aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsvc <svc@yandex-team.ru>2022-02-10 16:50:23 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:23 +0300
commitb52616d775abd70c27365aa9721e9ee71bfc77d2 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8
parenteb48c66d105713a2574106c798c8b6387643f5c7 (diff)
downloadydb-b52616d775abd70c27365aa9721e9ee71bfc77d2.tar.gz
Restoring authorship annotation for <svc@yandex-team.ru>. Commit 2 of 2.
-rw-r--r--library/cpp/actors/testlib/test_runtime.cpp16
-rw-r--r--library/cpp/actors/testlib/test_runtime.h2
-rw-r--r--library/cpp/mime/types/mime.cpp12
-rw-r--r--library/cpp/mime/types/mime.h2
-rw-r--r--ydb/core/base/appdata.cpp4
-rw-r--r--ydb/core/base/appdata.h2
-rw-r--r--ydb/core/base/blobstorage.h72
-rw-r--r--ydb/core/base/channel_profiles.h22
-rw-r--r--ydb/core/base/domain.h202
-rw-r--r--ydb/core/base/events.h26
-rw-r--r--ydb/core/base/hive.h206
-rw-r--r--ydb/core/base/kikimr_issue.txt2
-rw-r--r--ydb/core/base/localdb.cpp20
-rw-r--r--ydb/core/base/localdb.h16
-rw-r--r--ydb/core/base/localdb_ut.cpp2
-rw-r--r--ydb/core/base/path.cpp190
-rw-r--r--ydb/core/base/path.h28
-rw-r--r--ydb/core/base/pathid.cpp64
-rw-r--r--ydb/core/base/pathid.h28
-rw-r--r--ydb/core/base/resource_profile.h2
-rw-r--r--ydb/core/base/storage_pools.cpp24
-rw-r--r--ydb/core/base/storage_pools.h182
-rw-r--r--ydb/core/base/subdomain.cpp62
-rw-r--r--ydb/core/base/subdomain.h74
-rw-r--r--ydb/core/base/table_index.cpp160
-rw-r--r--ydb/core/base/table_index.h38
-rw-r--r--ydb/core/base/tabletid.h38
-rw-r--r--ydb/core/base/tx_processing.cpp170
-rw-r--r--ydb/core/base/tx_processing.h92
-rw-r--r--ydb/core/base/ya.make16
-rw-r--r--ydb/core/blobstorage/dsproxy/dsproxy.h4
-rw-r--r--ydb/core/blobstorage/dsproxy/dsproxy_collect.cpp2
-rw-r--r--ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp332
-rw-r--r--ydb/core/blobstorage/pdisk/blobstorage_pdisk_actor.cpp2
-rw-r--r--ydb/core/client/client_ut.cpp304
-rw-r--r--ydb/core/client/flat_ut.cpp112
-rw-r--r--ydb/core/client/flat_ut_client.h6
-rw-r--r--ydb/core/client/locks_ut.cpp8
-rw-r--r--ydb/core/client/minikql_compile/mkql_compile_service.cpp4
-rw-r--r--ydb/core/client/minikql_compile/mkql_compile_service.h2
-rw-r--r--ydb/core/client/minikql_result_lib/converter_ut.cpp10
-rw-r--r--ydb/core/client/s3_listing_ut.cpp2
-rw-r--r--ydb/core/client/scheme_cache_lib/yql_db_scheme_resolver.cpp8
-rw-r--r--ydb/core/client/server/msgbus_server.cpp2
-rw-r--r--ydb/core/client/server/msgbus_server.h2
-rw-r--r--ydb/core/client/server/msgbus_server_db.cpp118
-rw-r--r--ydb/core/client/server/msgbus_server_hive_create_tablet.cpp48
-rw-r--r--ydb/core/client/server/msgbus_server_local_enumerate_tablets.cpp8
-rw-r--r--ydb/core/client/server/msgbus_server_persqueue.cpp2
-rw-r--r--ydb/core/client/server/msgbus_server_proxy.cpp16
-rw-r--r--ydb/core/client/server/msgbus_server_request.cpp4
-rw-r--r--ydb/core/client/server/msgbus_server_request.h2
-rw-r--r--ydb/core/client/server/msgbus_server_s3_listing.cpp2
-rw-r--r--ydb/core/client/server/msgbus_server_scheme_initroot.cpp20
-rw-r--r--ydb/core/client/server/msgbus_server_scheme_request.cpp18
-rw-r--r--ydb/core/client/server/msgbus_server_tx_request.cpp14
-rw-r--r--ydb/core/cms/console/console.cpp2
-rw-r--r--ydb/core/cms/console/console__create_tenant.cpp12
-rw-r--r--ydb/core/cms/console/console__scheme.h4
-rw-r--r--ydb/core/cms/console/console_tenants_manager.cpp110
-rw-r--r--ydb/core/cms/console/console_tenants_manager.h10
-rw-r--r--ydb/core/cms/console/console_ut_configs.cpp6
-rw-r--r--ydb/core/cms/console/console_ut_tenants.cpp410
-rw-r--r--ydb/core/driver_lib/cli_base/cli_cmds_db.cpp400
-rw-r--r--ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp42
-rw-r--r--ydb/core/driver_lib/run/config.h4
-rw-r--r--ydb/core/driver_lib/run/config_parser.cpp2
-rw-r--r--ydb/core/driver_lib/run/kikimr_services_initializers.cpp218
-rw-r--r--ydb/core/driver_lib/run/kikimr_services_initializers.h50
-rw-r--r--ydb/core/driver_lib/run/run.cpp90
-rw-r--r--ydb/core/driver_lib/run/ya.make6
-rw-r--r--ydb/core/engine/mkql_proto.cpp44
-rw-r--r--ydb/core/grpc_services/base/base.h4
-rw-r--r--ydb/core/grpc_services/grpc_request_check_actor.h146
-rw-r--r--ydb/core/grpc_services/grpc_request_proxy.cpp12
-rw-r--r--ydb/core/grpc_services/grpc_request_proxy.h4
-rw-r--r--ydb/core/grpc_services/operation_helpers.cpp28
-rw-r--r--ydb/core/grpc_services/rpc_alter_coordination_node.cpp4
-rw-r--r--ydb/core/grpc_services/rpc_alter_table.cpp24
-rw-r--r--ydb/core/grpc_services/rpc_calls.h2
-rw-r--r--ydb/core/grpc_services/rpc_cancel_operation.cpp2
-rw-r--r--ydb/core/grpc_services/rpc_copy_table.cpp4
-rw-r--r--ydb/core/grpc_services/rpc_copy_tables.cpp100
-rw-r--r--ydb/core/grpc_services/rpc_create_coordination_node.cpp4
-rw-r--r--ydb/core/grpc_services/rpc_create_table.cpp14
-rw-r--r--ydb/core/grpc_services/rpc_describe_coordination_node.cpp18
-rw-r--r--ydb/core/grpc_services/rpc_describe_path.cpp16
-rw-r--r--ydb/core/grpc_services/rpc_describe_table.cpp16
-rw-r--r--ydb/core/grpc_services/rpc_describe_table_options.cpp10
-rw-r--r--ydb/core/grpc_services/rpc_discovery.cpp38
-rw-r--r--ydb/core/grpc_services/rpc_drop_coordination_node.cpp4
-rw-r--r--ydb/core/grpc_services/rpc_drop_table.cpp4
-rw-r--r--ydb/core/grpc_services/rpc_export.cpp2
-rw-r--r--ydb/core/grpc_services/rpc_forget_operation.cpp2
-rw-r--r--ydb/core/grpc_services/rpc_get_operation.cpp30
-rw-r--r--ydb/core/grpc_services/rpc_import.cpp2
-rw-r--r--ydb/core/grpc_services/rpc_list_operations.cpp2
-rw-r--r--ydb/core/grpc_services/rpc_log_store.cpp52
-rw-r--r--ydb/core/grpc_services/rpc_login.cpp12
-rw-r--r--ydb/core/grpc_services/rpc_make_directory.cpp4
-rw-r--r--ydb/core/grpc_services/rpc_modify_permissions.cpp16
-rw-r--r--ydb/core/grpc_services/rpc_read_table.cpp4
-rw-r--r--ydb/core/grpc_services/rpc_remove_directory.cpp4
-rw-r--r--ydb/core/grpc_services/rpc_rename_tables.cpp142
-rw-r--r--ydb/core/grpc_services/rpc_scheme_base.h36
-rw-r--r--ydb/core/grpc_services/table_profiles.cpp18
-rw-r--r--ydb/core/grpc_services/table_profiles.h10
-rw-r--r--ydb/core/grpc_services/table_settings.cpp4
-rw-r--r--ydb/core/grpc_services/table_settings.h4
-rw-r--r--ydb/core/grpc_services/ya.make4
-rw-r--r--ydb/core/health_check/health_check.cpp12
-rw-r--r--ydb/core/keyvalue/keyvalue_collector.cpp2
-rw-r--r--ydb/core/kqp/kqp_ic_gateway.cpp138
-rw-r--r--ydb/core/kqp/kqp_metadata_loader.cpp6
-rw-r--r--ydb/core/kqp/provider/yql_kikimr_datasink.cpp2
-rw-r--r--ydb/core/kqp/provider/yql_kikimr_exec.cpp20
-rw-r--r--ydb/core/kqp/provider/yql_kikimr_gateway.cpp24
-rw-r--r--ydb/core/kqp/provider/yql_kikimr_gateway.h10
-rw-r--r--ydb/core/kqp/provider/yql_kikimr_gateway_ut.cpp4
-rw-r--r--ydb/core/kqp/provider/yql_kikimr_type_ann.cpp6
-rw-r--r--ydb/core/kqp/proxy/kqp_proxy_ut.cpp14
-rw-r--r--ydb/core/kqp/ut/common/kqp_ut_common.cpp2
-rw-r--r--ydb/core/kqp/ut/kqp_scheme_ut.cpp222
-rw-r--r--ydb/core/metering/metering.cpp256
-rw-r--r--ydb/core/metering/metering.h118
-rw-r--r--ydb/core/metering/time_grid.h86
-rw-r--r--ydb/core/metering/ya.make42
-rw-r--r--ydb/core/mind/bscontroller/impl.h2
-rw-r--r--ydb/core/mind/hive/hive_impl.cpp62
-rw-r--r--ydb/core/mind/hive/hive_impl.h12
-rw-r--r--ydb/core/mind/hive/hive_ut.cpp722
-rw-r--r--ydb/core/mind/hive/monitoring.cpp14
-rw-r--r--ydb/core/mind/hive/tx__adopt_tablet.cpp188
-rw-r--r--ydb/core/mind/hive/tx__block_storage_result.cpp8
-rw-r--r--ydb/core/mind/hive/tx__create_tablet.cpp38
-rw-r--r--ydb/core/mind/hive/tx__delete_tablet.cpp100
-rw-r--r--ydb/core/mind/hive/tx__load_everything.cpp6
-rw-r--r--ydb/core/mind/hive/tx__reassign_groups.cpp2
-rw-r--r--ydb/core/mind/hive/tx__update_tablet_groups.cpp26
-rw-r--r--ydb/core/mind/hive/ya.make2
-rw-r--r--ydb/core/mind/local.cpp190
-rw-r--r--ydb/core/mind/local.h18
-rw-r--r--ydb/core/mind/node_broker_ut.cpp4
-rw-r--r--ydb/core/mind/tenant_ut_pool.cpp2
-rw-r--r--ydb/core/persqueue/pq_ut.cpp6
-rw-r--r--ydb/core/persqueue/read_balancer.cpp6
-rw-r--r--ydb/core/persqueue/read_balancer.h4
-rw-r--r--ydb/core/protos/base.proto2
-rw-r--r--ydb/core/protos/bind_channel_storage_pool.proto22
-rw-r--r--ydb/core/protos/blobstorage.proto2
-rw-r--r--ydb/core/protos/channel_purpose.proto36
-rw-r--r--ydb/core/protos/config.proto56
-rw-r--r--ydb/core/protos/console_config.proto2
-rw-r--r--ydb/core/protos/counters_datashard.proto2
-rw-r--r--ydb/core/protos/counters_hive.proto2
-rw-r--r--ydb/core/protos/counters_mediator.proto22
-rw-r--r--ydb/core/protos/counters_schemeshard.proto198
-rw-r--r--ydb/core/protos/counters_tx_allocator.proto50
-rw-r--r--ydb/core/protos/flat_scheme_op.proto502
-rw-r--r--ydb/core/protos/flat_tx_scheme.proto406
-rw-r--r--ydb/core/protos/follower_group.proto18
-rw-r--r--ydb/core/protos/hive.proto80
-rw-r--r--ydb/core/protos/index_builder.proto158
-rw-r--r--ydb/core/protos/issue_id.proto2
-rw-r--r--ydb/core/protos/local.proto4
-rw-r--r--ydb/core/protos/msgbus.proto16
-rw-r--r--ydb/core/protos/scheme_board.proto28
-rw-r--r--ydb/core/protos/scheme_log.proto2
-rw-r--r--ydb/core/protos/services.proto28
-rw-r--r--ydb/core/protos/subdomains.proto74
-rw-r--r--ydb/core/protos/tablet.proto2
-rw-r--r--ydb/core/protos/tenant_pool.proto2
-rw-r--r--ydb/core/protos/tx.proto54
-rw-r--r--ydb/core/protos/tx_datashard.proto286
-rw-r--r--ydb/core/protos/tx_proxy.proto8
-rw-r--r--ydb/core/protos/ya.make12
-rw-r--r--ydb/core/scheme/scheme_tabledefs.h4
-rw-r--r--ydb/core/security/secure_request.h8
-rw-r--r--ydb/core/tablet/resource_broker.cpp18
-rw-r--r--ydb/core/tablet/tablet_counters.h30
-rw-r--r--ydb/core/tablet/tablet_counters_aggregator.cpp48
-rw-r--r--ydb/core/tablet/tablet_counters_app.cpp6
-rw-r--r--ydb/core/tablet/tablet_monitoring_proxy.cpp10
-rw-r--r--ydb/core/tablet/tablet_pipe_client.cpp2
-rw-r--r--ydb/core/tablet/tablet_pipe_client_cache.cpp12
-rw-r--r--ydb/core/tablet/tablet_pipe_client_cache.h2
-rw-r--r--ydb/core/tablet/tablet_req_blockbs.cpp2
-rw-r--r--ydb/core/tablet/tablet_req_delete.cpp2
-rw-r--r--ydb/core/tablet/tablet_req_findlatest.cpp6
-rw-r--r--ydb/core/tablet/tablet_req_rebuildhistory.cpp2
-rw-r--r--ydb/core/tablet/tablet_sys.cpp2
-rw-r--r--ydb/core/tablet_flat/flat_boot_switch.h2
-rw-r--r--ydb/core/tablet_flat/flat_boot_turns.h2
-rw-r--r--ydb/core/tablet_flat/flat_cxx_database.h24
-rw-r--r--ydb/core/tablet_flat/flat_dbase_apply.cpp2
-rw-r--r--ydb/core/tablet_flat/flat_dbase_apply.h2
-rw-r--r--ydb/core/tablet_flat/flat_dbase_scheme.cpp4
-rw-r--r--ydb/core/tablet_flat/flat_dbase_scheme.h12
-rw-r--r--ydb/core/tablet_flat/flat_executor.cpp4
-rw-r--r--ydb/core/tablet_flat/flat_executor.h4
-rw-r--r--ydb/core/tablet_flat/flat_executor.proto2
-rw-r--r--ydb/core/tablet_flat/flat_executor_compaction_logic.cpp12
-rw-r--r--ydb/core/tablet_flat/flat_executor_compaction_logic.h12
-rw-r--r--ydb/core/tablet_flat/flat_executor_ut.cpp6
-rw-r--r--ydb/core/tablet_flat/tablet_flat_executed.h58
-rw-r--r--ydb/core/tablet_flat/test/libs/exec/fuzzy.h2
-rw-r--r--ydb/core/tablet_flat/test/libs/exec/runner.h2
-rw-r--r--ydb/core/tablet_flat/ut/ut_db_iface.cpp4
-rw-r--r--ydb/core/testlib/actors/test_runtime.cpp18
-rw-r--r--ydb/core/testlib/actors/test_runtime.h2
-rw-r--r--ydb/core/testlib/basics/appdata.h2
-rw-r--r--ydb/core/testlib/basics/services.cpp6
-rw-r--r--ydb/core/testlib/basics/storage.h2
-rw-r--r--ydb/core/testlib/fake_coordinator.h110
-rw-r--r--ydb/core/testlib/fake_scheme_shard.h8
-rw-r--r--ydb/core/testlib/tablet_helpers.cpp670
-rw-r--r--ydb/core/testlib/tablet_helpers.h12
-rw-r--r--ydb/core/testlib/tenant_runtime.cpp206
-rw-r--r--ydb/core/testlib/tenant_runtime.h2
-rw-r--r--ydb/core/testlib/test_client.cpp1702
-rw-r--r--ydb/core/testlib/test_client.h334
-rw-r--r--ydb/core/testlib/test_pq_client.h2
-rw-r--r--ydb/core/tx/balance_coverage/defs.h2
-rw-r--r--ydb/core/tx/balance_coverage/ut/ya.make34
-rw-r--r--ydb/core/tx/balance_coverage/ya.make28
-rw-r--r--ydb/core/tx/columnshard/columnshard_ut_common.h4
-rw-r--r--ydb/core/tx/coordinator/coordinator.cpp152
-rw-r--r--ydb/core/tx/coordinator/coordinator.h34
-rw-r--r--ydb/core/tx/coordinator/coordinator__check.cpp2
-rw-r--r--ydb/core/tx/coordinator/coordinator__check.h6
-rw-r--r--ydb/core/tx/coordinator/coordinator__configure.cpp146
-rw-r--r--ydb/core/tx/coordinator/coordinator__init.cpp178
-rw-r--r--ydb/core/tx/coordinator/coordinator__mediators_confirmations.cpp18
-rw-r--r--ydb/core/tx/coordinator/coordinator__monitoring.cpp4
-rw-r--r--ydb/core/tx/coordinator/coordinator__plan_step.cpp56
-rw-r--r--ydb/core/tx/coordinator/coordinator__restart_mediator.cpp4
-rw-r--r--ydb/core/tx/coordinator/coordinator__restore_transaction.cpp16
-rw-r--r--ydb/core/tx/coordinator/coordinator__schema.cpp2
-rw-r--r--ydb/core/tx/coordinator/coordinator__schema_upgrade.cpp66
-rw-r--r--ydb/core/tx/coordinator/coordinator_impl.cpp86
-rw-r--r--ydb/core/tx/coordinator/coordinator_impl.h306
-rw-r--r--ydb/core/tx/coordinator/defs.h2
-rw-r--r--ydb/core/tx/coordinator/mediator_queue.cpp6
-rw-r--r--ydb/core/tx/coordinator/ya.make54
-rw-r--r--ydb/core/tx/datashard/alter_cdc_stream_unit.cpp2
-rw-r--r--ydb/core/tx/datashard/alter_table_unit.cpp10
-rw-r--r--ydb/core/tx/datashard/build_scheme_tx_out_rs_unit.cpp16
-rw-r--r--ydb/core/tx/datashard/change_collector_cdc_stream.cpp24
-rw-r--r--ydb/core/tx/datashard/change_sender_async_index.cpp2
-rw-r--r--ydb/core/tx/datashard/check_scheme_tx_unit.cpp176
-rw-r--r--ydb/core/tx/datashard/check_snapshot_tx_unit.cpp2
-rw-r--r--ydb/core/tx/datashard/create_table_unit.cpp6
-rw-r--r--ydb/core/tx/datashard/datashard.cpp366
-rw-r--r--ydb/core/tx/datashard/datashard.h130
-rw-r--r--ydb/core/tx/datashard/datashard__build_index.cpp1116
-rw-r--r--ydb/core/tx/datashard/datashard__conditional_erase_rows.cpp14
-rw-r--r--ydb/core/tx/datashard/datashard__init.cpp86
-rw-r--r--ydb/core/tx/datashard/datashard__migrate_schemeshard.cpp116
-rw-r--r--ydb/core/tx/datashard/datashard__monitoring.cpp2
-rw-r--r--ydb/core/tx/datashard/datashard__read_columns.cpp2
-rw-r--r--ydb/core/tx/datashard/datashard__stats.cpp2
-rw-r--r--ydb/core/tx/datashard/datashard_active_transaction.cpp36
-rw-r--r--ydb/core/tx/datashard/datashard_active_transaction.h20
-rw-r--r--ydb/core/tx/datashard/datashard_build_index.h110
-rw-r--r--ydb/core/tx/datashard/datashard_change_receiving.cpp8
-rw-r--r--ydb/core/tx/datashard/datashard_dep_tracker.cpp8
-rw-r--r--ydb/core/tx/datashard/datashard_dep_tracker.h6
-rw-r--r--ydb/core/tx/datashard/datashard_distributed_erase.cpp8
-rw-r--r--ydb/core/tx/datashard/datashard_impl.h110
-rw-r--r--ydb/core/tx/datashard/datashard_locks.cpp10
-rw-r--r--ydb/core/tx/datashard/datashard_locks.h12
-rw-r--r--ydb/core/tx/datashard/datashard_pipeline.cpp24
-rw-r--r--ydb/core/tx/datashard/datashard_pipeline.h12
-rw-r--r--ydb/core/tx/datashard/datashard_split_dst.cpp40
-rw-r--r--ydb/core/tx/datashard/datashard_subdomain_path_id.cpp8
-rw-r--r--ydb/core/tx/datashard/datashard_txs.h18
-rw-r--r--ydb/core/tx/datashard/datashard_user_table.cpp102
-rw-r--r--ydb/core/tx/datashard/datashard_user_table.h252
-rw-r--r--ydb/core/tx/datashard/datashard_ut_background_compaction.cpp2
-rw-r--r--ydb/core/tx/datashard/datashard_ut_build_index.cpp270
-rw-r--r--ydb/core/tx/datashard/datashard_ut_change_collector.cpp18
-rw-r--r--ydb/core/tx/datashard/datashard_ut_change_exchange.cpp8
-rw-r--r--ydb/core/tx/datashard/datashard_ut_common.cpp202
-rw-r--r--ydb/core/tx/datashard/datashard_ut_common.h18
-rw-r--r--ydb/core/tx/datashard/datashard_ut_erase_rows.cpp48
-rw-r--r--ydb/core/tx/datashard/datashard_ut_followers.cpp2
-rw-r--r--ydb/core/tx/datashard/datashard_ut_init.cpp20
-rw-r--r--ydb/core/tx/datashard/datashard_ut_kqp_scan.cpp2
-rw-r--r--ydb/core/tx/datashard/datashard_ut_locks.cpp24
-rw-r--r--ydb/core/tx/datashard/datashard_ut_minstep.cpp236
-rw-r--r--ydb/core/tx/datashard/datashard_ut_order.cpp4
-rw-r--r--ydb/core/tx/datashard/datashard_ut_range_ops.cpp1752
-rw-r--r--ydb/core/tx/datashard/datashard_ut_read_table.cpp2
-rw-r--r--ydb/core/tx/datashard/datashard_ut_reassign.cpp2
-rw-r--r--ydb/core/tx/datashard/datashard_ut_rs.cpp2
-rw-r--r--ydb/core/tx/datashard/datashard_ut_snapshot.cpp2
-rw-r--r--ydb/core/tx/datashard/datashard_ut_stats.cpp2
-rw-r--r--ydb/core/tx/datashard/datashard_ut_upload_rows.cpp10
-rw-r--r--ydb/core/tx/datashard/drop_index_notice_unit.cpp92
-rw-r--r--ydb/core/tx/datashard/drop_table_unit.cpp12
-rw-r--r--ydb/core/tx/datashard/erase_rows_condition.cpp18
-rw-r--r--ydb/core/tx/datashard/execution_unit.cpp16
-rw-r--r--ydb/core/tx/datashard/execution_unit_kind.h8
-rw-r--r--ydb/core/tx/datashard/export_common.cpp2
-rw-r--r--ydb/core/tx/datashard/export_common.h2
-rw-r--r--ydb/core/tx/datashard/export_s3_base_uploader.h2
-rw-r--r--ydb/core/tx/datashard/finalize_build_index_unit.cpp136
-rw-r--r--ydb/core/tx/datashard/import_s3.cpp8
-rw-r--r--ydb/core/tx/datashard/import_s3.h4
-rw-r--r--ydb/core/tx/datashard/initiate_build_index_unit.cpp122
-rw-r--r--ydb/core/tx/datashard/make_snapshot_unit.cpp10
-rw-r--r--ydb/core/tx/datashard/move_table_unit.cpp162
-rw-r--r--ydb/core/tx/datashard/range_ops.cpp424
-rw-r--r--ydb/core/tx/datashard/range_ops.h22
-rw-r--r--ydb/core/tx/datashard/restore_unit.cpp2
-rw-r--r--ydb/core/tx/datashard/s3_common.h14
-rw-r--r--ydb/core/tx/datashard/store_scheme_tx_unit.cpp28
-rw-r--r--ydb/core/tx/datashard/sys_tables.h32
-rw-r--r--ydb/core/tx/datashard/upload_stats.cpp56
-rw-r--r--ydb/core/tx/datashard/upload_stats.h86
-rw-r--r--ydb/core/tx/datashard/ya.make12
-rw-r--r--ydb/core/tx/mediator/defs.h2
-rw-r--r--ydb/core/tx/mediator/execute_queue.cpp18
-rw-r--r--ydb/core/tx/mediator/mediator.cpp6
-rw-r--r--ydb/core/tx/mediator/mediator.h16
-rw-r--r--ydb/core/tx/mediator/mediator__configure.cpp170
-rw-r--r--ydb/core/tx/mediator/mediator__init.cpp194
-rw-r--r--ydb/core/tx/mediator/mediator__schema.cpp64
-rw-r--r--ydb/core/tx/mediator/mediator__schema_upgrade.cpp126
-rw-r--r--ydb/core/tx/mediator/mediator_impl.cpp608
-rw-r--r--ydb/core/tx/mediator/mediator_impl.h282
-rw-r--r--ydb/core/tx/mediator/tablet_queue.cpp60
-rw-r--r--ydb/core/tx/mediator/ya.make42
-rw-r--r--ydb/core/tx/message_seqno.h24
-rw-r--r--ydb/core/tx/scheme_board/cache.cpp466
-rw-r--r--ydb/core/tx/scheme_board/cache_ut.cpp830
-rw-r--r--ydb/core/tx/scheme_board/double_indexed.h20
-rw-r--r--ydb/core/tx/scheme_board/events.h110
-rw-r--r--ydb/core/tx/scheme_board/helpers.cpp90
-rw-r--r--ydb/core/tx/scheme_board/helpers.h14
-rw-r--r--ydb/core/tx/scheme_board/load_test.cpp48
-rw-r--r--ydb/core/tx/scheme_board/populator.cpp236
-rw-r--r--ydb/core/tx/scheme_board/replica.cpp358
-rw-r--r--ydb/core/tx/scheme_board/replica_ut.cpp704
-rw-r--r--ydb/core/tx/scheme_board/subscriber.cpp174
-rw-r--r--ydb/core/tx/scheme_board/subscriber_ut.cpp512
-rw-r--r--ydb/core/tx/scheme_board/two_part_description.h4
-rw-r--r--ydb/core/tx/scheme_board/ut_helpers.cpp236
-rw-r--r--ydb/core/tx/scheme_board/ut_helpers.h116
-rw-r--r--ydb/core/tx/scheme_cache/scheme_cache.cpp22
-rw-r--r--ydb/core/tx/scheme_cache/scheme_cache.h236
-rw-r--r--ydb/core/tx/scheme_cache/ya.make28
-rw-r--r--ydb/core/tx/schemeshard/schemeshard.cpp144
-rw-r--r--ydb/core/tx/schemeshard/schemeshard.h480
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__clean_pathes.cpp124
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__compaction.cpp6
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__conditional_erase.cpp20
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__delete_tablet_reply.cpp162
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__describe_scheme.cpp50
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__find_subdomain_path_id.cpp28
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__fix_bad_paths.cpp18
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__init.cpp5056
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__init_populator.cpp66
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__init_root.cpp1230
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__init_schema.cpp12
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__login.cpp12
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__make_access_database_no_inheritable.cpp248
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__monitoring.cpp2010
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__notify.cpp148
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation.cpp1928
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation.h226
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp642
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_alter_cdc_stream.cpp32
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_alter_extsubdomain.cpp848
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_alter_fs.cpp32
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_alter_index.cpp534
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_alter_kesus.cpp752
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_alter_login.cpp8
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_alter_olap_store.cpp56
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_alter_olap_table.cpp32
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_alter_pq.cpp798
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_alter_solomon.cpp662
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_alter_subdomain.cpp690
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_alter_table.cpp922
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_alter_user_attrs.cpp310
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_apply_build_index.cpp266
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_assign_bsv.cpp184
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_backup_restore_common.h870
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_cancel_tx.cpp146
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_common.cpp816
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_common.h2518
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_consistent_copy_tables.cpp266
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp1280
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_backup.cpp98
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_bsv.cpp614
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_build_index.cpp154
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_cdc_stream.cpp64
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_extsubdomain.cpp538
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_fs.cpp34
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_index.cpp614
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_indexed_table.cpp378
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_kesus.cpp850
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_lock.cpp608
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_olap_store.cpp52
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_olap_table.cpp82
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_pq.cpp704
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_restore.cpp4
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_rtmr.cpp792
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_sequence.cpp18
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_solomon.cpp902
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_subdomain.cpp682
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_create_table.cpp1242
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_db_changes.cpp118
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_db_changes.h138
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_drop_bsv.cpp606
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_drop_cdc_stream.cpp30
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_drop_extsubdomain.cpp836
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_drop_fs.cpp30
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_drop_index.cpp1020
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_drop_indexed_table.cpp974
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_drop_kesus.cpp588
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_drop_lock.cpp428
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_drop_olap_store.cpp22
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_drop_olap_table.cpp18
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_drop_pq.cpp894
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_drop_sequence.cpp8
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_drop_solomon.cpp556
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_drop_subdomain.cpp564
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_drop_table.cpp1316
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_drop_unsafe.cpp640
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_finalize_build_index.cpp892
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_initiate_build_index.cpp868
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_just_reject.cpp104
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_memory_changes.cpp272
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_memory_changes.h122
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_mkdir.cpp510
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_modify_acl.cpp242
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_move_table.cpp1586
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_move_table_index.cpp1246
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_move_tables.cpp260
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_part.cpp206
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_part.h484
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_rmdir.cpp362
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_side_effects.cpp1894
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_side_effects.h330
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_split_merge.cpp1782
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_upgrade_subdomain.cpp3136
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__publish_to_scheme_board.cpp66
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__serverless_storage_billing.cpp410
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__state_changed_reply.cpp150
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__sync_update_tenants.cpp342
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__table_stats.cpp202
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__table_stats_histogram.cpp272
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__upgrade_access_database.cpp298
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__upgrade_schema.cpp256
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_billing_helpers.cpp4
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_billing_helpers.h4
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_build_index.cpp350
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_build_index.h252
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_build_index__cancel.cpp264
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_build_index__create.cpp404
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_build_index__forget.cpp232
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_build_index__get.cpp208
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_build_index__list.cpp256
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_build_index__progress.cpp2562
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_build_index_helpers.h38
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_build_index_tx_base.h752
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_domain_links.cpp230
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_domain_links.h142
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_effective_acl.cpp174
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_effective_acl.h60
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_export.cpp42
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_export.h4
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_export__cancel.cpp20
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_export__create.cpp52
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_export__forget.cpp8
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_export__get.cpp8
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_export__list.cpp10
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_export_flow_proposals.cpp68
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_export_flow_proposals.h28
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_identificators.cpp10
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_identificators.h246
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_impl.cpp6880
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_impl.h1110
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_import.cpp32
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_import.h4
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_import__cancel.cpp18
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_import__create.cpp40
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_import__forget.cpp8
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_import__get.cpp8
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_import__list.cpp10
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_import_flow_proposals.cpp48
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_import_flow_proposals.h22
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_import_scheme_getter.cpp4
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_import_scheme_getter.h4
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_import_scheme_getter_fallback.cpp4
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_info_types.cpp2614
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_info_types.h2488
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_path.cpp2858
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_path.h288
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_path_describer.cpp496
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_path_describer.h50
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_path_element.h866
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_private.h148
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_schema.h2222
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_tx_infly.h804
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_types.cpp152
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_types.h174
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_ui64id.cpp2
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_ui64id.h242
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_user_attr_limits.h2
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_utils.cpp938
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_utils.h264
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_validate_ttl.cpp2
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_xxport__get.h6
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_xxport__list.h6
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_xxport__tx_base.h24
-rw-r--r--ydb/core/tx/schemeshard/ut_async_index.cpp8
-rw-r--r--ydb/core/tx/schemeshard/ut_base.cpp9796
-rw-r--r--ydb/core/tx/schemeshard/ut_base/ya.make24
-rw-r--r--ydb/core/tx/schemeshard/ut_base_reboots.cpp1828
-rw-r--r--ydb/core/tx/schemeshard/ut_base_reboots/ya.make10
-rw-r--r--ydb/core/tx/schemeshard/ut_bsvolume.cpp4
-rw-r--r--ydb/core/tx/schemeshard/ut_bsvolume/ya.make2
-rw-r--r--ydb/core/tx/schemeshard/ut_bsvolume_reboots.cpp500
-rw-r--r--ydb/core/tx/schemeshard/ut_bsvolume_reboots/ya.make10
-rw-r--r--ydb/core/tx/schemeshard/ut_cdc_stream.cpp22
-rw-r--r--ydb/core/tx/schemeshard/ut_export.cpp50
-rw-r--r--ydb/core/tx/schemeshard/ut_export_reboots_s3.cpp508
-rw-r--r--ydb/core/tx/schemeshard/ut_export_reboots_s3/ya.make64
-rw-r--r--ydb/core/tx/schemeshard/ut_extsubdomain.cpp1396
-rw-r--r--ydb/core/tx/schemeshard/ut_extsubdomain/ya.make42
-rw-r--r--ydb/core/tx/schemeshard/ut_extsubdomain_reboots.cpp366
-rw-r--r--ydb/core/tx/schemeshard/ut_extsubdomain_reboots/ya.make8
-rw-r--r--ydb/core/tx/schemeshard/ut_filestore_reboots.cpp30
-rw-r--r--ydb/core/tx/schemeshard/ut_helpers/failing_mtpq.cpp66
-rw-r--r--ydb/core/tx/schemeshard/ut_helpers/helpers.cpp2000
-rw-r--r--ydb/core/tx/schemeshard/ut_helpers/helpers.h276
-rw-r--r--ydb/core/tx/schemeshard/ut_helpers/ls_checks.cpp1338
-rw-r--r--ydb/core/tx/schemeshard/ut_helpers/ls_checks.h210
-rw-r--r--ydb/core/tx/schemeshard/ut_helpers/test_env.cpp1512
-rw-r--r--ydb/core/tx/schemeshard/ut_helpers/test_env.h218
-rw-r--r--ydb/core/tx/schemeshard/ut_helpers/ya.make14
-rw-r--r--ydb/core/tx/schemeshard/ut_index_build.cpp1406
-rw-r--r--ydb/core/tx/schemeshard/ut_index_build_reboots.cpp454
-rw-r--r--ydb/core/tx/schemeshard/ut_index_build_reboots/ya.make34
-rw-r--r--ydb/core/tx/schemeshard/ut_info_types.cpp6
-rw-r--r--ydb/core/tx/schemeshard/ut_login.cpp2
-rw-r--r--ydb/core/tx/schemeshard/ut_move.cpp1658
-rw-r--r--ydb/core/tx/schemeshard/ut_move/ya.make40
-rw-r--r--ydb/core/tx/schemeshard/ut_move_reboots.cpp618
-rw-r--r--ydb/core/tx/schemeshard/ut_move_reboots/ya.make20
-rw-r--r--ydb/core/tx/schemeshard/ut_olap.cpp20
-rw-r--r--ydb/core/tx/schemeshard/ut_olap_reboots.cpp24
-rw-r--r--ydb/core/tx/schemeshard/ut_pq/ya.make4
-rw-r--r--ydb/core/tx/schemeshard/ut_pq_reboots.cpp634
-rw-r--r--ydb/core/tx/schemeshard/ut_pq_reboots/ya.make10
-rw-r--r--ydb/core/tx/schemeshard/ut_reboots.cpp1222
-rw-r--r--ydb/core/tx/schemeshard/ut_restore.cpp82
-rw-r--r--ydb/core/tx/schemeshard/ut_rtmr.cpp36
-rw-r--r--ydb/core/tx/schemeshard/ut_rtmr/ya.make2
-rw-r--r--ydb/core/tx/schemeshard/ut_rtmr_reboots.cpp106
-rw-r--r--ydb/core/tx/schemeshard/ut_rtmr_reboots/ya.make10
-rw-r--r--ydb/core/tx/schemeshard/ut_ru_calculator.cpp2
-rw-r--r--ydb/core/tx/schemeshard/ut_sequence.cpp16
-rw-r--r--ydb/core/tx/schemeshard/ut_sequence_reboots.cpp20
-rw-r--r--ydb/core/tx/schemeshard/ut_serverless.cpp458
-rw-r--r--ydb/core/tx/schemeshard/ut_serverless/ya.make34
-rw-r--r--ydb/core/tx/schemeshard/ut_split_merge.cpp512
-rw-r--r--ydb/core/tx/schemeshard/ut_split_merge/ya.make2
-rw-r--r--ydb/core/tx/schemeshard/ut_split_merge_reboots.cpp2244
-rw-r--r--ydb/core/tx/schemeshard/ut_split_merge_reboots/ya.make20
-rw-r--r--ydb/core/tx/schemeshard/ut_subdomain.cpp3910
-rw-r--r--ydb/core/tx/schemeshard/ut_subdomain/ya.make6
-rw-r--r--ydb/core/tx/schemeshard/ut_subdomain_reboots.cpp1676
-rw-r--r--ydb/core/tx/schemeshard/ut_subdomain_reboots/ya.make10
-rw-r--r--ydb/core/tx/schemeshard/ut_ttl.cpp74
-rw-r--r--ydb/core/tx/schemeshard/ut_upgradesubdomain.cpp1492
-rw-r--r--ydb/core/tx/schemeshard/ut_upgradesubdomain/ya.make8
-rw-r--r--ydb/core/tx/schemeshard/ut_upgradesubdomain_reboots.cpp2168
-rw-r--r--ydb/core/tx/schemeshard/ut_upgradesubdomain_reboots/ya.make46
-rw-r--r--ydb/core/tx/schemeshard/ut_user_attributes.cpp412
-rw-r--r--ydb/core/tx/schemeshard/ut_user_attributes/ya.make24
-rw-r--r--ydb/core/tx/schemeshard/ut_user_attributes_reboots.cpp290
-rw-r--r--ydb/core/tx/schemeshard/ut_user_attributes_reboots/ya.make10
-rw-r--r--ydb/core/tx/schemeshard/ya.make198
-rw-r--r--ydb/core/tx/sequenceproxy/sequenceproxy_ut.cpp6
-rw-r--r--ydb/core/tx/time_cast/defs.h2
-rw-r--r--ydb/core/tx/time_cast/time_cast.cpp24
-rw-r--r--ydb/core/tx/time_cast/time_cast.h18
-rw-r--r--ydb/core/tx/time_cast/ya.make28
-rw-r--r--ydb/core/tx/tx.cpp86
-rw-r--r--ydb/core/tx/tx.h100
-rw-r--r--ydb/core/tx/tx_allocator/defs.h2
-rw-r--r--ydb/core/tx/tx_allocator/txallocator.cpp34
-rw-r--r--ydb/core/tx/tx_allocator/txallocator.h118
-rw-r--r--ydb/core/tx/tx_allocator/txallocator__reserve.cpp144
-rw-r--r--ydb/core/tx/tx_allocator/txallocator__scheme.cpp66
-rw-r--r--ydb/core/tx/tx_allocator/txallocator_impl.cpp182
-rw-r--r--ydb/core/tx/tx_allocator/txallocator_impl.h220
-rw-r--r--ydb/core/tx/tx_allocator/txallocator_ut.cpp180
-rw-r--r--ydb/core/tx/tx_allocator/txallocator_ut_helpers.cpp174
-rw-r--r--ydb/core/tx/tx_allocator/txallocator_ut_helpers.h104
-rw-r--r--ydb/core/tx/tx_allocator/ut/ya.make26
-rw-r--r--ydb/core/tx/tx_allocator/ya.make34
-rw-r--r--ydb/core/tx/tx_allocator_client/actor_client.cpp20
-rw-r--r--ydb/core/tx/tx_allocator_client/actor_client.h32
-rw-r--r--ydb/core/tx/tx_allocator_client/client.cpp212
-rw-r--r--ydb/core/tx/tx_allocator_client/client.h68
-rw-r--r--ydb/core/tx/tx_processing.h16
-rw-r--r--ydb/core/tx/tx_proxy/datareq.cpp242
-rw-r--r--ydb/core/tx/tx_proxy/defs.h2
-rw-r--r--ydb/core/tx/tx_proxy/describe.cpp156
-rw-r--r--ydb/core/tx/tx_proxy/encrypted_storage_ut.cpp220
-rw-r--r--ydb/core/tx/tx_proxy/mon.cpp14
-rw-r--r--ydb/core/tx/tx_proxy/mon.h18
-rw-r--r--ydb/core/tx/tx_proxy/proxy.cpp6
-rw-r--r--ydb/core/tx/tx_proxy/proxy.h62
-rw-r--r--ydb/core/tx/tx_proxy/proxy_ext_tenant_ut.cpp1088
-rw-r--r--ydb/core/tx/tx_proxy/proxy_impl.cpp518
-rw-r--r--ydb/core/tx/tx_proxy/proxy_ut.cpp1832
-rw-r--r--ydb/core/tx/tx_proxy/proxy_ut_helpers.cpp924
-rw-r--r--ydb/core/tx/tx_proxy/proxy_ut_helpers.h400
-rw-r--r--ydb/core/tx/tx_proxy/schemereq.cpp2220
-rw-r--r--ydb/core/tx/tx_proxy/storage_tenant_ut.cpp1094
-rw-r--r--ydb/core/tx/tx_proxy/upload_rows.cpp6
-rw-r--r--ydb/core/tx/tx_proxy/upload_rows.h4
-rw-r--r--ydb/core/tx/tx_proxy/upload_rows_common_impl.h2
-rw-r--r--ydb/core/tx/tx_proxy/ut_base_tenant/ya.make40
-rw-r--r--ydb/core/tx/tx_proxy/ut_encrypted_storage/ya.make44
-rw-r--r--ydb/core/tx/tx_proxy/ut_ext_tenant/ya.make44
-rw-r--r--ydb/core/tx/tx_proxy/ut_storage_tenant/ya.make42
-rw-r--r--ydb/core/tx/tx_proxy/ya.make32
-rw-r--r--ydb/core/tx/ya.make2
-rw-r--r--ydb/core/util/yverify_stream.h2
-rw-r--r--ydb/core/viewer/browse.h48
-rw-r--r--ydb/core/viewer/browse_db.h12
-rw-r--r--ydb/core/viewer/browse_pq.h22
-rw-r--r--ydb/core/viewer/content/viewer.js86
-rw-r--r--ydb/core/viewer/json_cluster.h12
-rw-r--r--ydb/core/viewer/json_config.h2
-rw-r--r--ydb/core/viewer/json_describe.h12
-rw-r--r--ydb/core/viewer/json_hotkeys.h8
-rw-r--r--ydb/core/viewer/json_nodes.h10
-rw-r--r--ydb/core/viewer/json_storage.h2
-rw-r--r--ydb/core/viewer/json_tabletcounters.h24
-rw-r--r--ydb/core/viewer/json_tabletinfo.h10
-rw-r--r--ydb/core/viewer/protos/viewer.proto52
-rw-r--r--ydb/core/viewer/viewer.cpp8
-rw-r--r--ydb/core/viewer/viewer.h2
-rw-r--r--ydb/core/ydb_convert/column_families.h16
-rw-r--r--ydb/core/ydb_convert/table_description.cpp112
-rw-r--r--ydb/core/ydb_convert/table_description.h44
-rw-r--r--ydb/core/ydb_convert/table_settings.cpp4
-rw-r--r--ydb/core/ydb_convert/table_settings.h8
-rw-r--r--ydb/core/ydb_convert/ydb_convert.cpp62
-rw-r--r--ydb/core/ydb_convert/ydb_convert.h26
-rw-r--r--ydb/core/ymq/actor/executor.cpp6
-rw-r--r--ydb/core/ymq/actor/executor.h4
-rw-r--r--ydb/core/ymq/actor/garbage_collector.cpp4
-rw-r--r--ydb/core/ymq/actor/list_permissions.cpp12
-rw-r--r--ydb/core/ymq/actor/list_users.cpp26
-rw-r--r--ydb/core/ymq/actor/migration.cpp2
-rw-r--r--ydb/core/ymq/actor/modify_permissions.cpp4
-rw-r--r--ydb/core/ymq/actor/queue_schema.cpp8
-rw-r--r--ydb/core/ymq/actor/queue_schema.h2
-rw-r--r--ydb/core/ymq/actor/schema.cpp30
-rw-r--r--ydb/core/ymq/actor/service.cpp10
-rw-r--r--ydb/core/ymq/actor/service.h2
-rw-r--r--ydb/core/ymq/actor/yc_search_ut/index_events_processor_ut.cpp2
-rw-r--r--ydb/core/yql_testlib/yql_testlib.cpp10
-rw-r--r--ydb/core/yql_testlib/yql_testlib.h8
-rw-r--r--ydb/library/aclib/aclib.cpp26
-rw-r--r--ydb/library/aclib/aclib.h12
-rw-r--r--ydb/library/backup/query_uploader.cpp26
-rw-r--r--ydb/library/backup/query_uploader.h8
-rw-r--r--ydb/library/backup/ya.make2
-rw-r--r--ydb/library/yql/sql/v1/SQLv1.g.in4
-rw-r--r--ydb/library/yql/sql/v1/context.cpp2
-rw-r--r--ydb/library/yql/sql/v1/node.h10
-rw-r--r--ydb/library/yql/sql/v1/query.cpp10
-rw-r--r--ydb/library/yql/sql/v1/sql.cpp54
-rw-r--r--ydb/library/yql/sql/v1/sql_ut.cpp48
-rw-r--r--ydb/public/api/grpc/ydb_table_v1.proto12
-rw-r--r--ydb/public/api/protos/draft/datastreams.proto2
-rw-r--r--ydb/public/api/protos/ydb_cms.proto4
-rw-r--r--ydb/public/api/protos/ydb_table.proto88
-rw-r--r--ydb/public/lib/base/defs.h2
-rw-r--r--ydb/public/lib/deprecated/kicli/cpp_ut.cpp22
-rw-r--r--ydb/public/lib/deprecated/kicli/kicli.h8
-rw-r--r--ydb/public/lib/deprecated/kicli/kikimr.cpp4
-rw-r--r--ydb/public/lib/deprecated/kicli/schema.cpp64
-rw-r--r--ydb/public/lib/ydb_cli/commands/ydb_tools.cpp186
-rw-r--r--ydb/public/lib/ydb_cli/commands/ydb_tools.h38
-rw-r--r--ydb/public/lib/ydb_cli/dump/dump.h2
-rw-r--r--ydb/public/lib/ydb_cli/dump/restore_import_data.cpp16
-rw-r--r--ydb/public/sdk/cpp/client/ydb_driver/driver.cpp2
-rw-r--r--ydb/public/sdk/cpp/client/ydb_table/table.cpp222
-rw-r--r--ydb/public/sdk/cpp/client/ydb_table/table.h136
-rw-r--r--ydb/public/sdk/python/CHANGELOG.md10
-rw-r--r--ydb/public/sdk/python/ydb/_session_impl.py20
-rw-r--r--ydb/public/sdk/python/ydb/aio/table.py2
-rw-r--r--ydb/public/sdk/python/ydb/table.py126
-rw-r--r--ydb/services/cms/cms_ut.cpp58
-rw-r--r--ydb/services/datastreams/datastreams_proxy.cpp96
-rw-r--r--ydb/services/lib/actors/pq_schema_actor.cpp4
-rw-r--r--ydb/services/lib/actors/pq_schema_actor.h6
-rw-r--r--ydb/services/persqueue_v1/grpc_pq_actor.h12
-rw-r--r--ydb/services/persqueue_v1/grpc_pq_schema.cpp20
-rw-r--r--ydb/services/ydb/ydb_common_ut.h16
-rw-r--r--ydb/services/ydb/ydb_coordination_ut.cpp6
-rw-r--r--ydb/services/ydb/ydb_table.cpp12
-rw-r--r--ydb/services/ydb/ydb_table_ut.cpp1030
-rw-r--r--ydb/services/ydb/ydb_ut.cpp442
-rw-r--r--ydb/tests/functional/rename/__init__.py6
-rw-r--r--ydb/tests/functional/rename/common.py148
-rw-r--r--ydb/tests/functional/rename/conftest.py196
-rw-r--r--ydb/tests/functional/rename/test.py518
-rw-r--r--ydb/tests/functional/rename/ya.make74
-rw-r--r--ydb/tests/functional/scheme_shard/test_scheme_shard_operations.py2
-rw-r--r--ydb/tests/functional/scheme_tests/tablet_scheme_tests.py20
-rw-r--r--ydb/tests/functional/serverless/conftest.py376
-rw-r--r--ydb/tests/functional/serverless/test.py266
-rw-r--r--ydb/tests/functional/serverless/ya.make36
-rw-r--r--ydb/tests/functional/tenants/__init__.py2
-rw-r--r--ydb/tests/functional/tenants/common.py272
-rw-r--r--ydb/tests/functional/tenants/test_dynamic_tenants.py382
-rw-r--r--ydb/tests/functional/tenants/test_publish_into_schemeboard_with_common_ssring.py124
-rw-r--r--ydb/tests/functional/tenants/test_storage_config.py1062
-rw-r--r--ydb/tests/functional/tenants/test_tenants.py822
-rw-r--r--ydb/tests/functional/tenants/ya.make28
-rw-r--r--ydb/tests/functional/ttl/test_ttl.py2
-rw-r--r--ydb/tests/library/common/local_db_scheme.py210
-rw-r--r--ydb/tests/library/common/msgbus_types.py2
-rw-r--r--ydb/tests/library/common/path_types.py34
-rw-r--r--ydb/tests/library/common/protobuf_console.py58
-rw-r--r--ydb/tests/library/common/protobuf_ss.py1080
-rw-r--r--ydb/tests/library/common/types.py28
-rw-r--r--ydb/tests/library/harness/daemon.py54
-rw-r--r--ydb/tests/library/harness/kikimr_client.py78
-rw-r--r--ydb/tests/library/harness/kikimr_cluster.py2
-rw-r--r--ydb/tests/library/harness/kikimr_cluster_interface.py188
-rw-r--r--ydb/tests/library/harness/kikimr_config.py68
-rw-r--r--ydb/tests/library/harness/kikimr_http_client.py14
-rw-r--r--ydb/tests/library/harness/kikimr_runner.py18
-rw-r--r--ydb/tests/library/matchers/scheme_ops.py740
-rw-r--r--ydb/tests/library/nemesis/nemesis_core.py2
-rw-r--r--ydb/tests/library/nemesis/nemesis_network.py66
-rw-r--r--ydb/tests/library/nemesis/network/client.py46
-rw-r--r--ydb/tests/library/predicates/executor.py58
750 files changed, 87975 insertions, 87975 deletions
diff --git a/library/cpp/actors/testlib/test_runtime.cpp b/library/cpp/actors/testlib/test_runtime.cpp
index d5ecaefe6a2..6fa25b99656 100644
--- a/library/cpp/actors/testlib/test_runtime.cpp
+++ b/library/cpp/actors/testlib/test_runtime.cpp
@@ -61,7 +61,7 @@ namespace NActors {
ActorSystemMonotonic = nullptr;
}
- void TTestActorRuntimeBase::TNodeDataBase::Stop() {
+ void TTestActorRuntimeBase::TNodeDataBase::Stop() {
if (Poller)
Poller->Stop();
@@ -77,11 +77,11 @@ namespace NActors {
Poller.Reset();
}
- TTestActorRuntimeBase::TNodeDataBase::~TNodeDataBase() {
- Stop();
- }
+ TTestActorRuntimeBase::TNodeDataBase::~TNodeDataBase() {
+ Stop();
+ }
+
-
class TTestActorRuntimeBase::TEdgeActor : public TActor<TEdgeActor> {
public:
static constexpr EActivityType ActorActivityType() {
@@ -1660,9 +1660,9 @@ namespace NActors {
common->Settings.Handshake = TDuration::Max();
}
- common->ClusterUUID = ClusterUUID;
- common->AcceptUUID = {ClusterUUID};
-
+ common->ClusterUUID = ClusterUUID;
+ common->AcceptUUID = {ClusterUUID};
+
for (ui32 proxyNodeIndex = 0; proxyNodeIndex < NodeCount; ++proxyNodeIndex) {
if (proxyNodeIndex == nodeIndex)
continue;
diff --git a/library/cpp/actors/testlib/test_runtime.h b/library/cpp/actors/testlib/test_runtime.h
index ffbf475f9a7..26e3b45c984 100644
--- a/library/cpp/actors/testlib/test_runtime.h
+++ b/library/cpp/actors/testlib/test_runtime.h
@@ -538,7 +538,7 @@ namespace NActors {
protected:
struct TNodeDataBase: public TThrRefBase {
TNodeDataBase();
- void Stop();
+ void Stop();
virtual ~TNodeDataBase();
virtual ui64 GetLoggerPoolId() const {
return 0;
diff --git a/library/cpp/mime/types/mime.cpp b/library/cpp/mime/types/mime.cpp
index dbfe99b7182..706d776b24d 100644
--- a/library/cpp/mime/types/mime.cpp
+++ b/library/cpp/mime/types/mime.cpp
@@ -20,7 +20,7 @@ public:
// Methods
public:
const char* StrByExt(const char* ext) const;
-
+
MimeTypes MimeByStr(const char* str) const;
MimeTypes MimeByStr(const TStringBuf& str) const;
const char* StrByMime(MimeTypes mime) const;
@@ -73,7 +73,7 @@ const TMimeTypes::TRecord TMimeTypes::Records[] = {
{MIME_ODP, "application/vnd.oasis.opendocument.presentation\0", "odp\0"},
{MIME_ODS, "application/vnd.oasis.opendocument.spreadsheet\0", "ods\0"},
{MIME_UNKNOWN, nullptr, nullptr},
- {MIME_IMAGE_BMP, "image/bmp\0image/x-ms-bmp\0image/x-windows-bmp\0", "bmp\0"},
+ {MIME_IMAGE_BMP, "image/bmp\0image/x-ms-bmp\0image/x-windows-bmp\0", "bmp\0"},
{MIME_WAV, "audio/x-wav\0", "wav\0"},
{MIME_ARCHIVE, "application/x-archive\0", nullptr},
{MIME_EXE, "application/exe\0application/octet-stream\0application/x-dosexec\0application/x-msdownload\0", "exe\0"},
@@ -87,7 +87,7 @@ const TMimeTypes::TRecord TMimeTypes::Records[] = {
{MIME_JSON, "application/json\0", "json\0"},
{MIME_APK, "application/vnd.android.package-archive\0", "apk\0"},
{MIME_CSS, "text/css\0", "css\0"},
- {MIME_IMAGE_WEBP, "image/webp\0", "webp\0"},
+ {MIME_IMAGE_WEBP, "image/webp\0", "webp\0"},
{MIME_DJVU, "image/vnd.djvu\0image/x-djvu\0", "djvu\0djv\0"},
{MIME_CHM, "application/x-chm\0application/vnd.ms-htmlhelp\0", "chm\0"},
{MIME_FB2ZIP, "application/zip\0", "fb2zip\0"},
@@ -215,8 +215,8 @@ const char* MimeNames[MIME_MAX] = {
"swf", // MIME_SWF // 9
"xls", // MIME_XLS // 10
"ppt", // MIME_PPT // 11
- "jpg", // MIME_IMAGE_JPG // 12
- "pjpg", // MIME_IMAGE_PJPG // 13
+ "jpg", // MIME_IMAGE_JPG // 12
+ "pjpg", // MIME_IMAGE_PJPG // 13
"png", // MIME_IMAGE_PNG // 14
"gif", // MIME_IMAGE_GIF // 15
"docx", // MIME_DOCX // 16
@@ -238,7 +238,7 @@ const char* MimeNames[MIME_MAX] = {
"json", // MIME_JSON // 32
"apk", // MIME_APK // 33
"css", // MIME_CSS // 34
- "webp", // MIME_IMAGE_WEBP // 35
+ "webp", // MIME_IMAGE_WEBP // 35
"djvu", // MIME_DJVU // 36
"chm", // MIME_CHM // 37
"fb2zip", // MIME_FB2ZIP // 38
diff --git a/library/cpp/mime/types/mime.h b/library/cpp/mime/types/mime.h
index c58ee93db19..05da389ea9d 100644
--- a/library/cpp/mime/types/mime.h
+++ b/library/cpp/mime/types/mime.h
@@ -46,7 +46,7 @@ enum MimeTypes {
MIME_JSON = 32,
MIME_APK = 33,
MIME_CSS = 34,
- MIME_IMAGE_WEBP = 35,
+ MIME_IMAGE_WEBP = 35,
MIME_DJVU = 36,
MIME_CHM = 37,
MIME_FB2ZIP = 38,
diff --git a/ydb/core/base/appdata.cpp b/ydb/core/base/appdata.cpp
index 16bd428ff1b..f9e517fc424 100644
--- a/ydb/core/base/appdata.cpp
+++ b/ydb/core/base/appdata.cpp
@@ -38,8 +38,8 @@ TAppData::TDefaultTabletTypes::TDefaultTabletTypes()
, PersQueue(TTabletTypes::PERSQUEUE)
, PersQueueReadBalancer(TTabletTypes::PERSQUEUE_READ_BALANCER)
, Dummy(TTabletTypes::TX_DUMMY)
- , Coordinator(TTabletTypes::FLAT_TX_COORDINATOR)
- , Mediator(TTabletTypes::TX_MEDIATOR)
+ , Coordinator(TTabletTypes::FLAT_TX_COORDINATOR)
+ , Mediator(TTabletTypes::TX_MEDIATOR)
, Kesus(TTabletTypes::KESUS)
, Hive(TTabletTypes::Hive)
, SysViewProcessor(TTabletTypes::SysViewProcessor)
diff --git a/ydb/core/base/appdata.h b/ydb/core/base/appdata.h
index c253df2b01e..c666f7468c0 100644
--- a/ydb/core/base/appdata.h
+++ b/ydb/core/base/appdata.h
@@ -149,7 +149,7 @@ struct TAppData {
bool EnforceUserTokenRequirement = false;
bool AllowHugeKeyValueDeletes = true; // delete when all clients limit deletes per request
bool EnableKqpSpilling = false;
- bool AllowShadowDataInSchemeShardForTests = false;
+ bool AllowShadowDataInSchemeShardForTests = false;
bool EnableMvccSnapshotWithLegacyDomainRoot = false;
TVector<TString> AdministrationAllowedSIDs; // users/groups which allowed to perform administrative tasks
TVector<TString> DefaultUserSIDs;
diff --git a/ydb/core/base/blobstorage.h b/ydb/core/base/blobstorage.h
index 47e7b0be33d..a2faee326e5 100644
--- a/ydb/core/base/blobstorage.h
+++ b/ydb/core/base/blobstorage.h
@@ -94,11 +94,11 @@ enum EGroupConfigurationType {
};
struct TGroupID {
- TGroupID() { Set((EGroupConfigurationType)0x1, 0x3f, InvalidLocalId); }
- TGroupID(EGroupConfigurationType configurationType, ui32 dataCenterId, ui32 groupLocalId) {
+ TGroupID() { Set((EGroupConfigurationType)0x1, 0x3f, InvalidLocalId); }
+ TGroupID(EGroupConfigurationType configurationType, ui32 dataCenterId, ui32 groupLocalId) {
Set(configurationType, dataCenterId, groupLocalId);
}
- TGroupID(const TGroupID& group) { Raw.X = group.GetRaw(); }
+ TGroupID(const TGroupID& group) { Raw.X = group.GetRaw(); }
explicit TGroupID(ui32 raw) { Raw.X = raw; }
EGroupConfigurationType ConfigurationType() const { return (EGroupConfigurationType)Raw.N.ConfigurationType; }
ui32 AvailabilityDomainID() const { return Raw.N.AvailabilityDomainID; }
@@ -107,16 +107,16 @@ struct TGroupID {
bool operator==(const TGroupID &x) const { return GetRaw() == x.GetRaw(); }
bool operator!=(const TGroupID &x) const { return GetRaw() != x.GetRaw(); }
- TGroupID operator++() {
- Set(ConfigurationType(), AvailabilityDomainID(), NextValidLocalId());
- return *this;
- }
- TGroupID operator++(int) {
- TGroupID old(*this);
- ++(*this);
- return old;
- }
-
+ TGroupID operator++() {
+ Set(ConfigurationType(), AvailabilityDomainID(), NextValidLocalId());
+ return *this;
+ }
+ TGroupID operator++(int) {
+ TGroupID old(*this);
+ ++(*this);
+ return old;
+ }
+
TString ToString() const;
private:
union {
@@ -137,19 +137,19 @@ private:
Raw.N.AvailabilityDomainID = availabilityDomainID;
Raw.N.GroupLocalID = groupLocalId;
}
-
- ui32 NextValidLocalId() {
- const ui32 localId = GroupLocalID();
- if (localId == InvalidLocalId) {
- return localId;
- }
- if (localId == InvalidLocalId - 1) {
- return 0;
- }
- return localId + 1;
- }
-
- static constexpr ui32 InvalidLocalId = 0x1ffffff;
+
+ ui32 NextValidLocalId() {
+ const ui32 localId = GroupLocalID();
+ if (localId == InvalidLocalId) {
+ return localId;
+ }
+ if (localId == InvalidLocalId - 1) {
+ return 0;
+ }
+ return localId + 1;
+ }
+
+ static constexpr ui32 InvalidLocalId = 0x1ffffff;
static_assert(sizeof(decltype(Raw)) == sizeof(ui32), "TGroupID Raw value must be binary compatible with ui32");
};
@@ -229,8 +229,8 @@ struct TTabletChannelInfo {
ui32 Channel;
TBlobStorageGroupType Type;
- TString StoragePool;
- TVector<THistoryEntry> History;
+ TString StoragePool;
+ TVector<THistoryEntry> History;
TTabletChannelInfo()
: Channel()
@@ -247,11 +247,11 @@ struct TTabletChannelInfo {
, Type(erasureSpecies)
{}
- TTabletChannelInfo(ui32 channel, TString storagePool)
- : Channel(channel)
- , Type(TBlobStorageGroupType::ErasureNone)
- , StoragePool(storagePool)
- {}
+ TTabletChannelInfo(ui32 channel, TString storagePool)
+ : Channel(channel)
+ , Type(TBlobStorageGroupType::ErasureNone)
+ , StoragePool(storagePool)
+ {}
ui32 GroupForGeneration(ui32 gen) const {
const size_t historySize = History.size();
@@ -296,7 +296,7 @@ struct TTabletChannelInfo {
TStringStream str;
str << "{Channel# " << Channel;
str << " Type# " << Type.ToString();
- str << " StoragePool# " << StoragePool;
+ str << " StoragePool# " << StoragePool;
str << " History# {";
const size_t historySize = History.size();
for (size_t historyIdx = 0; historyIdx < historySize; ++historyIdx) {
@@ -722,8 +722,8 @@ struct TEvBlobStorage {
EvUnusedLocal2, // Not used.
EvUnusedLocal3, // Not used.
EvNotReadyRetryTimeout,
- EvConfigureQueryTimeout,
- EvEstablishingSessionTimeout,
+ EvConfigureQueryTimeout,
+ EvEstablishingSessionTimeout,
EvDeathNote, /// 268 637 191
EvVDiskStateChanged,
EvAccelerate,
diff --git a/ydb/core/base/channel_profiles.h b/ydb/core/base/channel_profiles.h
index f166081dd60..e10d6a3f91e 100644
--- a/ydb/core/base/channel_profiles.h
+++ b/ydb/core/base/channel_profiles.h
@@ -12,23 +12,23 @@ struct TChannelProfiles : public TThrRefBase {
ui64 PDiskCategory;
NKikimrBlobStorage::TVDiskKind::EVDiskKind VDiskCategory;
- TString PoolKind;
-
- TChannel(TBlobStorageGroupType::EErasureSpecies erasure,
- ui64 pDiskCategory,
- NKikimrBlobStorage::TVDiskKind::EVDiskKind vDiskCategory,
- TString poolKind = TString())
+ TString PoolKind;
+
+ TChannel(TBlobStorageGroupType::EErasureSpecies erasure,
+ ui64 pDiskCategory,
+ NKikimrBlobStorage::TVDiskKind::EVDiskKind vDiskCategory,
+ TString poolKind = TString())
: Erasure(erasure)
, PDiskCategory(pDiskCategory)
, VDiskCategory(vDiskCategory)
- , PoolKind(poolKind)
+ , PoolKind(poolKind)
{}
bool operator ==(const TChannel& a) const {
- return Erasure == a.Erasure
- && PDiskCategory == a.PDiskCategory
- && VDiskCategory == a.VDiskCategory
- && PoolKind == a.PoolKind;
+ return Erasure == a.Erasure
+ && PDiskCategory == a.PDiskCategory
+ && VDiskCategory == a.VDiskCategory
+ && PoolKind == a.PoolKind;
}
bool operator !=(const TChannel& a) const {
diff --git a/ydb/core/base/domain.h b/ydb/core/base/domain.h
index 015c2f7d62d..05346e474aa 100644
--- a/ydb/core/base/domain.h
+++ b/ydb/core/base/domain.h
@@ -20,46 +20,46 @@ struct TDomainsInfo : public TThrRefBase {
static const ui32 DomainBits = 5;
static const ui32 MaxDomainId = (1 << DomainBits) - 1;
- // it's very sad mistake
- // MakeTabletID should be called with hiveUid == 0 for all domain's static tablets
- // but we do it with hiveUid == domain, and collision with dynamic tablets occurs
+ // it's very sad mistake
+ // MakeTabletID should be called with hiveUid == 0 for all domain's static tablets
+ // but we do it with hiveUid == domain, and collision with dynamic tablets occurs
// use AvoidBrokenUniqPartsBySystemTablets to avoid this mistake
- static ui64 MakeTxCoordinatorID(ui32 domain, ui32 uid) {
- Y_VERIFY_DEBUG(domain < 32 && uid < 256);
- const ui64 uniqPart = 0x800000 | (ui64)uid;
- return MakeTabletID(domain, domain, uniqPart);
- }
-
- static ui64 MakeTxCoordinatorIDFixed(ui32 domain, ui32 uid) {
- Y_VERIFY_DEBUG(domain < 32 && uid < 256);
- const ui64 uniqPart = 0x800000 | (ui64)uid;
- return MakeTabletID(domain, 0, uniqPart);
- }
-
- static ui64 MakeTxMediatorID(ui32 domain, ui32 uid) {
- Y_VERIFY_DEBUG(domain < 32 && uid < 256);
- const ui64 uniqPart = 0x810000 | (ui64)uid;
- return MakeTabletID(domain, domain, uniqPart);
- }
-
- static ui64 MakeTxMediatorIDFixed(ui32 domain, ui32 uid) {
- Y_VERIFY_DEBUG(domain < 32 && uid < 256);
- const ui64 uniqPart = 0x810000 | (ui64)uid;
- return MakeTabletID(domain, 0, uniqPart);
- }
-
- static ui64 MakeTxAllocatorID(ui32 domain, ui32 uid) {
- Y_VERIFY_DEBUG(domain < 32 && uid > 0 && uid < 4096);
- const ui64 uniqPart = 0x820000 | (ui64)uid;
- return MakeTabletID(domain, domain, uniqPart);
- }
-
- static ui64 MakeTxAllocatorIDFixed(ui32 domain, ui32 uid) {
- Y_VERIFY_DEBUG(domain < 32 && uid > 0 && uid < 4096);
- const ui64 uniqPart = 0x820000 | (ui64)uid;
- return MakeTabletID(domain, 0, uniqPart);
- }
-
+ static ui64 MakeTxCoordinatorID(ui32 domain, ui32 uid) {
+ Y_VERIFY_DEBUG(domain < 32 && uid < 256);
+ const ui64 uniqPart = 0x800000 | (ui64)uid;
+ return MakeTabletID(domain, domain, uniqPart);
+ }
+
+ static ui64 MakeTxCoordinatorIDFixed(ui32 domain, ui32 uid) {
+ Y_VERIFY_DEBUG(domain < 32 && uid < 256);
+ const ui64 uniqPart = 0x800000 | (ui64)uid;
+ return MakeTabletID(domain, 0, uniqPart);
+ }
+
+ static ui64 MakeTxMediatorID(ui32 domain, ui32 uid) {
+ Y_VERIFY_DEBUG(domain < 32 && uid < 256);
+ const ui64 uniqPart = 0x810000 | (ui64)uid;
+ return MakeTabletID(domain, domain, uniqPart);
+ }
+
+ static ui64 MakeTxMediatorIDFixed(ui32 domain, ui32 uid) {
+ Y_VERIFY_DEBUG(domain < 32 && uid < 256);
+ const ui64 uniqPart = 0x810000 | (ui64)uid;
+ return MakeTabletID(domain, 0, uniqPart);
+ }
+
+ static ui64 MakeTxAllocatorID(ui32 domain, ui32 uid) {
+ Y_VERIFY_DEBUG(domain < 32 && uid > 0 && uid < 4096);
+ const ui64 uniqPart = 0x820000 | (ui64)uid;
+ return MakeTabletID(domain, domain, uniqPart);
+ }
+
+ static ui64 MakeTxAllocatorIDFixed(ui32 domain, ui32 uid) {
+ Y_VERIFY_DEBUG(domain < 32 && uid > 0 && uid < 4096);
+ const ui64 uniqPart = 0x820000 | (ui64)uid;
+ return MakeTabletID(domain, 0, uniqPart);
+ }
+
static constexpr const char* SystemTableDefaultPoicyName() {
return "SystemTableDefault";
}
@@ -71,11 +71,11 @@ struct TDomainsInfo : public TThrRefBase {
typedef THashMap<TString, TIntrusiveConstPtr<NLocalDb::TCompactionPolicy>> TNamedCompactionPolicies;
struct TDomain : public TThrRefBase {
- using TPtr = TIntrusivePtr<TDomain>;
-
+ using TPtr = TIntrusivePtr<TDomain>;
+
using TVectorUi64 = TVector<ui64>;
using TVectorUi32 = TVector<ui32>;
- using TStoragePoolKinds = THashMap<TString, NKikimrBlobStorage::TDefineStoragePool>;
+ using TStoragePoolKinds = THashMap<TString, NKikimrBlobStorage::TDefineStoragePool>;
const ui32 DomainUid;
const ui32 DefaultStateStorageGroup;
@@ -89,13 +89,13 @@ struct TDomainsInfo : public TThrRefBase {
const ui32 DefaultHiveUid;
const TVector<ui32> HiveUids;
const ui64 DomainPlanResolution;
- const TStoragePoolKinds StoragePoolTypes;
+ const TStoragePoolKinds StoragePoolTypes;
- static constexpr ui32 TimecastBucketsPerMediator = 2; // <- any sense in making this configurable? may be for debug?..
+ static constexpr ui32 TimecastBucketsPerMediator = 2; // <- any sense in making this configurable? may be for debug?..
- private:
- //don't reinterpret any data
- TDomain(const TString &name, ui32 domainUid, ui64 schemeRootId,
+ private:
+ //don't reinterpret any data
+ TDomain(const TString &name, ui32 domainUid, ui64 schemeRootId,
ui32 defaultStateStorageGroup, ui32 defaultSchemeBoardGroup,
TVectorUi32 stateStorageGroup,
TVectorUi64 coordinators, TVectorUi64 mediators, TVectorUi64 allocators,
@@ -104,32 +104,32 @@ struct TDomainsInfo : public TThrRefBase {
: DomainUid(domainUid)
, DefaultStateStorageGroup(defaultStateStorageGroup)
, DefaultSchemeBoardGroup(defaultSchemeBoardGroup)
- , SchemeRoot(schemeRootId)
+ , SchemeRoot(schemeRootId)
, Name(name)
- , Coordinators(std::move(coordinators))
- , Mediators(std::move(mediators))
- , TxAllocators(std::move(allocators))
- , StateStorageGroups(std::move(stateStorageGroup))
+ , Coordinators(std::move(coordinators))
+ , Mediators(std::move(mediators))
+ , TxAllocators(std::move(allocators))
+ , StateStorageGroups(std::move(stateStorageGroup))
, DefaultHiveUid(defaultHiveUid)
- , HiveUids(std::move(hivesUids))
+ , HiveUids(std::move(hivesUids))
, DomainPlanResolution(domainPlanResolution)
, StoragePoolTypes(poolTypes)
{}
- public:
- //interpret coordinatorUids, mediatorUids and allocatorUids as vector uids and call proper MakeTabletId for each
- template <typename TUidsContainerUi32, typename TUidsContainerUi64>
- static TDomain::TPtr ConstructDomain(const TString &name, ui32 domainUid, ui64 schemeRoot,
+ public:
+ //interpret coordinatorUids, mediatorUids and allocatorUids as vector uids and call proper MakeTabletId for each
+ template <typename TUidsContainerUi32, typename TUidsContainerUi64>
+ static TDomain::TPtr ConstructDomain(const TString &name, ui32 domainUid, ui64 schemeRoot,
ui32 defaultStateStorageGroup, ui32 defaultSchemeBoardGroup,
const TUidsContainerUi32 &stateStorageGroups,
- ui32 defaultHiveUid,const TUidsContainerUi32 &hiveUids,
+ ui32 defaultHiveUid,const TUidsContainerUi32 &hiveUids,
ui64 planResolution,
const TUidsContainerUi64 &coordinatorUids,
const TUidsContainerUi64 &mediatorUids,
const TUidsContainerUi64 &allocatorUids,
- const TStoragePoolKinds &poolTypes = TStoragePoolKinds())
- {
- return new TDomain(name, domainUid, schemeRoot,
+ const TStoragePoolKinds &poolTypes = TStoragePoolKinds())
+ {
+ return new TDomain(name, domainUid, schemeRoot,
defaultStateStorageGroup, defaultSchemeBoardGroup,
TVectorUi32(stateStorageGroups.begin(), stateStorageGroups.end()),
MakeCoordinatorsIds(TVectorUi64(coordinatorUids.begin(), coordinatorUids.end()), domainUid),
@@ -137,16 +137,16 @@ struct TDomainsInfo : public TThrRefBase {
MakeAllocatorsIds(TVectorUi64(allocatorUids.begin(), allocatorUids.end()), domainUid),
defaultHiveUid, TVectorUi32(hiveUids.begin(), hiveUids.end()),
planResolution, poolTypes);
- }
-
- //no any tablets setted
- static TDomain::TPtr ConstructEmptyDomain(const TString &name, ui32 domainId = 0)
- {
- const ui64 schemeRoot = 0;
- const ui32 stateStorageGroup = domainId;
- const ui32 defHiveUid = domainId;
- ui64 planResolution = 500;
- return new TDomain(name, domainId, schemeRoot,
+ }
+
+ //no any tablets setted
+ static TDomain::TPtr ConstructEmptyDomain(const TString &name, ui32 domainId = 0)
+ {
+ const ui64 schemeRoot = 0;
+ const ui32 stateStorageGroup = domainId;
+ const ui32 defHiveUid = domainId;
+ ui64 planResolution = 500;
+ return new TDomain(name, domainId, schemeRoot,
stateStorageGroup, stateStorageGroup,
TVectorUi32(1, stateStorageGroup),
TVectorUi64(),
@@ -154,10 +154,10 @@ struct TDomainsInfo : public TThrRefBase {
TVectorUi64(),
defHiveUid, TVectorUi32(1, defHiveUid),
planResolution, TStoragePoolKinds());
- }
-
- template <typename TUidsContainerUi32, typename TUidsContainerUi64>
- static TDomain::TPtr ConstructDomainWithExplicitTabletIds(const TString &name, ui32 domainUid, ui64 schemeRoot,
+ }
+
+ template <typename TUidsContainerUi32, typename TUidsContainerUi64>
+ static TDomain::TPtr ConstructDomainWithExplicitTabletIds(const TString &name, ui32 domainUid, ui64 schemeRoot,
ui32 defaultStateStorageGroup, ui32 defaultSchemeBoardGroup,
const TUidsContainerUi32 &stateStorageGroups,
ui32 defaultHiveUid,const TUidsContainerUi32 &hiveUids,
@@ -166,8 +166,8 @@ struct TDomainsInfo : public TThrRefBase {
const TUidsContainerUi64 &mediatorUids,
const TUidsContainerUi64 &allocatorUids,
const TStoragePoolKinds &poolTypes = TStoragePoolKinds())
- {
- return new TDomain(name, domainUid, schemeRoot,
+ {
+ return new TDomain(name, domainUid, schemeRoot,
defaultStateStorageGroup, defaultSchemeBoardGroup,
TVectorUi32(stateStorageGroups.begin(), stateStorageGroups.end()),
TVectorUi64(coordinatorUids.begin(), coordinatorUids.end()),
@@ -175,27 +175,27 @@ struct TDomainsInfo : public TThrRefBase {
TVectorUi64(allocatorUids.begin(), allocatorUids.end()),
defaultHiveUid, TVectorUi32(hiveUids.begin(), hiveUids.end()),
planResolution, poolTypes);
- }
-
+ }
+
ui32 DomainRootTag() const {
return DomainUid + FirstUserTag;
}
static TVector<ui64> TransformUids(TVector<ui64> &&uids, std::function<ui64 (ui32)> func) {
TVector<ui64> result(std::move(uids));
- for (ui32 i = 0; i < result.size(); ++i) {
- result[i] = func(result[i]);
- }
- return result;
+ for (ui32 i = 0; i < result.size(); ++i) {
+ result[i] = func(result[i]);
+ }
+ return result;
}
static TVector<ui64> TransformIntoVectorUids(ui32 count) {
TVector<ui64> result;
- result.reserve(count);
- for (ui32 i = 1; i <= count; ++i) {
- result.push_back(i);
- }
- return result;
+ result.reserve(count);
+ for (ui32 i = 1; i <= count; ++i) {
+ result.push_back(i);
+ }
+ return result;
}
static TVector<ui64> MakeCoordinatorsIds(TVector<ui64> &&uids, ui32 domainUid) {
@@ -203,25 +203,25 @@ struct TDomainsInfo : public TThrRefBase {
}
static TVector<ui64> MakeCoordinatorsIds(ui32 count, ui32 domainUid) {
- return MakeCoordinatorsIds(TransformIntoVectorUids(count), domainUid);
- }
-
+ return MakeCoordinatorsIds(TransformIntoVectorUids(count), domainUid);
+ }
+
static TVector<ui64> MakeMediatrosIds(TVector<ui64> &&uids, ui32 domainUid) {
return TransformUids(std::move(uids), [&domainUid](ui32 uid) { return MakeTxMediatorID(domainUid, uid); });
- }
-
+ }
+
static TVector<ui64> MakeMediatrosIds(ui32 count, ui32 domainUid) {
- return MakeMediatrosIds(TransformIntoVectorUids(count), domainUid);
- }
-
+ return MakeMediatrosIds(TransformIntoVectorUids(count), domainUid);
+ }
+
static TVector<ui64> MakeAllocatorsIds(TVector<ui64> &&uids, ui32 domainUid) {
return TransformUids(std::move(uids), [&domainUid](ui32 uid) { return MakeTxAllocatorID(domainUid, uid); });
- }
-
+ }
+
static TVector<ui64> MakeAllocatorsIds(ui32 count, ui32 domainUid) {
- return MakeAllocatorsIds(TransformIntoVectorUids(count), domainUid);
- }
-
+ return MakeAllocatorsIds(TransformIntoVectorUids(count), domainUid);
+ }
+
ui32 GetHiveUidByIdx(ui32 idx) const {
if (idx == Max<ui32>()) {
return DefaultHiveUid;
diff --git a/ydb/core/base/events.h b/ydb/core/base/events.h
index 603218901b8..f5fedfe19b2 100644
--- a/ydb/core/base/events.h
+++ b/ydb/core/base/events.h
@@ -16,17 +16,17 @@ struct TKikimrEvents : TEvents {
for the following keywords, you should consider
issues about "rolling update".
*/
- ES_KIKIMR_ES_BEGIN = ES_USERSPACE, //4096
- ES_STATESTORAGE, //4097
+ ES_KIKIMR_ES_BEGIN = ES_USERSPACE, //4096
+ ES_STATESTORAGE, //4097
ES_DEPRECATED_4098, //4098
- ES_BLOBSTORAGE, //4099
- ES_HIVE, //4100
- ES_TABLETBASE, //4101
- ES_TABLET, //4102
+ ES_BLOBSTORAGE, //4099
+ ES_HIVE, //4100
+ ES_TABLETBASE, //4101
+ ES_TABLET, //4102
ES_TABLETRESOLVER,
ES_LOCAL,
ES_DEPRECATED_4105,
- ES_TX_PROXY, // generic proxy commands 4106
+ ES_TX_PROXY, // generic proxy commands 4106
ES_TX_COORDINATOR,
ES_TX_MEDIATOR,
ES_TX_PROCESSING, // 4109
@@ -42,7 +42,7 @@ struct TKikimrEvents : TEvents {
ES_DEPRECATED_4118,
ES_TABLET_COUNTERS_AGGREGATOR,
ES_DEPRECATED_4121,
- ES_PROXY_BUS, //4122
+ ES_PROXY_BUS, //4122
ES_BOOTSTRAPPER,
ES_TX_MEDIATORTIMECAST,
ES_DEPRECATED_4125,
@@ -52,17 +52,17 @@ struct TKikimrEvents : TEvents {
ES_DEPRECATED_4129,
ES_DEPRECATED_4130,
ES_DEPRECATED_4131,
- ES_KEYVALUE, //4132
+ ES_KEYVALUE, //4132
ES_MSGBUS_TRACER,
ES_RTMR_TABLET,
ES_FLAT_EXECUTOR,
ES_NODE_WHITEBOARD,
- ES_FLAT_TX_SCHEMESHARD, // 4137
+ ES_FLAT_TX_SCHEMESHARD, // 4137
ES_PQ,
ES_YQL_KIKIMR_PROXY,
ES_PQ_META_CACHE,
ES_DEPRECATED_4141,
- ES_PQ_L2_CACHE, //4142
+ ES_PQ_L2_CACHE, //4142
ES_TOKEN_BUILDER,
ES_TICKET_PARSER,
ES_KQP = NYql::NDq::TDqEvents::ES_DQ_COMPUTE_KQP_COMPATIBLE, // 4145
@@ -72,7 +72,7 @@ struct TKikimrEvents : TEvents {
ES_PQ_PROXY,
ES_CMS,
ES_NODE_BROKER,
- ES_TX_ALLOCATOR, //4152
+ ES_TX_ALLOCATOR, //4152
// reserve event space for each RTMR process
ES_RTMR_STORAGE,
ES_RTMR_PROXY,
@@ -120,7 +120,7 @@ struct TKikimrEvents : TEvents {
ES_S3_WRAPPER,
ES_FILESTORE,
ES_FILESTORE_PRIVATE,
- ES_YDB_METERING,
+ ES_YDB_METERING,
ES_IMPORT_SERVICE, // 4200
ES_TX_OLAPSHARD,
ES_TX_COLUMNSHARD,
diff --git a/ydb/core/base/hive.h b/ydb/core/base/hive.h
index 155b63bb255..7464c76699d 100644
--- a/ydb/core/base/hive.h
+++ b/ydb/core/base/hive.h
@@ -2,7 +2,7 @@
#include "defs.h"
#include "blobstorage.h"
#include "events.h"
-#include "storage_pools.h"
+#include "storage_pools.h"
#include "subdomain.h"
#include <ydb/core/protos/hive.pb.h>
#include <ydb/core/base/tablet.h>
@@ -18,7 +18,7 @@ namespace NKikimr {
EvReconfigureTablet,
EvLookupChannelInfo,
EvStopTablet,
-
+
EvTabletMetrics = EvStopTablet + 7, // review 194375
EvReassignTablet,
EvInitiateBlockStorage,
@@ -33,11 +33,11 @@ namespace NKikimr {
EvUnlockTabletExecution,
EvInitiateTabletExternalBoot,
EvRequestHiveDomainStats,
- EvAdoptTable,
+ EvAdoptTable,
EvInvalidateStoragePools,
EvRequestHiveNodeStats,
EvRequestHiveStorageStats,
- EvDeleteOwnerTablets,
+ EvDeleteOwnerTablets,
EvRequestTabletIdSequence,
EvSeizeTablets,
EvReleaseTablets,
@@ -63,10 +63,10 @@ namespace NKikimr {
EvUnlockTabletExecutionResult,
EvLockTabletExecutionLost,
EvResponseHiveDomainStats,
- EvAdoptTabletReply,
+ EvAdoptTabletReply,
EvResponseHiveNodeStats,
EvResponseHiveStorageStats,
- EvDeleteOwnerTabletsReply,
+ EvDeleteOwnerTabletsReply,
EvResponseTabletIdSequence,
EvResumeTabletResult,
EvSeizeTabletsReply,
@@ -121,7 +121,7 @@ namespace NKikimr {
TEvCreateTablet()
{}
- TEvCreateTablet(ui64 ownerId, ui64 ownerIdx,
+ TEvCreateTablet(ui64 ownerId, ui64 ownerIdx,
TTabletTypes::EType tabletType,
const TChannelsBindings& bindedChannels) {
Record.SetOwner(ownerId);
@@ -152,9 +152,9 @@ namespace NKikimr {
for (ui32 nodeId : allowedNodeIDs) {
Record.AddAllowedNodeIDs(nodeId);
}
- for (auto& channel : bindedChannels) {
- *Record.AddBindedChannels() = channel;
- }
+ for (auto& channel : bindedChannels) {
+ *Record.AddBindedChannels() = channel;
+ }
}
TString ToString() const {
@@ -163,16 +163,16 @@ namespace NKikimr {
str << " OwnerIdx: " << Record.GetOwnerIdx();
str << " TabletType: " << Record.GetTabletType();
str << " ChannelsProfile: " << Record.GetChannelsProfile();
-
- ui32 bindedChannelsSize = Record.BindedChannelsSize();
- if (bindedChannelsSize) {
- str << " BindedChannels: {" << Record.GetBindedChannels(0);
- for (size_t i = 1; i < bindedChannelsSize; ++i) {
- str << ", " << Record.GetBindedChannels(i);
- }
- str << "}";
- }
-
+
+ ui32 bindedChannelsSize = Record.BindedChannelsSize();
+ if (bindedChannelsSize) {
+ str << " BindedChannels: {" << Record.GetBindedChannels(0);
+ for (size_t i = 1; i < bindedChannelsSize; ++i) {
+ str << ", " << Record.GetBindedChannels(i);
+ }
+ str << "}";
+ }
+
ui32 allowedNodeIDsSize = Record.AllowedNodeIDsSize();
if (allowedNodeIDsSize) {
str << " AllowenNodeIDs: {" << Record.GetAllowedNodeIDs(0);
@@ -319,54 +319,54 @@ namespace NKikimr {
}
};
- struct TEvAdoptTablet
- : public TEventPB<TEvAdoptTablet, NKikimrHive::TEvAdoptTablet, EvAdoptTable> {
- TEvAdoptTablet()
- {}
-
- TEvAdoptTablet(ui64 tabletId, ui64 prevOwner, ui64 prevOwnerIdx, TTabletTypes::EType tabletType, ui64 owner, ui64 ownerIdx) {
- Record.SetTabletID(tabletId);
- Record.SetPrevOwner(prevOwner);
- Record.SetPrevOwnerIdx(prevOwnerIdx);
- Record.SetTabletType(tabletType);
- Record.SetOwner(owner);
- Record.SetOwnerIdx(ownerIdx);
- }
-
- TString ToString() const {
- TStringStream str;
- str << "{TEvAdoptTablet TabletID: " << Record.GetTabletID();
- str << " PrevOwner: " << Record.GetPrevOwner();
- str << " PrevOwnerIdx: " << Record.GetPrevOwnerIdx();
- str << " Owner: " << Record.GetOwner();
- str << " OwnerIdx: " << Record.GetOwnerIdx();
- str << "}";
- return str.Str();
- }
- };
-
- struct TEvAdoptTabletReply : TEventPB<TEvAdoptTabletReply, NKikimrHive::TEvAdoptTabletReply, EvAdoptTabletReply> {
- TEvAdoptTabletReply() = default;
-
- TEvAdoptTabletReply(NKikimrProto::EReplyStatus status, ui64 tablet, ui64 owner, ui64 ownerIdx, const TString explain, ui64 origin) {
- Record.SetStatus(status);
- Record.SetTabletID(tablet);
- Record.SetOwner(owner);
- Record.SetOwnerIdx(ownerIdx);
- Record.SetExplain(explain);
- Record.SetOrigin(origin);
- }
-
- TString ToString() const {
- TStringStream str;
+ struct TEvAdoptTablet
+ : public TEventPB<TEvAdoptTablet, NKikimrHive::TEvAdoptTablet, EvAdoptTable> {
+ TEvAdoptTablet()
+ {}
+
+ TEvAdoptTablet(ui64 tabletId, ui64 prevOwner, ui64 prevOwnerIdx, TTabletTypes::EType tabletType, ui64 owner, ui64 ownerIdx) {
+ Record.SetTabletID(tabletId);
+ Record.SetPrevOwner(prevOwner);
+ Record.SetPrevOwnerIdx(prevOwnerIdx);
+ Record.SetTabletType(tabletType);
+ Record.SetOwner(owner);
+ Record.SetOwnerIdx(ownerIdx);
+ }
+
+ TString ToString() const {
+ TStringStream str;
+ str << "{TEvAdoptTablet TabletID: " << Record.GetTabletID();
+ str << " PrevOwner: " << Record.GetPrevOwner();
+ str << " PrevOwnerIdx: " << Record.GetPrevOwnerIdx();
+ str << " Owner: " << Record.GetOwner();
+ str << " OwnerIdx: " << Record.GetOwnerIdx();
+ str << "}";
+ return str.Str();
+ }
+ };
+
+ struct TEvAdoptTabletReply : TEventPB<TEvAdoptTabletReply, NKikimrHive::TEvAdoptTabletReply, EvAdoptTabletReply> {
+ TEvAdoptTabletReply() = default;
+
+ TEvAdoptTabletReply(NKikimrProto::EReplyStatus status, ui64 tablet, ui64 owner, ui64 ownerIdx, const TString explain, ui64 origin) {
+ Record.SetStatus(status);
+ Record.SetTabletID(tablet);
+ Record.SetOwner(owner);
+ Record.SetOwnerIdx(ownerIdx);
+ Record.SetExplain(explain);
+ Record.SetOrigin(origin);
+ }
+
+ TString ToString() const {
+ TStringStream str;
str << "{TEvAdoptTabletReply Status: " << NKikimrProto::EReplyStatus_Name(Record.GetStatus()).data();
- str << " TabletID: " << Record.GetTabletID();
- str << " Explain: " << Record.GetExplain();
- str << "}";
- return str.Str();
- }
- };
-
+ str << " TabletID: " << Record.GetTabletID();
+ str << " Explain: " << Record.GetExplain();
+ str << "}";
+ return str.Str();
+ }
+ };
+
struct TEvReconfigureTablet
: public TEventPB<TEvReconfigureTablet, NKikimrHive::TEvReconfigureTablet, EvReconfigureTablet> {
TEvReconfigureTablet()
@@ -408,9 +408,9 @@ namespace NKikimr {
{}
TEvDeleteTablet(ui64 ownerId, ui64 ownerIdx, ui64 txId) {
- Record.SetShardOwnerId(ownerId);
- Record.AddShardLocalIdx(ownerIdx);
- Record.SetTxId_Deprecated(txId);
+ Record.SetShardOwnerId(ownerId);
+ Record.AddShardLocalIdx(ownerIdx);
+ Record.SetTxId_Deprecated(txId);
}
TEvDeleteTablet(ui64 ownerId, ui64 ownerIdx, ui64 tabletId, ui64 txId) {
@@ -426,41 +426,41 @@ namespace NKikimr {
TEvDeleteTabletReply()
{}
- TEvDeleteTabletReply(NKikimrProto::EReplyStatus status, ui64 hiveID, ui64 txId, ui64 ownerId, const TVector<ui64>& localIdxs) {
+ TEvDeleteTabletReply(NKikimrProto::EReplyStatus status, ui64 hiveID, ui64 txId, ui64 ownerId, const TVector<ui64>& localIdxs) {
Record.SetStatus(status);
Record.SetOrigin(hiveID);
- Record.SetTxId_Deprecated(txId);
- Record.SetShardOwnerId(ownerId);
- for (auto& idx: localIdxs) {
- Record.AddShardLocalIdx(idx);
- }
- }
- };
-
- struct TEvDeleteOwnerTablets : public TEventPB<TEvDeleteOwnerTablets,
- NKikimrHive::TEvDeleteOwnerTablets, EvDeleteOwnerTablets> {
- TEvDeleteOwnerTablets()
- {}
-
- TEvDeleteOwnerTablets(ui64 ownerId, ui64 txId) {
- Record.SetOwner(ownerId);
- Record.SetTxId(txId);
- }
- };
-
- struct TEvDeleteOwnerTabletsReply : public TEventPB<TEvDeleteOwnerTabletsReply,
- NKikimrHive::TEvDeleteOwnerTabletsReply, EvDeleteOwnerTabletsReply> {
- TEvDeleteOwnerTabletsReply()
- {}
-
- TEvDeleteOwnerTabletsReply(NKikimrProto::EReplyStatus status, ui64 hiveID, ui64 ownerId, ui64 txId) {
- Record.SetStatus(status);
- Record.SetOwner(ownerId);
- Record.SetTxId(txId);
- Record.SetOrigin(hiveID);
- }
- };
-
+ Record.SetTxId_Deprecated(txId);
+ Record.SetShardOwnerId(ownerId);
+ for (auto& idx: localIdxs) {
+ Record.AddShardLocalIdx(idx);
+ }
+ }
+ };
+
+ struct TEvDeleteOwnerTablets : public TEventPB<TEvDeleteOwnerTablets,
+ NKikimrHive::TEvDeleteOwnerTablets, EvDeleteOwnerTablets> {
+ TEvDeleteOwnerTablets()
+ {}
+
+ TEvDeleteOwnerTablets(ui64 ownerId, ui64 txId) {
+ Record.SetOwner(ownerId);
+ Record.SetTxId(txId);
+ }
+ };
+
+ struct TEvDeleteOwnerTabletsReply : public TEventPB<TEvDeleteOwnerTabletsReply,
+ NKikimrHive::TEvDeleteOwnerTabletsReply, EvDeleteOwnerTabletsReply> {
+ TEvDeleteOwnerTabletsReply()
+ {}
+
+ TEvDeleteOwnerTabletsReply(NKikimrProto::EReplyStatus status, ui64 hiveID, ui64 ownerId, ui64 txId) {
+ Record.SetStatus(status);
+ Record.SetOwner(ownerId);
+ Record.SetTxId(txId);
+ Record.SetOrigin(hiveID);
+ }
+ };
+
struct TEvLookupChannelInfo : TEventPB<TEvLookupChannelInfo, NKikimrHive::TEvLookupChannelInfo, EvLookupChannelInfo> {
TEvLookupChannelInfo() = default;
diff --git a/ydb/core/base/kikimr_issue.txt b/ydb/core/base/kikimr_issue.txt
index 063c5f39b12..56c375080be 100644
--- a/ydb/core/base/kikimr_issue.txt
+++ b/ydb/core/base/kikimr_issue.txt
@@ -19,7 +19,7 @@ ids { code: DOMAIN_LOCALITY_ERROR severity: S_ERROR }
ids { code: SHARD_NOT_AVAILABLE severity: S_ERROR }
ids { code: TX_STATE_UNKNOWN severity: S_ERROR }
ids { code: TX_DECLINED_BY_COORDINATOR severity: S_ERROR }
-ids { code: TX_DECLINED_IMPLICIT_COORDINATOR severity: S_ERROR }
+ids { code: TX_DECLINED_IMPLICIT_COORDINATOR severity: S_ERROR }
ids { code: SHARD_PROGRAM_SIZE_EXCEEDED severity: S_ERROR }
ids { code: SCOPE_REQPROXY severity: S_INFO}
diff --git a/ydb/core/base/localdb.cpp b/ydb/core/base/localdb.cpp
index 3de6ef896f8..d07ee26fc1f 100644
--- a/ydb/core/base/localdb.cpp
+++ b/ydb/core/base/localdb.cpp
@@ -23,14 +23,14 @@ TCompactionPolicy::TBackgroundPolicy::TBackgroundPolicy(ui32 threshold,
, ResourceBrokerTask(resourceBrokerTask)
{}
-TCompactionPolicy::TBackgroundPolicy::TBackgroundPolicy(const NKikimrSchemeOp::TCompactionPolicy::TBackgroundPolicy &policyPb)
+TCompactionPolicy::TBackgroundPolicy::TBackgroundPolicy(const NKikimrSchemeOp::TCompactionPolicy::TBackgroundPolicy &policyPb)
: Threshold(policyPb.HasThreshold() ? policyPb.GetThreshold() : 101)
, PriorityBase(policyPb.HasPriorityBase() ? policyPb.GetPriorityBase() : 100)
, TimeFactor(policyPb.HasTimeFactor() ? policyPb.GetTimeFactor() : 1.0)
, ResourceBrokerTask(policyPb.HasResourceBrokerTask() ? policyPb.GetResourceBrokerTask() : BackgroundCompactionTaskName)
{}
-void TCompactionPolicy::TBackgroundPolicy::Serialize(NKikimrSchemeOp::TCompactionPolicy::TBackgroundPolicy& policyPb) const
+void TCompactionPolicy::TBackgroundPolicy::Serialize(NKikimrSchemeOp::TCompactionPolicy::TBackgroundPolicy& policyPb) const
{
policyPb.SetThreshold(Threshold);
policyPb.SetPriorityBase(PriorityBase);
@@ -60,7 +60,7 @@ TCompactionPolicy::TGenerationPolicy::TGenerationPolicy(ui64 sizeToCompact,
, UpliftPartSize(sizeToCompact / countToCompact)
{}
-TCompactionPolicy::TGenerationPolicy::TGenerationPolicy(const NKikimrSchemeOp::TCompactionPolicy::TGenerationPolicy &policyPb)
+TCompactionPolicy::TGenerationPolicy::TGenerationPolicy(const NKikimrSchemeOp::TCompactionPolicy::TGenerationPolicy &policyPb)
: SizeToCompact(policyPb.HasSizeToCompact() ? policyPb.GetSizeToCompact() : 0)
, CountToCompact(policyPb.HasCountToCompact() ? policyPb.GetCountToCompact() : 5)
, ForceCountToCompact(policyPb.HasForceCountToCompact() ? policyPb.GetForceCountToCompact() : 8)
@@ -79,7 +79,7 @@ TCompactionPolicy::TGenerationPolicy::TGenerationPolicy(const NKikimrSchemeOp::T
ResourceBrokerTask = LegacyQueueIdToTaskName(CompactionBrokerQueue);
}
-void TCompactionPolicy::TGenerationPolicy::Serialize(NKikimrSchemeOp::TCompactionPolicy::TGenerationPolicy& policyPb) const
+void TCompactionPolicy::TGenerationPolicy::Serialize(NKikimrSchemeOp::TCompactionPolicy::TGenerationPolicy& policyPb) const
{
policyPb.SetSizeToCompact(SizeToCompact);
policyPb.SetCountToCompact(CountToCompact);
@@ -115,11 +115,11 @@ TCompactionPolicy::TCompactionPolicy()
, LogOverheadSizeToSnapshot(16 * 1024 * 1024)
, LogOverheadCountToSnapshot(500)
, DroppedRowsPercentToCompact(50)
- , CompactionStrategy(NKikimrSchemeOp::CompactionStrategyUnset)
+ , CompactionStrategy(NKikimrSchemeOp::CompactionStrategyUnset)
, KeepEraseMarkers(false)
{}
-TCompactionPolicy::TCompactionPolicy(const NKikimrSchemeOp::TCompactionPolicy& policyPb)
+TCompactionPolicy::TCompactionPolicy(const NKikimrSchemeOp::TCompactionPolicy& policyPb)
: InMemSizeToSnapshot(policyPb.HasInMemSizeToSnapshot() ? policyPb.GetInMemSizeToSnapshot() : 4 * 1024 * 1024)
, InMemStepsToSnapshot(policyPb.HasInMemStepsToSnapshot() ? policyPb.GetInMemStepsToSnapshot() : 300)
, InMemForceStepsToSnapshot(policyPb.HasInMemForceStepsToSnapshot() ? policyPb.GetInMemForceStepsToSnapshot() : 500)
@@ -158,7 +158,7 @@ TCompactionPolicy::TCompactionPolicy(const NKikimrSchemeOp::TCompactionPolicy& p
}
}
-void TCompactionPolicy::Serialize(NKikimrSchemeOp::TCompactionPolicy& policyPb) const {
+void TCompactionPolicy::Serialize(NKikimrSchemeOp::TCompactionPolicy& policyPb) const {
policyPb.SetInMemSizeToSnapshot(InMemSizeToSnapshot);
policyPb.SetInMemStepsToSnapshot(InMemStepsToSnapshot);
policyPb.SetInMemForceStepsToSnapshot(InMemForceStepsToSnapshot);
@@ -177,7 +177,7 @@ void TCompactionPolicy::Serialize(NKikimrSchemeOp::TCompactionPolicy& policyPb)
policyPb.SetLogOverheadSizeToSnapshot(LogOverheadSizeToSnapshot);
policyPb.SetLogOverheadCountToSnapshot(LogOverheadCountToSnapshot);
policyPb.SetDroppedRowsPercentToCompact(DroppedRowsPercentToCompact);
- if (CompactionStrategy != NKikimrSchemeOp::CompactionStrategyUnset) {
+ if (CompactionStrategy != NKikimrSchemeOp::CompactionStrategyUnset) {
policyPb.SetCompactionStrategy(CompactionStrategy);
}
if (KeepEraseMarkers) {
@@ -197,7 +197,7 @@ void TCompactionPolicy::Serialize(NKikimrSchemeOp::TCompactionPolicy& policyPb)
TCompactionPolicyPtr CreateDefaultTablePolicy() {
TCompactionPolicyPtr policy = new TCompactionPolicy;
#if KIKIMR_DEFAULT_SHARDED_COMPACTION
- policy->CompactionStrategy = NKikimrSchemeOp::CompactionStrategySharded;
+ policy->CompactionStrategy = NKikimrSchemeOp::CompactionStrategySharded;
policy->ShardPolicy.SetTaskPriorityBase(100);
#endif
return policy;
@@ -213,7 +213,7 @@ TCompactionPolicyPtr CreateDefaultUserTablePolicy() {
userPolicy->Generations.push_back({400 * 1024 * 1024, 5, 16, 16ull * 1024 * 1024 * 1024,
LegacyQueueIdToTaskName(3), false});
#if KIKIMR_DEFAULT_SHARDED_COMPACTION
- userPolicy->CompactionStrategy = NKikimrSchemeOp::CompactionStrategySharded;
+ userPolicy->CompactionStrategy = NKikimrSchemeOp::CompactionStrategySharded;
#endif
return userPolicy;
}
diff --git a/ydb/core/base/localdb.h b/ydb/core/base/localdb.h
index 8abd074dab6..8679cb286fc 100644
--- a/ydb/core/base/localdb.h
+++ b/ydb/core/base/localdb.h
@@ -19,9 +19,9 @@ struct TCompactionPolicy : public TThrRefBase {
TBackgroundPolicy();
TBackgroundPolicy(ui32 threshold, ui32 priorityBase, double timeFactor, const TString &resourceBrokerTask);
- TBackgroundPolicy(const NKikimrSchemeOp::TCompactionPolicy::TBackgroundPolicy &policyPb);
+ TBackgroundPolicy(const NKikimrSchemeOp::TCompactionPolicy::TBackgroundPolicy &policyPb);
- void Serialize(NKikimrSchemeOp::TCompactionPolicy::TBackgroundPolicy& policyPb) const;
+ void Serialize(NKikimrSchemeOp::TCompactionPolicy::TBackgroundPolicy& policyPb) const;
bool operator ==(const TBackgroundPolicy& p) const {
return (Threshold == p.Threshold
@@ -50,9 +50,9 @@ struct TCompactionPolicy : public TThrRefBase {
ui64 forceSizeToCompact, const TString &resourceBrokerTask,
bool keepInCache,
const TBackgroundPolicy &backgroundCompactionPolicy = TBackgroundPolicy());
- TGenerationPolicy(const NKikimrSchemeOp::TCompactionPolicy::TGenerationPolicy &policyPb);
+ TGenerationPolicy(const NKikimrSchemeOp::TCompactionPolicy::TGenerationPolicy &policyPb);
- void Serialize(NKikimrSchemeOp::TCompactionPolicy::TGenerationPolicy& policyPb) const;
+ void Serialize(NKikimrSchemeOp::TCompactionPolicy::TGenerationPolicy& policyPb) const;
bool operator ==(const TGenerationPolicy& p) const {
return SizeToCompact == p.SizeToCompact
@@ -89,16 +89,16 @@ struct TCompactionPolicy : public TThrRefBase {
ui64 LogOverheadSizeToSnapshot;
ui32 LogOverheadCountToSnapshot;
ui32 DroppedRowsPercentToCompact;
- NKikimrSchemeOp::ECompactionStrategy CompactionStrategy;
- NKikimrSchemeOp::TCompactionPolicy::TShardPolicy ShardPolicy;
+ NKikimrSchemeOp::ECompactionStrategy CompactionStrategy;
+ NKikimrSchemeOp::TCompactionPolicy::TShardPolicy ShardPolicy;
bool KeepEraseMarkers;
TVector<TGenerationPolicy> Generations;
TCompactionPolicy();
- explicit TCompactionPolicy(const NKikimrSchemeOp::TCompactionPolicy& policyPb);
+ explicit TCompactionPolicy(const NKikimrSchemeOp::TCompactionPolicy& policyPb);
- void Serialize(NKikimrSchemeOp::TCompactionPolicy& policyPb) const;
+ void Serialize(NKikimrSchemeOp::TCompactionPolicy& policyPb) const;
bool operator ==(const TCompactionPolicy& p) const {
return InMemSizeToSnapshot == p.InMemSizeToSnapshot
diff --git a/ydb/core/base/localdb_ut.cpp b/ydb/core/base/localdb_ut.cpp
index 192149762a2..9710d04ccf2 100644
--- a/ydb/core/base/localdb_ut.cpp
+++ b/ydb/core/base/localdb_ut.cpp
@@ -7,7 +7,7 @@ namespace NLocalDb {
Y_UNIT_TEST_SUITE(TLocalDbTest) {
Y_UNIT_TEST(BackupTaskNameChangedAtLoadTime) {
- NKikimrSchemeOp::TCompactionPolicy policyPb;
+ NKikimrSchemeOp::TCompactionPolicy policyPb;
CreateDefaultUserTablePolicy()->Serialize(policyPb);
// We expect default task name to be "scan" at the moment
diff --git a/ydb/core/base/path.cpp b/ydb/core/base/path.cpp
index 9122a32d27e..0cfb16f99dc 100644
--- a/ydb/core/base/path.cpp
+++ b/ydb/core/base/path.cpp
@@ -1,52 +1,52 @@
-#include "path.h"
-
+#include "path.h"
+
#include <util/string/builder.h>
#include <util/string/printf.h>
-namespace NKikimr {
+namespace NKikimr {
TVector<TString> SplitPath(TString path) {
TVector<TString> res;
- if (path.empty())
- return res;
-// xenoxeno: don't do it unless you want YQL to complain about paths...
-// if (*path.begin() != '/')
-// return res;
- size_t prevpos = 0;
- size_t pos = 0;
- size_t len = path.size();
- while (pos < len) {
- if (path[pos] == '/') {
- if (pos != prevpos)
- res.emplace_back(path.substr(prevpos, pos-prevpos));
- ++pos;
- prevpos = pos;
- } else {
- ++pos;
- }
- }
- if (pos != prevpos)
- res.emplace_back(path.substr(prevpos, pos-prevpos));
- return res;
-}
-
+ if (path.empty())
+ return res;
+// xenoxeno: don't do it unless you want YQL to complain about paths...
+// if (*path.begin() != '/')
+// return res;
+ size_t prevpos = 0;
+ size_t pos = 0;
+ size_t len = path.size();
+ while (pos < len) {
+ if (path[pos] == '/') {
+ if (pos != prevpos)
+ res.emplace_back(path.substr(prevpos, pos-prevpos));
+ ++pos;
+ prevpos = pos;
+ } else {
+ ++pos;
+ }
+ }
+ if (pos != prevpos)
+ res.emplace_back(path.substr(prevpos, pos-prevpos));
+ return res;
+}
+
TString JoinPath(const TVector<TString>& path) {
- TString result;
- size_t size = 0;
- for (const TString& s : path) {
- if (size != 0)
- ++size;
- size += s.size();
- }
- result.reserve(size);
- for (const TString& s : path) {
- if (!result.empty())
- result += '/';
- result += s;
- }
- return result;
-}
-
+ TString result;
+ size_t size = 0;
+ for (const TString& s : path) {
+ if (size != 0)
+ ++size;
+ size += s.size();
+ }
+ result.reserve(size);
+ for (const TString& s : path) {
+ if (!result.empty())
+ result += '/';
+ result += s;
+ }
+ return result;
+}
+
TString CanonizePath(const TString &path)
{
if (!path)
@@ -70,49 +70,49 @@ ui32 CanonizedPathLen(const TVector<TString>& path) {
return ret;
}
-TStringBuf ExtractDomain(const TString& path) noexcept {
- auto domain = TStringBuf(path);
-
+TStringBuf ExtractDomain(const TString& path) noexcept {
+ auto domain = TStringBuf(path);
+
return ExtractDomain(domain);
}
TStringBuf ExtractDomain(TStringBuf path) noexcept {
- // coherence with SplitPath and JoinPath that allow no / leading path
+ // coherence with SplitPath and JoinPath that allow no / leading path
path.SkipPrefix(TStringBuf("/"));
-
+
return path.Before('/');
-}
-
-bool IsEqualPaths(const TString& l, const TString& r) noexcept {
- auto left = TStringBuf(l);
- // coherence with SplitPath and JoinPath that allow no / leading path
+}
+
+bool IsEqualPaths(const TString& l, const TString& r) noexcept {
+ auto left = TStringBuf(l);
+ // coherence with SplitPath and JoinPath that allow no / leading path
left.SkipPrefix(TStringBuf("/"));
- // also do not accaunt / at the end
+ // also do not accaunt / at the end
left.ChopSuffix(TStringBuf("/"));
-
- auto right = TStringBuf(r);
+
+ auto right = TStringBuf(r);
right.SkipPrefix(TStringBuf("/"));
right.ChopSuffix(TStringBuf("/"));
-
- return left == right;
-}
-
-bool IsStartWithSlash(const TString &l) {
+
+ return left == right;
+}
+
+bool IsStartWithSlash(const TString &l) {
return TStringBuf(l).StartsWith(TStringBuf("/"));
-}
-
-TString::const_iterator PathPartBrokenAt(const TString &part, const TStringBuf extraSymbols) {
+}
+
+TString::const_iterator PathPartBrokenAt(const TString &part, const TStringBuf extraSymbols) {
static constexpr TStringBuf basicSymbols = "-_.";
- for (auto it = part.begin(); it != part.end(); ++it) {
- if (!isalnum(*it)
- && !basicSymbols.Contains(*it)
- && !extraSymbols.Contains(*it)) {
- return it;
+ for (auto it = part.begin(); it != part.end(); ++it) {
+ if (!isalnum(*it)
+ && !basicSymbols.Contains(*it)
+ && !extraSymbols.Contains(*it)) {
+ return it;
}
}
- return part.end();
-}
+ return part.end();
+}
bool CheckDbPath(const TString &path, const TString &domain, TString &error) {
auto parts = SplitPath(path);
@@ -128,39 +128,39 @@ bool CheckDbPath(const TString &path, const TString &domain, TString &error) {
}
for (auto &part : parts) {
- if (!part) {
- error = "Database names and path parts shouldn't be empty";
+ if (!part) {
+ error = "Database names and path parts shouldn't be empty";
return false;
- }
-
- auto brokenAt = PathPartBrokenAt(part);
- if (brokenAt != part.end()) {
- error = Sprintf("Symbol '%c' is not allowed in database names and path parts ", *brokenAt);
- return false;
- }
+ }
+
+ auto brokenAt = PathPartBrokenAt(part);
+ if (brokenAt != part.end()) {
+ error = Sprintf("Symbol '%c' is not allowed in database names and path parts ", *brokenAt);
+ return false;
+ }
}
return true;
}
-TStringBuf ExtractParent(const TString &path) noexcept {
- TStringBuf parent = TStringBuf(path);
-
- // coherence with SplitPath and JoinPath that allow no / leading path
+TStringBuf ExtractParent(const TString &path) noexcept {
+ TStringBuf parent = TStringBuf(path);
+
+ // coherence with SplitPath and JoinPath that allow no / leading path
parent.ChopSuffix(TStringBuf("/"));
-
- return parent.RBefore('/');
+
+ return parent.RBefore('/');
}
-
-TStringBuf ExtractBase(const TString &path) noexcept {
- TStringBuf parent = TStringBuf(path);
-
- // coherence with SplitPath and JoinPath that allow no / leading path
+
+TStringBuf ExtractBase(const TString &path) noexcept {
+ TStringBuf parent = TStringBuf(path);
+
+ // coherence with SplitPath and JoinPath that allow no / leading path
parent.ChopSuffix(TStringBuf("/"));
-
- return parent.RAfter('/');
-}
-
+
+ return parent.RAfter('/');
+}
+
bool TrySplitPathByDb(const TString& path, const TString& database,
std::pair<TString, TString>& result, TString& error)
{
@@ -202,6 +202,6 @@ bool TrySplitPathByDb(const TString& path, const TString& database,
);
return true;
-}
+}
}
diff --git a/ydb/core/base/path.h b/ydb/core/base/path.h
index bda42ded980..c2b93d2bafd 100644
--- a/ydb/core/base/path.h
+++ b/ydb/core/base/path.h
@@ -1,24 +1,24 @@
-#pragma once
-
-#include <util/generic/vector.h>
-#include <util/generic/string.h>
-#include <util/string/join.h>
-
-namespace NKikimr {
+#pragma once
+
+#include <util/generic/vector.h>
+#include <util/generic/string.h>
+#include <util/string/join.h>
+
+namespace NKikimr {
TVector<TString> SplitPath(TString path);
TString JoinPath(const TVector<TString>& path);
TString CanonizePath(const TString &path);
TString CanonizePath(const TVector<TString>& path);
ui32 CanonizedPathLen(const TVector<TString>& path);
-TStringBuf ExtractDomain(const TString& path) noexcept;
+TStringBuf ExtractDomain(const TString& path) noexcept;
TStringBuf ExtractDomain(TStringBuf path) noexcept;
-TStringBuf ExtractBase(const TString& path) noexcept;
-TStringBuf ExtractParent(const TString& path) noexcept;
-bool IsEqualPaths(const TString& l, const TString& r) noexcept;
-bool IsStartWithSlash(const TString& l);
+TStringBuf ExtractBase(const TString& path) noexcept;
+TStringBuf ExtractParent(const TString& path) noexcept;
+bool IsEqualPaths(const TString& l, const TString& r) noexcept;
+bool IsStartWithSlash(const TString& l);
bool CheckDbPath(const TString &path, const TString &domain, TString &error);
-TString::const_iterator PathPartBrokenAt(const TString &part, const TStringBuf extraSymbols = {});
+TString::const_iterator PathPartBrokenAt(const TString &part, const TStringBuf extraSymbols = {});
bool TrySplitPathByDb(const TString& path, const TString& database,
std::pair<TString, TString>& result, TString& error);
@@ -28,6 +28,6 @@ TString CombinePath(TIter begin, TIter end, bool canonize = true) {
return canonize
? CanonizePath(path)
: path;
-}
+}
}
diff --git a/ydb/core/base/pathid.cpp b/ydb/core/base/pathid.cpp
index 962a27b5a15..0ad8a2d93cf 100644
--- a/ydb/core/base/pathid.cpp
+++ b/ydb/core/base/pathid.cpp
@@ -47,38 +47,38 @@ bool TPathId::operator!=(const TPathId& x) const {
return OwnerId != x.OwnerId || LocalPathId != x.LocalPathId;
}
-TPathId TPathId::NextId() const {
- if (!this->operator bool()) {
- return TPathId();
- }
-
- if (LocalPathId + 1 == InvalidLocalPathId) {
- if (OwnerId + 1 == InvalidOwnerId) {
- return TPathId();
- }
-
- return TPathId(OwnerId + 1, 0);
- }
-
- return TPathId(OwnerId, LocalPathId + 1);
-}
-
-TPathId TPathId::PrevId() const {
- if (!this->operator bool()) {
- return TPathId();
- }
-
- if (LocalPathId == 0) {
- if (OwnerId == 0) {
- return TPathId();
- }
-
- return TPathId(OwnerId - 1, Max<ui64>() - 1);
- }
-
- return TPathId(OwnerId, LocalPathId - 1);
-}
-
+TPathId TPathId::NextId() const {
+ if (!this->operator bool()) {
+ return TPathId();
+ }
+
+ if (LocalPathId + 1 == InvalidLocalPathId) {
+ if (OwnerId + 1 == InvalidOwnerId) {
+ return TPathId();
+ }
+
+ return TPathId(OwnerId + 1, 0);
+ }
+
+ return TPathId(OwnerId, LocalPathId + 1);
+}
+
+TPathId TPathId::PrevId() const {
+ if (!this->operator bool()) {
+ return TPathId();
+ }
+
+ if (LocalPathId == 0) {
+ if (OwnerId == 0) {
+ return TPathId();
+ }
+
+ return TPathId(OwnerId - 1, Max<ui64>() - 1);
+ }
+
+ return TPathId(OwnerId, LocalPathId - 1);
+}
+
TPathId::operator bool() const {
return OwnerId != InvalidOwnerId && LocalPathId != InvalidLocalPathId;
}
diff --git a/ydb/core/base/pathid.h b/ydb/core/base/pathid.h
index 67757a59667..e974f846134 100644
--- a/ydb/core/base/pathid.h
+++ b/ydb/core/base/pathid.h
@@ -7,24 +7,24 @@
namespace NKikimr {
using TOwnerId = ui64;
-constexpr TOwnerId InvalidOwnerId = Max<ui64>();
+constexpr TOwnerId InvalidOwnerId = Max<ui64>();
using TLocalPathId = ui64;
-constexpr TLocalPathId InvalidLocalPathId = Max<ui64>();
+constexpr TLocalPathId InvalidLocalPathId = Max<ui64>();
struct TPathId {
TOwnerId OwnerId;
TLocalPathId LocalPathId;
- constexpr TPathId()
- : OwnerId(InvalidOwnerId)
- , LocalPathId(InvalidLocalPathId)
- {}
- constexpr TPathId(const TOwnerId ownerId, const TLocalPathId localPathId)
- : OwnerId(ownerId)
- , LocalPathId(localPathId)
- {
- }
+ constexpr TPathId()
+ : OwnerId(InvalidOwnerId)
+ , LocalPathId(InvalidLocalPathId)
+ {}
+ constexpr TPathId(const TOwnerId ownerId, const TLocalPathId localPathId)
+ : OwnerId(ownerId)
+ , LocalPathId(localPathId)
+ {
+ }
ui64 Hash() const;
TString ToString() const;
@@ -38,9 +38,9 @@ struct TPathId {
bool operator!=(const TPathId& x) const;
explicit operator bool() const;
- TPathId NextId() const;
- TPathId PrevId() const;
-
+ TPathId NextId() const;
+ TPathId PrevId() const;
+
}; // TPathId
TPathId PathIdFromPathId(const NKikimrProto::TPathID& proto);
diff --git a/ydb/core/base/resource_profile.h b/ydb/core/base/resource_profile.h
index 9c4e37d696a..113b1dd65e3 100644
--- a/ydb/core/base/resource_profile.h
+++ b/ydb/core/base/resource_profile.h
@@ -14,7 +14,7 @@ namespace NKikimr {
class TResourceProfiles : public TThrRefBase {
public:
- using TResourceProfile = NKikimrSchemeOp::TResourceProfile;
+ using TResourceProfile = NKikimrSchemeOp::TResourceProfile;
using TPtr = std::shared_ptr<TResourceProfile>;
private:
diff --git a/ydb/core/base/storage_pools.cpp b/ydb/core/base/storage_pools.cpp
index cb39532b19f..0a9c42a579e 100644
--- a/ydb/core/base/storage_pools.cpp
+++ b/ydb/core/base/storage_pools.cpp
@@ -1,12 +1,12 @@
-#include "storage_pools.h"
-
-NKikimr::TStoragePool::TStoragePool(const NKikimrStoragePool::TStoragePool &pool)
- : TBase(pool.GetName(), pool.GetKind())
-{}
-
-NKikimr::TStoragePool::operator NKikimrStoragePool::TStoragePool() const {
- NKikimrStoragePool::TStoragePool pool;
- pool.SetName(GetName());
- pool.SetKind(GetKind());
- return pool;
-}
+#include "storage_pools.h"
+
+NKikimr::TStoragePool::TStoragePool(const NKikimrStoragePool::TStoragePool &pool)
+ : TBase(pool.GetName(), pool.GetKind())
+{}
+
+NKikimr::TStoragePool::operator NKikimrStoragePool::TStoragePool() const {
+ NKikimrStoragePool::TStoragePool pool;
+ pool.SetName(GetName());
+ pool.SetKind(GetKind());
+ return pool;
+}
diff --git a/ydb/core/base/storage_pools.h b/ydb/core/base/storage_pools.h
index 3b4302569a4..e8a997c7251 100644
--- a/ydb/core/base/storage_pools.h
+++ b/ydb/core/base/storage_pools.h
@@ -1,94 +1,94 @@
-#pragma once
-
+#pragma once
+
#include <ydb/core/protos/bind_channel_storage_pool.pb.h>
#include <ydb/core/protos/channel_purpose.pb.h>
-
-#include <util/system/types.h>
-#include <util/generic/vector.h>
-#include <util/generic/map.h>
-
-namespace NKikimr {
-
-struct TStoragePool: public std::pair<TString, TString> {
- using TBase = std::pair<TString, TString>;
-
- using TBase::TBase;
- TStoragePool(const NKikimrStoragePool::TStoragePool& pool);
-
- const TString& GetName() const {
- return first;
- }
-
- const TString& GetKind() const {
- return second;
- }
-
- operator NKikimrStoragePool::TStoragePool() const;
-};
-
-using TStoragePools = TVector<TStoragePool>;
-
+
+#include <util/system/types.h>
+#include <util/generic/vector.h>
+#include <util/generic/map.h>
+
+namespace NKikimr {
+
+struct TStoragePool: public std::pair<TString, TString> {
+ using TBase = std::pair<TString, TString>;
+
+ using TBase::TBase;
+ TStoragePool(const NKikimrStoragePool::TStoragePool& pool);
+
+ const TString& GetName() const {
+ return first;
+ }
+
+ const TString& GetKind() const {
+ return second;
+ }
+
+ operator NKikimrStoragePool::TStoragePool() const;
+};
+
+using TStoragePools = TVector<TStoragePool>;
+
using TChannelBind = NKikimrStoragePool::TChannelBind;
-
-using TChannelsBindings = TVector<TChannelBind>;
-
-struct TStorageRoom: public TThrRefBase {
-public:
- using TPtr = TIntrusivePtr<TStorageRoom>;
- using EPurpose = NKikimrStorageSettings::TChannelPurpose::EPurpose;
-
-private:
- ui32 RoomId;
- TMap<EPurpose, ui32> Purposes;
-
-public:
- TStorageRoom(ui32 id)
- : RoomId(id)
- {}
-
- TStorageRoom(const NKikimrStorageSettings::TStorageRoom& room)
- : RoomId(room.GetRoomId())
- {
- for (auto& explanation: room.GetExplanation()) {
- AssignChannel(explanation.GetPurpose(), explanation.GetChannel());
- }
- }
-
- void AssignChannel(EPurpose purpose, ui32 channel) {
- bool repeated = Purposes.emplace(purpose, channel).second;
- Y_VERIFY(repeated, "reassign is forbided, channle purpose was %s chennel id was %d",
- NKikimrStorageSettings::TChannelPurpose::EPurpose_Name(purpose).c_str(),
- channel);
- }
-
- ui32 GetChannel(EPurpose purpose, ui32 defaultChannel) const {
- auto it = Purposes.find(purpose);
-
- if (it == Purposes.end()) {
- return defaultChannel;
- }
-
- return it->second;
- }
-
- operator NKikimrStorageSettings::TStorageRoom() const {
- NKikimrStorageSettings::TStorageRoom room;
- room.SetRoomId(RoomId);
- for (auto& item: Purposes) {
- auto layout = room.AddExplanation();
- layout->SetChannel(item.second);
- layout->SetPurpose(item.first);
- }
- return room;
- }
-
- ui32 GetId() const {
- return RoomId;
- }
-
- operator bool() const {
- return !!Purposes;
- }
-};
-
-}
+
+using TChannelsBindings = TVector<TChannelBind>;
+
+struct TStorageRoom: public TThrRefBase {
+public:
+ using TPtr = TIntrusivePtr<TStorageRoom>;
+ using EPurpose = NKikimrStorageSettings::TChannelPurpose::EPurpose;
+
+private:
+ ui32 RoomId;
+ TMap<EPurpose, ui32> Purposes;
+
+public:
+ TStorageRoom(ui32 id)
+ : RoomId(id)
+ {}
+
+ TStorageRoom(const NKikimrStorageSettings::TStorageRoom& room)
+ : RoomId(room.GetRoomId())
+ {
+ for (auto& explanation: room.GetExplanation()) {
+ AssignChannel(explanation.GetPurpose(), explanation.GetChannel());
+ }
+ }
+
+ void AssignChannel(EPurpose purpose, ui32 channel) {
+ bool repeated = Purposes.emplace(purpose, channel).second;
+ Y_VERIFY(repeated, "reassign is forbided, channle purpose was %s chennel id was %d",
+ NKikimrStorageSettings::TChannelPurpose::EPurpose_Name(purpose).c_str(),
+ channel);
+ }
+
+ ui32 GetChannel(EPurpose purpose, ui32 defaultChannel) const {
+ auto it = Purposes.find(purpose);
+
+ if (it == Purposes.end()) {
+ return defaultChannel;
+ }
+
+ return it->second;
+ }
+
+ operator NKikimrStorageSettings::TStorageRoom() const {
+ NKikimrStorageSettings::TStorageRoom room;
+ room.SetRoomId(RoomId);
+ for (auto& item: Purposes) {
+ auto layout = room.AddExplanation();
+ layout->SetChannel(item.second);
+ layout->SetPurpose(item.first);
+ }
+ return room;
+ }
+
+ ui32 GetId() const {
+ return RoomId;
+ }
+
+ operator bool() const {
+ return !!Purposes;
+ }
+};
+
+}
diff --git a/ydb/core/base/subdomain.cpp b/ydb/core/base/subdomain.cpp
index 04d6e213479..7725571666f 100644
--- a/ydb/core/base/subdomain.cpp
+++ b/ydb/core/base/subdomain.cpp
@@ -1,36 +1,36 @@
-#include "subdomain.h"
-
+#include "subdomain.h"
+
#include <ydb/core/base/defs.h>
-
-namespace NKikimr {
+
+namespace NKikimr {
TSubDomainKey::TSubDomainKey(ui64 shardId, ui64 pathId)
: TBase(shardId, pathId)
{}
-TSubDomainKey::TSubDomainKey(const NKikimrSubDomains::TDomainKey &domainKey)
- : TBase(domainKey.GetSchemeShard(), domainKey.GetPathId())
-{}
-
-ui64 TSubDomainKey::GetSchemeShard() const {
- return first;
-}
-
-ui64 TSubDomainKey::GetPathId() const {
- return second;
-}
-
-ui64 TSubDomainKey::Hash() const noexcept {
- return Hash128to32(GetSchemeShard(), GetPathId());
-}
-
-TSubDomainKey::operator NKikimrSubDomains::TDomainKey() const {
- NKikimrSubDomains::TDomainKey result;
- result.SetSchemeShard(GetSchemeShard());
- result.SetPathId(GetPathId());
- return result;
-}
-
-TSubDomainKey::operator bool() const {
- return GetSchemeShard() || GetPathId();
-}
-}
+TSubDomainKey::TSubDomainKey(const NKikimrSubDomains::TDomainKey &domainKey)
+ : TBase(domainKey.GetSchemeShard(), domainKey.GetPathId())
+{}
+
+ui64 TSubDomainKey::GetSchemeShard() const {
+ return first;
+}
+
+ui64 TSubDomainKey::GetPathId() const {
+ return second;
+}
+
+ui64 TSubDomainKey::Hash() const noexcept {
+ return Hash128to32(GetSchemeShard(), GetPathId());
+}
+
+TSubDomainKey::operator NKikimrSubDomains::TDomainKey() const {
+ NKikimrSubDomains::TDomainKey result;
+ result.SetSchemeShard(GetSchemeShard());
+ result.SetPathId(GetPathId());
+ return result;
+}
+
+TSubDomainKey::operator bool() const {
+ return GetSchemeShard() || GetPathId();
+}
+}
diff --git a/ydb/core/base/subdomain.h b/ydb/core/base/subdomain.h
index 0aea8d5d976..0e1101bc781 100644
--- a/ydb/core/base/subdomain.h
+++ b/ydb/core/base/subdomain.h
@@ -1,44 +1,44 @@
-#pragma once
-
+#pragma once
+
#include <ydb/core/protos/subdomains.pb.h>
-
-#include <util/system/types.h>
-#include <utility>
-
-namespace NKikimr {
-struct TSubDomainKey : public std::pair<ui64, ui64> {
- using TBase = std::pair<ui64, ui64>;
-
- using TBase::TBase;
- TSubDomainKey() = default;
+
+#include <util/system/types.h>
+#include <utility>
+
+namespace NKikimr {
+struct TSubDomainKey : public std::pair<ui64, ui64> {
+ using TBase = std::pair<ui64, ui64>;
+
+ using TBase::TBase;
+ TSubDomainKey() = default;
TSubDomainKey(const TSubDomainKey&) = default;
TSubDomainKey(TSubDomainKey&&) = default;
TSubDomainKey(ui64 shardId, ui64 pathId);
- explicit TSubDomainKey(const NKikimrSubDomains::TDomainKey &domainKey);
-
+ explicit TSubDomainKey(const NKikimrSubDomains::TDomainKey &domainKey);
+
TSubDomainKey& operator =(const TSubDomainKey&) = default;
TSubDomainKey& operator =(TSubDomainKey&&) = default;
- ui64 GetSchemeShard() const;
- ui64 GetPathId() const;
-
- operator NKikimrSubDomains::TDomainKey() const;
- operator bool() const;
-
- ui64 Hash() const noexcept;
-};
-
-static const TSubDomainKey InvalidSubDomainKey = TSubDomainKey();
-}
-
-template <>
-struct THash<NKikimr::TSubDomainKey> {
- inline ui64 operator()(const NKikimr::TSubDomainKey &x) const {
- return x.Hash();
- }
-};
-
-template<>
-inline void Out<NKikimr::TSubDomainKey>(IOutputStream &o, const NKikimr::TSubDomainKey &x) {
- o << x.GetSchemeShard() << ":" << x.GetPathId();
-}
+ ui64 GetSchemeShard() const;
+ ui64 GetPathId() const;
+
+ operator NKikimrSubDomains::TDomainKey() const;
+ operator bool() const;
+
+ ui64 Hash() const noexcept;
+};
+
+static const TSubDomainKey InvalidSubDomainKey = TSubDomainKey();
+}
+
+template <>
+struct THash<NKikimr::TSubDomainKey> {
+ inline ui64 operator()(const NKikimr::TSubDomainKey &x) const {
+ return x.Hash();
+ }
+};
+
+template<>
+inline void Out<NKikimr::TSubDomainKey>(IOutputStream &o, const NKikimr::TSubDomainKey &x) {
+ o << x.GetSchemeShard() << ":" << x.GetPathId();
+}
diff --git a/ydb/core/base/table_index.cpp b/ydb/core/base/table_index.cpp
index 2aa8b381b97..ac89504ef1b 100644
--- a/ydb/core/base/table_index.cpp
+++ b/ydb/core/base/table_index.cpp
@@ -1,67 +1,67 @@
-#include "table_index.h"
-
-TVector<TString>::const_iterator IsUniq(const TVector<TString>& names) {
- THashSet<TString> tmp;
-
- for (auto it = names.begin(); it != names.end(); ++it) {
- bool inserted = tmp.insert(*it).second;
- if (!inserted) {
- return it;
- }
- }
-
- return names.end();
-}
-
-namespace NKikimr {
-namespace NTableIndex {
-
+#include "table_index.h"
+
+TVector<TString>::const_iterator IsUniq(const TVector<TString>& names) {
+ THashSet<TString> tmp;
+
+ for (auto it = names.begin(); it != names.end(); ++it) {
+ bool inserted = tmp.insert(*it).second;
+ if (!inserted) {
+ return it;
+ }
+ }
+
+ return names.end();
+}
+
+namespace NKikimr {
+namespace NTableIndex {
+
TTableColumns CalcTableImplDescription(const TTableColumns& table, const TIndexColumns& index) {
- {
- TString explain;
- Y_VERIFY(IsCompatibleIndex(table, index, explain), "explain is %s", explain.c_str());
- }
-
- TTableColumns result;
-
+ {
+ TString explain;
+ Y_VERIFY(IsCompatibleIndex(table, index, explain), "explain is %s", explain.c_str());
+ }
+
+ TTableColumns result;
+
for (const auto& ik: index.KeyColumns) {
- result.Keys.push_back(ik);
- result.Columns.insert(ik);
- }
-
+ result.Keys.push_back(ik);
+ result.Columns.insert(ik);
+ }
+
for (const auto& tk: table.Keys) {
- if (!result.Columns.contains(tk)) {
- result.Keys.push_back(tk);
- result.Columns.insert(tk);
- }
- }
-
+ if (!result.Columns.contains(tk)) {
+ result.Keys.push_back(tk);
+ result.Columns.insert(tk);
+ }
+ }
+
for (const auto& dk: index.DataColumns) {
result.Columns.insert(dk);
}
- return result;
-}
-
+ return result;
+}
+
bool IsCompatibleIndex(const TTableColumns& table, const TIndexColumns& index, TString& explain) {
- {
- auto brokenAt = IsUniq(table.Keys);
- if (brokenAt != table.Keys.end()) {
- explain = TStringBuilder()
- << "all table keys should be uniq, for example " << *brokenAt;
- return false;
- }
- }
-
- {
+ {
+ auto brokenAt = IsUniq(table.Keys);
+ if (brokenAt != table.Keys.end()) {
+ explain = TStringBuilder()
+ << "all table keys should be uniq, for example " << *brokenAt;
+ return false;
+ }
+ }
+
+ {
auto brokenAt = IsUniq(index.KeyColumns);
if (brokenAt != index.KeyColumns.end()) {
- explain = TStringBuilder()
- << "all index keys should be uniq, for example " << *brokenAt;
- return false;
- }
- }
-
+ explain = TStringBuilder()
+ << "all index keys should be uniq, for example " << *brokenAt;
+ return false;
+ }
+ }
+
{
auto brokenAt = IsUniq(index.DataColumns);
if (brokenAt != index.DataColumns.end()) {
@@ -75,30 +75,30 @@ bool IsCompatibleIndex(const TTableColumns& table, const TIndexColumns& index, T
for (const auto& tableKeyName: table.Keys) {
indexKeys.insert(tableKeyName);
- if (!table.Columns.contains(tableKeyName)) {
- explain = TStringBuilder()
- << "all table keys should be in table columns too"
- << ", table key " << tableKeyName << " is missed";
- return false;
- }
- }
-
+ if (!table.Columns.contains(tableKeyName)) {
+ explain = TStringBuilder()
+ << "all table keys should be in table columns too"
+ << ", table key " << tableKeyName << " is missed";
+ return false;
+ }
+ }
+
for (const auto& indexKeyName: index.KeyColumns) {
indexKeys.insert(indexKeyName);
- if (!table.Columns.contains(indexKeyName)) {
- explain = TStringBuilder()
- << "all index keys should be in table columns"
- << ", index key " << indexKeyName << " is missed";
- return false;
- }
- }
-
+ if (!table.Columns.contains(indexKeyName)) {
+ explain = TStringBuilder()
+ << "all index keys should be in table columns"
+ << ", index key " << indexKeyName << " is missed";
+ return false;
+ }
+ }
+
if (index.KeyColumns == table.Keys) {
- explain = TStringBuilder()
- << "table and index keys are the same";
- return false;
- }
-
+ explain = TStringBuilder()
+ << "table and index keys are the same";
+ return false;
+ }
+
for (const auto& dataName: index.DataColumns) {
if (indexKeys.contains(dataName)) {
explain = TStringBuilder()
@@ -113,8 +113,8 @@ bool IsCompatibleIndex(const TTableColumns& table, const TIndexColumns& index, T
}
}
- return true;
-}
-
-}
-}
+ return true;
+}
+
+}
+}
diff --git a/ydb/core/base/table_index.h b/ydb/core/base/table_index.h
index 6039b971ad9..ea1328cdb61 100644
--- a/ydb/core/base/table_index.h
+++ b/ydb/core/base/table_index.h
@@ -1,25 +1,25 @@
-#pragma once
-
-#include <util/generic/hash_set.h>
-#include <util/generic/vector.h>
-#include <util/generic/string.h>
-#include <util/string/builder.h>
-
-namespace NKikimr {
-namespace NTableIndex {
-
-struct TTableColumns {
- THashSet<TString> Columns;
- TVector<TString> Keys;
-};
-
+#pragma once
+
+#include <util/generic/hash_set.h>
+#include <util/generic/vector.h>
+#include <util/generic/string.h>
+#include <util/string/builder.h>
+
+namespace NKikimr {
+namespace NTableIndex {
+
+struct TTableColumns {
+ THashSet<TString> Columns;
+ TVector<TString> Keys;
+};
+
struct TIndexColumns {
TVector<TString> KeyColumns;
TVector<TString> DataColumns;
};
-
+
bool IsCompatibleIndex(const TTableColumns& table, const TIndexColumns& index, TString& explain);
TTableColumns CalcTableImplDescription(const TTableColumns& table, const TIndexColumns &index);
-
-}
-}
+
+}
+}
diff --git a/ydb/core/base/tabletid.h b/ydb/core/base/tabletid.h
index f97d4801708..cd0a7cb58f0 100644
--- a/ydb/core/base/tabletid.h
+++ b/ydb/core/base/tabletid.h
@@ -20,29 +20,29 @@ namespace NKikimr {
return (tabletId & 0x00000FFFFFFFFFFFull);
}
- inline ui64 AvoidReservedUniqPart(ui64 candidate, ui64 brokenBegin, ui64 brokenEnd) {
- if (candidate >= brokenBegin && candidate < brokenEnd) {
- return brokenEnd;
- }
- return candidate;
- }
-
+ inline ui64 AvoidReservedUniqPart(ui64 candidate, ui64 brokenBegin, ui64 brokenEnd) {
+ if (candidate >= brokenBegin && candidate < brokenEnd) {
+ return brokenEnd;
+ }
+ return candidate;
+ }
+
static const ui64 TABLET_ID_BLACKHOLE_BEGIN = 0x800000;
static const ui64 TABLET_ID_BLACKHOLE_END = 0x900000;
- inline ui64 AvoidReservedUniqPartsBySystemTablets(ui64 candidate) {
- // candidate = AvoidReservedUniqPart(candidate, 0x800000, 0x800100); // coordinators
- // candidate = AvoidReservedUniqPart(candidate, 0x810000, 0x810100); // mediators
- // candidate = AvoidReservedUniqPart(candidate, 0x820000, 0x821000); // allocators
- // candidate = AvoidReservedUniqPart(candidate, 0x840000, 0x860000); // schemeshard
+ inline ui64 AvoidReservedUniqPartsBySystemTablets(ui64 candidate) {
+ // candidate = AvoidReservedUniqPart(candidate, 0x800000, 0x800100); // coordinators
+ // candidate = AvoidReservedUniqPart(candidate, 0x810000, 0x810100); // mediators
+ // candidate = AvoidReservedUniqPart(candidate, 0x820000, 0x821000); // allocators
+ // candidate = AvoidReservedUniqPart(candidate, 0x840000, 0x860000); // schemeshard
return AvoidReservedUniqPart(candidate, TABLET_ID_BLACKHOLE_BEGIN, TABLET_ID_BLACKHOLE_END); // for sure
- }
-
- inline bool IsReservedTabletId(ui64 tabletId) {
- const ui64 uniqPart = UniqPartFromTabletID(tabletId);
- return uniqPart != AvoidReservedUniqPartsBySystemTablets(uniqPart);
- }
-
+ }
+
+ inline bool IsReservedTabletId(ui64 tabletId) {
+ const ui64 uniqPart = UniqPartFromTabletID(tabletId);
+ return uniqPart != AvoidReservedUniqPartsBySystemTablets(uniqPart);
+ }
+
// 8 + 12 + 44
inline ui64 MakeTabletID(ui64 stateStorageGroup, ui64 hiveUid, ui64 uniqPart) {
Y_VERIFY(stateStorageGroup < (1ull << 8ull) && hiveUid < (1ull << 12ull) && uniqPart < (1ull << 44ull));
diff --git a/ydb/core/base/tx_processing.cpp b/ydb/core/base/tx_processing.cpp
index d2c4f4b29f0..a017f670188 100644
--- a/ydb/core/base/tx_processing.cpp
+++ b/ydb/core/base/tx_processing.cpp
@@ -1,91 +1,91 @@
-#include "tx_processing.h"
-
-#include "defs.h"
-
-NKikimr::TCoordinators::TCoordinators(const NKikimrSubDomains::TProcessingParams &processing)
- : Coordinators(processing.GetCoordinators().begin(), processing.GetCoordinators().end())
-{}
-
-NKikimr::TCoordinators::TCoordinators(const NKikimr::TDomainsInfo::TDomain &domain)
- : Coordinators(domain.Coordinators)
-{}
-
+#include "tx_processing.h"
+
+#include "defs.h"
+
+NKikimr::TCoordinators::TCoordinators(const NKikimrSubDomains::TProcessingParams &processing)
+ : Coordinators(processing.GetCoordinators().begin(), processing.GetCoordinators().end())
+{}
+
+NKikimr::TCoordinators::TCoordinators(const NKikimr::TDomainsInfo::TDomain &domain)
+ : Coordinators(domain.Coordinators)
+{}
+
NKikimr::TCoordinators::TCoordinators(const TVector<ui64> &coordinators)
- : Coordinators(coordinators)
-{}
-
+ : Coordinators(coordinators)
+{}
+
NKikimr::TCoordinators::TCoordinators(TVector<ui64> &&coordinators)
- : Coordinators(std::move(coordinators))
-{}
-
-
-ui64 NKikimr::TCoordinators::Select(ui64 txId) const {
- if (Coordinators.size()) {
- return Coordinators[txId % Coordinators.size()];
- }
- return 0;
-}
-
+ : Coordinators(std::move(coordinators))
+{}
+
+
+ui64 NKikimr::TCoordinators::Select(ui64 txId) const {
+ if (Coordinators.size()) {
+ return Coordinators[txId % Coordinators.size()];
+ }
+ return 0;
+}
+
const TVector<ui64> &NKikimr::TCoordinators::List() const {
- return Coordinators;
-}
-
-NKikimr::TMediators::TMediators(const NKikimrSubDomains::TProcessingParams &processing)
- : Mediators(processing.GetMediators().begin(), processing.GetMediators().end())
-{}
-
-NKikimr::TMediators::TMediators(const NKikimr::TDomainsInfo::TDomain &domain)
- : Mediators(domain.Mediators)
-{}
-
+ return Coordinators;
+}
+
+NKikimr::TMediators::TMediators(const NKikimrSubDomains::TProcessingParams &processing)
+ : Mediators(processing.GetMediators().begin(), processing.GetMediators().end())
+{}
+
+NKikimr::TMediators::TMediators(const NKikimr::TDomainsInfo::TDomain &domain)
+ : Mediators(domain.Mediators)
+{}
+
NKikimr::TMediators::TMediators(const TVector<ui64> &mediators)
- : Mediators(mediators)
-{}
-
+ : Mediators(mediators)
+{}
+
NKikimr::TMediators::TMediators(TVector<ui64> &&mediators)
- : Mediators(std::move(mediators))
-{}
-
-ui64 NKikimr::TMediators::Select(ui64 tabletId) const {
- return Mediators[Hash64to32(tabletId) % Mediators.size()];
-}
-
+ : Mediators(std::move(mediators))
+{}
+
+ui64 NKikimr::TMediators::Select(ui64 tabletId) const {
+ return Mediators[Hash64to32(tabletId) % Mediators.size()];
+}
+
const TVector<ui64> &NKikimr::TMediators::List() const {
- return Mediators;
-}
-
-NKikimrSubDomains::TProcessingParams NKikimr::ExtractProcessingParams(const NKikimr::TDomainsInfo::TDomain &domain) {
- NKikimrSubDomains::TProcessingParams params;
- params.SetVersion(0);
- params.SetPlanResolution(domain.DomainPlanResolution);
- for (ui64 coordinator: domain.Coordinators) {
- params.AddCoordinators(coordinator);
- }
- params.SetTimeCastBucketsPerMediator(domain.TimecastBucketsPerMediator);
- for (ui64 mediator: domain.Mediators) {
- params.AddMediators(mediator);
- }
- return params;
-}
-
-NKikimr::TTimeCastBuckets::TTimeCastBuckets()
- : TimecastBucketsPerMediator(TDomainsInfo::TDomain::TimecastBucketsPerMediator)
-{}
-
-NKikimr::TTimeCastBuckets::TTimeCastBuckets(ui32 timecastBuckets)
- : TimecastBucketsPerMediator(timecastBuckets)
-{
- Y_VERIFY(TimecastBucketsPerMediator);
-}
-
-NKikimr::TTimeCastBuckets::TTimeCastBuckets(const NKikimrSubDomains::TProcessingParams &processing)
- : TTimeCastBuckets(processing.GetTimeCastBucketsPerMediator())
-{}
-
-ui32 NKikimr::TTimeCastBuckets::Select(ui64 tabletId) const {
- return tabletId % TimecastBucketsPerMediator;
-}
-
-ui32 NKikimr::TTimeCastBuckets::Buckets() const {
- return TimecastBucketsPerMediator;
-}
+ return Mediators;
+}
+
+NKikimrSubDomains::TProcessingParams NKikimr::ExtractProcessingParams(const NKikimr::TDomainsInfo::TDomain &domain) {
+ NKikimrSubDomains::TProcessingParams params;
+ params.SetVersion(0);
+ params.SetPlanResolution(domain.DomainPlanResolution);
+ for (ui64 coordinator: domain.Coordinators) {
+ params.AddCoordinators(coordinator);
+ }
+ params.SetTimeCastBucketsPerMediator(domain.TimecastBucketsPerMediator);
+ for (ui64 mediator: domain.Mediators) {
+ params.AddMediators(mediator);
+ }
+ return params;
+}
+
+NKikimr::TTimeCastBuckets::TTimeCastBuckets()
+ : TimecastBucketsPerMediator(TDomainsInfo::TDomain::TimecastBucketsPerMediator)
+{}
+
+NKikimr::TTimeCastBuckets::TTimeCastBuckets(ui32 timecastBuckets)
+ : TimecastBucketsPerMediator(timecastBuckets)
+{
+ Y_VERIFY(TimecastBucketsPerMediator);
+}
+
+NKikimr::TTimeCastBuckets::TTimeCastBuckets(const NKikimrSubDomains::TProcessingParams &processing)
+ : TTimeCastBuckets(processing.GetTimeCastBucketsPerMediator())
+{}
+
+ui32 NKikimr::TTimeCastBuckets::Select(ui64 tabletId) const {
+ return tabletId % TimecastBucketsPerMediator;
+}
+
+ui32 NKikimr::TTimeCastBuckets::Buckets() const {
+ return TimecastBucketsPerMediator;
+}
diff --git a/ydb/core/base/tx_processing.h b/ydb/core/base/tx_processing.h
index f1e9fb061a7..17e5e7062cf 100644
--- a/ydb/core/base/tx_processing.h
+++ b/ydb/core/base/tx_processing.h
@@ -1,55 +1,55 @@
-#pragma once
-
-#include "domain.h"
-
+#pragma once
+
+#include "domain.h"
+
#include <ydb/core/protos/subdomains.pb.h>
-
-#include <util/generic/vector.h>
-#include <util/generic/ptr.h>
-
-namespace NKikimr {
- NKikimrSubDomains::TProcessingParams ExtractProcessingParams(const TDomainsInfo::TDomain &domain);
-
- struct TCoordinators: TAtomicRefCount<TCoordinators> {
- using TPtr = TIntrusiveConstPtr<TCoordinators>;
-
+
+#include <util/generic/vector.h>
+#include <util/generic/ptr.h>
+
+namespace NKikimr {
+ NKikimrSubDomains::TProcessingParams ExtractProcessingParams(const TDomainsInfo::TDomain &domain);
+
+ struct TCoordinators: TAtomicRefCount<TCoordinators> {
+ using TPtr = TIntrusiveConstPtr<TCoordinators>;
+
const TVector<ui64> Coordinators;
-
- TCoordinators(const NKikimrSubDomains::TProcessingParams &processing);
- TCoordinators(const TDomainsInfo::TDomain &domain);
-
+
+ TCoordinators(const NKikimrSubDomains::TProcessingParams &processing);
+ TCoordinators(const TDomainsInfo::TDomain &domain);
+
TCoordinators(const TVector<ui64> &coordinators);
TCoordinators(TVector<ui64> &&coordinators);
-
- ui64 Select(ui64 txId) const;
+
+ ui64 Select(ui64 txId) const;
const TVector<ui64>& List() const;
- };
-
- struct TMediators: TAtomicRefCount<TMediators> {
- using TPtr = TIntrusiveConstPtr<TMediators>;
-
+ };
+
+ struct TMediators: TAtomicRefCount<TMediators> {
+ using TPtr = TIntrusiveConstPtr<TMediators>;
+
const TVector<ui64> Mediators;
-
- TMediators(const NKikimrSubDomains::TProcessingParams &processing);
- TMediators(const TDomainsInfo::TDomain &domain);
-
+
+ TMediators(const NKikimrSubDomains::TProcessingParams &processing);
+ TMediators(const TDomainsInfo::TDomain &domain);
+
TMediators(const TVector<ui64> &mediators);
TMediators(TVector<ui64> &&mediators);
-
- ui64 Select(ui64 tabletId) const;
+
+ ui64 Select(ui64 tabletId) const;
const TVector<ui64>& List() const;
- };
-
- struct TTimeCastBuckets: TAtomicRefCount<TTimeCastBuckets> {
- using TPtr = TIntrusiveConstPtr<TTimeCastBuckets>;
-
- const ui32 TimecastBucketsPerMediator;
-
- TTimeCastBuckets();
- TTimeCastBuckets(ui32 timecastBuckets);
- TTimeCastBuckets(const NKikimrSubDomains::TProcessingParams &processing);
-
- ui32 Select(ui64 tabletId) const;
- ui32 Buckets() const;
- };
-}
+ };
+
+ struct TTimeCastBuckets: TAtomicRefCount<TTimeCastBuckets> {
+ using TPtr = TIntrusiveConstPtr<TTimeCastBuckets>;
+
+ const ui32 TimecastBucketsPerMediator;
+
+ TTimeCastBuckets();
+ TTimeCastBuckets(ui32 timecastBuckets);
+ TTimeCastBuckets(const NKikimrSubDomains::TProcessingParams &processing);
+
+ ui32 Select(ui64 tabletId) const;
+ ui32 Buckets() const;
+ };
+}
diff --git a/ydb/core/base/ya.make b/ydb/core/base/ya.make
index f1b226b8ea4..83db5825c3a 100644
--- a/ydb/core/base/ya.make
+++ b/ydb/core/base/ya.make
@@ -42,7 +42,7 @@ SRCS(
logoblob.cpp
logoblob.h
nameservice.h
- path.cpp
+ path.cpp
pathid.cpp
pool_stats_collector.cpp
pool_stats_collector.h
@@ -65,11 +65,11 @@ SRCS(
statestorage_replica.cpp
statestorage_replica_probe.cpp
statestorage_warden.cpp
- storage_pools.cpp
- storage_pools.h
- subdomain.h
- subdomain.cpp
- table_index.cpp
+ storage_pools.cpp
+ storage_pools.h
+ subdomain.h
+ subdomain.cpp
+ table_index.cpp
tablet.cpp
tablet.h
tablet_killer.cpp
@@ -82,8 +82,8 @@ SRCS(
traceid.cpp
traceid.h
tracing.h
- tx_processing.h
- tx_processing.cpp
+ tx_processing.h
+ tx_processing.cpp
user_registry.h
blobstorage_grouptype.cpp
)
diff --git a/ydb/core/blobstorage/dsproxy/dsproxy.h b/ydb/core/blobstorage/dsproxy/dsproxy.h
index d926e8b21b8..27592e971f9 100644
--- a/ydb/core/blobstorage/dsproxy/dsproxy.h
+++ b/ydb/core/blobstorage/dsproxy/dsproxy.h
@@ -30,12 +30,12 @@ constexpr ui32 TypicalDisksInSubring = 8;
constexpr ui32 MaxBatchedPutSize = 64 * 1024 - 512 - 5; // (MinREALHugeBlobInBytes - 1 - TDiskBlob::HugeBlobOverhead) for ssd and nvme
-const TDuration ProxyConfigurationTimeout = TDuration::Seconds(20);
+const TDuration ProxyConfigurationTimeout = TDuration::Seconds(20);
const ui32 ProxyRetryConfigurationInitialTimeout = 200;
const ui32 ProxyRetryConfigurationMaxTimeout = 5000;
const ui64 UnconfiguredBufferSizeLimit = 32 << 20;
-const TDuration ProxyEstablishSessionsTimeout = TDuration::Seconds(100);
+const TDuration ProxyEstablishSessionsTimeout = TDuration::Seconds(100);
const ui64 DsPutWakeupMs = 60000;
diff --git a/ydb/core/blobstorage/dsproxy/dsproxy_collect.cpp b/ydb/core/blobstorage/dsproxy/dsproxy_collect.cpp
index 25e3d919a0c..d12c819a745 100644
--- a/ydb/core/blobstorage/dsproxy/dsproxy_collect.cpp
+++ b/ydb/core/blobstorage/dsproxy/dsproxy_collect.cpp
@@ -67,7 +67,7 @@ class TBlobStorageGroupCollectGarbageRequest : public TBlobStorageGroupRequestAc
: QuorumTracker.ProcessReply(vdisk, status)) {
case NKikimrProto::OK:
return ReplyAndDie(newStatus);
-
+
case NKikimrProto::UNKNOWN:
break;
diff --git a/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp b/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp
index c98da8e2e22..e3c74cce7b4 100644
--- a/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp
+++ b/ydb/core/blobstorage/nodewarden/blobstorage_node_warden_ut.cpp
@@ -21,7 +21,7 @@
#include <util/random/entropy.h>
#include <util/string/printf.h>
#include <util/string/subst.h>
-#include <util/stream/file.h>
+#include <util/stream/file.h>
#include <google/protobuf/text_format.h>
#include <library/cpp/testing/unittest/registar.h>
@@ -113,32 +113,32 @@ void SetupServices(TTestActorRuntime &runtime, TString extraPath, TIntrusivePtr<
TAppPrepare app;
- {
- TString baseDir = runtime.GetTempDir();
+ {
+ TString baseDir = runtime.GetTempDir();
TString keyfile = Sprintf("%s/key.txt", baseDir.data());
-
- TFileOutput file(keyfile);
- file << "some data";
- app.SetKeyForNode(keyfile, 0);
- }
-
+
+ TFileOutput file(keyfile);
+ file << "some data";
+ app.SetKeyForNode(keyfile, 0);
+ }
+
{ // setup domain info
app.ClearDomainsAndHive();
- auto domain = TDomainsInfo::TDomain::ConstructDomainWithExplicitTabletIds("dc-1", domainId, 0,
+ auto domain = TDomainsInfo::TDomain::ConstructDomainWithExplicitTabletIds("dc-1", domainId, 0,
domainId, domainId, TVector<ui32>{domainId},
- domainId, TVector<ui32>{domainId},
+ domainId, TVector<ui32>{domainId},
100500,
- TVector<ui64>{},
- TVector<ui64>{},
- TVector<ui64>{},
- DefaultPoolKinds(2));
- app.AddDomain(domain.Release());
+ TVector<ui64>{},
+ TVector<ui64>{},
+ TVector<ui64>{},
+ DefaultPoolKinds(2));
+ app.AddDomain(domain.Release());
app.AddHive(domainId, MakeDefaultHiveID(stateStorageGroup));
}
-
+
SetupChannelProfiles(app, domainId);
-
- if (false) { // setup channel profiles
+
+ if (false) { // setup channel profiles
TIntrusivePtr<TChannelProfiles> channelProfiles = new TChannelProfiles;
channelProfiles->Profiles.emplace_back();
TChannelProfiles::TProfile &profile = channelProfiles->Profiles.back();
@@ -210,24 +210,24 @@ void SetupServices(TTestActorRuntime &runtime, TString extraPath, TIntrusivePtr<
ObtainTenantKey(&nodeWardenConfig->TenantKey, app.Keys[0]);
ObtainStaticKey(&nodeWardenConfig->StaticKey);
- TString baseDir = runtime.GetTempDir();
+ TString baseDir = runtime.GetTempDir();
TIntrusivePtr<NPDisk::TSectorMap> sectorMap(new NPDisk::TSectorMap());
sectorMap->ForceSize(64ull << 30ull);
TString pDiskPath0 = TStringBuilder() << "SectorMap:" << baseDir << "pdisk_map";
- nodeWardenConfig->ServiceSet.MutablePDisks(0)->SetPath(pDiskPath0);
+ nodeWardenConfig->ServiceSet.MutablePDisks(0)->SetPath(pDiskPath0);
nodeWardenConfig->SectorMaps[pDiskPath0] = sectorMap;
-
+
ui64 pDiskGuid = 1;
static ui64 iteration = 0;
++iteration;
::NKikimr::FormatPDisk(pDiskPath0, 0, 4 << 10, 32u << 20u, pDiskGuid,
0x1234567890 + iteration, 0x4567890123 + iteration, 0x7890123456 + iteration,
NPDisk::YdbDefaultPDiskSequence, "", false, false, sectorMap);
-
-
+
+
// Magic path from testlib, do not change it
TString pDiskPath1 = TStringBuilder() << baseDir << "pdisk_1.dat";
TIntrusivePtr<NPDisk::TSectorMap> sectorMap1(new NPDisk::TSectorMap());
@@ -259,18 +259,18 @@ void SetupServices(TTestActorRuntime &runtime, TString extraPath, TIntrusivePtr<
CreateTestBootstrapper(runtime, CreateTestTabletInfo(MakeBSControllerID(defaultStateStorageGroup),
TTabletTypes::FLAT_BS_CONTROLLER, TBlobStorageGroupType::ErasureMirror3, groupId),
&CreateFlatBsController);
-
+
SetupBoxAndStoragePool(runtime, runtime.AllocateEdgeActor(), domainId);
}
void Setup(TTestActorRuntime &runtime, TString extraPath, TIntrusivePtr<NPDisk::TSectorMap> extraSectorMap) {
SetupLogging(runtime);
SetupServices(runtime, extraPath, extraSectorMap);
-// runtime.SetLogPriority(NKikimrServices::BS_CONTROLLER, NLog::PRI_DEBUG);
+// runtime.SetLogPriority(NKikimrServices::BS_CONTROLLER, NLog::PRI_DEBUG);
// runtime.SetLogPriority(NKikimrServices::BS_NODE, NLog::PRI_DEBUG);
- runtime.SetLogPriority(NKikimrServices::BS_PROXY, NLog::PRI_DEBUG);
- runtime.SetLogPriority(NKikimrServices::BS_PROXY_PUT, NLog::PRI_DEBUG);
- runtime.SetLogPriority(NKikimrServices::BS_PROXY_BLOCK, NLog::PRI_DEBUG);
+ runtime.SetLogPriority(NKikimrServices::BS_PROXY, NLog::PRI_DEBUG);
+ runtime.SetLogPriority(NKikimrServices::BS_PROXY_PUT, NLog::PRI_DEBUG);
+ runtime.SetLogPriority(NKikimrServices::BS_PROXY_BLOCK, NLog::PRI_DEBUG);
// runtime.SetLogPriority(NKikimrServices::BS_PDISK, NLog::PRI_DEBUG);
// runtime.SetLogPriority(NKikimrServices::BS_QUEUE, NLog::PRI_DEBUG);
}
@@ -313,176 +313,176 @@ Y_UNIT_TEST_SUITE(TBlobStorageWardenTest) {
TAutoPtr<IEventHandle> handle;
auto putResult = runtime.GrabEdgeEventRethrow<TEvBlobStorage::TEvPutResult>(handle);
UNIT_ASSERT(putResult);
- UNIT_ASSERT_C(putResult->Status == expectAnsver,
+ UNIT_ASSERT_C(putResult->Status == expectAnsver,
"Status# " << NKikimrProto::EReplyStatus_Name(putResult->Status));
UNIT_ASSERT_EQUAL(handle->Cookie, cookie);
}
- void CreateStoragePool(TTestBasicRuntime& runtime, ui32 domainId, TString name, TString kind) {
- auto stateStorage = runtime.GetAppData().DomainsInfo->GetDefaultStateStorageGroup(domainId);
+ void CreateStoragePool(TTestBasicRuntime& runtime, ui32 domainId, TString name, TString kind) {
+ auto stateStorage = runtime.GetAppData().DomainsInfo->GetDefaultStateStorageGroup(domainId);
NKikimrBlobStorage::TDefineStoragePool storagePool = runtime.GetAppData().DomainsInfo->GetDomain(domainId).StoragePoolTypes.at(kind);
-
+
TActorId edge = runtime.AllocateEdgeActor();
auto request = std::make_unique<TEvBlobStorage::TEvControllerConfigRequest>();
- Y_VERIFY(storagePool.GetKind() == kind);
+ Y_VERIFY(storagePool.GetKind() == kind);
storagePool.ClearStoragePoolId();
- storagePool.SetName(name);
- storagePool.SetNumGroups(1);
- storagePool.SetEncryptionMode(1);
- request->Record.MutableRequest()->AddCommand()->MutableDefineStoragePool()->CopyFrom(storagePool);
-
- NTabletPipe::TClientConfig pipeConfig;
+ storagePool.SetName(name);
+ storagePool.SetNumGroups(1);
+ storagePool.SetEncryptionMode(1);
+ request->Record.MutableRequest()->AddCommand()->MutableDefineStoragePool()->CopyFrom(storagePool);
+
+ NTabletPipe::TClientConfig pipeConfig;
pipeConfig.RetryPolicy = NTabletPipe::TClientRetryPolicy::WithRetries();
runtime.SendToPipe(MakeBSControllerID(stateStorage), edge, request.release(), 0, pipeConfig);
-
- auto reply = runtime.GrabEdgeEventRethrow<TEvBlobStorage::TEvControllerConfigResponse>(edge);
- UNIT_ASSERT_VALUES_EQUAL(reply->Get()->Record.GetResponse().GetSuccess(), true);
- }
-
- ui32 GetGroupFromPool(TTestBasicRuntime& runtime, ui32 domainId, TString poolName) {
- auto stateStorage = runtime.GetAppData().DomainsInfo->GetDefaultStateStorageGroup(domainId);
-
+
+ auto reply = runtime.GrabEdgeEventRethrow<TEvBlobStorage::TEvControllerConfigResponse>(edge);
+ UNIT_ASSERT_VALUES_EQUAL(reply->Get()->Record.GetResponse().GetSuccess(), true);
+ }
+
+ ui32 GetGroupFromPool(TTestBasicRuntime& runtime, ui32 domainId, TString poolName) {
+ auto stateStorage = runtime.GetAppData().DomainsInfo->GetDefaultStateStorageGroup(domainId);
+
TActorId edge = runtime.AllocateEdgeActor();
auto selectGroups = std::make_unique<TEvBlobStorage::TEvControllerSelectGroups>();
auto *record = &selectGroups->Record;
record->SetReturnAllMatchingGroups(true);
auto* groupParams = record->AddGroupParameters();
groupParams->MutableStoragePoolSpecifier()->SetName(poolName);
-
- NTabletPipe::TClientConfig pipeConfig;
+
+ NTabletPipe::TClientConfig pipeConfig;
pipeConfig.RetryPolicy = NTabletPipe::TClientRetryPolicy::WithRetries();
runtime.SendToPipe(MakeBSControllerID(stateStorage), edge, selectGroups.release(), 0, pipeConfig);
-
+
auto reply = runtime.GrabEdgeEventRethrow<TEvBlobStorage::TEvControllerSelectGroupsResult>(edge);
UNIT_ASSERT_VALUES_EQUAL(reply->Get()->Record.GetStatus(), NKikimrProto::OK);
return reply->Get()->Record.GetMatchingGroups(0).GetGroups(0).GetGroupID();
- }
-
+ }
+
void SendToBsProxy(TTestBasicRuntime& runtime, TActorId sender, ui32 groupId, IEventBase *ev, ui64 cookie = 0) {
- auto flags = NActors::IEventHandle::FlagTrackDelivery
- | NActors::IEventHandle::FlagForwardOnNondelivery;
-
+ auto flags = NActors::IEventHandle::FlagTrackDelivery
+ | NActors::IEventHandle::FlagForwardOnNondelivery;
+
TActorId recipient = MakeBlobStorageProxyID(groupId);
TActorId nodeWarden = MakeBlobStorageNodeWardenID(sender.NodeId());
- return runtime.Send(new IEventHandle(recipient, sender, ev,
- flags, cookie, &nodeWarden, {}), sender.NodeId() - runtime.GetNodeId(0));
- }
-
- NKikimrBlobStorage::TDefineStoragePool DescribeStoragePool(TTestBasicRuntime& runtime, ui32 domainId, const TString& name) {
- auto stateStorage = runtime.GetAppData().DomainsInfo->GetDefaultStateStorageGroup(domainId);
-
+ return runtime.Send(new IEventHandle(recipient, sender, ev,
+ flags, cookie, &nodeWarden, {}), sender.NodeId() - runtime.GetNodeId(0));
+ }
+
+ NKikimrBlobStorage::TDefineStoragePool DescribeStoragePool(TTestBasicRuntime& runtime, ui32 domainId, const TString& name) {
+ auto stateStorage = runtime.GetAppData().DomainsInfo->GetDefaultStateStorageGroup(domainId);
+
TActorId edge = runtime.AllocateEdgeActor();
auto selectGroups = std::make_unique<TEvBlobStorage::TEvControllerConfigRequest>();
- auto* request = selectGroups->Record.MutableRequest();
- auto* readPool = request->AddCommand()->MutableReadStoragePool();
- readPool->SetBoxId(1);
- readPool->AddName(name);
-
- NTabletPipe::TClientConfig pipeConfig;
+ auto* request = selectGroups->Record.MutableRequest();
+ auto* readPool = request->AddCommand()->MutableReadStoragePool();
+ readPool->SetBoxId(1);
+ readPool->AddName(name);
+
+ NTabletPipe::TClientConfig pipeConfig;
pipeConfig.RetryPolicy = NTabletPipe::TClientRetryPolicy::WithRetries();
runtime.SendToPipe(MakeBSControllerID(stateStorage), edge, selectGroups.release(), 0, pipeConfig);
-
- auto reply = runtime.GrabEdgeEventRethrow<TEvBlobStorage::TEvControllerConfigResponse>(edge);
- UNIT_ASSERT_VALUES_EQUAL(reply->Get()->Record.GetResponse().GetSuccess(), true);
- return reply->Get()->Record.GetResponse().GetStatus(0).GetStoragePool(0);
- }
-
- void RemoveStoragePool(TTestBasicRuntime& runtime, ui32 domainId, const NKikimrBlobStorage::TDefineStoragePool& storagePool) {
- auto stateStorage = runtime.GetAppData().DomainsInfo->GetDefaultStateStorageGroup(domainId);
+
+ auto reply = runtime.GrabEdgeEventRethrow<TEvBlobStorage::TEvControllerConfigResponse>(edge);
+ UNIT_ASSERT_VALUES_EQUAL(reply->Get()->Record.GetResponse().GetSuccess(), true);
+ return reply->Get()->Record.GetResponse().GetStatus(0).GetStoragePool(0);
+ }
+
+ void RemoveStoragePool(TTestBasicRuntime& runtime, ui32 domainId, const NKikimrBlobStorage::TDefineStoragePool& storagePool) {
+ auto stateStorage = runtime.GetAppData().DomainsInfo->GetDefaultStateStorageGroup(domainId);
TActorId edge = runtime.AllocateEdgeActor();
auto selectGroups = std::make_unique<TEvBlobStorage::TEvControllerConfigRequest>();
- auto* request = selectGroups->Record.MutableRequest();
- auto* deletePool = request->AddCommand()->MutableDeleteStoragePool();
- deletePool->SetBoxId(1);
- deletePool->SetStoragePoolId(storagePool.GetStoragePoolId());
- deletePool->SetItemConfigGeneration(storagePool.GetItemConfigGeneration());
-
- NTabletPipe::TClientConfig pipeConfig;
+ auto* request = selectGroups->Record.MutableRequest();
+ auto* deletePool = request->AddCommand()->MutableDeleteStoragePool();
+ deletePool->SetBoxId(1);
+ deletePool->SetStoragePoolId(storagePool.GetStoragePoolId());
+ deletePool->SetItemConfigGeneration(storagePool.GetItemConfigGeneration());
+
+ NTabletPipe::TClientConfig pipeConfig;
pipeConfig.RetryPolicy = NTabletPipe::TClientRetryPolicy::WithRetries();
runtime.SendToPipe(MakeBSControllerID(stateStorage), edge, selectGroups.release(), 0, pipeConfig);
-
- auto reply = runtime.GrabEdgeEventRethrow<TEvBlobStorage::TEvControllerConfigResponse>(edge);
- UNIT_ASSERT_VALUES_EQUAL(reply->Get()->Record.GetResponse().GetSuccess(), true);
- }
-
- struct TBlockUpdates {
- TTestBasicRuntime* Runtime;
- TTestActorRuntime::TEventObserver PrevObserver = nullptr;
-
-
-
- TBlockUpdates(TTestBasicRuntime& runtime)
- : Runtime(&runtime)
- {
+
+ auto reply = runtime.GrabEdgeEventRethrow<TEvBlobStorage::TEvControllerConfigResponse>(edge);
+ UNIT_ASSERT_VALUES_EQUAL(reply->Get()->Record.GetResponse().GetSuccess(), true);
+ }
+
+ struct TBlockUpdates {
+ TTestBasicRuntime* Runtime;
+ TTestActorRuntime::TEventObserver PrevObserver = nullptr;
+
+
+
+ TBlockUpdates(TTestBasicRuntime& runtime)
+ : Runtime(&runtime)
+ {
TTestActorRuntime::TEventObserver observer = [=] (TTestActorRuntimeBase& /*runtime*/, TAutoPtr<IEventHandle>& event) -> TTestActorRuntime::EEventAction {
- if (event->GetTypeRewrite() == TEvBlobStorage::EvControllerNodeServiceSetUpdate) {
- return TTestActorRuntime::EEventAction::DROP;
- }
- return TTestActorRuntime::EEventAction::PROCESS;
- };
- PrevObserver = Runtime->SetObserverFunc(observer);
- }
-
- ~TBlockUpdates() {
- Runtime->SetObserverFunc(PrevObserver);
- }
- };
-
+ if (event->GetTypeRewrite() == TEvBlobStorage::EvControllerNodeServiceSetUpdate) {
+ return TTestActorRuntime::EEventAction::DROP;
+ }
+ return TTestActorRuntime::EEventAction::PROCESS;
+ };
+ PrevObserver = Runtime->SetObserverFunc(observer);
+ }
+
+ ~TBlockUpdates() {
+ Runtime->SetObserverFunc(PrevObserver);
+ }
+ };
+
void BlockGroup(TTestBasicRuntime& runtime, TActorId sender, ui64 tabletId, ui32 groupId, ui32 generation, bool isMonitored,
NKikimrProto::EReplyStatus expectAnsver = NKikimrProto::EReplyStatus::OK) {
auto request = std::make_unique<TEvBlobStorage::TEvBlock>(tabletId, generation, TInstant::Max());
request->IsMonitored = isMonitored;
SendToBsProxy(runtime, sender, groupId, request.release());
- auto reply = runtime.GrabEdgeEventRethrow<TEvBlobStorage::TEvBlockResult>(sender);
- UNIT_ASSERT_VALUES_EQUAL(reply->Get()->Status, expectAnsver);
- }
-
+ auto reply = runtime.GrabEdgeEventRethrow<TEvBlobStorage::TEvBlockResult>(sender);
+ UNIT_ASSERT_VALUES_EQUAL(reply->Get()->Status, expectAnsver);
+ }
+
void CollectGroup(TTestBasicRuntime& runtime, TActorId sender, ui64 tabletId, ui32 groupId, bool isMonitored,
NKikimrProto::EReplyStatus expectAnsver = NKikimrProto::EReplyStatus::OK) {
auto request = std::make_unique<TEvBlobStorage::TEvCollectGarbage>(tabletId, Max<ui32>(), Max<ui32>(), ui32(0),
- true, Max<ui32>(), Max<ui32>(),
- nullptr, nullptr, TInstant::Max(),
- true, true);
+ true, Max<ui32>(), Max<ui32>(),
+ nullptr, nullptr, TInstant::Max(),
+ true, true);
request->IsMonitored = isMonitored;
SendToBsProxy(runtime, sender, groupId, request.release());
- auto reply = runtime.GrabEdgeEventRethrow<TEvBlobStorage::TEvCollectGarbageResult>(sender);
- UNIT_ASSERT_VALUES_EQUAL(reply->Get()->Status, expectAnsver);
- }
-
- CUSTOM_UNIT_TEST(TestDeleteStoragePool) {
- TTestBasicRuntime runtime(1, false);
+ auto reply = runtime.GrabEdgeEventRethrow<TEvBlobStorage::TEvCollectGarbageResult>(sender);
+ UNIT_ASSERT_VALUES_EQUAL(reply->Get()->Status, expectAnsver);
+ }
+
+ CUSTOM_UNIT_TEST(TestDeleteStoragePool) {
+ TTestBasicRuntime runtime(1, false);
Setup(runtime, "", nullptr);
-
- auto sender0 = runtime.AllocateEdgeActor(0);
-
+
+ auto sender0 = runtime.AllocateEdgeActor(0);
+
CreateStoragePool(runtime, DOMAIN_ID, "test_storage", "pool-kind-1");
ui32 groupId = GetGroupFromPool(runtime, DOMAIN_ID, "test_storage");
-
- ui64 tabletId = 1234;
- ui32 generation = 1;
+
+ ui64 tabletId = 1234;
+ ui32 generation = 1;
BlockGroup(runtime, sender0, tabletId, groupId, generation, true);
BlockGroup(runtime, sender0, tabletId, groupId, generation, true, NKikimrProto::EReplyStatus::RACE);
BlockGroup(runtime, sender0, tabletId, groupId, generation-1, true, NKikimrProto::EReplyStatus::RACE);
-
+
auto describePool = DescribeStoragePool(runtime, DOMAIN_ID, "test_storage");
- {
- TBlockUpdates bloker(runtime);
- RemoveStoragePool(runtime, DOMAIN_ID, describePool);
-
- ++generation;
+ {
+ TBlockUpdates bloker(runtime);
+ RemoveStoragePool(runtime, DOMAIN_ID, describePool);
+
+ ++generation;
BlockGroup(runtime, sender0, tabletId, groupId, generation++, true);
- }
-
- ++generation;
+ }
+
+ ++generation;
BlockGroup(runtime, sender0, tabletId, groupId, generation++, true);
-
- auto stateStorage = runtime.GetAppData().DomainsInfo->GetDefaultStateStorageGroup(DOMAIN_ID);
+
+ auto stateStorage = runtime.GetAppData().DomainsInfo->GetDefaultStateStorageGroup(DOMAIN_ID);
RebootTablet(runtime, MakeBSControllerID(stateStorage), sender0, sender0.NodeId() - runtime.GetNodeId(0));
-
- ++generation;
+
+ ++generation;
BlockGroup(runtime, sender0, tabletId, groupId, generation++, true, NKikimrProto::EReplyStatus::NO_GROUP);
- }
-
+ }
+
CUSTOM_UNIT_TEST(TestSendToInvalidGroupId) {
TTestBasicRuntime runtime(1, false);
Setup(runtime, "", nullptr);
@@ -500,32 +500,32 @@ Y_UNIT_TEST_SUITE(TBlobStorageWardenTest) {
CollectGroup(runtime, sender, tabletId, groupId, true, NKikimrProto::EReplyStatus::ERROR);
}
- CUSTOM_UNIT_TEST(TestBlockEncriptedGroup) {
- TTestBasicRuntime runtime(2, false);
+ CUSTOM_UNIT_TEST(TestBlockEncriptedGroup) {
+ TTestBasicRuntime runtime(2, false);
Setup(runtime, "", nullptr);
-
- auto sender0 = runtime.AllocateEdgeActor(0);
- auto sender1 = runtime.AllocateEdgeActor(1);
-
+
+ auto sender0 = runtime.AllocateEdgeActor(0);
+ auto sender1 = runtime.AllocateEdgeActor(1);
+
CreateStoragePool(runtime, DOMAIN_ID, "test_storage", "pool-kind-1");
ui32 groupId = GetGroupFromPool(runtime, DOMAIN_ID, "test_storage");
-
- ui64 tabletId = 1234;
- ui32 generation = 1;
+
+ ui64 tabletId = 1234;
+ ui32 generation = 1;
BlockGroup(runtime, sender0, tabletId, groupId, generation, true);
-
- Put(runtime, sender0, groupId, TLogoBlobID(tabletId, generation, 0, 0, 5, 0), "hello", NKikimrProto::EReplyStatus::BLOCKED);
- Put(runtime, sender0, groupId, TLogoBlobID(tabletId, generation+1, 0, 0, 5, 0), "hello");
-
+
+ Put(runtime, sender0, groupId, TLogoBlobID(tabletId, generation, 0, 0, 5, 0), "hello", NKikimrProto::EReplyStatus::BLOCKED);
+ Put(runtime, sender0, groupId, TLogoBlobID(tabletId, generation+1, 0, 0, 5, 0), "hello");
+
BlockGroup(runtime, sender1, tabletId, groupId, generation+2, true);
- Put(runtime, sender1, groupId, TLogoBlobID(tabletId, generation+2, 0, 0, 10, 0), "hellohello", NKikimrProto::EReplyStatus::ERROR);
- Put(runtime, sender1, groupId, TLogoBlobID(tabletId, generation+3, 0, 0, 10, 0), "hellohello", NKikimrProto::EReplyStatus::ERROR);
-
- Put(runtime, sender0, groupId, TLogoBlobID(tabletId, generation+1, 0, 0, 11, 0), "hello_again", NKikimrProto::EReplyStatus::BLOCKED);
-
+ Put(runtime, sender1, groupId, TLogoBlobID(tabletId, generation+2, 0, 0, 10, 0), "hellohello", NKikimrProto::EReplyStatus::ERROR);
+ Put(runtime, sender1, groupId, TLogoBlobID(tabletId, generation+3, 0, 0, 10, 0), "hellohello", NKikimrProto::EReplyStatus::ERROR);
+
+ Put(runtime, sender0, groupId, TLogoBlobID(tabletId, generation+1, 0, 0, 11, 0), "hello_again", NKikimrProto::EReplyStatus::BLOCKED);
+
CollectGroup(runtime, sender1, tabletId, groupId, true);
- }
-
+ }
+
void AssertMonitoringExists(TTestBasicRuntime& runtime, ui32 nodeIdx, TString groupName) {
auto rootStats = runtime.GetDynamicCounters(nodeIdx);
auto stats = GetServiceCounters(rootStats, "dsproxy_percentile")->GetSubgroup("blobstorageproxy", groupName);
@@ -569,7 +569,7 @@ Y_UNIT_TEST_SUITE(TBlobStorageWardenTest) {
CUSTOM_UNIT_TEST(TestLimitedKeylessGroupThenNoMonitoring) {
TTestBasicRuntime runtime(2, false);
Setup(runtime, "", nullptr);
-
+
auto sender0 = runtime.AllocateEdgeActor(0);
auto sender1 = runtime.AllocateEdgeActor(1);
diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_actor.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_actor.cpp
index 2bbb4324b57..d92b19c6cca 100644
--- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_actor.cpp
+++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_actor.cpp
@@ -300,7 +300,7 @@ public:
PDisk->HttpInfo(*req); // Sends TEvHttpInfoResult inside
}
}
-
+
void InitHandle(TEvPDiskFormattingFinished::TPtr &ev) {
FormattingThread->Join();
IsFormattingNow = false;
diff --git a/ydb/core/client/client_ut.cpp b/ydb/core/client/client_ut.cpp
index 888b340b4f5..b94c722588b 100644
--- a/ydb/core/client/client_ut.cpp
+++ b/ydb/core/client/client_ut.cpp
@@ -103,7 +103,7 @@ struct TTestTables {
: Client(client)
{
TOpts opts(var, numFollowers);
- NKikimrSchemeOp::TTableDescription tableSimple;
+ NKikimrSchemeOp::TTableDescription tableSimple;
{
tableSimple.SetName("Simple");
auto *c1 = tableSimple.AddColumns();
@@ -133,7 +133,7 @@ struct TTestTables {
*tableSimple.AddKeyColumnNames() = "key";
}
- NKikimrSchemeOp::TTableDescription tableByBytes;
+ NKikimrSchemeOp::TTableDescription tableByBytes;
{
tableByBytes.SetName("ByBytes");
auto *c1 = tableByBytes.AddColumns();
@@ -149,7 +149,7 @@ struct TTestTables {
*tableByBytes.AddKeyColumnNames() = "key";
}
- NKikimrSchemeOp::TTableDescription tableComp;
+ NKikimrSchemeOp::TTableDescription tableComp;
{
tableComp.SetName("Comp");
auto *c1 = tableComp.AddColumns();
@@ -192,7 +192,7 @@ private:
};
void CreateOldTypesTables(TClient &client) {
- NKikimrSchemeOp::TTableDescription tableOld;
+ NKikimrSchemeOp::TTableDescription tableOld;
{
tableOld.SetName("Old");
auto * c1 = tableOld.AddColumns();
@@ -218,7 +218,7 @@ void CreateOldTypesTables(TClient &client) {
tableOld.SetUniformPartitionsCount(4);
}
- NKikimrSchemeOp::TTableDescription tableNew;
+ NKikimrSchemeOp::TTableDescription tableNew;
{
tableNew.SetName("New");
auto * c1 = tableNew.AddColumns();
@@ -251,7 +251,7 @@ void CreateOldTypesTables(TClient &client) {
}
void AlterTestTables(TClient& client) {
- NKikimrSchemeOp::TTableDescription alterSimple;
+ NKikimrSchemeOp::TTableDescription alterSimple;
{
alterSimple.SetName("Simple");
auto* dc1 = alterSimple.AddDropColumns();
@@ -260,7 +260,7 @@ void AlterTestTables(TClient& client) {
client.AlterTable(TablePlacement, alterSimple);
- NKikimrSchemeOp::TTableDescription alterSimple1;
+ NKikimrSchemeOp::TTableDescription alterSimple1;
{
alterSimple1.SetName("Simple");
auto *c2 = alterSimple1.AddColumns();
@@ -331,14 +331,14 @@ Y_UNIT_TEST_SUITE(TClientTest) {
Y_UNIT_TEST(TestInspectProxy) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- auto settings = TServerSettings(port);
- settings.SetSupportsRedirect(false);
+ auto settings = TServerSettings(port);
+ settings.SetSupportsRedirect(false);
+
+ TServer server(settings);
+ TClient client(settings);
- TServer server(settings);
- TClient client(settings);
-
NKikimrMiniKQL::TResult res;
- UNIT_ASSERT(client.LocalQuery(TxAllocator, "("
+ UNIT_ASSERT(client.LocalQuery(TxAllocator, "("
"(let row '('('dummyKey (Bool 'true))))"
"(let select '('reservedIds))"
"(return (AsList (SetResult 'reservedIds (SelectRow 'config row select))))"
@@ -355,10 +355,10 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
NKikimrMiniKQL::TResult res;
UNIT_ASSERT(client.FlatQuery("("
"(return (AsList (SetResult 'res1 (Int32 '42))))"
@@ -376,11 +376,11 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
- client.InitRootScheme();
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
+ client.InitRootScheme();
TTestTables tables(client, TTestTables::OneShard_NoOpts);
NKikimrMiniKQL::TResult writeRes;
@@ -490,11 +490,11 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
- client.InitRootScheme();
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
+ client.InitRootScheme();
{
TTestTables tables(client, TTestTables::OneShard_NoOpts);
@@ -526,11 +526,11 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
- client.InitRootScheme();
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
+ client.InitRootScheme();
{
TTestTables tables(client, TTestTables::OneShard_NoOpts);
@@ -549,7 +549,7 @@ Y_UNIT_TEST_SUITE(TClientTest) {
AlterTestTables(client);
ReadWriteViaMiniKQLBody(client, false, false);
}
-
+
{
TTestTables tables(client, TTestTables::OneShard_OutOfOrder_SoftUpdates);
AlterTestTables(client);
@@ -573,7 +573,7 @@ Y_UNIT_TEST_SUITE(TClientTest) {
AlterTestTables(client);
ReadWriteViaMiniKQLBody(client, false, false);
}
-
+
{
TTestTables tables(client, TTestTables::Sharded_OutOfOrder_SoftUpdates);
AlterTestTables(client);
@@ -585,11 +585,11 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
- client.InitRootScheme();
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
+ client.InitRootScheme();
{
TTestTables tables(client, TTestTables::OneShard_NoOpts);
@@ -610,11 +610,11 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
- client.InitRootScheme();
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
+ client.InitRootScheme();
{
TTestTables tables(client, TTestTables::OneShard_NoOpts);
@@ -622,7 +622,7 @@ Y_UNIT_TEST_SUITE(TClientTest) {
}
{
- NKikimrSchemeOp::TTableDescription tableSimple;
+ NKikimrSchemeOp::TTableDescription tableSimple;
tableSimple.SetName("Simple");
auto *c1 = tableSimple.AddColumns();
c1->SetName("key");
@@ -658,11 +658,11 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
- client.InitRootScheme();
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
+ client.InitRootScheme();
{
TTestTables tables(client, TTestTables::OneShard_NoOpts);
@@ -679,11 +679,11 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
- client.InitRootScheme();
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
+ client.InitRootScheme();
TTestTables tables(client, TTestTables::Sharded_NoOpts);
//server.GetRuntime()->SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_DEBUG);
@@ -696,15 +696,15 @@ Y_UNIT_TEST_SUITE(TClientTest) {
// Currently followers cannot be started at the same node with leader
// so we need 2 nodes
- auto settings = TServerSettings(port);
- settings.SetNodeCount(2);
+ auto settings = TServerSettings(port);
+ settings.SetNodeCount(2);
+
+ TServer server(settings);
+ TClient client(settings);
- TServer server(settings);
- TClient client(settings);
-
server.GetRuntime()->SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_DEBUG);
- client.InitRootScheme();
+ client.InitRootScheme();
{
TTestTables tables(client, TTestTables::Sharded_NoOpts, 1);
@@ -778,11 +778,11 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
- client.InitRootScheme();
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
+ client.InitRootScheme();
TTestTables tables(client, TTestTables::Sharded_NoOpts);
GetStepTxIdBody(client, false);
@@ -792,11 +792,11 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
- client.InitRootScheme();
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
+ client.InitRootScheme();
TTestTables tables(client, TTestTables::Sharded_NoOpts);
GetStepTxIdBody(client, true);
@@ -881,11 +881,11 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
- client.InitRootScheme();
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
+ client.InitRootScheme();
{
TTestTables tables(client, TTestTables::OneShard_NoOpts);
@@ -901,7 +901,7 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TTestTables tables(client, TTestTables::OneShard_SoftUpdates);
CASViaMiniKQLBody(client);
}
-
+
{
TTestTables tables(client, TTestTables::OneShard_OutOfOrder_SoftUpdates);
CASViaMiniKQLBody(client);
@@ -989,11 +989,11 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
- client.InitRootScheme();
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
+ client.InitRootScheme();
{
TTestTables tables(client, TTestTables::OneShard_NoOpts);
@@ -1009,7 +1009,7 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TTestTables tables(client, TTestTables::OneShard_SoftUpdates);
RowEraseViaMiniKQLBody(client);
}
-
+
{
TTestTables tables(client, TTestTables::OneShard_OutOfOrder_SoftUpdates);
RowEraseViaMiniKQLBody(client);
@@ -1085,11 +1085,11 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
- client.InitRootScheme();
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
+ client.InitRootScheme();
{
TTestTables tables(client, TTestTables::OneShard_NoOpts);
@@ -1105,7 +1105,7 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TTestTables tables(client, TTestTables::OneShard_SoftUpdates);
ReadRangeViaMiniKQLBody(client);
}
-
+
{
TTestTables tables(client, TTestTables::OneShard_OutOfOrder_SoftUpdates);
ReadRangeViaMiniKQLBody(client);
@@ -1301,11 +1301,11 @@ Y_UNIT_TEST_SUITE(TClientTest) {
Y_UNIT_TEST(SelectRangeOptions) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
- client.InitRootScheme();
+ client.InitRootScheme();
{
TTestTables tables(client, TTestTables::OneShard_NoOpts);
@@ -1393,11 +1393,11 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
- client.InitRootScheme();
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
+ client.InitRootScheme();
{
TTestTables tables(client, TTestTables::OneShard_NoOpts);
@@ -1413,7 +1413,7 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TTestTables tables(client, TTestTables::OneShard_SoftUpdates);
MultiSelectBody(client);
}
-
+
{
TTestTables tables(client, TTestTables::OneShard_OutOfOrder_SoftUpdates);
MultiSelectBody(client);
@@ -1433,7 +1433,7 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TTestTables tables(client, TTestTables::Sharded_SoftUpdates);
MultiSelectBody(client);
}
-
+
{
TTestTables tables(client, TTestTables::Sharded_OutOfOrder_SoftUpdates);
MultiSelectBody(client);
@@ -1444,11 +1444,11 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
- client.InitRootScheme();
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
+ client.InitRootScheme();
{
TTestTables tables(client, TTestTables::OneShard_NoOpts);
@@ -1462,7 +1462,7 @@ Y_UNIT_TEST_SUITE(TClientTest) {
}
void PrepareTestData(TClient& client, bool allowFollowerPromotion) {
- client.InitRootScheme();
+ client.InitRootScheme();
client.MkDir("/dc-1", "Berkanavt");
client.MkDir("/dc-1/Berkanavt", "tables");
client.CreateTable(TablePlacement, Sprintf(
@@ -1529,12 +1529,12 @@ Y_UNIT_TEST_SUITE(TClientTest) {
Y_UNIT_TEST(ReadFromFollower) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
-
- auto settings = TServerSettings(port);
- settings.SetNodeCount(2);
- TServer server(settings);
- TClient client(settings);
-
+
+ auto settings = TServerSettings(port);
+ settings.SetNodeCount(2);
+ TServer server(settings);
+ TClient client(settings);
+
SetupLogging(server);
PrepareTestData(client, false);
@@ -1544,12 +1544,12 @@ Y_UNIT_TEST_SUITE(TClientTest) {
Y_UNIT_TEST(FollowerCacheRefresh) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
-
- auto settings = TServerSettings(port);
- settings.SetNodeCount(2);
- TServer server(settings);
- TClient client(settings);
-
+
+ auto settings = TServerSettings(port);
+ settings.SetNodeCount(2);
+ TServer server(settings);
+ TClient client(settings);
+
server.GetRuntime()->SetLogPriority(NKikimrServices::TABLET_EXECUTOR, NActors::NLog::PRI_DEBUG);
client.MarkNodeInHive(server.GetRuntime(), 1, false);
@@ -1629,12 +1629,12 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- auto settings = TServerSettings(port);
- settings.SetNodeCount(2);
-
- TServer server(settings);
- TClient client(settings);
-
+ auto settings = TServerSettings(port);
+ settings.SetNodeCount(2);
+
+ TServer server(settings);
+ TClient client(settings);
+
PrepareTestData(client, true);
SetupLogging(server);
@@ -1719,11 +1719,11 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
- client.InitRootScheme();
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
+ client.InitRootScheme();
{
TTestTables tables(client, TTestTables::Sharded_NoOpts);
@@ -1739,7 +1739,7 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TTestTables tables(client, TTestTables::Sharded_NoOpts);
DiagnosticsBody(client, false);
}
-
+
{
TTestTables tables(client, TTestTables::Sharded_NoOpts, 1);
DiagnosticsBody(client, false);
@@ -1788,10 +1788,10 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
NTabletFlatScheme::TSchemeChanges scheme1;
NTabletFlatScheme::TSchemeChanges scheme2;
TString err;
@@ -1807,10 +1807,10 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
NTabletFlatScheme::TSchemeChanges scheme;
TString err;
bool success = false;
@@ -1857,10 +1857,10 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
server.StartDummyTablets();
WaitForLeaderStart(client, server.GetRuntime(), ChangeStateStorage(Tests::DummyTablet1, TestDomain), TDuration::Seconds(1));
@@ -1893,11 +1893,11 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
- client.InitRootScheme();
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
+ client.InitRootScheme();
CreateOldTypesTables(client);
const char * writeOldTypes = R"((
@@ -1973,11 +1973,11 @@ Y_UNIT_TEST_SUITE(TClientTest) {
TPortManager tp;
ui16 port = tp.GetPort(2134);
- const auto settings = TServerSettings(port);
- TServer server(settings);
- TClient client(settings);
-
- client.InitRootScheme();
+ const auto settings = TServerSettings(port);
+ TServer server(settings);
+ TClient client(settings);
+
+ client.InitRootScheme();
CreateOldTypesTables(client);
const char * paramsOld = R"((
diff --git a/ydb/core/client/flat_ut.cpp b/ydb/core/client/flat_ut.cpp
index cb58f4d324a..362c052aa11 100644
--- a/ydb/core/client/flat_ut.cpp
+++ b/ydb/core/client/flat_ut.cpp
@@ -114,7 +114,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(Init) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
if (true) {
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_DEBUG);
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_DEBUG);
@@ -260,7 +260,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
if (!true) {
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_DEBUG);
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_DEBUG);
@@ -379,7 +379,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(ModifyMultipleRowsCrossShardAllToAll) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
if (!true) {
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_DEBUG);
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_DEBUG);
@@ -519,7 +519,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(CrossRW) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
if (!true) {
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_DEBUG);
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_DEBUG);
@@ -896,7 +896,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(Mix_DML_DDL) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
if (!true) {
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_DEBUG);
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_DEBUG);
@@ -1016,7 +1016,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(MiniKQLRanges) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
if (!true) {
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_DEBUG);
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_DEBUG);
@@ -1117,7 +1117,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
TServer cleverServer = TServer(TServerSettings(port).SetEnableSystemViews(false));
TFlatMsgBusClient annoyingClient(port);
- annoyingClient.InitRoot();
+ annoyingClient.InitRoot();
// Listing all domains always works
TestLsSuccess(annoyingClient, "/", {"dc-1"});
@@ -1143,7 +1143,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
}
void SetSchemeshardReadOnly(TServer& cleverServer, TFlatMsgBusClient& annoyingClient, bool isReadOnly) {
- ui64 schemeShardTabletId = Tests::ChangeStateStorage(Tests::SchemeRoot, Tests::TestDomain);
+ ui64 schemeShardTabletId = Tests::ChangeStateStorage(Tests::SchemeRoot, Tests::TestDomain);
NKikimrMiniKQL::TResult result;
bool ok = annoyingClient.LocalQuery(schemeShardTabletId, Sprintf(R"(
@@ -1172,7 +1172,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(ReadOnlyMode) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port).SetEnableMockOnSingleNode(false));
+ TServer cleverServer = TServer(TServerSettings(port).SetEnableMockOnSingleNode(false));
TFlatMsgBusClient annoyingClient(port);
@@ -1272,8 +1272,8 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
TestLsPathIdSuccess(annoyingClient, schemeshardId, 3, "arcadia", {});
}
- ui32 TestInitRoot(TFlatMsgBusClient& annoyingClient, const TString& name) {
- TAutoPtr<NBus::TBusMessage> reply = annoyingClient.InitRootSchemeWithReply(name);
+ ui32 TestInitRoot(TFlatMsgBusClient& annoyingClient, const TString& name) {
+ TAutoPtr<NBus::TBusMessage> reply = annoyingClient.InitRootSchemeWithReply(name);
TAutoPtr<NMsgBusProxy::TBusResponse> res = dynamic_cast<NMsgBusProxy::TBusResponse*>(reply.Release());
UNIT_ASSERT(res);
return res->Record.GetStatus();
@@ -1282,27 +1282,27 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(InitRoot) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
if (true) {
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_DEBUG);
}
TFlatMsgBusClient annoyingClient(port);
- UNIT_ASSERT_VALUES_EQUAL(TestInitRoot(annoyingClient, "dc-1"), NMsgBusProxy::MSTATUS_OK);
+ UNIT_ASSERT_VALUES_EQUAL(TestInitRoot(annoyingClient, "dc-1"), NMsgBusProxy::MSTATUS_OK);
// Reinitializing same root is Ok
- UNIT_ASSERT_VALUES_EQUAL(TestInitRoot(annoyingClient, "dc-1"), NMsgBusProxy::MSTATUS_OK);
+ UNIT_ASSERT_VALUES_EQUAL(TestInitRoot(annoyingClient, "dc-1"), NMsgBusProxy::MSTATUS_OK);
// Unknown roots
- UNIT_ASSERT_VALUES_EQUAL(TestInitRoot(annoyingClient, ""), NMsgBusProxy::MSTATUS_ERROR);
- UNIT_ASSERT_VALUES_EQUAL(TestInitRoot(annoyingClient, "dc-11"), NMsgBusProxy::MSTATUS_ERROR);
- UNIT_ASSERT_VALUES_EQUAL(TestInitRoot(annoyingClient, "dc-2"), NMsgBusProxy::MSTATUS_ERROR);
+ UNIT_ASSERT_VALUES_EQUAL(TestInitRoot(annoyingClient, ""), NMsgBusProxy::MSTATUS_ERROR);
+ UNIT_ASSERT_VALUES_EQUAL(TestInitRoot(annoyingClient, "dc-11"), NMsgBusProxy::MSTATUS_ERROR);
+ UNIT_ASSERT_VALUES_EQUAL(TestInitRoot(annoyingClient, "dc-2"), NMsgBusProxy::MSTATUS_ERROR);
}
Y_UNIT_TEST(CheckACL) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
if (!true) {
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_DEBUG);
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_DEBUG);
@@ -1313,9 +1313,9 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
}
TFlatMsgBusClient annoyingClient(port);
- annoyingClient.InitRoot();
- annoyingClient.ModifyOwner("/", "dc-1", "berkanavt@" BUILTIN_ACL_DOMAIN);
- annoyingClient.SetSecurityToken("berkanavt@" BUILTIN_ACL_DOMAIN); // there is should be something like "234ba4f44ef7c"
+ annoyingClient.InitRoot();
+ annoyingClient.ModifyOwner("/", "dc-1", "berkanavt@" BUILTIN_ACL_DOMAIN);
+ annoyingClient.SetSecurityToken("berkanavt@" BUILTIN_ACL_DOMAIN); // there is should be something like "234ba4f44ef7c"
NMsgBusProxy::EResponseStatus status;
@@ -1365,7 +1365,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
TAutoPtr<NMsgBusProxy::TBusResponse> response = annoyingClient.Ls("/dc-1/Berkanavt/tables/Students");
studentsTableId = response.Get()->Record.GetPathDescription().GetSelf().GetPathId();
}
- TTableId tabletId(ChangeStateStorage(Tests::SchemeRoot, TestDomain), studentsTableId);
+ TTableId tabletId(ChangeStateStorage(Tests::SchemeRoot, TestDomain), studentsTableId);
annoyingClient.SetSecurityToken("argonaut@" BUILTIN_ACL_DOMAIN); // there is should be something like "234ba4f44ef7c"
annoyingClient.FlatQuery("((return (AsList (SetResult 'res1 (Int32 '2016)))))");
@@ -1436,22 +1436,22 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
return; // TODO https://st.yandex-team.ru/KIKIMR-2279
TPortManager pm;
ui16 port = pm.GetPort(2134);
-
+
NFake::TStorage diskParams;
diskParams.DiskSize = 500ull*1024*1024;
diskParams.SectorSize = 512;
diskParams.ChunkSize = 50ull*1024*1024;
-
+
NKikimrConfig::TImmediateControlsConfig controls;
controls.MutableTxLimitControls()->SetPerRequestDataSizeLimit(1000000000);
controls.MutableTxLimitControls()->SetPerShardIncomingReadSetSizeLimit(1000000000);
controls.MutableTxLimitControls()->SetPerShardReadSizeLimit(1000000000);
- TServer cleverServer = TServer(TServerSettings(port)
+ TServer cleverServer = TServer(TServerSettings(port)
.SetControls(controls)
- .SetCustomDiskParams(diskParams)
- .SetEnableMockOnSingleNode(false));
-
+ .SetCustomDiskParams(diskParams)
+ .SetEnableMockOnSingleNode(false));
+
TFlatMsgBusClient annoyingClient(port);
const char * table = "Name: \"Table\""
@@ -1578,7 +1578,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(RejectByPerRequestSize) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
-
+
NKikimrConfig::TImmediateControlsConfig controls;
controls.MutableTxLimitControls()->SetPerRequestDataSizeLimit(10000);
controls.MutableTxLimitControls()->SetPerShardIncomingReadSetSizeLimit(1000000000);
@@ -1586,7 +1586,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
TServer cleverServer = TServer(TServerSettings(port)
.SetControls(controls));
-
+
TFlatMsgBusClient annoyingClient(port);
const char * table =
@@ -1658,7 +1658,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
TServer cleverServer = TServer(TServerSettings(port)
.SetControls(controls));
-
+
TFlatMsgBusClient annoyingClient(port);
const char * table =
@@ -1890,8 +1890,8 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
-
+ TServer cleverServer = TServer(TServerSettings(port));
+
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::OPS_COMPACT, NActors::NLog::PRI_INFO);
TFlatMsgBusClient annoyingClient(port);
@@ -1932,7 +1932,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
annoyingClient.MkDir("/dc-1", "Dir");
for (int colCount = 1; colCount < 100; ++colCount) {
- NKikimrSchemeOp::TTableDescription schema;
+ NKikimrSchemeOp::TTableDescription schema;
TString name = "Table_" + ToString(colCount);
schema.SetName(name);
Cout << name << Endl;
@@ -1976,7 +1976,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(CopyCopiedTableAndRead) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::OPS_COMPACT, NActors::NLog::PRI_INFO);
@@ -2005,7 +2005,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(CopyTableAndAddFollowers) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::OPS_COMPACT, NActors::NLog::PRI_INFO);
@@ -2051,7 +2051,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(CopyTableAndDropCopy) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::OPS_COMPACT, NActors::NLog::PRI_INFO);
@@ -2100,7 +2100,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(CopyTableAndDropOriginal) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::OPS_COMPACT, NActors::NLog::PRI_INFO);
@@ -2138,7 +2138,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(CopyTableAndReturnPartAfterCompaction) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::OPS_COMPACT, NActors::NLog::PRI_INFO);
@@ -2210,7 +2210,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(CopyTableDropOriginalAndReturnPartAfterCompaction) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::OPS_COMPACT, NActors::NLog::PRI_INFO);
@@ -2292,7 +2292,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(CopyCopiedTableAndDropFirstCopy) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::OPS_COMPACT, NActors::NLog::PRI_INFO);
@@ -2404,15 +2404,15 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
annoyingClient.TrySplitTablePartition("/dc-1/Dir1", "SourceTabletId: 100500 SplitBoundary { KeyPrefix {Tuple { Optional { Uint32: 42 } } } }", response);
// Cerr << response;
UNIT_ASSERT_VALUES_EQUAL(response.GetStatus(), NMsgBusProxy::MSTATUS_ERROR);
- UNIT_ASSERT_VALUES_EQUAL(response.GetSchemeStatus(), NKikimrScheme::StatusNameConflict);
+ UNIT_ASSERT_VALUES_EQUAL(response.GetSchemeStatus(), NKikimrScheme::StatusNameConflict);
}
Y_UNIT_TEST(SplitEmptyAndWrite) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
DisableSplitMergePartCountLimit(cleverServer);
-
+
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::OPS_COMPACT, NActors::NLog::PRI_INFO);
TFlatMsgBusClient annoyingClient(port);
@@ -2471,7 +2471,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(SplitEmptyTwice) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
DisableSplitMergePartCountLimit(cleverServer);
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::OPS_COMPACT, NActors::NLog::PRI_INFO);
@@ -2508,7 +2508,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(MergeEmptyAndWrite) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
DisableSplitMergePartCountLimit(cleverServer);
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::OPS_COMPACT, NActors::NLog::PRI_INFO);
@@ -2544,7 +2544,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(WriteMergeAndRead) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
DisableSplitMergePartCountLimit(cleverServer);
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::OPS_COMPACT, NActors::NLog::PRI_INFO);
@@ -2637,7 +2637,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(SplitThenMerge) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
DisableSplitMergePartCountLimit(cleverServer);
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::OPS_COMPACT, NActors::NLog::PRI_INFO);
@@ -2675,7 +2675,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(WriteSplitAndRead) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
DisableSplitMergePartCountLimit(cleverServer);
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::OPS_COMPACT, NActors::NLog::PRI_INFO);
@@ -2715,7 +2715,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(WriteSplitAndReadFromFollower) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port).SetNodeCount(2));
+ TServer cleverServer = TServer(TServerSettings(port).SetNodeCount(2));
DisableSplitMergePartCountLimit(cleverServer);
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::OPS_COMPACT, NActors::NLog::PRI_INFO);
@@ -2771,7 +2771,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(WriteSplitKillRead) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
DisableSplitMergePartCountLimit(cleverServer);
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::OPS_COMPACT, NActors::NLog::PRI_INFO);
@@ -2819,7 +2819,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(SplitBoundaryRead) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
DisableSplitMergePartCountLimit(cleverServer);
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::OPS_COMPACT, NActors::NLog::PRI_INFO);
@@ -2838,7 +2838,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(WriteSplitWriteSplit) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
DisableSplitMergePartCountLimit(cleverServer);
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::OPS_COMPACT, NActors::NLog::PRI_INFO);
@@ -2886,7 +2886,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(AutoSplitBySize) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
DisableSplitMergePartCountLimit(cleverServer);
cleverServer.GetRuntime()->SetLogPriority(NKikimrServices::OPS_COMPACT, NActors::NLog::PRI_INFO);
@@ -3237,7 +3237,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
Y_UNIT_TEST(GetTabletCounters) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
TFlatMsgBusClient annoyingClient(port);
PrepareSourceTable(annoyingClient);
@@ -3399,7 +3399,7 @@ Y_UNIT_TEST_SUITE(TFlatTest) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
TFlatMsgBusClient annoyingClient(port);
annoyingClient.InitRoot();
diff --git a/ydb/core/client/flat_ut_client.h b/ydb/core/client/flat_ut_client.h
index cc9d549dd77..07f5b30cc6b 100644
--- a/ydb/core/client/flat_ut_client.h
+++ b/ydb/core/client/flat_ut_client.h
@@ -22,7 +22,7 @@ public:
{}
void InitRoot() {
- InitRootScheme();
+ InitRootScheme();
}
using TClient::FlatQuery;
@@ -64,7 +64,7 @@ public:
TActorId txProxy = MakeTxProxyID();
TActorId sender = runtime->AllocateEdgeActor();
TAutoPtr<TEvTxUserProxy::TEvInvalidateTable> ev(new TEvTxUserProxy::TEvInvalidateTable(tableId));
- runtime->Send(new IEventHandle(txProxy, sender, ev.Release()));
+ runtime->Send(new IEventHandle(txProxy, sender, ev.Release()));
TAutoPtr<IEventHandle> handle;
auto readSchemeStringResult = runtime->GrabEdgeEventRethrow<TEvTxUserProxy::TEvInvalidateTableResult>(handle);
Y_UNUSED(readSchemeStringResult);
@@ -100,7 +100,7 @@ public:
void TrySplitTablePartition(const TString& tablePath, const TString& splitDescription, NKikimrClient::TResponse& response) {
TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
- op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpSplitMergeTablePartitions);
+ op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpSplitMergeTablePartitions);
UNIT_ASSERT(::google::protobuf::TextFormat::ParseFromString(splitDescription, op->MutableSplitMergeTablePartitions()));
op->MutableSplitMergeTablePartitions()->SetTablePath(tablePath);
diff --git a/ydb/core/client/locks_ut.cpp b/ydb/core/client/locks_ut.cpp
index b945b517f7b..47b7c3dfdd5 100644
--- a/ydb/core/client/locks_ut.cpp
+++ b/ydb/core/client/locks_ut.cpp
@@ -20,11 +20,11 @@ using namespace Tests;
class TFlatMsgBusClient : public TClient {
public:
TFlatMsgBusClient(ui16 port)
- : TClient(TServerSettings(port))
+ : TClient(TServerSettings(port))
{}
void InitRoot() {
- InitRootScheme();
+ InitRootScheme();
}
using TClient::FlatQuery;
@@ -52,7 +52,7 @@ public:
TActorId txProxy = MakeTxProxyID();
TActorId sender = runtime->AllocateEdgeActor();
TAutoPtr<TEvTxUserProxy::TEvInvalidateTable> ev(new TEvTxUserProxy::TEvInvalidateTable(tableId));
- runtime->Send(new IEventHandle(txProxy, sender, ev.Release()));
+ runtime->Send(new IEventHandle(txProxy, sender, ev.Release()));
TAutoPtr<IEventHandle> handle;
auto readSchemeStringResult = runtime->GrabEdgeEventRethrow<TEvTxUserProxy::TEvInvalidateTableResult>(handle);
Y_UNUSED(readSchemeStringResult);
@@ -68,7 +68,7 @@ struct TClientServer {
TClientServer(bool outOfOrder = false, bool softUpdates = false, ui16 portNo = 2134)
: Port(PortManager.GetPort(portNo))
- , Server(TServerSettings(Port))
+ , Server(TServerSettings(Port))
, Client(Port)
{
SetLogging(EnableLogs);
diff --git a/ydb/core/client/minikql_compile/mkql_compile_service.cpp b/ydb/core/client/minikql_compile/mkql_compile_service.cpp
index 0a6d6922a60..e01d61a22cc 100644
--- a/ydb/core/client/minikql_compile/mkql_compile_service.cpp
+++ b/ydb/core/client/minikql_compile/mkql_compile_service.cpp
@@ -64,7 +64,7 @@ public:
}
TMiniKQLCompileService(size_t compileInflightLimit, THolder<NYql::IDbSchemeResolver>&& dbSchemeResolver)
- : COMPILE_INFLIGHT_LIMIT(compileInflightLimit)
+ : COMPILE_INFLIGHT_LIMIT(compileInflightLimit)
, DbSchemeResolver(std::move(dbSchemeResolver))
{
}
@@ -181,7 +181,7 @@ const TActorId& GetMiniKQLCompileServiceID() {
return miniKQLCompileServiceID;
}
-IActor* CreateMiniKQLCompileService(size_t compileInflightLimit) {
+IActor* CreateMiniKQLCompileService(size_t compileInflightLimit) {
THolder<NYql::IDbSchemeResolver> resolver;
return new TMiniKQLCompileService(compileInflightLimit, std::move(resolver));
}
diff --git a/ydb/core/client/minikql_compile/mkql_compile_service.h b/ydb/core/client/minikql_compile/mkql_compile_service.h
index 302ccbe13d3..4b0aca14917 100644
--- a/ydb/core/client/minikql_compile/mkql_compile_service.h
+++ b/ydb/core/client/minikql_compile/mkql_compile_service.h
@@ -42,7 +42,7 @@ struct TMiniKQLCompileServiceEvents {
NActors::TActorId MakeMiniKQLCompileServiceID();
const NActors::TActorId& GetMiniKQLCompileServiceID();
-NActors::IActor* CreateMiniKQLCompileService(size_t compileInflightLimit);
+NActors::IActor* CreateMiniKQLCompileService(size_t compileInflightLimit);
NActors::IActor* CreateMiniKQLCompileService(size_t compileInflightLimit, THolder<NYql::IDbSchemeResolver>&& dbSchemeResolver);
} // namespace NKikimr
diff --git a/ydb/core/client/minikql_result_lib/converter_ut.cpp b/ydb/core/client/minikql_result_lib/converter_ut.cpp
index 4ab6b9c6ba9..0fb5eff6211 100644
--- a/ydb/core/client/minikql_result_lib/converter_ut.cpp
+++ b/ydb/core/client/minikql_result_lib/converter_ut.cpp
@@ -14,11 +14,11 @@ Y_UNIT_TEST_SUITE(TMiniKQLResultConverterTest) {
Y_UNIT_TEST(TTestWithSimpleProgram) {
TPortManager pm;
- ui16 port = pm.GetPort(2134);
- auto settings = Tests::TServerSettings(port);
- Tests::TServer server = Tests::TServer(settings);
- Tests::TClient client(settings);
- client.InitRootScheme();
+ ui16 port = pm.GetPort(2134);
+ auto settings = Tests::TServerSettings(port);
+ Tests::TServer server = Tests::TServer(settings);
+ Tests::TClient client(settings);
+ client.InitRootScheme();
const TString pgmText = R"___(
(
diff --git a/ydb/core/client/s3_listing_ut.cpp b/ydb/core/client/s3_listing_ut.cpp
index e9b9a838ac4..919c45dc467 100644
--- a/ydb/core/client/s3_listing_ut.cpp
+++ b/ydb/core/client/s3_listing_ut.cpp
@@ -350,7 +350,7 @@ Y_UNIT_TEST_SUITE(TS3ListingTest) {
Y_UNIT_TEST(Listing) {
TPortManager pm;
ui16 port = pm.GetPort(2134);
- TServer cleverServer = TServer(TServerSettings(port));
+ TServer cleverServer = TServer(TServerSettings(port));
TFlatMsgBusClient annoyingClient(port);
diff --git a/ydb/core/client/scheme_cache_lib/yql_db_scheme_resolver.cpp b/ydb/core/client/scheme_cache_lib/yql_db_scheme_resolver.cpp
index ff365deb319..eb74fa36e94 100644
--- a/ydb/core/client/scheme_cache_lib/yql_db_scheme_resolver.cpp
+++ b/ydb/core/client/scheme_cache_lib/yql_db_scheme_resolver.cpp
@@ -24,7 +24,7 @@ class TTableProxyActor : public TActorBootstrapped<TTableProxyActor> {
TVector<TTable> Tables;
void Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr &ev, const TActorContext &ctx) {
- const NSchemeCache::TSchemeCacheNavigate &request = *ev->Get()->Request;
+ const NSchemeCache::TSchemeCacheNavigate &request = *ev->Get()->Request;
Y_VERIFY(request.ResultSet.size() == Tables.size());
TVector<TTableResult> results;
@@ -108,14 +108,14 @@ public:
{}
void Bootstrap(const TActorContext &ctx) {
- TAutoPtr<NSchemeCache::TSchemeCacheNavigate> request(new NSchemeCache::TSchemeCacheNavigate());
+ TAutoPtr<NSchemeCache::TSchemeCacheNavigate> request(new NSchemeCache::TSchemeCacheNavigate());
request->ResultSet.reserve(Tables.size());
for (auto &table : Tables) {
request->ResultSet.push_back({});
auto &x = request->ResultSet.back();
- x.Path = SplitPath(table.TableName);
- x.Operation = NSchemeCache::TSchemeCacheNavigate::OpTable;
+ x.Path = SplitPath(table.TableName);
+ x.Operation = NSchemeCache::TSchemeCacheNavigate::OpTable;
x.ShowPrivatePath = true;
}
diff --git a/ydb/core/client/server/msgbus_server.cpp b/ydb/core/client/server/msgbus_server.cpp
index 46740180600..8a4d8a3bbd5 100644
--- a/ydb/core/client/server/msgbus_server.cpp
+++ b/ydb/core/client/server/msgbus_server.cpp
@@ -598,7 +598,7 @@ void TMessageBusServer::UnknownMessage(TBusMessageContext &msg) {
msg.SendReplyMove(new TBusResponseStatus(MSTATUS_UNKNOWN, "undocumented error 9"));
}
-IActor* TMessageBusServer::CreateProxy() {
+IActor* TMessageBusServer::CreateProxy() {
return CreateMessageBusServerProxy(this, PQReadSessionsInfoWorkerFactory);
}
diff --git a/ydb/core/client/server/msgbus_server.h b/ydb/core/client/server/msgbus_server.h
index 154ecebe9ed..3d40fc90017 100644
--- a/ydb/core/client/server/msgbus_server.h
+++ b/ydb/core/client/server/msgbus_server.h
@@ -160,7 +160,7 @@ protected:
void OnMessage(TBusMessageContext &msg);
IActor* CreateMessageBusTraceService() override;
private:
- IActor* CreateProxy() override;
+ IActor* CreateProxy() override;
void OnError(TAutoPtr<NBus::TBusMessage> message, NBus::EMessageStatus status) override;
void GetTypes(TBusMessageContext &msg);
diff --git a/ydb/core/client/server/msgbus_server_db.cpp b/ydb/core/client/server/msgbus_server_db.cpp
index b4d6f931efe..08f3d717864 100644
--- a/ydb/core/client/server/msgbus_server_db.cpp
+++ b/ydb/core/client/server/msgbus_server_db.cpp
@@ -1,6 +1,6 @@
-#include "msgbus_server.h"
-#include "msgbus_server_proxy.h"
-
+#include "msgbus_server.h"
+#include "msgbus_server_proxy.h"
+
#include <library/cpp/actors/core/actor_bootstrapped.h>
#include <ydb/core/base/appdata.h>
#include <ydb/core/base/path.h>
@@ -12,16 +12,16 @@
#include <ydb/core/tx/schemeshard/schemeshard.h>
#include <ydb/core/tx/tx_proxy/proxy.h>
#include <ydb/public/lib/deprecated/kicli/kicli.h>
-
+
#include <ydb/library/yql/minikql/mkql_node.h>
#include <ydb/library/yql/minikql/mkql_node_serialization.h>
#include <ydb/library/yql/minikql/mkql_function_registry.h>
-
+
#include <library/cpp/json/json_reader.h>
#include <library/cpp/json/json_value.h>
#include <library/cpp/protobuf/json/json2proto.h>
-
+
namespace NKikimr {
namespace NMsgBusProxy {
@@ -196,7 +196,7 @@ protected:
TIntrusivePtr<TMessageBusDbOpsCounters> DbOperationsCounters;
NMon::THistogramCounterHelper* OperationHistogram;
- TAutoPtr<NSchemeCache::TSchemeCacheNavigate> CacheNavigate;
+ TAutoPtr<NSchemeCache::TSchemeCacheNavigate> CacheNavigate;
NJson::TJsonValue JSON;
THPTimer StartTime;
TString Table;
@@ -233,9 +233,9 @@ protected:
}
void Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr& ev, const TActorContext& ctx) {
- const NSchemeCache::TSchemeCacheNavigate& request = *ev->Get()->Request;
+ const NSchemeCache::TSchemeCacheNavigate& request = *ev->Get()->Request;
Y_VERIFY(request.ResultSet.size() == 1);
- if (request.ResultSet.front().Status != NSchemeCache::TSchemeCacheNavigate::EStatus::Ok) {
+ if (request.ResultSet.front().Status != NSchemeCache::TSchemeCacheNavigate::EStatus::Ok) {
return ReplyWithError(MSTATUS_ERROR, TEvTxUserProxy::TResultStatus::ResolveError, ToString(request.ResultSet.front().Status), ctx);
}
CacheNavigate = ev->Get()->Request;
@@ -279,7 +279,7 @@ protected:
case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::EmptyAffectedSet:
case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ResolveError:
case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecError:
- case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::DomainLocalityError:
+ case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::DomainLocalityError:
case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::WrongRequest:
return ReplyWithResult(MSTATUS_ERROR, msg->Record, ctx);
case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ProxyShardNotAvailable:
@@ -327,13 +327,13 @@ public:
}
void ResolveTable(const TString& table, const NActors::TActorContext& ctx) {
- TAutoPtr<NSchemeCache::TSchemeCacheNavigate> request(new NSchemeCache::TSchemeCacheNavigate());
- NSchemeCache::TSchemeCacheNavigate::TEntry entry;
- entry.Path = SplitPath(table);
+ TAutoPtr<NSchemeCache::TSchemeCacheNavigate> request(new NSchemeCache::TSchemeCacheNavigate());
+ NSchemeCache::TSchemeCacheNavigate::TEntry entry;
+ entry.Path = SplitPath(table);
if (entry.Path.empty()) {
return ReplyWithError(MSTATUS_ERROR, TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::WrongRequest, "Invalid table path specified", ctx);
}
- entry.Operation = NSchemeCache::TSchemeCacheNavigate::OpTable;
+ entry.Operation = NSchemeCache::TSchemeCacheNavigate::OpTable;
request->ResultSet.emplace_back(entry);
ctx.Send(SchemeCache, new TEvTxProxySchemeCache::TEvNavigateKeySet(request));
++Requests;
@@ -341,7 +341,7 @@ public:
ctx.Send(MakeTicketParserID(), new TEvTicketParser::TEvAuthorizeTicket(SecurityToken));
++Requests;
}
- TBase::Become(&TThis::StateWaitResolve, ctx, Timeout, new TEvents::TEvWakeup());
+ TBase::Become(&TThis::StateWaitResolve, ctx, Timeout, new TEvents::TEvWakeup());
}
static NMiniKQL::TRuntimeNode NewDataLiteral(NMiniKQL::TKikimrProgramBuilder& pgmBuilder, const NJson::TJsonValue& jsonValue, NScheme::TTypeId typeId) {
@@ -380,7 +380,7 @@ public:
}
}
- void BuildProgram(const NJson::TJsonValue& json, NMiniKQL::TRuntimeNode& pgmReturn, NMiniKQL::TKikimrProgramBuilder& pgmBuilder, const NSchemeCache::TSchemeCacheNavigate::TEntry& tableInfo,
+ void BuildProgram(const NJson::TJsonValue& json, NMiniKQL::TRuntimeNode& pgmReturn, NMiniKQL::TKikimrProgramBuilder& pgmBuilder, const NSchemeCache::TSchemeCacheNavigate::TEntry& tableInfo,
const TVector<const NTxProxy::TTableColumnInfo*>& keys, const THashMap<TString, const NTxProxy::TTableColumnInfo*>& columnByName, TVector<NMiniKQL::TRuntimeNode>& result) {
TVector<NMiniKQL::TRuntimeNode> keyColumns;
TVector<ui32> keyTypes;
@@ -496,7 +496,7 @@ public:
NMiniKQL::TTypeEnvironment env(alloc);
NMiniKQL::TKikimrProgramBuilder pgmBuilder(env, functionRegistry);
NMiniKQL::TRuntimeNode pgmReturn = pgmBuilder.NewEmptyListOfVoid();
- const NSchemeCache::TSchemeCacheNavigate::TEntry& tableInfo = CacheNavigate->ResultSet.front();
+ const NSchemeCache::TSchemeCacheNavigate::TEntry& tableInfo = CacheNavigate->ResultSet.front();
TVector<const NTxProxy::TTableColumnInfo*> keys;
THashMap<TString, const NTxProxy::TTableColumnInfo*> columnByName;
TVector<NMiniKQL::TRuntimeNode> result;
@@ -532,7 +532,7 @@ public:
if (!UserToken.empty()) {
record.SetUserToken(UserToken);
}
- ctx.Send(TxProxyId, Proposal.Release());
+ ctx.Send(TxProxyId, Proposal.Release());
TBase::Become(&TThis::StateWaitExecute);
}
catch (yexception& e) {
@@ -554,7 +554,7 @@ public:
} else {
return ReplyWithError(MSTATUS_ERROR, TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::WrongRequest, "Table should be specified", ctx);
}
- ResolveTable(Table, ctx);
+ ResolveTable(Table, ctx);
}
};
@@ -562,7 +562,7 @@ template <>
TServerDbOperation<TMessageBusInterface<TBusDbOperation>>::TServerDbOperation(
TBusMessageContext& msg, TActorId txProxyId, const TActorId& schemeCache, const TIntrusivePtr<TMessageBusDbOpsCounters>& dbOperationsCounters)
: TMessageBusInterface<TBusDbOperation>(msg)
- , TxProxyId(txProxyId)
+ , TxProxyId(txProxyId)
, SchemeCache(schemeCache)
, DbOperationsCounters(dbOperationsCounters)
, OperationHistogram(nullptr)
@@ -578,7 +578,7 @@ TServerDbOperation<TActorInterface>::TServerDbOperation(
const TIntrusivePtr<TMessageBusDbOpsCounters>& dbOperationsCounters
)
: TActorInterface(hostActor)
- , TxProxyId(txProxyId)
+ , TxProxyId(txProxyId)
, SchemeCache(schemeCache)
, DbOperationsCounters(dbOperationsCounters)
, OperationHistogram(nullptr)
@@ -635,21 +635,21 @@ protected:
}
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered::TPtr&, const TActorContext&) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered::TPtr&, const TActorContext&) {
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr&, const TActorContext& ctx) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr&, const TActorContext& ctx) {
ProcessRequests(ctx);
}
void SendNextRequest(const TActorContext& ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::MSGBUS_PROXY,
- "SendNextRequest proposal" <<
- " to proxy#" << TxProxyId.ToString());
-
+ LOG_DEBUG_S(ctx, NKikimrServices::MSGBUS_PROXY,
+ "SendNextRequest proposal" <<
+ " to proxy#" << TxProxyId.ToString());
+
TAutoPtr<TEvTxUserProxy::TEvProposeTransaction> proposal = Requests.front();
Requests.pop_front();
- ctx.Send(TxProxyId, proposal.Release());
+ ctx.Send(TxProxyId, proposal.Release());
}
void Handle(TEvTxUserProxy::TEvProposeTransactionStatus::TPtr& ev, const TActorContext& ctx) {
@@ -668,11 +668,11 @@ protected:
pipe = itPipe->second;
}
}
- TAutoPtr<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion> request(new NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion());
+ TAutoPtr<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion> request(new NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion());
request->Record.SetTxId(msg->Record.GetTxId());
- LOG_DEBUG_S(ctx, NKikimrServices::MSGBUS_PROXY,
- "HANDLE TEvProposeTransactionStatus" <<
- " send to schemeShard tabletid#" << schemeShardId);
+ LOG_DEBUG_S(ctx, NKikimrServices::MSGBUS_PROXY,
+ "HANDLE TEvProposeTransactionStatus" <<
+ " send to schemeShard tabletid#" << schemeShardId);
NTabletPipe::SendData(ctx, pipe, request.Release());
return;
}
@@ -745,8 +745,8 @@ public:
switch (ev->GetTypeRewrite()) {
HFunc(TEvTxUserProxy::TEvProposeTransactionStatus, Handle);
HFunc(TEvTicketParser::TEvAuthorizeTicketResult, Handle)
- HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered, Handle);
- HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult, Handle);
}
}
@@ -784,17 +784,17 @@ public:
const NJson::TJsonValue::TArray& array = jsonDropTable.GetArray();
for (const NJson::TJsonValue& value : array) {
TAutoPtr<TEvTxUserProxy::TEvProposeTransaction> Proposal(new TEvTxUserProxy::TEvProposeTransaction());
- NKikimrSchemeOp::TModifyScheme& modifyScheme(*Proposal->Record.MutableTransaction()->MutableModifyScheme());
+ NKikimrSchemeOp::TModifyScheme& modifyScheme(*Proposal->Record.MutableTransaction()->MutableModifyScheme());
modifyScheme.SetWorkingDir(path);
- modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
+ modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
modifyScheme.MutableDrop()->SetName(value.GetString());
Requests.emplace_back(Proposal.Release());
}
} else {
TAutoPtr<TEvTxUserProxy::TEvProposeTransaction> Proposal(new TEvTxUserProxy::TEvProposeTransaction());
- NKikimrSchemeOp::TModifyScheme& modifyScheme(*Proposal->Record.MutableTransaction()->MutableModifyScheme());
+ NKikimrSchemeOp::TModifyScheme& modifyScheme(*Proposal->Record.MutableTransaction()->MutableModifyScheme());
modifyScheme.SetWorkingDir(path);
- modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
+ modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
modifyScheme.MutableDrop()->SetName(jsonDropTable.GetString());
Requests.emplace_back(Proposal.Release());
}
@@ -806,17 +806,17 @@ public:
const NJson::TJsonValue::TArray& array = jsonMkDir.GetArray();
for (const NJson::TJsonValue& value : array) {
TAutoPtr<TEvTxUserProxy::TEvProposeTransaction> Proposal(new TEvTxUserProxy::TEvProposeTransaction());
- NKikimrSchemeOp::TModifyScheme& modifyScheme(*Proposal->Record.MutableTransaction()->MutableModifyScheme());
+ NKikimrSchemeOp::TModifyScheme& modifyScheme(*Proposal->Record.MutableTransaction()->MutableModifyScheme());
modifyScheme.SetWorkingDir(path);
- modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpMkDir);
+ modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpMkDir);
modifyScheme.MutableMkDir()->SetName(value.GetString());
Requests.emplace_back(Proposal.Release());
}
} else {
TAutoPtr<TEvTxUserProxy::TEvProposeTransaction> Proposal(new TEvTxUserProxy::TEvProposeTransaction());
- NKikimrSchemeOp::TModifyScheme& modifyScheme(*Proposal->Record.MutableTransaction()->MutableModifyScheme());
+ NKikimrSchemeOp::TModifyScheme& modifyScheme(*Proposal->Record.MutableTransaction()->MutableModifyScheme());
modifyScheme.SetWorkingDir(path);
- modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpMkDir);
+ modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpMkDir);
modifyScheme.MutableMkDir()->SetName(jsonMkDir.GetString());
Requests.emplace_back(Proposal.Release());
}
@@ -827,17 +827,17 @@ public:
const NJson::TJsonValue::TMapType& jsonTables = jsonCreateTable.GetMap();
for (auto itTable = jsonTables.begin(); itTable != jsonTables.end(); ++itTable) {
TAutoPtr<TEvTxUserProxy::TEvProposeTransaction> Proposal(new TEvTxUserProxy::TEvProposeTransaction());
- NKikimrSchemeOp::TModifyScheme& modifyScheme(*Proposal->Record.MutableTransaction()->MutableModifyScheme());
+ NKikimrSchemeOp::TModifyScheme& modifyScheme(*Proposal->Record.MutableTransaction()->MutableModifyScheme());
modifyScheme.SetWorkingDir(path);
- modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
- NKikimrSchemeOp::TTableDescription& createTable(*modifyScheme.MutableCreateTable());
+ modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
+ NKikimrSchemeOp::TTableDescription& createTable(*modifyScheme.MutableCreateTable());
createTable.SetName(itTable->first);
// parsing CreateTable/<name>/Columns
NJson::TJsonValue jsonColumn;
if (itTable->second.GetValue("Columns", &jsonColumn)) {
const NJson::TJsonValue::TMapType& jsonColumns = jsonColumn.GetMap();
for (auto itColumn = jsonColumns.begin(); itColumn != jsonColumns.end(); ++itColumn) {
- NKikimrSchemeOp::TColumnDescription& column(*createTable.AddColumns());
+ NKikimrSchemeOp::TColumnDescription& column(*createTable.AddColumns());
column.SetName(itColumn->first);
column.SetType(itColumn->second.GetString());
}
@@ -876,7 +876,7 @@ public:
if (Requests.empty()) {
return ReplyWithError(MSTATUS_ERROR, TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::WrongRequest, "No valid operations were found", ctx);
}
- ProcessRequests(ctx);
+ ProcessRequests(ctx);
}
};
@@ -884,7 +884,7 @@ template <>
TServerDbSchema<TMessageBusInterface<TBusDbSchema>>::TServerDbSchema(
TBusMessageContext &msg, TActorId txProxyId, const TIntrusivePtr<TMessageBusDbOpsCounters>& dbOperationsCounters)
: TMessageBusInterface<TBusDbSchema>(msg)
- , TxProxyId(txProxyId)
+ , TxProxyId(txProxyId)
, DbOperationsCounters(dbOperationsCounters)
{}
@@ -897,7 +897,7 @@ TServerDbSchema<TActorInterface>::TServerDbSchema(
const TIntrusivePtr<TMessageBusDbOpsCounters>& dbOperationsCounters
)
: TActorInterface(hostActor)
- , TxProxyId(txProxyId)
+ , TxProxyId(txProxyId)
, DbOperationsCounters(dbOperationsCounters)
, JSON(jsonValue)
, SecurityToken(securityToken)
@@ -1036,7 +1036,7 @@ template <>
TServerDbBatch<TMessageBusInterface<TBusDbBatch>>::TServerDbBatch(
TBusMessageContext &msg, TActorId txProxyId, const TActorId& schemeCache, const TIntrusivePtr<TMessageBusDbOpsCounters>& dbOperationsCounters)
: TMessageBusInterface<TBusDbBatch>(msg)
- , TxProxyId(txProxyId)
+ , TxProxyId(txProxyId)
, SchemeCache(schemeCache)
, DbOperationsCounters(dbOperationsCounters)
, MaxInFlight(1)
@@ -1045,23 +1045,23 @@ TServerDbBatch<TMessageBusInterface<TBusDbBatch>>::TServerDbBatch(
void TMessageBusServerProxy::Handle(TEvBusProxy::TEvDbSchema::TPtr& ev, const TActorContext& ctx) {
TEvBusProxy::TEvDbSchema* msg = ev->Get();
- LOG_DEBUG_S(ctx, NKikimrServices::MSGBUS_PROXY,
- " actor# "<< ctx.SelfID.ToString() <<
- " HANDLE TEvDbSchema");
- auto* requestActor = new TServerDbSchema<TMessageBusInterface<TBusDbSchema>>(msg->MsgContext, TxProxy, DbOperationsCounters);
- ctx.Register(requestActor);
+ LOG_DEBUG_S(ctx, NKikimrServices::MSGBUS_PROXY,
+ " actor# "<< ctx.SelfID.ToString() <<
+ " HANDLE TEvDbSchema");
+ auto* requestActor = new TServerDbSchema<TMessageBusInterface<TBusDbSchema>>(msg->MsgContext, TxProxy, DbOperationsCounters);
+ ctx.Register(requestActor);
}
void TMessageBusServerProxy::Handle(TEvBusProxy::TEvDbOperation::TPtr& ev, const TActorContext& ctx) {
TEvBusProxy::TEvDbOperation* msg = ev->Get();
- auto* requestActor = new TServerDbOperation<TMessageBusInterface<TBusDbOperation>>(msg->MsgContext, TxProxy, SchemeCache, DbOperationsCounters);
- ctx.Register(requestActor);
+ auto* requestActor = new TServerDbOperation<TMessageBusInterface<TBusDbOperation>>(msg->MsgContext, TxProxy, SchemeCache, DbOperationsCounters);
+ ctx.Register(requestActor);
}
void TMessageBusServerProxy::Handle(TEvBusProxy::TEvDbBatch::TPtr& ev, const TActorContext& ctx) {
TEvBusProxy::TEvDbBatch* msg = ev->Get();
- auto* requestActor = new TServerDbBatch<TMessageBusInterface<TBusDbBatch>>(msg->MsgContext, TxProxy, SchemeCache, DbOperationsCounters);
- ctx.Register(requestActor);
+ auto* requestActor = new TServerDbBatch<TMessageBusInterface<TBusDbBatch>>(msg->MsgContext, TxProxy, SchemeCache, DbOperationsCounters);
+ ctx.Register(requestActor);
}
}
diff --git a/ydb/core/client/server/msgbus_server_hive_create_tablet.cpp b/ydb/core/client/server/msgbus_server_hive_create_tablet.cpp
index 94e6961cb32..0c41e53f090 100644
--- a/ydb/core/client/server/msgbus_server_hive_create_tablet.cpp
+++ b/ydb/core/client/server/msgbus_server_hive_create_tablet.cpp
@@ -24,23 +24,23 @@ using TBase = TActorBootstrapped<TMessageBusHiveCreateTablet<ResponseType>>;
ui64 OwnerIdx;
TTabletTypes::EType TabletType;
TVector<ui32> AllowedNodeIDs;
- TVector<TSubDomainKey> AllowedDomains;
- TChannelsBindings BindedChannels;
+ TVector<TSubDomainKey> AllowedDomains;
+ TChannelsBindings BindedChannels;
NKikimrProto::EReplyStatus Status;
ui64 TabletId;
TRequest(ui64 ownerId, ui64 ownerIdx, TTabletTypes::EType tabletType,
- TVector<ui32> allowedNodeIDs,
- TVector<TSubDomainKey> allowedDomains,
- TChannelsBindings bindedChannels)
+ TVector<ui32> allowedNodeIDs,
+ TVector<TSubDomainKey> allowedDomains,
+ TChannelsBindings bindedChannels)
: Event(TEvHive::EvCreateTablet)
, OwnerId(ownerId)
, OwnerIdx(ownerIdx)
, TabletType(tabletType)
- , AllowedNodeIDs(std::move(allowedNodeIDs))
- , AllowedDomains(std::move(allowedDomains))
- , BindedChannels(std::move(bindedChannels))
+ , AllowedNodeIDs(std::move(allowedNodeIDs))
+ , AllowedDomains(std::move(allowedDomains))
+ , BindedChannels(std::move(bindedChannels))
, Status(NKikimrProto::UNKNOWN)
, TabletId(0)
{}
@@ -85,9 +85,9 @@ public:
&& cmd.HasTabletType() && (cmd.BindedChannelsSize() > 0);
if (isOk) {
Requests.emplace_back(cmd.GetOwnerId(), cmd.GetOwnerIdx(), cmd.GetTabletType(),
- TVector<ui32>(cmd.GetAllowedNodeIDs().begin(), cmd.GetAllowedNodeIDs().end()),
- TVector<TSubDomainKey>(cmd.GetAllowedDomains().begin(), cmd.GetAllowedDomains().end()),
- TChannelsBindings(cmd.GetBindedChannels().begin(), cmd.GetBindedChannels().end()));
+ TVector<ui32>(cmd.GetAllowedNodeIDs().begin(), cmd.GetAllowedNodeIDs().end()),
+ TVector<TSubDomainKey>(cmd.GetAllowedDomains().begin(), cmd.GetAllowedDomains().end()),
+ TChannelsBindings(cmd.GetBindedChannels().begin(), cmd.GetBindedChannels().end()));
} else {
ErrorReason = Sprintf("Missing arguments for CmdCreateTablet(%" PRIu32 ") call", i);
}
@@ -97,7 +97,7 @@ public:
const auto &cmd = record.GetCmdLookupTablet(i);
isOk = isOk && cmd.HasOwnerId() && cmd.HasOwnerIdx();
if (isOk) {
- Requests.emplace_back(cmd.GetOwnerId(), cmd.GetOwnerIdx());
+ Requests.emplace_back(cmd.GetOwnerId(), cmd.GetOwnerIdx());
} else {
ErrorReason = Sprintf("Missing arguments for CmdLookupTablet(%" PRIu32 ") call", i);
}
@@ -269,8 +269,8 @@ public:
" or kikimr domian configuration, Marker# HC9", (ui64)DomainUid);
return SendReplyAndDie(CreateErrorReply(MSTATUS_ERROR, ctx), ctx);
}
- auto &domain = domainIt->second;
- ui64 hiveUid = domain->DefaultHiveUid;
+ auto &domain = domainIt->second;
+ ui64 hiveUid = domain->DefaultHiveUid;
ui64 hiveTabletId = domainsInfo.GetHive(hiveUid);
if (Status == NKikimrProto::OK) {
@@ -280,16 +280,16 @@ public:
const TRequest &cmd = Requests[i];
switch (cmd.Event) {
case TEvHive::EvCreateTablet: {
- THolder<TEvHive::TEvCreateTablet> x(new TEvHive::TEvCreateTablet(cmd.OwnerId,
- cmd.OwnerIdx,
- cmd.TabletType,
- cmd.BindedChannels,
- cmd.AllowedNodeIDs));
-
- for (const auto& domainKey: cmd.AllowedDomains) {
- *x->Record.AddAllowedDomains() = domainKey;
- }
-
+ THolder<TEvHive::TEvCreateTablet> x(new TEvHive::TEvCreateTablet(cmd.OwnerId,
+ cmd.OwnerIdx,
+ cmd.TabletType,
+ cmd.BindedChannels,
+ cmd.AllowedNodeIDs));
+
+ for (const auto& domainKey: cmd.AllowedDomains) {
+ *x->Record.AddAllowedDomains() = domainKey;
+ }
+
NTabletPipe::SendData(ctx, PipeClient, x.Release(), i);
break;
}
diff --git a/ydb/core/client/server/msgbus_server_local_enumerate_tablets.cpp b/ydb/core/client/server/msgbus_server_local_enumerate_tablets.cpp
index 3b3dbdbaa29..9f867dddc7c 100644
--- a/ydb/core/client/server/msgbus_server_local_enumerate_tablets.cpp
+++ b/ydb/core/client/server/msgbus_server_local_enumerate_tablets.cpp
@@ -75,10 +75,10 @@ public:
TActorId invalidId;
return invalidId;
}
- ui32 nodeId = IsNodeIdPresent ? NodeId : ctx.SelfID.NodeId();
- ui32 hiveUid = domainsInfo.GetDefaultHiveUid(DomainUid);
- ui64 hiveId = domainsInfo.GetHive(hiveUid);
- return MakeLocalRegistrarID(nodeId, hiveId);
+ ui32 nodeId = IsNodeIdPresent ? NodeId : ctx.SelfID.NodeId();
+ ui32 hiveUid = domainsInfo.GetDefaultHiveUid(DomainUid);
+ ui64 hiveId = domainsInfo.GetHive(hiveUid);
+ return MakeLocalRegistrarID(nodeId, hiveId);
}
TEvLocal::TEvEnumerateTablets* MakeReq(const TActorContext &ctx) {
diff --git a/ydb/core/client/server/msgbus_server_persqueue.cpp b/ydb/core/client/server/msgbus_server_persqueue.cpp
index 28c877af065..78b83ef3a3b 100644
--- a/ydb/core/client/server/msgbus_server_persqueue.cpp
+++ b/ydb/core/client/server/msgbus_server_persqueue.cpp
@@ -1010,7 +1010,7 @@ public:
Y_VERIFY((needResolving + needAskOffset + needAskStatus + needAskFetch + metadataOnly) == 1);
++TopicsAnswered;
auto it = TopicInfo.find(topic);
- Y_VERIFY(it != TopicInfo.end(), "topic '%s'", topic.c_str());
+ Y_VERIFY(it != TopicInfo.end(), "topic '%s'", topic.c_str());
it->second.Config = pqDescr.GetPQTabletConfig();
it->second.Config.SetVersion(pqDescr.GetAlterVersion());
it->second.NumParts = pqDescr.PartitionsSize();
diff --git a/ydb/core/client/server/msgbus_server_proxy.cpp b/ydb/core/client/server/msgbus_server_proxy.cpp
index c8cc5253c2a..7f3146d21a7 100644
--- a/ydb/core/client/server/msgbus_server_proxy.cpp
+++ b/ydb/core/client/server/msgbus_server_proxy.cpp
@@ -25,12 +25,12 @@ class TMessageBusServerFlatDescribeRequest : public TMessageBusSecureRequest<TMe
THolder<TBusSchemeDescribe> Request;
NYql::TIssueManager IssueManager;
- void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev, const TActorContext& ctx) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev, const TActorContext& ctx) {
auto &mutableRecord = *ev->Get()->MutableRecord();
TAutoPtr<ResponseType> response(new ResponseType());
response->Record.SetSchemeStatus(mutableRecord.GetStatus());
const auto status = mutableRecord.GetStatus();
- if (status == NKikimrScheme::StatusSuccess) {
+ if (status == NKikimrScheme::StatusSuccess) {
response->Record.SetStatus(MSTATUS_OK);
response->Record.SetPath(mutableRecord.GetPath());
response->Record.MutablePathDescription()->Swap(mutableRecord.MutablePathDescription());
@@ -40,7 +40,7 @@ class TMessageBusServerFlatDescribeRequest : public TMessageBusSecureRequest<TMe
response->Record.SetErrorReason(mutableRecord.GetReason());
switch (status) {
- case NKikimrScheme::StatusPathDoesNotExist:
+ case NKikimrScheme::StatusPathDoesNotExist:
response->Record.SetStatusCode(NKikimrIssues::TStatusIds::PATH_NOT_EXIST);
IssueManager.RaiseIssue(MakeIssue(NKikimrIssues::TIssuesIds::PATH_NOT_EXIST));
break;
@@ -56,7 +56,7 @@ class TMessageBusServerFlatDescribeRequest : public TMessageBusSecureRequest<TMe
TBase::SendReplyAutoPtr(response);
Request.Destroy();
- this->Die(ctx);
+ this->Die(ctx);
}
public:
@@ -72,7 +72,7 @@ public:
//STFUNC(StateWork)
void StateWork(TAutoPtr<NActors::IEventHandle>& ev, const NActors::TActorContext& ctx) {
switch (ev->GetTypeRewrite()) {
- HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
}
}
@@ -83,7 +83,7 @@ public:
void SendRequest(const TActorContext& ctx) {
TAutoPtr<TEvTxUserProxy::TEvNavigate> req(new TEvTxUserProxy::TEvNavigate());
- NKikimrSchemeOp::TDescribePath* record = req->Record.MutableDescribePath();
+ NKikimrSchemeOp::TDescribePath* record = req->Record.MutableDescribePath();
if (Request->Record.HasPath()) {
record->SetPath(Request->Record.GetPath());
@@ -169,8 +169,8 @@ void TMessageBusServerProxy::Handle(TEvBusProxy::TEvFlatDescribeRequest::TPtr& e
void TMessageBusServerProxy::Bootstrap(const TActorContext& ctx) {
SelfID = ctx.SelfID;
- TxProxy = MakeTxProxyID();
-
+ TxProxy = MakeTxProxyID();
+
SchemeCacheCounters = GetServiceCounters(AppData(ctx)->Counters, "pqproxy|cache");
DbOperationsCounters = new TMessageBusDbOpsCounters(AppData(ctx)->Counters);
diff --git a/ydb/core/client/server/msgbus_server_request.cpp b/ydb/core/client/server/msgbus_server_request.cpp
index c18e8100343..9223bea9f1a 100644
--- a/ydb/core/client/server/msgbus_server_request.cpp
+++ b/ydb/core/client/server/msgbus_server_request.cpp
@@ -185,7 +185,7 @@ void TMessageBusServerRequest::FinishReply(const TActorContext &ctx)
if (Proposal)
AsyncDestroy(Proposal, ctx, AppData(ctx)->UserPoolId);
- Die(ctx);
+ Die(ctx);
}
void TMessageBusServerRequest::Handle(TMiniKQLCompileServiceEvents::TEvCompileStatus::TPtr &ev, const TActorContext &ctx) {
@@ -299,7 +299,7 @@ void TMessageBusServerRequest::Handle(TEvTxUserProxy::TEvProposeTransactionStatu
case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::EmptyAffectedSet:
case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecError:
case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::AccessDenied:
- case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::DomainLocalityError:
+ case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::DomainLocalityError:
case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecResultUnavailable:
case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecCancelled:
case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::WrongRequest:
diff --git a/ydb/core/client/server/msgbus_server_request.h b/ydb/core/client/server/msgbus_server_request.h
index 31fc9b0681c..b77d50983e6 100644
--- a/ydb/core/client/server/msgbus_server_request.h
+++ b/ydb/core/client/server/msgbus_server_request.h
@@ -28,7 +28,7 @@ public:
SendReplyAutoPtr(response);
- this->Die(ctx);
+ this->Die(ctx);
}
};
diff --git a/ydb/core/client/server/msgbus_server_s3_listing.cpp b/ydb/core/client/server/msgbus_server_s3_listing.cpp
index ec8cc3ec3be..3626866322b 100644
--- a/ydb/core/client/server/msgbus_server_s3_listing.cpp
+++ b/ydb/core/client/server/msgbus_server_s3_listing.cpp
@@ -114,7 +114,7 @@ private:
TAutoPtr<NSchemeCache::TSchemeCacheNavigate> request(new NSchemeCache::TSchemeCacheNavigate());
NSchemeCache::TSchemeCacheNavigate::TEntry entry;
- entry.Path = SplitPath(table);
+ entry.Path = SplitPath(table);
if (entry.Path.empty()) {
return ReplyWithError(MSTATUS_ERROR, NTxProxy::TResultStatus::EStatus::ResolveError, "Invalid table path specified", ctx);
}
diff --git a/ydb/core/client/server/msgbus_server_scheme_initroot.cpp b/ydb/core/client/server/msgbus_server_scheme_initroot.cpp
index 43016ccf5a2..a8538eea1cb 100644
--- a/ydb/core/client/server/msgbus_server_scheme_initroot.cpp
+++ b/ydb/core/client/server/msgbus_server_scheme_initroot.cpp
@@ -11,7 +11,7 @@
namespace NKikimr {
namespace NMsgBusProxy {
-using namespace NSchemeShard;
+using namespace NSchemeShard;
class TMessageBusSchemeInitRoot : public TMessageBusSecureRequest<TMessageBusServerRequestBase<TMessageBusSchemeInitRoot>> {
using TBase = TMessageBusSecureRequest<TMessageBusServerRequestBase<TMessageBusSchemeInitRoot>>;
@@ -19,20 +19,20 @@ class TMessageBusSchemeInitRoot : public TMessageBusSecureRequest<TMessageBusSer
const bool WithRetry = true;
TActorId PipeClient;
- void ReplyWithResult(EResponseStatus status, TEvSchemeShard::TEvInitRootShardResult::EStatus ssStatus, const TActorContext &ctx) {
+ void ReplyWithResult(EResponseStatus status, TEvSchemeShard::TEvInitRootShardResult::EStatus ssStatus, const TActorContext &ctx) {
TAutoPtr<TBusResponseStatus> response(new TBusResponseStatus(status));
response->Record.SetSchemeStatus(ssStatus);
SendReplyAutoPtr(response);
Request.Destroy();
- Die(ctx);
+ Die(ctx);
}
- void Handle(TEvSchemeShard::TEvInitRootShardResult::TPtr& ev, const TActorContext& ctx) {
+ void Handle(TEvSchemeShard::TEvInitRootShardResult::TPtr& ev, const TActorContext& ctx) {
const NKikimrTxScheme::TEvInitRootShardResult &record = ev->Get()->Record;
- const auto status = (TEvSchemeShard::TEvInitRootShardResult::EStatus)record.GetStatus();
+ const auto status = (TEvSchemeShard::TEvInitRootShardResult::EStatus)record.GetStatus();
switch (status) {
- case TEvSchemeShard::TEvInitRootShardResult::StatusSuccess:
- case TEvSchemeShard::TEvInitRootShardResult::StatusAlreadyInitialized:
+ case TEvSchemeShard::TEvInitRootShardResult::StatusSuccess:
+ case TEvSchemeShard::TEvInitRootShardResult::StatusAlreadyInitialized:
return ReplyWithResult(MSTATUS_OK, status, ctx);
default:
return ReplyWithResult(MSTATUS_ERROR, status, ctx);
@@ -64,7 +64,7 @@ public:
//STFUNC(StateWork)
void StateWork(TAutoPtr<NActors::IEventHandle> &ev, const NActors::TActorContext &ctx) {
switch (ev->GetTypeRewrite()) {
- HFunc(TEvSchemeShard::TEvInitRootShardResult, Handle);
+ HFunc(TEvSchemeShard::TEvInitRootShardResult, Handle);
}
}
@@ -72,7 +72,7 @@ public:
TString tagName = Request->Record.GetTagName();
const TDomainsInfo::TDomain *domain = AppData(ctx)->DomainsInfo->GetDomainByName(tagName);
if (domain != nullptr) {
- THolder<TEvSchemeShard::TEvInitRootShard> x = MakeHolder<TEvSchemeShard::TEvInitRootShard>(ctx.SelfID, domain->DomainRootTag(), domain->Name);
+ THolder<TEvSchemeShard::TEvInitRootShard> x = MakeHolder<TEvSchemeShard::TEvInitRootShard>(ctx.SelfID, domain->DomainRootTag(), domain->Name);
if (Request->Record.HasGlobalConfig()) {
x->Record.MutableConfig()->MergeFrom(Request->Record.GetGlobalConfig());
}
@@ -85,7 +85,7 @@ public:
PipeClient = ctx.RegisterWithSameMailbox(NTabletPipe::CreateClient(ctx.SelfID, domain->SchemeRoot, clientConfig));
NTabletPipe::SendData(ctx, PipeClient, x.Release());
} else {
- ReplyWithResult(MSTATUS_ERROR, TEvSchemeShard::TEvInitRootShardResult::StatusBadArgument, ctx);
+ ReplyWithResult(MSTATUS_ERROR, TEvSchemeShard::TEvInitRootShardResult::StatusBadArgument, ctx);
}
}
};
diff --git a/ydb/core/client/server/msgbus_server_scheme_request.cpp b/ydb/core/client/server/msgbus_server_scheme_request.cpp
index f999841c159..7df5e262d07 100644
--- a/ydb/core/client/server/msgbus_server_scheme_request.cpp
+++ b/ydb/core/client/server/msgbus_server_scheme_request.cpp
@@ -100,7 +100,7 @@ void TMessageBusServerSchemeRequest<TBusPersQueue>::SendProposeRequest(const TAc
const auto& cmd = Request->Record.GetMetaRequest().GetCmdCreateTopic();
auto *transaction = record.MutableTransaction()->MutableModifyScheme();
transaction->SetWorkingDir(TopicPrefix(ctx));
- transaction->SetOperationType(NKikimrSchemeOp::ESchemeOpCreatePersQueueGroup);
+ transaction->SetOperationType(NKikimrSchemeOp::ESchemeOpCreatePersQueueGroup);
auto *pqgroup = transaction->MutableCreatePersQueueGroup();
pqgroup->SetName(cmd.GetTopic());
pqgroup->SetTotalGroupCount(cmd.GetNumPartitions());
@@ -112,7 +112,7 @@ void TMessageBusServerSchemeRequest<TBusPersQueue>::SendProposeRequest(const TAc
const auto& cmd = Request->Record.GetMetaRequest().GetCmdChangeTopic();
auto *transaction = record.MutableTransaction()->MutableModifyScheme();
transaction->SetWorkingDir(TopicPrefix(ctx));
- transaction->SetOperationType(NKikimrSchemeOp::ESchemeOpAlterPersQueueGroup);
+ transaction->SetOperationType(NKikimrSchemeOp::ESchemeOpAlterPersQueueGroup);
auto *pqgroup = transaction->MutableAlterPersQueueGroup();
pqgroup->SetName(cmd.GetTopic());
if (cmd.HasNumPartitions())
@@ -125,7 +125,7 @@ void TMessageBusServerSchemeRequest<TBusPersQueue>::SendProposeRequest(const TAc
const auto& cmd = Request->Record.GetMetaRequest().GetCmdDeleteTopic();
auto *transaction = record.MutableTransaction()->MutableModifyScheme();
transaction->SetWorkingDir(TopicPrefix(ctx));
- transaction->SetOperationType(NKikimrSchemeOp::ESchemeOpDropPersQueueGroup);
+ transaction->SetOperationType(NKikimrSchemeOp::ESchemeOpDropPersQueueGroup);
auto *pqgroup = transaction->MutableDrop();
pqgroup->SetName(cmd.GetTopic());
}
@@ -139,7 +139,7 @@ template <>
void TMessageBusServerSchemeRequest<TBusPersQueue>::ReplyWithResult(EResponseStatus status, const NKikimrTxUserProxy::TEvProposeTransactionStatus &result, const TActorContext &ctx) {
TAutoPtr<TBusResponse> response(new TBusResponse());
FillStatus(status, result, response.Get());
- if (result.GetSchemeShardStatus() == NKikimrScheme::StatusPathDoesNotExist) {
+ if (result.GetSchemeShardStatus() == NKikimrScheme::StatusPathDoesNotExist) {
response->Record.SetErrorCode(NPersQueue::NErrorCode::UNKNOWN_TOPIC);
} else if (status == MSTATUS_OK || status == MSTATUS_INPROGRESS)
response->Record.SetErrorCode(NPersQueue::NErrorCode::OK);
@@ -150,7 +150,7 @@ void TMessageBusServerSchemeRequest<TBusPersQueue>::ReplyWithResult(EResponseSta
}
SendReplyAutoPtr(response);
Request.Destroy();
- Die(ctx);
+ Die(ctx);
}
template <>
@@ -168,7 +168,7 @@ void TMessageBusServerSchemeRequest<TBusSchemeOperation>::SendProposeRequest(con
bool needAdminCheck = false;
switch (Request->Record.GetTransaction().GetModifyScheme().GetOperationType()) {
- case NKikimrSchemeOp::ESchemeOpSplitMergeTablePartitions:
+ case NKikimrSchemeOp::ESchemeOpSplitMergeTablePartitions:
needAdminCheck = true;
break;
default:
@@ -201,12 +201,12 @@ void TMessageBusServerSchemeRequest<TBusSchemeOperation>::SendProposeRequest(con
template <>
void TMessageBusServerSchemeRequest<TBusSchemeOperation>::ReplyWithResult(EResponseStatus status, const NKikimrTxUserProxy::TEvProposeTransactionStatus &result, const TActorContext &ctx) {
TAutoPtr<TBusResponse> response(new TBusResponse());
-
+
FillStatus(status, result, response.Get());
-
+
SendReplyAutoPtr(response);
Request.Destroy();
- Die(ctx);
+ Die(ctx);
}
void TMessageBusServerProxy::Handle(TEvBusProxy::TEvPersQueue::TPtr& ev, const TActorContext& ctx) {
diff --git a/ydb/core/client/server/msgbus_server_tx_request.cpp b/ydb/core/client/server/msgbus_server_tx_request.cpp
index 922925c7ed3..a0d73fa9d69 100644
--- a/ydb/core/client/server/msgbus_server_tx_request.cpp
+++ b/ydb/core/client/server/msgbus_server_tx_request.cpp
@@ -5,7 +5,7 @@
namespace NKikimr {
namespace NMsgBusProxy {
-class TMessageBusTxStatusRequestActor : public TMessageBusSimpleTabletRequest<TMessageBusTxStatusRequestActor, NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult, NKikimrServices::TActivity::FRONT_SCHEME_TXSTATUS> {
+class TMessageBusTxStatusRequestActor : public TMessageBusSimpleTabletRequest<TMessageBusTxStatusRequestActor, NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult, NKikimrServices::TActivity::FRONT_SCHEME_TXSTATUS> {
const ui64 TxId;
const ui64 PathId;
bool InProgress;
@@ -22,7 +22,7 @@ public:
: TMessageBusTxStatusRequestActor(msg, static_cast<TBusSchemeOperationStatus*>(msg.GetMessage()))
{}
- void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr&, const TActorContext& ctx) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr&, const TActorContext& ctx) {
TAutoPtr<NMsgBusProxy::TBusResponse> response(new NMsgBusProxy::TBusResponse());
response->Record.SetStatus(NMsgBusProxy::MSTATUS_OK);
response->Record.MutableFlatTxId()->SetTxId(TxId);
@@ -31,7 +31,7 @@ public:
SendReplyAndDie(response.Release(), ctx);
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered::TPtr&, const TActorContext&) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered::TPtr&, const TActorContext&) {
InProgress = true;
}
@@ -50,8 +50,8 @@ public:
SendReplyAndDie(response.Release(), ctx);
}
- NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion* MakeReq(const TActorContext&) {
- THolder<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion> request(new NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion());
+ NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion* MakeReq(const TActorContext&) {
+ THolder<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion> request(new NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion());
request->Record.SetTxId(TxId);
return request.Release();
}
@@ -59,8 +59,8 @@ public:
void StateFunc(TAutoPtr<NActors::IEventHandle>& ev, const NActors::TActorContext& ctx) {
switch (ev->GetTypeRewrite()) {
HFunc(TEvents::TEvUndelivered, HandleUndelivered);
- HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered, Handle);
- HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult, Handle);
CFunc(TEvents::TSystem::Wakeup, HandleTimeout);
}
}
diff --git a/ydb/core/cms/console/console.cpp b/ydb/core/cms/console/console.cpp
index 919d8040299..fe477202af5 100644
--- a/ydb/core/cms/console/console.cpp
+++ b/ydb/core/cms/console/console.cpp
@@ -29,7 +29,7 @@ void TConsole::OnActivateExecutor(const TActorContext &ctx)
ctx.RegisterWithSameMailbox(ConfigsManager);
TenantsManager = new TTenantsManager(*this, domains->Domains.at(domainId),
- Counters,
+ Counters,
AppData()->FeatureFlags);
ctx.RegisterWithSameMailbox(TenantsManager);
diff --git a/ydb/core/cms/console/console__create_tenant.cpp b/ydb/core/cms/console/console__create_tenant.cpp
index 04c906a45f8..77d8166d547 100644
--- a/ydb/core/cms/console/console__create_tenant.cpp
+++ b/ydb/core/cms/console/console__create_tenant.cpp
@@ -127,11 +127,11 @@ public:
Tenant->IsExternalSubdomain = Self->FeatureFlags.GetEnableExternalSubdomains();
Tenant->IsExternalHive = Self->FeatureFlags.GetEnableExternalHive();
Tenant->IsExternalSysViewProcessor = Self->FeatureFlags.GetEnablePersistentQueryStats();
-
- if (rec.options().disable_external_subdomain()) {
- Tenant->IsExternalSubdomain = false;
- }
-
+
+ if (rec.options().disable_external_subdomain()) {
+ Tenant->IsExternalSubdomain = false;
+ }
+
if (rec.options().plan_resolution()) {
Tenant->PlanResolution = rec.options().plan_resolution();
}
@@ -141,7 +141,7 @@ public:
Tenant->Mediators = 0;
Tenant->PlanResolution = 0;
Tenant->TimeCastBucketsPerMediator = 0;
- Tenant->IsExternalSubdomain = false;
+ Tenant->IsExternalSubdomain = false;
Tenant->IsExternalHive = false;
Tenant->IsExternalSysViewProcessor = false;
}
diff --git a/ydb/core/cms/console/console__scheme.h b/ydb/core/cms/console/console__scheme.h
index ecbf746747a..29eb6c3035a 100644
--- a/ydb/core/cms/console/console__scheme.h
+++ b/ydb/core/cms/console/console__scheme.h
@@ -29,14 +29,14 @@ struct Schema : NIceDb::Schema {
struct SubdomainVersion : Column<10, NScheme::NTypeIds::Uint64> {};
struct ConfirmedSubdomain : Column<11, NScheme::NTypeIds::Uint64> {};
struct TimeCastBucketsPerMediator : Column<12, NScheme::NTypeIds::Uint32> {};
- struct Attributes : Column<13, NScheme::NTypeIds::String> { using Type = NKikimrSchemeOp::TAlterUserAttributes; };
+ struct Attributes : Column<13, NScheme::NTypeIds::String> { using Type = NKikimrSchemeOp::TAlterUserAttributes; };
struct Generation : Column<14, NScheme::NTypeIds::Uint64> {};
// DomainId {
struct SchemeShardId : Column<15, NScheme::NTypeIds::Uint64> {};
struct PathId : Column<16, NScheme::NTypeIds::Uint64> {};
// } // DomainId
struct ErrorCode : Column<17, NScheme::NTypeIds::Uint32> {};
- struct IsExternalSubDomain : Column<18, NScheme::NTypeIds::Bool> {};
+ struct IsExternalSubDomain : Column<18, NScheme::NTypeIds::Bool> {};
struct IsExternalHive : Column<19, NScheme::NTypeIds::Bool> {};
struct AreResourcesShared : Column<20, NScheme::NTypeIds::Bool> {};
// SharedDomainId {
diff --git a/ydb/core/cms/console/console_tenants_manager.cpp b/ydb/core/cms/console/console_tenants_manager.cpp
index 47f05a7c8c9..0db3f5dceda 100644
--- a/ydb/core/cms/console/console_tenants_manager.cpp
+++ b/ydb/core/cms/console/console_tenants_manager.cpp
@@ -447,18 +447,18 @@ public:
}
}
- void FillSubdomainCreationInfo(NKikimrSubDomains::TSubDomainSettings &subdomain)
- {
- subdomain.SetName(Subdomain.second);
- if (Tenant->IsExternalSubdomain) {
- subdomain.SetExternalSchemeShard(true);
+ void FillSubdomainCreationInfo(NKikimrSubDomains::TSubDomainSettings &subdomain)
+ {
+ subdomain.SetName(Subdomain.second);
+ if (Tenant->IsExternalSubdomain) {
+ subdomain.SetExternalSchemeShard(true);
if (Tenant->IsExternalHive) {
subdomain.SetExternalHive(true);
}
if (Tenant->IsExternalSysViewProcessor) {
subdomain.SetExternalSysViewProcessor(true);
}
- }
+ }
if (SharedTenant) {
const auto &resourcesDomainId = SharedTenant->DomainId;
@@ -466,9 +466,9 @@ public:
resourcesDomainKey.SetSchemeShard(resourcesDomainId.OwnerId);
resourcesDomainKey.SetPathId(resourcesDomainId.LocalPathId);
}
- }
-
- void FillSubdomainAlterInfo(NKikimrSubDomains::TSubDomainSettings &subdomain,
+ }
+
+ void FillSubdomainAlterInfo(NKikimrSubDomains::TSubDomainSettings &subdomain,
bool tablets)
{
subdomain.SetName(Subdomain.second);
@@ -478,15 +478,15 @@ public:
subdomain.SetPlanResolution(Tenant->PlanResolution);
subdomain.SetTimeCastBucketsPerMediator(Tenant->TimeCastBucketsPerMediator);
}
- if (Tenant->IsExternalSubdomain) {
- subdomain.SetExternalSchemeShard(true);
+ if (Tenant->IsExternalSubdomain) {
+ subdomain.SetExternalSchemeShard(true);
if (Tenant->IsExternalHive) {
subdomain.SetExternalHive(true);
}
if (Tenant->IsExternalSysViewProcessor) {
subdomain.SetExternalSysViewProcessor(true);
}
- }
+ }
for (auto &pr : (SharedTenant ? SharedTenant->StoragePools : Tenant->StoragePools)) {
// N.B. only provide schemeshard with pools that have at least one allocated group
@@ -526,7 +526,7 @@ public:
auto &tx = *request->Record.MutableTransaction()->MutableModifyScheme();
tx.SetWorkingDir(Subdomain.first);
- tx.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterUserAttributes);
+ tx.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterUserAttributes);
tx.MutableAlterUserAttributes()->CopyFrom(Tenant->Attributes);
tx.MutableAlterUserAttributes()->SetPathName(Subdomain.second);
@@ -553,11 +553,11 @@ public:
FillSubdomainAlterInfo(*tx.MutableSubDomain(), true);
- if (Tenant->IsExternalSubdomain) {
- tx.SetOperationType(NKikimrSchemeOp::ESchemeOpAlterExtSubDomain);
- } else {
- tx.SetOperationType(NKikimrSchemeOp::ESchemeOpAlterSubDomain);
- }
+ if (Tenant->IsExternalSubdomain) {
+ tx.SetOperationType(NKikimrSchemeOp::ESchemeOpAlterExtSubDomain);
+ } else {
+ tx.SetOperationType(NKikimrSchemeOp::ESchemeOpAlterSubDomain);
+ }
BLOG_TRACE("TSubdomainManip(" << Tenant->Path << ") send alter subdomain cmd: "
<< request->ToString());
@@ -575,13 +575,13 @@ public:
if (Tenant->UserToken.GetUserSID())
request->Record.SetUserToken(Tenant->UserToken.SerializeAsString());
auto &tx = *request->Record.MutableTransaction()->MutableModifyScheme();
- if (Tenant->IsExternalSubdomain) {
- tx.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateExtSubDomain);
- } else {
- tx.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateSubDomain);
- }
+ if (Tenant->IsExternalSubdomain) {
+ tx.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateExtSubDomain);
+ } else {
+ tx.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateSubDomain);
+ }
tx.SetWorkingDir(Subdomain.first);
- FillSubdomainCreationInfo(*tx.MutableSubDomain());
+ FillSubdomainCreationInfo(*tx.MutableSubDomain());
if (Tenant->Attributes.UserAttributesSize())
tx.MutableAlterUserAttributes()->CopyFrom(Tenant->Attributes);
@@ -601,11 +601,11 @@ public:
if (Tenant->UserToken.GetUserSID())
request->Record.SetUserToken(Tenant->UserToken.SerializeAsString());
auto &tx = *request->Record.MutableTransaction()->MutableModifyScheme();
- if (Tenant->IsExternalSubdomain) {
- tx.SetOperationType(NKikimrSchemeOp::ESchemeOpForceDropExtSubDomain);
- } else {
- tx.SetOperationType(NKikimrSchemeOp::ESchemeOpForceDropSubDomain);
- }
+ if (Tenant->IsExternalSubdomain) {
+ tx.SetOperationType(NKikimrSchemeOp::ESchemeOpForceDropExtSubDomain);
+ } else {
+ tx.SetOperationType(NKikimrSchemeOp::ESchemeOpForceDropSubDomain);
+ }
tx.SetWorkingDir(Subdomain.first);
tx.MutableDrop()->SetName(Subdomain.second);
@@ -691,7 +691,7 @@ public:
if (!Pipe)
OpenPipe(ctx);
- auto request = MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>();
+ auto request = MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>();
request->Record.SetTxId(TxId);
BLOG_TRACE("TSubdomainManip(" << Tenant->Path << ") send notification request: " << request->ToString());
@@ -705,7 +705,7 @@ public:
if (!Pipe)
OpenPipe(ctx);
- auto request = MakeHolder<TEvSchemeShard::TEvDescribeScheme>(Tenant->Path);
+ auto request = MakeHolder<TEvSchemeShard::TEvDescribeScheme>(Tenant->Path);
NTabletPipe::SendData(ctx, Pipe, request.Release());
}
@@ -728,12 +728,12 @@ public:
}
}
- void Handle(TEvSchemeShard::TEvNotifyTxCompletionRegistered::TPtr &ev, const TActorContext&) {
+ void Handle(TEvSchemeShard::TEvNotifyTxCompletionRegistered::TPtr &ev, const TActorContext&) {
BLOG_D("TSubdomainManip(" << Tenant->Path << ") got TEvNotifyTxCompletionRegistered: "
<< ev->Get()->Record.ShortDebugString());
}
- void Handle(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr &ev, const TActorContext& ctx) {
+ void Handle(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr &ev, const TActorContext& ctx) {
BLOG_D("TSubdomainManip(" << Tenant->Path << ") got TEvNotifyTxCompletionResult: "
<< ev->Get()->Record.ShortDebugString());
@@ -786,8 +786,8 @@ public:
case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecError:
if (Action == REMOVE) {
// Check if removal finished or in-progress.
- if (rec.GetSchemeShardStatus() == NKikimrScheme::StatusPathDoesNotExist
- || rec.GetSchemeShardStatus() == NKikimrScheme::StatusMultipleModifications) {
+ if (rec.GetSchemeShardStatus() == NKikimrScheme::StatusPathDoesNotExist
+ || rec.GetSchemeShardStatus() == NKikimrScheme::StatusMultipleModifications) {
BLOG_D("TSubdomainManip(" << Tenant->Path << ") consider dubdomain is removed");
ActionFinished(ctx);
break;
@@ -802,7 +802,7 @@ public:
}
}
- void Handle(TEvSchemeShard::TEvDescribeSchemeResult::TPtr ev, const TActorContext &ctx)
+ void Handle(TEvSchemeShard::TEvDescribeSchemeResult::TPtr ev, const TActorContext &ctx)
{
const auto &rec = ev->Get()->GetRecord();
@@ -811,10 +811,10 @@ public:
if (Action == REMOVE) {
switch (rec.GetStatus()) {
- case NKikimrScheme::EStatus::StatusPathDoesNotExist:
+ case NKikimrScheme::EStatus::StatusPathDoesNotExist:
ActionFinished(ctx);
break;
- case NKikimrScheme::EStatus::StatusSuccess:
+ case NKikimrScheme::EStatus::StatusSuccess:
DropSubdomain(ctx);
break;
default:
@@ -825,10 +825,10 @@ public:
return;
}
- if (rec.GetStatus() != NKikimrScheme::EStatus::StatusSuccess) {
+ if (rec.GetStatus() != NKikimrScheme::EStatus::StatusSuccess) {
BLOG_ERROR("TSubdomainManip(" << Tenant->Path << ") "
<< "Receive TEvDescribeSchemeResult with bad status "
- << NKikimrScheme::EStatus_Name(rec.GetStatus()) <<
+ << NKikimrScheme::EStatus_Name(rec.GetStatus()) <<
" reason is <" << rec.GetReason() << ">" <<
" while resolving subdomain " << Tenant->Path);
@@ -837,13 +837,13 @@ public:
}
auto pathType = rec.GetPathDescription().GetSelf().GetPathType();
- auto expectedPathType = Tenant->IsExternalSubdomain ? NKikimrSchemeOp::EPathTypeExtSubDomain : NKikimrSchemeOp::EPathTypeSubDomain;
- if (pathType != expectedPathType) {
+ auto expectedPathType = Tenant->IsExternalSubdomain ? NKikimrSchemeOp::EPathTypeExtSubDomain : NKikimrSchemeOp::EPathTypeSubDomain;
+ if (pathType != expectedPathType) {
BLOG_ERROR("TSubdomainManip(" << Tenant->Path << ") "
<< "Resolve subdomain fail, tenant path "
<< Tenant->Path << " has invalid path type "
- << NKikimrSchemeOp::EPathType_Name(pathType)
- << " but expected " << NKikimrSchemeOp::EPathType_Name(expectedPathType));
+ << NKikimrSchemeOp::EPathType_Name(pathType)
+ << " but expected " << NKikimrSchemeOp::EPathType_Name(expectedPathType));
ReplyAndDie(new TTenantsManager::TEvPrivate::TEvSubdomainFailed(Tenant, "bad path type"), ctx);
return;
}
@@ -866,9 +866,9 @@ public:
STFUNC(StateSubdomain) {
switch (ev->GetTypeRewrite()) {
- HFunc(TEvSchemeShard::TEvDescribeSchemeResult, Handle);
- HFunc(TEvSchemeShard::TEvNotifyTxCompletionRegistered, Handle);
- HFunc(TEvSchemeShard::TEvNotifyTxCompletionResult, Handle);
+ HFunc(TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ HFunc(TEvSchemeShard::TEvNotifyTxCompletionRegistered, Handle);
+ HFunc(TEvSchemeShard::TEvNotifyTxCompletionResult, Handle);
HFunc(TEvTabletPipe::TEvClientConnected, Handle);
HFunc(TEvTabletPipe::TEvClientDestroyed, Handle);
HFunc(TEvTxUserProxy::TEvProposeTransactionStatus, HandleSubdomain);
@@ -882,7 +882,7 @@ public:
STFUNC(GetSubdomainKey) {
switch (ev->GetTypeRewrite()) {
- HFunc(TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ HFunc(TEvSchemeShard::TEvDescribeSchemeResult, Handle);
HFunc(TEvTabletPipe::TEvClientConnected, Handle);
HFunc(TEvTabletPipe::TEvClientDestroyed, Handle);
@@ -1181,7 +1181,7 @@ TTenantsManager::TTenant::TTenant(const TString &path,
, SubdomainVersion(1)
, ConfirmedSubdomain(0)
, Generation(0)
- , IsExternalSubdomain(false)
+ , IsExternalSubdomain(false)
, IsExternalHive(false)
, IsExternalSysViewProcessor(false)
, AreResourcesShared(false)
@@ -2245,7 +2245,7 @@ void TTenantsManager::DbAddTenant(TTenant::TPtr tenant,
<< " confirmedsubdomain=" << tenant->ConfirmedSubdomain
<< " attrs=" << tenant->Attributes.ShortDebugString()
<< " generation=" << tenant->Generation
- << " errorcode=" << tenant->ErrorCode
+ << " errorcode=" << tenant->ErrorCode
<< " isExternalSubDomain=" << tenant->IsExternalSubdomain
<< " isExternalHive=" << tenant->IsExternalHive
<< " isExternalSysViewProcessor=" << tenant->IsExternalSysViewProcessor
@@ -2266,7 +2266,7 @@ void TTenantsManager::DbAddTenant(TTenant::TPtr tenant,
NIceDb::TUpdate<Schema::Tenants::ConfirmedSubdomain>(tenant->ConfirmedSubdomain),
NIceDb::TUpdate<Schema::Tenants::Attributes>(tenant->Attributes),
NIceDb::TUpdate<Schema::Tenants::Generation>(tenant->Generation),
- NIceDb::TUpdate<Schema::Tenants::ErrorCode>(tenant->ErrorCode),
+ NIceDb::TUpdate<Schema::Tenants::ErrorCode>(tenant->ErrorCode),
NIceDb::TUpdate<Schema::Tenants::IsExternalSubDomain>(tenant->IsExternalSubdomain),
NIceDb::TUpdate<Schema::Tenants::IsExternalHive>(tenant->IsExternalHive),
NIceDb::TUpdate<Schema::Tenants::IsExternalSysViewProcessor>(tenant->IsExternalSysViewProcessor),
@@ -2364,14 +2364,14 @@ bool TTenantsManager::DbLoadState(TTransactionContext &txc, const TActorContext
TString userToken = tenantRowset.GetValue<Schema::Tenants::UserToken>();
ui64 subdomainVersion = tenantRowset.GetValueOrDefault<Schema::Tenants::SubdomainVersion>(1);
ui64 confirmedSubdomain = tenantRowset.GetValueOrDefault<Schema::Tenants::ConfirmedSubdomain>(0);
- NKikimrSchemeOp::TAlterUserAttributes attrs = tenantRowset.GetValueOrDefault<Schema::Tenants::Attributes>({});
+ NKikimrSchemeOp::TAlterUserAttributes attrs = tenantRowset.GetValueOrDefault<Schema::Tenants::Attributes>({});
ui64 generation = tenantRowset.GetValueOrDefault<Schema::Tenants::Generation>(1);
const TDomainId domainId = LoadDomainId<Schema::Tenants::SchemeShardId, Schema::Tenants::PathId>(tenantRowset);
const TDomainId sharedDomainId = LoadDomainId<Schema::Tenants::SharedDomainSchemeShardId, Schema::Tenants::SharedDomainPathId>(tenantRowset);
TString issue = tenantRowset.GetValueOrDefault<Schema::Tenants::Issue>("");
Ydb::StatusIds::StatusCode errorCode
= static_cast<Ydb::StatusIds::StatusCode>(tenantRowset.GetValueOrDefault<Schema::Tenants::ErrorCode>(0));
- bool isExternalSubDomain = tenantRowset.GetValueOrDefault<Schema::Tenants::IsExternalSubDomain>(false);
+ bool isExternalSubDomain = tenantRowset.GetValueOrDefault<Schema::Tenants::IsExternalSubDomain>(false);
bool isExternalHive = tenantRowset.GetValueOrDefault<Schema::Tenants::IsExternalHive>(false);
bool isExternalSysViewProcessor = tenantRowset.GetValueOrDefault<Schema::Tenants::IsExternalSysViewProcessor>(false);
const bool areResourcesShared = tenantRowset.GetValueOrDefault<Schema::Tenants::AreResourcesShared>(false);
@@ -2390,7 +2390,7 @@ bool TTenantsManager::DbLoadState(TTransactionContext &txc, const TActorContext
tenant->SharedDomainId = sharedDomainId;
tenant->ErrorCode = errorCode;
tenant->Issue = issue;
- tenant->IsExternalSubdomain = isExternalSubDomain;
+ tenant->IsExternalSubdomain = isExternalSubDomain;
tenant->IsExternalHive = isExternalHive;
tenant->IsExternalSysViewProcessor = isExternalSysViewProcessor;
tenant->AreResourcesShared = areResourcesShared;
@@ -2764,7 +2764,7 @@ void TTenantsManager::DbUpdateTenantAlterIdempotencyKey(TTenant::TPtr tenant,
}
void TTenantsManager::DbUpdateTenantUserAttributes(TTenant::TPtr tenant,
- const NKikimrSchemeOp::TAlterUserAttributes &attributes,
+ const NKikimrSchemeOp::TAlterUserAttributes &attributes,
TTransactionContext &txc,
const TActorContext &ctx)
{
diff --git a/ydb/core/cms/console/console_tenants_manager.h b/ydb/core/cms/console/console_tenants_manager.h
index f5177d07ee1..a21615dd622 100644
--- a/ydb/core/cms/console/console_tenants_manager.h
+++ b/ydb/core/cms/console/console_tenants_manager.h
@@ -32,7 +32,7 @@ using NTabletFlatExecutor::TTabletExecutedFlat;
using NTabletFlatExecutor::ITransaction;
using NTabletFlatExecutor::TTransactionBase;
using NTabletFlatExecutor::TTransactionContext;
-using NSchemeShard::TEvSchemeShard;
+using NSchemeShard::TEvSchemeShard;
using NTenantSlotBroker::TEvTenantSlotBroker;
using NTenantSlotBroker::TSlotDescription;
using NMonitoring::TDynamicCounterPtr;
@@ -510,13 +510,13 @@ public:
// Last subdomain version configured in SchemeShard.
ui64 ConfirmedSubdomain;
// Attributes to attach to subdomain.
- NKikimrSchemeOp::TAlterUserAttributes Attributes;
+ NKikimrSchemeOp::TAlterUserAttributes Attributes;
// Current generation.
ui64 Generation;
// Subdomain ID.
TDomainId DomainId;
TDomainId SharedDomainId;
- bool IsExternalSubdomain;
+ bool IsExternalSubdomain;
bool IsExternalHive;
bool IsExternalSysViewProcessor;
bool AreResourcesShared;
@@ -867,7 +867,7 @@ public:
TTransactionContext &txc,
const TActorContext &ctx);
void DbUpdateTenantUserAttributes(TTenant::TPtr tenant,
- const NKikimrSchemeOp::TAlterUserAttributes &attributes,
+ const NKikimrSchemeOp::TAlterUserAttributes &attributes,
TTransactionContext &txc,
const TActorContext &ctx);
void DbUpdateTenantGeneration(TTenant::TPtr tenant,
@@ -959,7 +959,7 @@ public:
public:
TTenantsManager(TConsole &self,
TDomainsInfo::TDomain::TPtr domain,
- TDynamicCounterPtr counters,
+ TDynamicCounterPtr counters,
NKikimrConfig::TFeatureFlags featureFlags)
: Self(self)
, Domain(domain)
diff --git a/ydb/core/cms/console/console_ut_configs.cpp b/ydb/core/cms/console/console_ut_configs.cpp
index 9d8e55288c7..0cb1655281d 100644
--- a/ydb/core/cms/console/console_ut_configs.cpp
+++ b/ydb/core/cms/console/console_ut_configs.cpp
@@ -2285,7 +2285,7 @@ Y_UNIT_TEST_SUITE(TConsoleConfigTests) {
Y_UNIT_TEST(TestAffectedConfigs)
{
- TValidatorsRegistry::Instance()->DropInstance();
+ TValidatorsRegistry::Instance()->DropInstance();
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
InitializeTestConfigItems();
@@ -3510,7 +3510,7 @@ Y_UNIT_TEST_SUITE(TConsoleConfigSubscriptionTests) {
}, 1);
runtime.DispatchEvents(options);
-
+
CheckAddConfigSubscription(runtime, Ydb::StatusIds::SUCCESS,
nodeId + 1, "host2", "tenant-2", "type2",
0, TActorId(nodeId + 1, "service"), TVector<ui32>({1}));
@@ -3518,7 +3518,7 @@ Y_UNIT_TEST_SUITE(TConsoleConfigSubscriptionTests) {
id1, nodeId, "host1", "tenant-1", "type1",
0, TActorId(nodeId, "service"), TVector<ui32>({1}));
CheckListConfigSubscriptions(runtime, Ydb::StatusIds::SUCCESS, 0, TActorId(100, "service"));
-
+
CheckListConfigSubscriptions(runtime, Ydb::StatusIds::SUCCESS, 100, TActorId(),
id3, 100, "host100", "tenant-100", "type100",
100, TActorId(), TVector<ui32>({1}));
diff --git a/ydb/core/cms/console/console_ut_tenants.cpp b/ydb/core/cms/console/console_ut_tenants.cpp
index 5377e539ef0..57e4820af72 100644
--- a/ydb/core/cms/console/console_ut_tenants.cpp
+++ b/ydb/core/cms/console/console_ut_tenants.cpp
@@ -18,7 +18,7 @@
namespace NKikimr {
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NTenantSlotBroker;
using namespace NConsole;
using namespace NConsole::NUT;
@@ -652,7 +652,7 @@ Y_UNIT_TEST_SUITE(TConsoleTxProcessorTests) {
}
}
-
+
Y_UNIT_TEST_SUITE(TConsoleTests) {
void RunTestCreateTenant(TTenantTestRuntime& runtime, bool shared = false) {
using EType = TCreateTenantRequest::EType;
@@ -680,16 +680,16 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckCounter(runtime, {{ {"status", "SUCCESS"} }}, TTenantsManager::COUNTER_CREATE_RESPONSES, 1);
}
- Y_UNIT_TEST(TestCreateTenant) {
+ Y_UNIT_TEST(TestCreateTenant) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
- RunTestCreateTenant(runtime);
- }
-
- Y_UNIT_TEST(TestCreateTenantExtSubdomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
- RunTestCreateTenant(runtime);
- }
-
+ RunTestCreateTenant(runtime);
+ }
+
+ Y_UNIT_TEST(TestCreateTenantExtSubdomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
+ RunTestCreateTenant(runtime);
+ }
+
Y_UNIT_TEST(TestCreateSharedTenant) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
RunTestCreateTenant(runtime, true);
@@ -723,7 +723,7 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
.WithSharedDbPath(TENANT1_1_NAME));
}
- void RunTestCreateTenantWrongName(TTenantTestRuntime& runtime) {
+ void RunTestCreateTenantWrongName(TTenantTestRuntime& runtime) {
// Empty path
CheckCreateTenant(runtime, Ydb::StatusIds::BAD_REQUEST, TCreateTenantRequest(""));
// Root path
@@ -746,33 +746,33 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckCounter(runtime, {{ {"status", "BAD_REQUEST"} }}, TTenantsManager::COUNTER_CREATE_RESPONSES, 9);
}
- Y_UNIT_TEST(TestCreateTenantWrongName) {
+ Y_UNIT_TEST(TestCreateTenantWrongName) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
- RunTestCreateTenantWrongName(runtime);
- }
-
- Y_UNIT_TEST(TestCreateTenantWrongNameExtSubdomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
- RunTestCreateTenantWrongName(runtime);
- }
-
- void RunTestCreateTenantWrongPool(TTenantTestRuntime& runtime) {
+ RunTestCreateTenantWrongName(runtime);
+ }
+
+ Y_UNIT_TEST(TestCreateTenantWrongNameExtSubdomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
+ RunTestCreateTenantWrongName(runtime);
+ }
+
+ void RunTestCreateTenantWrongPool(TTenantTestRuntime& runtime) {
CheckCreateTenant(runtime, Ydb::StatusIds::BAD_REQUEST, TCreateTenantRequest(TENANT1_1_NAME));
CheckCreateTenant(runtime, Ydb::StatusIds::BAD_REQUEST, TCreateTenantRequest(TENANT1_1_NAME).WithPools({{"hdd", 0}}));
CheckCreateTenant(runtime, Ydb::StatusIds::BAD_REQUEST, TCreateTenantRequest(TENANT1_1_NAME).WithPools({{"unknown", 1}}));
}
- Y_UNIT_TEST(TestCreateTenantWrongPool) {
+ Y_UNIT_TEST(TestCreateTenantWrongPool) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
- RunTestCreateTenantWrongPool(runtime);
- }
-
- Y_UNIT_TEST(TestCreateTenantWrongPoolExtSubdomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
- RunTestCreateTenantWrongPool(runtime);
- }
-
- void RunTestCreateTenantWrongComputationalUnit(TTenantTestRuntime& runtime) {
+ RunTestCreateTenantWrongPool(runtime);
+ }
+
+ Y_UNIT_TEST(TestCreateTenantWrongPoolExtSubdomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
+ RunTestCreateTenantWrongPool(runtime);
+ }
+
+ void RunTestCreateTenantWrongComputationalUnit(TTenantTestRuntime& runtime) {
// Unknown unit kind
CheckCreateTenant(runtime, TENANT1_1_NAME, Ydb::StatusIds::BAD_REQUEST,
{{"hdd", 1}, {"hdd-1", 2}},
@@ -791,17 +791,17 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
SLOT1_TYPE, ZONE1, 3);
}
- Y_UNIT_TEST(TestCreateTenantWrongComputationalUnit) {
+ Y_UNIT_TEST(TestCreateTenantWrongComputationalUnit) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
- RunTestCreateTenantWrongComputationalUnit(runtime);
- }
-
- Y_UNIT_TEST(TestCreateTenantWrongComputationalUnitExtSubdomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
- RunTestCreateTenantWrongComputationalUnit(runtime);
- }
-
- void RunTestCreateTenantAlreadyExists(TTenantTestRuntime& runtime) {
+ RunTestCreateTenantWrongComputationalUnit(runtime);
+ }
+
+ Y_UNIT_TEST(TestCreateTenantWrongComputationalUnitExtSubdomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
+ RunTestCreateTenantWrongComputationalUnit(runtime);
+ }
+
+ void RunTestCreateTenantAlreadyExists(TTenantTestRuntime& runtime) {
CheckCreateTenant(runtime, "/dc-1/users/tenant-1", Ydb::StatusIds::SUCCESS,
{{"hdd", 1}},
SLOT1_TYPE, ZONE1, 3,
@@ -831,18 +831,18 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckCounter(runtime, {{ {"status", "ALREADY_EXISTS"} }}, TTenantsManager::COUNTER_CREATE_RESPONSES, 3);
}
-
- Y_UNIT_TEST(TestCreateTenantAlreadyExists) {
+
+ Y_UNIT_TEST(TestCreateTenantAlreadyExists) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
- RunTestCreateTenantAlreadyExists(runtime);
- }
-
- Y_UNIT_TEST(TestCreateTenantAlreadyExistsExtSubdomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
- RunTestCreateTenantAlreadyExists(runtime);
- }
-
- void RunTestGetUnknownTenantStatus(TTenantTestRuntime& runtime) {
+ RunTestCreateTenantAlreadyExists(runtime);
+ }
+
+ Y_UNIT_TEST(TestCreateTenantAlreadyExistsExtSubdomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
+ RunTestCreateTenantAlreadyExists(runtime);
+ }
+
+ void RunTestGetUnknownTenantStatus(TTenantTestRuntime& runtime) {
CheckTenantStatus(runtime, TENANT1_1_NAME, Ydb::StatusIds::NOT_FOUND,
Ydb::Cms::GetDatabaseStatusResult::STATE_UNSPECIFIED, {}, {});
@@ -850,17 +850,17 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckCounter(runtime, {{ {"status", "NOT_FOUND"} }}, TTenantsManager::COUNTER_STATUS_RESPONSES, 1);
}
- Y_UNIT_TEST(TestGetUnknownTenantStatus) {
+ Y_UNIT_TEST(TestGetUnknownTenantStatus) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
- RunTestGetUnknownTenantStatus(runtime);
- }
-
- Y_UNIT_TEST(TestGetUnknownTenantStatusExtSubdomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
- RunTestGetUnknownTenantStatus(runtime);
- }
-
- void RunTestRestartConsoleAndPools(TTenantTestRuntime& runtime) {
+ RunTestGetUnknownTenantStatus(runtime);
+ }
+
+ Y_UNIT_TEST(TestGetUnknownTenantStatusExtSubdomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
+ RunTestGetUnknownTenantStatus(runtime);
+ }
+
+ void RunTestRestartConsoleAndPools(TTenantTestRuntime& runtime) {
runtime.Send(new IEventHandle(MakeTenantPoolID(runtime.GetNodeId(1), 0),
runtime.Sender,
new TEvents::TEvPoisonPill));
@@ -897,18 +897,18 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckCounter(runtime, {}, TTenantsManager::COUNTER_TENANTS, 1);
}
-
- Y_UNIT_TEST(TestRestartConsoleAndPools) {
+
+ Y_UNIT_TEST(TestRestartConsoleAndPools) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
- RunTestRestartConsoleAndPools(runtime);
- }
-
- Y_UNIT_TEST(TestRestartConsoleAndPoolsExtSubdomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
- RunTestRestartConsoleAndPools(runtime);
- }
-
- void RunTestAlterTenantModifyComputationalResourcesForPending(TTenantTestRuntime& runtime) {
+ RunTestRestartConsoleAndPools(runtime);
+ }
+
+ Y_UNIT_TEST(TestRestartConsoleAndPoolsExtSubdomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
+ RunTestRestartConsoleAndPools(runtime);
+ }
+
+ void RunTestAlterTenantModifyComputationalResourcesForPending(TTenantTestRuntime& runtime) {
CheckCreateTenant(runtime, Ydb::StatusIds::SUCCESS,
TCreateTenantRequest(TENANT1_1_NAME).WithPools({{"hdd", 1}}));
@@ -926,17 +926,17 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
SLOT1_TYPE, ZONE1, 5, 5);
}
- Y_UNIT_TEST(TestAlterTenantModifyComputationalResourcesForPending) {
+ Y_UNIT_TEST(TestAlterTenantModifyComputationalResourcesForPending) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
- RunTestAlterTenantModifyComputationalResourcesForPending(runtime);
- }
-
- Y_UNIT_TEST(TestAlterTenantModifyComputationalResourcesForPendingExtSubdomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
- RunTestAlterTenantModifyComputationalResourcesForPending(runtime);
- }
-
- void RunTestAlterTenantModifyComputationalResourcesForRunning(TTenantTestRuntime& runtime) {
+ RunTestAlterTenantModifyComputationalResourcesForPending(runtime);
+ }
+
+ Y_UNIT_TEST(TestAlterTenantModifyComputationalResourcesForPendingExtSubdomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
+ RunTestAlterTenantModifyComputationalResourcesForPending(runtime);
+ }
+
+ void RunTestAlterTenantModifyComputationalResourcesForRunning(TTenantTestRuntime& runtime) {
CheckCreateTenant(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
{{"hdd", 1}},
SLOT1_TYPE, ZONE1, 5,
@@ -955,7 +955,7 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckAlterTenantSlots(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
{{ {SLOT1_TYPE, ZONE1, 5} }},
{{ {SLOT2_TYPE, ZONE1, 3},
- {SLOT3_TYPE, ZONE1, 7} }});
+ {SLOT3_TYPE, ZONE1, 7} }});
runtime.WaitForHiveState({{{DOMAIN1_NAME, 8, 8, 8},
{TENANT1_1_NAME, 27, 27, 27}}});
@@ -969,8 +969,8 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckAlterTenantSlots(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
{},
{{ {SLOT1_TYPE, ZONE1, 10},
- {SLOT2_TYPE, ZONE1, 5},
- {SLOT3_TYPE, ZONE1, 3} }});
+ {SLOT2_TYPE, ZONE1, 5},
+ {SLOT3_TYPE, ZONE1, 3} }});
runtime.WaitForHiveState({{{DOMAIN1_NAME, 8, 8, 8}}});
@@ -979,8 +979,8 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckAlterTenantSlots(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
{{ {SLOT1_TYPE, ZONE1, 1},
- {SLOT2_TYPE, ZONE1, 2},
- {SLOT3_TYPE, ZONE1, 3} }},
+ {SLOT2_TYPE, ZONE1, 2},
+ {SLOT3_TYPE, ZONE1, 3} }},
{});
runtime.WaitForHiveState({{{DOMAIN1_NAME, 8, 8, 8},
@@ -996,17 +996,17 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckCounter(runtime, {{ {"status", "SUCCESS"} }}, TTenantsManager::COUNTER_ALTER_RESPONSES, 3);
}
- Y_UNIT_TEST(TestAlterTenantModifyComputationalResourcesForRunning) {
+ Y_UNIT_TEST(TestAlterTenantModifyComputationalResourcesForRunning) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
- RunTestAlterTenantModifyComputationalResourcesForRunning(runtime);
- }
-
- Y_UNIT_TEST(TestAlterTenantModifyComputationalResourcesForRunningExtSubdomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
- RunTestAlterTenantModifyComputationalResourcesForRunning(runtime);
- }
-
- void RunTestAlterTenantModifyStorageResourcesForPending(TTenantTestRuntime& runtime) {
+ RunTestAlterTenantModifyComputationalResourcesForRunning(runtime);
+ }
+
+ Y_UNIT_TEST(TestAlterTenantModifyComputationalResourcesForRunningExtSubdomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
+ RunTestAlterTenantModifyComputationalResourcesForRunning(runtime);
+ }
+
+ void RunTestAlterTenantModifyStorageResourcesForPending(TTenantTestRuntime& runtime) {
CheckCreateTenant(runtime, Ydb::StatusIds::SUCCESS,
TCreateTenantRequest(TENANT1_1_NAME).WithPools({{"hdd", 1}, {"hdd-1", 3}}));
@@ -1074,17 +1074,17 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckCounter(runtime, {{ {"kind", "hdd-2"} }}, TTenantsManager::COUNTER_ALLOCATED_STORAGE_UNITS, 0);
}
- Y_UNIT_TEST(TestAlterTenantModifyStorageResourcesForPending) {
+ Y_UNIT_TEST(TestAlterTenantModifyStorageResourcesForPending) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
- RunTestAlterTenantModifyStorageResourcesForPending(runtime);
- }
-
- Y_UNIT_TEST(TestAlterTenantModifyStorageResourcesForPendingExtSubdomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
- RunTestAlterTenantModifyStorageResourcesForPending(runtime);
- }
-
- void RunTestAlterTenantModifyStorageResourcesForRunning(TTenantTestRuntime& runtime) {
+ RunTestAlterTenantModifyStorageResourcesForPending(runtime);
+ }
+
+ Y_UNIT_TEST(TestAlterTenantModifyStorageResourcesForPendingExtSubdomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
+ RunTestAlterTenantModifyStorageResourcesForPending(runtime);
+ }
+
+ void RunTestAlterTenantModifyStorageResourcesForRunning(TTenantTestRuntime& runtime) {
CheckCreateTenant(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
{{"hdd", 1}, {"hdd-1", 3}},
SLOT1_TYPE, ZONE1, 1);
@@ -1130,17 +1130,17 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckCounter(runtime, {{ {"status", "BAD_REQUEST"} }}, TTenantsManager::COUNTER_ALTER_RESPONSES, 2);
}
- Y_UNIT_TEST(TestAlterTenantModifyStorageResourcesForRunning) {
+ Y_UNIT_TEST(TestAlterTenantModifyStorageResourcesForRunning) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
- RunTestAlterTenantModifyStorageResourcesForRunning(runtime);
- }
-
- Y_UNIT_TEST(TestAlterTenantModifyStorageResourcesForRunningExtSubdomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
- RunTestAlterTenantModifyStorageResourcesForRunning(runtime);
- }
-
- void RunTestAlterUnknownTenant(TTenantTestRuntime& runtime) {
+ RunTestAlterTenantModifyStorageResourcesForRunning(runtime);
+ }
+
+ Y_UNIT_TEST(TestAlterTenantModifyStorageResourcesForRunningExtSubdomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
+ RunTestAlterTenantModifyStorageResourcesForRunning(runtime);
+ }
+
+ void RunTestAlterUnknownTenant(TTenantTestRuntime& runtime) {
CheckAlterTenantSlots(runtime, TENANT1_1_NAME, Ydb::StatusIds::NOT_FOUND,
{ }, { });
@@ -1148,17 +1148,17 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckCounter(runtime, {{ {"status", "NOT_FOUND"} }}, TTenantsManager::COUNTER_ALTER_RESPONSES, 1);
}
-
- Y_UNIT_TEST(TestAlterUnknownTenant) {
+
+ Y_UNIT_TEST(TestAlterUnknownTenant) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
- RunTestAlterUnknownTenant(runtime);
- }
-
- Y_UNIT_TEST(TestAlterUnknownTenantExtSubdomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
- RunTestAlterUnknownTenant(runtime);
- }
-
+ RunTestAlterUnknownTenant(runtime);
+ }
+
+ Y_UNIT_TEST(TestAlterUnknownTenantExtSubdomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
+ RunTestAlterUnknownTenant(runtime);
+ }
+
Y_UNIT_TEST(TestAlterStorageUnitsOfSharedTenant) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
// create shared tenant
@@ -1211,7 +1211,7 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckCounter(runtime, {{ {"status", "BAD_REQUEST"} }}, TTenantsManager::COUNTER_ALTER_RESPONSES, 1);
}
- void RunTestListTenants(TTenantTestRuntime& runtime) {
+ void RunTestListTenants(TTenantTestRuntime& runtime) {
CheckCreateTenant(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
{{"hdd", 1}},
SLOT1_TYPE, ZONE1, 1);
@@ -1241,16 +1241,16 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckCounter(runtime, {}, TTenantsManager::COUNTER_LIST_REQUESTS, 1);
}
- Y_UNIT_TEST(TestListTenants) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig());
- RunTestListTenants(runtime);
- }
-
- Y_UNIT_TEST(TestListTenantsExtSubdomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
- RunTestListTenants(runtime);
- }
-
+ Y_UNIT_TEST(TestListTenants) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig());
+ RunTestListTenants(runtime);
+ }
+
+ Y_UNIT_TEST(TestListTenantsExtSubdomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
+ RunTestListTenants(runtime);
+ }
+
Y_UNIT_TEST(TestSetDefaultStorageUnitsQuota) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
@@ -1512,7 +1512,7 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
}
}
- void RunTestRemoveTenant(TTenantTestRuntime& runtime) {
+ void RunTestRemoveTenant(TTenantTestRuntime& runtime) {
CheckCreateTenant(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
{{"hdd", 1}, {"hdd-1", 2}},
SLOT1_TYPE, ZONE1, 3,
@@ -1531,7 +1531,7 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckAlterRegisteredUnits(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
{{ {"host1", 1, "kind1"},
- {"host2", 2, "kind2"} }},
+ {"host2", 2, "kind2"} }},
{});
CheckTenantStatus(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
@@ -1584,16 +1584,16 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckCounter(runtime, {}, TTenantsManager::COUNTER_TENANTS, 0);
}
- Y_UNIT_TEST(TestRemoveTenant) {
+ Y_UNIT_TEST(TestRemoveTenant) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
- RunTestRemoveTenant(runtime);
- }
-
- Y_UNIT_TEST(TestRemoveTenantExtSubdomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
- RunTestRemoveTenant(runtime);
- }
-
+ RunTestRemoveTenant(runtime);
+ }
+
+ Y_UNIT_TEST(TestRemoveTenantExtSubdomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
+ RunTestRemoveTenant(runtime);
+ }
+
Y_UNIT_TEST(TestRemoveSharedTenantWoServerlessTenants) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
// create shared tenant
@@ -1666,7 +1666,7 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckCounter(runtime, {{ {"status", "SUCCESS"} }}, TTenantsManager::COUNTER_REMOVE_RESPONSES, 1);
}
- void RunTestCreateSubSubDomain(TTenantTestRuntime& runtime) {
+ void RunTestCreateSubSubDomain(TTenantTestRuntime& runtime) {
CheckCreateTenant(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
{{"hdd", 1}, {"hdd-1", 2}},
SLOT1_TYPE, ZONE1, 3,
@@ -1712,16 +1712,16 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckCounter(runtime, {{ {"kind", "hdd-1"} }}, TTenantsManager::COUNTER_ALLOCATED_STORAGE_UNITS, 0);
}
- Y_UNIT_TEST(TestCreateSubSubDomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig());
- RunTestCreateSubSubDomain(runtime);
- }
-
- Y_UNIT_TEST(TestCreateSubSubDomainExtSubdomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
- RunTestCreateSubSubDomain(runtime);
- }
-
+ Y_UNIT_TEST(TestCreateSubSubDomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig());
+ RunTestCreateSubSubDomain(runtime);
+ }
+
+ Y_UNIT_TEST(TestCreateSubSubDomainExtSubdomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
+ RunTestCreateSubSubDomain(runtime);
+ }
+
Y_UNIT_TEST(TestDefaultAvailabilityZone) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
@@ -1869,7 +1869,7 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
SLOT1_TYPE, ZONE1, 1, 1);
}
- void RunTestNotifyOperationCompletion(TTenantTestRuntime& runtime) {
+ void RunTestNotifyOperationCompletion(TTenantTestRuntime& runtime) {
TAutoPtr<IEventHandle> handle;
// This observer should intercept events about pool creation/removal
@@ -1965,17 +1965,17 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckNotificationRequest(runtime, id, Ydb::StatusIds::SUCCESS);
}
- Y_UNIT_TEST(TestNotifyOperationCompletion) {
+ Y_UNIT_TEST(TestNotifyOperationCompletion) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
- RunTestNotifyOperationCompletion(runtime);
- }
-
- Y_UNIT_TEST(TestNotifyOperationCompletionExtSubdomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
- RunTestNotifyOperationCompletion(runtime);
- }
-
- void RunTestAuthorization(TTenantTestRuntime& runtime) {
+ RunTestNotifyOperationCompletion(runtime);
+ }
+
+ Y_UNIT_TEST(TestNotifyOperationCompletionExtSubdomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
+ RunTestNotifyOperationCompletion(runtime);
+ }
+
+ void RunTestAuthorization(TTenantTestRuntime& runtime) {
for (ui32 i = 0; i < runtime.GetNodeCount(); ++i) {
auto &appData = runtime.GetAppData(i);
appData.AdministrationAllowedSIDs.push_back("root@builtin");
@@ -2018,24 +2018,24 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
Ydb::StatusIds::UNAUTHORIZED);
}
- Y_UNIT_TEST(TestAuthorization) {
+ Y_UNIT_TEST(TestAuthorization) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
- RunTestAuthorization(runtime);
- }
+ RunTestAuthorization(runtime);
+ }
+
+ Y_UNIT_TEST(TestAuthorizationExtSubdomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
+ RunTestAuthorization(runtime);
+ }
- Y_UNIT_TEST(TestAuthorizationExtSubdomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
- RunTestAuthorization(runtime);
- }
-
bool CheckAttrsPresent(TTenantTestRuntime& runtime, const TString& tenantName, THashMap<TString, TString> attrs, bool skipAbsent = false) {
- auto request = MakeHolder<TEvSchemeShard::TEvDescribeScheme>(tenantName);
+ auto request = MakeHolder<TEvSchemeShard::TEvDescribeScheme>(tenantName);
ForwardToTablet(runtime, SCHEME_SHARD1_ID, runtime.Sender, request.Release());
TAutoPtr<IEventHandle> handle;
- auto reply = runtime.GrabEdgeEvent<TEvSchemeShard::TEvDescribeSchemeResult>(handle);
- Cerr << "Reply: " << reply->GetRecord().DebugString() << "\n";
+ auto reply = runtime.GrabEdgeEvent<TEvSchemeShard::TEvDescribeSchemeResult>(handle);
+ Cerr << "Reply: " << reply->GetRecord().DebugString() << "\n";
for (auto &attr : reply->GetRecord().GetPathDescription().GetUserAttributes()) {
if (!skipAbsent) {
UNIT_ASSERT(attrs.contains(attr.GetKey()));
@@ -2126,16 +2126,16 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckAttrsPresent(runtime, TENANT1_1_NAME, THashMap<TString, TString> {{"name1", "value1"}});
}
- Y_UNIT_TEST(TestAttributes) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig());
- RunTestAttributes(runtime);
- }
-
- Y_UNIT_TEST(TestAttributesExtSubdomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
- RunTestAttributes(runtime);
- }
-
+ Y_UNIT_TEST(TestAttributes) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig());
+ RunTestAttributes(runtime);
+ }
+
+ Y_UNIT_TEST(TestAttributesExtSubdomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
+ RunTestAttributes(runtime);
+ }
+
Y_UNIT_TEST(TestRemoveAttributes) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
RunTestRemoveAttributes(runtime);
@@ -2408,7 +2408,7 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
CheckCounter(runtime, {{ {"kind", "any"}, {"zone", ZONE_ANY } }}, TTenantsManager::COUNTER_COMPUTATIONAL_UNITS, 12);
}
- void RunTestTenantGeneration(TTenantTestRuntime& runtime) {
+ void RunTestTenantGeneration(TTenantTestRuntime& runtime) {
CheckCreateTenant(runtime, TENANT1_1_NAME, Ydb::StatusIds::SUCCESS,
{{"hdd", 1}},
SLOT1_TYPE, ZONE1, 1);
@@ -2462,16 +2462,16 @@ Y_UNIT_TEST_SUITE(TConsoleTests) {
"alter-key-1");
}
- Y_UNIT_TEST(TestTenantGeneration) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig());
- RunTestTenantGeneration(runtime);
- }
-
- Y_UNIT_TEST(TestTenantGenerationExtSubdomain) {
- TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
- RunTestTenantGeneration(runtime);
- }
-
+ Y_UNIT_TEST(TestTenantGeneration) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig());
+ RunTestTenantGeneration(runtime);
+ }
+
+ Y_UNIT_TEST(TestTenantGenerationExtSubdomain) {
+ TTenantTestRuntime runtime(DefaultConsoleTestConfig(), {}, true);
+ RunTestTenantGeneration(runtime);
+ }
+
Y_UNIT_TEST(TestSchemeShardErrorForwarding) {
TTenantTestRuntime runtime(DefaultConsoleTestConfig());
diff --git a/ydb/core/driver_lib/cli_base/cli_cmds_db.cpp b/ydb/core/driver_lib/cli_base/cli_cmds_db.cpp
index bd6a5c6bf12..450d4135c6c 100644
--- a/ydb/core/driver_lib/cli_base/cli_cmds_db.cpp
+++ b/ydb/core/driver_lib/cli_base/cli_cmds_db.cpp
@@ -135,7 +135,7 @@ public:
virtual void Parse(TConfig& config) override {
TClientCommand::Parse(config);
- NKikimrSchemeOp::TModifyScript protoScript;
+ NKikimrSchemeOp::TModifyScript protoScript;
ParseProtobuf(&protoScript, config.ParseResult->GetFreeArgs()[0]);
for (const auto& modifyScheme : protoScript.GetModifyScheme()) {
TAutoPtr<NKikimrClient::TSchemeOperation> request = new NKikimrClient::TSchemeOperation();
@@ -249,14 +249,14 @@ public:
}
}
- void PrintEntry(const NKikimrSchemeOp::TPathDescription& path) {
- const NKikimrSchemeOp::TDirEntry& entry(path.GetSelf());
+ void PrintEntry(const NKikimrSchemeOp::TPathDescription& path) {
+ const NKikimrSchemeOp::TDirEntry& entry(path.GetSelf());
TString type;
switch(entry.GetPathType()) {
- case NKikimrSchemeOp::EPathTypeDir:
+ case NKikimrSchemeOp::EPathTypeDir:
type = "<dir>";
break;
- case NKikimrSchemeOp::EPathTypeTable:
+ case NKikimrSchemeOp::EPathTypeTable:
type = "<table>";
break;
case NKikimrSchemeOp::EPathTypeColumnStore:
@@ -265,13 +265,13 @@ public:
case NKikimrSchemeOp::EPathTypeColumnTable:
type = "<column table>";
break;
- case NKikimrSchemeOp::EPathTypeSequence:
+ case NKikimrSchemeOp::EPathTypeSequence:
type = "<sequence>";
break;
case NKikimrSchemeOp::EPathTypeReplication:
type = "<replication>";
break;
- case NKikimrSchemeOp::EPathTypePersQueueGroup:
+ case NKikimrSchemeOp::EPathTypePersQueueGroup:
type = "<pq group>";
break;
default:
@@ -304,11 +304,11 @@ public:
Cout << id << type << name << owner << acl << Endl;
if (Details) {
switch(entry.GetPathType()) {
- case NKikimrSchemeOp::EPathTypeTable: {
- const NKikimrSchemeOp::TTableDescription& table(path.GetTable());
+ case NKikimrSchemeOp::EPathTypeTable: {
+ const NKikimrSchemeOp::TTableDescription& table(path.GetTable());
size_t szWidth = id.size() + type.size() + entry.GetName().size();
size_t szColumns[3] = {0, 0, 0};
- for (const NKikimrSchemeOp::TColumnDescription& column : table.GetColumns()) {
+ for (const NKikimrSchemeOp::TColumnDescription& column : table.GetColumns()) {
szColumns[0] = std::max(szColumns[0], ToString(column.GetId()).size());
szColumns[1] = std::max(szColumns[1], column.GetType().size());
szColumns[2] = std::max(szColumns[2], column.GetName().size());
@@ -323,7 +323,7 @@ public:
}
Cout << Endl;
const auto& keyColumnIds(table.GetKeyColumnIds());
- for (const NKikimrSchemeOp::TColumnDescription& column : table.GetColumns()) {
+ for (const NKikimrSchemeOp::TColumnDescription& column : table.GetColumns()) {
TString id(ToString(column.GetId()));
TString type(column.GetType());
TString name(column.GetName());
@@ -339,8 +339,8 @@ public:
}
break;
}
- case NKikimrSchemeOp::EPathTypePersQueueGroup: {
- const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroup(path.GetPersQueueGroup());
+ case NKikimrSchemeOp::EPathTypePersQueueGroup: {
+ const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroup(path.GetPersQueueGroup());
for (ui32 pi = 0; pi < pqGroup.PartitionsSize(); ++pi) {
const auto& partition = pqGroup.GetPartitions(pi);
TString partitionId = Sprintf(" %6" PRIu32 " ", partition.GetPartitionId());
@@ -354,7 +354,7 @@ public:
}
if (BackupInfo) {
if (path.HasBackupProgress()) {
- NKikimrSchemeOp::TBackupProgress backup = path.GetBackupProgress();
+ NKikimrSchemeOp::TBackupProgress backup = path.GetBackupProgress();
ui32 total = backup.GetTotal();
ui32 notYet = backup.GetNotCompleteYet();
Cout << "backup in progress: " << (total - notYet) << "/" << total;
@@ -394,7 +394,7 @@ public:
if (Request != nullptr)
request->Record.MergeFrom(*Request);
- TList<NKikimrSchemeOp::TPathDescription> entries;
+ TList<NKikimrSchemeOp::TPathDescription> entries;
for(;;) {
MessageBusCall<NMsgBusProxy::TBusSchemeDescribe, NMsgBusProxy::TBusResponse>(config, request,
@@ -416,7 +416,7 @@ public:
}
int cnt = 0;
//Cout << Path << Endl;
- for (const NKikimrSchemeOp::TPathDescription& entry : entries) {
+ for (const NKikimrSchemeOp::TPathDescription& entry : entries) {
if (cnt > 0) {
Cout << TString((cnt - 1) * 3, ' ');
Cout << "└─ ";
@@ -459,19 +459,19 @@ public:
});
}
- static void PrintEntry(const NKikimrSchemeOp::TDirEntry& entry) {
+ static void PrintEntry(const NKikimrSchemeOp::TDirEntry& entry) {
TString type;
switch(entry.GetPathType()) {
- case NKikimrSchemeOp::EPathTypeDir:
+ case NKikimrSchemeOp::EPathTypeDir:
type = "<dir>";
break;
- case NKikimrSchemeOp::EPathTypeSubDomain:
+ case NKikimrSchemeOp::EPathTypeSubDomain:
type = "<database>";
break;
- case NKikimrSchemeOp::EPathTypeTable:
+ case NKikimrSchemeOp::EPathTypeTable:
type = "<table>";
break;
- case NKikimrSchemeOp::EPathTypePersQueueGroup:
+ case NKikimrSchemeOp::EPathTypePersQueueGroup:
type = "<pq group>";
break;
case NKikimrSchemeOp::EPathTypeColumnStore:
@@ -480,7 +480,7 @@ public:
case NKikimrSchemeOp::EPathTypeColumnTable:
type = "<column table>";
break;
- case NKikimrSchemeOp::EPathTypeSequence:
+ case NKikimrSchemeOp::EPathTypeSequence:
type = "<sequence>";
break;
case NKikimrSchemeOp::EPathTypeReplication:
@@ -497,8 +497,8 @@ public:
int PrintResponse(const NMsgBusProxy::TBusResponse& response) const {
const NKikimrClient::TResponse& record(response.Record);
const auto& description(record.GetPathDescription());
- if (description.GetSelf().GetPathType() == NKikimrSchemeOp::EPathTypeDir
- || description.GetSelf().GetPathType() == NKikimrSchemeOp::EPathTypeSubDomain
+ if (description.GetSelf().GetPathType() == NKikimrSchemeOp::EPathTypeDir
+ || description.GetSelf().GetPathType() == NKikimrSchemeOp::EPathTypeSubDomain
|| description.GetSelf().GetPathType() == NKikimrSchemeOp::EPathTypeColumnStore) {
for (const auto& entry : description.GetChildren()) {
PrintEntry(entry);
@@ -599,7 +599,7 @@ public:
TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
NKikimrClient::TSchemeOperation& record(request->Record);
auto& modifyScheme = *record.MutableTransaction()->MutableModifyScheme();
- modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL);
+ modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL);
modifyScheme.SetWorkingDir(base);
auto& modifyAcl = *modifyScheme.MutableModifyACL();
modifyAcl.SetName(name);
@@ -697,7 +697,7 @@ public:
TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
NKikimrClient::TSchemeOperation& record(request->Record);
auto& modifyScheme = *record.MutableTransaction()->MutableModifyScheme();
- modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL);
+ modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL);
modifyScheme.SetWorkingDir(Base);
auto& modifyAcl = *modifyScheme.MutableModifyACL();
modifyAcl.SetName(Name);
@@ -768,7 +768,7 @@ public:
TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
NKikimrClient::TSchemeOperation& record(request->Record);
auto& modifyScheme = *record.MutableTransaction()->MutableModifyScheme();
- modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL);
+ modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL);
modifyScheme.SetWorkingDir(Base);
auto& modifyAcl = *modifyScheme.MutableModifyACL();
modifyAcl.SetName(Name);
@@ -921,94 +921,94 @@ public:
}
};
-class TClientCommandSchemaTableCopy : public TClientCommand {
-public:
+class TClientCommandSchemaTableCopy : public TClientCommand {
+public:
NGrpc::TGRpcClientConfig ClientConfig;
- TString DatabaseName;
- TVector<TString> SrcValues;
- TVector<TString> DstValues;
-
- TClientCommandSchemaTableCopy()
- : TClientCommand("copy", {}, "Copy table")
- {}
-
- virtual void Config(TConfig& config) override {
- TClientCommand::Config(config);
-
- config.SetFreeArgsNum(0);
+ TString DatabaseName;
+ TVector<TString> SrcValues;
+ TVector<TString> DstValues;
+
+ TClientCommandSchemaTableCopy()
+ : TClientCommand("copy", {}, "Copy table")
+ {}
+
+ virtual void Config(TConfig& config) override {
+ TClientCommand::Config(config);
+
+ config.SetFreeArgsNum(0);
config.Opts->AddLongOption("database", "Database name").AddLongName("db").Required().RequiredArgument("DB").StoreResult(&DatabaseName);
config.Opts->AddLongOption("source", "Source table path").AddLongName("src").RequiredArgument("PATH").AppendTo(&SrcValues);
config.Opts->AddLongOption("destination", "Destination table path").AddLongName("dst").RequiredArgument("PATH").AppendTo(&DstValues);
- }
-
- virtual void Parse(TConfig& config) override {
- TClientCommand::Parse(config);
-
+ }
+
+ virtual void Parse(TConfig& config) override {
+ TClientCommand::Parse(config);
+
if (!CommandConfig.ClientConfig.Defined()) {
- return;
- }
-
+ return;
+ }
+
auto *p = std::get_if<NGrpc::TGRpcClientConfig>(&CommandConfig.ClientConfig.GetRef());
- if (!p) {
- return;
- }
-
- ClientConfig = *p;
- }
-
- virtual int Run(TConfig& config) override {
- if (!ClientConfig.Locator) {
- Cerr << "GRPC call error: GRPC server is not specified (MBus protocol is not supported for this command)." << Endl;
- return -2;
- }
-
- if (!DatabaseName) {
- Cerr << "Invalid paramets: database name is empty." << Endl;
- return -2;
- }
-
- if (SrcValues.size() != DstValues.size()) {
- Cerr << "Invalid paramets: sources count is not equal to count destinations count." << Endl;
- return -2;
- }
-
- if (SrcValues.size() == 0 || DstValues.size() == 0) {
- Cerr << "Invalid paramets: either sources or destinations are not preset." << Endl;
- return -2;
- }
-
- Y_VERIFY(SrcValues.size() == DstValues.size());
- const ui32 itemCount = SrcValues.size();
-
- TVector<NYdb::NTable::TCopyItem> copyItems;
- copyItems.reserve(itemCount);
- for (ui32 i = 0; i < itemCount; ++i) {
- copyItems.emplace_back(SrcValues[i], DstValues[i]);
- }
-
- auto driverConfig = NYdb::TDriverConfig()
- .SetEndpoint(ClientConfig.Locator)
- .SetDatabase(DatabaseName)
- .SetAuthToken(config.SecurityToken);
-
- NYdb::TDriver driver(driverConfig);
-
- NYdb::NTable::TTableClient client(driver);
-
- auto status = client.RetryOperationSync([copyItems{std::move(copyItems)}](NYdb::NTable::TSession session) {
- return session.CopyTables(copyItems).GetValueSync();
- });
-
- if (!status.IsSuccess()) {
- Cerr << "Copying tables failed with status: " << status.GetStatus() << Endl;
- status.GetIssues().PrintTo(Cerr);
- return -1;
- }
-
- return 0;
- }
-};
-
+ if (!p) {
+ return;
+ }
+
+ ClientConfig = *p;
+ }
+
+ virtual int Run(TConfig& config) override {
+ if (!ClientConfig.Locator) {
+ Cerr << "GRPC call error: GRPC server is not specified (MBus protocol is not supported for this command)." << Endl;
+ return -2;
+ }
+
+ if (!DatabaseName) {
+ Cerr << "Invalid paramets: database name is empty." << Endl;
+ return -2;
+ }
+
+ if (SrcValues.size() != DstValues.size()) {
+ Cerr << "Invalid paramets: sources count is not equal to count destinations count." << Endl;
+ return -2;
+ }
+
+ if (SrcValues.size() == 0 || DstValues.size() == 0) {
+ Cerr << "Invalid paramets: either sources or destinations are not preset." << Endl;
+ return -2;
+ }
+
+ Y_VERIFY(SrcValues.size() == DstValues.size());
+ const ui32 itemCount = SrcValues.size();
+
+ TVector<NYdb::NTable::TCopyItem> copyItems;
+ copyItems.reserve(itemCount);
+ for (ui32 i = 0; i < itemCount; ++i) {
+ copyItems.emplace_back(SrcValues[i], DstValues[i]);
+ }
+
+ auto driverConfig = NYdb::TDriverConfig()
+ .SetEndpoint(ClientConfig.Locator)
+ .SetDatabase(DatabaseName)
+ .SetAuthToken(config.SecurityToken);
+
+ NYdb::TDriver driver(driverConfig);
+
+ NYdb::NTable::TTableClient client(driver);
+
+ auto status = client.RetryOperationSync([copyItems{std::move(copyItems)}](NYdb::NTable::TSession session) {
+ return session.CopyTables(copyItems).GetValueSync();
+ });
+
+ if (!status.IsSuccess()) {
+ Cerr << "Copying tables failed with status: " << status.GetStatus() << Endl;
+ status.GetIssues().PrintTo(Cerr);
+ return -1;
+ }
+
+ return 0;
+ }
+};
+
class TClientCommandSchemaTable : public TClientCommandTree {
public:
TClientCommandSchemaTable()
@@ -1050,7 +1050,7 @@ public:
}
}
- static void Print(const google::protobuf::RepeatedPtrField<NKikimrSchemeOp::TUserAttribute>& items) {
+ static void Print(const google::protobuf::RepeatedPtrField<NKikimrSchemeOp::TUserAttribute>& items) {
for (const auto& item : items) {
Cout << item.GetKey() << ": " << item.GetValue() << Endl;
}
@@ -1071,30 +1071,30 @@ public:
}
};
-std::pair<TString, TString> SplitPath(const TClientCommand::TConfig& config, const TString& pathname) {
- std::pair<TString, TString> result;
-
- size_t pos = pathname.rfind('/');
- if (config.Path) {
- // Profile path is set
- if (!pathname.StartsWith('/')) {
- result.first = config.Path;
- result.second = pathname;
- } else {
- WarnProfilePathSet();
- result.first = pathname.substr(0, pos);
- result.second = pathname.substr(pos + 1);
- }
- } else {
- result.first = pathname.substr(0, pos);
- result.second = pathname.substr(pos + 1);
- }
-
- return result;
-}
-
+std::pair<TString, TString> SplitPath(const TClientCommand::TConfig& config, const TString& pathname) {
+ std::pair<TString, TString> result;
+
+ size_t pos = pathname.rfind('/');
+ if (config.Path) {
+ // Profile path is set
+ if (!pathname.StartsWith('/')) {
+ result.first = config.Path;
+ result.second = pathname;
+ } else {
+ WarnProfilePathSet();
+ result.first = pathname.substr(0, pos);
+ result.second = pathname.substr(pos + 1);
+ }
+ } else {
+ result.first = pathname.substr(0, pos);
+ result.second = pathname.substr(pos + 1);
+ }
+
+ return result;
+}
+
class TClientCommandSchemaUserAttributeSet: public TClientCommand {
- using TUserAttributesLimits = NSchemeShard::TUserAttributesLimits;
+ using TUserAttributesLimits = NSchemeShard::TUserAttributesLimits;
public:
TClientCommandSchemaUserAttributeSet()
@@ -1116,7 +1116,7 @@ public:
virtual void Parse(TConfig& config) override {
TClientCommand::Parse(config);
- std::tie(Base, Name) = SplitPath(config, config.ParseResult->GetFreeArgs()[0]);
+ std::tie(Base, Name) = SplitPath(config, config.ParseResult->GetFreeArgs()[0]);
for (ui32 i = 1; i < config.ParseResult->GetFreeArgCount(); ++i) {
TString attr = config.ParseResult->GetFreeArgs()[i];
@@ -1155,7 +1155,7 @@ public:
NKikimrClient::TSchemeOperation& record(request->Record);
auto& modifyScheme = *record.MutableTransaction()->MutableModifyScheme();
- modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterUserAttributes);
+ modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterUserAttributes);
modifyScheme.SetWorkingDir(Base);
auto& alter = *modifyScheme.MutableAlterUserAttributes();
@@ -1180,71 +1180,71 @@ public:
}
};
-class TClientCommandSchemaUserAttributeDel: public TClientCommand {
- using TUserAttributesLimits = NSchemeShard::TUserAttributesLimits;
-
-public:
- TClientCommandSchemaUserAttributeDel()
- : TClientCommand("del", {}, "Delete user attribute(s)")
- {}
-
- virtual void Config(TConfig& config) override {
- TClientCommand::Config(config);
- config.SetFreeArgsMin(2);
- SetFreeArgTitle(0, "<PATH>", "Full pathname of an object (e.g. /ru/home/user/mydb/test1/test2).\n"
- " Or short pathname if profile path is set (e.g. test1/test2).");
- SetFreeArgTitle(1, "<ATTRIBUTE>", "NAME");
- }
-
- TString Base;
- TString Name;
- TSet<TString> Attributes;
-
- virtual void Parse(TConfig& config) override {
- TClientCommand::Parse(config);
-
- std::tie(Base, Name) = SplitPath(config, config.ParseResult->GetFreeArgs()[0]);
-
- for (ui32 i = 1; i < config.ParseResult->GetFreeArgCount(); ++i) {
- TString key = config.ParseResult->GetFreeArgs()[i];
-
- if (Attributes.contains(key)) {
- Cerr << "Duplicate value for key: " << key << Endl;
- }
-
- Attributes.insert(key);
- }
- }
-
- virtual int Run(TConfig& config) override {
- TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
- NKikimrClient::TSchemeOperation& record(request->Record);
-
- auto& modifyScheme = *record.MutableTransaction()->MutableModifyScheme();
- modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterUserAttributes);
- modifyScheme.SetWorkingDir(Base);
-
- auto& alter = *modifyScheme.MutableAlterUserAttributes();
- alter.SetPathName(Name);
- auto& attributes = *alter.MutableUserAttributes();
- attributes.Reserve(Attributes.size());
- for (const auto& key : Attributes) {
- auto& attribute = *attributes.Add();
- attribute.SetKey(key);
- }
-
- return MessageBusCall<NMsgBusProxy::TBusSchemeOperation, NMsgBusProxy::TBusResponse>(config, request,
- [](const NMsgBusProxy::TBusResponse& response) -> int {
- if (response.Record.GetStatus() != NMsgBusProxy::MSTATUS_OK) {
- Cerr << ToCString(static_cast<NMsgBusProxy::EResponseStatus>(response.Record.GetStatus())) << " " << response.Record.GetErrorReason() << Endl;
- return 1;
- }
- return 0;
- }
- );
- }
-};
-
+class TClientCommandSchemaUserAttributeDel: public TClientCommand {
+ using TUserAttributesLimits = NSchemeShard::TUserAttributesLimits;
+
+public:
+ TClientCommandSchemaUserAttributeDel()
+ : TClientCommand("del", {}, "Delete user attribute(s)")
+ {}
+
+ virtual void Config(TConfig& config) override {
+ TClientCommand::Config(config);
+ config.SetFreeArgsMin(2);
+ SetFreeArgTitle(0, "<PATH>", "Full pathname of an object (e.g. /ru/home/user/mydb/test1/test2).\n"
+ " Or short pathname if profile path is set (e.g. test1/test2).");
+ SetFreeArgTitle(1, "<ATTRIBUTE>", "NAME");
+ }
+
+ TString Base;
+ TString Name;
+ TSet<TString> Attributes;
+
+ virtual void Parse(TConfig& config) override {
+ TClientCommand::Parse(config);
+
+ std::tie(Base, Name) = SplitPath(config, config.ParseResult->GetFreeArgs()[0]);
+
+ for (ui32 i = 1; i < config.ParseResult->GetFreeArgCount(); ++i) {
+ TString key = config.ParseResult->GetFreeArgs()[i];
+
+ if (Attributes.contains(key)) {
+ Cerr << "Duplicate value for key: " << key << Endl;
+ }
+
+ Attributes.insert(key);
+ }
+ }
+
+ virtual int Run(TConfig& config) override {
+ TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
+ NKikimrClient::TSchemeOperation& record(request->Record);
+
+ auto& modifyScheme = *record.MutableTransaction()->MutableModifyScheme();
+ modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterUserAttributes);
+ modifyScheme.SetWorkingDir(Base);
+
+ auto& alter = *modifyScheme.MutableAlterUserAttributes();
+ alter.SetPathName(Name);
+ auto& attributes = *alter.MutableUserAttributes();
+ attributes.Reserve(Attributes.size());
+ for (const auto& key : Attributes) {
+ auto& attribute = *attributes.Add();
+ attribute.SetKey(key);
+ }
+
+ return MessageBusCall<NMsgBusProxy::TBusSchemeOperation, NMsgBusProxy::TBusResponse>(config, request,
+ [](const NMsgBusProxy::TBusResponse& response) -> int {
+ if (response.Record.GetStatus() != NMsgBusProxy::MSTATUS_OK) {
+ Cerr << ToCString(static_cast<NMsgBusProxy::EResponseStatus>(response.Record.GetStatus())) << " " << response.Record.GetErrorReason() << Endl;
+ return 1;
+ }
+ return 0;
+ }
+ );
+ }
+};
+
class TClientCommandSchemaUserAttribute: public TClientCommandTree {
public:
TClientCommandSchemaUserAttribute()
diff --git a/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp b/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp
index 8042cc99232..6766dd31719 100644
--- a/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp
+++ b/ydb/core/driver_lib/cli_utils/cli_cmds_server.cpp
@@ -29,7 +29,7 @@ protected:
ui32 LogSamplingLevel; // log settings
ui32 LogSamplingRate; // log settings
TString LogFormat;// log settings
- TString SysLogServiceTag; //unique tags for sys logs
+ TString SysLogServiceTag; //unique tags for sys logs
TString LogFileName; // log file name to initialize file log backend
TString ClusterName; // log settings
@@ -49,13 +49,13 @@ protected:
TString UDFsDir;
TVector<TString> UDFsPaths;
TString HostLabelOverride;
- TString TenantName;
+ TString TenantName;
TString TenantDomain;
TString TenantSlotType;
TString TenantSlotId;
- ui64 TenantCPU;
- ui64 TenantMemory;
- ui64 TenantNetwork;
+ ui64 TenantCPU;
+ ui64 TenantMemory;
+ ui64 TenantNetwork;
TVector<TString> NodeBrokerAddresses;
ui32 NodeBrokerPort;
bool NodeBrokerUseTls;
@@ -104,12 +104,12 @@ protected:
MonitoringThreads = 10;
RestartsCountFile = "";
CompileInflightLimit = 100000;
- TenantName = "";
+ TenantName = "";
TenantSlotType = "default";
TenantSlotId = "";
- TenantCPU = 0;
- TenantMemory = 0;
- TenantNetwork = 0;
+ TenantCPU = 0;
+ TenantMemory = 0;
+ TenantNetwork = 0;
NodeBrokerPort = 0;
NodeBrokerUseTls = false;
FixedNodeID = false;
@@ -141,7 +141,7 @@ protected:
config.Opts->AddLongOption("log-format", "log format to use; short skips the priority and timestamp")
.DefaultValue("full").OptionalArgument("full|short|json").StoreResult(&LogFormat);
config.Opts->AddLongOption("syslog", "send to syslog instead of stderr").NoArgument();
- config.Opts->AddLongOption("syslog-service-tag", "unique tag for syslog").RequiredArgument("NAME").StoreResult(&SysLogServiceTag);
+ config.Opts->AddLongOption("syslog-service-tag", "unique tag for syslog").RequiredArgument("NAME").StoreResult(&SysLogServiceTag);
config.Opts->AddLongOption("log-file-name", "file name for log backend").RequiredArgument("NAME").StoreResult(&LogFileName);
config.Opts->AddLongOption("tcp", "start tcp interconnect").NoArgument();
config.Opts->AddLongOption('n', "node", "Node ID or 'static' to auto-detect using naming file and ic-port, or 'dynamic' for dynamic nodes, or 'dynamic-fixed' for dynamic nodes with infinite node ID lease (for dynamic storage nodes)")
@@ -167,19 +167,19 @@ protected:
config.Opts->AddLongOption("proxy", "Bind to proxy(-ies)").RequiredArgument("ADDR").AppendTo(&ProxyBindToProxy);
config.Opts->AddLongOption("host-label-override", "overrides host label for slot").RequiredArgument("NAME").StoreResult(&HostLabelOverride);
config.Opts->AddLongOption("tenant", "add binding for Local service to specified tenant, might be one of {'no', 'dynamic', '/<root>', '/<root>/<path_to_user>'}")
- .RequiredArgument("NAME").StoreResult(&TenantName);
+ .RequiredArgument("NAME").StoreResult(&TenantName);
config.Opts->AddLongOption("tenant-slot-type", "set tenant slot type for dynamic tenant")
.RequiredArgument("NAME").StoreResult(&TenantSlotType);
config.Opts->AddLongOption("tenant-slot-id", "set tenant slot id (for static tenants it is used for monitoring)")
.RequiredArgument("NAME").StoreResult(&TenantSlotId);
config.Opts->AddLongOption("tenant-domain", "specify domain for dynamic tenant")
.RequiredArgument("NAME").StoreResult(&TenantDomain);
- config.Opts->AddLongOption("tenant-cpu", "specify CPU limit tenant binding")
- .RequiredArgument("NUM").StoreResult(&TenantCPU);
- config.Opts->AddLongOption("tenant-memory", "specify Memory limit for tenant binding")
- .RequiredArgument("NUM").StoreResult(&TenantMemory);
- config.Opts->AddLongOption("tenant-network", "specify Network limit for tenant binding")
- .RequiredArgument("NUM").StoreResult(&TenantNetwork);
+ config.Opts->AddLongOption("tenant-cpu", "specify CPU limit tenant binding")
+ .RequiredArgument("NUM").StoreResult(&TenantCPU);
+ config.Opts->AddLongOption("tenant-memory", "specify Memory limit for tenant binding")
+ .RequiredArgument("NUM").StoreResult(&TenantMemory);
+ config.Opts->AddLongOption("tenant-network", "specify Network limit for tenant binding")
+ .RequiredArgument("NUM").StoreResult(&TenantNetwork);
config.Opts->AddLongOption("mon-port", "Monitoring port").OptionalArgument("NUM").StoreResult(&MonitoringPort);
config.Opts->AddLongOption("mon-address", "Monitoring address").OptionalArgument("ADDR").StoreResult(&MonitoringAddress);
config.Opts->AddLongOption("mon-threads", "Monitoring http server threads").RequiredArgument("NUM").StoreResult(&MonitoringThreads);
@@ -224,7 +224,7 @@ protected:
config.Opts->AddLongOption("yq-file", "Yandex Query config file").OptionalArgument("PATH");
config.Opts->AddLongOption("feature-flags-file", "File with feature flags to turn new features on/off").OptionalArgument("PATH");
config.Opts->AddLongOption("rb-file", "File with resource broker customizations").OptionalArgument("PATH");
- config.Opts->AddLongOption("metering-file", "File with metering config").OptionalArgument("PATH");
+ config.Opts->AddLongOption("metering-file", "File with metering config").OptionalArgument("PATH");
config.Opts->AddLongOption('r', "restarts-count-file", "State for restarts monitoring counter,\nuse empty string to disable\n")
.OptionalArgument("PATH").DefaultValue(RestartsCountFile).StoreResult(&RestartsCountFile);
config.Opts->AddLongOption("compile-inflight-limit", "Limit on parallel programs compilation").OptionalArgument("NUM").StoreResult(&CompileInflightLimit);
@@ -431,7 +431,7 @@ protected:
OPTION("sqs-file", SqsConfig);
OPTION("feature-flags-file", FeatureFlags);
OPTION("rb-file", ResourceBrokerConfig);
- OPTION("metering-file", MeteringConfig);
+ OPTION("metering-file", MeteringConfig);
OPTION("kqp-file", KQPConfig);
OPTION("incrhuge-file", IncrHugeConfig);
OPTION("alloc-file", AllocatorConfig);
@@ -504,7 +504,7 @@ protected:
ythrow yexception() << "--suppress-version-check option is provided without static nameservice config";
}
}
-
+
// apply options affecting UDF paths
if (!AppConfig.HasUDFsDir())
AppConfig.SetUDFsDir(UDFsDir);
@@ -969,7 +969,7 @@ protected:
for (auto &node : result->Record().GetNodes()) {
if (node.GetNodeId() == result->GetNodeId()) {
dnConfig.MutableNodeInfo()->CopyFrom(node);
- } else {
+ } else {
auto &info = *nsConfig.AddNode();
info.SetNodeId(node.GetNodeId());
info.SetAddress(node.GetAddress());
diff --git a/ydb/core/driver_lib/run/config.h b/ydb/core/driver_lib/run/config.h
index 48c56b0bd0e..faf1797413e 100644
--- a/ydb/core/driver_lib/run/config.h
+++ b/ydb/core/driver_lib/run/config.h
@@ -30,7 +30,7 @@ union TBasicKikimrServicesMask {
bool EnableRestartsCountPublisher:1;
bool EnableBootstrapper:1;
bool EnableMediatorTimeCastProxy:1;
- bool EnableTxProxy:1;
+ bool EnableTxProxy:1;
bool EnableMiniKQLCompileService:1;
bool EnableMessageBusServices:1;
bool EnableStatsCollector:1;
@@ -57,7 +57,7 @@ union TBasicKikimrServicesMask {
bool EnableNetClassifier:1;
bool EnablePersQueueClusterTracker:1;
bool EnableSysViewService:1;
- bool EnableMeteringWriter:1;
+ bool EnableMeteringWriter:1;
bool EnableSchemeBoardMonitoring:1;
bool EnableConfigsCache:1;
bool EnableLongTxService:1;
diff --git a/ydb/core/driver_lib/run/config_parser.cpp b/ydb/core/driver_lib/run/config_parser.cpp
index a3775f5b1ef..bb686562912 100644
--- a/ydb/core/driver_lib/run/config_parser.cpp
+++ b/ydb/core/driver_lib/run/config_parser.cpp
@@ -344,7 +344,7 @@ void TRunCommandConfigParser::ApplyParsedOptions() {
messageBusConfig->SetStartTracingBusProxy(RunOpts.StartTracingBusProxy);
messageBusConfig->SetTracePath(RunOpts.TracePath);
- Config.AppConfig.MutableBootstrapConfig()->MutableCompileServiceConfig()->SetInflightLimit(RunOpts.CompileInflightLimit);
+ Config.AppConfig.MutableBootstrapConfig()->MutableCompileServiceConfig()->SetInflightLimit(RunOpts.CompileInflightLimit);
Config.AppConfig.MutableMonitoringConfig()->SetMonitoringPort(RunOpts.MonitoringPort);
Config.AppConfig.MutableMonitoringConfig()->SetMonitoringAddress(RunOpts.MonitoringAddress);
Config.AppConfig.MutableMonitoringConfig()->SetMonitoringThreads(RunOpts.MonitoringThreads);
diff --git a/ydb/core/driver_lib/run/kikimr_services_initializers.cpp b/ydb/core/driver_lib/run/kikimr_services_initializers.cpp
index 3a6603124a6..819c1478d19 100644
--- a/ydb/core/driver_lib/run/kikimr_services_initializers.cpp
+++ b/ydb/core/driver_lib/run/kikimr_services_initializers.cpp
@@ -1,5 +1,5 @@
#include "config.h"
-#include "kikimr_services_initializers.h"
+#include "kikimr_services_initializers.h"
#include "service_initializer.h"
#include "version.h"
@@ -20,7 +20,7 @@
#include <ydb/core/base/tablet_pipecache.h>
#include <ydb/core/base/tabletid.h>
#include <ydb/core/base/user_registry.h>
-
+
#include <ydb/core/blobstorage/backpressure/unisched.h>
#include <ydb/core/blobstorage/nodewarden/node_warden.h>
#include <ydb/core/blobstorage/other/mon_get_blob_page.h>
@@ -31,7 +31,7 @@
#include <ydb/core/client/server/grpc_proxy_status.h>
#include <ydb/core/client/server/msgbus_server_pq_metacache.h>
#include <ydb/core/client/server/msgbus_server_tracer.h>
-
+
#include <ydb/core/cms/cms.h>
#include <ydb/core/cms/console/configs_dispatcher.h>
#include <ydb/core/cms/console/configs_cache.h>
@@ -41,15 +41,15 @@
#include <ydb/core/cms/console/shared_cache_configurator.h>
#include <ydb/core/cms/console/validators/core_validators.h>
#include <ydb/core/cms/http.h>
-
+
#include <ydb/core/control/immediate_control_board_actor.h>
-
+
#include <ydb/core/grpc_services/grpc_mon.h>
#include <ydb/core/grpc_services/grpc_request_proxy.h>
#include <ydb/core/kesus/proxy/proxy.h>
#include <ydb/core/kesus/tablet/tablet.h>
-
+
#include <ydb/core/keyvalue/keyvalue.h>
#include <ydb/core/test_tablet/test_tablet.h>
@@ -61,7 +61,7 @@
#include <ydb/core/kqp/rm/kqp_rm.h>
#include <ydb/core/metering/metering.h>
-
+
#include <ydb/core/mind/address_classification/net_classifier.h>
#include <ydb/core/mind/bscontroller/bsc.h>
#include <ydb/core/mind/configured_tablet_bootstrapper.h>
@@ -72,30 +72,30 @@
#include <ydb/core/mind/tenant_node_enumeration.h>
#include <ydb/core/mind/tenant_pool.h>
#include <ydb/core/mind/tenant_slot_broker.h>
-
+
#include <ydb/core/mon/mon.h>
#include <ydb/core/mon_alloc/monitor.h>
#include <ydb/core/mon_alloc/profiler.h>
#include <ydb/core/mon_alloc/stats.h>
#include <ydb/core/node_whiteboard/node_whiteboard.h>
-
+
#include <ydb/core/persqueue/cluster_tracker.h>
#include <ydb/core/persqueue/pq.h>
#include <ydb/core/persqueue/pq_l2_service.h>
-
+
#include <ydb/core/protos/services.pb.h>
#include <ydb/core/protos/console_config.pb.h>
#include <ydb/core/quoter/quoter_service.h>
#include <ydb/core/scheme/scheme_type_registry.h>
-
+
#include <ydb/core/security/ticket_parser.h>
-
+
#include <ydb/core/sys_view/processor/processor.h>
#include <ydb/core/sys_view/service/sysview_service.h>
-
+
#include <ydb/core/tablet/bootstrapper.h>
#include <ydb/core/tablet/node_tablet_monitor.h>
#include <ydb/core/tablet/resource_broker.h>
@@ -105,7 +105,7 @@
#include <ydb/core/tablet_flat/tablet_flat_executed.h>
#include <ydb/core/tracing/tablet_info.h>
-
+
#include <ydb/core/tx/coordinator/coordinator.h>
#include <ydb/core/tx/columnshard/blob_cache.h>
#include <ydb/core/tx/datashard/datashard.h>
@@ -141,43 +141,43 @@
#include <ydb/library/yql/minikql/comp_nodes/mkql_factories.h>
-#include <library/cpp/actors/protos/services_common.pb.h>
+#include <library/cpp/actors/protos/services_common.pb.h>
-#include <library/cpp/actors/core/actor_bootstrapped.h>
-#include <library/cpp/actors/core/actorsystem.h>
-#include <library/cpp/actors/core/event_local.h>
-#include <library/cpp/actors/core/events.h>
-#include <library/cpp/actors/core/executor_pool_basic.h>
-#include <library/cpp/actors/core/executor_pool_io.h>
+#include <library/cpp/actors/core/actor_bootstrapped.h>
+#include <library/cpp/actors/core/actorsystem.h>
+#include <library/cpp/actors/core/event_local.h>
+#include <library/cpp/actors/core/events.h>
+#include <library/cpp/actors/core/executor_pool_basic.h>
+#include <library/cpp/actors/core/executor_pool_io.h>
#include <library/cpp/actors/core/executor_pool_united.h>
-#include <library/cpp/actors/core/log.h>
-#include <library/cpp/actors/core/log_settings.h>
-#include <library/cpp/actors/core/mon.h>
-#include <library/cpp/actors/core/mon_stats.h>
+#include <library/cpp/actors/core/log.h>
+#include <library/cpp/actors/core/log_settings.h>
+#include <library/cpp/actors/core/mon.h>
+#include <library/cpp/actors/core/mon_stats.h>
#include <library/cpp/actors/core/probes.h>
-#include <library/cpp/actors/core/process_stats.h>
-#include <library/cpp/actors/core/scheduler_basic.h>
+#include <library/cpp/actors/core/process_stats.h>
+#include <library/cpp/actors/core/scheduler_basic.h>
#include <library/cpp/actors/core/io_dispatcher.h>
#include <library/cpp/actors/dnsresolver/dnsresolver.h>
#include <library/cpp/actors/helpers/selfping_actor.h>
#include <library/cpp/actors/http/http_proxy.h>
-#include <library/cpp/actors/interconnect/interconnect.h>
-#include <library/cpp/actors/interconnect/interconnect_mon.h>
-#include <library/cpp/actors/interconnect/interconnect_tcp_proxy.h>
+#include <library/cpp/actors/interconnect/interconnect.h>
+#include <library/cpp/actors/interconnect/interconnect_mon.h>
+#include <library/cpp/actors/interconnect/interconnect_tcp_proxy.h>
#include <library/cpp/actors/interconnect/interconnect_proxy_wrapper.h>
-#include <library/cpp/actors/interconnect/interconnect_tcp_server.h>
-#include <library/cpp/actors/interconnect/load.h>
-#include <library/cpp/actors/interconnect/poller_actor.h>
-#include <library/cpp/actors/interconnect/poller_tcp.h>
+#include <library/cpp/actors/interconnect/interconnect_tcp_server.h>
+#include <library/cpp/actors/interconnect/load.h>
+#include <library/cpp/actors/interconnect/poller_actor.h>
+#include <library/cpp/actors/interconnect/poller_tcp.h>
#include <library/cpp/actors/util/affinity.h>
-#include <library/cpp/logger/global/global.h>
-#include <library/cpp/logger/log.h>
+#include <library/cpp/logger/global/global.h>
+#include <library/cpp/logger/log.h>
+
+#include <library/cpp/monlib/messagebus/mon_messagebus.h>
-#include <library/cpp/monlib/messagebus/mon_messagebus.h>
+#include <library/cpp/svnversion/svnversion.h>
-#include <library/cpp/svnversion/svnversion.h>
-
#include <library/cpp/lwtrace/mon/mon_lwtrace.h>
#include <util/digest/city.h>
@@ -738,11 +738,11 @@ void TBasicServicesInitializer::InitializeServices(NActors::TActorSystemSetup* s
auto &info = Config.GetDynamicNodeConfig().GetNodeInfo();
icCommon->TechnicalSelfHostName = info.GetHost();
- TString address = "::"; //bind ipv6 interfaces by default
- if (info.GetAddress()) {
- address = info.GetAddress();
- }
- auto listener = new TInterconnectListenerTCP(address, info.GetPort(), icCommon);
+ TString address = "::"; //bind ipv6 interfaces by default
+ if (info.GetAddress()) {
+ address = info.GetAddress();
+ }
+ auto listener = new TInterconnectListenerTCP(address, info.GetPort(), icCommon);
if (int err = listener->Bind()) {
Cerr << "Failed to set up IC listener on port " << info.GetPort()
<< " errno# " << err << " (" << strerror(err) << ")" << Endl;
@@ -910,9 +910,9 @@ void TLocalServiceInitializer::InitializeServices(
new TTabletSetupInfo(&CreatePersQueue, TMailboxType::ReadAsFilled, appData->UserPoolId, TMailboxType::ReadAsFilled, appData->SystemPoolId));
localConfig->TabletClassInfo[appData->DefaultTabletTypes.PersQueueReadBalancer] = TLocalConfig::TTabletClassInfo(
new TTabletSetupInfo(&CreatePersQueueReadBalancer, TMailboxType::ReadAsFilled, appData->UserPoolId, TMailboxType::ReadAsFilled, appData->SystemPoolId));
- localConfig->TabletClassInfo[appData->DefaultTabletTypes.Coordinator] = TLocalConfig::TTabletClassInfo(
+ localConfig->TabletClassInfo[appData->DefaultTabletTypes.Coordinator] = TLocalConfig::TTabletClassInfo(
new TTabletSetupInfo(&CreateFlatTxCoordinator, TMailboxType::Revolving, importantPoolId, TMailboxType::ReadAsFilled, appData->SystemPoolId));
- localConfig->TabletClassInfo[appData->DefaultTabletTypes.Mediator] = TLocalConfig::TTabletClassInfo(
+ localConfig->TabletClassInfo[appData->DefaultTabletTypes.Mediator] = TLocalConfig::TTabletClassInfo(
new TTabletSetupInfo(&CreateTxMediator, TMailboxType::Revolving, importantPoolId, TMailboxType::ReadAsFilled, appData->SystemPoolId));
localConfig->TabletClassInfo[appData->DefaultTabletTypes.Kesus] = TLocalConfig::TTabletClassInfo(
new TTabletSetupInfo(&NKesus::CreateKesusTablet, TMailboxType::ReadAsFilled, appData->UserPoolId, TMailboxType::ReadAsFilled, appData->SystemPoolId));
@@ -1282,8 +1282,8 @@ static TIntrusivePtr<TTabletSetupInfo> CreateTablet(
// TBootstrapperInitializer
TBootstrapperInitializer::TBootstrapperInitializer(
- const TKikimrRunConfig& runConfig)
- : IKikimrServicesInitializer(runConfig) {
+ const TKikimrRunConfig& runConfig)
+ : IKikimrServicesInitializer(runConfig) {
}
void TBootstrapperInitializer::InitializeServices(
@@ -1384,23 +1384,23 @@ void TMediatorTimeCastProxyInitializer::InitializeServices(
NActors::TActorSystemSetup* setup,
const NKikimr::TAppData* appData) {
setup->LocalServices.push_back(std::pair<TActorId, TActorSetupCmd>(
- MakeMediatorTimecastProxyID(),
+ MakeMediatorTimecastProxyID(),
TActorSetupCmd(CreateMediatorTimecastProxy(), TMailboxType::ReadAsFilled, appData->SystemPoolId)));
}
// TMiniKQLCompileServiceInitializer
-TMiniKQLCompileServiceInitializer::TMiniKQLCompileServiceInitializer(const TKikimrRunConfig& runConfig)
- : IKikimrServicesInitializer(runConfig) {
+TMiniKQLCompileServiceInitializer::TMiniKQLCompileServiceInitializer(const TKikimrRunConfig& runConfig)
+ : IKikimrServicesInitializer(runConfig) {
}
void TMiniKQLCompileServiceInitializer::InitializeServices(NActors::TActorSystemSetup* setup,
const NKikimr::TAppData* appData) {
- const auto compileInFlight = Config.GetBootstrapConfig().GetCompileServiceConfig().GetInflightLimit();
- IActor* compileService = CreateMiniKQLCompileService(compileInFlight);
+ const auto compileInFlight = Config.GetBootstrapConfig().GetCompileServiceConfig().GetInflightLimit();
+ IActor* compileService = CreateMiniKQLCompileService(compileInFlight);
setup->LocalServices.push_back(std::pair<TActorId, TActorSetupCmd>(MakeMiniKQLCompileServiceID(),
- TActorSetupCmd(compileService,
- TMailboxType::ReadAsFilled,
+ TActorSetupCmd(compileService,
+ TMailboxType::ReadAsFilled,
appData->UserPoolId)));
}
@@ -1415,9 +1415,9 @@ static bool IsServiceInitialized(NActors::TActorSystemSetup* setup, TActorId ser
// TMessageBusServicesInitializer
TMessageBusServicesInitializer::TMessageBusServicesInitializer(const TKikimrRunConfig& runConfig,
- NMsgBusProxy::IMessageBusServer& busServer)
+ NMsgBusProxy::IMessageBusServer& busServer)
: IKikimrServicesInitializer(runConfig)
- , BusServer(busServer) {
+ , BusServer(busServer) {
}
void TMessageBusServicesInitializer::InitializeServices(NActors::TActorSystemSetup* setup,
@@ -1477,7 +1477,7 @@ TGRpcServicesInitializer::TGRpcServicesInitializer(
)
: IKikimrServicesInitializer(runConfig)
, Factories(factories)
-{}
+{}
void TGRpcServicesInitializer::InitializeServices(NActors::TActorSystemSetup* setup,
const NKikimr::TAppData* appData)
@@ -1749,7 +1749,7 @@ void TTabletMonitorInitializer::InitializeServices(NActors::TActorSystemSetup* s
// TViewerInitializer
-TViewerInitializer::TViewerInitializer(const TKikimrRunConfig& runConfig)
+TViewerInitializer::TViewerInitializer(const TKikimrRunConfig& runConfig)
: IKikimrServicesInitializer(runConfig)
, KikimrRunConfig(runConfig)
{}
@@ -1932,7 +1932,7 @@ TKqpServiceInitializer::TKqpServiceInitializer(
std::shared_ptr<TModuleFactories> factories)
: IKikimrServicesInitializer(runConfig)
, Factories(std::move(factories))
-{}
+{}
void TKqpServiceInitializer::InitializeServices(NActors::TActorSystemSetup* setup, const NKikimr::TAppData* appData) {
bool enableKqp = true;
@@ -2015,30 +2015,30 @@ void TCmsServiceInitializer::InitializeServices(NActors::TActorSystemSetup* setu
TActorSetupCmd(http, TMailboxType::HTSwap, appData->UserPoolId));
}
-TTxProxyInitializer::TTxProxyInitializer(const TKikimrRunConfig &runConfig)
- : IKikimrServicesInitializer(runConfig)
-{
-}
+TTxProxyInitializer::TTxProxyInitializer(const TKikimrRunConfig &runConfig)
+ : IKikimrServicesInitializer(runConfig)
+{
+}
TVector<ui64> TTxProxyInitializer::CollectAllAllocatorsFromAllDomains(const TAppData *appData) {
TVector<ui64> allocators;
- for (auto it: appData->DomainsInfo->Domains) {
- auto &domain = it.second;
- for (auto tabletId: domain->TxAllocators) {
- allocators.push_back(tabletId);
- }
- }
- return allocators;
-}
-
-void TTxProxyInitializer::InitializeServices(TActorSystemSetup *setup,
- const TAppData *appData)
-{
+ for (auto it: appData->DomainsInfo->Domains) {
+ auto &domain = it.second;
+ for (auto tabletId: domain->TxAllocators) {
+ allocators.push_back(tabletId);
+ }
+ }
+ return allocators;
+}
+
+void TTxProxyInitializer::InitializeServices(TActorSystemSetup *setup,
+ const TAppData *appData)
+{
setup->LocalServices.push_back(std::pair<TActorId, TActorSetupCmd>(
- MakeTxProxyID(),
- TActorSetupCmd(CreateTxProxy(CollectAllAllocatorsFromAllDomains(appData)), TMailboxType::ReadAsFilled, appData->UserPoolId)));
-}
-
+ MakeTxProxyID(),
+ TActorSetupCmd(CreateTxProxy(CollectAllAllocatorsFromAllDomains(appData)), TMailboxType::ReadAsFilled, appData->UserPoolId)));
+}
+
TLongTxServiceInitializer::TLongTxServiceInitializer(const TKikimrRunConfig &runConfig)
: IKikimrServicesInitializer(runConfig)
{
@@ -2071,7 +2071,7 @@ TLeaseHolderInitializer::TLeaseHolderInitializer(const TKikimrRunConfig& runConf
: IKikimrServicesInitializer(runConfig)
{
}
-
+
void TLeaseHolderInitializer::InitializeServices(NActors::TActorSystemSetup* setup,
const NKikimr::TAppData* appData)
{
@@ -2188,34 +2188,34 @@ void TSysViewServiceInitializer::InitializeServices(NActors::TActorSystemSetup*
TActorSetupCmd(actor.Release(), TMailboxType::HTSwap, appData->UserPoolId)));
}
-TMeteringWriterInitializer::TMeteringWriterInitializer(const TKikimrRunConfig &runConfig)
- : IKikimrServicesInitializer(runConfig)
-{
-}
-
-void TMeteringWriterInitializer::InitializeServices(TActorSystemSetup *setup, const TAppData *appData)
-{
- if (!Config.HasMeteringConfig() || !Config.GetMeteringConfig().HasMeteringFilePath()) {
- return;
- }
-
- const auto& filePath = Config.GetMeteringConfig().GetMeteringFilePath();
-
- THolder<TFileLogBackend> fileBackend;
- try {
- fileBackend = MakeHolder<TFileLogBackend>(filePath);
- } catch (const TFileError& ex) {
- Cerr << "TMeteringWriterInitializer: failed to open file '" << filePath << "': " << ex.what() << Endl;
- exit(1);
- }
-
- auto actor = NMetering::CreateMeteringWriter(std::move(fileBackend));
-
- setup->LocalServices.push_back(std::pair<TActorId, TActorSetupCmd>(
- NMetering::MakeMeteringServiceID(),
- TActorSetupCmd(actor.Release(), TMailboxType::HTSwap, appData->IOPoolId)));
-}
-
+TMeteringWriterInitializer::TMeteringWriterInitializer(const TKikimrRunConfig &runConfig)
+ : IKikimrServicesInitializer(runConfig)
+{
+}
+
+void TMeteringWriterInitializer::InitializeServices(TActorSystemSetup *setup, const TAppData *appData)
+{
+ if (!Config.HasMeteringConfig() || !Config.GetMeteringConfig().HasMeteringFilePath()) {
+ return;
+ }
+
+ const auto& filePath = Config.GetMeteringConfig().GetMeteringFilePath();
+
+ THolder<TFileLogBackend> fileBackend;
+ try {
+ fileBackend = MakeHolder<TFileLogBackend>(filePath);
+ } catch (const TFileError& ex) {
+ Cerr << "TMeteringWriterInitializer: failed to open file '" << filePath << "': " << ex.what() << Endl;
+ exit(1);
+ }
+
+ auto actor = NMetering::CreateMeteringWriter(std::move(fileBackend));
+
+ setup->LocalServices.push_back(std::pair<TActorId, TActorSetupCmd>(
+ NMetering::MakeMeteringServiceID(),
+ TActorSetupCmd(actor.Release(), TMailboxType::HTSwap, appData->IOPoolId)));
+}
+
TSchemeBoardMonitoringInitializer::TSchemeBoardMonitoringInitializer(const TKikimrRunConfig &runConfig)
: IKikimrServicesInitializer(runConfig)
{
diff --git a/ydb/core/driver_lib/run/kikimr_services_initializers.h b/ydb/core/driver_lib/run/kikimr_services_initializers.h
index e6a0e28959a..407ce1bb7ba 100644
--- a/ydb/core/driver_lib/run/kikimr_services_initializers.h
+++ b/ydb/core/driver_lib/run/kikimr_services_initializers.h
@@ -3,7 +3,7 @@
#include "factories.h"
#include "service_initializer.h"
-#include <library/cpp/actors/util/affinity.h>
+#include <library/cpp/actors/util/affinity.h>
#include <ydb/core/base/appdata.h>
#include <ydb/core/base/statestorage.h>
#include <ydb/core/tablet/tablet_setup.h>
@@ -13,15 +13,15 @@
#include <ydb/core/protos/config.pb.h>
#include <ydb/public/lib/base/msgbus.h>
-
+
#include <ydb/core/yq/libs/shared_resources/interface/shared_resources.h>
-#include <library/cpp/actors/core/defs.h>
-#include <library/cpp/actors/core/actorsystem.h>
-#include <library/cpp/actors/core/log_settings.h>
-#include <library/cpp/actors/core/scheduler_actor.h>
-#include <library/cpp/actors/core/scheduler_basic.h>
-#include <library/cpp/actors/interconnect/poller_tcp.h>
+#include <library/cpp/actors/core/defs.h>
+#include <library/cpp/actors/core/actorsystem.h>
+#include <library/cpp/actors/core/log_settings.h>
+#include <library/cpp/actors/core/scheduler_actor.h>
+#include <library/cpp/actors/core/scheduler_basic.h>
+#include <library/cpp/actors/interconnect/poller_tcp.h>
#include <library/cpp/monlib/dynamic_counters/counters.h>
#include <util/generic/vector.h>
@@ -179,7 +179,7 @@ public:
class TBootstrapperInitializer : public IKikimrServicesInitializer {
public:
- TBootstrapperInitializer(const TKikimrRunConfig& runConfig);
+ TBootstrapperInitializer(const TKikimrRunConfig& runConfig);
void InitializeServices(NActors::TActorSystemSetup *setup, const NKikimr::TAppData *appData) override;
};
@@ -204,13 +204,13 @@ public:
class TTxProxyInitializer : public IKikimrServicesInitializer {
TVector<ui64> CollectAllAllocatorsFromAllDomains(const NKikimr::TAppData* appData);
-
-public:
- TTxProxyInitializer(const TKikimrRunConfig& runConfig);
-
+
+public:
+ TTxProxyInitializer(const TKikimrRunConfig& runConfig);
+
void InitializeServices(NActors::TActorSystemSetup *setup, const NKikimr::TAppData *appData) override;
-};
-
+};
+
class TLongTxServiceInitializer : public IKikimrServicesInitializer {
public:
TLongTxServiceInitializer(const TKikimrRunConfig& runConfig);
@@ -227,7 +227,7 @@ public:
class TMiniKQLCompileServiceInitializer : public IKikimrServicesInitializer {
public:
- TMiniKQLCompileServiceInitializer(const TKikimrRunConfig& runConfig);
+ TMiniKQLCompileServiceInitializer(const TKikimrRunConfig& runConfig);
void InitializeServices(NActors::TActorSystemSetup *setup, const NKikimr::TAppData *appData) override;
};
@@ -238,7 +238,7 @@ class TMessageBusServicesInitializer : public IKikimrServicesInitializer {
public:
TMessageBusServicesInitializer(const TKikimrRunConfig& runConfig,
- NMsgBusProxy::IMessageBusServer& busServer);
+ NMsgBusProxy::IMessageBusServer& busServer);
void InitializeServices(NActors::TActorSystemSetup *setup, const NKikimr::TAppData *appData) override;
};
@@ -310,7 +310,7 @@ class TViewerInitializer : public IKikimrServicesInitializer {
const TKikimrRunConfig& KikimrRunConfig;
public:
- TViewerInitializer(const TKikimrRunConfig& runConfig);
+ TViewerInitializer(const TKikimrRunConfig& runConfig);
void InitializeServices(NActors::TActorSystemSetup *setup, const NKikimr::TAppData *appData) override;
};
@@ -458,13 +458,13 @@ public:
void InitializeServices(NActors::TActorSystemSetup* setup, const NKikimr::TAppData* appData) override;
};
-class TMeteringWriterInitializer : public IKikimrServicesInitializer {
-public:
- TMeteringWriterInitializer(const TKikimrRunConfig& runConfig);
-
- void InitializeServices(NActors::TActorSystemSetup* setup, const NKikimr::TAppData* appData) override;
-};
-
+class TMeteringWriterInitializer : public IKikimrServicesInitializer {
+public:
+ TMeteringWriterInitializer(const TKikimrRunConfig& runConfig);
+
+ void InitializeServices(NActors::TActorSystemSetup* setup, const NKikimr::TAppData* appData) override;
+};
+
class TSchemeBoardMonitoringInitializer : public IKikimrServicesInitializer {
public:
TSchemeBoardMonitoringInitializer(const TKikimrRunConfig& runConfig);
diff --git a/ydb/core/driver_lib/run/run.cpp b/ydb/core/driver_lib/run/run.cpp
index 1c8c162c6d3..a4f74aa4e0f 100644
--- a/ydb/core/driver_lib/run/run.cpp
+++ b/ydb/core/driver_lib/run/run.cpp
@@ -145,39 +145,39 @@ public:
const ui64 schemeRoot = domain.HasSchemeRoot() ? domain.GetSchemeRoot() : 0;
const ui64 planResolution = domain.HasPlanResolution() ? domain.GetPlanResolution() : 500;
const TString domainName = domain.HasName() ? domain.GetName() : Sprintf("domain-%" PRIu32, domainId);
- TDomainsInfo::TDomain::TStoragePoolKinds poolTypes;
+ TDomainsInfo::TDomain::TStoragePoolKinds poolTypes;
for (auto &type : domain.GetStoragePoolTypes()) {
Y_VERIFY(!poolTypes.contains(type.GetKind()), "duplicated slot type");
- poolTypes[type.GetKind()] = type.GetPoolConfig();
+ poolTypes[type.GetKind()] = type.GetPoolConfig();
}
- bool isExplicitTabletIds = domain.ExplicitCoordinatorsSize() + domain.ExplicitMediatorsSize() + domain.ExplicitAllocatorsSize();
-
+ bool isExplicitTabletIds = domain.ExplicitCoordinatorsSize() + domain.ExplicitMediatorsSize() + domain.ExplicitAllocatorsSize();
+
const ui32 defaultSSId = domainId;
const ui32 schemeBoardSSId = (domain.HasSchemeBoardSSId() && domain.GetSchemeBoardSSId()) ? domain.GetSchemeBoardSSId() : defaultSSId;
Y_VERIFY(Find(domain.GetSSId(), defaultSSId) != domain.GetSSId().end());
Y_VERIFY(Find(domain.GetSSId(), schemeBoardSSId) != domain.GetSSId().end());
- TDomainsInfo::TDomain::TPtr domainPtr = nullptr;
- if (isExplicitTabletIds) {
- domainPtr = TDomainsInfo::TDomain::ConstructDomainWithExplicitTabletIds(domainName, domainId, schemeRoot,
+ TDomainsInfo::TDomain::TPtr domainPtr = nullptr;
+ if (isExplicitTabletIds) {
+ domainPtr = TDomainsInfo::TDomain::ConstructDomainWithExplicitTabletIds(domainName, domainId, schemeRoot,
defaultSSId, schemeBoardSSId, domain.GetSSId(),
- domainId, domain.GetHiveUid(),
+ domainId, domain.GetHiveUid(),
planResolution,
- domain.GetExplicitCoordinators(),
- domain.GetExplicitMediators(),
- domain.GetExplicitAllocators(),
- poolTypes);
- } else {
- domainPtr = TDomainsInfo::TDomain::ConstructDomain(domainName, domainId, schemeRoot,
+ domain.GetExplicitCoordinators(),
+ domain.GetExplicitMediators(),
+ domain.GetExplicitAllocators(),
+ poolTypes);
+ } else {
+ domainPtr = TDomainsInfo::TDomain::ConstructDomain(domainName, domainId, schemeRoot,
defaultSSId, schemeBoardSSId, domain.GetSSId(),
- domainId, domain.GetHiveUid(),
+ domainId, domain.GetHiveUid(),
planResolution,
- domain.GetCoordinator(), domain.GetMediator(),
- domain.GetProxy(), poolTypes);
- }
-
- appData->DomainsInfo->AddDomain(domainPtr.Release());
+ domain.GetCoordinator(), domain.GetMediator(),
+ domain.GetProxy(), poolTypes);
+ }
+
+ appData->DomainsInfo->AddDomain(domainPtr.Release());
}
for (const NKikimrConfig::TDomainsConfig::THiveConfig &hiveConfig : Config.GetDomainsConfig().GetHiveConfig()) {
@@ -200,7 +200,7 @@ public:
appData->DefaultUserSIDs = std::move(defaultUserSIDs);
}
appData->AllAuthenticatedUsers = securityConfig.GetAllAuthenticatedUsers();
-
+
appData->FeatureFlags = Config.GetFeatureFlags();
appData->AllowHugeKeyValueDeletes = Config.GetFeatureFlags().GetAllowHugeKeyValueDeletes();
appData->EnableKqpSpilling = Config.GetTableServiceConfig().GetSpillingServiceConfig().GetLocalFileConfig().GetEnable();
@@ -249,9 +249,9 @@ public:
}
const ui64 pDiskCategory = channel.GetPDiskCategory();
const NKikimrBlobStorage::TVDiskKind::EVDiskKind vDiskCategory = static_cast<NKikimrBlobStorage::TVDiskKind::EVDiskKind>(channel.GetVDiskCategory());
-
- const TString kind = channel.GetStoragePoolKind();
- outProfile.Channels.push_back(TChannelProfiles::TProfile::TChannel(erasure, pDiskCategory, vDiskCategory, kind));
+
+ const TString kind = channel.GetStoragePoolKind();
+ outProfile.Channels.push_back(TChannelProfiles::TProfile::TChannel(erasure, pDiskCategory, vDiskCategory, kind));
++channelIdx;
}
}
@@ -1197,27 +1197,27 @@ TIntrusivePtr<TServiceInitializersList> TKikimrRunner::CreateServiceInitializers
sil->AddServiceInitializer(new TRestartsCountPublisher(runConfig));
}
if (serviceMask.EnableBootstrapper) {
- sil->AddServiceInitializer(new TBootstrapperInitializer(runConfig));
+ sil->AddServiceInitializer(new TBootstrapperInitializer(runConfig));
}
if (serviceMask.EnableMediatorTimeCastProxy) {
sil->AddServiceInitializer(new TMediatorTimeCastProxyInitializer(runConfig));
}
- if (serviceMask.EnableTxProxy) {
- sil->AddServiceInitializer(new TTxProxyInitializer(runConfig));
- }
+ if (serviceMask.EnableTxProxy) {
+ sil->AddServiceInitializer(new TTxProxyInitializer(runConfig));
+ }
if (serviceMask.EnableSecurityServices) {
sil->AddServiceInitializer(new TSecurityServicesInitializer(runConfig, ModuleFactories));
}
- if (BusServer && serviceMask.EnableMessageBusServices) {
- sil->AddServiceInitializer(new TMessageBusServicesInitializer(runConfig, *BusServer));
+ if (BusServer && serviceMask.EnableMessageBusServices) {
+ sil->AddServiceInitializer(new TMessageBusServicesInitializer(runConfig, *BusServer));
+ }
+
+ if (serviceMask.EnableMiniKQLCompileService) {
+ sil->AddServiceInitializer(new TMiniKQLCompileServiceInitializer(runConfig));
}
- if (serviceMask.EnableMiniKQLCompileService) {
- sil->AddServiceInitializer(new TMiniKQLCompileServiceInitializer(runConfig));
- }
-
if (serviceMask.EnableHealthCheckService) {
sil->AddServiceInitializer(new THealthCheckInitializer(runConfig));
}
@@ -1242,7 +1242,7 @@ TIntrusivePtr<TServiceInitializersList> TKikimrRunner::CreateServiceInitializers
}
if (serviceMask.EnableViewerService) {
- sil->AddServiceInitializer(new TViewerInitializer(runConfig));
+ sil->AddServiceInitializer(new TViewerInitializer(runConfig));
}
if (serviceMask.EnableLoadService) {
sil->AddServiceInitializer(new TLoadInitializer(runConfig));
@@ -1303,10 +1303,10 @@ TIntrusivePtr<TServiceInitializersList> TKikimrRunner::CreateServiceInitializers
sil->AddServiceInitializer(new TSysViewServiceInitializer(runConfig));
}
- if (serviceMask.EnableMeteringWriter) {
- sil->AddServiceInitializer(new TMeteringWriterInitializer(runConfig));
- }
-
+ if (serviceMask.EnableMeteringWriter) {
+ sil->AddServiceInitializer(new TMeteringWriterInitializer(runConfig));
+ }
+
if (serviceMask.EnableLongTxService) {
sil->AddServiceInitializer(new TLongTxServiceInitializer(runConfig));
}
@@ -1514,12 +1514,12 @@ void TKikimrRunner::SetSignalHandlers() {
#endif
signal(SIGINT, &TKikimrRunner::OnTerminate);
signal(SIGTERM, &TKikimrRunner::OnTerminate);
-
-#if !defined(_win_)
- SetAsyncSignalHandler(SIGHUP, [](int) {
- TLogBackend::ReopenAllBackends();
- });
-#endif
+
+#if !defined(_win_)
+ SetAsyncSignalHandler(SIGHUP, [](int) {
+ TLogBackend::ReopenAllBackends();
+ });
+#endif
}
void TKikimrRunner::InitializeRegistries(const TKikimrRunConfig& runConfig) {
diff --git a/ydb/core/driver_lib/run/ya.make b/ydb/core/driver_lib/run/ya.make
index f780a19f2a3..f410ef42f20 100644
--- a/ydb/core/driver_lib/run/ya.make
+++ b/ydb/core/driver_lib/run/ya.make
@@ -1,9 +1,9 @@
LIBRARY(run)
-OWNER(
- ddoarn
+OWNER(
+ ddoarn
g:kikimr
-)
+)
IF (PROFILE_MEMORY_ALLOCATIONS)
CFLAGS(
diff --git a/ydb/core/engine/mkql_proto.cpp b/ydb/core/engine/mkql_proto.cpp
index 7068cb0b25a..3dd053e3724 100644
--- a/ydb/core/engine/mkql_proto.cpp
+++ b/ydb/core/engine/mkql_proto.cpp
@@ -287,12 +287,12 @@ bool CellsFromTuple(const NKikimrMiniKQL::TType* tupleType,
CASE_SIMPLE_TYPE(Uint64, ui64, Uint64);
CASE_SIMPLE_TYPE(Float, float, Float);
CASE_SIMPLE_TYPE(Double, double,Double);
- CASE_SIMPLE_TYPE(Date, ui16, Uint32);
- CASE_SIMPLE_TYPE(Datetime, ui32, Uint32);
- CASE_SIMPLE_TYPE(Timestamp, ui64, Uint64);
- CASE_SIMPLE_TYPE(Interval, i64, Int64);
+ CASE_SIMPLE_TYPE(Date, ui16, Uint32);
+ CASE_SIMPLE_TYPE(Datetime, ui32, Uint32);
+ CASE_SIMPLE_TYPE(Timestamp, ui64, Uint64);
+ CASE_SIMPLE_TYPE(Interval, i64, Int64);
+
-
#undef CASE_SIMPLE_TYPE
case NScheme::NTypeIds::Yson:
@@ -390,23 +390,23 @@ bool CellToValue(NScheme::TTypeId typeId, const TCell& c, NKikimrMiniKQL::TValue
val.MutableOptional()->SetDouble(ReadUnaligned<double>(c.Data()));
break;
- case NScheme::NTypeIds::Date:
- Y_VERIFY(c.Size() == sizeof(ui16));
- val.MutableOptional()->SetUint32(ReadUnaligned<i16>(c.Data()));
- break;
- case NScheme::NTypeIds::Datetime:
- Y_VERIFY(c.Size() == sizeof(ui32));
- val.MutableOptional()->SetUint32(ReadUnaligned<ui32>(c.Data()));
- break;
- case NScheme::NTypeIds::Timestamp:
- Y_VERIFY(c.Size() == sizeof(ui64));
- val.MutableOptional()->SetUint64(ReadUnaligned<ui64>(c.Data()));
- break;
- case NScheme::NTypeIds::Interval:
- Y_VERIFY(c.Size() == sizeof(i64));
- val.MutableOptional()->SetInt64(ReadUnaligned<i64>(c.Data()));
- break;
-
+ case NScheme::NTypeIds::Date:
+ Y_VERIFY(c.Size() == sizeof(ui16));
+ val.MutableOptional()->SetUint32(ReadUnaligned<i16>(c.Data()));
+ break;
+ case NScheme::NTypeIds::Datetime:
+ Y_VERIFY(c.Size() == sizeof(ui32));
+ val.MutableOptional()->SetUint32(ReadUnaligned<ui32>(c.Data()));
+ break;
+ case NScheme::NTypeIds::Timestamp:
+ Y_VERIFY(c.Size() == sizeof(ui64));
+ val.MutableOptional()->SetUint64(ReadUnaligned<ui64>(c.Data()));
+ break;
+ case NScheme::NTypeIds::Interval:
+ Y_VERIFY(c.Size() == sizeof(i64));
+ val.MutableOptional()->SetInt64(ReadUnaligned<i64>(c.Data()));
+ break;
+
case NScheme::NTypeIds::JsonDocument:
case NScheme::NTypeIds::String:
case NScheme::NTypeIds::DyNumber:
diff --git a/ydb/core/grpc_services/base/base.h b/ydb/core/grpc_services/base/base.h
index 3e11c6814d8..44b25c4a5f9 100644
--- a/ydb/core/grpc_services/base/base.h
+++ b/ydb/core/grpc_services/base/base.h
@@ -56,9 +56,9 @@ struct TRpcServices {
EvCreateTable,
EvDropTable,
EvCopyTable,
- EvCopyTables,
+ EvCopyTables,
EvListDirectory,
- EvRenameTables,
+ EvRenameTables,
EvDescribeTable,
EvDescribePath,
EvGetOperation,
diff --git a/ydb/core/grpc_services/grpc_request_check_actor.h b/ydb/core/grpc_services/grpc_request_check_actor.h
index 0f8fcce0f00..04c72abe6de 100644
--- a/ydb/core/grpc_services/grpc_request_check_actor.h
+++ b/ydb/core/grpc_services/grpc_request_check_actor.h
@@ -74,13 +74,13 @@ public:
const TSchemeBoardEvents::TDescribeSchemeResult& schemeData,
TIntrusivePtr<TSecurityObject> securityObject,
TAutoPtr<TEventHandle<TEvent>> request,
- TGrpcProxyCounters::TPtr counters,
- bool skipCheckConnectRigths)
+ TGrpcProxyCounters::TPtr counters,
+ bool skipCheckConnectRigths)
: Owner_(owner)
, Request_(std::move(request))
, Counters_(counters)
, SecurityObject_(std::move(securityObject))
- , SkipCheckConnectRigths_(skipCheckConnectRigths)
+ , SkipCheckConnectRigths_(skipCheckConnectRigths)
{
GrpcRequestBaseCtx_ = Request_->Get();
TMaybe<TString> authToken = GrpcRequestBaseCtx_->GetYdbToken();
@@ -96,11 +96,11 @@ public:
void Bootstrap(const TActorContext& ctx) {
TBase::Become(&TSelf::DbAccessStateFunc);
- {
- auto [error, issue] = CheckConnectRight();
- if (error) {
- ReplyUnauthorizedAndDie(*issue);
- return;
+ {
+ auto [error, issue] = CheckConnectRight();
+ if (error) {
+ ReplyUnauthorizedAndDie(*issue);
+ return;
}
}
@@ -328,67 +328,67 @@ private:
TBase::PassAway();
}
- std::pair<bool, std::optional<NYql::TIssue>> CheckConnectRight() {
- if (SkipCheckConnectRigths_) {
- LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::GRPC_PROXY_NO_CONNECT_ACCESS,
- "Skip check permission connect db, AllowYdbRequestsWithoutDatabase is off, there is no db provided from user"
- << ", database: " << CheckedDatabaseName_
- << ", user: " << TBase::GetUserSID()
- << ", from ip: " << GrpcRequestBaseCtx_->GetPeerName());
- return {false, std::nullopt};
- }
-
- if (TBase::IsUserAdmin()) {
- LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::GRPC_PROXY_NO_CONNECT_ACCESS,
- "Skip check permission connect db, user is a admin"
- << ", database: " << CheckedDatabaseName_
- << ", user: " << TBase::GetUserSID()
- << ", from ip: " << GrpcRequestBaseCtx_->GetPeerName());
- return {false, std::nullopt};
- }
-
- if (!TBase::GetSecurityToken()) {
- if (!TBase::IsTokenRequired()) {
- LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::GRPC_PROXY_NO_CONNECT_ACCESS,
- "Skip check permission connect db, token is not required, there is no token provided"
- << ", database: " << CheckedDatabaseName_
- << ", user: " << TBase::GetUserSID()
- << ", from ip: " << GrpcRequestBaseCtx_->GetPeerName());
- return {false, std::nullopt};
- }
- }
-
- if (!SecurityObject_) {
- LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::GRPC_PROXY_NO_CONNECT_ACCESS,
- "Skip check permission connect db, no SecurityObject_"
- << ", database: " << CheckedDatabaseName_
- << ", user: " << TBase::GetUserSID()
- << ", from ip: " << GrpcRequestBaseCtx_->GetPeerName());
- return {false, std::nullopt};
- }
-
- const ui32 access = NACLib::ConnectDatabase;
- if (SecurityObject_->CheckAccess(access, TBase::GetSerializedToken())) {
- return {false, std::nullopt};
- }
-
- const TString error = TStringBuilder()
- << "User has no permission to perform query on this database"
- << ", database: " << CheckedDatabaseName_
- << ", user: " << TBase::GetUserSID()
- << ", from ip: " << GrpcRequestBaseCtx_->GetPeerName();
- LOG_INFO(*TlsActivationContext, NKikimrServices::GRPC_PROXY_NO_CONNECT_ACCESS, "%s", error.c_str());
-
- Counters_->IncDatabaseAccessDenyCounter();
-
- if (!AppData()->FeatureFlags.GetCheckDatabaseAccessPermission()) {
- return {false, std::nullopt};
- }
-
- LOG_ERROR(*TlsActivationContext, NKikimrServices::GRPC_SERVER, "%s", error.c_str());
- return {true, MakeIssue(NKikimrIssues::TIssuesIds::ACCESS_DENIED, error)};
- }
-
+ std::pair<bool, std::optional<NYql::TIssue>> CheckConnectRight() {
+ if (SkipCheckConnectRigths_) {
+ LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::GRPC_PROXY_NO_CONNECT_ACCESS,
+ "Skip check permission connect db, AllowYdbRequestsWithoutDatabase is off, there is no db provided from user"
+ << ", database: " << CheckedDatabaseName_
+ << ", user: " << TBase::GetUserSID()
+ << ", from ip: " << GrpcRequestBaseCtx_->GetPeerName());
+ return {false, std::nullopt};
+ }
+
+ if (TBase::IsUserAdmin()) {
+ LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::GRPC_PROXY_NO_CONNECT_ACCESS,
+ "Skip check permission connect db, user is a admin"
+ << ", database: " << CheckedDatabaseName_
+ << ", user: " << TBase::GetUserSID()
+ << ", from ip: " << GrpcRequestBaseCtx_->GetPeerName());
+ return {false, std::nullopt};
+ }
+
+ if (!TBase::GetSecurityToken()) {
+ if (!TBase::IsTokenRequired()) {
+ LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::GRPC_PROXY_NO_CONNECT_ACCESS,
+ "Skip check permission connect db, token is not required, there is no token provided"
+ << ", database: " << CheckedDatabaseName_
+ << ", user: " << TBase::GetUserSID()
+ << ", from ip: " << GrpcRequestBaseCtx_->GetPeerName());
+ return {false, std::nullopt};
+ }
+ }
+
+ if (!SecurityObject_) {
+ LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::GRPC_PROXY_NO_CONNECT_ACCESS,
+ "Skip check permission connect db, no SecurityObject_"
+ << ", database: " << CheckedDatabaseName_
+ << ", user: " << TBase::GetUserSID()
+ << ", from ip: " << GrpcRequestBaseCtx_->GetPeerName());
+ return {false, std::nullopt};
+ }
+
+ const ui32 access = NACLib::ConnectDatabase;
+ if (SecurityObject_->CheckAccess(access, TBase::GetSerializedToken())) {
+ return {false, std::nullopt};
+ }
+
+ const TString error = TStringBuilder()
+ << "User has no permission to perform query on this database"
+ << ", database: " << CheckedDatabaseName_
+ << ", user: " << TBase::GetUserSID()
+ << ", from ip: " << GrpcRequestBaseCtx_->GetPeerName();
+ LOG_INFO(*TlsActivationContext, NKikimrServices::GRPC_PROXY_NO_CONNECT_ACCESS, "%s", error.c_str());
+
+ Counters_->IncDatabaseAccessDenyCounter();
+
+ if (!AppData()->FeatureFlags.GetCheckDatabaseAccessPermission()) {
+ return {false, std::nullopt};
+ }
+
+ LOG_ERROR(*TlsActivationContext, NKikimrServices::GRPC_SERVER, "%s", error.c_str());
+ return {true, MakeIssue(NKikimrIssues::TIssuesIds::ACCESS_DENIED, error)};
+ }
+
const TActorId Owner_;
TAutoPtr<TEventHandle<TEvent>> Request_;
TGrpcProxyCounters::TPtr Counters_;
@@ -396,7 +396,7 @@ private:
TString CheckedDatabaseName_;
IRequestProxyCtx* GrpcRequestBaseCtx_;
NRpcService::TRlConfig* RlConfig = nullptr;
- bool SkipCheckConnectRigths_ = false;
+ bool SkipCheckConnectRigths_ = false;
std::vector<std::pair<TString, TString>> Attributes_;
};
@@ -441,10 +441,10 @@ IActor* CreateGrpcRequestCheckActor(
const TSchemeBoardEvents::TDescribeSchemeResult& schemeData,
TIntrusivePtr<TSecurityObject> securityObject,
TAutoPtr<TEventHandle<TEvent>> request,
- TGrpcProxyCounters::TPtr counters,
- bool skipCheckConnectRigths) {
+ TGrpcProxyCounters::TPtr counters,
+ bool skipCheckConnectRigths) {
- return new TGrpcRequestCheckActor<TEvent>(owner, schemeData, std::move(securityObject), std::move(request), counters, skipCheckConnectRigths);
+ return new TGrpcRequestCheckActor<TEvent>(owner, schemeData, std::move(securityObject), std::move(request), counters, skipCheckConnectRigths);
}
}
diff --git a/ydb/core/grpc_services/grpc_request_proxy.cpp b/ydb/core/grpc_services/grpc_request_proxy.cpp
index 7f538ac9f56..a1e7accb877 100644
--- a/ydb/core/grpc_services/grpc_request_proxy.cpp
+++ b/ydb/core/grpc_services/grpc_request_proxy.cpp
@@ -192,9 +192,9 @@ private:
TString databaseName;
const TDatabaseInfo* database = nullptr;
bool skipResourceCheck = false;
- // do not check connect rights for the deprecated requests without database
- // remove this along with AllowYdbRequestsWithoutDatabase flag
- bool skipCheckConnectRigths = false;
+ // do not check connect rights for the deprecated requests without database
+ // remove this along with AllowYdbRequestsWithoutDatabase flag
+ bool skipCheckConnectRigths = false;
if (state.State == NGrpc::TAuthState::AS_NOT_PERFORMED) {
const auto& maybeDatabaseName = requestBaseCtx->GetDatabaseName();
@@ -207,7 +207,7 @@ private:
} else {
databaseName = RootDatabase;
skipResourceCheck = true;
- skipCheckConnectRigths = true;
+ skipCheckConnectRigths = true;
}
}
auto it = Databases.find(databaseName);
@@ -253,7 +253,7 @@ private:
Register(CreateGrpcRequestCheckActor<TEvent>(SelfId(),
database->SchemeBoardResult->DescribeSchemeResult,
- database->SecurityObject, event.Release(), Counters, skipCheckConnectRigths));
+ database->SecurityObject, event.Release(), Counters, skipCheckConnectRigths));
return;
}
@@ -578,7 +578,7 @@ void TGRpcRequestProxyImpl::StateFunc(TAutoPtr<IEventHandle>& ev, const TActorCo
HFunc(TEvDeleteSessionRequest, PreHandle);
HFunc(TEvCopyTableRequest, PreHandle);
HFunc(TEvCopyTablesRequest, PreHandle);
- HFunc(TEvRenameTablesRequest, PreHandle);
+ HFunc(TEvRenameTablesRequest, PreHandle);
HFunc(TEvDescribeTableRequest, PreHandle);
HFunc(TEvReadTableRequest, PreHandle);
HFunc(TEvExplainDataQueryRequest, PreHandle);
diff --git a/ydb/core/grpc_services/grpc_request_proxy.h b/ydb/core/grpc_services/grpc_request_proxy.h
index a112d5c4f4d..97315f6e9fb 100644
--- a/ydb/core/grpc_services/grpc_request_proxy.h
+++ b/ydb/core/grpc_services/grpc_request_proxy.h
@@ -51,8 +51,8 @@ protected:
void Handle(TEvCreateTableRequest::TPtr& ev, const TActorContext& ctx);
void Handle(TEvDropTableRequest::TPtr& ev, const TActorContext& ctx);
void Handle(TEvCopyTableRequest::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvCopyTablesRequest::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvRenameTablesRequest::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvCopyTablesRequest::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvRenameTablesRequest::TPtr& ev, const TActorContext& ctx);
void Handle(TEvDescribeTableRequest::TPtr& ev, const TActorContext& ctx);
void Handle(TEvGetOperationRequest::TPtr& ev, const TActorContext& ctx);
void Handle(TEvCancelOperationRequest::TPtr& ev, const TActorContext& ctx);
diff --git a/ydb/core/grpc_services/operation_helpers.cpp b/ydb/core/grpc_services/operation_helpers.cpp
index 16886d96c56..66e95a319ab 100644
--- a/ydb/core/grpc_services/operation_helpers.cpp
+++ b/ydb/core/grpc_services/operation_helpers.cpp
@@ -159,9 +159,9 @@ public:
(this->*StateFunc)(ctx);
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered::TPtr&, const TActorContext&) {}
+ void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered::TPtr&, const TActorContext&) {}
- void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr&, const TActorContext& ctx) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr&, const TActorContext& ctx) {
//TODO: Change SS API to get operation status just from TEvNotifyTxCompletionResult
switch (OpType) {
case TOpType::Common:
@@ -189,13 +189,13 @@ public:
STFUNC(AwaitState) {
switch (ev->GetTypeRewrite()) {
- HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult, Handle);
- HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered, Handle);
HFunc(TEvTabletPipe::TEvClientConnected, Handle);
HFunc(TEvTabletPipe::TEvClientDestroyed, Handle);
- HFunc(NSchemeShard::TEvExport::TEvGetExportResponse, Handle);
- HFunc(NSchemeShard::TEvImport::TEvGetImportResponse, Handle);
- HFunc(NSchemeShard::TEvIndexBuilder::TEvGetResponse, Handle);
+ HFunc(NSchemeShard::TEvExport::TEvGetExportResponse, Handle);
+ HFunc(NSchemeShard::TEvImport::TEvGetImportResponse, Handle);
+ HFunc(NSchemeShard::TEvIndexBuilder::TEvGetResponse, Handle);
default:
{
Req->ReplyWithYdbStatus(Ydb::StatusIds::INTERNAL_ERROR);
@@ -214,27 +214,27 @@ private:
}
void DoSubscribe(const TActorContext& ctx) {
- auto request = MakeHolder<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion>();
+ auto request = MakeHolder<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion>();
request->Record.SetTxId(TxId);
NTabletPipe::SendData(ctx, SSPipeClient, request.Release());
}
void GetBuildIndexStatus(const TActorContext& ctx) {
- auto request = new NSchemeShard::TEvIndexBuilder::TEvGetRequest(DatabaseName, TxId);
+ auto request = new NSchemeShard::TEvIndexBuilder::TEvGetRequest(DatabaseName, TxId);
NTabletPipe::SendData(ctx, SSPipeClient, request);
}
void GetExportStatus(const TActorContext& ctx) {
- auto request = new NSchemeShard::TEvExport::TEvGetExportRequest(DatabaseName, TxId);
+ auto request = new NSchemeShard::TEvExport::TEvGetExportRequest(DatabaseName, TxId);
NTabletPipe::SendData(ctx, SSPipeClient, request);
}
void GetImportStatus(const TActorContext& ctx) {
- auto request = new NSchemeShard::TEvImport::TEvGetImportRequest(DatabaseName, TxId);
+ auto request = new NSchemeShard::TEvImport::TEvGetImportRequest(DatabaseName, TxId);
NTabletPipe::SendData(ctx, SSPipeClient, request);
}
- void Handle(NSchemeShard::TEvExport::TEvGetExportResponse::TPtr& ev, const TActorContext& ctx) {
+ void Handle(NSchemeShard::TEvExport::TEvGetExportResponse::TPtr& ev, const TActorContext& ctx) {
const auto& record = ev->Get()->Record.GetResponse();
LOG_D("Handle TEvExport::TEvGetExportResponse"
@@ -245,7 +245,7 @@ private:
Die(ctx);
}
- void Handle(NSchemeShard::TEvImport::TEvGetImportResponse::TPtr& ev, const TActorContext& ctx) {
+ void Handle(NSchemeShard::TEvImport::TEvGetImportResponse::TPtr& ev, const TActorContext& ctx) {
const auto& record = ev->Get()->Record.GetResponse();
LOG_D("Handle TEvImport::TEvGetImportResponse"
@@ -256,7 +256,7 @@ private:
Die(ctx);
}
- void Handle(NSchemeShard::TEvIndexBuilder::TEvGetResponse::TPtr& ev, const TActorContext& ctx) {
+ void Handle(NSchemeShard::TEvIndexBuilder::TEvGetResponse::TPtr& ev, const TActorContext& ctx) {
const auto& record = ev->Get()->Record;
LOG_D("Handle TEvIndexBuilder::TEvGetResponse"
diff --git a/ydb/core/grpc_services/rpc_alter_coordination_node.cpp b/ydb/core/grpc_services/rpc_alter_coordination_node.cpp
index 98d8f3c1c6a..52cfe8c9403 100644
--- a/ydb/core/grpc_services/rpc_alter_coordination_node.cpp
+++ b/ydb/core/grpc_services/rpc_alter_coordination_node.cpp
@@ -40,9 +40,9 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvProposeTransaction> proposeRequest = CreateProposeTransaction();
NKikimrTxUserProxy::TEvProposeTransaction& record = proposeRequest->Record;
- NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
+ NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
modifyScheme->SetWorkingDir(workingDir);
- modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterKesus);
+ modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterKesus);
auto desc = modifyScheme->MutableKesus();
desc->SetName(name);
diff --git a/ydb/core/grpc_services/rpc_alter_table.cpp b/ydb/core/grpc_services/rpc_alter_table.cpp
index 7d9271c47e1..d1f2755b66d 100644
--- a/ydb/core/grpc_services/rpc_alter_table.cpp
+++ b/ydb/core/grpc_services/rpc_alter_table.cpp
@@ -195,7 +195,7 @@ private:
switch (ev->GetTypeRewrite()) {
HFunc(TEvTxUserProxy::TEvAllocateTxIdResult, Handle);
HFunc(TEvTxProxySchemeCache::TEvNavigateKeySetResult, Handle);
- HFunc(NSchemeShard::TEvIndexBuilder::TEvCreateResponse, Handle);
+ HFunc(NSchemeShard::TEvIndexBuilder::TEvCreateResponse, Handle);
default: TBase::StateWork(ev, ctx);
}
}
@@ -330,17 +330,17 @@ private:
void SendAddIndexOpToSS(const TActorContext& ctx) {
const auto& req = *GetProtoRequest();
- NKikimrIndexBuilder::TIndexBuildSettings settings;
- settings.set_source_path(req.path());
- auto tableIndex = settings.mutable_index();
+ NKikimrIndexBuilder::TIndexBuildSettings settings;
+ settings.set_source_path(req.path());
+ auto tableIndex = settings.mutable_index();
tableIndex->CopyFrom(req.add_indexes(0));
- auto ev = new NSchemeShard::TEvIndexBuilder::TEvCreateRequest(TxId, DatabaseName, std::move(settings));
+ auto ev = new NSchemeShard::TEvIndexBuilder::TEvCreateRequest(TxId, DatabaseName, std::move(settings));
NTabletPipe::SendData(ctx, SSPipeClient, ev);
}
- void Handle(NSchemeShard::TEvIndexBuilder::TEvCreateResponse::TPtr& ev, const TActorContext& ctx) {
- const auto& response = ev->Get()->Record;
+ void Handle(NSchemeShard::TEvIndexBuilder::TEvCreateResponse::TPtr& ev, const TActorContext& ctx) {
+ const auto& response = ev->Get()->Record;
const auto status = response.GetStatus();
auto issuesProto = response.GetIssues();
@@ -384,9 +384,9 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvProposeTransaction> proposeRequest = CreateProposeTransaction();
NKikimrTxUserProxy::TEvProposeTransaction& record = proposeRequest->Record;
- NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
+ NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
modifyScheme->SetWorkingDir(workingDir);
- modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropIndex);
+ modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropIndex);
for (const auto& drop : req->drop_indexes()) {
auto desc = modifyScheme->MutableDropIndex();
@@ -411,9 +411,9 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvProposeTransaction> proposeRequest = CreateProposeTransaction();
NKikimrTxUserProxy::TEvProposeTransaction& record = proposeRequest->Record;
- NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
+ NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
modifyScheme->SetWorkingDir(workingDir);
- modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterTable);
+ modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterTable);
auto desc = modifyScheme->MutableAlterTable();
desc->SetName(name);
@@ -505,7 +505,7 @@ private:
auto& modifyScheme = *record.MutableTransaction()->MutableModifyScheme();
modifyScheme.SetWorkingDir(workingDir);
- modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterUserAttributes);
+ modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterUserAttributes);
auto& alter = *modifyScheme.MutableAlterUserAttributes();
alter.SetPathName(name);
diff --git a/ydb/core/grpc_services/rpc_calls.h b/ydb/core/grpc_services/rpc_calls.h
index 0fd5615bc69..43136c2f4ad 100644
--- a/ydb/core/grpc_services/rpc_calls.h
+++ b/ydb/core/grpc_services/rpc_calls.h
@@ -50,7 +50,7 @@ using TEvCreateTableRequest = TGRpcRequestValidationWrapper<TRpcServices::EvCrea
using TEvDropTableRequest = TGRpcRequestWrapper<TRpcServices::EvDropTable, Ydb::Table::DropTableRequest, Ydb::Table::DropTableResponse, true, TRateLimiterMode::Rps>;
using TEvCopyTableRequest = TGRpcRequestWrapper<TRpcServices::EvCopyTable, Ydb::Table::CopyTableRequest, Ydb::Table::CopyTableResponse, true, TRateLimiterMode::Rps>;
using TEvCopyTablesRequest = TGRpcRequestWrapper<TRpcServices::EvCopyTables, Ydb::Table::CopyTablesRequest, Ydb::Table::CopyTablesResponse, true, TRateLimiterMode::Rps>;
-using TEvRenameTablesRequest = TGRpcRequestWrapper<TRpcServices::EvRenameTables, Ydb::Table::RenameTablesRequest, Ydb::Table::RenameTablesResponse, true, TRateLimiterMode::Rps>;
+using TEvRenameTablesRequest = TGRpcRequestWrapper<TRpcServices::EvRenameTables, Ydb::Table::RenameTablesRequest, Ydb::Table::RenameTablesResponse, true, TRateLimiterMode::Rps>;
using TEvDescribeTableRequest = TGRpcRequestWrapper<TRpcServices::EvDescribeTable, Ydb::Table::DescribeTableRequest, Ydb::Table::DescribeTableResponse, true, TRateLimiterMode::Rps>;
using TEvGetOperationRequest = TGRpcRequestValidationWrapper<TRpcServices::EvGetOperation, Ydb::Operations::GetOperationRequest, Ydb::Operations::GetOperationResponse, true, TRateLimiterMode::Rps>;
using TEvCancelOperationRequest = TGRpcRequestValidationWrapper<TRpcServices::EvCancelOperation, Ydb::Operations::CancelOperationRequest, Ydb::Operations::CancelOperationResponse, false, TRateLimiterMode::Rps>;
diff --git a/ydb/core/grpc_services/rpc_cancel_operation.cpp b/ydb/core/grpc_services/rpc_cancel_operation.cpp
index 7e72968dc68..579f927c80f 100644
--- a/ydb/core/grpc_services/rpc_cancel_operation.cpp
+++ b/ydb/core/grpc_services/rpc_cancel_operation.cpp
@@ -14,7 +14,7 @@ namespace NKikimr {
namespace NGRpcService {
using namespace NActors;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NKikimrIssues;
using namespace NOperationId;
using namespace Ydb;
diff --git a/ydb/core/grpc_services/rpc_copy_table.cpp b/ydb/core/grpc_services/rpc_copy_table.cpp
index 79b8f55119d..74a0c9d9a81 100644
--- a/ydb/core/grpc_services/rpc_copy_table.cpp
+++ b/ydb/core/grpc_services/rpc_copy_table.cpp
@@ -40,9 +40,9 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvProposeTransaction> proposeRequest = CreateProposeTransaction();
NKikimrTxUserProxy::TEvProposeTransaction& record = proposeRequest->Record;
- NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
+ NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
modifyScheme->SetWorkingDir(workingDir);
- modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
+ modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
auto create = modifyScheme->MutableCreateTable();
create->SetName(name);
create->SetCopyFromTable(req->source_path());
diff --git a/ydb/core/grpc_services/rpc_copy_tables.cpp b/ydb/core/grpc_services/rpc_copy_tables.cpp
index 292184a2051..1f5fd281a51 100644
--- a/ydb/core/grpc_services/rpc_copy_tables.cpp
+++ b/ydb/core/grpc_services/rpc_copy_tables.cpp
@@ -1,52 +1,52 @@
-#include "grpc_request_proxy.h"
-
-#include "rpc_calls.h"
-#include "rpc_scheme_base.h"
-#include "rpc_common.h"
-
-namespace NKikimr {
-namespace NGRpcService {
-
-using namespace NActors;
-using namespace Ydb;
-
-class TCopyTablesRPC : public TRpcSchemeRequestActor<TCopyTablesRPC, TEvCopyTablesRequest> {
- using TBase = TRpcSchemeRequestActor<TCopyTablesRPC, TEvCopyTablesRequest>;
-
-public:
- TCopyTablesRPC(TEvCopyTablesRequest* msg)
- : TBase(msg) {}
-
- void Bootstrap(const TActorContext &ctx) {
- TBase::Bootstrap(ctx);
-
- SendProposeRequest(ctx);
- Become(&TCopyTablesRPC::StateWork);
- }
-
-private:
- void SendProposeRequest(const TActorContext &ctx) {
+#include "grpc_request_proxy.h"
+
+#include "rpc_calls.h"
+#include "rpc_scheme_base.h"
+#include "rpc_common.h"
+
+namespace NKikimr {
+namespace NGRpcService {
+
+using namespace NActors;
+using namespace Ydb;
+
+class TCopyTablesRPC : public TRpcSchemeRequestActor<TCopyTablesRPC, TEvCopyTablesRequest> {
+ using TBase = TRpcSchemeRequestActor<TCopyTablesRPC, TEvCopyTablesRequest>;
+
+public:
+ TCopyTablesRPC(TEvCopyTablesRequest* msg)
+ : TBase(msg) {}
+
+ void Bootstrap(const TActorContext &ctx) {
+ TBase::Bootstrap(ctx);
+
+ SendProposeRequest(ctx);
+ Become(&TCopyTablesRPC::StateWork);
+ }
+
+private:
+ void SendProposeRequest(const TActorContext &ctx) {
std::unique_ptr<TEvTxUserProxy::TEvProposeTransaction> proposeRequest = CreateProposeTransaction();
- NKikimrTxUserProxy::TEvProposeTransaction& record = proposeRequest->Record;
- NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
- modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateConsistentCopyTables);
- auto copy = modifyScheme->MutableCreateConsistentCopyTables();
-
+ NKikimrTxUserProxy::TEvProposeTransaction& record = proposeRequest->Record;
+ NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
+ modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateConsistentCopyTables);
+ auto copy = modifyScheme->MutableCreateConsistentCopyTables();
+
const auto req = GetProtoRequest();
- for (const auto& item: req->tables()) {
- auto description = copy->AddCopyTableDescriptions();
- description->SetSrcPath(item.source_path());
- description->SetDstPath(item.destination_path());
- description->SetOmitIndexes(item.omit_indexes());
- }
-
- ctx.Send(MakeTxProxyID(), proposeRequest.release());
- }
-};
-
-void TGRpcRequestProxy::Handle(TEvCopyTablesRequest::TPtr& ev, const TActorContext& ctx) {
- ctx.Register(new TCopyTablesRPC(ev->Release().Release()));
-}
-
-} // namespace NKikimr
-} // namespace NGRpcService
+ for (const auto& item: req->tables()) {
+ auto description = copy->AddCopyTableDescriptions();
+ description->SetSrcPath(item.source_path());
+ description->SetDstPath(item.destination_path());
+ description->SetOmitIndexes(item.omit_indexes());
+ }
+
+ ctx.Send(MakeTxProxyID(), proposeRequest.release());
+ }
+};
+
+void TGRpcRequestProxy::Handle(TEvCopyTablesRequest::TPtr& ev, const TActorContext& ctx) {
+ ctx.Register(new TCopyTablesRPC(ev->Release().Release()));
+}
+
+} // namespace NKikimr
+} // namespace NGRpcService
diff --git a/ydb/core/grpc_services/rpc_create_coordination_node.cpp b/ydb/core/grpc_services/rpc_create_coordination_node.cpp
index 52a84540137..11c838592ca 100644
--- a/ydb/core/grpc_services/rpc_create_coordination_node.cpp
+++ b/ydb/core/grpc_services/rpc_create_coordination_node.cpp
@@ -40,9 +40,9 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvProposeTransaction> proposeRequest = CreateProposeTransaction();
NKikimrTxUserProxy::TEvProposeTransaction& record = proposeRequest->Record;
- NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
+ NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
modifyScheme->SetWorkingDir(workingDir);
- modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateKesus);
+ modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateKesus);
auto kesus = modifyScheme->MutableKesus();
kesus->SetName(name);
kesus->MutableConfig()->CopyFrom(req->config());
diff --git a/ydb/core/grpc_services/rpc_create_table.cpp b/ydb/core/grpc_services/rpc_create_table.cpp
index 93edbbce0e3..302dfde57a8 100644
--- a/ydb/core/grpc_services/rpc_create_table.cpp
+++ b/ydb/core/grpc_services/rpc_create_table.cpp
@@ -15,7 +15,7 @@
namespace NKikimr {
namespace NGRpcService {
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NActors;
using namespace NConsole;
using namespace Ydb;
@@ -54,7 +54,7 @@ private:
void Handle(TEvents::TEvUndelivered::TPtr &/*ev*/, const TActorContext &ctx)
{
- LOG_CRIT_S(ctx, NKikimrServices::GRPC_PROXY,
+ LOG_CRIT_S(ctx, NKikimrServices::GRPC_PROXY,
"TCreateTableRPC: cannot deliver config request to Configs Dispatcher"
" (empty default profile is available only)");
SendProposeRequest(ctx);
@@ -72,7 +72,7 @@ private:
void HandleWakeup(TEvents::TEvWakeup::TPtr &ev, const TActorContext &ctx) {
switch (ev->Get()->Tag) {
case WakeupTagGetConfig: {
- LOG_CRIT_S(ctx, NKikimrServices::GRPC_PROXY, "TCreateTableRPC: cannot get table profiles (timeout)");
+ LOG_CRIT_S(ctx, NKikimrServices::GRPC_PROXY, "TCreateTableRPC: cannot get table profiles (timeout)");
NYql::TIssues issues;
issues.AddIssue(NYql::TIssue("Tables profiles config not available."));
return Reply(StatusIds::UNAVAILABLE, issues, ctx);
@@ -124,14 +124,14 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvProposeTransaction> proposeRequest = CreateProposeTransaction();
NKikimrTxUserProxy::TEvProposeTransaction& record = proposeRequest->Record;
- NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
+ NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
modifyScheme->SetWorkingDir(workingDir);
- NKikimrSchemeOp::TTableDescription* tableDesc = nullptr;
+ NKikimrSchemeOp::TTableDescription* tableDesc = nullptr;
if (req->indexesSize()) {
- modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexedTable);
+ modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexedTable);
tableDesc = modifyScheme->MutableCreateIndexedTable()->MutableTableDescription();
} else {
- modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
+ modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
tableDesc = modifyScheme->MutableCreateTable();
}
diff --git a/ydb/core/grpc_services/rpc_describe_coordination_node.cpp b/ydb/core/grpc_services/rpc_describe_coordination_node.cpp
index 414bd13fe34..04c16bf32e8 100644
--- a/ydb/core/grpc_services/rpc_describe_coordination_node.cpp
+++ b/ydb/core/grpc_services/rpc_describe_coordination_node.cpp
@@ -31,20 +31,20 @@ public:
private:
void StateWork(TAutoPtr<IEventHandle>& ev, const TActorContext& ctx) {
switch (ev->GetTypeRewrite()) {
- HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
default: TBase::StateWork(ev, ctx);
}
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev, const TActorContext& ctx) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev, const TActorContext& ctx) {
const auto& record = ev->Get()->GetRecord();
const auto status = record.GetStatus();
switch (status) {
- case NKikimrScheme::StatusSuccess: {
+ case NKikimrScheme::StatusSuccess: {
const auto& pathDescription = record.GetPathDescription();
const auto pathType = pathDescription.GetSelf().GetPathType();
- if (pathType != NKikimrSchemeOp::EPathTypeKesus) {
+ if (pathType != NKikimrSchemeOp::EPathTypeKesus) {
return Reply(Ydb::StatusIds::SCHEME_ERROR, ctx);
}
@@ -64,14 +64,14 @@ private:
return ReplyWithResult(Ydb::StatusIds::SUCCESS, result, ctx);
}
- case NKikimrScheme::StatusPathDoesNotExist:
- case NKikimrScheme::StatusSchemeError: {
+ case NKikimrScheme::StatusPathDoesNotExist:
+ case NKikimrScheme::StatusSchemeError: {
return Reply(Ydb::StatusIds::SCHEME_ERROR, ctx);
}
- case NKikimrScheme::StatusAccessDenied: {
+ case NKikimrScheme::StatusAccessDenied: {
return Reply(Ydb::StatusIds::UNAUTHORIZED, ctx);
}
- case NKikimrScheme::StatusNotAvailable: {
+ case NKikimrScheme::StatusNotAvailable: {
return Reply(Ydb::StatusIds::UNAVAILABLE, ctx);
}
default: {
@@ -86,7 +86,7 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvNavigate> navigateRequest(new TEvTxUserProxy::TEvNavigate());
SetAuthToken(navigateRequest, *Request_);
SetDatabase(navigateRequest.get(), *Request_);
- NKikimrSchemeOp::TDescribePath* record = navigateRequest->Record.MutableDescribePath();
+ NKikimrSchemeOp::TDescribePath* record = navigateRequest->Record.MutableDescribePath();
record->SetPath(req->path());
ctx.Send(MakeTxProxyID(), navigateRequest.release());
diff --git a/ydb/core/grpc_services/rpc_describe_path.cpp b/ydb/core/grpc_services/rpc_describe_path.cpp
index 8535d9a9824..7960f50779b 100644
--- a/ydb/core/grpc_services/rpc_describe_path.cpp
+++ b/ydb/core/grpc_services/rpc_describe_path.cpp
@@ -41,7 +41,7 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvNavigate> navigateRequest(new TEvTxUserProxy::TEvNavigate());
SetAuthToken(navigateRequest, *this->Request_);
SetDatabase(navigateRequest.get(), *this->Request_);
- NKikimrSchemeOp::TDescribePath* record = navigateRequest->Record.MutableDescribePath();
+ NKikimrSchemeOp::TDescribePath* record = navigateRequest->Record.MutableDescribePath();
record->SetPath(req->path());
ctx.Send(MakeTxProxyID(), navigateRequest.release());
@@ -49,12 +49,12 @@ private:
void StateWork(TAutoPtr<IEventHandle>& ev, const TActorContext& ctx) {
switch (ev->GetTypeRewrite()) {
- HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
default: TBase::StateWork(ev, ctx);
}
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev, const TActorContext& ctx) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev, const TActorContext& ctx) {
const auto& record = ev->Get()->GetRecord();
const auto status = record.GetStatus();
@@ -65,7 +65,7 @@ private:
TResult result;
switch (status) {
- case NKikimrScheme::StatusSuccess: {
+ case NKikimrScheme::StatusSuccess: {
const auto& pathDescription = record.GetPathDescription();
ConvertDirectoryEntry(pathDescription, result.mutable_self(), true);
if constexpr (ListChildren) {
@@ -75,14 +75,14 @@ private:
}
return this->ReplyWithResult(Ydb::StatusIds::SUCCESS, result, ctx);
}
- case NKikimrScheme::StatusPathDoesNotExist:
- case NKikimrScheme::StatusSchemeError: {
+ case NKikimrScheme::StatusPathDoesNotExist:
+ case NKikimrScheme::StatusSchemeError: {
return this->Reply(Ydb::StatusIds::SCHEME_ERROR, ctx);
}
- case NKikimrScheme::StatusAccessDenied: {
+ case NKikimrScheme::StatusAccessDenied: {
return this->Reply(Ydb::StatusIds::UNAUTHORIZED, ctx);
}
- case NKikimrScheme::StatusNotAvailable: {
+ case NKikimrScheme::StatusNotAvailable: {
return this->Reply(Ydb::StatusIds::UNAVAILABLE, ctx);
}
default: {
diff --git a/ydb/core/grpc_services/rpc_describe_table.cpp b/ydb/core/grpc_services/rpc_describe_table.cpp
index dc2a67566ef..261f10d4676 100644
--- a/ydb/core/grpc_services/rpc_describe_table.cpp
+++ b/ydb/core/grpc_services/rpc_describe_table.cpp
@@ -31,12 +31,12 @@ public:
private:
void StateWork(TAutoPtr<IEventHandle>& ev, const TActorContext& ctx) {
switch (ev->GetTypeRewrite()) {
- HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
default: TBase::StateWork(ev, ctx);
}
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev, const TActorContext& ctx) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev, const TActorContext& ctx) {
const auto& record = ev->Get()->GetRecord();
const auto status = record.GetStatus();
if (record.HasReason()) {
@@ -45,7 +45,7 @@ private:
}
Ydb::Table::DescribeTableResult describeTableResult;
switch (status) {
- case NKikimrScheme::StatusSuccess: {
+ case NKikimrScheme::StatusSuccess: {
const auto& pathDescription = record.GetPathDescription();
Ydb::Scheme::Entry* selfEntry = describeTableResult.mutable_self();
selfEntry->set_name(pathDescription.GetSelf().GetName());
@@ -90,16 +90,16 @@ private:
return ReplyWithResult(Ydb::StatusIds::SUCCESS, describeTableResult, ctx);
}
- case NKikimrScheme::StatusPathDoesNotExist:
- case NKikimrScheme::StatusSchemeError: {
+ case NKikimrScheme::StatusPathDoesNotExist:
+ case NKikimrScheme::StatusSchemeError: {
return Reply(Ydb::StatusIds::SCHEME_ERROR, ctx);
}
- case NKikimrScheme::StatusAccessDenied: {
+ case NKikimrScheme::StatusAccessDenied: {
return Reply(Ydb::StatusIds::UNAUTHORIZED, ctx);
}
- case NKikimrScheme::StatusNotAvailable: {
+ case NKikimrScheme::StatusNotAvailable: {
return Reply(Ydb::StatusIds::UNAVAILABLE, ctx);
}
@@ -115,7 +115,7 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvNavigate> navigateRequest(new TEvTxUserProxy::TEvNavigate());
SetAuthToken(navigateRequest, *Request_);
SetDatabase(navigateRequest.get(), *Request_);
- NKikimrSchemeOp::TDescribePath* record = navigateRequest->Record.MutableDescribePath();
+ NKikimrSchemeOp::TDescribePath* record = navigateRequest->Record.MutableDescribePath();
record->SetPath(req->path());
if (req->include_shard_key_bounds()) {
record->MutableOptions()->SetReturnBoundaries(true);
diff --git a/ydb/core/grpc_services/rpc_describe_table_options.cpp b/ydb/core/grpc_services/rpc_describe_table_options.cpp
index 7e174953e4d..6d77e3cff71 100644
--- a/ydb/core/grpc_services/rpc_describe_table_options.cpp
+++ b/ydb/core/grpc_services/rpc_describe_table_options.cpp
@@ -11,7 +11,7 @@
namespace NKikimr {
namespace NGRpcService {
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NActors;
using namespace NConsole;
using namespace Ydb;
@@ -50,7 +50,7 @@ private:
void Handle(TEvents::TEvUndelivered::TPtr &/*ev*/, const TActorContext &ctx)
{
- LOG_CRIT_S(ctx, NKikimrServices::GRPC_PROXY,
+ LOG_CRIT_S(ctx, NKikimrServices::GRPC_PROXY,
"TDescribeTableOptionsRPC: cannot deliver config request to Configs Dispatcher");
NYql::TIssues issues;
issues.AddIssue(NYql::TIssue("Cannot get table profiles (service unavailable)"));
@@ -103,7 +103,7 @@ private:
for (size_t i = 0; i < pr.second.ColumnFamiliesSize(); ++i) {
auto &family = pr.second.GetColumnFamilies(i);
if (family.GetId() == 0) {
- if (family.GetColumnCache() == NKikimrSchemeOp::ColumnCacheEver)
+ if (family.GetColumnCache() == NKikimrSchemeOp::ColumnCacheEver)
labels["in_memory"] = "true";
else
labels["in_memory"] = "false";
@@ -119,7 +119,7 @@ private:
labels["medium_threshold"] = ToString(family.GetStorageConfig().GetDataThreshold());
if (family.GetStorageConfig().GetExternalThreshold())
labels["external_threshold"] = ToString(family.GetStorageConfig().GetExternalThreshold());
- if (family.GetColumnCodec() == NKikimrSchemeOp::ColumnCodecLZ4)
+ if (family.GetColumnCodec() == NKikimrSchemeOp::ColumnCodecLZ4)
labels["codec"] = "lz4";
else
labels["codec"] = "none";
@@ -179,7 +179,7 @@ private:
void HandleWakeup(TEvents::TEvWakeup::TPtr &ev, const TActorContext &ctx) {
switch (ev->Get()->Tag) {
case WakeupTagGetConfig: {
- LOG_CRIT_S(ctx, NKikimrServices::GRPC_PROXY,
+ LOG_CRIT_S(ctx, NKikimrServices::GRPC_PROXY,
"TDescribeTableOptionsRPC: cannot get table profiles (timeout)");
NYql::TIssues issues;
issues.AddIssue(NYql::TIssue("Tables profiles config not available."));
diff --git a/ydb/core/grpc_services/rpc_discovery.cpp b/ydb/core/grpc_services/rpc_discovery.cpp
index 32694091127..75550f92acf 100644
--- a/ydb/core/grpc_services/rpc_discovery.cpp
+++ b/ydb/core/grpc_services/rpc_discovery.cpp
@@ -199,10 +199,10 @@ public:
Y_VERIFY(navigate->ResultSet.size() == 1);
const auto &entry = navigate->ResultSet.front();
- LOG_TRACE_S(*TlsActivationContext, NKikimrServices::GRPC_PROXY,
- "TListEndpointsRPC: handle TEvNavigateKeySetResult"
+ LOG_TRACE_S(*TlsActivationContext, NKikimrServices::GRPC_PROXY,
+ "TListEndpointsRPC: handle TEvNavigateKeySetResult"
<< ", entry: " << entry.ToString());
-
+
if (navigate->ErrorCount > 0) {
switch (entry.Status) {
case NSchemeCache::TSchemeCacheNavigate::EStatus::PathErrorUnknown:
@@ -216,10 +216,10 @@ public:
}
default:
{
- LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::GRPC_PROXY,
- "TListEndpointsRPC: GENERIC_RESOLVE_ERROR"
+ LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::GRPC_PROXY,
+ "TListEndpointsRPC: GENERIC_RESOLVE_ERROR"
<< ", entry: " << entry.ToString());
-
+
auto issue = MakeIssue(NKikimrIssues::TIssuesIds::GENERIC_RESOLVE_ERROR, "Database resolve failed with no certain result");
google::protobuf::RepeatedPtrField<TYdbIssueMessageType> issueMessages;
NYql::IssueToMessage(issue, issueMessages.Add());
@@ -284,14 +284,14 @@ public:
if (RequestScheme) {
// check presence of database (acl should be checked here too)
const auto &entry = SchemeCacheResponse->Request->ResultSet.front();
- if (entry.Path.size() != 1
- && (entry.Kind != NSchemeCache::TSchemeCacheNavigate::KindSubdomain && entry.Kind != NSchemeCache::TSchemeCacheNavigate::KindExtSubdomain))
- {
- LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::GRPC_PROXY,
- "TListEndpointsRPC: SchemeCacheResponse path is not a database"
- << ", entry.Path: " << CanonizePath(entry.Path)
- << ", entry.Kind: " << (ui64)entry.Kind);
-
+ if (entry.Path.size() != 1
+ && (entry.Kind != NSchemeCache::TSchemeCacheNavigate::KindSubdomain && entry.Kind != NSchemeCache::TSchemeCacheNavigate::KindExtSubdomain))
+ {
+ LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::GRPC_PROXY,
+ "TListEndpointsRPC: SchemeCacheResponse path is not a database"
+ << ", entry.Path: " << CanonizePath(entry.Path)
+ << ", entry.Kind: " << (ui64)entry.Kind);
+
auto issue = MakeIssue(NKikimrIssues::TIssuesIds::ACCESS_DENIED, "Requested path is not database name");
google::protobuf::RepeatedPtrField<TYdbIssueMessageType> issueMessages;
NYql::IssueToMessage(issue, issueMessages.Add());
@@ -301,11 +301,11 @@ public:
}
if (LookupResponse->Status != TEvStateStorage::TEvBoardInfo::EStatus::Ok) {
- LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::GRPC_PROXY,
- "TListEndpointsRPC: LookupResponse in not OK"
- << ", LookupResponse->Status: " << ui64(LookupResponse->Status));
-
- auto issue = MakeIssue(NKikimrIssues::TIssuesIds::GENERIC_RESOLVE_ERROR, "Database nodes resolve failed with no certain result");
+ LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::GRPC_PROXY,
+ "TListEndpointsRPC: LookupResponse in not OK"
+ << ", LookupResponse->Status: " << ui64(LookupResponse->Status));
+
+ auto issue = MakeIssue(NKikimrIssues::TIssuesIds::GENERIC_RESOLVE_ERROR, "Database nodes resolve failed with no certain result");
google::protobuf::RepeatedPtrField<TYdbIssueMessageType> issueMessages;
NYql::IssueToMessage(issue, issueMessages.Add());
Request->SendResult(Ydb::StatusIds::UNAVAILABLE, issueMessages);
diff --git a/ydb/core/grpc_services/rpc_drop_coordination_node.cpp b/ydb/core/grpc_services/rpc_drop_coordination_node.cpp
index db48ef491b6..3632ec58723 100644
--- a/ydb/core/grpc_services/rpc_drop_coordination_node.cpp
+++ b/ydb/core/grpc_services/rpc_drop_coordination_node.cpp
@@ -40,9 +40,9 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvProposeTransaction> proposeRequest = CreateProposeTransaction();
NKikimrTxUserProxy::TEvProposeTransaction& record = proposeRequest->Record;
- NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
+ NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
modifyScheme->SetWorkingDir(workingDir);
- modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropKesus);
+ modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropKesus);
auto drop = modifyScheme->MutableDrop();
drop->SetName(name);
ctx.Send(MakeTxProxyID(), proposeRequest.release());
diff --git a/ydb/core/grpc_services/rpc_drop_table.cpp b/ydb/core/grpc_services/rpc_drop_table.cpp
index ab2a3b311ad..27899a9d773 100644
--- a/ydb/core/grpc_services/rpc_drop_table.cpp
+++ b/ydb/core/grpc_services/rpc_drop_table.cpp
@@ -40,9 +40,9 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvProposeTransaction> proposeRequest = CreateProposeTransaction();
NKikimrTxUserProxy::TEvProposeTransaction& record = proposeRequest->Record;
- NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
+ NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
modifyScheme->SetWorkingDir(workingDir);
- modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
+ modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
auto drop = modifyScheme->MutableDrop();
drop->SetName(name);
ctx.Send(MakeTxProxyID(), proposeRequest.release());
diff --git a/ydb/core/grpc_services/rpc_export.cpp b/ydb/core/grpc_services/rpc_export.cpp
index 6d58a1c8c22..f0fa7be3dfe 100644
--- a/ydb/core/grpc_services/rpc_export.cpp
+++ b/ydb/core/grpc_services/rpc_export.cpp
@@ -14,7 +14,7 @@ namespace NKikimr {
namespace NGRpcService {
using namespace NActors;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NKikimrIssues;
using namespace Ydb;
diff --git a/ydb/core/grpc_services/rpc_forget_operation.cpp b/ydb/core/grpc_services/rpc_forget_operation.cpp
index 0689773f62f..8b250125cac 100644
--- a/ydb/core/grpc_services/rpc_forget_operation.cpp
+++ b/ydb/core/grpc_services/rpc_forget_operation.cpp
@@ -14,7 +14,7 @@ namespace NKikimr {
namespace NGRpcService {
using namespace NActors;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NKikimrIssues;
using namespace NOperationId;
using namespace Ydb;
diff --git a/ydb/core/grpc_services/rpc_get_operation.cpp b/ydb/core/grpc_services/rpc_get_operation.cpp
index e2b06b48d8a..6f7a1406863 100644
--- a/ydb/core/grpc_services/rpc_get_operation.cpp
+++ b/ydb/core/grpc_services/rpc_get_operation.cpp
@@ -46,11 +46,11 @@ class TGetOperationRPC : public TRpcOperationRequestActor<TGetOperationRPC, TEvG
IEventBase* MakeRequest() override {
switch (OperationId_.GetKind()) {
case TOperationId::EXPORT:
- return new NSchemeShard::TEvExport::TEvGetExportRequest(DatabaseName, RawOperationId_);
+ return new NSchemeShard::TEvExport::TEvGetExportRequest(DatabaseName, RawOperationId_);
case TOperationId::IMPORT:
- return new NSchemeShard::TEvImport::TEvGetImportRequest(DatabaseName, RawOperationId_);
+ return new NSchemeShard::TEvImport::TEvGetImportRequest(DatabaseName, RawOperationId_);
case TOperationId::BUILD_INDEX:
- return new NSchemeShard::TEvIndexBuilder::TEvGetRequest(DatabaseName, RawOperationId_);
+ return new NSchemeShard::TEvIndexBuilder::TEvGetRequest(DatabaseName, RawOperationId_);
default:
Y_FAIL("unreachable");
}
@@ -99,23 +99,23 @@ public:
STFUNC(AwaitState) {
switch (ev->GetTypeRewrite()) {
HFunc(TEvTxUserProxy::TEvProposeTransactionStatus, HandleResponse);
- HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult, Handle);
- HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered, Handle);
HFunc(NConsole::TEvConsole::TEvGetOperationResponse, Handle);
- HFunc(NSchemeShard::TEvExport::TEvGetExportResponse, Handle);
- HFunc(NSchemeShard::TEvImport::TEvGetImportResponse, Handle);
- HFunc(NSchemeShard::TEvIndexBuilder::TEvGetResponse, Handle);
+ HFunc(NSchemeShard::TEvExport::TEvGetExportResponse, Handle);
+ HFunc(NSchemeShard::TEvImport::TEvGetImportResponse, Handle);
+ HFunc(NSchemeShard::TEvIndexBuilder::TEvGetResponse, Handle);
default:
return StateBase(ev, TlsActivationContext->AsActorContext());
}
}
private:
- void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered::TPtr&, const TActorContext& ctx) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered::TPtr&, const TActorContext& ctx) {
ReplyGetOperationResponse(false, ctx);
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr&, const TActorContext& ctx) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr&, const TActorContext& ctx) {
ReplyGetOperationResponse(true, ctx);
}
@@ -179,12 +179,12 @@ private:
Y_VERIFY(pipeActor);
PipeActorId_ = ctx.ExecutorThread.RegisterActor(pipeActor);
- auto request = MakeHolder<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion>();
+ auto request = MakeHolder<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion>();
request->Record.SetTxId(txId);
NTabletPipe::SendData(ctx, PipeActorId_, request.Release());
}
- void Handle(NSchemeShard::TEvExport::TEvGetExportResponse::TPtr& ev, const TActorContext& ctx) {
+ void Handle(NSchemeShard::TEvExport::TEvGetExportResponse::TPtr& ev, const TActorContext& ctx) {
const auto& record = ev->Get()->Record.GetResponse();
LOG_D("Handle TEvExport::TEvGetExportResponse"
@@ -195,7 +195,7 @@ private:
Reply(resp, ctx);
}
- void Handle(NSchemeShard::TEvImport::TEvGetImportResponse::TPtr& ev, const TActorContext& ctx) {
+ void Handle(NSchemeShard::TEvImport::TEvGetImportResponse::TPtr& ev, const TActorContext& ctx) {
const auto& record = ev->Get()->Record.GetResponse();
LOG_D("Handle TEvImport::TEvGetImportResponse"
@@ -206,8 +206,8 @@ private:
Reply(resp, ctx);
}
- void Handle(NSchemeShard::TEvIndexBuilder::TEvGetResponse::TPtr& ev, const TActorContext& ctx) {
- const auto& record = ev->Get()->Record;
+ void Handle(NSchemeShard::TEvIndexBuilder::TEvGetResponse::TPtr& ev, const TActorContext& ctx) {
+ const auto& record = ev->Get()->Record;
LOG_D("Handle TEvIndexBuilder::TEvGetResponse"
<< ": record# " << record.ShortDebugString());
diff --git a/ydb/core/grpc_services/rpc_import.cpp b/ydb/core/grpc_services/rpc_import.cpp
index 4fec35b0c59..83eff924039 100644
--- a/ydb/core/grpc_services/rpc_import.cpp
+++ b/ydb/core/grpc_services/rpc_import.cpp
@@ -14,7 +14,7 @@ namespace NKikimr {
namespace NGRpcService {
using namespace NActors;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NKikimrIssues;
using namespace Ydb;
diff --git a/ydb/core/grpc_services/rpc_list_operations.cpp b/ydb/core/grpc_services/rpc_list_operations.cpp
index 4696e54f4b6..a905efd8d6f 100644
--- a/ydb/core/grpc_services/rpc_list_operations.cpp
+++ b/ydb/core/grpc_services/rpc_list_operations.cpp
@@ -16,7 +16,7 @@ namespace NKikimr {
namespace NGRpcService {
using namespace NActors;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NKikimrIssues;
using namespace NOperationId;
using namespace Ydb;
diff --git a/ydb/core/grpc_services/rpc_log_store.cpp b/ydb/core/grpc_services/rpc_log_store.cpp
index e5284f7e008..d77f7c7cc01 100644
--- a/ydb/core/grpc_services/rpc_log_store.cpp
+++ b/ydb/core/grpc_services/rpc_log_store.cpp
@@ -120,7 +120,7 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvProposeTransaction> proposeRequest = CreateProposeTransaction();
NKikimrTxUserProxy::TEvProposeTransaction& record = proposeRequest->Record;
- NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
+ NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
modifyScheme->SetWorkingDir(workingDir);
modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateColumnStore);
auto create = modifyScheme->MutableCreateColumnStore();
@@ -155,12 +155,12 @@ public:
private:
void StateWork(TAutoPtr<IEventHandle>& ev, const TActorContext& ctx) {
switch (ev->GetTypeRewrite()) {
- HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
default: TBase::StateWork(ev, ctx);
}
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev, const TActorContext& ctx) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev, const TActorContext& ctx) {
const auto& record = ev->Get()->GetRecord();
const auto status = record.GetStatus();
if (record.HasReason()) {
@@ -169,7 +169,7 @@ private:
}
Ydb::LogStore::DescribeLogStoreResult describeLogStoreResult;
switch (status) {
- case NKikimrScheme::StatusSuccess: {
+ case NKikimrScheme::StatusSuccess: {
const auto& pathDescription = record.GetPathDescription();
Ydb::Scheme::Entry* selfEntry = describeLogStoreResult.mutable_self();
selfEntry->set_name(pathDescription.GetSelf().GetName());
@@ -193,16 +193,16 @@ private:
return ReplyWithResult(Ydb::StatusIds::SUCCESS, describeLogStoreResult, ctx);
}
- case NKikimrScheme::StatusPathDoesNotExist:
- case NKikimrScheme::StatusSchemeError: {
+ case NKikimrScheme::StatusPathDoesNotExist:
+ case NKikimrScheme::StatusSchemeError: {
return Reply(Ydb::StatusIds::SCHEME_ERROR, ctx);
}
- case NKikimrScheme::StatusAccessDenied: {
+ case NKikimrScheme::StatusAccessDenied: {
return Reply(Ydb::StatusIds::UNAUTHORIZED, ctx);
}
- case NKikimrScheme::StatusNotAvailable: {
+ case NKikimrScheme::StatusNotAvailable: {
return Reply(Ydb::StatusIds::UNAVAILABLE, ctx);
}
@@ -218,14 +218,14 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvNavigate> navigateRequest(new TEvTxUserProxy::TEvNavigate());
SetAuthToken(navigateRequest, *Request_);
SetDatabase(navigateRequest.get(), *Request_);
- NKikimrSchemeOp::TDescribePath* record = navigateRequest->Record.MutableDescribePath();
+ NKikimrSchemeOp::TDescribePath* record = navigateRequest->Record.MutableDescribePath();
record->SetPath(req->path());
ctx.Send(MakeTxProxyID(), navigateRequest.release());
}
};
-template <class TEv, NKikimrSchemeOp::EOperationType EOpType>
+template <class TEv, NKikimrSchemeOp::EOperationType EOpType>
class TDropLogRPC : public TRpcSchemeRequestActor<TDropLogRPC<TEv, EOpType>, TEv> {
using TSelf = TDropLogRPC<TEv, EOpType>;
using TBase = TRpcSchemeRequestActor<TSelf, TEv>;
@@ -257,7 +257,7 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvProposeTransaction> proposeRequest = this->CreateProposeTransaction();
NKikimrTxUserProxy::TEvProposeTransaction& record = proposeRequest->Record;
- NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
+ NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
modifyScheme->SetWorkingDir(workingDir);
modifyScheme->SetOperationType(EOpType);
auto drop = modifyScheme->MutableDrop();
@@ -309,7 +309,7 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvProposeTransaction> proposeRequest = CreateProposeTransaction();
NKikimrTxUserProxy::TEvProposeTransaction& record = proposeRequest->Record;
- NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
+ NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
modifyScheme->SetWorkingDir(workingDir);
modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateColumnTable);
auto create = modifyScheme->MutableCreateColumnTable();
@@ -355,12 +355,12 @@ public:
private:
void StateWork(TAutoPtr<IEventHandle>& ev, const TActorContext& ctx) {
switch (ev->GetTypeRewrite()) {
- HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
default: TBase::StateWork(ev, ctx);
}
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev, const TActorContext& ctx) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev, const TActorContext& ctx) {
const auto& record = ev->Get()->GetRecord();
const auto status = record.GetStatus();
if (record.HasReason()) {
@@ -369,7 +369,7 @@ private:
}
Ydb::LogStore::DescribeLogTableResult describeLogTableResult;
switch (status) {
- case NKikimrScheme::StatusSuccess: {
+ case NKikimrScheme::StatusSuccess: {
const auto& pathDescription = record.GetPathDescription();
Ydb::Scheme::Entry* selfEntry = describeLogTableResult.mutable_self();
selfEntry->set_name(pathDescription.GetSelf().GetName());
@@ -394,17 +394,17 @@ private:
const auto& inTTL = tableDescription.GetTtlSettings().GetEnabled();
switch (inTTL.GetColumnUnit()) {
- case NKikimrSchemeOp::TTTLSettings::UNIT_AUTO: {
+ case NKikimrSchemeOp::TTTLSettings::UNIT_AUTO: {
auto& outTTL = *describeLogTableResult.mutable_ttl_settings()->mutable_date_type_column();
outTTL.set_column_name(inTTL.GetColumnName());
outTTL.set_expire_after_seconds(inTTL.GetExpireAfterSeconds());
break;
}
- case NKikimrSchemeOp::TTTLSettings::UNIT_SECONDS:
- case NKikimrSchemeOp::TTTLSettings::UNIT_MILLISECONDS:
- case NKikimrSchemeOp::TTTLSettings::UNIT_MICROSECONDS:
- case NKikimrSchemeOp::TTTLSettings::UNIT_NANOSECONDS: {
+ case NKikimrSchemeOp::TTTLSettings::UNIT_SECONDS:
+ case NKikimrSchemeOp::TTTLSettings::UNIT_MILLISECONDS:
+ case NKikimrSchemeOp::TTTLSettings::UNIT_MICROSECONDS:
+ case NKikimrSchemeOp::TTTLSettings::UNIT_NANOSECONDS: {
auto& outTTL = *describeLogTableResult.mutable_ttl_settings()->mutable_value_since_unix_epoch();
outTTL.set_column_name(inTTL.GetColumnName());
outTTL.set_column_unit(static_cast<Ydb::Table::ValueSinceUnixEpochModeSettings::Unit>(inTTL.GetColumnUnit()));
@@ -420,16 +420,16 @@ private:
return ReplyWithResult(Ydb::StatusIds::SUCCESS, describeLogTableResult, ctx);
}
- case NKikimrScheme::StatusPathDoesNotExist:
- case NKikimrScheme::StatusSchemeError: {
+ case NKikimrScheme::StatusPathDoesNotExist:
+ case NKikimrScheme::StatusSchemeError: {
return Reply(Ydb::StatusIds::SCHEME_ERROR, ctx);
}
- case NKikimrScheme::StatusAccessDenied: {
+ case NKikimrScheme::StatusAccessDenied: {
return Reply(Ydb::StatusIds::UNAUTHORIZED, ctx);
}
- case NKikimrScheme::StatusNotAvailable: {
+ case NKikimrScheme::StatusNotAvailable: {
return Reply(Ydb::StatusIds::UNAVAILABLE, ctx);
}
@@ -445,7 +445,7 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvNavigate> navigateRequest(new TEvTxUserProxy::TEvNavigate());
SetAuthToken(navigateRequest, *Request_);
SetDatabase(navigateRequest.get(), *Request_);
- NKikimrSchemeOp::TDescribePath* record = navigateRequest->Record.MutableDescribePath();
+ NKikimrSchemeOp::TDescribePath* record = navigateRequest->Record.MutableDescribePath();
record->SetPath(req->path());
ctx.Send(MakeTxProxyID(), navigateRequest.release());
@@ -487,7 +487,7 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvProposeTransaction> proposeRequest = CreateProposeTransaction();
NKikimrTxUserProxy::TEvProposeTransaction& record = proposeRequest->Record;
- NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
+ NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
modifyScheme->SetWorkingDir(workingDir);
modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterColumnTable);
auto alter = modifyScheme->MutableAlterColumnTable();
diff --git a/ydb/core/grpc_services/rpc_login.cpp b/ydb/core/grpc_services/rpc_login.cpp
index 128361809d9..9815aeac99b 100644
--- a/ydb/core/grpc_services/rpc_login.cpp
+++ b/ydb/core/grpc_services/rpc_login.cpp
@@ -10,13 +10,13 @@
namespace NKikimr {
namespace NGRpcService {
-using namespace NSchemeShard;
+using namespace NSchemeShard;
class TLoginRPC : public TRpcRequestActor<TLoginRPC, TEvLoginRequest> {
public:
using TRpcRequestActor::TRpcRequestActor;
- THolder<TEvSchemeShard::TEvLoginResult> Result;
+ THolder<TEvSchemeShard::TEvLoginResult> Result;
Ydb::StatusIds_StatusCode Status = Ydb::StatusIds::SUCCESS;
TDuration Timeout = TDuration::MilliSeconds(60000);
TActorId PipeClient;
@@ -53,7 +53,7 @@ public:
ui64 schemeShardTabletId = entry.DomainInfo->ExtractSchemeShard();
IActor* pipe = NTabletPipe::CreateClient(SelfId(), schemeShardTabletId, GetPipeClientConfig());
PipeClient = RegisterWithSameMailbox(pipe);
- THolder<TEvSchemeShard::TEvLogin> request = MakeHolder<TEvSchemeShard::TEvLogin>();
+ THolder<TEvSchemeShard::TEvLogin> request = MakeHolder<TEvSchemeShard::TEvLogin>();
const Ydb::Auth::LoginRequest* protoRequest = Request->GetProtoRequest();
request.Get()->Record.SetUser(protoRequest->user());
request.Get()->Record.SetPassword(protoRequest->password());
@@ -64,7 +64,7 @@ public:
ReplyAndPassAway();
}
- void HandleResult(TEvSchemeShard::TEvLoginResult::TPtr& ev) {
+ void HandleResult(TEvSchemeShard::TEvLoginResult::TPtr& ev) {
Status = Ydb::StatusIds::SUCCESS;
Result = ev->Release();
ReplyAndPassAway();
@@ -87,7 +87,7 @@ public:
hFunc(TEvents::TEvUndelivered, HandleUndelivered);
hFunc(TEvTabletPipe::TEvClientConnected, HandleConnect);
hFunc(TEvTxProxySchemeCache::TEvNavigateKeySetResult, HandleNavigate);
- hFunc(TEvSchemeShard::TEvLoginResult, HandleResult);
+ hFunc(TEvSchemeShard::TEvLoginResult, HandleResult);
cFunc(TEvents::TSystem::Wakeup, HandleTimeout);
}
}
@@ -99,7 +99,7 @@ public:
TResponse response;
Ydb::Operations::Operation& operation = *response.mutable_operation();
if (Result) {
- const NKikimrScheme::TEvLoginResult& record = Result->Record;
+ const NKikimrScheme::TEvLoginResult& record = Result->Record;
if (record.error()) {
Ydb::Issue::IssueMessage* issue = operation.add_issues();
issue->set_message(record.error());
diff --git a/ydb/core/grpc_services/rpc_make_directory.cpp b/ydb/core/grpc_services/rpc_make_directory.cpp
index 7765556ee16..f6e6b2d0cd5 100644
--- a/ydb/core/grpc_services/rpc_make_directory.cpp
+++ b/ydb/core/grpc_services/rpc_make_directory.cpp
@@ -45,9 +45,9 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvProposeTransaction> proposeRequest = CreateProposeTransaction();
NKikimrTxUserProxy::TEvProposeTransaction& record = proposeRequest->Record;
- NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
+ NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
modifyScheme->SetWorkingDir(workingDir);
- modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpMkDir);
+ modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpMkDir);
modifyScheme->MutableMkDir()->SetName(name);
ctx.Send(MakeTxProxyID(), proposeRequest.release());
}
diff --git a/ydb/core/grpc_services/rpc_modify_permissions.cpp b/ydb/core/grpc_services/rpc_modify_permissions.cpp
index 3f3a754ecb1..d9b01887d2c 100644
--- a/ydb/core/grpc_services/rpc_modify_permissions.cpp
+++ b/ydb/core/grpc_services/rpc_modify_permissions.cpp
@@ -48,8 +48,8 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvProposeTransaction> proposeRequest = CreateProposeTransaction();
NKikimrTxUserProxy::TEvProposeTransaction& record = proposeRequest->Record;
- NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
- modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL);
+ NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
+ modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL);
modifyScheme->SetWorkingDir(workingDir);
modifyScheme->MutableModifyACL()->SetName(name);
@@ -62,22 +62,22 @@ private:
case Ydb::Scheme::PermissionsAction::kSet: {
acl.ClearAccessForSid(perm.set().subject());
for (const auto& n : perm.set().permission_names()) {
- auto aclAttrs = ConvertYdbPermissionNameToACLAttrs(n);
- acl.AddAccess(NACLib::EAccessType::Allow, aclAttrs.AccessMask, perm.set().subject(), aclAttrs.InheritanceType);
+ auto aclAttrs = ConvertYdbPermissionNameToACLAttrs(n);
+ acl.AddAccess(NACLib::EAccessType::Allow, aclAttrs.AccessMask, perm.set().subject(), aclAttrs.InheritanceType);
}
}
break;
case Ydb::Scheme::PermissionsAction::kGrant: {
for (const auto& n : perm.grant().permission_names()) {
- auto aclAttrs = ConvertYdbPermissionNameToACLAttrs(n);
- acl.AddAccess(NACLib::EAccessType::Allow, aclAttrs.AccessMask, perm.grant().subject(), aclAttrs.InheritanceType);
+ auto aclAttrs = ConvertYdbPermissionNameToACLAttrs(n);
+ acl.AddAccess(NACLib::EAccessType::Allow, aclAttrs.AccessMask, perm.grant().subject(), aclAttrs.InheritanceType);
}
}
break;
case Ydb::Scheme::PermissionsAction::kRevoke: {
for (const auto& n : perm.revoke().permission_names()) {
- auto aclAttrs = ConvertYdbPermissionNameToACLAttrs(n);
- acl.RemoveAccess(NACLib::EAccessType::Allow, aclAttrs.AccessMask, perm.revoke().subject(), aclAttrs.InheritanceType);
+ auto aclAttrs = ConvertYdbPermissionNameToACLAttrs(n);
+ acl.RemoveAccess(NACLib::EAccessType::Allow, aclAttrs.AccessMask, perm.revoke().subject(), aclAttrs.InheritanceType);
}
}
break;
diff --git a/ydb/core/grpc_services/rpc_read_table.cpp b/ydb/core/grpc_services/rpc_read_table.cpp
index dd82c9aa111..bbb87907289 100644
--- a/ydb/core/grpc_services/rpc_read_table.cpp
+++ b/ydb/core/grpc_services/rpc_read_table.cpp
@@ -197,8 +197,8 @@ private:
}
break;
case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecComplete: {
- if (msg->Record.GetSchemeShardStatus() == NKikimrScheme::EStatus::StatusSuccess ||
- msg->Record.GetSchemeShardStatus() == NKikimrScheme::EStatus::StatusAlreadyExists)
+ if (msg->Record.GetSchemeShardStatus() == NKikimrScheme::EStatus::StatusSuccess ||
+ msg->Record.GetSchemeShardStatus() == NKikimrScheme::EStatus::StatusAlreadyExists)
{
// We can't close stream if has not empty send buffer
if (SendBuffer_) {
diff --git a/ydb/core/grpc_services/rpc_remove_directory.cpp b/ydb/core/grpc_services/rpc_remove_directory.cpp
index 055828762d6..9bdc2ad7b20 100644
--- a/ydb/core/grpc_services/rpc_remove_directory.cpp
+++ b/ydb/core/grpc_services/rpc_remove_directory.cpp
@@ -44,9 +44,9 @@ private:
std::unique_ptr<TEvTxUserProxy::TEvProposeTransaction> proposeRequest = CreateProposeTransaction();
NKikimrTxUserProxy::TEvProposeTransaction& record = proposeRequest->Record;
- NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
+ NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
modifyScheme->SetWorkingDir(workingDir);
- modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpRmDir);
+ modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpRmDir);
modifyScheme->MutableDrop()->SetName(name);
ctx.Send(MakeTxProxyID(), proposeRequest.release());
}
diff --git a/ydb/core/grpc_services/rpc_rename_tables.cpp b/ydb/core/grpc_services/rpc_rename_tables.cpp
index 65e17a1ddca..69684e889b1 100644
--- a/ydb/core/grpc_services/rpc_rename_tables.cpp
+++ b/ydb/core/grpc_services/rpc_rename_tables.cpp
@@ -1,71 +1,71 @@
-#include "grpc_request_proxy.h"
-
-#include "rpc_calls.h"
-#include "rpc_scheme_base.h"
-#include "rpc_common.h"
-
-namespace NKikimr {
-namespace NGRpcService {
-
-using namespace NActors;
-using namespace Ydb;
-
-class TRenameTablesRPC : public TRpcSchemeRequestActor<TRenameTablesRPC, TEvRenameTablesRequest> {
- using TBase = TRpcSchemeRequestActor<TRenameTablesRPC, TEvRenameTablesRequest>;
-
-public:
- TRenameTablesRPC(TEvRenameTablesRequest* msg)
- : TBase(msg) {}
-
- void Bootstrap(const TActorContext &ctx) {
- TBase::Bootstrap(ctx);
-
- SendProposeRequest(ctx);
- Become(&TRenameTablesRPC::StateWork);
- }
-
-private:
- void SendProposeRequest(const TActorContext &ctx) {
- const auto req = GetProtoRequest();
-
- auto proposeRequest = TBase::CreateProposeTransaction();
- auto& record = proposeRequest->Record;
- auto& transaction = *record.MutableTransaction();
-
- if (req->tables().empty()) {
- Request_->RaiseIssue(NYql::TIssue("Emply move list"));
- return Reply(StatusIds::BAD_REQUEST, ctx);
- }
-
- try {
- for (const auto& item: req->tables()) {
- if (item.replace_destination()) {
- auto* modifyScheme = transaction.AddTransactionalModification();
- modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
-
- auto [workingDir, name] = SplitPath(item.destination_path());
- modifyScheme->SetWorkingDir(workingDir);
- modifyScheme->MutableDrop()->SetName(name);
- }
-
- auto* modifyScheme = transaction.AddTransactionalModification();
- modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpMoveTable);
- auto* description = modifyScheme->MutableMoveTable();
- description->SetSrcPath(item.source_path());
- description->SetDstPath(item.destination_path());
- }
- } catch (const std::exception& ex) {
- Request_->RaiseIssue(NYql::ExceptionToIssue(ex));
- return Reply(StatusIds::BAD_REQUEST, ctx);
- }
-
- ctx.Send(MakeTxProxyID(), proposeRequest.release());
- }
-};
-
-void TGRpcRequestProxy::Handle(TEvRenameTablesRequest::TPtr& ev, const TActorContext& ctx) {
- ctx.Register(new TRenameTablesRPC(ev->Release().Release()));
-}
-
-} // namespace NKikimr
-} // namespace NGRpcService
+#include "grpc_request_proxy.h"
+
+#include "rpc_calls.h"
+#include "rpc_scheme_base.h"
+#include "rpc_common.h"
+
+namespace NKikimr {
+namespace NGRpcService {
+
+using namespace NActors;
+using namespace Ydb;
+
+class TRenameTablesRPC : public TRpcSchemeRequestActor<TRenameTablesRPC, TEvRenameTablesRequest> {
+ using TBase = TRpcSchemeRequestActor<TRenameTablesRPC, TEvRenameTablesRequest>;
+
+public:
+ TRenameTablesRPC(TEvRenameTablesRequest* msg)
+ : TBase(msg) {}
+
+ void Bootstrap(const TActorContext &ctx) {
+ TBase::Bootstrap(ctx);
+
+ SendProposeRequest(ctx);
+ Become(&TRenameTablesRPC::StateWork);
+ }
+
+private:
+ void SendProposeRequest(const TActorContext &ctx) {
+ const auto req = GetProtoRequest();
+
+ auto proposeRequest = TBase::CreateProposeTransaction();
+ auto& record = proposeRequest->Record;
+ auto& transaction = *record.MutableTransaction();
+
+ if (req->tables().empty()) {
+ Request_->RaiseIssue(NYql::TIssue("Emply move list"));
+ return Reply(StatusIds::BAD_REQUEST, ctx);
+ }
+
+ try {
+ for (const auto& item: req->tables()) {
+ if (item.replace_destination()) {
+ auto* modifyScheme = transaction.AddTransactionalModification();
+ modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
+
+ auto [workingDir, name] = SplitPath(item.destination_path());
+ modifyScheme->SetWorkingDir(workingDir);
+ modifyScheme->MutableDrop()->SetName(name);
+ }
+
+ auto* modifyScheme = transaction.AddTransactionalModification();
+ modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpMoveTable);
+ auto* description = modifyScheme->MutableMoveTable();
+ description->SetSrcPath(item.source_path());
+ description->SetDstPath(item.destination_path());
+ }
+ } catch (const std::exception& ex) {
+ Request_->RaiseIssue(NYql::ExceptionToIssue(ex));
+ return Reply(StatusIds::BAD_REQUEST, ctx);
+ }
+
+ ctx.Send(MakeTxProxyID(), proposeRequest.release());
+ }
+};
+
+void TGRpcRequestProxy::Handle(TEvRenameTablesRequest::TPtr& ev, const TActorContext& ctx) {
+ ctx.Register(new TRenameTablesRPC(ev->Release().Release()));
+}
+
+} // namespace NKikimr
+} // namespace NGRpcService
diff --git a/ydb/core/grpc_services/rpc_scheme_base.h b/ydb/core/grpc_services/rpc_scheme_base.h
index 86ddb2f4d2e..0be68e802e1 100644
--- a/ydb/core/grpc_services/rpc_scheme_base.h
+++ b/ydb/core/grpc_services/rpc_scheme_base.h
@@ -23,8 +23,8 @@ protected:
HFunc(TEvTabletPipe::TEvClientConnected, Handle);
HFunc(TEvTabletPipe::TEvClientDestroyed, Handle);
HFunc(TEvTxUserProxy::TEvProposeTransactionStatus, Handle);
- HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult, Handle);
- HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered, Handle);
default: TBase::StateFuncBase(ev, ctx);
}
}
@@ -61,8 +61,8 @@ protected:
auto issueMessage = msg->Record.GetIssues();
switch (status) {
case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecComplete: {
- if (msg->Record.GetSchemeShardStatus() == NKikimrScheme::EStatus::StatusSuccess ||
- msg->Record.GetSchemeShardStatus() == NKikimrScheme::EStatus::StatusAlreadyExists)
+ if (msg->Record.GetSchemeShardStatus() == NKikimrScheme::EStatus::StatusSuccess ||
+ msg->Record.GetSchemeShardStatus() == NKikimrScheme::EStatus::StatusAlreadyExists)
{
return this->ReplyWithResult(Ydb::StatusIds::SUCCESS, issueMessage, ctx);
}
@@ -74,7 +74,7 @@ protected:
Y_VERIFY(pipeActor);
SchemePipeActorId_ = ctx.ExecutorThread.RegisterActor(pipeActor);
- auto request = MakeHolder<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion>();
+ auto request = MakeHolder<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion>();
request->Record.SetTxId(msg->Record.GetTxId());
NTabletPipe::SendData(ctx, SchemePipeActorId_, request.Release());
return;
@@ -85,28 +85,28 @@ protected:
case TEvTxUserProxy::TResultStatus::AccessDenied: {
return this->ReplyWithResult(Ydb::StatusIds::UNAUTHORIZED, issueMessage, ctx);
}
- case TEvTxUserProxy::TResultStatus::ProxyShardNotAvailable: {
- return this->ReplyWithResult(Ydb::StatusIds::UNAVAILABLE, issueMessage, ctx);
- }
+ case TEvTxUserProxy::TResultStatus::ProxyShardNotAvailable: {
+ return this->ReplyWithResult(Ydb::StatusIds::UNAVAILABLE, issueMessage, ctx);
+ }
case TEvTxUserProxy::TResultStatus::ResolveError: {
return this->ReplyWithResult(Ydb::StatusIds::SCHEME_ERROR, issueMessage, ctx);
}
case TEvTxUserProxy::TResultStatus::ExecError: {
switch (msg->Record.GetSchemeShardStatus()) {
- case NKikimrScheme::EStatus::StatusMultipleModifications: {
+ case NKikimrScheme::EStatus::StatusMultipleModifications: {
return this->ReplyWithResult(Ydb::StatusIds::OVERLOADED, issueMessage, ctx);
}
- case NKikimrScheme::EStatus::StatusSchemeError:
- case NKikimrScheme::EStatus::StatusNameConflict:
- case NKikimrScheme::EStatus::StatusPathDoesNotExist: {
+ case NKikimrScheme::EStatus::StatusSchemeError:
+ case NKikimrScheme::EStatus::StatusNameConflict:
+ case NKikimrScheme::EStatus::StatusPathDoesNotExist: {
return this->ReplyWithResult(Ydb::StatusIds::SCHEME_ERROR, issueMessage, ctx);
}
- case NKikimrScheme::EStatus::StatusQuotaExceeded: {
+ case NKikimrScheme::EStatus::StatusQuotaExceeded: {
// FIXME: clients may start aggressive retries when receiving 'overloaded'
return this->ReplyWithResult(Ydb::StatusIds::OVERLOADED, issueMessage, ctx);
}
- case NKikimrScheme::EStatus::StatusResourceExhausted:
- case NKikimrScheme::EStatus::StatusPreconditionFailed: {
+ case NKikimrScheme::EStatus::StatusResourceExhausted:
+ case NKikimrScheme::EStatus::StatusPreconditionFailed: {
return this->ReplyWithResult(Ydb::StatusIds::PRECONDITION_FAILED, issueMessage, ctx);
}
default: {
@@ -126,15 +126,15 @@ protected:
return this->ReplyWithResult(Ydb::StatusIds::INTERNAL_ERROR, issueMessage, ctx);
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev, const TActorContext& ctx) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev, const TActorContext& ctx) {
NTabletPipe::CloseClient(ctx, SchemePipeActorId_);
return this->ReplyNotifyTxCompletionResult(ev, ctx);
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered::TPtr&, const TActorContext&) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionRegistered::TPtr&, const TActorContext&) {
}
- virtual void ReplyNotifyTxCompletionResult(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev, const TActorContext& ctx) {
+ virtual void ReplyNotifyTxCompletionResult(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev, const TActorContext& ctx) {
Y_UNUSED(ev);
return this->Reply(Ydb::StatusIds::SUCCESS, ctx);
}
diff --git a/ydb/core/grpc_services/table_profiles.cpp b/ydb/core/grpc_services/table_profiles.cpp
index 6692cca1fc2..367de4cc89e 100644
--- a/ydb/core/grpc_services/table_profiles.cpp
+++ b/ydb/core/grpc_services/table_profiles.cpp
@@ -45,7 +45,7 @@ void TTableProfiles::Load(const NKikimrConfig::TTableProfilesConfig &config)
CachingPolicies[policy.GetName()] = policy;
}
-NKikimrSchemeOp::TFamilyDescription *TTableProfiles::GetNamedFamilyDescription(NKikimrConfig::TStoragePolicy &policy, const TString& name) const {
+NKikimrSchemeOp::TFamilyDescription *TTableProfiles::GetNamedFamilyDescription(NKikimrConfig::TStoragePolicy &policy, const TString& name) const {
for (size_t i = 0; i < policy.ColumnFamiliesSize(); ++i) {
const auto& family = policy.GetColumnFamilies(i);
if (family.HasName() && name == family.GetName()) {
@@ -57,7 +57,7 @@ NKikimrSchemeOp::TFamilyDescription *TTableProfiles::GetNamedFamilyDescription(N
return res;
}
-NKikimrSchemeOp::TFamilyDescription *TTableProfiles::GetDefaultFamilyDescription(NKikimrConfig::TStoragePolicy &policy) const {
+NKikimrSchemeOp::TFamilyDescription *TTableProfiles::GetDefaultFamilyDescription(NKikimrConfig::TStoragePolicy &policy) const {
for (size_t i = 0; i < policy.ColumnFamiliesSize(); ++i) {
const auto& family = policy.GetColumnFamilies(i);
if ((family.HasId() && family.GetId() == 0) ||
@@ -71,7 +71,7 @@ NKikimrSchemeOp::TFamilyDescription *TTableProfiles::GetDefaultFamilyDescription
return res;
}
-NKikimrSchemeOp::TStorageConfig *TTableProfiles::GetDefaultStorageConfig(NKikimrConfig::TStoragePolicy &policy) const {
+NKikimrSchemeOp::TStorageConfig *TTableProfiles::GetDefaultStorageConfig(NKikimrConfig::TStoragePolicy &policy) const {
return GetDefaultFamilyDescription(policy)->MutableStorageConfig();
}
@@ -80,7 +80,7 @@ bool TTableProfiles::HasPresetName(const TString &presetName) const {
}
bool TTableProfiles::ApplyTableProfile(const Ydb::Table::TableProfile &profile,
- NKikimrSchemeOp::TTableDescription &tableDesc,
+ NKikimrSchemeOp::TTableDescription &tableDesc,
Ydb::StatusIds::StatusCode &code,
TString &error) const
{
@@ -226,7 +226,7 @@ bool TTableProfiles::ApplyTableProfile(const Ydb::Table::TableProfile &profile,
error = "Setting keep_in_memory to ENABLED is not allowed";
return false;
}
- GetDefaultFamilyDescription(storagePolicy)->SetColumnCache(NKikimrSchemeOp::ColumnCacheEver);
+ GetDefaultFamilyDescription(storagePolicy)->SetColumnCache(NKikimrSchemeOp::ColumnCacheEver);
break;
case Ydb::FeatureFlag::DISABLED:
GetDefaultFamilyDescription(storagePolicy)->ClearColumnCache();
@@ -277,7 +277,7 @@ bool TTableProfiles::ApplyTableProfile(const Ydb::Table::TableProfile &profile,
error = "Setting keep_in_memory to ENABLED is not allowed";
return false;
}
- familyProto.SetColumnCache(NKikimrSchemeOp::ColumnCacheEver);
+ familyProto.SetColumnCache(NKikimrSchemeOp::ColumnCacheEver);
break;
case Ydb::FeatureFlag::DISABLED:
familyProto.ClearColumnCache();
@@ -293,10 +293,10 @@ bool TTableProfiles::ApplyTableProfile(const Ydb::Table::TableProfile &profile,
case Ydb::Table::ColumnFamilyPolicy::COMPRESSION_UNSPECIFIED:
break;
case Ydb::Table::ColumnFamilyPolicy::UNCOMPRESSED:
- familyProto.SetColumnCodec(NKikimrSchemeOp::ColumnCodecPlain);
+ familyProto.SetColumnCodec(NKikimrSchemeOp::ColumnCodecPlain);
break;
case Ydb::Table::ColumnFamilyPolicy::COMPRESSED:
- familyProto.SetColumnCodec(NKikimrSchemeOp::ColumnCodecLZ4);
+ familyProto.SetColumnCodec(NKikimrSchemeOp::ColumnCodecLZ4);
break;
default:
code = Ydb::StatusIds::BAD_REQUEST;
@@ -437,7 +437,7 @@ bool TTableProfiles::ApplyTableProfile(const Ydb::Table::TableProfile &profile,
}
bool TTableProfiles::ApplyCompactionPolicy(const TString &name,
- NKikimrSchemeOp::TPartitionConfig &partitionConfig, Ydb::StatusIds::StatusCode &code,
+ NKikimrSchemeOp::TPartitionConfig &partitionConfig, Ydb::StatusIds::StatusCode &code,
TString &error, const TAppData* appData) const
{
NKikimrConfig::TCompactionPolicy compactionPolicy;
diff --git a/ydb/core/grpc_services/table_profiles.h b/ydb/core/grpc_services/table_profiles.h
index f39533dbb18..2acec6f115e 100644
--- a/ydb/core/grpc_services/table_profiles.h
+++ b/ydb/core/grpc_services/table_profiles.h
@@ -20,17 +20,17 @@ public:
bool HasPresetName(const TString& presetName) const;
bool ApplyTableProfile(const Ydb::Table::TableProfile &profile,
- NKikimrSchemeOp::TTableDescription &tableDesc,
+ NKikimrSchemeOp::TTableDescription &tableDesc,
Ydb::StatusIds::StatusCode &code,
TString &error) const;
- bool ApplyCompactionPolicy(const TString &name, NKikimrSchemeOp::TPartitionConfig &partitionConfig,
+ bool ApplyCompactionPolicy(const TString &name, NKikimrSchemeOp::TPartitionConfig &partitionConfig,
Ydb::StatusIds::StatusCode &code, TString &error, const TAppData* appData = nullptr) const;
private:
- NKikimrSchemeOp::TFamilyDescription *GetNamedFamilyDescription(NKikimrConfig::TStoragePolicy &policy, const TString& name) const;
- NKikimrSchemeOp::TFamilyDescription *GetDefaultFamilyDescription(NKikimrConfig::TStoragePolicy &policy) const;
- NKikimrSchemeOp::TStorageConfig *GetDefaultStorageConfig(NKikimrConfig::TStoragePolicy &policy) const;
+ NKikimrSchemeOp::TFamilyDescription *GetNamedFamilyDescription(NKikimrConfig::TStoragePolicy &policy, const TString& name) const;
+ NKikimrSchemeOp::TFamilyDescription *GetDefaultFamilyDescription(NKikimrConfig::TStoragePolicy &policy) const;
+ NKikimrSchemeOp::TStorageConfig *GetDefaultStorageConfig(NKikimrConfig::TStoragePolicy &policy) const;
public:
THashMap<TString, NKikimrConfig::TCompactionPolicy> CompactionPolicies;
THashMap<TString, NKikimrConfig::TExecutionPolicy> ExecutionPolicies;
diff --git a/ydb/core/grpc_services/table_settings.cpp b/ydb/core/grpc_services/table_settings.cpp
index 8367bd3fe7c..97dc63a53c5 100644
--- a/ydb/core/grpc_services/table_settings.cpp
+++ b/ydb/core/grpc_services/table_settings.cpp
@@ -3,7 +3,7 @@
namespace NKikimr {
namespace NGRpcService {
-bool FillCreateTableSettingsDesc(NKikimrSchemeOp::TTableDescription& out,
+bool FillCreateTableSettingsDesc(NKikimrSchemeOp::TTableDescription& out,
const Ydb::Table::CreateTableRequest& in, const NGRpcService::TTableProfiles& profiles,
Ydb::StatusIds::StatusCode& code, TString& error, TList<TString>& warnings) {
@@ -28,7 +28,7 @@ bool FillCreateTableSettingsDesc(NKikimrSchemeOp::TTableDescription& out,
return NKikimr::FillCreateTableSettingsDesc(out, in, code, error, warnings, tableProfileSet);
}
-bool FillAlterTableSettingsDesc(NKikimrSchemeOp::TTableDescription& out,
+bool FillAlterTableSettingsDesc(NKikimrSchemeOp::TTableDescription& out,
const Ydb::Table::AlterTableRequest& in, const NGRpcService::TTableProfiles& profiles,
Ydb::StatusIds::StatusCode& code, TString& error, const TAppData* appData) {
diff --git a/ydb/core/grpc_services/table_settings.h b/ydb/core/grpc_services/table_settings.h
index 98106f734b2..c8c6d26281f 100644
--- a/ydb/core/grpc_services/table_settings.h
+++ b/ydb/core/grpc_services/table_settings.h
@@ -7,11 +7,11 @@
namespace NKikimr {
namespace NGRpcService {
-bool FillCreateTableSettingsDesc(NKikimrSchemeOp::TTableDescription& out,
+bool FillCreateTableSettingsDesc(NKikimrSchemeOp::TTableDescription& out,
const Ydb::Table::CreateTableRequest& in, const NGRpcService::TTableProfiles& profiles,
Ydb::StatusIds::StatusCode& code, TString& error, TList<TString>& warnings);
-bool FillAlterTableSettingsDesc(NKikimrSchemeOp::TTableDescription& out,
+bool FillAlterTableSettingsDesc(NKikimrSchemeOp::TTableDescription& out,
const Ydb::Table::AlterTableRequest& in, const NGRpcService::TTableProfiles& profiles,
Ydb::StatusIds::StatusCode& code, TString& error, const TAppData* appData);
diff --git a/ydb/core/grpc_services/ya.make b/ydb/core/grpc_services/ya.make
index 16bdfa2655c..05b156bf043 100644
--- a/ydb/core/grpc_services/ya.make
+++ b/ydb/core/grpc_services/ya.make
@@ -22,7 +22,7 @@ SRCS(
rpc_cms.cpp
rpc_commit_transaction.cpp
rpc_copy_table.cpp
- rpc_copy_tables.cpp
+ rpc_copy_tables.cpp
rpc_export.cpp
rpc_create_coordination_node.cpp
rpc_create_session.cpp
@@ -62,7 +62,7 @@ SRCS(
rpc_read_columns.cpp
rpc_read_table.cpp
rpc_remove_directory.cpp
- rpc_rename_tables.cpp
+ rpc_rename_tables.cpp
rpc_rollback_transaction.cpp
rpc_s3_listing.cpp
rpc_scheme_base.cpp
diff --git a/ydb/core/health_check/health_check.cpp b/ydb/core/health_check/health_check.cpp
index 931ac370abd..7995c58aafc 100644
--- a/ydb/core/health_check/health_check.cpp
+++ b/ydb/core/health_check/health_check.cpp
@@ -330,7 +330,7 @@ public:
TTabletId RootSchemeShardId;
TTabletId RootHiveId;
THashMap<TString, TTenantInfo> TenantByPath;
- THashMap<TString, THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>> DescribeByPath;
+ THashMap<TString, THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>> DescribeByPath;
THashMap<TString, Ydb::Cms::GetDatabaseStatusResult> DatabaseStatusByPath;
THashMap<TString, THolder<NTenantSlotBroker::TEvTenantSlotBroker::TEvTenantState>> TenantStateByPath;
THashMap<TString, THolder<NSchemeCache::TSchemeCacheNavigate>> NavigateResult;
@@ -532,7 +532,7 @@ public:
hFunc(TEvHive::TEvResponseHiveDomainStats, Handle);
hFunc(TEvHive::TEvResponseHiveNodeStats, Handle);
hFunc(TEvHive::TEvResponseHiveInfo, Handle);
- hFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ hFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
hFunc(TEvTxProxySchemeCache::TEvNavigateKeySetResult, Handle)
hFunc(TEvBlobStorage::TEvControllerSelectGroupsResult, Handle);
hFunc(TEvBlobStorage::TEvControllerConfigResponse, Handle);
@@ -574,8 +574,8 @@ public:
}
void RequestDescribe(TTabletId schemeShardId, const TString& path) {
- THolder<NSchemeShard::TEvSchemeShard::TEvDescribeScheme> request = MakeHolder<NSchemeShard::TEvSchemeShard::TEvDescribeScheme>();
- NKikimrSchemeOp::TDescribePath& record = request->Record;
+ THolder<NSchemeShard::TEvSchemeShard::TEvDescribeScheme> request = MakeHolder<NSchemeShard::TEvSchemeShard::TEvDescribeScheme>();
+ NKikimrSchemeOp::TDescribePath& record = request->Record;
record.SetPath(path);
record.MutableOptions()->SetReturnPartitioningInfo(false);
record.MutableOptions()->SetReturnPartitionConfig(false);
@@ -847,9 +847,9 @@ public:
RequestDone("TEvControllerSelectGroupsResult");
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
TabletRequests.CompleteRequest(ev->Cookie);
- if (ev->Get()->GetRecord().GetStatus() == NKikimrScheme::StatusSuccess) {
+ if (ev->Get()->GetRecord().GetStatus() == NKikimrScheme::StatusSuccess) {
TString path = ev->Get()->GetRecord().GetPath();
TDatabaseState& state(DatabaseState[path]);
for (const auto& storagePool : ev->Get()->GetRecord().GetPathDescription().GetDomainDescription().GetStoragePools()) {
diff --git a/ydb/core/keyvalue/keyvalue_collector.cpp b/ydb/core/keyvalue/keyvalue_collector.cpp
index a82dac5e6ef..8b7696bcb25 100644
--- a/ydb/core/keyvalue/keyvalue_collector.cpp
+++ b/ydb/core/keyvalue/keyvalue_collector.cpp
@@ -106,7 +106,7 @@ public:
ui32 groupId = CollectorForGroupForChannel.begin()->second.begin()->first;
CollectorErrors++;
- if (status == NKikimrProto::RACE || status == NKikimrProto::BLOCKED || status == NKikimrProto::NO_GROUP || CollectorErrors > CollectorMaxErrors) {
+ if (status == NKikimrProto::RACE || status == NKikimrProto::BLOCKED || status == NKikimrProto::NO_GROUP || CollectorErrors > CollectorMaxErrors) {
LOG_ERROR_S(ctx, NKikimrServices::KEYVALUE, "Tablet# " << TabletInfo->TabletID
<< " Collector got Status# " << NKikimrProto::EReplyStatus_Name(status)
<< " from Group# " << groupId << " Channel# " << channelIdx
diff --git a/ydb/core/kqp/kqp_ic_gateway.cpp b/ydb/core/kqp/kqp_ic_gateway.cpp
index ec0ae780905..47489a9bd54 100644
--- a/ydb/core/kqp/kqp_ic_gateway.cpp
+++ b/ydb/core/kqp/kqp_ic_gateway.cpp
@@ -41,8 +41,8 @@ using NYql::TIssue;
using TIssuesIds = NYql::TIssuesIds;
using namespace NThreading;
using namespace NYql::NCommon;
-using namespace NSchemeShard;
-using namespace NKikimrSchemeOp;
+using namespace NSchemeShard;
+using namespace NKikimrSchemeOp;
using NKikimrTxUserProxy::TMiniKQLTransaction;
@@ -50,7 +50,7 @@ constexpr const IKqpGateway::TKqpSnapshot IKqpGateway::TKqpSnapshot::InvalidSnap
#define STATIC_ASSERT_STATE_EQUAL(name) \
static_assert(static_cast<ui32>(NYql::TIndexDescription::EIndexState::name) \
- == NKikimrSchemeOp::EIndexState::EIndexState##name, \
+ == NKikimrSchemeOp::EIndexState::EIndexState##name, \
"index state missmatch, flag: ## name");
STATIC_ASSERT_STATE_EQUAL(Invalid)
@@ -86,11 +86,11 @@ public:
using TCallbackFunc = typename TBase::TCallbackFunc;
TProxyRequestHandler(TRequest* request, TPromise<TResult> promise, TCallbackFunc callback)
- : TBase(request, promise, callback) {}
+ : TBase(request, promise, callback) {}
void Bootstrap(const TActorContext& ctx) {
TActorId txproxy = MakeTxProxyID();
- ctx.Send(txproxy, this->Request.Release());
+ ctx.Send(txproxy, this->Request.Release());
this->Become(&TProxyRequestHandler::AwaitState);
}
@@ -495,7 +495,7 @@ public:
TMkqlRequestHandler(const TAlignedPagePoolCounters& allocCounters, TRequest* request,
TKqpParamsMap&& paramsMap, TPromise<TResult> promise, TCallbackFunc callback,
const TActorId& miniKqlComplileServiceActorId)
- : TBase(request, promise, callback)
+ : TBase(request, promise, callback)
, ParamsMap(std::move(paramsMap))
, CompilationPending(false)
, CompilationRetried(false)
@@ -641,9 +641,9 @@ private:
if (!CompilationPending) {
TAutoPtr<TRequest> ev = new TRequest();
ev->Record.CopyFrom(this->Request->Record);
-
+
TActorId txproxy = MakeTxProxyID();
- ctx.Send(txproxy, ev.Release());
+ ctx.Send(txproxy, ev.Release());
}
}
@@ -669,12 +669,12 @@ public:
using TResponse = TEvTxUserProxy::TEvProposeTransactionStatus;
using TResult = IKqpGateway::TGenericResult;
- TSchemeOpRequestHandler(TRequest* request, TPromise<TResult> promise)
- : TBase(request, promise, {}) {}
+ TSchemeOpRequestHandler(TRequest* request, TPromise<TResult> promise)
+ : TBase(request, promise, {}) {}
void Bootstrap(const TActorContext& ctx) {
TActorId txproxy = MakeTxProxyID();
- ctx.Send(txproxy, this->Request.Release());
+ ctx.Send(txproxy, this->Request.Release());
this->Become(&TSchemeOpRequestHandler::AwaitState);
}
@@ -697,7 +697,7 @@ public:
Y_VERIFY(pipeActor);
ShemePipeActorId = ctx.ExecutorThread.RegisterActor(pipeActor);
- auto request = MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>();
+ auto request = MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>();
request->Record.SetTxId(response.GetTxId());
NTabletPipe::SendData(ctx, ShemePipeActorId, request.Release());
@@ -719,8 +719,8 @@ public:
}
case TEvTxUserProxy::TResultStatus::ExecComplete: {
- if (response.GetSchemeShardStatus() == NKikimrScheme::EStatus::StatusSuccess ||
- response.GetSchemeShardStatus() == NKikimrScheme::EStatus::StatusAlreadyExists)
+ if (response.GetSchemeShardStatus() == NKikimrScheme::EStatus::StatusSuccess ||
+ response.GetSchemeShardStatus() == NKikimrScheme::EStatus::StatusAlreadyExists)
{
LOG_DEBUG_S(ctx, NKikimrServices::KQP_GATEWAY, "Successful completion of scheme request"
<< ", TxId: " << response.GetTxId());
@@ -750,13 +750,13 @@ public:
case TEvTxUserProxy::TResultStatus::ExecError:
switch (response.GetSchemeShardStatus()) {
- case NKikimrScheme::EStatus::StatusMultipleModifications: {
+ case NKikimrScheme::EStatus::StatusMultipleModifications: {
Promise.SetValue(ResultFromIssues<TResult>(TIssuesIds::KIKIMR_MULTIPLE_SCHEME_MODIFICATIONS,
response.GetSchemeShardReason(), {}));
this->Die(ctx);
return;
}
- case NKikimrScheme::EStatus::StatusPathDoesNotExist: {
+ case NKikimrScheme::EStatus::StatusPathDoesNotExist: {
Promise.SetValue(ResultFromIssues<TResult>(TIssuesIds::KIKIMR_SCHEME_ERROR,
response.GetSchemeShardReason(), {}));
this->Die(ctx);
@@ -787,7 +787,7 @@ public:
this->Die(ctx);
}
- void Handle(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev, const TActorContext& ctx) {
+ void Handle(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev, const TActorContext& ctx) {
auto& response = ev->Get()->Record;
LOG_DEBUG_S(ctx, NKikimrServices::KQP_GATEWAY, "Received TEvNotifyTxCompletionResult for scheme request"
@@ -804,15 +804,15 @@ public:
this->Die(ctx);
}
- void Handle(TEvSchemeShard::TEvNotifyTxCompletionRegistered::TPtr&, const TActorContext&) {}
+ void Handle(TEvSchemeShard::TEvNotifyTxCompletionRegistered::TPtr&, const TActorContext&) {}
STFUNC(AwaitState) {
switch (ev->GetTypeRewrite()) {
HFunc(TResponse, HandleResponse);
HFunc(TEvTabletPipe::TEvClientConnected, Handle);
HFunc(TEvTabletPipe::TEvClientDestroyed, Handle);
- HFunc(TEvSchemeShard::TEvNotifyTxCompletionResult, Handle);
- HFunc(TEvSchemeShard::TEvNotifyTxCompletionRegistered, Handle);
+ HFunc(TEvSchemeShard::TEvNotifyTxCompletionResult, Handle);
+ HFunc(TEvSchemeShard::TEvNotifyTxCompletionRegistered, Handle);
default:
TBase::HandleUnexpectedEvent("TSchemeOpRequestHandler", ev->GetTypeRewrite(), ctx);
}
@@ -1147,23 +1147,23 @@ public:
}
auto& schemeTx = *ev->Record.MutableTransaction()->MutableModifyScheme();
schemeTx.SetWorkingDir(pathPair.first);
- NKikimrSchemeOp::TTableDescription* tableDesc = nullptr;
+ NKikimrSchemeOp::TTableDescription* tableDesc = nullptr;
if (!metadata->Indexes.empty()) {
- schemeTx.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateIndexedTable);
+ schemeTx.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateIndexedTable);
tableDesc = schemeTx.MutableCreateIndexedTable()->MutableTableDescription();
for (const auto& index : metadata->Indexes) {
auto indexDesc = schemeTx.MutableCreateIndexedTable()->AddIndexDescription();
indexDesc->SetName(index.Name);
switch (index.Type) {
case NYql::TIndexDescription::EType::GlobalSync:
- indexDesc->SetType(NKikimrSchemeOp::EIndexType::EIndexTypeGlobal);
+ indexDesc->SetType(NKikimrSchemeOp::EIndexType::EIndexTypeGlobal);
break;
case NYql::TIndexDescription::EType::GlobalAsync:
- indexDesc->SetType(NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync);
+ indexDesc->SetType(NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync);
break;
}
- indexDesc->SetState(static_cast<::NKikimrSchemeOp::EIndexState>(index.State));
+ indexDesc->SetState(static_cast<::NKikimrSchemeOp::EIndexState>(index.State));
for (const auto& col : index.KeyColumns) {
indexDesc->AddKeyColumnNames(col);
}
@@ -1173,7 +1173,7 @@ public:
}
FillCreateTableColumnDesc(*tableDesc, pathPair.second, metadata);
} else {
- schemeTx.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateTable);
+ schemeTx.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateTable);
tableDesc = schemeTx.MutableCreateTable();
FillCreateTableColumnDesc(*tableDesc, pathPair.second, metadata);
}
@@ -1231,40 +1231,40 @@ public:
}
}
- TFuture<TGenericResult> RenameTable(const TString& src, const TString& dst, const TString& cluster) override {
- using TRequest = TEvTxUserProxy::TEvProposeTransaction;
-
- try {
- if (!CheckCluster(cluster)) {
- return InvalidCluster<TGenericResult>(cluster);
- }
-
- auto ev = MakeHolder<TRequest>();
- ev->Record.SetDatabaseName(Database);
- if (UserToken) {
- ev->Record.SetUserToken(UserToken->Serialized);
- }
- auto& schemeTx = *ev->Record.MutableTransaction()->MutableModifyScheme();
- schemeTx.SetOperationType(NKikimrSchemeOp::ESchemeOpMoveTable);
- auto& op = *schemeTx.MutableMoveTable();
- op.SetSrcPath(src);
- op.SetDstPath(dst);
-
- auto movePromise = NewPromise<TGenericResult>();
-
- SendSchemeRequest(ev.Release()).Apply(
- [movePromise](const TFuture<TGenericResult>& future) mutable {
- movePromise.SetValue(future.GetValue());
- });
-
- return movePromise.GetFuture();
-
- }
- catch (yexception& e) {
- return MakeFuture(ResultFromException<TGenericResult>(e));
- }
- }
-
+ TFuture<TGenericResult> RenameTable(const TString& src, const TString& dst, const TString& cluster) override {
+ using TRequest = TEvTxUserProxy::TEvProposeTransaction;
+
+ try {
+ if (!CheckCluster(cluster)) {
+ return InvalidCluster<TGenericResult>(cluster);
+ }
+
+ auto ev = MakeHolder<TRequest>();
+ ev->Record.SetDatabaseName(Database);
+ if (UserToken) {
+ ev->Record.SetUserToken(UserToken->Serialized);
+ }
+ auto& schemeTx = *ev->Record.MutableTransaction()->MutableModifyScheme();
+ schemeTx.SetOperationType(NKikimrSchemeOp::ESchemeOpMoveTable);
+ auto& op = *schemeTx.MutableMoveTable();
+ op.SetSrcPath(src);
+ op.SetDstPath(dst);
+
+ auto movePromise = NewPromise<TGenericResult>();
+
+ SendSchemeRequest(ev.Release()).Apply(
+ [movePromise](const TFuture<TGenericResult>& future) mutable {
+ movePromise.SetValue(future.GetValue());
+ });
+
+ return movePromise.GetFuture();
+
+ }
+ catch (yexception& e) {
+ return MakeFuture(ResultFromException<TGenericResult>(e));
+ }
+ }
+
TFuture<TGenericResult> DropTable(const TString& cluster, const TString& table) override {
try {
if (!CheckCluster(cluster)) {
@@ -1911,7 +1911,7 @@ public:
}
private:
- using TDescribeSchemeResponse = TEvSchemeShard::TEvDescribeSchemeResult;
+ using TDescribeSchemeResponse = TEvSchemeShard::TEvDescribeSchemeResult;
using TTransactionResponse = TEvTxUserProxy::TEvProposeTransactionStatus;
private:
@@ -2001,7 +2001,7 @@ private:
TFuture<TGenericResult> SendSchemeRequest(TEvTxUserProxy::TEvProposeTransaction* request)
{
auto promise = NewPromise<TGenericResult>();
- IActor* requestHandler = new TSchemeOpRequestHandler(request, promise);
+ IActor* requestHandler = new TSchemeOpRequestHandler(request, promise);
RegisterActor(requestHandler);
return promise.GetFuture();
@@ -2205,7 +2205,7 @@ private:
return result;
}
- static void FillCreateTableColumnDesc(NKikimrSchemeOp::TTableDescription& tableDesc,
+ static void FillCreateTableColumnDesc(NKikimrSchemeOp::TTableDescription& tableDesc,
const TString& name, NYql::TKikimrTableMetadataPtr metadata)
{
tableDesc.SetName(name);
@@ -2235,16 +2235,16 @@ private:
using TResult = IKikimrGateway::TTableMetadataResult;
switch (status) {
- case NKikimrScheme::EStatus::StatusSuccess:
- case NKikimrScheme::EStatus::StatusPathDoesNotExist:
+ case NKikimrScheme::EStatus::StatusSuccess:
+ case NKikimrScheme::EStatus::StatusPathDoesNotExist:
return true;
- case NKikimrScheme::EStatus::StatusSchemeError:
+ case NKikimrScheme::EStatus::StatusSchemeError:
error = ResultFromError<TResult>(YqlIssue({}, TIssuesIds::KIKIMR_SCHEME_ERROR, reason));
return false;
- case NKikimrScheme::EStatus::StatusAccessDenied:
+ case NKikimrScheme::EStatus::StatusAccessDenied:
error = ResultFromError<TResult>(YqlIssue({}, TIssuesIds::KIKIMR_ACCESS_DENIED, reason));
return false;
- case NKikimrScheme::EStatus::StatusNotAvailable:
+ case NKikimrScheme::EStatus::StatusNotAvailable:
error = ResultFromError<TResult>(YqlIssue({}, TIssuesIds::KIKIMR_TEMPORARILY_UNAVAILABLE, reason));
return false;
default:
@@ -2609,7 +2609,7 @@ private:
}
static bool FillCreateTableDesc(NYql::TKikimrTableMetadataPtr metadata,
- NKikimrSchemeOp::TTableDescription& tableDesc, const NGRpcService::TTableProfiles& profiles,
+ NKikimrSchemeOp::TTableDescription& tableDesc, const NGRpcService::TTableProfiles& profiles,
Ydb::StatusIds::StatusCode& code, TString& error, TList<TString>& warnings)
{
Ydb::Table::CreateTableRequest createTableProto;
diff --git a/ydb/core/kqp/kqp_metadata_loader.cpp b/ydb/core/kqp/kqp_metadata_loader.cpp
index e71d05e18f7..167b8df3c42 100644
--- a/ydb/core/kqp/kqp_metadata_loader.cpp
+++ b/ydb/core/kqp/kqp_metadata_loader.cpp
@@ -64,15 +64,15 @@ TFuture<TResult> SendActorRequest(TActorSystem* actorSystem, const TActorId& act
template<typename TIndexProto>
void IndexProtoToMetadata(const TIndexProto& indexes, NYql::TKikimrTableMetadataPtr tableMeta) {
- for (const NKikimrSchemeOp::TIndexDescription& index : indexes) {
+ for (const NKikimrSchemeOp::TIndexDescription& index : indexes) {
const auto indexState = index.GetState();
- YQL_ENSURE(indexState != NKikimrSchemeOp::EIndexState::EIndexStateInvalid,
+ YQL_ENSURE(indexState != NKikimrSchemeOp::EIndexState::EIndexStateInvalid,
"Unexpected index state, probably SchemeShard/SchemeCache bug!");
// Skip index if the state is NotReady - index just has been created but mark as not
// ready to use.
- if (indexState == NKikimrSchemeOp::EIndexState::EIndexStateNotReady) {
+ if (indexState == NKikimrSchemeOp::EIndexState::EIndexStateNotReady) {
continue;
}
diff --git a/ydb/core/kqp/provider/yql_kikimr_datasink.cpp b/ydb/core/kqp/provider/yql_kikimr_datasink.cpp
index 68d8d2a0e1c..035d6b77012 100644
--- a/ydb/core/kqp/provider/yql_kikimr_datasink.cpp
+++ b/ydb/core/kqp/provider/yql_kikimr_datasink.cpp
@@ -568,7 +568,7 @@ public:
return nullptr;
}
}
-
+
YQL_ENSURE(settings.AlterActions);
YQL_ENSURE(!settings.AlterActions.Cast().Empty());
diff --git a/ydb/core/kqp/provider/yql_kikimr_exec.cpp b/ydb/core/kqp/provider/yql_kikimr_exec.cpp
index a40c35dcae1..ad360fcaebe 100644
--- a/ydb/core/kqp/provider/yql_kikimr_exec.cpp
+++ b/ydb/core/kqp/provider/yql_kikimr_exec.cpp
@@ -530,16 +530,16 @@ public:
for (auto action : maybeAlter.Cast().Actions()) {
auto name = action.Name().Value();
- if (name == "renameTo") {
- auto destination = action.Value().Cast<TCoAtom>().StringValue();
- auto future = Gateway->RenameTable(table.Metadata->Name, destination, cluster);
- return WrapFuture(future,
- [](const IKikimrGateway::TGenericResult& res, const TExprNode::TPtr& input, TExprContext& ctx) {
- Y_UNUSED(res);
- auto resultNode = ctx.NewWorld(input->Pos());
- return resultNode;
- });
- } else if (name == "addColumns") {
+ if (name == "renameTo") {
+ auto destination = action.Value().Cast<TCoAtom>().StringValue();
+ auto future = Gateway->RenameTable(table.Metadata->Name, destination, cluster);
+ return WrapFuture(future,
+ [](const IKikimrGateway::TGenericResult& res, const TExprNode::TPtr& input, TExprContext& ctx) {
+ Y_UNUSED(res);
+ auto resultNode = ctx.NewWorld(input->Pos());
+ return resultNode;
+ });
+ } else if (name == "addColumns") {
auto listNode = action.Value().Cast<TExprList>();
for (size_t i = 0; i < listNode.Size(); ++i) {
auto add_column = alterTableRequest.add_add_columns();
diff --git a/ydb/core/kqp/provider/yql_kikimr_gateway.cpp b/ydb/core/kqp/provider/yql_kikimr_gateway.cpp
index c4178318571..e49f84b5e1e 100644
--- a/ydb/core/kqp/provider/yql_kikimr_gateway.cpp
+++ b/ydb/core/kqp/provider/yql_kikimr_gateway.cpp
@@ -5,7 +5,7 @@
#include <ydb/library/yql/utils/yql_panic.h>
#include <ydb/core/base/table_index.h>
-
+
#include <util/string/split.h>
namespace NYql {
@@ -171,7 +171,7 @@ TString IKikimrGateway::CreateIndexTablePath(const TString& tableName, const TSt
void IKikimrGateway::BuildIndexMetadata(TTableMetadataResult& loadTableMetadataResult) {
auto tableMetadata = loadTableMetadataResult.Metadata;
YQL_ENSURE(tableMetadata);
-
+
if (tableMetadata->Indexes.empty()) {
return;
}
@@ -182,27 +182,27 @@ void IKikimrGateway::BuildIndexMetadata(TTableMetadataResult& loadTableMetadataR
NKikimr::NTableIndex::TTableColumns tableColumns;
tableColumns.Columns.reserve(tableMetadata->Columns.size());
- for (auto& column: tableMetadata->Columns) {
+ for (auto& column: tableMetadata->Columns) {
tableColumns.Columns.insert_noresize(column.first);
- }
+ }
tableColumns.Keys = tableMetadata->KeyColumnNames;
- tableMetadata->SecondaryGlobalIndexMetadata.resize(indexesCount);
+ tableMetadata->SecondaryGlobalIndexMetadata.resize(indexesCount);
for (size_t i = 0; i < indexesCount; i++) {
const auto& index = tableMetadata->Indexes[i];
- auto indexTablePath = CreateIndexTablePath(tableName, index.Name);
+ auto indexTablePath = CreateIndexTablePath(tableName, index.Name);
NKikimr::NTableIndex::TTableColumns indexTableColumns = NKikimr::NTableIndex::CalcTableImplDescription(
tableColumns,
NKikimr::NTableIndex::TIndexColumns{index.KeyColumns, {}});
- TKikimrTableMetadataPtr indexTableMetadata = new TKikimrTableMetadata(cluster, indexTablePath);
- indexTableMetadata->DoesExist = true;
+ TKikimrTableMetadataPtr indexTableMetadata = new TKikimrTableMetadata(cluster, indexTablePath);
+ indexTableMetadata->DoesExist = true;
indexTableMetadata->KeyColumnNames = indexTableColumns.Keys;
for (auto& column: indexTableColumns.Columns) {
- indexTableMetadata->Columns[column] = tableMetadata->Columns.at(column);
- }
-
- tableMetadata->SecondaryGlobalIndexMetadata[i] = indexTableMetadata;
+ indexTableMetadata->Columns[column] = tableMetadata->Columns.at(column);
+ }
+
+ tableMetadata->SecondaryGlobalIndexMetadata[i] = indexTableMetadata;
}
}
diff --git a/ydb/core/kqp/provider/yql_kikimr_gateway.h b/ydb/core/kqp/provider/yql_kikimr_gateway.h
index 025b034085a..7598494a2b9 100644
--- a/ydb/core/kqp/provider/yql_kikimr_gateway.h
+++ b/ydb/core/kqp/provider/yql_kikimr_gateway.h
@@ -53,7 +53,7 @@ struct TIndexDescription {
};
- // Index states here must be in sync with NKikimrSchemeOp::EIndexState protobuf
+ // Index states here must be in sync with NKikimrSchemeOp::EIndexState protobuf
enum class EIndexState : ui32 {
Invalid = 0, // this state should not be used
Ready = 1, // index is ready to use
@@ -82,7 +82,7 @@ struct TIndexDescription {
, PathOwnerId(pathOwnerId)
{}
- TIndexDescription(const NKikimrSchemeOp::TIndexDescription& index)
+ TIndexDescription(const NKikimrSchemeOp::TIndexDescription& index)
: Name(index.GetName())
, KeyColumns(index.GetKeyColumnNames().begin(), index.GetKeyColumnNames().end())
, DataColumns(index.GetDataColumnNames().begin(), index.GetDataColumnNames().end())
@@ -104,7 +104,7 @@ struct TIndexDescription {
, PathOwnerId(message->GetPathOwnerId())
{}
- static TIndexDescription::EType ConvertIndexType(const NKikimrSchemeOp::TIndexDescription& index) {
+ static TIndexDescription::EType ConvertIndexType(const NKikimrSchemeOp::TIndexDescription& index) {
auto type = NYql::TIndexDescription::EType::GlobalSync;
if (index.GetType() == NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync) {
type = NYql::TIndexDescription::EType::GlobalAsync;
@@ -599,8 +599,8 @@ public:
virtual NThreading::TFuture<TGenericResult> AlterTable(Ydb::Table::AlterTableRequest&& req, const TString& cluster) = 0;
- virtual NThreading::TFuture<TGenericResult> RenameTable(const TString& src, const TString& dst, const TString& cluster) = 0;
-
+ virtual NThreading::TFuture<TGenericResult> RenameTable(const TString& src, const TString& dst, const TString& cluster) = 0;
+
virtual NThreading::TFuture<TGenericResult> DropTable(const TString& cluster, const TString& table) = 0;
virtual NThreading::TFuture<TGenericResult> CreateUser(const TString& cluster, const TCreateUserSettings& settings) = 0;
diff --git a/ydb/core/kqp/provider/yql_kikimr_gateway_ut.cpp b/ydb/core/kqp/provider/yql_kikimr_gateway_ut.cpp
index 607b17d12e0..791a617c083 100644
--- a/ydb/core/kqp/provider/yql_kikimr_gateway_ut.cpp
+++ b/ydb/core/kqp/provider/yql_kikimr_gateway_ut.cpp
@@ -173,10 +173,10 @@ void CheckPolicies(Tests::TClient& client, const TString& tableName) {
for (const auto family : desc.GetTable().GetPartitionConfig().GetColumnFamilies()) {
if (family.HasId() && family.GetId() == 0) {
UNIT_ASSERT_VALUES_EQUAL(static_cast<size_t>(family.GetColumnCodec()),
- static_cast<size_t>(NKikimrSchemeOp::ColumnCodecPlain));
+ static_cast<size_t>(NKikimrSchemeOp::ColumnCodecPlain));
} else if (family.HasName() && family.GetName() == "Family2") {
UNIT_ASSERT_VALUES_EQUAL(static_cast<size_t>(family.GetColumnCodec()),
- static_cast<size_t>(NKikimrSchemeOp::ColumnCodecLZ4));
+ static_cast<size_t>(NKikimrSchemeOp::ColumnCodecLZ4));
}
}
}
diff --git a/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp b/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp
index ab8c5682d95..692165204ae 100644
--- a/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp
+++ b/ydb/core/kqp/provider/yql_kikimr_type_ann.cpp
@@ -876,9 +876,9 @@ private:
for (const auto& action : node.Actions()) {
auto name = action.Name().Value();
- if (name == "renameTo") {
- YQL_ENSURE(action.Value().Cast<TCoAtom>().Value());
- } else if (name == "addColumns") {
+ if (name == "renameTo") {
+ YQL_ENSURE(action.Value().Cast<TCoAtom>().Value());
+ } else if (name == "addColumns") {
auto listNode = action.Value().Cast<TExprList>();
for (size_t i = 0; i < listNode.Size(); ++i) {
auto item = listNode.Item(i);
diff --git a/ydb/core/kqp/proxy/kqp_proxy_ut.cpp b/ydb/core/kqp/proxy/kqp_proxy_ut.cpp
index d7ce975b69f..49224bf2f46 100644
--- a/ydb/core/kqp/proxy/kqp_proxy_ut.cpp
+++ b/ydb/core/kqp/proxy/kqp_proxy_ut.cpp
@@ -16,7 +16,7 @@
namespace NKikimr::NKqp {
using namespace Tests;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
struct TSimpleResource {
ui32 Cnt;
@@ -58,9 +58,9 @@ void InitRoot(Tests::TServer::TPtr server,
auto tid = ChangeStateStorage(SchemeRoot, settings.Domain);
const TDomainsInfo::TDomain& domain = runtime.GetAppData().DomainsInfo->GetDomain(settings.Domain);
- auto evTx = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(1, tid);
+ auto evTx = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(1, tid);
auto transaction = evTx->Record.AddTransaction();
- transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain);
+ transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain);
transaction->SetWorkingDir("/");
auto op = transaction->MutableSubDomain();
op->SetName(domain.Name);
@@ -75,17 +75,17 @@ void InitRoot(Tests::TServer::TPtr server,
{
TAutoPtr<IEventHandle> handle;
- auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvModifySchemeTransactionResult>(handle);
+ auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvModifySchemeTransactionResult>(handle);
UNIT_ASSERT_VALUES_EQUAL(event->Record.GetSchemeshardId(), tid);
- UNIT_ASSERT_VALUES_EQUAL(event->Record.GetStatus(), NKikimrScheme::EStatus::StatusAccepted);
+ UNIT_ASSERT_VALUES_EQUAL(event->Record.GetStatus(), NKikimrScheme::EStatus::StatusAccepted);
}
- auto evSubscribe = MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(1);
+ auto evSubscribe = MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(1);
runtime.SendToPipe(tid, sender, evSubscribe.Release(), 0, GetPipeConfigWithRetries());
{
TAutoPtr<IEventHandle> handle;
- auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvNotifyTxCompletionResult>(handle);
+ auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvNotifyTxCompletionResult>(handle);
UNIT_ASSERT_VALUES_EQUAL(event->Record.GetTxId(), 1);
}
}
diff --git a/ydb/core/kqp/ut/common/kqp_ut_common.cpp b/ydb/core/kqp/ut/common/kqp_ut_common.cpp
index 82274913c75..9bc7889f92f 100644
--- a/ydb/core/kqp/ut/common/kqp_ut_common.cpp
+++ b/ydb/core/kqp/ut/common/kqp_ut_common.cpp
@@ -107,7 +107,7 @@ TKikimrRunner::TKikimrRunner(const TKikimrSettings& settings) {
ServerSettings->SetEnableDataColumnForIndexTable(true);
ServerSettings->SetKeepSnapshotTimeout(settings.KeepSnapshotTimeout);
ServerSettings->SetFrFactory(&UdfFrFactory);
- ServerSettings->SetEnableSchemeTransactionsAtSchemeShard(true);
+ ServerSettings->SetEnableSchemeTransactionsAtSchemeShard(true);
ServerSettings->SetEnableNotNullColumns(true);
if (settings.LogStream)
ServerSettings->SetLogBackend(new TStreamLogBackend(settings.LogStream));
diff --git a/ydb/core/kqp/ut/kqp_scheme_ut.cpp b/ydb/core/kqp/ut/kqp_scheme_ut.cpp
index b89de44ebbe..ca7ffa42a4f 100644
--- a/ydb/core/kqp/ut/kqp_scheme_ut.cpp
+++ b/ydb/core/kqp/ut/kqp_scheme_ut.cpp
@@ -755,117 +755,117 @@ Y_UNIT_TEST_SUITE(KqpScheme) {
CreateAndAlterTableWithPartitionSize(true);
}
- Y_UNIT_TEST(RenameTable) {
- TKikimrRunner kikimr;
- auto db = kikimr.GetTableClient();
- auto session = db.CreateSession().GetValueSync().GetSession();
-
- {
- TString query = R"(
- --!syntax_v1
- CREATE TABLE `/Root/table` (
- Key Uint64,
- Value String,
- PRIMARY KEY (Key)
- );
- )";
- auto result = session.ExecuteSchemeQuery(query).GetValueSync();
- UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
- }
-
- {
- auto query = TStringBuilder() << R"(
- --!syntax_v1
- ALTER TABLE `/Root/table` RENAME TO `/Root/moved`;
- )";
-
- const auto result = session.ExecuteSchemeQuery(query).GetValueSync();
- UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
-
- auto describeResult = session.DescribeTable("/Root/moved").GetValueSync();
- UNIT_ASSERT_C(describeResult.IsSuccess(), result.GetIssues().ToString());
- }
-
- {
- auto query = TStringBuilder() << R"(
- --!syntax_v1
- ALTER TABLE `moved` RENAME TO `/Root/table`
- )";
-
- const auto result = session.ExecuteSchemeQuery(query).GetValueSync();
- UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
-
- auto describeResult = session.DescribeTable("/Root/table").GetValueSync();
- UNIT_ASSERT_C(describeResult.IsSuccess(), result.GetIssues().ToString());
- }
-
- {
- auto query = TStringBuilder() << R"(
- --!syntax_v1
- CREATE TABLE `/Root/second` (
- Key Uint64,
- Value String,
- PRIMARY KEY (Key)
- );
- )";
- auto result = session.ExecuteSchemeQuery(query).GetValueSync();
- UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
- }
-
- {
- auto query = TStringBuilder() << R"(
- --!syntax_v1
- ALTER TABLE `table` RENAME TO `/Root/moved`;
- ALTER TABLE `/Root/second` RENAME TO `movedsecond`;
- )";
-
- const auto result = session.ExecuteSchemeQuery(query).GetValueSync();
- UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
-
- {
- auto describeResult = session.DescribeTable("/Root/moved").GetValueSync();
- UNIT_ASSERT_C(describeResult.IsSuccess(), result.GetIssues().ToString());
- }
- {
- auto describeResult = session.DescribeTable("/Root/movedsecond").GetValueSync();
- UNIT_ASSERT_C(describeResult.IsSuccess(), result.GetIssues().ToString());
- }
- }
-
- {
- auto query = TStringBuilder() << R"(
- --!syntax_v1
- ALTER TABLE `/Root/moved` RENAME TO `/Root/table`;
- ALTER TABLE `/Root/movedsecond` RENAME TO `/Root/second`;
- )";
-
- const auto result = session.ExecuteSchemeQuery(query << ";").GetValueSync();
- UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
- }
-
- {
- auto query = TStringBuilder() << R"(
- --!syntax_v1
- DROP TABLE `/Root/second`;
- ALTER TABLE `/Root/table` RENAME TO `/Root/second`;
- )";
-
- const auto result = session.ExecuteSchemeQuery(query).GetValueSync();
- UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
-
- {
- auto describeResult = session.DescribeTable("/Root/second").GetValueSync();
- UNIT_ASSERT_C(describeResult.IsSuccess(), result.GetIssues().ToString());
- }
-
- {
- auto describeResult = session.DescribeTable("/Root/table").GetValueSync();
- UNIT_ASSERT_C(!describeResult.IsSuccess(), result.GetIssues().ToString());
- }
- }
-
- }
-
+ Y_UNIT_TEST(RenameTable) {
+ TKikimrRunner kikimr;
+ auto db = kikimr.GetTableClient();
+ auto session = db.CreateSession().GetValueSync().GetSession();
+
+ {
+ TString query = R"(
+ --!syntax_v1
+ CREATE TABLE `/Root/table` (
+ Key Uint64,
+ Value String,
+ PRIMARY KEY (Key)
+ );
+ )";
+ auto result = session.ExecuteSchemeQuery(query).GetValueSync();
+ UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
+ }
+
+ {
+ auto query = TStringBuilder() << R"(
+ --!syntax_v1
+ ALTER TABLE `/Root/table` RENAME TO `/Root/moved`;
+ )";
+
+ const auto result = session.ExecuteSchemeQuery(query).GetValueSync();
+ UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
+
+ auto describeResult = session.DescribeTable("/Root/moved").GetValueSync();
+ UNIT_ASSERT_C(describeResult.IsSuccess(), result.GetIssues().ToString());
+ }
+
+ {
+ auto query = TStringBuilder() << R"(
+ --!syntax_v1
+ ALTER TABLE `moved` RENAME TO `/Root/table`
+ )";
+
+ const auto result = session.ExecuteSchemeQuery(query).GetValueSync();
+ UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
+
+ auto describeResult = session.DescribeTable("/Root/table").GetValueSync();
+ UNIT_ASSERT_C(describeResult.IsSuccess(), result.GetIssues().ToString());
+ }
+
+ {
+ auto query = TStringBuilder() << R"(
+ --!syntax_v1
+ CREATE TABLE `/Root/second` (
+ Key Uint64,
+ Value String,
+ PRIMARY KEY (Key)
+ );
+ )";
+ auto result = session.ExecuteSchemeQuery(query).GetValueSync();
+ UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
+ }
+
+ {
+ auto query = TStringBuilder() << R"(
+ --!syntax_v1
+ ALTER TABLE `table` RENAME TO `/Root/moved`;
+ ALTER TABLE `/Root/second` RENAME TO `movedsecond`;
+ )";
+
+ const auto result = session.ExecuteSchemeQuery(query).GetValueSync();
+ UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
+
+ {
+ auto describeResult = session.DescribeTable("/Root/moved").GetValueSync();
+ UNIT_ASSERT_C(describeResult.IsSuccess(), result.GetIssues().ToString());
+ }
+ {
+ auto describeResult = session.DescribeTable("/Root/movedsecond").GetValueSync();
+ UNIT_ASSERT_C(describeResult.IsSuccess(), result.GetIssues().ToString());
+ }
+ }
+
+ {
+ auto query = TStringBuilder() << R"(
+ --!syntax_v1
+ ALTER TABLE `/Root/moved` RENAME TO `/Root/table`;
+ ALTER TABLE `/Root/movedsecond` RENAME TO `/Root/second`;
+ )";
+
+ const auto result = session.ExecuteSchemeQuery(query << ";").GetValueSync();
+ UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
+ }
+
+ {
+ auto query = TStringBuilder() << R"(
+ --!syntax_v1
+ DROP TABLE `/Root/second`;
+ ALTER TABLE `/Root/table` RENAME TO `/Root/second`;
+ )";
+
+ const auto result = session.ExecuteSchemeQuery(query).GetValueSync();
+ UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
+
+ {
+ auto describeResult = session.DescribeTable("/Root/second").GetValueSync();
+ UNIT_ASSERT_C(describeResult.IsSuccess(), result.GetIssues().ToString());
+ }
+
+ {
+ auto describeResult = session.DescribeTable("/Root/table").GetValueSync();
+ UNIT_ASSERT_C(!describeResult.IsSuccess(), result.GetIssues().ToString());
+ }
+ }
+
+ }
+
void CreateAndAlterTableWithPartitioningByLoad(bool compat) {
TKikimrRunner kikimr;
auto db = kikimr.GetTableClient();
diff --git a/ydb/core/metering/metering.cpp b/ydb/core/metering/metering.cpp
index 48e7e782d64..598de386922 100644
--- a/ydb/core/metering/metering.cpp
+++ b/ydb/core/metering/metering.cpp
@@ -1,129 +1,129 @@
-#include "metering.h"
-
-#include <library/cpp/logger/record.h>
-#include <library/cpp/actors/core/hfunc.h>
-#include <library/cpp/actors/core/log.h>
-
-#include <util/string/builder.h>
-
-#if defined LOG_T || \
- defined LOG_D || \
- defined LOG_I || \
- defined LOG_N || \
- defined LOG_W || \
- defined LOG_E
-# error log macro redefinition
-#endif
-
-#define LOG_T(stream) LOG_TRACE_S((TlsActivationContext->AsActorContext()), NKikimrServices::METERING_WRITER, stream)
-#define LOG_D(stream) LOG_DEBUG_S((TlsActivationContext->AsActorContext()), NKikimrServices::METERING_WRITER, stream)
-#define LOG_I(stream) LOG_INFO_S((TlsActivationContext->AsActorContext()), NKikimrServices::METERING_WRITER, stream)
-#define LOG_N(stream) LOG_NOTICE_S((TlsActivationContext->AsActorContext()), NKikimrServices::METERING_WRITER, stream)
-#define LOG_W(stream) LOG_WARN_S((TlsActivationContext->AsActorContext()), NKikimrServices::METERING_WRITER, stream)
-#define LOG_E(stream) LOG_ERROR_S((TlsActivationContext->AsActorContext()), NKikimrServices::METERING_WRITER, stream)
-
-namespace NKikimr {
-namespace NMetering {
-
-namespace {
-using namespace NActors;
-
-////////////////////////////////////////////////////////////////////////////////
-class TMeteringWriteActor final
- : public TActor<TMeteringWriteActor>
-{
-private:
- const THolder<TLogBackend> MeteringFile;
-public:
- TMeteringWriteActor(THolder<TLogBackend> meteringFile)
- : TActor(&TThis::StateWork)
- , MeteringFile(std::move(meteringFile))
- {
- }
-
- static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
- return NKikimrServices::TActivity::METERING_WRITER_ACTOR;
- }
-
-private:
- STFUNC(StateWork);
-
- void HandlePoisonPill(
- const TEvents::TEvPoisonPill::TPtr& ev,
- const TActorContext& ctx);
-
- void HandleWriteMeteringJson(
- const TEvMetering::TEvWriteMeteringJson::TPtr& ev,
- const TActorContext& ctx);
-
- void HandleUnexpectedEvent(STFUNC_SIG);
-};
-
-////////////////////////////////////////////////////////////////////////////////
-void TMeteringWriteActor::HandlePoisonPill(
- const TEvents::TEvPoisonPill::TPtr& ev,
- const TActorContext& ctx)
-{
- Y_UNUSED(ev);
- Die(ctx);
-}
-
-STFUNC(TMeteringWriteActor::StateWork)
-{
- switch (ev->GetTypeRewrite()) {
- HFunc(TEvents::TEvPoisonPill, HandlePoisonPill);
- HFunc(TEvMetering::TEvWriteMeteringJson, HandleWriteMeteringJson);
- default:
- HandleUnexpectedEvent(ev, ctx);
- break;
- }
-}
-
-void TMeteringWriteActor::HandleWriteMeteringJson(
- const TEvMetering::TEvWriteMeteringJson::TPtr& ev,
- const TActorContext& ctx)
-{
- Y_UNUSED(ctx);
-
- const auto* msg = ev->Get();
- try {
- MeteringFile->WriteData(
- TLogRecord(
- ELogPriority::TLOG_INFO,
- msg->MeteringJson.data(),
- msg->MeteringJson.length()));
- } catch (const TFileError& e) {
- LOG_W("TMeteringWriteActor:"
- << " unable to write metering data (error: " << e.what() << ")");
- }
-}
-
-void TMeteringWriteActor::HandleUnexpectedEvent(STFUNC_SIG)
-{
- Y_UNUSED(ctx);
-
- LOG_W("TMeteringWriteActor:"
- << " unhandled event type: " << ev->GetTypeRewrite()
- << " event: " << (ev->HasEvent() ? ev->GetBase()->ToString().data() : "serialized?"));
-}
-
-} // namespace
-
-////////////////////////////////////////////////////////////////////////////////
-THolder<NActors::IActor> CreateMeteringWriter(THolder<TLogBackend> meteringFile)
-{
+#include "metering.h"
+
+#include <library/cpp/logger/record.h>
+#include <library/cpp/actors/core/hfunc.h>
+#include <library/cpp/actors/core/log.h>
+
+#include <util/string/builder.h>
+
+#if defined LOG_T || \
+ defined LOG_D || \
+ defined LOG_I || \
+ defined LOG_N || \
+ defined LOG_W || \
+ defined LOG_E
+# error log macro redefinition
+#endif
+
+#define LOG_T(stream) LOG_TRACE_S((TlsActivationContext->AsActorContext()), NKikimrServices::METERING_WRITER, stream)
+#define LOG_D(stream) LOG_DEBUG_S((TlsActivationContext->AsActorContext()), NKikimrServices::METERING_WRITER, stream)
+#define LOG_I(stream) LOG_INFO_S((TlsActivationContext->AsActorContext()), NKikimrServices::METERING_WRITER, stream)
+#define LOG_N(stream) LOG_NOTICE_S((TlsActivationContext->AsActorContext()), NKikimrServices::METERING_WRITER, stream)
+#define LOG_W(stream) LOG_WARN_S((TlsActivationContext->AsActorContext()), NKikimrServices::METERING_WRITER, stream)
+#define LOG_E(stream) LOG_ERROR_S((TlsActivationContext->AsActorContext()), NKikimrServices::METERING_WRITER, stream)
+
+namespace NKikimr {
+namespace NMetering {
+
+namespace {
+using namespace NActors;
+
+////////////////////////////////////////////////////////////////////////////////
+class TMeteringWriteActor final
+ : public TActor<TMeteringWriteActor>
+{
+private:
+ const THolder<TLogBackend> MeteringFile;
+public:
+ TMeteringWriteActor(THolder<TLogBackend> meteringFile)
+ : TActor(&TThis::StateWork)
+ , MeteringFile(std::move(meteringFile))
+ {
+ }
+
+ static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
+ return NKikimrServices::TActivity::METERING_WRITER_ACTOR;
+ }
+
+private:
+ STFUNC(StateWork);
+
+ void HandlePoisonPill(
+ const TEvents::TEvPoisonPill::TPtr& ev,
+ const TActorContext& ctx);
+
+ void HandleWriteMeteringJson(
+ const TEvMetering::TEvWriteMeteringJson::TPtr& ev,
+ const TActorContext& ctx);
+
+ void HandleUnexpectedEvent(STFUNC_SIG);
+};
+
+////////////////////////////////////////////////////////////////////////////////
+void TMeteringWriteActor::HandlePoisonPill(
+ const TEvents::TEvPoisonPill::TPtr& ev,
+ const TActorContext& ctx)
+{
+ Y_UNUSED(ev);
+ Die(ctx);
+}
+
+STFUNC(TMeteringWriteActor::StateWork)
+{
+ switch (ev->GetTypeRewrite()) {
+ HFunc(TEvents::TEvPoisonPill, HandlePoisonPill);
+ HFunc(TEvMetering::TEvWriteMeteringJson, HandleWriteMeteringJson);
+ default:
+ HandleUnexpectedEvent(ev, ctx);
+ break;
+ }
+}
+
+void TMeteringWriteActor::HandleWriteMeteringJson(
+ const TEvMetering::TEvWriteMeteringJson::TPtr& ev,
+ const TActorContext& ctx)
+{
+ Y_UNUSED(ctx);
+
+ const auto* msg = ev->Get();
+ try {
+ MeteringFile->WriteData(
+ TLogRecord(
+ ELogPriority::TLOG_INFO,
+ msg->MeteringJson.data(),
+ msg->MeteringJson.length()));
+ } catch (const TFileError& e) {
+ LOG_W("TMeteringWriteActor:"
+ << " unable to write metering data (error: " << e.what() << ")");
+ }
+}
+
+void TMeteringWriteActor::HandleUnexpectedEvent(STFUNC_SIG)
+{
+ Y_UNUSED(ctx);
+
+ LOG_W("TMeteringWriteActor:"
+ << " unhandled event type: " << ev->GetTypeRewrite()
+ << " event: " << (ev->HasEvent() ? ev->GetBase()->ToString().data() : "serialized?"));
+}
+
+} // namespace
+
+////////////////////////////////////////////////////////////////////////////////
+THolder<NActors::IActor> CreateMeteringWriter(THolder<TLogBackend> meteringFile)
+{
return MakeHolder<TMeteringWriteActor>(std::move(meteringFile));
-}
-
-
-void SendMeteringJson(const NActors::TActorContext &ctx, TString message)
-{
- auto request = MakeHolder<TEvMetering::TEvWriteMeteringJson>(std::move(message));
- ctx.Send(
- MakeMeteringServiceID(),
- request.Release());
-}
-
-} // namespace NKikime
-} // namespace NMetering
-
+}
+
+
+void SendMeteringJson(const NActors::TActorContext &ctx, TString message)
+{
+ auto request = MakeHolder<TEvMetering::TEvWriteMeteringJson>(std::move(message));
+ ctx.Send(
+ MakeMeteringServiceID(),
+ request.Release());
+}
+
+} // namespace NKikime
+} // namespace NMetering
+
diff --git a/ydb/core/metering/metering.h b/ydb/core/metering/metering.h
index b7e53252549..6e17fcadf12 100644
--- a/ydb/core/metering/metering.h
+++ b/ydb/core/metering/metering.h
@@ -1,61 +1,61 @@
-#pragma once
-
+#pragma once
+
#include <ydb/core/base/events.h>
-
-#include <library/cpp/actors/core/actor.h>
-#include <library/cpp/actors/core/events.h>
-#include <library/cpp/logger/backend.h>
-
-#include <util/generic/strbuf.h>
-
-namespace NKikimr {
-namespace NMetering {
-
-
-struct TEvMetering
-{
- //
- // Events declaration
- //
-
- enum EEvents
- {
- EvBegin = EventSpaceBegin(TKikimrEvents::ES_YDB_METERING),
-
- // Request actors
- EvWriteMeteringJson = EvBegin + 0,
-
- EvEnd
- };
-
- static_assert(EvEnd <= EventSpaceEnd(TKikimrEvents::ES_YDB_METERING),
- "expected EvEnd <= EventSpaceEnd(TKikimrEvents::ES_YDB_METERING)");
-
- //
- // WriteMeteringJson
- //
-
- struct TEvWriteMeteringJson
- : public NActors::TEventLocal<TEvWriteMeteringJson, EvWriteMeteringJson>
- {
- TString MeteringJson;
-
- TEvWriteMeteringJson(TString meteringJson)
- : MeteringJson(std::move(meteringJson))
- {}
- };
-};
-
-////////////////////////////////////////////////////////////////////////////////
-
-void SendMeteringJson(const NActors::TActorContext& ctx, TString message);
-
-inline NActors::TActorId MakeMeteringServiceID() {
+
+#include <library/cpp/actors/core/actor.h>
+#include <library/cpp/actors/core/events.h>
+#include <library/cpp/logger/backend.h>
+
+#include <util/generic/strbuf.h>
+
+namespace NKikimr {
+namespace NMetering {
+
+
+struct TEvMetering
+{
+ //
+ // Events declaration
+ //
+
+ enum EEvents
+ {
+ EvBegin = EventSpaceBegin(TKikimrEvents::ES_YDB_METERING),
+
+ // Request actors
+ EvWriteMeteringJson = EvBegin + 0,
+
+ EvEnd
+ };
+
+ static_assert(EvEnd <= EventSpaceEnd(TKikimrEvents::ES_YDB_METERING),
+ "expected EvEnd <= EventSpaceEnd(TKikimrEvents::ES_YDB_METERING)");
+
+ //
+ // WriteMeteringJson
+ //
+
+ struct TEvWriteMeteringJson
+ : public NActors::TEventLocal<TEvWriteMeteringJson, EvWriteMeteringJson>
+ {
+ TString MeteringJson;
+
+ TEvWriteMeteringJson(TString meteringJson)
+ : MeteringJson(std::move(meteringJson))
+ {}
+ };
+};
+
+////////////////////////////////////////////////////////////////////////////////
+
+void SendMeteringJson(const NActors::TActorContext& ctx, TString message);
+
+inline NActors::TActorId MakeMeteringServiceID() {
return NActors::TActorId(0, TStringBuf("YDB_METER"));
-}
-
-THolder<NActors::IActor> CreateMeteringWriter(
- THolder<TLogBackend> meteringFile);
-
-} // namespace NKikimr
-} // namespace NMetering
+}
+
+THolder<NActors::IActor> CreateMeteringWriter(
+ THolder<TLogBackend> meteringFile);
+
+} // namespace NKikimr
+} // namespace NMetering
diff --git a/ydb/core/metering/time_grid.h b/ydb/core/metering/time_grid.h
index c57ca77e0c7..ce1630d02d4 100644
--- a/ydb/core/metering/time_grid.h
+++ b/ydb/core/metering/time_grid.h
@@ -1,48 +1,48 @@
-#pragma once
-
-#include <util/datetime/base.h>
-
-namespace NKikimr {
-
+#pragma once
+
+#include <util/datetime/base.h>
+
+namespace NKikimr {
+
// Time grid taking into account the features of billing slots
- struct TTimeGrid {
- struct TSlot {
- TInstant Start;
- TInstant End;
-
- TSlot(TInstant start, TInstant end)
- : Start(start)
- , End(end)
- {}
- };
-
+ struct TTimeGrid {
+ struct TSlot {
+ TInstant Start;
+ TInstant End;
+
+ TSlot(TInstant start, TInstant end)
+ : Start(start)
+ , End(end)
+ {}
+ };
+
TDuration Period;
-
- TTimeGrid(TDuration period)
- : Period(period)
- {
- Y_VERIFY(Period >= TDuration::Seconds(1));
+
+ TTimeGrid(TDuration period)
+ : Period(period)
+ {
+ Y_VERIFY(Period >= TDuration::Seconds(1));
Y_VERIFY(Period <= TDuration::Hours(1));
Y_VERIFY(TDuration::Hours(1).MicroSeconds() % Period.MicroSeconds() == 0);
- }
-
- const TSlot Get(TInstant now) const {
- auto hour = TInstant::Hours(now.Hours());
-
- auto passedFromHourBegin = now - hour;
-
- ui64 slotNo = passedFromHourBegin.Seconds() / Period.Seconds();
-
- return TSlot(hour + slotNo * Period, hour + (slotNo + 1) * Period - TDuration::Seconds(1));
- }
-
- const TSlot GetPrev(TSlot p) const {
- return TSlot(p.Start - Period, p.End - Period);
- }
-
- const TSlot GetNext(TSlot p) const {
- return TSlot(p.Start + Period, p.End + Period);
- }
- };
-
+ }
+
+ const TSlot Get(TInstant now) const {
+ auto hour = TInstant::Hours(now.Hours());
+
+ auto passedFromHourBegin = now - hour;
+
+ ui64 slotNo = passedFromHourBegin.Seconds() / Period.Seconds();
+
+ return TSlot(hour + slotNo * Period, hour + (slotNo + 1) * Period - TDuration::Seconds(1));
+ }
+
+ const TSlot GetPrev(TSlot p) const {
+ return TSlot(p.Start - Period, p.End - Period);
+ }
+
+ const TSlot GetNext(TSlot p) const {
+ return TSlot(p.Start + Period, p.End + Period);
+ }
+ };
+
} // namespace NKikimr
diff --git a/ydb/core/metering/ya.make b/ydb/core/metering/ya.make
index 007acfbfc7e..a1e9a4d3393 100644
--- a/ydb/core/metering/ya.make
+++ b/ydb/core/metering/ya.make
@@ -2,32 +2,32 @@ RECURSE_FOR_TESTS(
ut
)
-LIBRARY()
-
-OWNER(
- svc
- g:kikimr
-)
-
-SRCS(
+LIBRARY()
+
+OWNER(
+ svc
+ g:kikimr
+)
+
+SRCS(
bill_record.cpp
bill_record.h
- metering.cpp
- metering.h
+ metering.cpp
+ metering.h
time_grid.h
-)
-
+)
+
GENERATE_ENUM_SERIALIZATION(bill_record.h)
-PEERDIR(
- library/cpp/actors/core
+PEERDIR(
+ library/cpp/actors/core
library/cpp/json
- library/cpp/logger
+ library/cpp/logger
ydb/core/base
-)
-
-RESOURCE(
+)
+
+RESOURCE(
ydb/core/kqp/kqp_default_settings.txt kqp_default_settings.txt
-)
-
-END()
+)
+
+END()
diff --git a/ydb/core/mind/bscontroller/impl.h b/ydb/core/mind/bscontroller/impl.h
index 8ec81ce6758..ba311a254c3 100644
--- a/ydb/core/mind/bscontroller/impl.h
+++ b/ydb/core/mind/bscontroller/impl.h
@@ -1487,7 +1487,7 @@ private:
const NKikimrBlobStorage::EEntityStatus entityStatus);
void ReadVSlot(const TVSlotInfo& vslot, TEvBlobStorage::TEvControllerNodeServiceSetUpdate *result);
-
+
void DefaultSignalTabletActive(const TActorContext&) override
{} // do nothing, we will signal tablet active explicitly after initialization
diff --git a/ydb/core/mind/hive/hive_impl.cpp b/ydb/core/mind/hive/hive_impl.cpp
index e8d95907c4f..58ca2ac3e43 100644
--- a/ydb/core/mind/hive/hive_impl.cpp
+++ b/ydb/core/mind/hive/hive_impl.cpp
@@ -46,10 +46,10 @@ void THive::Handle(TEvHive::TEvCreateTablet::TPtr& ev) {
void THive::Handle(TEvHive::TEvAdoptTablet::TPtr& ev) {
BLOG_D("Handle TEvHive::TEvAdoptTablet");
NKikimrHive::TEvAdoptTablet& rec = ev->Get()->Record;
- Y_VERIFY(rec.HasOwner() && rec.HasOwnerIdx() && rec.HasTabletType());
+ Y_VERIFY(rec.HasOwner() && rec.HasOwnerIdx() && rec.HasTabletType());
Execute(CreateAdoptTablet(rec, ev->Sender, ev->Cookie));
-}
-
+}
+
void THive::Handle(TEvents::TEvPoisonPill::TPtr&) {
BLOG_D("Handle TEvents::TEvPoisonPill");
Send(Tablet(), new TEvents::TEvPoisonPill);
@@ -157,8 +157,8 @@ void THive::Handle(TEvHive::TEvDeleteTablet::TPtr& ev) {
void THive::Handle(TEvHive::TEvDeleteOwnerTablets::TPtr& ev) {
Execute(CreateDeleteOwnerTablets(ev));
-}
-
+}
+
void THive::DeleteTabletWithoutStorage(TLeaderTabletInfo* tablet) {
Y_ENSURE_LOG(tablet->IsDeleting(), "tablet " << tablet->Id);
Y_ENSURE_LOG(tablet->TabletStorageInfo->Channels.empty() || tablet->TabletStorageInfo->Channels[0].History.empty(), "tablet " << tablet->Id);
@@ -667,25 +667,25 @@ void THive::ScheduleDisconnectNode(THolder<TEvPrivate::TEvProcessDisconnectNode>
void THive::Handle(TEvPrivate::TEvKickTablet::TPtr &ev) {
TFullTabletId tabletId(ev->Get()->TabletId);
TTabletInfo* tablet = FindTablet(tabletId);
- if (tablet == nullptr) {
+ if (tablet == nullptr) {
BLOG_W("THive::Handle::TEvKickTablet" <<
" TabletId=" << tabletId <<
" tablet not found");
- return;
- }
-
- if (!tablet->IsAlive()) {
+ return;
+ }
+
+ if (!tablet->IsAlive()) {
BLOG_D("THive::Handle::TEvKickTablet" <<
" TabletId=" << tabletId <<
- " tablet isn't alive");
- return;
- }
-
+ " tablet isn't alive");
+ return;
+ }
+
BLOG_D("THive::Handle::TEvKickTablet TabletId=" << tabletId);
TBestNodeResult result = FindBestNode(*tablet);
- if (result.BestNode == nullptr) {
+ if (result.BestNode == nullptr) {
Execute(CreateRestartTablet(tabletId));
- } else if (result.BestNode != tablet->Node) {
+ } else if (result.BestNode != tablet->Node) {
if (IsTabletMoveExpedient(*tablet, *result.BestNode)) {
Execute(CreateRestartTablet(tabletId));
}
@@ -828,7 +828,7 @@ void THive::OnActivateExecutor(const TActorContext&) {
BLOG_D("THive::OnActivateExecutor");
TDomainsInfo* domainsInfo = AppData()->DomainsInfo.Get();
HiveUid = domainsInfo->GetDefaultHiveUid(domainsInfo->Domains.begin()->first);
- HiveDomain = domainsInfo->GetHiveDomainUid(HiveUid);
+ HiveDomain = domainsInfo->GetHiveDomainUid(HiveUid);
const TDomainsInfo::TDomain& domain = domainsInfo->GetDomain(HiveDomain);
RootHiveId = domainsInfo->GetHive(domain.DefaultHiveUid);
Y_VERIFY(HiveUid != Max<ui32>() && HiveDomain != TDomainsInfo::BadDomainId);
@@ -853,7 +853,7 @@ void THive::DefaultSignalTabletActive(const TActorContext& ctx) {
Y_UNUSED(ctx);
}
-
+
void THive::AssignTabletGroups(TLeaderTabletInfo& tablet) {
ui32 channels = tablet.GetChannelCount();
THashSet<TString> storagePoolsToRefresh;
@@ -867,8 +867,8 @@ void THive::AssignTabletGroups(TLeaderTabletInfo& tablet) {
if (!storagePool.IsFresh() || storagePool.ConfigurationGeneration != ConfigurationGeneration) {
storagePoolsToRefresh.insert(storagePool.Name);
}
- }
- }
+ }
+ }
if (!storagePoolsToRefresh.empty()) {
// we had to refresh storage pool state from BSC
@@ -962,7 +962,7 @@ void THive::Handle(TEvTabletBase::TEvBlockBlobStorageResult::TPtr &ev) {
void THive::Handle(TEvTabletBase::TEvDeleteTabletResult::TPtr &ev) {
Execute(CreateDeleteTabletResult(ev));
}
-
+
template <>
TNodeInfo* THive::SelectNode<NKikimrConfig::THiveConfig::HIVE_NODE_SELECT_STRATEGY_RANDOM>(const std::vector<THive::TSelectedNode>& selectedNodes) {
if (selectedNodes.empty()) {
@@ -1472,9 +1472,9 @@ void THive::UpdateCounterBootQueueSize(ui64 bootQueueSize) {
}
bool THive::DomainHasNodes(const TSubDomainKey &domainKey) const {
- return !DomainsView.IsEmpty(domainKey);
-}
-
+ return !DomainsView.IsEmpty(domainKey);
+}
+
TResourceNormalizedValues THive::GetStDevResourceValues() const {
TVector<TResourceNormalizedValues> values;
values.reserve(Nodes.size());
@@ -1507,11 +1507,11 @@ bool THive::IsTabletMoveExpedient(const TTabletInfo& tablet, const TNodeInfo& no
<< " is expedient because the node is down");
return true;
}
- if (!tablet.Node->IsAllowedToRunTablet(tablet)) {
+ if (!tablet.Node->IsAllowedToRunTablet(tablet)) {
BLOG_TRACE("[TME] Move of tablet " << tablet.ToString() << " from " << tablet.NodeId << " to " << node.Id
<< " is expedient because the current node is unappropriate target for the tablet");
- return true;
- }
+ return true;
+ }
if (tablet.Node->Id == node.Id) {
BLOG_TRACE("[TME] Move of tablet " << tablet.ToString() << " from " << tablet.NodeId << " to " << node.Id
<< " is not expedient because node is the same");
@@ -2039,10 +2039,10 @@ bool THive::IsValidMetricsNetwork(const NKikimrTabletBase::TMetrics& metrics) {
return metrics.GetNetwork() > 1024/*1KBps*/;
}
-TString THive::DebugDomainsActiveNodes() const {
- return DomainsView.AsString();
-}
-
+TString THive::DebugDomainsActiveNodes() const {
+ return DomainsView.AsString();
+}
+
void THive::AggregateMetricsMax(NKikimrTabletBase::TMetrics& aggregate, const NKikimrTabletBase::TMetrics& value) {
aggregate.SetCPU(std::max(aggregate.GetCPU(), value.GetCPU()));
aggregate.SetMemory(std::max(aggregate.GetMemory(), value.GetMemory()));
diff --git a/ydb/core/mind/hive/hive_impl.h b/ydb/core/mind/hive/hive_impl.h
index af068c87f75..70c4530fee0 100644
--- a/ydb/core/mind/hive/hive_impl.h
+++ b/ydb/core/mind/hive/hive_impl.h
@@ -183,7 +183,7 @@ protected:
friend class TTxInitScheme;
friend class TTxDeleteTablet;
- friend class TTxDeleteOwnerTablets;
+ friend class TTxDeleteOwnerTablets;
friend class TTxReassignGroups;
friend class TTxStartTablet;
friend class TTxCreateTablet;
@@ -242,7 +242,7 @@ protected:
void StartHiveFill(TNodeId nodeId, const TActorId& initiator);
void CreateEvMonitoring(NMon::TEvRemoteHttpInfo::TPtr& ev, const TActorContext& ctx);
ITransaction* CreateDeleteTablet(TEvHive::TEvDeleteTablet::TPtr& ev);
- ITransaction* CreateDeleteOwnerTablets(TEvHive::TEvDeleteOwnerTablets::TPtr& ev);
+ ITransaction* CreateDeleteOwnerTablets(TEvHive::TEvDeleteOwnerTablets::TPtr& ev);
ITransaction* CreateDeleteTabletResult(TEvTabletBase::TEvDeleteTabletResult::TPtr& ev);
ITransaction* CreateCutTabletHistory(TEvHive::TEvCutTabletHistory::TPtr& ev);
ITransaction* CreateBlockStorageResult(TEvTabletBase::TEvBlockBlobStorageResult::TPtr& ev);
@@ -298,7 +298,7 @@ protected:
TTabletId RootHiveId;
TTabletId HiveId;
ui64 HiveGeneration;
- TSubDomainKey RootDomainKey;
+ TSubDomainKey RootDomainKey;
TSubDomainKey PrimaryDomainKey;
TString RootDomainName;
TIntrusivePtr<NTabletPipe::TBoundedClientCacheConfig> PipeClientCacheConfig;
@@ -561,7 +561,7 @@ public:
TLeaderTabletInfo* FindTabletEvenInDeleting(TTabletId tabletId); // find tablets, even deleting ones
TTabletInfo& GetTablet(TTabletId tabletId, TFollowerId followerId);
TTabletInfo* FindTablet(TTabletId tabletId, TFollowerId followerId);
- TTabletInfo* FindTablet(const TFullTabletId& tabletId) { return FindTablet(tabletId.first, tabletId.second); }
+ TTabletInfo* FindTablet(const TFullTabletId& tabletId) { return FindTablet(tabletId.first, tabletId.second); }
TTabletInfo* FindTabletEvenInDeleting(TTabletId tabletId, TFollowerId followerId);
TStoragePoolInfo& GetStoragePool(const TString& name);
TStoragePoolInfo* FindStoragePool(const TString& name);
@@ -580,7 +580,7 @@ public:
void UpdateCounterTabletsTotal(i64 tabletsTotalDiff);
void UpdateCounterTabletsAlive(i64 tabletsAliveDiff);
void UpdateCounterBootQueueSize(ui64 bootQueueSize);
- bool DomainHasNodes(const TSubDomainKey &domainKey) const;
+ bool DomainHasNodes(const TSubDomainKey &domainKey) const;
void ProcessBootQueue();
void ProcessWaitQueue();
void PostponeProcessBootQueue(TDuration after);
@@ -757,7 +757,7 @@ protected:
void ScheduleDisconnectNode(THolder<TEvPrivate::TEvProcessDisconnectNode> event);
void DeleteTabletWithoutStorage(TLeaderTabletInfo* tablet);
void ScheduleUnlockTabletExecution(TNodeInfo& node);
- TString DebugDomainsActiveNodes() const;
+ TString DebugDomainsActiveNodes() const;
TResourceNormalizedValues GetStDevResourceValues() const;
bool IsTabletMoveExpedient(const TTabletInfo& tablet, const TNodeInfo& node) const;
TResourceRawValues GetDefaultResourceInitialMaximumValues();
diff --git a/ydb/core/mind/hive/hive_ut.cpp b/ydb/core/mind/hive/hive_ut.cpp
index c41bb8dc8c7..0383d49a123 100644
--- a/ydb/core/mind/hive/hive_ut.cpp
+++ b/ydb/core/mind/hive/hive_ut.cpp
@@ -109,20 +109,20 @@ namespace {
app.AddDomain(domain.Release());
app.AddHive(domainUid, hive);
- }
+ }
static TString STORAGE_POOL = "def";
void SetupChannels(TAppPrepare &app) {
- TIntrusivePtr<TChannelProfiles> channelProfiles = new TChannelProfiles;
- channelProfiles->Profiles.emplace_back();
+ TIntrusivePtr<TChannelProfiles> channelProfiles = new TChannelProfiles;
+ channelProfiles->Profiles.emplace_back();
TChannelProfiles::TProfile &profile = channelProfiles->Profiles.back();
- for (ui32 channelIdx = 0; channelIdx < 3; ++channelIdx) {
- profile.Channels.push_back(
- TChannelProfiles::TProfile::TChannel(TBlobStorageGroupType::ErasureNone, 0, NKikimrBlobStorage::TVDiskKind::Default));
+ for (ui32 channelIdx = 0; channelIdx < 3; ++channelIdx) {
+ profile.Channels.push_back(
+ TChannelProfiles::TProfile::TChannel(TBlobStorageGroupType::ErasureNone, 0, NKikimrBlobStorage::TVDiskKind::Default));
}
app.SetChannels(std::move(channelProfiles));
- }
+ }
static TChannelBind GetChannelBind(const TString& storagePool) {
TChannelBind bind;
@@ -132,8 +132,8 @@ namespace {
static TChannelsBindings BINDED_CHANNELS = {GetChannelBind(STORAGE_POOL + "1"), GetChannelBind(STORAGE_POOL + "2"), GetChannelBind(STORAGE_POOL + "3")};
- void SetupNodeWarden(TTestActorRuntime &runtime) {
- for (ui32 nodeIndex = 0; nodeIndex < runtime.GetNodeCount(); ++nodeIndex) {
+ void SetupNodeWarden(TTestActorRuntime &runtime) {
+ for (ui32 nodeIndex = 0; nodeIndex < runtime.GetNodeCount(); ++nodeIndex) {
TString staticConfig(
"AvailabilityDomains: 0 "
"PDisks { NodeID: $Node1 PDiskID: 1 PDiskGuid: 1 Path: \"/tmp/pdisk.dat\" }"
@@ -159,64 +159,64 @@ namespace {
std::swap(nodeWardenConfig->SectorMaps, existingNodeWardenConfig->SectorMaps);
}
- NodeWardenConfigs[nodeIndex] = nodeWardenConfig;
- }
- }
-
- void SetupPDisk(TTestActorRuntime &runtime) {
- if (runtime.GetNodeCount() == 0)
- return;
-
- TIntrusivePtr<TNodeWardenConfig> nodeWardenConfig = NodeWardenConfigs[0];
-
- TString pDiskPath;
+ NodeWardenConfigs[nodeIndex] = nodeWardenConfig;
+ }
+ }
+
+ void SetupPDisk(TTestActorRuntime &runtime) {
+ if (runtime.GetNodeCount() == 0)
+ return;
+
+ TIntrusivePtr<TNodeWardenConfig> nodeWardenConfig = NodeWardenConfigs[0];
+
+ TString pDiskPath;
TIntrusivePtr<NPDisk::TSectorMap> sectorMap;
ui64 pDiskSize = 32ull << 30ull;
- ui64 pDiskChunkSize = 32u << 20u;
- if (true /*in memory*/) {
+ ui64 pDiskChunkSize = 32u << 20u;
+ if (true /*in memory*/) {
pDiskPath = "/tmp/pdisk.dat";
auto& existing = nodeWardenConfig->SectorMaps[pDiskPath];
if (existing && existing->DeviceSize == pDiskSize) {
sectorMap = existing;
- } else {
+ } else {
sectorMap.Reset(new NPDisk::TSectorMap(pDiskSize));
nodeWardenConfig->SectorMaps[pDiskPath] = sectorMap;
}
- } else {
- static TTempDir tempDir;
+ } else {
+ static TTempDir tempDir;
pDiskPath = tempDir() + "/pdisk.dat";
- }
- nodeWardenConfig->ServiceSet.MutablePDisks(0)->SetPath(pDiskPath);
- ui64 pDiskGuid = 1;
- static ui64 iteration = 0;
- ++iteration;
- FormatPDisk(
- pDiskPath,
- pDiskSize,
- 4 << 10,
- pDiskChunkSize,
- pDiskGuid,
+ }
+ nodeWardenConfig->ServiceSet.MutablePDisks(0)->SetPath(pDiskPath);
+ ui64 pDiskGuid = 1;
+ static ui64 iteration = 0;
+ ++iteration;
+ FormatPDisk(
+ pDiskPath,
+ pDiskSize,
+ 4 << 10,
+ pDiskChunkSize,
+ pDiskGuid,
0x1234567890 + iteration,
0x4567890123 + iteration,
0x7890123456 + iteration,
NPDisk::YdbDefaultPDiskSequence,
- TString(""),
- false,
+ TString(""),
+ false,
false,
sectorMap);
- }
+ }
- void SetupLocals(TTestActorRuntime &runtime, bool isLocalEnabled) {
- if (!isLocalEnabled) {
- return;
- }
+ void SetupLocals(TTestActorRuntime &runtime, bool isLocalEnabled) {
+ if (!isLocalEnabled) {
+ return;
+ }
- for (ui32 nodeIndex = 0; nodeIndex < runtime.GetNodeCount(); ++nodeIndex) {
- TLocalConfig::TPtr localConfig(new TLocalConfig());
- localConfig->TabletClassInfo[TTabletTypes::Dummy].SetupInfo = new TTabletSetupInfo(
+ for (ui32 nodeIndex = 0; nodeIndex < runtime.GetNodeCount(); ++nodeIndex) {
+ TLocalConfig::TPtr localConfig(new TLocalConfig());
+ localConfig->TabletClassInfo[TTabletTypes::Dummy].SetupInfo = new TTabletSetupInfo(
&CreateFlatDummyTablet,
- TMailboxType::Simple, 0,
- TMailboxType::Simple, 0);
+ TMailboxType::Simple, 0,
+ TMailboxType::Simple, 0);
localConfig->TabletClassInfo[TTabletTypes::Hive].SetupInfo = new TTabletSetupInfo(
&CreateDefaultHive,
TMailboxType::Simple, 0,
@@ -225,39 +225,39 @@ namespace {
&CreateTxMediator,
TMailboxType::Simple, 0,
TMailboxType::Simple, 0);
- TTenantPoolConfig::TPtr tenantPoolConfig = new TTenantPoolConfig(localConfig);
- tenantPoolConfig->AddStaticSlot(DOMAIN_NAME);
+ TTenantPoolConfig::TPtr tenantPoolConfig = new TTenantPoolConfig(localConfig);
+ tenantPoolConfig->AddStaticSlot(DOMAIN_NAME);
runtime.AddLocalService(MakeTenantPoolRootID(), TActorSetupCmd(
- CreateTenantPool(tenantPoolConfig), TMailboxType::Revolving, 0), nodeIndex);
- }
- }
-
- void EnableSchedule(TTestActorRuntime &runtime, bool isLocalEnabled) {
+ CreateTenantPool(tenantPoolConfig), TMailboxType::Revolving, 0), nodeIndex);
+ }
+ }
+
+ void EnableSchedule(TTestActorRuntime &runtime, bool isLocalEnabled) {
for (ui32 nodeIndex = 0; nodeIndex < runtime.GetNodeCount(); ++nodeIndex) {
if (isLocalEnabled) {
TActorId localActor = runtime.GetLocalServiceId(MakeLocalID(runtime.GetNodeId(nodeIndex)), nodeIndex);
runtime.EnableScheduleForActor(localActor, true);
}
- runtime.EnableScheduleForActor(runtime.GetLocalServiceId(MakeBlobStorageNodeWardenID(runtime.GetNodeId(nodeIndex)), nodeIndex), true);
- runtime.EnableScheduleForActor(runtime.GetLocalServiceId(MakeTabletResolverID(), nodeIndex), true);
+ runtime.EnableScheduleForActor(runtime.GetLocalServiceId(MakeBlobStorageNodeWardenID(runtime.GetNodeId(nodeIndex)), nodeIndex), true);
+ runtime.EnableScheduleForActor(runtime.GetLocalServiceId(MakeTabletResolverID(), nodeIndex), true);
}
- }
+ }
- void SetupServices(TTestActorRuntime &runtime, bool isLocalEnabled) {
+ void SetupServices(TTestActorRuntime &runtime, bool isLocalEnabled) {
TAppPrepare app;
SetupDomainInfo(runtime, app);
SetupChannels(app);
-
+
app.SetMinRequestSequenceSize(10); // for smaller sequences and high interaction between root and domain hives
app.SetRequestSequenceSize(10);
- SetupNodeWarden(runtime);
- SetupPDisk(runtime);
-
- SetupLocals(runtime, isLocalEnabled);
-
+ SetupNodeWarden(runtime);
+ SetupPDisk(runtime);
+
+ SetupLocals(runtime, isLocalEnabled);
+
for (ui32 nodeIndex = 0; nodeIndex < runtime.GetNodeCount(); ++nodeIndex) {
SetupStateStorage(runtime, nodeIndex);
SetupBSNodeWarden(runtime, nodeIndex, NodeWardenConfigs[nodeIndex]);
@@ -266,7 +266,7 @@ namespace {
}
runtime.Initialize(app.Unwrap());
-
+
for (ui32 nodeIndex = 0; nodeIndex < runtime.GetNodeCount(); ++nodeIndex) {
auto it = NodeWardenConfigs.find(nodeIndex);
if (it != NodeWardenConfigs.end()) {
@@ -274,10 +274,10 @@ namespace {
}
}
- EnableSchedule(runtime, isLocalEnabled);
-
- const ui32 domainsNum = 1;
- const ui32 disksInDomain = 1;
+ EnableSchedule(runtime, isLocalEnabled);
+
+ const ui32 domainsNum = 1;
+ const ui32 disksInDomain = 1;
if (!runtime.IsRealThreads()) {
TDispatchOptions options;
options.FinalEvents.push_back(TDispatchOptions::TFinalEventCondition(
@@ -419,41 +419,41 @@ void FormatPDiskForTest(TString path, ui64 diskSize, ui32 chunkSize, ui64 guid,
chunkKey, logKey, sysLogKey, NPDisk::YdbDefaultPDiskSequence, "", false, false, sectorMap);
}
-void InitSchemeRoot(TTestBasicRuntime& runtime, const TActorId& sender) {
+void InitSchemeRoot(TTestBasicRuntime& runtime, const TActorId& sender) {
auto evTx = MakeHolder<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction>(1, TTestTxConfig::SchemeShard);
- auto transaction = evTx->Record.AddTransaction();
- transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain);
- transaction->SetWorkingDir("/");
- auto op = transaction->MutableSubDomain();
- op->SetName(DOMAIN_NAME);
-
- for (const auto& [kind, pool] :runtime.GetAppData().DomainsInfo->GetDomain(0).StoragePoolTypes) {
- auto* p = op->AddStoragePools();
- p->SetKind(kind);
- p->SetName(pool.GetName());
- }
-
+ auto transaction = evTx->Record.AddTransaction();
+ transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain);
+ transaction->SetWorkingDir("/");
+ auto op = transaction->MutableSubDomain();
+ op->SetName(DOMAIN_NAME);
+
+ for (const auto& [kind, pool] :runtime.GetAppData().DomainsInfo->GetDomain(0).StoragePoolTypes) {
+ auto* p = op->AddStoragePools();
+ p->SetKind(kind);
+ p->SetName(pool.GetName());
+ }
+
runtime.SendToPipe(TTestTxConfig::SchemeShard, sender, evTx.Release(), 0, GetPipeConfigWithRetries());
-
- {
- TAutoPtr<IEventHandle> handle;
- auto event = runtime.GrabEdgeEvent<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult>(handle);
+
+ {
+ TAutoPtr<IEventHandle> handle;
+ auto event = runtime.GrabEdgeEvent<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult>(handle);
UNIT_ASSERT_VALUES_EQUAL(event->Record.GetSchemeshardId(), TTestTxConfig::SchemeShard);
- UNIT_ASSERT_VALUES_EQUAL(event->Record.GetStatus(), NKikimrScheme::EStatus::StatusAccepted);
- }
-
-// there is no coordinators, so transaction is doomed to hung
-//
-// auto evSubscribe = MakeHolder<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion>(1);
+ UNIT_ASSERT_VALUES_EQUAL(event->Record.GetStatus(), NKikimrScheme::EStatus::StatusAccepted);
+ }
+
+// there is no coordinators, so transaction is doomed to hung
+//
+// auto evSubscribe = MakeHolder<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion>(1);
// runtime.SendToPipe(TTestTxConfig::SchemeShard, sender, evSubscribe.Release(), 0, GetPipeConfigWithRetries());
-
-// {
-// TAutoPtr<IEventHandle> handle;
-// auto event = runtime.GrabEdgeEvent<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult>(handle);
-// UNIT_ASSERT_VALUES_EQUAL(event->Record.GetTxId(), 1);
-// }
-}
-
+
+// {
+// TAutoPtr<IEventHandle> handle;
+// auto event = runtime.GrabEdgeEvent<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult>(handle);
+// UNIT_ASSERT_VALUES_EQUAL(event->Record.GetTxId(), 1);
+// }
+}
+
Y_UNIT_TEST_SUITE(THiveTest) {
template <typename KeyType, typename ValueType>
static double GetStDev(const THashMap<KeyType, ValueType>& values) {
@@ -552,35 +552,35 @@ Y_UNIT_TEST_SUITE(THiveTest) {
return seenEvDeleteTabletResult;
}
- bool SendDeleteTestOwner(TTestActorRuntime &runtime, ui64 hiveTablet,
- THolder<TEvHive::TEvDeleteOwnerTablets> ev, ui32 nodeIndex = 0,
- NKikimrProto::EReplyStatus expectedStatus = NKikimrProto::OK) {
- ui64 owner = ev->Record.GetOwner();
- ui64 txId = ev->Record.GetTxId();
-
- bool seenEvDeleteTabletResult = false;
- TTestActorRuntime::TEventObserver prevObserverFunc;
- prevObserverFunc = runtime.SetObserverFunc([&](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event) {
- if (event->GetTypeRewrite() == TEvTabletBase::EvDeleteTabletResult) {
- seenEvDeleteTabletResult = true;
- }
- return prevObserverFunc(runtime, event);
- });
+ bool SendDeleteTestOwner(TTestActorRuntime &runtime, ui64 hiveTablet,
+ THolder<TEvHive::TEvDeleteOwnerTablets> ev, ui32 nodeIndex = 0,
+ NKikimrProto::EReplyStatus expectedStatus = NKikimrProto::OK) {
+ ui64 owner = ev->Record.GetOwner();
+ ui64 txId = ev->Record.GetTxId();
+
+ bool seenEvDeleteTabletResult = false;
+ TTestActorRuntime::TEventObserver prevObserverFunc;
+ prevObserverFunc = runtime.SetObserverFunc([&](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event) {
+ if (event->GetTypeRewrite() == TEvTabletBase::EvDeleteTabletResult) {
+ seenEvDeleteTabletResult = true;
+ }
+ return prevObserverFunc(runtime, event);
+ });
TActorId senderB = runtime.AllocateEdgeActor(nodeIndex);
- runtime.SendToPipe(hiveTablet, senderB, ev.Release(), 0, GetPipeConfigWithRetries());
- TAutoPtr<IEventHandle> handle;
- auto deleteTabletReply = runtime.GrabEdgeEventRethrow<TEvHive::TEvDeleteOwnerTabletsReply>(handle);
- UNIT_ASSERT(deleteTabletReply);
- UNIT_ASSERT_EQUAL_C(deleteTabletReply->Record.GetStatus(), expectedStatus,
- (ui32)deleteTabletReply->Record.GetStatus() << " != " << (ui32)expectedStatus);
- UNIT_ASSERT_EQUAL_C(deleteTabletReply->Record.GetOwner(), owner,
- deleteTabletReply->Record.GetOwner() << " != " << owner);
- UNIT_ASSERT_EQUAL_C(deleteTabletReply->Record.GetTxId(), txId,
- deleteTabletReply->Record.GetTxId() << " != " << txId);
- runtime.SetObserverFunc(prevObserverFunc);
- return seenEvDeleteTabletResult;
- }
-
+ runtime.SendToPipe(hiveTablet, senderB, ev.Release(), 0, GetPipeConfigWithRetries());
+ TAutoPtr<IEventHandle> handle;
+ auto deleteTabletReply = runtime.GrabEdgeEventRethrow<TEvHive::TEvDeleteOwnerTabletsReply>(handle);
+ UNIT_ASSERT(deleteTabletReply);
+ UNIT_ASSERT_EQUAL_C(deleteTabletReply->Record.GetStatus(), expectedStatus,
+ (ui32)deleteTabletReply->Record.GetStatus() << " != " << (ui32)expectedStatus);
+ UNIT_ASSERT_EQUAL_C(deleteTabletReply->Record.GetOwner(), owner,
+ deleteTabletReply->Record.GetOwner() << " != " << owner);
+ UNIT_ASSERT_EQUAL_C(deleteTabletReply->Record.GetTxId(), txId,
+ deleteTabletReply->Record.GetTxId() << " != " << txId);
+ runtime.SetObserverFunc(prevObserverFunc);
+ return seenEvDeleteTabletResult;
+ }
+
void WaitEvDeleteTabletResult(TTestActorRuntime& runtime) {
TDispatchOptions options;
options.FinalEvents.emplace_back(TEvTabletBase::EvDeleteTabletResult);
@@ -685,16 +685,16 @@ Y_UNIT_TEST_SUITE(THiveTest) {
}
}
- void MakeSureTheTabletIsDeleted(TTestActorRuntime &runtime, ui64 hiveTablet, ui64 tabletId) {
+ void MakeSureTheTabletIsDeleted(TTestActorRuntime &runtime, ui64 hiveTablet, ui64 tabletId) {
TActorId sender = runtime.AllocateEdgeActor();
- runtime.SendToPipe(hiveTablet, sender, new TEvHive::TEvRequestHiveInfo(true));
- TAutoPtr<IEventHandle> handle;
- TEvHive::TEvResponseHiveInfo* response = runtime.GrabEdgeEventRethrow<TEvHive::TEvResponseHiveInfo>(handle);
- for (const NKikimrHive::TTabletInfo& tablet : response->Record.GetTablets()) {
- UNIT_ASSERT_VALUES_UNEQUAL(tablet.GetTabletID(), tabletId);
- }
- }
-
+ runtime.SendToPipe(hiveTablet, sender, new TEvHive::TEvRequestHiveInfo(true));
+ TAutoPtr<IEventHandle> handle;
+ TEvHive::TEvResponseHiveInfo* response = runtime.GrabEdgeEventRethrow<TEvHive::TEvResponseHiveInfo>(handle);
+ for (const NKikimrHive::TTabletInfo& tablet : response->Record.GetTablets()) {
+ UNIT_ASSERT_VALUES_UNEQUAL(tablet.GetTabletID(), tabletId);
+ }
+ }
+
void WaitForTabletIsUp(
TTestActorRuntime &runtime,
i64 tabletId,
@@ -851,8 +851,8 @@ Y_UNIT_TEST_SUITE(THiveTest) {
for (TTabletId tabletId : tablets) {
MakeSureTabletIsUp(runtime, tabletId, 0);
}
- }
-
+ }
+
Y_UNIT_TEST(TestDrain) {
const int NUM_NODES = 3;
const int NUM_TABLETS = 100;
@@ -932,24 +932,24 @@ Y_UNIT_TEST_SUITE(THiveTest) {
MakeSureTabletIsUp(runtime, TTestTxConfig::SchemeShard, 0); // root ss good
TActorId sender = runtime.AllocateEdgeActor(0);
- InitSchemeRoot(runtime, sender);
+ InitSchemeRoot(runtime, sender);
TSubDomainKey subdomainKey;
// Create subdomain
do {
- auto x = MakeHolder<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction>();
- auto* tran = x->Record.AddTransaction();
+ auto x = MakeHolder<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction>();
+ auto* tran = x->Record.AddTransaction();
tran->SetWorkingDir("/dc-1");
- tran->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateSubDomain);
+ tran->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateSubDomain);
auto* subd = tran->MutableSubDomain();
subd->SetName("tenant1");
runtime.SendToPipe(TTestTxConfig::SchemeShard, sender, x.Release());
TAutoPtr<IEventHandle> handle;
- auto reply = runtime.GrabEdgeEventRethrow<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult>(handle, TDuration::MilliSeconds(100));
+ auto reply = runtime.GrabEdgeEventRethrow<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult>(handle, TDuration::MilliSeconds(100));
if (reply) {
subdomainKey = TSubDomainKey(reply->Record.GetSchemeshardId(), reply->Record.GetPathId());
- UNIT_ASSERT_VALUES_EQUAL(reply->Record.GetStatus(), (ui32)NKikimrScheme::EStatus::StatusAccepted);
+ UNIT_ASSERT_VALUES_EQUAL(reply->Record.GetStatus(), (ui32)NKikimrScheme::EStatus::StatusAccepted);
break;
}
} while (true);
@@ -962,8 +962,8 @@ Y_UNIT_TEST_SUITE(THiveTest) {
TTestActorRuntime::TEventObserver prevObserverFunc;
prevObserverFunc = runtime.SetObserverFunc([&](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event) {
- if (event->GetTypeRewrite() == NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult) {
- event->Get<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>()->MutableRecord()->
+ if (event->GetTypeRewrite() == NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult) {
+ event->Get<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>()->MutableRecord()->
MutablePathDescription()->MutableDomainDescription()->MutableProcessingParams()->SetHive(subHiveTablet);
}
return prevObserverFunc(runtime, event);
@@ -995,23 +995,23 @@ Y_UNIT_TEST_SUITE(THiveTest) {
TActorId sender = runtime.AllocateEdgeActor(0);
- InitSchemeRoot(runtime, sender);
+ InitSchemeRoot(runtime, sender);
TSubDomainKey subdomainKey;
// Create subdomain
do {
- auto x = MakeHolder<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction>();
- auto* tran = x->Record.AddTransaction();
+ auto x = MakeHolder<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction>();
+ auto* tran = x->Record.AddTransaction();
tran->SetWorkingDir("/dc-1");
- tran->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateSubDomain);
+ tran->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateSubDomain);
auto* subd = tran->MutableSubDomain();
subd->SetName("tenant1");
runtime.SendToPipe(TTestTxConfig::SchemeShard, sender, x.Release());
TAutoPtr<IEventHandle> handle;
- auto reply = runtime.GrabEdgeEventRethrow<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult>(handle, TDuration::MilliSeconds(100));
+ auto reply = runtime.GrabEdgeEventRethrow<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult>(handle, TDuration::MilliSeconds(100));
if (reply) {
subdomainKey = TSubDomainKey(reply->Record.GetSchemeshardId(), reply->Record.GetPathId());
- UNIT_ASSERT_VALUES_EQUAL(reply->Record.GetStatus(), (ui32)NKikimrScheme::EStatus::StatusAccepted);
+ UNIT_ASSERT_VALUES_EQUAL(reply->Record.GetStatus(), (ui32)NKikimrScheme::EStatus::StatusAccepted);
break;
}
} while (true);
@@ -1024,8 +1024,8 @@ Y_UNIT_TEST_SUITE(THiveTest) {
TTestActorRuntime::TEventObserver prevObserverFunc;
prevObserverFunc = runtime.SetObserverFunc([&](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event) {
- if (event->GetTypeRewrite() == NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult) {
- event->Get<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>()->MutableRecord()->
+ if (event->GetTypeRewrite() == NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult) {
+ event->Get<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>()->MutableRecord()->
MutablePathDescription()->MutableDomainDescription()->MutableProcessingParams()->SetHive(subHiveTablet);
}
return prevObserverFunc(runtime, event);
@@ -1106,24 +1106,24 @@ Y_UNIT_TEST_SUITE(THiveTest) {
TActorId sender = runtime.AllocateEdgeActor(0);
- InitSchemeRoot(runtime, sender);
+ InitSchemeRoot(runtime, sender);
TSubDomainKey subdomainKey;
// Create subdomain
do {
- auto x = MakeHolder<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction>();
- auto* tran = x->Record.AddTransaction();
+ auto x = MakeHolder<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction>();
+ auto* tran = x->Record.AddTransaction();
tran->SetWorkingDir("/dc-1");
- tran->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateSubDomain);
+ tran->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateSubDomain);
auto* subd = tran->MutableSubDomain();
subd->SetName("tenant1");
runtime.SendToPipe(TTestTxConfig::SchemeShard, sender, x.Release());
TAutoPtr<IEventHandle> handle;
- auto reply = runtime.GrabEdgeEventRethrow<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult>(handle, TDuration::MilliSeconds(100));
+ auto reply = runtime.GrabEdgeEventRethrow<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult>(handle, TDuration::MilliSeconds(100));
if (reply) {
subdomainKey = TSubDomainKey(reply->Record.GetSchemeshardId(), reply->Record.GetPathId());
- UNIT_ASSERT_VALUES_EQUAL(reply->Record.GetStatus(), (ui32)NKikimrScheme::EStatus::StatusAccepted);
+ UNIT_ASSERT_VALUES_EQUAL(reply->Record.GetStatus(), (ui32)NKikimrScheme::EStatus::StatusAccepted);
break;
}
} while (true);
@@ -1136,8 +1136,8 @@ Y_UNIT_TEST_SUITE(THiveTest) {
TTestActorRuntime::TEventObserver prevObserverFunc;
prevObserverFunc = runtime.SetObserverFunc([&](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event) {
- if (event->GetTypeRewrite() == NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult) {
- event->Get<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>()->MutableRecord()->
+ if (event->GetTypeRewrite() == NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult) {
+ event->Get<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>()->MutableRecord()->
MutablePathDescription()->MutableDomainDescription()->MutableProcessingParams()->SetHive(subHiveTablet);
}
return prevObserverFunc(runtime, event);
@@ -1217,24 +1217,24 @@ Y_UNIT_TEST_SUITE(THiveTest) {
TActorId sender = runtime.AllocateEdgeActor(0);
- InitSchemeRoot(runtime, sender);
+ InitSchemeRoot(runtime, sender);
TSubDomainKey subdomainKey;
// Create subdomain
do {
- auto x = MakeHolder<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction>();
- auto* tran = x->Record.AddTransaction();
+ auto x = MakeHolder<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction>();
+ auto* tran = x->Record.AddTransaction();
tran->SetWorkingDir("/dc-1");
- tran->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateSubDomain);
+ tran->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateSubDomain);
auto* subd = tran->MutableSubDomain();
subd->SetName("tenant1");
runtime.SendToPipe(TTestTxConfig::SchemeShard, sender, x.Release());
TAutoPtr<IEventHandle> handle;
- auto reply = runtime.GrabEdgeEventRethrow<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult>(handle, TDuration::MilliSeconds(100));
+ auto reply = runtime.GrabEdgeEventRethrow<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult>(handle, TDuration::MilliSeconds(100));
if (reply) {
subdomainKey = TSubDomainKey(reply->Record.GetSchemeshardId(), reply->Record.GetPathId());
- UNIT_ASSERT_VALUES_EQUAL(reply->Record.GetStatus(), (ui32)NKikimrScheme::EStatus::StatusAccepted);
+ UNIT_ASSERT_VALUES_EQUAL(reply->Record.GetStatus(), (ui32)NKikimrScheme::EStatus::StatusAccepted);
break;
}
} while (true);
@@ -1247,8 +1247,8 @@ Y_UNIT_TEST_SUITE(THiveTest) {
TTestActorRuntime::TEventObserver prevObserverFunc;
prevObserverFunc = runtime.SetObserverFunc([&](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event) {
- if (event->GetTypeRewrite() == NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult) {
- event->Get<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>()->MutableRecord()->
+ if (event->GetTypeRewrite() == NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult) {
+ event->Get<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>()->MutableRecord()->
MutablePathDescription()->MutableDomainDescription()->MutableProcessingParams()->SetHive(subHiveTablet);
}
return prevObserverFunc(runtime, event);
@@ -1335,24 +1335,24 @@ Y_UNIT_TEST_SUITE(THiveTest) {
MakeSureTabletIsUp(runtime, TTestTxConfig::SchemeShard, 0); // root ss good
TActorId sender = runtime.AllocateEdgeActor(0);
- InitSchemeRoot(runtime, sender);
+ InitSchemeRoot(runtime, sender);
TSubDomainKey subdomainKey;
// Create subdomain
do {
- auto x = MakeHolder<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction>();
- auto* tran = x->Record.AddTransaction();
+ auto x = MakeHolder<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction>();
+ auto* tran = x->Record.AddTransaction();
tran->SetWorkingDir("/dc-1");
- tran->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateSubDomain);
+ tran->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateSubDomain);
auto* subd = tran->MutableSubDomain();
subd->SetName("tenant1");
runtime.SendToPipe(TTestTxConfig::SchemeShard, sender, x.Release());
TAutoPtr<IEventHandle> handle;
- auto reply = runtime.GrabEdgeEventRethrow<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult>(handle, TDuration::MilliSeconds(100));
+ auto reply = runtime.GrabEdgeEventRethrow<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult>(handle, TDuration::MilliSeconds(100));
if (reply) {
subdomainKey = TSubDomainKey(reply->Record.GetSchemeshardId(), reply->Record.GetPathId());
- UNIT_ASSERT_VALUES_EQUAL(reply->Record.GetStatus(), (ui32)NKikimrScheme::EStatus::StatusAccepted);
+ UNIT_ASSERT_VALUES_EQUAL(reply->Record.GetStatus(), (ui32)NKikimrScheme::EStatus::StatusAccepted);
break;
}
} while (true);
@@ -1365,8 +1365,8 @@ Y_UNIT_TEST_SUITE(THiveTest) {
TTestActorRuntime::TEventObserver prevObserverFunc;
prevObserverFunc = runtime.SetObserverFunc([&](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event) {
- if (event->GetTypeRewrite() == NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult) {
- event->Get<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>()->MutableRecord()->
+ if (event->GetTypeRewrite() == NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult) {
+ event->Get<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>()->MutableRecord()->
MutablePathDescription()->MutableDomainDescription()->MutableProcessingParams()->SetHive(subHiveTablet);
}
return prevObserverFunc(runtime, event);
@@ -1428,24 +1428,24 @@ Y_UNIT_TEST_SUITE(THiveTest) {
MakeSureTabletIsUp(runtime, TTestTxConfig::SchemeShard, 0); // root ss good
TActorId sender = runtime.AllocateEdgeActor(0);
- InitSchemeRoot(runtime, sender);
+ InitSchemeRoot(runtime, sender);
TSubDomainKey subdomainKey;
// Create subdomain
do {
- auto x = MakeHolder<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction>();
- auto* tran = x->Record.AddTransaction();
+ auto x = MakeHolder<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction>();
+ auto* tran = x->Record.AddTransaction();
tran->SetWorkingDir("/dc-1");
- tran->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateSubDomain);
+ tran->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateSubDomain);
auto* subd = tran->MutableSubDomain();
subd->SetName("tenant1");
runtime.SendToPipe(TTestTxConfig::SchemeShard, sender, x.Release());
TAutoPtr<IEventHandle> handle;
- auto reply = runtime.GrabEdgeEventRethrow<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult>(handle, TDuration::MilliSeconds(100));
+ auto reply = runtime.GrabEdgeEventRethrow<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult>(handle, TDuration::MilliSeconds(100));
if (reply) {
subdomainKey = TSubDomainKey(reply->Record.GetSchemeshardId(), reply->Record.GetPathId());
- UNIT_ASSERT_VALUES_EQUAL(reply->Record.GetStatus(), (ui32)NKikimrScheme::EStatus::StatusAccepted);
+ UNIT_ASSERT_VALUES_EQUAL(reply->Record.GetStatus(), (ui32)NKikimrScheme::EStatus::StatusAccepted);
break;
}
} while (true);
@@ -1458,8 +1458,8 @@ Y_UNIT_TEST_SUITE(THiveTest) {
TTestActorRuntime::TEventObserver prevObserverFunc;
prevObserverFunc = runtime.SetObserverFunc([&](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event) {
- if (event->GetTypeRewrite() == NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult) {
- event->Get<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>()->MutableRecord()->
+ if (event->GetTypeRewrite() == NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult) {
+ event->Get<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>()->MutableRecord()->
MutablePathDescription()->MutableDomainDescription()->MutableProcessingParams()->SetHive(subHiveTablet);
}
return prevObserverFunc(runtime, event);
@@ -1529,24 +1529,24 @@ Y_UNIT_TEST_SUITE(THiveTest) {
MakeSureTabletIsUp(runtime, TTestTxConfig::SchemeShard, 0); // root ss good
TActorId sender = runtime.AllocateEdgeActor(0);
- InitSchemeRoot(runtime, sender);
+ InitSchemeRoot(runtime, sender);
TSubDomainKey subdomainKey;
// Create subdomain
do {
- auto x = MakeHolder<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction>();
- auto* tran = x->Record.AddTransaction();
+ auto x = MakeHolder<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction>();
+ auto* tran = x->Record.AddTransaction();
tran->SetWorkingDir("/dc-1");
- tran->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateSubDomain);
+ tran->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateSubDomain);
auto* subd = tran->MutableSubDomain();
subd->SetName("tenant1");
runtime.SendToPipe(TTestTxConfig::SchemeShard, sender, x.Release());
TAutoPtr<IEventHandle> handle;
- auto reply = runtime.GrabEdgeEventRethrow<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult>(handle, TDuration::MilliSeconds(100));
+ auto reply = runtime.GrabEdgeEventRethrow<NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult>(handle, TDuration::MilliSeconds(100));
if (reply) {
subdomainKey = TSubDomainKey(reply->Record.GetSchemeshardId(), reply->Record.GetPathId());
- UNIT_ASSERT_VALUES_EQUAL(reply->Record.GetStatus(), (ui32)NKikimrScheme::EStatus::StatusAccepted);
+ UNIT_ASSERT_VALUES_EQUAL(reply->Record.GetStatus(), (ui32)NKikimrScheme::EStatus::StatusAccepted);
break;
}
} while (true);
@@ -1559,8 +1559,8 @@ Y_UNIT_TEST_SUITE(THiveTest) {
TTestActorRuntime::TEventObserver prevObserverFunc;
prevObserverFunc = runtime.SetObserverFunc([&](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event) {
- if (event->GetTypeRewrite() == NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult) {
- event->Get<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>()->MutableRecord()->
+ if (event->GetTypeRewrite() == NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult) {
+ event->Get<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>()->MutableRecord()->
MutablePathDescription()->MutableDomainDescription()->MutableProcessingParams()->SetHive(subHiveTablet);
}
return prevObserverFunc(runtime, event);
@@ -1640,120 +1640,120 @@ Y_UNIT_TEST_SUITE(THiveTest) {
}
Y_UNIT_TEST(TestCreateAndDeleteTabletWithStoragePoolsReboots) {
- const ui64 hiveTablet = MakeDefaultHiveID(0);
- const ui64 bsControllerTablet = MakeBSControllerID(0);
- const ui64 testerTablet = MakeDefaultHiveID(1);
-
- THiveInitialEventsFilter initialEventsFilter;
-
- TVector<ui64> tabletIds;
- tabletIds.push_back(hiveTablet);
- tabletIds.push_back(bsControllerTablet);
- tabletIds.push_back(testerTablet);
- RunTestWithReboots(tabletIds, [&]() {
- return initialEventsFilter.Prepare();
- }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) {
- if (ENABLE_DETAILED_HIVE_LOG) {
+ const ui64 hiveTablet = MakeDefaultHiveID(0);
+ const ui64 bsControllerTablet = MakeBSControllerID(0);
+ const ui64 testerTablet = MakeDefaultHiveID(1);
+
+ THiveInitialEventsFilter initialEventsFilter;
+
+ TVector<ui64> tabletIds;
+ tabletIds.push_back(hiveTablet);
+ tabletIds.push_back(bsControllerTablet);
+ tabletIds.push_back(testerTablet);
+ RunTestWithReboots(tabletIds, [&]() {
+ return initialEventsFilter.Prepare();
+ }, [&](const TString &dispatchName, std::function<void(TTestActorRuntime&)> setup, bool &activeZone) {
+ if (ENABLE_DETAILED_HIVE_LOG) {
Ctest << "At dispatch " << dispatchName << Endl;
- }
+ }
TTestBasicRuntime runtime(1, false);
Setup(runtime, true);
- setup(runtime);
-
+ setup(runtime);
+
CreateTestBootstrapper(runtime, CreateTestTabletInfo(hiveTablet, TTabletTypes::FLAT_HIVE), &CreateDefaultHive);
-
+
TAutoPtr<TEvHive::TEvCreateTablet> ev(new TEvHive::TEvCreateTablet(testerTablet, 0, TTabletTypes::Dummy, BINDED_CHANNELS));
- const bool doWaitForResult = false;
- ui64 tabletId = SendCreateTestTablet(runtime, hiveTablet, testerTablet, ev, 0, doWaitForResult);
-
- activeZone = true;
- {
- bool allowIncompleteResult = (dispatchName != INITIAL_TEST_DISPATCH_NAME);
- try {
- MakeSureTabletIsUp(runtime, tabletId, 0);
- } catch (TEmptyEventQueueException&) {
+ const bool doWaitForResult = false;
+ ui64 tabletId = SendCreateTestTablet(runtime, hiveTablet, testerTablet, ev, 0, doWaitForResult);
+
+ activeZone = true;
+ {
+ bool allowIncompleteResult = (dispatchName != INITIAL_TEST_DISPATCH_NAME);
+ try {
+ MakeSureTabletIsUp(runtime, tabletId, 0);
+ } catch (TEmptyEventQueueException&) {
Ctest << "Event queue is empty at dispatch " << dispatchName << "\n";
- if (!allowIncompleteResult)
- throw;
- }
- }
- activeZone = false;
- });
- }
-
+ if (!allowIncompleteResult)
+ throw;
+ }
+ }
+ activeZone = false;
+ });
+ }
+
Y_UNIT_TEST(TestCreateAndDeleteTabletWithStoragePools) {
TTestBasicRuntime runtime(1, false);
Setup(runtime);
-
- const ui64 hiveTablet = MakeDefaultHiveID(0);
- const ui64 testerTablet = MakeDefaultHiveID(1);
+
+ const ui64 hiveTablet = MakeDefaultHiveID(0);
+ const ui64 testerTablet = MakeDefaultHiveID(1);
CreateTestBootstrapper(runtime, CreateTestTabletInfo(hiveTablet, TTabletTypes::FLAT_HIVE), &CreateDefaultHive);
-
- TTabletTypes::EType tabletType = TTabletTypes::Dummy;
+
+ TTabletTypes::EType tabletType = TTabletTypes::Dummy;
TAutoPtr<TEvHive::TEvCreateTablet> ev(new TEvHive::TEvCreateTablet(testerTablet, 0, tabletType, BINDED_CHANNELS));
- const bool doWaitForResult = true;
- ui64 tabletId = SendCreateTestTablet(runtime, hiveTablet, testerTablet, ev, 0, doWaitForResult);
-
- MakeSureTabletIsUp(runtime, tabletId, 0);
-
- SendKillLocal(runtime, 0);
- WaitForEvServerDisconnected(runtime);
-
- MakeSureTabletIsDown(runtime, tabletId, 0);
- CreateLocal(runtime, 0);
- MakeSureTabletIsUp(runtime, tabletId, 0);
-
+ const bool doWaitForResult = true;
+ ui64 tabletId = SendCreateTestTablet(runtime, hiveTablet, testerTablet, ev, 0, doWaitForResult);
+
+ MakeSureTabletIsUp(runtime, tabletId, 0);
+
+ SendKillLocal(runtime, 0);
+ WaitForEvServerDisconnected(runtime);
+
+ MakeSureTabletIsDown(runtime, tabletId, 0);
+ CreateLocal(runtime, 0);
+ MakeSureTabletIsUp(runtime, tabletId, 0);
+
if (!SendDeleteTestTablet(runtime, hiveTablet, MakeHolder<TEvHive::TEvDeleteTablet>(testerTablet, 0, 0))) {
- WaitEvDeleteTabletResult(runtime);
- }
-
- MakeSureTheTabletIsDeleted(runtime, hiveTablet, tabletId);
- }
-
- Y_UNIT_TEST(TestCreateAndReassignTabletWithStoragePools) {
- TTestBasicRuntime runtime(1, false);
+ WaitEvDeleteTabletResult(runtime);
+ }
+
+ MakeSureTheTabletIsDeleted(runtime, hiveTablet, tabletId);
+ }
+
+ Y_UNIT_TEST(TestCreateAndReassignTabletWithStoragePools) {
+ TTestBasicRuntime runtime(1, false);
Setup(runtime);
-
- const ui64 hiveTablet = MakeDefaultHiveID(0);
- const ui64 testerTablet = MakeDefaultHiveID(1);
+
+ const ui64 hiveTablet = MakeDefaultHiveID(0);
+ const ui64 testerTablet = MakeDefaultHiveID(1);
CreateTestBootstrapper(runtime, CreateTestTabletInfo(hiveTablet, TTabletTypes::FLAT_HIVE), &CreateDefaultHive);
- CreateLocal(runtime, 0);
-
- TTabletTypes::EType tabletType = TTabletTypes::Dummy;
+ CreateLocal(runtime, 0);
+
+ TTabletTypes::EType tabletType = TTabletTypes::Dummy;
TAutoPtr<TEvHive::TEvCreateTablet> ev(new TEvHive::TEvCreateTablet(testerTablet, 0, tabletType, BINDED_CHANNELS));
- const bool doWaitForResult = true;
- ui64 tabletId = SendCreateTestTablet(runtime, hiveTablet, testerTablet, ev, 0, doWaitForResult);
-
- MakeSureTabletIsUp(runtime, tabletId, 0);
-
- runtime.Register(CreateTabletKiller(hiveTablet, runtime.GetNodeId(0)));
-
- MakeSureTabletIsUp(runtime, hiveTablet, 0);
- MakeSureTabletIsUp(runtime, tabletId, 0);
-
- SendReassignTablet(runtime, hiveTablet, tabletId, {}, 0);
- {
- TDispatchOptions options;
+ const bool doWaitForResult = true;
+ ui64 tabletId = SendCreateTestTablet(runtime, hiveTablet, testerTablet, ev, 0, doWaitForResult);
+
+ MakeSureTabletIsUp(runtime, tabletId, 0);
+
+ runtime.Register(CreateTabletKiller(hiveTablet, runtime.GetNodeId(0)));
+
+ MakeSureTabletIsUp(runtime, hiveTablet, 0);
+ MakeSureTabletIsUp(runtime, tabletId, 0);
+
+ SendReassignTablet(runtime, hiveTablet, tabletId, {}, 0);
+ {
+ TDispatchOptions options;
options.FinalEvents.push_back(TDispatchOptions::TFinalEventCondition(TEvBlobStorage::EvControllerSelectGroupsResult));
- runtime.DispatchEvents(options);
- }
- MakeSureTabletIsUp(runtime, tabletId, 0);
-
+ runtime.DispatchEvents(options);
+ }
+ MakeSureTabletIsUp(runtime, tabletId, 0);
+
if (!SendDeleteTestTablet(runtime, hiveTablet, MakeHolder<TEvHive::TEvDeleteTablet>(testerTablet, 0, 0))) {
- WaitEvDeleteTabletResult(runtime);
- }
-
- {
+ WaitEvDeleteTabletResult(runtime);
+ }
+
+ {
TActorId sender = runtime.AllocateEdgeActor();
- runtime.SendToPipe(hiveTablet, sender, new TEvHive::TEvRequestHiveInfo(true));
- TAutoPtr<IEventHandle> handle;
- TEvHive::TEvResponseHiveInfo* response = runtime.GrabEdgeEventRethrow<TEvHive::TEvResponseHiveInfo>(handle);
- for (const NKikimrHive::TTabletInfo& tablet : response->Record.GetTablets()) {
- UNIT_ASSERT_VALUES_UNEQUAL(tablet.GetTabletID(), tabletId);
- }
- }
- }
-
+ runtime.SendToPipe(hiveTablet, sender, new TEvHive::TEvRequestHiveInfo(true));
+ TAutoPtr<IEventHandle> handle;
+ TEvHive::TEvResponseHiveInfo* response = runtime.GrabEdgeEventRethrow<TEvHive::TEvResponseHiveInfo>(handle);
+ for (const NKikimrHive::TTabletInfo& tablet : response->Record.GetTablets()) {
+ UNIT_ASSERT_VALUES_UNEQUAL(tablet.GetTabletID(), tabletId);
+ }
+ }
+ }
+
Y_UNIT_TEST(TestCreateAndReassignTabletWhileStarting) {
TTestBasicRuntime runtime(1, false);
Setup(runtime, true, 2);
@@ -1904,67 +1904,67 @@ Y_UNIT_TEST_SUITE(THiveTest) {
runtime.SendToPipe(hiveTablet, sender, new TEvHive::TEvRequestHiveInfo(true));
TAutoPtr<IEventHandle> handle;
TEvHive::TEvResponseHiveInfo* response = runtime.GrabEdgeEventRethrow<TEvHive::TEvResponseHiveInfo>(handle);
- for (const NKikimrHive::TTabletInfo& tablet : response->Record.GetTablets()) {
- UNIT_ASSERT_VALUES_UNEQUAL(tablet.GetTabletID(), tabletId);
+ for (const NKikimrHive::TTabletInfo& tablet : response->Record.GetTablets()) {
+ UNIT_ASSERT_VALUES_UNEQUAL(tablet.GetTabletID(), tabletId);
}
}
- Y_UNIT_TEST(TestDeleteOwnerTablets) {
- TTestBasicRuntime runtime(1, false);
- Setup(runtime, true);
+ Y_UNIT_TEST(TestDeleteOwnerTablets) {
+ TTestBasicRuntime runtime(1, false);
+ Setup(runtime, true);
TActorId sender = runtime.AllocateEdgeActor();
- const ui64 hiveTablet = MakeDefaultHiveID(0);
- const ui64 testerTablet = MakeDefaultHiveID(1);
+ const ui64 hiveTablet = MakeDefaultHiveID(0);
+ const ui64 testerTablet = MakeDefaultHiveID(1);
CreateTestBootstrapper(runtime, CreateTestTabletInfo(hiveTablet, TTabletTypes::FLAT_HIVE), &CreateDefaultHive);
- TTabletTypes::EType tabletType = TTabletTypes::Dummy;
+ TTabletTypes::EType tabletType = TTabletTypes::Dummy;
const ui64 tabletId = SendCreateTestTablet(runtime, hiveTablet, testerTablet, MakeHolder<TEvHive::TEvCreateTablet>(testerTablet, 0, tabletType, BINDED_CHANNELS), 0, false);
- {
- TDispatchOptions options;
- options.FinalEvents.emplace_back(TEvLocal::EvBootTablet);
- runtime.DispatchEvents(options);
- }
-
+ {
+ TDispatchOptions options;
+ options.FinalEvents.emplace_back(TEvLocal::EvBootTablet);
+ runtime.DispatchEvents(options);
+ }
+
if (!SendDeleteTestOwner(runtime, hiveTablet, MakeHolder<TEvHive::TEvDeleteOwnerTablets>(testerTablet, 123))) {
- WaitEvDeleteTabletResult(runtime);
- }
-
- runtime.SendToPipe(hiveTablet, sender, new TEvHive::TEvRequestHiveInfo(true));
- TAutoPtr<IEventHandle> handle;
- TEvHive::TEvResponseHiveInfo* response = runtime.GrabEdgeEventRethrow<TEvHive::TEvResponseHiveInfo>(handle);
- for (const NKikimrHive::TTabletInfo& tablet : response->Record.GetTablets()) {
- UNIT_ASSERT_VALUES_UNEQUAL(tablet.GetTabletID(), tabletId);
- }
-
+ WaitEvDeleteTabletResult(runtime);
+ }
+
+ runtime.SendToPipe(hiveTablet, sender, new TEvHive::TEvRequestHiveInfo(true));
+ TAutoPtr<IEventHandle> handle;
+ TEvHive::TEvResponseHiveInfo* response = runtime.GrabEdgeEventRethrow<TEvHive::TEvResponseHiveInfo>(handle);
+ for (const NKikimrHive::TTabletInfo& tablet : response->Record.GetTablets()) {
+ UNIT_ASSERT_VALUES_UNEQUAL(tablet.GetTabletID(), tabletId);
+ }
+
SendDeleteTestOwner(runtime, hiveTablet, MakeHolder<TEvHive::TEvDeleteOwnerTablets>(testerTablet, 124), 0, NKikimrProto::ALREADY);
- }
-
- Y_UNIT_TEST(TestDeleteOwnerTabletsMany) {
- TTestBasicRuntime runtime(1, false);
- Setup(runtime, true);
+ }
+
+ Y_UNIT_TEST(TestDeleteOwnerTabletsMany) {
+ TTestBasicRuntime runtime(1, false);
+ Setup(runtime, true);
TActorId sender = runtime.AllocateEdgeActor();
- const ui64 hiveTablet = MakeDefaultHiveID(0);
- const ui64 testerTablet = MakeDefaultHiveID(1);
+ const ui64 hiveTablet = MakeDefaultHiveID(0);
+ const ui64 testerTablet = MakeDefaultHiveID(1);
CreateTestBootstrapper(runtime, CreateTestTabletInfo(hiveTablet, TTabletTypes::FLAT_HIVE), &CreateDefaultHive);
- TTabletTypes::EType tabletType = TTabletTypes::Dummy;
- const ui64 count = 100;
- TSet<ui64> tabletIds;
- for (ui64 i = 0; i < count; ++i) {
+ TTabletTypes::EType tabletType = TTabletTypes::Dummy;
+ const ui64 count = 100;
+ TSet<ui64> tabletIds;
+ for (ui64 i = 0; i < count; ++i) {
const ui64 tabletId = SendCreateTestTablet(runtime, hiveTablet, testerTablet, MakeHolder<TEvHive::TEvCreateTablet>(testerTablet, i, tabletType, BINDED_CHANNELS), 0, false);
- tabletIds.insert(tabletId);
- }
-
+ tabletIds.insert(tabletId);
+ }
+
SendDeleteTestOwner(runtime, hiveTablet, MakeHolder<TEvHive::TEvDeleteOwnerTablets>(testerTablet, 123));
-
- runtime.SendToPipe(hiveTablet, sender, new TEvHive::TEvRequestHiveInfo(true));
- TAutoPtr<IEventHandle> handle;
- TEvHive::TEvResponseHiveInfo* response = runtime.GrabEdgeEventRethrow<TEvHive::TEvResponseHiveInfo>(handle);
- for (const NKikimrHive::TTabletInfo& tablet : response->Record.GetTablets()) {
- UNIT_ASSERT(!tabletIds.contains(tablet.GetTabletID()));
- }
-
+
+ runtime.SendToPipe(hiveTablet, sender, new TEvHive::TEvRequestHiveInfo(true));
+ TAutoPtr<IEventHandle> handle;
+ TEvHive::TEvResponseHiveInfo* response = runtime.GrabEdgeEventRethrow<TEvHive::TEvResponseHiveInfo>(handle);
+ for (const NKikimrHive::TTabletInfo& tablet : response->Record.GetTablets()) {
+ UNIT_ASSERT(!tabletIds.contains(tablet.GetTabletID()));
+ }
+
SendDeleteTestOwner(runtime, hiveTablet, MakeHolder<TEvHive::TEvDeleteOwnerTablets>(testerTablet, 124), 0, NKikimrProto::ALREADY);
- }
-
+ }
+
Y_UNIT_TEST(TestDeleteTabletWithFollowers) {
TTestBasicRuntime runtime(3, false);
Setup(runtime, true);
@@ -2355,36 +2355,36 @@ Y_UNIT_TEST_SUITE(THiveTest) {
MakeSureTabletIsUp(runtime, tabletId, 0);
}
- Y_UNIT_TEST(TestCreateTabletWithWrongSPoolsAndReassignGroupsFailButDeletionIsOk) {
- TTestBasicRuntime runtime(1, false);
- Setup(runtime, true);
- const ui64 hiveTablet = MakeDefaultHiveID(0);
- const ui64 testerTablet = MakeDefaultHiveID(1);
+ Y_UNIT_TEST(TestCreateTabletWithWrongSPoolsAndReassignGroupsFailButDeletionIsOk) {
+ TTestBasicRuntime runtime(1, false);
+ Setup(runtime, true);
+ const ui64 hiveTablet = MakeDefaultHiveID(0);
+ const ui64 testerTablet = MakeDefaultHiveID(1);
CreateTestBootstrapper(runtime, CreateTestTabletInfo(hiveTablet, TTabletTypes::FLAT_HIVE), &CreateDefaultHive);
-
- TTabletTypes::EType tabletType = TTabletTypes::Dummy;
+
+ TTabletTypes::EType tabletType = TTabletTypes::Dummy;
TChannelsBindings channlesBinds = {GetDefaultChannelBind("NoExistStoragePool"),
GetDefaultChannelBind("NoExistStoragePool")};
auto ev = new TEvHive::TEvCreateTablet(testerTablet, 0, tabletType, channlesBinds);
ui64 tabletId = SendCreateTestTablet(runtime, hiveTablet, testerTablet, THolder(ev), 0, false);
-
- MakeSureTabletIsDown(runtime, tabletId, 0);
-
- SendReassignTablet(runtime, hiveTablet, tabletId, {}, 0);
-
+
+ MakeSureTabletIsDown(runtime, tabletId, 0);
+
+ SendReassignTablet(runtime, hiveTablet, tabletId, {}, 0);
+
/*{
- TDispatchOptions options;
+ TDispatchOptions options;
options.FinalEvents.push_back(TDispatchOptions::TFinalEventCondition(TEvBlobStorage::EvControllerSelectGroupsResult));
- runtime.DispatchEvents(options);
+ runtime.DispatchEvents(options);
}*/
-
+
if (!SendDeleteTestTablet(runtime, hiveTablet, MakeHolder<TEvHive::TEvDeleteTablet>(testerTablet, 0, 0))) {
- WaitEvDeleteTabletResult(runtime);
- }
-
- MakeSureTheTabletIsDeleted(runtime, hiveTablet, tabletId);
- }
-
+ WaitEvDeleteTabletResult(runtime);
+ }
+
+ MakeSureTheTabletIsDeleted(runtime, hiveTablet, tabletId);
+ }
+
Y_UNIT_TEST(TestCreateTabletAndReassignGroups3) {
TTestBasicRuntime runtime(1, false);
Setup(runtime, true, 3);
diff --git a/ydb/core/mind/hive/monitoring.cpp b/ydb/core/mind/hive/monitoring.cpp
index 469cc045033..7e9a83b354e 100644
--- a/ydb/core/mind/hive/monitoring.cpp
+++ b/ydb/core/mind/hive/monitoring.cpp
@@ -1123,7 +1123,7 @@ public:
auto it = tabletTypesToChannels.find(pr.second.Type);
if (it == tabletTypesToChannels.end()) {
ui32 channels = pr.second.GetChannelCount();
- tabletTypesToChannels.emplace(pr.second.Type, channels);
+ tabletTypesToChannels.emplace(pr.second.Type, channels);
}
}
++tablets;
@@ -3052,9 +3052,9 @@ public:
, Event(new TEvHive::TEvDeleteTablet())
, Hive(hive)
{
- Event->Record.SetShardOwnerId(owner);
- Event->Record.AddShardLocalIdx(ownerIdx);
- Event->Record.SetTxId_Deprecated(FAKE_TXID);
+ Event->Record.SetShardOwnerId(owner);
+ Event->Record.AddShardLocalIdx(ownerIdx);
+ Event->Record.SetTxId_Deprecated(FAKE_TXID);
}
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
@@ -3076,9 +3076,9 @@ public:
}
}
- Event->Record.SetShardOwnerId(owner);
- Event->Record.AddShardLocalIdx(ownerIdx);
- Event->Record.SetTxId_Deprecated(FAKE_TXID);
+ Event->Record.SetShardOwnerId(owner);
+ Event->Record.AddShardLocalIdx(ownerIdx);
+ Event->Record.SetTxId_Deprecated(FAKE_TXID);
}
private:
diff --git a/ydb/core/mind/hive/tx__adopt_tablet.cpp b/ydb/core/mind/hive/tx__adopt_tablet.cpp
index c09fcc28e97..45203af0d1f 100644
--- a/ydb/core/mind/hive/tx__adopt_tablet.cpp
+++ b/ydb/core/mind/hive/tx__adopt_tablet.cpp
@@ -1,118 +1,118 @@
#include "hive_impl.h"
#include "hive_log.h"
-
-namespace NKikimr {
+
+namespace NKikimr {
namespace NHive {
-
+
class TTxAdoptTablet : public TTransactionBase<THive> {
- const ui64 TabletId;
- const ui64 PrevOwner;
- const ui64 PrevOwnerIdx;
- const TTabletTypes::EType TabletType;
-
- const ui64 Owner;
- const ui64 OwnerIdx;
-
+ const ui64 TabletId;
+ const ui64 PrevOwner;
+ const ui64 PrevOwnerIdx;
+ const TTabletTypes::EType TabletType;
+
+ const ui64 Owner;
+ const ui64 OwnerIdx;
+
const TActorId Sender;
- const ui64 Cookie;
-
- TString Explain;
- NKikimrProto::EReplyStatus Status;
-
-public:
+ const ui64 Cookie;
+
+ TString Explain;
+ NKikimrProto::EReplyStatus Status;
+
+public:
TTxAdoptTablet(NKikimrHive::TEvAdoptTablet &rec, const TActorId &sender, const ui64 cookie, THive *hive)
- : TBase(hive)
- , TabletId(rec.GetTabletID())
- , PrevOwner(rec.GetPrevOwner())
- , PrevOwnerIdx(rec.GetPrevOwnerIdx())
- , TabletType(rec.GetTabletType())
- , Owner(rec.GetOwner())
- , OwnerIdx(rec.GetOwnerIdx())
- , Sender(sender)
- , Cookie(cookie)
- {
- Y_VERIFY(!!Sender);
- }
-
- TTxType GetTxType() const override { return NHive::TXTYPE_ADOPT_TABLET; }
-
+ : TBase(hive)
+ , TabletId(rec.GetTabletID())
+ , PrevOwner(rec.GetPrevOwner())
+ , PrevOwnerIdx(rec.GetPrevOwnerIdx())
+ , TabletType(rec.GetTabletType())
+ , Owner(rec.GetOwner())
+ , OwnerIdx(rec.GetOwnerIdx())
+ , Sender(sender)
+ , Cookie(cookie)
+ {
+ Y_VERIFY(!!Sender);
+ }
+
+ TTxType GetTxType() const override { return NHive::TXTYPE_ADOPT_TABLET; }
+
bool Execute(TTransactionContext &txc, const TActorContext&) override {
BLOG_D("THive::TTxAdoptTablet::Execute");
- NIceDb::TNiceDb db(txc.DB);
-
- const TOwnerIdxType::TValueType prevOwner(PrevOwner, PrevOwnerIdx);
- const TOwnerIdxType::TValueType newOwner(Owner, OwnerIdx);
-
-
- {// check if tablet is already adopted
- auto itOwner = Self->OwnerToTablet.find(newOwner);
- if (itOwner != Self->OwnerToTablet.end()) {
- const ui64 tabletId = itOwner->second;
- if (tabletId != TabletId) {
- Explain = "there is another tablet assotiated with the (owner; ownerIdx)";
- Status = NKikimrProto::EReplyStatus::RACE;
- return true;
- }
-
+ NIceDb::TNiceDb db(txc.DB);
+
+ const TOwnerIdxType::TValueType prevOwner(PrevOwner, PrevOwnerIdx);
+ const TOwnerIdxType::TValueType newOwner(Owner, OwnerIdx);
+
+
+ {// check if tablet is already adopted
+ auto itOwner = Self->OwnerToTablet.find(newOwner);
+ if (itOwner != Self->OwnerToTablet.end()) {
+ const ui64 tabletId = itOwner->second;
+ if (tabletId != TabletId) {
+ Explain = "there is another tablet assotiated with the (owner; ownerIdx)";
+ Status = NKikimrProto::EReplyStatus::RACE;
+ return true;
+ }
+
TLeaderTabletInfo* tablet = Self->FindTablet(tabletId);
if (tablet != nullptr && tablet->Type != TabletType) {
- Explain = "there is the tablet with different type assotiated with the (owner; ownerIdx)";
- Status = NKikimrProto::EReplyStatus::RACE;
- return true;
- }
-
+ Explain = "there is the tablet with different type assotiated with the (owner; ownerIdx)";
+ Status = NKikimrProto::EReplyStatus::RACE;
+ return true;
+ }
+
if (tablet != nullptr) {
Explain = "it seems like the tablet aleready adopted";
Status = NKikimrProto::EReplyStatus::ALREADY;
return true;
}
- }
- }
-
- auto itOwner = Self->OwnerToTablet.find(prevOwner);
- if (itOwner == Self->OwnerToTablet.end()) {
- Explain = "the tablet isn't found";
- Status = NKikimrProto::EReplyStatus::NODATA;
- return true;
- }
-
- const ui64 tabletId = itOwner->second;
- if (tabletId != TabletId) {
- Explain = "there is another tablet assotiated with the (prevOwner; prevOwnerIdx)";
- Status = NKikimrProto::EReplyStatus::ERROR;
- return true;
- }
-
+ }
+ }
+
+ auto itOwner = Self->OwnerToTablet.find(prevOwner);
+ if (itOwner == Self->OwnerToTablet.end()) {
+ Explain = "the tablet isn't found";
+ Status = NKikimrProto::EReplyStatus::NODATA;
+ return true;
+ }
+
+ const ui64 tabletId = itOwner->second;
+ if (tabletId != TabletId) {
+ Explain = "there is another tablet assotiated with the (prevOwner; prevOwnerIdx)";
+ Status = NKikimrProto::EReplyStatus::ERROR;
+ return true;
+ }
+
TLeaderTabletInfo* tablet = Self->FindTablet(tabletId);
if (tablet != nullptr && tablet->Type != TabletType) { // tablet is the same
- Explain = "there is the tablet with different type assotiated with the (preOwner; prevOwnerIdx)";
- Status = NKikimrProto::EReplyStatus::ERROR;
- return true;
- }
-
- db.Table<Schema::Tablet>().Key(TabletId).Update(NIceDb::TUpdate<Schema::Tablet::Owner>(newOwner));
-
- Self->OwnerToTablet[newOwner] = itOwner->second;
- Self->OwnerToTablet.erase(prevOwner);
-
- Explain = "we did it";
- this->Status = NKikimrProto::OK;
- return true;
- }
-
+ Explain = "there is the tablet with different type assotiated with the (preOwner; prevOwnerIdx)";
+ Status = NKikimrProto::EReplyStatus::ERROR;
+ return true;
+ }
+
+ db.Table<Schema::Tablet>().Key(TabletId).Update(NIceDb::TUpdate<Schema::Tablet::Owner>(newOwner));
+
+ Self->OwnerToTablet[newOwner] = itOwner->second;
+ Self->OwnerToTablet.erase(prevOwner);
+
+ Explain = "we did it";
+ this->Status = NKikimrProto::OK;
+ return true;
+ }
+
void Complete(const TActorContext& ctx) override {
BLOG_D("THive::TTxAdoptTablet::Complete TabletId: " << TabletId <<
" Status: " << NKikimrProto::EReplyStatus_Name(Status) <<
" Explain: " << Explain);
-
- ctx.Send(Sender, new TEvHive::TEvAdoptTabletReply(Status, TabletId, Owner, OwnerIdx, Explain, Self->TabletID()), 0, Cookie);;
- }
-
-};
-
+
+ ctx.Send(Sender, new TEvHive::TEvAdoptTabletReply(Status, TabletId, Owner, OwnerIdx, Explain, Self->TabletID()), 0, Cookie);;
+ }
+
+};
+
ITransaction* THive::CreateAdoptTablet(NKikimrHive::TEvAdoptTablet &rec, const TActorId &sender, const ui64 cookie) {
- return new TTxAdoptTablet(rec, sender, cookie, this);
-}
-
+ return new TTxAdoptTablet(rec, sender, cookie, this);
+}
+
} // NHive
} // NKikimr
diff --git a/ydb/core/mind/hive/tx__block_storage_result.cpp b/ydb/core/mind/hive/tx__block_storage_result.cpp
index 0299c571742..28315ec93bd 100644
--- a/ydb/core/mind/hive/tx__block_storage_result.cpp
+++ b/ydb/core/mind/hive/tx__block_storage_result.cpp
@@ -40,10 +40,10 @@ public:
BLOG_D("THive::TTxBlockStorageResult::Complete(" << TabletId << " " << NKikimrProto::EReplyStatus_Name(msg->Status) << ")");
TLeaderTabletInfo* tablet = Self->FindTabletEvenInDeleting(TabletId);
if (tablet != nullptr) {
- if (msg->Status == NKikimrProto::OK
- || msg->Status == NKikimrProto::RACE
- || msg->Status == NKikimrProto::BLOCKED
- || msg->Status == NKikimrProto::NO_GROUP) {
+ if (msg->Status == NKikimrProto::OK
+ || msg->Status == NKikimrProto::RACE
+ || msg->Status == NKikimrProto::BLOCKED
+ || msg->Status == NKikimrProto::NO_GROUP) {
if (tablet->IsDeleting()) {
if (msg->Status != NKikimrProto::EReplyStatus::OK) {
BLOG_W("THive::TTxBlockStorageResult Complete status was " << NKikimrProto::EReplyStatus_Name(msg->Status) << " for TabletId " << tablet->Id);
diff --git a/ydb/core/mind/hive/tx__create_tablet.cpp b/ydb/core/mind/hive/tx__create_tablet.cpp
index fa7b3131c1f..f3b27bfd9ac 100644
--- a/ydb/core/mind/hive/tx__create_tablet.cpp
+++ b/ydb/core/mind/hive/tx__create_tablet.cpp
@@ -101,10 +101,10 @@ public:
void UpdateChannelsBinding(TLeaderTabletInfo& tablet, NIceDb::TNiceDb& db) {
Y_VERIFY(tablet.BoundChannels.size() <= BoundChannels.size(), "only expansion channels number is allowed in Binded Channels");
-
- std::bitset<MAX_TABLET_CHANNELS> newChannels;
-
- // compare channel list with erasure and category information
+
+ std::bitset<MAX_TABLET_CHANNELS> newChannels;
+
+ // compare channel list with erasure and category information
for (ui32 channelId = 0; channelId < tablet.BoundChannels.size(); ++channelId) {
auto& channelA = tablet.BoundChannels[channelId];
auto channelB = BoundChannels[channelId]; // copy, not reference
@@ -113,10 +113,10 @@ public:
db.Table<Schema::TabletChannel>().Key(TabletId, channelId).Update<Schema::TabletChannel::StoragePool>(BoundChannels[channelId].GetStoragePoolName());
db.Table<Schema::TabletChannel>().Key(TabletId, channelId).Update<Schema::TabletChannel::Binding>(BoundChannels[channelId]);
db.Table<Schema::TabletChannel>().Key(TabletId, channelId).Update<Schema::TabletChannel::NeedNewGroup>(true);
- newChannels.set(channelId);
- }
- }
-
+ newChannels.set(channelId);
+ }
+ }
+
// new channels found in the tablet profile
for (ui32 channelId = tablet.BoundChannels.size(); channelId < BoundChannels.size(); ++channelId) {
auto channel = BoundChannels[channelId]; // copy, not reference
@@ -124,12 +124,12 @@ public:
db.Table<Schema::TabletChannel>().Key(TabletId, channelId).Update<Schema::TabletChannel::StoragePool>(BoundChannels[channelId].GetStoragePoolName());
db.Table<Schema::TabletChannel>().Key(TabletId, channelId).Update<Schema::TabletChannel::Binding>(BoundChannels[channelId]);
db.Table<Schema::TabletChannel>().Key(TabletId, channelId).Update<Schema::TabletChannel::NeedNewGroup>(true);
- newChannels.set(channelId);
- }
-
- if (newChannels.any()) {
- tablet.ChannelProfileNewGroup |= newChannels;
- tablet.State = State = ETabletState::GroupAssignment;
+ newChannels.set(channelId);
+ }
+
+ if (newChannels.any()) {
+ tablet.ChannelProfileNewGroup |= newChannels;
+ tablet.State = State = ETabletState::GroupAssignment;
tablet.ChannelProfileReassignReason = NKikimrHive::TEvReassignTablet::HIVE_REASSIGN_REASON_NO;
tablet.BoundChannels = BoundChannels;
for (auto& bind : tablet.BoundChannels) {
@@ -139,10 +139,10 @@ public:
.Update<Schema::Tablet::State, Schema::Tablet::ReassignReason, Schema::Tablet::ActorsToNotify>(
State, NKikimrHive::TEvReassignTablet::HIVE_REASSIGN_REASON_NO, {Sender}
);
- Status = NKikimrProto::OK; // otherwise it would be ALREADY
- }
- }
-
+ Status = NKikimrProto::OK; // otherwise it would be ALREADY
+ }
+ }
+
bool ValidateChannelsBinding(TLeaderTabletInfo& tablet) {
if (BoundChannels.size() < tablet.BoundChannels.size()) {
ErrorReason = NKikimrHive::ERROR_REASON_CHANNELS_CANNOT_SHRINK;
@@ -421,7 +421,7 @@ public:
tablet.TabletStorageInfo.Reset(new TTabletStorageInfo(tablet.Id, tablet.Type));
tablet.TabletStorageInfo->TenantPathId = tablet.GetTenant();
- UpdateChannelsBinding(tablet, db);
+ UpdateChannelsBinding(tablet, db);
for (const auto& srcFollowerGroup : FollowerGroups) {
TFollowerGroup& followerGroup = tablet.AddFollowerGroup();
diff --git a/ydb/core/mind/hive/tx__delete_tablet.cpp b/ydb/core/mind/hive/tx__delete_tablet.cpp
index 62c0b22b35b..6d481e695fd 100644
--- a/ydb/core/mind/hive/tx__delete_tablet.cpp
+++ b/ydb/core/mind/hive/tx__delete_tablet.cpp
@@ -6,8 +6,8 @@ namespace NHive {
class TTxDeleteTablet : public TTransactionBase<THive> {
TEvHive::TEvDeleteTablet::TPtr Event;
- ui64 OwnerId = 0;
- TVector<ui64> LocalIdxs;
+ ui64 OwnerId = 0;
+ TVector<ui64> LocalIdxs;
NKikimrProto::EReplyStatus Status = NKikimrProto::ERROR;
TVector<TTabletId> TabletIds;
TCompleteNotifications Notifications;
@@ -23,14 +23,14 @@ public:
TTabletId DoDeleteTablet(ui64 owner, ui64 idx, NIceDb::TNiceDb& db) {
TTabletId deletedTablet = 0;
-
- TOwnerIdxType::TValueType ownerIdx(owner, idx);
+
+ TOwnerIdxType::TValueType ownerIdx(owner, idx);
auto it = Self->OwnerToTablet.find(ownerIdx);
if (it != Self->OwnerToTablet.end()) {
deletedTablet = it->second;
BLOG_D("THive::TTxDeleteTablet::Execute Tablet " << it->second);
TLeaderTabletInfo* tablet = Self->FindTabletEvenInDeleting(it->second);
- Y_VERIFY(tablet != nullptr, "%s", (TStringBuilder() << "Tablet " << it->second << " OwnerIdx " << ownerIdx).data());
+ Y_VERIFY(tablet != nullptr, "%s", (TStringBuilder() << "Tablet " << it->second << " OwnerIdx " << ownerIdx).data());
if (tablet->SeizedByChild) {
BLOG_W("THive::TTxDeleteTablet tablet " << it->second << " seized by child");
return 0;
@@ -48,19 +48,19 @@ public:
}
} else {
BLOG_D("THive::TTxDeleteTablet::Execute Tablet " << it->second << " already in ETabletState::Deleting");
- }
- } else {
+ }
+ } else {
BLOG_W("THive::TTxDeleteTablet tablet " << ownerIdx << " wasn't found");
Self->PendingCreateTablets.erase({owner, idx});
- }
-
+ }
+
return deletedTablet;
- }
-
+ }
+
bool Execute(TTransactionContext& txc, const TActorContext&) override {
const NKikimrHive::TEvDeleteTablet& rec = Event->Get()->Record;
NIceDb::TNiceDb db(txc.DB);
- OwnerId = rec.GetShardOwnerId();
+ OwnerId = rec.GetShardOwnerId();
for (ui64 idx : rec.GetShardLocalIdx()) {
LocalIdxs.push_back(idx);
}
@@ -78,8 +78,8 @@ public:
Status = NKikimrProto::INVALID_OWNER; // actually this status from blob storage, but I think it fits this situation perfectly
return true; // abort transaction
}
- for (ui64 idx : rec.GetShardLocalIdx()) {
- Status = NKikimrProto::OK;
+ for (ui64 idx : rec.GetShardLocalIdx()) {
+ Status = NKikimrProto::OK;
if (TTabletId deletedTablet = DoDeleteTablet(OwnerId, idx, db)) {
TabletIds.push_back(deletedTablet);
}
@@ -119,16 +119,16 @@ ITransaction* THive::CreateDeleteTablet(TEvHive::TEvDeleteTablet::TPtr& ev) {
// TODO: split
-class TTxDeleteOwnerTablets : public TTransactionBase<THive> {
- TEvHive::TEvDeleteOwnerTablets::TPtr Event;
- NKikimrProto::EReplyStatus Status = NKikimrProto::OK;
- TVector<ui64> ToDelete;
-public:
- TTxDeleteOwnerTablets(TEvHive::TEvDeleteOwnerTablets::TPtr& ev, THive* hive)
- : TBase(hive)
- , Event(ev)
- {}
-
+class TTxDeleteOwnerTablets : public TTransactionBase<THive> {
+ TEvHive::TEvDeleteOwnerTablets::TPtr Event;
+ NKikimrProto::EReplyStatus Status = NKikimrProto::OK;
+ TVector<ui64> ToDelete;
+public:
+ TTxDeleteOwnerTablets(TEvHive::TEvDeleteOwnerTablets::TPtr& ev, THive* hive)
+ : TBase(hive)
+ , Event(ev)
+ {}
+
TTabletId DoDeleteTablet(ui64 owner, ui64 idx, NIceDb::TNiceDb& db) {
TTabletId deletedTablet = 0;
@@ -166,45 +166,45 @@ public:
}
bool Execute(TTransactionContext& txc, const TActorContext&) override {
- const NKikimrHive::TEvDeleteOwnerTablets& rec = Event->Get()->Record;
+ const NKikimrHive::TEvDeleteOwnerTablets& rec = Event->Get()->Record;
BLOG_D("THive::TEvDeleteOwnerTablets::Execute Owner: " << rec.GetOwner());
for (auto item : Self->OwnerToTablet) {
- if (item.first.first != rec.GetOwner()) {
- continue;
- }
+ if (item.first.first != rec.GetOwner()) {
+ continue;
+ }
const TLeaderTabletInfo* tablet = Self->FindTabletEvenInDeleting(item.second);
if (tablet) {
if (!tablet->IsDeleting()) {
ToDelete.push_back(item.first.second);
}
}
- }
-
- if (ToDelete.empty()) {
- Status = NKikimrProto::ALREADY;
- return true;
- }
-
- NIceDb::TNiceDb db(txc.DB);
+ }
+
+ if (ToDelete.empty()) {
+ Status = NKikimrProto::ALREADY;
+ return true;
+ }
+
+ NIceDb::TNiceDb db(txc.DB);
for (auto idx : ToDelete) {
DoDeleteTablet(rec.GetOwner(), idx, db);
- }
+ }
db.Table<Schema::BlockedOwner>().Key(rec.GetOwner()).Update();
-
- return true;
- }
-
+
+ return true;
+ }
+
void Complete(const TActorContext& ctx) override {
BLOG_D("THive::TEvDeleteOwnerTablets::Complete(" << Event->Get()->Record.GetOwner() << "), " << ToDelete.size() << " tablet has been deleted");
Self->BlockedOwners.emplace(Event->Get()->Record.GetOwner());
- ctx.Send(Event->Sender, new TEvHive::TEvDeleteOwnerTabletsReply(Status, Self->TabletID(), Event->Get()->Record.GetOwner(), Event->Get()->Record.GetTxId()));
- }
-};
-
-ITransaction* THive::CreateDeleteOwnerTablets(TEvHive::TEvDeleteOwnerTablets::TPtr& ev) {
- return new TTxDeleteOwnerTablets(ev, this);
-}
-
-
+ ctx.Send(Event->Sender, new TEvHive::TEvDeleteOwnerTabletsReply(Status, Self->TabletID(), Event->Get()->Record.GetOwner(), Event->Get()->Record.GetTxId()));
+ }
+};
+
+ITransaction* THive::CreateDeleteOwnerTablets(TEvHive::TEvDeleteOwnerTablets::TPtr& ev) {
+ return new TTxDeleteOwnerTablets(ev, this);
+}
+
+
} // NHive
} // NKikimr
diff --git a/ydb/core/mind/hive/tx__load_everything.cpp b/ydb/core/mind/hive/tx__load_everything.cpp
index 84ea70b05aa..e4c1cf1f51e 100644
--- a/ydb/core/mind/hive/tx__load_everything.cpp
+++ b/ydb/core/mind/hive/tx__load_everything.cpp
@@ -520,13 +520,13 @@ public:
NKikimrStoragePool::TChannelBind& bind = tablet.BoundChannels.back();
if (tabletChannelRowset.HaveValue<Schema::TabletChannel::Binding>()) {
bind = tabletChannelRowset.GetValue<Schema::TabletChannel::Binding>();
- }
+ }
bind.SetStoragePoolName(storagePool);
Self->InitDefaultChannelBind(bind);
tablet.TabletStorageInfo->Channels.emplace_back(channelId, storagePool);
-
+
TTabletChannelInfo& channel = tablet.TabletStorageInfo->Channels[channelId];
-
+
if (tabletChannelRowset.GetValue<Schema::TabletChannel::NeedNewGroup>()) {
tablet.ChannelProfileNewGroup.set(channelId);
}
diff --git a/ydb/core/mind/hive/tx__reassign_groups.cpp b/ydb/core/mind/hive/tx__reassign_groups.cpp
index acc92527993..ec9f4bfdd23 100644
--- a/ydb/core/mind/hive/tx__reassign_groups.cpp
+++ b/ydb/core/mind/hive/tx__reassign_groups.cpp
@@ -40,7 +40,7 @@ public:
NIceDb::TUpdate<Schema::Tablet::ReassignReason>(tablet->ChannelProfileReassignReason));
const ui32 channels = tablet->GetChannelCount();
- for (ui32 channelId = 0; channelId < channels; ++channelId) {
+ for (ui32 channelId = 0; channelId < channels; ++channelId) {
if (ChannelProfileNewGroup.none() || ChannelProfileNewGroup.test(channelId)) {
db.Table<Schema::TabletChannel>().Key(TabletId, channelId).Update(NIceDb::TUpdate<Schema::TabletChannel::NeedNewGroup>(true));
}
diff --git a/ydb/core/mind/hive/tx__update_tablet_groups.cpp b/ydb/core/mind/hive/tx__update_tablet_groups.cpp
index 29b93f97afa..2d9a11bc3b8 100644
--- a/ydb/core/mind/hive/tx__update_tablet_groups.cpp
+++ b/ydb/core/mind/hive/tx__update_tablet_groups.cpp
@@ -17,7 +17,7 @@ class TTxUpdateTabletGroups : public TTransactionBase<THive> {
bool Changed = false;
bool Ignored = false;
TCompleteNotifications Notifications;
-
+
public:
TTxUpdateTabletGroups(TTabletId tabletId, TVector<NKikimrBlobStorage::TEvControllerSelectGroupsResult::TGroupParameters> groups, THive *hive)
: TBase(hive)
@@ -35,10 +35,10 @@ public:
BLOG_W("THive::TTxUpdateTabletGroups:: tablet " << TabletId << " wasn't found");
Ignored = true;
return true;
- }
+ }
BLOG_D("THive::TTxUpdateTabletGroups::Execute{" << (ui64)this << "}("
<< tablet->Id << "," << tablet->ChannelProfileReassignReason << "," << Groups << ")");
-
+
Y_VERIFY(tablet->TabletStorageInfo);
if (tablet->ChannelProfileNewGroup.count() != Groups.size() && !Groups.empty()) {
@@ -82,8 +82,8 @@ public:
NewTabletState = ETabletState::ReadyToWork;
return true;
}
- }
-
+ }
+
NIceDb::TNiceDb db(txc.DB);
// updating tablet channels
@@ -94,7 +94,7 @@ public:
// we are skipping this channel because we haven't asked for it
continue;
}
-
+
const NKikimrBlobStorage::TEvControllerSelectGroupsResult::TGroupParameters* group;
if (Groups.size() > orderNumber) {
@@ -127,7 +127,7 @@ public:
TTabletChannelInfo* channel;
- if (channelId < tabletChannels.size()) {
+ if (channelId < tabletChannels.size()) {
channel = &tabletChannels[channelId];
Y_VERIFY(channel->Channel == channelId);
if (!tablet->ReleaseAllocationUnit(channelId)) {
@@ -177,7 +177,7 @@ public:
++orderNumber;
}
-
+
bool hasEmptyChannel = false;
for (ui32 channelId = 0; channelId < channels; ++channelId) {
if (tabletStorageInfo->Channels.size() <= channelId || tabletStorageInfo->Channels[channelId].History.empty()) {
@@ -219,7 +219,7 @@ public:
tablet->ActorsToNotify.clear();
db.Table<Schema::Tablet>().Key(TabletId).UpdateToNull<Schema::Tablet::ActorsToNotify>();
}
- } else {
+ } else {
BLOG_W("THive::TTxUpdateTabletGroups::Execute{" << (ui64)this << "}: tablet "
<< tablet->Id
<< " wasn't changed anything");
@@ -238,8 +238,8 @@ public:
}
NewTabletState = ETabletState::ReadyToWork;
}
- }
-
+ }
+
db.Table<Schema::Tablet>().Key(tablet->Id).Update<Schema::Tablet::State>(NewTabletState);
if (!tabletBootState.empty()) {
@@ -288,7 +288,7 @@ public:
ITransaction* THive::CreateUpdateTabletGroups(TTabletId tabletId, TVector<NKikimrBlobStorage::TEvControllerSelectGroupsResult::TGroupParameters> groups) {
return new TTxUpdateTabletGroups(tabletId, std::move(groups), this);
-}
-
+}
+
} // NHive
} // NKikimr
diff --git a/ydb/core/mind/hive/ya.make b/ydb/core/mind/hive/ya.make
index b604a0105c4..171f26f1b5f 100644
--- a/ydb/core/mind/hive/ya.make
+++ b/ydb/core/mind/hive/ya.make
@@ -42,7 +42,7 @@ SRCS(
storage_pool_info.h
tablet_info.cpp
tablet_info.h
- tx__adopt_tablet.cpp
+ tx__adopt_tablet.cpp
tx__block_storage_result.cpp
tx__configure_subdomain.cpp
tx__create_tablet.cpp
diff --git a/ydb/core/mind/local.cpp b/ydb/core/mind/local.cpp
index b7109150fb3..09fc15f76dd 100644
--- a/ydb/core/mind/local.cpp
+++ b/ydb/core/mind/local.cpp
@@ -183,9 +183,9 @@ class TLocalNodeRegistrar : public TActorBootstrapped<TLocalNodeRegistrar> {
HivePipeClient = ctx.RegisterWithSameMailbox(NTabletPipe::CreateClient(ctx.SelfID, HiveId, pipeConfig));
THolder<TEvLocal::TEvRegisterNode> request = MakeHolder<TEvLocal::TEvRegisterNode>(HiveId);
- for (auto &domain: ServicedDomains) {
- *request->Record.AddServicedDomains() = NKikimrSubDomains::TDomainKey(domain);
- }
+ for (auto &domain: ServicedDomains) {
+ *request->Record.AddServicedDomains() = NKikimrSubDomains::TDomainKey(domain);
+ }
for (const auto& [tabletType, tabletInfo] : Config->TabletClassInfo) {
NKikimrLocal::TTabletAvailability* tabletAvailability = request->Record.AddTabletAvailability();
tabletAvailability->SetType(tabletType);
@@ -193,9 +193,9 @@ class TLocalNodeRegistrar : public TActorBootstrapped<TLocalNodeRegistrar> {
tabletAvailability->SetMaxCount(tabletInfo.MaxCount);
}
}
-
- NTabletPipe::SendData(ctx, HivePipeClient, request.Release());
-
+
+ NTabletPipe::SendData(ctx, HivePipeClient, request.Release());
+
LOG_DEBUG_S(ctx, NKikimrServices::LOCAL, "TLocalNodeRegistrar::TryToRegister pipe to hive, pipe:" << HivePipeClient.ToString());
}
@@ -405,7 +405,7 @@ class TLocalNodeRegistrar : public TActorBootstrapped<TLocalNodeRegistrar> {
TMap<TTabletTypes::EType, TLocalConfig::TTabletClassInfo>::const_iterator it = Config->TabletClassInfo.find(tabletType);
if (it == Config->TabletClassInfo.end()) {
- LOG_ERROR_S(ctx, NKikimrServices::LOCAL,
+ LOG_ERROR_S(ctx, NKikimrServices::LOCAL,
"TLocalNodeRegistrar: boot-tablet unknown tablet type: "
<< tabletType << " for tablet: " << tabletId);
ctx.Send(ev->Sender, new TEvLocal::TEvTabletStatus(
@@ -866,15 +866,15 @@ public:
NMonitoring::TDynamicCounterPtr counters)
: Owner(owner)
, HiveId(hiveId)
- , ServicedDomains(std::move(servicedDomains))
+ , ServicedDomains(std::move(servicedDomains))
, Connected(false)
, Config(config)
, HiveGeneration(0)
, SendTabletMetricsInProgress(false)
, ResourceLimit(resourceLimit)
, Counters(counters)
- {
- Y_VERIFY(!ServicedDomains.empty());
+ {
+ Y_VERIFY(!ServicedDomains.empty());
TxCacheQuota = new TSharedQuota(Counters->GetCounter("UsedTxDataCache"),
Counters->GetCounter("TxDataCacheSize"));
@@ -896,7 +896,7 @@ public:
CounterCancelUnknownReason = Counters->GetCounter("Local_CancelUnknownReason", true);
UpdateCacheQuota();
- }
+ }
void Bootstrap(const TActorContext &ctx) {
LOG_DEBUG(ctx, NKikimrServices::LOCAL, "TLocalNodeRegistrar::Bootstrap");
@@ -949,7 +949,7 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
: Info(info)
, DomainKey(domainKey)
{}
-
+
TTenantInfo(const TTenantInfo &other) = default;
TTenantInfo(TTenantInfo &&other) = default;
@@ -960,7 +960,7 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
THashMap<TString, TString> Attributes;
TSubDomainKey DomainKey;
};
-
+
TString Domain;
ui64 SchemeRoot;
TVector<ui64> HiveIds;
@@ -970,13 +970,13 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
TIntrusivePtr<TLocalConfig> Config;
THashMap<TString, TTenantInfo> RunningTenants;
TString LogPrefix;
-
+
void OpenPipe(const TActorContext &ctx)
{
ClosePipe(ctx);
SchemeShardPipe = ctx.RegisterWithSameMailbox(NTabletPipe::CreateClient(ctx.SelfID, SchemeRoot, PipeConfig));
}
-
+
void ClosePipe(const TActorContext &ctx)
{
if (SchemeShardPipe) {
@@ -984,23 +984,23 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
SchemeShardPipe = TActorId();
}
}
-
+
void SendResolveRequest(const TRegistrationInfo &info, const TActorContext &ctx)
{
LOG_DEBUG_S(ctx, NKikimrServices::LOCAL,
LogPrefix << "Send resolve request for " << info.TenantName
<< " to schemeshard " << SchemeRoot);
-
- auto request = MakeHolder<NSchemeShard::TEvSchemeShard::TEvDescribeScheme>(info.TenantName);
+
+ auto request = MakeHolder<NSchemeShard::TEvSchemeShard::TEvDescribeScheme>(info.TenantName);
NTabletPipe::SendData(ctx.SelfID, SchemeShardPipe, request.Release());
}
-
+
void SendStatus(const TString &tenant,
TActorId recipient,
const TActorContext &ctx)
{
TAutoPtr<TEvLocal::TEvTenantStatus> ev;
-
+
auto it = RunningTenants.find(tenant);
if (it != RunningTenants.end())
ev = new TEvLocal::TEvTenantStatus(tenant,
@@ -1012,10 +1012,10 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
else
ev = new TEvLocal::TEvTenantStatus(tenant,
TEvLocal::TEvTenantStatus::STOPPED);
-
+
ctx.Send(recipient, ev.Release());
}
-
+
void SendStatus(const TString &tenant,
TEvLocal::TEvTenantStatus::EStatus status,
const TString &msg,
@@ -1042,27 +1042,27 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
{
for (auto &r : recipients)
SendStatus(tenant, status, msg, r, ctx);
- }
+ }
void RegisterLocalNode(const TString &tenant,
const NKikimrTabletBase::TMetrics &resourceLimit,
- ui64 hiveId,
+ ui64 hiveId,
const TVector<TSubDomainKey> &servicedDomains,
- const TActorContext &ctx)
- {
+ const TActorContext &ctx)
+ {
auto counters = GetServiceCounters(AppData(ctx)->Counters, "tablets");
auto actor = new TLocalNodeRegistrar(SelfId(), hiveId, servicedDomains, resourceLimit, Config, counters);
TActorId actorId = ctx.Register(actor);
-
+
RunningTenants.at(tenant).Locals.push_back(actorId);
-
+
TActorId localRegistrarServiceId = MakeLocalRegistrarID(ctx.SelfID.NodeId(), hiveId);
- ctx.ExecutorThread.ActorSystem->RegisterLocalService(localRegistrarServiceId, actorId);
+ ctx.ExecutorThread.ActorSystem->RegisterLocalService(localRegistrarServiceId, actorId);
}
void RegisterAsDomain(const TRegistrationInfo &info,
- const TActorContext &ctx)
- {
+ const TActorContext &ctx)
+ {
Y_VERIFY(!RunningTenants.contains(info.TenantName));
const auto domainKey = TSubDomainKey(SchemeRoot, 1);
RunningTenants.emplace(std::make_pair(info.TenantName, TTenantInfo(info, domainKey)));
@@ -1074,16 +1074,16 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
" at domain " << info.DomainName <<
" (allocated resources: " << info.ResourceLimit.ShortDebugString() << ")");
}
- }
-
- void RegisterAsSubDomain(const NKikimrScheme::TEvDescribeSchemeResult &rec,
+ }
+
+ void RegisterAsSubDomain(const NKikimrScheme::TEvDescribeSchemeResult &rec,
const TResolveTask &task,
const TVector<TTabletId> hiveIds,
const TActorContext &ctx)
{
const auto &domainDesc = rec.GetPathDescription().GetDomainDescription();
const auto domainKey = TSubDomainKey(domainDesc.GetDomainKey());
-
+
Y_VERIFY(!RunningTenants.contains(task.Info.TenantName));
TTenantInfo info(task.Info, domainKey);
for (auto &attr : rec.GetPathDescription().GetUserAttributes())
@@ -1098,11 +1098,11 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
<< " to hive " << hId
<< " (allocated resources: " << task.Info.ResourceLimit.ShortDebugString() << ")");
RegisterLocalNode(task.Info.TenantName, task.Info.ResourceLimit, hId, {domainKey}, ctx);
- }
- }
+ }
+ }
void HandlePoison(const TActorContext &ctx)
- {
+ {
LOG_DEBUG_S(ctx, NKikimrServices::LOCAL, LogPrefix << "HandlePoison");
for (auto &pr : RunningTenants) {
@@ -1121,21 +1121,21 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
new NNodeWhiteboard::TEvWhiteboard::TEvSystemStateRemoveTenant(pr.first));
}
- ClosePipe(ctx);
+ ClosePipe(ctx);
Die(ctx);
- }
-
+ }
+
void HandlePipe(TEvTabletPipe::TEvClientConnected::TPtr ev, const TActorContext &ctx)
{
- TEvTabletPipe::TEvClientConnected *msg = ev->Get();
-
- LOG_DEBUG_S(ctx, NKikimrServices::LOCAL,
+ TEvTabletPipe::TEvClientConnected *msg = ev->Get();
+
+ LOG_DEBUG_S(ctx, NKikimrServices::LOCAL,
LogPrefix << "TDomainLocal::TEvClientConnected for " << Domain
<< " shard " << msg->TabletId);
-
+
if (msg->Status != NKikimrProto::EReplyStatus::OK) {
OpenPipe(ctx);
- return;
+ return;
}
for (auto &pr : ResolveTasks)
@@ -1144,35 +1144,35 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
void HandlePipe(TEvTabletPipe::TEvClientDestroyed::TPtr ev, const TActorContext &ctx)
{
- TEvTabletPipe::TEvClientDestroyed *msg = ev->Get();
-
- LOG_DEBUG_S(ctx, NKikimrServices::LOCAL,
+ TEvTabletPipe::TEvClientDestroyed *msg = ev->Get();
+
+ LOG_DEBUG_S(ctx, NKikimrServices::LOCAL,
LogPrefix << "TEvTabletPipe::TEvClientDestroyed from tablet " << msg->TabletId);
-
+
OpenPipe(ctx);
- }
-
- void HandleResolve(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr ev, const TActorContext &ctx)
+ }
+
+ void HandleResolve(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr ev, const TActorContext &ctx)
{
- const NKikimrScheme::TEvDescribeSchemeResult &rec = ev->Get()->GetRecord();
-
- LOG_DEBUG_S(ctx, NKikimrServices::LOCAL,
+ const NKikimrScheme::TEvDescribeSchemeResult &rec = ev->Get()->GetRecord();
+
+ LOG_DEBUG_S(ctx, NKikimrServices::LOCAL,
LogPrefix << "HandleResolve from schemeshard " << SchemeRoot
<< ": " << rec.ShortDebugString());
-
+
if (!ResolveTasks.contains(rec.GetPath())) {
LOG_DEBUG_S(ctx, NKikimrServices::LOCAL,
LogPrefix << "Missing task for " << rec.GetPath());
- return;
- }
-
+ return;
+ }
+
const TResolveTask &task = ResolveTasks.find(rec.GetPath())->second;
-
- using EDescStatus = NKikimrScheme::EStatus;
- if (rec.GetStatus() != EDescStatus::StatusSuccess) {
+
+ using EDescStatus = NKikimrScheme::EStatus;
+ if (rec.GetStatus() != EDescStatus::StatusSuccess) {
LOG_ERROR_S(ctx, NKikimrServices::LOCAL,
LogPrefix << " Receive TEvDescribeSchemeResult with bad status "
- << NKikimrScheme::EStatus_Name(rec.GetStatus()) <<
+ << NKikimrScheme::EStatus_Name(rec.GetStatus()) <<
" reason is <" << rec.GetReason() << ">" <<
" while resolving subdomain " << task.Info.DomainName);
@@ -1180,28 +1180,28 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
rec.GetReason(), task.Senders, ctx);
ResolveTasks.erase(rec.GetPath());
return;
- }
-
- Y_VERIFY(rec.HasPathDescription());
- Y_VERIFY(rec.GetPathDescription().HasSelf());
- if (rec.GetPathDescription().GetSelf().GetPathType() != NKikimrSchemeOp::EPathTypeSubDomain
- && rec.GetPathDescription().GetSelf().GetPathType() != NKikimrSchemeOp::EPathTypeExtSubDomain) {
- LOG_CRIT_S(ctx, NKikimrServices::LOCAL,
+ }
+
+ Y_VERIFY(rec.HasPathDescription());
+ Y_VERIFY(rec.GetPathDescription().HasSelf());
+ if (rec.GetPathDescription().GetSelf().GetPathType() != NKikimrSchemeOp::EPathTypeSubDomain
+ && rec.GetPathDescription().GetSelf().GetPathType() != NKikimrSchemeOp::EPathTypeExtSubDomain) {
+ LOG_CRIT_S(ctx, NKikimrServices::LOCAL,
LogPrefix << " Resolve subdomain fail, requested path "
<< task.Info.DomainName << " has invalid path type "
- << NKikimrSchemeOp::EPathType_Name(rec.GetPathDescription().GetSelf().GetPathType()));
+ << NKikimrSchemeOp::EPathType_Name(rec.GetPathDescription().GetSelf().GetPathType()));
SendStatus(rec.GetPath(), TEvLocal::TEvTenantStatus::UNKNOWN_TENANT,
rec.GetPath() + " is not a tenant path", task.Senders, ctx);
ResolveTasks.erase(rec.GetPath());
return;
- }
- Y_VERIFY(rec.GetPathDescription().HasDomainDescription());
- Y_VERIFY(rec.GetPathDescription().GetDomainDescription().GetDomainKey().GetSchemeShard() == SchemeRoot);
-
+ }
+ Y_VERIFY(rec.GetPathDescription().HasDomainDescription());
+ Y_VERIFY(rec.GetPathDescription().GetDomainDescription().GetDomainKey().GetSchemeShard() == SchemeRoot);
+
TVector<TTabletId> hiveIds(HiveIds);
TString path = rec.GetPath();
-
+
TTabletId hiveId = rec.GetPathDescription().GetDomainDescription().GetProcessingParams().GetHive();
if (hiveId) {
hiveIds.emplace_back(hiveId);
@@ -1268,7 +1268,7 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
if (RunningTenants.contains(info.TenantName)) {
SendStatus(info.TenantName, ev->Sender, ctx);
return;
- }
+ }
// In-fly?
auto it = ResolveTasks.find(info.TenantName);
@@ -1287,12 +1287,12 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
else
OpenPipe(ctx);
}
- }
-
+ }
+
void HandleTenant(TEvLocal::TEvRemoveTenant::TPtr &ev, const TActorContext &ctx)
{
auto &tenant = ev->Get()->TenantName;
-
+
// In-fly?
auto it = ResolveTasks.find(tenant);
if (it != ResolveTasks.end()) {
@@ -1315,7 +1315,7 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
}
SendStatus(ev->Get()->TenantName, ev->Sender, ctx);
}
-
+
void HandleDrain(TEvLocal::TEvLocalDrainNode::TPtr &ev, const TActorContext& ctx) {
for(auto& hiveId: HiveIds) {
LOG_NOTICE_S(ctx, NKikimrServices::LOCAL, "Forward drain node to local, hive id: " << hiveId);
@@ -1329,7 +1329,7 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
void HandleTenant(TEvLocal::TEvAlterTenant::TPtr &ev, const TActorContext &ctx)
{
auto &info = ev->Get()->TenantInfo;
-
+
LOG_DEBUG_S(ctx, NKikimrServices::LOCAL,
LogPrefix << "Alter tenant " << info.TenantName);
@@ -1342,7 +1342,7 @@ class TDomainLocal : public TActorBootstrapped<TDomainLocal> {
SendStatus(info.TenantName, ev->Sender, ctx);
}
-
+
public:
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
return NKikimrServices::TActivity::LOCAL_ACTOR;
@@ -1356,7 +1356,7 @@ public:
{
for (auto hiveUid : domain.HiveUids)
HiveIds.push_back(domainsInfo.GetHive(hiveUid));
-
+
PipeConfig.RetryPolicy = NTabletPipe::TClientRetryPolicy::WithRetries();
LogPrefix = Sprintf("TDomainLocal(%s): ", Domain.data());
@@ -1370,14 +1370,14 @@ public:
}
STFUNC(StateWork) {
- switch (ev->GetTypeRewrite()) {
- CFunc(TEvents::TSystem::PoisonPill, HandlePoison);
-
- HFunc(TEvTabletPipe::TEvClientConnected, HandlePipe);
- HFunc(TEvTabletPipe::TEvClientDestroyed, HandlePipe);
-
- HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, HandleResolve);
-
+ switch (ev->GetTypeRewrite()) {
+ CFunc(TEvents::TSystem::PoisonPill, HandlePoison);
+
+ HFunc(TEvTabletPipe::TEvClientConnected, HandlePipe);
+ HFunc(TEvTabletPipe::TEvClientDestroyed, HandlePipe);
+
+ HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, HandleResolve);
+
HFunc(TEvLocal::TEvAddTenant, HandleTenant);
HFunc(TEvLocal::TEvRemoveTenant, HandleTenant);
HFunc(TEvLocal::TEvAlterTenant, HandleTenant);
@@ -1389,8 +1389,8 @@ public:
default:
Y_FAIL("Unexpected event for TDomainLocal");
break;
- }
- }
+ }
+ }
};
class TLocal : public TActorBootstrapped<TLocal> {
diff --git a/ydb/core/mind/local.h b/ydb/core/mind/local.h
index 9c1f3b316a8..05c9bdc48eb 100644
--- a/ydb/core/mind/local.h
+++ b/ydb/core/mind/local.h
@@ -279,7 +279,7 @@ struct TEvLocal {
};
struct TEvRemoveTenant : public TEventLocal<TEvRemoveTenant, EvRemoveTenant> {
- TString TenantName;
+ TString TenantName;
TEvRemoveTenant(const TString &name)
: TenantName(name)
@@ -320,7 +320,7 @@ struct TEvLocal {
: TenantName(tenant)
, Status(status)
{}
-
+
TEvTenantStatus(const TString &tenant, EStatus status, const TString &error)
: TenantName(tenant)
, Status(status)
@@ -348,14 +348,14 @@ struct TEvLocal {
{}
};
};
-
+
struct TLocalConfig : public TThrRefBase {
using TPtr = TIntrusivePtr<TLocalConfig>;
-
+
struct TTabletClassInfo {
TTabletSetupInfo::TPtr SetupInfo;
ui64 MaxCount = 0; // maximum allowed number of running tablets, 0 means unlimited
-
+
TTabletClassInfo()
{}
@@ -388,10 +388,10 @@ inline TActorId MakeLocalRegistrarID(ui32 node, ui64 hiveId) {
x[5] = (char)((node >> 8) & 0xFF);
x[6] = (char)((node >> 16) & 0xFF);
x[7] = (char)((node >> 24) & 0xFF);
- x[8] = (char)((hiveId & 0xFF) ^ ((hiveId >> 32) & 0xFF));
- x[9] = (char)(((hiveId >> 8) & 0xFF) ^ ((hiveId >> 40) & 0xFF));
- x[10] = (char)(((hiveId >> 16) & 0xFF) ^ ((hiveId >> 48) & 0xFF));
- x[11] = (char)(((hiveId >> 24) & 0xFF) ^ ((hiveId >> 56) & 0xFF));
+ x[8] = (char)((hiveId & 0xFF) ^ ((hiveId >> 32) & 0xFF));
+ x[9] = (char)(((hiveId >> 8) & 0xFF) ^ ((hiveId >> 40) & 0xFF));
+ x[10] = (char)(((hiveId >> 16) & 0xFF) ^ ((hiveId >> 48) & 0xFF));
+ x[11] = (char)(((hiveId >> 24) & 0xFF) ^ ((hiveId >> 56) & 0xFF));
return TActorId(node, TStringBuf(x, 12));
}
diff --git a/ydb/core/mind/node_broker_ut.cpp b/ydb/core/mind/node_broker_ut.cpp
index db2205175c1..0d9498ddcdd 100644
--- a/ydb/core/mind/node_broker_ut.cpp
+++ b/ydb/core/mind/node_broker_ut.cpp
@@ -53,9 +53,9 @@ void SetupServices(TTestActorRuntime &runtime,
const ui32 domainsNum = 1;
const ui32 disksInDomain = 1;
- // setup domain info
+ // setup domain info
TAppPrepare app;
-
+
app.ClearDomainsAndHive();
app.AddDomain(TDomainsInfo::TDomain::ConstructEmptyDomain("dc-1").Release());
diff --git a/ydb/core/mind/tenant_ut_pool.cpp b/ydb/core/mind/tenant_ut_pool.cpp
index 399f2c10e65..9ac6b6843c3 100644
--- a/ydb/core/mind/tenant_ut_pool.cpp
+++ b/ydb/core/mind/tenant_ut_pool.cpp
@@ -1219,7 +1219,7 @@ Y_UNIT_TEST_SUITE(TTenantPoolTests) {
config.Nodes.back().TenantPoolConfig.DynamicSlots.push_back(dynamicSlot);
}
- TTenantTestRuntime runtime(config, {}, false);
+ TTenantTestRuntime runtime(config, {}, false);
const TActorId& sender = runtime.Sender;
const TActorId tenantPoolRoot = MakeTenantPoolRootID();
diff --git a/ydb/core/persqueue/pq_ut.cpp b/ydb/core/persqueue/pq_ut.cpp
index d122ada22f1..13a61229105 100644
--- a/ydb/core/persqueue/pq_ut.cpp
+++ b/ydb/core/persqueue/pq_ut.cpp
@@ -331,7 +331,7 @@ Y_UNIT_TEST(TestCheckACL) {
{
TDispatchOptions options;
- options.FinalEvents.emplace_back(NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult);
+ options.FinalEvents.emplace_back(NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult);
tc.Runtime->DispatchEvents(options);
}
@@ -344,7 +344,7 @@ Y_UNIT_TEST(TestCheckACL) {
{
TDispatchOptions options;
- options.FinalEvents.emplace_back(NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult);
+ options.FinalEvents.emplace_back(NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult);
tc.Runtime->DispatchEvents(options);
}
@@ -362,7 +362,7 @@ Y_UNIT_TEST(TestCheckACL) {
{
TDispatchOptions options;
- options.FinalEvents.emplace_back(NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult);
+ options.FinalEvents.emplace_back(NSchemeShard::TEvSchemeShard::EvDescribeSchemeResult);
tc.Runtime->DispatchEvents(options);
}
diff --git a/ydb/core/persqueue/read_balancer.cpp b/ydb/core/persqueue/read_balancer.cpp
index 2ec93c95b85..4eb9c7206dd 100644
--- a/ydb/core/persqueue/read_balancer.cpp
+++ b/ydb/core/persqueue/read_balancer.cpp
@@ -626,7 +626,7 @@ void TPersQueueReadBalancer::RequestTabletIfNeeded(const ui64 tabletId, const TA
pipeClient = it->second;
}
if (tabletId == SchemeShardId) {
- NTabletPipe::SendData(ctx, pipeClient, new NSchemeShard::TEvSchemeShard::TEvDescribeScheme(tabletId, PathId));
+ NTabletPipe::SendData(ctx, pipeClient, new NSchemeShard::TEvSchemeShard::TEvDescribeScheme(tabletId, PathId));
} else {
NTabletPipe::SendData(ctx, pipeClient, new TEvPersQueue::TEvStatus());
}
@@ -670,13 +670,13 @@ void TPersQueueReadBalancer::AnswerWaitingRequests(const TActorContext& ctx) {
}
-void TPersQueueReadBalancer::Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev, const TActorContext& ctx) {
+void TPersQueueReadBalancer::Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev, const TActorContext& ctx) {
Y_UNUSED(ctx);
if (!WaitingForACL) //ignore if already processed
return;
WaitingForACL = false;
const auto& record = ev->Get()->GetRecord();
- if (record.GetStatus() == NKikimrScheme::EStatus::StatusSuccess) {
+ if (record.GetStatus() == NKikimrScheme::EStatus::StatusSuccess) {
ACL.Clear();
Y_PROTOBUF_SUPPRESS_NODISCARD ACL.MutableACL()->ParseFromString(record.GetPathDescription().GetSelf().GetEffectiveACL());
LastACLUpdate = ctx.Now();
diff --git a/ydb/core/persqueue/read_balancer.h b/ydb/core/persqueue/read_balancer.h
index 38f41c70896..6a07edcb784 100644
--- a/ydb/core/persqueue/read_balancer.h
+++ b/ydb/core/persqueue/read_balancer.h
@@ -284,7 +284,7 @@ class TPersQueueReadBalancer : public TActor<TPersQueueReadBalancer>, public TTa
void Handle(TEvents::TEvPoisonPill &ev, const TActorContext& ctx);
void Handle(TEvPersQueue::TEvStatusResponse::TPtr& ev, const TActorContext& ctx);
- void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev, const TActorContext& ctx);
+ void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev, const TActorContext& ctx);
void RegisterSession(const TActorId& pipe, const TActorContext& ctx);
struct TPipeInfo;
@@ -506,7 +506,7 @@ public:
HFunc(TEvTabletPipe::TEvClientConnected, Handle);
HFunc(TEvTabletPipe::TEvClientDestroyed, Handle);
HFunc(TEvPersQueue::TEvStatusResponse, Handle);
- HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
default:
HandleDefaultEvents(ev, ctx);
diff --git a/ydb/core/protos/base.proto b/ydb/core/protos/base.proto
index 272972106b1..1f7e855e091 100644
--- a/ydb/core/protos/base.proto
+++ b/ydb/core/protos/base.proto
@@ -23,7 +23,7 @@ enum EReplyStatus {
INVALID_ROUND = 18;
RESTART = 19;
NOT_YET = 20;
- NO_GROUP = 21;
+ NO_GROUP = 21;
UNKNOWN = 255;
};
diff --git a/ydb/core/protos/bind_channel_storage_pool.proto b/ydb/core/protos/bind_channel_storage_pool.proto
index c3f251f49c8..f9b1943aae6 100644
--- a/ydb/core/protos/bind_channel_storage_pool.proto
+++ b/ydb/core/protos/bind_channel_storage_pool.proto
@@ -1,15 +1,15 @@
-package NKikimrStoragePool;
-option java_package = "ru.yandex.kikimr.proto";
-
-message TStoragePool {
- optional string Name = 1;
- optional string Kind = 2;
-}
-
-message TChannelBind {
+package NKikimrStoragePool;
+option java_package = "ru.yandex.kikimr.proto";
+
+message TStoragePool {
+ optional string Name = 1;
+ optional string Kind = 2;
+}
+
+message TChannelBind {
//optional uint32 Channel = 1; // it should be equal to array index, so it doesn't make any sense to have one
- optional string StoragePoolName = 2;
+ optional string StoragePoolName = 2;
optional float IOPS = 10;
optional uint64 Throughput = 11;
optional uint64 Size = 12;
-}
+}
diff --git a/ydb/core/protos/blobstorage.proto b/ydb/core/protos/blobstorage.proto
index 0d390e58ffc..a08ccbf865c 100644
--- a/ydb/core/protos/blobstorage.proto
+++ b/ydb/core/protos/blobstorage.proto
@@ -1016,7 +1016,7 @@ message TDriveData {
message TEvControllerRegisterNode {
reserved 1;
optional uint32 NodeID = 2;
- repeated uint32 Groups = 4;
+ repeated uint32 Groups = 4;
repeated uint32 GroupGenerations = 5; // must be zero entries (for old nodes) and the same number as in Groups for new ones
repeated TVDiskStatus VDiskStatus = 6; // actual status for currently operating VDisks
repeated TDriveData DrivesData = 7;
diff --git a/ydb/core/protos/channel_purpose.proto b/ydb/core/protos/channel_purpose.proto
index 53dda97071e..40f370d6145 100644
--- a/ydb/core/protos/channel_purpose.proto
+++ b/ydb/core/protos/channel_purpose.proto
@@ -1,18 +1,18 @@
-package NKikimrStorageSettings;
-option java_package = "ru.yandex.kikimr.proto";
-
-message TChannelPurpose {
- enum EPurpose {
- SysLog = 1;
- Log = 2;
- Data = 3;
- External = 4;
- };
- optional EPurpose Purpose = 1;
- optional uint32 Channel = 2;
-}
-
-message TStorageRoom {
- optional uint32 RoomId = 1;
- repeated TChannelPurpose Explanation = 2;
-}
+package NKikimrStorageSettings;
+option java_package = "ru.yandex.kikimr.proto";
+
+message TChannelPurpose {
+ enum EPurpose {
+ SysLog = 1;
+ Log = 2;
+ Data = 3;
+ External = 4;
+ };
+ optional EPurpose Purpose = 1;
+ optional uint32 Channel = 2;
+}
+
+message TStorageRoom {
+ optional uint32 RoomId = 1;
+ repeated TChannelPurpose Explanation = 2;
+}
diff --git a/ydb/core/protos/config.proto b/ydb/core/protos/config.proto
index a4e756b1d7e..d64169d4fc0 100644
--- a/ydb/core/protos/config.proto
+++ b/ydb/core/protos/config.proto
@@ -169,7 +169,7 @@ message TDomainsConfig {
}
message TStoragePoolType {
- optional string Kind = 1;
+ optional string Kind = 1;
optional NKikimrBlobStorage.TDefineStoragePool PoolConfig = 2;
}
@@ -191,9 +191,9 @@ message TDomainsConfig {
optional string Name = 9;
optional TTxLimits TxLimits = 10; // DEPRECATED
repeated TStoragePoolType StoragePoolTypes = 11;
- repeated fixed64 ExplicitMediators = 12;
- repeated fixed64 ExplicitCoordinators = 13;
- repeated fixed64 ExplicitAllocators = 14;
+ repeated fixed64 ExplicitMediators = 12;
+ repeated fixed64 ExplicitCoordinators = 13;
+ repeated fixed64 ExplicitAllocators = 14;
optional uint32 SchemeBoardSSId = 15;
}
@@ -207,7 +207,7 @@ message TDomainsConfig {
message TNamedCompactionPolicy {
optional string Name = 1;
- optional NKikimrSchemeOp.TCompactionPolicy Policy = 2;
+ optional NKikimrSchemeOp.TCompactionPolicy Policy = 2;
}
message TSecurityConfig {
@@ -290,10 +290,10 @@ message TLogConfig {
optional uint64 TimeThresholdMs = 14 [default = 1000];
}
-message TCompileServiceConfig {
- optional uint32 InflightLimit = 1 [default = 100000];
-}
-
+message TCompileServiceConfig {
+ optional uint32 InflightLimit = 1 [default = 100000];
+}
+
message TBootstrap {
enum ETabletType {
TX_DUMMY = 0;
@@ -307,7 +307,7 @@ message TBootstrap {
FLAT_HIVE = 14;
FLAT_BS_CONTROLLER = 15;
FLAT_TX_PROXY = 17;
- TX_ALLOCATOR = 18;
+ TX_ALLOCATOR = 18;
BS_DOMAINCONTROLLER = 20;
@@ -346,8 +346,8 @@ message TBootstrap {
optional NKikimrNodeLimits.TNodeLimitsConfig NodeLimits = 5;
optional NKikimrResourceBroker.TResourceBrokerConfig ResourceBroker = 6;
optional NKikimrSharedCache.TSharedCacheConfig SharedCacheConfig = 7;
- repeated NKikimrSchemeOp.TResourceProfile ResourceProfiles = 8;
- optional TCompileServiceConfig CompileServiceConfig = 9; //may be need special file with resource limits?
+ repeated NKikimrSchemeOp.TResourceProfile ResourceProfiles = 8;
+ optional TCompileServiceConfig CompileServiceConfig = 9; //may be need special file with resource limits?
optional bool EnableIntrospection = 10;
}
@@ -425,7 +425,7 @@ message TChannelProfileConfig {
// this option uses new BS configuration interface to obtain matching groups, and it must not be provided
// with any of the above fields
- optional string StoragePoolKind = 5;
+ optional string StoragePoolKind = 5;
}
optional uint32 ProfileId = 1;
@@ -530,7 +530,7 @@ message TMessageBusConfig {
repeated uint64 ProxyBindToProxy = 5;
optional bool StartTracingBusProxy = 6 [default = true]; // move to TMessageBusTraceServiceConfig
optional string TracePath = 7;
- optional uint64 CompileInflightLimit_Depricated = 8 [default = 100000];
+ optional uint64 CompileInflightLimit_Depricated = 8 [default = 100000];
}
message TTabletsConfig {
@@ -620,13 +620,13 @@ message TFeatureFlags {
optional bool EnablePerOwnerChunkLimitForPDisk = 5 [default = false];
optional bool TrimEntireDeviceOnStartup = 6 [default = false];
optional bool EnableChunkGraceForPDisk = 7 [default = true];
- optional bool AllowConsistentOperationsForSchemeShard = 8 [default = true];
+ optional bool AllowConsistentOperationsForSchemeShard = 8 [default = true];
optional bool EnableSchemeBoard = 9 [default = true]; // deprecated: always true
optional bool AllowYdbRequestsWithoutDatabase = 10 [default = true];
- optional bool EnableExternalSubdomains = 11 [default = true];
+ optional bool EnableExternalSubdomains = 11 [default = true];
optional bool AllowRecursiveMkDir = 12 [default = true]; // deprecated: always true
optional bool AllowHugeKeyValueDeletes = 13 [default = true]; // delete when all clients limit deletes per request
- optional bool SendSchemaVersionToDatashard = 14 [default = true]; // deprecated: always true
+ optional bool SendSchemaVersionToDatashard = 14 [default = true]; // deprecated: always true
optional bool EnableSchemeBoardCache = 15 [default = true]; // deprecated: always true
optional bool EnableSystemViews = 16 [default = true];
optional bool EnableExternalHive = 17 [default = true];
@@ -636,7 +636,7 @@ message TFeatureFlags {
optional bool ImportantTabletsUseSystemPool = 21 [default = true];
optional bool EnableOfflineSlaves = 22 [default = true]; // deprecated: always true
optional bool CheckDatabaseAccessPermission = 23 [default = false];
- optional bool AllowOnlineIndexBuild = 24 [default = true]; // deprecated: always true
+ optional bool AllowOnlineIndexBuild = 24 [default = true]; // deprecated: always true
optional bool EnablePersistentQueryStats = 25 [default = false];
optional bool DisableDataShardBarrier = 26 [default = false];
optional bool EnablePutBatchingForBlobStorage = 27 [default = true];
@@ -647,7 +647,7 @@ message TFeatureFlags {
optional bool AllowUpdateChannelsBindingOfSolomonPartitions = 32 [default = false];
optional bool DisableLegacyYql = 33 [default = true]; // deprecated: always true
optional bool EnableDataColumnForIndexTable = 34 [default = true];
- optional bool AllowServerlessStorageBillingForSchemeShard = 35 [default = false];
+ optional bool AllowServerlessStorageBillingForSchemeShard = 35 [default = false];
optional bool EnableGracefulShutdown = 36 [default = true];
optional bool EnableDrainOnShutdown = 37 [default = true];
optional bool EnableConfigurationCache = 38 [default = false];
@@ -660,7 +660,7 @@ message TFeatureFlags {
optional bool EnableVPatch = 45 [default = false];
optional bool EnableMvccSnapshotReads = 46 [default = false];
optional Tribool EnableMvcc = 47 [default = VALUE_TRUE];
- optional bool EnableSchemeTransactionsAtSchemeShard = 48 [default = false];
+ optional bool EnableSchemeTransactionsAtSchemeShard = 48 [default = false];
optional bool EnableArrowFormatAtDatashard = 49 [default = false];
optional bool Enable3x3RequestsForMirror3DCMinLatencyPut = 50 [default = false];
optional bool EnableBackgroundCompaction = 51 [default = true];
@@ -878,13 +878,13 @@ message TConfigsDispatcherConfig {
message TCompactionPolicy {
optional string Name = 1;
- optional NKikimrSchemeOp.TCompactionPolicy CompactionPolicy = 2;
+ optional NKikimrSchemeOp.TCompactionPolicy CompactionPolicy = 2;
}
message TExecutionPolicy {
optional string Name = 1;
- optional NKikimrSchemeOp.TPipelineConfig PipelineConfig = 2;
+ optional NKikimrSchemeOp.TPipelineConfig PipelineConfig = 2;
optional string ResourceProfile = 3;
optional bool EnableFilterByKey = 4 [default = false];
optional bool ExecutorFastLogPolicy = 5 [default = true];
@@ -907,7 +907,7 @@ message TPartitioningPolicy {
message TStoragePolicy {
optional string Name = 1;
- repeated NKikimrSchemeOp.TFamilyDescription ColumnFamilies = 2;
+ repeated NKikimrSchemeOp.TFamilyDescription ColumnFamilies = 2;
}
message TReplicationPolicy {
@@ -1187,11 +1187,11 @@ message TImmediateControlsConfig {
optional TTxLimitControls TxLimitControls = 2;
};
-message TMeteringConfig {
- optional string MeteringFilePath = 1;
+message TMeteringConfig {
+ optional string MeteringFilePath = 1;
repeated string SystemBackupSIDs = 2;
-};
-
+};
+
message THiveTabletLimit {
optional NKikimrTabletBase.TTabletTypes.EType Type = 1;
optional uint64 MaxCount = 2;
@@ -1374,7 +1374,7 @@ message TAppConfig {
optional NKikimrNetClassifier.TNetClassifierConfig NetClassifierConfig = 42;
optional NKikimrNetClassifier.TNetClassifierDistributableConfig NetClassifierDistributableConfig = 43; // also dynamic via cms
optional NKikimrResourceBroker.TResourceBrokerConfig ResourceBrokerConfig = 44;
- optional TMeteringConfig MeteringConfig = 45;
+ optional TMeteringConfig MeteringConfig = 45;
optional THiveConfig HiveConfig = 46;
optional TDataShardConfig DataShardConfig = 49;
optional NYq.NConfig.TConfig YandexQueryConfig = 50;
diff --git a/ydb/core/protos/console_config.proto b/ydb/core/protos/console_config.proto
index 698ac3234a0..d5a32d05c66 100644
--- a/ydb/core/protos/console_config.proto
+++ b/ydb/core/protos/console_config.proto
@@ -106,7 +106,7 @@ message TConfigItem {
NetClassifierConfigItem = 42;
NetClassifierDistributableConfigItem = 43;
ResourceBrokerConfigItem = 44;
- MeteringConfigItem = 45;
+ MeteringConfigItem = 45;
HiveConfigItem = 46;
DataShardConfigItem = 49;
YandexQueryConfigItem = 50;
diff --git a/ydb/core/protos/counters_datashard.proto b/ydb/core/protos/counters_datashard.proto
index 53ee0c2229e..956a1369378 100644
--- a/ydb/core/protos/counters_datashard.proto
+++ b/ydb/core/protos/counters_datashard.proto
@@ -391,7 +391,7 @@ enum ETxTypes {
TXTYPE_REFRESH_VOLATILE_SNAPSHOT = 42 [(TxTypeOpts) = {Name: "TxRefreshVolatileSnapshot"}];
TXTYPE_DISCARD_VOLATILE_SNAPSHOT = 43 [(TxTypeOpts) = {Name: "TxDiscardVolatileSnapshot"}];
TXTYPE_CLEANUP_REMOVED_SNAPSHOTS = 44 [(TxTypeOpts) = {Name: "TxCleanupRemovedSnapshots"}];
- TXTYPE_MIGRATE_SCHEMESHARD = 45 [(TxTypeOpts) = {Name: "TxMigrateSchemeShard"}];
+ TXTYPE_MIGRATE_SCHEMESHARD = 45 [(TxTypeOpts) = {Name: "TxMigrateSchemeShard"}];
TXTYPE_GET_S3_UPLOAD_ID = 46 [(TxTypeOpts) = {Name: "TxGetS3UploadId"}];
TXTYPE_STORE_S3_UPLOAD_ID = 47 [(TxTypeOpts) = {Name: "TxStoreS3UploadId"}];
TXTYPE_ERASE_ROWS = 48 [(TxTypeOpts) = {Name: "TxEraseRows"}];
diff --git a/ydb/core/protos/counters_hive.proto b/ydb/core/protos/counters_hive.proto
index f03d8a31c37..952f4e99e3c 100644
--- a/ydb/core/protos/counters_hive.proto
+++ b/ydb/core/protos/counters_hive.proto
@@ -54,7 +54,7 @@ enum ETxTypes {
TXTYPE_UPDATE_TABLET_STATUS = 4 [(TxTypeOpts) = {Name: "TxUpdateTabletStatus"}];
TXTYPE_REGISTER_NODE = 5 [(TxTypeOpts) = {Name: "TxRegisterNode"}];
TXTYPE_KILL_NODE = 6 [(TxTypeOpts) = {Name: "TxKillNode"}];
- TXTYPE_ADOPT_TABLET = 7 [(TxTypeOpts) = {Name: "TxAdoptTablet"}];
+ TXTYPE_ADOPT_TABLET = 7 [(TxTypeOpts) = {Name: "TxAdoptTablet"}];
TXTYPE_UPDATE_TABLET_METRIC = 8 [(TxTypeOpts) = {Name: "TxUpdateTabletMetric"}];
TXTYPE_UPDATE_TABLET_GROUPS = 9 [(TxTypeOpts) = {Name: "TxUpdateTabletGroups"}];
TXTYPE_UNLOCK_TABLET_EXECUTION = 10 [(TxTypeOpts) = {Name: "TxUnlockTabletExecution"}];
diff --git a/ydb/core/protos/counters_mediator.proto b/ydb/core/protos/counters_mediator.proto
index 6168e02e588..c31d474276a 100644
--- a/ydb/core/protos/counters_mediator.proto
+++ b/ydb/core/protos/counters_mediator.proto
@@ -1,12 +1,12 @@
import "ydb/core/protos/counters.proto";
-
-package NKikimr.NTxMediator;
-
-option java_package = "ru.yandex.kikimr.proto";
-
-option (TabletTypeName) = "Mediator"; // Used as prefix for all counters
-
-enum ETxTypes {
- TXTYPE_INIT = 0 [(TxTypeOpts) = {Name: "TxInit"}];
- TXTYPE_CONFIGURE = 1 [(TxTypeOpts) = {Name: "TxConfigure"}];
-}
+
+package NKikimr.NTxMediator;
+
+option java_package = "ru.yandex.kikimr.proto";
+
+option (TabletTypeName) = "Mediator"; // Used as prefix for all counters
+
+enum ETxTypes {
+ TXTYPE_INIT = 0 [(TxTypeOpts) = {Name: "TxInit"}];
+ TXTYPE_CONFIGURE = 1 [(TxTypeOpts) = {Name: "TxConfigure"}];
+}
diff --git a/ydb/core/protos/counters_schemeshard.proto b/ydb/core/protos/counters_schemeshard.proto
index e87bfe177a5..a839915c98f 100644
--- a/ydb/core/protos/counters_schemeshard.proto
+++ b/ydb/core/protos/counters_schemeshard.proto
@@ -1,6 +1,6 @@
import "ydb/core/protos/counters.proto";
-package NKikimr.NSchemeShard;
+package NKikimr.NSchemeShard;
option java_package = "ru.yandex.kikimr.proto";
@@ -17,9 +17,9 @@ enum ESimpleCounters {
COUNTER_TABLE_SHARD_INACTIVE_COUNT = 6 [(CounterOpts) = {Name: "TableShardsInactive"}];
COUNTER_PQ_SHARD_COUNT = 7 [(CounterOpts) = {Name: "PqGroupShards"}];
COUNTER_PQ_RB_SHARD_COUNT = 8 [(CounterOpts) = {Name: "PqReadBalancerShards"}];
- COUNTER_SUB_DOMAIN_COUNT = 9 [(CounterOpts) = {Name: "SubDomains"}];
- COUNTER_SUB_DOMAIN_COORDINATOR_COUNT = 10 [(CounterOpts) = {Name: "SubDomainsCoordinators"}];
- COUNTER_SUB_DOMAIN_MEDIATOR_COUNT = 11 [(CounterOpts) = {Name: "SubDomainsMediators"}];
+ COUNTER_SUB_DOMAIN_COUNT = 9 [(CounterOpts) = {Name: "SubDomains"}];
+ COUNTER_SUB_DOMAIN_COORDINATOR_COUNT = 10 [(CounterOpts) = {Name: "SubDomainsCoordinators"}];
+ COUNTER_SUB_DOMAIN_MEDIATOR_COUNT = 11 [(CounterOpts) = {Name: "SubDomainsMediators"}];
COUNTER_RTMR_VOLUME_COUNT = 12 [(CounterOpts) = {Name: "RtmrVolumesCount"}];
COUNTER_RTMR_PARTITIONS_COUNT = 13 [(CounterOpts) = {Name: "RtmrPartitionsCount"}];
COUNTER_BLOCKSTORE_VOLUME_COUNT = 14 [(CounterOpts) = {Name: "BlockStoreVolumes"}];
@@ -52,39 +52,39 @@ enum ESimpleCounters {
COUNTER_KESUS_SHARD_COUNT = 39 [(CounterOpts) = {Name: "KesusShards"}];
COUNTER_IN_FLIGHT_OPS_TxCreateKesus = 40 [(CounterOpts) = {Name: "InFlightOps/CreateKesus"}];
COUNTER_IN_FLIGHT_OPS_TxDropKesus = 41 [(CounterOpts) = {Name: "InFlightOps/DropKesus"}];
- COUNTER_IN_FLIGHT_OPS_TxForceDropSubDomain = 42 [(CounterOpts) = {Name: "InFlightOps/ForceDropSubDomain"}];
- COUNTER_IN_FLIGHT_OPS_TxCreateSolomonVolume = 43 [(CounterOpts) = {Name: "InFlightOps/CreateSolomonVolume"}];
- COUNTER_IN_FLIGHT_OPS_TxDropSolomonVolume = 44 [(CounterOpts) = {Name: "InFlightOps/DropSolomonVolume"}];
- COUNTER_SOLOMON_VOLUME_COUNT = 45 [(CounterOpts) = {Name: "SolomonVolumesCount"}];
- COUNTER_SOLOMON_PARTITIONS_COUNT = 46 [(CounterOpts) = {Name: "SolomonPartitionsCount"}];
+ COUNTER_IN_FLIGHT_OPS_TxForceDropSubDomain = 42 [(CounterOpts) = {Name: "InFlightOps/ForceDropSubDomain"}];
+ COUNTER_IN_FLIGHT_OPS_TxCreateSolomonVolume = 43 [(CounterOpts) = {Name: "InFlightOps/CreateSolomonVolume"}];
+ COUNTER_IN_FLIGHT_OPS_TxDropSolomonVolume = 44 [(CounterOpts) = {Name: "InFlightOps/DropSolomonVolume"}];
+ COUNTER_SOLOMON_VOLUME_COUNT = 45 [(CounterOpts) = {Name: "SolomonVolumesCount"}];
+ COUNTER_SOLOMON_PARTITIONS_COUNT = 46 [(CounterOpts) = {Name: "SolomonPartitionsCount"}];
COUNTER_IN_FLIGHT_OPS_TxAlterKesus = 47 [(CounterOpts) = {Name: "InFlightOps/AlterKesus"}];
- COUNTER_IN_FLIGHT_OPS_TxAlterSubDomain = 48 [(CounterOpts) = {Name: "InFlightOps/AlterSubDomain"}];
- COUNTER_IN_FLIGHT_OPS_TxAlterUserAttributes = 49 [(CounterOpts) = {Name: "InFlightOps/AlterUserAttributes"}];
- COUNTER_USER_ATTRIBUTES_COUNT = 50 [(CounterOpts) = {Name: "UserAttributes"}];
- COUNTER_IN_FLIGHT_OPS_TxCreateTableIndex = 51 [(CounterOpts) = {Name: "InFlightOps/CreateTableIndex"}];
- COUNTER_TABLE_INDEXES_COUNT = 52 [(CounterOpts) = {Name: "TableIndexes"}];
+ COUNTER_IN_FLIGHT_OPS_TxAlterSubDomain = 48 [(CounterOpts) = {Name: "InFlightOps/AlterSubDomain"}];
+ COUNTER_IN_FLIGHT_OPS_TxAlterUserAttributes = 49 [(CounterOpts) = {Name: "InFlightOps/AlterUserAttributes"}];
+ COUNTER_USER_ATTRIBUTES_COUNT = 50 [(CounterOpts) = {Name: "UserAttributes"}];
+ COUNTER_IN_FLIGHT_OPS_TxCreateTableIndex = 51 [(CounterOpts) = {Name: "InFlightOps/CreateTableIndex"}];
+ COUNTER_TABLE_INDEXES_COUNT = 52 [(CounterOpts) = {Name: "TableIndexes"}];
COUNTER_BLOCKSTORE_PARTITION2_SHARD_COUNT = 53 [(CounterOpts) = {Name: "BlockStorePartition2Shards"}];
- COUNTER_IN_FLIGHT_OPS_TxDropTableIndex = 54 [(CounterOpts) = {Name: "InFlightOps/DropTableIndex"}];
-
- COUNTER_EXTSUB_DOMAIN_COUNT = 55 [(CounterOpts) = {Name: "ExernalSubDomains"}];
- COUNTER_IN_FLIGHT_OPS_TxCreateExtSubDomain = 56 [(CounterOpts) = {Name: "InFlightOps/CreateExtSubDomain"}];
- COUNTER_SUB_DOMAIN_SCHEME_SHARD_COUNT = 57 [(CounterOpts) = {Name: "SubDomainsSchemeShards"}];
- COUNTER_IN_FLIGHT_OPS_TxMergeTablePartition = 58 [(CounterOpts) = {Name: "InFlightOps/MergeTablePartition"}];
- COUNTER_IN_FLIGHT_OPS_TxAlterExtSubDomain = 59 [(CounterOpts) = {Name: "InFlightOps/AlterExtSubDomain"}];
- COUNTER_IN_FLIGHT_OPS_TxForceDropExtSubDomain = 60 [(CounterOpts) = {Name: "InFlightOps/ForceDropExtSubDomain"}];
+ COUNTER_IN_FLIGHT_OPS_TxDropTableIndex = 54 [(CounterOpts) = {Name: "InFlightOps/DropTableIndex"}];
+
+ COUNTER_EXTSUB_DOMAIN_COUNT = 55 [(CounterOpts) = {Name: "ExernalSubDomains"}];
+ COUNTER_IN_FLIGHT_OPS_TxCreateExtSubDomain = 56 [(CounterOpts) = {Name: "InFlightOps/CreateExtSubDomain"}];
+ COUNTER_SUB_DOMAIN_SCHEME_SHARD_COUNT = 57 [(CounterOpts) = {Name: "SubDomainsSchemeShards"}];
+ COUNTER_IN_FLIGHT_OPS_TxMergeTablePartition = 58 [(CounterOpts) = {Name: "InFlightOps/MergeTablePartition"}];
+ COUNTER_IN_FLIGHT_OPS_TxAlterExtSubDomain = 59 [(CounterOpts) = {Name: "InFlightOps/AlterExtSubDomain"}];
+ COUNTER_IN_FLIGHT_OPS_TxForceDropExtSubDomain = 60 [(CounterOpts) = {Name: "InFlightOps/ForceDropExtSubDomain"}];
COUNTER_IN_FLIGHT_OPS_TxFillIndex = 61 [(CounterOpts) = {Name: "InFlightOps/FillIndex"}];
- COUNTER_IN_FLIGHT_OPS_TxUpgradeSubDomain = 62 [(CounterOpts) = {Name: "InFlightOps/UpgradeSubDomain"}];
- COUNTER_IN_FLIGHT_OPS_TxUpgradeSubDomainDecision = 63 [(CounterOpts) = {Name: "InFlightOps/UpgradeSubDomainDecision"}];
+ COUNTER_IN_FLIGHT_OPS_TxUpgradeSubDomain = 62 [(CounterOpts) = {Name: "InFlightOps/UpgradeSubDomain"}];
+ COUNTER_IN_FLIGHT_OPS_TxUpgradeSubDomainDecision = 63 [(CounterOpts) = {Name: "InFlightOps/UpgradeSubDomainDecision"}];
COUNTER_SUB_DOMAIN_HIVE_COUNT = 64 [(CounterOpts) = {Name: "SubDomainsHives"}];
- COUNTER_IN_FLIGHT_OPS_TxInitializeBuildIndex = 65 [(CounterOpts) = {Name: "InFlightOps/InitializeBuildIndex"}];
- COUNTER_SNAPSHOTS_COUNT = 66 [(CounterOpts) = {Name: "Snapshots"}];
- COUNTER_LOCKS_COUNT = 67 [(CounterOpts) = {Name: "Locks"}];
- COUNTER_IN_FLIGHT_OPS_TxCreateLockForIndexBuild = 68 [(CounterOpts) = {Name: "InFlightOps/CreateLockForIndexBuild"}];
- COUNTER_IN_FLIGHT_OPS_TxAlterTableIndex = 69 [(CounterOpts) = {Name: "InFlightOps/AlterTableIndex"}];
- COUNTER_IN_FLIGHT_OPS_TxFinalizeBuildIndex = 70 [(CounterOpts) = {Name: "InFlightOps/FinalizeBuildIndex"}];
- COUNTER_IN_FLIGHT_OPS_TxAlterSolomonVolume = 71 [(CounterOpts) = {Name: "InFlightOps/AlterSolomonVolume"}];
- COUNTER_IN_FLIGHT_OPS_TxDropLock = 72 [(CounterOpts) = {Name: "InFlightOps/DropLock"}];
- COUNTER_IN_FLIGHT_OPS_TxDropTableIndexAtMainTable = 73 [(CounterOpts) = {Name: "InFlightOps/DropTableIndexAtMainTable"}];
+ COUNTER_IN_FLIGHT_OPS_TxInitializeBuildIndex = 65 [(CounterOpts) = {Name: "InFlightOps/InitializeBuildIndex"}];
+ COUNTER_SNAPSHOTS_COUNT = 66 [(CounterOpts) = {Name: "Snapshots"}];
+ COUNTER_LOCKS_COUNT = 67 [(CounterOpts) = {Name: "Locks"}];
+ COUNTER_IN_FLIGHT_OPS_TxCreateLockForIndexBuild = 68 [(CounterOpts) = {Name: "InFlightOps/CreateLockForIndexBuild"}];
+ COUNTER_IN_FLIGHT_OPS_TxAlterTableIndex = 69 [(CounterOpts) = {Name: "InFlightOps/AlterTableIndex"}];
+ COUNTER_IN_FLIGHT_OPS_TxFinalizeBuildIndex = 70 [(CounterOpts) = {Name: "InFlightOps/FinalizeBuildIndex"}];
+ COUNTER_IN_FLIGHT_OPS_TxAlterSolomonVolume = 71 [(CounterOpts) = {Name: "InFlightOps/AlterSolomonVolume"}];
+ COUNTER_IN_FLIGHT_OPS_TxDropLock = 72 [(CounterOpts) = {Name: "InFlightOps/DropLock"}];
+ COUNTER_IN_FLIGHT_OPS_TxDropTableIndexAtMainTable = 73 [(CounterOpts) = {Name: "InFlightOps/DropTableIndexAtMainTable"}];
COUNTER_SYS_VIEW_PROCESSOR_COUNT = 74 [(CounterOpts) = {Name: "SysViewProcessors"}];
COUNTER_FILESTORE_COUNT = 75 [(CounterOpts) = {Name: "FileStores"}];
@@ -116,7 +116,7 @@ enum ESimpleCounters {
COUNTER_DISK_SPACE_HARD_QUOTA_BYTES = 96 [(CounterOpts) = {Name: "DiskSpaceHardQuotaBytes"}];
COUNTER_DISK_SPACE_SOFT_QUOTA_BYTES = 97 [(CounterOpts) = {Name: "DiskSpaceSoftQuotaBytes"}];
-
+
COUNTER_IN_FLIGHT_OPS_TxCreateCdcStream = 98 [(CounterOpts) = {Name: "InFlightOps/CreateCdcStream"}];
COUNTER_IN_FLIGHT_OPS_TxCreateCdcStreamAtTable = 99 [(CounterOpts) = {Name: "InFlightOps/CreateCdcStreamAtTable"}];
COUNTER_IN_FLIGHT_OPS_TxAlterCdcStream = 100 [(CounterOpts) = {Name: "InFlightOps/AlterCdcStream"}];
@@ -177,28 +177,28 @@ enum ECumulativeCounters {
COUNTER_FINISHED_OPS_TxCreateKesus = 22 [(CounterOpts) = {Name: "FinishedOps/CreateKesus"}];
COUNTER_FINISHED_OPS_TxDropKesus = 23 [(CounterOpts) = {Name: "FinishedOps/DropKesus"}];
- COUNTER_FINISHED_OPS_TxForceDropSubDomain = 24 [(CounterOpts) = {Name: "FinishedOps/ForceDropSubDomain"}];
- COUNTER_FINISHED_OPS_TxCreateSolomonVolume = 25 [(CounterOpts) = {Name: "FinishedOps/CreateSolomonVolume"}];
- COUNTER_FINISHED_OPS_TxDropSolomonVolume = 26 [(CounterOpts) = {Name: "FinishedOps/DropSolomonVolume"}];
+ COUNTER_FINISHED_OPS_TxForceDropSubDomain = 24 [(CounterOpts) = {Name: "FinishedOps/ForceDropSubDomain"}];
+ COUNTER_FINISHED_OPS_TxCreateSolomonVolume = 25 [(CounterOpts) = {Name: "FinishedOps/CreateSolomonVolume"}];
+ COUNTER_FINISHED_OPS_TxDropSolomonVolume = 26 [(CounterOpts) = {Name: "FinishedOps/DropSolomonVolume"}];
COUNTER_FINISHED_OPS_TxAlterKesus = 27 [(CounterOpts) = {Name: "FinishedOps/AlterKesus"}];
- COUNTER_FINISHED_OPS_TxAlterSubDomain = 28 [(CounterOpts) = {Name: "FinishedOps/AlterSubDomain"}];
- COUNTER_FINISHED_OPS_TxAlterUserAttributes = 29 [(CounterOpts) = {Name: "FinishedOps/AlterUserAttributes"}];
- COUNTER_FINISHED_OPS_TxCreateTableIndex = 30 [(CounterOpts) = {Name: "FinishedOps/CreateTableIndex"}];
- COUNTER_FINISHED_OPS_TxDropTableIndex = 31 [(CounterOpts) = {Name: "FinishedOps/DropTableIndex"}];
- COUNTER_FINISHED_OPS_TxCreateExtSubDomain = 32 [(CounterOpts) = {Name: "FinishedOps/DropExtSubDomain"}];
- COUNTER_FINISHED_OPS_TxMergeTablePartition = 33 [(CounterOpts) = {Name: "FinishedOps/MergeTablePartition"}];
- COUNTER_FINISHED_OPS_TxAlterExtSubDomain = 34 [(CounterOpts) = {Name: "FinishedOps/AlterExtSubDomain"}];
- COUNTER_FINISHED_OPS_TxForceDropExtSubDomain = 35 [(CounterOpts) = {Name: "FinishedOps/ForceDropExtSubDomain"}];
+ COUNTER_FINISHED_OPS_TxAlterSubDomain = 28 [(CounterOpts) = {Name: "FinishedOps/AlterSubDomain"}];
+ COUNTER_FINISHED_OPS_TxAlterUserAttributes = 29 [(CounterOpts) = {Name: "FinishedOps/AlterUserAttributes"}];
+ COUNTER_FINISHED_OPS_TxCreateTableIndex = 30 [(CounterOpts) = {Name: "FinishedOps/CreateTableIndex"}];
+ COUNTER_FINISHED_OPS_TxDropTableIndex = 31 [(CounterOpts) = {Name: "FinishedOps/DropTableIndex"}];
+ COUNTER_FINISHED_OPS_TxCreateExtSubDomain = 32 [(CounterOpts) = {Name: "FinishedOps/DropExtSubDomain"}];
+ COUNTER_FINISHED_OPS_TxMergeTablePartition = 33 [(CounterOpts) = {Name: "FinishedOps/MergeTablePartition"}];
+ COUNTER_FINISHED_OPS_TxAlterExtSubDomain = 34 [(CounterOpts) = {Name: "FinishedOps/AlterExtSubDomain"}];
+ COUNTER_FINISHED_OPS_TxForceDropExtSubDomain = 35 [(CounterOpts) = {Name: "FinishedOps/ForceDropExtSubDomain"}];
COUNTER_FINISHED_OPS_TxFillIndex = 36 [(CounterOpts) = {Name: "FinishedOps/FillIndex"}];
- COUNTER_FINISHED_OPS_TxUpgradeSubDomain = 37 [(CounterOpts) = {Name: "FinishedOps/UpgradeSubDomain"}];
- COUNTER_FINISHED_OPS_TxUpgradeSubDomainDecision = 38 [(CounterOpts) = {Name: "FinishedOps/UpgradeSubDomainDecision"}];
- COUNTER_FINISHED_OPS_TxInitializeBuildIndex = 39 [(CounterOpts) = {Name: "FinishedOps/InitializeBuildIndex"}];
- COUNTER_FINISHED_OPS_TxCreateLockForIndexBuild = 40 [(CounterOpts) = {Name: "FinishedOps/CreateLockForIndexBuild"}];
- COUNTER_FINISHED_OPS_TxAlterTableIndex = 41 [(CounterOpts) = {Name: "FinishedOps/AlterTableIndex"}];
- COUNTER_FINISHED_OPS_TxFinalizeBuildIndex = 42 [(CounterOpts) = {Name: "FinishedOps/FinalizeBuildIndex"}];
- COUNTER_FINISHED_OPS_TxAlterSolomonVolume = 43 [(CounterOpts) = {Name: "FinishedOps/AlterSolomonVolume"}];
- COUNTER_FINISHED_OPS_TxDropLock = 44 [(CounterOpts) = {Name: "FinishedOps/DropLock"}];
- COUNTER_FINISHED_OPS_TxDropTableIndexAtMainTable = 45 [(CounterOpts) = {Name: "FinishedOps/DropTableIndexAtMainTable"}];
+ COUNTER_FINISHED_OPS_TxUpgradeSubDomain = 37 [(CounterOpts) = {Name: "FinishedOps/UpgradeSubDomain"}];
+ COUNTER_FINISHED_OPS_TxUpgradeSubDomainDecision = 38 [(CounterOpts) = {Name: "FinishedOps/UpgradeSubDomainDecision"}];
+ COUNTER_FINISHED_OPS_TxInitializeBuildIndex = 39 [(CounterOpts) = {Name: "FinishedOps/InitializeBuildIndex"}];
+ COUNTER_FINISHED_OPS_TxCreateLockForIndexBuild = 40 [(CounterOpts) = {Name: "FinishedOps/CreateLockForIndexBuild"}];
+ COUNTER_FINISHED_OPS_TxAlterTableIndex = 41 [(CounterOpts) = {Name: "FinishedOps/AlterTableIndex"}];
+ COUNTER_FINISHED_OPS_TxFinalizeBuildIndex = 42 [(CounterOpts) = {Name: "FinishedOps/FinalizeBuildIndex"}];
+ COUNTER_FINISHED_OPS_TxAlterSolomonVolume = 43 [(CounterOpts) = {Name: "FinishedOps/AlterSolomonVolume"}];
+ COUNTER_FINISHED_OPS_TxDropLock = 44 [(CounterOpts) = {Name: "FinishedOps/DropLock"}];
+ COUNTER_FINISHED_OPS_TxDropTableIndexAtMainTable = 45 [(CounterOpts) = {Name: "FinishedOps/DropTableIndexAtMainTable"}];
COUNTER_FINISHED_OPS_TxCreateFileStore = 46 [(CounterOpts) = {Name: "FinishedOps/CreateFileStore"}];
COUNTER_FINISHED_OPS_TxAlterFileStore = 47 [(CounterOpts) = {Name: "FinishedOps/AlterFileStore"}];
@@ -213,16 +213,16 @@ enum ECumulativeCounters {
COUNTER_FINISHED_OPS_TxAlterOlapTable = 54 [(CounterOpts) = {Name: "FinishedOps/AlterOlapTable"}];
COUNTER_FINISHED_OPS_TxDropOlapTable = 55 [(CounterOpts) = {Name: "FinishedOps/DropOlapTable"}];
-
+
COUNTER_FINISHED_OPS_TxCreateCdcStream = 56 [(CounterOpts) = {Name: "FinishedOps/CreateCdcStream"}];
COUNTER_FINISHED_OPS_TxCreateCdcStreamAtTable = 57 [(CounterOpts) = {Name: "FinishedOps/CreateCdcStreamAtTable"}];
COUNTER_FINISHED_OPS_TxAlterCdcStream = 58 [(CounterOpts) = {Name: "FinishedOps/AlterCdcStream"}];
COUNTER_FINISHED_OPS_TxAlterCdcStreamAtTable = 59 [(CounterOpts) = {Name: "FinishedOps/AlterCdcStreamAtTable"}];
COUNTER_FINISHED_OPS_TxDropCdcStream = 60 [(CounterOpts) = {Name: "FinishedOps/DropCdcStream"}];
COUNTER_FINISHED_OPS_TxDropCdcStreamAtTable = 61 [(CounterOpts) = {Name: "FinishedOps/DropCdcStreamAtTable"}];
-
- COUNTER_FINISHED_OPS_TxMoveTable = 62 [(CounterOpts) = {Name: "FinishedOps/MoveTable"}];
- COUNTER_FINISHED_OPS_TxMoveTableIndex = 63 [(CounterOpts) = {Name: "FinishedOps/MoveTableIndex"}];
+
+ COUNTER_FINISHED_OPS_TxMoveTable = 62 [(CounterOpts) = {Name: "FinishedOps/MoveTable"}];
+ COUNTER_FINISHED_OPS_TxMoveTableIndex = 63 [(CounterOpts) = {Name: "FinishedOps/MoveTableIndex"}];
COUNTER_FINISHED_OPS_TxCreateSequence = 64 [(CounterOpts) = {Name: "FinishedOps/CreateSequence"}];
COUNTER_FINISHED_OPS_TxAlterSequence = 65 [(CounterOpts) = {Name: "FinishedOps/AlterSequence"}];
@@ -280,26 +280,26 @@ enum ETxTypes {
TXTYPE_INIT = 0 [(TxTypeOpts) = {Name: "TxInit"}];
TXTYPE_INIT_ROOT = 1 [(TxTypeOpts) = {Name: "TxInitRoot"}];
TXTYPE_PLAN_STEP = 2 [(TxTypeOpts) = {Name: "TxPlanStep"}];
- TXTYPE_DESCRIBE_SCHEME = 3 [(TxTypeOpts) = {Name: "TxDescribeScheme"}];
- TXTYPE_DATASHARD_PROPOSE_RESULT = 4 [(TxTypeOpts) = {Name: "TxDataShardProposeResult"}];
- TXTYPE_CREATE_TABLET_REPLY = 5 [(TxTypeOpts) = {Name: "TxCreateTabletReply"}];
- TXTYPE_PROGRESS_OP = 6 [(TxTypeOpts) = {Name: "TxProgressOp"}];
- TXTYPE_PERSQUEUE_CONFIG_RESULT = 7 [(TxTypeOpts) = {Name: "TxPersQueueConfigResult"}];
- TXTYPE_DROP_TABLET_RESULT = 8 [(TxTypeOpts) = {Name: "TxDropTabletResult"}];
- TXTYPE_FREE_TABLET_RESULT = 9 [(TxTypeOpts) = {Name: "TxFreeTabletResult"}];
- TXTYPE_DATASHARD_STATE_RESULT = 10 [(TxTypeOpts) = {Name: "TxDataShardStateResult"}];
- TXTYPE_INIT_SPLIT_DST_ACK = 11 [(TxTypeOpts) = {Name: "TxInitSplitDstAck"}];
- TXTYPE_SPLIT_ACK = 12 [(TxTypeOpts) = {Name: "TxSplitAck"}];
- TXTYPE_SPLIT_PARTITIONING_CHANGED_DST_ACK = 13 [(TxTypeOpts) = {Name: "TxSplitPartitioningChangedAck"}];
+ TXTYPE_DESCRIBE_SCHEME = 3 [(TxTypeOpts) = {Name: "TxDescribeScheme"}];
+ TXTYPE_DATASHARD_PROPOSE_RESULT = 4 [(TxTypeOpts) = {Name: "TxDataShardProposeResult"}];
+ TXTYPE_CREATE_TABLET_REPLY = 5 [(TxTypeOpts) = {Name: "TxCreateTabletReply"}];
+ TXTYPE_PROGRESS_OP = 6 [(TxTypeOpts) = {Name: "TxProgressOp"}];
+ TXTYPE_PERSQUEUE_CONFIG_RESULT = 7 [(TxTypeOpts) = {Name: "TxPersQueueConfigResult"}];
+ TXTYPE_DROP_TABLET_RESULT = 8 [(TxTypeOpts) = {Name: "TxDropTabletResult"}];
+ TXTYPE_FREE_TABLET_RESULT = 9 [(TxTypeOpts) = {Name: "TxFreeTabletResult"}];
+ TXTYPE_DATASHARD_STATE_RESULT = 10 [(TxTypeOpts) = {Name: "TxDataShardStateResult"}];
+ TXTYPE_INIT_SPLIT_DST_ACK = 11 [(TxTypeOpts) = {Name: "TxInitSplitDstAck"}];
+ TXTYPE_SPLIT_ACK = 12 [(TxTypeOpts) = {Name: "TxSplitAck"}];
+ TXTYPE_SPLIT_PARTITIONING_CHANGED_DST_ACK = 13 [(TxTypeOpts) = {Name: "TxSplitPartitioningChangedAck"}];
TXTYPE_CANCEL_BACKUP_IMPL = 14 [(TxTypeOpts) = {Name: "TxCancelBackupImpl"}];
- TXTYPE_MONITORING = 15 [(TxTypeOpts) = {Name: "TxMonitoring"}];
- TXTYPE_SUBDOMAIN_CONFIGURE_RESULT = 16 [(TxTypeOpts) = {Name: "TTxSubDomainConfigureStatus"}];
- TXTYPE_BLOCKSTORE_CONFIG_RESULT = 17 [(TxTypeOpts) = {Name: "TTxBlockStoreConfigResult"}];
- TXTYPE_KESUS_CONFIG_RESULT = 18 [(TxTypeOpts) = {Name: "TTxKesusConfigResult"}];
- TXTYPE_PROPOSE = 19 [(TxTypeOpts) = {Name: "TTxOperationPropose"}];
- TXTYPE_DATASHARD_SCHEMA_CHANGED = 20 [(TxTypeOpts) = {Name: "TxDataShardSchemaChanged"}];
+ TXTYPE_MONITORING = 15 [(TxTypeOpts) = {Name: "TxMonitoring"}];
+ TXTYPE_SUBDOMAIN_CONFIGURE_RESULT = 16 [(TxTypeOpts) = {Name: "TTxSubDomainConfigureStatus"}];
+ TXTYPE_BLOCKSTORE_CONFIG_RESULT = 17 [(TxTypeOpts) = {Name: "TTxBlockStoreConfigResult"}];
+ TXTYPE_KESUS_CONFIG_RESULT = 18 [(TxTypeOpts) = {Name: "TTxKesusConfigResult"}];
+ TXTYPE_PROPOSE = 19 [(TxTypeOpts) = {Name: "TTxOperationPropose"}];
+ TXTYPE_DATASHARD_SCHEMA_CHANGED = 20 [(TxTypeOpts) = {Name: "TxDataShardSchemaChanged"}];
TXTYPE_DEFERRED_UPDATE_ON_SCHEME_BOARD = 21 [(TxTypeOpts) = {Name: "TxDeferredUpdateOnSchemeBoard"}];
- TXTYPE_CLEAN_TABLES = 22 [(TxTypeOpts) = {Name: "TxCleanTables"}];
+ TXTYPE_CLEAN_TABLES = 22 [(TxTypeOpts) = {Name: "TxCleanTables"}];
TXTYPE_CREATE_EXPORT = 23 [(TxTypeOpts) = {Name: "TxCreateExport"}];
TXTYPE_GET_EXPORT = 24 [(TxTypeOpts) = {Name: "TxGetExport"}];
@@ -308,21 +308,21 @@ enum ETxTypes {
TXTYPE_FORGET_EXPORT = 27 [(TxTypeOpts) = {Name: "TxForgetExport"}];
TXTYPE_LIST_EXPORTS = 28 [(TxTypeOpts) = {Name: "TxListExports"}];
TXTYPE_EXPORT_PROGRESS = 29 [(TxTypeOpts) = {Name: "TxExportProgress"}];
-
- TXTYPE_SYNC_TENANT = 30 [(TxTypeOpts) = {Name: "TxSyncTenant"}];
- TXTYPE_UPDATE_TENANT = 31 [(TxTypeOpts) = {Name: "TxUpdateTenant"}];
- TXTYPE_FREE_OWNER_TABLETS_RESULT = 32 [(TxTypeOpts) = {Name: "TxFreeOwnerTabletsResult"}];
- TXTYPE_SUBDOMAIN_MIGRATE_RESULT = 33 [(TxTypeOpts) = {Name: "TTxSubDomainMigrateResult"}];
- TXTYPE_SUBDOMAIN_MIGRATE = 34 [(TxTypeOpts) = {Name: "TTxSubDomainMigrate"}];
- TXTYPE_UPGRADE_SCHEME = 35 [(TxTypeOpts) = {Name: "TTxUpgradeScheme"}];
- TXTYPE_INIT_POPULATOR = 36 [(TxTypeOpts) = {Name: "TTxInitPopulator"}];
-
- TXTYPE_CREATE_INDEX_BUILD = 37 [(TxTypeOpts) = {Name: "TxCreateIndexBuild"}];
- TXTYPE_GET_INDEX_BUILD = 38 [(TxTypeOpts) = {Name: "TxGetIndexBuild"}];
- TXTYPE_CANCEL_INDEX_BUILD = 39 [(TxTypeOpts) = {Name: "TxCancelIndexBuild"}];
- TXTYPE_FORGET_INDEX_BUILD = 40 [(TxTypeOpts) = {Name: "TxForgetIndexBuild"}];
- TXTYPE_LIST_INDEX_BUILD = 41 [(TxTypeOpts) = {Name: "TxListIndexBuild"}];
- TXTYPE_PROGRESS_INDEX_BUILD = 42 [(TxTypeOpts) = {Name: "TxProgressIndexBuild"}];
+
+ TXTYPE_SYNC_TENANT = 30 [(TxTypeOpts) = {Name: "TxSyncTenant"}];
+ TXTYPE_UPDATE_TENANT = 31 [(TxTypeOpts) = {Name: "TxUpdateTenant"}];
+ TXTYPE_FREE_OWNER_TABLETS_RESULT = 32 [(TxTypeOpts) = {Name: "TxFreeOwnerTabletsResult"}];
+ TXTYPE_SUBDOMAIN_MIGRATE_RESULT = 33 [(TxTypeOpts) = {Name: "TTxSubDomainMigrateResult"}];
+ TXTYPE_SUBDOMAIN_MIGRATE = 34 [(TxTypeOpts) = {Name: "TTxSubDomainMigrate"}];
+ TXTYPE_UPGRADE_SCHEME = 35 [(TxTypeOpts) = {Name: "TTxUpgradeScheme"}];
+ TXTYPE_INIT_POPULATOR = 36 [(TxTypeOpts) = {Name: "TTxInitPopulator"}];
+
+ TXTYPE_CREATE_INDEX_BUILD = 37 [(TxTypeOpts) = {Name: "TxCreateIndexBuild"}];
+ TXTYPE_GET_INDEX_BUILD = 38 [(TxTypeOpts) = {Name: "TxGetIndexBuild"}];
+ TXTYPE_CANCEL_INDEX_BUILD = 39 [(TxTypeOpts) = {Name: "TxCancelIndexBuild"}];
+ TXTYPE_FORGET_INDEX_BUILD = 40 [(TxTypeOpts) = {Name: "TxForgetIndexBuild"}];
+ TXTYPE_LIST_INDEX_BUILD = 41 [(TxTypeOpts) = {Name: "TxListIndexBuild"}];
+ TXTYPE_PROGRESS_INDEX_BUILD = 42 [(TxTypeOpts) = {Name: "TxProgressIndexBuild"}];
TXTYPE_SCHEDULE_CONDITIONAL_ERASE = 43 [(TxTypeOpts) = {Name: "TxScheduleConditionalErase"}];
TXTYPE_RUN_CONDITIONAL_ERASE = 44 [(TxTypeOpts) = {Name: "TxRunConditionalErase"}];
@@ -330,8 +330,8 @@ enum ETxTypes {
TXTYPE_STORE_PARTITION_STATS = 45 [(TxTypeOpts) = {Name: "TxStorePartitionStats"}];
TXTYPE_FILESTORE_CONFIG_RESULT = 46 [(TxTypeOpts) = {Name: "TxFileStoreConfigResult"}];
-
- TXTYPE_MAKEBILL_INDEX_BUILD = 47 [(TxTypeOpts) = {Name: "TxBillingIndexBuild"}];
+
+ TXTYPE_MAKEBILL_INDEX_BUILD = 47 [(TxTypeOpts) = {Name: "TxBillingIndexBuild"}];
TXTYPE_CREATE_IMPORT = 48 [(TxTypeOpts) = {Name: "TxCreateImport"}];
TXTYPE_GET_IMPORT = 49 [(TxTypeOpts) = {Name: "TxGetImport"}];
@@ -340,7 +340,7 @@ enum ETxTypes {
TXTYPE_FORGET_IMPORT = 52 [(TxTypeOpts) = {Name: "TxForgetImport"}];
TXTYPE_LIST_IMPORTS = 53 [(TxTypeOpts) = {Name: "TxListImports"}];
TXTYPE_IMPORT_PROGRESS = 54 [(TxTypeOpts) = {Name: "TxImportProgress"}];
- TXTYPE_SERVERLESS_STORAGE_BILLING = 55 [(TxTypeOpts) = {Name: "TxServerlessStorageBilling"}];
+ TXTYPE_SERVERLESS_STORAGE_BILLING = 55 [(TxTypeOpts) = {Name: "TxServerlessStorageBilling"}];
TXTYPE_OLAPSHARD_PROPOSE_RESULT = 56 [(TxTypeOpts) = {Name: "TxOlapShardProposeResult"}];
TXTYPE_COLUMNSHARD_PROPOSE_RESULT = 57 [(TxTypeOpts) = {Name: "TxColumnShardProposeResult"}];
TXTYPE_OLAPSHARD_NOTIFY_TX_COMPLETION_RESULT = 58 [(TxTypeOpts) = {Name: "TxOlapShardNotifyTxCompletionResult"}];
@@ -360,11 +360,11 @@ enum ETxTypes {
TXTYPE_SEQUENCESHARD_FREEZE_SEQUENCE_RESULT = 68 [(TxTypeOpts) = {Name: "TxSequenceShardFreezeSequenceResult"}];
TXTYPE_SEQUENCESHARD_RESTORE_SEQUENCE_RESULT = 69 [(TxTypeOpts) = {Name: "TxSequenceShardRestoreSequenceResult"}];
TXTYPE_SEQUENCESHARD_REDIRECT_SEQUENCE_RESULT = 70 [(TxTypeOpts) = {Name: "TxSequenceShardRedirectSequenceResult"}];
-
- TXTYPE_NOTIFY_OPERATION_COMPLETE_PUBLICATION = 71 [(TxTypeOpts) = {Name: "TxNotifyOperationCompletePublication"}];
- TXTYPE_NOTIFY_OPERATION_COMPLETE_BARRIER = 72 [(TxTypeOpts) = {Name: "TxNotifyOperationCompleteBarrier"}];
-
- TXTYPE_PARTITION_HISTOGRAM = 73 [(TxTypeOpts) = {Name: "TxPartitionHistogram"}];
+
+ TXTYPE_NOTIFY_OPERATION_COMPLETE_PUBLICATION = 71 [(TxTypeOpts) = {Name: "TxNotifyOperationCompletePublication"}];
+ TXTYPE_NOTIFY_OPERATION_COMPLETE_BARRIER = 72 [(TxTypeOpts) = {Name: "TxNotifyOperationCompleteBarrier"}];
+
+ TXTYPE_PARTITION_HISTOGRAM = 73 [(TxTypeOpts) = {Name: "TxPartitionHistogram"}];
TXTYPE_CREATE_REPLICATION_RESULT = 74 [(TxTypeOpts) = {Name: "TxCreateReplicationResult"}];
TXTYPE_ALTER_REPLICATION_RESULT = 75 [(TxTypeOpts) = {Name: "TxAlterReplicationResult"}];
diff --git a/ydb/core/protos/counters_tx_allocator.proto b/ydb/core/protos/counters_tx_allocator.proto
index e10fe38c4de..b5c4bb9f915 100644
--- a/ydb/core/protos/counters_tx_allocator.proto
+++ b/ydb/core/protos/counters_tx_allocator.proto
@@ -1,29 +1,29 @@
import "ydb/core/protos/counters.proto";
-
-package NKikimr.NTxAllocator;
-
-option java_package = "ru.yandex.kikimr.proto";
-
-option (TabletTypeName) = "TxAllocator"; // Used as prefix for all counters
-
-enum ESimpleCounters {
+
+package NKikimr.NTxAllocator;
+
+option java_package = "ru.yandex.kikimr.proto";
+
+option (TabletTypeName) = "TxAllocator"; // Used as prefix for all counters
+
+enum ESimpleCounters {
COUNTER_SIMPLE_IGNORE = 0;
-}
-
-enum ECumulativeCounters {
+}
+
+enum ECumulativeCounters {
COUNTER_CUMULATIVE_IGNORE = 0;
-}
-
-enum EPercentileCounters {
- option (GlobalCounterOpts) = {
- Ranges { Value: 0 Name: "0 ms" }
- Ranges { Value: 1 Name: "1 ms" }
- };
-
+}
+
+enum EPercentileCounters {
+ option (GlobalCounterOpts) = {
+ Ranges { Value: 0 Name: "0 ms" }
+ Ranges { Value: 1 Name: "1 ms" }
+ };
+
COUNTER_PERCENTILE_IGNORE = 0;
-}
-
-enum ETxTypes {
- TXTYPE_INIT = 0 [(TxTypeOpts) = {Name: "TxInit"}];
- TXTYPE_RESERVE = 1 [(TxTypeOpts) = {Name: "TxReserve"}];
-}
+}
+
+enum ETxTypes {
+ TXTYPE_INIT = 0 [(TxTypeOpts) = {Name: "TxInit"}];
+ TXTYPE_RESERVE = 1 [(TxTypeOpts) = {Name: "TxReserve"}];
+}
diff --git a/ydb/core/protos/flat_scheme_op.proto b/ydb/core/protos/flat_scheme_op.proto
index ae908f01a4a..33e598c1c25 100644
--- a/ydb/core/protos/flat_scheme_op.proto
+++ b/ydb/core/protos/flat_scheme_op.proto
@@ -13,8 +13,8 @@ import "ydb/public/api/protos/ydb_coordination.proto";
import "ydb/public/api/protos/ydb_export.proto";
import "ydb/library/mkql_proto/protos/minikql.proto";
-
-package NKikimrSchemeOp;
+
+package NKikimrSchemeOp;
option java_package = "ru.yandex.kikimr.proto";
message TMkDir {
@@ -23,7 +23,7 @@ message TMkDir {
enum EDropWaitPolicy {
EDropFailOnChanges = 0;
- EDropAbortChanges = 1; //depricated
+ EDropAbortChanges = 1; //depricated
EDropWaitChanges = 2;
}
@@ -93,8 +93,8 @@ message TStorageConfig {
optional TStorageSettings Log = 2;
optional TStorageSettings Data = 3;
optional TStorageSettings External = 4;
- optional uint32 DataThreshold = 5;
- optional uint32 ExternalThreshold = 6;
+ optional uint32 DataThreshold = 5;
+ optional uint32 ExternalThreshold = 6;
}
message TFamilyDescription {
@@ -105,7 +105,7 @@ message TFamilyDescription {
optional string Name = 5;
optional EColumnCodec ColumnCodec = 6;
optional EColumnCache ColumnCache = 7;
- optional EColumnStorage Storage = 8; // DEPRECATED: use StorageConfig
+ optional EColumnStorage Storage = 8; // DEPRECATED: use StorageConfig
optional TStorageConfig StorageConfig = 9;
}
@@ -264,7 +264,7 @@ message TPartitionConfig {
optional bool DisableStatisticsCalculation = 14; // KIKIMR-3861 hotfix
optional bool EnableFilterByKey = 15 [default = false]; // Build and use per-part bloom filter for fast key non-existence check
optional bool ExecutorFastLogPolicy = 16 [default = true]; // Commit log faster at the expense of bandwidth for cross-DC
- repeated NKikimrStorageSettings.TStorageRoom StorageRooms = 17;
+ repeated NKikimrStorageSettings.TStorageRoom StorageRooms = 17;
optional bool EnableEraseCache = 18 [default = true]; // Use erase cache for faster iteration over erased rows
optional uint32 EraseCacheMinRows = 19; // Minimum number of erased rows worth caching (default 16)
optional uint32 EraseCacheMaxBytes = 20; // Maximum number of bytes to use for cached rows (default 1MB)
@@ -321,7 +321,7 @@ message TTTLSettings {
message TTableDescription {
optional string Name = 1;
- optional uint64 Id_Deprecated = 2; // LocalPathId, deprecated
+ optional uint64 Id_Deprecated = 2; // LocalPathId, deprecated
repeated TColumnDescription Columns = 3;
repeated string KeyColumnNames = 4;
repeated uint32 KeyColumnIds = 5;
@@ -332,7 +332,7 @@ message TTableDescription {
repeated TColumnDescription DropColumns = 8;
optional string Path = 9;
- // It shouldn't be there
+ // It shouldn't be there
optional bytes PartitionRangeBegin = 20;
optional bytes PartitionRangeEnd = 21;
optional bool PartitionRangeBeginIsInclusive = 22;
@@ -340,11 +340,11 @@ message TTableDescription {
optional string CopyFromTable = 30;
repeated TSplitBoundary SplitBoundary = 31; // Boundaries for non-uniform split
-
- repeated TIndexDescription TableIndexes = 32;
+
+ repeated TIndexDescription TableIndexes = 32;
optional uint64 TableSchemaVersion = 33;
-
+
optional NKikimrProto.TPathID PathId = 34; // TPathId, owerride Id = 2
optional TTTLSettings TTLSettings = 35;
@@ -740,27 +740,27 @@ message TDropCdcStream {
optional string StreamName = 2;
}
-enum EIndexType {
- EIndexTypeInvalid = 0;
- EIndexTypeGlobal = 1;
+enum EIndexType {
+ EIndexTypeInvalid = 0;
+ EIndexTypeGlobal = 1;
EIndexTypeGlobalAsync = 2;
-}
-
-enum EIndexState {
- EIndexStateInvalid = 0;
- EIndexStateReady = 1;
+}
+
+enum EIndexState {
+ EIndexStateInvalid = 0;
+ EIndexStateReady = 1;
EIndexStateNotReady = 2;
EIndexStateWriteOnly = 3;
-}
-
-message TIndexDescription {
- optional string Name = 1;
+}
+
+message TIndexDescription {
+ optional string Name = 1;
optional uint64 LocalPathId = 2;
-
- optional EIndexType Type = 3;
- optional EIndexState State = 4;
-
- repeated string KeyColumnNames = 5;
+
+ optional EIndexType Type = 3;
+ optional EIndexState State = 4;
+
+ repeated string KeyColumnNames = 5;
optional uint64 SchemaVersion = 6; // Schema version of abstract index (not impl table)
@@ -769,51 +769,51 @@ message TIndexDescription {
repeated string DataColumnNames = 8;
// DataSize + IndexSize of indexImplTable
optional uint64 DataSize = 9;
-}
-
-message TIndexCreationConfig {
- optional string Name = 1;
- repeated string KeyColumnNames = 2;
- optional EIndexType Type = 3;
+}
+
+message TIndexCreationConfig {
+ optional string Name = 1;
+ repeated string KeyColumnNames = 2;
+ optional EIndexType Type = 3;
optional TTableDescription IndexImplTableDescription = 4; //description for index impl table
optional EIndexState State = 5; //state of index at the creation time
repeated string DataColumnNames = 6; //columns to be denormalized to read data just from index
-}
-
-message TIndexAlteringConfig {
- optional string Name = 1;
- optional EIndexState State = 2;
-}
-
-message TIndexedTableCreationConfig {
- optional TTableDescription TableDescription = 1;
- repeated TIndexCreationConfig IndexDescription = 2;
+}
+
+message TIndexAlteringConfig {
+ optional string Name = 1;
+ optional EIndexState State = 2;
+}
+
+message TIndexedTableCreationConfig {
+ optional TTableDescription TableDescription = 1;
+ repeated TIndexCreationConfig IndexDescription = 2;
repeated TSequenceDescription SequenceDescription = 3;
-}
-
-message TInitiateBuildIndexMainTable {
- optional string TableName = 1;
-}
-
-message TFinalizeBuildIndexMainTable {
- optional string TableName = 1;
- optional uint64 SnapshotTxId = 2;
- optional uint64 BuildIndexId = 3;
-}
-
-message TCopyTableConfig { //TTableDescription implemets copying a table in original and full way
- optional string SrcPath = 1;
- optional string DstPath = 2;
-
- optional bool OmitIndexes = 3 [default = false];
+}
+
+message TInitiateBuildIndexMainTable {
+ optional string TableName = 1;
+}
+
+message TFinalizeBuildIndexMainTable {
+ optional string TableName = 1;
+ optional uint64 SnapshotTxId = 2;
+ optional uint64 BuildIndexId = 3;
+}
+
+message TCopyTableConfig { //TTableDescription implemets copying a table in original and full way
+ optional string SrcPath = 1;
+ optional string DstPath = 2;
+
+ optional bool OmitIndexes = 3 [default = false];
optional bool OmitFollowers = 4 [default = false];
optional bool IsBackup = 5 [default = false];
}
-message TConsistentTableCopyingConfig {
- repeated TCopyTableConfig CopyTableDescriptions = 1;
-}
-
+message TConsistentTableCopyingConfig {
+ repeated TCopyTableConfig CopyTableDescriptions = 1;
+}
+
message TYTSettings {
optional string Host = 1;
optional string TablePattern = 2;
@@ -964,44 +964,44 @@ message TKesusDescription {
optional uint64 Version = 5; // do not set
}
-message TSolomonVolumeDescription {
- message TPartition {
- optional uint64 PartitionId = 1;
- optional uint64 TabletId = 2;
- optional uint64 ShardIdx = 3;
+message TSolomonVolumeDescription {
+ message TPartition {
+ optional uint64 PartitionId = 1;
+ optional uint64 TabletId = 2;
+ optional uint64 ShardIdx = 3;
repeated NKikimrStoragePool.TChannelBind BoundChannels = 4;
- }
-
- optional string Name = 1; // mandatory
- optional uint64 PathId = 2;
- optional uint64 PartitionCount = 3;
- repeated TPartition Partitions = 4;
-}
-
-message TCreateSolomonVolume {
- message TAdoptedPartition {
- optional uint64 OwnerId = 1;
- optional uint64 ShardIdx = 2;
- optional uint64 TabletId = 3;
- }
-
- optional string Name = 1; // mandatory
- optional uint32 ChannelProfileId = 2;
-
- optional uint64 PartitionCount = 3; // it is a mutually exclusive parametr
- repeated TAdoptedPartition AdoptedPartitions = 4; // with this one
-}
-
-message TAlterSolomonVolume {
- optional string Name = 1; // mandatory
-
- optional uint32 ChannelProfileId = 2;
-
- optional uint64 PartitionCount = 3;
+ }
+
+ optional string Name = 1; // mandatory
+ optional uint64 PathId = 2;
+ optional uint64 PartitionCount = 3;
+ repeated TPartition Partitions = 4;
+}
+
+message TCreateSolomonVolume {
+ message TAdoptedPartition {
+ optional uint64 OwnerId = 1;
+ optional uint64 ShardIdx = 2;
+ optional uint64 TabletId = 3;
+ }
+
+ optional string Name = 1; // mandatory
+ optional uint32 ChannelProfileId = 2;
+
+ optional uint64 PartitionCount = 3; // it is a mutually exclusive parametr
+ repeated TAdoptedPartition AdoptedPartitions = 4; // with this one
+}
+
+message TAlterSolomonVolume {
+ optional string Name = 1; // mandatory
+
+ optional uint32 ChannelProfileId = 2;
+
+ optional uint64 PartitionCount = 3;
optional bool UpdateChannelsBinding = 4 [default = false];
-}
-
+}
+
message TBlockStoreAssignOp {
optional string Name = 1; // mandatory
optional string NewMountToken = 2; // unset to unassign
@@ -1017,28 +1017,28 @@ message TModifyACL {
message TSplitMergeTablePartitions {
optional uint64 TxId = 1;
optional string TablePath = 2;
- optional uint64 TableLocalId = 3;
+ optional uint64 TableLocalId = 3;
repeated uint64 SourceTabletId = 4;
repeated TSplitBoundary SplitBoundary = 5; // Points of split (there will be N+1 parts)
optional uint64 SchemeshardId = 6; // Only needed if TableId is used instead of path
- optional uint64 TableOwnerId = 7;
-}
-
-message TUserAttribute {
- optional string Key = 1;
- optional string Value = 2;
-}
-
-message TAlterUserAttributes {
- optional string PathName = 1;
- repeated TUserAttribute UserAttributes = 2;
-}
-
-message TMove { // private description of the operation
- optional string SrcPath = 1;
- optional string DstPath = 2;
-}
-
+ optional uint64 TableOwnerId = 7;
+}
+
+message TUserAttribute {
+ optional string Key = 1;
+ optional string Value = 2;
+}
+
+message TAlterUserAttributes {
+ optional string PathName = 1;
+ repeated TUserAttribute UserAttributes = 2;
+}
+
+message TMove { // private description of the operation
+ optional string SrcPath = 1;
+ optional string DstPath = 2;
+}
+
message TSequenceDescription {
optional string Name = 1; // mandatory
optional NKikimrProto.TPathID PathId = 2; // sequence path id, assigned by schemeshard
@@ -1078,8 +1078,8 @@ enum EOperationType {
ESchemeOpRmDir = 9;
ESchemeOpSplitMergeTablePartitions = 10;
ESchemeOpBackup = 11;
- ESchemeOpCreateSubDomain = 12;
- ESchemeOpDropSubDomain = 13;
+ ESchemeOpCreateSubDomain = 12;
+ ESchemeOpDropSubDomain = 13;
ESchemeOpCreateRtmrVolume = 14;
ESchemeOpCreateBlockStoreVolume = 15;
ESchemeOpAlterBlockStoreVolume = 16;
@@ -1087,49 +1087,49 @@ enum EOperationType {
ESchemeOpDropBlockStoreVolume = 18;
ESchemeOpCreateKesus = 19;
ESchemeOpDropKesus = 20;
- ESchemeOpForceDropSubDomain = 21;
- ESchemeOpCreateSolomonVolume = 22;
- ESchemeOpDropSolomonVolume = 23;
+ ESchemeOpForceDropSubDomain = 21;
+ ESchemeOpCreateSolomonVolume = 22;
+ ESchemeOpDropSolomonVolume = 23;
ESchemeOpAlterKesus = 24;
- ESchemeOpAlterSubDomain = 25;
- ESchemeOpAlterUserAttributes = 26;
-
- // *************
- // Unsafe operation. Nornally it is used for deleting database. It called by CMS, and CMS takes care of remaining resourses.
- // If you apply it manually to an ordinary path in cases of emergenses, be aware of:
- // 1 -- data transactions are ignored. Distributed transactions colud be broken so progress on another shards would be blocked forever
- // 2 -- boorowed/loans blobs could be lost forever.
- //
- ESchemeOpForceDropUnsafe = 27;
- //
- // *************
-
- ESchemeOpCreateIndexedTable = 28;
- ESchemeOpCreateTableIndex = 29;
- ESchemeOpCreateConsistentCopyTables = 30;
- ESchemeOpDropTableIndex = 31;
- ESchemeOpCreateExtSubDomain = 32;
- ESchemeOpAlterExtSubDomain = 33;
- ESchemeOpForceDropExtSubDomain = 34;
- ESchemeOp_DEPRECATED_35 = 35;
- ESchemeOpUpgradeSubDomain = 36;
- ESchemeOpUpgradeSubDomainDecision = 37;
- ESchemeOpCreateIndexBuild = 38;
- ESchemeOpInitiateBuildIndexMainTable = 39;
- ESchemeOpCreateLockForIndexBuild = 40;
- ESchemeOpApplyIndexBuild = 41;
- ESchemeOpFinalizeBuildIndexMainTable = 42;
- ESchemeOpAlterTableIndex = 43;
- ESchemeOpAlterSolomonVolume = 44;
- ESchemeOpDropLock = 45;
-
- ESchemeOpFinalizeBuildIndexImplTable = 46;
- ESchemeOpInitiateBuildIndexImplTable = 47;
-
- ESchemeOpDropIndex = 48;
- ESchemeOpDropTableIndexAtMainTable = 49;
-
- ESchemeOpCancelIndexBuild = 50;
+ ESchemeOpAlterSubDomain = 25;
+ ESchemeOpAlterUserAttributes = 26;
+
+ // *************
+ // Unsafe operation. Nornally it is used for deleting database. It called by CMS, and CMS takes care of remaining resourses.
+ // If you apply it manually to an ordinary path in cases of emergenses, be aware of:
+ // 1 -- data transactions are ignored. Distributed transactions colud be broken so progress on another shards would be blocked forever
+ // 2 -- boorowed/loans blobs could be lost forever.
+ //
+ ESchemeOpForceDropUnsafe = 27;
+ //
+ // *************
+
+ ESchemeOpCreateIndexedTable = 28;
+ ESchemeOpCreateTableIndex = 29;
+ ESchemeOpCreateConsistentCopyTables = 30;
+ ESchemeOpDropTableIndex = 31;
+ ESchemeOpCreateExtSubDomain = 32;
+ ESchemeOpAlterExtSubDomain = 33;
+ ESchemeOpForceDropExtSubDomain = 34;
+ ESchemeOp_DEPRECATED_35 = 35;
+ ESchemeOpUpgradeSubDomain = 36;
+ ESchemeOpUpgradeSubDomainDecision = 37;
+ ESchemeOpCreateIndexBuild = 38;
+ ESchemeOpInitiateBuildIndexMainTable = 39;
+ ESchemeOpCreateLockForIndexBuild = 40;
+ ESchemeOpApplyIndexBuild = 41;
+ ESchemeOpFinalizeBuildIndexMainTable = 42;
+ ESchemeOpAlterTableIndex = 43;
+ ESchemeOpAlterSolomonVolume = 44;
+ ESchemeOpDropLock = 45;
+
+ ESchemeOpFinalizeBuildIndexImplTable = 46;
+ ESchemeOpInitiateBuildIndexImplTable = 47;
+
+ ESchemeOpDropIndex = 48;
+ ESchemeOpDropTableIndexAtMainTable = 49;
+
+ ESchemeOpCancelIndexBuild = 50;
ESchemeOpCreateFileStore = 51;
ESchemeOpAlterFileStore = 52;
@@ -1159,9 +1159,9 @@ enum EOperationType {
ESchemeOpDropCdcStream = 68;
ESchemeOpDropCdcStreamImpl = 69;
ESchemeOpDropCdcStreamAtTable = 70;
-
- ESchemeOpMoveTable = 71;
- ESchemeOpMoveTableIndex = 72;
+
+ ESchemeOpMoveTable = 71;
+ ESchemeOpMoveTableIndex = 72;
// Sequences
ESchemeOpCreateSequence = 73;
@@ -1174,57 +1174,57 @@ enum EOperationType {
ESchemeOpDropReplication = 78;
}
-message TApplyIf {
- optional uint64 PathId = 1;
- optional uint64 PathVersion = 2;
- optional uint64 LockedTxId = 3;
-}
-
-message TUpgradeSubDomain {
- optional string Name = 1;
-
- enum EDecision {
- Invalid = 0;
- Undo = 2;
- Commit = 3;
- }
-
- optional EDecision Decision = 2;
-}
-
-message TIndexBuildConfig {
- optional string Table = 1;
- optional TIndexCreationConfig Index = 2;
-}
-
-message TIndexBuildControl {
- optional string TablePath = 1;
- optional string IndexName = 2;
- optional uint64 SnaphotTxId = 3;
- optional uint64 BuildIndexId = 4;
-}
-
-message TLockConfig {
- optional string Name = 1;
-}
-
-message TLockGuard {
- optional uint64 OwnerTxId = 1;
-}
-
-message TDropIndex {
- optional string TableName = 1;
- optional string IndexName = 2;
-}
-
+message TApplyIf {
+ optional uint64 PathId = 1;
+ optional uint64 PathVersion = 2;
+ optional uint64 LockedTxId = 3;
+}
+
+message TUpgradeSubDomain {
+ optional string Name = 1;
+
+ enum EDecision {
+ Invalid = 0;
+ Undo = 2;
+ Commit = 3;
+ }
+
+ optional EDecision Decision = 2;
+}
+
+message TIndexBuildConfig {
+ optional string Table = 1;
+ optional TIndexCreationConfig Index = 2;
+}
+
+message TIndexBuildControl {
+ optional string TablePath = 1;
+ optional string IndexName = 2;
+ optional uint64 SnaphotTxId = 3;
+ optional uint64 BuildIndexId = 4;
+}
+
+message TLockConfig {
+ optional string Name = 1;
+}
+
+message TLockGuard {
+ optional uint64 OwnerTxId = 1;
+}
+
+message TDropIndex {
+ optional string TableName = 1;
+ optional string IndexName = 2;
+}
+
// Request for scheme modification
// Has only one of the operations
message TModifyScheme {
optional string WorkingDir = 1;
optional EOperationType OperationType = 2;
optional bool Internal = 36 [default = false]; // internal operations are not generated directly by the user
- optional bool FailOnExist = 50 [default = false]; // as a replacement for TEvModifySchemeTransaction.FailOnExist
-
+ optional bool FailOnExist = 50 [default = false]; // as a replacement for TEvModifySchemeTransaction.FailOnExist
+
optional TMkDir MkDir = 3;
optional TTableDescription CreateTable = 4;
optional TPersQueueGroupDescription CreatePersQueueGroup = 5;
@@ -1234,30 +1234,30 @@ message TModifyScheme {
optional TTableDescription AlterTable = 9;
optional TSplitMergeTablePartitions SplitMergeTablePartitions = 10;
optional TBackupTask Backup = 11;
- optional NKikimrSubDomains.TSubDomainSettings SubDomain = 12;
+ optional NKikimrSubDomains.TSubDomainSettings SubDomain = 12;
optional TRtmrVolumeDescription CreateRtmrVolume = 13;
optional TBlockStoreVolumeDescription CreateBlockStoreVolume = 14;
optional TBlockStoreVolumeDescription AlterBlockStoreVolume = 15;
optional TBlockStoreAssignOp AssignBlockStoreVolume = 16;
optional TKesusDescription Kesus = 17;
- optional TCreateSolomonVolume CreateSolomonVolume = 18;
- optional TAlterUserAttributes AlterUserAttributes = 19;
- repeated TApplyIf ApplyIf = 20;
- optional TIndexCreationConfig CreateTableIndex = 21;
- optional TIndexedTableCreationConfig CreateIndexedTable = 22;
- optional TConsistentTableCopyingConfig CreateConsistentCopyTables = 23;
- reserved 24;
- optional TUpgradeSubDomain UpgradeSubDomain = 25;
- optional TIndexBuildConfig InitiateIndexBuild = 26;
- optional TInitiateBuildIndexMainTable InitiateBuildIndexMainTable = 27;
- optional TLockConfig LockConfig = 28;
- optional TLockGuard LockGuard = 29;
- optional TIndexAlteringConfig AlterTableIndex = 30;
- optional TFinalizeBuildIndexMainTable FinalizeBuildIndexMainTable = 31;
- optional TIndexBuildControl ApplyIndexBuild = 32;
- optional TAlterSolomonVolume AlterSolomonVolume = 33;
- optional TDropIndex DropIndex = 34;
- optional TIndexBuildControl CancelIndexBuild = 35;
+ optional TCreateSolomonVolume CreateSolomonVolume = 18;
+ optional TAlterUserAttributes AlterUserAttributes = 19;
+ repeated TApplyIf ApplyIf = 20;
+ optional TIndexCreationConfig CreateTableIndex = 21;
+ optional TIndexedTableCreationConfig CreateIndexedTable = 22;
+ optional TConsistentTableCopyingConfig CreateConsistentCopyTables = 23;
+ reserved 24;
+ optional TUpgradeSubDomain UpgradeSubDomain = 25;
+ optional TIndexBuildConfig InitiateIndexBuild = 26;
+ optional TInitiateBuildIndexMainTable InitiateBuildIndexMainTable = 27;
+ optional TLockConfig LockConfig = 28;
+ optional TLockGuard LockGuard = 29;
+ optional TIndexAlteringConfig AlterTableIndex = 30;
+ optional TFinalizeBuildIndexMainTable FinalizeBuildIndexMainTable = 31;
+ optional TIndexBuildControl ApplyIndexBuild = 32;
+ optional TAlterSolomonVolume AlterSolomonVolume = 33;
+ optional TDropIndex DropIndex = 34;
+ optional TIndexBuildControl CancelIndexBuild = 35;
optional TFileStoreDescription CreateFileStore = 37;
optional TFileStoreDescription AlterFileStore = 38;
optional TRestoreTask Restore = 39;
@@ -1269,8 +1269,8 @@ message TModifyScheme {
optional TCreateCdcStream CreateCdcStream = 45;
optional TAlterCdcStream AlterCdcStream = 46;
optional TDropCdcStream DropCdcStream = 47;
- optional TMove MoveTable = 48;
- optional TMove MoveTableIndex = 49;
+ optional TMove MoveTable = 48;
+ optional TMove MoveTableIndex = 49;
optional TSequenceDescription Sequence = 51;
optional TReplicationDescription Replication = 52;
}
@@ -1285,9 +1285,9 @@ message TDescribeOptions {
optional bool ReturnPartitionConfig = 2 [default = true];
optional bool BackupInfo = 3 [default = false];
optional bool ReturnPartitionStats = 4 [default = false];
- optional bool ReturnChildren = 5 [default = true];
+ optional bool ReturnChildren = 5 [default = true];
optional bool ReturnBoundaries = 6 [default = false];
- optional bool ShowPrivateTable = 7 [default = false];
+ optional bool ShowPrivateTable = 7 [default = false];
optional bool ReturnChannelsBinding = 8 [default = false];
}
@@ -1309,17 +1309,17 @@ message TDescribePath {
// Must be sync with Ydb::EntryType
enum EPathType {
- EPathTypeInvalid = 0;
+ EPathTypeInvalid = 0;
EPathTypeDir = 1;
EPathTypeTable = 2;
EPathTypePersQueueGroup = 3;
- EPathTypeSubDomain = 4;
+ EPathTypeSubDomain = 4;
EPathTypeRtmrVolume = 5;
EPathTypeBlockStoreVolume = 6;
EPathTypeKesus = 7;
- EPathTypeSolomonVolume = 8;
+ EPathTypeSolomonVolume = 8;
EPathTypeTableIndex = 9; // Used for abstract index
- EPathTypeExtSubDomain = 10;
+ EPathTypeExtSubDomain = 10;
EPathTypeFileStore = 11;
EPathTypeColumnStore = 12;
EPathTypeColumnTable = 13;
@@ -1343,10 +1343,10 @@ enum EPathState {
EPathStateDrop = 5;
EPathStateCopying = 6;
EPathStateBackup = 7;
- EPathStateUpgrade = 8;
- EPathStateMigrated = 9;
+ EPathStateUpgrade = 8;
+ EPathStateMigrated = 9;
EPathStateRestore = 10;
- EPathStateMoving = 11;
+ EPathStateMoving = 11;
}
message TPathVersion {
@@ -1382,17 +1382,17 @@ message TPathVersion {
message TDirEntry {
optional string Name = 1;
optional uint64 PathId = 2;
- optional uint64 SchemeshardId = 3; // PathOwnerId
+ optional uint64 SchemeshardId = 3; // PathOwnerId
optional EPathType PathType = 4;
optional bool CreateFinished = 5;
optional uint64 CreateTxId = 6;
optional uint64 CreateStep = 7;
- optional uint64 ParentPathId = 8; // parentPathOwnerId ?
+ optional uint64 ParentPathId = 8; // parentPathOwnerId ?
optional EPathState PathState = 9;
optional string Owner = 10;
optional bytes ACL = 11;
optional bytes EffectiveACL = 12;
- optional uint64 PathVersion = 13;
+ optional uint64 PathVersion = 13;
optional EPathSubType PathSubType = 14;
optional TPathVersion Version = 15;
@@ -1444,16 +1444,16 @@ message TPathDescription {
repeated TLastBackupResult LastBackupResult = 7;
optional NKikimrTableStats.TTableStats TableStats = 8;
optional NKikimrTabletBase.TMetrics TabletMetrics = 9;
- optional NKikimrSubDomains.TDomainDescription DomainDescription = 10;
+ optional NKikimrSubDomains.TDomainDescription DomainDescription = 10;
optional TRtmrVolumeDescription RtmrVolumeDescription = 11; // for rtmr volume
optional TBlockStoreVolumeDescription BlockStoreVolumeDescription = 12;
optional TKesusDescription Kesus = 13;
- optional TSolomonVolumeDescription SolomonDescription = 14;
+ optional TSolomonVolumeDescription SolomonDescription = 14;
repeated NKikimrTableStats.TTableStats TablePartitionStats = 15;
- repeated TUserAttribute UserAttributes = 16;
- optional TIndexDescription TableIndex = 17;
+ repeated TUserAttribute UserAttributes = 16;
+ optional TIndexDescription TableIndex = 17;
repeated NKikimrTabletBase.TMetrics TablePartitionMetrics = 18;
- repeated uint64 AbandonedTenantsSchemeShards = 19;
+ repeated uint64 AbandonedTenantsSchemeShards = 19;
optional TFileStoreDescription FileStoreDescription = 20;
optional TColumnStoreDescription ColumnStoreDescription = 21;
optional TColumnTableDescription ColumnTableDescription = 22;
@@ -1473,7 +1473,7 @@ message TResourceProfile {
// 2. Search for profile 'default' for tablet TYPE.
// 3. Search for profile NAME for tablet 'Unknown'.
// 4. Search for profile 'default' for tablet 'Unknown'.
- // 5. Use default NKikimrSchemeOp.TResourceProfile value.
+ // 5. Use default NKikimrSchemeOp.TResourceProfile value.
optional NKikimrTabletBase.TTabletTypes.EType TabletType = 1 [default = Unknown];
optional string Name = 2;
// Memory used by tablet (not related to transactions and executor cache).
diff --git a/ydb/core/protos/flat_tx_scheme.proto b/ydb/core/protos/flat_tx_scheme.proto
index cb7283c1ddc..dc06523e5cc 100644
--- a/ydb/core/protos/flat_tx_scheme.proto
+++ b/ydb/core/protos/flat_tx_scheme.proto
@@ -5,7 +5,7 @@ import "ydb/core/protos/bind_channel_storage_pool.proto";
import "ydb/core/protos/flat_scheme_op.proto";
import "ydb/public/api/protos/ydb_cms.proto";
-package NKikimrScheme;
+package NKikimrScheme;
option java_package = "ru.yandex.kikimr.proto";
message TSchemeConfig {
@@ -33,8 +33,8 @@ enum EStatus {
StatusTxIsNotCancellable = 11;
StatusAccessDenied = 12;
StatusNotAvailable = 13;
- StatusPreconditionFailed = 14;
- StatusRedirectDomain = 15;
+ StatusPreconditionFailed = 14;
+ StatusRedirectDomain = 15;
StatusQuotaExceeded = 16;
StatusResourceExhausted = 17;
StatusReserved18 = 18;
@@ -45,11 +45,11 @@ enum EStatus {
}
message TEvModifySchemeTransaction {
- repeated NKikimrSchemeOp.TModifyScheme Transaction = 1;
+ repeated NKikimrSchemeOp.TModifyScheme Transaction = 1;
optional uint64 TxId = 2;
optional uint64 TabletId = 3;
optional string Owner = 5;
- optional bool FailOnExist = 6; // depricated, TModifyScheme.FailOnExist is recomended
+ optional bool FailOnExist = 6; // depricated, TModifyScheme.FailOnExist is recomended
optional string UserToken = 7; // serialized NACLib::TUserToken
}
@@ -67,14 +67,14 @@ message TEvDescribeSchemeResult {
optional EStatus Status = 1;
optional string Reason = 2;
optional string Path = 3;
- optional NKikimrSchemeOp.TPathDescription PathDescription = 4;
+ optional NKikimrSchemeOp.TPathDescription PathDescription = 4;
optional fixed64 PathOwner = 5;
optional fixed64 PathId = 6;
-
- optional string LastExistedPrefixPath = 7;
- optional fixed64 LastExistedPrefixPathId = 8;
- optional NKikimrSchemeOp.TPathDescription LastExistedPrefixDescription = 9;
- optional fixed64 PathOwnerId = 10;
+
+ optional string LastExistedPrefixPath = 7;
+ optional fixed64 LastExistedPrefixPathId = 8;
+ optional NKikimrSchemeOp.TPathDescription LastExistedPrefixDescription = 9;
+ optional fixed64 PathOwnerId = 10;
}
message TEvCancelTx {
@@ -88,7 +88,7 @@ message TEvCancelTxResult {
optional EStatus Status = 1;
optional string Result = 2;
optional uint64 TargetTxId = 3;
- optional uint64 TxId = 4;
+ optional uint64 TxId = 4;
}
message TEvUpdateConfig {
@@ -124,45 +124,45 @@ message TEvNotifyTxCompletionRegistered {
message TEvNotifyTxCompletionResult {
optional uint64 TxId = 1;
}
-
-message TSchemeLimits {
- optional uint64 MaxDepth = 1;
- optional uint64 MaxPaths = 2;
- optional uint64 MaxChildrenInDir = 3;
- optional uint64 MaxAclBytesSize = 4;
-
- optional uint64 MaxTableColumns = 5;
- optional uint64 MaxTableColumnNameLength = 6;
- optional uint64 MaxTableKeyColumns = 7;
- optional uint64 MaxTableIndices = 8;
- optional uint64 MaxShards = 9;
- optional uint64 MaxShardsInPath = 10;
- optional uint64 MaxConsistentCopyTargets = 11;
-
- optional uint64 MaxPathElementLength = 12;
- optional string ExtraPathSymbolsAllowed = 13;
+
+message TSchemeLimits {
+ optional uint64 MaxDepth = 1;
+ optional uint64 MaxPaths = 2;
+ optional uint64 MaxChildrenInDir = 3;
+ optional uint64 MaxAclBytesSize = 4;
+
+ optional uint64 MaxTableColumns = 5;
+ optional uint64 MaxTableColumnNameLength = 6;
+ optional uint64 MaxTableKeyColumns = 7;
+ optional uint64 MaxTableIndices = 8;
+ optional uint64 MaxShards = 9;
+ optional uint64 MaxShardsInPath = 10;
+ optional uint64 MaxConsistentCopyTargets = 11;
+
+ optional uint64 MaxPathElementLength = 12;
+ optional string ExtraPathSymbolsAllowed = 13;
optional uint64 MaxPQPartitions = 14;
-}
-
-message TEvInitTenantSchemeShard {
- optional fixed64 DomainSchemeShard = 1;
- optional fixed64 DomainPathId = 2;
- optional string RootPath = 3;
- optional string Owner = 4;
-
- optional bytes EffectiveACL = 5;
- optional uint64 EffectiveACLVersion = 6;
-
- optional NKikimrSubDomains.TProcessingParams ProcessingParams = 7;
- repeated NKikimrStoragePool.TStoragePool StoragePools = 8;
-
- repeated NKikimrSchemeOp.TUserAttribute UserAttributes = 9;
- optional uint64 UserAttributesVersion = 10;
-
- optional TSchemeLimits SchemeLimits = 11;
-
- optional bool InitiateMigration = 12;
+}
+
+message TEvInitTenantSchemeShard {
+ optional fixed64 DomainSchemeShard = 1;
+ optional fixed64 DomainPathId = 2;
+ optional string RootPath = 3;
+ optional string Owner = 4;
+
+ optional bytes EffectiveACL = 5;
+ optional uint64 EffectiveACLVersion = 6;
+
+ optional NKikimrSubDomains.TProcessingParams ProcessingParams = 7;
+ repeated NKikimrStoragePool.TStoragePool StoragePools = 8;
+
+ repeated NKikimrSchemeOp.TUserAttribute UserAttributes = 9;
+ optional uint64 UserAttributesVersion = 10;
+
+ optional TSchemeLimits SchemeLimits = 11;
+
+ optional bool InitiateMigration = 12;
optional fixed64 ResourcesDomainOwnerId = 13;
optional fixed64 ResourcesDomainPathId = 14;
@@ -170,174 +170,174 @@ message TEvInitTenantSchemeShard {
optional NKikimrSubDomains.TSchemeQuotas DeclaredSchemeQuotas = 16;
optional Ydb.Cms.DatabaseQuotas DatabaseQuotas = 17;
-}
-
-message TEvInitTenantSchemeShardResult {
- optional uint64 TenantSchemeShard = 1;
- optional EStatus Status = 2;
-}
-
-message TShardID {
- optional fixed64 OwnerId = 1;
- optional uint64 LocalId = 2;
-}
-
-message TMigrateShard {
- optional TShardID ShardIdx = 1;
- optional uint32 Type = 2;
- optional fixed64 TabletId = 3;
-
- //repeated uint32 Channel = 4; // it should be equal to array index in StoragePoolName
- repeated NKikimrStoragePool.TChannelBind BindedStoragePool = 4;
-}
-
-message TMigratePath {
+}
+
+message TEvInitTenantSchemeShardResult {
+ optional uint64 TenantSchemeShard = 1;
+ optional EStatus Status = 2;
+}
+
+message TShardID {
+ optional fixed64 OwnerId = 1;
+ optional uint64 LocalId = 2;
+}
+
+message TMigrateShard {
+ optional TShardID ShardIdx = 1;
+ optional uint32 Type = 2;
+ optional fixed64 TabletId = 3;
+
+ //repeated uint32 Channel = 4; // it should be equal to array index in StoragePoolName
+ repeated NKikimrStoragePool.TChannelBind BindedStoragePool = 4;
+}
+
+message TMigratePath {
optional NKikimrProto.TPathID PathId = 1;
optional NKikimrProto.TPathID ParentPathId = 2;
- optional string Name = 3;
- optional uint32 PathType = 4;
- optional uint64 StepCreated= 5;
- optional fixed64 CreateTxId =6;
- optional string Owner = 7;
- optional string ACL = 8;
- optional uint64 DirAlterVersion = 9;
- optional uint64 UserAttrsAlterVersion = 10;
- optional uint64 ACLVersion = 11;
- repeated NKikimrSchemeOp.TUserAttribute UserAttributes = 12;
-}
-
-message TMigrateColumn {
- optional uint32 Id = 1;
- optional string Name = 2;
- optional uint32 ColType = 3;
- optional uint32 ColKeyOrder = 4;
- optional uint64 CreateVersion = 5;
- optional uint64 DeleteVersion = 6;
- optional uint32 Family = 7;
+ optional string Name = 3;
+ optional uint32 PathType = 4;
+ optional uint64 StepCreated= 5;
+ optional fixed64 CreateTxId =6;
+ optional string Owner = 7;
+ optional string ACL = 8;
+ optional uint64 DirAlterVersion = 9;
+ optional uint64 UserAttrsAlterVersion = 10;
+ optional uint64 ACLVersion = 11;
+ repeated NKikimrSchemeOp.TUserAttribute UserAttributes = 12;
+}
+
+message TMigrateColumn {
+ optional uint32 Id = 1;
+ optional string Name = 2;
+ optional uint32 ColType = 3;
+ optional uint32 ColKeyOrder = 4;
+ optional uint64 CreateVersion = 5;
+ optional uint64 DeleteVersion = 6;
+ optional uint32 Family = 7;
optional uint32 DefaultKind = 8;
optional bytes DefaultValue = 9;
optional bool NotNull = 10;
-}
-
-message TMigratePartition {
- optional uint32 Id = 1;
- optional string RangeEnd = 2;
- optional TShardID ShardIdx = 3;
- optional string PartitionConfig = 4;
-}
-
-message TMigrateTable {
+}
+
+message TMigratePartition {
+ optional uint32 Id = 1;
+ optional string RangeEnd = 2;
+ optional TShardID ShardIdx = 3;
+ optional string PartitionConfig = 4;
+}
+
+message TMigrateTable {
optional NKikimrProto.TPathID PathId = 1;
- optional uint32 NextColId = 2;
- optional string PartitionConfig = 3;
- optional uint32 AlterVersion = 4;
- optional uint32 PartitioningVersion = 5;
-
- repeated TMigrateColumn Columns = 6;
- repeated TMigratePartition Partitions = 7;
-}
-
-message TMigrateTableIndex {
+ optional uint32 NextColId = 2;
+ optional string PartitionConfig = 3;
+ optional uint32 AlterVersion = 4;
+ optional uint32 PartitioningVersion = 5;
+
+ repeated TMigrateColumn Columns = 6;
+ repeated TMigratePartition Partitions = 7;
+}
+
+message TMigrateTableIndex {
optional NKikimrProto.TPathID PathId = 1;
- optional uint64 AlterVersion = 2;
- optional uint32 Type = 3;
- optional uint32 State = 4;
- repeated string Keys = 5;
-}
-
-message TMigrateKesus {
+ optional uint64 AlterVersion = 2;
+ optional uint32 Type = 3;
+ optional uint32 State = 4;
+ repeated string Keys = 5;
+}
+
+message TMigrateKesus {
optional NKikimrProto.TPathID PathId = 1;
- optional uint64 Version = 2;
- optional string Config = 3;
-}
-
-message TEvMigrate {
- optional uint64 SchemeShardGeneration = 1;
- optional TMigratePath Path = 2;
- optional NKikimrSchemeOp.TPathVersion PathVersion = 3;
-
- repeated TMigrateShard Shards = 4;
-
- optional TMigrateTable Table = 5;
- optional TMigrateTableIndex TableIndex = 6;
- optional TMigrateKesus Kesus = 7;
-}
-
-message TEvMigrateResult {
- optional fixed64 TenantSchemeShard = 1;
- optional uint64 SchemeShardGeneration = 2;
+ optional uint64 Version = 2;
+ optional string Config = 3;
+}
+
+message TEvMigrate {
+ optional uint64 SchemeShardGeneration = 1;
+ optional TMigratePath Path = 2;
+ optional NKikimrSchemeOp.TPathVersion PathVersion = 3;
+
+ repeated TMigrateShard Shards = 4;
+
+ optional TMigrateTable Table = 5;
+ optional TMigrateTableIndex TableIndex = 6;
+ optional TMigrateKesus Kesus = 7;
+}
+
+message TEvMigrateResult {
+ optional fixed64 TenantSchemeShard = 1;
+ optional uint64 SchemeShardGeneration = 2;
optional NKikimrProto.TPathID PathId = 3;
- repeated TShardID ShardIds = 4;
-}
-
-message TEvPublishTenantAsReadOnly {
- optional fixed64 DomainSchemeShard = 1;
-}
-
-message TEvPublishTenantAsReadOnlyResult {
- optional fixed64 TenantSchemeShard = 1;
- optional EStatus Status = 2;
-}
-
-message TEvRewriteOwner {
- optional fixed64 PrevOwner = 1;
- optional fixed64 NewOwner = 2;
-
- optional uint64 Generation = 3;
- optional uint64 Round = 4;
-}
-
-message TEvRewriteOwnerResult {
- optional EStatus Status = 1;
-}
-
-message TEvPublishTenant {
- optional fixed64 DomainSchemeShard = 1;
-}
-
-message TEvPublishTenantResult {
- optional fixed64 TenantSchemeShard = 1;
-}
-
-message TEvSyncTenantSchemeShard {
- optional fixed64 DomainSchemeShard = 1;
- optional fixed64 DomainPathId = 2;
- optional fixed64 TabletID = 3;
- optional uint64 Generation = 4;
-
- optional uint64 EffectiveACLVersion = 5;
- optional uint64 SubdomainVersion = 6;
- optional uint64 UserAttributesVersion = 7;
-
- optional uint64 TenantHive = 8;
+ repeated TShardID ShardIds = 4;
+}
+
+message TEvPublishTenantAsReadOnly {
+ optional fixed64 DomainSchemeShard = 1;
+}
+
+message TEvPublishTenantAsReadOnlyResult {
+ optional fixed64 TenantSchemeShard = 1;
+ optional EStatus Status = 2;
+}
+
+message TEvRewriteOwner {
+ optional fixed64 PrevOwner = 1;
+ optional fixed64 NewOwner = 2;
+
+ optional uint64 Generation = 3;
+ optional uint64 Round = 4;
+}
+
+message TEvRewriteOwnerResult {
+ optional EStatus Status = 1;
+}
+
+message TEvPublishTenant {
+ optional fixed64 DomainSchemeShard = 1;
+}
+
+message TEvPublishTenantResult {
+ optional fixed64 TenantSchemeShard = 1;
+}
+
+message TEvSyncTenantSchemeShard {
+ optional fixed64 DomainSchemeShard = 1;
+ optional fixed64 DomainPathId = 2;
+ optional fixed64 TabletID = 3;
+ optional uint64 Generation = 4;
+
+ optional uint64 EffectiveACLVersion = 5;
+ optional uint64 SubdomainVersion = 6;
+ optional uint64 UserAttributesVersion = 7;
+
+ optional uint64 TenantHive = 8;
optional uint64 TenantSysViewProcessor = 9;
-
- optional string TenantRootACL = 10;
-}
-
-message TEvUpdateTenantSchemeShard {
- optional fixed64 TabletId = 1;
- optional uint64 Generation = 2;
-
- optional string Owner = 3;
- optional bytes EffectiveACL = 4;
- optional uint64 EffectiveACLVersion = 5;
-
- repeated NKikimrStoragePool.TStoragePool StoragePools = 6;
- optional uint64 SubdomainVersion = 7;
-
- repeated NKikimrSchemeOp.TUserAttribute UserAttributes = 8;
- optional uint64 UserAttributesVersion = 9;
-
- optional uint64 TenantHive = 10;
+
+ optional string TenantRootACL = 10;
+}
+
+message TEvUpdateTenantSchemeShard {
+ optional fixed64 TabletId = 1;
+ optional uint64 Generation = 2;
+
+ optional string Owner = 3;
+ optional bytes EffectiveACL = 4;
+ optional uint64 EffectiveACLVersion = 5;
+
+ repeated NKikimrStoragePool.TStoragePool StoragePools = 6;
+ optional uint64 SubdomainVersion = 7;
+
+ repeated NKikimrSchemeOp.TUserAttribute UserAttributes = 8;
+ optional uint64 UserAttributesVersion = 9;
+
+ optional uint64 TenantHive = 10;
optional uint64 TenantSysViewProcessor = 11;
optional NKikimrSubDomains.TSchemeQuotas DeclaredSchemeQuotas = 12;
optional Ydb.Cms.DatabaseQuotas DatabaseQuotas = 14;
-
- optional string UpdateTenantRootACL = 13;
-}
-
+
+ optional string UpdateTenantRootACL = 13;
+}
+
message TEvFindTabletSubDomainPathId {
optional uint64 TabletId = 1; // DataShard tablet id
}
diff --git a/ydb/core/protos/follower_group.proto b/ydb/core/protos/follower_group.proto
index 268db11f953..d374752bcde 100644
--- a/ydb/core/protos/follower_group.proto
+++ b/ydb/core/protos/follower_group.proto
@@ -1,15 +1,15 @@
-package NKikimrHive;
-option java_package = "ru.yandex.kikimr.proto";
-
+package NKikimrHive;
+option java_package = "ru.yandex.kikimr.proto";
+
message TFollowerGroup {
optional uint32 FollowerCount = 1;
optional bool AllowLeaderPromotion = 2;
- optional bool AllowClientRead = 3;
- repeated uint32 AllowedNodeIDs = 4;
+ optional bool AllowClientRead = 3;
+ repeated uint32 AllowedNodeIDs = 4;
repeated uint32 AllowedDataCenterNumIDs = 5 [deprecated=true]; // use AllowedDataCenters
- optional bool RequireAllDataCenters = 6;
- optional bool LocalNodeOnly = 7;
- optional bool RequireDifferentNodes = 8;
+ optional bool RequireAllDataCenters = 6;
+ optional bool LocalNodeOnly = 7;
+ optional bool RequireDifferentNodes = 8;
optional bool FollowerCountPerDataCenter = 9; // multiplies FollowerCount by number of DataCenters
repeated string AllowedDataCenters = 10;
-}
+}
diff --git a/ydb/core/protos/hive.proto b/ydb/core/protos/hive.proto
index ea4f6ede4f5..0059db81de8 100644
--- a/ydb/core/protos/hive.proto
+++ b/ydb/core/protos/hive.proto
@@ -90,7 +90,7 @@ message TEvCreateTablet {
optional NKikimrSubDomains.TDomainKey ObjectDomain = 18;
optional ETabletBootMode TabletBootMode = 19;
optional uint64 ObjectId = 20;
- repeated NKikimrStoragePool.TChannelBind BindedChannels = 21;
+ repeated NKikimrStoragePool.TChannelBind BindedChannels = 21;
optional fixed64 TabletID = 22;
repeated NKikimrSubDomains.TDomainKey AllowedDomains = 23;
optional TDataCentersPreference DataCentersPreference = 24;
@@ -156,26 +156,26 @@ message TEvReconfigureTablet {
repeated TChannelRequest Channels = 4;
}
-message TEvAdoptTablet {
- optional fixed64 TabletID = 1;
-
- optional fixed64 PrevOwner = 2;
- optional uint64 PrevOwnerIdx = 3;
- optional NKikimrTabletBase.TTabletTypes.EType TabletType = 4;
-
- optional fixed64 Owner = 5;
- optional uint64 OwnerIdx = 6;
-}
-
-message TEvAdoptTabletReply {
- optional fixed64 TabletID = 1;
- optional fixed64 Origin = 2;
- optional fixed64 Owner = 3;
- optional uint64 OwnerIdx = 4;
- optional NKikimrProto.EReplyStatus Status = 5;
- optional string Explain = 6;
-}
-
+message TEvAdoptTablet {
+ optional fixed64 TabletID = 1;
+
+ optional fixed64 PrevOwner = 2;
+ optional uint64 PrevOwnerIdx = 3;
+ optional NKikimrTabletBase.TTabletTypes.EType TabletType = 4;
+
+ optional fixed64 Owner = 5;
+ optional uint64 OwnerIdx = 6;
+}
+
+message TEvAdoptTabletReply {
+ optional fixed64 TabletID = 1;
+ optional fixed64 Origin = 2;
+ optional fixed64 Owner = 3;
+ optional uint64 OwnerIdx = 4;
+ optional NKikimrProto.EReplyStatus Status = 5;
+ optional string Explain = 6;
+}
+
message TEvReconfigureTabletReply {
optional NKikimrProto.EReplyStatus Status = 1;
optional fixed64 TabletID = 2;
@@ -184,34 +184,34 @@ message TEvReconfigureTabletReply {
}
message TEvDeleteTablet {
- optional fixed64 ShardOwnerId = 1;
- repeated uint64 ShardLocalIdx = 2;
- optional uint64 TxId_Deprecated = 3;
+ optional fixed64 ShardOwnerId = 1;
+ repeated uint64 ShardLocalIdx = 2;
+ optional uint64 TxId_Deprecated = 3;
repeated fixed64 TabletID = 4;
}
message TEvDeleteTabletReply {
optional NKikimrProto.EReplyStatus Status = 1;
optional fixed64 Origin = 2;
- optional uint64 TxId_Deprecated = 3;
- optional uint64 ShardOwnerId = 4;
- repeated uint64 ShardLocalIdx = 5;
+ optional uint64 TxId_Deprecated = 3;
+ optional uint64 ShardOwnerId = 4;
+ repeated uint64 ShardLocalIdx = 5;
optional TForwardRequest ForwardRequest = 6;
}
-message TEvDeleteOwnerTablets {
- optional fixed64 Owner = 1;
- optional uint64 TxId = 2;
-}
-
-message TEvDeleteOwnerTabletsReply {
- optional NKikimrProto.EReplyStatus Status = 1;
- optional fixed64 Owner = 2;
- optional uint64 TxId = 3;
- optional fixed64 Origin = 4;
-}
-
-
+message TEvDeleteOwnerTablets {
+ optional fixed64 Owner = 1;
+ optional uint64 TxId = 2;
+}
+
+message TEvDeleteOwnerTabletsReply {
+ optional NKikimrProto.EReplyStatus Status = 1;
+ optional fixed64 Owner = 2;
+ optional uint64 TxId = 3;
+ optional fixed64 Origin = 4;
+}
+
+
message TEvLookupChannelInfo {
optional fixed64 TabletID = 1;
repeated uint32 Channels = 2;
diff --git a/ydb/core/protos/index_builder.proto b/ydb/core/protos/index_builder.proto
index 94808462b0a..f6ca5f9da68 100644
--- a/ydb/core/protos/index_builder.proto
+++ b/ydb/core/protos/index_builder.proto
@@ -2,86 +2,86 @@ import "ydb/public/api/protos/ydb_issue_message.proto";
import "ydb/public/api/protos/ydb_operation.proto";
import "ydb/public/api/protos/ydb_status_codes.proto";
import "ydb/public/api/protos/ydb_table.proto";
-
-package NKikimrIndexBuilder;
-option java_package = "ru.yandex.kikimr.proto";
-
-message TIndexBuildSettings {
- optional string source_path = 1;
- optional Ydb.Table.TableIndex index = 2;
-
+
+package NKikimrIndexBuilder;
+option java_package = "ru.yandex.kikimr.proto";
+
+message TIndexBuildSettings {
+ optional string source_path = 1;
+ optional Ydb.Table.TableIndex index = 2;
+
optional uint32 max_batch_rows = 3 [ default = 500 ];
optional uint64 max_batch_bytes = 4 [ default = 8388608 ];
- optional uint32 max_shards_in_flight = 5 [ default = 32 ];
- optional uint32 max_retries_upload_batch = 6 [ default = 50 ];
-}
-
-message TIndexBuild {
- optional uint64 Id = 1;
- repeated Ydb.Issue.IssueMessage Issues = 2;
+ optional uint32 max_shards_in_flight = 5 [ default = 32 ];
+ optional uint32 max_retries_upload_batch = 6 [ default = 50 ];
+}
+
+message TIndexBuild {
+ optional uint64 Id = 1;
+ repeated Ydb.Issue.IssueMessage Issues = 2;
optional Ydb.Table.IndexBuildState.State State = 3;
- optional TIndexBuildSettings Settings = 4;
+ optional TIndexBuildSettings Settings = 4;
optional float Progress = 5 [default = 0];
-}
-
-message TEvCreateRequest {
- optional Ydb.Operations.OperationParams OperationParams = 1;
- optional uint64 TxId = 2;
- optional string DatabaseName = 3;
- optional TIndexBuildSettings Settings = 4;
-}
-
-message TEvCreateResponse {
- optional uint64 TxId = 1;
- optional Ydb.StatusIds.StatusCode Status = 2;
- repeated Ydb.Issue.IssueMessage Issues = 3;
- optional TIndexBuild IndexBuild = 4;
-}
-
-message TEvGetRequest {
- optional string DatabaseName = 1;
- optional uint64 IndexBuildId = 2;
-}
-
-message TEvGetResponse {
- optional Ydb.StatusIds.StatusCode Status = 1;
- repeated Ydb.Issue.IssueMessage Issues = 2;
- optional TIndexBuild IndexBuild = 3;
-}
-
-message TEvCancelRequest {
- optional uint64 TxId = 1;
- optional string DatabaseName = 2;
- optional uint64 IndexBuildId = 3;
-}
-
-message TEvCancelResponse {
- optional uint64 TxId = 1;
- optional Ydb.StatusIds.StatusCode Status = 2;
- repeated Ydb.Issue.IssueMessage Issues = 3;
-}
-
-message TEvForgetRequest {
- optional uint64 TxId = 1;
- optional string DatabaseName = 2;
- optional uint64 IndexBuildId = 3;
-}
-
-message TEvForgetResponse {
- optional uint64 TxId = 1;
- optional Ydb.StatusIds.StatusCode Status = 2;
- repeated Ydb.Issue.IssueMessage Issues = 3;
-}
-
-message TEvListRequest {
- optional string DatabaseName = 1;
- optional uint64 PageSize = 2;
- optional string PageToken = 3;
-}
-
-message TEvListResponse {
- optional Ydb.StatusIds.StatusCode Status = 1;
- repeated Ydb.Issue.IssueMessage Issues = 2;
- repeated TIndexBuild Entries = 3;
- optional string NextPageToken = 4;
-}
+}
+
+message TEvCreateRequest {
+ optional Ydb.Operations.OperationParams OperationParams = 1;
+ optional uint64 TxId = 2;
+ optional string DatabaseName = 3;
+ optional TIndexBuildSettings Settings = 4;
+}
+
+message TEvCreateResponse {
+ optional uint64 TxId = 1;
+ optional Ydb.StatusIds.StatusCode Status = 2;
+ repeated Ydb.Issue.IssueMessage Issues = 3;
+ optional TIndexBuild IndexBuild = 4;
+}
+
+message TEvGetRequest {
+ optional string DatabaseName = 1;
+ optional uint64 IndexBuildId = 2;
+}
+
+message TEvGetResponse {
+ optional Ydb.StatusIds.StatusCode Status = 1;
+ repeated Ydb.Issue.IssueMessage Issues = 2;
+ optional TIndexBuild IndexBuild = 3;
+}
+
+message TEvCancelRequest {
+ optional uint64 TxId = 1;
+ optional string DatabaseName = 2;
+ optional uint64 IndexBuildId = 3;
+}
+
+message TEvCancelResponse {
+ optional uint64 TxId = 1;
+ optional Ydb.StatusIds.StatusCode Status = 2;
+ repeated Ydb.Issue.IssueMessage Issues = 3;
+}
+
+message TEvForgetRequest {
+ optional uint64 TxId = 1;
+ optional string DatabaseName = 2;
+ optional uint64 IndexBuildId = 3;
+}
+
+message TEvForgetResponse {
+ optional uint64 TxId = 1;
+ optional Ydb.StatusIds.StatusCode Status = 2;
+ repeated Ydb.Issue.IssueMessage Issues = 3;
+}
+
+message TEvListRequest {
+ optional string DatabaseName = 1;
+ optional uint64 PageSize = 2;
+ optional string PageToken = 3;
+}
+
+message TEvListResponse {
+ optional Ydb.StatusIds.StatusCode Status = 1;
+ repeated Ydb.Issue.IssueMessage Issues = 2;
+ repeated TIndexBuild Entries = 3;
+ optional string NextPageToken = 4;
+}
diff --git a/ydb/core/protos/issue_id.proto b/ydb/core/protos/issue_id.proto
index 0ae2f9fe628..1c82c0d95e8 100644
--- a/ydb/core/protos/issue_id.proto
+++ b/ydb/core/protos/issue_id.proto
@@ -32,7 +32,7 @@ message TIssuesIds {
SHARD_NOT_AVAILABLE = 200505;
TX_STATE_UNKNOWN = 200506;
TX_DECLINED_BY_COORDINATOR = 200507;
- TX_DECLINED_IMPLICIT_COORDINATOR = 200508;
+ TX_DECLINED_IMPLICIT_COORDINATOR = 200508;
SHARD_PROGRAM_SIZE_EXCEEDED = 200509;
SCOPE_REQPROXY = 200600;
diff --git a/ydb/core/protos/local.proto b/ydb/core/protos/local.proto
index f0a395cffe7..a385a3cf3e1 100644
--- a/ydb/core/protos/local.proto
+++ b/ydb/core/protos/local.proto
@@ -15,7 +15,7 @@ message TTabletAvailability {
message TEvRegisterNode {
optional fixed64 HiveId = 1;
- repeated NKikimrSubDomains.TDomainKey ServicedDomains = 2;
+ repeated NKikimrSubDomains.TDomainKey ServicedDomains = 2;
optional NActorsInterconnect.TNodeLocation SystemLocation = 3;
repeated TTabletAvailability TabletAvailability = 4;
}
@@ -27,7 +27,7 @@ message TEvRegisterNodeResult {
}
message TLocalConfig {
- repeated NKikimrSchemeOp.TResourceProfile ResourceProfiles = 1;
+ repeated NKikimrSchemeOp.TResourceProfile ResourceProfiles = 1;
}
message TEvPing {
diff --git a/ydb/core/protos/msgbus.proto b/ydb/core/protos/msgbus.proto
index 6b54c5e1a24..df7cda59800 100644
--- a/ydb/core/protos/msgbus.proto
+++ b/ydb/core/protos/msgbus.proto
@@ -181,8 +181,8 @@ message TResponse {
repeated NKikimrWhiteboard.TTabletStateInfo TabletStateInfo = 500;
// TSchemeDescribe
- optional NKikimrSchemeOp.TPathDescription PathDescription = 600;
- optional string Path = 601;
+ optional NKikimrSchemeOp.TPathDescription PathDescription = 600;
+ optional string Path = 601;
// TSchemeOperation
optional TFlatTxId FlatTxId = 700;
@@ -332,8 +332,8 @@ message THiveCreateTablet {
optional NKikimrTabletBase.TTabletTypes.EType TabletType = 3; // mandatory, tablet type, see ydb/core/base/tablet_types.h
optional uint32 ChannelsProfile = 4; // mandatory, channels profile index (use 0 for default profile)
repeated uint32 AllowedNodeIDs = 5;
- repeated NKikimrSubDomains.TDomainKey AllowedDomains = 6;
- repeated NKikimrStoragePool.TChannelBind BindedChannels = 7;
+ repeated NKikimrSubDomains.TDomainKey AllowedDomains = 6;
+ repeated NKikimrStoragePool.TChannelBind BindedChannels = 7;
}
message TCmdLookupTablet {
@@ -440,15 +440,15 @@ message TSchemeDescribe {
optional uint64 PathId = 2;
optional uint64 SchemeshardId = 3;
optional string SecurityToken = 5;
- optional NKikimrSchemeOp.TDescribeOptions Options = 6;
+ optional NKikimrSchemeOp.TDescribeOptions Options = 6;
};
message TFlatDescribeResponse {
option deprecated = true;
optional uint32 Status = 1;
-
- optional string Path = 9;
- optional NKikimrSchemeOp.TPathDescription PathDescription = 2;
+
+ optional string Path = 9;
+ optional NKikimrSchemeOp.TPathDescription PathDescription = 2;
optional string ErrorReason = 3; // When present contains human-readable error description
optional int32 SchemeStatus = 4;
diff --git a/ydb/core/protos/scheme_board.proto b/ydb/core/protos/scheme_board.proto
index ad2764873e2..f063144f5d0 100644
--- a/ydb/core/protos/scheme_board.proto
+++ b/ydb/core/protos/scheme_board.proto
@@ -13,11 +13,11 @@ message TEvHandshake {
optional uint64 Generation = 2;
}
-// here and below
-// Owner is the tablet id of schemeshard witch holds the records
-// LocalPathId is a second part of TPathId
-// PathOwnerId is a first part of TPathId
-
+// here and below
+// Owner is the tablet id of schemeshard witch holds the records
+// LocalPathId is a second part of TPathId
+// PathOwnerId is a first part of TPathId
+
message TEvUpdate {
optional uint64 Owner = 1;
optional uint64 Generation = 2;
@@ -25,10 +25,10 @@ message TEvUpdate {
optional string Path = 4;
optional uint64 LocalPathId = 5;
optional bool IsDeletion = 6 [default = false];
- optional NKikimrScheme.TEvDescribeSchemeResult DescribeSchemeResult = 7;
+ optional NKikimrScheme.TEvDescribeSchemeResult DescribeSchemeResult = 7;
optional bool NeedAck = 8 [default = false];
- optional uint64 PathOwnerId = 9;
- optional TLocalPathIdRange MigratedLocalPathIds = 10;
+ optional uint64 PathOwnerId = 9;
+ optional TLocalPathIdRange MigratedLocalPathIds = 10;
}
message TEvUpdateAck {
@@ -36,7 +36,7 @@ message TEvUpdateAck {
optional uint64 Generation = 2;
optional uint64 LocalPathId = 3;
optional uint64 Version = 4;
- optional uint64 PathOwnerId = 5;
+ optional uint64 PathOwnerId = 5;
}
message TEvCommitGeneration {
@@ -51,7 +51,7 @@ message TEvSubscribe {
optional string Path = 1;
// or
- optional uint64 PathOwnerId = 2;
+ optional uint64 PathOwnerId = 2;
optional uint64 LocalPathId = 3;
// common
optional uint64 DomainOwnerId = 4;
@@ -61,18 +61,18 @@ message TEvSubscribe {
message TEvUnsubscribe {
optional string Path = 1;
// or
- optional uint64 PathOwnerId = 2;
+ optional uint64 PathOwnerId = 2;
optional uint64 LocalPathId = 3;
}
message TEvNotify {
optional string Path = 1;
// and/or
- optional uint64 PathOwnerId = 2;
+ optional uint64 PathOwnerId = 2;
optional uint64 LocalPathId = 3;
// common fields
optional bool IsDeletion = 4 [default = false];
- optional NKikimrScheme.TEvDescribeSchemeResult DescribeSchemeResult = 5;
+ optional NKikimrScheme.TEvDescribeSchemeResult DescribeSchemeResult = 5;
optional uint64 Version = 6;
optional bool Strong = 7 [default = false];
}
@@ -84,7 +84,7 @@ message TEvNotifyAck {
message TEvSyncVersionRequest {
optional string Path = 1;
// and/or
- optional uint64 PathOwnerId = 2;
+ optional uint64 PathOwnerId = 2;
optional uint64 LocalPathId = 3;
}
diff --git a/ydb/core/protos/scheme_log.proto b/ydb/core/protos/scheme_log.proto
index e87f612ffd6..fcf4ba52b94 100644
--- a/ydb/core/protos/scheme_log.proto
+++ b/ydb/core/protos/scheme_log.proto
@@ -61,7 +61,7 @@ message TAlterRecord {
optional bool NotNull = 24 [default = false];
optional uint64 ExecutorCacheSize = 100;
- optional NKikimrSchemeOp.TCompactionPolicy CompactionPolicy = 101;
+ optional NKikimrSchemeOp.TCompactionPolicy CompactionPolicy = 101;
optional bool ExecutorAllowLogBatching = 102;
optional uint64 ExecutorLogFlushPeriod = 103;
optional uint32 ExecutorLimitInFlyTx = 104;
diff --git a/ydb/core/protos/services.proto b/ydb/core/protos/services.proto
index c92fa3fe986..c17c8a7dc37 100644
--- a/ydb/core/protos/services.proto
+++ b/ydb/core/protos/services.proto
@@ -61,16 +61,16 @@ enum EServiceKikimr {
BS_VDISK_CHUNKS = 299;
// SCHEMESHARD section
- SCHEMESHARD_DESCRIBE = 295;
+ SCHEMESHARD_DESCRIBE = 295;
FLAT_TX_SCHEMESHARD = 296;
- SHEME_SHARD = 700; // stillborn tag
+ SHEME_SHARD = 700; // stillborn tag
// OLAP section
TX_OLAPSHARD = 331;
TX_COLUMNSHARD = 332;
BLOB_CACHE = 333;
TX_COLUMNSHARD_SCAN = 334;
-
+
// BLOBSTORAGE again
BS_HANDOFF = 298;
@@ -141,17 +141,17 @@ enum EServiceKikimr {
// PROXY section
TX_PROXY = 400;
TX_PROXY_SCHEME_CACHE = 401;
- MSGBUS_PROXY = 403;
- TX_ALLOCATOR = 402;
+ MSGBUS_PROXY = 403;
+ TX_ALLOCATOR = 402;
TX_ALLOCATOR_CLIENT = 404;
LONG_TX_SERVICE = 405;
-
+
LOGGER = 410;
MSGBUS_TRACER = 411;
MSGBUS_REQUEST = 412; // deprecated, use RPC_REQUEST
GRPC_SERVER = 413;
- GRPC_PROXY = 415;
- GRPC_PROXY_NO_CONNECT_ACCESS = 417;
+ GRPC_PROXY = 415;
+ GRPC_PROXY_NO_CONNECT_ACCESS = 417;
READ_TABLE_API = 414; // deprecated, use RPC_REQUEST
RPC_REQUEST = 416;
// KEY VALUE section
@@ -274,10 +274,10 @@ enum EServiceKikimr {
// System views
SYSTEM_VIEWS = 900;
-
- BUILD_INDEX = 1000;
-
- METERING_WRITER = 1010;
+
+ BUILD_INDEX = 1000;
+
+ METERING_WRITER = 1010;
// Streaming
STREAMS = 1011;
@@ -772,7 +772,7 @@ message TActivity {
BS_PROXY_PATCH_ACTOR = 457;
SCHEME_BOARD_WATCH_CACHE_ACTOR = 458;
SEQUENCESHARD_ACTOR = 459;
- BUILD_INDEX_SCAN_ACTOR = 460;
+ BUILD_INDEX_SCAN_ACTOR = 460;
FLAT_EXECUTOR_REASSIGN = 461;
DISTRIBUTED_ERASE_ROWS_ACTOR = 462;
YT_WRAPPER_ACTOR = 463;
@@ -796,7 +796,7 @@ message TActivity {
TX_COLUMNSHARD_COMPACTION_ACTOR = 499;
SCHEME_BOARD_MONITORING_ACTOR = 478;
SCHEME_BOARD_INFO_REQUESTER_ACTOR = 479;
- METERING_WRITER_ACTOR = 480;
+ METERING_WRITER_ACTOR = 480;
SEQUENCE_PROXY_SERVICE = 481;
KQP_TABLE_SCAN_PROXY = 482;
KQP_TABLE_RESOLVER = 483;
diff --git a/ydb/core/protos/subdomains.proto b/ydb/core/protos/subdomains.proto
index 0b0497018ab..5d665ff3813 100644
--- a/ydb/core/protos/subdomains.proto
+++ b/ydb/core/protos/subdomains.proto
@@ -1,43 +1,43 @@
import "ydb/core/protos/bind_channel_storage_pool.proto";
import "ydb/public/api/protos/ydb_cms.proto";
import "ydb/library/login/protos/login.proto";
-
-package NKikimrSubDomains;
-
+
+package NKikimrSubDomains;
+
message TDomainKey {
optional fixed64 SchemeShard = 1;
optional fixed64 PathId = 2;
}
-message TSubDomainSettings {
- optional uint64 PlanResolution = 1;
- optional uint64 Coordinators = 2;
- optional uint64 Mediators = 3;
- optional string Name = 4;
- optional uint32 TimeCastBucketsPerMediator = 5;
- repeated NKikimrStoragePool.TStoragePool StoragePools = 6;
+message TSubDomainSettings {
+ optional uint64 PlanResolution = 1;
+ optional uint64 Coordinators = 2;
+ optional uint64 Mediators = 3;
+ optional string Name = 4;
+ optional uint32 TimeCastBucketsPerMediator = 5;
+ repeated NKikimrStoragePool.TStoragePool StoragePools = 6;
optional bool ExternalSchemeShard = 7 [default = false];
optional bool ExternalHive = 8 [default = false];
optional TDomainKey ResourcesDomainKey = 9;
optional bool ExternalSysViewProcessor = 10 [default = false];
optional TSchemeQuotas DeclaredSchemeQuotas = 11;
optional Ydb.Cms.DatabaseQuotas DatabaseQuotas = 12;
-}
-
-message TProcessingParams {
- optional uint32 Version = 1; //label for track changes
- optional uint64 PlanResolution = 2;
- repeated fixed64 Coordinators = 3;
- optional uint64 TimeCastBucketsPerMediator = 4;
- repeated fixed64 Mediators = 5;
-
- optional fixed64 SchemeShard = 6;
+}
+
+message TProcessingParams {
+ optional uint32 Version = 1; //label for track changes
+ optional uint64 PlanResolution = 2;
+ repeated fixed64 Coordinators = 3;
+ optional uint64 TimeCastBucketsPerMediator = 4;
+ repeated fixed64 Mediators = 5;
+
+ optional fixed64 SchemeShard = 6;
optional fixed64 Hive = 7;
optional fixed64 SysViewProcessor = 8;
-
- //put there SubSchemeShard and SubHive at the future
-}
-
+
+ //put there SubSchemeShard and SubHive at the future
+}
+
message TDiskSpaceUsage {
message TTables {
// in bytes
@@ -53,18 +53,18 @@ message TDomainState {
optional bool DiskQuotaExceeded = 1;
}
-message TDomainDescription {
- optional fixed64 SchemeShardId_Depricated = 1;
- optional fixed64 PathId_Depricated = 2;
-
- optional TProcessingParams ProcessingParams = 3;
- optional TDomainKey DomainKey = 4; // SchemeShardId:PathId -- key for subdomain
- repeated NKikimrStoragePool.TStoragePool StoragePools = 5;
-
- optional uint64 PathsInside = 6;
- optional uint64 PathsLimit = 7;
- optional uint64 ShardsInside = 8;
- optional uint64 ShardsLimit = 9;
+message TDomainDescription {
+ optional fixed64 SchemeShardId_Depricated = 1;
+ optional fixed64 PathId_Depricated = 2;
+
+ optional TProcessingParams ProcessingParams = 3;
+ optional TDomainKey DomainKey = 4; // SchemeShardId:PathId -- key for subdomain
+ repeated NKikimrStoragePool.TStoragePool StoragePools = 5;
+
+ optional uint64 PathsInside = 6;
+ optional uint64 PathsLimit = 7;
+ optional uint64 ShardsInside = 8;
+ optional uint64 ShardsLimit = 9;
optional TDomainKey ResourcesDomainKey = 10;
@@ -79,7 +79,7 @@ message TDomainDescription {
optional TDomainState DomainState = 16;
optional NLoginProto.TSecurityState SecurityState = 20;
-}
+}
message TSchemeQuotas {
repeated TSchemeQuota SchemeQuotas = 1;
diff --git a/ydb/core/protos/tablet.proto b/ydb/core/protos/tablet.proto
index 4ed253e8f3a..f0bec238e78 100644
--- a/ydb/core/protos/tablet.proto
+++ b/ydb/core/protos/tablet.proto
@@ -91,7 +91,7 @@ message TTabletChannelInfo {
optional uint32 ChannelType = 2;
repeated THistoryEntry History = 3;
optional string ChannelErasureName = 4;
- optional string StoragePool = 5;
+ optional string StoragePool = 5;
}
message TTabletStorageInfo {
diff --git a/ydb/core/protos/tenant_pool.proto b/ydb/core/protos/tenant_pool.proto
index 64479f44952..b4d39fbab71 100644
--- a/ydb/core/protos/tenant_pool.proto
+++ b/ydb/core/protos/tenant_pool.proto
@@ -37,7 +37,7 @@ message TSlotStatus {
optional string AssignedTenant = 3;
optional NKikimrTabletBase.TMetrics ResourceLimit = 4;
optional string Label = 5;
- repeated NKikimrSchemeOp.TUserAttribute TenantAttributes = 6;
+ repeated NKikimrSchemeOp.TUserAttribute TenantAttributes = 6;
optional EState State = 7;
optional NKikimrSubDomains.TDomainKey DomainKey = 8;
}
diff --git a/ydb/core/protos/tx.proto b/ydb/core/protos/tx.proto
index 2cfeb65a9ad..1f18e7eca6e 100644
--- a/ydb/core/protos/tx.proto
+++ b/ydb/core/protos/tx.proto
@@ -66,17 +66,17 @@ message TCoordinatorTransaction {
optional uint64 Moderator = 5; // tablet id of moderator (if any)
}
-message TEvSubDomainConfigurationAck {
- enum EStatus {
- SUCCESS = 0; // ok
- ALREADY = 1; // ok, repeated request
- REJECT = 2; // precisely not ok
- }
-
- optional EStatus Status = 1;
- optional fixed64 OnTabletId = 2;
-}
-
+message TEvSubDomainConfigurationAck {
+ enum EStatus {
+ SUCCESS = 0; // ok
+ ALREADY = 1; // ok, repeated request
+ REJECT = 2; // precisely not ok
+ }
+
+ optional EStatus Status = 1;
+ optional fixed64 OnTabletId = 2;
+}
+
message TEvCoordinatorSync {
optional fixed64 Cookie = 1;
optional fixed64 MediatorID = 9;
@@ -109,22 +109,22 @@ message TEvCoordinatorStep {
optional uint64 TotalTxAffectedEntries = 20; // sum(transactions[i].affectedset.size)
}
-message TEvTxAllocate {
- optional fixed64 RangeSize = 1;
-}
-
-message TEvTxAllocateResult {
- enum EStatus {
- SUCCESS = 0; // ok
- IMPOSIBLE = 1; // precisely not ok
- }
-
- optional EStatus Status = 1;
-
- optional fixed64 RangeBegin = 2;
- optional fixed64 RangeEnd = 3;
-}
-
+message TEvTxAllocate {
+ optional fixed64 RangeSize = 1;
+}
+
+message TEvTxAllocateResult {
+ enum EStatus {
+ SUCCESS = 0; // ok
+ IMPOSIBLE = 1; // precisely not ok
+ }
+
+ optional EStatus Status = 1;
+
+ optional fixed64 RangeBegin = 2;
+ optional fixed64 RangeEnd = 3;
+}
+
message TEvCoordinatorStepResult {
enum EStatus {
UNKNOWN_COORDINATOR = 0; // requested coordinator not known
diff --git a/ydb/core/protos/tx_datashard.proto b/ydb/core/protos/tx_datashard.proto
index 846f01ff804..89863b25400 100644
--- a/ydb/core/protos/tx_datashard.proto
+++ b/ydb/core/protos/tx_datashard.proto
@@ -91,12 +91,12 @@ message TRWTransaction {
message TROTransaction {
}
-message TTableId {
- optional uint64 OwnerId = 1;
- optional uint64 TableId = 2;
+message TTableId {
+ optional uint64 OwnerId = 1;
+ optional uint64 TableId = 2;
optional uint64 SchemaVersion = 3;
-}
-
+}
+
message TReadTableTransaction {
message TColumn {
optional uint32 Id = 1;
@@ -295,15 +295,15 @@ message TSnapshotTransferInfo {
};
message TReceiveSnapshot {
- optional uint64 TableId_Deprecated = 1;
+ optional uint64 TableId_Deprecated = 1;
repeated TSnapshotTransferInfo ReceiveFrom = 2;
- optional TTableId TableId = 3;
+ optional TTableId TableId = 3;
}
message TSendSnapshot {
- optional uint64 TableId_Deprecated = 1;
+ optional uint64 TableId_Deprecated = 1;
repeated TSnapshotTransferInfo SendTo = 2;
- optional TTableId TableId = 3;
+ optional TTableId TableId = 3;
}
message TSchemeOpSeqNo {
@@ -324,44 +324,44 @@ message TDropPersistentSnapshot {
optional uint64 TxId = 4;
}
-message TInitiateBuildIndex {
+message TInitiateBuildIndex {
optional NKikimrProto.TPathID PathId = 1;
- optional string SnapshotName = 2;
+ optional string SnapshotName = 2;
optional uint64 TableSchemaVersion = 3;
-
- optional NKikimrSchemeOp.TIndexDescription IndexDescription = 4;
-}
-
-message TFinalizeBuildIndex {
+
+ optional NKikimrSchemeOp.TIndexDescription IndexDescription = 4;
+}
+
+message TFinalizeBuildIndex {
optional NKikimrProto.TPathID PathId = 1;
-
- optional uint64 SnapshotStep = 2;
- optional uint64 SnapshotTxId = 3;
-
- optional uint64 TableSchemaVersion = 4;
-
- optional uint64 BuildIndexId = 5;
-}
-
-message TDropIndexNotice {
+
+ optional uint64 SnapshotStep = 2;
+ optional uint64 SnapshotTxId = 3;
+
+ optional uint64 TableSchemaVersion = 4;
+
+ optional uint64 BuildIndexId = 5;
+}
+
+message TDropIndexNotice {
// Path id of the table that the index is being dropped from
optional NKikimrProto.TPathID PathId = 1;
optional uint64 TableSchemaVersion = 2;
-
+
// Path id of the index being dropped
optional NKikimrProto.TPathID IndexPathId = 3;
-}
-
+}
+
message TCreateCdcStreamNotice {
optional NKikimrProto.TPathID PathId = 1;
optional uint64 TableSchemaVersion = 2;
- optional NKikimrSchemeOp.TCdcStreamDescription StreamDescription = 3;
+ optional NKikimrSchemeOp.TCdcStreamDescription StreamDescription = 3;
}
message TAlterCdcStreamNotice {
optional NKikimrProto.TPathID PathId = 1;
optional uint64 TableSchemaVersion = 2;
- optional NKikimrSchemeOp.TCdcStreamDescription StreamDescription = 3;
+ optional NKikimrSchemeOp.TCdcStreamDescription StreamDescription = 3;
}
message TDropCdcStreamNotice {
@@ -373,45 +373,45 @@ message TDropCdcStreamNotice {
message TAsyncIndexInfo {
}
-message TMoveTable {
+message TMoveTable {
optional NKikimrProto.TPathID PathId = 1;
- optional uint64 TableSchemaVersion = 2;
-
+ optional uint64 TableSchemaVersion = 2;
+
optional NKikimrProto.TPathID DstPathId = 3;
- optional string DstPath = 4;
-
- message TRemapIndexPathId {
+ optional string DstPath = 4;
+
+ message TRemapIndexPathId {
optional NKikimrProto.TPathID PathId = 1;
optional NKikimrProto.TPathID DstPathId = 2;
- }
-
- repeated TRemapIndexPathId ReMapIndexes = 5;
-}
-
+ }
+
+ repeated TRemapIndexPathId ReMapIndexes = 5;
+}
+
message TFlatSchemeTransaction {
- optional NKikimrSchemeOp.TTableDescription CreateTable = 1;
- optional NKikimrSchemeOp.TTableDescription DropTable = 2;
- optional NKikimrSchemeOp.TTableDescription AlterTable = 3;
+ optional NKikimrSchemeOp.TTableDescription CreateTable = 1;
+ optional NKikimrSchemeOp.TTableDescription DropTable = 2;
+ optional NKikimrSchemeOp.TTableDescription AlterTable = 3;
optional TReceiveSnapshot ReceiveSnapshot = 4;
optional TSendSnapshot SendSnapshot = 5;
- optional NKikimrSchemeOp.TBackupTask Backup = 6;
+ optional NKikimrSchemeOp.TBackupTask Backup = 6;
optional TSchemeOpSeqNo SeqNo = 7;
optional bool ReadOnly = 8;
- reserved 9;
+ reserved 9;
optional TCreatePersistentSnapshot CreatePersistentSnapshot = 10;
optional TDropPersistentSnapshot DropPersistentSnapshot = 11;
-
- optional TInitiateBuildIndex InitiateBuildIndex = 12;
- optional TFinalizeBuildIndex FinalizeBuildIndex = 13;
- optional TDropIndexNotice DropIndexNotice = 14;
- optional NKikimrSchemeOp.TRestoreTask Restore = 15;
+ optional TInitiateBuildIndex InitiateBuildIndex = 12;
+ optional TFinalizeBuildIndex FinalizeBuildIndex = 13;
+ optional TDropIndexNotice DropIndexNotice = 14;
+
+ optional NKikimrSchemeOp.TRestoreTask Restore = 15;
optional TAsyncIndexInfo AsyncIndexInfo = 16;
-
- optional TMoveTable MoveTable = 17;
+
+ optional TMoveTable MoveTable = 17;
optional TCreateCdcStreamNotice CreateCdcStreamNotice = 18;
optional TAlterCdcStreamNotice AlterCdcStreamNotice = 19;
@@ -477,7 +477,7 @@ message TEvProposeTransaction {
optional uint32 ExecLevel = 5;
optional uint32 Flags = 6;
optional uint64 SchemeShardId = 7;
- optional NKikimrSubDomains.TProcessingParams ProcessingParams = 8;
+ optional NKikimrSubDomains.TProcessingParams ProcessingParams = 8;
optional uint64 SubDomainPathId = 9; // LocalPathId (SchemeShardId is the OwnerId)
optional TMvccSnapshot MvccSnapshot = 10;
}
@@ -574,7 +574,7 @@ message TEvProposeTransactionResult {
optional TTabletInfo TabletInfo = 19;
// For read table tx result holds offsets in TxResult to cut response
repeated uint32 RowOffsets = 20;
- repeated fixed64 DomainCoordinators = 21;
+ repeated fixed64 DomainCoordinators = 21;
optional uint32 ApiVersion = 22; // Version of TxResult response data
optional NKikimrQueryStats.TTxStats TxStats = 23;
optional uint64 DataSeqNo = 24; // Response data seqno (1, 2, ...)
@@ -629,10 +629,10 @@ message TSplitMergeDescription {
// Schemeshard -> Dst datashard
message TEvInitSplitMergeDestination {
optional uint64 OperationCookie = 1;
- optional uint64 SchemeshardTabletId = 2; // OwnerSchemeShardTabletId
+ optional uint64 SchemeshardTabletId = 2; // OwnerSchemeShardTabletId
optional TSplitMergeDescription SplitDescription = 3;
- optional NKikimrSubDomains.TProcessingParams ProcessingParams = 4;
- optional NKikimrSchemeOp.TTableDescription CreateTable = 5;
+ optional NKikimrSubDomains.TProcessingParams ProcessingParams = 4;
+ optional NKikimrSchemeOp.TTableDescription CreateTable = 5;
optional uint64 SubDomainPathId = 6; // LocalPathId (SchemeshardTabletId is the OwnerId)
}
@@ -653,7 +653,7 @@ message TEvSplitAck {
}
message TTableSnapshot {
- optional uint64 TableId = 1; // tableid in term of localDB
+ optional uint64 TableId = 1; // tableid in term of localDB
optional bytes SnapshotData = 2;
}
@@ -671,7 +671,7 @@ message TPersistentSnapshot {
message TEvSplitTransferSnapshot {
optional uint64 OperationCookie = 1;
optional uint64 SrcTabletId = 2;
- optional NKikimrSchemeOp.TTableDescription UserTableScheme = 3;
+ optional NKikimrSchemeOp.TTableDescription UserTableScheme = 3;
repeated TTableSnapshot TableSnapshot = 4;
optional uint64 MinWriteVersionStep = 5;
optional uint64 MinWriteVersionTxId = 6;
@@ -709,7 +709,7 @@ message TEvSplitPartitioningChangedAck {
message TEvCancelBackup {
optional uint64 BackupTxId = 1;
- optional uint64 TableId = 2;
+ optional uint64 TableId = 2;
}
message TEvCancelRestore {
@@ -726,19 +726,19 @@ message TEvGetTableStats {
message TEvGetTableStatsResult {
optional uint64 DatashardId = 1;
- optional uint64 TableLocalId = 2;
+ optional uint64 TableLocalId = 2;
optional NKikimrTableStats.TTableStats TableStats = 3;
optional NKikimrTabletBase.TMetrics TabletMetrics = 4;
optional uint32 ShardState = 5;
repeated uint64 UserTablePartOwners = 6;
repeated uint64 SysTablesPartOwners = 7;
optional bool FullStatsReady = 8;
- optional uint64 TableOwnerId = 9;
+ optional uint64 TableOwnerId = 9;
}
message TEvPeriodicTableStats {
optional uint64 DatashardId = 1;
- optional uint64 TableLocalId = 2;
+ optional uint64 TableLocalId = 2;
optional uint64 Generation = 3;
optional uint64 Round = 4;
@@ -752,8 +752,8 @@ message TEvPeriodicTableStats {
optional uint32 NodeId = 10;
optional uint64 StartTime = 11; // milliseconds since epoch
-
- optional uint64 TableOwnerId = 12;
+
+ optional uint64 TableOwnerId = 12;
}
message TEvS3ListingRequest {
@@ -855,7 +855,7 @@ message TEvGetInfoResponse {
optional string Path = 2;
optional uint32 LocalId = 3;
optional uint64 PathId = 4;
- optional NKikimrSchemeOp.TTableDescription Description = 5;
+ optional NKikimrSchemeOp.TTableDescription Description = 5;
optional TStats Stats = 6;
optional NKikimrTabletBase.TMetrics Metrics = 7;
optional uint64 SchemaVersion = 8;
@@ -1200,29 +1200,29 @@ message TEvDiscardVolatileSnapshotResponse {
optional EStatus Status = 6;
repeated uint64 TransferredToShards = 7;
}
-
-message TEvMigrateSchemeShardRequest {
- optional fixed64 CurrentSchemeShardId = 1;
- optional fixed64 NewSchemeShardId = 2;
- optional fixed64 TabletId = 3;
-}
-
-message TEvMigrateSchemeShardResponse {
- enum EStatus {
- Success = 1;
- Already = 2;
- WrongRequest = 3;
- }
-
- optional EStatus Status = 1;
- optional fixed64 TabletId = 2;
-}
-
+
+message TEvMigrateSchemeShardRequest {
+ optional fixed64 CurrentSchemeShardId = 1;
+ optional fixed64 NewSchemeShardId = 2;
+ optional fixed64 TabletId = 3;
+}
+
+message TEvMigrateSchemeShardResponse {
+ enum EStatus {
+ Success = 1;
+ Already = 2;
+ WrongRequest = 3;
+ }
+
+ optional EStatus Status = 1;
+ optional fixed64 TabletId = 2;
+}
+
message TExpirationCondition {
// erase if valueof(ColumnId) < WallClockTimestamp
optional uint32 ColumnId = 1; // Must contain date type
optional uint64 WallClockTimestamp = 2;
- optional NKikimrSchemeOp.TTTLSettings.EUnit ColumnUnit = 3;
+ optional NKikimrSchemeOp.TTTLSettings.EUnit ColumnUnit = 3;
}
message TEvEraseRowsRequest {
@@ -1314,65 +1314,65 @@ message TEvConditionalEraseRowsResponse {
optional string ErrorDescription = 3;
optional TStats Stats = 4;
}
-
-message TEvBuildIndexCreateRequest {
- optional uint64 BuildIndexId = 1; // unique id of build index proccess
-
- optional uint64 TabletId = 2;
- optional uint64 OwnerId = 3;
- optional uint64 PathId = 4;
-
- optional string TargetName = 5;
+
+message TEvBuildIndexCreateRequest {
+ optional uint64 BuildIndexId = 1; // unique id of build index proccess
+
+ optional uint64 TabletId = 2;
+ optional uint64 OwnerId = 3;
+ optional uint64 PathId = 4;
+
+ optional string TargetName = 5;
repeated string IndexColumns = 6; // key columns that is needed to transer in terms of target table
-
- optional NKikimrTx.TKeyRange KeyRange = 7; // key range to transfer in term of source table
-
- optional uint64 SnapshotTxId = 8;
- optional uint64 SnapshotStep = 9;
-
- optional uint32 MaxBatchRows = 10;
- optional uint64 MaxBatchBytes = 11;
-
- optional uint64 SeqNoGeneration = 12; // monotonically increasing sequence, first part
- optional uint64 SeqNoRound = 13; // monotonically increasing sequence, second part
-
- optional uint64 MaxRetries = 14;
+
+ optional NKikimrTx.TKeyRange KeyRange = 7; // key range to transfer in term of source table
+
+ optional uint64 SnapshotTxId = 8;
+ optional uint64 SnapshotStep = 9;
+
+ optional uint32 MaxBatchRows = 10;
+ optional uint64 MaxBatchBytes = 11;
+
+ optional uint64 SeqNoGeneration = 12; // monotonically increasing sequence, first part
+ optional uint64 SeqNoRound = 13; // monotonically increasing sequence, second part
+
+ optional uint64 MaxRetries = 14;
repeated string DataColumns = 15;
-}
-
-message TEvBuildIndexProgressResponse {
- optional uint64 BuildIndexId = 1;
-
- optional uint64 TabletId = 2;
- optional uint64 OwnerId = 3;
- optional uint64 PathId = 4;
-
- enum EStatus {
- INVALID = 0;
- ACCEPTED = 1;
- INPROGRESS = 2;
- DONE = 3;
-
- ABORTED = 4;
- BUILD_ERROR = 5;
- BAD_REQUEST = 6;
- }
-
- optional EStatus Status = 5;
-
- optional Ydb.StatusIds.StatusCode UploadStatus = 6;
- repeated Ydb.Issue.IssueMessage Issues = 7;
-
- optional NKikimrTx.TKeyRange RequestedKeyRange = 8;
- optional bytes LastKeyAck = 9;
-
- optional uint64 RowsDelta = 10;
- optional uint64 BytesDelta = 11;
-
- optional uint64 RequestSeqNoGeneration = 12;
- optional uint64 RequestSeqNoRound = 13;
-}
+}
+
+message TEvBuildIndexProgressResponse {
+ optional uint64 BuildIndexId = 1;
+
+ optional uint64 TabletId = 2;
+ optional uint64 OwnerId = 3;
+ optional uint64 PathId = 4;
+
+ enum EStatus {
+ INVALID = 0;
+ ACCEPTED = 1;
+ INPROGRESS = 2;
+ DONE = 3;
+
+ ABORTED = 4;
+ BUILD_ERROR = 5;
+ BAD_REQUEST = 6;
+ }
+
+ optional EStatus Status = 5;
+
+ optional Ydb.StatusIds.StatusCode UploadStatus = 6;
+ repeated Ydb.Issue.IssueMessage Issues = 7;
+
+ optional NKikimrTx.TKeyRange RequestedKeyRange = 8;
+ optional bytes LastKeyAck = 9;
+
+ optional uint64 RowsDelta = 10;
+ optional uint64 BytesDelta = 11;
+
+ optional uint64 RequestSeqNoGeneration = 12;
+ optional uint64 RequestSeqNoRound = 13;
+}
message TEvKqpScan {
optional uint64 TxId = 1;
diff --git a/ydb/core/protos/tx_proxy.proto b/ydb/core/protos/tx_proxy.proto
index 277196b7158..dedd2f9cbb5 100644
--- a/ydb/core/protos/tx_proxy.proto
+++ b/ydb/core/protos/tx_proxy.proto
@@ -173,8 +173,8 @@ message TTransaction {
optional uint32 Flags = 6; // See ydb/core/tx/tx_datashard.h NKikimr::NTxDataShard::TTxFlags
optional string UserRequestId = 8;
- optional NKikimrSchemeOp.TModifyScheme ModifyScheme = 10;
- repeated NKikimrSchemeOp.TModifyScheme TransactionalModification = 11;
+ optional NKikimrSchemeOp.TModifyScheme ModifyScheme = 10;
+ repeated NKikimrSchemeOp.TModifyScheme TransactionalModification = 11;
optional TReadTableTransaction ReadTableTransaction = 20;
@@ -251,7 +251,7 @@ message TEvNavigate {
reserved 3; // optional bytes TextPath = 3;
reserved 4; // optional uint64 SchemeShardHint = 4;
- optional NKikimrSchemeOp.TDescribePath DescribePath = 5;
+ optional NKikimrSchemeOp.TDescribePath DescribePath = 5;
optional string UserToken = 6; // already built and serialized user's token
optional string DatabaseName = 7;
@@ -267,7 +267,7 @@ message TEvNavigateStatus_Deprecated {
optional uint32 SchemeShardStatus = 30;
optional uint32 SchemeShardReportedId = 31;
- optional NKikimrSchemeOp.TPathDescription PathDescription = 40;
+ optional NKikimrSchemeOp.TPathDescription PathDescription = 40;
}
message TEvInvalidateTable {
diff --git a/ydb/core/protos/ya.make b/ydb/core/protos/ya.make
index c3e54e1ec2c..70bb65514cd 100644
--- a/ydb/core/protos/ya.make
+++ b/ydb/core/protos/ya.make
@@ -15,7 +15,7 @@ ENDIF()
SRCS(
alloc.proto
base.proto
- bind_channel_storage_pool.proto
+ bind_channel_storage_pool.proto
blobstorage.proto
blobstorage_controller.proto
blobstorage_disk.proto
@@ -28,7 +28,7 @@ SRCS(
filestore_config.proto
bootstrapper.proto
change_exchange.proto
- channel_purpose.proto
+ channel_purpose.proto
cms.proto
config.proto
config_units.proto
@@ -36,7 +36,7 @@ SRCS(
console_base.proto
console_config.proto
console_tenant.proto
- counters_tx_allocator.proto
+ counters_tx_allocator.proto
counters_bs_controller.proto
counters_coordinator.proto
counters_columnshard.proto
@@ -52,7 +52,7 @@ SRCS(
counters_sysview_processor.proto
counters_testshard.proto
counters_tx_proxy.proto
- counters_mediator.proto
+ counters_mediator.proto
counters.proto
database_basic_sausage_metainfo.proto
drivemodel.proto
@@ -63,7 +63,7 @@ SRCS(
hive.proto
http_config.proto
import.proto
- index_builder.proto
+ index_builder.proto
issue_id.proto
kesus.proto
kqp_query_settings.proto
@@ -96,7 +96,7 @@ SRCS(
ssa.proto
statestorage.proto
stream.proto
- subdomains.proto
+ subdomains.proto
table_stats.proto
tablet.proto
tablet_counters_aggregator.proto
diff --git a/ydb/core/scheme/scheme_tabledefs.h b/ydb/core/scheme/scheme_tabledefs.h
index 0f17b44e9e6..190233fdeee 100644
--- a/ydb/core/scheme/scheme_tabledefs.h
+++ b/ydb/core/scheme/scheme_tabledefs.h
@@ -562,8 +562,8 @@ private:
};
struct TSecurityObject : TAtomicRefCount<TSecurityObject>, NACLib::TSecurityObject {
- using TPtr = TIntrusivePtr<TSecurityObject>;
-
+ using TPtr = TIntrusivePtr<TSecurityObject>;
+
static NACLib::TSecurityObject FromByteStream(const NACLibProto::TSecurityObject* parent, const TString& owner, const TString& acl, bool isContainer) {
NACLib::TSecurityObject object(owner, isContainer);
Y_VERIFY(object.MutableACL()->ParseFromString(acl));
diff --git a/ydb/core/security/secure_request.h b/ydb/core/security/secure_request.h
index a6cf4fc2611..04e276a8971 100644
--- a/ydb/core/security/secure_request.h
+++ b/ydb/core/security/secure_request.h
@@ -129,10 +129,10 @@ public:
}
public:
- bool IsTokenRequired() const {
- return GetEnforceUserTokenRequirement() || (RequireAdminAccess && !GetAdministrationAllowedSIDs().empty());
- }
-
+ bool IsTokenRequired() const {
+ return GetEnforceUserTokenRequirement() || (RequireAdminAccess && !GetAdministrationAllowedSIDs().empty());
+ }
+
void Bootstrap(const TActorContext& ctx) {
if (IsTokenRequired() && !IsTokenExists()) {
return static_cast<TDerived*>(this)->OnAccessDenied(TEvTicketParser::TError{"Access denied without user token", false}, ctx);
diff --git a/ydb/core/tablet/resource_broker.cpp b/ydb/core/tablet/resource_broker.cpp
index ac4238a51f4..fff30b26010 100644
--- a/ydb/core/tablet/resource_broker.cpp
+++ b/ydb/core/tablet/resource_broker.cpp
@@ -1335,11 +1335,11 @@ NKikimrResourceBroker::TResourceBrokerConfig MakeDefaultConfig()
queue->MutableLimit()->SetCpu(KqpRmQueueCPU);
queue->MutableLimit()->SetMemory(KqpRmQueueMemory);
- queue = config.AddQueues();
- queue->SetName("queue_build_index");
- queue->SetWeight(100);
+ queue = config.AddQueues();
+ queue->SetName("queue_build_index");
+ queue->SetWeight(100);
queue->MutableLimit()->SetCpu(10);
-
+
auto task = config.AddTasks();
task->SetName(NLocalDb::UnknownTaskName);
task->SetQueueName(NLocalDb::DefaultQueueName);
@@ -1420,11 +1420,11 @@ NKikimrResourceBroker::TResourceBrokerConfig MakeDefaultConfig()
task->SetQueueName(NLocalDb::KqpResourceManagerQueue);
task->SetDefaultDuration(TDuration::Minutes(10).GetValue());
- task = config.AddTasks();
- task->SetName("build_index");
- task->SetQueueName("queue_build_index");
- task->SetDefaultDuration(TDuration::Minutes(10).GetValue());
-
+ task = config.AddTasks();
+ task->SetName("build_index");
+ task->SetQueueName("queue_build_index");
+ task->SetDefaultDuration(TDuration::Minutes(10).GetValue());
+
config.MutableResourceLimit()->SetCpu(TotalCPU);
config.MutableResourceLimit()->SetMemory(TotalMemory);
diff --git a/ydb/core/tablet/tablet_counters.h b/ydb/core/tablet/tablet_counters.h
index ae3571eb46e..a8cc27e9eda 100644
--- a/ydb/core/tablet/tablet_counters.h
+++ b/ydb/core/tablet/tablet_counters.h
@@ -58,29 +58,29 @@ public:
Value = value;
return *this;
}
-
+
TTabletSimpleCounter& Add(ui64 delta) {
Value += delta;
return *this;
}
-
- TTabletSimpleCounter& Sub(ui64 delta) {
- Value -= delta;
- return *this;
- }
-
+
+ TTabletSimpleCounter& Sub(ui64 delta) {
+ Value -= delta;
+ return *this;
+ }
+
TTabletSimpleCounter& operator = (ui64 value) {
return Set(value);
}
- TTabletSimpleCounter& operator += (ui64 delta) {
- return Add(delta);
- }
-
- TTabletSimpleCounter& operator -= (ui64 delta) {
- return Sub(delta);
- }
-
+ TTabletSimpleCounter& operator += (ui64 delta) {
+ return Add(delta);
+ }
+
+ TTabletSimpleCounter& operator -= (ui64 delta) {
+ return Sub(delta);
+ }
+
private:
//
void Initialize(const TTabletSimpleCounter& rp) {
diff --git a/ydb/core/tablet/tablet_counters_aggregator.cpp b/ydb/core/tablet/tablet_counters_aggregator.cpp
index 8ae602ad867..1885b26e09c 100644
--- a/ydb/core/tablet/tablet_counters_aggregator.cpp
+++ b/ydb/core/tablet/tablet_counters_aggregator.cpp
@@ -1210,8 +1210,8 @@ private:
TCounterPtr ScanBytes;
TCounterPtr DatashardRowCount;
TCounterPtr DatashardSizeBytes;
- TCounterPtr ResourcesStorageUsedBytes;
- TCounterPtr ResourcesStorageLimitBytes;
+ TCounterPtr ResourcesStorageUsedBytes;
+ TCounterPtr ResourcesStorageLimitBytes;
TCounterPtr ResourcesStreamUsedShards;
TCounterPtr ResourcesStreamLimitShards;
//TCounterPtr ResourcesStreamUsedShardsPercents;
@@ -1237,9 +1237,9 @@ private:
TCounterPtr DbUniqueDataBytes;
THistogramPtr ConsumedCpuHistogram;
- TCounterPtr DiskSpaceTablesTotalBytes;
- TCounterPtr DiskSpaceSoftQuotaBytes;
-
+ TCounterPtr DiskSpaceTablesTotalBytes;
+ TCounterPtr DiskSpaceSoftQuotaBytes;
+
TCounterPtr StreamShardsCount;
TCounterPtr StreamShardsQuota;
TCounterPtr StreamReservedThroughput;
@@ -1274,11 +1274,11 @@ private:
"table.datashard.row_count", false);
DatashardSizeBytes = ydbGroup->GetNamedCounter("name",
"table.datashard.size_bytes", false);
-
- ResourcesStorageUsedBytes = ydbGroup->GetNamedCounter("name",
- "resources.storage.used_bytes", false);
- ResourcesStorageLimitBytes = ydbGroup->GetNamedCounter("name",
- "resources.storage.limit_bytes", false);
+
+ ResourcesStorageUsedBytes = ydbGroup->GetNamedCounter("name",
+ "resources.storage.used_bytes", false);
+ ResourcesStorageLimitBytes = ydbGroup->GetNamedCounter("name",
+ "resources.storage.limit_bytes", false);
ResourcesStreamUsedShards = ydbGroup->GetNamedCounter("name",
"resources.stream.used_shards", false);
@@ -1331,16 +1331,16 @@ private:
DbUniqueDataBytes = execGroup->GetCounter("SUM(DbUniqueDataBytes)");
ConsumedCpuHistogram = execGroup->FindHistogram("HIST(ConsumedCPU)");
}
-
- auto schemeshard = FindCountersByTabletType(
- TTabletTypes::FLAT_SCHEMESHARD, countersByTabletType);
-
- if (schemeshard && !DiskSpaceTablesTotalBytes) {
- auto schemeshardGroup = counters->GetSubgroup("type", "SchemeShard");
- auto appGroup = schemeshardGroup->GetSubgroup("category", "app");
-
- DiskSpaceTablesTotalBytes = appGroup->GetCounter("SUM(SchemeShard/DiskSpaceTablesTotalBytes)");
- DiskSpaceSoftQuotaBytes = appGroup->GetCounter("SUM(SchemeShard/DiskSpaceSoftQuotaBytes)");
+
+ auto schemeshard = FindCountersByTabletType(
+ TTabletTypes::FLAT_SCHEMESHARD, countersByTabletType);
+
+ if (schemeshard && !DiskSpaceTablesTotalBytes) {
+ auto schemeshardGroup = counters->GetSubgroup("type", "SchemeShard");
+ auto appGroup = schemeshardGroup->GetSubgroup("category", "app");
+
+ DiskSpaceTablesTotalBytes = appGroup->GetCounter("SUM(SchemeShard/DiskSpaceTablesTotalBytes)");
+ DiskSpaceSoftQuotaBytes = appGroup->GetCounter("SUM(SchemeShard/DiskSpaceSoftQuotaBytes)");
StreamShardsCount = appGroup->GetCounter("SUM(SchemeShard/StreamShardsCount)");
StreamShardsQuota = appGroup->GetCounter("SUM(SchemeShard/StreamShardsQuota)");
@@ -1348,7 +1348,7 @@ private:
StreamReservedStorage = appGroup->GetCounter("SUM(SchemeShard/StreamReservedStorage)");
StreamReservedStorageLimit = appGroup->GetCounter("SUM(SchemeShard/StreamReservedStorageQuota)");
- }
+ }
}
void Transform() {
@@ -1370,8 +1370,8 @@ private:
TransferBuckets(ShardCpuUtilization, ConsumedCpuHistogram);
}
}
-
- if (DiskSpaceTablesTotalBytes) {
+
+ if (DiskSpaceTablesTotalBytes) {
ResourcesStorageUsedBytes->Set(DiskSpaceTablesTotalBytes->Val());
ResourcesStorageLimitBytes->Set(DiskSpaceSoftQuotaBytes->Val());
@@ -1387,7 +1387,7 @@ private:
ResourcesStreamReservedThroughput->Set(StreamReservedThroughput->Val());
ResourcesStreamReservedStorage->Set(StreamReservedStorage->Val());
ResourcesStreamReservedStorageLimit->Set(StreamReservedStorageLimit->Val());
- }
+ }
}
void TransferBuckets(THistogramPtr dst, THistogramPtr src) {
diff --git a/ydb/core/tablet/tablet_counters_app.cpp b/ydb/core/tablet/tablet_counters_app.cpp
index 44642f46f27..bfed7ffd13c 100644
--- a/ydb/core/tablet/tablet_counters_app.cpp
+++ b/ydb/core/tablet/tablet_counters_app.cpp
@@ -13,9 +13,9 @@ THolder<TTabletCountersBase> CreateAppCountersByTabletType(TTabletTypes::EType t
switch (type) {
case TTabletTypes::SchemeShard:
return MakeHolder<TAppProtobufTabletCounters<
- NSchemeShard::ESimpleCounters_descriptor,
- NSchemeShard::ECumulativeCounters_descriptor,
- NSchemeShard::EPercentileCounters_descriptor
+ NSchemeShard::ESimpleCounters_descriptor,
+ NSchemeShard::ECumulativeCounters_descriptor,
+ NSchemeShard::EPercentileCounters_descriptor
>>();
case TTabletTypes::DataShard:
return MakeHolder<TAppProtobufTabletCounters<
diff --git a/ydb/core/tablet/tablet_monitoring_proxy.cpp b/ydb/core/tablet/tablet_monitoring_proxy.cpp
index 7346e918146..a61a43b7e5c 100644
--- a/ydb/core/tablet/tablet_monitoring_proxy.cpp
+++ b/ydb/core/tablet/tablet_monitoring_proxy.cpp
@@ -256,7 +256,7 @@ TTabletMonitoringProxyActor::Handle(NMon::TEvHttpInfo::TPtr &ev, const TActorCon
TABLEBODY() {
if (const ui64 schemeRootTabletId = di.second->SchemeRoot) {
TABLER() {
- TABLED() {str << "<a href=\"tablets?TabletID=" << schemeRootTabletId << "\">SCHEMESHARD</a>";}
+ TABLED() {str << "<a href=\"tablets?TabletID=" << schemeRootTabletId << "\">SCHEMESHARD</a>";}
TABLED() {str << schemeRootTabletId;}
TABLED() {str << " <a href=\"tablets?SsId="
<< schemeRootTabletId << "\">"
@@ -336,7 +336,7 @@ TTabletMonitoringProxyActor::Handle(NMon::TEvHttpInfo::TPtr &ev, const TActorCon
TABLED() {str << "<a href='tablets?KillTabletID=" << tabletId << "'><span class='glyphicon glyphicon-remove' title='Kill Tablet'/></a>";}
}
}
- for (auto tabletId : di.second->Coordinators) {
+ for (auto tabletId : di.second->Coordinators) {
TABLER() {
TABLED() {str << "<a href=\"tablets?TabletID=" << tabletId << "\">TX_COORDINATOR</a>";}
TABLED() {str << tabletId;}
@@ -348,7 +348,7 @@ TTabletMonitoringProxyActor::Handle(NMon::TEvHttpInfo::TPtr &ev, const TActorCon
TABLED() {str << "<a href='tablets?KillTabletID=" << tabletId << "'><span class='glyphicon glyphicon-remove' title='Kill Tablet'/></a>";}
}
}
- for (auto tabletId : di.second->Mediators) {
+ for (auto tabletId : di.second->Mediators) {
TABLER() {
TABLED() {str << "<a href=\"tablets?TabletID=" << tabletId << "\">TX_MEDIATOR</a>";}
TABLED() {str << tabletId;}
@@ -360,9 +360,9 @@ TTabletMonitoringProxyActor::Handle(NMon::TEvHttpInfo::TPtr &ev, const TActorCon
TABLED() {str << "<a href='tablets?KillTabletID=" << tabletId << "'><span class='glyphicon glyphicon-remove' title='Kill Tablet'/></a>";}
}
}
- for (auto tabletId : di.second->TxAllocators) {
+ for (auto tabletId : di.second->TxAllocators) {
TABLER() {
- TABLED() {str << "<a href=\"tablets?TabletID=" << tabletId << "\">TX_ALLOCATOR</a>";}
+ TABLED() {str << "<a href=\"tablets?TabletID=" << tabletId << "\">TX_ALLOCATOR</a>";}
TABLED() {str << tabletId;}
TABLED() {str << " <a href=\"tablets?SsId="
<< tabletId << "\">"
diff --git a/ydb/core/tablet/tablet_pipe_client.cpp b/ydb/core/tablet/tablet_pipe_client.cpp
index 63c5e8e5d6b..2fa35af9a0e 100644
--- a/ydb/core/tablet/tablet_pipe_client.cpp
+++ b/ydb/core/tablet/tablet_pipe_client.cpp
@@ -451,7 +451,7 @@ namespace NTabletPipe {
void NotifyConnectFail(const TActorContext &ctx) {
UnsubscribeNetworkSession(ctx);
- if (Config.CheckAliveness && !IsReservedTabletId(TabletId)) {
+ if (Config.CheckAliveness && !IsReservedTabletId(TabletId)) {
BLOG_D("connect failed, check aliveness");
if (!Config.RetryPolicy)
diff --git a/ydb/core/tablet/tablet_pipe_client_cache.cpp b/ydb/core/tablet/tablet_pipe_client_cache.cpp
index 1396d7bd345..47b81e45681 100644
--- a/ydb/core/tablet/tablet_pipe_client_cache.cpp
+++ b/ydb/core/tablet/tablet_pipe_client_cache.cpp
@@ -36,8 +36,8 @@ namespace NTabletPipe {
class TClientCache : public IClientCache {
public:
TClientCache(const TClientConfig& config, TAutoPtr<IClientCacheContainer> container, TAutoPtr<IClientCacheContainer> poolContainer, IClientFactory::TPtr pipeFactory)
- : PipeClientConfig(config)
- , Container(container)
+ : PipeClientConfig(config)
+ , Container(container)
, PoolContainer(poolContainer)
, ActorSystem(nullptr)
, PipeFactory(std::move(pipeFactory))
@@ -99,13 +99,13 @@ namespace NTabletPipe {
}
TActorId Send(const TActorContext& ctx, ui64 tabletId, IEventBase* payload, ui64 cookie) override {
- auto clientId = Prepare(ctx, tabletId);
+ auto clientId = Prepare(ctx, tabletId);
SendData(ctx, clientId, payload, cookie);
return clientId;
}
TActorId Send(const TActorContext& ctx, ui64 tabletId, ui32 eventType, const TIntrusivePtr<TEventSerializedData>& eventBuffer, ui64 cookie) override {
- auto clientId = Prepare(ctx, tabletId);
+ auto clientId = Prepare(ctx, tabletId);
SendData(ctx, clientId, eventType, eventBuffer, cookie);
return clientId;
}
@@ -206,7 +206,7 @@ namespace NTabletPipe {
}
private:
- TClientConfig PipeClientConfig;
+ TClientConfig PipeClientConfig;
TAutoPtr<IClientCacheContainer> Container;
TAutoPtr<IClientCacheContainer> PoolContainer;
@@ -225,7 +225,7 @@ namespace NTabletPipe {
TIntrusivePtr<NCache::T2QCacheConfig> poolContainerConfig(new NCache::T2QCacheConfig);
TAutoPtr<IClientCacheContainer> poolContainer(new NCache::T2QCache<ui64, TClientCacheEntry>(poolContainerConfig));
poolContainer->SetOverflowCallback([=](const IClientCacheContainer& cache) {
- return cache.GetUsedSize() >= cacheConfig->ClientPoolLimit;
+ return cache.GetUsedSize() >= cacheConfig->ClientPoolLimit;
});
return new TClientCache(pipeConfig, container, poolContainer, std::move(pipeFactory));
diff --git a/ydb/core/tablet/tablet_pipe_client_cache.h b/ydb/core/tablet/tablet_pipe_client_cache.h
index b736c761bff..a6548c20e95 100644
--- a/ydb/core/tablet/tablet_pipe_client_cache.h
+++ b/ydb/core/tablet/tablet_pipe_client_cache.h
@@ -35,7 +35,7 @@ namespace NTabletPipe {
};
IClientCache* CreateUnboundedClientCache(const TClientConfig& pipeConfig = TClientConfig(), IClientFactory::TPtr pipeFactory = nullptr);
-
+
struct TBoundedClientCacheConfig : public TThrRefBase {
ui64 ClientPoolLimit;
diff --git a/ydb/core/tablet/tablet_req_blockbs.cpp b/ydb/core/tablet/tablet_req_blockbs.cpp
index 35ab970c898..7e2e94ec95d 100644
--- a/ydb/core/tablet/tablet_req_blockbs.cpp
+++ b/ydb/core/tablet/tablet_req_blockbs.cpp
@@ -38,7 +38,7 @@ class TTabletReqBlockBlobStorageGroup : public TActorBootstrapped<TTabletReqBloc
return ReplyAndDie(NKikimrProto::OK);
case NKikimrProto::BLOCKED:
case NKikimrProto::RACE:
- case NKikimrProto::NO_GROUP:
+ case NKikimrProto::NO_GROUP:
// The request will never succeed
return ReplyAndDie(msg->Status, msg->ErrorReason);
default:
diff --git a/ydb/core/tablet/tablet_req_delete.cpp b/ydb/core/tablet/tablet_req_delete.cpp
index fc90597b4ec..754c79bb325 100644
--- a/ydb/core/tablet/tablet_req_delete.cpp
+++ b/ydb/core/tablet/tablet_req_delete.cpp
@@ -78,7 +78,7 @@ class TTabletReqDelete : public TActorBootstrapped<TTabletReqDelete> {
switch (msg->Status) {
case NKikimrProto::OK:
case NKikimrProto::ALREADY:
- case NKikimrProto::NO_GROUP:
+ case NKikimrProto::NO_GROUP:
++FinishedRequests;
if (FinishedRequests >= Requests.size()) {
if (Generation == std::numeric_limits<ui32>::max()) {
diff --git a/ydb/core/tablet/tablet_req_findlatest.cpp b/ydb/core/tablet/tablet_req_findlatest.cpp
index f01fca6c8a3..ca3d09aa432 100644
--- a/ydb/core/tablet/tablet_req_findlatest.cpp
+++ b/ydb/core/tablet/tablet_req_findlatest.cpp
@@ -58,12 +58,12 @@ class TTabletReqFindLatestLogEntry : public TActorBootstrapped<TTabletReqFindLat
case NKikimrProto::RACE:
case NKikimrProto::ERROR:
case NKikimrProto::TIMEOUT:
- case NKikimrProto::NO_GROUP:
+ case NKikimrProto::NO_GROUP:
BLOG_ERROR("Handle::TEvDiscoverResult, result status " << NKikimrProto::EReplyStatus_Name(msg->Status));
return ReplyAndDie(msg->Status, msg->ErrorReason);
default:
- Y_VERIFY(false, "default case status %s", NKikimrProto::EReplyStatus_Name(msg->Status).c_str());
-
+ Y_VERIFY(false, "default case status %s", NKikimrProto::EReplyStatus_Name(msg->Status).c_str());
+
return ReplyAndDie(NKikimrProto::ERROR, msg->ErrorReason);
}
}
diff --git a/ydb/core/tablet/tablet_req_rebuildhistory.cpp b/ydb/core/tablet/tablet_req_rebuildhistory.cpp
index ca2e73117d0..c0b4c0c2bc1 100644
--- a/ydb/core/tablet/tablet_req_rebuildhistory.cpp
+++ b/ydb/core/tablet/tablet_req_rebuildhistory.cpp
@@ -804,7 +804,7 @@ class TTabletReqRebuildHistoryGraph : public TActorBootstrapped<TTabletReqRebuil
}
return ProcessKeyEntry(msg->Latest, msg->Buffer);
- case NKikimrProto::RACE:
+ case NKikimrProto::RACE:
case NKikimrProto::NODATA:
return ReplyAndDie(msg->Status, msg->ErrorReason); // valid condition, nothing known in blob-storage
default:
diff --git a/ydb/core/tablet/tablet_sys.cpp b/ydb/core/tablet/tablet_sys.cpp
index c9c9af96e6b..44bfac7b2d6 100644
--- a/ydb/core/tablet/tablet_sys.cpp
+++ b/ydb/core/tablet/tablet_sys.cpp
@@ -1253,7 +1253,7 @@ void TTablet::Handle(TEvBlobStorage::TEvCollectGarbageResult::TPtr &ev) {
switch (msg->Status) {
case NKikimrProto::RACE:
case NKikimrProto::BLOCKED:
- case NKikimrProto::NO_GROUP:
+ case NKikimrProto::NO_GROUP:
// We want to stop after current graph is committed
if (BlobStorageStatus == NKikimrProto::OK) {
BlobStorageStatus = msg->Status;
diff --git a/ydb/core/tablet_flat/flat_boot_switch.h b/ydb/core/tablet_flat/flat_boot_switch.h
index 4258d874295..6442b82f0bb 100644
--- a/ydb/core/tablet_flat/flat_boot_switch.h
+++ b/ydb/core/tablet_flat/flat_boot_switch.h
@@ -51,7 +51,7 @@ namespace NBoot {
};
struct TCompactionChanges {
- NKikimrSchemeOp::ECompactionStrategy Strategy = NKikimrSchemeOp::CompactionStrategyUnset;
+ NKikimrSchemeOp::ECompactionStrategy Strategy = NKikimrSchemeOp::CompactionStrategyUnset;
THashMap<ui64, TString> KeyValues;
};
diff --git a/ydb/core/tablet_flat/flat_boot_turns.h b/ydb/core/tablet_flat/flat_boot_turns.h
index b11a7de4f9e..7730e9cbb91 100644
--- a/ydb/core/tablet_flat/flat_boot_turns.h
+++ b/ydb/core/tablet_flat/flat_boot_turns.h
@@ -204,7 +204,7 @@ namespace NBoot {
auto &snapshot = compaction->Snapshots[front.Table];
// N.B.: schema is reflected first during commit
- if (front.CompactionChanges.Strategy != NKikimrSchemeOp::CompactionStrategyUnset &&
+ if (front.CompactionChanges.Strategy != NKikimrSchemeOp::CompactionStrategyUnset &&
front.CompactionChanges.Strategy != snapshot.Strategy)
{
snapshot.State.PartLevels.clear();
diff --git a/ydb/core/tablet_flat/flat_cxx_database.h b/ydb/core/tablet_flat/flat_cxx_database.h
index d8e05ed1f21..27a260bcb27 100644
--- a/ydb/core/tablet_flat/flat_cxx_database.h
+++ b/ydb/core/tablet_flat/flat_cxx_database.h
@@ -1847,9 +1847,9 @@ struct Schema {
template <typename Type, typename... Types>
struct SchemaTables: SchemaTables<Types...> {
- static bool Precharge(TToughDb& database) {
- return SchemaTables<Type>::Precharge(database) & SchemaTables<Types...>::Precharge(database);
- }
+ static bool Precharge(TToughDb& database) {
+ return SchemaTables<Type>::Precharge(database) & SchemaTables<Types...>::Precharge(database);
+ }
static void Materialize(TToughDb& database, EMaterializationMode mode = EMaterializationMode::All) {
SchemaTables<Type>::Materialize(database, mode);
@@ -1872,10 +1872,10 @@ struct Schema {
return typeName.substr(typeName.rfind(':') + 1);
}
- static bool Precharge(TToughDb& database) {
- return typename Type::TKey::template Selector<Type>(database).Precharge();
- }
-
+ static bool Precharge(TToughDb& database) {
+ return typename Type::TKey::template Selector<Type>(database).Precharge();
+ }
+
static void Materialize(TToughDb& database, EMaterializationMode mode = EMaterializationMode::All) {
switch (mode) {
case EMaterializationMode::All:
@@ -1948,11 +1948,11 @@ public:
}
template <typename SchemaType>
- bool Precharge() {
- return SchemaType::TTables::Precharge(Database);
- }
-
- template <typename SchemaType>
+ bool Precharge() {
+ return SchemaType::TTables::Precharge(Database);
+ }
+
+ template <typename SchemaType>
void Materialize() {
SchemaType::TSettings::Materialize(Database);
SchemaType::TTables::Materialize(Database, EMaterializationMode::All);
diff --git a/ydb/core/tablet_flat/flat_dbase_apply.cpp b/ydb/core/tablet_flat/flat_dbase_apply.cpp
index 94a69e947fc..f87b315d332 100644
--- a/ydb/core/tablet_flat/flat_dbase_apply.cpp
+++ b/ydb/core/tablet_flat/flat_dbase_apply.cpp
@@ -265,7 +265,7 @@ bool TSchemeModifier::SetExecutorResourceProfile(const TString &name)
return std::exchange(Scheme.Executor.ResourceProfile, name) != name;
}
-bool TSchemeModifier::SetCompactionPolicy(ui32 tid, const NKikimrSchemeOp::TCompactionPolicy &proto)
+bool TSchemeModifier::SetCompactionPolicy(ui32 tid, const NKikimrSchemeOp::TCompactionPolicy &proto)
{
auto *table = Table(tid);
TIntrusiveConstPtr<TCompactionPolicy> policy(new TCompactionPolicy(proto));
diff --git a/ydb/core/tablet_flat/flat_dbase_apply.h b/ydb/core/tablet_flat/flat_dbase_apply.h
index d0df2215d3b..3502030b71b 100644
--- a/ydb/core/tablet_flat/flat_dbase_apply.h
+++ b/ydb/core/tablet_flat/flat_dbase_apply.h
@@ -43,7 +43,7 @@ namespace NTable {
bool SetExecutorLogFlushPeriod(TDuration flushPeriod);
bool SetExecutorLimitInFlyTx(ui32 limitTxInFly);
bool SetExecutorResourceProfile(const TString &name);
- bool SetCompactionPolicy(ui32 tableId, const NKikimrSchemeOp::TCompactionPolicy& newPolicy);
+ bool SetCompactionPolicy(ui32 tableId, const NKikimrSchemeOp::TCompactionPolicy& newPolicy);
TTable* Table(ui32 tid) const noexcept
{
diff --git a/ydb/core/tablet_flat/flat_dbase_scheme.cpp b/ydb/core/tablet_flat/flat_dbase_scheme.cpp
index 5f0070e34b2..fa12005009b 100644
--- a/ydb/core/tablet_flat/flat_dbase_scheme.cpp
+++ b/ydb/core/tablet_flat/flat_dbase_scheme.cpp
@@ -22,7 +22,7 @@ TAutoPtr<TSchemeChanges> TScheme::GetSnapshot() const {
delta.AddFamily(table, it.first, family.Room);
delta.SetFamily(table, it.first, family.Cache, family.Codec);
- delta.SetFamilyBlobs(table, it.first, family.Small, family.Large);
+ delta.SetFamilyBlobs(table, it.first, family.Small, family.Large);
}
for(const auto& it : itTable.second.Columns) {
@@ -156,7 +156,7 @@ TAlter& TAlter::SetFamily(ui32 table, ui32 family, ECache cache, ECodec codec)
return *this;
}
-TAlter& TAlter::SetFamilyBlobs(ui32 table, ui32 family, ui32 small, ui32 large)
+TAlter& TAlter::SetFamilyBlobs(ui32 table, ui32 family, ui32 small, ui32 large)
{
TAlterRecord& delta = *Log.AddDelta();
delta.SetDeltaType(TAlterRecord::SetFamily);
diff --git a/ydb/core/tablet_flat/flat_dbase_scheme.h b/ydb/core/tablet_flat/flat_dbase_scheme.h
index 0abde4ebeed..1fd5ed2b480 100644
--- a/ydb/core/tablet_flat/flat_dbase_scheme.h
+++ b/ydb/core/tablet_flat/flat_dbase_scheme.h
@@ -16,7 +16,7 @@ namespace NTable {
using namespace NTabletFlatScheme;
-using NKikimrSchemeOp::ECompactionStrategy;
+using NKikimrSchemeOp::ECompactionStrategy;
using TCompactionPolicy = NLocalDb::TCompactionPolicy;
@@ -129,7 +129,7 @@ public:
TDuration LogFlushPeriod = TDuration::MicroSeconds(500);
ui32 LimitInFlyTx = 0;
TString ResourceProfile = "default";
- ECompactionStrategy DefaultCompactionStrategy = NKikimrSchemeOp::CompactionStrategyGenerational;
+ ECompactionStrategy DefaultCompactionStrategy = NKikimrSchemeOp::CompactionStrategyGenerational;
};
const TTableInfo* GetTableInfo(ui32 id) const { return const_cast<TScheme*>(this)->GetTableInfo(id); }
@@ -180,11 +180,11 @@ public:
{
if (auto *table = GetTableInfo(id)) {
auto strategy = table->CompactionPolicy->CompactionStrategy;
- if (strategy != NKikimrSchemeOp::CompactionStrategyUnset) {
- if (table->ColdBorrow && strategy == NKikimrSchemeOp::CompactionStrategySharded) {
+ if (strategy != NKikimrSchemeOp::CompactionStrategyUnset) {
+ if (table->ColdBorrow && strategy == NKikimrSchemeOp::CompactionStrategySharded) {
// Sharded strategy does not support cold borrow
// Use the safe generational strategy instead
- strategy = NKikimrSchemeOp::CompactionStrategyGenerational;
+ strategy = NKikimrSchemeOp::CompactionStrategyGenerational;
}
return strategy;
}
@@ -220,7 +220,7 @@ public:
TAlter& AddFamily(ui32 table, ui32 family, ui32 room);
TAlter& AddColumnToKey(ui32 table, ui32 column);
TAlter& SetFamily(ui32 table, ui32 family, ECache cache, ECodec codec);
- TAlter& SetFamilyBlobs(ui32 table, ui32 family, ui32 small, ui32 large);
+ TAlter& SetFamilyBlobs(ui32 table, ui32 family, ui32 small, ui32 large);
TAlter& SetRoom(ui32 table, ui32 room, ui32 main, ui32 blobs, ui32 outer);
TAlter& SetRedo(ui32 annex);
TAlter& SetExecutorCacheSize(ui64 cacheSize);
diff --git a/ydb/core/tablet_flat/flat_executor.cpp b/ydb/core/tablet_flat/flat_executor.cpp
index f5da90bab8e..59afc462158 100644
--- a/ydb/core/tablet_flat/flat_executor.cpp
+++ b/ydb/core/tablet_flat/flat_executor.cpp
@@ -4275,7 +4275,7 @@ void TExecutor::Handle(TEvPrivate::TEvActivateCompactionChanges::TPtr& ev, const
void TExecutor::CommitCompactionChanges(
ui32 tableId,
const NTable::TCompactionChanges& changes,
- NKikimrSchemeOp::ECompactionStrategy strategy)
+ NKikimrSchemeOp::ECompactionStrategy strategy)
{
if (!changes.SliceChanges && !changes.StateChanges) {
// Don't bother unless there's something to do
@@ -4305,7 +4305,7 @@ void TExecutor::CommitCompactionChanges(
void TExecutor::ApplyCompactionChanges(
TCompactionChangesCtx& ctx,
const NTable::TCompactionChanges& changes,
- NKikimrSchemeOp::ECompactionStrategy strategy)
+ NKikimrSchemeOp::ECompactionStrategy strategy)
{
const ui32 tableId = ctx.Proto.GetTableId();
diff --git a/ydb/core/tablet_flat/flat_executor.h b/ydb/core/tablet_flat/flat_executor.h
index 0cc70ba3937..df08b3a338a 100644
--- a/ydb/core/tablet_flat/flat_executor.h
+++ b/ydb/core/tablet_flat/flat_executor.h
@@ -554,11 +554,11 @@ class TExecutor
void CommitCompactionChanges(
ui32 tableId,
const NTable::TCompactionChanges& changes,
- NKikimrSchemeOp::ECompactionStrategy strategy);
+ NKikimrSchemeOp::ECompactionStrategy strategy);
void ApplyCompactionChanges(
TCompactionChangesCtx& ctx,
const NTable::TCompactionChanges& changes,
- NKikimrSchemeOp::ECompactionStrategy strategy);
+ NKikimrSchemeOp::ECompactionStrategy strategy);
public:
void Describe(IOutputStream &out) const noexcept override
diff --git a/ydb/core/tablet_flat/flat_executor.proto b/ydb/core/tablet_flat/flat_executor.proto
index 27907e90a23..77588121870 100644
--- a/ydb/core/tablet_flat/flat_executor.proto
+++ b/ydb/core/tablet_flat/flat_executor.proto
@@ -157,7 +157,7 @@ message TCompactionState {
}
optional uint32 Table = 1;
- optional NKikimrSchemeOp.ECompactionStrategy Strategy = 2;
+ optional NKikimrSchemeOp.ECompactionStrategy Strategy = 2;
repeated TKeyValue KeyValues = 3; // Key/value mapping (updates or snapshot)
}
diff --git a/ydb/core/tablet_flat/flat_executor_compaction_logic.cpp b/ydb/core/tablet_flat/flat_executor_compaction_logic.cpp
index 4d9df9a2f53..3d699e8f87b 100644
--- a/ydb/core/tablet_flat/flat_executor_compaction_logic.cpp
+++ b/ydb/core/tablet_flat/flat_executor_compaction_logic.cpp
@@ -221,10 +221,10 @@ TReflectSchemeChangesResult TCompactionLogic::ReflectSchemeChanges()
table.Policy = info.CompactionPolicy;
auto newStrategyType = scheme.CompactionStrategyFor(info.Id);
- Y_VERIFY(newStrategyType != NKikimrSchemeOp::CompactionStrategyUnset);
+ Y_VERIFY(newStrategyType != NKikimrSchemeOp::CompactionStrategyUnset);
if (table.StrategyType != newStrategyType) {
- if (table.StrategyType != NKikimrSchemeOp::CompactionStrategyUnset) {
+ if (table.StrategyType != NKikimrSchemeOp::CompactionStrategyUnset) {
result.StrategyChanges.push_back({ info.Id, newStrategyType });
StrategyChanging(table);
}
@@ -268,19 +268,19 @@ TReflectSchemeChangesResult TCompactionLogic::ReflectSchemeChanges()
THolder<NTable::ICompactionStrategy> TCompactionLogic::CreateStrategy(
ui32 tableId,
- NKikimrSchemeOp::ECompactionStrategy strategy)
+ NKikimrSchemeOp::ECompactionStrategy strategy)
{
switch (strategy) {
- case NKikimrSchemeOp::CompactionStrategyGenerational:
+ case NKikimrSchemeOp::CompactionStrategyGenerational:
return NTable::CreateGenCompactionStrategy(
tableId, Backend, Broker, Time, TaskNameSuffix);
- case NKikimrSchemeOp::CompactionStrategySharded:
+ case NKikimrSchemeOp::CompactionStrategySharded:
return NTable::CreateShardedCompactionStrategy(
tableId, Backend, Broker, Logger, Time, TaskNameSuffix);
default:
- Y_FAIL("Unsupported strategy %s", NKikimrSchemeOp::ECompactionStrategy_Name(strategy).c_str());
+ Y_FAIL("Unsupported strategy %s", NKikimrSchemeOp::ECompactionStrategy_Name(strategy).c_str());
}
}
diff --git a/ydb/core/tablet_flat/flat_executor_compaction_logic.h b/ydb/core/tablet_flat/flat_executor_compaction_logic.h
index 839b9616ce8..b85a13a19ec 100644
--- a/ydb/core/tablet_flat/flat_executor_compaction_logic.h
+++ b/ydb/core/tablet_flat/flat_executor_compaction_logic.h
@@ -81,7 +81,7 @@ struct TCompactionLogicState {
// This identifies currently active strategy type
// The default value is used as a marker for uninitialized strategies
- NKikimrSchemeOp::ECompactionStrategy StrategyType = NKikimrSchemeOp::CompactionStrategyUnset;
+ NKikimrSchemeOp::ECompactionStrategy StrategyType = NKikimrSchemeOp::CompactionStrategyUnset;
THolder<NTable::ICompactionStrategy> Strategy;
@@ -122,7 +122,7 @@ struct TCompactionLogicState {
// The default value is used for compatibility, i.e. tablets that did
// not have any strategy markers in their history are assumed to have
// used the generational compaction.
- NKikimrSchemeOp::ECompactionStrategy Strategy = NKikimrSchemeOp::CompactionStrategyGenerational;
+ NKikimrSchemeOp::ECompactionStrategy Strategy = NKikimrSchemeOp::CompactionStrategyGenerational;
};
TMap<ui32, TTableInfo> Tables;
@@ -133,7 +133,7 @@ class TFlatTableScan;
struct TTableCompactionResult {
NTable::TCompactionChanges Changes;
- NKikimrSchemeOp::ECompactionStrategy Strategy;
+ NKikimrSchemeOp::ECompactionStrategy Strategy;
TVector<TIntrusivePtr<TTableSnapshotContext>> CompleteSnapshots;
bool MemCompacted = false;
};
@@ -141,13 +141,13 @@ struct TTableCompactionResult {
struct TTableCompactionChanges {
ui32 Table;
NTable::TCompactionChanges Changes;
- NKikimrSchemeOp::ECompactionStrategy Strategy;
+ NKikimrSchemeOp::ECompactionStrategy Strategy;
};
struct TReflectSchemeChangesResult {
struct TStrategyChange {
ui32 Table;
- NKikimrSchemeOp::ECompactionStrategy Strategy;
+ NKikimrSchemeOp::ECompactionStrategy Strategy;
};
TVector<TStrategyChange> StrategyChanges;
@@ -173,7 +173,7 @@ class TCompactionLogic {
bool BeginMemTableCompaction(ui64 taskId, ui32 tableId);
- THolder<NTable::ICompactionStrategy> CreateStrategy(ui32 tableId, NKikimrSchemeOp::ECompactionStrategy);
+ THolder<NTable::ICompactionStrategy> CreateStrategy(ui32 tableId, NKikimrSchemeOp::ECompactionStrategy);
void StopTable(TCompactionLogicState::TTableInfo &table);
void StrategyChanging(TCompactionLogicState::TTableInfo &table);
diff --git a/ydb/core/tablet_flat/flat_executor_ut.cpp b/ydb/core/tablet_flat/flat_executor_ut.cpp
index 7f48c64ff95..c9cf5289711 100644
--- a/ydb/core/tablet_flat/flat_executor_ut.cpp
+++ b/ydb/core/tablet_flat/flat_executor_ut.cpp
@@ -1757,7 +1757,7 @@ Y_UNIT_TEST_SUITE(TFlatTableExecutorShardedCompaction) {
TIntrusivePtr<TCompactionPolicy> policy = new TCompactionPolicy;
policy->InMemForceSizeToSnapshot = 1024 * 1024;
- policy->CompactionStrategy = NKikimrSchemeOp::CompactionStrategySharded;
+ policy->CompactionStrategy = NKikimrSchemeOp::CompactionStrategySharded;
policy->ShardPolicy.SetMinSliceSize(0);
policy->ShardPolicy.SetMinShardSize(512 * 1024);
policy->ShardPolicy.SetMaxShardSize(5 * 1024 * 1024 / 2);
@@ -1792,7 +1792,7 @@ Y_UNIT_TEST_SUITE(TFlatTableExecutorShardedCompaction) {
TIntrusivePtr<TCompactionPolicy> policy = new TCompactionPolicy;
policy->InMemForceSizeToSnapshot = 1024;
- policy->CompactionStrategy = NKikimrSchemeOp::CompactionStrategySharded;
+ policy->CompactionStrategy = NKikimrSchemeOp::CompactionStrategySharded;
policy->ShardPolicy.SetMinSliceSize(0);
policy->ShardPolicy.SetMinShardSize(512 * 1024);
policy->ShardPolicy.SetMaxShardSize(5 * 1024 * 1024 / 2);
@@ -1827,7 +1827,7 @@ Y_UNIT_TEST_SUITE(TFlatTableExecutorShardedCompaction) {
TIntrusivePtr<TCompactionPolicy> policy = new TCompactionPolicy;
policy->InMemForceSizeToSnapshot = 1024 * 1024;
- policy->CompactionStrategy = NKikimrSchemeOp::CompactionStrategySharded;
+ policy->CompactionStrategy = NKikimrSchemeOp::CompactionStrategySharded;
policy->ShardPolicy.SetMinSliceSize(0);
policy->ShardPolicy.SetMinShardSize(512 * 1024);
policy->ShardPolicy.SetMaxShardSize(5 * 1024 * 1024 / 2);
diff --git a/ydb/core/tablet_flat/tablet_flat_executed.h b/ydb/core/tablet_flat/tablet_flat_executed.h
index ce7294e8c6d..117d7532bb3 100644
--- a/ydb/core/tablet_flat/tablet_flat_executed.h
+++ b/ydb/core/tablet_flat/tablet_flat_executed.h
@@ -90,33 +90,33 @@ private:
};
}}
-
-#define STFUNC_TABLET_INIT(NAME, HANDLERS) \
- void NAME(STFUNC_SIG) { \
- switch (const ui32 etype = ev->GetTypeRewrite()) { \
- HANDLERS \
- default: \
- TTabletExecutedFlat::StateInitImpl(ev, ctx); \
- } \
- }
-
-#define STFUNC_TABLET_DEF(NAME, HANDLERS) \
- void NAME(STFUNC_SIG) { \
- switch (const ui32 etype = ev->GetTypeRewrite()) { \
- HANDLERS \
- default: \
- if (!TTabletExecutedFlat::HandleDefaultEvents(ev, ctx)) \
- Y_VERIFY_DEBUG(false, "%s: unexpected event type: %" PRIx32 " event: %s", \
- __func__, ev->GetTypeRewrite(), \
+
+#define STFUNC_TABLET_INIT(NAME, HANDLERS) \
+ void NAME(STFUNC_SIG) { \
+ switch (const ui32 etype = ev->GetTypeRewrite()) { \
+ HANDLERS \
+ default: \
+ TTabletExecutedFlat::StateInitImpl(ev, ctx); \
+ } \
+ }
+
+#define STFUNC_TABLET_DEF(NAME, HANDLERS) \
+ void NAME(STFUNC_SIG) { \
+ switch (const ui32 etype = ev->GetTypeRewrite()) { \
+ HANDLERS \
+ default: \
+ if (!TTabletExecutedFlat::HandleDefaultEvents(ev, ctx)) \
+ Y_VERIFY_DEBUG(false, "%s: unexpected event type: %" PRIx32 " event: %s", \
+ __func__, ev->GetTypeRewrite(), \
ev->HasEvent() ? ev->GetBase()->ToString().data() : "serialized?"); \
- } \
- }
-
-#define STFUNC_TABLET_IGN(NAME, HANDLERS) \
- void NAME(STFUNC_SIG) { \
- switch (const ui32 etype = ev->GetTypeRewrite()) { \
- HANDLERS \
- default: \
- TTabletExecutedFlat::HandleDefaultEvents(ev, ctx); \
- } \
- }
+ } \
+ }
+
+#define STFUNC_TABLET_IGN(NAME, HANDLERS) \
+ void NAME(STFUNC_SIG) { \
+ switch (const ui32 etype = ev->GetTypeRewrite()) { \
+ HANDLERS \
+ default: \
+ TTabletExecutedFlat::HandleDefaultEvents(ev, ctx); \
+ } \
+ }
diff --git a/ydb/core/tablet_flat/test/libs/exec/fuzzy.h b/ydb/core/tablet_flat/test/libs/exec/fuzzy.h
index 87ce3c010bd..1523dc0b39e 100644
--- a/ydb/core/tablet_flat/test/libs/exec/fuzzy.h
+++ b/ydb/core/tablet_flat/test/libs/exec/fuzzy.h
@@ -32,7 +32,7 @@ namespace NFake {
delta.SetFamily(table, 0, NPage::ECache::None, NPage::ECodec::LZ4);
} else {
delta.AddFamily(table, 0, 0);
- delta.SetFamilyBlobs(table, 0, 6500, 7000);
+ delta.SetFamilyBlobs(table, 0, 6500, 7000);
}
delta.AddColumn(table, "key", KeyId, NScheme::TInt64::TypeId, false);
diff --git a/ydb/core/tablet_flat/test/libs/exec/runner.h b/ydb/core/tablet_flat/test/libs/exec/runner.h
index 7b5083790b5..3b58ab814b4 100644
--- a/ydb/core/tablet_flat/test/libs/exec/runner.h
+++ b/ydb/core/tablet_flat/test/libs/exec/runner.h
@@ -46,7 +46,7 @@ namespace NFake {
auto *types = NTable::NTest::DbgRegistry();
auto *app = new TAppData(0, 0, 0, 0, { }, types, nullptr, nullptr, nullptr);
- Env.Initialize({ app, nullptr, nullptr });
+ Env.Initialize({ app, nullptr, nullptr });
Env.SetDispatchTimeout(DEFAULT_DISPATCH_TIMEOUT);
Env.SetLogPriority(NKikimrServices::FAKE_ENV, NActors::NLog::PRI_INFO);
diff --git a/ydb/core/tablet_flat/ut/ut_db_iface.cpp b/ydb/core/tablet_flat/ut/ut_db_iface.cpp
index 4df04dd3190..9843e5a6033 100644
--- a/ydb/core/tablet_flat/ut/ut_db_iface.cpp
+++ b/ydb/core/tablet_flat/ut/ut_db_iface.cpp
@@ -353,7 +353,7 @@ Y_UNIT_TEST_SUITE(DBase) {
{
auto alter = MakeAlter(1);
- alter.SetRedo(32).SetFamilyBlobs(1, 0, Max<ui32>(), 24);
+ alter.SetRedo(32).SetFamilyBlobs(1, 0, Max<ui32>(), 24);
TDbExec me;
@@ -445,7 +445,7 @@ Y_UNIT_TEST_SUITE(DBase) {
TDbExec me;
- me.To(10).Begin().Apply(*alter.SetFamilyBlobs(1, 0, 17, 999)).Commit();
+ me.To(10).Begin().Apply(*alter.SetFamilyBlobs(1, 0, 17, 999)).Commit();
const TString small17("0123456789abcdef0");
const TString small21("0123456789abcdef01234");
diff --git a/ydb/core/testlib/actors/test_runtime.cpp b/ydb/core/testlib/actors/test_runtime.cpp
index f445e258222..63f0436bff7 100644
--- a/ydb/core/testlib/actors/test_runtime.cpp
+++ b/ydb/core/testlib/actors/test_runtime.cpp
@@ -14,16 +14,16 @@
/**** ACHTUNG: Do not make here any new dependecies on kikimr ****/
namespace NActors {
-
- void TTestActorRuntime::TNodeData::Stop() {
- if (Mon) {
- Mon->Stop();
- }
- TNodeDataBase::Stop();
- }
-
+
+ void TTestActorRuntime::TNodeData::Stop() {
+ if (Mon) {
+ Mon->Stop();
+ }
+ TNodeDataBase::Stop();
+ }
+
TTestActorRuntime::TNodeData::~TNodeData() {
- Stop();
+ Stop();
}
ui64 TTestActorRuntime::TNodeData::GetLoggerPoolId() const {
diff --git a/ydb/core/testlib/actors/test_runtime.h b/ydb/core/testlib/actors/test_runtime.h
index fa3231be532..deb156876bf 100644
--- a/ydb/core/testlib/actors/test_runtime.h
+++ b/ydb/core/testlib/actors/test_runtime.h
@@ -26,7 +26,7 @@ namespace NActors {
{
private:
struct TNodeData: public TNodeDataBase {
- void Stop();
+ void Stop();
~TNodeData();
ui64 GetLoggerPoolId() const override;
THolder<NActors::TMon> Mon;
diff --git a/ydb/core/testlib/basics/appdata.h b/ydb/core/testlib/basics/appdata.h
index a12bc474f35..409869161f5 100644
--- a/ydb/core/testlib/basics/appdata.h
+++ b/ydb/core/testlib/basics/appdata.h
@@ -72,7 +72,7 @@ namespace NKikimr {
TIntrusivePtr<TChannelProfiles> Channels;
NKikimrBlobStorage::TNodeWardenServiceSet BSConf;
TIntrusivePtr<TDomainsInfo> Domains;
- TMap<ui32, NKikimrProto::TKeyConfig> Keys;
+ TMap<ui32, NKikimrProto::TKeyConfig> Keys;
bool EnableKqpSpilling = false;
NKikimrConfig::TCompactionConfig CompactionConfig;
TString NetDataSourceUrl;
diff --git a/ydb/core/testlib/basics/services.cpp b/ydb/core/testlib/basics/services.cpp
index 9bdb69ca622..b4585ad96c6 100644
--- a/ydb/core/testlib/basics/services.cpp
+++ b/ydb/core/testlib/basics/services.cpp
@@ -243,11 +243,11 @@ namespace NPDisk {
TTestStorageFactory disk(runtime, storage, mock);
- {
- NKikimrBlobStorage::TNodeWardenServiceSet bsConfig;
+ {
+ NKikimrBlobStorage::TNodeWardenServiceSet bsConfig;
Y_VERIFY(google::protobuf::TextFormat::ParseFromString(disk.MakeTextConf(*app.Domains), &bsConfig));
app.SetBSConf(std::move(bsConfig));
- }
+ }
if (app.Domains->Domains.empty()) {
app.AddDomain(TDomainsInfo::TDomain::ConstructEmptyDomain("dc-1").Release());
diff --git a/ydb/core/testlib/basics/storage.h b/ydb/core/testlib/basics/storage.h
index 83eef4f4db3..36cee178189 100644
--- a/ydb/core/testlib/basics/storage.h
+++ b/ydb/core/testlib/basics/storage.h
@@ -54,7 +54,7 @@ namespace NKikimr {
static ui64 keySalt = 0;
ui64 salt = ++keySalt;
- TString baseDir = Runtime.GetTempDir();
+ TString baseDir = Runtime.GetTempDir();
if (Conf.UseDisk) {
MakeDirIfNotExist(baseDir.c_str());
diff --git a/ydb/core/testlib/fake_coordinator.h b/ydb/core/testlib/fake_coordinator.h
index 01909fe70d0..b3098d60a59 100644
--- a/ydb/core/testlib/fake_coordinator.h
+++ b/ydb/core/testlib/fake_coordinator.h
@@ -10,12 +10,12 @@ namespace NKikimr {
class TFakeCoordinator : public TActor<TFakeCoordinator>, public NTabletFlatExecutor::TTabletExecutedFlat {
public:
struct TState : TThrRefBase {
- ui64 CurrentStep = 5000000;
- ui64 FrontStep = 0;
+ ui64 CurrentStep = 5000000;
+ ui64 FrontStep = 0;
TMap<std::pair<ui64, ui64>, TVector<TAutoPtr<TEvTxProcessing::TEvPlanStep>>> QueuedPlans; // shard+step->event
TMap<ui64, TSet<ui64>> TxIds; // txid -> list of shards
- TState() = default;
+ TState() = default;
typedef TIntrusivePtr<TState> TPtr;
};
@@ -95,7 +95,7 @@ namespace NKikimr {
}
State->TxIds.insert(std::make_pair(tx.GetTxId(), shards));
- Cerr << "FAKE_COORDINATOR: Add transaction: " << tx.GetTxId() << " at step: " << State->CurrentStep << "\n";
+ Cerr << "FAKE_COORDINATOR: Add transaction: " << tx.GetTxId() << " at step: " << State->CurrentStep << "\n";
for (ui64 shard : shards) {
auto evPlan = new TEvTxProcessing::TEvPlanStep(State->CurrentStep, 0, shard);
auto planTx = evPlan->Record.AddTransactions();
@@ -105,40 +105,40 @@ namespace NKikimr {
State->QueuedPlans[std::make_pair(shard, State->CurrentStep)].push_back(evPlan);
}
- AdvancePlan(ctx);
+ AdvancePlan(ctx);
}
void Handle(TEvTabletPipe::TEvClientConnected::TPtr& ev, const TActorContext& ctx) {
if (!Pipes->OnConnect(ev)) {
if (ev->Get()->Dead) {
AckPlanStepsForDeadTablet(ev->Get()->TabletId);
- AdvancePlan(ctx);
- } else {
- SendQueued(ctx, ev->Get()->TabletId);
+ AdvancePlan(ctx);
+ } else {
+ SendQueued(ctx, ev->Get()->TabletId);
}
-
+
}
}
void Handle(TEvTabletPipe::TEvClientDestroyed::TPtr& ev, const TActorContext& ctx) {
Pipes->OnDisconnect(ev);
- SendQueued(ctx, ev->Get()->TabletId);
+ SendQueued(ctx, ev->Get()->TabletId);
}
void Handle(TEvTxProcessing::TEvPlanStepAccepted::TPtr& ev, const TActorContext& ctx) {
auto stepIt = State->QueuedPlans.find(std::make_pair(ev->Get()->Record.GetTabletId(), ev->Get()->Record.GetStep()));
- if (stepIt == State->QueuedPlans.end()) {
- return;
- }
-
- for (auto& tabletData : stepIt->second) {
- for (auto& tx : tabletData->Record.GetTransactions()) {
- UnlinkTx(ev->Get()->Record.GetTabletId(), tx.GetTxId());
+ if (stepIt == State->QueuedPlans.end()) {
+ return;
+ }
+
+ for (auto& tabletData : stepIt->second) {
+ for (auto& tx : tabletData->Record.GetTransactions()) {
+ UnlinkTx(ev->Get()->Record.GetTabletId(), tx.GetTxId());
}
- }
- State->QueuedPlans.erase(stepIt);
+ }
+ State->QueuedPlans.erase(stepIt);
- AdvancePlan(ctx);
+ AdvancePlan(ctx);
}
void UnlinkTx(ui64 tabletId, ui64 txId) {
@@ -146,7 +146,7 @@ namespace NKikimr {
if (txIt != State->TxIds.end()) {
txIt->second.erase(tabletId);
if (txIt->second.empty()) {
- Cerr << "FAKE_COORDINATOR: Erasing txId " << txId << Endl;
+ Cerr << "FAKE_COORDINATOR: Erasing txId " << txId << Endl;
State->TxIds.erase(txIt);
}
}
@@ -155,7 +155,7 @@ namespace NKikimr {
void AckPlanStepsForDeadTablet(ui64 tabletId) {
auto pit = State->QueuedPlans.lower_bound(std::make_pair(tabletId, 0));
while (pit != State->QueuedPlans.end() && pit->first.first == tabletId) {
- Cerr << "FAKE_COORDINATOR: forgetting step " << pit->first.second << " for dead tablet " << pit->first.first << Endl;
+ Cerr << "FAKE_COORDINATOR: forgetting step " << pit->first.second << " for dead tablet " << pit->first.first << Endl;
auto toErase = pit;
++pit;
for (const auto& evPlan : toErase->second) {
@@ -168,51 +168,51 @@ namespace NKikimr {
}
}
- ui64 GetMinStep() const {
+ ui64 GetMinStep() const {
ui64 minStep = Max<ui64>();
for (auto& kv : State->QueuedPlans) {
const ui64 step = kv.first.second;
minStep = Min(minStep, step);
}
- return minStep;
- }
-
- void AdvancePlan(const TActorContext& ctx, ui64 onlyForTabletId = 0) {
- ui64 minStep = GetMinStep();
-
- if (minStep == Max<ui64>()) {
- return;
- }
-
- Cerr << "FAKE_COORDINATOR: advance: minStep" << minStep << " State->FrontStep: " << State->FrontStep << "\n";
-
- if (State->FrontStep >= minStep) {
- return;
- }
-
- State->FrontStep = minStep;
-
- SendQueued(ctx, onlyForTabletId);
- }
-
- void SendQueued(const TActorContext& ctx, ui64 onlyForTabletId = 0) {
-
+ return minStep;
+ }
+
+ void AdvancePlan(const TActorContext& ctx, ui64 onlyForTabletId = 0) {
+ ui64 minStep = GetMinStep();
+
+ if (minStep == Max<ui64>()) {
+ return;
+ }
+
+ Cerr << "FAKE_COORDINATOR: advance: minStep" << minStep << " State->FrontStep: " << State->FrontStep << "\n";
+
+ if (State->FrontStep >= minStep) {
+ return;
+ }
+
+ State->FrontStep = minStep;
+
+ SendQueued(ctx, onlyForTabletId);
+ }
+
+ void SendQueued(const TActorContext& ctx, ui64 onlyForTabletId = 0) {
+
for (auto& kv : State->QueuedPlans) {
- ui64 tabletId = kv.first.first;
- if (onlyForTabletId && onlyForTabletId != tabletId) {
- continue;
- }
+ ui64 tabletId = kv.first.first;
+ if (onlyForTabletId && onlyForTabletId != tabletId) {
+ continue;
+ }
const ui64 step = kv.first.second;
- if (step != State->FrontStep) {
+ if (step != State->FrontStep) {
continue;
- }
+ }
for (auto& ev : kv.second) {
TAllocChunkSerializer serializer;
ev->SerializeToArcadiaStream(&serializer);
- Cerr << "FAKE_COORDINATOR: Send Plan to tablet " << tabletId << " for txId: " << ev->Record.GetTransactions(0).GetTxId() << " at step: " << step << "\n";
-
- Pipes->Send(ctx, tabletId, ev->EventType, serializer.Release(ev->IsExtendedFormat()));
+ Cerr << "FAKE_COORDINATOR: Send Plan to tablet " << tabletId << " for txId: " << ev->Record.GetTransactions(0).GetTxId() << " at step: " << step << "\n";
+
+ Pipes->Send(ctx, tabletId, ev->EventType, serializer.Release(ev->IsExtendedFormat()));
}
}
}
diff --git a/ydb/core/testlib/fake_scheme_shard.h b/ydb/core/testlib/fake_scheme_shard.h
index b1cf8f4ffd9..8c388d49dd0 100644
--- a/ydb/core/testlib/fake_scheme_shard.h
+++ b/ydb/core/testlib/fake_scheme_shard.h
@@ -72,7 +72,7 @@ public:
void StateWork(STFUNC_SIG) {
switch (ev->GetTypeRewrite()) {
HFunc(TEvTablet::TEvTabletDead, HandleTabletDead);
- HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeScheme, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeScheme, Handle);
HFunc(TEvents::TEvPoisonPill, Handle);
}
}
@@ -83,11 +83,11 @@ public:
}
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeScheme::TPtr &ev, const TActorContext &ctx) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeScheme::TPtr &ev, const TActorContext &ctx) {
const auto& record = ev->Get()->Record;
UNIT_ASSERT(record.GetPathId() == 1);
- TAutoPtr<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder> response =
- new NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder();
+ TAutoPtr<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder> response =
+ new NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder();
TString out;
Y_PROTOBUF_SUPPRESS_NODISCARD State->ACL.GetACL().SerializeToString(&out);
response->Record.MutablePathDescription()->MutableSelf()->SetACL(out);
diff --git a/ydb/core/testlib/tablet_helpers.cpp b/ydb/core/testlib/tablet_helpers.cpp
index 53ef4e6d667..a853040b932 100644
--- a/ydb/core/testlib/tablet_helpers.cpp
+++ b/ydb/core/testlib/tablet_helpers.cpp
@@ -48,8 +48,8 @@
#include <ydb/core/testlib/basics/appdata.h>
const bool SUPPRESS_REBOOTS = false;
-const bool ENABLE_REBOOT_DISPATCH_LOG = true;
-const bool TRACE_DELAY_TIMING = true;
+const bool ENABLE_REBOOT_DISPATCH_LOG = true;
+const bool TRACE_DELAY_TIMING = true;
const bool SUPPRESS_DELAYS = false;
const bool VARIATE_RANDOM_SEED = false;
const ui64 PQ_CACHE_MAX_SIZE_MB = 32;
@@ -96,13 +96,13 @@ namespace NKikimr {
THashMap<ui64, TIntrusivePtr<TMediatorTimecastEntry>> Entries;
};
- void SetupMediatorTimecastProxy(TTestActorRuntime& runtime, ui32 nodeIndex, bool useFake = false)
+ void SetupMediatorTimecastProxy(TTestActorRuntime& runtime, ui32 nodeIndex, bool useFake = false)
{
- runtime.AddLocalService(
- MakeMediatorTimecastProxyID()
- , TActorSetupCmd(useFake ? new TFakeMediatorTimecastProxy() : CreateMediatorTimecastProxy()
- , TMailboxType::Revolving, 0)
- , nodeIndex);
+ runtime.AddLocalService(
+ MakeMediatorTimecastProxyID()
+ , TActorSetupCmd(useFake ? new TFakeMediatorTimecastProxy() : CreateMediatorTimecastProxy()
+ , TMailboxType::Revolving, 0)
+ , nodeIndex);
}
void SetupTabletCountersAggregator(TTestActorRuntime& runtime, ui32 nodeIndex)
@@ -122,29 +122,29 @@ namespace NKikimr {
}
struct TUltimateNodes : public NFake::INode {
- TUltimateNodes(TTestActorRuntime &runtime, const TAppPrepare *app)
+ TUltimateNodes(TTestActorRuntime &runtime, const TAppPrepare *app)
: Runtime(runtime)
{
- if (runtime.IsRealThreads()) {
- return;
- }
-
- const auto& domainsInfo = app->Domains;
- if (!domainsInfo || domainsInfo->Domains.size() == 0) {
- return;
- }
-
- Y_VERIFY(domainsInfo->Domains.size() == 1);
- for (const auto &xpair : domainsInfo->Domains) {
- const TDomainsInfo::TDomain *domain = xpair.second.Get();
- UseFakeTimeCast |= domain->Mediators.size() == 0;
- }
+ if (runtime.IsRealThreads()) {
+ return;
+ }
+
+ const auto& domainsInfo = app->Domains;
+ if (!domainsInfo || domainsInfo->Domains.size() == 0) {
+ return;
+ }
+
+ Y_VERIFY(domainsInfo->Domains.size() == 1);
+ for (const auto &xpair : domainsInfo->Domains) {
+ const TDomainsInfo::TDomain *domain = xpair.second.Get();
+ UseFakeTimeCast |= domain->Mediators.size() == 0;
+ }
}
void Birth(ui32 node) noexcept override
{
- SetupMediatorTimecastProxy(Runtime, node, UseFakeTimeCast);
+ SetupMediatorTimecastProxy(Runtime, node, UseFakeTimeCast);
SetupMonitoringProxy(Runtime, node);
SetupTabletCountersAggregator(Runtime, node);
SetupGRpcProxyStatus(Runtime, node);
@@ -154,7 +154,7 @@ namespace NKikimr {
}
TTestActorRuntime &Runtime;
- bool UseFakeTimeCast = false;
+ bool UseFakeTimeCast = false;
};
class TTabletTracer : TNonCopyable {
@@ -169,18 +169,18 @@ namespace NKikimr {
if (event->GetTypeRewrite() == TEvStateStorage::EvInfo) {
auto info = static_cast<TEvStateStorage::TEvInfo*>(event->GetBase());
if (info->Status == NKikimrProto::OK && (Find(TabletIds.begin(), TabletIds.end(), info->TabletID) != TabletIds.end())) {
- if (ENABLE_REBOOT_DISPATCH_LOG) {
+ if (ENABLE_REBOOT_DISPATCH_LOG) {
Cerr << "Leader for TabletID " << info->TabletID << " is " << info->CurrentLeaderTablet << " sender: " << event->Sender << " recipient: " << event->Recipient << Endl;
- }
+ }
if (info->CurrentLeaderTablet) {
TabletLeaders[info->TabletID] = info->CurrentLeaderTablet;
- } else {
- if (ENABLE_REBOOT_DISPATCH_LOG) {
+ } else {
+ if (ENABLE_REBOOT_DISPATCH_LOG) {
Cerr << "IGNORE Leader for TabletID " << info->TabletID << " is " << info->CurrentLeaderTablet << " sender: " << event->Sender << " recipient: " << event->Recipient << Endl;
- }
- }
+ }
+ }
TabletRelatedActors[info->CurrentLeaderTablet] = info->TabletID;
-
+
}
} else if (event->GetTypeRewrite() == TEvFakeHive::EvNotifyTabletDeleted) {
auto notifyEv = static_cast<TEvFakeHive::TEvNotifyTabletDeleted*>(event->GetBase());
@@ -314,13 +314,13 @@ namespace NKikimr {
}
TActorId targetActorId = TabletLeaders[TabletId];
-
+
if (targetActorId == TActorId()) {
- if (ENABLE_REBOOT_DISPATCH_LOG)
- Cerr << "!IGNORE " << TabletId << " event " << eventType << " becouse actor is null!\n";
-
+ if (ENABLE_REBOOT_DISPATCH_LOG)
+ Cerr << "!IGNORE " << TabletId << " event " << eventType << " becouse actor is null!\n";
+
return TTestActorRuntime::EEventAction::DROP;
- }
+ }
if (ENABLE_REBOOT_DISPATCH_LOG)
Cerr << "!Reboot " << TabletId << " (actor " << targetActorId << ") on event " << eventType << " !\n";
@@ -334,17 +334,17 @@ namespace NKikimr {
};
runtime.DispatchEvents(rebootOptions);
- if (ENABLE_REBOOT_DISPATCH_LOG)
- Cerr << "!Reboot " << TabletId << " (actor " << targetActorId << ") rebooted!\n";
-
+ if (ENABLE_REBOOT_DISPATCH_LOG)
+ Cerr << "!Reboot " << TabletId << " (actor " << targetActorId << ") rebooted!\n";
+
InvalidateTabletResolverCache(runtime, TabletId);
TDispatchOptions invalidateOptions;
invalidateOptions.FinalEvents.push_back(TDispatchOptions::TFinalEventCondition(TEvStateStorage::EvInfo));
runtime.DispatchEvents(invalidateOptions);
-
- if (ENABLE_REBOOT_DISPATCH_LOG)
- Cerr << "!Reboot " << TabletId << " (actor " << targetActorId << ") tablet resolver refreshed! new actor is" << TabletLeaders[TabletId] << " \n";
-
+
+ if (ENABLE_REBOOT_DISPATCH_LOG)
+ Cerr << "!Reboot " << TabletId << " (actor " << targetActorId << ") tablet resolver refreshed! new actor is" << TabletLeaders[TabletId] << " \n";
+
return TTestActorRuntime::EEventAction::DROP;
}
@@ -363,11 +363,11 @@ namespace NKikimr {
};
// Breaks pipe after the specified number of events
- class TPipeResetObserver : public TTabletTracer {
+ class TPipeResetObserver : public TTabletTracer {
public:
- TPipeResetObserver(ui32 eventCountBeforeReboot, bool& tracingActive, TTestActorRuntime::TEventFilter filter, const TVector<ui64>& tabletIds)
- : TTabletTracer(tracingActive, tabletIds)
- , EventCountBeforeReboot(eventCountBeforeReboot)
+ TPipeResetObserver(ui32 eventCountBeforeReboot, bool& tracingActive, TTestActorRuntime::TEventFilter filter, const TVector<ui64>& tabletIds)
+ : TTabletTracer(tracingActive, tabletIds)
+ , EventCountBeforeReboot(eventCountBeforeReboot)
, TracingActive(tracingActive)
, Filter(filter)
, CurrentEventCount(0)
@@ -375,8 +375,8 @@ namespace NKikimr {
{}
TTestActorRuntime::EEventAction OnEvent(TTestActorRuntime& runtime, TAutoPtr<IEventHandle>& event) {
- TTabletTracer::OnEvent(runtime, event);
-
+ TTabletTracer::OnEvent(runtime, event);
+
if (!TracingActive)
return TTestActorRuntime::EEventAction::PROCESS;
@@ -622,133 +622,133 @@ namespace NKikimr {
if (app == nullptr) {
dummy = app = new TAppPrepare;
}
- TUltimateNodes nodes(runtime, app);
+ TUltimateNodes nodes(runtime, app);
SetupBasicServices(runtime, *app, mockDisk, &nodes, storage, caches);
}
- TDomainsInfo::TDomain::TStoragePoolKinds DefaultPoolKinds(ui32 count) {
- TDomainsInfo::TDomain::TStoragePoolKinds storagePoolKinds;
-
- for (ui32 poolNum = 1; poolNum <= count; ++poolNum) {
+ TDomainsInfo::TDomain::TStoragePoolKinds DefaultPoolKinds(ui32 count) {
+ TDomainsInfo::TDomain::TStoragePoolKinds storagePoolKinds;
+
+ for (ui32 poolNum = 1; poolNum <= count; ++poolNum) {
TString poolKind = "pool-kind-" + ToString(poolNum);
NKikimrBlobStorage::TDefineStoragePool& hddPool = storagePoolKinds[poolKind];
- hddPool.SetBoxId(1);
- hddPool.SetErasureSpecies("none");
- hddPool.SetVDiskKind("Default");
- hddPool.AddPDiskFilter()->AddProperty()->SetType(NKikimrBlobStorage::ROT);
- hddPool.SetKind(poolKind);
+ hddPool.SetBoxId(1);
+ hddPool.SetErasureSpecies("none");
+ hddPool.SetVDiskKind("Default");
+ hddPool.AddPDiskFilter()->AddProperty()->SetType(NKikimrBlobStorage::ROT);
+ hddPool.SetKind(poolKind);
hddPool.SetStoragePoolId(poolNum);
hddPool.SetName("pool-" + ToString(poolNum));
- }
-
- return storagePoolKinds;
- }
-
+ }
+
+ return storagePoolKinds;
+ }
+
i64 SetSplitMergePartCountLimit(TTestActorRuntime* runtime, i64 val) {
TAtomic prev;
runtime->GetAppData().Icb->SetValue("SchemeShard_SplitMergePartCountLimit", val, prev);
return prev;
}
- bool SetAllowServerlessStorageBilling(TTestActorRuntime* runtime, bool isAllow) {
- TAtomic prev;
- runtime->GetAppData().Icb->SetValue("SchemeShard_AllowServerlessStorageBilling", isAllow, prev);
- return prev;
- }
-
+ bool SetAllowServerlessStorageBilling(TTestActorRuntime* runtime, bool isAllow) {
+ TAtomic prev;
+ runtime->GetAppData().Icb->SetValue("SchemeShard_AllowServerlessStorageBilling", isAllow, prev);
+ return prev;
+ }
+
void SetupChannelProfiles(TAppPrepare &app, ui32 domainId, ui32 nchannels) {
Y_VERIFY(app.Domains && app.Domains->Domains.contains(domainId));
auto& poolKinds = app.Domains->GetDomain(domainId).StoragePoolTypes;
- Y_VERIFY(!poolKinds.empty());
-
- TIntrusivePtr<TChannelProfiles> channelProfiles = new TChannelProfiles;
-
- {//Set unexisted pool type for default profile # 0
- channelProfiles->Profiles.emplace_back();
- auto& profile = channelProfiles->Profiles.back();
- for (ui32 channelIdx = 0; channelIdx < nchannels; ++channelIdx) {
+ Y_VERIFY(!poolKinds.empty());
+
+ TIntrusivePtr<TChannelProfiles> channelProfiles = new TChannelProfiles;
+
+ {//Set unexisted pool type for default profile # 0
+ channelProfiles->Profiles.emplace_back();
+ auto& profile = channelProfiles->Profiles.back();
+ for (ui32 channelIdx = 0; channelIdx < nchannels; ++channelIdx) {
profile.Channels.emplace_back(TBlobStorageGroupType::ErasureNone, 0, NKikimrBlobStorage::TVDiskKind::Default, poolKinds.begin()->first);
- }
- }
-
- //add mixed pool profile # 1
- if (poolKinds) {
- channelProfiles->Profiles.emplace_back();
- TChannelProfiles::TProfile &profile = channelProfiles->Profiles.back();
- auto poolIt = poolKinds.begin();
-
- profile.Channels.emplace_back(TBlobStorageGroupType::ErasureNone, 0, NKikimrBlobStorage::TVDiskKind::Default, poolIt->first);
-
- if (poolKinds.size() > 1) {
- ++poolIt;
- }
- profile.Channels.emplace_back(TBlobStorageGroupType::ErasureNone, 0, NKikimrBlobStorage::TVDiskKind::Default, poolIt->first);
-
- if (poolKinds.size() > 2) {
- ++poolIt;
-
- profile.Channels.emplace_back(TBlobStorageGroupType::ErasureNone, 0, NKikimrBlobStorage::TVDiskKind::Default, poolIt->first);
- }
- }
-
- //add one pool profile for each pool # 2 .. poolKinds + 2
- for (auto& kind: poolKinds) {
- channelProfiles->Profiles.emplace_back();
- auto& profile = channelProfiles->Profiles.back();
- for (ui32 channelIdx = 0; channelIdx < nchannels; ++channelIdx) {
- profile.Channels.emplace_back(TBlobStorageGroupType::ErasureNone, 0, NKikimrBlobStorage::TVDiskKind::Default, kind.first);
- }
- }
-
+ }
+ }
+
+ //add mixed pool profile # 1
+ if (poolKinds) {
+ channelProfiles->Profiles.emplace_back();
+ TChannelProfiles::TProfile &profile = channelProfiles->Profiles.back();
+ auto poolIt = poolKinds.begin();
+
+ profile.Channels.emplace_back(TBlobStorageGroupType::ErasureNone, 0, NKikimrBlobStorage::TVDiskKind::Default, poolIt->first);
+
+ if (poolKinds.size() > 1) {
+ ++poolIt;
+ }
+ profile.Channels.emplace_back(TBlobStorageGroupType::ErasureNone, 0, NKikimrBlobStorage::TVDiskKind::Default, poolIt->first);
+
+ if (poolKinds.size() > 2) {
+ ++poolIt;
+
+ profile.Channels.emplace_back(TBlobStorageGroupType::ErasureNone, 0, NKikimrBlobStorage::TVDiskKind::Default, poolIt->first);
+ }
+ }
+
+ //add one pool profile for each pool # 2 .. poolKinds + 2
+ for (auto& kind: poolKinds) {
+ channelProfiles->Profiles.emplace_back();
+ auto& profile = channelProfiles->Profiles.back();
+ for (ui32 channelIdx = 0; channelIdx < nchannels; ++channelIdx) {
+ profile.Channels.emplace_back(TBlobStorageGroupType::ErasureNone, 0, NKikimrBlobStorage::TVDiskKind::Default, kind.first);
+ }
+ }
+
app.SetChannels(std::move(channelProfiles));
- }
-
+ }
+
void SetupBoxAndStoragePool(TTestActorRuntime &runtime, const TActorId& sender, ui32 domainId, ui32 nGroups) {
- NTabletPipe::TClientConfig pipeConfig;
+ NTabletPipe::TClientConfig pipeConfig;
pipeConfig.RetryPolicy = NTabletPipe::TClientRetryPolicy::WithRetries();
-
- //get NodesInfo, nodes hostname and port are interested
+
+ //get NodesInfo, nodes hostname and port are interested
runtime.Send(new IEventHandle(GetNameserviceActorId(), sender, new TEvInterconnect::TEvListNodes));
- TAutoPtr<IEventHandle> handleNodesInfo;
- auto nodesInfo = runtime.GrabEdgeEventRethrow<TEvInterconnect::TEvNodesInfo>(handleNodesInfo);
+ TAutoPtr<IEventHandle> handleNodesInfo;
+ auto nodesInfo = runtime.GrabEdgeEventRethrow<TEvInterconnect::TEvNodesInfo>(handleNodesInfo);
auto bsConfigureRequest = MakeHolder<TEvBlobStorage::TEvControllerConfigRequest>();
-
- NKikimrBlobStorage::TDefineBox boxConfig;
- boxConfig.SetBoxId(1);
-
- ui32 nodeId = runtime.GetNodeId(0);
- Y_VERIFY(nodesInfo->Nodes[0].NodeId == nodeId);
- auto& nodeInfo = nodesInfo->Nodes[0];
-
- NKikimrBlobStorage::TDefineHostConfig hostConfig;
- hostConfig.SetHostConfigId(nodeId);
+
+ NKikimrBlobStorage::TDefineBox boxConfig;
+ boxConfig.SetBoxId(1);
+
+ ui32 nodeId = runtime.GetNodeId(0);
+ Y_VERIFY(nodesInfo->Nodes[0].NodeId == nodeId);
+ auto& nodeInfo = nodesInfo->Nodes[0];
+
+ NKikimrBlobStorage::TDefineHostConfig hostConfig;
+ hostConfig.SetHostConfigId(nodeId);
TString path = TStringBuilder() << runtime.GetTempDir() << "pdisk_1.dat";
hostConfig.AddDrive()->SetPath(path);
Cerr << "tablet_helpers.cpp: SetPath # " << path << Endl;
- bsConfigureRequest->Record.MutableRequest()->AddCommand()->MutableDefineHostConfig()->CopyFrom(hostConfig);
-
- auto &host = *boxConfig.AddHost();
- host.MutableKey()->SetFqdn(nodeInfo.Host);
- host.MutableKey()->SetIcPort(nodeInfo.Port);
- host.SetHostConfigId(hostConfig.GetHostConfigId());
- bsConfigureRequest->Record.MutableRequest()->AddCommand()->MutableDefineBox()->CopyFrom(boxConfig);
-
+ bsConfigureRequest->Record.MutableRequest()->AddCommand()->MutableDefineHostConfig()->CopyFrom(hostConfig);
+
+ auto &host = *boxConfig.AddHost();
+ host.MutableKey()->SetFqdn(nodeInfo.Host);
+ host.MutableKey()->SetIcPort(nodeInfo.Port);
+ host.SetHostConfigId(hostConfig.GetHostConfigId());
+ bsConfigureRequest->Record.MutableRequest()->AddCommand()->MutableDefineBox()->CopyFrom(boxConfig);
+
for (const auto& [kind, pool] : runtime.GetAppData().DomainsInfo->Domains[domainId]->StoragePoolTypes) {
NKikimrBlobStorage::TDefineStoragePool storagePool(pool);
storagePool.SetNumGroups(nGroups);
bsConfigureRequest->Record.MutableRequest()->AddCommand()->MutableDefineStoragePool()->CopyFrom(storagePool);
}
-
+
runtime.SendToPipe(MakeBSControllerID(domainId), sender, bsConfigureRequest.Release(), 0, GetPipeConfigWithRetries());
-
- TAutoPtr<IEventHandle> handleConfigureResponse;
- auto configureResponse = runtime.GrabEdgeEventRethrow<TEvBlobStorage::TEvControllerConfigResponse>(handleConfigureResponse);
- if (!configureResponse->Record.GetResponse().GetSuccess()) {
- Cerr << "\n\n configResponse is #" << configureResponse->Record.DebugString() << "\n\n";
- }
- UNIT_ASSERT(configureResponse->Record.GetResponse().GetSuccess());
- }
-
+
+ TAutoPtr<IEventHandle> handleConfigureResponse;
+ auto configureResponse = runtime.GrabEdgeEventRethrow<TEvBlobStorage::TEvControllerConfigResponse>(handleConfigureResponse);
+ if (!configureResponse->Record.GetResponse().GetSuccess()) {
+ Cerr << "\n\n configResponse is #" << configureResponse->Record.DebugString() << "\n\n";
+ }
+ UNIT_ASSERT(configureResponse->Record.GetResponse().GetSuccess());
+ }
+
void RunTestWithReboots(const TVector<ui64>& tabletIds, std::function<TTestActorRuntime::TEventFilter()> filterFactory,
std::function<void(const TString& dispatchPass, std::function<void(TTestActorRuntime&)> setup, bool& activeZone)> testFunc,
ui32 selectedReboot, ui64 selectedTablet, ui32 bucket, ui32 totalBuckets, bool killOnCommit) {
@@ -758,31 +758,31 @@ namespace NKikimr {
{
TTabletTracer tabletTracer(activeZone, tabletIds);
TTabletScheduledFilter scheduledFilter(tabletTracer);
- try {
+ try {
testFunc(INITIAL_TEST_DISPATCH_NAME, [&](TTestActorRuntimeBase& runtime) {
runtime.SetObserverFunc([&](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event) {
tabletTracer.OnEvent(AsKikimrRuntime(runtime), event);
- return TTestActorRuntime::EEventAction::PROCESS;
- });
+ return TTestActorRuntime::EEventAction::PROCESS;
+ });
runtime.SetRegistrationObserverFunc([&](TTestActorRuntimeBase& runtime, const TActorId& parentId, const TActorId& actorId) {
tabletTracer.OnRegistration(AsKikimrRuntime(runtime), parentId, actorId);
- });
+ });
runtime.SetScheduledEventFilter([&](TTestActorRuntimeBase& r, TAutoPtr<IEventHandle>& event,
- TDuration delay, TInstant& deadline) {
+ TDuration delay, TInstant& deadline) {
auto& runtime = AsKikimrRuntime(r);
- return !(!scheduledFilter(runtime, event, delay, deadline) || !TTestActorRuntime::DefaultScheduledFilterFunc(runtime, event, delay, deadline));
- });
+ return !(!scheduledFilter(runtime, event, delay, deadline) || !TTestActorRuntime::DefaultScheduledFilterFunc(runtime, event, delay, deadline));
+ });
- runtime.SetScheduledEventsSelectorFunc(&TTestActorRuntime::CollapsedTimeScheduledEventsSelector);
- }, activeZone);
- }
- catch (yexception& e) {
- UNIT_FAIL("Failed"
- << " at dispatch " << INITIAL_TEST_DISPATCH_NAME
- << " with exception " << e.what() << "\n");
- }
+ runtime.SetScheduledEventsSelectorFunc(&TTestActorRuntime::CollapsedTimeScheduledEventsSelector);
+ }, activeZone);
+ }
+ catch (yexception& e) {
+ UNIT_FAIL("Failed"
+ << " at dispatch " << INITIAL_TEST_DISPATCH_NAME
+ << " with exception " << e.what() << "\n");
+ }
}
if (SUPPRESS_REBOOTS || GetEnv("FAST_UT")=="1")
@@ -805,7 +805,7 @@ namespace NKikimr {
continue;
}
- TString dispatchName = Sprintf("Reboot tablet %" PRIu64 " (#%" PRIu32 ") run %" PRIu32 "" , tabletId, tabletEventCountBeforeReboot, runCount);
+ TString dispatchName = Sprintf("Reboot tablet %" PRIu64 " (#%" PRIu32 ") run %" PRIu32 "" , tabletId, tabletEventCountBeforeReboot, runCount);
if (ENABLE_REBOOT_DISPATCH_LOG)
Cout << "===> BEGIN dispatch: " << dispatchName << "\n";
@@ -817,27 +817,27 @@ namespace NKikimr {
TTabletScheduledFilter scheduledFilter(rebootingObserver);
testFunc(dispatchName,
[&](TTestActorRuntime& runtime) {
- runtime.SetObserverFunc([&](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event) {
- return rebootingObserver.OnEvent(AsKikimrRuntime(runtime), event);
- });
+ runtime.SetObserverFunc([&](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event) {
+ return rebootingObserver.OnEvent(AsKikimrRuntime(runtime), event);
+ });
runtime.SetRegistrationObserverFunc([&](TTestActorRuntimeBase& runtime, const TActorId& parentId, const TActorId& actorId) {
- rebootingObserver.OnRegistration(AsKikimrRuntime(runtime), parentId, actorId);
- });
+ rebootingObserver.OnRegistration(AsKikimrRuntime(runtime), parentId, actorId);
+ });
- runtime.SetScheduledEventFilter([&](TTestActorRuntimeBase& r, TAutoPtr<IEventHandle>& event,
- TDuration delay, TInstant& deadline) {
- auto& runtime = AsKikimrRuntime(r);
- return scheduledFilter(runtime, event, delay, deadline) && TTestActorRuntime::DefaultScheduledFilterFunc(runtime, event, delay, deadline);
- });
+ runtime.SetScheduledEventFilter([&](TTestActorRuntimeBase& r, TAutoPtr<IEventHandle>& event,
+ TDuration delay, TInstant& deadline) {
+ auto& runtime = AsKikimrRuntime(r);
+ return scheduledFilter(runtime, event, delay, deadline) && TTestActorRuntime::DefaultScheduledFilterFunc(runtime, event, delay, deadline);
+ });
- runtime.SetScheduledEventsSelectorFunc(&TTestActorRuntime::CollapsedTimeScheduledEventsSelector);
- }, activeZone);
+ runtime.SetScheduledEventsSelectorFunc(&TTestActorRuntime::CollapsedTimeScheduledEventsSelector);
+ }, activeZone);
hasReboot = rebootingObserver.HasReboot();
- } catch (yexception& e) {
- UNIT_FAIL("Failed"
- << " at dispatch " << dispatchName
- << " with exception " << e.what() << "\n");
+ } catch (yexception& e) {
+ UNIT_FAIL("Failed"
+ << " at dispatch " << dispatchName
+ << " with exception " << e.what() << "\n");
}
if (ENABLE_REBOOT_DISPATCH_LOG)
@@ -850,29 +850,29 @@ namespace NKikimr {
}
}
- void RunTestWithPipeResets(const TVector<ui64>& tabletIds, std::function<TTestActorRuntime::TEventFilter()> filterFactory,
+ void RunTestWithPipeResets(const TVector<ui64>& tabletIds, std::function<TTestActorRuntime::TEventFilter()> filterFactory,
std::function<void(const TString& dispatchPass, std::function<void(TTestActorRuntime&)> setup, bool& activeZone)> testFunc,
ui32 selectedReboot, ui32 bucket, ui32 totalBuckets) {
bool activeZone = false;
if (selectedReboot == Max<ui32>()) {
- TTabletTracer tabletTracer(activeZone, tabletIds);
- TTabletScheduledFilter scheduledFilter(tabletTracer);
+ TTabletTracer tabletTracer(activeZone, tabletIds);
+ TTabletScheduledFilter scheduledFilter(tabletTracer);
testFunc(INITIAL_TEST_DISPATCH_NAME, [&](TTestActorRuntime& runtime) {
runtime.SetObserverFunc([&](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event) {
tabletTracer.OnEvent(AsKikimrRuntime(runtime), event);
- return TTestActorRuntime::EEventAction::PROCESS;
- });
-
+ return TTestActorRuntime::EEventAction::PROCESS;
+ });
+
runtime.SetRegistrationObserverFunc([&](TTestActorRuntimeBase& runtime, const TActorId& parentId, const TActorId& actorId) {
tabletTracer.OnRegistration(AsKikimrRuntime(runtime), parentId, actorId);
- });
-
+ });
+
runtime.SetScheduledEventFilter([&](TTestActorRuntimeBase& r, TAutoPtr<IEventHandle>& event,
TDuration delay, TInstant& deadline) {
auto& runtime = AsKikimrRuntime(r);
- return scheduledFilter(runtime, event, delay, deadline) && TTestActorRuntime::DefaultScheduledFilterFunc(runtime, event, delay, deadline);
+ return scheduledFilter(runtime, event, delay, deadline) && TTestActorRuntime::DefaultScheduledFilterFunc(runtime, event, delay, deadline);
});
runtime.SetScheduledEventsSelectorFunc(&TTestActorRuntime::CollapsedTimeScheduledEventsSelector);
@@ -903,28 +903,28 @@ namespace NKikimr {
++runCount;
activeZone = false;
TTestActorRuntime::TEventFilter filter = filterFactory();
- TPipeResetObserver pipeResetingObserver(eventCountBeforeReboot, activeZone, filter, tabletIds);
- TTabletScheduledFilter scheduledFilter(pipeResetingObserver);
-
+ TPipeResetObserver pipeResetingObserver(eventCountBeforeReboot, activeZone, filter, tabletIds);
+ TTabletScheduledFilter scheduledFilter(pipeResetingObserver);
+
testFunc(dispatchName,
- [&](TTestActorRuntime& runtime) {
+ [&](TTestActorRuntime& runtime) {
runtime.SetObserverFunc([&](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event) {
return pipeResetingObserver.OnEvent(AsKikimrRuntime(runtime), event);
- });
-
+ });
+
runtime.SetRegistrationObserverFunc([&](TTestActorRuntimeBase& runtime, const TActorId& parentId, const TActorId& actorId) {
pipeResetingObserver.OnRegistration(AsKikimrRuntime(runtime), parentId, actorId);
- });
-
+ });
+
runtime.SetScheduledEventFilter([&](TTestActorRuntimeBase& r, TAutoPtr<IEventHandle>& event,
- TDuration delay, TInstant& deadline) {
+ TDuration delay, TInstant& deadline) {
auto& runtime = AsKikimrRuntime(r);
- return scheduledFilter(runtime, event, delay, deadline) && TTestActorRuntime::DefaultScheduledFilterFunc(runtime, event, delay, deadline);
- });
-
- runtime.SetScheduledEventsSelectorFunc(&TTestActorRuntime::CollapsedTimeScheduledEventsSelector);
- }, activeZone);
-
+ return scheduledFilter(runtime, event, delay, deadline) && TTestActorRuntime::DefaultScheduledFilterFunc(runtime, event, delay, deadline);
+ });
+
+ runtime.SetScheduledEventsSelectorFunc(&TTestActorRuntime::CollapsedTimeScheduledEventsSelector);
+ }, activeZone);
+
hasReboot = pipeResetingObserver.HasReset();
}
catch (yexception& e) {
@@ -1130,9 +1130,9 @@ namespace NKikimr {
switch (ev->GetTypeRewrite()) {
HFunc(TEvTablet::TEvTabletDead, HandleTabletDead);
HFunc(TEvHive::TEvCreateTablet, Handle);
- HFunc(TEvHive::TEvAdoptTablet, Handle);
+ HFunc(TEvHive::TEvAdoptTablet, Handle);
HFunc(TEvHive::TEvDeleteTablet, Handle);
- HFunc(TEvHive::TEvDeleteOwnerTablets, Handle);
+ HFunc(TEvHive::TEvDeleteOwnerTablets, Handle);
HFunc(TEvHive::TEvRequestHiveInfo, Handle);
HFunc(TEvHive::TEvInitiateTabletExternalBoot, Handle);
HFunc(TEvFakeHive::TEvSubscribeToTabletDeletion, Handle);
@@ -1170,12 +1170,12 @@ namespace NKikimr {
bootstrapperActorId = Boot(ctx, type, &CreatePersQueue, DataGroupErasure);
} else if (type == defaultTabletTypes.PersQueueReadBalancer) {
bootstrapperActorId = Boot(ctx, type, &CreatePersQueueReadBalancer, DataGroupErasure);
- } else if (type == defaultTabletTypes.Coordinator) {
+ } else if (type == defaultTabletTypes.Coordinator) {
bootstrapperActorId = Boot(ctx, type, &CreateFlatTxCoordinator, DataGroupErasure);
- } else if (type == defaultTabletTypes.Mediator) {
+ } else if (type == defaultTabletTypes.Mediator) {
bootstrapperActorId = Boot(ctx, type, &CreateTxMediator, DataGroupErasure);
- } else if (type == defaultTabletTypes.SchemeShard) {
- bootstrapperActorId = Boot(ctx, type, &CreateFlatTxSchemeShard, DataGroupErasure);
+ } else if (type == defaultTabletTypes.SchemeShard) {
+ bootstrapperActorId = Boot(ctx, type, &CreateFlatTxSchemeShard, DataGroupErasure);
} else if (type == defaultTabletTypes.Kesus) {
bootstrapperActorId = Boot(ctx, type, &NKesus::CreateKesusTablet, DataGroupErasure);
} else if (type == defaultTabletTypes.Hive) {
@@ -1214,139 +1214,139 @@ namespace NKikimr {
key.second, it->second.TabletId, TabletID()), 0, ev->Cookie);
}
- void TraceAdoptingCases(const std::pair<ui64, ui64> prevKey,
- const std::pair<ui64, ui64> newKey,
- const TTabletTypes::EType type,
- const ui64 tabletID,
- TString& explain,
- NKikimrProto::EReplyStatus& status)
- {
- auto it = State->Tablets.find(newKey);
- if (it != State->Tablets.end()) {
- if (it->second.TabletId != tabletID) {
- explain = "there is another tablet assotiated with the (owner; ownerIdx)";
- status = NKikimrProto::EReplyStatus::RACE;
- return;
- }
-
- if (it->second.Type != type) {
- explain = "there is the tablet with different type assotiated with the (owner; ownerIdx)";
- status = NKikimrProto::EReplyStatus::RACE;
- return;
- }
-
- explain = "it seems like the tablet aleready adopted";
- status = NKikimrProto::EReplyStatus::ALREADY;
- return;
- }
-
- it = State->Tablets.find(prevKey);
- if (it == State->Tablets.end()) {
- explain = "the tablet isn't found";
- status = NKikimrProto::EReplyStatus::NODATA;
- return;
- }
-
- if (it->second.TabletId != tabletID) {
- explain = "there is another tablet assotiated with the (prevOwner; prevOwnerIdx)";
- status = NKikimrProto::EReplyStatus::ERROR;
- return;
- }
-
- if (it->second.Type != type) { // tablet is the same
- explain = "there is the tablet with different type assotiated with the (preOwner; prevOwnerIdx)";
- status = NKikimrProto::EReplyStatus::ERROR;
- return;
- }
-
- State->Tablets.emplace(newKey, it->second);
- State->Tablets.erase(prevKey);
- State->TabletIdToOwner[tabletID] = newKey;
-
- explain = "we did it";
- status = NKikimrProto::OK;
- return;
- }
-
- void Handle(TEvHive::TEvAdoptTablet::TPtr& ev, const TActorContext& ctx) {
- const std::pair<ui64, ui64> prevKey(ev->Get()->Record.GetPrevOwner(), ev->Get()->Record.GetPrevOwnerIdx());
- const std::pair<ui64, ui64> newKey(ev->Get()->Record.GetOwner(), ev->Get()->Record.GetOwnerIdx());
- const TTabletTypes::EType type = ev->Get()->Record.GetTabletType();
- const ui64 tabletID = ev->Get()->Record.GetTabletID();
-
- TString explain;
- NKikimrProto::EReplyStatus status = NKikimrProto::OK;
-
- TraceAdoptingCases(prevKey, newKey, type, tabletID, explain, status);
-
- ctx.Send(ev->Sender, new TEvHive::TEvAdoptTabletReply(status, tabletID, newKey.first,
- newKey.second, explain, TabletID()), 0, ev->Cookie);
- }
-
- void DeleteTablet(const std::pair<ui64, ui64>& id, const TActorContext &ctx) {
- auto it = State->Tablets.find(id);
- if (it == State->Tablets.end()) {
- return;
- }
-
- TFakeHiveTabletInfo& tabletInfo = it->second;
- ctx.Send(ctx.SelfID, new TEvFakeHive::TEvNotifyTabletDeleted(tabletInfo.TabletId));
-
- // Kill the tablet and don't restart it
+ void TraceAdoptingCases(const std::pair<ui64, ui64> prevKey,
+ const std::pair<ui64, ui64> newKey,
+ const TTabletTypes::EType type,
+ const ui64 tabletID,
+ TString& explain,
+ NKikimrProto::EReplyStatus& status)
+ {
+ auto it = State->Tablets.find(newKey);
+ if (it != State->Tablets.end()) {
+ if (it->second.TabletId != tabletID) {
+ explain = "there is another tablet assotiated with the (owner; ownerIdx)";
+ status = NKikimrProto::EReplyStatus::RACE;
+ return;
+ }
+
+ if (it->second.Type != type) {
+ explain = "there is the tablet with different type assotiated with the (owner; ownerIdx)";
+ status = NKikimrProto::EReplyStatus::RACE;
+ return;
+ }
+
+ explain = "it seems like the tablet aleready adopted";
+ status = NKikimrProto::EReplyStatus::ALREADY;
+ return;
+ }
+
+ it = State->Tablets.find(prevKey);
+ if (it == State->Tablets.end()) {
+ explain = "the tablet isn't found";
+ status = NKikimrProto::EReplyStatus::NODATA;
+ return;
+ }
+
+ if (it->second.TabletId != tabletID) {
+ explain = "there is another tablet assotiated with the (prevOwner; prevOwnerIdx)";
+ status = NKikimrProto::EReplyStatus::ERROR;
+ return;
+ }
+
+ if (it->second.Type != type) { // tablet is the same
+ explain = "there is the tablet with different type assotiated with the (preOwner; prevOwnerIdx)";
+ status = NKikimrProto::EReplyStatus::ERROR;
+ return;
+ }
+
+ State->Tablets.emplace(newKey, it->second);
+ State->Tablets.erase(prevKey);
+ State->TabletIdToOwner[tabletID] = newKey;
+
+ explain = "we did it";
+ status = NKikimrProto::OK;
+ return;
+ }
+
+ void Handle(TEvHive::TEvAdoptTablet::TPtr& ev, const TActorContext& ctx) {
+ const std::pair<ui64, ui64> prevKey(ev->Get()->Record.GetPrevOwner(), ev->Get()->Record.GetPrevOwnerIdx());
+ const std::pair<ui64, ui64> newKey(ev->Get()->Record.GetOwner(), ev->Get()->Record.GetOwnerIdx());
+ const TTabletTypes::EType type = ev->Get()->Record.GetTabletType();
+ const ui64 tabletID = ev->Get()->Record.GetTabletID();
+
+ TString explain;
+ NKikimrProto::EReplyStatus status = NKikimrProto::OK;
+
+ TraceAdoptingCases(prevKey, newKey, type, tabletID, explain, status);
+
+ ctx.Send(ev->Sender, new TEvHive::TEvAdoptTabletReply(status, tabletID, newKey.first,
+ newKey.second, explain, TabletID()), 0, ev->Cookie);
+ }
+
+ void DeleteTablet(const std::pair<ui64, ui64>& id, const TActorContext &ctx) {
+ auto it = State->Tablets.find(id);
+ if (it == State->Tablets.end()) {
+ return;
+ }
+
+ TFakeHiveTabletInfo& tabletInfo = it->second;
+ ctx.Send(ctx.SelfID, new TEvFakeHive::TEvNotifyTabletDeleted(tabletInfo.TabletId));
+
+ // Kill the tablet and don't restart it
TActorId bootstrapperActorId = tabletInfo.BootstrapperActorId;
- ctx.Send(bootstrapperActorId, new TEvBootstrapper::TEvStandBy());
-
+ ctx.Send(bootstrapperActorId, new TEvBootstrapper::TEvStandBy());
+
for (TActorId waiter : tabletInfo.DeletionWaiters) {
- SendDeletionNotification(it->second.TabletId, waiter, ctx);
- }
- State->TabletIdToOwner.erase(it->second.TabletId);
- State->Tablets.erase(it);
- }
-
+ SendDeletionNotification(it->second.TabletId, waiter, ctx);
+ }
+ State->TabletIdToOwner.erase(it->second.TabletId);
+ State->Tablets.erase(it);
+ }
+
void Handle(TEvHive::TEvDeleteTablet::TPtr &ev, const TActorContext &ctx) {
NKikimrHive::TEvDeleteTablet& rec = ev->Get()->Record;
Cout << "FAKEHIVE " << TabletID() << " TEvDeleteTablet " << rec.ShortDebugString() << Endl;
- TVector<ui64> deletedIdx;
- for (size_t i = 0; i < rec.ShardLocalIdxSize(); ++i) {
- auto id = std::make_pair<ui64, ui64>(rec.GetShardOwnerId(), rec.GetShardLocalIdx(i));
- deletedIdx.push_back(rec.GetShardLocalIdx(i));
- DeleteTablet(id, ctx);
- }
- ctx.Send(ev->Sender, new TEvHive::TEvDeleteTabletReply(NKikimrProto::OK, TabletID(), rec.GetTxId_Deprecated(), rec.GetShardOwnerId(), deletedIdx));
- }
-
- void Handle(TEvHive::TEvDeleteOwnerTablets::TPtr &ev, const TActorContext &ctx) {
- NKikimrHive::TEvDeleteOwnerTablets& rec = ev->Get()->Record;
+ TVector<ui64> deletedIdx;
+ for (size_t i = 0; i < rec.ShardLocalIdxSize(); ++i) {
+ auto id = std::make_pair<ui64, ui64>(rec.GetShardOwnerId(), rec.GetShardLocalIdx(i));
+ deletedIdx.push_back(rec.GetShardLocalIdx(i));
+ DeleteTablet(id, ctx);
+ }
+ ctx.Send(ev->Sender, new TEvHive::TEvDeleteTabletReply(NKikimrProto::OK, TabletID(), rec.GetTxId_Deprecated(), rec.GetShardOwnerId(), deletedIdx));
+ }
+
+ void Handle(TEvHive::TEvDeleteOwnerTablets::TPtr &ev, const TActorContext &ctx) {
+ NKikimrHive::TEvDeleteOwnerTablets& rec = ev->Get()->Record;
Cout << "FAKEHIVE " << TabletID() << " TEvDeleteOwnerTablets " << rec.ShortDebugString() << Endl;
- auto ownerId = rec.GetOwner();
- TVector<ui64> toDelete;
-
- if (ownerId == 0) {
- ctx.Send(ev->Sender, new TEvHive::TEvDeleteOwnerTabletsReply(NKikimrProto::ERROR, TabletID(), ownerId, rec.GetTxId()));
- return;
- }
-
- for (auto& item: State->Tablets) {
- auto& id = item.first;
-
- if (id.first != ownerId) {
- continue;
+ auto ownerId = rec.GetOwner();
+ TVector<ui64> toDelete;
+
+ if (ownerId == 0) {
+ ctx.Send(ev->Sender, new TEvHive::TEvDeleteOwnerTabletsReply(NKikimrProto::ERROR, TabletID(), ownerId, rec.GetTxId()));
+ return;
+ }
+
+ for (auto& item: State->Tablets) {
+ auto& id = item.first;
+
+ if (id.first != ownerId) {
+ continue;
}
-
- toDelete.push_back(id.second);
+
+ toDelete.push_back(id.second);
+ }
+
+ if (toDelete.empty()) {
+ ctx.Send(ev->Sender, new TEvHive::TEvDeleteOwnerTabletsReply(NKikimrProto::ALREADY, TabletID(), ownerId, rec.GetTxId()));
+ return;
}
-
- if (toDelete.empty()) {
- ctx.Send(ev->Sender, new TEvHive::TEvDeleteOwnerTabletsReply(NKikimrProto::ALREADY, TabletID(), ownerId, rec.GetTxId()));
- return;
- }
-
- for (auto& idx: toDelete) {
- std::pair<ui64, ui64> id(ownerId, idx);
- DeleteTablet(id, ctx);
- }
-
- ctx.Send(ev->Sender, new TEvHive::TEvDeleteOwnerTabletsReply(NKikimrProto::OK, TabletID(), ownerId, rec.GetTxId()));
+
+ for (auto& idx: toDelete) {
+ std::pair<ui64, ui64> id(ownerId, idx);
+ DeleteTablet(id, ctx);
+ }
+
+ ctx.Send(ev->Sender, new TEvHive::TEvDeleteOwnerTabletsReply(NKikimrProto::OK, TabletID(), ownerId, rec.GetTxId()));
}
void Handle(TEvHive::TEvRequestHiveInfo::TPtr &ev, const TActorContext &ctx) {
@@ -1432,8 +1432,8 @@ namespace NKikimr {
};
void BootFakeHive(TTestActorRuntime& runtime, ui64 tabletId, TFakeHiveState::TPtr state,
- TGetTabletCreationFunc getTabletCreationFunc)
- {
+ TGetTabletCreationFunc getTabletCreationFunc)
+ {
CreateTestBootstrapper(runtime, CreateTestTabletInfo(tabletId, TTabletTypes::Hive), [=](const TActorId & tablet, TTabletStorageInfo* info) {
return new TFakeHive(tablet, info, state,
(getTabletCreationFunc == nullptr) ? &TFakeHive::DefaultGetTabletCreationFunc : getTabletCreationFunc);
diff --git a/ydb/core/testlib/tablet_helpers.h b/ydb/core/testlib/tablet_helpers.h
index f54ed9acf78..81a7c614aaa 100644
--- a/ydb/core/testlib/tablet_helpers.h
+++ b/ydb/core/testlib/tablet_helpers.h
@@ -28,8 +28,8 @@ namespace NKikimr {
void SetupTabletServices(TTestActorRuntime& runtime, TAppPrepare* app = nullptr, bool mockDisk = false,
NFake::TStorage storage = {}, NFake::TCaches caches = {});
- const TString DEFAULT_STORAGE_POOL = "Storage Pool with id: 1";
-
+ const TString DEFAULT_STORAGE_POOL = "Storage Pool with id: 1";
+
static TChannelBind GetDefaultChannelBind(const TString& storagePool = DEFAULT_STORAGE_POOL) {
TChannelBind bind;
bind.SetStoragePoolName(storagePool);
@@ -42,7 +42,7 @@ namespace NKikimr {
TDomainsInfo::TDomain::TStoragePoolKinds DefaultPoolKinds(ui32 count = 1);
i64 SetSplitMergePartCountLimit(TTestActorRuntime* runtime, i64 val);
- bool SetAllowServerlessStorageBilling(TTestActorRuntime* runtime, bool isAllow);
+ bool SetAllowServerlessStorageBilling(TTestActorRuntime* runtime, bool isAllow);
const TString INITIAL_TEST_DISPATCH_NAME = "Trace";
@@ -51,7 +51,7 @@ namespace NKikimr {
ui32 selectedReboot = Max<ui32>(), ui64 selectedTablet = Max<ui64>(), ui32 bucket = 0, ui32 totalBuckets = 0, bool killOnCommit = false);
// Resets pipe when receiving client events
- void RunTestWithPipeResets(const TVector<ui64>& tabletIds, std::function<TTestActorRuntime::TEventFilter()> filterFactory,
+ void RunTestWithPipeResets(const TVector<ui64>& tabletIds, std::function<TTestActorRuntime::TEventFilter()> filterFactory,
std::function<void(const TString& dispatchPass, std::function<void(TTestActorRuntime&)> setup, bool& activeZone)> testFunc,
ui32 selectedReboot = Max<ui32>(), ui32 bucket = 0, ui32 totalBuckets = 0);
@@ -124,8 +124,8 @@ namespace NKikimr {
, TabletId(tabletId)
, BootstrapperActorId(bootstrapperActorId)
{}
-
- TFakeHiveTabletInfo(const TFakeHiveTabletInfo& info) = default;
+
+ TFakeHiveTabletInfo(const TFakeHiveTabletInfo& info) = default;
};
struct TFakeHiveState : TThrRefBase {
diff --git a/ydb/core/testlib/tenant_runtime.cpp b/ydb/core/testlib/tenant_runtime.cpp
index f7476a9f00f..974cc166d0d 100644
--- a/ydb/core/testlib/tenant_runtime.cpp
+++ b/ydb/core/testlib/tenant_runtime.cpp
@@ -33,7 +33,7 @@
namespace NKikimr {
using namespace NTabletFlatExecutor;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NConsole;
using namespace NTenantSlotBroker;
@@ -129,7 +129,7 @@ public:
};
class TFakeSchemeShard : public TActor<TFakeSchemeShard>, public TTabletExecutedFlat {
- void Handle(TEvSchemeShard::TEvDescribeScheme::TPtr &ev, const TActorContext &ctx)
+ void Handle(TEvSchemeShard::TEvDescribeScheme::TPtr &ev, const TActorContext &ctx)
{
if (HoldResolve) {
Queue.push_back(ev.Release());
@@ -142,24 +142,24 @@ class TFakeSchemeShard : public TActor<TFakeSchemeShard>, public TTabletExecuted
if (!path)
path = Paths[rec.GetPathId()];
- auto *resp = new TEvSchemeShard::TEvDescribeSchemeResultBuilder;
+ auto *resp = new TEvSchemeShard::TEvDescribeSchemeResultBuilder;
resp->Record.SetPath(path);
auto it = SubDomains.find(path);
if (it != SubDomains.end()) {
- resp->Record.SetStatus(NKikimrScheme::StatusSuccess);
+ resp->Record.SetStatus(NKikimrScheme::StatusSuccess);
auto &self = *resp->Record.MutablePathDescription()->MutableSelf();
self.SetName(ev->Get()->Record.GetPath());
self.SetPathId(it->second);
self.SetSchemeshardId(TabletID());
- self.SetPathType(NKikimrSchemeOp::EPathTypeSubDomain);
+ self.SetPathType(NKikimrSchemeOp::EPathTypeSubDomain);
auto &domain = *resp->Record.MutablePathDescription()->MutableDomainDescription();
domain.SetSchemeShardId_Depricated(TabletID());
domain.SetPathId_Depricated(it->second);
domain.MutableDomainKey()->SetSchemeShard(TabletID());
domain.MutableDomainKey()->SetPathId(it->second);
} else {
- resp->Record.SetStatus(NKikimrScheme::StatusPathDoesNotExist);
+ resp->Record.SetStatus(NKikimrScheme::StatusPathDoesNotExist);
}
ctx.Send(ev->Sender, resp);
}
@@ -218,7 +218,7 @@ public:
STFUNC(StateWork)
{
switch (ev->GetTypeRewrite()) {
- HFunc(TEvSchemeShard::TEvDescribeScheme, Handle);
+ HFunc(TEvSchemeShard::TEvDescribeScheme, Handle);
HFunc(TEvTest::TEvHoldResolve, Handle);
default:
break;
@@ -351,7 +351,7 @@ class TFakeHive : public TActor<TFakeHive>, public TTabletExecutedFlat {
void ResolveKey(TSubDomainKey key, const TActorContext &ctx)
{
TActorId clientId = ctx.Register(NKikimr::NTabletPipe::CreateClient(ctx.SelfID, key.GetSchemeShard()));
- auto *request = new TEvSchemeShard::TEvDescribeScheme(key.GetSchemeShard(), key.GetPathId());
+ auto *request = new TEvSchemeShard::TEvDescribeScheme(key.GetSchemeShard(), key.GetPathId());
NTabletPipe::SendData(ctx, clientId, request);
ctx.Send(clientId, new NKikimr::TEvTabletPipe::TEvShutdown);
}
@@ -362,10 +362,10 @@ class TFakeHive : public TActor<TFakeHive>, public TTabletExecutedFlat {
CheckState(ctx);
}
- void Handle(TEvSchemeShard::TEvDescribeSchemeResult::TPtr &ev, const TActorContext &ctx)
+ void Handle(TEvSchemeShard::TEvDescribeSchemeResult::TPtr &ev, const TActorContext &ctx)
{
const auto &rec = ev->Get()->GetRecord();
- UNIT_ASSERT_VALUES_EQUAL(rec.GetStatus(), NKikimrScheme::StatusSuccess);
+ UNIT_ASSERT_VALUES_EQUAL(rec.GetStatus(), NKikimrScheme::StatusSuccess);
auto &path = rec.GetPath();
auto shardId = rec.GetPathDescription().GetSelf().GetSchemeshardId();
auto pathId = rec.GetPathDescription().GetSelf().GetPathId();
@@ -427,8 +427,8 @@ class TFakeHive : public TActor<TFakeHive>, public TTabletExecutedFlat {
bootstrapperActorId = Boot(ctx, type, &CreateFlatTxCoordinator, DataGroupErasure);
} else if (type == defaultTabletTypes.Mediator) {
bootstrapperActorId = Boot(ctx, type, &CreateTxMediator, DataGroupErasure);
- } else if (type == defaultTabletTypes.SchemeShard) {
- bootstrapperActorId = Boot(ctx, type, &CreateFlatTxSchemeShard, DataGroupErasure);
+ } else if (type == defaultTabletTypes.SchemeShard) {
+ bootstrapperActorId = Boot(ctx, type, &CreateFlatTxSchemeShard, DataGroupErasure);
} else if (type == defaultTabletTypes.Hive) {
bootstrapperActorId = Boot(ctx, type, &CreateDefaultHive, DataGroupErasure);
} else if (type == defaultTabletTypes.SysViewProcessor) {
@@ -469,10 +469,10 @@ class TFakeHive : public TActor<TFakeHive>, public TTabletExecutedFlat {
void Handle(TEvHive::TEvDeleteTablet::TPtr &ev, const TActorContext &ctx) {
NKikimrHive::TEvDeleteTablet& rec = ev->Get()->Record;
- TVector<ui64> localIds;
- for (size_t i = 0; i < rec.ShardLocalIdxSize(); ++i) {
- localIds.push_back(rec.GetShardLocalIdx(i));
- auto it = State.Tablets.find(std::make_pair<ui64, ui64>(rec.GetShardOwnerId(), rec.GetShardLocalIdx(i)));
+ TVector<ui64> localIds;
+ for (size_t i = 0; i < rec.ShardLocalIdxSize(); ++i) {
+ localIds.push_back(rec.GetShardLocalIdx(i));
+ auto it = State.Tablets.find(std::make_pair<ui64, ui64>(rec.GetShardOwnerId(), rec.GetShardLocalIdx(i)));
if (it != State.Tablets.end()) {
ctx.Send(ctx.SelfID, new TEvFakeHive::TEvNotifyTabletDeleted(it->second.TabletId));
@@ -486,38 +486,38 @@ class TFakeHive : public TActor<TFakeHive>, public TTabletExecutedFlat {
State.Tablets.erase(it);
}
}
- ctx.Send(ev->Sender, new TEvHive::TEvDeleteTabletReply(NKikimrProto::OK, TabletID(), rec.GetTxId_Deprecated(), rec.GetShardOwnerId(), localIds));
- }
-
- void Handle(TEvHive::TEvDeleteOwnerTablets::TPtr &ev, const TActorContext &ctx) {
- NKikimrHive::TEvDeleteOwnerTablets& rec = ev->Get()->Record;
- TVector<ui64> toDelete;
- for (auto item : State.Tablets) {
- if (item.first.first != rec.GetOwner()) {
- continue;
- }
- toDelete.push_back(item.first.second);
- }
-
- for (auto idx: toDelete) {
- auto it = State.Tablets.find(std::pair<ui64, ui64>(rec.GetOwner(), idx));
- if (it != State.Tablets.end()) {
- ctx.Send(ctx.SelfID, new TEvFakeHive::TEvNotifyTabletDeleted(it->second.TabletId));
-
+ ctx.Send(ev->Sender, new TEvHive::TEvDeleteTabletReply(NKikimrProto::OK, TabletID(), rec.GetTxId_Deprecated(), rec.GetShardOwnerId(), localIds));
+ }
+
+ void Handle(TEvHive::TEvDeleteOwnerTablets::TPtr &ev, const TActorContext &ctx) {
+ NKikimrHive::TEvDeleteOwnerTablets& rec = ev->Get()->Record;
+ TVector<ui64> toDelete;
+ for (auto item : State.Tablets) {
+ if (item.first.first != rec.GetOwner()) {
+ continue;
+ }
+ toDelete.push_back(item.first.second);
+ }
+
+ for (auto idx: toDelete) {
+ auto it = State.Tablets.find(std::pair<ui64, ui64>(rec.GetOwner(), idx));
+ if (it != State.Tablets.end()) {
+ ctx.Send(ctx.SelfID, new TEvFakeHive::TEvNotifyTabletDeleted(it->second.TabletId));
+
TActorId bootstrapperActorId = it->second.BootstrapperActorId;
- ctx.Send(bootstrapperActorId, new TEvBootstrapper::TEvStandBy());
-
+ ctx.Send(bootstrapperActorId, new TEvBootstrapper::TEvStandBy());
+
for (TActorId waiter : it->second.DeletionWaiters) {
- SendDeletionNotification(it->second.TabletId, waiter, ctx);
- }
- State.TabletIdToOwner.erase(it->second.TabletId);
- State.Tablets.erase(it);
- }
- }
-
- ctx.Send(ev->Sender, new TEvHive::TEvDeleteOwnerTabletsReply(NKikimrProto::OK, TabletID(), rec.GetOwner(), rec.GetTxId()));
- }
-
+ SendDeletionNotification(it->second.TabletId, waiter, ctx);
+ }
+ State.TabletIdToOwner.erase(it->second.TabletId);
+ State.Tablets.erase(it);
+ }
+ }
+
+ ctx.Send(ev->Sender, new TEvHive::TEvDeleteOwnerTabletsReply(NKikimrProto::OK, TabletID(), rec.GetOwner(), rec.GetTxId()));
+ }
+
void Handle(TEvLocal::TEvRegisterNode::TPtr &ev, const TActorContext &ctx)
{
auto &record = ev->Get()->Record;
@@ -661,10 +661,10 @@ public:
TRACE_EVENT(NKikimrServices::HIVE);
switch (ev->GetTypeRewrite()) {
HFuncTraced(TEvents::TEvUndelivered, Handle);
- HFuncTraced(TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ HFuncTraced(TEvSchemeShard::TEvDescribeSchemeResult, Handle);
HFuncTraced(TEvHive::TEvCreateTablet, Handle);
HFuncTraced(TEvHive::TEvDeleteTablet, Handle);
- HFuncTraced(TEvHive::TEvDeleteOwnerTablets, Handle);
+ HFuncTraced(TEvHive::TEvDeleteOwnerTablets, Handle);
HFuncTraced(TEvLocal::TEvRegisterNode, Handle);
HFuncTraced(TEvLocal::TEvStatus, Handle);
HFuncTraced(TEvTest::TEvWaitHiveState, Handle);
@@ -787,10 +787,10 @@ void TTenantTestRuntime::Setup(bool createTenantPools)
SetLogPriority(NKikimrServices::CONFIGS_CACHE, NLog::PRI_TRACE);
SetLogPriority(NKikimrServices::HIVE, NLog::PRI_DEBUG);
SetLogPriority(NKikimrServices::BS_CONTROLLER, NLog::PRI_DEBUG);
- SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NLog::PRI_DEBUG);
- SetLogPriority(NKikimrServices::TX_PROXY, NLog::PRI_DEBUG);
- SetLogPriority(NKikimrServices::TX_PROXY_SCHEME_CACHE, NLog::PRI_DEBUG);
-
+ SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NLog::PRI_DEBUG);
+ SetLogPriority(NKikimrServices::TX_PROXY, NLog::PRI_DEBUG);
+ SetLogPriority(NKikimrServices::TX_PROXY_SCHEME_CACHE, NLog::PRI_DEBUG);
+
//SetLogPriority(NKikimrServices::TX_MEDIATOR, NLog::PRI_DEBUG);
//SetLogPriority(NKikimrServices::TX_COORDINATOR, NLog::PRI_DEBUG);
//SetLogPriority(NKikimrServices::BS_CONTROLLER, NLog::PRI_DEBUG);
@@ -809,26 +809,26 @@ void TTenantTestRuntime::Setup(bool createTenantPools)
ui32 planResolution = 500;
// Add domains info.
- for (ui32 i = 0; i < Config.Domains.size(); ++i) {
+ for (ui32 i = 0; i < Config.Domains.size(); ++i) {
auto &domain = Config.Domains[i];
NKikimrBlobStorage::TDefineStoragePool hddPool;
hddPool.SetBoxId(1);
hddPool.SetErasureSpecies("none");
hddPool.SetVDiskKind("Default");
hddPool.AddPDiskFilter()->AddProperty()->SetType(NKikimrBlobStorage::ROT);
- TDomainsInfo::TDomain::TStoragePoolKinds poolTypes;
+ TDomainsInfo::TDomain::TStoragePoolKinds poolTypes;
poolTypes["hdd"] = hddPool;
poolTypes["hdd-1"] = hddPool;
poolTypes["hdd-2"] = hddPool;
poolTypes["hdd-3"] = hddPool;
- auto domainPtr = TDomainsInfo::TDomain::ConstructDomainWithExplicitTabletIds(domain.Name, i, domain.SchemeShardId,
+ auto domainPtr = TDomainsInfo::TDomain::ConstructDomainWithExplicitTabletIds(domain.Name, i, domain.SchemeShardId,
i, i, TVector<ui32>{i},
- i, TVector<ui32>{i},
+ i, TVector<ui32>{i},
planResolution,
- TVector<ui64>{TDomainsInfo::MakeTxCoordinatorIDFixed(i, 1)},
- TVector<ui64>{TDomainsInfo::MakeTxMediatorIDFixed(i, 1)},
- TVector<ui64>{TDomainsInfo::MakeTxAllocatorIDFixed(i, 1)},
- poolTypes);
+ TVector<ui64>{TDomainsInfo::MakeTxCoordinatorIDFixed(i, 1)},
+ TVector<ui64>{TDomainsInfo::MakeTxMediatorIDFixed(i, 1)},
+ TVector<ui64>{TDomainsInfo::MakeTxAllocatorIDFixed(i, 1)},
+ poolTypes);
TVector<ui64> ids = GetTxAllocatorTabletIds();
ids.insert(ids.end(), domainPtr->TxAllocators.begin(), domainPtr->TxAllocators.end());
@@ -850,22 +850,22 @@ void TTenantTestRuntime::Setup(bool createTenantPools)
Register(NTabletMonitoringProxy::CreateTabletMonitoringProxy());
}
- for (auto &pr : GetAppData().DomainsInfo->Domains) {
- auto &domain = pr.second;
- for (auto id : domain->TxAllocators) {
+ for (auto &pr : GetAppData().DomainsInfo->Domains) {
+ auto &domain = pr.second;
+ for (auto id : domain->TxAllocators) {
auto aid = CreateTestBootstrapper(*this, CreateTestTabletInfo(id, TTabletTypes::TX_ALLOCATOR), &CreateTxAllocator);
- EnableScheduleForActor(aid, true);
- }
- for (auto id : domain->Coordinators) {
+ EnableScheduleForActor(aid, true);
+ }
+ for (auto id : domain->Coordinators) {
auto aid = CreateTestBootstrapper(*this, CreateTestTabletInfo(id, TTabletTypes::FLAT_TX_COORDINATOR), &CreateFlatTxCoordinator);
- EnableScheduleForActor(aid, true);
- }
- for (auto id : domain->Mediators) {
+ EnableScheduleForActor(aid, true);
+ }
+ for (auto id : domain->Mediators) {
auto aid = CreateTestBootstrapper(*this, CreateTestTabletInfo(id, TTabletTypes::TX_MEDIATOR), &CreateTxMediator);
- EnableScheduleForActor(aid, true);
- }
- }
-
+ EnableScheduleForActor(aid, true);
+ }
+ }
+
// Create Scheme Shards
Sender = AllocateEdgeActor();
for (size_t i = 0; i < Config.Domains.size(); ++i) {
@@ -893,38 +893,38 @@ void TTenantTestRuntime::Setup(bool createTenantPools)
EnableScheduleForActor(actorId, true);
// Init scheme root.
- {
- auto evTx = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(1, domain.SchemeShardId);
- auto transaction = evTx->Record.AddTransaction();
- transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain);
- transaction->SetWorkingDir("/");
- auto op = transaction->MutableSubDomain();
- op->SetName(domain.Name);
-
+ {
+ auto evTx = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(1, domain.SchemeShardId);
+ auto transaction = evTx->Record.AddTransaction();
+ transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain);
+ transaction->SetWorkingDir("/");
+ auto op = transaction->MutableSubDomain();
+ op->SetName(domain.Name);
+
for (const auto& [kind, pool] : GetAppData().DomainsInfo->GetDomain(0).StoragePoolTypes) {
- auto* p = op->AddStoragePools();
- p->SetKind(kind);
- p->SetName(pool.GetName());
+ auto* p = op->AddStoragePools();
+ p->SetKind(kind);
+ p->SetName(pool.GetName());
}
-
- SendToPipe(domain.SchemeShardId, Sender, evTx.Release(), 0, GetPipeConfigWithRetries());
-
- {
- TAutoPtr<IEventHandle> handle;
- auto event = GrabEdgeEvent<TEvSchemeShard::TEvModifySchemeTransactionResult>(handle);
- UNIT_ASSERT_VALUES_EQUAL(event->Record.GetSchemeshardId(), domain.SchemeShardId);
- UNIT_ASSERT_VALUES_EQUAL(event->Record.GetStatus(), NKikimrScheme::EStatus::StatusAccepted);
+
+ SendToPipe(domain.SchemeShardId, Sender, evTx.Release(), 0, GetPipeConfigWithRetries());
+
+ {
+ TAutoPtr<IEventHandle> handle;
+ auto event = GrabEdgeEvent<TEvSchemeShard::TEvModifySchemeTransactionResult>(handle);
+ UNIT_ASSERT_VALUES_EQUAL(event->Record.GetSchemeshardId(), domain.SchemeShardId);
+ UNIT_ASSERT_VALUES_EQUAL(event->Record.GetStatus(), NKikimrScheme::EStatus::StatusAccepted);
}
-
- auto evSubscribe = MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(1);
- SendToPipe(domain.SchemeShardId, Sender, evSubscribe.Release(), 0, GetPipeConfigWithRetries());
-
- {
- TAutoPtr<IEventHandle> handle;
- auto event = GrabEdgeEvent<TEvSchemeShard::TEvNotifyTxCompletionResult>(handle);
- UNIT_ASSERT_VALUES_EQUAL(event->Record.GetTxId(), 1);
- }
- }
+
+ auto evSubscribe = MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(1);
+ SendToPipe(domain.SchemeShardId, Sender, evSubscribe.Release(), 0, GetPipeConfigWithRetries());
+
+ {
+ TAutoPtr<IEventHandle> handle;
+ auto event = GrabEdgeEvent<TEvSchemeShard::TEvNotifyTxCompletionResult>(handle);
+ UNIT_ASSERT_VALUES_EQUAL(event->Record.GetTxId(), 1);
+ }
+ }
Y_VERIFY(domain.Subdomains.empty(), "Pre-initialized subdomains are not supported for real SchemeShard");
}
}
@@ -1118,7 +1118,7 @@ void TTenantTestRuntime::Setup(bool createTenantPools)
}
TTenantTestRuntime::TTenantTestRuntime(const TTenantTestConfig &config,
- const NKikimrConfig::TAppConfig &extension,
+ const NKikimrConfig::TAppConfig &extension,
bool createTenantPools)
: TTestBasicRuntime(config.Nodes.size(), config.DataCenterCount, false)
, Config(config)
diff --git a/ydb/core/testlib/tenant_runtime.h b/ydb/core/testlib/tenant_runtime.h
index 1bde6260999..f98c1441af3 100644
--- a/ydb/core/testlib/tenant_runtime.h
+++ b/ydb/core/testlib/tenant_runtime.h
@@ -196,7 +196,7 @@ private:
public:
TTenantTestRuntime(const TTenantTestConfig &config,
- const NKikimrConfig::TAppConfig &extension = {},
+ const NKikimrConfig::TAppConfig &extension = {},
bool createTenantPools = true);
void CreateTenantPool(ui32 nodeIndex);
diff --git a/ydb/core/testlib/test_client.cpp b/ydb/core/testlib/test_client.cpp
index 2d9cef6ed2d..d4907c26f1e 100644
--- a/ydb/core/testlib/test_client.cpp
+++ b/ydb/core/testlib/test_client.cpp
@@ -90,7 +90,7 @@
#include <ydb/core/client/server/msgbus_server_tracer.h>
#include <library/cpp/actors/interconnect/interconnect.h>
-
+
#include <library/cpp/grpc/server/actors/logger.h>
#include <util/system/sanitizers.h>
@@ -130,33 +130,33 @@ namespace Tests {
}
ui64 ChangeDomain(ui64 tabletId, ui32 domainUid) {
- return MakeTabletID(StateStorageGroupFromTabletID(tabletId), domainUid, UniqPartFromTabletID(tabletId));
+ return MakeTabletID(StateStorageGroupFromTabletID(tabletId), domainUid, UniqPartFromTabletID(tabletId));
+ }
+
+ ui64 ChangeStateStorage(ui64 tabletId, ui32 ssUid) {
+ return MakeTabletID(ssUid, HiveUidFromTabletID(tabletId), UniqPartFromTabletID(tabletId));
}
- ui64 ChangeStateStorage(ui64 tabletId, ui32 ssUid) {
- return MakeTabletID(ssUid, HiveUidFromTabletID(tabletId), UniqPartFromTabletID(tabletId));
- }
-
TServer::TServer(TServerSettings::TConstPtr settings, bool init)
- : Settings(settings)
- , UseStoragePools(!Settings->StoragePoolTypes.empty())
+ : Settings(settings)
+ , UseStoragePools(!Settings->StoragePoolTypes.empty())
{
- if (Settings->SupportsRedirect && IsServerRedirected())
- return;
+ if (Settings->SupportsRedirect && IsServerRedirected())
+ return;
if (init)
Initialize();
- }
-
+ }
+
TServer::TServer(const TServerSettings &settings, bool init)
: TServer(new TServerSettings(settings), init)
- {
+ {
}
- void TServer::Initialize() {
- if (Settings->SupportsRedirect && IsServerRedirected())
- return;
-
+ void TServer::Initialize() {
+ if (Settings->SupportsRedirect && IsServerRedirected())
+ return;
+
TAppPrepare app; /* will cook TAppData */
app.SetNetDataSourceUrl(Settings->NetClassifierConfig.GetUpdaterConfig().GetNetDataSourceUrl());
app.SetEnableKqpSpilling(Settings->EnableKqpSpilling);
@@ -173,25 +173,25 @@ namespace Tests {
runtime.EnableScheduleForActor(actorId);
});
- for (auto& it: Settings->NodeKeys) {
- ui32 nodeId = it.first;
- const TString& keyValue = it.second;
-
- TString baseDir = Runtime->GetTempDir();
- TString keyfile = TStringBuilder() << baseDir << "/key-" << nodeId << ".txt";
- {
- TFileOutput file(keyfile);
- file << keyValue;
- }
- app.SetKeyForNode(keyfile, nodeId);
- }
-
- SetupLogging();
-
- SetupMessageBus(Settings->Port, Settings->TracePath);
+ for (auto& it: Settings->NodeKeys) {
+ ui32 nodeId = it.first;
+ const TString& keyValue = it.second;
+
+ TString baseDir = Runtime->GetTempDir();
+ TString keyfile = TStringBuilder() << baseDir << "/key-" << nodeId << ".txt";
+ {
+ TFileOutput file(keyfile);
+ file << keyValue;
+ }
+ app.SetKeyForNode(keyfile, nodeId);
+ }
+
+ SetupLogging();
+
+ SetupMessageBus(Settings->Port, Settings->TracePath);
SetupDomains(app);
- app.AddHive(Settings->Domain, ChangeStateStorage(Hive, Settings->Domain));
+ app.AddHive(Settings->Domain, ChangeStateStorage(Hive, Settings->Domain));
app.SetFnRegistry(Settings->FrFactory);
app.SetFormatsFactory(Settings->Formats);
@@ -208,7 +208,7 @@ namespace Tests {
CreateBootstrapTablets();
SetupStorage();
-
+
for (ui32 nodeIdx = 0; nodeIdx < StaticNodes() + DynamicNodes(); ++nodeIdx) {
SetupDomainLocalService(nodeIdx);
Runtime->GetAppData(nodeIdx).AuthConfig.MergeFrom(Settings->AuthConfig);
@@ -222,7 +222,7 @@ namespace Tests {
}
}
- void TServer::SetupMessageBus(ui16 port, const TString &tracePath) {
+ void TServer::SetupMessageBus(ui16 port, const TString &tracePath) {
if (port) {
Bus = NBus::CreateMessageQueue(NBus::TBusQueueConfig());
if (tracePath) {
@@ -342,29 +342,29 @@ namespace Tests {
}
void TServer::SetupDomains(TAppPrepare &app) {
- const ui32 domainId = Settings->Domain;
+ const ui32 domainId = Settings->Domain;
ui64 planResolution = Settings->DomainPlanResolution;
if (!planResolution) {
planResolution = Settings->UseRealThreads ? 7 : 500;
}
- auto domain = TDomainsInfo::TDomain::ConstructDomainWithExplicitTabletIds(Settings->DomainName, domainId, ChangeStateStorage(SchemeRoot, domainId),
+ auto domain = TDomainsInfo::TDomain::ConstructDomainWithExplicitTabletIds(Settings->DomainName, domainId, ChangeStateStorage(SchemeRoot, domainId),
domainId, domainId, TVector<ui32>{domainId},
- domainId, TVector<ui32>{domainId},
+ domainId, TVector<ui32>{domainId},
planResolution,
- TVector<ui64>{TDomainsInfo::MakeTxCoordinatorIDFixed(domainId, 1)},
- TVector<ui64>{TDomainsInfo::MakeTxMediatorIDFixed(domainId, 1)},
- TVector<ui64>{TDomainsInfo::MakeTxAllocatorIDFixed(domainId, 1)},
- Settings->StoragePoolTypes);
+ TVector<ui64>{TDomainsInfo::MakeTxCoordinatorIDFixed(domainId, 1)},
+ TVector<ui64>{TDomainsInfo::MakeTxMediatorIDFixed(domainId, 1)},
+ TVector<ui64>{TDomainsInfo::MakeTxAllocatorIDFixed(domainId, 1)},
+ Settings->StoragePoolTypes);
app.AddDomain(domain.Release());
}
void TServer::CreateBootstrapTablets() {
- const ui32 domainId = Settings->Domain;
- Y_VERIFY(TDomainsInfo::MakeTxAllocatorIDFixed(domainId, 1) == ChangeStateStorage(TxAllocator, domainId));
+ const ui32 domainId = Settings->Domain;
+ Y_VERIFY(TDomainsInfo::MakeTxAllocatorIDFixed(domainId, 1) == ChangeStateStorage(TxAllocator, domainId));
CreateTestBootstrapper(*Runtime, CreateTestTabletInfo(ChangeStateStorage(TxAllocator, domainId), TTabletTypes::TX_ALLOCATOR), &CreateTxAllocator);
- Y_VERIFY(TDomainsInfo::MakeTxCoordinatorIDFixed(domainId, 1) == ChangeStateStorage(Coordinator, domainId));
+ Y_VERIFY(TDomainsInfo::MakeTxCoordinatorIDFixed(domainId, 1) == ChangeStateStorage(Coordinator, domainId));
CreateTestBootstrapper(*Runtime, CreateTestTabletInfo(ChangeStateStorage(Coordinator, domainId), TTabletTypes::FLAT_TX_COORDINATOR), &CreateFlatTxCoordinator);
- Y_VERIFY(TDomainsInfo::MakeTxMediatorIDFixed(domainId, 1) == ChangeStateStorage(Mediator, domainId));
+ Y_VERIFY(TDomainsInfo::MakeTxMediatorIDFixed(domainId, 1) == ChangeStateStorage(Mediator, domainId));
CreateTestBootstrapper(*Runtime, CreateTestTabletInfo(ChangeStateStorage(Mediator, domainId), TTabletTypes::TX_MEDIATOR), &CreateTxMediator);
CreateTestBootstrapper(*Runtime, CreateTestTabletInfo(ChangeStateStorage(SchemeRoot, domainId), TTabletTypes::FLAT_SCHEMESHARD), &CreateFlatTxSchemeShard);
CreateTestBootstrapper(*Runtime, CreateTestTabletInfo(ChangeStateStorage(Hive, domainId), TTabletTypes::FLAT_HIVE), &CreateDefaultHive);
@@ -372,9 +372,9 @@ namespace Tests {
CreateTestBootstrapper(*Runtime, CreateTestTabletInfo(MakeTenantSlotBrokerID(domainId), TTabletTypes::TENANT_SLOT_BROKER), &NTenantSlotBroker::CreateTenantSlotBroker);
if (Settings->EnableConsole)
CreateTestBootstrapper(*Runtime, CreateTestTabletInfo(MakeConsoleID(domainId), TTabletTypes::CONSOLE), &NConsole::CreateConsole);
- }
-
- void TServer::SetupStorage() {
+ }
+
+ void TServer::SetupStorage() {
TActorId sender = Runtime->AllocateEdgeActor();
NTabletPipe::TClientConfig pipeConfig;
@@ -421,8 +421,8 @@ namespace Tests {
Cerr << "\n\n configResponse is #" << configureResponse->Record.DebugString() << "\n\n";
}
UNIT_ASSERT(configureResponse->Record.GetResponse().GetSuccess());
- }
-
+ }
+
void TServer::SetupDefaultProfiles() {
NKikimr::Tests::TClient client(*Settings);
TAutoPtr<NMsgBusProxy::TBusConsoleRequest> request(new NMsgBusProxy::TBusConsoleRequest());
@@ -442,7 +442,7 @@ namespace Tests {
{
// Compaction policy:
NLocalDb::TCompactionPolicyPtr defaultPolicy = NLocalDb::CreateDefaultUserTablePolicy();
- NKikimrSchemeOp::TCompactionPolicy defaultflatSchemePolicy;
+ NKikimrSchemeOp::TCompactionPolicy defaultflatSchemePolicy;
defaultPolicy->Serialize(defaultflatSchemePolicy);
auto &defaultCompactionPolicy = *profiles.AddCompactionPolicies();
defaultCompactionPolicy.SetName("default");
@@ -450,7 +450,7 @@ namespace Tests {
NLocalDb::TCompactionPolicy policy1;
policy1.Generations.push_back({ 0, 8, 8, 128 * 1024 * 1024, NLocalDb::LegacyQueueIdToTaskName(1), true });
- NKikimrSchemeOp::TCompactionPolicy flatSchemePolicy1;
+ NKikimrSchemeOp::TCompactionPolicy flatSchemePolicy1;
policy1.Serialize(flatSchemePolicy1);
auto &compactionPolicy1 = *profiles.AddCompactionPolicies();
compactionPolicy1.SetName("compaction1");
@@ -459,7 +459,7 @@ namespace Tests {
NLocalDb::TCompactionPolicy policy2;
policy2.Generations.push_back({ 0, 8, 8, 128 * 1024 * 1024, NLocalDb::LegacyQueueIdToTaskName(1), true });
policy2.Generations.push_back({ 40 * 1024 * 1024, 5, 16, 512 * 1024 * 1024, NLocalDb::LegacyQueueIdToTaskName(2), false });
- NKikimrSchemeOp::TCompactionPolicy flatSchemePolicy2;
+ NKikimrSchemeOp::TCompactionPolicy flatSchemePolicy2;
policy2.Serialize(flatSchemePolicy2);
auto &compactionPolicy2 = *profiles.AddCompactionPolicies();
compactionPolicy2.SetName("compaction2");
@@ -477,62 +477,62 @@ namespace Tests {
UNIT_ASSERT_VALUES_EQUAL(resp.GetStatus().GetCode(), Ydb::StatusIds::SUCCESS);
}
- void TServer::SetupDomainLocalService(ui32 nodeIdx) {
- SetupLocalService(nodeIdx, Settings->DomainName);
- }
-
- void TServer::SetupDynamicLocalService(ui32 nodeIdx, const TString &tenantName) {
- Y_VERIFY(nodeIdx >= StaticNodes());
- SetupLocalService(nodeIdx, tenantName);
- }
-
- void TServer::DestroyDynamicLocalService(ui32 nodeIdx) {
- Y_VERIFY(nodeIdx >= StaticNodes());
+ void TServer::SetupDomainLocalService(ui32 nodeIdx) {
+ SetupLocalService(nodeIdx, Settings->DomainName);
+ }
+
+ void TServer::SetupDynamicLocalService(ui32 nodeIdx, const TString &tenantName) {
+ Y_VERIFY(nodeIdx >= StaticNodes());
+ SetupLocalService(nodeIdx, tenantName);
+ }
+
+ void TServer::DestroyDynamicLocalService(ui32 nodeIdx) {
+ Y_VERIFY(nodeIdx >= StaticNodes());
TActorId local = MakeLocalID(Runtime->GetNodeId(nodeIdx)); // MakeTenantPoolRootID?
Runtime->Send(new IEventHandle(local, TActorId(), new TEvents::TEvPoisonPill()));
- }
+ }
- void TServer::SetupLocalConfig(TLocalConfig &localConfig, const NKikimr::TAppData &appData) {
- localConfig.TabletClassInfo[appData.DefaultTabletTypes.Dummy] =
- TLocalConfig::TTabletClassInfo(new TTabletSetupInfo(
+ void TServer::SetupLocalConfig(TLocalConfig &localConfig, const NKikimr::TAppData &appData) {
+ localConfig.TabletClassInfo[appData.DefaultTabletTypes.Dummy] =
+ TLocalConfig::TTabletClassInfo(new TTabletSetupInfo(
&CreateFlatDummyTablet, TMailboxType::Revolving, appData.UserPoolId,
- TMailboxType::Revolving, appData.SystemPoolId));
- localConfig.TabletClassInfo[appData.DefaultTabletTypes.DataShard] =
- TLocalConfig::TTabletClassInfo(new TTabletSetupInfo(
+ TMailboxType::Revolving, appData.SystemPoolId));
+ localConfig.TabletClassInfo[appData.DefaultTabletTypes.DataShard] =
+ TLocalConfig::TTabletClassInfo(new TTabletSetupInfo(
&CreateDataShard, TMailboxType::Revolving, appData.UserPoolId,
- TMailboxType::Revolving, appData.SystemPoolId));
- localConfig.TabletClassInfo[appData.DefaultTabletTypes.KeyValue] =
- TLocalConfig::TTabletClassInfo(new TTabletSetupInfo(
- &CreateKeyValueFlat, TMailboxType::Revolving, appData.UserPoolId,
- TMailboxType::Revolving, appData.SystemPoolId));
+ TMailboxType::Revolving, appData.SystemPoolId));
+ localConfig.TabletClassInfo[appData.DefaultTabletTypes.KeyValue] =
+ TLocalConfig::TTabletClassInfo(new TTabletSetupInfo(
+ &CreateKeyValueFlat, TMailboxType::Revolving, appData.UserPoolId,
+ TMailboxType::Revolving, appData.SystemPoolId));
localConfig.TabletClassInfo[appData.DefaultTabletTypes.ColumnShard] =
TLocalConfig::TTabletClassInfo(new TTabletSetupInfo(
&CreateColumnShard, TMailboxType::Revolving, appData.UserPoolId,
TMailboxType::Revolving, appData.SystemPoolId));
- localConfig.TabletClassInfo[appData.DefaultTabletTypes.PersQueue] =
- TLocalConfig::TTabletClassInfo(new TTabletSetupInfo(
- &CreatePersQueue, TMailboxType::Revolving, appData.UserPoolId,
- TMailboxType::Revolving, appData.SystemPoolId));
- localConfig.TabletClassInfo[appData.DefaultTabletTypes.PersQueueReadBalancer] =
- TLocalConfig::TTabletClassInfo(new TTabletSetupInfo(
- &CreatePersQueueReadBalancer, TMailboxType::Revolving, appData.UserPoolId,
- TMailboxType::Revolving, appData.SystemPoolId));
- localConfig.TabletClassInfo[appData.DefaultTabletTypes.Coordinator] =
- TLocalConfig::TTabletClassInfo(new TTabletSetupInfo(
- &CreateFlatTxCoordinator, TMailboxType::Revolving, appData.UserPoolId,
- TMailboxType::Revolving, appData.SystemPoolId));
- localConfig.TabletClassInfo[appData.DefaultTabletTypes.Mediator] =
- TLocalConfig::TTabletClassInfo(new TTabletSetupInfo(
- &CreateTxMediator, TMailboxType::Revolving, appData.UserPoolId,
- TMailboxType::Revolving, appData.SystemPoolId));
+ localConfig.TabletClassInfo[appData.DefaultTabletTypes.PersQueue] =
+ TLocalConfig::TTabletClassInfo(new TTabletSetupInfo(
+ &CreatePersQueue, TMailboxType::Revolving, appData.UserPoolId,
+ TMailboxType::Revolving, appData.SystemPoolId));
+ localConfig.TabletClassInfo[appData.DefaultTabletTypes.PersQueueReadBalancer] =
+ TLocalConfig::TTabletClassInfo(new TTabletSetupInfo(
+ &CreatePersQueueReadBalancer, TMailboxType::Revolving, appData.UserPoolId,
+ TMailboxType::Revolving, appData.SystemPoolId));
+ localConfig.TabletClassInfo[appData.DefaultTabletTypes.Coordinator] =
+ TLocalConfig::TTabletClassInfo(new TTabletSetupInfo(
+ &CreateFlatTxCoordinator, TMailboxType::Revolving, appData.UserPoolId,
+ TMailboxType::Revolving, appData.SystemPoolId));
+ localConfig.TabletClassInfo[appData.DefaultTabletTypes.Mediator] =
+ TLocalConfig::TTabletClassInfo(new TTabletSetupInfo(
+ &CreateTxMediator, TMailboxType::Revolving, appData.UserPoolId,
+ TMailboxType::Revolving, appData.SystemPoolId));
localConfig.TabletClassInfo[appData.DefaultTabletTypes.Kesus] =
TLocalConfig::TTabletClassInfo(new TTabletSetupInfo(
&NKesus::CreateKesusTablet, TMailboxType::Revolving, appData.UserPoolId,
TMailboxType::Revolving, appData.SystemPoolId));
- localConfig.TabletClassInfo[appData.DefaultTabletTypes.SchemeShard] =
- TLocalConfig::TTabletClassInfo(new TTabletSetupInfo(
- &CreateFlatTxSchemeShard, TMailboxType::Revolving, appData.UserPoolId,
- TMailboxType::Revolving, appData.SystemPoolId));
+ localConfig.TabletClassInfo[appData.DefaultTabletTypes.SchemeShard] =
+ TLocalConfig::TTabletClassInfo(new TTabletSetupInfo(
+ &CreateFlatTxSchemeShard, TMailboxType::Revolving, appData.UserPoolId,
+ TMailboxType::Revolving, appData.SystemPoolId));
localConfig.TabletClassInfo[appData.DefaultTabletTypes.Hive] =
TLocalConfig::TTabletClassInfo(new TTabletSetupInfo(
&CreateDefaultHive, TMailboxType::Revolving, appData.UserPoolId,
@@ -551,14 +551,14 @@ namespace Tests {
TMailboxType::Revolving, appData.SystemPoolId));
}
- void TServer::SetupLocalService(ui32 nodeIdx, const TString &domainName) {
- TLocalConfig::TPtr localConfig = new TLocalConfig();
- auto &appData = Runtime->GetAppData(nodeIdx);
- SetupLocalConfig(*localConfig, appData);
-
+ void TServer::SetupLocalService(ui32 nodeIdx, const TString &domainName) {
+ TLocalConfig::TPtr localConfig = new TLocalConfig();
+ auto &appData = Runtime->GetAppData(nodeIdx);
+ SetupLocalConfig(*localConfig, appData);
+
TTenantPoolConfig::TPtr tenantPoolConfig = new TTenantPoolConfig(localConfig);
tenantPoolConfig->AddStaticSlot(domainName);
-
+
auto poolId = Runtime->Register(CreateTenantPool(tenantPoolConfig), nodeIdx, appData.SystemPoolId,
TMailboxType::Revolving, 0);
Runtime->RegisterService(MakeTenantPoolRootID(), poolId, nodeIdx);
@@ -575,8 +575,8 @@ namespace Tests {
auto tenantPublisher = CreateTenantNodeEnumerationPublisher();
Runtime->Register(tenantPublisher, nodeIdx);
- }
-
+ }
+
void TServer::SetupConfigurators(ui32 nodeIdx) {
auto &appData = Runtime->GetAppData(nodeIdx);
Runtime->Register(NConsole::CreateImmediateControlsConfigurator(appData.Icb, Settings->Controls),
@@ -584,7 +584,7 @@ namespace Tests {
}
void TServer::SetupProxies(ui32 nodeIdx) {
- Runtime->SetTxAllocatorTabletIds({ChangeStateStorage(TxAllocator, Settings->Domain)});
+ Runtime->SetTxAllocatorTabletIds({ChangeStateStorage(TxAllocator, Settings->Domain)});
{
IActor* ticketParser = Settings->CreateTicketParser(Settings->AuthConfig);
TActorId ticketParserId = Runtime->Register(ticketParser, nodeIdx);
@@ -617,7 +617,7 @@ namespace Tests {
TActorId txProxyId = Runtime->Register(txProxy, nodeIdx);
Runtime->RegisterService(MakeTxProxyID(), txProxyId, nodeIdx);
}
-
+
{
IActor* compileService = CreateMiniKQLCompileService(100000);
TActorId compileServiceId = Runtime->Register(compileService, nodeIdx, Runtime->GetAppData(nodeIdx).SystemPoolId, TMailboxType::Revolving, 0);
@@ -820,37 +820,37 @@ namespace Tests {
}
}
- void TServer::SetupLogging() {
+ void TServer::SetupLogging() {
Runtime->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NLog::PRI_WARN);
- //Runtime->SetLogPriority(NKikimrServices::SCHEMESHARD_DESCRIBE, NLog::PRI_DEBUG);
+ //Runtime->SetLogPriority(NKikimrServices::SCHEMESHARD_DESCRIBE, NLog::PRI_DEBUG);
//Runtime->SetLogPriority(NKikimrServices::HIVE, NActors::NLog::PRI_DEBUG);
- //Runtime->SetLogPriority(NKikimrServices::LOCAL, NActors::NLog::PRI_DEBUG);
-
+ //Runtime->SetLogPriority(NKikimrServices::LOCAL, NActors::NLog::PRI_DEBUG);
+
Runtime->SetLogPriority(NKikimrServices::BS_CONTROLLER, NLog::PRI_WARN);
- Runtime->SetLogPriority(NKikimrServices::MSGBUS_REQUEST, NLog::PRI_WARN);
-
- //Runtime->SetLogPriority(NKikimrServices::TX_COORDINATOR, NLog::PRI_DEBUG);
- //Runtime->SetLogPriority(NKikimrServices::TX_MEDIATOR, NLog::PRI_DEBUG);
- //Runtime->SetLogPriority(NKikimrServices::TX_PROXY, NLog::PRI_DEBUG);
- //Runtime->SetLogPriority(NKikimrServices::TX_PROXY_SCHEME_CACHE, NLog::PRI_DEBUG);
-
- //Runtime->SetLogPriority(NKikimrServices::MINIKQL_ENGINE, NLog::PRI_DEBUG);
+ Runtime->SetLogPriority(NKikimrServices::MSGBUS_REQUEST, NLog::PRI_WARN);
+
+ //Runtime->SetLogPriority(NKikimrServices::TX_COORDINATOR, NLog::PRI_DEBUG);
+ //Runtime->SetLogPriority(NKikimrServices::TX_MEDIATOR, NLog::PRI_DEBUG);
+ //Runtime->SetLogPriority(NKikimrServices::TX_PROXY, NLog::PRI_DEBUG);
+ //Runtime->SetLogPriority(NKikimrServices::TX_PROXY_SCHEME_CACHE, NLog::PRI_DEBUG);
+
+ //Runtime->SetLogPriority(NKikimrServices::MINIKQL_ENGINE, NLog::PRI_DEBUG);
//Runtime->SetLogPriority(NKikimrServices::KQP_PROXY, NLog::PRI_DEBUG);
//Runtime->SetLogPriority(NKikimrServices::KQP_WORKER, NLog::PRI_DEBUG);
- //Runtime->SetLogPriority(NKikimrServices::TX_PROXY, NActors::NLog::PRI_TRACE);
- //Runtime->SetLogPriority(NKikimrServices::TX_PROXY_SCHEME_CACHE, NActors::NLog::PRI_TRACE);
- //Runtime->SetLogPriority(NKikimrServices::SCHEME_BOARD_REPLICA, NActors::NLog::PRI_DEBUG);
- //Runtime->SetLogPriority(NKikimrServices::SCHEME_BOARD_POPULATOR, NActors::NLog::PRI_DEBUG);
- //Runtime->SetLogPriority(NKikimrServices::SCHEME_BOARD_SUBSCRIBER, NActors::NLog::PRI_TRACE);
+ //Runtime->SetLogPriority(NKikimrServices::TX_PROXY, NActors::NLog::PRI_TRACE);
+ //Runtime->SetLogPriority(NKikimrServices::TX_PROXY_SCHEME_CACHE, NActors::NLog::PRI_TRACE);
+ //Runtime->SetLogPriority(NKikimrServices::SCHEME_BOARD_REPLICA, NActors::NLog::PRI_DEBUG);
+ //Runtime->SetLogPriority(NKikimrServices::SCHEME_BOARD_POPULATOR, NActors::NLog::PRI_DEBUG);
+ //Runtime->SetLogPriority(NKikimrServices::SCHEME_BOARD_SUBSCRIBER, NActors::NLog::PRI_TRACE);
//Runtime->SetLogPriority(NKikimrServices::YQL_PROXY, NActors::NLog::PRI_DEBUG);
-
- if (Settings->LoggerInitializer) {
- Settings->LoggerInitializer(*Runtime);
+
+ if (Settings->LoggerInitializer) {
+ Settings->LoggerInitializer(*Runtime);
}
}
- void TServer::StartDummyTablets() {
+ void TServer::StartDummyTablets() {
if (!Runtime)
ythrow TWithBackTrace<yexception>() << "Server is redirected";
@@ -862,19 +862,19 @@ namespace Tests {
return Runtime.Get();
}
- const TServerSettings &TServer::GetSettings() const {
- return *Settings;
- }
-
- const NScheme::TTypeRegistry* TServer::GetTypeRegistry() {
+ const TServerSettings &TServer::GetSettings() const {
+ return *Settings;
+ }
+
+ const NScheme::TTypeRegistry* TServer::GetTypeRegistry() {
return Runtime->GetAppData().TypeRegistry;
}
- const NMiniKQL::IFunctionRegistry* TServer::GetFunctionRegistry() {
+ const NMiniKQL::IFunctionRegistry* TServer::GetFunctionRegistry() {
return Runtime->GetAppData().FunctionRegistry;
}
- TServer::~TServer() {
+ TServer::~TServer() {
if (Runtime->GetAppData().Mon) {
Runtime->GetAppData().Mon->Stop();
}
@@ -894,23 +894,23 @@ namespace Tests {
}
- TClient::TClient(const TServerSettings& settings)
- : Domain(settings.Domain)
- , DomainName(settings.DomainName)
- , SupportsRedirect(settings.SupportsRedirect)
- , StoragePoolTypes(settings.StoragePoolTypes)
+ TClient::TClient(const TServerSettings& settings)
+ : Domain(settings.Domain)
+ , DomainName(settings.DomainName)
+ , SupportsRedirect(settings.SupportsRedirect)
+ , StoragePoolTypes(settings.StoragePoolTypes)
, FunctionRegistry(NKikimr::NMiniKQL::CreateFunctionRegistry(NKikimr::NMiniKQL::CreateBuiltinRegistry()))
, LoadedFunctionRegistry(NKikimr::NMiniKQL::CreateFunctionRegistry(NKikimr::NMiniKQL::CreateBuiltinRegistry()))
{
TServerSetup serverSetup;
- if (SupportsRedirect && Tests::IsServerRedirected()) {
- serverSetup = GetServerSetup();
+ if (SupportsRedirect && Tests::IsServerRedirected()) {
+ serverSetup = GetServerSetup();
} else {
serverSetup = TServerSetup("localhost", settings.Port);
}
ClientConfig.Ip = serverSetup.IpAddress;
- ClientConfig.Port = serverSetup.Port;
+ ClientConfig.Port = serverSetup.Port;
ClientConfig.BusSessionConfig.TotalTimeout = Max<int>() / 2;
ClientConfig.BusSessionConfig.ConnectTimeout = ConnectTimeoutMilliSeconds;
ClientConfig.BusSessionConfig.NumRetries = 10;
@@ -973,7 +973,7 @@ namespace Tests {
ui64 TClient::GetPatchedSchemeRoot(ui64 schemeRoot, ui32 domain, bool supportsRedirect) {
if (!supportsRedirect || !IsServerRedirected())
- return ChangeStateStorage(schemeRoot, domain);
+ return ChangeStateStorage(schemeRoot, domain);
TString domainRedirect = GetEnv(DomainRedirectEnvVar);
if (!domainRedirect)
@@ -991,54 +991,54 @@ namespace Tests {
return FromString<ui64>(tabletIdStr);
}
- void TClient::WaitRootIsUp(const TString& root) {
- while (true) {
- TAutoPtr<NMsgBusProxy::TBusResponse> resp = Ls(root);
- UNIT_ASSERT(resp);
-
- if (resp->Record.GetStatus() == NMsgBusProxy::MSTATUS_OK && resp->Record.GetSchemeStatus() == NKikimrScheme::StatusSuccess) {
- break;
- }
- }
- }
-
- TAutoPtr<NBus::TBusMessage> TClient::InitRootSchemeWithReply(const TString& root) {
- WaitRootIsUp(root);
-
- TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request = new NMsgBusProxy::TBusSchemeOperation();
- auto* transaction = request->Record.MutableTransaction()->MutableModifyScheme();
- transaction->SetWorkingDir("/");
- transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain);
- auto op = transaction->MutableSubDomain();
- op->SetName(root);
-
- for (const auto& [kind, pool] : StoragePoolTypes) {
- auto* p = op->AddStoragePools();
- p->SetKind(kind);
- p->SetName(pool.GetName());
+ void TClient::WaitRootIsUp(const TString& root) {
+ while (true) {
+ TAutoPtr<NMsgBusProxy::TBusResponse> resp = Ls(root);
+ UNIT_ASSERT(resp);
+
+ if (resp->Record.GetStatus() == NMsgBusProxy::MSTATUS_OK && resp->Record.GetSchemeStatus() == NKikimrScheme::StatusSuccess) {
+ break;
+ }
+ }
+ }
+
+ TAutoPtr<NBus::TBusMessage> TClient::InitRootSchemeWithReply(const TString& root) {
+ WaitRootIsUp(root);
+
+ TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request = new NMsgBusProxy::TBusSchemeOperation();
+ auto* transaction = request->Record.MutableTransaction()->MutableModifyScheme();
+ transaction->SetWorkingDir("/");
+ transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain);
+ auto op = transaction->MutableSubDomain();
+ op->SetName(root);
+
+ for (const auto& [kind, pool] : StoragePoolTypes) {
+ auto* p = op->AddStoragePools();
+ p->SetKind(kind);
+ p->SetName(pool.GetName());
}
TAutoPtr<NBus::TBusMessage> reply;
- SendAndWaitCompletion(request, reply);
-
-#ifndef NDEBUG
- Cout << PrintResult<NMsgBusProxy::TBusResponse>(reply.Get()) << Endl;
-#endif
+ SendAndWaitCompletion(request, reply);
+
+#ifndef NDEBUG
+ Cout << PrintResult<NMsgBusProxy::TBusResponse>(reply.Get()) << Endl;
+#endif
return reply;
}
- void TClient::InitRootScheme() {
- InitRootScheme(DomainName);
- }
-
- void TClient::InitRootScheme(const TString& root) {
- TAutoPtr<NBus::TBusMessage> reply = InitRootSchemeWithReply(root);
- auto resp = dynamic_cast<NMsgBusProxy::TBusResponse*>(reply.Get());
- UNIT_ASSERT(resp);
- UNIT_ASSERT_VALUES_EQUAL(resp->Record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
- }
-
-
+ void TClient::InitRootScheme() {
+ InitRootScheme(DomainName);
+ }
+
+ void TClient::InitRootScheme(const TString& root) {
+ TAutoPtr<NBus::TBusMessage> reply = InitRootSchemeWithReply(root);
+ auto resp = dynamic_cast<NMsgBusProxy::TBusResponse*>(reply.Get());
+ UNIT_ASSERT(resp);
+ UNIT_ASSERT_VALUES_EQUAL(resp->Record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
+ }
+
+
void TClient::ExecuteTraceCommand(NKikimrClient::TMessageBusTraceRequest::ECommand command, const TString &path) {
TAutoPtr<NMsgBusProxy::TBusMessageBusTraceRequest> request(new NMsgBusProxy::TBusMessageBusTraceRequest());
request->Record.SetCommand(command);
@@ -1070,20 +1070,20 @@ namespace Tests {
UNIT_ASSERT_VALUES_EQUAL(SyncCall(request, reply), NBus::MESSAGE_OK);
}
- NBus::EMessageStatus TClient::WaitCompletion(ui64 txId, ui64 schemeshard, ui64 pathId,
- TAutoPtr<NBus::TBusMessage>& reply,
- TDuration timeout)
- {
- auto deadline = TInstant::Now() + timeout;
+ NBus::EMessageStatus TClient::WaitCompletion(ui64 txId, ui64 schemeshard, ui64 pathId,
+ TAutoPtr<NBus::TBusMessage>& reply,
+ TDuration timeout)
+ {
+ auto deadline = TInstant::Now() + timeout;
- NBus::EMessageStatus status;
- const NKikimrClient::TResponse* response = nullptr;
- do {
+ NBus::EMessageStatus status;
+ const NKikimrClient::TResponse* response = nullptr;
+ do {
TAutoPtr<NMsgBusProxy::TBusSchemeOperationStatus> msg = new NMsgBusProxy::TBusSchemeOperationStatus();
- msg->Record.MutableFlatTxId()->SetTxId(txId);
- msg->Record.MutableFlatTxId()->SetSchemeShardTabletId(schemeshard);
- msg->Record.MutableFlatTxId()->SetPathId(pathId);
- msg->Record.MutablePollOptions()->SetTimeout(timeout.MilliSeconds());
+ msg->Record.MutableFlatTxId()->SetTxId(txId);
+ msg->Record.MutableFlatTxId()->SetSchemeShardTabletId(schemeshard);
+ msg->Record.MutableFlatTxId()->SetPathId(pathId);
+ msg->Record.MutablePollOptions()->SetTimeout(timeout.MilliSeconds());
#ifndef NDEBUG
Cerr << "waiting..." << Endl;
#endif
@@ -1097,45 +1097,62 @@ namespace Tests {
break;
}
response = &static_cast<NMsgBusProxy::TBusResponse*>(reply.Get())->Record;
- } while (response->GetStatus() == NMsgBusProxy::MSTATUS_INPROGRESS && deadline >= TInstant::Now());
-
- return status;
- }
-
- NBus::EMessageStatus TClient::SendAndWaitCompletion(TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request,
- TAutoPtr<NBus::TBusMessage>& reply,
- TDuration timeout) {
- NBus::EMessageStatus status = SendWhenReady(request, reply, timeout.MilliSeconds());
-
- if (status != NBus::MESSAGE_OK) {
- return status;
- }
-
- const NMsgBusProxy::TBusResponse* flatResponse = dynamic_cast<const NMsgBusProxy::TBusResponse*>(reply.Get());
- if (!flatResponse)
- return NBus::MESSAGE_UNKNOWN;
-
- const NKikimrClient::TResponse* response = &flatResponse->Record;
-
+ } while (response->GetStatus() == NMsgBusProxy::MSTATUS_INPROGRESS && deadline >= TInstant::Now());
+
+ return status;
+ }
+
+ NBus::EMessageStatus TClient::SendAndWaitCompletion(TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request,
+ TAutoPtr<NBus::TBusMessage>& reply,
+ TDuration timeout) {
+ NBus::EMessageStatus status = SendWhenReady(request, reply, timeout.MilliSeconds());
+
+ if (status != NBus::MESSAGE_OK) {
+ return status;
+ }
+
+ const NMsgBusProxy::TBusResponse* flatResponse = dynamic_cast<const NMsgBusProxy::TBusResponse*>(reply.Get());
+ if (!flatResponse)
+ return NBus::MESSAGE_UNKNOWN;
+
+ const NKikimrClient::TResponse* response = &flatResponse->Record;
+
if (response->HasErrorReason()) {
Cerr << "reason: " << response->GetErrorReason() << Endl;
}
-
- if (response->GetStatus() != NMsgBusProxy::MSTATUS_INPROGRESS) {
- return status;
- }
-
- NKikimrClient::TFlatTxId txId = response->GetFlatTxId();
- return WaitCompletion(txId.GetTxId(), txId.GetSchemeShardTabletId(), txId.GetPathId(), reply, timeout);
+
+ if (response->GetStatus() != NMsgBusProxy::MSTATUS_INPROGRESS) {
+ return status;
+ }
+
+ NKikimrClient::TFlatTxId txId = response->GetFlatTxId();
+ return WaitCompletion(txId.GetTxId(), txId.GetSchemeShardTabletId(), txId.GetPathId(), reply, timeout);
}
- NMsgBusProxy::EResponseStatus TClient::MkDir(const TString& parent, const TString& name, const TApplyIf& applyIf) {
+ NMsgBusProxy::EResponseStatus TClient::MkDir(const TString& parent, const TString& name, const TApplyIf& applyIf) {
NMsgBusProxy::TBusSchemeOperation* request(new NMsgBusProxy::TBusSchemeOperation());
auto* mkDirTx = request->Record.MutableTransaction()->MutableModifyScheme();
mkDirTx->SetWorkingDir(parent);
- mkDirTx->SetOperationType(NKikimrSchemeOp::ESchemeOpMkDir);
+ mkDirTx->SetOperationType(NKikimrSchemeOp::ESchemeOpMkDir);
mkDirTx->MutableMkDir()->SetName(name);
- SetApplyIf(*mkDirTx, applyIf);
+ SetApplyIf(*mkDirTx, applyIf);
+ TAutoPtr<NBus::TBusMessage> reply;
+ NBus::EMessageStatus msgStatus = SendAndWaitCompletion(request, reply);
+#ifndef NDEBUG
+ Cout << PrintResult<NMsgBusProxy::TBusResponse>(reply.Get()) << Endl;
+#endif
+ UNIT_ASSERT_VALUES_EQUAL(msgStatus, NBus::MESSAGE_OK);
+ const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
+ return (NMsgBusProxy::EResponseStatus)response.GetStatus();
+ }
+
+ NMsgBusProxy::EResponseStatus TClient::RmDir(const TString& parent, const TString& name, const TApplyIf& applyIf) {
+ NMsgBusProxy::TBusSchemeOperation* request(new NMsgBusProxy::TBusSchemeOperation());
+ auto* mkDirTx = request->Record.MutableTransaction()->MutableModifyScheme();
+ mkDirTx->SetWorkingDir(parent);
+ mkDirTx->SetOperationType(NKikimrSchemeOp::ESchemeOpRmDir);
+ mkDirTx->MutableDrop()->SetName(name);
+ SetApplyIf(*mkDirTx, applyIf);
TAutoPtr<NBus::TBusMessage> reply;
NBus::EMessageStatus msgStatus = SendAndWaitCompletion(request, reply);
#ifndef NDEBUG
@@ -1146,163 +1163,146 @@ namespace Tests {
return (NMsgBusProxy::EResponseStatus)response.GetStatus();
}
- NMsgBusProxy::EResponseStatus TClient::RmDir(const TString& parent, const TString& name, const TApplyIf& applyIf) {
- NMsgBusProxy::TBusSchemeOperation* request(new NMsgBusProxy::TBusSchemeOperation());
- auto* mkDirTx = request->Record.MutableTransaction()->MutableModifyScheme();
- mkDirTx->SetWorkingDir(parent);
- mkDirTx->SetOperationType(NKikimrSchemeOp::ESchemeOpRmDir);
- mkDirTx->MutableDrop()->SetName(name);
- SetApplyIf(*mkDirTx, applyIf);
- TAutoPtr<NBus::TBusMessage> reply;
- NBus::EMessageStatus msgStatus = SendAndWaitCompletion(request, reply);
-#ifndef NDEBUG
- Cout << PrintResult<NMsgBusProxy::TBusResponse>(reply.Get()) << Endl;
-#endif
- UNIT_ASSERT_VALUES_EQUAL(msgStatus, NBus::MESSAGE_OK);
- const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
- return (NMsgBusProxy::EResponseStatus)response.GetStatus();
- }
-
- NMsgBusProxy::EResponseStatus TClient::CreateSubdomain(const TString &parent, const TString &description) {
- NKikimrSubDomains::TSubDomainSettings subdomain;
- UNIT_ASSERT(::google::protobuf::TextFormat::ParseFromString(description, &subdomain));
- return CreateSubdomain(parent, subdomain);
- }
-
- NMsgBusProxy::EResponseStatus TClient::CreateSubdomain(const TString &parent, const NKikimrSubDomains::TSubDomainSettings &subdomain) {
- TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
- auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
- op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateSubDomain);
- op->SetWorkingDir(parent);
- op->MutableSubDomain()->CopyFrom(subdomain);
-
- TAutoPtr<NBus::TBusMessage> reply;
- NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply);
- UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
- const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
- return (NMsgBusProxy::EResponseStatus)response.GetStatus();
- }
-
- NMsgBusProxy::EResponseStatus TClient::CreateExtSubdomain(const TString &parent, const TString &description) {
- NKikimrSubDomains::TSubDomainSettings subdomain;
- UNIT_ASSERT(::google::protobuf::TextFormat::ParseFromString(description, &subdomain));
- return CreateExtSubdomain(parent, subdomain);
- }
-
- NMsgBusProxy::EResponseStatus TClient::CreateExtSubdomain(const TString &parent, const NKikimrSubDomains::TSubDomainSettings &subdomain) {
- TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
- auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
- op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateExtSubDomain);
- op->SetWorkingDir(parent);
- op->MutableSubDomain()->CopyFrom(subdomain);
-
- TAutoPtr<NBus::TBusMessage> reply;
- NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply);
- UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
- const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
- return (NMsgBusProxy::EResponseStatus)response.GetStatus();
- }
-
- NMsgBusProxy::EResponseStatus TClient::AlterUserAttributes(const TString &parent, const TString &name, const TVector<std::pair<TString, TString>>& addAttrs, const TVector<TString>& dropAttrs, const TApplyIf& applyIf) {
- TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
- auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
- op->SetWorkingDir(parent);
- op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterUserAttributes);
- auto userAttributes = op->MutableAlterUserAttributes();
- userAttributes->SetPathName(name);
- for (const auto& item: addAttrs) {
- auto attr = userAttributes->AddUserAttributes();
- attr->SetKey(item.first);
- attr->SetValue(item.second);
- }
- for (const auto& item: dropAttrs) {
- auto attr = userAttributes->AddUserAttributes();
- attr->SetKey(item);
- }
- SetApplyIf(*op, applyIf);
- TAutoPtr<NBus::TBusMessage> reply;
- NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply);
- UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
- const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
- return (NMsgBusProxy::EResponseStatus)response.GetStatus();
- }
-
- NMsgBusProxy::EResponseStatus TClient::AlterSubdomain(const TString &parent, const TString &description, TDuration timeout) {
- NKikimrSubDomains::TSubDomainSettings subdomain;
- UNIT_ASSERT(::google::protobuf::TextFormat::ParseFromString(description, &subdomain));
- return AlterSubdomain(parent, subdomain, timeout);
- }
-
- NMsgBusProxy::EResponseStatus TClient::AlterSubdomain(const TString &parent, const NKikimrSubDomains::TSubDomainSettings &subdomain, TDuration timeout) {
- TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
- auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
- op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain);
- op->SetWorkingDir(parent);
- op->MutableSubDomain()->CopyFrom(subdomain);
-
- TAutoPtr<NBus::TBusMessage> reply;
- NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply, timeout);
- UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
- const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
- return (NMsgBusProxy::EResponseStatus)response.GetStatus();
- }
-
- NMsgBusProxy::EResponseStatus TClient::AlterExtSubdomain(const TString &parent, const NKikimrSubDomains::TSubDomainSettings &subdomain, TDuration timeout) {
- TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
- auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
- op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterExtSubDomain);
- op->SetWorkingDir(parent);
- op->MutableSubDomain()->CopyFrom(subdomain);
-
- TAutoPtr<NBus::TBusMessage> reply;
- NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply, timeout);
- UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
- const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
- return (NMsgBusProxy::EResponseStatus)response.GetStatus();
- }
-
- NMsgBusProxy::EResponseStatus TClient::DeleteSubdomain(const TString &parent, const TString &name) {
- TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
- auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
- op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropSubDomain);
- op->SetWorkingDir(parent);
- op->MutableDrop()->SetName(name);
-
- TAutoPtr<NBus::TBusMessage> reply;
- NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply);
- UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
- const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
- return (NMsgBusProxy::EResponseStatus)response.GetStatus();
- }
-
- NMsgBusProxy::EResponseStatus TClient::ForceDeleteSubdomain(const TString &parent, const TString &name) {
- TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
- auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
- op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpForceDropSubDomain);
- op->SetWorkingDir(parent);
- op->MutableDrop()->SetName(name);
-
- TAutoPtr<NBus::TBusMessage> reply;
- NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply);
- UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
- const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
- return (NMsgBusProxy::EResponseStatus)response.GetStatus();
- }
-
- NMsgBusProxy::EResponseStatus TClient::ForceDeleteUnsafe(const TString &parent, const TString &name) {
- TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
- auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
- op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpForceDropUnsafe);
- op->SetWorkingDir(parent);
- op->MutableDrop()->SetName(name);
-
- TAutoPtr<NBus::TBusMessage> reply;
- NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply);
- UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
- const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
- return (NMsgBusProxy::EResponseStatus)response.GetStatus();
- }
-
+ NMsgBusProxy::EResponseStatus TClient::CreateSubdomain(const TString &parent, const TString &description) {
+ NKikimrSubDomains::TSubDomainSettings subdomain;
+ UNIT_ASSERT(::google::protobuf::TextFormat::ParseFromString(description, &subdomain));
+ return CreateSubdomain(parent, subdomain);
+ }
+
+ NMsgBusProxy::EResponseStatus TClient::CreateSubdomain(const TString &parent, const NKikimrSubDomains::TSubDomainSettings &subdomain) {
+ TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
+ auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
+ op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateSubDomain);
+ op->SetWorkingDir(parent);
+ op->MutableSubDomain()->CopyFrom(subdomain);
+
+ TAutoPtr<NBus::TBusMessage> reply;
+ NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply);
+ UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
+ const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
+ return (NMsgBusProxy::EResponseStatus)response.GetStatus();
+ }
+
+ NMsgBusProxy::EResponseStatus TClient::CreateExtSubdomain(const TString &parent, const TString &description) {
+ NKikimrSubDomains::TSubDomainSettings subdomain;
+ UNIT_ASSERT(::google::protobuf::TextFormat::ParseFromString(description, &subdomain));
+ return CreateExtSubdomain(parent, subdomain);
+ }
+
+ NMsgBusProxy::EResponseStatus TClient::CreateExtSubdomain(const TString &parent, const NKikimrSubDomains::TSubDomainSettings &subdomain) {
+ TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
+ auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
+ op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateExtSubDomain);
+ op->SetWorkingDir(parent);
+ op->MutableSubDomain()->CopyFrom(subdomain);
+
+ TAutoPtr<NBus::TBusMessage> reply;
+ NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply);
+ UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
+ const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
+ return (NMsgBusProxy::EResponseStatus)response.GetStatus();
+ }
+
+ NMsgBusProxy::EResponseStatus TClient::AlterUserAttributes(const TString &parent, const TString &name, const TVector<std::pair<TString, TString>>& addAttrs, const TVector<TString>& dropAttrs, const TApplyIf& applyIf) {
+ TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
+ auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
+ op->SetWorkingDir(parent);
+ op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterUserAttributes);
+ auto userAttributes = op->MutableAlterUserAttributes();
+ userAttributes->SetPathName(name);
+ for (const auto& item: addAttrs) {
+ auto attr = userAttributes->AddUserAttributes();
+ attr->SetKey(item.first);
+ attr->SetValue(item.second);
+ }
+ for (const auto& item: dropAttrs) {
+ auto attr = userAttributes->AddUserAttributes();
+ attr->SetKey(item);
+ }
+ SetApplyIf(*op, applyIf);
+ TAutoPtr<NBus::TBusMessage> reply;
+ NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply);
+ UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
+ const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
+ return (NMsgBusProxy::EResponseStatus)response.GetStatus();
+ }
+
+ NMsgBusProxy::EResponseStatus TClient::AlterSubdomain(const TString &parent, const TString &description, TDuration timeout) {
+ NKikimrSubDomains::TSubDomainSettings subdomain;
+ UNIT_ASSERT(::google::protobuf::TextFormat::ParseFromString(description, &subdomain));
+ return AlterSubdomain(parent, subdomain, timeout);
+ }
+
+ NMsgBusProxy::EResponseStatus TClient::AlterSubdomain(const TString &parent, const NKikimrSubDomains::TSubDomainSettings &subdomain, TDuration timeout) {
+ TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
+ auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
+ op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain);
+ op->SetWorkingDir(parent);
+ op->MutableSubDomain()->CopyFrom(subdomain);
+
+ TAutoPtr<NBus::TBusMessage> reply;
+ NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply, timeout);
+ UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
+ const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
+ return (NMsgBusProxy::EResponseStatus)response.GetStatus();
+ }
+
+ NMsgBusProxy::EResponseStatus TClient::AlterExtSubdomain(const TString &parent, const NKikimrSubDomains::TSubDomainSettings &subdomain, TDuration timeout) {
+ TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
+ auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
+ op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterExtSubDomain);
+ op->SetWorkingDir(parent);
+ op->MutableSubDomain()->CopyFrom(subdomain);
+
+ TAutoPtr<NBus::TBusMessage> reply;
+ NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply, timeout);
+ UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
+ const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
+ return (NMsgBusProxy::EResponseStatus)response.GetStatus();
+ }
+
+ NMsgBusProxy::EResponseStatus TClient::DeleteSubdomain(const TString &parent, const TString &name) {
+ TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
+ auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
+ op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropSubDomain);
+ op->SetWorkingDir(parent);
+ op->MutableDrop()->SetName(name);
+
+ TAutoPtr<NBus::TBusMessage> reply;
+ NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply);
+ UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
+ const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
+ return (NMsgBusProxy::EResponseStatus)response.GetStatus();
+ }
+
+ NMsgBusProxy::EResponseStatus TClient::ForceDeleteSubdomain(const TString &parent, const TString &name) {
+ TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
+ auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
+ op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpForceDropSubDomain);
+ op->SetWorkingDir(parent);
+ op->MutableDrop()->SetName(name);
+
+ TAutoPtr<NBus::TBusMessage> reply;
+ NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply);
+ UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
+ const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
+ return (NMsgBusProxy::EResponseStatus)response.GetStatus();
+ }
+
+ NMsgBusProxy::EResponseStatus TClient::ForceDeleteUnsafe(const TString &parent, const TString &name) {
+ TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
+ auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
+ op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpForceDropUnsafe);
+ op->SetWorkingDir(parent);
+ op->MutableDrop()->SetName(name);
+
+ TAutoPtr<NBus::TBusMessage> reply;
+ NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply);
+ UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
+ const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
+ return (NMsgBusProxy::EResponseStatus)response.GetStatus();
+ }
+
NMsgBusProxy::EResponseStatus TClient::CreateUser(const TString& parent, const TString& user, const TString& password) {
TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
auto* op = request->Record.MutableTransaction()->MutableModifyScheme();
@@ -1320,14 +1320,14 @@ namespace Tests {
return (NMsgBusProxy::EResponseStatus)response.GetStatus();
}
- NMsgBusProxy::EResponseStatus TClient::CreateTable(const TString& parent, const NKikimrSchemeOp::TTableDescription &table, TDuration timeout) {
+ NMsgBusProxy::EResponseStatus TClient::CreateTable(const TString& parent, const NKikimrSchemeOp::TTableDescription &table, TDuration timeout) {
TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
- op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
+ op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
op->SetWorkingDir(parent);
op->MutableCreateTable()->CopyFrom(table);
TAutoPtr<NBus::TBusMessage> reply;
- NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply, timeout);
+ NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply, timeout);
UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
return (NMsgBusProxy::EResponseStatus)response.GetStatus();
@@ -1362,60 +1362,60 @@ namespace Tests {
return (NMsgBusProxy::EResponseStatus)response.GetStatus();
}
- NMsgBusProxy::EResponseStatus TClient::SplitTable(const TString& table, ui64 datashardId, ui64 border, TDuration timeout) {
- TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
- auto op = request->Record.MutableTransaction()->MutableModifyScheme();
- op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpSplitMergeTablePartitions);
- auto split = op->MutableSplitMergeTablePartitions();
- split->SetTablePath(table);
- split->AddSourceTabletId(datashardId);
- split->AddSplitBoundary()->MutableKeyPrefix()->AddTuple()->MutableOptional()->SetUint64(border);
-
- TAutoPtr<NBus::TBusMessage> reply;
- NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply, timeout);
- UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
- const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
- return (NMsgBusProxy::EResponseStatus)response.GetStatus();
- }
-
- NMsgBusProxy::EResponseStatus TClient::CopyTable(const TString &parent, const TString &name, const TString &src) {
- NKikimrSchemeOp::TTableDescription table;
- table.SetName(name);
- table.SetCopyFromTable(src);
- return CreateTable(parent, table, TDuration::Seconds(5000));
- }
-
- NMsgBusProxy::EResponseStatus TClient::ConsistentCopyTables(TVector<std::pair<TString, TString>> desc, TDuration timeout) {
- NKikimrSchemeOp::TConsistentTableCopyingConfig coping;
- for (auto& task: desc) {
- auto* item = coping.AddCopyTableDescriptions();
- item->SetSrcPath(std::move(task.first));
- item->SetDstPath(std::move(task.second));
- }
-
- TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
- auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
- op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateConsistentCopyTables);
- *op->MutableCreateConsistentCopyTables() = std::move(coping);
-
- TAutoPtr<NBus::TBusMessage> reply;
- NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply, timeout);
- UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
- const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
- return (NMsgBusProxy::EResponseStatus)response.GetStatus();
- }
-
- NMsgBusProxy::EResponseStatus TClient::CreateTable(const TString& parent, const TString& scheme, TDuration timeout) {
- NKikimrSchemeOp::TTableDescription table;
+ NMsgBusProxy::EResponseStatus TClient::SplitTable(const TString& table, ui64 datashardId, ui64 border, TDuration timeout) {
+ TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
+ auto op = request->Record.MutableTransaction()->MutableModifyScheme();
+ op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpSplitMergeTablePartitions);
+ auto split = op->MutableSplitMergeTablePartitions();
+ split->SetTablePath(table);
+ split->AddSourceTabletId(datashardId);
+ split->AddSplitBoundary()->MutableKeyPrefix()->AddTuple()->MutableOptional()->SetUint64(border);
+
+ TAutoPtr<NBus::TBusMessage> reply;
+ NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply, timeout);
+ UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
+ const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
+ return (NMsgBusProxy::EResponseStatus)response.GetStatus();
+ }
+
+ NMsgBusProxy::EResponseStatus TClient::CopyTable(const TString &parent, const TString &name, const TString &src) {
+ NKikimrSchemeOp::TTableDescription table;
+ table.SetName(name);
+ table.SetCopyFromTable(src);
+ return CreateTable(parent, table, TDuration::Seconds(5000));
+ }
+
+ NMsgBusProxy::EResponseStatus TClient::ConsistentCopyTables(TVector<std::pair<TString, TString>> desc, TDuration timeout) {
+ NKikimrSchemeOp::TConsistentTableCopyingConfig coping;
+ for (auto& task: desc) {
+ auto* item = coping.AddCopyTableDescriptions();
+ item->SetSrcPath(std::move(task.first));
+ item->SetDstPath(std::move(task.second));
+ }
+
+ TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
+ auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
+ op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateConsistentCopyTables);
+ *op->MutableCreateConsistentCopyTables() = std::move(coping);
+
+ TAutoPtr<NBus::TBusMessage> reply;
+ NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply, timeout);
+ UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
+ const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
+ return (NMsgBusProxy::EResponseStatus)response.GetStatus();
+ }
+
+ NMsgBusProxy::EResponseStatus TClient::CreateTable(const TString& parent, const TString& scheme, TDuration timeout) {
+ NKikimrSchemeOp::TTableDescription table;
bool parseOk = ::google::protobuf::TextFormat::ParseFromString(scheme, &table);
UNIT_ASSERT(parseOk);
- return CreateTable(parent, table, timeout);
+ return CreateTable(parent, table, timeout);
}
NMsgBusProxy::EResponseStatus TClient::CreateKesus(const TString& parent, const TString& name) {
auto* request = new NMsgBusProxy::TBusSchemeOperation();
auto* tx = request->Record.MutableTransaction()->MutableModifyScheme();
- tx->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateKesus);
+ tx->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateKesus);
tx->SetWorkingDir(parent);
tx->MutableKesus()->SetName(name);
TAutoPtr<NBus::TBusMessage> reply;
@@ -1428,7 +1428,7 @@ namespace Tests {
NMsgBusProxy::EResponseStatus TClient::DeleteKesus(const TString& parent, const TString& name) {
auto* request = new NMsgBusProxy::TBusSchemeOperation();
auto* tx = request->Record.MutableTransaction()->MutableModifyScheme();
- tx->SetOperationType(NKikimrSchemeOp::ESchemeOpDropKesus);
+ tx->SetOperationType(NKikimrSchemeOp::ESchemeOpDropKesus);
tx->SetWorkingDir(parent);
tx->MutableDrop()->SetName(name);
TAutoPtr<NBus::TBusMessage> reply;
@@ -1480,25 +1480,25 @@ namespace Tests {
return (NMsgBusProxy::EResponseStatus)response.GetStatus();
}
- NMsgBusProxy::EResponseStatus TClient::CreateSolomon(const TString& parent, const TString& name, ui32 parts, ui32 channelProfile) {
- auto* request = new NMsgBusProxy::TBusSchemeOperation();
- auto* tx = request->Record.MutableTransaction()->MutableModifyScheme();
- tx->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateSolomonVolume);
- tx->SetWorkingDir(parent);
- tx->MutableCreateSolomonVolume()->SetName(name);
- tx->MutableCreateSolomonVolume()->SetPartitionCount(parts);
- tx->MutableCreateSolomonVolume()->SetChannelProfileId(channelProfile);
- TAutoPtr<NBus::TBusMessage> reply;
- NBus::EMessageStatus msgStatus = SendAndWaitCompletion(request, reply);
- UNIT_ASSERT_VALUES_EQUAL(msgStatus, NBus::MESSAGE_OK);
- const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
- return (NMsgBusProxy::EResponseStatus)response.GetStatus();
- }
-
- TAutoPtr<NMsgBusProxy::TBusResponse> TClient::AlterTable(const TString& parent, const NKikimrSchemeOp::TTableDescription& alter, const TString& userToken) {
+ NMsgBusProxy::EResponseStatus TClient::CreateSolomon(const TString& parent, const TString& name, ui32 parts, ui32 channelProfile) {
+ auto* request = new NMsgBusProxy::TBusSchemeOperation();
+ auto* tx = request->Record.MutableTransaction()->MutableModifyScheme();
+ tx->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateSolomonVolume);
+ tx->SetWorkingDir(parent);
+ tx->MutableCreateSolomonVolume()->SetName(name);
+ tx->MutableCreateSolomonVolume()->SetPartitionCount(parts);
+ tx->MutableCreateSolomonVolume()->SetChannelProfileId(channelProfile);
+ TAutoPtr<NBus::TBusMessage> reply;
+ NBus::EMessageStatus msgStatus = SendAndWaitCompletion(request, reply);
+ UNIT_ASSERT_VALUES_EQUAL(msgStatus, NBus::MESSAGE_OK);
+ const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
+ return (NMsgBusProxy::EResponseStatus)response.GetStatus();
+ }
+
+ TAutoPtr<NMsgBusProxy::TBusResponse> TClient::AlterTable(const TString& parent, const NKikimrSchemeOp::TTableDescription& alter, const TString& userToken) {
TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
- op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterTable);
+ op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterTable);
op->SetWorkingDir(parent);
op->MutableAlterTable()->CopyFrom(alter);
TAutoPtr<NBus::TBusMessage> reply;
@@ -1511,29 +1511,29 @@ namespace Tests {
}
TAutoPtr<NMsgBusProxy::TBusResponse> TClient::AlterTable(const TString& parent, const TString& alter, const TString& userToken) {
- NKikimrSchemeOp::TTableDescription table;
+ NKikimrSchemeOp::TTableDescription table;
bool parseOk = ::google::protobuf::TextFormat::ParseFromString(alter, &table);
UNIT_ASSERT(parseOk);
return AlterTable(parent, table, userToken);
}
- NMsgBusProxy::EResponseStatus TClient::AlterTable(const TString& parent, const NKikimrSchemeOp::TTableDescription& alter) {
+ NMsgBusProxy::EResponseStatus TClient::AlterTable(const TString& parent, const NKikimrSchemeOp::TTableDescription& alter) {
TAutoPtr<NMsgBusProxy::TBusResponse> reply = AlterTable(parent, alter, TString());
const NKikimrClient::TResponse &response = reply->Record;
return (NMsgBusProxy::EResponseStatus)response.GetStatus();
}
NMsgBusProxy::EResponseStatus TClient::AlterTable(const TString& parent, const TString& alter) {
- NKikimrSchemeOp::TTableDescription table;
+ NKikimrSchemeOp::TTableDescription table;
bool parseOk = ::google::protobuf::TextFormat::ParseFromString(alter, &table);
UNIT_ASSERT(parseOk);
return AlterTable(parent, table);
}
- NMsgBusProxy::EResponseStatus TClient::StoreTableBackup(const TString& parent, const NKikimrSchemeOp::TBackupTask& task) {
+ NMsgBusProxy::EResponseStatus TClient::StoreTableBackup(const TString& parent, const NKikimrSchemeOp::TBackupTask& task) {
TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
- op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpBackup);
+ op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpBackup);
op->SetWorkingDir(parent);
op->MutableBackup()->CopyFrom(task);
TAutoPtr<NBus::TBusMessage> reply;
@@ -1546,7 +1546,7 @@ namespace Tests {
NMsgBusProxy::EResponseStatus TClient::DeleteTable(const TString& parent, const TString& name) {
TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
- op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
+ op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
op->SetWorkingDir(parent);
op->MutableDrop()->SetName(name);
TAutoPtr<NBus::TBusMessage> reply;
@@ -1559,7 +1559,7 @@ namespace Tests {
NMsgBusProxy::EResponseStatus TClient::DeleteTopic(const TString& parent, const TString& name) {
TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
- op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropPersQueueGroup);
+ op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropPersQueueGroup);
op->SetWorkingDir(parent);
op->MutableDrop()->SetName(name);
TAutoPtr<NBus::TBusMessage> reply;
@@ -1572,7 +1572,7 @@ namespace Tests {
TAutoPtr<NMsgBusProxy::TBusResponse> TClient::TryDropPersQueueGroup(const TString& parent, const TString& name) {
TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
auto * op = request->Record.MutableTransaction()->MutableModifyScheme();
- op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropPersQueueGroup);
+ op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropPersQueueGroup);
op->SetWorkingDir(parent);
op->MutableDrop()->SetName(name);
TAutoPtr<NBus::TBusMessage> reply;
@@ -1583,30 +1583,30 @@ namespace Tests {
return res;
}
- NMsgBusProxy::EResponseStatus TClient::WaitCreateTx(TTestActorRuntime* runtime, const TString& path, TDuration timeout) {
- TAutoPtr<NSchemeShard::TEvSchemeShard::TEvDescribeScheme> request(new NSchemeShard::TEvSchemeShard::TEvDescribeScheme());
- request->Record.SetPath(path);
- const ui64 schemeRoot = GetPatchedSchemeRoot(SchemeRoot, Domain, SupportsRedirect);
+ NMsgBusProxy::EResponseStatus TClient::WaitCreateTx(TTestActorRuntime* runtime, const TString& path, TDuration timeout) {
+ TAutoPtr<NSchemeShard::TEvSchemeShard::TEvDescribeScheme> request(new NSchemeShard::TEvSchemeShard::TEvDescribeScheme());
+ request->Record.SetPath(path);
+ const ui64 schemeRoot = GetPatchedSchemeRoot(SchemeRoot, Domain, SupportsRedirect);
TActorId sender = runtime->AllocateEdgeActor(0);
ForwardToTablet(*runtime, schemeRoot, sender, request.Release(), 0);
-
- TAutoPtr<IEventHandle> handle;
- runtime->GrabEdgeEvent<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>(handle);
- auto& record = handle->Get<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>()->GetRecord();
- //Cerr << record.DebugString() << Endl;
-
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
- auto& descr = record.GetPathDescription().GetSelf();
- TAutoPtr<NBus::TBusMessage> reply;
- auto msgStatus = WaitCompletion(descr.GetCreateTxId(), descr.GetSchemeshardId(), descr.GetPathId(), reply, timeout);
+
+ TAutoPtr<IEventHandle> handle;
+ runtime->GrabEdgeEvent<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>(handle);
+ auto& record = handle->Get<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>()->GetRecord();
+ //Cerr << record.DebugString() << Endl;
+
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
+ auto& descr = record.GetPathDescription().GetSelf();
+ TAutoPtr<NBus::TBusMessage> reply;
+ auto msgStatus = WaitCompletion(descr.GetCreateTxId(), descr.GetSchemeshardId(), descr.GetPathId(), reply, timeout);
#ifndef NDEBUG
- Cout << PrintResult<NMsgBusProxy::TBusResponse>(reply.Get()) << Endl;
+ Cout << PrintResult<NMsgBusProxy::TBusResponse>(reply.Get()) << Endl;
#endif
- UNIT_ASSERT_VALUES_EQUAL(msgStatus, NBus::MESSAGE_OK);
- const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
- return (NMsgBusProxy::EResponseStatus)response.GetStatus();
- }
-
+ UNIT_ASSERT_VALUES_EQUAL(msgStatus, NBus::MESSAGE_OK);
+ const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
+ return (NMsgBusProxy::EResponseStatus)response.GetStatus();
+ }
+
TAutoPtr<NMsgBusProxy::TBusResponse> TClient::LsImpl(const TString& path) {
TAutoPtr<NMsgBusProxy::TBusSchemeDescribe> request(new NMsgBusProxy::TBusSchemeDescribe());
request->Record.SetPath(path);
@@ -1615,7 +1615,7 @@ namespace Tests {
NBus::EMessageStatus msgStatus = SendWhenReady(request, reply);
UNIT_ASSERT_VALUES_EQUAL(msgStatus, NBus::MESSAGE_OK);
#ifndef NDEBUG
- Cerr << "TClient::Ls: " << PrintResult<NMsgBusProxy::TBusResponse>(reply.Get()) << Endl;
+ Cerr << "TClient::Ls: " << PrintResult<NMsgBusProxy::TBusResponse>(reply.Get()) << Endl;
#endif
return dynamic_cast<NMsgBusProxy::TBusResponse*>(reply.Release());
}
@@ -1624,26 +1624,26 @@ namespace Tests {
return LsImpl(path).Release();
}
- TClient::TPathVersion TClient::ExtractPathVersion(const TAutoPtr<NMsgBusProxy::TBusResponse>& describe) {
- UNIT_ASSERT(describe.Get());
- auto& record = describe->Record;
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
- UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
-
- UNIT_ASSERT(record.HasPathDescription());
- auto& descr = record.GetPathDescription();
-
- UNIT_ASSERT(descr.HasSelf());
- auto& self = descr.GetSelf();
-
- return TPathVersion{self.GetSchemeshardId(), self.GetPathId(), self.GetPathVersion()};
- }
-
+ TClient::TPathVersion TClient::ExtractPathVersion(const TAutoPtr<NMsgBusProxy::TBusResponse>& describe) {
+ UNIT_ASSERT(describe.Get());
+ auto& record = describe->Record;
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
+
+ UNIT_ASSERT(record.HasPathDescription());
+ auto& descr = record.GetPathDescription();
+
+ UNIT_ASSERT(descr.HasSelf());
+ auto& self = descr.GetSelf();
+
+ return TPathVersion{self.GetSchemeshardId(), self.GetPathId(), self.GetPathVersion()};
+ }
+
TVector<ui64> TClient::ExtractTableShards(const TAutoPtr<NMsgBusProxy::TBusResponse>& describe) {
UNIT_ASSERT(describe.Get());
NKikimrClient::TResponse& record = describe->Record;
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
- UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
UNIT_ASSERT(record.HasPathDescription());
auto& descr = record.GetPathDescription();
@@ -1657,38 +1657,38 @@ namespace Tests {
return shards;
}
- void TClient::RefreshPathCache(TTestActorRuntime* runtime, const TString& path, ui32 nodeIdx) {
+ void TClient::RefreshPathCache(TTestActorRuntime* runtime, const TString& path, ui32 nodeIdx) {
TActorId sender = runtime->AllocateEdgeActor(nodeIdx);
- auto request = MakeHolder<NSchemeCache::TSchemeCacheNavigate>();
- auto& entry = request->ResultSet.emplace_back();
- entry.Path = SplitPath(path);
- entry.Operation = NSchemeCache::TSchemeCacheNavigate::OpPath;
- runtime->Send(
- new IEventHandle(
+ auto request = MakeHolder<NSchemeCache::TSchemeCacheNavigate>();
+ auto& entry = request->ResultSet.emplace_back();
+ entry.Path = SplitPath(path);
+ entry.Operation = NSchemeCache::TSchemeCacheNavigate::OpPath;
+ runtime->Send(
+ new IEventHandle(
MakeSchemeCacheID(),
- sender,
- new TEvTxProxySchemeCache::TEvNavigateKeySet(request.Release())),
- nodeIdx);
- auto ev = runtime->GrabEdgeEvent<TEvTxProxySchemeCache::TEvNavigateKeySetResult>(sender);
- Y_VERIFY(ev);
- }
-
- void TClient::ModifyOwner(const TString& parent, const TString& name, const TString& owner) {
- TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
- auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
- op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL);
- op->SetWorkingDir(parent);
- op->MutableModifyACL()->SetName(name);
- op->MutableModifyACL()->SetNewOwner(owner);
- TAutoPtr<NBus::TBusMessage> reply;
- NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply);
- UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
- }
-
+ sender,
+ new TEvTxProxySchemeCache::TEvNavigateKeySet(request.Release())),
+ nodeIdx);
+ auto ev = runtime->GrabEdgeEvent<TEvTxProxySchemeCache::TEvNavigateKeySetResult>(sender);
+ Y_VERIFY(ev);
+ }
+
+ void TClient::ModifyOwner(const TString& parent, const TString& name, const TString& owner) {
+ TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
+ auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
+ op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL);
+ op->SetWorkingDir(parent);
+ op->MutableModifyACL()->SetName(name);
+ op->MutableModifyACL()->SetNewOwner(owner);
+ TAutoPtr<NBus::TBusMessage> reply;
+ NBus::EMessageStatus status = SendAndWaitCompletion(request.Release(), reply);
+ UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
+ }
+
void TClient::ModifyACL(const TString& parent, const TString& name, const TString& acl) {
TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request(new NMsgBusProxy::TBusSchemeOperation());
auto *op = request->Record.MutableTransaction()->MutableModifyScheme();
- op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL);
+ op->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL);
op->SetWorkingDir(parent);
op->MutableModifyACL()->SetName(name);
op->MutableModifyACL()->SetDiffACL(acl);
@@ -1698,23 +1698,23 @@ namespace Tests {
}
TAutoPtr<NMsgBusProxy::TBusResponse> TClient::HiveCreateTablet(ui32 domainUid, ui64 owner, ui64 owner_index, TTabletTypes::EType tablet_type,
- const TVector<ui32>& allowed_node_ids,
- const TVector<TSubDomainKey>& allowed_domains,
- const TChannelsBindings& bindings)
- {
- TAutoPtr<NMsgBusProxy::TBusHiveCreateTablet> request(new NMsgBusProxy::TBusHiveCreateTablet());
- NKikimrClient::THiveCreateTablet& record = request->Record;
- record.SetDomainUid(domainUid);
- auto *cmdCreate = record.AddCmdCreateTablet();
- cmdCreate->SetOwnerId(owner);
- cmdCreate->SetOwnerIdx(owner_index);
- cmdCreate->SetTabletType(tablet_type);
- for (ui32 node_id: allowed_node_ids) {
- cmdCreate->AddAllowedNodeIDs(node_id);
- }
- for (auto& domain_id: allowed_domains) {
- *cmdCreate->AddAllowedDomains() = domain_id;
- }
+ const TVector<ui32>& allowed_node_ids,
+ const TVector<TSubDomainKey>& allowed_domains,
+ const TChannelsBindings& bindings)
+ {
+ TAutoPtr<NMsgBusProxy::TBusHiveCreateTablet> request(new NMsgBusProxy::TBusHiveCreateTablet());
+ NKikimrClient::THiveCreateTablet& record = request->Record;
+ record.SetDomainUid(domainUid);
+ auto *cmdCreate = record.AddCmdCreateTablet();
+ cmdCreate->SetOwnerId(owner);
+ cmdCreate->SetOwnerIdx(owner_index);
+ cmdCreate->SetTabletType(tablet_type);
+ for (ui32 node_id: allowed_node_ids) {
+ cmdCreate->AddAllowedNodeIDs(node_id);
+ }
+ for (auto& domain_id: allowed_domains) {
+ *cmdCreate->AddAllowedDomains() = domain_id;
+ }
if (!bindings.empty()) {
for (auto& binding: bindings) {
*cmdCreate->AddBindedChannels() = binding;
@@ -1725,94 +1725,94 @@ namespace Tests {
cmdCreate->AddBindedChannels()->SetStoragePoolName(storagePool); // 0
cmdCreate->AddBindedChannels()->SetStoragePoolName(storagePool); // 1
cmdCreate->AddBindedChannels()->SetStoragePoolName(storagePool); // 2
- }
- TAutoPtr<NBus::TBusMessage> reply;
- NBus::EMessageStatus status = SyncCall(request, reply);
- UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
- NMsgBusProxy::TBusResponse* res = dynamic_cast<NMsgBusProxy::TBusResponse*>(reply.Release());
- UNIT_ASSERT(res);
- return res;
- }
-
- TString TClient::CreateStoragePool(const TString& poolKind, const TString& partOfName, ui32 groups) {
+ }
+ TAutoPtr<NBus::TBusMessage> reply;
+ NBus::EMessageStatus status = SyncCall(request, reply);
+ UNIT_ASSERT_VALUES_EQUAL(status, NBus::MESSAGE_OK);
+ NMsgBusProxy::TBusResponse* res = dynamic_cast<NMsgBusProxy::TBusResponse*>(reply.Release());
+ UNIT_ASSERT(res);
+ return res;
+ }
+
+ TString TClient::CreateStoragePool(const TString& poolKind, const TString& partOfName, ui32 groups) {
Y_VERIFY(StoragePoolTypes.contains(poolKind));
- const TString poolName = Sprintf("name_%s_kind_%s", partOfName.c_str(), poolKind.c_str());
- const ui64 poolId = THash<TString>()(poolName);
-
- NKikimrBlobStorage::TDefineStoragePool storagePool = StoragePoolTypes.at(poolKind);
- Y_VERIFY(storagePool.GetKind() == poolKind);
- storagePool.SetStoragePoolId(poolId);
- storagePool.SetName(poolName);
- storagePool.SetNumGroups(groups);
-
- TAutoPtr<NMsgBusProxy::TBusBlobStorageConfigRequest> request(new NMsgBusProxy::TBusBlobStorageConfigRequest());
- request->Record.MutableRequest()->AddCommand()->MutableDefineStoragePool()->CopyFrom(storagePool);
- request->Record.SetDomain(Domain);
-
- TAutoPtr<NBus::TBusMessage> reply;
- NBus::EMessageStatus msgStatus = SendWhenReady(request, reply);
-
- UNIT_ASSERT_VALUES_EQUAL(msgStatus, NBus::MESSAGE_OK);
- const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
- Y_VERIFY(response.HasBlobStorageConfigResponse() && response.GetBlobStorageConfigResponse().GetSuccess());
- UNIT_ASSERT((NMsgBusProxy::EResponseStatus)response.GetStatus());
-
- return poolName;
- }
-
- NKikimrBlobStorage::TDefineStoragePool TClient::DescribeStoragePool(const TString& name) {
- TAutoPtr<NMsgBusProxy::TBusBlobStorageConfigRequest> readRequest(new NMsgBusProxy::TBusBlobStorageConfigRequest());
- readRequest->Record.SetDomain(Domain);
- auto readParam = readRequest->Record.MutableRequest()->AddCommand()->MutableReadStoragePool();
+ const TString poolName = Sprintf("name_%s_kind_%s", partOfName.c_str(), poolKind.c_str());
+ const ui64 poolId = THash<TString>()(poolName);
+
+ NKikimrBlobStorage::TDefineStoragePool storagePool = StoragePoolTypes.at(poolKind);
+ Y_VERIFY(storagePool.GetKind() == poolKind);
+ storagePool.SetStoragePoolId(poolId);
+ storagePool.SetName(poolName);
+ storagePool.SetNumGroups(groups);
+
+ TAutoPtr<NMsgBusProxy::TBusBlobStorageConfigRequest> request(new NMsgBusProxy::TBusBlobStorageConfigRequest());
+ request->Record.MutableRequest()->AddCommand()->MutableDefineStoragePool()->CopyFrom(storagePool);
+ request->Record.SetDomain(Domain);
+
+ TAutoPtr<NBus::TBusMessage> reply;
+ NBus::EMessageStatus msgStatus = SendWhenReady(request, reply);
+
+ UNIT_ASSERT_VALUES_EQUAL(msgStatus, NBus::MESSAGE_OK);
+ const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
+ Y_VERIFY(response.HasBlobStorageConfigResponse() && response.GetBlobStorageConfigResponse().GetSuccess());
+ UNIT_ASSERT((NMsgBusProxy::EResponseStatus)response.GetStatus());
+
+ return poolName;
+ }
+
+ NKikimrBlobStorage::TDefineStoragePool TClient::DescribeStoragePool(const TString& name) {
+ TAutoPtr<NMsgBusProxy::TBusBlobStorageConfigRequest> readRequest(new NMsgBusProxy::TBusBlobStorageConfigRequest());
+ readRequest->Record.SetDomain(Domain);
+ auto readParam = readRequest->Record.MutableRequest()->AddCommand()->MutableReadStoragePool();
readParam->SetBoxId(TServerSettings::BOX_ID);
- readParam->AddName(name);
-
- TAutoPtr<NBus::TBusMessage> reply;
- NBus::EMessageStatus msgStatus = SendWhenReady(readRequest, reply);
-
+ readParam->AddName(name);
+
+ TAutoPtr<NBus::TBusMessage> reply;
+ NBus::EMessageStatus msgStatus = SendWhenReady(readRequest, reply);
+
#ifndef NDEBUG
Cerr << PrintResult<NMsgBusProxy::TBusResponse>(reply.Get()) << Endl;
#endif
- UNIT_ASSERT_VALUES_EQUAL(msgStatus, NBus::MESSAGE_OK);
- const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
- UNIT_ASSERT(response.HasBlobStorageConfigResponse() && response.GetBlobStorageConfigResponse().GetSuccess());
- UNIT_ASSERT((NMsgBusProxy::EResponseStatus)response.GetStatus());
- UNIT_ASSERT(response.GetBlobStorageConfigResponse().StatusSize() > 0);
- auto status = response.GetBlobStorageConfigResponse().GetStatus(0);
- UNIT_ASSERT(status.StoragePoolSize() > 0);
-
- auto storagePool = status.GetStoragePool(0);
- UNIT_ASSERT(name == storagePool.GetName());
+ UNIT_ASSERT_VALUES_EQUAL(msgStatus, NBus::MESSAGE_OK);
+ const NKikimrClient::TResponse &response = dynamic_cast<NMsgBusProxy::TBusResponse *>(reply.Get())->Record;
+ UNIT_ASSERT(response.HasBlobStorageConfigResponse() && response.GetBlobStorageConfigResponse().GetSuccess());
+ UNIT_ASSERT((NMsgBusProxy::EResponseStatus)response.GetStatus());
+ UNIT_ASSERT(response.GetBlobStorageConfigResponse().StatusSize() > 0);
+ auto status = response.GetBlobStorageConfigResponse().GetStatus(0);
+ UNIT_ASSERT(status.StoragePoolSize() > 0);
+
+ auto storagePool = status.GetStoragePool(0);
+ UNIT_ASSERT(name == storagePool.GetName());
UNIT_ASSERT(TServerSettings::BOX_ID == storagePool.GetBoxId());
-
- return storagePool;
- }
-
- void TClient::RemoveStoragePool(const TString& name) {
- auto storagePool = DescribeStoragePool(name);
-
- TAutoPtr<NMsgBusProxy::TBusBlobStorageConfigRequest> deleteRequest(new NMsgBusProxy::TBusBlobStorageConfigRequest());
- deleteRequest->Record.SetDomain(Domain);
- auto deleteParam = deleteRequest->Record.MutableRequest()->AddCommand()->MutableDeleteStoragePool();
+
+ return storagePool;
+ }
+
+ void TClient::RemoveStoragePool(const TString& name) {
+ auto storagePool = DescribeStoragePool(name);
+
+ TAutoPtr<NMsgBusProxy::TBusBlobStorageConfigRequest> deleteRequest(new NMsgBusProxy::TBusBlobStorageConfigRequest());
+ deleteRequest->Record.SetDomain(Domain);
+ auto deleteParam = deleteRequest->Record.MutableRequest()->AddCommand()->MutableDeleteStoragePool();
deleteParam->SetBoxId(TServerSettings::BOX_ID);
- deleteParam->SetStoragePoolId(storagePool.GetStoragePoolId());
- deleteParam->SetItemConfigGeneration(storagePool.GetItemConfigGeneration());
-
- TAutoPtr<NBus::TBusMessage> replyDelete;
- NBus::EMessageStatus msgStatus = SendWhenReady(deleteRequest, replyDelete);
-
+ deleteParam->SetStoragePoolId(storagePool.GetStoragePoolId());
+ deleteParam->SetItemConfigGeneration(storagePool.GetItemConfigGeneration());
+
+ TAutoPtr<NBus::TBusMessage> replyDelete;
+ NBus::EMessageStatus msgStatus = SendWhenReady(deleteRequest, replyDelete);
+
#ifndef NDEBUG
- Cout << PrintResult<NMsgBusProxy::TBusResponse>(replyDelete.Get()) << Endl;
+ Cout << PrintResult<NMsgBusProxy::TBusResponse>(replyDelete.Get()) << Endl;
#endif
- UNIT_ASSERT_VALUES_EQUAL(msgStatus, NBus::MESSAGE_OK);
- const NKikimrClient::TResponse &responseDelete = dynamic_cast<NMsgBusProxy::TBusResponse *>(replyDelete.Get())->Record;
- UNIT_ASSERT(responseDelete.HasBlobStorageConfigResponse() && responseDelete.GetBlobStorageConfigResponse().GetSuccess());
- UNIT_ASSERT((NMsgBusProxy::EResponseStatus)responseDelete.GetStatus());
- }
-
+ UNIT_ASSERT_VALUES_EQUAL(msgStatus, NBus::MESSAGE_OK);
+ const NKikimrClient::TResponse &responseDelete = dynamic_cast<NMsgBusProxy::TBusResponse *>(replyDelete.Get())->Record;
+ UNIT_ASSERT(responseDelete.HasBlobStorageConfigResponse() && responseDelete.GetBlobStorageConfigResponse().GetSuccess());
+ UNIT_ASSERT((NMsgBusProxy::EResponseStatus)responseDelete.GetStatus());
+ }
+
bool TClient::LocalQuery(const ui64 tabletId, const TString &pgmText, NKikimrMiniKQL::TResult& result) {
TAutoPtr<NMsgBusProxy::TBusTabletLocalMKQL> request = new NMsgBusProxy::TBusTabletLocalMKQL();
- request->Record.SetTabletID(ChangeStateStorage(tabletId, Domain));
+ request->Record.SetTabletID(ChangeStateStorage(tabletId, Domain));
request->Record.SetWithRetry(true);
auto *mkql = request->Record.MutableProgram();
mkql->MutableProgram()->SetText(pgmText);
@@ -1833,7 +1833,7 @@ namespace Tests {
bool TClient::LocalSchemeTx(const ui64 tabletId, const NTabletFlatScheme::TSchemeChanges& changes, bool dryRun,
NTabletFlatScheme::TSchemeChanges& scheme, TString& err) {
TAutoPtr<NMsgBusProxy::TBusTabletLocalSchemeTx> request = new NMsgBusProxy::TBusTabletLocalSchemeTx();
- request->Record.SetTabletID(ChangeStateStorage(tabletId, Domain));
+ request->Record.SetTabletID(ChangeStateStorage(tabletId, Domain));
request->Record.SetDryRun(dryRun);
auto *schemeChanges = request->Record.MutableSchemeChanges();
schemeChanges->CopyFrom(changes);
@@ -2020,7 +2020,7 @@ namespace Tests {
TString TClient::MarkNodeInHive(TTestActorRuntime* runtime, ui32 nodeIdx, bool up) {
ui32 nodeId = runtime->GetNodeId(nodeIdx);
- ui64 hive = ChangeStateStorage(Tests::Hive, Domain);
+ ui64 hive = ChangeStateStorage(Tests::Hive, Domain);
TInstant deadline = TInstant::Now() + TIMEOUT;
while (TInstant::Now() <= deadline) {
TString res = SendTabletMonQuery(runtime, hive, TString("/app?page=SetDown&node=") + ToString(nodeId) + "&down=" + (up ? "0" : "1"));
@@ -2034,7 +2034,7 @@ namespace Tests {
TString TClient::KickNodeInHive(TTestActorRuntime* runtime, ui32 nodeIdx) {
ui32 nodeId = runtime->GetNodeId(nodeIdx);
- ui64 hive = ChangeStateStorage(Tests::Hive, Domain);
+ ui64 hive = ChangeStateStorage(Tests::Hive, Domain);
return SendTabletMonQuery(runtime, hive, TString("/app?page=KickNode&node=") + ToString(nodeId));
}
@@ -2046,29 +2046,29 @@ namespace Tests {
clientConfig.RetryPolicy = NTabletPipe::TClientRetryPolicy::WithRetries();
TActorId pipeClient = runtime->Register(NTabletPipe::CreateClient(edge, tabletId, clientConfig));
TAutoPtr<IEventHandle> handle;
- const TInstant deadline = TInstant::Now() + timeout;
+ const TInstant deadline = TInstant::Now() + timeout;
bool res = false;
-
- try {
- while (TInstant::Now() <= deadline) {
- TEvTabletPipe::TEvClientConnected* ev = runtime->GrabEdgeEvent<TEvTabletPipe::TEvClientConnected>(handle, deadline - TInstant::Now());
- if (!ev) {
- break;
- }
- if (ev->ClientId == pipeClient && ev->TabletId == tabletId) {
- res = (ev->Status == NKikimrProto::OK);
- break;
- }
+
+ try {
+ while (TInstant::Now() <= deadline) {
+ TEvTabletPipe::TEvClientConnected* ev = runtime->GrabEdgeEvent<TEvTabletPipe::TEvClientConnected>(handle, deadline - TInstant::Now());
+ if (!ev) {
+ break;
+ }
+ if (ev->ClientId == pipeClient && ev->TabletId == tabletId) {
+ res = (ev->Status == NKikimrProto::OK);
+ break;
+ }
}
- } catch (TEmptyEventQueueException &) {}
-
+ } catch (TEmptyEventQueueException &) {}
+
runtime->Send(new IEventHandle(pipeClient, TActorId(), new TEvents::TEvPoisonPill()));
return res;
}
bool TClient::WaitForTabletDown(TTestActorRuntime* runtime, ui64 tabletId, bool leader, TDuration timeout) {
TActorId edge = runtime->AllocateEdgeActor();
- NTabletPipe::TClientConfig clientConfig;
+ NTabletPipe::TClientConfig clientConfig;
clientConfig.AllowFollower = !leader;
clientConfig.ForceFollower = !leader;
clientConfig.RetryPolicy = {
@@ -2078,45 +2078,45 @@ namespace Tests {
.BackoffMultiplier = 2,
};
TActorId pipeClient = runtime->Register(NTabletPipe::CreateClient(edge, tabletId, clientConfig));
- TInstant deadline = TInstant::Now() + timeout;
-
- bool res = false;
-
- try {
- while (TInstant::Now() <= deadline) {
- TAutoPtr<IEventHandle> handle;
- auto result = runtime->GrabEdgeEvents<TEvTabletPipe::TEvClientConnected, TEvTabletPipe::TEvClientDestroyed>(handle, deadline - TInstant::Now());
- if (handle && handle->Recipient == edge && handle->Sender == pipeClient) {
- if (std::get<TEvTabletPipe::TEvClientDestroyed*>(result) != nullptr)
- {
- TEvTabletPipe::TEvClientDestroyed* event = std::get<TEvTabletPipe::TEvClientDestroyed*>(result);
- if (event->TabletId == tabletId) {
- res = true;
- break;
- }
- }
- if (std::get<TEvTabletPipe::TEvClientConnected*>(result) != nullptr)
- {
- TEvTabletPipe::TEvClientConnected* event = std::get<TEvTabletPipe::TEvClientConnected*>(result);
- if (event->TabletId == tabletId && event->Status != NKikimrProto::OK) {
- res = true;
- break;
- }
- }
- }
- }
- } catch (TEmptyEventQueueException &) {}
-
- runtime->Send(new IEventHandle(pipeClient, edge, new TEvents::TEvPoisonPill()));
- return res;
- }
-
+ TInstant deadline = TInstant::Now() + timeout;
+
+ bool res = false;
+
+ try {
+ while (TInstant::Now() <= deadline) {
+ TAutoPtr<IEventHandle> handle;
+ auto result = runtime->GrabEdgeEvents<TEvTabletPipe::TEvClientConnected, TEvTabletPipe::TEvClientDestroyed>(handle, deadline - TInstant::Now());
+ if (handle && handle->Recipient == edge && handle->Sender == pipeClient) {
+ if (std::get<TEvTabletPipe::TEvClientDestroyed*>(result) != nullptr)
+ {
+ TEvTabletPipe::TEvClientDestroyed* event = std::get<TEvTabletPipe::TEvClientDestroyed*>(result);
+ if (event->TabletId == tabletId) {
+ res = true;
+ break;
+ }
+ }
+ if (std::get<TEvTabletPipe::TEvClientConnected*>(result) != nullptr)
+ {
+ TEvTabletPipe::TEvClientConnected* event = std::get<TEvTabletPipe::TEvClientConnected*>(result);
+ if (event->TabletId == tabletId && event->Status != NKikimrProto::OK) {
+ res = true;
+ break;
+ }
+ }
+ }
+ }
+ } catch (TEmptyEventQueueException &) {}
+
+ runtime->Send(new IEventHandle(pipeClient, edge, new TEvents::TEvPoisonPill()));
+ return res;
+ }
+
void TClient::GetTabletInfoFromHive(TTestActorRuntime* runtime, ui64 tabletId, bool returnFollowers, NKikimrHive::TEvResponseHiveInfo& res) {
TAutoPtr<TEvHive::TEvRequestHiveInfo> ev(new TEvHive::TEvRequestHiveInfo);
ev->Record.SetTabletID(tabletId);
ev->Record.SetReturnFollowers(returnFollowers);
- ui64 hive = ChangeStateStorage(Tests::Hive, Domain);
+ ui64 hive = ChangeStateStorage(Tests::Hive, Domain);
TActorId edge = runtime->AllocateEdgeActor();
runtime->SendToPipe(hive, edge, ev.Release());
TAutoPtr<IEventHandle> handle;
@@ -2130,15 +2130,15 @@ namespace Tests {
// Cerr << res << Endl;
for (const NKikimrHive::TTabletInfo& tablet : res.GetTablets()) {
- if (tablet.GetTabletID() == tabletId && tablet.GetNodeID() != 0) {
+ if (tablet.GetTabletID() == tabletId && tablet.GetNodeID() != 0) {
return NodeIdToIndex(runtime, tablet.GetNodeID());
}
}
- return Max<ui32>();
+ return Max<ui32>();
}
- bool TClient::TabletExistsInHive(TTestActorRuntime* runtime, ui64 tabletId, bool evenInDeleting) {
+ bool TClient::TabletExistsInHive(TTestActorRuntime* runtime, ui64 tabletId, bool evenInDeleting) {
NKikimrHive::TEvResponseHiveInfo res;
GetTabletInfoFromHive(runtime, tabletId, false, res);
// Cerr << res << Endl;
@@ -2152,31 +2152,31 @@ namespace Tests {
return false;
}
- void TClient::GetTabletStorageInfoFromHive(TTestActorRuntime* runtime, ui64 tabletId, NKikimrHive::TEvGetTabletStorageInfoResult& res) {
- TAutoPtr<TEvHive::TEvGetTabletStorageInfo> ev(new TEvHive::TEvGetTabletStorageInfo(tabletId));
-
- ui64 hive = ChangeStateStorage(Tests::Hive, Domain);
+ void TClient::GetTabletStorageInfoFromHive(TTestActorRuntime* runtime, ui64 tabletId, NKikimrHive::TEvGetTabletStorageInfoResult& res) {
+ TAutoPtr<TEvHive::TEvGetTabletStorageInfo> ev(new TEvHive::TEvGetTabletStorageInfo(tabletId));
+
+ ui64 hive = ChangeStateStorage(Tests::Hive, Domain);
TActorId edge = runtime->AllocateEdgeActor();
- runtime->SendToPipe(hive, edge, ev.Release());
- TAutoPtr<IEventHandle> handle;
- TEvHive::TEvGetTabletStorageInfoResult* response = runtime->GrabEdgeEventRethrow<TEvHive::TEvGetTabletStorageInfoResult>(handle);
-
- res.Swap(&response->Record);
+ runtime->SendToPipe(hive, edge, ev.Release());
+ TAutoPtr<IEventHandle> handle;
+ TEvHive::TEvGetTabletStorageInfoResult* response = runtime->GrabEdgeEventRethrow<TEvHive::TEvGetTabletStorageInfoResult>(handle);
+
+ res.Swap(&response->Record);
#ifndef NDEBUG
- Cerr << response->Record.DebugString() << "\n";
+ Cerr << response->Record.DebugString() << "\n";
#endif
-
- if (res.GetStatus() == NKikimrProto::OK) {
- auto& info = res.GetInfo();
- Y_VERIFY(res.GetTabletID() == info.GetTabletID());
- Y_VERIFY(info.ChannelsSize() > 0);
-
- auto& channel = info.GetChannels(0);
- Y_VERIFY(channel.GetChannel() == 0);
- Y_VERIFY(channel.HistorySize() > 0);
- }
- }
-
+
+ if (res.GetStatus() == NKikimrProto::OK) {
+ auto& info = res.GetInfo();
+ Y_VERIFY(res.GetTabletID() == info.GetTabletID());
+ Y_VERIFY(info.ChannelsSize() > 0);
+
+ auto& channel = info.GetChannels(0);
+ Y_VERIFY(channel.GetChannel() == 0);
+ Y_VERIFY(channel.HistorySize() > 0);
+ }
+ }
+
TVector<ui32> TClient::GetFollowerNodes(TTestActorRuntime* runtime, ui64 tabletId) {
NKikimrHive::TEvResponseHiveInfo res;
GetTabletInfoFromHive(runtime, tabletId, true, res);
@@ -2281,165 +2281,165 @@ namespace Tests {
return TServerSetup(TString(address), portValue);
}
-
- TTenants::TTenants(TServer::TPtr server)
- : Server(server)
- {
- ui32 dynamicNodeStartsAt = Server->StaticNodes();
- ui32 dynamicNodeEndsAt = dynamicNodeStartsAt + Server->DynamicNodes();
- for (ui32 nodeIdx = dynamicNodeStartsAt; nodeIdx < dynamicNodeEndsAt; ++nodeIdx) {
- VacantNodes.push_back(nodeIdx);
- }
- MakeHeap(VacantNodes.begin(), VacantNodes.end());
- }
-
- TTenants::~TTenants() {
- Stop();
- }
-
- void TTenants::Run(const TString &name, ui32 nodes) {
+
+ TTenants::TTenants(TServer::TPtr server)
+ : Server(server)
+ {
+ ui32 dynamicNodeStartsAt = Server->StaticNodes();
+ ui32 dynamicNodeEndsAt = dynamicNodeStartsAt + Server->DynamicNodes();
+ for (ui32 nodeIdx = dynamicNodeStartsAt; nodeIdx < dynamicNodeEndsAt; ++nodeIdx) {
+ VacantNodes.push_back(nodeIdx);
+ }
+ MakeHeap(VacantNodes.begin(), VacantNodes.end());
+ }
+
+ TTenants::~TTenants() {
+ Stop();
+ }
+
+ void TTenants::Run(const TString &name, ui32 nodes) {
Y_VERIFY(!Tenants.contains(name));
- Y_VERIFY(Availabe() >= nodes);
-
- Tenants[name] = {};
- RunNodes(name, nodes);
- }
-
- void TTenants::Stop(const TString &name) {
+ Y_VERIFY(Availabe() >= nodes);
+
+ Tenants[name] = {};
+ RunNodes(name, nodes);
+ }
+
+ void TTenants::Stop(const TString &name) {
Y_VERIFY(Tenants.contains(name));
-
- Free(name, Size(name));
- Tenants.erase(name);
- }
-
- void TTenants::Stop() {
- for (auto &it: Tenants) {
- const TString &name = it.first;
- Free(name, Size(name));
- }
- Tenants.clear();
- }
-
- void TTenants::Add(const TString &name, ui32 nodes) {
+
+ Free(name, Size(name));
+ Tenants.erase(name);
+ }
+
+ void TTenants::Stop() {
+ for (auto &it: Tenants) {
+ const TString &name = it.first;
+ Free(name, Size(name));
+ }
+ Tenants.clear();
+ }
+
+ void TTenants::Add(const TString &name, ui32 nodes) {
Y_VERIFY(Tenants.contains(name));
- Y_VERIFY(Availabe() >= nodes);
-
- return RunNodes(name, nodes);
- }
-
- void TTenants::Free(const TString &name, ui32 nodes) {
+ Y_VERIFY(Availabe() >= nodes);
+
+ return RunNodes(name, nodes);
+ }
+
+ void TTenants::Free(const TString &name, ui32 nodes) {
Y_VERIFY(Tenants.contains(name));
- Y_VERIFY(Size(name) >= nodes);
-
- return StopNodes(name, nodes);
- }
-
- void TTenants::FreeNode(const TString &name, ui32 nodeIdx) {
+ Y_VERIFY(Size(name) >= nodes);
+
+ return StopNodes(name, nodes);
+ }
+
+ void TTenants::FreeNode(const TString &name, ui32 nodeIdx) {
Y_VERIFY(Tenants.contains(name));
- Y_VERIFY(Size(name) >= 1);
-
- return StopPaticularNode(name, nodeIdx);
- }
-
- bool TTenants::IsStaticNode(ui32 nodeIdx) const {
- return nodeIdx < Server->StaticNodes();
- }
-
- bool TTenants::IsActive(const TString &name, ui32 nodeIdx) const {
+ Y_VERIFY(Size(name) >= 1);
+
+ return StopPaticularNode(name, nodeIdx);
+ }
+
+ bool TTenants::IsStaticNode(ui32 nodeIdx) const {
+ return nodeIdx < Server->StaticNodes();
+ }
+
+ bool TTenants::IsActive(const TString &name, ui32 nodeIdx) const {
const TVector<ui32>& nodes = List(name);
#ifndef NDEBUG
- Cerr << "IsActive: " << name << " -- " << nodeIdx << Endl;
- for (auto& x: nodes) {
- Cerr << " -- " << x;
- }
- Cerr << Endl;
+ Cerr << "IsActive: " << name << " -- " << nodeIdx << Endl;
+ for (auto& x: nodes) {
+ Cerr << " -- " << x;
+ }
+ Cerr << Endl;
#endif
- return std::find(nodes.begin(), nodes.end(), nodeIdx) != nodes.end();
- }
-
+ return std::find(nodes.begin(), nodes.end(), nodeIdx) != nodes.end();
+ }
+
const TVector<ui32> &TTenants::List(const TString &name) const {
Y_VERIFY(Tenants.contains(name));
-
- return Tenants.at(name);
- }
-
- ui32 TTenants::Size(const TString &name) const {
+
+ return Tenants.at(name);
+ }
+
+ ui32 TTenants::Size(const TString &name) const {
if (!Tenants.contains(name))
- return 0;
- return List(name).size();
- }
-
- ui32 TTenants::Size() const {
- return Capacity() - Availabe();
- }
-
- ui32 TTenants::Availabe() const {
- return VacantNodes.size();
- }
-
- ui32 TTenants::Capacity() const {
- return Server->DynamicNodes();
- }
-
+ return 0;
+ return List(name).size();
+ }
+
+ ui32 TTenants::Size() const {
+ return Capacity() - Availabe();
+ }
+
+ ui32 TTenants::Availabe() const {
+ return VacantNodes.size();
+ }
+
+ ui32 TTenants::Capacity() const {
+ return Server->DynamicNodes();
+ }
+
TVector<ui32> &TTenants::Nodes(const TString &name) {
- return Tenants[name];
- }
-
- void TTenants::StopNode(const TString, ui32 nodeIdx) {
- Server->DestroyDynamicLocalService(nodeIdx);
- }
-
- void TTenants::RunNode(const TString &name, ui32 nodeIdx) {
- Server->SetupDynamicLocalService(nodeIdx, name);
- }
-
- void TTenants::StopPaticularNode(const TString &name, ui32 nodeIdx) {
+ return Tenants[name];
+ }
+
+ void TTenants::StopNode(const TString, ui32 nodeIdx) {
+ Server->DestroyDynamicLocalService(nodeIdx);
+ }
+
+ void TTenants::RunNode(const TString &name, ui32 nodeIdx) {
+ Server->SetupDynamicLocalService(nodeIdx, name);
+ }
+
+ void TTenants::StopPaticularNode(const TString &name, ui32 nodeIdx) {
TVector<ui32>& nodes = Nodes(name);
-
- auto subj = std::find(nodes.begin(), nodes.end(), nodeIdx);
- Y_VERIFY(subj != nodes.end());
-
- StopNode(name, nodeIdx);
-
- std::swap(*subj, nodes.back());
- nodes.pop_back();
- FreeNodeIdx(nodeIdx);
- }
-
- void TTenants::StopNodes(const TString &name, ui32 count) {
+
+ auto subj = std::find(nodes.begin(), nodes.end(), nodeIdx);
+ Y_VERIFY(subj != nodes.end());
+
+ StopNode(name, nodeIdx);
+
+ std::swap(*subj, nodes.back());
+ nodes.pop_back();
+ FreeNodeIdx(nodeIdx);
+ }
+
+ void TTenants::StopNodes(const TString &name, ui32 count) {
TVector<ui32>& nodes = Nodes(name);
-
- for (ui32 num = 0; num < count && nodes; ++num) {
- ui32 nodeIdx = nodes.back();
- StopNode(name, nodeIdx);
- nodes.pop_back();
- FreeNodeIdx(nodeIdx);
- }
- }
-
- void TTenants::RunNodes(const TString &name, ui32 count) {
+
+ for (ui32 num = 0; num < count && nodes; ++num) {
+ ui32 nodeIdx = nodes.back();
+ StopNode(name, nodeIdx);
+ nodes.pop_back();
+ FreeNodeIdx(nodeIdx);
+ }
+ }
+
+ void TTenants::RunNodes(const TString &name, ui32 count) {
TVector<ui32>& nodes = Nodes(name);
-
- for (ui32 num = 0; num < count; ++num) {
- ui32 nodeIdx = AllocNodeIdx();
- RunNode(name, nodeIdx);
- nodes.push_back(nodeIdx);
- }
- }
-
- ui32 TTenants::AllocNodeIdx() {
- Y_VERIFY(VacantNodes);
- PopHeap(VacantNodes.begin(), VacantNodes.end());
- ui32 node = VacantNodes.back();
- VacantNodes.pop_back();
- return node;
- }
-
- void TTenants::FreeNodeIdx(ui32 nodeIdx) {
- VacantNodes.push_back(nodeIdx);
- PushHeap(VacantNodes.begin(), VacantNodes.end());
- }
-
+
+ for (ui32 num = 0; num < count; ++num) {
+ ui32 nodeIdx = AllocNodeIdx();
+ RunNode(name, nodeIdx);
+ nodes.push_back(nodeIdx);
+ }
+ }
+
+ ui32 TTenants::AllocNodeIdx() {
+ Y_VERIFY(VacantNodes);
+ PopHeap(VacantNodes.begin(), VacantNodes.end());
+ ui32 node = VacantNodes.back();
+ VacantNodes.pop_back();
+ return node;
+ }
+
+ void TTenants::FreeNodeIdx(ui32 nodeIdx) {
+ VacantNodes.push_back(nodeIdx);
+ PushHeap(VacantNodes.begin(), VacantNodes.end());
+ }
+
TServerSettings& TServerSettings::AddStoragePool(const TString& poolKind, const TString& poolName, ui32 numGroups, ui32 encryptionMode) {
NKikimrBlobStorage::TDefineStoragePool& hddPool = StoragePoolTypes[poolKind];
hddPool.SetBoxId(BOX_ID);
@@ -2461,20 +2461,20 @@ namespace Tests {
}
TServerSettings& TServerSettings::AddStoragePoolType(const TString& poolKind, ui32 encryptionMode) {
- NKikimrBlobStorage::TDefineStoragePool hddPool;
+ NKikimrBlobStorage::TDefineStoragePool hddPool;
hddPool.SetBoxId(BOX_ID);
hddPool.SetStoragePoolId(POOL_ID++);
- hddPool.SetErasureSpecies("none");
- hddPool.SetVDiskKind("Default");
- hddPool.AddPDiskFilter()->AddProperty()->SetType(NKikimrBlobStorage::ROT);
- hddPool.SetKind(poolKind);
+ hddPool.SetErasureSpecies("none");
+ hddPool.SetVDiskKind("Default");
+ hddPool.AddPDiskFilter()->AddProperty()->SetType(NKikimrBlobStorage::ROT);
+ hddPool.SetKind(poolKind);
if (encryptionMode) {
hddPool.SetEncryptionMode(encryptionMode);
}
- StoragePoolTypes[poolKind] = hddPool;
- return *this;
- }
-
-
+ StoragePoolTypes[poolKind] = hddPool;
+ return *this;
+ }
+
+
}
}
diff --git a/ydb/core/testlib/test_client.h b/ydb/core/testlib/test_client.h
index a7109e2a36b..2064752ab45 100644
--- a/ydb/core/testlib/test_client.h
+++ b/ydb/core/testlib/test_client.h
@@ -28,7 +28,7 @@
#include <google/protobuf/text_format.h>
#include <functional>
-#include <algorithm>
+#include <algorithm>
namespace NKikimr {
namespace Tests {
@@ -46,13 +46,13 @@ namespace Tests {
constexpr const char* TestDomainName = "dc-1";
const ui32 TestDomain = 1;
- const ui64 DummyTablet1 = 0x840100;
- const ui64 DummyTablet2 = 0x840101;
- const ui64 Coordinator = 0x800001;
- const ui64 Mediator = 0x810001;
- const ui64 TxAllocator = 0x820001;
- const ui64 SchemeRoot = 0x850100;
- const ui64 Hive = 0xA001;
+ const ui64 DummyTablet1 = 0x840100;
+ const ui64 DummyTablet2 = 0x840101;
+ const ui64 Coordinator = 0x800001;
+ const ui64 Mediator = 0x810001;
+ const ui64 TxAllocator = 0x820001;
+ const ui64 SchemeRoot = 0x850100;
+ const ui64 Hive = 0xA001;
struct TServerSetup {
TString IpAddress;
@@ -72,20 +72,20 @@ namespace Tests {
TServerSetup GetServerSetup();
ui64 ChangeDomain(ui64 tabletId, ui32 domainUid);
- ui64 ChangeStateStorage(ui64 tabletId, ui32 ssUid);
+ ui64 ChangeStateStorage(ui64 tabletId, ui32 ssUid);
NMiniKQL::IFunctionRegistry* DefaultFrFactory(const NScheme::TTypeRegistry& typeRegistry);
-
+
struct TServerSettings: public TThrRefBase, public TTestFeatureFlagsHolder<TServerSettings> {
static constexpr ui64 BOX_ID = 999;
ui64 POOL_ID = 1;
- using TPtr = TIntrusivePtr<TServerSettings>;
- using TConstPtr = TIntrusiveConstPtr<TServerSettings>;
-
+ using TPtr = TIntrusivePtr<TServerSettings>;
+ using TConstPtr = TIntrusiveConstPtr<TServerSettings>;
+
using TControls = NKikimrConfig::TImmediateControlsConfig;
using TLoggerInitializer = std::function<void (TTestActorRuntime&)>;
- using TStoragePoolKinds = TDomainsInfo::TDomain::TStoragePoolKinds;
+ using TStoragePoolKinds = TDomainsInfo::TDomain::TStoragePoolKinds;
ui16 Port;
ui16 GrpcPort = 0;
@@ -93,12 +93,12 @@ namespace Tests {
NKikimrPQ::TPQConfig PQConfig;
NKikimrPQ::TPQClusterDiscoveryConfig PQClusterDiscoveryConfig;
NKikimrNetClassifier::TNetClassifierConfig NetClassifierConfig;
- ui32 Domain = TestDomain;
+ ui32 Domain = TestDomain;
bool SupportsRedirect = true;
TString TracePath;
TString DomainName = TestDomainName;
ui32 NodeCount = 1;
- ui32 DynamicNodeCount = 0;
+ ui32 DynamicNodeCount = 0;
NFake::TStorage CustomDiskParams;
TControls Controls;
TAppPrepare::TFnReg FrFactory = &DefaultFrFactory;
@@ -106,7 +106,7 @@ namespace Tests {
bool EnableMockOnSingleNode = true;
TAutoPtr<TLogBackend> LogBackend;
TLoggerInitializer LoggerInitializer;
- TStoragePoolKinds StoragePoolTypes;
+ TStoragePoolKinds StoragePoolTypes;
TVector<NKikimrKqp::TKqpSetting> KqpSettings;
bool EnableConsole = true;
bool EnableConfigsDispatcher = true;
@@ -118,7 +118,7 @@ namespace Tests {
ui64 ChangesQueueBytesLimit = 0;
NKikimrConfig::TAppConfig AppConfig;
NKikimrConfig::TCompactionConfig CompactionConfig;
- TMap<ui32, TString> NodeKeys;
+ TMap<ui32, TString> NodeKeys;
ui64 DomainPlanResolution = 0;
std::shared_ptr<NKikimr::NMsgBusProxy::IPersQueueGetReadSessionsInfoWorkerFactory> PersQueueGetReadSessionsInfoWorkerFactory;
@@ -131,15 +131,15 @@ namespace Tests {
TServerSettings& SetGrpcPort(ui16 value) { GrpcPort = value; return *this; }
TServerSettings& SetSupportsRedirect(bool value) { SupportsRedirect = value; return *this; }
TServerSettings& SetTracePath(const TString& value) { TracePath = value; return *this; }
- TServerSettings& SetDomain(ui32 value) { Domain = value; return *this; }
+ TServerSettings& SetDomain(ui32 value) { Domain = value; return *this; }
TServerSettings& SetDomainName(const TString& value);
TServerSettings& SetNodeCount(ui32 value) { NodeCount = value; return *this; }
- TServerSettings& SetDynamicNodeCount(ui32 value) { DynamicNodeCount = value; return *this; }
+ TServerSettings& SetDynamicNodeCount(ui32 value) { DynamicNodeCount = value; return *this; }
TServerSettings& SetCustomDiskParams(const NFake::TStorage& value) { CustomDiskParams = value; return *this; }
TServerSettings& SetControls(const TControls& value) { Controls = value; return *this; }
TServerSettings& SetFrFactory(const TAppPrepare::TFnReg& value) { FrFactory = value; return *this; }
TServerSettings& SetEnableMockOnSingleNode(bool value) { EnableMockOnSingleNode = value; return *this; }
- TServerSettings& SetLogBackend(TAutoPtr<TLogBackend> value) { LogBackend = value; return *this; }
+ TServerSettings& SetLogBackend(TAutoPtr<TLogBackend> value) { LogBackend = value; return *this; }
TServerSettings& SetLoggerInitializer(TLoggerInitializer value) { LoggerInitializer = std::move(value); return *this; }
TServerSettings& AddStoragePoolType(const TString& poolKind, ui32 encryptionMode = 0);
TServerSettings& AddStoragePool(const TString& poolKind, const TString& poolName = {}, ui32 numGroups = 1, ui32 encryptionMode = 0);
@@ -148,7 +148,7 @@ namespace Tests {
TServerSettings& SetEnableConfigsDispatcher(bool value) { EnableConfigsDispatcher = value; return *this; }
TServerSettings& SetUseRealThreads(bool value) { UseRealThreads = value; return *this; }
TServerSettings& SetAppConfig(const NKikimrConfig::TAppConfig value) { AppConfig = value; return *this; }
- TServerSettings& SetKeyFor(ui32 nodeId, TString keyValue) { NodeKeys[nodeId] = keyValue; return *this; }
+ TServerSettings& SetKeyFor(ui32 nodeId, TString keyValue) { NodeKeys[nodeId] = keyValue; return *this; }
TServerSettings& SetEnableKqpSpilling(bool value) { EnableKqpSpilling = value; return *this; }
TServerSettings& SetDomainPlanResolution(ui64 resolution) { DomainPlanResolution = resolution; return *this; }
TServerSettings& SetFeatureFlags(const NKikimrConfig::TFeatureFlags& value) { FeatureFlags = value; return *this; }
@@ -186,36 +186,36 @@ namespace Tests {
{
AddStoragePool("test", "/" + DomainName + ":test");
}
-
- TServerSettings(const TServerSettings& settings) = default;
+
+ TServerSettings(const TServerSettings& settings) = default;
};
- class TServer : public TThrRefBase, TMoveOnly {
- protected:
- void SetupStorage();
-
- void SetupMessageBus(ui16 port, const TString &tracePath);
+ class TServer : public TThrRefBase, TMoveOnly {
+ protected:
+ void SetupStorage();
+
+ void SetupMessageBus(ui16 port, const TString &tracePath);
void SetupDomains(TAppPrepare&);
void CreateBootstrapTablets();
- void SetupLocalConfig(TLocalConfig &localConfig, const NKikimr::TAppData &appData);
- void SetupDomainLocalService(ui32 nodeIdx);
- void SetupLocalService(ui32 nodeIdx, const TString &domainName);
+ void SetupLocalConfig(TLocalConfig &localConfig, const NKikimr::TAppData &appData);
+ void SetupDomainLocalService(ui32 nodeIdx);
+ void SetupLocalService(ui32 nodeIdx, const TString &domainName);
void SetupConfigurators(ui32 nodeIdx);
void SetupProxies(ui32 nodeIdx);
- void SetupLogging();
-
+ void SetupLogging();
+
void Initialize();
-
+
public:
- using TPtr = TIntrusivePtr<TServer>;
- using TMapStoragePool = TDomainsInfo::TDomain::TStoragePoolKinds;
+ using TPtr = TIntrusivePtr<TServer>;
+ using TMapStoragePool = TDomainsInfo::TDomain::TStoragePoolKinds;
TServer(const TServerSettings& settings, bool defaultInit = true);
TServer(TServerSettings::TConstPtr settings, bool defaultInit = true);
- TServer(TServer&& server) = default;
- TServer& operator =(TServer&& server) = default;
- virtual ~TServer();
+ TServer(TServer&& server) = default;
+ TServer& operator =(TServer&& server) = default;
+ virtual ~TServer();
void EnableGRpc(const NGrpc::TServerOptions& options);
void EnableGRpc(ui16 port);
@@ -232,30 +232,30 @@ namespace Tests {
GRpcServer = nullptr;
}
}
- void StartDummyTablets();
+ void StartDummyTablets();
TTestActorRuntime* GetRuntime() const;
- const TServerSettings& GetSettings() const;
- const NScheme::TTypeRegistry* GetTypeRegistry();
- const NMiniKQL::IFunctionRegistry* GetFunctionRegistry();
-
- ui32 StaticNodes() const {
- return Settings->NodeCount;
- }
- ui32 DynamicNodes() const {
- return Settings->DynamicNodeCount;
- }
- void SetupDynamicLocalService(ui32 nodeIdx, const TString &tenantName);
- void DestroyDynamicLocalService(ui32 nodeIdx);
-
- protected:
- const TServerSettings::TConstPtr Settings;
- const bool UseStoragePools;
-
- THolder<TTestActorRuntime> Runtime;
+ const TServerSettings& GetSettings() const;
+ const NScheme::TTypeRegistry* GetTypeRegistry();
+ const NMiniKQL::IFunctionRegistry* GetFunctionRegistry();
+
+ ui32 StaticNodes() const {
+ return Settings->NodeCount;
+ }
+ ui32 DynamicNodes() const {
+ return Settings->DynamicNodeCount;
+ }
+ void SetupDynamicLocalService(ui32 nodeIdx, const TString &tenantName);
+ void DestroyDynamicLocalService(ui32 nodeIdx);
+
+ protected:
+ const TServerSettings::TConstPtr Settings;
+ const bool UseStoragePools;
+
+ THolder<TTestActorRuntime> Runtime;
THolder<NYdb::TDriver> Driver;
- TIntrusivePtr<NBus::TBusMessageQueue> Bus;
- const NBus::TBusServerSessionConfig BusServerSessionConfig; //BusServer hold const & on config
- TAutoPtr<NMsgBusProxy::IMessageBusServer> BusServer;
+ TIntrusivePtr<NBus::TBusMessageQueue> Bus;
+ const NBus::TBusServerSessionConfig BusServerSessionConfig; //BusServer hold const & on config
+ TAutoPtr<NMsgBusProxy::IMessageBusServer> BusServer;
std::unique_ptr<NGrpc::TGRpcServer> GRpcServer;
TIntrusivePtr<NMonitoring::TDynamicCounters> GRpcServerRootCounters;
};
@@ -268,14 +268,14 @@ namespace Tests {
bool CollectStats = false;
};
- struct TPathVersion {
- ui64 OwnerId = 0;
- ui64 PathId = 0;
- ui64 Version = 0;
- };
- using TApplyIf = TVector<TPathVersion>;
-
- TClient(const TServerSettings& settings);
+ struct TPathVersion {
+ ui64 OwnerId = 0;
+ ui64 PathId = 0;
+ ui64 Version = 0;
+ };
+ using TApplyIf = TVector<TPathVersion>;
+
+ TClient(const TServerSettings& settings);
virtual ~TClient();
const NMsgBusProxy::TMsgBusClientConfig& GetClientConfig() const;
@@ -333,58 +333,58 @@ namespace Tests {
}
static ui64 GetPatchedSchemeRoot(ui64 schemeRoot, ui32 domain, bool supportsRedirect);
- void WaitRootIsUp(const TString& root);
- TAutoPtr<NBus::TBusMessage> InitRootSchemeWithReply(const TString& root);
- void InitRootScheme();
- void InitRootScheme(const TString& root);
+ void WaitRootIsUp(const TString& root);
+ TAutoPtr<NBus::TBusMessage> InitRootSchemeWithReply(const TString& root);
+ void InitRootScheme();
+ void InitRootScheme(const TString& root);
void ExecuteTraceCommand(NKikimrClient::TMessageBusTraceRequest::ECommand command, const TString &path = TString());
TString StartTrace(const TString &path);
void StopTrace();
// Flat DB operations
- NMsgBusProxy::EResponseStatus WaitCreateTx(TTestActorRuntime* runtime, const TString& path, TDuration timeout);
- NMsgBusProxy::EResponseStatus MkDir(const TString& parent, const TString& name, const TApplyIf& applyIf = {});
- NMsgBusProxy::EResponseStatus RmDir(const TString& parent, const TString& name, const TApplyIf& applyIf = {});
- NMsgBusProxy::EResponseStatus CreateSubdomain(const TString &parent, const TString &description);
- NMsgBusProxy::EResponseStatus CreateSubdomain(const TString& parent, const NKikimrSubDomains::TSubDomainSettings &subdomain);
- NMsgBusProxy::EResponseStatus CreateExtSubdomain(const TString &parent, const TString &description);
- NMsgBusProxy::EResponseStatus CreateExtSubdomain(const TString& parent, const NKikimrSubDomains::TSubDomainSettings &subdomain);
- NMsgBusProxy::EResponseStatus AlterExtSubdomain(const TString &parent, const NKikimrSubDomains::TSubDomainSettings &subdomain, TDuration timeout = TDuration::Seconds(5000));
- NMsgBusProxy::EResponseStatus AlterUserAttributes(const TString &parent, const TString &name, const TVector<std::pair<TString, TString>>& addAttrs, const TVector<TString>& dropAttrs = {}, const TApplyIf& applyIf = {});
- NMsgBusProxy::EResponseStatus AlterSubdomain(const TString &parent, const TString &description, TDuration timeout = TDuration::Seconds(5000));
- NMsgBusProxy::EResponseStatus AlterSubdomain(const TString& parent, const NKikimrSubDomains::TSubDomainSettings &subdomain, TDuration timeout = TDuration::Seconds(5000));
- NMsgBusProxy::EResponseStatus DeleteSubdomain(const TString& parent, const TString &name);
- NMsgBusProxy::EResponseStatus ForceDeleteSubdomain(const TString& parent, const TString &name);
- NMsgBusProxy::EResponseStatus ForceDeleteUnsafe(const TString& parent, const TString &name);
+ NMsgBusProxy::EResponseStatus WaitCreateTx(TTestActorRuntime* runtime, const TString& path, TDuration timeout);
+ NMsgBusProxy::EResponseStatus MkDir(const TString& parent, const TString& name, const TApplyIf& applyIf = {});
+ NMsgBusProxy::EResponseStatus RmDir(const TString& parent, const TString& name, const TApplyIf& applyIf = {});
+ NMsgBusProxy::EResponseStatus CreateSubdomain(const TString &parent, const TString &description);
+ NMsgBusProxy::EResponseStatus CreateSubdomain(const TString& parent, const NKikimrSubDomains::TSubDomainSettings &subdomain);
+ NMsgBusProxy::EResponseStatus CreateExtSubdomain(const TString &parent, const TString &description);
+ NMsgBusProxy::EResponseStatus CreateExtSubdomain(const TString& parent, const NKikimrSubDomains::TSubDomainSettings &subdomain);
+ NMsgBusProxy::EResponseStatus AlterExtSubdomain(const TString &parent, const NKikimrSubDomains::TSubDomainSettings &subdomain, TDuration timeout = TDuration::Seconds(5000));
+ NMsgBusProxy::EResponseStatus AlterUserAttributes(const TString &parent, const TString &name, const TVector<std::pair<TString, TString>>& addAttrs, const TVector<TString>& dropAttrs = {}, const TApplyIf& applyIf = {});
+ NMsgBusProxy::EResponseStatus AlterSubdomain(const TString &parent, const TString &description, TDuration timeout = TDuration::Seconds(5000));
+ NMsgBusProxy::EResponseStatus AlterSubdomain(const TString& parent, const NKikimrSubDomains::TSubDomainSettings &subdomain, TDuration timeout = TDuration::Seconds(5000));
+ NMsgBusProxy::EResponseStatus DeleteSubdomain(const TString& parent, const TString &name);
+ NMsgBusProxy::EResponseStatus ForceDeleteSubdomain(const TString& parent, const TString &name);
+ NMsgBusProxy::EResponseStatus ForceDeleteUnsafe(const TString& parent, const TString &name);
NMsgBusProxy::EResponseStatus CreateUser(const TString& parent, const TString& user, const TString& password);
-
- NMsgBusProxy::EResponseStatus CreateTable(const TString& parent, const TString& scheme, TDuration timeout = TDuration::Seconds(5000));
- NMsgBusProxy::EResponseStatus CreateTable(const TString& parent, const NKikimrSchemeOp::TTableDescription &table, TDuration timeout = TDuration::Seconds(5000));
+
+ NMsgBusProxy::EResponseStatus CreateTable(const TString& parent, const TString& scheme, TDuration timeout = TDuration::Seconds(5000));
+ 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, 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 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);
NMsgBusProxy::EResponseStatus DeleteKesus(const TString& parent, const TString& name);
- NMsgBusProxy::EResponseStatus ConsistentCopyTables(TVector<std::pair<TString, TString>> desc, TDuration timeout = TDuration::Seconds(5000));
- NMsgBusProxy::EResponseStatus DeleteTable(const TString& parent, const TString& name);
- NMsgBusProxy::EResponseStatus AlterTable(const TString& parent, const NKikimrSchemeOp::TTableDescription& update);
- NMsgBusProxy::EResponseStatus AlterTable(const TString& parent, const TString& alter);
- TAutoPtr<NMsgBusProxy::TBusResponse> AlterTable(const TString& parent, const NKikimrSchemeOp::TTableDescription& update, const TString& userToken);
+ NMsgBusProxy::EResponseStatus ConsistentCopyTables(TVector<std::pair<TString, TString>> desc, TDuration timeout = TDuration::Seconds(5000));
+ NMsgBusProxy::EResponseStatus DeleteTable(const TString& parent, const TString& name);
+ NMsgBusProxy::EResponseStatus AlterTable(const TString& parent, const NKikimrSchemeOp::TTableDescription& update);
+ NMsgBusProxy::EResponseStatus AlterTable(const TString& parent, const TString& alter);
+ TAutoPtr<NMsgBusProxy::TBusResponse> AlterTable(const TString& parent, const NKikimrSchemeOp::TTableDescription& update, const TString& userToken);
TAutoPtr<NMsgBusProxy::TBusResponse> AlterTable(const TString& parent, const TString& alter, const TString& userToken);
-
+
NMsgBusProxy::EResponseStatus CreateOlapStore(const TString& parent, const TString& scheme);
NMsgBusProxy::EResponseStatus CreateOlapStore(const TString& parent, const NKikimrSchemeOp::TColumnStoreDescription& store);
NMsgBusProxy::EResponseStatus CreateOlapTable(const TString& parent, const TString& scheme);
NMsgBusProxy::EResponseStatus CreateOlapTable(const TString& parent, const NKikimrSchemeOp::TColumnTableDescription& table);
- NMsgBusProxy::EResponseStatus CreateSolomon(const TString& parent, const TString& name, ui32 parts = 4, ui32 channelProfile = 0);
- NMsgBusProxy::EResponseStatus StoreTableBackup(const TString& parent, const NKikimrSchemeOp::TBackupTask& task);
+ NMsgBusProxy::EResponseStatus CreateSolomon(const TString& parent, const TString& name, ui32 parts = 4, ui32 channelProfile = 0);
+ NMsgBusProxy::EResponseStatus StoreTableBackup(const TString& parent, const NKikimrSchemeOp::TBackupTask& task);
NMsgBusProxy::EResponseStatus DeleteTopic(const TString& parent, const TString& name);
TAutoPtr<NMsgBusProxy::TBusResponse> TryDropPersQueueGroup(const TString& parent, const TString& name);
TAutoPtr<NMsgBusProxy::TBusResponse> Ls(const TString& path);
- static TPathVersion ExtractPathVersion(const TAutoPtr<NMsgBusProxy::TBusResponse>& describe);
+ static TPathVersion ExtractPathVersion(const TAutoPtr<NMsgBusProxy::TBusResponse>& describe);
static TVector<ui64> ExtractTableShards(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
bool FlatQuery(const TString& mkql, NKikimrMiniKQL::TResult& result);
bool FlatQuery(const TString& mkql, TFlatQueryOptions& opts, NKikimrMiniKQL::TResult& result,
@@ -403,17 +403,17 @@ namespace Tests {
bool LocalSchemeTx(const ui64 tabletId, const TString& schemeChanges, bool dryRun,
NTabletFlatScheme::TSchemeChanges& scheme, TString& err);
void SetSecurityToken(const TString& token) { SecurityToken = token; }
- void ModifyOwner(const TString& parent, const TString& name, const TString& owner);
+ void ModifyOwner(const TString& parent, const TString& name, const TString& owner);
void ModifyACL(const TString& parent, const TString& name, const TString& acl);
- TString CreateStoragePool(const TString& poolKind, const TString& partOfName, ui32 groups = 1);
- NKikimrBlobStorage::TDefineStoragePool DescribeStoragePool(const TString& name);
- void RemoveStoragePool(const TString& name);
+ TString CreateStoragePool(const TString& poolKind, const TString& partOfName, ui32 groups = 1);
+ NKikimrBlobStorage::TDefineStoragePool DescribeStoragePool(const TString& name);
+ void RemoveStoragePool(const TString& name);
+
-
TAutoPtr<NMsgBusProxy::TBusResponse> HiveCreateTablet(ui32 domainUid, ui64 owner, ui64 owner_index, TTabletTypes::EType tablet_type,
- const TVector<ui32>& allowed_node_ids, const TVector<TSubDomainKey>& allowed_domains = {}, const TChannelsBindings& binding = {});
-
-
+ const TVector<ui32>& allowed_node_ids, const TVector<TSubDomainKey>& allowed_domains = {}, const TChannelsBindings& binding = {});
+
+
// Helper functions
TString SendTabletMonQuery(TTestActorRuntime* runtime, ui64 tabletId, TString query);
TString MarkNodeInHive(TTestActorRuntime* runtime, ui32 nodeIdx, bool up);
@@ -421,7 +421,7 @@ namespace Tests {
bool WaitForTabletAlive(TTestActorRuntime* runtime, ui64 tabletId, bool leader, TDuration timeout);
bool WaitForTabletDown(TTestActorRuntime* runtime, ui64 tabletId, bool leader, TDuration timeout);
ui32 GetLeaderNode(TTestActorRuntime* runtime, ui64 tabletId);
- bool TabletExistsInHive(TTestActorRuntime* runtime, ui64 tabletId, bool evenInDeleting = false);
+ bool TabletExistsInHive(TTestActorRuntime* runtime, ui64 tabletId, bool evenInDeleting = false);
TVector<ui32> GetFollowerNodes(TTestActorRuntime *runtime, ui64 tabletId);
void S3Listing(const TString& table, const TString& prefixColumnsPb, const TString &pathPrefix,
const TString &pathDelimiter, const TString& startAfterSuffixColumnsPb,
@@ -429,10 +429,10 @@ namespace Tests {
NKikimrClient::TS3ListingResponse &res);
void GetTabletInfoFromHive(TTestActorRuntime* runtime, ui64 tabletId, bool returnFollowers, NKikimrHive::TEvResponseHiveInfo& res);
- void GetTabletStorageInfoFromHive(TTestActorRuntime* runtime, ui64 tabletId, NKikimrHive::TEvGetTabletStorageInfoResult& res);
-
- static void RefreshPathCache(TTestActorRuntime* runtime, const TString& path, ui32 nodeIdx = 0);
-
+ void GetTabletStorageInfoFromHive(TTestActorRuntime* runtime, ui64 tabletId, NKikimrHive::TEvGetTabletStorageInfoResult& res);
+
+ static void RefreshPathCache(TTestActorRuntime* runtime, const TString& path, ui32 nodeIdx = 0);
+
ui64 GetKesusTabletId(const TString& kesusPath);
Ydb::StatusIds::StatusCode AddQuoterResource(TTestActorRuntime* runtime, const TString& kesusPath, const TString& resourcePath, const NKikimrKesus::THierarchicalDRRResourceConfig& props);
Ydb::StatusIds::StatusCode AddQuoterResource(TTestActorRuntime* runtime, const TString& kesusPath, const TString& resourcePath, const TMaybe<double> maxUnitsPerSecond = Nothing());
@@ -481,36 +481,36 @@ namespace Tests {
}
// Waits for scheme operation to complete
- NBus::EMessageStatus WaitCompletion(ui64 txId, ui64 schemeshard, ui64 pathId,
- TAutoPtr<NBus::TBusMessage>& reply,
- TDuration timeout = TDuration::Seconds(1000));
+ NBus::EMessageStatus WaitCompletion(ui64 txId, ui64 schemeshard, ui64 pathId,
+ TAutoPtr<NBus::TBusMessage>& reply,
+ TDuration timeout = TDuration::Seconds(1000));
NBus::EMessageStatus SendAndWaitCompletion(TAutoPtr<NMsgBusProxy::TBusSchemeOperation> request,
- TAutoPtr<NBus::TBusMessage>& reply,
- TDuration timeout = TDuration::Seconds(1000));
+ TAutoPtr<NBus::TBusMessage>& reply,
+ TDuration timeout = TDuration::Seconds(1000));
ui32 NodeIdToIndex(TTestActorRuntime* runtime, ui32 id) {
ui32 offset = runtime->GetNodeId(0);
- Y_VERIFY(id >= offset);
+ Y_VERIFY(id >= offset);
return id - offset;
}
TAutoPtr<NMsgBusProxy::TBusResponse> LsImpl(const TString& path);
- static void SetApplyIf(NKikimrSchemeOp::TModifyScheme& transaction, const TApplyIf& applyIf) {
- for (auto& pathVer: applyIf) {
- auto item = transaction.AddApplyIf();
- item->SetPathId(pathVer.PathId);
- item->SetPathVersion(pathVer.Version);
- }
- }
-
+ static void SetApplyIf(NKikimrSchemeOp::TModifyScheme& transaction, const TApplyIf& applyIf) {
+ for (auto& pathVer: applyIf) {
+ auto item = transaction.AddApplyIf();
+ item->SetPathId(pathVer.PathId);
+ item->SetPathVersion(pathVer.Version);
+ }
+ }
+
protected:
- using TStoragePoolKinds = TDomainsInfo::TDomain::TStoragePoolKinds;
-
+ using TStoragePoolKinds = TDomainsInfo::TDomain::TStoragePoolKinds;
+
const ui32 Domain;
const TString DomainName;
const bool SupportsRedirect;
- const TStoragePoolKinds StoragePoolTypes;
+ const TStoragePoolKinds StoragePoolTypes;
NScheme::TKikimrTypeRegistry TypeRegistry;
TIntrusivePtr<NMiniKQL::IFunctionRegistry> FunctionRegistry;
NMsgBusProxy::TMsgBusClientConfig ClientConfig;
@@ -521,44 +521,44 @@ namespace Tests {
TString SecurityToken;
};
- struct TTenants {
- private:
- Tests::TServer::TPtr Server;
-
+ struct TTenants {
+ private:
+ Tests::TServer::TPtr Server;
+
TVector<ui32> VacantNodes;
TMap<TString, TVector<ui32>> Tenants;
-
- public:
- TTenants(Tests::TServer::TPtr server);
- ~TTenants();
-
- void Run(const TString &name, ui32 nodes = 1);
- void Stop(const TString &name);
- void Stop();
-
- void Add(const TString &name, ui32 nodes = 1);
- void Free(const TString &name, ui32 nodes = 1);
-
- bool IsActive(const TString &name, ui32 nodeIdx) const;
- void FreeNode(const TString &name, ui32 nodeIdx);
-
- bool IsStaticNode(ui32 nodeIdx) const;
+
+ public:
+ TTenants(Tests::TServer::TPtr server);
+ ~TTenants();
+
+ void Run(const TString &name, ui32 nodes = 1);
+ void Stop(const TString &name);
+ void Stop();
+
+ void Add(const TString &name, ui32 nodes = 1);
+ void Free(const TString &name, ui32 nodes = 1);
+
+ bool IsActive(const TString &name, ui32 nodeIdx) const;
+ void FreeNode(const TString &name, ui32 nodeIdx);
+
+ bool IsStaticNode(ui32 nodeIdx) const;
const TVector<ui32>& List(const TString &name) const;
- ui32 Size(const TString &name) const;
- ui32 Size() const;
- ui32 Availabe() const;
- ui32 Capacity() const;
-
- private:
+ ui32 Size(const TString &name) const;
+ ui32 Size() const;
+ ui32 Availabe() const;
+ ui32 Capacity() const;
+
+ private:
TVector<ui32>& Nodes(const TString &name);
- void StopNode(const TString /*name*/, ui32 nodeIdx);
- void RunNode(const TString &name, ui32 nodeIdx);
- void StopPaticularNode(const TString &name, ui32 nodeIdx);
- void StopNodes(const TString &name, ui32 count);
- void RunNodes(const TString &name, ui32 count);
- ui32 AllocNodeIdx();
- void FreeNodeIdx(ui32 nodeIdx);
- };
-
+ void StopNode(const TString /*name*/, ui32 nodeIdx);
+ void RunNode(const TString &name, ui32 nodeIdx);
+ void StopPaticularNode(const TString &name, ui32 nodeIdx);
+ void StopNodes(const TString &name, ui32 count);
+ void RunNodes(const TString &name, ui32 count);
+ ui32 AllocNodeIdx();
+ void FreeNodeIdx(ui32 nodeIdx);
+ };
+
}
}
diff --git a/ydb/core/testlib/test_pq_client.h b/ydb/core/testlib/test_pq_client.h
index 1c3c65d25df..f0599232508 100644
--- a/ydb/core/testlib/test_pq_client.h
+++ b/ydb/core/testlib/test_pq_client.h
@@ -1019,7 +1019,7 @@ public:
for (; i < 500; ++i) {
TAutoPtr<NMsgBusProxy::TBusResponse> r = TryDropPersQueueGroup("/Root/PQ", name);
UNIT_ASSERT(r);
- if (r->Record.GetSchemeStatus() == NKikimrScheme::StatusPathDoesNotExist) {
+ if (r->Record.GetSchemeStatus() == NKikimrScheme::StatusPathDoesNotExist) {
break;
}
Sleep(TDuration::MilliSeconds(50));
diff --git a/ydb/core/tx/balance_coverage/defs.h b/ydb/core/tx/balance_coverage/defs.h
index be74f0bf20f..6220d95bc3d 100644
--- a/ydb/core/tx/balance_coverage/defs.h
+++ b/ydb/core/tx/balance_coverage/defs.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
// unique tag to fix pragma once gcc glueing: ./ydb/core/tx/proxy/defs.h
#include <ydb/core/base/defs.h>
#include <ydb/core/base/events.h>
diff --git a/ydb/core/tx/balance_coverage/ut/ya.make b/ydb/core/tx/balance_coverage/ut/ya.make
index 3565d3ff358..55dee93c047 100644
--- a/ydb/core/tx/balance_coverage/ut/ya.make
+++ b/ydb/core/tx/balance_coverage/ut/ya.make
@@ -1,27 +1,27 @@
UNITTEST_FOR(ydb/core/tx/balance_coverage)
-
+
OWNER(
svc
g:kikimr
)
-
-FORK_SUBTESTS()
-IF (SANITIZER_TYPE)
+FORK_SUBTESTS()
+
+IF (SANITIZER_TYPE)
TIMEOUT(600)
SIZE(MEDIUM)
-ELSE()
- TIMEOUT(60)
- SIZE(SMALL)
-ENDIF()
-
-PEERDIR(
+ELSE()
+ TIMEOUT(60)
+ SIZE(SMALL)
+ENDIF()
+
+PEERDIR(
library/cpp/testing/unittest
ydb/core/testlib
-)
-
-SRCS(
- balance_coverage_builder_ut.cpp
-)
-
-END()
+)
+
+SRCS(
+ balance_coverage_builder_ut.cpp
+)
+
+END()
diff --git a/ydb/core/tx/balance_coverage/ya.make b/ydb/core/tx/balance_coverage/ya.make
index b8827e0eca4..d97c07aea49 100644
--- a/ydb/core/tx/balance_coverage/ya.make
+++ b/ydb/core/tx/balance_coverage/ya.make
@@ -1,20 +1,20 @@
-LIBRARY()
-
-OWNER(
- svc
+LIBRARY()
+
+OWNER(
+ svc
g:kikimr
-)
-
-PEERDIR(
+)
+
+PEERDIR(
ydb/core/base
ydb/core/protos
-)
-
-SRCS(
- balance_coverage_builder.cpp
-)
-
-END()
+)
+
+SRCS(
+ balance_coverage_builder.cpp
+)
+
+END()
RECURSE_FOR_TESTS(
ut
diff --git a/ydb/core/tx/columnshard/columnshard_ut_common.h b/ydb/core/tx/columnshard/columnshard_ut_common.h
index 230ccc9e735..139e83198a4 100644
--- a/ydb/core/tx/columnshard/columnshard_ut_common.h
+++ b/ydb/core/tx/columnshard/columnshard_ut_common.h
@@ -129,8 +129,8 @@ struct TTestSchema {
return schema;
}
- static NKikimrSchemeOp::TOlapColumnDescription CreateColumn(ui32 id, const TString& name, TTypeId type) {
- NKikimrSchemeOp::TOlapColumnDescription col;
+ static NKikimrSchemeOp::TOlapColumnDescription CreateColumn(ui32 id, const TString& name, TTypeId type) {
+ NKikimrSchemeOp::TOlapColumnDescription col;
col.SetId(id);
col.SetName(name);
col.SetTypeId(type);
diff --git a/ydb/core/tx/coordinator/coordinator.cpp b/ydb/core/tx/coordinator/coordinator.cpp
index dacfe7199ca..3e76fe192e2 100644
--- a/ydb/core/tx/coordinator/coordinator.cpp
+++ b/ydb/core/tx/coordinator/coordinator.cpp
@@ -1,76 +1,76 @@
-#include "coordinator.h"
-#include "coordinator_impl.h"
-
-NKikimr::TEvTxCoordinator::TEvCoordinatorStep::TEvCoordinatorStep(const NFlatTxCoordinator::TMediatorStep &mediatorStep, ui64 prevStep, ui64 mediatorId, ui64 coordinatorId, ui64 activeGeneration)
-{
- Record.SetStep(mediatorStep.Step);
- Record.SetPrevStep(prevStep);
- Record.SetMediatorID(mediatorId);
- Record.SetCoordinatorID(coordinatorId);
- Record.SetActiveCoordinatorGeneration(activeGeneration);
-
- for (const NFlatTxCoordinator::TMediatorStep::TTx &tx : mediatorStep.Transactions) {
- NKikimrTx::TCoordinatorTransaction *x = Record.AddTransactions();
- if (tx.TxId)
- x->SetTxId(tx.TxId);
- for (ui64 affected : tx.PushToAffected)
- x->AddAffectedSet(affected);
- }
-}
-
-NKikimr::TEvTxCoordinator::TEvMediatorQueueConfirmations::TEvMediatorQueueConfirmations(TAutoPtr<NKikimr::NFlatTxCoordinator::TMediatorConfirmations> &confirmations)
-: Confirmations(confirmations)
-{}
-
-NKikimr::TEvTxCoordinator::TEvCoordinatorStepResult::TEvCoordinatorStepResult(NKikimrTx::TEvCoordinatorStepResult::EStatus status, ui64 step, ui64 completeStep, ui64 latestKnown, ui64 subjectiveTime, ui64 mediator, ui64 coordinator)
-{
- Record.SetStatus(status);
- Record.SetStep(step);
- Record.SetCompleteStep(completeStep);
- Record.SetLatestKnown(latestKnown);
- Record.SetSubjectiveTime(subjectiveTime);
- Record.SetMediatorID(mediator);
- Record.SetCoordinatorID(coordinator);
-}
-
-NKikimr::TEvTxCoordinator::TEvCoordinatorSync::TEvCoordinatorSync(ui64 cookie, ui64 mediator, ui64 coordinator) {
- Record.SetCookie(cookie);
- Record.SetMediatorID(mediator);
- Record.SetCoordinatorID(coordinator);
-}
-
-NKikimr::TEvTxCoordinator::TEvCoordinatorSyncResult::TEvCoordinatorSyncResult(NKikimrProto::EReplyStatus status, ui64 cookie)
-{
- Record.SetStatus(status);
- Record.SetCookie(cookie);
-}
-
-NKikimr::TEvTxCoordinator::TEvCoordinatorSyncResult::TEvCoordinatorSyncResult(ui64 cookie, ui64 completeStep, ui64 latestKnown, ui64 subjectiveTime, ui64 mediator, ui64 coordinator)
-{
- Record.SetStatus(NKikimrProto::OK);
- Record.SetCookie(cookie);
- Record.SetCompleteStep(completeStep);
- Record.SetLatestKnown(latestKnown);
- Record.SetSubjectiveTime(subjectiveTime);
- Record.SetMediatorID(mediator);
- Record.SetCoordinatorID(coordinator);
-}
-
-NKikimr::TEvTxCoordinator::TEvMediatorQueueStep::TEvMediatorQueueStep(ui64 genCookie, TAutoPtr<NKikimr::NFlatTxCoordinator::TMediatorStep> step)
-: GenCookie(genCookie)
-, Step(step)
-{}
-
-NKikimr::TEvTxCoordinator::TEvMediatorQueueRestart::TEvMediatorQueueRestart(ui64 mediatorId, ui64 startFrom, ui64 genCookie)
-: MediatorId(mediatorId)
-, StartFrom(startFrom)
-, GenCookie(genCookie)
-{}
-
-NKikimr::TEvTxCoordinator::TEvMediatorQueueStop::TEvMediatorQueueStop(ui64 mediatorId)
-: MediatorId(mediatorId)
-{}
-
-NKikimr::TEvTxCoordinator::TEvCoordinatorConfirmPlan::TEvCoordinatorConfirmPlan(TAutoPtr<NFlatTxCoordinator::TCoordinatorStepConfirmations> &confirmations)
-: Confirmations(confirmations)
-{}
+#include "coordinator.h"
+#include "coordinator_impl.h"
+
+NKikimr::TEvTxCoordinator::TEvCoordinatorStep::TEvCoordinatorStep(const NFlatTxCoordinator::TMediatorStep &mediatorStep, ui64 prevStep, ui64 mediatorId, ui64 coordinatorId, ui64 activeGeneration)
+{
+ Record.SetStep(mediatorStep.Step);
+ Record.SetPrevStep(prevStep);
+ Record.SetMediatorID(mediatorId);
+ Record.SetCoordinatorID(coordinatorId);
+ Record.SetActiveCoordinatorGeneration(activeGeneration);
+
+ for (const NFlatTxCoordinator::TMediatorStep::TTx &tx : mediatorStep.Transactions) {
+ NKikimrTx::TCoordinatorTransaction *x = Record.AddTransactions();
+ if (tx.TxId)
+ x->SetTxId(tx.TxId);
+ for (ui64 affected : tx.PushToAffected)
+ x->AddAffectedSet(affected);
+ }
+}
+
+NKikimr::TEvTxCoordinator::TEvMediatorQueueConfirmations::TEvMediatorQueueConfirmations(TAutoPtr<NKikimr::NFlatTxCoordinator::TMediatorConfirmations> &confirmations)
+: Confirmations(confirmations)
+{}
+
+NKikimr::TEvTxCoordinator::TEvCoordinatorStepResult::TEvCoordinatorStepResult(NKikimrTx::TEvCoordinatorStepResult::EStatus status, ui64 step, ui64 completeStep, ui64 latestKnown, ui64 subjectiveTime, ui64 mediator, ui64 coordinator)
+{
+ Record.SetStatus(status);
+ Record.SetStep(step);
+ Record.SetCompleteStep(completeStep);
+ Record.SetLatestKnown(latestKnown);
+ Record.SetSubjectiveTime(subjectiveTime);
+ Record.SetMediatorID(mediator);
+ Record.SetCoordinatorID(coordinator);
+}
+
+NKikimr::TEvTxCoordinator::TEvCoordinatorSync::TEvCoordinatorSync(ui64 cookie, ui64 mediator, ui64 coordinator) {
+ Record.SetCookie(cookie);
+ Record.SetMediatorID(mediator);
+ Record.SetCoordinatorID(coordinator);
+}
+
+NKikimr::TEvTxCoordinator::TEvCoordinatorSyncResult::TEvCoordinatorSyncResult(NKikimrProto::EReplyStatus status, ui64 cookie)
+{
+ Record.SetStatus(status);
+ Record.SetCookie(cookie);
+}
+
+NKikimr::TEvTxCoordinator::TEvCoordinatorSyncResult::TEvCoordinatorSyncResult(ui64 cookie, ui64 completeStep, ui64 latestKnown, ui64 subjectiveTime, ui64 mediator, ui64 coordinator)
+{
+ Record.SetStatus(NKikimrProto::OK);
+ Record.SetCookie(cookie);
+ Record.SetCompleteStep(completeStep);
+ Record.SetLatestKnown(latestKnown);
+ Record.SetSubjectiveTime(subjectiveTime);
+ Record.SetMediatorID(mediator);
+ Record.SetCoordinatorID(coordinator);
+}
+
+NKikimr::TEvTxCoordinator::TEvMediatorQueueStep::TEvMediatorQueueStep(ui64 genCookie, TAutoPtr<NKikimr::NFlatTxCoordinator::TMediatorStep> step)
+: GenCookie(genCookie)
+, Step(step)
+{}
+
+NKikimr::TEvTxCoordinator::TEvMediatorQueueRestart::TEvMediatorQueueRestart(ui64 mediatorId, ui64 startFrom, ui64 genCookie)
+: MediatorId(mediatorId)
+, StartFrom(startFrom)
+, GenCookie(genCookie)
+{}
+
+NKikimr::TEvTxCoordinator::TEvMediatorQueueStop::TEvMediatorQueueStop(ui64 mediatorId)
+: MediatorId(mediatorId)
+{}
+
+NKikimr::TEvTxCoordinator::TEvCoordinatorConfirmPlan::TEvCoordinatorConfirmPlan(TAutoPtr<NFlatTxCoordinator::TCoordinatorStepConfirmations> &confirmations)
+: Confirmations(confirmations)
+{}
diff --git a/ydb/core/tx/coordinator/coordinator.h b/ydb/core/tx/coordinator/coordinator.h
index 947bf3264b5..e7a76df3cee 100644
--- a/ydb/core/tx/coordinator/coordinator.h
+++ b/ydb/core/tx/coordinator/coordinator.h
@@ -10,13 +10,13 @@
namespace NKikimr {
namespace NFlatTxCoordinator {
- struct TMediatorStep;
- struct TMediatorConfirmations;
- struct TCoordinatorStepConfirmations;
-}
-}
+ struct TMediatorStep;
+ struct TMediatorConfirmations;
+ struct TCoordinatorStepConfirmations;
+}
+}
-namespace NKikimr {
+namespace NKikimr {
IActor* CreateFlatTxCoordinator(const TActorId &tablet, TTabletStorageInfo *info);
@@ -40,26 +40,26 @@ struct TEvTxCoordinator {
static_assert(EvEnd < EventSpaceEnd(TKikimrEvents::ES_TX_COORDINATOR), "expect EvEnd < EventSpaceEnd(TKikimrEvents::ES_TX_COORDINATOR)");
-
+
struct TEvCoordinatorStep : public TEventPB<TEvCoordinatorStep, NKikimrTx::TEvCoordinatorStep, EvCoordinatorStep> {
TEvCoordinatorStep()
{}
- TEvCoordinatorStep(const NFlatTxCoordinator::TMediatorStep &mediatorStep, ui64 prevStep, ui64 mediatorId, ui64 coordinatorId, ui64 activeGeneration);
+ TEvCoordinatorStep(const NFlatTxCoordinator::TMediatorStep &mediatorStep, ui64 prevStep, ui64 mediatorId, ui64 coordinatorId, ui64 activeGeneration);
};
struct TEvCoordinatorStepResult : public TEventPB<TEvCoordinatorStep, NKikimrTx::TEvCoordinatorStepResult, EvCoordinatorStepResult> {
TEvCoordinatorStepResult()
{}
- TEvCoordinatorStepResult(NKikimrTx::TEvCoordinatorStepResult::EStatus status, ui64 step, ui64 completeStep, ui64 latestKnown, ui64 subjectiveTime, ui64 mediator, ui64 coordinator);
+ TEvCoordinatorStepResult(NKikimrTx::TEvCoordinatorStepResult::EStatus status, ui64 step, ui64 completeStep, ui64 latestKnown, ui64 subjectiveTime, ui64 mediator, ui64 coordinator);
};
struct TEvCoordinatorSync : public TEventPB<TEvCoordinatorSync, NKikimrTx::TEvCoordinatorSync, EvCoordinatorSync> {
TEvCoordinatorSync()
{}
- TEvCoordinatorSync(ui64 cookie, ui64 mediator, ui64 coordinator);
+ TEvCoordinatorSync(ui64 cookie, ui64 mediator, ui64 coordinator);
};
struct TEvCoordinatorSyncResult : public TEventPB<TEvCoordinatorSyncResult, NKikimrTx::TEvCoordinatorSyncResult, EvCoordinatorSyncResult> {
@@ -67,9 +67,9 @@ struct TEvTxCoordinator {
TEvCoordinatorSyncResult()
{}
- TEvCoordinatorSyncResult(NKikimrProto::EReplyStatus status, ui64 cookie);
+ TEvCoordinatorSyncResult(NKikimrProto::EReplyStatus status, ui64 cookie);
- TEvCoordinatorSyncResult(ui64 cookie, ui64 completeStep, ui64 latestKnown, ui64 subjectiveTime, ui64 mediator, ui64 coordinator);
+ TEvCoordinatorSyncResult(ui64 cookie, ui64 completeStep, ui64 latestKnown, ui64 subjectiveTime, ui64 mediator, ui64 coordinator);
};
@@ -78,7 +78,7 @@ struct TEvTxCoordinator {
const ui64 GenCookie;
TAutoPtr<NFlatTxCoordinator::TMediatorStep> Step;
- TEvMediatorQueueStep(ui64 genCookie, TAutoPtr<NFlatTxCoordinator::TMediatorStep> step);
+ TEvMediatorQueueStep(ui64 genCookie, TAutoPtr<NFlatTxCoordinator::TMediatorStep> step);
};
struct TEvMediatorQueueRestart : public TEventLocal<TEvMediatorQueueRestart, EvMediatorQueueRestart> {
@@ -86,25 +86,25 @@ struct TEvTxCoordinator {
const ui64 StartFrom;
const ui64 GenCookie;
- TEvMediatorQueueRestart(ui64 mediatorId, ui64 startFrom, ui64 genCookie);
+ TEvMediatorQueueRestart(ui64 mediatorId, ui64 startFrom, ui64 genCookie);
};
struct TEvMediatorQueueStop : public TEventLocal<TEvMediatorQueueStop, EvMediatorQueueStop> {
const ui64 MediatorId;
- TEvMediatorQueueStop(ui64 mediatorId);
+ TEvMediatorQueueStop(ui64 mediatorId);
};
struct TEvMediatorQueueConfirmations : public TEventLocal<TEvMediatorQueueConfirmations, EvMediatorQueueConfirmations> {
TAutoPtr<NFlatTxCoordinator::TMediatorConfirmations> Confirmations;
- TEvMediatorQueueConfirmations(TAutoPtr<NFlatTxCoordinator::TMediatorConfirmations> &confirmations);
+ TEvMediatorQueueConfirmations(TAutoPtr<NFlatTxCoordinator::TMediatorConfirmations> &confirmations);
};
struct TEvCoordinatorConfirmPlan : public TEventLocal<TEvCoordinatorConfirmPlan, EvCoordinatorConfirmPlan> {
TAutoPtr<NFlatTxCoordinator::TCoordinatorStepConfirmations> Confirmations;
- TEvCoordinatorConfirmPlan(TAutoPtr<NFlatTxCoordinator::TCoordinatorStepConfirmations> &confirmations);
+ TEvCoordinatorConfirmPlan(TAutoPtr<NFlatTxCoordinator::TCoordinatorStepConfirmations> &confirmations);
};
};
diff --git a/ydb/core/tx/coordinator/coordinator__check.cpp b/ydb/core/tx/coordinator/coordinator__check.cpp
index 14190aae28d..345ce8d1ddb 100644
--- a/ydb/core/tx/coordinator/coordinator__check.cpp
+++ b/ydb/core/tx/coordinator/coordinator__check.cpp
@@ -1,4 +1,4 @@
-#include "coordinator__check.h"
+#include "coordinator__check.h"
namespace NKikimr {
namespace NFlatTxCoordinator {
diff --git a/ydb/core/tx/coordinator/coordinator__check.h b/ydb/core/tx/coordinator/coordinator__check.h
index ec7cd3a4e13..8277b0200be 100644
--- a/ydb/core/tx/coordinator/coordinator__check.h
+++ b/ydb/core/tx/coordinator/coordinator__check.h
@@ -1,7 +1,7 @@
#pragma once
-#include "coordinator_impl.h"
-
+#include "coordinator_impl.h"
+
#include <util/generic/hash_set.h>
namespace NKikimr {
@@ -37,7 +37,7 @@ struct TTxCoordinator::TTxConsistencyCheck : public TTransactionBase<TTxCoordina
if (!rowset.IsReady())
return false;
while (!rowset.EndOfSet()) {
- TTabletId medId = rowset.GetValue<Schema::AffectedSet::MediatorID>();
+ TTabletId medId = rowset.GetValue<Schema::AffectedSet::MediatorID>();
TTxId txId = rowset.GetValue<Schema::AffectedSet::TransactionID>();
auto itTransaction = transactions.find(txId);
Y_ENSURE(itTransaction != transactions.end(), "Could not find mediator's transaction");
diff --git a/ydb/core/tx/coordinator/coordinator__configure.cpp b/ydb/core/tx/coordinator/coordinator__configure.cpp
index 021fdb656a3..338432dbc35 100644
--- a/ydb/core/tx/coordinator/coordinator__configure.cpp
+++ b/ydb/core/tx/coordinator/coordinator__configure.cpp
@@ -1,61 +1,61 @@
-#include "coordinator_impl.h"
-
-namespace NKikimr {
-namespace NFlatTxCoordinator {
-
-struct TTxCoordinator::TTxConfigure : public TTransactionBase<TTxCoordinator> {
+#include "coordinator_impl.h"
+
+namespace NKikimr {
+namespace NFlatTxCoordinator {
+
+struct TTxCoordinator::TTxConfigure : public TTransactionBase<TTxCoordinator> {
TActorId AckTo;
- ui64 Version;
- ui64 Resolution;
+ ui64 Version;
+ ui64 Resolution;
TVector<TTabletId> Mediators;
NKikimrSubDomains::TProcessingParams Config;
- TAutoPtr<TEvSubDomain::TEvConfigureStatus> Respond;
- bool ConfigurationApplied;
-
+ TAutoPtr<TEvSubDomain::TEvConfigureStatus> Respond;
+ bool ConfigurationApplied;
+
TTxConfigure(TSelf *coordinator, TActorId ackTo,
ui64 version, ui64 resolution, const TVector<TTabletId>& mediators,
const NKikimrSubDomains::TProcessingParams& config)
- : TBase(coordinator)
- , AckTo(ackTo)
- , Version(version)
- , Resolution(resolution)
- , Mediators(mediators)
+ : TBase(coordinator)
+ , AckTo(ackTo)
+ , Version(version)
+ , Resolution(resolution)
+ , Mediators(mediators)
, Config(config)
- , ConfigurationApplied(false)
-
- {}
-
- TTxType GetTxType() const override { return TXTYPE_INIT; }
-
- bool Execute(TTransactionContext &txc, const TActorContext&) override {
- NIceDb::TNiceDb db(txc.DB);
-
- auto rowset = db.Table<Schema::DomainConfiguration>().Range().Select();
-
- if (!rowset.IsReady())
- return false;
-
- ui64 curVersion = 0;
+ , ConfigurationApplied(false)
+
+ {}
+
+ TTxType GetTxType() const override { return TXTYPE_INIT; }
+
+ bool Execute(TTransactionContext &txc, const TActorContext&) override {
+ NIceDb::TNiceDb db(txc.DB);
+
+ auto rowset = db.Table<Schema::DomainConfiguration>().Range().Select();
+
+ if (!rowset.IsReady())
+ return false;
+
+ ui64 curVersion = 0;
TVector<TTabletId> curMediators;
- ui64 curResolution = 0;
+ ui64 curResolution = 0;
bool curHaveConfig = false;
-
- while (!rowset.EndOfSet()) {
- const ui64 ver = rowset.GetValue<Schema::DomainConfiguration::Version>();
+
+ while (!rowset.EndOfSet()) {
+ const ui64 ver = rowset.GetValue<Schema::DomainConfiguration::Version>();
TVector<TTabletId> mediators = rowset.GetValue<Schema::DomainConfiguration::Mediators>();
- ui64 resolution = rowset.GetValue<Schema::DomainConfiguration::Resolution>();
-
- if (ver >= curVersion) {
- curVersion = ver;
- curMediators.swap(mediators);
- curResolution = resolution;
+ ui64 resolution = rowset.GetValue<Schema::DomainConfiguration::Resolution>();
+
+ if (ver >= curVersion) {
+ curVersion = ver;
+ curMediators.swap(mediators);
+ curResolution = resolution;
curHaveConfig = rowset.HaveValue<Schema::DomainConfiguration::Config>();
- }
-
- if (!rowset.Next())
- return false;
- }
-
+ }
+
+ if (!rowset.Next())
+ return false;
+ }
+
auto persistConfig = [&]() {
TString encodedConfig;
Y_PROTOBUF_SUPPRESS_NODISCARD Config.SerializeToString(&encodedConfig);
@@ -73,14 +73,14 @@ struct TTxCoordinator::TTxConfigure : public TTransactionBase<TTxCoordinator> {
}
};
- if (curVersion == 0) {
+ if (curVersion == 0) {
// First config version
- Respond = new TEvSubDomain::TEvConfigureStatus(NKikimrTx::TEvSubDomainConfigurationAck::SUCCESS, Self->TabletID());
+ Respond = new TEvSubDomain::TEvConfigureStatus(NKikimrTx::TEvSubDomainConfigurationAck::SUCCESS, Self->TabletID());
persistConfig();
- ConfigurationApplied = true;
+ ConfigurationApplied = true;
} else if (curVersion == Version && curMediators == Mediators && curResolution == Resolution) {
// Same config version without mediator/resolution changes
- Respond = new TEvSubDomain::TEvConfigureStatus(NKikimrTx::TEvSubDomainConfigurationAck::ALREADY, Self->TabletID());
+ Respond = new TEvSubDomain::TEvConfigureStatus(NKikimrTx::TEvSubDomainConfigurationAck::ALREADY, Self->TabletID());
if (!curHaveConfig) {
persistConfig();
updateCurrentConfig();
@@ -90,33 +90,33 @@ struct TTxCoordinator::TTxConfigure : public TTransactionBase<TTxCoordinator> {
Respond = new TEvSubDomain::TEvConfigureStatus(NKikimrTx::TEvSubDomainConfigurationAck::SUCCESS, Self->TabletID());
persistConfig();
updateCurrentConfig();
- } else {
+ } else {
// Outdated config version, or attempt to change mediators/resolution
- Respond = new TEvSubDomain::TEvConfigureStatus(NKikimrTx::TEvSubDomainConfigurationAck::REJECT, Self->TabletID());
- }
-
- return true;
- }
-
- void Complete(const TActorContext &ctx) override {
- LOG_INFO_S(ctx, NKikimrServices::TX_COORDINATOR,
- "tablet# " << Self->TabletID() <<
- " version# " << Version <<
- " TTxConfigure Complete");
- if (ConfigurationApplied)
- Self->Execute(Self->CreateTxInit(), ctx);
-
+ Respond = new TEvSubDomain::TEvConfigureStatus(NKikimrTx::TEvSubDomainConfigurationAck::REJECT, Self->TabletID());
+ }
+
+ return true;
+ }
+
+ void Complete(const TActorContext &ctx) override {
+ LOG_INFO_S(ctx, NKikimrServices::TX_COORDINATOR,
+ "tablet# " << Self->TabletID() <<
+ " version# " << Version <<
+ " TTxConfigure Complete");
+ if (ConfigurationApplied)
+ Self->Execute(Self->CreateTxInit(), ctx);
+
if (AckTo && Respond)
ctx.Send(AckTo, Respond.Release());
- }
-};
-
+ }
+};
+
ITransaction* TTxCoordinator::CreateTxConfigure(
TActorId ackTo, ui64 version, ui64 resolution, const TVector<TTabletId> &mediators,
const NKikimrSubDomains::TProcessingParams &config)
{
return new TTxCoordinator::TTxConfigure(this, ackTo, version, resolution, mediators, config);
-}
-
-}
-}
+}
+
+}
+}
diff --git a/ydb/core/tx/coordinator/coordinator__init.cpp b/ydb/core/tx/coordinator/coordinator__init.cpp
index 5e63e205636..beb9975b42c 100644
--- a/ydb/core/tx/coordinator/coordinator__init.cpp
+++ b/ydb/core/tx/coordinator/coordinator__init.cpp
@@ -1,28 +1,28 @@
-#include "coordinator_impl.h"
-
+#include "coordinator_impl.h"
+
#include <ydb/core/base/appdata.h>
#include <ydb/core/util/pb.h>
-
-namespace NKikimr {
-namespace NFlatTxCoordinator {
-
-struct TTxCoordinator::TTxInit : public TTransactionBase<TTxCoordinator> {
+
+namespace NKikimr {
+namespace NFlatTxCoordinator {
+
+struct TTxCoordinator::TTxInit : public TTransactionBase<TTxCoordinator> {
ui64 Version = 0;
TVector<TTabletId> Mediators;
TVector<TTabletId> Coordinators;
- ui64 PlanResolution;
+ ui64 PlanResolution;
ui64 LastPlanned = 0;
ui64 LastAcquired = 0;
-
- TTxInit(TSelf *coordinator)
- : TBase(coordinator)
- {}
-
- TTxType GetTxType() const override { return TXTYPE_INIT; }
-
- bool Execute(TTransactionContext &txc, const TActorContext&) override {
- NIceDb::TNiceDb db(txc.DB);
-
+
+ TTxInit(TSelf *coordinator)
+ : TBase(coordinator)
+ {}
+
+ TTxType GetTxType() const override { return TXTYPE_INIT; }
+
+ bool Execute(TTransactionContext &txc, const TActorContext&) override {
+ NIceDb::TNiceDb db(txc.DB);
+
bool ready = true;
ready &= LoadDomainConfiguration(db);
ready &= LoadLastPlanned(db);
@@ -32,36 +32,36 @@ struct TTxCoordinator::TTxInit : public TTransactionBase<TTxCoordinator> {
}
bool LoadDomainConfiguration(NIceDb::TNiceDb &db) {
- auto rowset = db.Table<Schema::DomainConfiguration>().Range().Select();
-
- if (!rowset.IsReady())
- return false;
-
- while (!rowset.EndOfSet()) {
- const ui64 ver = rowset.GetValue<Schema::DomainConfiguration::Version>();
+ auto rowset = db.Table<Schema::DomainConfiguration>().Range().Select();
+
+ if (!rowset.IsReady())
+ return false;
+
+ while (!rowset.EndOfSet()) {
+ const ui64 ver = rowset.GetValue<Schema::DomainConfiguration::Version>();
TVector<TTabletId> mediators = rowset.GetValue<Schema::DomainConfiguration::Mediators>();
- ui64 resolution = rowset.GetValue<Schema::DomainConfiguration::Resolution>();
-
- if (ver >= Version) {
- Version = ver;
- Mediators.swap(mediators);
+ ui64 resolution = rowset.GetValue<Schema::DomainConfiguration::Resolution>();
+
+ if (ver >= Version) {
+ Version = ver;
+ Mediators.swap(mediators);
Coordinators.clear();
- PlanResolution = resolution;
+ PlanResolution = resolution;
if (rowset.HaveValue<Schema::DomainConfiguration::Config>()) {
TProtoBox<NKikimrSubDomains::TProcessingParams> config(rowset.GetValue<Schema::DomainConfiguration::Config>());
for (ui64 coordinator : config.GetCoordinators()) {
Coordinators.push_back(coordinator);
}
}
- }
-
- if (!rowset.Next())
- return false;
- }
-
- return true;
- }
-
+ }
+
+ if (!rowset.Next())
+ return false;
+ }
+
+ return true;
+ }
+
bool LoadLastPlanned(NIceDb::TNiceDb &db) {
auto rowset = db.Table<Schema::State>().Key(Schema::State::KeyLastPlanned).Select<Schema::State::StateValue>();
@@ -86,58 +86,58 @@ struct TTxCoordinator::TTxInit : public TTransactionBase<TTxCoordinator> {
return true;
}
- bool IsTabletInStaticDomain(const TAppData *appdata) {
- const ui32 selfDomain = appdata->DomainsInfo->GetDomainUidByTabletId(Self->TabletID());
- Y_VERIFY(selfDomain != appdata->DomainsInfo->BadDomainId);
- const auto& domain = appdata->DomainsInfo->GetDomain(selfDomain);
-
- for (auto domainCoordinatorId: domain.Coordinators) {
- if (Self->TabletID() == domainCoordinatorId) {
- return true;
- }
- }
-
- return false;
- }
-
- void Complete(const TActorContext &ctx) override {
+ bool IsTabletInStaticDomain(const TAppData *appdata) {
+ const ui32 selfDomain = appdata->DomainsInfo->GetDomainUidByTabletId(Self->TabletID());
+ Y_VERIFY(selfDomain != appdata->DomainsInfo->BadDomainId);
+ const auto& domain = appdata->DomainsInfo->GetDomain(selfDomain);
+
+ for (auto domainCoordinatorId: domain.Coordinators) {
+ if (Self->TabletID() == domainCoordinatorId) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ void Complete(const TActorContext &ctx) override {
Self->VolatileState.LastPlanned = LastPlanned;
Self->VolatileState.LastSentStep = LastPlanned;
Self->VolatileState.LastAcquired = LastAcquired;
- if (Mediators.size()) {
- LOG_INFO_S(ctx, NKikimrServices::TX_COORDINATOR,
- "tablet# " << Self->TabletID() <<
- " CreateTxInit Complete");
- Self->Config.MediatorsVersion = Version;
- Self->Config.Mediators = new TMediators(std::move(Mediators));
+ if (Mediators.size()) {
+ LOG_INFO_S(ctx, NKikimrServices::TX_COORDINATOR,
+ "tablet# " << Self->TabletID() <<
+ " CreateTxInit Complete");
+ Self->Config.MediatorsVersion = Version;
+ Self->Config.Mediators = new TMediators(std::move(Mediators));
Self->Config.Coordinators = Coordinators;
- Self->Config.Resolution = PlanResolution;
- Self->Execute(Self->CreateTxRestoreTransactions(), ctx);
- return;
- }
-
- TAppData* appData = AppData(ctx);
- if (IsTabletInStaticDomain(appData)) {
- LOG_INFO_S(ctx, NKikimrServices::TX_COORDINATOR,
- "tablet# " << Self->TabletID() <<
- " CreateTxInit initialize himself");
- Self->DoConfiguration(*CreateDomainConfigurationFromStatic(appData, Self->TabletID()), ctx);
- return;
- }
-
- Self->Become(&TThis::StateSync);
- Self->SignalTabletActive(ctx);
-
- LOG_INFO_S(ctx, NKikimrServices::TX_COORDINATOR,
- "tablet# " << Self->TabletID() <<
- " CreateTxInit wait TEvCoordinatorConfiguration for switching to StateWork from external");
- }
-};
-
+ Self->Config.Resolution = PlanResolution;
+ Self->Execute(Self->CreateTxRestoreTransactions(), ctx);
+ return;
+ }
+
+ TAppData* appData = AppData(ctx);
+ if (IsTabletInStaticDomain(appData)) {
+ LOG_INFO_S(ctx, NKikimrServices::TX_COORDINATOR,
+ "tablet# " << Self->TabletID() <<
+ " CreateTxInit initialize himself");
+ Self->DoConfiguration(*CreateDomainConfigurationFromStatic(appData, Self->TabletID()), ctx);
+ return;
+ }
+
+ Self->Become(&TThis::StateSync);
+ Self->SignalTabletActive(ctx);
+
+ LOG_INFO_S(ctx, NKikimrServices::TX_COORDINATOR,
+ "tablet# " << Self->TabletID() <<
+ " CreateTxInit wait TEvCoordinatorConfiguration for switching to StateWork from external");
+ }
+};
+
ITransaction* TTxCoordinator::CreateTxInit() {
- return new TTxCoordinator::TTxInit(this);
-}
-
-}
-}
+ return new TTxCoordinator::TTxInit(this);
+}
+
+}
+}
diff --git a/ydb/core/tx/coordinator/coordinator__mediators_confirmations.cpp b/ydb/core/tx/coordinator/coordinator__mediators_confirmations.cpp
index 5f731dcf6d5..28a644503d9 100644
--- a/ydb/core/tx/coordinator/coordinator__mediators_confirmations.cpp
+++ b/ydb/core/tx/coordinator/coordinator__mediators_confirmations.cpp
@@ -1,9 +1,9 @@
-#include "coordinator_impl.h"
-
+#include "coordinator_impl.h"
+
#include <ydb/core/tablet_flat/flat_cxx_database.h>
-#include <util/generic/hash_set.h>
-
+#include <util/generic/hash_set.h>
+
namespace NKikimr {
namespace NFlatTxCoordinator {
@@ -20,7 +20,7 @@ struct TTxCoordinator::TTxMediatorConfirmations : public TTransactionBase<TTxCoo
TTxType GetTxType() const override { return TXTYPE_MEDIATOR_CONFIRMATIONS; }
bool Execute(TTransactionContext &txc, const TActorContext &ctx) override {
- const TTabletId mediatorId = Confirmations->MediatorId;
+ const TTabletId mediatorId = Confirmations->MediatorId;
Y_UNUSED(ctx);
CompleteTransactions = 0;
NIceDb::TNiceDb db(txc.DB);
@@ -33,7 +33,7 @@ struct TTxCoordinator::TTxMediatorConfirmations : public TTransactionBase<TTxCoo
auto txit = Self->Transactions.find(txid);
if (txit == Self->Transactions.end()) {
FLOG_DEBUG_S(ctx, NKikimrServices::TX_COORDINATOR,
- "at tablet# " << Self->TabletID()
+ "at tablet# " << Self->TabletID()
<< " gen:step " << internalTxGen << ":" << internalTxStep
<< " Mediator " << mediatorId << " confirmed finish of transaction " << txid << " but transaction wasn't found");
for (const TTabletId affected : txidsx.second) {
@@ -47,14 +47,14 @@ struct TTxCoordinator::TTxMediatorConfirmations : public TTransactionBase<TTxCoo
THashSet<TTabletId>::size_type result = mediatorAffectedSet.erase(affected);
db.Table<Schema::AffectedSet>().Key(mediatorId, txid, affected).Delete();
FLOG_DEBUG_S(ctx, NKikimrServices::TX_COORDINATOR,
- "at tablet# " << Self->TabletID()
+ "at tablet# " << Self->TabletID()
<< " gen:step " << internalTxGen << ":" << internalTxStep
<< " Confirmed transaction " << txid << " for mediator " << mediatorId << " tablet " << affected << " result=" << result);
}
if (mediatorAffectedSet.empty()) {
FLOG_DEBUG_S(ctx, NKikimrServices::TX_COORDINATOR,
- "at tablet# " << Self->TabletID()
+ "at tablet# " << Self->TabletID()
<< " gen:step " << internalTxGen << ":" << internalTxStep
<< " Mediator " << mediatorId << " confirmed finish of transaction " << txid);
txit->second.UnconfirmedAffectedSet.erase(mediatorId);
@@ -62,7 +62,7 @@ struct TTxCoordinator::TTxMediatorConfirmations : public TTransactionBase<TTxCoo
if (txit->second.UnconfirmedAffectedSet.empty()) { // transaction finished
FLOG_DEBUG_S(ctx, NKikimrServices::TX_COORDINATOR,
- "at tablet# " << Self->TabletID()
+ "at tablet# " << Self->TabletID()
<< " gen:step " << internalTxGen << ":" << internalTxStep
<< " Transaction " << txid << " has been completed");
db.Table<Schema::Transaction>().Key(txid).Delete();
diff --git a/ydb/core/tx/coordinator/coordinator__monitoring.cpp b/ydb/core/tx/coordinator/coordinator__monitoring.cpp
index 9deb5b4f88c..550c8ef2815 100644
--- a/ydb/core/tx/coordinator/coordinator__monitoring.cpp
+++ b/ydb/core/tx/coordinator/coordinator__monitoring.cpp
@@ -1,5 +1,5 @@
-#include "coordinator_impl.h"
-#include "coordinator__check.h"
+#include "coordinator_impl.h"
+#include "coordinator__check.h"
namespace NKikimr {
namespace NFlatTxCoordinator {
diff --git a/ydb/core/tx/coordinator/coordinator__plan_step.cpp b/ydb/core/tx/coordinator/coordinator__plan_step.cpp
index e08bcbdc37f..c1fac2ffa58 100644
--- a/ydb/core/tx/coordinator/coordinator__plan_step.cpp
+++ b/ydb/core/tx/coordinator/coordinator__plan_step.cpp
@@ -1,22 +1,22 @@
-#include "coordinator_impl.h"
-
+#include "coordinator_impl.h"
+
#include <util/generic/hash_set.h>
namespace NKikimr {
namespace NFlatTxCoordinator {
-struct TInFlyAccountant {
- NMonitoring::TDynamicCounters::TCounterPtr Counter;
- TInFlyAccountant(NMonitoring::TDynamicCounters::TCounterPtr counter)
- : Counter(counter)
- {
- Counter->Inc();
- }
- ~TInFlyAccountant() {
- Counter->Dec();
- }
-};
-
+struct TInFlyAccountant {
+ NMonitoring::TDynamicCounters::TCounterPtr Counter;
+ TInFlyAccountant(NMonitoring::TDynamicCounters::TCounterPtr counter)
+ : Counter(counter)
+ {
+ Counter->Inc();
+ }
+ ~TInFlyAccountant() {
+ Counter->Dec();
+ }
+};
+
struct TTxCoordinator::TTxPlanStep : public TTransactionBase<TTxCoordinator> {
const ui64 PlanOnStep;
const bool Rapid;
@@ -28,7 +28,7 @@ struct TTxCoordinator::TTxPlanStep : public TTransactionBase<TTxCoordinator> {
TInstant ExecStartMoment;
ui64 PlannedCounter;
ui64 DeclinedCounter;
- TInFlyAccountant InFlyAccountant;
+ TInFlyAccountant InFlyAccountant;
TTxPlanStep(ui64 toPlan, TVector<TQueueType::TSlot> &slots, TSelf *coordinator, bool rapid)
: TBase(coordinator)
@@ -36,7 +36,7 @@ struct TTxCoordinator::TTxPlanStep : public TTransactionBase<TTxCoordinator> {
, Rapid(rapid)
, PlannedCounter(0)
, DeclinedCounter(0)
- , InFlyAccountant(Self->MonCounters.StepsInFly)
+ , InFlyAccountant(Self->MonCounters.StepsInFly)
{
Slots.swap(slots);
}
@@ -52,11 +52,11 @@ struct TTxCoordinator::TTxPlanStep : public TTransactionBase<TTxCoordinator> {
THashMap<TTabletId, TVector<TTabletId>> byMediatorAffected;
// first fill every mediator with something (every mediator must receive step)
- const ui32 mediatorsSize = Self->Config.Mediators->List().size();
+ const ui32 mediatorsSize = Self->Config.Mediators->List().size();
mediatorSteps.reserve(mediatorsSize);
- for (TTabletId mediatorId : Self->Config.Mediators->List()) {
+ for (TTabletId mediatorId : Self->Config.Mediators->List()) {
mediatorSteps.push_back(new TMediatorStep(mediatorId, PlanOnStep));
- }
+ }
// create mediator steps
ProxyPlanConfirmations.Reset(new TCoordinatorStepConfirmations(PlanOnStep));
@@ -64,9 +64,9 @@ struct TTxCoordinator::TTxPlanStep : public TTransactionBase<TTxCoordinator> {
TQueueType::TQ &queue = *slot.Queue;
TQueueType::TQ::TReadIterator iterator = queue.Iterator();
while (TTransactionProposal *proposal = iterator.Next()) {
- for (auto &x : byMediatorAffected) {
- x.second.clear();
- }
+ for (auto &x : byMediatorAffected) {
+ x.second.clear();
+ }
const TTxId txId = proposal->TxId;
Y_VERIFY(txId);
@@ -134,12 +134,12 @@ struct TTxCoordinator::TTxPlanStep : public TTransactionBase<TTxCoordinator> {
Y_VERIFY(!proposal->AffectedSet.empty());
for (const auto &txprop : proposal->AffectedSet) {
const TTabletId affectedTablet = txprop.TabletId;
- const TTabletId mediatorId = Self->Config.Mediators->Select(affectedTablet);
+ const TTabletId mediatorId = Self->Config.Mediators->Select(affectedTablet);
transaction.AffectedSet.insert(affectedTablet);
- transaction.UnconfirmedAffectedSet[mediatorId].insert(affectedTablet);
+ transaction.UnconfirmedAffectedSet[mediatorId].insert(affectedTablet);
- byMediatorAffected[mediatorId].push_back(affectedTablet);
+ byMediatorAffected[mediatorId].push_back(affectedTablet);
}
TVector<TTabletId> affectedSet(transaction.AffectedSet.begin(), transaction.AffectedSet.end());
@@ -152,7 +152,7 @@ struct TTxCoordinator::TTxPlanStep : public TTransactionBase<TTxCoordinator> {
}
for (ui32 idx = 0; idx < mediatorsSize; ++idx) {
- TTabletId mediatorId = mediatorSteps[idx]->MediatorId;
+ TTabletId mediatorId = mediatorSteps[idx]->MediatorId;
TVector<TTabletId> &affected = byMediatorAffected[mediatorId];
if (!affected.empty()) {
mediatorSteps[idx]->Transactions.push_back(TMediatorStep::TTx(txId, &affected.front(), affected.size(), 0));
@@ -186,8 +186,8 @@ struct TTxCoordinator::TTxPlanStep : public TTransactionBase<TTxCoordinator> {
if (mediator.PushUpdates) {
StepsToConfirm[mediatorId] = std::pair<ui64, bool *>(mediator.GenCookie, &mp->Confirmed);
mediator.Queue->Push(mp.Release());
- } else if (!StepsToConfirm.empty()) {
- FLOG_DEBUG_S(ctx, NKikimrServices::TX_COORDINATOR, "PushUpdates false for mediator " << mediatorId << " step " << PlanOnStep);
+ } else if (!StepsToConfirm.empty()) {
+ FLOG_DEBUG_S(ctx, NKikimrServices::TX_COORDINATOR, "PushUpdates false for mediator " << mediatorId << " step " << PlanOnStep);
}
}
db.Table<Schema::State>().Key(Schema::State::KeyLastPlanned).Update(NIceDb::TUpdate<Schema::State::StateValue>(PlanOnStep));
diff --git a/ydb/core/tx/coordinator/coordinator__restart_mediator.cpp b/ydb/core/tx/coordinator/coordinator__restart_mediator.cpp
index 6b68e41f350..673115d22b0 100644
--- a/ydb/core/tx/coordinator/coordinator__restart_mediator.cpp
+++ b/ydb/core/tx/coordinator/coordinator__restart_mediator.cpp
@@ -1,10 +1,10 @@
-#include "coordinator_impl.h"
+#include "coordinator_impl.h"
namespace NKikimr {
namespace NFlatTxCoordinator {
struct TTxCoordinator::TTxRestartMediatorQueue : public TTransactionBase<TTxCoordinator> {
- const TTabletId MediatorId;
+ const TTabletId MediatorId;
const ui64 GenCookie;
TVector<bool *> StepsToConfirm;
diff --git a/ydb/core/tx/coordinator/coordinator__restore_transaction.cpp b/ydb/core/tx/coordinator/coordinator__restore_transaction.cpp
index 3afb8509a5d..26a916bdff9 100644
--- a/ydb/core/tx/coordinator/coordinator__restore_transaction.cpp
+++ b/ydb/core/tx/coordinator/coordinator__restore_transaction.cpp
@@ -1,5 +1,5 @@
-#include "coordinator_impl.h"
-
+#include "coordinator_impl.h"
+
#include <ydb/core/base/appdata.h>
#include <ydb/core/tablet/tablet_exception.h>
@@ -8,8 +8,8 @@
namespace NKikimr {
namespace NFlatTxCoordinator {
-struct TTxCoordinator::TTxRestoreTransactions : public TTransactionBase<TTxCoordinator> {
- TTxRestoreTransactions(TSelf *coordinator)
+struct TTxCoordinator::TTxRestoreTransactions : public TTransactionBase<TTxCoordinator> {
+ TTxRestoreTransactions(TSelf *coordinator)
: TBase(coordinator)
{}
@@ -43,7 +43,7 @@ struct TTxCoordinator::TTxRestoreTransactions : public TTransactionBase<TTxCoord
while (!rowset.EndOfSet()) {
const TTxId txId = rowset.GetValue<Schema::AffectedSet::TransactionID>();
- const TTabletId medId = rowset.GetValue<Schema::AffectedSet::MediatorID>();
+ const TTabletId medId = rowset.GetValue<Schema::AffectedSet::MediatorID>();
const ui64 affectedShardId = rowset.GetValue<Schema::AffectedSet::DataShardID>();
auto itTransaction = transactions.find(txId);
@@ -90,20 +90,20 @@ struct TTxCoordinator::TTxRestoreTransactions : public TTransactionBase<TTxCoord
void Complete(const TActorContext &ctx) override {
// start mediator queues
- for (ui64 mediatorId: Self->Config.Mediators->List()) {
+ for (ui64 mediatorId: Self->Config.Mediators->List()) {
TMediator &mediator = Self->Mediator(mediatorId, ctx);
Y_UNUSED(mediator);
}
// start plan process.
Self->Become(&TSelf::StateWork);
- Self->SignalTabletActive(ctx);
+ Self->SignalTabletActive(ctx);
Self->SchedulePlanTick(ctx);
}
};
ITransaction* TTxCoordinator::CreateTxRestoreTransactions() {
- return new TTxRestoreTransactions(this);
+ return new TTxRestoreTransactions(this);
}
}
diff --git a/ydb/core/tx/coordinator/coordinator__schema.cpp b/ydb/core/tx/coordinator/coordinator__schema.cpp
index 9f629822875..1fb202a2581 100644
--- a/ydb/core/tx/coordinator/coordinator__schema.cpp
+++ b/ydb/core/tx/coordinator/coordinator__schema.cpp
@@ -1,4 +1,4 @@
-#include "coordinator_impl.h"
+#include "coordinator_impl.h"
namespace NKikimr {
namespace NFlatTxCoordinator {
diff --git a/ydb/core/tx/coordinator/coordinator__schema_upgrade.cpp b/ydb/core/tx/coordinator/coordinator__schema_upgrade.cpp
index 63b3a2e0811..931a7c993e5 100644
--- a/ydb/core/tx/coordinator/coordinator__schema_upgrade.cpp
+++ b/ydb/core/tx/coordinator/coordinator__schema_upgrade.cpp
@@ -1,56 +1,56 @@
-#include "coordinator_impl.h"
-
+#include "coordinator_impl.h"
+
#include <ydb/core/tablet/tablet_exception.h>
namespace NKikimr {
namespace NFlatTxCoordinator {
struct TTxCoordinator::TTxUpgrade : public TTransactionBase<TTxCoordinator> {
- bool UpgradeFail;
-
+ bool UpgradeFail;
+
TTxUpgrade(TSelf *coordinator)
: TBase(coordinator)
- , UpgradeFail(false)
+ , UpgradeFail(false)
{}
TTxType GetTxType() const override { return TXTYPE_INIT; }
- bool Execute(TTransactionContext &txc, const TActorContext& ctx) override {
+ bool Execute(TTransactionContext &txc, const TActorContext& ctx) override {
NIceDb::TNiceDb db(txc.DB);
-
-
+
+
auto row = db.Table<Schema::State>().Key(Schema::State::DatabaseVersion).Select<Schema::State::StateValue>();
- if (!row.IsReady()) {
+ if (!row.IsReady()) {
return false;
- }
-
+ }
+
if (!row.IsValid()) {
- db.Table<Schema::State>().Key(Schema::State::DatabaseVersion).Update(NIceDb::TUpdate<Schema::State::StateValue>(Schema::CurrentVersion));
- return true;
- }
-
- Schema::State::StateValue::Type databaseVersion = row.GetValue<Schema::State::StateValue>();
- if (Schema::CurrentVersion == databaseVersion) {
- return true;
- }
-
- UpgradeFail = true;
- FLOG_LOG_S(ctx, NActors::NLog::PRI_CRIT, NKikimrServices::TX_COORDINATOR,
- "tablet# " << Self->Tablet() <<
- " SEND to self TEvents::TEvPoisonPill" <<
- " databaseVersion# " << databaseVersion <<
- " CurrentDataBaseVersion# " << Schema::CurrentVersion <<
- " reason# no realisation for upgrade scheme present");
+ db.Table<Schema::State>().Key(Schema::State::DatabaseVersion).Update(NIceDb::TUpdate<Schema::State::StateValue>(Schema::CurrentVersion));
+ return true;
+ }
+
+ Schema::State::StateValue::Type databaseVersion = row.GetValue<Schema::State::StateValue>();
+ if (Schema::CurrentVersion == databaseVersion) {
+ return true;
+ }
+
+ UpgradeFail = true;
+ FLOG_LOG_S(ctx, NActors::NLog::PRI_CRIT, NKikimrServices::TX_COORDINATOR,
+ "tablet# " << Self->Tablet() <<
+ " SEND to self TEvents::TEvPoisonPill" <<
+ " databaseVersion# " << databaseVersion <<
+ " CurrentDataBaseVersion# " << Schema::CurrentVersion <<
+ " reason# no realisation for upgrade scheme present");
return true;
}
void Complete(const TActorContext &ctx) override {
- if (UpgradeFail) {
- Self->Become(&TSelf::StateBroken);
- ctx.Send(Self->Tablet(), new TEvents::TEvPoisonPill);
- return;
- }
-
+ if (UpgradeFail) {
+ Self->Become(&TSelf::StateBroken);
+ ctx.Send(Self->Tablet(), new TEvents::TEvPoisonPill);
+ return;
+ }
+
Self->Execute(Self->CreateTxInit(), ctx);
}
};
diff --git a/ydb/core/tx/coordinator/coordinator_impl.cpp b/ydb/core/tx/coordinator/coordinator_impl.cpp
index f945e18f3e6..b4eeb184e29 100644
--- a/ydb/core/tx/coordinator/coordinator_impl.cpp
+++ b/ydb/core/tx/coordinator/coordinator_impl.cpp
@@ -1,4 +1,4 @@
-#include "coordinator_impl.h"
+#include "coordinator_impl.h"
#include <ydb/core/engine/minikql/flat_local_tx_factory.h>
#include <ydb/core/tablet/tablet_counters_protobuf.h>
#include <ydb/core/tablet/tablet_counters_aggregator.h>
@@ -45,8 +45,8 @@ static TAutoPtr<TTransactionProposal> MakeTransactionProposal(TEvTxProxy::TEvPro
return proposal;
}
-const ui32 TTxCoordinator::Schema::CurrentVersion = 1;
-
+const ui32 TTxCoordinator::Schema::CurrentVersion = 1;
+
TTxCoordinator::TTxCoordinator(TTabletStorageInfo *info, const TActorId &tablet)
: TActor(&TThis::StateInit)
, TTabletExecutedFlat(info, tablet, new NMiniKQL::TMiniKQLFactory)
@@ -79,13 +79,13 @@ void TTxCoordinator::PlanTx(TAutoPtr<TTransactionProposal> &proposal, const TAct
proposal->AcceptMoment = ctx.Now();
MonCounters.PlanTxCalls->Inc();
- if (proposal->MaxStep <= VolatileState.LastPlanned) {
- MonCounters.PlanTxOutdated->Inc();
- return SendTransactionStatus(proposal->Proxy
- , TEvTxProxy::TEvProposeTransactionStatus::EStatus::StatusOutdated
- , proposal->TxId, 0, ctx, TabletID());
- }
-
+ if (proposal->MaxStep <= VolatileState.LastPlanned) {
+ MonCounters.PlanTxOutdated->Inc();
+ return SendTransactionStatus(proposal->Proxy
+ , TEvTxProxy::TEvProposeTransactionStatus::EStatus::StatusOutdated
+ , proposal->TxId, 0, ctx, TabletID());
+ }
+
if (Stopping) {
return SendTransactionStatus(proposal->Proxy,
TEvTxProxy::TEvProposeTransactionStatus::EStatus::StatusRestarting,
@@ -117,7 +117,7 @@ void TTxCoordinator::PlanTx(TAutoPtr<TTransactionProposal> &proposal, const TAct
MonCounters.PlanTxAccepted->Inc();
SendTransactionStatus(proposal->Proxy, TEvTxProxy::TEvProposeTransactionStatus::EStatus::StatusAccepted,
proposal->TxId, planStep, ctx, TabletID());
-
+
if (forRapidExecution) {
TQueueType::TSlot &rapidSlot = VolatileState.Queue.RapidSlot;
rapidSlot.Queue->Push(proposal.Release());
@@ -168,7 +168,7 @@ void TTxCoordinator::HandleEnqueue(TEvTxProxy::TEvProposeTransaction::TPtr &ev,
void TTxCoordinator::Handle(TEvPrivate::TEvPlanTick::TPtr &ev, const TActorContext &ctx) {
Y_UNUSED(ev);
- //LOG_DEBUG_S(ctx, NKikimrServices::TX_COORDINATOR, "tablet# " << TabletID() << " HANDLE EvPlanTick LastPlanned " << VolatileState.LastPlanned);
+ //LOG_DEBUG_S(ctx, NKikimrServices::TX_COORDINATOR, "tablet# " << TabletID() << " HANDLE EvPlanTick LastPlanned " << VolatileState.LastPlanned);
if (VolatileState.Queue.Unsorted) {
while (TAutoPtr<TTransactionProposal> x = VolatileState.Queue.Unsorted->Pop())
@@ -184,11 +184,11 @@ void TTxCoordinator::Handle(TEvPrivate::TEvPlanTick::TPtr &ev, const TActorConte
if (next <= VolatileState.LastPlanned) {
return SchedulePlanTick(ctx);
- }
+ }
TVector<TQueueType::TSlot> slots;
slots.reserve(1000);
-
+
if (VolatileState.Queue.RapidSlot.QueueSize) {
slots.push_back(VolatileState.Queue.RapidSlot);
VolatileState.Queue.RapidSlot = TQueueType::TSlot();
@@ -269,37 +269,37 @@ void TTxCoordinator::Handle(TEvTxCoordinator::TEvCoordinatorConfirmPlan::TPtr &e
}
void TTxCoordinator::DoConfiguration(const TEvSubDomain::TEvConfigure &ev, const TActorContext &ctx, const TActorId &ackTo) {
- const TEvSubDomain::TEvConfigure::ProtoRecordType &record = ev.Record;
-
- if(0 == record.MediatorsSize()) {
- LOG_ERROR_S(ctx, NKikimrServices::TX_COORDINATOR
- , "tablet# " << TabletID()
- << " HANDLE EvCoordinatorConfiguration Version# " << record.GetVersion()
- << " recive empty mediators set");
- Y_FAIL("empty mediators set");
- return;
- }
-
+ const TEvSubDomain::TEvConfigure::ProtoRecordType &record = ev.Record;
+
+ if(0 == record.MediatorsSize()) {
+ LOG_ERROR_S(ctx, NKikimrServices::TX_COORDINATOR
+ , "tablet# " << TabletID()
+ << " HANDLE EvCoordinatorConfiguration Version# " << record.GetVersion()
+ << " recive empty mediators set");
+ Y_FAIL("empty mediators set");
+ return;
+ }
+
TVector<TTabletId> mediators;
- mediators.reserve(record.MediatorsSize());
-
- for (auto id: record.GetMediators()) {
- Y_VERIFY(TabletID() != id, "found self id in mediators list");
- mediators.push_back(id);
- }
-
+ mediators.reserve(record.MediatorsSize());
+
+ for (auto id: record.GetMediators()) {
+ Y_VERIFY(TabletID() != id, "found self id in mediators list");
+ mediators.push_back(id);
+ }
+
Execute(CreateTxConfigure(ackTo, record.GetVersion(), record.GetPlanResolution(), mediators, record), ctx);
-}
-
-void TTxCoordinator::Handle(TEvSubDomain::TEvConfigure::TPtr &ev, const TActorContext &ctx) {
- const TEvSubDomain::TEvConfigure::ProtoRecordType &record = ev->Get()->Record;
- LOG_NOTICE_S(ctx, NKikimrServices::TX_COORDINATOR
- , "tablet# " << TabletID()
- << " HANDLE TEvConfigure Version# " << record.GetVersion());
-
- DoConfiguration(*ev->Get(), ctx, ev->Sender);
-}
-
+}
+
+void TTxCoordinator::Handle(TEvSubDomain::TEvConfigure::TPtr &ev, const TActorContext &ctx) {
+ const TEvSubDomain::TEvConfigure::ProtoRecordType &record = ev->Get()->Record;
+ LOG_NOTICE_S(ctx, NKikimrServices::TX_COORDINATOR
+ , "tablet# " << TabletID()
+ << " HANDLE TEvConfigure Version# " << record.GetVersion());
+
+ DoConfiguration(*ev->Get(), ctx, ev->Sender);
+}
+
void TTxCoordinator::Handle(TEvents::TEvPoisonPill::TPtr&, const TActorContext& ctx) {
Become(&TThis::StateBroken);
ctx.Send(Tablet(), new TEvents::TEvPoisonPill);
diff --git a/ydb/core/tx/coordinator/coordinator_impl.h b/ydb/core/tx/coordinator/coordinator_impl.h
index 64855a6b563..39018aff1e7 100644
--- a/ydb/core/tx/coordinator/coordinator_impl.h
+++ b/ydb/core/tx/coordinator/coordinator_impl.h
@@ -1,10 +1,10 @@
#pragma once
-
+
#include "defs.h"
-#include "coordinator.h"
-
+#include "coordinator.h"
+
#include <ydb/core/protos/counters_coordinator.pb.h>
-
+
#include <library/cpp/actors/helpers/mon_histogram_helper.h>
#include <ydb/core/base/tablet_pipe.h>
#include <ydb/core/base/tx_processing.h>
@@ -14,129 +14,129 @@
#include <ydb/core/scheme/scheme_types_defs.h>
#include <ydb/core/tx/tx.h>
#include <ydb/core/util/queue_oneone_inplace.h>
-
+
#include <library/cpp/actors/core/actor_bootstrapped.h>
#include <library/cpp/actors/core/hfunc.h>
-
-#include <util/generic/hash_set.h>
+
+#include <util/generic/hash_set.h>
#include <util/stream/file.h>
#include <util/stream/zlib.h>
-#include <algorithm>
-
+#include <algorithm>
+
namespace NKikimr {
namespace NFlatTxCoordinator {
-typedef ui64 TStepId;
-typedef ui64 TTabletId;
-typedef ui64 TTxId;
-
-struct TTransactionProposal {
+typedef ui64 TStepId;
+typedef ui64 TTabletId;
+typedef ui64 TTxId;
+
+struct TTransactionProposal {
TActorId Proxy;
-
- TTxId TxId; // could be zero, then transaction is not saved a-priori and must be idempotent, with body provided
- TStepId MinStep; // not plan before (tablet would be not ready), could be zero
- TStepId MaxStep; // not plan after (tablet would trash tx body).
-
- struct TAffectedEntry {
- enum {
- AffectedRead = 1 << 0,
- AffectedWrite = 1 << 1,
- };
-
- TTabletId TabletId;
- ui64 AffectedFlags : 8;
+
+ TTxId TxId; // could be zero, then transaction is not saved a-priori and must be idempotent, with body provided
+ TStepId MinStep; // not plan before (tablet would be not ready), could be zero
+ TStepId MaxStep; // not plan after (tablet would trash tx body).
+
+ struct TAffectedEntry {
+ enum {
+ AffectedRead = 1 << 0,
+ AffectedWrite = 1 << 1,
+ };
+
+ TTabletId TabletId;
+ ui64 AffectedFlags : 8;
// reserved
- };
-
+ };
+
TVector<TAffectedEntry> AffectedSet;
-
- TInstant AcceptMoment;
+
+ TInstant AcceptMoment;
bool IgnoreLowDiskSpace;
-
+
TTransactionProposal(const TActorId &proxy, TTxId txId, TStepId minStep, TStepId maxStep, bool ignoreLowDiskSpace)
- : Proxy(proxy)
- , TxId(txId)
- , MinStep(minStep)
- , MaxStep(maxStep)
+ : Proxy(proxy)
+ , TxId(txId)
+ , MinStep(minStep)
+ , MaxStep(maxStep)
, IgnoreLowDiskSpace(ignoreLowDiskSpace)
- {}
-};
-
-struct TCoordinatorStepConfirmations {
+ {}
+};
+
+struct TCoordinatorStepConfirmations {
struct TEntry {
- TTxId TxId;
+ TTxId TxId;
TActorId ProxyId;
- TEvTxProxy::TEvProposeTransactionStatus::EStatus Status;
- TStepId Step;
-
+ TEvTxProxy::TEvProposeTransactionStatus::EStatus Status;
+ TStepId Step;
+
TEntry(TTxId txid, const TActorId &proxyId, TEvTxProxy::TEvProposeTransactionStatus::EStatus status, TStepId step)
- : TxId(txid)
- , ProxyId(proxyId)
- , Status(status)
- , Step(step)
- {}
- };
-
- using TQ = TOneOneQueueInplace<TEntry *, 128>;
-
- const TAutoPtr<TQ, TQ::TPtrCleanDestructor> Queue;
- const TStepId Step;
-
- TCoordinatorStepConfirmations(TStepId step)
- : Queue(new TQ())
- , Step(step)
- {}
-};
-
-struct TMediatorStep {
- struct TTx {
- TTxId TxId;
-
- // todo: move to flat presentation (with buffer for all affected, instead of per-one)
+ : TxId(txid)
+ , ProxyId(proxyId)
+ , Status(status)
+ , Step(step)
+ {}
+ };
+
+ using TQ = TOneOneQueueInplace<TEntry *, 128>;
+
+ const TAutoPtr<TQ, TQ::TPtrCleanDestructor> Queue;
+ const TStepId Step;
+
+ TCoordinatorStepConfirmations(TStepId step)
+ : Queue(new TQ())
+ , Step(step)
+ {}
+};
+
+struct TMediatorStep {
+ struct TTx {
+ TTxId TxId;
+
+ // todo: move to flat presentation (with buffer for all affected, instead of per-one)
TVector<TTabletId> PushToAffected; // filtered one (only entries which belong to this mediator)
-
- ui64 Moderator;
-
+
+ ui64 Moderator;
+
TTx(TTxId txId, TTabletId *affected, ui32 affectedSize, ui64 moderator)
- : TxId(txId)
- , PushToAffected(affected, affected + affectedSize)
- , Moderator(moderator)
- {
- Y_VERIFY(TxId != 0);
- }
-
- TTx(TTxId txId)
- : TxId(txId)
- {
- Y_VERIFY(TxId != 0);
- }
- };
-
- const TTabletId MediatorId;
- const TStepId Step;
- bool Confirmed;
+ : TxId(txId)
+ , PushToAffected(affected, affected + affectedSize)
+ , Moderator(moderator)
+ {
+ Y_VERIFY(TxId != 0);
+ }
+
+ TTx(TTxId txId)
+ : TxId(txId)
+ {
+ Y_VERIFY(TxId != 0);
+ }
+ };
+
+ const TTabletId MediatorId;
+ const TStepId Step;
+ bool Confirmed;
TVector<TTx> Transactions;
-
- TMediatorStep(TTabletId mediatorId, TStepId step)
- : MediatorId(mediatorId)
- , Step(step)
- , Confirmed(false)
- {}
-};
-
-struct TMediatorConfirmations {
- const TTabletId MediatorId;
-
+
+ TMediatorStep(TTabletId mediatorId, TStepId step)
+ : MediatorId(mediatorId)
+ , Step(step)
+ , Confirmed(false)
+ {}
+};
+
+struct TMediatorConfirmations {
+ const TTabletId MediatorId;
+
THashMap<TTxId, THashSet<TTabletId>> Acks;
-
- TMediatorConfirmations(TTabletId mediatorId)
- : MediatorId(mediatorId)
- {}
-};
-
+
+ TMediatorConfirmations(TTabletId mediatorId)
+ : MediatorId(mediatorId)
+ {}
+};
+
IActor* CreateTxCoordinatorMediatorQueue(const TActorId &owner, ui64 coordinator, ui64 mediator, ui64 coordinatorGeneration);
-
+
using NTabletFlatExecutor::TTabletExecutedFlat;
using NTabletFlatExecutor::ITransaction;
using NTabletFlatExecutor::TTransactionBase;
@@ -228,8 +228,8 @@ class TTxCoordinator : public TActor<TTxCoordinator>, public TTabletExecutedFlat
};
struct TTxInit;
- struct TTxRestoreTransactions;
- struct TTxConfigure;
+ struct TTxRestoreTransactions;
+ struct TTxConfigure;
struct TTxSchema;
struct TTxUpgrade;
struct TTxPlanStep;
@@ -255,8 +255,8 @@ class TTxCoordinator : public TActor<TTxCoordinator>, public TTabletExecutedFlat
ITransaction* CreateTxStopGuard();
struct TConfig {
- ui64 MediatorsVersion;
- TMediators::TPtr Mediators;
+ ui64 MediatorsVersion;
+ TMediators::TPtr Mediators;
TVector<TTabletId> Coordinators;
ui64 PlanAhead;
@@ -266,8 +266,8 @@ class TTxCoordinator : public TActor<TTxCoordinator>, public TTabletExecutedFlat
bool Synthetic;
TConfig()
- : MediatorsVersion(0)
- , PlanAhead(0)
+ : MediatorsVersion(0)
+ , PlanAhead(0)
, Resolution(0)
, RapidSlotFlushSize(0)
, Synthetic(false)
@@ -328,8 +328,8 @@ class TTxCoordinator : public TActor<TTxCoordinator>, public TTabletExecutedFlat
public:
struct Schema : NIceDb::Schema {
- static const ui32 CurrentVersion;
-
+ static const ui32 CurrentVersion;
+
struct Transaction : Table<0> {
struct ID : Column<0, NScheme::NTypeIds::Uint64> {}; // PK
struct Plan : Column<1, NScheme::NTypeIds::Uint64> {};
@@ -362,17 +362,17 @@ public:
using TColumns = TableColumns<StateKey, StateValue>;
};
- struct DomainConfiguration : Table<5> {
- struct Version : Column<1, NScheme::NTypeIds::Uint64> {};
+ struct DomainConfiguration : Table<5> {
+ struct Version : Column<1, NScheme::NTypeIds::Uint64> {};
struct Mediators : Column<2, NScheme::NTypeIds::String> { using Type = TVector<TTabletId>; };
- struct Resolution : Column<3, NScheme::NTypeIds::Uint64> {};
+ struct Resolution : Column<3, NScheme::NTypeIds::Uint64> {};
struct Config : Column<4, NScheme::NTypeIds::String> {};
-
- using TKey = TableKey<Version>;
+
+ using TKey = TableKey<Version>;
using TColumns = TableColumns<Version, Mediators, Resolution, Config>;
- };
-
- using TTables = SchemaTables<Transaction, AffectedSet, State, DomainConfiguration>;
+ };
+
+ using TTables = SchemaTables<Transaction, AffectedSet, State, DomainConfiguration>;
};
private:
@@ -411,7 +411,7 @@ private:
TAutoPtr<TTabletCountersBase> TabletCountersPtr;
typedef THashMap<TTabletId, TMediator> TMediatorsIndex;
- TMediatorsIndex Mediators;
+ TMediatorsIndex Mediators;
typedef THashMap<TTxId, TTransaction> TTransactions;
TTransactions Transactions;
@@ -426,7 +426,7 @@ private:
#endif
void Die(const TActorContext &ctx) override {
- for (TMediatorsIndex::iterator it = Mediators.begin(), end = Mediators.end(); it != end; ++it) {
+ for (TMediatorsIndex::iterator it = Mediators.begin(), end = Mediators.end(); it != end; ++it) {
TMediator &x = it->second;
ctx.Send(x.QueueActor, new TEvents::TEvPoisonPill());
}
@@ -440,10 +440,10 @@ private:
void OnActivateExecutor(const TActorContext &ctx) override;
- void DefaultSignalTabletActive(const TActorContext &ctx) override {
- Y_UNUSED(ctx); //unactivate incomming tablet's pipes until StateSync
- }
-
+ void DefaultSignalTabletActive(const TActorContext &ctx) override {
+ Y_UNUSED(ctx); //unactivate incomming tablet's pipes until StateSync
+ }
+
void OnDetach(const TActorContext &ctx) override {
return Die(ctx);
}
@@ -453,7 +453,7 @@ private:
return Die(ctx);
}
- TMediator& Mediator(TTabletId mediatorId, const TActorContext &ctx) {
+ TMediator& Mediator(TTabletId mediatorId, const TActorContext &ctx) {
TMediator &mediator = Mediators[mediatorId];
if (!mediator.QueueActor)
mediator.QueueActor = ctx.ExecutorThread.RegisterActor(CreateTxCoordinatorMediatorQueue(ctx.SelfID, TabletID(), mediatorId, Executor()->Generation()));
@@ -473,12 +473,12 @@ private:
void Handle(TEvTxCoordinator::TEvMediatorQueueRestart::TPtr &ev, const TActorContext &ctx);
void Handle(TEvTxCoordinator::TEvMediatorQueueConfirmations::TPtr &ev, const TActorContext &ctx);
void Handle(TEvTxCoordinator::TEvCoordinatorConfirmPlan::TPtr &ev, const TActorContext &ctx);
- void Handle(TEvSubDomain::TEvConfigure::TPtr &ev, const TActorContext &ctx);
+ void Handle(TEvSubDomain::TEvConfigure::TPtr &ev, const TActorContext &ctx);
void Handle(TEvents::TEvPoisonPill::TPtr& ev, const TActorContext& ctx);
void DoConfiguration(const TEvSubDomain::TEvConfigure &ev, const TActorContext &ctx, const TActorId &ackTo = TActorId());
-
+
void Sync(ui64 mediator, const TActorContext &ctx);
void Sync(const TActorContext &ctx);
@@ -507,34 +507,34 @@ public:
TTxCoordinator(TTabletStorageInfo *info, const TActorId &tablet);
- // no incomming pipes is allowed in StateInit
- STFUNC_TABLET_INIT(StateInit,
- HFunc(TEvents::TEvPoisonPill, Handle))
+ // no incomming pipes is allowed in StateInit
+ STFUNC_TABLET_INIT(StateInit,
+ HFunc(TEvents::TEvPoisonPill, Handle))
- STFUNC_TABLET_DEF(StateSync,
- HFunc(TEvTxProxy::TEvProposeTransaction, HandleEnqueue)
+ STFUNC_TABLET_DEF(StateSync,
+ HFunc(TEvTxProxy::TEvProposeTransaction, HandleEnqueue)
HFunc(TEvTxProxy::TEvAcquireReadStep, Handle)
HFunc(TEvPrivate::TEvAcquireReadStepFlush, Handle);
- HFunc(TEvSubDomain::TEvConfigure, Handle)
- HFunc(TEvents::TEvPoisonPill, Handle)
- IgnoreFunc(TEvTabletPipe::TEvServerConnected)
- IgnoreFunc(TEvTabletPipe::TEvServerDisconnected))
-
- STFUNC_TABLET_DEF(StateWork,
- HFunc(TEvSubDomain::TEvConfigure, Handle)
- HFunc(TEvTxProxy::TEvProposeTransaction, Handle)
+ HFunc(TEvSubDomain::TEvConfigure, Handle)
+ HFunc(TEvents::TEvPoisonPill, Handle)
+ IgnoreFunc(TEvTabletPipe::TEvServerConnected)
+ IgnoreFunc(TEvTabletPipe::TEvServerDisconnected))
+
+ STFUNC_TABLET_DEF(StateWork,
+ HFunc(TEvSubDomain::TEvConfigure, Handle)
+ HFunc(TEvTxProxy::TEvProposeTransaction, Handle)
HFunc(TEvTxProxy::TEvAcquireReadStep, Handle)
HFunc(TEvPrivate::TEvAcquireReadStepFlush, Handle)
- HFunc(TEvPrivate::TEvPlanTick, Handle)
- HFunc(TEvTxCoordinator::TEvMediatorQueueConfirmations, Handle)
- HFunc(TEvTxCoordinator::TEvMediatorQueueRestart, Handle)
- HFunc(TEvTxCoordinator::TEvMediatorQueueStop, Handle)
- HFunc(TEvTxCoordinator::TEvCoordinatorConfirmPlan, Handle)
- HFunc(TEvents::TEvPoisonPill, Handle)
- IgnoreFunc(TEvTabletPipe::TEvServerConnected)
- IgnoreFunc(TEvTabletPipe::TEvServerDisconnected))
-
- STFUNC_TABLET_IGN(StateBroken,)
+ HFunc(TEvPrivate::TEvPlanTick, Handle)
+ HFunc(TEvTxCoordinator::TEvMediatorQueueConfirmations, Handle)
+ HFunc(TEvTxCoordinator::TEvMediatorQueueRestart, Handle)
+ HFunc(TEvTxCoordinator::TEvMediatorQueueStop, Handle)
+ HFunc(TEvTxCoordinator::TEvCoordinatorConfirmPlan, Handle)
+ HFunc(TEvents::TEvPoisonPill, Handle)
+ IgnoreFunc(TEvTabletPipe::TEvServerConnected)
+ IgnoreFunc(TEvTabletPipe::TEvServerDisconnected))
+
+ STFUNC_TABLET_IGN(StateBroken,)
};
}
diff --git a/ydb/core/tx/coordinator/defs.h b/ydb/core/tx/coordinator/defs.h
index 0c22aca69a2..5236b33beb6 100644
--- a/ydb/core/tx/coordinator/defs.h
+++ b/ydb/core/tx/coordinator/defs.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
// unique tag to fix pragma once gcc glueing: ./ydb/core/tx/coordinator/defs.h
#include <ydb/core/base/defs.h>
#include <ydb/core/base/events.h>
diff --git a/ydb/core/tx/coordinator/mediator_queue.cpp b/ydb/core/tx/coordinator/mediator_queue.cpp
index 0031600c4ab..9b3955fa1bf 100644
--- a/ydb/core/tx/coordinator/mediator_queue.cpp
+++ b/ydb/core/tx/coordinator/mediator_queue.cpp
@@ -1,6 +1,6 @@
-#include "coordinator.h"
-#include "coordinator_impl.h"
-
+#include "coordinator.h"
+#include "coordinator_impl.h"
+
#include <ydb/core/tx/tx_processing.h>
#include <ydb/core/base/tablet_pipe.h>
#include <library/cpp/actors/core/actor_bootstrapped.h>
diff --git a/ydb/core/tx/coordinator/ya.make b/ydb/core/tx/coordinator/ya.make
index c7a0c5e9616..080671e1feb 100644
--- a/ydb/core/tx/coordinator/ya.make
+++ b/ydb/core/tx/coordinator/ya.make
@@ -1,30 +1,30 @@
-LIBRARY()
-
-OWNER(
- ddoarn
+LIBRARY()
+
+OWNER(
+ ddoarn
g:kikimr
-)
-
-SRCS(
- coordinator.cpp
- coordinator_impl.cpp
+)
+
+SRCS(
+ coordinator.cpp
+ coordinator_impl.cpp
coordinator__acquire_read_step.cpp
- coordinator__configure.cpp
- coordinator__check.cpp
- coordinator__init.cpp
- coordinator__mediators_confirmations.cpp
- coordinator__monitoring.cpp
- coordinator__plan_step.cpp
- coordinator__restart_mediator.cpp
- coordinator__restore_transaction.cpp
- coordinator__schema.cpp
- coordinator__schema_upgrade.cpp
+ coordinator__configure.cpp
+ coordinator__check.cpp
+ coordinator__init.cpp
+ coordinator__mediators_confirmations.cpp
+ coordinator__monitoring.cpp
+ coordinator__plan_step.cpp
+ coordinator__restart_mediator.cpp
+ coordinator__restore_transaction.cpp
+ coordinator__schema.cpp
+ coordinator__schema_upgrade.cpp
coordinator__stop_guard.cpp
- defs.h
- mediator_queue.cpp
-)
-
-PEERDIR(
+ defs.h
+ mediator_queue.cpp
+)
+
+PEERDIR(
library/cpp/actors/core
library/cpp/actors/helpers
library/cpp/actors/interconnect
@@ -37,6 +37,6 @@ PEERDIR(
ydb/core/tablet_flat
ydb/core/tx
ydb/core/util
-)
-
-END()
+)
+
+END()
diff --git a/ydb/core/tx/datashard/alter_cdc_stream_unit.cpp b/ydb/core/tx/datashard/alter_cdc_stream_unit.cpp
index d7f276d58c7..b79d5017361 100644
--- a/ydb/core/tx/datashard/alter_cdc_stream_unit.cpp
+++ b/ydb/core/tx/datashard/alter_cdc_stream_unit.cpp
@@ -36,7 +36,7 @@ public:
const auto streamPathId = TPathId(streamDesc.GetPathId().GetOwnerId(), streamDesc.GetPathId().GetLocalId());
Y_VERIFY(streamPathId.OwnerId == DataShard.GetPathOwnerId());
- Y_VERIFY_S(streamDesc.GetState() == NKikimrSchemeOp::ECdcStreamStateDisabled, "Unexpected alter cdc stream"
+ Y_VERIFY_S(streamDesc.GetState() == NKikimrSchemeOp::ECdcStreamStateDisabled, "Unexpected alter cdc stream"
<< ": desc# " << streamDesc.ShortDebugString());
auto tableInfo = DataShard.AlterTableDisableCdcStream(ctx, txc, pathId, params.GetTableSchemaVersion(), streamPathId);
DataShard.AddUserTable(pathId, tableInfo);
diff --git a/ydb/core/tx/datashard/alter_table_unit.cpp b/ydb/core/tx/datashard/alter_table_unit.cpp
index f3b9ece48ae..78786adae78 100644
--- a/ydb/core/tx/datashard/alter_table_unit.cpp
+++ b/ydb/core/tx/datashard/alter_table_unit.cpp
@@ -141,12 +141,12 @@ EExecutionStatus TAlterTableUnit::Execute(TOperation::TPtr op,
<< " version " << alterTableTx.GetTableSchemaVersion());
TPathId tableId(DataShard.GetPathOwnerId(), alterTableTx.GetId_Deprecated());
- if (alterTableTx.HasPathId()) {
- auto& pathId = alterTableTx.GetPathId();
- Y_VERIFY(DataShard.GetPathOwnerId() == pathId.GetOwnerId());
+ if (alterTableTx.HasPathId()) {
+ auto& pathId = alterTableTx.GetPathId();
+ Y_VERIFY(DataShard.GetPathOwnerId() == pathId.GetOwnerId());
tableId.LocalPathId = pathId.GetLocalId();
- }
-
+ }
+
TUserTable::TPtr info = DataShard.AlterUserTable(ctx, txc, alterTableTx);
DataShard.AddUserTable(tableId, info);
diff --git a/ydb/core/tx/datashard/build_scheme_tx_out_rs_unit.cpp b/ydb/core/tx/datashard/build_scheme_tx_out_rs_unit.cpp
index eaacbbef09f..7f632531577 100644
--- a/ydb/core/tx/datashard/build_scheme_tx_out_rs_unit.cpp
+++ b/ydb/core/tx/datashard/build_scheme_tx_out_rs_unit.cpp
@@ -51,14 +51,14 @@ EExecutionStatus TBuildSchemeTxOutRSUnit::Execute(TOperation::TPtr op,
auto &outReadSets = op->OutReadSets();
ui64 srcTablet = DataShard.TabletID();
-
- const auto& snapshot = schemeTx.GetSendSnapshot();
- ui64 targetTablet = snapshot.GetSendTo(0).GetShard();
- ui64 tableId = snapshot.GetTableId_Deprecated();
- if (snapshot.HasTableId()) {
- Y_VERIFY(DataShard.GetPathOwnerId() == snapshot.GetTableId().GetOwnerId());
- tableId = snapshot.GetTableId().GetTableId();
- }
+
+ const auto& snapshot = schemeTx.GetSendSnapshot();
+ ui64 targetTablet = snapshot.GetSendTo(0).GetShard();
+ ui64 tableId = snapshot.GetTableId_Deprecated();
+ if (snapshot.HasTableId()) {
+ Y_VERIFY(DataShard.GetPathOwnerId() == snapshot.GetTableId().GetOwnerId());
+ tableId = snapshot.GetTableId().GetTableId();
+ }
Y_VERIFY(DataShard.GetUserTables().contains(tableId));
ui32 localTableId = DataShard.GetUserTables().at(tableId)->LocalTid;
diff --git a/ydb/core/tx/datashard/change_collector_cdc_stream.cpp b/ydb/core/tx/datashard/change_collector_cdc_stream.cpp
index e0d24b8be85..f5cb67d1ba4 100644
--- a/ydb/core/tx/datashard/change_collector_cdc_stream.cpp
+++ b/ydb/core/tx/datashard/change_collector_cdc_stream.cpp
@@ -65,13 +65,13 @@ bool TCdcStreamChangeCollector::NeedToReadKeys() const {
for (const auto& [_, tableInfo] : Self->GetUserTables()) {
for (const auto& [_, streamInfo] : tableInfo->CdcStreams) {
switch (streamInfo.Mode) {
- case NKikimrSchemeOp::ECdcStreamModeKeysOnly:
- case NKikimrSchemeOp::ECdcStreamModeUpdate:
+ case NKikimrSchemeOp::ECdcStreamModeKeysOnly:
+ case NKikimrSchemeOp::ECdcStreamModeUpdate:
CachedNeedToReadKeys = false;
break;
- case NKikimrSchemeOp::ECdcStreamModeNewImage:
- case NKikimrSchemeOp::ECdcStreamModeOldImage:
- case NKikimrSchemeOp::ECdcStreamModeNewAndOldImages:
+ case NKikimrSchemeOp::ECdcStreamModeNewImage:
+ case NKikimrSchemeOp::ECdcStreamModeOldImage:
+ case NKikimrSchemeOp::ECdcStreamModeNewAndOldImages:
CachedNeedToReadKeys = true;
break;
default:
@@ -114,15 +114,15 @@ bool TCdcStreamChangeCollector::Collect(const TTableId& tableId, ERowOp rop,
for (const auto& [pathId, stream] : userTable->CdcStreams) {
switch (stream.Mode) {
- case NKikimrSchemeOp::ECdcStreamModeKeysOnly:
+ case NKikimrSchemeOp::ECdcStreamModeKeysOnly:
Persist(pathId, rop, key, keyTags, {});
break;
- case NKikimrSchemeOp::ECdcStreamModeUpdate:
+ case NKikimrSchemeOp::ECdcStreamModeUpdate:
Persist(pathId, rop, key, keyTags, updates);
break;
- case NKikimrSchemeOp::ECdcStreamModeNewImage:
- case NKikimrSchemeOp::ECdcStreamModeOldImage:
- case NKikimrSchemeOp::ECdcStreamModeNewAndOldImages: {
+ case NKikimrSchemeOp::ECdcStreamModeNewImage:
+ case NKikimrSchemeOp::ECdcStreamModeOldImage:
+ case NKikimrSchemeOp::ECdcStreamModeNewAndOldImages: {
const auto valueTags = MakeValueTags(userTable->Columns);
const auto oldState = GetCurrentState(localTableId, key, keyTags, valueTags);
@@ -130,12 +130,12 @@ bool TCdcStreamChangeCollector::Collect(const TTableId& tableId, ERowOp rop,
return false;
}
- if (stream.Mode == NKikimrSchemeOp::ECdcStreamModeOldImage) {
+ if (stream.Mode == NKikimrSchemeOp::ECdcStreamModeOldImage) {
Persist(pathId, rop, key, keyTags, NullIfErased(&*oldState), nullptr, valueTags);
} else {
const auto newState = PatchState(*oldState, rop, MakeTagToPos(valueTags), MappedUpdates(updates));
- if (stream.Mode == NKikimrSchemeOp::ECdcStreamModeNewImage) {
+ if (stream.Mode == NKikimrSchemeOp::ECdcStreamModeNewImage) {
Persist(pathId, rop, key, keyTags, nullptr, NullIfErased(&newState), valueTags);
} else {
Persist(pathId, rop, key, keyTags, NullIfErased(&*oldState), NullIfErased(&newState), valueTags);
diff --git a/ydb/core/tx/datashard/change_sender_async_index.cpp b/ydb/core/tx/datashard/change_sender_async_index.cpp
index 0e7e7f288e4..1bc6796dbf6 100644
--- a/ydb/core/tx/datashard/change_sender_async_index.cpp
+++ b/ydb/core/tx/datashard/change_sender_async_index.cpp
@@ -376,7 +376,7 @@ class TAsyncIndexChangeSenderMain: public TActorBootstrapped<TAsyncIndexChangeSe
void HandleUserTable(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr& ev) {
const auto& result = ev->Get()->Request;
- LOG_D("HandleUserTable TEvTxProxySchemeCache::TEvNavigateKeySetResult"
+ LOG_D("HandleUserTable TEvTxProxySchemeCache::TEvNavigateKeySetResult"
<< ": result# " << (result ? result->ToString(*AppData()->TypeRegistry) : "nullptr"));
if (!CheckNotEmpty(result)) {
diff --git a/ydb/core/tx/datashard/check_scheme_tx_unit.cpp b/ydb/core/tx/datashard/check_scheme_tx_unit.cpp
index f8c3067fad3..bbba1c6d95d 100644
--- a/ydb/core/tx/datashard/check_scheme_tx_unit.cpp
+++ b/ydb/core/tx/datashard/check_scheme_tx_unit.cpp
@@ -30,10 +30,10 @@ private:
bool CheckCopy(TActiveTransaction *activeTx);
bool CheckCreatePersistentSnapshot(TActiveTransaction *activeTx);
bool CheckDropPersistentSnapshot(TActiveTransaction *activeTx);
- bool CheckInitiateBuildIndex(TActiveTransaction *activeTx);
- bool CheckFinalizeBuildIndex(TActiveTransaction *activeTx);
- bool CheckDropIndexNotice(TActiveTransaction *activeTx);
- bool CheckMoveTable(TActiveTransaction *activeTx);
+ bool CheckInitiateBuildIndex(TActiveTransaction *activeTx);
+ bool CheckFinalizeBuildIndex(TActiveTransaction *activeTx);
+ bool CheckDropIndexNotice(TActiveTransaction *activeTx);
+ bool CheckMoveTable(TActiveTransaction *activeTx);
bool CheckCreateCdcStream(TActiveTransaction *activeTx);
bool CheckAlterCdcStream(TActiveTransaction *activeTx);
bool CheckDropCdcStream(TActiveTransaction *activeTx);
@@ -82,7 +82,7 @@ EExecutionStatus TCheckSchemeTxUnit::Execute(TOperation::TPtr op,
tx.GetAlterTable().GetPartitionConfig().HasFreezeState())
{
auto cmd = tx.GetAlterTable().GetPartitionConfig().GetFreezeState();
- unfreezeTx = cmd == NKikimrSchemeOp::EFreezeState::Unfreeze;
+ unfreezeTx = cmd == NKikimrSchemeOp::EFreezeState::Unfreeze;
}
// Check state is proper for scheme transactions.
@@ -343,20 +343,20 @@ bool TCheckSchemeTxUnit::CheckSchemeTx(TActiveTransaction *activeTx)
res = CheckDropPersistentSnapshot(activeTx);
break;
case TSchemaOperation::ETypeInitiateBuildIndex:
- res = CheckInitiateBuildIndex(activeTx);
- break;
+ res = CheckInitiateBuildIndex(activeTx);
+ break;
case TSchemaOperation::ETypeFinalizeBuildIndex:
- res = CheckFinalizeBuildIndex(activeTx);
- break;
+ res = CheckFinalizeBuildIndex(activeTx);
+ break;
case TSchemaOperation::ETypeDropIndexNotice:
- res = CheckDropIndexNotice(activeTx);
- break;
- case TSchemaOperation::ETypeMoveTable:
- res = CheckMoveTable(activeTx);
- break;
+ res = CheckDropIndexNotice(activeTx);
+ break;
+ case TSchemaOperation::ETypeMoveTable:
+ res = CheckMoveTable(activeTx);
+ break;
case TSchemaOperation::ETypeCreateCdcStream:
res = CheckCreateCdcStream(activeTx);
- break;
+ break;
case TSchemaOperation::ETypeAlterCdcStream:
res = CheckAlterCdcStream(activeTx);
break;
@@ -382,14 +382,14 @@ bool TCheckSchemeTxUnit::CheckCreate(TActiveTransaction *activeTx) {
}
const auto &create = tx.GetCreateTable();
- ui64 tableId = create.GetId_Deprecated();
- if (create.HasPathId()) {
- Y_VERIFY(DataShard.GetPathOwnerId() == create.GetPathId().GetOwnerId() || DataShard.GetPathOwnerId() == INVALID_TABLET_ID);
- tableId = create.GetPathId().GetLocalId();
- }
-
- Y_VERIFY(!DataShard.GetUserTables().contains(tableId));
-
+ ui64 tableId = create.GetId_Deprecated();
+ if (create.HasPathId()) {
+ Y_VERIFY(DataShard.GetPathOwnerId() == create.GetPathId().GetOwnerId() || DataShard.GetPathOwnerId() == INVALID_TABLET_ID);
+ tableId = create.GetPathId().GetLocalId();
+ }
+
+ Y_VERIFY(!DataShard.GetUserTables().contains(tableId));
+
return true;
}
@@ -401,12 +401,12 @@ bool TCheckSchemeTxUnit::CheckDrop(TActiveTransaction *activeTx) {
}
const auto &drop = tx.GetDropTable();
- ui64 tableId = drop.GetId_Deprecated();
- if (drop.HasPathId()) {
- Y_VERIFY(DataShard.GetPathOwnerId() == drop.GetPathId().GetOwnerId());
- tableId = drop.GetPathId().GetLocalId();
- }
- Y_VERIFY(DataShard.GetUserTables().FindPtr(tableId));
+ ui64 tableId = drop.GetId_Deprecated();
+ if (drop.HasPathId()) {
+ Y_VERIFY(DataShard.GetPathOwnerId() == drop.GetPathId().GetOwnerId());
+ tableId = drop.GetPathId().GetLocalId();
+ }
+ Y_VERIFY(DataShard.GetUserTables().FindPtr(tableId));
return true;
}
@@ -451,7 +451,7 @@ bool TCheckSchemeTxUnit::CheckAlter(TActiveTransaction *activeTx)
return false;
}
- bool freeze = alter.GetPartitionConfig().GetFreezeState() == NKikimrSchemeOp::EFreezeState::Freeze;
+ bool freeze = alter.GetPartitionConfig().GetFreezeState() == NKikimrSchemeOp::EFreezeState::Freeze;
const auto curState = DataShard.GetState();
bool err = false;
@@ -477,14 +477,14 @@ bool TCheckSchemeTxUnit::CheckAlter(TActiveTransaction *activeTx)
}
}
- ui64 tableId = alter.GetId_Deprecated();
- if (alter.HasPathId()) {
- Y_VERIFY(DataShard.GetPathOwnerId() == alter.GetPathId().GetOwnerId());
- tableId = alter.GetPathId().GetLocalId();
- }
+ ui64 tableId = alter.GetId_Deprecated();
+ if (alter.HasPathId()) {
+ Y_VERIFY(DataShard.GetPathOwnerId() == alter.GetPathId().GetOwnerId());
+ tableId = alter.GetPathId().GetLocalId();
+ }
const auto tablePtr = DataShard.GetUserTables().FindPtr(tableId);
- Y_VERIFY_S(tablePtr, "tableId: " << tableId);
+ Y_VERIFY_S(tablePtr, "tableId: " << tableId);
const TUserTable &table = **tablePtr;
auto curSchemaVersion = table.GetTableSchemaVersion();
@@ -571,12 +571,12 @@ bool TCheckSchemeTxUnit::CheckCopy(TActiveTransaction *activeTx) {
}
const auto &snap = tx.GetSendSnapshot();
- ui64 tableId = snap.GetTableId_Deprecated();
- if (snap.HasTableId()) {
- Y_VERIFY(DataShard.GetPathOwnerId() == snap.GetTableId().GetOwnerId());
- tableId = snap.GetTableId().GetTableId();
- }
- Y_VERIFY(DataShard.GetUserTables().contains(tableId));
+ ui64 tableId = snap.GetTableId_Deprecated();
+ if (snap.HasTableId()) {
+ Y_VERIFY(DataShard.GetPathOwnerId() == snap.GetTableId().GetOwnerId());
+ tableId = snap.GetTableId().GetTableId();
+ }
+ Y_VERIFY(DataShard.GetUserTables().contains(tableId));
return true;
}
@@ -605,78 +605,78 @@ bool TCheckSchemeTxUnit::CheckDropPersistentSnapshot(TActiveTransaction *activeT
return true;
}
-bool TCheckSchemeTxUnit::CheckInitiateBuildIndex(TActiveTransaction *activeTx) {
+bool TCheckSchemeTxUnit::CheckInitiateBuildIndex(TActiveTransaction *activeTx) {
if (HasDuplicate(activeTx, "InitiateBuildIndex", &TPipeline::HasInitiateBuilIndex)) {
- return false;
- }
-
+ return false;
+ }
+
const auto &initiate = activeTx->GetSchemeTx().GetInitiateBuildIndex();
if (!HasPathId(activeTx, initiate, "InitiateBuildIndex")) {
return false;
- }
-
+ }
+
return CheckSchemaVersion(activeTx, initiate);
-}
-
-bool TCheckSchemeTxUnit::CheckFinalizeBuildIndex(TActiveTransaction *activeTx) {
+}
+
+bool TCheckSchemeTxUnit::CheckFinalizeBuildIndex(TActiveTransaction *activeTx) {
if (HasDuplicate(activeTx, "FinalizeBuildIndex", &TPipeline::HasFinalizeBuilIndex)) {
- return false;
- }
-
+ return false;
+ }
+
const auto &finalize = activeTx->GetSchemeTx().GetFinalizeBuildIndex();
if (!HasPathId(activeTx, finalize, "FinalizeBuildIndex")) {
return false;
- }
-
+ }
+
const auto pathId = GetPathId(finalize);
- const auto snapshotKey = TSnapshotKey(pathId.OwnerId, pathId.LocalPathId, finalize.GetSnapshotStep(), finalize.GetSnapshotTxId());
-
- if (DataShard.GetSnapshotManager().FindAvailable(snapshotKey) == nullptr) {
- LOG_DEBUG_S(TActivationContext::AsActorContext(), NKikimrServices::TX_DATASHARD,
- "FinalizeBuildIndex description has unexisting snapshot key."
- << " Tablet " << DataShard.TabletID()
- << " txId " << activeTx->GetTxId()
- << " pathId " << pathId
- << " snapshotKey " << snapshotKey);
- BuildResult(activeTx, NKikimrTxDataShard::TEvProposeTransactionResult::ERROR);
+ const auto snapshotKey = TSnapshotKey(pathId.OwnerId, pathId.LocalPathId, finalize.GetSnapshotStep(), finalize.GetSnapshotTxId());
+
+ if (DataShard.GetSnapshotManager().FindAvailable(snapshotKey) == nullptr) {
+ LOG_DEBUG_S(TActivationContext::AsActorContext(), NKikimrServices::TX_DATASHARD,
+ "FinalizeBuildIndex description has unexisting snapshot key."
+ << " Tablet " << DataShard.TabletID()
+ << " txId " << activeTx->GetTxId()
+ << " pathId " << pathId
+ << " snapshotKey " << snapshotKey);
+ BuildResult(activeTx, NKikimrTxDataShard::TEvProposeTransactionResult::ERROR);
return false;
- }
-
+ }
+
return CheckSchemaVersion(activeTx, pathId.LocalPathId, finalize);
-}
-
-bool TCheckSchemeTxUnit::CheckDropIndexNotice(TActiveTransaction *activeTx) {
+}
+
+bool TCheckSchemeTxUnit::CheckDropIndexNotice(TActiveTransaction *activeTx) {
if (HasDuplicate(activeTx, "DropIndexNotice", &TPipeline::HasDropIndexNotice)) {
- return false;
- }
-
+ return false;
+ }
+
const auto &notice = activeTx->GetSchemeTx().GetDropIndexNotice();
if (!HasPathId(activeTx, notice, "DropIndexNotice")) {
return false;
- }
-
+ }
+
return CheckSchemaVersion(activeTx, notice);
-}
-
-
-bool TCheckSchemeTxUnit::CheckMoveTable(TActiveTransaction *activeTx) {
+}
+
+
+bool TCheckSchemeTxUnit::CheckMoveTable(TActiveTransaction *activeTx) {
if (HasDuplicate(activeTx, "Move", &TPipeline::HasMove)) {
- return false;
- }
-
+ return false;
+ }
+
const auto &mv = activeTx->GetSchemeTx().GetMoveTable();
if (!HasPathId(activeTx, mv, "Move")) {
return false;
- }
-
+ }
+
return CheckSchemaVersion(activeTx, mv);
-}
-
+}
+
bool TCheckSchemeTxUnit::CheckCreateCdcStream(TActiveTransaction *activeTx) {
if (HasDuplicate(activeTx, "CreateCdcStream", &TPipeline::HasCreateCdcStream)) {
return false;
}
-
+
const auto &notice = activeTx->GetSchemeTx().GetCreateCdcStreamNotice();
if (!HasPathId(activeTx, notice, "CreateCdcStream")) {
return false;
diff --git a/ydb/core/tx/datashard/check_snapshot_tx_unit.cpp b/ydb/core/tx/datashard/check_snapshot_tx_unit.cpp
index 3f7b0170311..cdba2783f07 100644
--- a/ydb/core/tx/datashard/check_snapshot_tx_unit.cpp
+++ b/ydb/core/tx/datashard/check_snapshot_tx_unit.cpp
@@ -17,7 +17,7 @@ public:
bool CheckTable(TOperation::TPtr op, ui64 ownerId, ui64 pathId) {
// FIXME: tables must use proper owner id when addressed
- if (ownerId != DataShard.GetPathOwnerId() ||
+ if (ownerId != DataShard.GetPathOwnerId() ||
!DataShard.GetUserTables().contains(pathId))
{
BuildResult(op)->AddError(
diff --git a/ydb/core/tx/datashard/create_table_unit.cpp b/ydb/core/tx/datashard/create_table_unit.cpp
index a7b77214e83..85f38d456a3 100644
--- a/ydb/core/tx/datashard/create_table_unit.cpp
+++ b/ydb/core/tx/datashard/create_table_unit.cpp
@@ -51,10 +51,10 @@ EExecutionStatus TCreateTableUnit::Execute(TOperation::TPtr op,
const auto &createTableTx = schemeTx.GetCreateTable();
TPathId tableId(DataShard.GetPathOwnerId(), createTableTx.GetId_Deprecated());
- if (createTableTx.HasPathId()) {
+ if (createTableTx.HasPathId()) {
Y_VERIFY(DataShard.GetPathOwnerId() == createTableTx.GetPathId().GetOwnerId());
tableId.LocalPathId = createTableTx.GetPathId().GetLocalId();
- }
+ }
const ui64 schemaVersion = createTableTx.HasTableSchemaVersion() ? createTableTx.GetTableSchemaVersion() : 0u;
@@ -67,7 +67,7 @@ EExecutionStatus TCreateTableUnit::Execute(TOperation::TPtr op,
DataShard.AddUserTable(tableId, info);
for (const auto& [indexPathId, indexInfo] : info->Indexes) {
- if (indexInfo.Type == NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync) {
+ if (indexInfo.Type == NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync) {
AddSenders.emplace_back(new TEvChangeExchange::TEvAddSender(
tableId, TEvChangeExchange::ESenderType::AsyncIndex, indexPathId
));
diff --git a/ydb/core/tx/datashard/datashard.cpp b/ydb/core/tx/datashard/datashard.cpp
index 116f6b477c4..d86568b4a15 100644
--- a/ydb/core/tx/datashard/datashard.cpp
+++ b/ydb/core/tx/datashard/datashard.cpp
@@ -18,7 +18,7 @@ IActor* CreateDataShard(const TActorId &tablet, TTabletStorageInfo *info) {
namespace NDataShard {
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NTabletFlatExecutor;
// NOTE: We really want to batch log records by default in datashards!
@@ -98,8 +98,8 @@ TDataShard::TDataShard(const TActorId &tablet, TTabletStorageInfo *info)
, PipeClientCache(NTabletPipe::CreateBoundedClientCache(PipeClientCacheConfig, GetPipeClientConfig()))
, ResendReadSetPipeTracker(*PipeClientCache)
, SchemeShardPipeRetryPolicy({})
- , PathOwnerId(INVALID_TABLET_ID)
- , CurrentSchemeShardId(INVALID_TABLET_ID)
+ , PathOwnerId(INVALID_TABLET_ID)
+ , CurrentSchemeShardId(INVALID_TABLET_ID)
, LastKnownMediator(INVALID_TABLET_ID)
, RegistrationSended(false)
, LoanReturnTracker(info->TabletID)
@@ -457,10 +457,10 @@ ui64 TDataShard::AllocateChangeRecordGroup(NIceDb::TNiceDb& db) {
}
void TDataShard::PersistChangeRecord(NIceDb::TNiceDb& db, const TChangeRecord& record) {
- LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::TX_DATASHARD, "PersistChangeRecord"
- << ": record: " << record
- << ", at tablet: " << TabletID());
-
+ LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::TX_DATASHARD, "PersistChangeRecord"
+ << ": record: " << record
+ << ", at tablet: " << TabletID());
+
db.Table<Schema::ChangeRecords>().Key(record.GetOrder()).Update(
NIceDb::TUpdate<Schema::ChangeRecords::Group>(record.GetGroup()),
NIceDb::TUpdate<Schema::ChangeRecords::PlanStep>(record.GetStep()),
@@ -474,21 +474,21 @@ void TDataShard::PersistChangeRecord(NIceDb::TNiceDb& db, const TChangeRecord& r
}
void TDataShard::MoveChangeRecord(NIceDb::TNiceDb& db, ui64 order, const TPathId& pathId) {
- LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::TX_DATASHARD, "MoveChangeRecord"
- << ": order: " << order
- << ": pathId: " << pathId
- << ", at tablet: " << TabletID());
-
- db.Table<Schema::ChangeRecords>().Key(order).Update(
- NIceDb::TUpdate<Schema::ChangeRecords::PathOwnerId>(pathId.OwnerId),
- NIceDb::TUpdate<Schema::ChangeRecords::LocalPathId>(pathId.LocalPathId));
-}
-
+ LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::TX_DATASHARD, "MoveChangeRecord"
+ << ": order: " << order
+ << ": pathId: " << pathId
+ << ", at tablet: " << TabletID());
+
+ db.Table<Schema::ChangeRecords>().Key(order).Update(
+ NIceDb::TUpdate<Schema::ChangeRecords::PathOwnerId>(pathId.OwnerId),
+ NIceDb::TUpdate<Schema::ChangeRecords::LocalPathId>(pathId.LocalPathId));
+}
+
void TDataShard::RemoveChangeRecord(NIceDb::TNiceDb& db, ui64 order) {
- LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::TX_DATASHARD, "RemoveChangeRecord"
- << ": order: " << order
- << ", at tablet: " << TabletID());
-
+ LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::TX_DATASHARD, "RemoveChangeRecord"
+ << ": order: " << order
+ << ", at tablet: " << TabletID());
+
auto it = ChangesQueue.find(order);
if (it != ChangesQueue.end()) {
Y_VERIFY(it->second <= ChangesQueueBytes);
@@ -581,35 +581,35 @@ void TDataShard::KillChangeSender(const TActorContext& ctx) {
bool TDataShard::LoadChangeRecords(NIceDb::TNiceDb& db, TVector<TEvChangeExchange::TEvEnqueueRecords::TRecordInfo>& changeRecords) {
using Schema = TDataShard::Schema;
-
- LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::TX_DATASHARD, "LoadChangeRecords"
- << ": QueueSize: " << ChangesQueue.size()
- << ", at tablet: " << TabletID());
-
- changeRecords.reserve(ChangesQueue.size());
-
- auto rowset = db.Table<Schema::ChangeRecords>().Range().Select();
- if (!rowset.IsReady()) {
- return false;
- }
-
- while (!rowset.EndOfSet()) {
- const ui64 order = rowset.GetValue<Schema::ChangeRecords::Order>();
- const ui64 bodySize = rowset.GetValue<Schema::ChangeRecords::BodySize>();
- const auto pathId = TPathId(
- rowset.GetValue<Schema::ChangeRecords::PathOwnerId>(),
- rowset.GetValue<Schema::ChangeRecords::LocalPathId>()
- );
-
- changeRecords.emplace_back(order, pathId, bodySize);
- if (!rowset.Next()) {
- return false;
- }
- }
-
- return true;
-}
-
+
+ LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::TX_DATASHARD, "LoadChangeRecords"
+ << ": QueueSize: " << ChangesQueue.size()
+ << ", at tablet: " << TabletID());
+
+ changeRecords.reserve(ChangesQueue.size());
+
+ auto rowset = db.Table<Schema::ChangeRecords>().Range().Select();
+ if (!rowset.IsReady()) {
+ return false;
+ }
+
+ while (!rowset.EndOfSet()) {
+ const ui64 order = rowset.GetValue<Schema::ChangeRecords::Order>();
+ const ui64 bodySize = rowset.GetValue<Schema::ChangeRecords::BodySize>();
+ const auto pathId = TPathId(
+ rowset.GetValue<Schema::ChangeRecords::PathOwnerId>(),
+ rowset.GetValue<Schema::ChangeRecords::LocalPathId>()
+ );
+
+ changeRecords.emplace_back(order, pathId, bodySize);
+ if (!rowset.Next()) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
void TDataShard::PersistSchemeTxResult(NIceDb::TNiceDb &db, const TSchemaOperation &op) {
db.Table<Schema::SchemaOperations>().Key(op.TxId).Update(
NIceDb::TUpdate<Schema::SchemaOperations::Success>(op.Success),
@@ -702,47 +702,47 @@ void TDataShard::PersistUserTableFullCompactionTs(NIceDb::TNiceDb& db, ui64 tabl
}
void TDataShard::PersistMoveUserTable(NIceDb::TNiceDb& db, ui64 prevTableId, ui64 tableId, const TUserTable& tableInfo) {
- db.Table<Schema::UserTables>().Key(prevTableId).Delete();
- PersistUserTable(db, tableId, tableInfo);
+ db.Table<Schema::UserTables>().Key(prevTableId).Delete();
+ PersistUserTable(db, tableId, tableInfo);
db.Table<Schema::UserTablesStats>().Key(prevTableId).Delete();
if (tableInfo.Stats.LastFullCompaction) {
PersistUserTableFullCompactionTs(db, tableId, tableInfo.Stats.LastFullCompaction.Seconds());
}
-}
-
+}
+
TUserTable::TPtr TDataShard::AlterTableSchemaVersion(
const TActorContext&, TTransactionContext& txc,
const TPathId& pathId, const ui64 tableSchemaVersion, bool persist)
-{
-
- Y_VERIFY(GetPathOwnerId() == pathId.OwnerId);
- ui64 tableId = pathId.LocalPathId;
-
- Y_VERIFY(TableInfos.contains(tableId));
- auto oldTableInfo = TableInfos[tableId];
- Y_VERIFY(oldTableInfo);
-
- TUserTable::TPtr newTableInfo = new TUserTable(*oldTableInfo);
- newTableInfo->SetTableSchemaVersion(tableSchemaVersion);
-
- Y_VERIFY_DEBUG_S(oldTableInfo->GetTableSchemaVersion() < newTableInfo->GetTableSchemaVersion(),
- "pathId " << pathId
- << "old version " << oldTableInfo->GetTableSchemaVersion()
- << "new version " << newTableInfo->GetTableSchemaVersion());
-
+{
+
+ Y_VERIFY(GetPathOwnerId() == pathId.OwnerId);
+ ui64 tableId = pathId.LocalPathId;
+
+ Y_VERIFY(TableInfos.contains(tableId));
+ auto oldTableInfo = TableInfos[tableId];
+ Y_VERIFY(oldTableInfo);
+
+ TUserTable::TPtr newTableInfo = new TUserTable(*oldTableInfo);
+ newTableInfo->SetTableSchemaVersion(tableSchemaVersion);
+
+ Y_VERIFY_DEBUG_S(oldTableInfo->GetTableSchemaVersion() < newTableInfo->GetTableSchemaVersion(),
+ "pathId " << pathId
+ << "old version " << oldTableInfo->GetTableSchemaVersion()
+ << "new version " << newTableInfo->GetTableSchemaVersion());
+
if (persist) {
NIceDb::TNiceDb db(txc.DB);
PersistUserTable(db, tableId, *newTableInfo);
}
-
- return newTableInfo;
-}
-
+
+ return newTableInfo;
+}
+
TUserTable::TPtr TDataShard::AlterTableAddIndex(
const TActorContext& ctx, TTransactionContext& txc,
const TPathId& pathId, ui64 tableSchemaVersion,
- const NKikimrSchemeOp::TIndexDescription& indexDesc)
+ const NKikimrSchemeOp::TIndexDescription& indexDesc)
{
auto tableInfo = AlterTableSchemaVersion(ctx, txc, pathId, tableSchemaVersion, false);
tableInfo->AddIndex(indexDesc);
@@ -770,7 +770,7 @@ TUserTable::TPtr TDataShard::AlterTableDropIndex(
TUserTable::TPtr TDataShard::AlterTableAddCdcStream(
const TActorContext& ctx, TTransactionContext& txc,
const TPathId& pathId, ui64 tableSchemaVersion,
- const NKikimrSchemeOp::TCdcStreamDescription& streamDesc)
+ const NKikimrSchemeOp::TCdcStreamDescription& streamDesc)
{
auto tableInfo = AlterTableSchemaVersion(ctx, txc, pathId, tableSchemaVersion, false);
tableInfo->AddCdcStream(streamDesc);
@@ -810,14 +810,14 @@ TUserTable::TPtr TDataShard::AlterTableDropCdcStream(
}
TUserTable::TPtr TDataShard::CreateUserTable(TTransactionContext& txc,
- const NKikimrSchemeOp::TTableDescription& tableScheme)
+ const NKikimrSchemeOp::TTableDescription& tableScheme)
{
const TString mainTableName = TDataShard::Schema::UserTablePrefix + tableScheme.GetName();
- ui64 tableId = tableScheme.GetId_Deprecated();
- if (tableScheme.HasPathId()) {
- Y_VERIFY(GetPathOwnerId() == tableScheme.GetPathId().GetOwnerId() || GetPathOwnerId() == INVALID_TABLET_ID);
- tableId = tableScheme.GetPathId().GetLocalId();
- }
+ ui64 tableId = tableScheme.GetId_Deprecated();
+ if (tableScheme.HasPathId()) {
+ Y_VERIFY(GetPathOwnerId() == tableScheme.GetPathId().GetOwnerId() || GetPathOwnerId() == INVALID_TABLET_ID);
+ tableId = tableScheme.GetPathId().GetLocalId();
+ }
ui32 localTid = ++LastLocalTid;
ui32 shadowTid = tableScheme.GetPartitionConfig().GetShadowData() ? ++LastLocalTid : 0;
TUserTable::TPtr tableInfo = new TUserTable(localTid, tableScheme, shadowTid);
@@ -853,65 +853,65 @@ TUserTable::TPtr TDataShard::CreateUserTable(TTransactionContext& txc,
}
THashMap<TPathId, TPathId> TDataShard::GetRemapIndexes(const NKikimrTxDataShard::TMoveTable& move) {
- THashMap<TPathId, TPathId> remap;
- for (const auto& item: move.GetReMapIndexes()) {
- auto prevId = TPathId(item.GetPathId().GetOwnerId(), item.GetPathId().GetLocalId());
- auto newId = TPathId(item.GetDstPathId().GetOwnerId(), item.GetDstPathId().GetLocalId());
- remap[prevId] = newId;
- }
- return remap;
-}
-
+ THashMap<TPathId, TPathId> remap;
+ for (const auto& item: move.GetReMapIndexes()) {
+ auto prevId = TPathId(item.GetPathId().GetOwnerId(), item.GetPathId().GetLocalId());
+ auto newId = TPathId(item.GetDstPathId().GetOwnerId(), item.GetDstPathId().GetLocalId());
+ remap[prevId] = newId;
+ }
+ return remap;
+}
+
TUserTable::TPtr TDataShard::MoveUserTable(const TActorContext& ctx, TTransactionContext& txc,
- const NKikimrTxDataShard::TMoveTable& move)
-{
- auto prevId = TPathId(move.GetPathId().GetOwnerId(), move.GetPathId().GetLocalId());
- auto newId = TPathId(move.GetDstPathId().GetOwnerId(), move.GetDstPathId().GetLocalId());
-
- Y_VERIFY(GetPathOwnerId() == prevId.OwnerId);
- Y_VERIFY(TableInfos.contains(prevId.LocalPathId));
-
- auto newTableInfo = AlterTableSchemaVersion(ctx, txc, prevId, move.GetTableSchemaVersion(), false);
- newTableInfo->SetPath(move.GetDstPath());
-
- Y_VERIFY(move.ReMapIndexesSize() == newTableInfo->Indexes.size());
- const THashMap<TPathId, TPathId> remap = GetRemapIndexes(move);
-
- NKikimrSchemeOp::TTableDescription schema;
- newTableInfo->GetSchema(schema);
- for (auto& indexDesc: *schema.MutableTableIndexes()) {
- Y_VERIFY(indexDesc.HasPathOwnerId() && indexDesc.HasLocalPathId());
- auto prevPathId = TPathId(indexDesc.GetPathOwnerId(), indexDesc.GetLocalPathId());
- Y_VERIFY_S(remap.contains(prevPathId), "no rule how to move index with pathId " << prevPathId); // we should remap all indexes
- auto newPathId = remap.at(prevPathId);
-
- indexDesc.SetPathOwnerId(newPathId.OwnerId);
- indexDesc.SetLocalPathId(newPathId.LocalPathId);
-
- newTableInfo->Indexes[newPathId] = newTableInfo->Indexes[prevPathId];
- newTableInfo->Indexes.erase(prevPathId);
- }
- newTableInfo->SetSchema(schema);
- Y_VERIFY(move.ReMapIndexesSize() == newTableInfo->Indexes.size());
-
- RemoveUserTable(prevId);
- AddUserTable(newId, newTableInfo);
-
- NIceDb::TNiceDb db(txc.DB);
- PersistMoveUserTable(db, prevId.LocalPathId, newId.LocalPathId, *newTableInfo);
- PersistOwnerPathId(newId.OwnerId, txc);
-
- return newTableInfo;
-}
-
+ const NKikimrTxDataShard::TMoveTable& move)
+{
+ auto prevId = TPathId(move.GetPathId().GetOwnerId(), move.GetPathId().GetLocalId());
+ auto newId = TPathId(move.GetDstPathId().GetOwnerId(), move.GetDstPathId().GetLocalId());
+
+ Y_VERIFY(GetPathOwnerId() == prevId.OwnerId);
+ Y_VERIFY(TableInfos.contains(prevId.LocalPathId));
+
+ auto newTableInfo = AlterTableSchemaVersion(ctx, txc, prevId, move.GetTableSchemaVersion(), false);
+ newTableInfo->SetPath(move.GetDstPath());
+
+ Y_VERIFY(move.ReMapIndexesSize() == newTableInfo->Indexes.size());
+ const THashMap<TPathId, TPathId> remap = GetRemapIndexes(move);
+
+ NKikimrSchemeOp::TTableDescription schema;
+ newTableInfo->GetSchema(schema);
+ for (auto& indexDesc: *schema.MutableTableIndexes()) {
+ Y_VERIFY(indexDesc.HasPathOwnerId() && indexDesc.HasLocalPathId());
+ auto prevPathId = TPathId(indexDesc.GetPathOwnerId(), indexDesc.GetLocalPathId());
+ Y_VERIFY_S(remap.contains(prevPathId), "no rule how to move index with pathId " << prevPathId); // we should remap all indexes
+ auto newPathId = remap.at(prevPathId);
+
+ indexDesc.SetPathOwnerId(newPathId.OwnerId);
+ indexDesc.SetLocalPathId(newPathId.LocalPathId);
+
+ newTableInfo->Indexes[newPathId] = newTableInfo->Indexes[prevPathId];
+ newTableInfo->Indexes.erase(prevPathId);
+ }
+ newTableInfo->SetSchema(schema);
+ Y_VERIFY(move.ReMapIndexesSize() == newTableInfo->Indexes.size());
+
+ RemoveUserTable(prevId);
+ AddUserTable(newId, newTableInfo);
+
+ NIceDb::TNiceDb db(txc.DB);
+ PersistMoveUserTable(db, prevId.LocalPathId, newId.LocalPathId, *newTableInfo);
+ PersistOwnerPathId(newId.OwnerId, txc);
+
+ return newTableInfo;
+}
+
TUserTable::TPtr TDataShard::AlterUserTable(const TActorContext& ctx, TTransactionContext& txc,
- const NKikimrSchemeOp::TTableDescription& alter)
+ const NKikimrSchemeOp::TTableDescription& alter)
{
- ui64 tableId = alter.GetId_Deprecated();
- if (alter.HasPathId()) {
- Y_VERIFY(GetPathOwnerId() == alter.GetPathId().GetOwnerId());
- tableId = alter.GetPathId().GetLocalId();
- }
+ ui64 tableId = alter.GetId_Deprecated();
+ if (alter.HasPathId()) {
+ Y_VERIFY(GetPathOwnerId() == alter.GetPathId().GetOwnerId());
+ tableId = alter.GetPathId().GetLocalId();
+ }
TUserTable::TCPtr oldTable = TableInfos[tableId];
Y_VERIFY(oldTable);
@@ -928,7 +928,7 @@ TUserTable::TPtr TDataShard::AlterUserTable(const TActorContext& ctx, TTransacti
if (alter.HasPartitionConfig()) {
// We are going to update table schema and save it
- NKikimrSchemeOp::TTableDescription tableDescr;
+ NKikimrSchemeOp::TTableDescription tableDescr;
tableInfo->GetSchema(tableDescr);
const auto& configDelta = alter.GetPartitionConfig();
@@ -936,7 +936,7 @@ TUserTable::TPtr TDataShard::AlterUserTable(const TActorContext& ctx, TTransacti
if (configDelta.HasFreezeState()) {
auto cmd = configDelta.GetFreezeState();
- State = cmd == NKikimrSchemeOp::EFreezeState::Freeze ? TShardState::Frozen : TShardState::Ready;
+ State = cmd == NKikimrSchemeOp::EFreezeState::Freeze ? TShardState::Frozen : TShardState::Ready;
PersistSys(db, Schema::Sys_State, State);
}
@@ -1059,8 +1059,8 @@ void TDataShard::SnapshotComplete(TIntrusivePtr<NTabletFlatExecutor::TTableSnaps
}
TUserTable::TSpecialUpdate TDataShard::SpecialUpdates(const NTable::TDatabase& db, const TTableId& tableId) const {
- Y_VERIFY(tableId.PathId.OwnerId == PathOwnerId, "%" PRIu64 " vs %" PRIu64,
- tableId.PathId.OwnerId, PathOwnerId);
+ Y_VERIFY(tableId.PathId.OwnerId == PathOwnerId, "%" PRIu64 " vs %" PRIu64,
+ tableId.PathId.OwnerId, PathOwnerId);
auto it = TableInfos.find(tableId.PathId.LocalPathId);
Y_VERIFY(it != TableInfos.end());
@@ -1340,19 +1340,19 @@ void TDataShard::Handle(TEvDataShard::TEvGetShardState::TPtr &ev, const TActorCo
}
void TDataShard::Handle(TEvDataShard::TEvSchemaChangedResult::TPtr& ev, const TActorContext& ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD,
- "Handle TEvSchemaChangedResult " << ev->Get()->Record.GetTxId()
- << " datashard " << TabletID()
- << " state " << DatashardStateName(State));
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD,
+ "Handle TEvSchemaChangedResult " << ev->Get()->Record.GetTxId()
+ << " datashard " << TabletID()
+ << " state " << DatashardStateName(State));
Execute(CreateTxSchemaChanged(ev), ctx);
}
void TDataShard::Handle(TEvDataShard::TEvStateChangedResult::TPtr& ev, const TActorContext& ctx) {
Y_UNUSED(ev);
- LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD,
- "Handle TEvStateChangedResult "
- << " datashard " << TabletID()
- << " state " << DatashardStateName(State));
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD,
+ "Handle TEvStateChangedResult "
+ << " datashard " << TabletID()
+ << " state " << DatashardStateName(State));
// TODO: implement
NTabletPipe::CloseAndForgetClient(SelfId(), StateReportPipe);
}
@@ -1622,15 +1622,15 @@ void TDataShard::ProposeTransaction(TEvDataShard::TEvProposeTransaction::TPtr &&
}
void TDataShard::Handle(TEvTxProcessing::TEvPlanStep::TPtr &ev, const TActorContext &ctx) {
- ui64 srcMediatorId = ev->Get()->Record.GetMediatorID();
- if (!CheckMediatorAuthorisation(srcMediatorId)) {
- LOG_CRIT_S(ctx, NKikimrServices::TX_DATASHARD, "tablet " << TabletID() <<
- " receive PlanStep " << ev->Get()->Record.GetStep() <<
- " from unauthorized mediator " << srcMediatorId);
+ ui64 srcMediatorId = ev->Get()->Record.GetMediatorID();
+ if (!CheckMediatorAuthorisation(srcMediatorId)) {
+ LOG_CRIT_S(ctx, NKikimrServices::TX_DATASHARD, "tablet " << TabletID() <<
+ " receive PlanStep " << ev->Get()->Record.GetStep() <<
+ " from unauthorized mediator " << srcMediatorId);
BecomeBroken(ctx);
return;
- }
-
+ }
+
Execute(new TTxPlanStep(this, ev), ctx);
}
@@ -1655,8 +1655,8 @@ void TDataShard::Handle(TEvTxProcessing::TEvReadSetAck::TPtr &ev, const TActorCo
Pipeline.AddCandidateUnit(EExecutionUnitKind::PlanQueue);
PlanQueue.Progress(ctx);
}
-
- CheckStateChange(ctx);
+
+ CheckStateChange(ctx);
}
void TDataShard::Handle(TEvPrivate::TEvProgressTransaction::TPtr &ev, const TActorContext &ctx) {
@@ -1881,7 +1881,7 @@ void TDataShard::AckRSToDeletedTablet(ui64 tabletId, const TActorContext& ctx) {
PlanQueue.Progress(ctx);
}
}
- CheckStateChange(ctx);
+ CheckStateChange(ctx);
}
void TDataShard::Handle(TEvTabletPipe::TEvServerConnected::TPtr &ev, const TActorContext &ctx) {
@@ -2087,13 +2087,13 @@ void TDataShard::UpdateLastSchemeOpSeqNo(const TSchemeOpSeqNo &newSeqNo,
}
void TDataShard::ResetLastSchemeOpSeqNo(TTransactionContext &txc)
-{
- NIceDb::TNiceDb db(txc.DB);
- LastSchemeOpSeqNo = TSchemeOpSeqNo();
- PersistSys(db, Schema::Sys_LastSchemeShardGeneration, LastSchemeOpSeqNo.Generation);
- PersistSys(db, Schema::Sys_LastSchemeShardRound, LastSchemeOpSeqNo.Round);
-}
-
+{
+ NIceDb::TNiceDb db(txc.DB);
+ LastSchemeOpSeqNo = TSchemeOpSeqNo();
+ PersistSys(db, Schema::Sys_LastSchemeShardGeneration, LastSchemeOpSeqNo.Generation);
+ PersistSys(db, Schema::Sys_LastSchemeShardRound, LastSchemeOpSeqNo.Round);
+}
+
void TDataShard::PersistProcessingParams(const NKikimrSubDomains::TProcessingParams &params,
NTabletFlatExecutor::TTransactionContext &txc)
{
@@ -2108,7 +2108,7 @@ void TDataShard::PersistCurrentSchemeShardId(ui64 id,
NTabletFlatExecutor::TTransactionContext &txc)
{
NIceDb::TNiceDb db(txc.DB);
- CurrentSchemeShardId = id;
+ CurrentSchemeShardId = id;
PersistSys(db, TDataShard::Schema::Sys_CurrentSchemeShardId, id);
}
@@ -2122,13 +2122,13 @@ void TDataShard::PersistSubDomainPathId(ui64 ownerId, ui64 localPathId,
}
void TDataShard::PersistOwnerPathId(ui64 id,
- NTabletFlatExecutor::TTransactionContext &txc)
-{
- NIceDb::TNiceDb db(txc.DB);
- PathOwnerId = id;
+ NTabletFlatExecutor::TTransactionContext &txc)
+{
+ NIceDb::TNiceDb db(txc.DB);
+ PathOwnerId = id;
PersistSys(db, TDataShard::Schema::Sys_PathOwnerId, id);
-}
-
+}
+
void TDataShard::ResolveTablePath(const TActorContext &ctx)
{
if (State != TShardState::Ready)
@@ -2142,10 +2142,10 @@ void TDataShard::ResolveTablePath(const TActorContext &ctx)
if (!TableResolvePipe) {
NTabletPipe::TClientConfig clientConfig;
clientConfig.RetryPolicy = SchemeShardPipeRetryPolicy;
- TableResolvePipe = ctx.Register(NTabletPipe::CreateClient(ctx.SelfID, CurrentSchemeShardId, clientConfig));
+ TableResolvePipe = ctx.Register(NTabletPipe::CreateClient(ctx.SelfID, CurrentSchemeShardId, clientConfig));
}
- auto *event = new TEvSchemeShard::TEvDescribeScheme(PathOwnerId,
+ auto *event = new TEvSchemeShard::TEvDescribeScheme(PathOwnerId,
pathId);
event->Record.MutableOptions()->SetReturnPartitioningInfo(false);
event->Record.MutableOptions()->SetReturnPartitionConfig(false);
@@ -2199,7 +2199,7 @@ void TDataShard::SerializeKeySample(const TUserTable &tinfo,
}
-void TDataShard::Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr ev,
+void TDataShard::Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr ev,
const TActorContext &ctx)
{
const auto &rec = ev->Get()->GetRecord();
@@ -2458,11 +2458,11 @@ void TDataShard::Handle(TEvInterconnect::TEvNodeDisconnected::TPtr &ev,
}
void TDataShard::Handle(TEvDataShard::TEvMigrateSchemeShardRequest::TPtr& ev,
- const TActorContext& ctx)
-{
- Execute(new TTxMigrateSchemeShard(this, ev), ctx);
-}
-
+ const TActorContext& ctx)
+{
+ Execute(new TTxMigrateSchemeShard(this, ev), ctx);
+}
+
void TDataShard::Handle(TEvDataShard::TEvCancelBackup::TPtr& ev, const TActorContext& ctx)
{
TOperation::TPtr op = Pipeline.FindOp(ev->Get()->Record.GetBackupTxId());
diff --git a/ydb/core/tx/datashard/datashard.h b/ydb/core/tx/datashard/datashard.h
index 38cb048af3d..5a93c035026 100644
--- a/ydb/core/tx/datashard/datashard.h
+++ b/ydb/core/tx/datashard/datashard.h
@@ -198,8 +198,8 @@ struct TEvDataShard {
EvSchemaChanged,
EvStateChanged,
EvCancelBackup,
- EvMigrateSchemeShardRequest,
- EvMigrateSchemeShardResponse,
+ EvMigrateSchemeShardRequest,
+ EvMigrateSchemeShardResponse,
EvCancelRestore,
EvInitDataShardResult = EvProposeTransaction + 5 * 512,
@@ -252,7 +252,7 @@ struct TEvDataShard {
EvGetRSInfoResponse,
EvGetDataHistogramRequest,
EvGetDataHistogramResponse,
- EvCancelFillIndex_DEPRECATED,
+ EvCancelFillIndex_DEPRECATED,
EvRefreshVolatileSnapshotRequest,
EvRefreshVolatileSnapshotResponse,
EvDiscardVolatileSnapshotRequest,
@@ -267,9 +267,9 @@ struct TEvDataShard {
EvConditionalEraseRowsRequest,
EvConditionalEraseRowsResponse,
- EvBuildIndexCreateRequest,
- EvBuildIndexProgressResponse,
-
+ EvBuildIndexCreateRequest,
+ EvBuildIndexProgressResponse,
+
EvGetS3DownloadInfo,
EvStoreS3DownloadInfo,
EvS3DownloadInfo,
@@ -364,12 +364,12 @@ struct TEvDataShard {
struct TEvSchemaChangedResult : public TEventPB<TEvSchemaChangedResult, NKikimrTxDataShard::TEvSchemaChangedResult,
TEvDataShard::EvSchemaChangedResult> {
- TEvSchemaChangedResult()
- {}
-
- explicit TEvSchemaChangedResult(ui64 txId) {
- Record.SetTxId(txId);
- }
+ TEvSchemaChangedResult()
+ {}
+
+ explicit TEvSchemaChangedResult(ui64 txId) {
+ Record.SetTxId(txId);
+ }
};
struct TEvStateChanged : public TEventPB<TEvStateChanged, NKikimrTxDataShard::TEvStateChanged,
@@ -433,13 +433,13 @@ struct TEvDataShard {
TEvProposeTransaction(NKikimrTxDataShard::ETransactionKind txKind, ui64 ssId, const TActorId& source, ui64 txId,
const TStringBuf& txBody, const NKikimrSubDomains::TProcessingParams &processingParams, ui32 flags = NDataShard::TTxFlags::Default)
- : TEvProposeTransaction(txKind, source, txId, txBody, flags)
- {
- Y_VERIFY(txKind == NKikimrTxDataShard::TX_KIND_SCHEME);
- Record.SetSchemeShardId(ssId);
- Record.MutableProcessingParams()->CopyFrom(processingParams);
- }
-
+ : TEvProposeTransaction(txKind, source, txId, txBody, flags)
+ {
+ Y_VERIFY(txKind == NKikimrTxDataShard::TX_KIND_SCHEME);
+ Record.SetSchemeShardId(ssId);
+ Record.MutableProcessingParams()->CopyFrom(processingParams);
+ }
+
TEvProposeTransaction(NKikimrTxDataShard::ETransactionKind txKind, ui64 ssId, ui64 subDomainPathId, const TActorId& source, ui64 txId,
const TStringBuf& txBody, const NKikimrSubDomains::TProcessingParams &processingParams, ui32 flags = NDataShard::TTxFlags::Default)
: TEvProposeTransaction(txKind, ssId, source, txId, txBody, processingParams, flags)
@@ -510,10 +510,10 @@ struct TEvDataShard {
Record.SetStatus(NKikimrTxDataShard::TEvProposeTransactionResult::TRY_LATER);
}
- void SetDomainCoordinators(const NKikimrSubDomains::TProcessingParams& params) {
- Record.MutableDomainCoordinators()->CopyFrom(params.GetCoordinators());
- }
-
+ void SetDomainCoordinators(const NKikimrSubDomains::TProcessingParams& params) {
+ Record.MutableDomainCoordinators()->CopyFrom(params.GetCoordinators());
+ }
+
void SetSchemeTxDuplicate(bool sameTxId = true) {
if (sameTxId) {
Record.SetStatus(NKikimrTxDataShard::TEvProposeTransactionResult::PREPARED);
@@ -689,13 +689,13 @@ struct TEvDataShard {
TEvDataShard::EvInitSplitMergeDestination> {
TEvInitSplitMergeDestination() = default;
TEvInitSplitMergeDestination(ui64 opId, ui64 schemeshardTabletId, ui64 subDomainPathId,
- const NKikimrTxDataShard::TSplitMergeDescription &splitDesc,
- const NKikimrSubDomains::TProcessingParams &processingParams) {
+ const NKikimrTxDataShard::TSplitMergeDescription &splitDesc,
+ const NKikimrSubDomains::TProcessingParams &processingParams) {
Record.SetOperationCookie(opId);
Record.SetSchemeshardTabletId(schemeshardTabletId);
Record.SetSubDomainPathId(subDomainPathId);
- Record.MutableSplitDescription()->CopyFrom(splitDesc);
- Record.MutableProcessingParams()->CopyFrom(processingParams);
+ Record.MutableSplitDescription()->CopyFrom(splitDesc);
+ Record.MutableProcessingParams()->CopyFrom(processingParams);
}
};
@@ -804,10 +804,10 @@ struct TEvDataShard {
NKikimrTxDataShard::TEvGetTableStatsResult,
TEvDataShard::EvGetTableStatsResult> {
TEvGetTableStatsResult() = default;
- TEvGetTableStatsResult(ui64 datashardId, ui64 tableOwnerId, ui64 tableLocalId) {
+ TEvGetTableStatsResult(ui64 datashardId, ui64 tableOwnerId, ui64 tableLocalId) {
Record.SetDatashardId(datashardId);
- Record.SetTableOwnerId(tableOwnerId);
- Record.SetTableLocalId(tableLocalId);
+ Record.SetTableOwnerId(tableOwnerId);
+ Record.SetTableLocalId(tableLocalId);
}
};
@@ -815,10 +815,10 @@ struct TEvDataShard {
NKikimrTxDataShard::TEvPeriodicTableStats,
TEvDataShard::EvPeriodicTableStats> {
TEvPeriodicTableStats() = default;
- TEvPeriodicTableStats(ui64 datashardId, ui64 tableOwnerId, ui64 tableLocalId) {
+ TEvPeriodicTableStats(ui64 datashardId, ui64 tableOwnerId, ui64 tableLocalId) {
Record.SetDatashardId(datashardId);
- Record.SetTableOwnerId(tableOwnerId);
- Record.SetTableLocalId(tableLocalId);
+ Record.SetTableOwnerId(tableOwnerId);
+ Record.SetTableLocalId(tableLocalId);
}
};
@@ -1130,24 +1130,24 @@ struct TEvDataShard {
{
using EStatus = NKikimrTxDataShard::TEvDiscardVolatileSnapshotResponse::EStatus;
};
-
- struct TEvMigrateSchemeShardRequest
- : public TEventPB<TEvMigrateSchemeShardRequest,
- NKikimrTxDataShard::TEvMigrateSchemeShardRequest,
- TEvDataShard::EvMigrateSchemeShardRequest>
- {
- ui64 GetDatashardId() const {
- return Record.GetTabletId();
- }
- };
-
- struct TEvMigrateSchemeShardResponse
- : public TEventPB<TEvMigrateSchemeShardResponse,
- NKikimrTxDataShard::TEvMigrateSchemeShardResponse,
- TEvDataShard::EvMigrateSchemeShardResponse>
- {
- using EStatus = NKikimrTxDataShard::TEvMigrateSchemeShardResponse::EStatus;
- };
+
+ struct TEvMigrateSchemeShardRequest
+ : public TEventPB<TEvMigrateSchemeShardRequest,
+ NKikimrTxDataShard::TEvMigrateSchemeShardRequest,
+ TEvDataShard::EvMigrateSchemeShardRequest>
+ {
+ ui64 GetDatashardId() const {
+ return Record.GetTabletId();
+ }
+ };
+
+ struct TEvMigrateSchemeShardResponse
+ : public TEventPB<TEvMigrateSchemeShardResponse,
+ NKikimrTxDataShard::TEvMigrateSchemeShardResponse,
+ TEvDataShard::EvMigrateSchemeShardResponse>
+ {
+ using EStatus = NKikimrTxDataShard::TEvMigrateSchemeShardResponse::EStatus;
+ };
struct TEvGetS3Upload
: public TEventLocal<TEvGetS3Upload, TEvDataShard::EvGetS3Upload>
@@ -1332,20 +1332,20 @@ struct TEvDataShard {
TEvDataShard::EvConditionalEraseRowsResponse>
{
};
-
- struct TEvBuildIndexCreateRequest
- : public TEventPB<TEvBuildIndexCreateRequest,
- NKikimrTxDataShard::TEvBuildIndexCreateRequest,
- TEvDataShard::EvBuildIndexCreateRequest>
- {
- };
-
- struct TEvBuildIndexProgressResponse
- : public TEventPB<TEvBuildIndexProgressResponse,
- NKikimrTxDataShard::TEvBuildIndexProgressResponse,
- TEvDataShard::EvBuildIndexProgressResponse>
- {
- };
+
+ struct TEvBuildIndexCreateRequest
+ : public TEventPB<TEvBuildIndexCreateRequest,
+ NKikimrTxDataShard::TEvBuildIndexCreateRequest,
+ TEvDataShard::EvBuildIndexCreateRequest>
+ {
+ };
+
+ struct TEvBuildIndexProgressResponse
+ : public TEventPB<TEvBuildIndexProgressResponse,
+ NKikimrTxDataShard::TEvBuildIndexProgressResponse,
+ TEvDataShard::EvBuildIndexProgressResponse>
+ {
+ };
struct TEvKqpScan
: public TEventPB<TEvKqpScan,
diff --git a/ydb/core/tx/datashard/datashard__build_index.cpp b/ydb/core/tx/datashard/datashard__build_index.cpp
index d374ff53924..5aebf94dc51 100644
--- a/ydb/core/tx/datashard/datashard__build_index.cpp
+++ b/ydb/core/tx/datashard/datashard__build_index.cpp
@@ -1,175 +1,175 @@
-#include "datashard_impl.h"
-#include "upload_stats.h"
-#include "range_ops.h"
-#include "datashard_build_index.h"
-
+#include "datashard_impl.h"
+#include "upload_stats.h"
+#include "range_ops.h"
+#include "datashard_build_index.h"
+
#include <ydb/core/base/appdata.h>
#include <ydb/core/base/counters.h>
#include <ydb/core/scheme/scheme_tablecell.h>
#include <ydb/core/tablet_flat/flat_row_state.h>
-
+
#include <ydb/core/tx/tx_proxy/proxy.h>
#include <ydb/core/tx/tx_proxy/upload_rows.h>
-
+
#include <ydb/library/yql/public/issue/yql_issue_message.h>
-
-#include <util/generic/algorithm.h>
-#include <util/string/builder.h>
-
-namespace NKikimr {
+
+#include <util/generic/algorithm.h>
+#include <util/string/builder.h>
+
+namespace NKikimr {
namespace NDataShard {
-
-using TColumnsTags = THashMap<TString, NTable::TTag>;
-using TColumnsTypes = THashMap<TString, NScheme::TTypeId>;
-
-using TTypes = TVector<std::pair<TString, Ydb::Type>>;
-using TTags = TVector<NTable::TTag>;
-
-using TRows = TVector<std::pair<TSerializedCellVec, TString>>;
-
+
+using TColumnsTags = THashMap<TString, NTable::TTag>;
+using TColumnsTypes = THashMap<TString, NScheme::TTypeId>;
+
+using TTypes = TVector<std::pair<TString, Ydb::Type>>;
+using TTags = TVector<NTable::TTag>;
+
+using TRows = TVector<std::pair<TSerializedCellVec, TString>>;
+
static TColumnsTags GetAllTags(const TUserTable::TCPtr tableInfo) {
- TColumnsTags result;
-
- for (const auto& it: tableInfo->Columns) {
- result[it.second.Name] = it.first;
- }
-
- return result;
-}
-
+ TColumnsTags result;
+
+ for (const auto& it: tableInfo->Columns) {
+ result[it.second.Name] = it.first;
+ }
+
+ return result;
+}
+
static TColumnsTypes GetAllTypes(const TUserTable::TCPtr tableInfo) {
- TColumnsTypes result;
-
- for (const auto& it: tableInfo->Columns) {
- result[it.second.Name] = it.second.Type;
- }
-
- return result;
-}
-
+ TColumnsTypes result;
+
+ for (const auto& it: tableInfo->Columns) {
+ result[it.second.Name] = it.second.Type;
+ }
+
+ return result;
+}
+
static TTags BuildTags(const TColumnsTags& allTags, const TVector<TString>& indexColumns, const TVector<TString>& dataColumns) {
- TTags result;
+ TTags result;
result.reserve(indexColumns.size());
-
+
for (const auto& colName: indexColumns) {
- result.push_back(allTags.at(colName));
- }
-
+ result.push_back(allTags.at(colName));
+ }
+
for (const auto& colName: dataColumns) {
result.push_back(allTags.at(colName));
}
- return result;
-}
-
-
+ return result;
+}
+
+
static std::shared_ptr<TTypes> BuildTypes(const TColumnsTypes& types, const TVector<TString>& indexColumns, const TVector<TString>& dataColumns) {
auto result = std::make_shared<TTypes>();
result->reserve(indexColumns.size());
-
+
for (const auto& colName: indexColumns) {
- Ydb::Type type;
- type.set_type_id(static_cast<Ydb::Type_PrimitiveTypeId>(types.at(colName)));
+ Ydb::Type type;
+ type.set_type_id(static_cast<Ydb::Type_PrimitiveTypeId>(types.at(colName)));
result->emplace_back(colName, type);
- }
-
+ }
+
for (const auto& colName: dataColumns) {
Ydb::Type type;
type.set_type_id(static_cast<Ydb::Type_PrimitiveTypeId>(types.at(colName)));
result->emplace_back(colName, type);
}
- return result;
-}
-
-struct TStatus {
- Ydb::StatusIds::StatusCode StatusCode = Ydb::StatusIds::STATUS_CODE_UNSPECIFIED;
- NYql::TIssues Issues;
-
- bool IsNone() const {
- return StatusCode == Ydb::StatusIds::STATUS_CODE_UNSPECIFIED;
- }
-
- bool IsSuccess() const {
- return StatusCode == Ydb::StatusIds::SUCCESS;
- }
-
- bool IsRetriable() const {
- return StatusCode == Ydb::StatusIds::UNAVAILABLE || StatusCode == Ydb::StatusIds::OVERLOADED;
- }
-
- TString ToString() const {
- return TStringBuilder()
- << "Status {"
- << " Code: " << Ydb::StatusIds_StatusCode_Name(StatusCode)
- << " Issues: " << Issues.ToString()
- << " }";
- }
-};
-
-struct TUploadLimits {
+ return result;
+}
+
+struct TStatus {
+ Ydb::StatusIds::StatusCode StatusCode = Ydb::StatusIds::STATUS_CODE_UNSPECIFIED;
+ NYql::TIssues Issues;
+
+ bool IsNone() const {
+ return StatusCode == Ydb::StatusIds::STATUS_CODE_UNSPECIFIED;
+ }
+
+ bool IsSuccess() const {
+ return StatusCode == Ydb::StatusIds::SUCCESS;
+ }
+
+ bool IsRetriable() const {
+ return StatusCode == Ydb::StatusIds::UNAVAILABLE || StatusCode == Ydb::StatusIds::OVERLOADED;
+ }
+
+ TString ToString() const {
+ return TStringBuilder()
+ << "Status {"
+ << " Code: " << Ydb::StatusIds_StatusCode_Name(StatusCode)
+ << " Issues: " << Issues.ToString()
+ << " }";
+ }
+};
+
+struct TUploadLimits {
ui64 BatchRowsLimit = 500;
ui64 BatchBytesLimit = 1u << 23; // 8MB
- ui32 MaxUploadRowsRetryCount = 50;
+ ui32 MaxUploadRowsRetryCount = 50;
ui32 BackoffCeiling = 3;
-
- TDuration GetTimeoutBackouff(ui32 retryNo) const {
- return TDuration::Seconds(1u << Max(retryNo, BackoffCeiling));
- }
-};
-
+
+ TDuration GetTimeoutBackouff(ui32 retryNo) const {
+ return TDuration::Seconds(1u << Max(retryNo, BackoffCeiling));
+ }
+};
+
class TBufferData : public IStatHolder, public TNonCopyable {
public:
TBufferData()
: Rows(new TRows)
{ }
-
- ui64 GetRows() const override final {
+
+ ui64 GetRows() const override final {
return Rows->size();
- }
-
+ }
+
std::shared_ptr<TRows> GetRowsData() const {
return Rows;
}
- ui64 GetBytes() const override final {
- return ByteSize;
- }
-
- void FlushTo(TBufferData& other) {
- if (this == &other) {
- return;
- }
-
+ ui64 GetBytes() const override final {
+ return ByteSize;
+ }
+
+ void FlushTo(TBufferData& other) {
+ if (this == &other) {
+ return;
+ }
+
Y_VERIFY(other.Rows);
- Y_VERIFY(other.IsEmpty());
-
+ Y_VERIFY(other.IsEmpty());
+
other.Rows.swap(Rows);
- other.ByteSize = ByteSize;
- other.LastKey = std::move(LastKey);
-
- Clear();
- }
-
- void Clear() {
+ other.ByteSize = ByteSize;
+ other.LastKey = std::move(LastKey);
+
+ Clear();
+ }
+
+ void Clear() {
Rows->clear();
- ByteSize = 0;
- LastKey = {};
- }
-
+ ByteSize = 0;
+ LastKey = {};
+ }
+
void AddRow(TSerializedCellVec&& key, TSerializedCellVec&& targetPk, TString&& targetValue) {
Rows->emplace_back(std::move(targetPk), std::move(targetValue));
ByteSize += Rows->back().first.GetBuffer().size() + Rows->back().second.size();
- LastKey = std::move(key);
- }
-
- bool IsEmpty() const {
+ LastKey = std::move(key);
+ }
+
+ bool IsEmpty() const {
return Rows->empty();
- }
-
- bool IsReachLimits(const TUploadLimits& Limits) {
+ }
+
+ bool IsReachLimits(const TUploadLimits& Limits) {
return Rows->size() >= Limits.BatchRowsLimit || ByteSize > Limits.BatchBytesLimit;
- }
+ }
void ExtractLastKey(TSerializedCellVec& out) {
out = std::move(LastKey);
@@ -183,217 +183,217 @@ private:
std::shared_ptr<TRows> Rows;
ui64 ByteSize = 0;
TSerializedCellVec LastKey;
-};
-
-class TBuildIndexScan : public TActor<TBuildIndexScan>, public NTable::IScan {
- const TUploadLimits Limits;
-
- const ui64 BuildIndexId;
- const TString TargetTable;
- const TBuildIndexRecord::TSeqNo SeqNo;
-
- const ui64 DataShardId;
+};
+
+class TBuildIndexScan : public TActor<TBuildIndexScan>, public NTable::IScan {
+ const TUploadLimits Limits;
+
+ const ui64 BuildIndexId;
+ const TString TargetTable;
+ const TBuildIndexRecord::TSeqNo SeqNo;
+
+ const ui64 DataShardId;
const TActorId DatashardActorId;
const TActorId SchemeShardActorID;
-
+
const TTags ScanTags; // first: columns we scan, order as in IndexTable
const std::shared_ptr<TTypes> UploadColumnsTypes; // columns types we upload to indexTable
const ui32 TargetDataColumnPos; // positon of first data column in target table
-
- const TTags KeyColumnIds;
- const TVector<NScheme::TTypeId> KeyTypes;
-
- const TSerializedTableRange TableRange;
- const TSerializedTableRange RequestedRange;
-
- IDriver* Driver = nullptr;
-
- TBufferData ReadBuf;
- TBufferData WriteBuf;
- TSerializedCellVec LastUploadedKey;
-
+
+ const TTags KeyColumnIds;
+ const TVector<NScheme::TTypeId> KeyTypes;
+
+ const TSerializedTableRange TableRange;
+ const TSerializedTableRange RequestedRange;
+
+ IDriver* Driver = nullptr;
+
+ TBufferData ReadBuf;
+ TBufferData WriteBuf;
+ TSerializedCellVec LastUploadedKey;
+
TActorId Uploader;
- ui64 RetryCount = 0;
-
- TUploadMonStats Stats = TUploadMonStats("tablets", "build_index_upload");
- TStatus UploadStatus;
-
-public:
- static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
- return NKikimrServices::TActivity::BUILD_INDEX_SCAN_ACTOR;
- }
-
- TBuildIndexScan(ui64 buildIndexId,
- const TString& target,
- const TBuildIndexRecord::TSeqNo& seqNo,
- ui64 dataShardId,
+ ui64 RetryCount = 0;
+
+ TUploadMonStats Stats = TUploadMonStats("tablets", "build_index_upload");
+ TStatus UploadStatus;
+
+public:
+ static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
+ return NKikimrServices::TActivity::BUILD_INDEX_SCAN_ACTOR;
+ }
+
+ TBuildIndexScan(ui64 buildIndexId,
+ const TString& target,
+ const TBuildIndexRecord::TSeqNo& seqNo,
+ ui64 dataShardId,
const TActorId& datashardActorId,
const TActorId& schemeshardActorId,
- const TSerializedTableRange& range,
+ const TSerializedTableRange& range,
const TVector<TString> targetIndexColumns,
const TVector<TString> targetDataColumns,
TUserTable::TCPtr tableInfo,
- TUploadLimits limits)
- : TActor(&TThis::StateWork)
- , Limits(limits)
- , BuildIndexId(buildIndexId)
- , TargetTable(target)
- , SeqNo(seqNo)
- , DataShardId(dataShardId)
- , DatashardActorId(datashardActorId)
- , SchemeShardActorID(schemeshardActorId)
+ TUploadLimits limits)
+ : TActor(&TThis::StateWork)
+ , Limits(limits)
+ , BuildIndexId(buildIndexId)
+ , TargetTable(target)
+ , SeqNo(seqNo)
+ , DataShardId(dataShardId)
+ , DatashardActorId(datashardActorId)
+ , SchemeShardActorID(schemeshardActorId)
, ScanTags(BuildTags(GetAllTags(tableInfo), targetIndexColumns, targetDataColumns))
, UploadColumnsTypes(BuildTypes(GetAllTypes(tableInfo), targetIndexColumns, targetDataColumns))
, TargetDataColumnPos(targetIndexColumns.size())
- , KeyColumnIds(tableInfo->KeyColumnIds)
- , KeyTypes(tableInfo->KeyColumnTypes)
- , TableRange(tableInfo->Range)
- , RequestedRange(range)
- {
- }
-
- ~TBuildIndexScan() override = default;
-
+ , KeyColumnIds(tableInfo->KeyColumnIds)
+ , KeyTypes(tableInfo->KeyColumnTypes)
+ , TableRange(tableInfo->Range)
+ , RequestedRange(range)
+ {
+ }
+
+ ~TBuildIndexScan() override = default;
+
THello Prepare(IDriver* driver, TIntrusiveConstPtr<TScheme>) noexcept override {
auto selfActorId = TActivationContext::AsActorContext().RegisterWithSameMailbox(this);
- auto ctx = TActivationContext::AsActorContext().MakeFor(selfActorId);
-
- LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD,
- "Prepared " << Debug());
-
- Driver = driver;
-
- return { EScan::Feed, { } };
- }
-
- EScan Seek(TLead& lead, ui64 seq) noexcept override {
- auto ctx = TActivationContext::AsActorContext().MakeFor(SelfId());
- LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD,
- "Seek no " << seq << " " << Debug());
- if (seq) {
- if (!WriteBuf.IsEmpty()) {
- return EScan::Sleep;
- }
-
- if (!ReadBuf.IsEmpty()) {
- ReadBuf.FlushTo(WriteBuf);
- Upload();
- return EScan::Sleep;
- }
-
- if (UploadStatus.IsNone()) {
- UploadStatus.StatusCode = Ydb::StatusIds::SUCCESS;
- UploadStatus.Issues.AddIssue(NYql::TIssue("Shard or requested range is empty"));
- }
-
- return EScan::Final;
- }
-
- auto scanRange = Intersect(KeyTypes, RequestedRange.ToTableRange(), TableRange.ToTableRange());
-
- if (bool(scanRange.From)) {
- auto seek = scanRange.InclusiveFrom ? NTable::ESeek::Lower : NTable::ESeek::Upper;
- lead.To(ScanTags, scanRange.From, seek);
- } else {
- lead.To(ScanTags, { }, NTable::ESeek::Lower);
- }
-
- if (bool(scanRange.To)) {
- lead.Until(scanRange.To, scanRange.InclusiveTo);
- }
-
- return EScan::Feed;
- }
-
- EScan Feed(TArrayRef<const TCell> key, const TRow& row) noexcept override {
- auto ctx = TActivationContext::AsActorContext().MakeFor(SelfId());
+ auto ctx = TActivationContext::AsActorContext().MakeFor(selfActorId);
+
LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD,
- "Feed key " << DebugPrintPoint(KeyTypes, key, *AppData()->TypeRegistry)
- << " " << Debug());
-
+ "Prepared " << Debug());
+
+ Driver = driver;
+
+ return { EScan::Feed, { } };
+ }
+
+ EScan Seek(TLead& lead, ui64 seq) noexcept override {
+ auto ctx = TActivationContext::AsActorContext().MakeFor(SelfId());
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD,
+ "Seek no " << seq << " " << Debug());
+ if (seq) {
+ if (!WriteBuf.IsEmpty()) {
+ return EScan::Sleep;
+ }
+
+ if (!ReadBuf.IsEmpty()) {
+ ReadBuf.FlushTo(WriteBuf);
+ Upload();
+ return EScan::Sleep;
+ }
+
+ if (UploadStatus.IsNone()) {
+ UploadStatus.StatusCode = Ydb::StatusIds::SUCCESS;
+ UploadStatus.Issues.AddIssue(NYql::TIssue("Shard or requested range is empty"));
+ }
+
+ return EScan::Final;
+ }
+
+ auto scanRange = Intersect(KeyTypes, RequestedRange.ToTableRange(), TableRange.ToTableRange());
+
+ if (bool(scanRange.From)) {
+ auto seek = scanRange.InclusiveFrom ? NTable::ESeek::Lower : NTable::ESeek::Upper;
+ lead.To(ScanTags, scanRange.From, seek);
+ } else {
+ lead.To(ScanTags, { }, NTable::ESeek::Lower);
+ }
+
+ if (bool(scanRange.To)) {
+ lead.Until(scanRange.To, scanRange.InclusiveTo);
+ }
+
+ return EScan::Feed;
+ }
+
+ EScan Feed(TArrayRef<const TCell> key, const TRow& row) noexcept override {
+ auto ctx = TActivationContext::AsActorContext().MakeFor(SelfId());
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD,
+ "Feed key " << DebugPrintPoint(KeyTypes, key, *AppData()->TypeRegistry)
+ << " " << Debug());
+
const TConstArrayRef<TCell> rowCells = *row;
-
+
ReadBuf.AddRow(TSerializedCellVec(TSerializedCellVec::Serialize(key)),
TSerializedCellVec(TSerializedCellVec::Serialize(rowCells.Slice(0, TargetDataColumnPos))),
TSerializedCellVec::Serialize(rowCells.Slice(TargetDataColumnPos)));
- if (!ReadBuf.IsReachLimits(Limits)) {
- return EScan::Feed;
- }
-
- if (!WriteBuf.IsEmpty()) {
- return EScan::Sleep;
- }
-
- ReadBuf.FlushTo(WriteBuf);
-
- Upload();
-
- return EScan::Feed;
- }
-
+ if (!ReadBuf.IsReachLimits(Limits)) {
+ return EScan::Feed;
+ }
+
+ if (!WriteBuf.IsEmpty()) {
+ return EScan::Sleep;
+ }
+
+ ReadBuf.FlushTo(WriteBuf);
+
+ Upload();
+
+ return EScan::Feed;
+ }
+
TAutoPtr<IDestructable> Finish(EAbort abort) noexcept override {
- auto ctx = TActivationContext::AsActorContext().MakeFor(SelfId());
-
- if (Uploader) {
- TAutoPtr<TEvents::TEvPoisonPill> poison
- = new TEvents::TEvPoisonPill;
- ctx.Send(Uploader, poison.Release());
- Uploader = {};
- }
-
- TAutoPtr<TEvDataShard::TEvBuildIndexProgressResponse> progress
- = new TEvDataShard::TEvBuildIndexProgressResponse;
- progress->Record.SetBuildIndexId(BuildIndexId);
- progress->Record.SetTabletId(DataShardId);
- progress->Record.SetRequestSeqNoGeneration(SeqNo.Generation);
- progress->Record.SetRequestSeqNoRound(SeqNo.Round);
-
- if (abort != EAbort::None) {
- progress->Record.SetStatus(NKikimrTxDataShard::TEvBuildIndexProgressResponse::ABORTED);
- UploadStatus.Issues.AddIssue(NYql::TIssue("Aborted by scan host env"));
-
- LOG_WARN_S(ctx, NKikimrServices::TX_DATASHARD,
- Debug());
- } else if (!UploadStatus.IsSuccess()) {
- progress->Record.SetStatus(NKikimrTxDataShard::TEvBuildIndexProgressResponse::BUILD_ERROR);
- } else {
- progress->Record.SetStatus(NKikimrTxDataShard::TEvBuildIndexProgressResponse::DONE);
- }
-
- UploadStatusToMessage(progress->Record);
-
- ctx.Send(SchemeShardActorID, progress.Release());;
-
- LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD,
- "Finish " << Debug());
-
- Driver = nullptr;
- PassAway();
- return nullptr;
- }
-
- void UploadStatusToMessage(NKikimrTxDataShard::TEvBuildIndexProgressResponse& msg) {
- msg.SetUploadStatus(UploadStatus.StatusCode);
- NYql::IssuesToMessage(UploadStatus.Issues, msg.MutableIssues());
- }
-
- void Describe(IOutputStream& out) const noexcept override {
- out << Debug();
- }
-
- TString Debug() const {
- TStringBuilder result;
- result << "TBuildIndexScan: "
- << ", datashard: " << DataShardId
- << ", requested range: " << DebugPrintRange(KeyTypes, RequestedRange.ToTableRange(), *AppData()->TypeRegistry)
- << ", last acked point: " << DebugPrintPoint(KeyTypes, LastUploadedKey.GetCells(), *AppData()->TypeRegistry)
- << Stats.ToString()
- << UploadStatus.ToString();
- return result;
- }
-
- EScan PageFault() noexcept override {
+ auto ctx = TActivationContext::AsActorContext().MakeFor(SelfId());
+
+ if (Uploader) {
+ TAutoPtr<TEvents::TEvPoisonPill> poison
+ = new TEvents::TEvPoisonPill;
+ ctx.Send(Uploader, poison.Release());
+ Uploader = {};
+ }
+
+ TAutoPtr<TEvDataShard::TEvBuildIndexProgressResponse> progress
+ = new TEvDataShard::TEvBuildIndexProgressResponse;
+ progress->Record.SetBuildIndexId(BuildIndexId);
+ progress->Record.SetTabletId(DataShardId);
+ progress->Record.SetRequestSeqNoGeneration(SeqNo.Generation);
+ progress->Record.SetRequestSeqNoRound(SeqNo.Round);
+
+ if (abort != EAbort::None) {
+ progress->Record.SetStatus(NKikimrTxDataShard::TEvBuildIndexProgressResponse::ABORTED);
+ UploadStatus.Issues.AddIssue(NYql::TIssue("Aborted by scan host env"));
+
+ LOG_WARN_S(ctx, NKikimrServices::TX_DATASHARD,
+ Debug());
+ } else if (!UploadStatus.IsSuccess()) {
+ progress->Record.SetStatus(NKikimrTxDataShard::TEvBuildIndexProgressResponse::BUILD_ERROR);
+ } else {
+ progress->Record.SetStatus(NKikimrTxDataShard::TEvBuildIndexProgressResponse::DONE);
+ }
+
+ UploadStatusToMessage(progress->Record);
+
+ ctx.Send(SchemeShardActorID, progress.Release());;
+
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD,
+ "Finish " << Debug());
+
+ Driver = nullptr;
+ PassAway();
+ return nullptr;
+ }
+
+ void UploadStatusToMessage(NKikimrTxDataShard::TEvBuildIndexProgressResponse& msg) {
+ msg.SetUploadStatus(UploadStatus.StatusCode);
+ NYql::IssuesToMessage(UploadStatus.Issues, msg.MutableIssues());
+ }
+
+ void Describe(IOutputStream& out) const noexcept override {
+ out << Debug();
+ }
+
+ TString Debug() const {
+ TStringBuilder result;
+ result << "TBuildIndexScan: "
+ << ", datashard: " << DataShardId
+ << ", requested range: " << DebugPrintRange(KeyTypes, RequestedRange.ToTableRange(), *AppData()->TypeRegistry)
+ << ", last acked point: " << DebugPrintPoint(KeyTypes, LastUploadedKey.GetCells(), *AppData()->TypeRegistry)
+ << Stats.ToString()
+ << UploadStatus.ToString();
+ return result;
+ }
+
+ EScan PageFault() noexcept override {
auto ctx = TActivationContext::AsActorContext().MakeFor(SelfId());
LOG_TRACE_S(ctx, NKikimrServices::TX_DATASHARD,
@@ -406,266 +406,266 @@ public:
return EScan::Feed;
}
- if (WriteBuf.IsEmpty()) {
- ReadBuf.FlushTo(WriteBuf);
- Upload();
- }
-
- return EScan::Feed;
- }
-
-private:
- STFUNC(StateWork) {
- switch (ev->GetTypeRewrite()) {
- HFunc(TEvTxUserProxy::TEvUploadRowsResponse, Handle);
- CFunc(TEvents::TSystem::Wakeup, HandleWakeup)
- default:
- LOG_ERROR(ctx, NKikimrServices::TX_DATASHARD,
- "TBuildIndexScan: StateWork unexpected event type: %" PRIx32 " event: %s",
- ev->GetTypeRewrite(), ev->HasEvent() ? ev->GetBase()->ToString().c_str() : "serialized?");
- }
- }
-
- void HandleWakeup(const NActors::TActorContext& ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD,
- "Retry upload " << Debug());
-
- if (!WriteBuf.IsEmpty()) {
- RetryUpload();
- }
- }
-
- void Handle(TEvTxUserProxy::TEvUploadRowsResponse::TPtr& ev, const TActorContext& ctx) {
- LOG_TRACE_S(ctx, NKikimrServices::TX_DATASHARD,
- "Handle TEvUploadRowsResponse"
- << " " << Debug()
- << " Uploader: " << Uploader.ToString()
- << " ev->Sender: " << ev->Sender.ToString());
-
- if (Uploader) {
- Y_VERIFY_S(Uploader == ev->Sender,
- "Mismatch"
- << " Uploader: " << Uploader.ToString()
- << " ev->Sender: " << ev->Sender.ToString());
- } else {
- Y_VERIFY(Driver == nullptr);
- return;
- }
-
- UploadStatus.StatusCode = ev->Get()->Status;
- UploadStatus.Issues.AddIssues(ev->Get()->Issues);
-
- if (UploadStatus.IsSuccess()) {
- Stats.Aggr(&WriteBuf);
+ if (WriteBuf.IsEmpty()) {
+ ReadBuf.FlushTo(WriteBuf);
+ Upload();
+ }
+
+ return EScan::Feed;
+ }
+
+private:
+ STFUNC(StateWork) {
+ switch (ev->GetTypeRewrite()) {
+ HFunc(TEvTxUserProxy::TEvUploadRowsResponse, Handle);
+ CFunc(TEvents::TSystem::Wakeup, HandleWakeup)
+ default:
+ LOG_ERROR(ctx, NKikimrServices::TX_DATASHARD,
+ "TBuildIndexScan: StateWork unexpected event type: %" PRIx32 " event: %s",
+ ev->GetTypeRewrite(), ev->HasEvent() ? ev->GetBase()->ToString().c_str() : "serialized?");
+ }
+ }
+
+ void HandleWakeup(const NActors::TActorContext& ctx) {
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD,
+ "Retry upload " << Debug());
+
+ if (!WriteBuf.IsEmpty()) {
+ RetryUpload();
+ }
+ }
+
+ void Handle(TEvTxUserProxy::TEvUploadRowsResponse::TPtr& ev, const TActorContext& ctx) {
+ LOG_TRACE_S(ctx, NKikimrServices::TX_DATASHARD,
+ "Handle TEvUploadRowsResponse"
+ << " " << Debug()
+ << " Uploader: " << Uploader.ToString()
+ << " ev->Sender: " << ev->Sender.ToString());
+
+ if (Uploader) {
+ Y_VERIFY_S(Uploader == ev->Sender,
+ "Mismatch"
+ << " Uploader: " << Uploader.ToString()
+ << " ev->Sender: " << ev->Sender.ToString());
+ } else {
+ Y_VERIFY(Driver == nullptr);
+ return;
+ }
+
+ UploadStatus.StatusCode = ev->Get()->Status;
+ UploadStatus.Issues.AddIssues(ev->Get()->Issues);
+
+ if (UploadStatus.IsSuccess()) {
+ Stats.Aggr(&WriteBuf);
WriteBuf.ExtractLastKey(LastUploadedKey);
-
- //send progress
- TAutoPtr<TEvDataShard::TEvBuildIndexProgressResponse> progress
- = new TEvDataShard::TEvBuildIndexProgressResponse;
- progress->Record.SetBuildIndexId(BuildIndexId);
- progress->Record.SetTabletId(DataShardId);
- progress->Record.SetRequestSeqNoGeneration(SeqNo.Generation);
- progress->Record.SetRequestSeqNoRound(SeqNo.Round);
-
- progress->Record.SetLastKeyAck(TSerializedCellVec::Serialize(LastUploadedKey.GetCells()));
- progress->Record.SetRowsDelta(WriteBuf.GetRows());
- progress->Record.SetBytesDelta(WriteBuf.GetBytes());
- WriteBuf.Clear();
-
- progress->Record.SetStatus(NKikimrTxDataShard::TEvBuildIndexProgressResponse::INPROGRESS);
- UploadStatusToMessage(progress->Record);
-
- ctx.Send(SchemeShardActorID, progress.Release());
-
- if (!ReadBuf.IsEmpty() && ReadBuf.IsReachLimits(Limits)) {
- ReadBuf.FlushTo(WriteBuf);
- Upload();
- }
-
- Driver->Touch(EScan::Feed);
- return;
- }
-
- if (RetryCount < Limits.MaxUploadRowsRetryCount && UploadStatus.IsRetriable()) {
- LOG_NOTICE_S(ctx, NKikimrServices::TX_DATASHARD,
- "Got retriable error, " << Debug());
-
- ctx.Schedule(Limits.GetTimeoutBackouff(RetryCount), new TEvents::TEvWakeup());
- return;
- }
-
- LOG_NOTICE_S(ctx, NKikimrServices::TX_DATASHARD,
- "Got error, abort scan, " << Debug());
-
- Driver->Touch(EScan::Final);
- }
-
- void RetryUpload() {
- Upload(true);
- }
-
- void Upload(bool isRetry = false) {
- if (isRetry) {
- ++RetryCount;
- } else {
- RetryCount = 0;
- }
-
- auto ctx = TActivationContext::AsActorContext().MakeFor(SelfId());
- LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD,
+
+ //send progress
+ TAutoPtr<TEvDataShard::TEvBuildIndexProgressResponse> progress
+ = new TEvDataShard::TEvBuildIndexProgressResponse;
+ progress->Record.SetBuildIndexId(BuildIndexId);
+ progress->Record.SetTabletId(DataShardId);
+ progress->Record.SetRequestSeqNoGeneration(SeqNo.Generation);
+ progress->Record.SetRequestSeqNoRound(SeqNo.Round);
+
+ progress->Record.SetLastKeyAck(TSerializedCellVec::Serialize(LastUploadedKey.GetCells()));
+ progress->Record.SetRowsDelta(WriteBuf.GetRows());
+ progress->Record.SetBytesDelta(WriteBuf.GetBytes());
+ WriteBuf.Clear();
+
+ progress->Record.SetStatus(NKikimrTxDataShard::TEvBuildIndexProgressResponse::INPROGRESS);
+ UploadStatusToMessage(progress->Record);
+
+ ctx.Send(SchemeShardActorID, progress.Release());
+
+ if (!ReadBuf.IsEmpty() && ReadBuf.IsReachLimits(Limits)) {
+ ReadBuf.FlushTo(WriteBuf);
+ Upload();
+ }
+
+ Driver->Touch(EScan::Feed);
+ return;
+ }
+
+ if (RetryCount < Limits.MaxUploadRowsRetryCount && UploadStatus.IsRetriable()) {
+ LOG_NOTICE_S(ctx, NKikimrServices::TX_DATASHARD,
+ "Got retriable error, " << Debug());
+
+ ctx.Schedule(Limits.GetTimeoutBackouff(RetryCount), new TEvents::TEvWakeup());
+ return;
+ }
+
+ LOG_NOTICE_S(ctx, NKikimrServices::TX_DATASHARD,
+ "Got error, abort scan, " << Debug());
+
+ Driver->Touch(EScan::Final);
+ }
+
+ void RetryUpload() {
+ Upload(true);
+ }
+
+ void Upload(bool isRetry = false) {
+ if (isRetry) {
+ ++RetryCount;
+ } else {
+ RetryCount = 0;
+ }
+
+ auto ctx = TActivationContext::AsActorContext().MakeFor(SelfId());
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD,
"Upload, last key " << DebugPrintPoint(KeyTypes, WriteBuf.GetLastKey().GetCells(), *AppData()->TypeRegistry)
- << " " << Debug());
-
- auto actor = NTxProxy::CreateUploadRowsInternal(
- SelfId(), TargetTable,
+ << " " << Debug());
+
+ auto actor = NTxProxy::CreateUploadRowsInternal(
+ SelfId(), TargetTable,
UploadColumnsTypes,
WriteBuf.GetRowsData(),
- NTxProxy::EUploadRowsMode::WriteToTableShadow,
- true /*writeToPrivateTable*/);
-
- Uploader = TActivationContext::AsActorContext().MakeFor(SelfId()).Register(actor);
- }
-};
-
+ NTxProxy::EUploadRowsMode::WriteToTableShadow,
+ true /*writeToPrivateTable*/);
+
+ Uploader = TActivationContext::AsActorContext().MakeFor(SelfId()).Register(actor);
+ }
+};
+
TAutoPtr<NTable::IScan> CreateBuildIndexScan(
- ui64 buildIndexId,
- TString target,
- const TBuildIndexRecord::TSeqNo& seqNo,
- ui64 dataShardId,
+ ui64 buildIndexId,
+ TString target,
+ const TBuildIndexRecord::TSeqNo& seqNo,
+ ui64 dataShardId,
const TActorId& datashardActorId,
const TActorId& schemeshardActorId,
- const TSerializedTableRange& range,
+ const TSerializedTableRange& range,
const TVector<TString>& targetIndexColumns,
const TVector<TString>& targetDataColumns,
TUserTable::TCPtr tableInfo,
- TUploadLimits limits)
-{
- return new TBuildIndexScan(
+ TUploadLimits limits)
+{
+ return new TBuildIndexScan(
buildIndexId, target, seqNo, dataShardId, datashardActorId, schemeshardActorId, range, targetIndexColumns, targetDataColumns, tableInfo, limits);
-}
-
-
+}
+
+
void TDataShard::Handle(TEvDataShard::TEvBuildIndexCreateRequest::TPtr& ev, const TActorContext& ctx) {
- const auto& record = ev->Get()->Record;
-
- auto response = MakeHolder<TEvDataShard::TEvBuildIndexProgressResponse>();
- response->Record.SetBuildIndexId(record.GetBuildIndexId());
- response->Record.SetTabletId(TabletID());
- response->Record.SetStatus(NKikimrTxDataShard::TEvBuildIndexProgressResponse::ACCEPTED);
-
- TBuildIndexRecord::TSeqNo seqNo = {record.GetSeqNoGeneration(), record.GetSeqNoRound()};
- response->Record.SetRequestSeqNoGeneration(seqNo.Generation);
- response->Record.SetRequestSeqNoRound(seqNo.Round);
-
- auto badRequest = [&] (const TString& error) {
- response->Record.SetStatus(NKikimrTxDataShard::TEvBuildIndexProgressResponse::BAD_REQUEST);
- auto issue = response->Record.AddIssues();
- issue->set_severity(NYql::TSeverityIds::S_ERROR);
- issue->set_message(error);
- };
-
- const ui64 buildIndexId = record.GetBuildIndexId();
- const ui64 shardId = record.GetTabletId();
- const auto tableId = TTableId(record.GetOwnerId(), record.GetPathId());
-
- if (shardId != TabletID()) {
- badRequest(TStringBuilder() << "Wrong shard " << shardId << " this is " << TabletID());
- ctx.Send(ev->Sender, std::move(response));
- return;
- }
-
- if (!GetUserTables().contains(tableId.PathId.LocalPathId)) {
- badRequest(TStringBuilder() << "Unknown table id: " << tableId.PathId.LocalPathId);
- ctx.Send(ev->Sender, std::move(response));
- return;
- }
-
- TUserTable::TCPtr userTable = GetUserTables().at(tableId.PathId.LocalPathId);
-
-
- if (BuildIndexManager.Contains(buildIndexId)) {
- TBuildIndexRecord recCard = BuildIndexManager.Get(buildIndexId);
- if (recCard.SeqNo == seqNo) {
- // do no start one more scan
- ctx.Send(ev->Sender, std::move(response));
- return;
- }
-
- CancelScan(userTable->LocalTid, recCard.ScanId);
- }
-
-
- TSerializedTableRange requestedRange;
- requestedRange.Load(record.GetKeyRange());
-
- auto scanRange = Intersect(userTable->KeyColumnTypes, requestedRange.ToTableRange(), userTable->Range.ToTableRange());
-
- if (scanRange.IsEmptyRange(userTable->KeyColumnTypes)) {
- badRequest(TStringBuilder() << " requested range doesn't intersect with table range"
- << " requestedRange: " << DebugPrintRange(userTable->KeyColumnTypes, requestedRange.ToTableRange(), *AppData()->TypeRegistry)
- << " tableRange: " << DebugPrintRange(userTable->KeyColumnTypes, userTable->Range.ToTableRange(), *AppData()->TypeRegistry)
- << " scanRange: " << DebugPrintRange(userTable->KeyColumnTypes, scanRange, *AppData()->TypeRegistry) );
- ctx.Send(ev->Sender, std::move(response));
- return;
- }
-
+ const auto& record = ev->Get()->Record;
+
+ auto response = MakeHolder<TEvDataShard::TEvBuildIndexProgressResponse>();
+ response->Record.SetBuildIndexId(record.GetBuildIndexId());
+ response->Record.SetTabletId(TabletID());
+ response->Record.SetStatus(NKikimrTxDataShard::TEvBuildIndexProgressResponse::ACCEPTED);
+
+ TBuildIndexRecord::TSeqNo seqNo = {record.GetSeqNoGeneration(), record.GetSeqNoRound()};
+ response->Record.SetRequestSeqNoGeneration(seqNo.Generation);
+ response->Record.SetRequestSeqNoRound(seqNo.Round);
+
+ auto badRequest = [&] (const TString& error) {
+ response->Record.SetStatus(NKikimrTxDataShard::TEvBuildIndexProgressResponse::BAD_REQUEST);
+ auto issue = response->Record.AddIssues();
+ issue->set_severity(NYql::TSeverityIds::S_ERROR);
+ issue->set_message(error);
+ };
+
+ const ui64 buildIndexId = record.GetBuildIndexId();
+ const ui64 shardId = record.GetTabletId();
+ const auto tableId = TTableId(record.GetOwnerId(), record.GetPathId());
+
+ if (shardId != TabletID()) {
+ badRequest(TStringBuilder() << "Wrong shard " << shardId << " this is " << TabletID());
+ ctx.Send(ev->Sender, std::move(response));
+ return;
+ }
+
+ if (!GetUserTables().contains(tableId.PathId.LocalPathId)) {
+ badRequest(TStringBuilder() << "Unknown table id: " << tableId.PathId.LocalPathId);
+ ctx.Send(ev->Sender, std::move(response));
+ return;
+ }
+
+ TUserTable::TCPtr userTable = GetUserTables().at(tableId.PathId.LocalPathId);
+
+
+ if (BuildIndexManager.Contains(buildIndexId)) {
+ TBuildIndexRecord recCard = BuildIndexManager.Get(buildIndexId);
+ if (recCard.SeqNo == seqNo) {
+ // do no start one more scan
+ ctx.Send(ev->Sender, std::move(response));
+ return;
+ }
+
+ CancelScan(userTable->LocalTid, recCard.ScanId);
+ }
+
+
+ TSerializedTableRange requestedRange;
+ requestedRange.Load(record.GetKeyRange());
+
+ auto scanRange = Intersect(userTable->KeyColumnTypes, requestedRange.ToTableRange(), userTable->Range.ToTableRange());
+
+ if (scanRange.IsEmptyRange(userTable->KeyColumnTypes)) {
+ badRequest(TStringBuilder() << " requested range doesn't intersect with table range"
+ << " requestedRange: " << DebugPrintRange(userTable->KeyColumnTypes, requestedRange.ToTableRange(), *AppData()->TypeRegistry)
+ << " tableRange: " << DebugPrintRange(userTable->KeyColumnTypes, userTable->Range.ToTableRange(), *AppData()->TypeRegistry)
+ << " scanRange: " << DebugPrintRange(userTable->KeyColumnTypes, scanRange, *AppData()->TypeRegistry) );
+ ctx.Send(ev->Sender, std::move(response));
+ return;
+ }
+
const TVector<TString> targetIndexColumns(record.GetIndexColumns().begin(), record.GetIndexColumns().end());
const TVector<TString> targetDataColumns(record.GetDataColumns().begin(), record.GetDataColumns().end());
-
- if (!record.HasSnapshotStep() || !record.HasSnapshotTxId()) {
- badRequest(TStringBuilder() << " request doesn't have Shapshot Step or TxId");
- ctx.Send(ev->Sender, std::move(response));
- return;
- }
-
- TSnapshotKey snapshotKey = TSnapshotKey(tableId.PathId.OwnerId, tableId.PathId.LocalPathId, record.GetSnapshotStep(), record.GetSnapshotTxId());
- const TSnapshot* snapshot = SnapshotManager.FindAvailable(snapshotKey);
- if (!snapshot) {
- badRequest(TStringBuilder()
- << "no snapshot has been found"
- << " , path id is " <<tableId.PathId.OwnerId << ":" << tableId.PathId.LocalPathId
- << " , snapshot step is " << snapshotKey.Step
- << " , snapshot tx is " << snapshotKey.TxId);
- ctx.Send(ev->Sender, std::move(response));
- return;
- }
-
- TScanOptions scanOpts;
- scanOpts.SetSnapshotRowVersion(TRowVersion(snapshotKey.Step, snapshotKey.TxId));
- scanOpts.SetResourceBroker("build_index", 10);
-
- TUploadLimits limits;
- if (record.HasMaxBatchRows()) {
- limits.BatchRowsLimit = record.GetMaxBatchRows();
- }
- if (record.HasMaxBatchBytes()) {
- limits.BatchBytesLimit = record.GetMaxBatchBytes();
- }
- if (record.HasMaxRetries()) {
- limits.MaxUploadRowsRetryCount = record.GetMaxRetries();
- }
-
- ui32 scanId = QueueScan(userTable->LocalTid,
- CreateBuildIndexScan(buildIndexId,
- record.GetTargetName(),
- seqNo,
- shardId,
- ctx.SelfID,
- ev->Sender,
- requestedRange,
- targetIndexColumns,
+
+ if (!record.HasSnapshotStep() || !record.HasSnapshotTxId()) {
+ badRequest(TStringBuilder() << " request doesn't have Shapshot Step or TxId");
+ ctx.Send(ev->Sender, std::move(response));
+ return;
+ }
+
+ TSnapshotKey snapshotKey = TSnapshotKey(tableId.PathId.OwnerId, tableId.PathId.LocalPathId, record.GetSnapshotStep(), record.GetSnapshotTxId());
+ const TSnapshot* snapshot = SnapshotManager.FindAvailable(snapshotKey);
+ if (!snapshot) {
+ badRequest(TStringBuilder()
+ << "no snapshot has been found"
+ << " , path id is " <<tableId.PathId.OwnerId << ":" << tableId.PathId.LocalPathId
+ << " , snapshot step is " << snapshotKey.Step
+ << " , snapshot tx is " << snapshotKey.TxId);
+ ctx.Send(ev->Sender, std::move(response));
+ return;
+ }
+
+ TScanOptions scanOpts;
+ scanOpts.SetSnapshotRowVersion(TRowVersion(snapshotKey.Step, snapshotKey.TxId));
+ scanOpts.SetResourceBroker("build_index", 10);
+
+ TUploadLimits limits;
+ if (record.HasMaxBatchRows()) {
+ limits.BatchRowsLimit = record.GetMaxBatchRows();
+ }
+ if (record.HasMaxBatchBytes()) {
+ limits.BatchBytesLimit = record.GetMaxBatchBytes();
+ }
+ if (record.HasMaxRetries()) {
+ limits.MaxUploadRowsRetryCount = record.GetMaxRetries();
+ }
+
+ ui32 scanId = QueueScan(userTable->LocalTid,
+ CreateBuildIndexScan(buildIndexId,
+ record.GetTargetName(),
+ seqNo,
+ shardId,
+ ctx.SelfID,
+ ev->Sender,
+ requestedRange,
+ targetIndexColumns,
targetDataColumns,
- userTable,
- limits),
- ev->Cookie,
- scanOpts);
-
- TBuildIndexRecord recCard = {scanId, seqNo};
-
- BuildIndexManager.Set(buildIndexId, recCard);
-
- ctx.Send(ev->Sender, std::move(response));
-}
-
+ userTable,
+ limits),
+ ev->Cookie,
+ scanOpts);
+
+ TBuildIndexRecord recCard = {scanId, seqNo};
+
+ BuildIndexManager.Set(buildIndexId, recCard);
+
+ ctx.Send(ev->Sender, std::move(response));
+}
+
} // NDataShard
-} // NKikimr
+} // NKikimr
diff --git a/ydb/core/tx/datashard/datashard__conditional_erase_rows.cpp b/ydb/core/tx/datashard/datashard__conditional_erase_rows.cpp
index 291c888f017..026b14e461f 100644
--- a/ydb/core/tx/datashard/datashard__conditional_erase_rows.cpp
+++ b/ydb/core/tx/datashard/datashard__conditional_erase_rows.cpp
@@ -464,12 +464,12 @@ static TIndexes GetIndexes(const NKikimrTxDataShard::TEvConditionalEraseRowsRequ
return result;
}
-static bool CheckUnit(NScheme::TTypeId type, NKikimrSchemeOp::TTTLSettings::EUnit unit, TString& error) {
+static bool CheckUnit(NScheme::TTypeId type, NKikimrSchemeOp::TTTLSettings::EUnit unit, TString& error) {
switch (type) {
case NScheme::NTypeIds::Date:
case NScheme::NTypeIds::Datetime:
case NScheme::NTypeIds::Timestamp:
- if (unit == NKikimrSchemeOp::TTTLSettings::UNIT_AUTO) {
+ if (unit == NKikimrSchemeOp::TTTLSettings::UNIT_AUTO) {
return true;
} else {
error = "Unit cannot be specified for date type column";
@@ -481,12 +481,12 @@ static bool CheckUnit(NScheme::TTypeId type, NKikimrSchemeOp::TTTLSettings::EUni
case NScheme::NTypeIds::Uint64:
case NScheme::NTypeIds::DyNumber:
switch (unit) {
- case NKikimrSchemeOp::TTTLSettings::UNIT_SECONDS:
- case NKikimrSchemeOp::TTTLSettings::UNIT_MILLISECONDS:
- case NKikimrSchemeOp::TTTLSettings::UNIT_MICROSECONDS:
- case NKikimrSchemeOp::TTTLSettings::UNIT_NANOSECONDS:
+ case NKikimrSchemeOp::TTTLSettings::UNIT_SECONDS:
+ case NKikimrSchemeOp::TTTLSettings::UNIT_MILLISECONDS:
+ case NKikimrSchemeOp::TTTLSettings::UNIT_MICROSECONDS:
+ case NKikimrSchemeOp::TTTLSettings::UNIT_NANOSECONDS:
return true;
- case NKikimrSchemeOp::TTTLSettings::UNIT_AUTO:
+ case NKikimrSchemeOp::TTTLSettings::UNIT_AUTO:
error = "Unit should be specified for integral type column";
return false;
default:
diff --git a/ydb/core/tx/datashard/datashard__init.cpp b/ydb/core/tx/datashard/datashard__init.cpp
index 2149f87a0b5..dc12c49959b 100644
--- a/ydb/core/tx/datashard/datashard__init.cpp
+++ b/ydb/core/tx/datashard/datashard__init.cpp
@@ -70,7 +70,7 @@ void TDataShard::TTxInit::Complete(const TActorContext &ctx) {
}
Self->SwitchToWork(ctx);
- Self->SendRegistrationRequestTimeCast(ctx);
+ Self->SendRegistrationRequestTimeCast(ctx);
// InReadSets table might have a lot of garbage due to old bug.
// Run transaction to collect if shard is not going offline.
@@ -178,12 +178,12 @@ bool TDataShard::TTxInit::ReadEverything(TTransactionContext &txc) {
LOAD_SYS_UI64(db, Schema::Sys_NextChangeRecordOrder, Self->NextChangeRecordOrder);
LOAD_SYS_UI64(db, Schema::Sys_LastChangeRecordGroup, Self->LastChangeRecordGroup);
LOAD_SYS_UI64(db, Schema::Sys_TxReadSizeLimit, Self->TxReadSizeLimit);
- LOAD_SYS_UI64(db, Schema::Sys_PathOwnerId, Self->PathOwnerId);
- LOAD_SYS_UI64(db, Schema::Sys_CurrentSchemeShardId, Self->CurrentSchemeShardId);
+ LOAD_SYS_UI64(db, Schema::Sys_PathOwnerId, Self->PathOwnerId);
+ LOAD_SYS_UI64(db, Schema::Sys_CurrentSchemeShardId, Self->CurrentSchemeShardId);
LOAD_SYS_UI64(db, Schema::Sys_LastSchemeShardGeneration, Self->LastSchemeOpSeqNo.Generation);
LOAD_SYS_UI64(db, Schema::Sys_LastSchemeShardRound, Self->LastSchemeOpSeqNo.Round);
LOAD_SYS_UI64(db, Schema::Sys_StatisticsDisabled, Self->StatisticsDisabled);
-
+
ui64 subDomainOwnerId = 0;
ui64 subDomainLocalPathId = 0;
LOAD_SYS_UI64(db, Schema::Sys_SubDomainOwnerId, subDomainOwnerId);
@@ -196,15 +196,15 @@ bool TDataShard::TTxInit::ReadEverything(TTransactionContext &txc) {
}
LOAD_SYS_BOOL(db, Schema::Sys_SubDomainOutOfSpace, Self->SubDomainOutOfSpace);
- {
- TString rawProcessingParams;
- LOAD_SYS_BYTES(db, Schema::Sys_SubDomainInfo, rawProcessingParams);
+ {
+ TString rawProcessingParams;
+ LOAD_SYS_BYTES(db, Schema::Sys_SubDomainInfo, rawProcessingParams);
if (!rawProcessingParams.empty()) {
Self->ProcessingParams.reset(new NKikimrSubDomains::TProcessingParams());
- Y_VERIFY(Self->ProcessingParams->ParseFromString(rawProcessingParams));
- }
- }
-
+ Y_VERIFY(Self->ProcessingParams->ParseFromString(rawProcessingParams));
+ }
+ }
+
if (!Self->Pipeline.Load(db))
return false;
@@ -218,7 +218,7 @@ bool TDataShard::TTxInit::ReadEverything(TTransactionContext &txc) {
ui32 localTid = rowset.GetValue<Schema::UserTables::LocalTid>();
ui32 shadowTid = rowset.GetValueOrDefault<Schema::UserTables::ShadowTid>();
TString schema = rowset.GetValue<Schema::UserTables::Schema>();
- NKikimrSchemeOp::TTableDescription descr;
+ NKikimrSchemeOp::TTableDescription descr;
bool parseOk = ParseFromStringNoSizeLimit(descr, schema);
Y_VERIFY(parseOk);
Self->AddUserTable(TPathId(Self->GetPathOwnerId(), tableId), new TUserTable(localTid, descr, shadowTid));
@@ -399,7 +399,7 @@ bool TDataShard::TTxInit::ReadEverything(TTransactionContext &txc) {
}
if (Self->State != TShardState::Offline && txc.DB.GetScheme().GetTableInfo(Schema::ChangeRecords::TableId)) {
- if (!Self->LoadChangeRecords(db, ChangeRecords)) {
+ if (!Self->LoadChangeRecords(db, ChangeRecords)) {
return false;
}
}
@@ -532,38 +532,38 @@ public:
Self->MvccSwitchState = TSwitchState::DONE;
}
- //remove this code after all datashards upgrade Sys_SubDomainInfo row in Sys
+ //remove this code after all datashards upgrade Sys_SubDomainInfo row in Sys
if (Self->State == TShardState::Ready ||
Self->State == TShardState::SplitSrcWaitForNoTxInFlight) {
- TString rawProcessingParams;
- LOAD_SYS_BYTES(db, Schema::Sys_SubDomainInfo, rawProcessingParams)
-
+ TString rawProcessingParams;
+ LOAD_SYS_BYTES(db, Schema::Sys_SubDomainInfo, rawProcessingParams)
+
if (rawProcessingParams.empty()) {
- auto appdata = AppData(ctx);
- const ui32 selfDomain = appdata->DomainsInfo->GetDomainUidByTabletId(Self->TabletID());
- Y_VERIFY(selfDomain != appdata->DomainsInfo->BadDomainId);
- const auto& domain = appdata->DomainsInfo->GetDomain(selfDomain);
-
- NKikimrSubDomains::TProcessingParams params = ExtractProcessingParams(domain);
- LOG_DEBUG(ctx, NKikimrServices::TX_DATASHARD, "TxInitSchema.Execute Persist Sys_SubDomainInfo");
- Self->PersistSys(db, Schema::Sys_SubDomainInfo, params.SerializeAsString());
- }
- }
-
- if (!isCreate) {
- ui64 currentSchemeShardId = INVALID_TABLET_ID;
- LOAD_SYS_UI64(db, Schema::Sys_CurrentSchemeShardId, currentSchemeShardId)
-
- ui64 pathOwnerId = INVALID_TABLET_ID;
- LOAD_SYS_UI64(db, Schema::Sys_PathOwnerId, pathOwnerId)
-
- if (pathOwnerId == INVALID_TABLET_ID && currentSchemeShardId != INVALID_TABLET_ID) {
- pathOwnerId = currentSchemeShardId;
- LOG_DEBUG(ctx, NKikimrServices::TX_DATASHARD, "TxInitSchema.Execute Persist Sys_PathOwnerId");
+ auto appdata = AppData(ctx);
+ const ui32 selfDomain = appdata->DomainsInfo->GetDomainUidByTabletId(Self->TabletID());
+ Y_VERIFY(selfDomain != appdata->DomainsInfo->BadDomainId);
+ const auto& domain = appdata->DomainsInfo->GetDomain(selfDomain);
+
+ NKikimrSubDomains::TProcessingParams params = ExtractProcessingParams(domain);
+ LOG_DEBUG(ctx, NKikimrServices::TX_DATASHARD, "TxInitSchema.Execute Persist Sys_SubDomainInfo");
+ Self->PersistSys(db, Schema::Sys_SubDomainInfo, params.SerializeAsString());
+ }
+ }
+
+ if (!isCreate) {
+ ui64 currentSchemeShardId = INVALID_TABLET_ID;
+ LOAD_SYS_UI64(db, Schema::Sys_CurrentSchemeShardId, currentSchemeShardId)
+
+ ui64 pathOwnerId = INVALID_TABLET_ID;
+ LOAD_SYS_UI64(db, Schema::Sys_PathOwnerId, pathOwnerId)
+
+ if (pathOwnerId == INVALID_TABLET_ID && currentSchemeShardId != INVALID_TABLET_ID) {
+ pathOwnerId = currentSchemeShardId;
+ LOG_DEBUG(ctx, NKikimrServices::TX_DATASHARD, "TxInitSchema.Execute Persist Sys_PathOwnerId");
Self->PersistSys(db, TDataShard::Schema::Sys_PathOwnerId, pathOwnerId);
- }
- }
-
+ }
+ }
+
return true;
}
@@ -660,7 +660,7 @@ bool TDataShard::SyncSchemeOnFollower(TTransactionContext &txc, const TActorCont
ui32 localTid = rowset.GetValue<Schema::UserTables::LocalTid>();
ui32 shadowTid = rowset.GetValueOrDefault<Schema::UserTables::ShadowTid>();
TString schema = rowset.GetValue<Schema::UserTables::Schema>();
- NKikimrSchemeOp::TTableDescription descr;
+ NKikimrSchemeOp::TTableDescription descr;
bool parseOk = ParseFromStringNoSizeLimit(descr, schema);
Y_VERIFY(parseOk);
AddUserTable(TPathId(GetPathOwnerId(), tableId), new TUserTable(localTid, descr, shadowTid));
@@ -680,7 +680,7 @@ bool TDataShard::SyncSchemeOnFollower(TTransactionContext &txc, const TActorCont
ui32 localTid = rowset.GetValue<Schema::UserTables::LocalTid>();
ui32 shadowTid = 0;
TString schema = rowset.GetValue<Schema::UserTables::Schema>();
- NKikimrSchemeOp::TTableDescription descr;
+ NKikimrSchemeOp::TTableDescription descr;
bool parseOk = ParseFromStringNoSizeLimit(descr, schema);
Y_VERIFY(parseOk);
AddUserTable(TPathId(GetPathOwnerId(), tableId), new TUserTable(localTid, descr, shadowTid));
diff --git a/ydb/core/tx/datashard/datashard__migrate_schemeshard.cpp b/ydb/core/tx/datashard/datashard__migrate_schemeshard.cpp
index 4c18a97f546..623776ef306 100644
--- a/ydb/core/tx/datashard/datashard__migrate_schemeshard.cpp
+++ b/ydb/core/tx/datashard/datashard__migrate_schemeshard.cpp
@@ -1,52 +1,52 @@
-#include "datashard_txs.h"
-
-namespace NKikimr {
+#include "datashard_txs.h"
+
+namespace NKikimr {
namespace NDataShard {
-
-using namespace NTabletFlatExecutor;
-
-
+
+using namespace NTabletFlatExecutor;
+
+
TDataShard::TTxMigrateSchemeShard::TTxMigrateSchemeShard(
TDataShard* ds,
- TEvDataShard::TEvMigrateSchemeShardRequest::TPtr ev)
- : TBase(ds)
- , Ev(std::move(ev))
-{ }
-
+ TEvDataShard::TEvMigrateSchemeShardRequest::TPtr ev)
+ : TBase(ds)
+ , Ev(std::move(ev))
+{ }
+
bool TDataShard::TTxMigrateSchemeShard::Execute(TTransactionContext& txc, const TActorContext& ctx) {
- using TResponse = NKikimrTxDataShard::TEvMigrateSchemeShardResponse;
-
- txc.DB.NoMoreReadsForTx();
-
- const auto& record = Ev->Get()->Record;
- const auto& tabletId = record.GetTabletId();
- const auto& currentId = record.GetCurrentSchemeShardId();
- const auto& newId = record.GetNewSchemeShardId();
-
- Reply.Reset(new TEvDataShard::TEvMigrateSchemeShardResponse);
- Reply->Record.SetTabletId(Self->TabletID());
-
- if (tabletId != Self->TabletID()) {
- Reply->Record.SetStatus(TResponse::WrongRequest);
- return true;
- }
-
- if (newId == Self->GetCurrentSchemeShardId()) {
- Reply->Record.SetStatus(TResponse::Already);
- return true;
- }
-
- if (currentId != Self->GetCurrentSchemeShardId()) {
- Reply->Record.SetStatus(TResponse::WrongRequest);
- return true;
- }
-
- LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD,
- "migrate SS from " << currentId << " to " << newId << " at datashard " << tabletId);
-
- Self->PersistCurrentSchemeShardId(newId, txc);
- Self->ResetLastSchemeOpSeqNo(txc);
-
+ using TResponse = NKikimrTxDataShard::TEvMigrateSchemeShardResponse;
+
+ txc.DB.NoMoreReadsForTx();
+
+ const auto& record = Ev->Get()->Record;
+ const auto& tabletId = record.GetTabletId();
+ const auto& currentId = record.GetCurrentSchemeShardId();
+ const auto& newId = record.GetNewSchemeShardId();
+
+ Reply.Reset(new TEvDataShard::TEvMigrateSchemeShardResponse);
+ Reply->Record.SetTabletId(Self->TabletID());
+
+ if (tabletId != Self->TabletID()) {
+ Reply->Record.SetStatus(TResponse::WrongRequest);
+ return true;
+ }
+
+ if (newId == Self->GetCurrentSchemeShardId()) {
+ Reply->Record.SetStatus(TResponse::Already);
+ return true;
+ }
+
+ if (currentId != Self->GetCurrentSchemeShardId()) {
+ Reply->Record.SetStatus(TResponse::WrongRequest);
+ return true;
+ }
+
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD,
+ "migrate SS from " << currentId << " to " << newId << " at datashard " << tabletId);
+
+ Self->PersistCurrentSchemeShardId(newId, txc);
+ Self->ResetLastSchemeOpSeqNo(txc);
+
// Invalidate current subdomain path id, it's no longer correct after migration
Self->SubDomainPathId.reset();
Self->StopWatchingSubDomainPathId();
@@ -56,18 +56,18 @@ bool TDataShard::TTxMigrateSchemeShard::Execute(TTransactionContext& txc, const
Self->StopFindSubDomainPathId();
Self->StartFindSubDomainPathId(/* delayFirstRequest */ false);
- Reply->Record.SetStatus(TResponse::Success);
- return true;
-}
-
+ Reply->Record.SetStatus(TResponse::Success);
+ return true;
+}
+
void TDataShard::TTxMigrateSchemeShard::Complete(const TActorContext& ctx) {
- Y_VERIFY(Reply);
-
- NTabletPipe::CloseAndForgetClient(Self->SelfId(), Self->DbStatsReportPipe);
-
- ctx.Send(Ev->Sender, Reply.Release(), 0, Ev->Cookie);
-}
-
-
+ Y_VERIFY(Reply);
+
+ NTabletPipe::CloseAndForgetClient(Self->SelfId(), Self->DbStatsReportPipe);
+
+ ctx.Send(Ev->Sender, Reply.Release(), 0, Ev->Cookie);
+}
+
+
} // namespace NDataShard
-} // namespace NKikimr
+} // namespace NKikimr
diff --git a/ydb/core/tx/datashard/datashard__monitoring.cpp b/ydb/core/tx/datashard/datashard__monitoring.cpp
index 2d96d3dde4c..644f9a74199 100644
--- a/ydb/core/tx/datashard/datashard__monitoring.cpp
+++ b/ydb/core/tx/datashard/datashard__monitoring.cpp
@@ -98,7 +98,7 @@ public:
}
auto &info = *response->Record.MutableTabletInfo();
- info.SetSchemeShard(Self->PathOwnerId);
+ info.SetSchemeShard(Self->PathOwnerId);
info.SetMediator(Self->LastKnownMediator);
info.SetGeneration(Self->Generation());
info.SetIsFollower(Self->IsFollower());
diff --git a/ydb/core/tx/datashard/datashard__read_columns.cpp b/ydb/core/tx/datashard/datashard__read_columns.cpp
index d520778a272..2b56a192d10 100644
--- a/ydb/core/tx/datashard/datashard__read_columns.cpp
+++ b/ydb/core/tx/datashard/datashard__read_columns.cpp
@@ -272,7 +272,7 @@ public:
TMaybe<TSnapshotKey> snapshotKey;
if (!ReadVersion.IsMax()) {
// FIXME: protocol needs a full table id (both owner id and path id)
- ui64 ownerId = Self->GetPathOwnerId();
+ ui64 ownerId = Self->GetPathOwnerId();
snapshotKey = TSnapshotKey(ownerId, tableId, ReadVersion.Step, ReadVersion.TxId);
// Check if readVersion is a valid snapshot
diff --git a/ydb/core/tx/datashard/datashard__stats.cpp b/ydb/core/tx/datashard/datashard__stats.cpp
index 91cec3a0d0b..129a14dca5f 100644
--- a/ydb/core/tx/datashard/datashard__stats.cpp
+++ b/ydb/core/tx/datashard/datashard__stats.cpp
@@ -80,7 +80,7 @@ public:
ui64 tableId = Ev->Get()->Record.GetTableId();
- Result = new TEvDataShard::TEvGetTableStatsResult(Self->TabletID(), Self->PathOwnerId, tableId);
+ Result = new TEvDataShard::TEvGetTableStatsResult(Self->TabletID(), Self->PathOwnerId, tableId);
if (!Self->TableInfos.contains(tableId))
return true;
diff --git a/ydb/core/tx/datashard/datashard_active_transaction.cpp b/ydb/core/tx/datashard/datashard_active_transaction.cpp
index 9d1d0fd5d42..0226bd42e25 100644
--- a/ydb/core/tx/datashard/datashard_active_transaction.cpp
+++ b/ydb/core/tx/datashard/datashard_active_transaction.cpp
@@ -433,17 +433,17 @@ bool TActiveTransaction::BuildSchemeTx()
if (!res)
return false;
- ui32 count = (ui32)SchemeTx->HasCreateTable()
- + (ui32)SchemeTx->HasDropTable()
- + (ui32)SchemeTx->HasAlterTable()
- + (ui32)SchemeTx->HasBackup()
+ ui32 count = (ui32)SchemeTx->HasCreateTable()
+ + (ui32)SchemeTx->HasDropTable()
+ + (ui32)SchemeTx->HasAlterTable()
+ + (ui32)SchemeTx->HasBackup()
+ (ui32)SchemeTx->HasRestore()
- + (ui32)SchemeTx->HasSendSnapshot()
+ + (ui32)SchemeTx->HasSendSnapshot()
+ (ui32)SchemeTx->HasCreatePersistentSnapshot()
- + (ui32)SchemeTx->HasDropPersistentSnapshot()
- + (ui32)SchemeTx->HasInitiateBuildIndex()
- + (ui32)SchemeTx->HasFinalizeBuildIndex()
- + (ui32)SchemeTx->HasDropIndexNotice()
+ + (ui32)SchemeTx->HasDropPersistentSnapshot()
+ + (ui32)SchemeTx->HasInitiateBuildIndex()
+ + (ui32)SchemeTx->HasFinalizeBuildIndex()
+ + (ui32)SchemeTx->HasDropIndexNotice()
+ (ui32)SchemeTx->HasMoveTable()
+ (ui32)SchemeTx->HasCreateCdcStreamNotice()
+ (ui32)SchemeTx->HasAlterCdcStreamNotice()
@@ -467,14 +467,14 @@ bool TActiveTransaction::BuildSchemeTx()
SchemeTxType = TSchemaOperation::ETypeCreatePersistentSnapshot;
else if (SchemeTx->HasDropPersistentSnapshot())
SchemeTxType = TSchemaOperation::ETypeDropPersistentSnapshot;
- else if (SchemeTx->HasInitiateBuildIndex())
+ else if (SchemeTx->HasInitiateBuildIndex())
SchemeTxType = TSchemaOperation::ETypeInitiateBuildIndex;
- else if (SchemeTx->HasFinalizeBuildIndex())
+ else if (SchemeTx->HasFinalizeBuildIndex())
SchemeTxType = TSchemaOperation::ETypeFinalizeBuildIndex;
- else if (SchemeTx->HasDropIndexNotice())
+ else if (SchemeTx->HasDropIndexNotice())
SchemeTxType = TSchemaOperation::ETypeDropIndexNotice;
- else if (SchemeTx->HasMoveTable())
- SchemeTxType = TSchemaOperation::ETypeMoveTable;
+ else if (SchemeTx->HasMoveTable())
+ SchemeTxType = TSchemaOperation::ETypeMoveTable;
else if (SchemeTx->HasCreateCdcStreamNotice())
SchemeTxType = TSchemaOperation::ETypeCreateCdcStream;
else if (SchemeTx->HasAlterCdcStreamNotice())
@@ -874,10 +874,10 @@ void TActiveTransaction::BuildExecutionPlan(bool loaded)
plan.push_back(EExecutionUnitKind::DropTable);
plan.push_back(EExecutionUnitKind::CreatePersistentSnapshot);
plan.push_back(EExecutionUnitKind::DropPersistentSnapshot);
- plan.push_back(EExecutionUnitKind::InitiateBuildIndex);
- plan.push_back(EExecutionUnitKind::FinalizeBuildIndex);
- plan.push_back(EExecutionUnitKind::DropIndexNotice);
- plan.push_back(EExecutionUnitKind::MoveTable);
+ plan.push_back(EExecutionUnitKind::InitiateBuildIndex);
+ plan.push_back(EExecutionUnitKind::FinalizeBuildIndex);
+ plan.push_back(EExecutionUnitKind::DropIndexNotice);
+ plan.push_back(EExecutionUnitKind::MoveTable);
plan.push_back(EExecutionUnitKind::CreateCdcStream);
plan.push_back(EExecutionUnitKind::AlterCdcStream);
plan.push_back(EExecutionUnitKind::DropCdcStream);
diff --git a/ydb/core/tx/datashard/datashard_active_transaction.h b/ydb/core/tx/datashard/datashard_active_transaction.h
index 5f0e1f07025..43abd525e15 100644
--- a/ydb/core/tx/datashard/datashard_active_transaction.h
+++ b/ydb/core/tx/datashard/datashard_active_transaction.h
@@ -41,14 +41,14 @@ struct TSchemaOperation {
ETypeAlter = 2,
ETypeBackup = 3,
ETypeCopy = 4,
- EType_DEPRECATED_05 = 5,
+ EType_DEPRECATED_05 = 5,
ETypeCreatePersistentSnapshot = 6,
ETypeDropPersistentSnapshot = 7,
- ETypeInitiateBuildIndex = 8,
- ETypeFinalizeBuildIndex = 9,
- ETypeDropIndexNotice = 10,
+ ETypeInitiateBuildIndex = 8,
+ ETypeFinalizeBuildIndex = 9,
+ ETypeDropIndexNotice = 10,
ETypeRestore = 11,
- ETypeMoveTable = 12,
+ ETypeMoveTable = 12,
ETypeCreateCdcStream = 13,
ETypeAlterCdcStream = 14,
ETypeDropCdcStream = 15,
@@ -99,10 +99,10 @@ struct TSchemaOperation {
bool IsCopy() const { return Type == ETypeCopy; }
bool IsCreatePersistentSnapshot() const { return Type == ETypeCreatePersistentSnapshot; }
bool IsDropPersistentSnapshot() const { return Type == ETypeDropPersistentSnapshot; }
- bool IsInitiateBuildIndex() const { return Type == ETypeInitiateBuildIndex; }
- bool IsFinalizeBuildIndex() const { return Type == ETypeFinalizeBuildIndex; }
- bool IsDropIndexNotice() const { return Type == ETypeDropIndexNotice; }
- bool IsMove() const { return Type == ETypeMoveTable; }
+ bool IsInitiateBuildIndex() const { return Type == ETypeInitiateBuildIndex; }
+ bool IsFinalizeBuildIndex() const { return Type == ETypeFinalizeBuildIndex; }
+ bool IsDropIndexNotice() const { return Type == ETypeDropIndexNotice; }
+ bool IsMove() const { return Type == ETypeMoveTable; }
bool IsCreateCdcStream() const { return Type == ETypeCreateCdcStream; }
bool IsAlterCdcStream() const { return Type == ETypeAlterCdcStream; }
bool IsDropCdcStream() const { return Type == ETypeDropCdcStream; }
@@ -388,7 +388,7 @@ public:
const NKikimrTxDataShard::TFlatSchemeTransaction &GetSchemeTx() const
{
- Y_VERIFY_S(SchemeTx, "No ptr");
+ Y_VERIFY_S(SchemeTx, "No ptr");
return *SchemeTx;
}
bool BuildSchemeTx();
diff --git a/ydb/core/tx/datashard/datashard_build_index.h b/ydb/core/tx/datashard/datashard_build_index.h
index b750bc1c895..fb4277f7d6a 100644
--- a/ydb/core/tx/datashard/datashard_build_index.h
+++ b/ydb/core/tx/datashard/datashard_build_index.h
@@ -1,60 +1,60 @@
-#pragma once
-
+#pragma once
+
#include <ydb/core/tablet_flat/flat_cxx_database.h>
#include <ydb/core/util/intrusive_heap.h>
-
-#include <util/generic/hash.h>
-#include <util/generic/list.h>
-#include <util/generic/map.h>
-
-namespace NKikimr {
+
+#include <util/generic/hash.h>
+#include <util/generic/list.h>
+#include <util/generic/map.h>
+
+namespace NKikimr {
namespace NDataShard {
-
+
class TDataShard;
-
-struct TBuildIndexRecord {
-
- struct TSeqNo {
- ui64 Generation = 0;
- ui64 Round = 0;
-
- bool operator == (const TSeqNo& x) const {
- return Generation == x.Generation && Round == x.Round;
- }
-
- bool operator < (const TSeqNo& x) const {
- return Generation != x.Generation ? Generation < x.Generation : Round < x.Round;
- }
- };
-
- ui64 ScanId = 0;
- TSeqNo SeqNo = {0, 0};
-
-};
-
-class TBuildIndexManager {
-public:
- bool Contains(ui64 id) {
- return Records.contains(id);
- }
-
- void Set(ui64 id, TBuildIndexRecord record) {
- Records.emplace(id, record);
- }
-
- TBuildIndexRecord Get(ui64 id) const {
- return Records.at(id);
- }
-
- void Drop(ui64 id) {
- Records.erase(id);
- }
-
-private:
- using TBuildIndexIdToScanIdMap = TMap<ui64, TBuildIndexRecord>;
-
- TBuildIndexIdToScanIdMap Records;
-};
-
+
+struct TBuildIndexRecord {
+
+ struct TSeqNo {
+ ui64 Generation = 0;
+ ui64 Round = 0;
+
+ bool operator == (const TSeqNo& x) const {
+ return Generation == x.Generation && Round == x.Round;
+ }
+
+ bool operator < (const TSeqNo& x) const {
+ return Generation != x.Generation ? Generation < x.Generation : Round < x.Round;
+ }
+ };
+
+ ui64 ScanId = 0;
+ TSeqNo SeqNo = {0, 0};
+
+};
+
+class TBuildIndexManager {
+public:
+ bool Contains(ui64 id) {
+ return Records.contains(id);
+ }
+
+ void Set(ui64 id, TBuildIndexRecord record) {
+ Records.emplace(id, record);
+ }
+
+ TBuildIndexRecord Get(ui64 id) const {
+ return Records.at(id);
+ }
+
+ void Drop(ui64 id) {
+ Records.erase(id);
+ }
+
+private:
+ using TBuildIndexIdToScanIdMap = TMap<ui64, TBuildIndexRecord>;
+
+ TBuildIndexIdToScanIdMap Records;
+};
+
} // namespace NDataShard
-} // namespace NKikimr
+} // namespace NKikimr
diff --git a/ydb/core/tx/datashard/datashard_change_receiving.cpp b/ydb/core/tx/datashard/datashard_change_receiving.cpp
index f387a92b24c..fcb74f44019 100644
--- a/ydb/core/tx/datashard/datashard_change_receiving.cpp
+++ b/ydb/core/tx/datashard/datashard_change_receiving.cpp
@@ -358,10 +358,10 @@ void TDataShard::Handle(TEvChangeExchange::TEvHandshake::TPtr& ev, const TActorC
}
void TDataShard::Handle(TEvChangeExchange::TEvApplyRecords::TPtr& ev, const TActorContext& ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD, "Handle TEvChangeExchange::TEvApplyRecords"
- << ": origin# " << ev->Get()->Record.GetOrigin()
- << ", generation# " << ev->Get()->Record.GetGeneration()
- << ", at tablet# " << TabletID());
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD, "Handle TEvChangeExchange::TEvApplyRecords"
+ << ": origin# " << ev->Get()->Record.GetOrigin()
+ << ", generation# " << ev->Get()->Record.GetGeneration()
+ << ", at tablet# " << TabletID());
Execute(new TTxApplyChangeRecords(this, ev), ctx);
}
diff --git a/ydb/core/tx/datashard/datashard_dep_tracker.cpp b/ydb/core/tx/datashard/datashard_dep_tracker.cpp
index 47e5a52086e..b7c37069379 100644
--- a/ydb/core/tx/datashard/datashard_dep_tracker.cpp
+++ b/ydb/core/tx/datashard/datashard_dep_tracker.cpp
@@ -57,10 +57,10 @@ void TDependencyTracker::UpdateSchema(const TPathId& tableId, const TUserTable&
state.ImmediateWrites.SetKeyTypes(tableInfo.KeyColumnTypes);
}
-void TDependencyTracker::RemoveSchema(const TPathId& tableId) noexcept {
- Tables.erase(tableId.LocalPathId);
-}
-
+void TDependencyTracker::RemoveSchema(const TPathId& tableId) noexcept {
+ Tables.erase(tableId.LocalPathId);
+}
+
void TDependencyTracker::ClearTmpRead() noexcept {
TmpRead.clear();
}
diff --git a/ydb/core/tx/datashard/datashard_dep_tracker.h b/ydb/core/tx/datashard/datashard_dep_tracker.h
index 8799008718e..856c71411c5 100644
--- a/ydb/core/tx/datashard/datashard_dep_tracker.h
+++ b/ydb/core/tx/datashard/datashard_dep_tracker.h
@@ -92,9 +92,9 @@ public:
// Called to update this table schema
void UpdateSchema(const TPathId& tableId, const TUserTable& tableInfo) noexcept;
- // Calld to update this table schema upon move
- void RemoveSchema(const TPathId& tableId) noexcept;
-
+ // Calld to update this table schema upon move
+ void RemoveSchema(const TPathId& tableId) noexcept;
+
// Adds operation to the tracker
void AddOperation(const TOperation::TPtr& op) noexcept {
GetTrackingLogic().AddOperation(op);
diff --git a/ydb/core/tx/datashard/datashard_distributed_erase.cpp b/ydb/core/tx/datashard/datashard_distributed_erase.cpp
index 0d9cc1e60d5..fae7d2edeb3 100644
--- a/ydb/core/tx/datashard/datashard_distributed_erase.cpp
+++ b/ydb/core/tx/datashard/datashard_distributed_erase.cpp
@@ -400,11 +400,11 @@ class TDistEraser: public TActorBootstrapped<TDistEraser> {
const auto tableId = TTableId(index.GetPathOwnerId(), index.GetLocalPathId(), index.GetSchemaVersion());
switch (index.GetState()) {
- case NKikimrSchemeOp::EIndexStateReady:
- case NKikimrSchemeOp::EIndexStateWriteOnly:
- case NKikimrSchemeOp::EIndexStateNotReady:
+ case NKikimrSchemeOp::EIndexStateReady:
+ case NKikimrSchemeOp::EIndexStateWriteOnly:
+ case NKikimrSchemeOp::EIndexStateNotReady:
break;
- case NKikimrSchemeOp::EIndexStateInvalid:
+ case NKikimrSchemeOp::EIndexStateInvalid:
return SchemeError(TStringBuilder() << "Invalid index state"
<< ": tableId# " << tableId
<< ", name# " << index.GetName());
diff --git a/ydb/core/tx/datashard/datashard_impl.h b/ydb/core/tx/datashard/datashard_impl.h
index 8243485dcf1..11313474f80 100644
--- a/ydb/core/tx/datashard/datashard_impl.h
+++ b/ydb/core/tx/datashard/datashard_impl.h
@@ -10,7 +10,7 @@
#include "datashard_s3_downloads.h"
#include "datashard_s3_uploads.h"
#include "datashard_user_table.h"
-#include "datashard_build_index.h"
+#include "datashard_build_index.h"
#include "datashard_repl_offsets.h"
#include "datashard_repl_offsets_client.h"
#include "datashard_repl_offsets_server.h"
@@ -187,7 +187,7 @@ class TDataShard
class TTxRefreshVolatileSnapshot;
class TTxDiscardVolatileSnapshot;
class TTxCleanupRemovedSnapshots;
- class TTxMigrateSchemeShard;
+ class TTxMigrateSchemeShard;
class TTxGetS3Upload;
class TTxStoreS3UploadId;
class TTxChangeS3UploadStatus;
@@ -247,7 +247,7 @@ class TDataShard
friend class TAsyncTableStatsBuilder;
friend class TReadTableScan;
friend class TWaitForStreamClearanceUnit;
- friend class TBuildIndexScan;
+ friend class TBuildIndexScan;
friend class TReadColumnsScan;
friend class TCondEraseScan;
friend class TDatashardKeySampler;
@@ -256,7 +256,7 @@ class TDataShard
friend class TS3DownloadsManager;
friend class TS3Downloader;
friend struct TSetupSysLocks;
-
+
friend class TTxStartMvccStateChange;
friend class TTxExecuteMvccStateChange;
@@ -773,8 +773,8 @@ class TDataShard
Sys_LastLocalTid,
Sys_LastSeqno, // Last sequence number of out read set
Sys_AliveStep, // Last known step we shouldn't drop at
- Sys_TxReadSizeLimit_DEPRECATED, // 10// No longer used but is present in old tables
- Sys_CurrentSchemeShardId, // TabletID of the schmemeshard that manages the datashard right now
+ Sys_TxReadSizeLimit_DEPRECATED, // 10// No longer used but is present in old tables
+ Sys_CurrentSchemeShardId, // TabletID of the schmemeshard that manages the datashard right now
Sys_DstSplitDescription, // Split/Merge operation description at destination shard
Sys_DstSplitOpId, // TxId of split operation at destination shard
Sys_SrcSplitDescription, // Split/Merge operation description at source shard
@@ -782,13 +782,13 @@ class TDataShard
Sys_LastSchemeShardGeneration, // LastSchemeOpSeqNo.Generation
Sys_LastSchemeShardRound, // LastSchemeOpSeqNo.Round
Sys_TxReadSizeLimit, // Maximum size in bytes that is allowed to be read by a single Tx
- Sys_SubDomainInfo, //19 Subdomain setting which owns this table
+ Sys_SubDomainInfo, //19 Subdomain setting which owns this table
Sys_StatisticsDisabled,
Sys_DstSplitSchemaInitialized,
Sys_MinWriteVersionStep, // 22 Minimum Step for new writes (past known snapshots)
Sys_MinWriteVersionTxId, // 23 Minimum TxId for new writes (past known snapshots)
- Sys_PathOwnerId, // TabletID of the schmemeshard that allocated the TPathId(ownerId,localId)
-
+ Sys_PathOwnerId, // TabletID of the schmemeshard that allocated the TPathId(ownerId,localId)
+
SysMvcc_State,
SysMvcc_CompleteEdgeStep,
SysMvcc_CompleteEdgeTxId,
@@ -938,14 +938,14 @@ class TDataShard
void Handle(TEvDataShard::TEvGetSlowOpProfilesRequest::TPtr& ev, const TActorContext& ctx);
void Handle(TEvDataShard::TEvRefreshVolatileSnapshotRequest::TPtr& ev, const TActorContext& ctx);
void Handle(TEvDataShard::TEvDiscardVolatileSnapshotRequest::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvDataShard::TEvMigrateSchemeShardRequest::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvDataShard::TEvMigrateSchemeShardRequest::TPtr& ev, const TActorContext& ctx);
void Handle(TEvDataShard::TEvGetS3Upload::TPtr& ev, const TActorContext& ctx);
void Handle(TEvDataShard::TEvStoreS3UploadId::TPtr& ev, const TActorContext& ctx);
void Handle(TEvDataShard::TEvChangeS3UploadStatus::TPtr& ev, const TActorContext& ctx);
void Handle(TEvDataShard::TEvGetS3DownloadInfo::TPtr& ev, const TActorContext& ctx);
void Handle(TEvDataShard::TEvStoreS3DownloadInfo::TPtr& ev, const TActorContext& ctx);
void Handle(TEvDataShard::TEvUnsafeUploadRowsRequest::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvDataShard::TEvBuildIndexCreateRequest::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvDataShard::TEvBuildIndexCreateRequest::TPtr& ev, const TActorContext& ctx);
void Handle(TEvPrivate::TEvAsyncJobComplete::TPtr& ev, const TActorContext& ctx);
void Handle(TEvDataShard::TEvCancelBackup::TPtr &ev, const TActorContext &ctx);
@@ -960,7 +960,7 @@ class TDataShard
void Handle(TEvTxProcessing::TEvInterruptTransaction::TPtr &ev, const TActorContext &ctx) {
ForwardEventToOperation(ev, ctx);
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr ev, const TActorContext &ctx);
+ void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr ev, const TActorContext &ctx);
void Handle(TEvents::TEvUndelivered::TPtr& ev, const TActorContext& ctx);
void Handle(TEvInterconnect::TEvNodeDisconnected::TPtr& ev, const TActorContext& ctx);
@@ -1008,7 +1008,7 @@ class TDataShard
}
void UpdateLagCounters(const TActorContext &ctx);
- static NTabletPipe::TClientConfig GetPipeClientConfig();
+ static NTabletPipe::TClientConfig GetPipeClientConfig();
void OnDetach(const TActorContext &ctx) override;
void OnTabletStop(TEvTablet::TEvTabletStop::TPtr &ev, const TActorContext &ctx) override;
@@ -1031,18 +1031,18 @@ class TDataShard
Y_UNUSED(ctx);
}
- void PersistSys(NIceDb::TNiceDb& db, ui64 key, const TString& value) const;
+ void PersistSys(NIceDb::TNiceDb& db, ui64 key, const TString& value) const;
void PersistSys(NIceDb::TNiceDb& db, ui64 key, ui64 value) const;
void PersistSys(NIceDb::TNiceDb& db, ui64 key, ui32 value) const;
void PersistSys(NIceDb::TNiceDb& db, ui64 key, bool value) const;
void PersistUserTable(NIceDb::TNiceDb& db, ui64 tableId, const TUserTable& tableInfo);
void PersistUserTableFullCompactionTs(NIceDb::TNiceDb& db, ui64 tableId, ui64 ts);
- void PersistMoveUserTable(NIceDb::TNiceDb& db, ui64 prevTableId, ui64 tableId, const TUserTable& tableInfo);
+ void PersistMoveUserTable(NIceDb::TNiceDb& db, ui64 prevTableId, ui64 tableId, const TUserTable& tableInfo);
void DropAllUserTables(TTransactionContext& txc);
void PurgeTxTables(TTransactionContext& txc);
- bool CheckMediatorAuthorisation(ui64 mediatorId);
+ bool CheckMediatorAuthorisation(ui64 mediatorId);
NTabletFlatExecutor::ITransaction* CreateTxInit();
NTabletFlatExecutor::ITransaction* CreateTxInitSchema();
@@ -1167,12 +1167,12 @@ public:
return prefix;
}
- void RemoveUserTable(const TPathId& tableId) {
- TableInfos.erase(tableId.LocalPathId);
- SysLocks.RemoveSchema(tableId);
- Pipeline.GetDepTracker().RemoveSchema(tableId);
- }
-
+ void RemoveUserTable(const TPathId& tableId) {
+ TableInfos.erase(tableId.LocalPathId);
+ SysLocks.RemoveSchema(tableId);
+ Pipeline.GetDepTracker().RemoveSchema(tableId);
+ }
+
void AddUserTable(const TPathId& tableId, TUserTable::TPtr tableInfo) {
TableInfos[tableId.LocalPathId] = tableInfo;
SysLocks.UpdateSchema(tableId, *tableInfo);
@@ -1215,7 +1215,7 @@ public:
}
ui64 GetOutdatedCleanupStep() const {
- ui64 mediatorTime = MediatorTimeCastEntry ? MediatorTimeCastEntry->Get(TabletID()) : 0;
+ ui64 mediatorTime = MediatorTimeCastEntry ? MediatorTimeCastEntry->Get(TabletID()) : 0;
ui64 pipelineTime = Pipeline.OutdatedCleanupStep();
return Max(mediatorTime, pipelineTime);
}
@@ -1290,21 +1290,21 @@ public:
bool IsStopping() const { return Stopping; }
- ui64 GetPathOwnerId() const { return PathOwnerId; }
- ui64 GetCurrentSchemeShardId() const { return CurrentSchemeShardId; }
+ ui64 GetPathOwnerId() const { return PathOwnerId; }
+ ui64 GetCurrentSchemeShardId() const { return CurrentSchemeShardId; }
TSchemeOpSeqNo GetLastSchemeOpSeqNo() { return LastSchemeOpSeqNo; }
void UpdateLastSchemeOpSeqNo(const TSchemeOpSeqNo &newSeqNo,
TTransactionContext &txc);
- void ResetLastSchemeOpSeqNo(TTransactionContext &txc);
+ void ResetLastSchemeOpSeqNo(TTransactionContext &txc);
void PersistProcessingParams(const NKikimrSubDomains::TProcessingParams &params,
NTabletFlatExecutor::TTransactionContext &txc);
- void PersistCurrentSchemeShardId(ui64 id,
+ void PersistCurrentSchemeShardId(ui64 id,
NTabletFlatExecutor::TTransactionContext &txc);
void PersistSubDomainPathId(ui64 ownerId, ui64 localPathId,
NTabletFlatExecutor::TTransactionContext &txc);
- void PersistOwnerPathId(ui64 id,
- NTabletFlatExecutor::TTransactionContext &txc);
+ void PersistOwnerPathId(ui64 id,
+ NTabletFlatExecutor::TTransactionContext &txc);
TDuration CleanupTimeout() const;
void PlanCleanup(const TActorContext &ctx) {
@@ -1346,11 +1346,11 @@ public:
const TActorContext& ctx, TTransactionContext& txc,
const TPathId& pathId, const ui64 tableSchemaVersion,
bool persist = true);
-
+
TUserTable::TPtr AlterTableAddIndex(
const TActorContext& ctx, TTransactionContext& txc,
const TPathId& pathId, ui64 tableSchemaVersion,
- const NKikimrSchemeOp::TIndexDescription& indexDesc);
+ const NKikimrSchemeOp::TIndexDescription& indexDesc);
TUserTable::TPtr AlterTableDropIndex(
const TActorContext& ctx, TTransactionContext& txc,
@@ -1360,7 +1360,7 @@ public:
TUserTable::TPtr AlterTableAddCdcStream(
const TActorContext& ctx, TTransactionContext& txc,
const TPathId& pathId, ui64 tableSchemaVersion,
- const NKikimrSchemeOp::TCdcStreamDescription& streamDesc);
+ const NKikimrSchemeOp::TCdcStreamDescription& streamDesc);
TUserTable::TPtr AlterTableDisableCdcStream(
const TActorContext& ctx, TTransactionContext& txc,
@@ -1372,11 +1372,11 @@ public:
const TPathId& pathId, ui64 tableSchemaVersion,
const TPathId& streamPathId);
- TUserTable::TPtr CreateUserTable(TTransactionContext& txc, const NKikimrSchemeOp::TTableDescription& tableScheme);
+ TUserTable::TPtr CreateUserTable(TTransactionContext& txc, const NKikimrSchemeOp::TTableDescription& tableScheme);
TUserTable::TPtr AlterUserTable(const TActorContext& ctx, TTransactionContext& txc,
- const NKikimrSchemeOp::TTableDescription& tableScheme);
- static THashMap<TPathId, TPathId> GetRemapIndexes(const NKikimrTxDataShard::TMoveTable& move);
- TUserTable::TPtr MoveUserTable(const TActorContext& ctx, TTransactionContext& txc, const NKikimrTxDataShard::TMoveTable& move);
+ const NKikimrSchemeOp::TTableDescription& tableScheme);
+ static THashMap<TPathId, TPathId> GetRemapIndexes(const NKikimrTxDataShard::TMoveTable& move);
+ TUserTable::TPtr MoveUserTable(const TActorContext& ctx, TTransactionContext& txc, const NKikimrTxDataShard::TMoveTable& move);
void DropUserTable(TTransactionContext& txc, ui64 tableId);
ui32 GetLastLocalTid() const { return LastLocalTid; }
@@ -1384,16 +1384,16 @@ public:
ui64 AllocateChangeRecordOrder(NIceDb::TNiceDb& db);
ui64 AllocateChangeRecordGroup(NIceDb::TNiceDb& db);
void PersistChangeRecord(NIceDb::TNiceDb& db, const TChangeRecord& record);
- void MoveChangeRecord(NIceDb::TNiceDb& db, ui64 order, const TPathId& pathId);
+ void MoveChangeRecord(NIceDb::TNiceDb& db, ui64 order, const TPathId& pathId);
void RemoveChangeRecord(NIceDb::TNiceDb& db, ui64 order);
void EnqueueChangeRecords(TVector<TEvChangeExchange::TEvEnqueueRecords::TRecordInfo>&& records);
void CreateChangeSender(const TActorContext& ctx);
void KillChangeSender(const TActorContext& ctx);
void MaybeActivateChangeSender(const TActorContext& ctx);
const TActorId& GetChangeSender() const { return OutChangeSender; }
- bool LoadChangeRecords(NIceDb::TNiceDb& db, TVector<TEvChangeExchange::TEvEnqueueRecords::TRecordInfo>& changeRecords);
+ bool LoadChangeRecords(NIceDb::TNiceDb& db, TVector<TEvChangeExchange::TEvEnqueueRecords::TRecordInfo>& changeRecords);
+
-
static void PersistSchemeTxResult(NIceDb::TNiceDb &db, const TSchemaOperation& op);
void NotifySchemeshard(const TActorContext& ctx, ui64 txId = 0);
@@ -1410,9 +1410,9 @@ public:
return SnapshotManager.PromoteCompleteEdge(std::forward<Args>(args)...);
}
- TBuildIndexManager& GetBuildIndexManager() { return BuildIndexManager; }
- const TBuildIndexManager& GetBuildIndexManager() const { return BuildIndexManager; }
-
+ TBuildIndexManager& GetBuildIndexManager() { return BuildIndexManager; }
+ const TBuildIndexManager& GetBuildIndexManager() const { return BuildIndexManager; }
+
// Returns true when datashard is working in mvcc mode
bool IsMvccEnabled() const;
@@ -1892,8 +1892,8 @@ private:
NTabletPipe::TClientRetryPolicy SchemeShardPipeRetryPolicy;
TActorId SchemeShardPipe; // For notifications about schema changes
TActorId StateReportPipe; // For notifications about shard state changes
- ui64 PathOwnerId; // TabletID of the schmemeshard that allocated the TPathId(ownerId,localId)
- ui64 CurrentSchemeShardId; // TabletID of SchemeShard wich manages the path right now
+ ui64 PathOwnerId; // TabletID of the schmemeshard that allocated the TPathId(ownerId,localId)
+ ui64 CurrentSchemeShardId; // TabletID of SchemeShard wich manages the path right now
ui64 LastKnownMediator;
bool RegistrationSended;
std::unique_ptr<NKikimrSubDomains::TProcessingParams> ProcessingParams;
@@ -1964,8 +1964,8 @@ private:
TReplicationSourceOffsetsServerLink ReplicationSourceOffsetsServer;
- TBuildIndexManager BuildIndexManager;
-
+ TBuildIndexManager BuildIndexManager;
+
TS3UploadsManager S3Uploads;
TS3DownloadsManager S3Downloads;
@@ -2145,7 +2145,7 @@ protected:
HFuncTraced(TEvDataShard::TEvGetS3DownloadInfo, Handle);
HFuncTraced(TEvDataShard::TEvStoreS3DownloadInfo, Handle);
HFuncTraced(TEvDataShard::TEvUnsafeUploadRowsRequest, Handle);
- HFuncTraced(TEvDataShard::TEvMigrateSchemeShardRequest, Handle);
+ HFuncTraced(TEvDataShard::TEvMigrateSchemeShardRequest, Handle);
HFuncTraced(TEvTxProcessing::TEvPlanStep, Handle);
HFuncTraced(TEvTxProcessing::TEvReadSet, Handle);
HFuncTraced(TEvTxProcessing::TEvReadSetAck, Handle);
@@ -2167,7 +2167,7 @@ protected:
HFuncTraced(TEvMediatorTimecast::TEvRegisterTabletResult, Handle);
HFuncTraced(TEvMediatorTimecast::TEvNotifyPlanStep, Handle);
HFuncTraced(TEvDataShard::TEvCancelTransactionProposal, Handle);
- HFuncTraced(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ HFuncTraced(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
HFunc(TEvDataShard::TEvReturnBorrowedPart, Handle);
HFunc(TEvDataShard::TEvReturnBorrowedPartAck, Handle);
HFunc(TEvDataShard::TEvInitSplitMergeDestination, Handle);
@@ -2200,7 +2200,7 @@ protected:
HFunc(TEvDataShard::TEvGetSlowOpProfilesRequest, Handle);
HFunc(TEvDataShard::TEvRefreshVolatileSnapshotRequest, Handle);
HFunc(TEvDataShard::TEvDiscardVolatileSnapshotRequest, Handle);
- HFuncTraced(TEvDataShard::TEvBuildIndexCreateRequest, Handle);
+ HFuncTraced(TEvDataShard::TEvBuildIndexCreateRequest, Handle);
HFunc(TEvPrivate::TEvAsyncJobComplete, Handle);
CFunc(TEvPrivate::EvPeriodicWakeup, DoPeriodicTasks);
HFunc(TEvents::TEvUndelivered, Handle);
@@ -2265,7 +2265,7 @@ protected:
HFuncTraced(TEvTablet::TEvTabletDead, HandleTabletDead);
default:
LOG_WARN_S(ctx, NKikimrServices::TX_DATASHARD, "TDataShard::BrokenState at tablet " << TabletID()
- << " unhandled event type: " << ev->GetTypeRewrite()
+ << " unhandled event type: " << ev->GetTypeRewrite()
<< " event: " << (ev->HasEvent() ? ev->GetBase()->ToString().data() : "serialized?"));
ctx.Send(ev->ForwardOnNondelivery(TEvents::TEvUndelivered::ReasonActorUnknown));
break;
@@ -2308,7 +2308,7 @@ protected:
void SendViaSchemeshardPipe(const TActorContext &ctx, ui64 tabletId, THolder<TEvDataShard::TEvSchemaChanged> event) {
Y_VERIFY(tabletId);
- Y_VERIFY(CurrentSchemeShardId == tabletId);
+ Y_VERIFY(CurrentSchemeShardId == tabletId);
if (!SchemeShardPipe) {
NTabletPipe::TClientConfig clientConfig;
@@ -2319,13 +2319,13 @@ protected:
void ReportState(const TActorContext &ctx, ui32 state) {
LOG_INFO_S(ctx, NKikimrServices::TX_DATASHARD, TabletID() << " Reporting state " << DatashardStateName(State)
- << " to schemeshard " << CurrentSchemeShardId);
+ << " to schemeshard " << CurrentSchemeShardId);
Y_VERIFY(state != TShardState::Offline || !HasSharedBlobs(),
"Datashard %" PRIu64 " tried to go offline while having shared blobs", TabletID());
if (!StateReportPipe) {
NTabletPipe::TClientConfig clientConfig;
clientConfig.RetryPolicy = SchemeShardPipeRetryPolicy;
- StateReportPipe = ctx.Register(NTabletPipe::CreateClient(ctx.SelfID, CurrentSchemeShardId, clientConfig));
+ StateReportPipe = ctx.Register(NTabletPipe::CreateClient(ctx.SelfID, CurrentSchemeShardId, clientConfig));
}
THolder<TEvDataShard::TEvStateChanged> ev(new TEvDataShard::TEvStateChanged(ctx.SelfID, TabletID(), state));
NTabletPipe::SendData(ctx, StateReportPipe, ev.Release());
@@ -2353,10 +2353,10 @@ protected:
if (!DbStatsReportPipe) {
NTabletPipe::TClientConfig clientConfig;
- DbStatsReportPipe = ctx.Register(NTabletPipe::CreateClient(ctx.SelfID, CurrentSchemeShardId, clientConfig));
+ DbStatsReportPipe = ctx.Register(NTabletPipe::CreateClient(ctx.SelfID, CurrentSchemeShardId, clientConfig));
}
- THolder<TEvDataShard::TEvPeriodicTableStats> ev(new TEvDataShard::TEvPeriodicTableStats(TabletID(), PathOwnerId, tableId));
+ THolder<TEvDataShard::TEvPeriodicTableStats> ev(new TEvDataShard::TEvPeriodicTableStats(TabletID(), PathOwnerId, tableId));
ev->Record.SetShardState(State);
ev->Record.SetGeneration(Executor()->Generation());
ev->Record.SetRound(StatsReportRound++);
diff --git a/ydb/core/tx/datashard/datashard_locks.cpp b/ydb/core/tx/datashard/datashard_locks.cpp
index 8a67d450054..aa5fc3876b4 100644
--- a/ydb/core/tx/datashard/datashard_locks.cpp
+++ b/ydb/core/tx/datashard/datashard_locks.cpp
@@ -294,11 +294,11 @@ void TLockLocker::UpdateSchema(const TPathId& tableId, const TUserTable& tableIn
table->UpdateKeyColumnsTypes(tableInfo.KeyColumnTypes);
}
-void TLockLocker::RemoveSchema(const TPathId& tableId) {
- Tables.erase(tableId);
-}
-
-
+void TLockLocker::RemoveSchema(const TPathId& tableId) {
+ Tables.erase(tableId);
+}
+
+
bool TLockLocker::ForceShardLock(const THashSet<TPathId>& rangeTables) const {
for (const TPathId& tableId : rangeTables) {
auto it = Tables.find(tableId);
diff --git a/ydb/core/tx/datashard/datashard_locks.h b/ydb/core/tx/datashard/datashard_locks.h
index 4f11867f6ce..19c68c4d88d 100644
--- a/ydb/core/tx/datashard/datashard_locks.h
+++ b/ydb/core/tx/datashard/datashard_locks.h
@@ -9,7 +9,7 @@
#include <library/cpp/cache/cache.h>
#include <util/generic/queue.h>
-#include <util/generic/set.h>
+#include <util/generic/set.h>
#include <util/system/valgrind.h>
#include <util/system/sanitizers.h>
@@ -320,7 +320,7 @@ public:
}
void UpdateSchema(const TPathId& tableId, const TUserTable& tableInfo);
- void RemoveSchema(const TPathId& tableId);
+ void RemoveSchema(const TPathId& tableId);
bool ForceShardLock(const THashSet<TPathId>& rangeTables) const;
// optimisation: set to remove broken lock at next Remove()
@@ -460,10 +460,10 @@ public:
Locker.UpdateSchema(tableId, tableInfo);
}
- void RemoveSchema(const TPathId& tableId) {
- Locker.RemoveSchema(tableId);
- }
-
+ void RemoveSchema(const TPathId& tableId) {
+ Locker.RemoveSchema(tableId);
+ }
+
TVector<TLock> ApplyLocks();
ui64 ExtractLockTxId(const TArrayRef<const TCell>& syslockKey) const;
TLock GetLock(const TArrayRef<const TCell>& syslockKey) const;
diff --git a/ydb/core/tx/datashard/datashard_pipeline.cpp b/ydb/core/tx/datashard/datashard_pipeline.cpp
index 5eb22f45a11..3498162c17e 100644
--- a/ydb/core/tx/datashard/datashard_pipeline.cpp
+++ b/ydb/core/tx/datashard/datashard_pipeline.cpp
@@ -68,7 +68,7 @@ void TPipeline::PersistConfig(NIceDb::TNiceDb& db) {
Self->PersistSys(db, Schema::SysPipeline_LimitDataTxCache, Config.LimitDataTxCache);
}
-void TPipeline::UpdateConfig(NIceDb::TNiceDb& db, const NKikimrSchemeOp::TPipelineConfig& cfg) {
+void TPipeline::UpdateConfig(NIceDb::TNiceDb& db, const NKikimrSchemeOp::TPipelineConfig& cfg) {
Config.Update(cfg);
PersistConfig(db);
}
@@ -802,16 +802,16 @@ bool TPipeline::PlanTxs(ui64 step,
NIceDb::TNiceDb db(txc.DB);
SaveLastPlannedTx(db, TStepOrder(step, lastTxId));
- for (ui64 txId : txIds) {
- if (SchemaTx && SchemaTx->TxId == txId && SchemaTx->MinStep > step) {
- TString explain = TStringBuilder() << "Scheme transaction has come too early"
- << ", only after particular step this shema tx is allowed"
- << ", txId: " << txId
- << ", expected min step: " << SchemaTx->MinStep
- << ", actual step: " << step;
- Y_VERIFY_DEBUG_S(SchemaTx->MinStep <= step, explain);
- LOG_ALERT_S(ctx, NKikimrServices::TX_DATASHARD, explain);
- }
+ for (ui64 txId : txIds) {
+ if (SchemaTx && SchemaTx->TxId == txId && SchemaTx->MinStep > step) {
+ TString explain = TStringBuilder() << "Scheme transaction has come too early"
+ << ", only after particular step this shema tx is allowed"
+ << ", txId: " << txId
+ << ", expected min step: " << SchemaTx->MinStep
+ << ", actual step: " << step;
+ Y_VERIFY_DEBUG_S(SchemaTx->MinStep <= step, explain);
+ LOG_ALERT_S(ctx, NKikimrServices::TX_DATASHARD, explain);
+ }
auto op = Self->TransQueue.FindTxInFly(txId);
if (!op) {
@@ -837,7 +837,7 @@ bool TPipeline::PlanTxs(ui64 step,
auto status = RunExecutionUnit(op, txc, ctx);
Y_VERIFY(status == EExecutionStatus::Executed);
}
- }
+ }
AddCandidateUnit(EExecutionUnitKind::PlanQueue);
MaybeActivateWaitingSchemeOps(ctx);
diff --git a/ydb/core/tx/datashard/datashard_pipeline.h b/ydb/core/tx/datashard/datashard_pipeline.h
index a9f22a417d5..67c35260b28 100644
--- a/ydb/core/tx/datashard/datashard_pipeline.h
+++ b/ydb/core/tx/datashard/datashard_pipeline.h
@@ -59,7 +59,7 @@ public:
LimitDataTxCache = DefaultLimitDataTxCache();
}
- void Update(const NKikimrSchemeOp::TPipelineConfig& cfg) {
+ void Update(const NKikimrSchemeOp::TPipelineConfig& cfg) {
if (cfg.GetEnableOutOfOrder()) {
Flags |= EFlagsOutOfOrder;
} else {
@@ -90,7 +90,7 @@ public:
~TPipeline();
bool Load(NIceDb::TNiceDb& db);
- void UpdateConfig(NIceDb::TNiceDb& db, const NKikimrSchemeOp::TPipelineConfig& cfg);
+ void UpdateConfig(NIceDb::TNiceDb& db, const NKikimrSchemeOp::TPipelineConfig& cfg);
bool OutOfOrderLimits() const;
bool CanRunAnotherOp();
@@ -159,10 +159,10 @@ public:
bool HasCopy() const { return SchemaTx && SchemaTx->IsCopy(); }
bool HasCreatePersistentSnapshot() const { return SchemaTx && SchemaTx->IsCreatePersistentSnapshot(); }
bool HasDropPersistentSnapshot() const { return SchemaTx && SchemaTx->IsDropPersistentSnapshot(); }
- bool HasInitiateBuilIndex() const { return SchemaTx && SchemaTx->IsInitiateBuildIndex(); }
- bool HasFinalizeBuilIndex() const { return SchemaTx && SchemaTx->IsFinalizeBuildIndex(); }
- bool HasDropIndexNotice() const { return SchemaTx && SchemaTx->IsDropIndexNotice(); }
- bool HasMove() const { return SchemaTx && SchemaTx->IsMove(); }
+ bool HasInitiateBuilIndex() const { return SchemaTx && SchemaTx->IsInitiateBuildIndex(); }
+ bool HasFinalizeBuilIndex() const { return SchemaTx && SchemaTx->IsFinalizeBuildIndex(); }
+ bool HasDropIndexNotice() const { return SchemaTx && SchemaTx->IsDropIndexNotice(); }
+ bool HasMove() const { return SchemaTx && SchemaTx->IsMove(); }
bool HasCreateCdcStream() const { return SchemaTx && SchemaTx->IsCreateCdcStream(); }
bool HasAlterCdcStream() const { return SchemaTx && SchemaTx->IsAlterCdcStream(); }
bool HasDropCdcStream() const { return SchemaTx && SchemaTx->IsDropCdcStream(); }
diff --git a/ydb/core/tx/datashard/datashard_split_dst.cpp b/ydb/core/tx/datashard/datashard_split_dst.cpp
index 7dd3f7b524a..65750810013 100644
--- a/ydb/core/tx/datashard/datashard_split_dst.cpp
+++ b/ydb/core/tx/datashard/datashard_split_dst.cpp
@@ -28,29 +28,29 @@ public:
return true;
}
- NIceDb::TNiceDb db(txc.DB);
-
+ NIceDb::TNiceDb db(txc.DB);
+
const bool initializeSchema = Ev->Get()->Record.HasCreateTable();
if (initializeSchema) {
// Schema changes must go first in a transaction
- const NKikimrSchemeOp::TTableDescription& createTable = Ev->Get()->Record.GetCreateTable();
-
+ const NKikimrSchemeOp::TTableDescription& createTable = Ev->Get()->Record.GetCreateTable();
+
TPathId tableId(Self->GetPathOwnerId(), createTable.GetId_Deprecated());
- if (createTable.HasPathId()) {
- Y_VERIFY(Self->GetPathOwnerId() == createTable.GetPathId().GetOwnerId() || Self->GetPathOwnerId() == INVALID_TABLET_ID);
+ if (createTable.HasPathId()) {
+ Y_VERIFY(Self->GetPathOwnerId() == createTable.GetPathId().GetOwnerId() || Self->GetPathOwnerId() == INVALID_TABLET_ID);
tableId.OwnerId = createTable.GetPathId().GetOwnerId();
tableId.LocalPathId = createTable.GetPathId().GetLocalId();
} else if (tableId.OwnerId == INVALID_TABLET_ID) {
// Legacy schemeshard before migrations, shouldn't be possible
tableId.OwnerId = Ev->Get()->Record.GetSchemeshardTabletId();
- }
-
+ }
+
auto info = Self->CreateUserTable(txc, createTable);
Self->AddUserTable(tableId, info);
-
- if (Self->GetPathOwnerId() == INVALID_TABLET_ID) {
+
+ if (Self->GetPathOwnerId() == INVALID_TABLET_ID) {
Self->PersistOwnerPathId(tableId.OwnerId, txc);
- }
+ }
}
Self->DstSplitDescription = std::make_shared<NKikimrTxDataShard::TSplitMergeDescription>(Ev->Get()->Record.GetSplitDescription());
@@ -74,15 +74,15 @@ public:
Self->State = TShardState::SplitDstReceivingSnapshot;
Self->PersistSys(db, Schema::Sys_State, Self->State);
- Self->CurrentSchemeShardId = Ev->Get()->Record.GetSchemeshardTabletId();
+ Self->CurrentSchemeShardId = Ev->Get()->Record.GetSchemeshardTabletId();
Self->PersistSys(db, Schema::Sys_CurrentSchemeShardId, Self->CurrentSchemeShardId);
- if (!Self->ProcessingParams && Ev->Get()->Record.HasProcessingParams()) {
+ if (!Self->ProcessingParams && Ev->Get()->Record.HasProcessingParams()) {
Self->ProcessingParams.reset(new NKikimrSubDomains::TProcessingParams());
- Self->ProcessingParams->CopyFrom(Ev->Get()->Record.GetProcessingParams());
- Self->PersistSys(db, Schema::Sys_SubDomainInfo, Self->ProcessingParams->SerializeAsString());
- }
-
+ Self->ProcessingParams->CopyFrom(Ev->Get()->Record.GetProcessingParams());
+ Self->PersistSys(db, Schema::Sys_SubDomainInfo, Self->ProcessingParams->SerializeAsString());
+ }
+
if (Self->CurrentSchemeShardId && Ev->Get()->Record.HasSubDomainPathId()) {
Self->PersistSubDomainPathId(Self->CurrentSchemeShardId, Ev->Get()->Record.GetSubDomainPathId(), txc);
Self->StopFindSubDomainPathId();
@@ -102,7 +102,7 @@ public:
LOG_DEBUG_S(ctx, NKikimrServices::TX_DATASHARD, Self->TabletID() << " ack init split/merge destination OpId " << opId);
ctx.Send(ackTo, new TEvDataShard::TEvInitSplitMergeDestinationAck(opId, Self->TabletID()));
- Self->SendRegistrationRequestTimeCast(ctx);
+ Self->SendRegistrationRequestTimeCast(ctx);
}
};
@@ -130,7 +130,7 @@ public:
const auto& tableScheme = Ev->Get()->Record.GetUserTableScheme();
TString tableName = TDataShard::Schema::UserTablePrefix + tableScheme.GetName();
if (!txc.DB.GetScheme().TableNames.contains(tableName)) { // TODO: properly check if table has already been created
- NKikimrSchemeOp::TTableDescription newTableScheme(tableScheme);
+ NKikimrSchemeOp::TTableDescription newTableScheme(tableScheme);
// Get this shard's range boundaries from the split/merge description
TString rangeBegin, rangeEnd;
@@ -248,7 +248,7 @@ public:
// Mark versions not accessible via snapshots as deleted
for (const auto& kv : Self->GetUserTables()) {
// FIXME: tables need to always have owner id
- ui64 ownerId = Self->GetPathOwnerId();
+ ui64 ownerId = Self->GetPathOwnerId();
ui64 tableId = kv.first;
ui32 localTableId = kv.second->LocalTid;
TRowVersion vlower = TRowVersion::Min();
diff --git a/ydb/core/tx/datashard/datashard_subdomain_path_id.cpp b/ydb/core/tx/datashard/datashard_subdomain_path_id.cpp
index 938e9162738..97d6b88e94c 100644
--- a/ydb/core/tx/datashard/datashard_subdomain_path_id.cpp
+++ b/ydb/core/tx/datashard/datashard_subdomain_path_id.cpp
@@ -54,7 +54,7 @@ private:
Timer = { };
SchemeShardPipe = Register(NTabletPipe::CreateClient(SelfId(), SchemeShardId));
NTabletPipe::SendData(SelfId(), SchemeShardPipe,
- new NSchemeShard::TEvSchemeShard::TEvFindTabletSubDomainPathId(TabletId));
+ new NSchemeShard::TEvSchemeShard::TEvFindTabletSubDomainPathId(TabletId));
Become(&TThis::StateWork);
}
@@ -65,7 +65,7 @@ private:
sFunc(TEvents::TEvPoison, PassAway);
hFunc(TEvTabletPipe::TEvClientConnected, Handle);
hFunc(TEvTabletPipe::TEvClientDestroyed, Handle);
- hFunc(NSchemeShard::TEvSchemeShard::TEvFindTabletSubDomainPathIdResult, Handle);
+ hFunc(NSchemeShard::TEvSchemeShard::TEvFindTabletSubDomainPathIdResult, Handle);
}
}
@@ -91,10 +91,10 @@ private:
}
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvFindTabletSubDomainPathIdResult::TPtr& ev) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvFindTabletSubDomainPathIdResult::TPtr& ev) {
const auto* msg = ev->Get();
- if (msg->Record.GetStatus() != NKikimrScheme::TEvFindTabletSubDomainPathIdResult::SUCCESS) {
+ if (msg->Record.GetStatus() != NKikimrScheme::TEvFindTabletSubDomainPathIdResult::SUCCESS) {
// The request failed for some reason, we just stop trying in that case
PassAway();
return;
diff --git a/ydb/core/tx/datashard/datashard_txs.h b/ydb/core/tx/datashard/datashard_txs.h
index 48ba43f6031..4a9ab008789 100644
--- a/ydb/core/tx/datashard/datashard_txs.h
+++ b/ydb/core/tx/datashard/datashard_txs.h
@@ -208,16 +208,16 @@ public:
};
class TDataShard::TTxMigrateSchemeShard : public NTabletFlatExecutor::TTransactionBase<TDataShard> {
-public:
+public:
TTxMigrateSchemeShard(TDataShard* ds, TEvDataShard::TEvMigrateSchemeShardRequest::TPtr ev);
- bool Execute(TTransactionContext& txc, const TActorContext& ctx) override;
- void Complete(const TActorContext& ctx) override;
- TTxType GetTxType() const override { return TXTYPE_MIGRATE_SCHEMESHARD; }
-private:
- TEvDataShard::TEvMigrateSchemeShardRequest::TPtr Ev;
- THolder<TEvDataShard::TEvMigrateSchemeShardResponse> Reply;
-};
-
+ bool Execute(TTransactionContext& txc, const TActorContext& ctx) override;
+ void Complete(const TActorContext& ctx) override;
+ TTxType GetTxType() const override { return TXTYPE_MIGRATE_SCHEMESHARD; }
+private:
+ TEvDataShard::TEvMigrateSchemeShardRequest::TPtr Ev;
+ THolder<TEvDataShard::TEvMigrateSchemeShardResponse> Reply;
+};
+
class TDataShard::TTxGetS3Upload: public NTabletFlatExecutor::TTransactionBase<TDataShard> {
public:
TTxGetS3Upload(TDataShard* ds, TEvDataShard::TEvGetS3Upload::TPtr ev);
diff --git a/ydb/core/tx/datashard/datashard_user_table.cpp b/ydb/core/tx/datashard/datashard_user_table.cpp
index 9d6049486a6..70bc9400733 100644
--- a/ydb/core/tx/datashard/datashard_user_table.cpp
+++ b/ydb/core/tx/datashard/datashard_user_table.cpp
@@ -11,7 +11,7 @@ using NTabletFlatExecutor::TTransactionContext;
namespace NDataShard {
-TUserTable::TUserTable(ui32 localTid, const NKikimrSchemeOp::TTableDescription& descr, ui32 shadowTid)
+TUserTable::TUserTable(ui32 localTid, const NKikimrSchemeOp::TTableDescription& descr, ui32 shadowTid)
: LocalTid(localTid)
, ShadowTid(shadowTid)
{
@@ -21,40 +21,40 @@ TUserTable::TUserTable(ui32 localTid, const NKikimrSchemeOp::TTableDescription&
ParseProto(descr);
}
-TUserTable::TUserTable(const TUserTable& table, const NKikimrSchemeOp::TTableDescription& descr)
+TUserTable::TUserTable(const TUserTable& table, const NKikimrSchemeOp::TTableDescription& descr)
: TUserTable(table)
{
- Y_VERIFY_S(Name == descr.GetName(), "Name: " << Name << " descr.Name: " << descr.GetName());
+ Y_VERIFY_S(Name == descr.GetName(), "Name: " << Name << " descr.Name: " << descr.GetName());
ParseProto(descr);
AlterSchema();
}
void TUserTable::SetPath(const TString &path)
{
- auto name = ExtractBase(path);
- if (!name) {
- return;
- }
-
- Name = name;
+ auto name = ExtractBase(path);
+ if (!name) {
+ return;
+ }
+
+ Name = name;
Path = path;
AlterSchema();
}
-
-void TUserTable::SetTableSchemaVersion(ui64 schemaVersion)
-{
- NKikimrSchemeOp::TTableDescription schema;
- GetSchema(schema);
- schema.SetTableSchemaVersion(schemaVersion);
- SetSchema(schema);
-
- TableSchemaVersion = schemaVersion;
-}
-
+
+void TUserTable::SetTableSchemaVersion(ui64 schemaVersion)
+{
+ NKikimrSchemeOp::TTableDescription schema;
+ GetSchema(schema);
+ schema.SetTableSchemaVersion(schemaVersion);
+ SetSchema(schema);
+
+ TableSchemaVersion = schemaVersion;
+}
+
bool TUserTable::ResetTableSchemaVersion()
{
if (TableSchemaVersion) {
- NKikimrSchemeOp::TTableDescription schema;
+ NKikimrSchemeOp::TTableDescription schema;
GetSchema(schema);
schema.ClearTableSchemaVersion();
@@ -67,7 +67,7 @@ bool TUserTable::ResetTableSchemaVersion()
return false;
}
-void TUserTable::AddIndex(const NKikimrSchemeOp::TIndexDescription& indexDesc) {
+void TUserTable::AddIndex(const NKikimrSchemeOp::TIndexDescription& indexDesc) {
Y_VERIFY(indexDesc.HasPathOwnerId() && indexDesc.HasLocalPathId());
const auto addIndexPathId = TPathId(indexDesc.GetPathOwnerId(), indexDesc.GetLocalPathId());
@@ -78,7 +78,7 @@ void TUserTable::AddIndex(const NKikimrSchemeOp::TIndexDescription& indexDesc) {
Indexes.emplace(addIndexPathId, TTableIndex(indexDesc, Columns));
AsyncIndexCount += ui32(indexDesc.GetType() == TTableIndex::EIndexType::EIndexTypeGlobalAsync);
- NKikimrSchemeOp::TTableDescription schema;
+ NKikimrSchemeOp::TTableDescription schema;
GetSchema(schema);
schema.MutableTableIndexes()->Add()->CopyFrom(indexDesc);
@@ -94,7 +94,7 @@ void TUserTable::DropIndex(const TPathId& indexPathId) {
AsyncIndexCount -= ui32(it->second.Type == TTableIndex::EIndexType::EIndexTypeGlobalAsync);
Indexes.erase(it);
- NKikimrSchemeOp::TTableDescription schema;
+ NKikimrSchemeOp::TTableDescription schema;
GetSchema(schema);
for (auto it = schema.GetTableIndexes().begin(); it != schema.GetTableIndexes().end(); ++it) {
@@ -115,7 +115,7 @@ bool TUserTable::HasAsyncIndexes() const {
return AsyncIndexCount > 0;
}
-void TUserTable::AddCdcStream(const NKikimrSchemeOp::TCdcStreamDescription& streamDesc) {
+void TUserTable::AddCdcStream(const NKikimrSchemeOp::TCdcStreamDescription& streamDesc) {
Y_VERIFY(streamDesc.HasPathId());
const auto streamPathId = TPathId(streamDesc.GetPathId().GetOwnerId(), streamDesc.GetPathId().GetLocalId());
@@ -125,7 +125,7 @@ void TUserTable::AddCdcStream(const NKikimrSchemeOp::TCdcStreamDescription& stre
CdcStreams.emplace(streamPathId, TCdcStream(streamDesc));
- NKikimrSchemeOp::TTableDescription schema;
+ NKikimrSchemeOp::TTableDescription schema;
GetSchema(schema);
schema.MutableCdcStreams()->Add()->CopyFrom(streamDesc);
@@ -140,7 +140,7 @@ void TUserTable::DisableCdcStream(const TPathId& streamPathId) {
it->second.State = TCdcStream::EState::ECdcStreamStateDisabled;
- NKikimrSchemeOp::TTableDescription schema;
+ NKikimrSchemeOp::TTableDescription schema;
GetSchema(schema);
for (auto it = schema.MutableCdcStreams()->begin(); it != schema.MutableCdcStreams()->end(); ++it) {
@@ -165,7 +165,7 @@ void TUserTable::DropCdcStream(const TPathId& streamPathId) {
CdcStreams.erase(it);
- NKikimrSchemeOp::TTableDescription schema;
+ NKikimrSchemeOp::TTableDescription schema;
GetSchema(schema);
for (auto it = schema.GetCdcStreams().begin(); it != schema.GetCdcStreams().end(); ++it) {
@@ -186,32 +186,32 @@ bool TUserTable::HasCdcStreams() const {
return !CdcStreams.empty();
}
-void TUserTable::ParseProto(const NKikimrSchemeOp::TTableDescription& descr)
+void TUserTable::ParseProto(const NKikimrSchemeOp::TTableDescription& descr)
{
// We expect schemeshard to send us full list of storage rooms
if (descr.GetPartitionConfig().StorageRoomsSize()) {
Rooms.clear();
}
- for (const auto& roomDescr : descr.GetPartitionConfig().GetStorageRooms()) {
- TStorageRoom::TPtr room = new TStorageRoom(roomDescr);
- Rooms[room->GetId()] = room;
- }
-
+ for (const auto& roomDescr : descr.GetPartitionConfig().GetStorageRooms()) {
+ TStorageRoom::TPtr room = new TStorageRoom(roomDescr);
+ Rooms[room->GetId()] = room;
+ }
+
for (const auto& family : descr.GetPartitionConfig().GetColumnFamilies()) {
auto it = Families.find(family.GetId());
if (it == Families.end()) {
- it = Families.emplace(std::make_pair(family.GetId(), TUserFamily(family))).first;
+ it = Families.emplace(std::make_pair(family.GetId(), TUserFamily(family))).first;
} else {
it->second.Update(family);
}
}
-
+
for (auto& kv : Families) {
auto roomIt = Rooms.find(kv.second.GetRoomId());
- if (roomIt != Rooms.end()) {
+ if (roomIt != Rooms.end()) {
kv.second.Update(roomIt->second);
- }
+ }
}
for (const auto& col : descr.GetColumns()) {
@@ -300,15 +300,15 @@ void TUserTable::CheckSpecialColumns() {
}
void TUserTable::AlterSchema() {
- NKikimrSchemeOp::TTableDescription schema;
+ NKikimrSchemeOp::TTableDescription schema;
GetSchema(schema);
auto& partConfig = *schema.MutablePartitionConfig();
- partConfig.ClearStorageRooms();
- for (const auto& room : Rooms) {
- partConfig.AddStorageRooms()->CopyFrom(*room.second);
- }
-
+ partConfig.ClearStorageRooms();
+ for (const auto& room : Rooms) {
+ partConfig.AddStorageRooms()->CopyFrom(*room.second);
+ }
+
// FIXME: these generated column families are incorrect!
partConfig.ClearColumnFamilies();
for (const auto& f : Families) {
@@ -339,7 +339,7 @@ void TUserTable::AlterSchema() {
schema.SetPartitionRangeEnd(Range.To.GetBuffer());
schema.SetPartitionRangeEndIsInclusive(Range.ToInclusive);
- schema.SetPath(Name);
+ schema.SetPath(Name);
schema.SetPath(Path);
SetSchema(schema);
@@ -347,21 +347,21 @@ void TUserTable::AlterSchema() {
void TUserTable::ApplyCreate(
TTransactionContext& txc, const TString& tableName,
- const NKikimrSchemeOp::TPartitionConfig& partConfig) const
+ const NKikimrSchemeOp::TPartitionConfig& partConfig) const
{
DoApplyCreate(txc, tableName, false, partConfig);
}
void TUserTable::ApplyCreateShadow(
TTransactionContext& txc, const TString& tableName,
- const NKikimrSchemeOp::TPartitionConfig& partConfig) const
+ const NKikimrSchemeOp::TPartitionConfig& partConfig) const
{
DoApplyCreate(txc, tableName, true, partConfig);
}
void TUserTable::DoApplyCreate(
TTransactionContext& txc, const TString& tableName, bool shadow,
- const NKikimrSchemeOp::TPartitionConfig& partConfig) const
+ const NKikimrSchemeOp::TPartitionConfig& partConfig) const
{
const ui32 tid = shadow ? ShadowTid : LocalTid;
@@ -432,10 +432,10 @@ void TUserTable::DoApplyCreate(
void TUserTable::ApplyAlter(
TTransactionContext& txc, const TUserTable& oldTable,
- const NKikimrSchemeOp::TTableDescription& delta, TString& strError)
+ const NKikimrSchemeOp::TTableDescription& delta, TString& strError)
{
const auto& configDelta = delta.GetPartitionConfig();
- NKikimrSchemeOp::TTableDescription schema;
+ NKikimrSchemeOp::TTableDescription schema;
GetSchema(schema);
auto& config = *schema.MutablePartitionConfig();
@@ -583,7 +583,7 @@ void TUserTable::ApplyDefaults(TTransactionContext& txc) const
return;
}
- NKikimrSchemeOp::TTableDescription schema;
+ NKikimrSchemeOp::TTableDescription schema;
GetSchema(schema);
const auto& config = schema.GetPartitionConfig();
diff --git a/ydb/core/tx/datashard/datashard_user_table.h b/ydb/core/tx/datashard/datashard_user_table.h
index bf42ae74bdc..0dab30cb84f 100644
--- a/ydb/core/tx/datashard/datashard_user_table.h
+++ b/ydb/core/tx/datashard/datashard_user_table.h
@@ -26,20 +26,20 @@ struct TUserTable : public TThrRefBase {
using ECodec = NTable::NPage::ECodec;
using ECache = NTable::NPage::ECache;
- TUserFamily(const NKikimrSchemeOp::TFamilyDescription& family)
+ TUserFamily(const NKikimrSchemeOp::TFamilyDescription& family)
: ColumnCodec(family.GetColumnCodec())
, ColumnCache(family.GetColumnCache())
- , OuterThreshold(SaveGetThreshold(family.GetStorageConfig().GetDataThreshold()))
- , ExternalThreshold(SaveGetThreshold(family.GetStorageConfig().GetExternalThreshold()))
+ , OuterThreshold(SaveGetThreshold(family.GetStorageConfig().GetDataThreshold()))
+ , ExternalThreshold(SaveGetThreshold(family.GetStorageConfig().GetExternalThreshold()))
, Storage(family.GetStorage())
, Codec(ExtractDbCodec(family))
, Cache(ExtractDbCache(family))
, Room(new TStorageRoom(family.GetRoom()))
, Name(family.GetName())
- {
- }
+ {
+ }
- void Update(const NKikimrSchemeOp::TFamilyDescription& family) {
+ void Update(const NKikimrSchemeOp::TFamilyDescription& family) {
if (family.HasColumnCodec()) {
ColumnCodec = family.GetColumnCodec();
Codec = ToDbCodec(ColumnCodec);
@@ -48,55 +48,55 @@ struct TUserTable : public TThrRefBase {
ColumnCache = family.GetColumnCache();
Cache = ToDbCache(ColumnCache);
}
- if (family.GetStorageConfig().HasDataThreshold()) {
- OuterThreshold = SaveGetThreshold(family.GetStorageConfig().GetDataThreshold());
- }
- if (family.GetStorageConfig().GetExternalThreshold()) {
- ExternalThreshold = SaveGetThreshold(family.GetStorageConfig().GetExternalThreshold());
- }
+ if (family.GetStorageConfig().HasDataThreshold()) {
+ OuterThreshold = SaveGetThreshold(family.GetStorageConfig().GetDataThreshold());
+ }
+ if (family.GetStorageConfig().GetExternalThreshold()) {
+ ExternalThreshold = SaveGetThreshold(family.GetStorageConfig().GetExternalThreshold());
+ }
if (family.HasStorage()) {
Storage = family.GetStorage();
}
Room.Reset(new TStorageRoom(family.GetRoom()));
}
- static ui32 SaveGetThreshold(ui32 value) {
- return 0 == value ? Max<ui32>() : value;
- }
-
- void Update(TStorageRoom::TPtr room) {
- if (room->GetId() != Room->GetId()) {
- return;
- }
-
- Room = room;
- }
-
- NKikimrSchemeOp::EColumnCodec ColumnCodec;
- NKikimrSchemeOp::EColumnCache ColumnCache;
- ui32 OuterThreshold;
- ui32 ExternalThreshold;
- NKikimrSchemeOp::EColumnStorage Storage;
-
-
+ static ui32 SaveGetThreshold(ui32 value) {
+ return 0 == value ? Max<ui32>() : value;
+ }
+
+ void Update(TStorageRoom::TPtr room) {
+ if (room->GetId() != Room->GetId()) {
+ return;
+ }
+
+ Room = room;
+ }
+
+ NKikimrSchemeOp::EColumnCodec ColumnCodec;
+ NKikimrSchemeOp::EColumnCache ColumnCache;
+ ui32 OuterThreshold;
+ ui32 ExternalThreshold;
+ NKikimrSchemeOp::EColumnStorage Storage;
+
+
ECodec Codec;
ECache Cache;
- TStorageRoom::TPtr Room;
+ TStorageRoom::TPtr Room;
ui32 MainChannel() const {
- if (!*Room) {
- return MainChannelByStorageEnum();
- }
-
- return Room->GetChannel(NKikimrStorageSettings::TChannelPurpose::Data, 1);
- }
-
- ui32 MainChannelByStorageEnum() const {
+ if (!*Room) {
+ return MainChannelByStorageEnum();
+ }
+
+ return Room->GetChannel(NKikimrStorageSettings::TChannelPurpose::Data, 1);
+ }
+
+ ui32 MainChannelByStorageEnum() const {
switch (Storage) {
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage2:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Ext2:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Ext1:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Med2Ext2:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage2:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Ext2:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Ext1:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Med2Ext2:
return 2;
default:
break;
@@ -105,40 +105,40 @@ struct TUserTable : public TThrRefBase {
}
ui32 OuterChannel() const {
- if (!*Room) {
- return OuterChannelByStorageEnum();
- }
-
- return Room->GetChannel(NKikimrStorageSettings::TChannelPurpose::Data, 1);
- }
-
- ui32 OuterChannelByStorageEnum() const {
+ if (!*Room) {
+ return OuterChannelByStorageEnum();
+ }
+
+ return Room->GetChannel(NKikimrStorageSettings::TChannelPurpose::Data, 1);
+ }
+
+ ui32 OuterChannelByStorageEnum() const {
switch (Storage) {
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Med2Ext2:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Med2Ext2:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Med2Ext2:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Med2Ext2:
return 2;
default:
break;
}
- return MainChannelByStorageEnum();
+ return MainChannelByStorageEnum();
}
ui32 ExternalChannel() const {
- if (!*Room) {
- return ExternalChannelByStorageEnum();
- }
-
- return Room->GetChannel(NKikimrStorageSettings::TChannelPurpose::External, 1);
- }
-
- ui32 ExternalChannelByStorageEnum() const {
+ if (!*Room) {
+ return ExternalChannelByStorageEnum();
+ }
+
+ return Room->GetChannel(NKikimrStorageSettings::TChannelPurpose::External, 1);
+ }
+
+ ui32 ExternalChannelByStorageEnum() const {
switch (Storage) {
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage2:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Ext2:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Ext2:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Med2Ext2:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Med2Ext2:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorageTest_1_2_1k:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage2:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Ext2:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Ext2:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Med2Ext2:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Med2Ext2:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorageTest_1_2_1k:
return 2;
default:
break;
@@ -146,35 +146,35 @@ struct TUserTable : public TThrRefBase {
return 1;
}
- ui32 GetOuterThreshold() const {
- switch (Storage) {
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Med2Ext2:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Med2Ext2:
- return 12*1024;
- case NKikimrSchemeOp::EColumnStorage::ColumnStorageTest_1_2_1k:
- return 512;
- default:
- break;
- }
- return OuterThreshold;
- }
-
- ui32 GetExternalThreshold() const {
+ ui32 GetOuterThreshold() const {
switch (Storage) {
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage2:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Ext1:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Ext2:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Ext1:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Ext2:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Med2Ext2:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Med2Ext2:
- return 512*1024;
- case NKikimrSchemeOp::EColumnStorage::ColumnStorageTest_1_2_1k:
- return 1024;
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Med2Ext2:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Med2Ext2:
+ return 12*1024;
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorageTest_1_2_1k:
+ return 512;
default:
break;
}
- return ExternalThreshold;
+ return OuterThreshold;
+ }
+
+ ui32 GetExternalThreshold() const {
+ switch (Storage) {
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage2:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Ext1:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Ext2:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Ext1:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Ext2:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Med2Ext2:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Med2Ext2:
+ return 512*1024;
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorageTest_1_2_1k:
+ return 1024;
+ default:
+ break;
+ }
+ return ExternalThreshold;
}
TString GetName() const {
@@ -183,14 +183,14 @@ struct TUserTable : public TThrRefBase {
return "default";
}
- ui32 GetRoomId() const {
- return Room->GetId();
- }
-
+ ui32 GetRoomId() const {
+ return Room->GetId();
+ }
+
private:
TString Name;
- static ECodec ExtractDbCodec(const NKikimrSchemeOp::TFamilyDescription& family) {
+ static ECodec ExtractDbCodec(const NKikimrSchemeOp::TFamilyDescription& family) {
if (family.HasColumnCodec())
return ToDbCodec(family.GetColumnCodec());
if (family.GetCodec() == 1) // legacy
@@ -198,31 +198,31 @@ struct TUserTable : public TThrRefBase {
return ECodec::Plain;
}
- static ECodec ToDbCodec(NKikimrSchemeOp::EColumnCodec codec) {
+ static ECodec ToDbCodec(NKikimrSchemeOp::EColumnCodec codec) {
switch (codec) {
- case NKikimrSchemeOp::EColumnCodec::ColumnCodecPlain:
+ case NKikimrSchemeOp::EColumnCodec::ColumnCodecPlain:
return ECodec::Plain;
- case NKikimrSchemeOp::EColumnCodec::ColumnCodecLZ4:
- case NKikimrSchemeOp::EColumnCodec::ColumnCodecZSTD: // FIXME: not supported
+ case NKikimrSchemeOp::EColumnCodec::ColumnCodecLZ4:
+ case NKikimrSchemeOp::EColumnCodec::ColumnCodecZSTD: // FIXME: not supported
return ECodec::LZ4;
// keep no default
}
Y_FAIL("unexpected");
}
- static ECache ExtractDbCache(const NKikimrSchemeOp::TFamilyDescription& family) {
+ static ECache ExtractDbCache(const NKikimrSchemeOp::TFamilyDescription& family) {
if (family.HasInMemory() && family.GetInMemory()) // legacy
return ECache::Ever;
return ECache::None;
}
- static ECache ToDbCache(NKikimrSchemeOp::EColumnCache cache) {
+ static ECache ToDbCache(NKikimrSchemeOp::EColumnCache cache) {
switch (cache) {
- case NKikimrSchemeOp::EColumnCache::ColumnCacheNone:
+ case NKikimrSchemeOp::EColumnCache::ColumnCacheNone:
return ECache::None;
- case NKikimrSchemeOp::EColumnCache::ColumnCacheOnce:
+ case NKikimrSchemeOp::EColumnCache::ColumnCacheOnce:
return ECache::Once;
- case NKikimrSchemeOp::EColumnCache::ColumnCacheEver:
+ case NKikimrSchemeOp::EColumnCache::ColumnCacheEver:
return ECache::Ever;
// keep no default
}
@@ -249,7 +249,7 @@ struct TUserTable : public TThrRefBase {
};
struct TTableIndex {
- using EIndexType = NKikimrSchemeOp::EIndexType;
+ using EIndexType = NKikimrSchemeOp::EIndexType;
TString Name;
EIndexType Type;
@@ -258,7 +258,7 @@ struct TUserTable : public TThrRefBase {
TTableIndex() = default;
- TTableIndex(const NKikimrSchemeOp::TIndexDescription& indexDesc, const TMap<ui32, TUserColumn>& columns)
+ TTableIndex(const NKikimrSchemeOp::TIndexDescription& indexDesc, const TMap<ui32, TUserColumn>& columns)
: Name(indexDesc.GetName())
, Type(indexDesc.GetType())
{
@@ -283,8 +283,8 @@ struct TUserTable : public TThrRefBase {
};
struct TCdcStream {
- using EMode = NKikimrSchemeOp::ECdcStreamMode;
- using EState = NKikimrSchemeOp::ECdcStreamState;
+ using EMode = NKikimrSchemeOp::ECdcStreamMode;
+ using EState = NKikimrSchemeOp::ECdcStreamState;
TString Name;
EMode Mode;
@@ -292,7 +292,7 @@ struct TUserTable : public TThrRefBase {
TCdcStream() = default;
- TCdcStream(const NKikimrSchemeOp::TCdcStreamDescription& streamDesc)
+ TCdcStream(const NKikimrSchemeOp::TCdcStreamDescription& streamDesc)
: Name(streamDesc.GetName())
, Mode(streamDesc.GetMode())
, State(streamDesc.GetState())
@@ -346,7 +346,7 @@ struct TUserTable : public TThrRefBase {
ui32 ShadowTid = 0;
TString Name;
TString Path;
- TMap<ui32, TStorageRoom::TPtr> Rooms;
+ TMap<ui32, TStorageRoom::TPtr> Rooms;
TMap<ui32, TUserFamily> Families;
TMap<ui32, TUserColumn> Columns;
TVector<NScheme::TTypeId> KeyColumnTypes;
@@ -369,26 +369,26 @@ struct TUserTable : public TThrRefBase {
TUserTable() { }
- TUserTable(ui32 localTid, const NKikimrSchemeOp::TTableDescription& descr, ui32 shadowTid); // for create
- TUserTable(const TUserTable& table, const NKikimrSchemeOp::TTableDescription& descr); // for alter
+ TUserTable(ui32 localTid, const NKikimrSchemeOp::TTableDescription& descr, ui32 shadowTid); // for create
+ TUserTable(const TUserTable& table, const NKikimrSchemeOp::TTableDescription& descr); // for alter
void ApplyCreate(NTabletFlatExecutor::TTransactionContext& txc, const TString& tableName,
- const NKikimrSchemeOp::TPartitionConfig& partConfig) const;
+ const NKikimrSchemeOp::TPartitionConfig& partConfig) const;
void ApplyCreateShadow(NTabletFlatExecutor::TTransactionContext& txc, const TString& tableName,
- const NKikimrSchemeOp::TPartitionConfig& partConfig) const;
+ const NKikimrSchemeOp::TPartitionConfig& partConfig) const;
void ApplyAlter(NTabletFlatExecutor::TTransactionContext& txc, const TUserTable& oldTable,
- const NKikimrSchemeOp::TTableDescription& alter, TString& strError);
+ const NKikimrSchemeOp::TTableDescription& alter, TString& strError);
void ApplyDefaults(NTabletFlatExecutor::TTransactionContext& txc) const;
TTableRange GetTableRange() const { return Range.ToTableRange(); }
const TString& GetSchema() const { return Schema; }
- void GetSchema(NKikimrSchemeOp::TTableDescription& description) const {
+ void GetSchema(NKikimrSchemeOp::TTableDescription& description) const {
bool ok = description.ParseFromArray(Schema.data(), Schema.size());
Y_VERIFY(ok);
}
- void SetSchema(const NKikimrSchemeOp::TTableDescription& description) {
+ void SetSchema(const NKikimrSchemeOp::TTableDescription& description) {
Schema.clear();
Y_PROTOBUF_SUPPRESS_NODISCARD description.SerializeToString(&Schema);
}
@@ -396,21 +396,21 @@ struct TUserTable : public TThrRefBase {
void SetPath(const TString &path);
ui64 GetTableSchemaVersion() const { return TableSchemaVersion; }
- void SetTableSchemaVersion(ui64 schemaVersion);
+ void SetTableSchemaVersion(ui64 schemaVersion);
bool ResetTableSchemaVersion();
- void AddIndex(const NKikimrSchemeOp::TIndexDescription& indexDesc);
+ void AddIndex(const NKikimrSchemeOp::TIndexDescription& indexDesc);
void DropIndex(const TPathId& indexPathId);
bool HasAsyncIndexes() const;
- void AddCdcStream(const NKikimrSchemeOp::TCdcStreamDescription& streamDesc);
+ void AddCdcStream(const NKikimrSchemeOp::TCdcStreamDescription& streamDesc);
void DisableCdcStream(const TPathId& streamPathId);
void DropCdcStream(const TPathId& streamPathId);
bool HasCdcStreams() const;
private:
void DoApplyCreate(NTabletFlatExecutor::TTransactionContext& txc, const TString& tableName, bool shadow,
- const NKikimrSchemeOp::TPartitionConfig& partConfig) const;
+ const NKikimrSchemeOp::TPartitionConfig& partConfig) const;
private:
TString Schema;
@@ -418,7 +418,7 @@ private:
void CheckSpecialColumns();
void AlterSchema();
- void ParseProto(const NKikimrSchemeOp::TTableDescription& descr);
+ void ParseProto(const NKikimrSchemeOp::TTableDescription& descr);
};
}}
diff --git a/ydb/core/tx/datashard/datashard_ut_background_compaction.cpp b/ydb/core/tx/datashard/datashard_ut_background_compaction.cpp
index 192754fa4f2..4872979bdf6 100644
--- a/ydb/core/tx/datashard/datashard_ut_background_compaction.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_background_compaction.cpp
@@ -9,7 +9,7 @@
namespace NKikimr {
using namespace NKikimr::NDataShard;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace Tests;
namespace {
diff --git a/ydb/core/tx/datashard/datashard_ut_build_index.cpp b/ydb/core/tx/datashard/datashard_ut_build_index.cpp
index 42904d90e1f..2b9e3f0a3fc 100644
--- a/ydb/core/tx/datashard/datashard_ut_build_index.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_build_index.cpp
@@ -1,145 +1,145 @@
-#include "defs.h"
-#include "datashard_ut_common.h"
-#include "datashard_ut_common_kqp.h"
-
+#include "defs.h"
+#include "datashard_ut_common.h"
+#include "datashard_ut_common_kqp.h"
+
#include <ydb/core/testlib/test_client.h>
#include <ydb/core/tx/schemeshard/schemeshard.h>
#include <ydb/core/tx/tx_proxy/proxy.h>
#include <ydb/core/tx/tx_proxy/upload_rows.h>
-
+
#include <ydb/library/yql/public/issue/yql_issue_message.h>
-
+
#include <library/cpp/testing/unittest/registar.h>
-
-template <>
-inline void Out<NKikimrTxDataShard::TEvBuildIndexProgressResponse::EStatus>
- (IOutputStream& o, NKikimrTxDataShard::TEvBuildIndexProgressResponse::EStatus status)
-{
- o << NKikimrTxDataShard::TEvBuildIndexProgressResponse::EStatus_Name(status);
-}
-
-namespace NKikimr {
-
+
+template <>
+inline void Out<NKikimrTxDataShard::TEvBuildIndexProgressResponse::EStatus>
+ (IOutputStream& o, NKikimrTxDataShard::TEvBuildIndexProgressResponse::EStatus status)
+{
+ o << NKikimrTxDataShard::TEvBuildIndexProgressResponse::EStatus_Name(status);
+}
+
+namespace NKikimr {
+
using namespace NKikimr::NDataShard::NKqpHelpers;
-using namespace NSchemeShard;
-using namespace Tests;
-
-
-Y_UNIT_TEST_SUITE(TTxDataShardBuildIndexScan) {
-
+using namespace NSchemeShard;
+using namespace Tests;
+
+
+Y_UNIT_TEST_SUITE(TTxDataShardBuildIndexScan) {
+
static void DoBuildIndex(Tests::TServer::TPtr server, TActorId sender,
- const TString& tableFrom, const TString& tableTo,
- const TRowVersion& snapshot,
- const NKikimrTxDataShard::TEvBuildIndexProgressResponse::EStatus& expected) {
- auto &runtime = *server->GetRuntime();
- TVector<ui64> datashards = GetTableShards(server, sender, tableFrom);
- TTableId tableId = ResolveTableId(server, sender, tableFrom);
-
- for (auto tid: datashards) {
- auto ev = new TEvDataShard::TEvBuildIndexCreateRequest;
- NKikimrTxDataShard::TEvBuildIndexCreateRequest& rec = ev->Record;
- rec.SetBuildIndexId(1);
-
- rec.SetTabletId(tid);
- rec.SetOwnerId(tableId.PathId.OwnerId);
- rec.SetPathId(tableId.PathId.LocalPathId);
-
- rec.SetTargetName(tableTo);
- rec.AddIndexColumns("value");
- rec.AddIndexColumns("key");
-
- rec.SetSnapshotTxId(snapshot.TxId);
- rec.SetSnapshotStep(snapshot.Step);
-
- runtime.SendToPipe(tid, sender, ev, 0, GetPipeConfigWithRetries());
-
- while (true) {
- TAutoPtr<IEventHandle> handle;
- auto reply = runtime.GrabEdgeEventRethrow<TEvDataShard::TEvBuildIndexProgressResponse>(handle);
-
- if (expected == NKikimrTxDataShard::TEvBuildIndexProgressResponse::DONE
- && reply->Record.GetStatus() == NKikimrTxDataShard::TEvBuildIndexProgressResponse::ACCEPTED) {
- Cerr << "skip ACCEPTED" << Endl;
- continue;
- }
-
- if (expected != NKikimrTxDataShard::TEvBuildIndexProgressResponse::INPROGRESS
- && reply->Record.GetStatus() == NKikimrTxDataShard::TEvBuildIndexProgressResponse::INPROGRESS) {
- Cerr << "skip INPROGRESS" << Endl;
- continue;
- }
-
- NYql::TIssues issues;
- NYql::IssuesFromMessage(reply->Record.GetIssues(), issues);
- UNIT_ASSERT_VALUES_EQUAL_C(reply->Record.GetStatus(), expected, issues.ToString());
- break;
- }
- }
- }
-
- static void CreateShardedTableForIndex(
+ const TString& tableFrom, const TString& tableTo,
+ const TRowVersion& snapshot,
+ const NKikimrTxDataShard::TEvBuildIndexProgressResponse::EStatus& expected) {
+ auto &runtime = *server->GetRuntime();
+ TVector<ui64> datashards = GetTableShards(server, sender, tableFrom);
+ TTableId tableId = ResolveTableId(server, sender, tableFrom);
+
+ for (auto tid: datashards) {
+ auto ev = new TEvDataShard::TEvBuildIndexCreateRequest;
+ NKikimrTxDataShard::TEvBuildIndexCreateRequest& rec = ev->Record;
+ rec.SetBuildIndexId(1);
+
+ rec.SetTabletId(tid);
+ rec.SetOwnerId(tableId.PathId.OwnerId);
+ rec.SetPathId(tableId.PathId.LocalPathId);
+
+ rec.SetTargetName(tableTo);
+ rec.AddIndexColumns("value");
+ rec.AddIndexColumns("key");
+
+ rec.SetSnapshotTxId(snapshot.TxId);
+ rec.SetSnapshotStep(snapshot.Step);
+
+ runtime.SendToPipe(tid, sender, ev, 0, GetPipeConfigWithRetries());
+
+ while (true) {
+ TAutoPtr<IEventHandle> handle;
+ auto reply = runtime.GrabEdgeEventRethrow<TEvDataShard::TEvBuildIndexProgressResponse>(handle);
+
+ if (expected == NKikimrTxDataShard::TEvBuildIndexProgressResponse::DONE
+ && reply->Record.GetStatus() == NKikimrTxDataShard::TEvBuildIndexProgressResponse::ACCEPTED) {
+ Cerr << "skip ACCEPTED" << Endl;
+ continue;
+ }
+
+ if (expected != NKikimrTxDataShard::TEvBuildIndexProgressResponse::INPROGRESS
+ && reply->Record.GetStatus() == NKikimrTxDataShard::TEvBuildIndexProgressResponse::INPROGRESS) {
+ Cerr << "skip INPROGRESS" << Endl;
+ continue;
+ }
+
+ NYql::TIssues issues;
+ NYql::IssuesFromMessage(reply->Record.GetIssues(), issues);
+ UNIT_ASSERT_VALUES_EQUAL_C(reply->Record.GetStatus(), expected, issues.ToString());
+ break;
+ }
+ }
+ }
+
+ static void CreateShardedTableForIndex(
Tests::TServer::TPtr server, TActorId sender,
- const TString &root, const TString &name,
- ui64 shards, bool enableOutOfOrder)
- {
- NLocalDb::TCompactionPolicyPtr policy = NLocalDb::CreateDefaultUserTablePolicy();
- policy->KeepEraseMarkers = true;
-
- auto opts = TShardedTableOptions()
- .Shards(shards)
- .EnableOutOfOrder(enableOutOfOrder)
- .Policy(policy.Get())
- .ShadowData(EShadowDataMode::Enabled)
+ const TString &root, const TString &name,
+ ui64 shards, bool enableOutOfOrder)
+ {
+ NLocalDb::TCompactionPolicyPtr policy = NLocalDb::CreateDefaultUserTablePolicy();
+ policy->KeepEraseMarkers = true;
+
+ auto opts = TShardedTableOptions()
+ .Shards(shards)
+ .EnableOutOfOrder(enableOutOfOrder)
+ .Policy(policy.Get())
+ .ShadowData(EShadowDataMode::Enabled)
.Columns({{"value", "Uint32", true, false}, {"key", "Uint32", true, false}});
-
- CreateShardedTable(server, sender, root, name, opts);
- }
-
- Y_UNIT_TEST(TestRunScan) {
- TPortManager pm;
- TServerSettings serverSettings(pm.GetPort(2134));
- serverSettings.SetDomainName("Root")
- .SetUseRealThreads(false);
-
- Tests::TServer::TPtr server = new TServer(serverSettings);
- auto &runtime = *server->GetRuntime();
- auto sender = runtime.AllocateEdgeActor();
-
- runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_DEBUG);
-
- // Allow manipulating shadow data using normal schemeshard operations
- runtime.GetAppData().AllowShadowDataInSchemeShardForTests = true;
-
- InitRoot(server, sender);
-
- CreateShardedTable(server, sender, "/Root", "table-1", 1, false);
-
- // Upsert some initial values
- ExecSQL(server, sender, "UPSERT INTO [/Root/table-1] (key, value) VALUES (1, 100), (3, 300), (5, 500);");
-
- CreateShardedTableForIndex(server, sender, "/Root", "table-2", 1, false);
-
- auto snapshot = CreateVolatileSnapshot(server, { "/Root/table-1" });
-
- DoBuildIndex(server, sender, "/Root/table-1", "/Root/table-2", snapshot, NKikimrTxDataShard::TEvBuildIndexProgressResponse::DONE);
-
- // Writes to shadow data should not be visible yet
- auto data = ReadShardedTable(server, "/Root/table-2");
- UNIT_ASSERT_VALUES_EQUAL(data, "");
-
- // Alter table: disable shadow data and change compaction policy
- auto policy = NLocalDb::CreateDefaultUserTablePolicy();
- policy->KeepEraseMarkers = false;
- WaitTxNotification(server,
- AsyncAlterAndDisableShadow(server, "/Root", "table-2", policy.Get()));
-
- // Shadow data must be visible now
- auto data2 = ReadShardedTable(server, "/Root/table-2");
- UNIT_ASSERT_VALUES_EQUAL(data2,
- "value = 100, key = 1\n"
- "value = 300, key = 3\n"
- "value = 500, key = 5\n");
- }
-}
-
-} // namespace NKikimr
+
+ CreateShardedTable(server, sender, root, name, opts);
+ }
+
+ Y_UNIT_TEST(TestRunScan) {
+ TPortManager pm;
+ TServerSettings serverSettings(pm.GetPort(2134));
+ serverSettings.SetDomainName("Root")
+ .SetUseRealThreads(false);
+
+ Tests::TServer::TPtr server = new TServer(serverSettings);
+ auto &runtime = *server->GetRuntime();
+ auto sender = runtime.AllocateEdgeActor();
+
+ runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_DEBUG);
+
+ // Allow manipulating shadow data using normal schemeshard operations
+ runtime.GetAppData().AllowShadowDataInSchemeShardForTests = true;
+
+ InitRoot(server, sender);
+
+ CreateShardedTable(server, sender, "/Root", "table-1", 1, false);
+
+ // Upsert some initial values
+ ExecSQL(server, sender, "UPSERT INTO [/Root/table-1] (key, value) VALUES (1, 100), (3, 300), (5, 500);");
+
+ CreateShardedTableForIndex(server, sender, "/Root", "table-2", 1, false);
+
+ auto snapshot = CreateVolatileSnapshot(server, { "/Root/table-1" });
+
+ DoBuildIndex(server, sender, "/Root/table-1", "/Root/table-2", snapshot, NKikimrTxDataShard::TEvBuildIndexProgressResponse::DONE);
+
+ // Writes to shadow data should not be visible yet
+ auto data = ReadShardedTable(server, "/Root/table-2");
+ UNIT_ASSERT_VALUES_EQUAL(data, "");
+
+ // Alter table: disable shadow data and change compaction policy
+ auto policy = NLocalDb::CreateDefaultUserTablePolicy();
+ policy->KeepEraseMarkers = false;
+ WaitTxNotification(server,
+ AsyncAlterAndDisableShadow(server, "/Root", "table-2", policy.Get()));
+
+ // Shadow data must be visible now
+ auto data2 = ReadShardedTable(server, "/Root/table-2");
+ UNIT_ASSERT_VALUES_EQUAL(data2,
+ "value = 100, key = 1\n"
+ "value = 300, key = 3\n"
+ "value = 500, key = 5\n");
+ }
+}
+
+} // namespace NKikimr
diff --git a/ydb/core/tx/datashard/datashard_ut_change_collector.cpp b/ydb/core/tx/datashard/datashard_ut_change_collector.cpp
index b8766f40863..cdce49ecdb0 100644
--- a/ydb/core/tx/datashard/datashard_ut_change_collector.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_change_collector.cpp
@@ -348,7 +348,7 @@ Y_UNIT_TEST_SUITE(AsyncIndexChangeCollector) {
{"ikey", "Uint32", false, false},
})
.Indexes({
- {"by_ikey", {"ikey"}, {}, NKikimrSchemeOp::EIndexTypeGlobalAsync},
+ {"by_ikey", {"ikey"}, {}, NKikimrSchemeOp::EIndexTypeGlobalAsync},
});
}
@@ -416,8 +416,8 @@ Y_UNIT_TEST_SUITE(AsyncIndexChangeCollector) {
{"ikey2", "Uint32", false, false},
})
.Indexes({
- {"by_ikey1", {"ikey1"}, {}, NKikimrSchemeOp::EIndexTypeGlobalAsync},
- {"by_ikey2", {"ikey2"}, {}, NKikimrSchemeOp::EIndexTypeGlobalAsync},
+ {"by_ikey1", {"ikey1"}, {}, NKikimrSchemeOp::EIndexTypeGlobalAsync},
+ {"by_ikey2", {"ikey2"}, {}, NKikimrSchemeOp::EIndexTypeGlobalAsync},
});
}
@@ -469,7 +469,7 @@ Y_UNIT_TEST_SUITE(AsyncIndexChangeCollector) {
{"ikey", "Uint32", false, false},
})
.Indexes({
- {"by_ikey_pkey", {"ikey", "pkey"}, {}, NKikimrSchemeOp::EIndexTypeGlobalAsync},
+ {"by_ikey_pkey", {"ikey", "pkey"}, {}, NKikimrSchemeOp::EIndexTypeGlobalAsync},
});
}
@@ -499,7 +499,7 @@ Y_UNIT_TEST_SUITE(AsyncIndexChangeCollector) {
{"value", "Uint32", false, false},
})
.Indexes({
- {"by_ikey", {"ikey"}, {"value"}, NKikimrSchemeOp::EIndexTypeGlobalAsync},
+ {"by_ikey", {"ikey"}, {"value"}, NKikimrSchemeOp::EIndexTypeGlobalAsync},
});
}
@@ -644,19 +644,19 @@ Y_UNIT_TEST_SUITE(CdcStreamChangeCollector) {
TCdcStream KeysOnly() {
return TCdcStream{
- "keys_stream", NKikimrSchemeOp::ECdcStreamModeKeysOnly
+ "keys_stream", NKikimrSchemeOp::ECdcStreamModeKeysOnly
};
}
TCdcStream Updates() {
return TCdcStream{
- "updates_stream", NKikimrSchemeOp::ECdcStreamModeUpdate
+ "updates_stream", NKikimrSchemeOp::ECdcStreamModeUpdate
};
}
TCdcStream NewAndOldImages() {
return TCdcStream{
- "new_and_old_images", NKikimrSchemeOp::ECdcStreamModeNewAndOldImages
+ "new_and_old_images", NKikimrSchemeOp::ECdcStreamModeNewAndOldImages
};
}
@@ -747,7 +747,7 @@ Y_UNIT_TEST_SUITE(CdcStreamChangeCollector) {
{"ikey", "Uint32", false, false},
})
.Indexes({
- {"by_ikey", {"ikey"}, {}, NKikimrSchemeOp::EIndexTypeGlobalAsync},
+ {"by_ikey", {"ikey"}, {}, NKikimrSchemeOp::EIndexTypeGlobalAsync},
});
}
diff --git a/ydb/core/tx/datashard/datashard_ut_change_exchange.cpp b/ydb/core/tx/datashard/datashard_ut_change_exchange.cpp
index c3c458405e7..5e312f673c4 100644
--- a/ydb/core/tx/datashard/datashard_ut_change_exchange.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_change_exchange.cpp
@@ -62,13 +62,13 @@ Y_UNIT_TEST_SUITE(AsyncIndexChangeExchange) {
TShardedTableOptions::TIndex SimpleSyncIndex() {
return TShardedTableOptions::TIndex{
- "by_ikey", {"ikey"}, {}, NKikimrSchemeOp::EIndexTypeGlobal
+ "by_ikey", {"ikey"}, {}, NKikimrSchemeOp::EIndexTypeGlobal
};
}
TShardedTableOptions::TIndex SimpleAsyncIndex() {
return TShardedTableOptions::TIndex{
- "by_ikey", {"ikey"}, {}, NKikimrSchemeOp::EIndexTypeGlobalAsync
+ "by_ikey", {"ikey"}, {}, NKikimrSchemeOp::EIndexTypeGlobalAsync
};
}
@@ -156,8 +156,8 @@ Y_UNIT_TEST_SUITE(AsyncIndexChangeExchange) {
{"i2key", "Uint32", false, false},
})
.Indexes({
- {"by_i1key", {"i1key"}, {}, NKikimrSchemeOp::EIndexTypeGlobalAsync},
- {"by_i2key", {"i2key"}, {}, NKikimrSchemeOp::EIndexTypeGlobalAsync},
+ {"by_i1key", {"i1key"}, {}, NKikimrSchemeOp::EIndexTypeGlobalAsync},
+ {"by_i2key", {"i2key"}, {}, NKikimrSchemeOp::EIndexTypeGlobalAsync},
})
);
}
diff --git a/ydb/core/tx/datashard/datashard_ut_common.cpp b/ydb/core/tx/datashard/datashard_ut_common.cpp
index dd02ae4ad78..d754f7ad0e2 100644
--- a/ydb/core/tx/datashard/datashard_ut_common.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_common.cpp
@@ -22,7 +22,7 @@
namespace NKikimr {
using namespace NMiniKQL;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace Tests;
const bool ENABLE_DATASHARD_LOG = true;
@@ -34,22 +34,22 @@ void TTester::Setup(TTestActorRuntime& runtime, const TOptions& opts) {
}
runtime.SetLogPriority(NKikimrServices::MINIKQL_ENGINE, NActors::NLog::PRI_DEBUG);
- ui32 domainId = 0;
- ui32 planResolution = 500;
+ ui32 domainId = 0;
+ ui32 planResolution = 500;
TAppPrepare app;
app.SetEnableMvcc(opts.Mvcc);
auto domain = TDomainsInfo::TDomain::ConstructDomainWithExplicitTabletIds(
- "dc-1", domainId, FAKE_SCHEMESHARD_TABLET_ID,
+ "dc-1", domainId, FAKE_SCHEMESHARD_TABLET_ID,
domainId, domainId, TVector<ui32>{domainId},
- domainId, TVector<ui32>{domainId},
+ domainId, TVector<ui32>{domainId},
planResolution,
- TVector<ui64>{TDomainsInfo::MakeTxCoordinatorIDFixed(domainId, 1)},
- TVector<ui64>{},
+ TVector<ui64>{TDomainsInfo::MakeTxCoordinatorIDFixed(domainId, 1)},
+ TVector<ui64>{},
TVector<ui64>{TDomainsInfo::MakeTxAllocatorIDFixed(domainId, 1)});
-
+
TVector<ui64> ids = runtime.GetTxAllocatorTabletIds();
ids.insert(ids.end(), domain->TxAllocators.begin(), domain->TxAllocators.end());
runtime.SetTxAllocatorTabletIds(ids);
@@ -170,7 +170,7 @@ void TTester::CreateDataShard(TFakeMiniKQLProxy& proxy, ui64 tabletId, const TSt
// needed for MiniKQL compiling
void TTester::RegisterTableInResolver(const TString& schemeText)
{
- NKikimrSchemeOp::TTableDescription tdesc;
+ NKikimrSchemeOp::TTableDescription tdesc;
bool parsed = NProtoBuf::TextFormat::ParseFromString(schemeText, &tdesc);
UNIT_ASSERT(parsed);
@@ -178,10 +178,10 @@ void TTester::RegisterTableInResolver(const TString& schemeText)
using TColumn = IDbSchemeResolver::TTableResult::TColumn;
IDbSchemeResolver::TTableResult table(IDbSchemeResolver::TTableResult::Ok);
table.Table.TableName = tdesc.GetName();
- table.TableId.Reset(new TTableId(FAKE_SCHEMESHARD_TABLET_ID, tdesc.GetId_Deprecated()));
- if (tdesc.HasPathId()) {
- table.TableId.Reset(new TTableId( tdesc.GetPathId().GetOwnerId(), tdesc.GetPathId().GetLocalId()));
- }
+ table.TableId.Reset(new TTableId(FAKE_SCHEMESHARD_TABLET_ID, tdesc.GetId_Deprecated()));
+ if (tdesc.HasPathId()) {
+ table.TableId.Reset(new TTableId( tdesc.GetPathId().GetOwnerId(), tdesc.GetPathId().GetLocalId()));
+ }
table.KeyColumnCount = tdesc.KeyColumnIdsSize();
for (size_t i = 0; i < tdesc.ColumnsSize(); i++) {
auto& c = tdesc.GetColumns(i);
@@ -201,7 +201,7 @@ void TTester::RegisterTableInResolver(const TString& schemeText)
void TTester::CreateSchema(ESchema schema, const TOptions& opts) {
TString keyValueSchemeText =
"Name: \"table1\"\n"
- "Id_Deprecated: 13\n"
+ "Id_Deprecated: 13\n"
"Path: \"/Root/table1\"\n"
"Columns { Id: 34 Name: \"key\" TypeId: " + ToString<int>(NScheme::NTypeIds::Uint32) + " }\n"
"Columns { Id: 56 Name: \"value\" TypeId: " + ToString<int>(NScheme::NTypeIds::Utf8) + " }\n"
@@ -211,8 +211,8 @@ void TTester::CreateSchema(ESchema schema, const TOptions& opts) {
TString doubleKeyValueSchemeText =
"Name: \"table2\"\n"
- "PathId { OwnerId: " + ToString(FAKE_SCHEMESHARD_TABLET_ID) + " LocalId: 14 }\n"
-
+ "PathId { OwnerId: " + ToString(FAKE_SCHEMESHARD_TABLET_ID) + " LocalId: 14 }\n"
+
"Path: \"/Root/table2\"\n"
"Columns { Id: 34 Name: \"key1\" TypeId: " + ToString<int>(NScheme::NTypeIds::Uint32) + " }\n"
"Columns { Id: 35 Name: \"key2\" TypeId: " + ToString<int>(NScheme::NTypeIds::Utf8) + " }\n"
@@ -234,8 +234,8 @@ void TTester::CreateSchema(ESchema schema, const TOptions& opts) {
TString specialKeyValueSchemeText =
"Name: \"table1\"\n"
- "Id_Deprecated: 13\n"
- "PathId { OwnerId: " + ToString(FAKE_SCHEMESHARD_TABLET_ID) + " LocalId: 13 }\n"
+ "Id_Deprecated: 13\n"
+ "PathId { OwnerId: " + ToString(FAKE_SCHEMESHARD_TABLET_ID) + " LocalId: 13 }\n"
"Path: \"/Root/table1\"\n"
"Columns { Id: 34 Name: \"key\" TypeId: " + ToString<int>(NScheme::NTypeIds::Uint32) + " }\n"
"Columns { Id: 56 Name: \"value\" TypeId: " + ToString<int>(NScheme::NTypeIds::Utf8) + " }\n"
@@ -561,7 +561,7 @@ void TFakeMiniKQLProxy::Cancel(ui64 txId) {
void TFakeMiniKQLProxy::ProposeSchemeCreateTable(TFakeProxyTx& tx, const TVector<ui64>& shards) {
const TString& schemaText = tx.TxBody();
- NKikimrSchemeOp::TTableDescription tableDesc;
+ NKikimrSchemeOp::TTableDescription tableDesc;
bool parsed = NProtoBuf::TextFormat::ParseFromString(schemaText, &tableDesc);
UNIT_ASSERT(parsed);
@@ -742,7 +742,7 @@ ui64 TFakeMiniKQLProxy::Plan(ui64 stepId, const TMap<ui64, TFakeProxyTx::TPtr>&
TString txBody;
ui32 shard = tx->GetShardProgram(0, txBody);
THolder<TEvDataShard::TEvProposeTransaction> event = MakeHolder<TEvDataShard::TEvProposeTransaction>(
- NKikimrTxDataShard::TX_KIND_DATA, Tester.Sender, txId, txBody, tx->TxFlags());
+ NKikimrTxDataShard::TX_KIND_DATA, Tester.Sender, txId, txBody, tx->TxFlags());
immEvents.emplace_back(std::make_pair(shard, std::move(event)));
results.insert(std::make_pair(shard, txId));
}
@@ -1045,46 +1045,46 @@ THolder<NKqp::TEvKqp::TEvQueryRequest> MakeSQLRequest(const TString &sql,
void InitRoot(Tests::TServer::TPtr server,
TActorId sender)
{
- if (server->GetSettings().StoragePoolTypes.empty()) {
- return;
- }
-
+ if (server->GetSettings().StoragePoolTypes.empty()) {
+ return;
+ }
+
auto &runtime = *server->GetRuntime();
auto &settings = server->GetSettings();
-
+
auto tid = ChangeStateStorage(SchemeRoot, settings.Domain);
- const TDomainsInfo::TDomain& domain = runtime.GetAppData().DomainsInfo->GetDomain(settings.Domain);
-
- auto evTx = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(1, tid);
- auto transaction = evTx->Record.AddTransaction();
- transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain);
- transaction->SetWorkingDir("/");
- auto op = transaction->MutableSubDomain();
- op->SetName(domain.Name);
-
- for (const auto& [kind, pool] : settings.StoragePoolTypes) {
- auto* p = op->AddStoragePools();
- p->SetKind(kind);
- p->SetName(pool.GetName());
+ const TDomainsInfo::TDomain& domain = runtime.GetAppData().DomainsInfo->GetDomain(settings.Domain);
+
+ auto evTx = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(1, tid);
+ auto transaction = evTx->Record.AddTransaction();
+ transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain);
+ transaction->SetWorkingDir("/");
+ auto op = transaction->MutableSubDomain();
+ op->SetName(domain.Name);
+
+ for (const auto& [kind, pool] : settings.StoragePoolTypes) {
+ auto* p = op->AddStoragePools();
+ p->SetKind(kind);
+ p->SetName(pool.GetName());
}
- runtime.SendToPipe(tid, sender, evTx.Release(), 0, GetPipeConfigWithRetries());
-
- {
- TAutoPtr<IEventHandle> handle;
- auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvModifySchemeTransactionResult>(handle);
- UNIT_ASSERT_VALUES_EQUAL(event->Record.GetSchemeshardId(), tid);
- UNIT_ASSERT_VALUES_EQUAL(event->Record.GetStatus(), NKikimrScheme::EStatus::StatusAccepted);
- }
-
- auto evSubscribe = MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(1);
- runtime.SendToPipe(tid, sender, evSubscribe.Release(), 0, GetPipeConfigWithRetries());
-
- {
- TAutoPtr<IEventHandle> handle;
- auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvNotifyTxCompletionResult>(handle);
- UNIT_ASSERT_VALUES_EQUAL(event->Record.GetTxId(), 1);
- }
+ runtime.SendToPipe(tid, sender, evTx.Release(), 0, GetPipeConfigWithRetries());
+
+ {
+ TAutoPtr<IEventHandle> handle;
+ auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvModifySchemeTransactionResult>(handle);
+ UNIT_ASSERT_VALUES_EQUAL(event->Record.GetSchemeshardId(), tid);
+ UNIT_ASSERT_VALUES_EQUAL(event->Record.GetStatus(), NKikimrScheme::EStatus::StatusAccepted);
+ }
+
+ auto evSubscribe = MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(1);
+ runtime.SendToPipe(tid, sender, evSubscribe.Release(), 0, GetPipeConfigWithRetries());
+
+ {
+ TAutoPtr<IEventHandle> handle;
+ auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvNotifyTxCompletionResult>(handle);
+ UNIT_ASSERT_VALUES_EQUAL(event->Record.GetTxId(), 1);
+ }
}
void CreateShardedTable(Tests::TServer::TPtr server,
@@ -1105,12 +1105,12 @@ void CreateShardedTable(Tests::TServer::TPtr server,
auto &tx = *request->Record.MutableTransaction()->MutableModifyScheme();
tx.SetWorkingDir(root);
- NKikimrSchemeOp::TTableDescription* desc = nullptr;
+ NKikimrSchemeOp::TTableDescription* desc = nullptr;
if (opts.Indexes_) {
- tx.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateIndexedTable);
+ tx.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateIndexedTable);
desc = tx.MutableCreateIndexedTable()->MutableTableDescription();
} else {
- tx.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateTable);
+ tx.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateTable);
desc = tx.MutableCreateTable();
}
@@ -1174,11 +1174,11 @@ void CreateShardedTable(Tests::TServer::TPtr server,
txId = reply->Record.GetTxId();
}
{
- auto request = MakeHolder<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion>();
+ auto request = MakeHolder<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion>();
request->Record.SetTxId(txId);
auto tid = ChangeStateStorage(SchemeRoot, settings.Domain);
runtime.SendToPipe(tid, sender, request.Release(), 0, GetPipeConfigWithRetries());
- runtime.GrabEdgeEventRethrow<TEvSchemeShard::TEvNotifyTxCompletionResult>(handle);
+ runtime.GrabEdgeEventRethrow<TEvSchemeShard::TEvNotifyTxCompletionResult>(handle);
}
}
@@ -1211,7 +1211,7 @@ NKikimrScheme::TEvDescribeSchemeResult DescribeTable(Tests::TServer::TPtr server
request->Record.MutableDescribePath()->SetPath(path);
request->Record.MutableDescribePath()->MutableOptions()->SetShowPrivateTable(true);
runtime.Send(new IEventHandle(MakeTxProxyID(), sender, request.Release()));
- auto reply = runtime.GrabEdgeEventRethrow<TEvSchemeShard::TEvDescribeSchemeResult>(handle);
+ auto reply = runtime.GrabEdgeEventRethrow<TEvSchemeShard::TEvDescribeSchemeResult>(handle);
return *reply->MutableRecord();
}
@@ -1456,7 +1456,7 @@ ui64 AsyncSplitTable(
auto request = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
request->Record.SetExecTimeoutPeriod(Max<ui64>());
auto &tx = *request->Record.MutableTransaction()->MutableModifyScheme();
- tx.SetOperationType(NKikimrSchemeOp::ESchemeOpSplitMergeTablePartitions);
+ tx.SetOperationType(NKikimrSchemeOp::ESchemeOpSplitMergeTablePartitions);
auto &desc = *tx.MutableSplitMergeTablePartitions();
desc.SetTablePath(path);
desc.AddSourceTabletId(sourceTablet);
@@ -1480,7 +1480,7 @@ ui64 AsyncMergeTable(
auto request = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
request->Record.SetExecTimeoutPeriod(Max<ui64>());
auto &tx = *request->Record.MutableTransaction()->MutableModifyScheme();
- tx.SetOperationType(NKikimrSchemeOp::ESchemeOpSplitMergeTablePartitions);
+ tx.SetOperationType(NKikimrSchemeOp::ESchemeOpSplitMergeTablePartitions);
auto &desc = *tx.MutableSplitMergeTablePartitions();
desc.SetTablePath(path);
for (ui64 tabletId : sourceTabletIds) {
@@ -1504,7 +1504,7 @@ ui64 AsyncAlterAddExtraColumn(
auto request = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
request->Record.SetExecTimeoutPeriod(Max<ui64>());
auto &tx = *request->Record.MutableTransaction()->MutableModifyScheme();
- tx.SetOperationType(NKikimrSchemeOp::ESchemeOpAlterTable);
+ tx.SetOperationType(NKikimrSchemeOp::ESchemeOpAlterTable);
tx.SetWorkingDir(workingDir);
auto &desc = *tx.MutableAlterTable();
desc.SetName(name);
@@ -1531,7 +1531,7 @@ ui64 AsyncAlterDropColumn(
auto request = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
request->Record.SetExecTimeoutPeriod(Max<ui64>());
auto &tx = *request->Record.MutableTransaction()->MutableModifyScheme();
- tx.SetOperationType(NKikimrSchemeOp::ESchemeOpAlterTable);
+ tx.SetOperationType(NKikimrSchemeOp::ESchemeOpAlterTable);
tx.SetWorkingDir(workingDir);
auto &desc = *tx.MutableAlterTable();
desc.SetName(name);
@@ -1557,7 +1557,7 @@ ui64 AsyncAlterAndDisableShadow(
auto request = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
request->Record.SetExecTimeoutPeriod(Max<ui64>());
auto &tx = *request->Record.MutableTransaction()->MutableModifyScheme();
- tx.SetOperationType(NKikimrSchemeOp::ESchemeOpAlterTable);
+ tx.SetOperationType(NKikimrSchemeOp::ESchemeOpAlterTable);
tx.SetWorkingDir(workingDir);
auto &desc = *tx.MutableAlterTable();
desc.SetName(name);
@@ -1596,10 +1596,10 @@ ui64 AsyncAlterAddIndex(
*index.mutable_data_columns() = {indexDesc.DataColumns.begin(), indexDesc.DataColumns.end()};
switch (indexDesc.Type) {
- case NKikimrSchemeOp::EIndexTypeGlobal:
+ case NKikimrSchemeOp::EIndexTypeGlobal:
*index.mutable_global_index() = Ydb::Table::GlobalIndex();
break;
- case NKikimrSchemeOp::EIndexTypeGlobalAsync:
+ case NKikimrSchemeOp::EIndexTypeGlobalAsync:
*index.mutable_global_async_index() = Ydb::Table::GlobalAsyncIndex();
break;
default:
@@ -1627,7 +1627,7 @@ ui64 AsyncAlterDropIndex(
auto request = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
request->Record.SetExecTimeoutPeriod(Max<ui64>());
auto &tx = *request->Record.MutableTransaction()->MutableModifyScheme();
- tx.SetOperationType(NKikimrSchemeOp::ESchemeOpDropIndex);
+ tx.SetOperationType(NKikimrSchemeOp::ESchemeOpDropIndex);
tx.SetWorkingDir(workingDir);
auto &desc = *tx.MutableDropIndex();
desc.SetTableName(tableName);
@@ -1651,7 +1651,7 @@ ui64 AsyncAlterAddStream(
auto request = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
request->Record.SetExecTimeoutPeriod(Max<ui64>());
auto &tx = *request->Record.MutableTransaction()->MutableModifyScheme();
- tx.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateCdcStream);
+ tx.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateCdcStream);
tx.SetWorkingDir(workingDir);
auto &desc = *tx.MutableCreateCdcStream();
desc.SetTableName(tableName);
@@ -1676,7 +1676,7 @@ ui64 AsyncAlterDropStream(
auto request = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
request->Record.SetExecTimeoutPeriod(Max<ui64>());
auto &tx = *request->Record.MutableTransaction()->MutableModifyScheme();
- tx.SetOperationType(NKikimrSchemeOp::ESchemeOpDropCdcStream);
+ tx.SetOperationType(NKikimrSchemeOp::ESchemeOpDropCdcStream);
tx.SetWorkingDir(workingDir);
auto &desc = *tx.MutableDropCdcStream();
desc.SetTableName(tableName);
@@ -1692,11 +1692,11 @@ void WaitTxNotification(Tests::TServer::TPtr server, TActorId sender, ui64 txId)
auto &runtime = *server->GetRuntime();
auto &settings = server->GetSettings();
- auto request = MakeHolder<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion>();
+ auto request = MakeHolder<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion>();
request->Record.SetTxId(txId);
auto tid = ChangeStateStorage(SchemeRoot, settings.Domain);
runtime.SendToPipe(tid, sender, request.Release(), 0, GetPipeConfigWithRetries());
- runtime.GrabEdgeEventRethrow<TEvSchemeShard::TEvNotifyTxCompletionResult>(sender);
+ runtime.GrabEdgeEventRethrow<TEvSchemeShard::TEvNotifyTxCompletionResult>(sender);
}
void WaitTxNotification(Tests::TServer::TPtr server, ui64 txId) {
@@ -1737,34 +1737,34 @@ void ExecSQL(Tests::TServer::TPtr server,
UNIT_ASSERT_VALUES_EQUAL(ev->Get()->Record.GetRef().GetYdbStatus(), code);
}
-void WaitTabletBecomesOffline(TServer::TPtr server, ui64 tabletId)
-{
- struct IsShardStateChange
- {
- IsShardStateChange(ui64 tabletId)
- : TabletId(tabletId)
- {
- }
-
- bool operator()(IEventHandle& ev)
- {
- if (ev.GetTypeRewrite() == TEvDataShard::EvStateChanged) {
- auto &rec = ev.Get<TEvDataShard::TEvStateChanged>()->Record;
- if (rec.GetTabletId() == TabletId
+void WaitTabletBecomesOffline(TServer::TPtr server, ui64 tabletId)
+{
+ struct IsShardStateChange
+ {
+ IsShardStateChange(ui64 tabletId)
+ : TabletId(tabletId)
+ {
+ }
+
+ bool operator()(IEventHandle& ev)
+ {
+ if (ev.GetTypeRewrite() == TEvDataShard::EvStateChanged) {
+ auto &rec = ev.Get<TEvDataShard::TEvStateChanged>()->Record;
+ if (rec.GetTabletId() == TabletId
&& rec.GetState() == NDataShard::TShardState::Offline)
- return true;
- }
- return false;
- }
-
- ui64 TabletId;
- };
-
- TDispatchOptions options;
- options.FinalEvents.emplace_back(IsShardStateChange(tabletId));
- server->GetRuntime()->DispatchEvents(options);
-}
-
+ return true;
+ }
+ return false;
+ }
+
+ ui64 TabletId;
+ };
+
+ TDispatchOptions options;
+ options.FinalEvents.emplace_back(IsShardStateChange(tabletId));
+ server->GetRuntime()->DispatchEvents(options);
+}
+
namespace {
class TReadTableImpl : public TActorBootstrapped<TReadTableImpl> {
@@ -1988,7 +1988,7 @@ TReadShardedTableState StartReadShardedTable(
UNIT_ASSERT_VALUES_EQUAL(result, "PAUSED");
}
return { sender, worker, result };
-}
+}
void ResumeReadShardedTable(
Tests::TServer::TPtr server,
diff --git a/ydb/core/tx/datashard/datashard_ut_common.h b/ydb/core/tx/datashard/datashard_ut_common.h
index b1cf4bd914e..4b5d7fe4ea0 100644
--- a/ydb/core/tx/datashard/datashard_ut_common.h
+++ b/ydb/core/tx/datashard/datashard_ut_common.h
@@ -384,7 +384,7 @@ struct TShardedTableOptions {
};
struct TIndex {
- using EType = NKikimrSchemeOp::EIndexType;
+ using EType = NKikimrSchemeOp::EIndexType;
TString Name;
TVector<TString> IndexColumns;
@@ -393,24 +393,24 @@ struct TShardedTableOptions {
};
struct TCdcStream {
- using EMode = NKikimrSchemeOp::ECdcStreamMode;
+ using EMode = NKikimrSchemeOp::ECdcStreamMode;
TString Name;
EMode Mode;
};
-#define TABLE_OPTION_IMPL(type, name, defaultValue) \
- TSelf& name(type value) {\
- name##_ = std::move(value); \
+#define TABLE_OPTION_IMPL(type, name, defaultValue) \
+ TSelf& name(type value) {\
+ name##_ = std::move(value); \
return *this; \
} \
type name##_ = defaultValue
-#define TABLE_OPTION(type, name, defaultValue) TABLE_OPTION_IMPL(type, name, defaultValue)
+#define TABLE_OPTION(type, name, defaultValue) TABLE_OPTION_IMPL(type, name, defaultValue)
TABLE_OPTION(ui64, Shards, 1);
TABLE_OPTION(bool, EnableOutOfOrder, true);
- TABLE_OPTION(const NLocalDb::TCompactionPolicy*, Policy, nullptr);
+ TABLE_OPTION(const NLocalDb::TCompactionPolicy*, Policy, nullptr);
TABLE_OPTION(EShadowDataMode, ShadowData, EShadowDataMode::Default);
TABLE_OPTION(TVector<TColumn>, Columns, (TVector<TColumn>{{"key", "Uint32", true, false}, {"value", "Uint32", false, false}}));
TABLE_OPTION(TVector<TIndex>, Indexes, {});
@@ -623,6 +623,6 @@ struct IsTxResultComplete {
}
};
-void WaitTabletBecomesOffline(Tests::TServer::TPtr server, ui64 tabletId);
-
+void WaitTabletBecomesOffline(Tests::TServer::TPtr server, ui64 tabletId);
+
}
diff --git a/ydb/core/tx/datashard/datashard_ut_erase_rows.cpp b/ydb/core/tx/datashard/datashard_ut_erase_rows.cpp
index 130cd338b0a..87a51ef80ab 100644
--- a/ydb/core/tx/datashard/datashard_ut_erase_rows.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_erase_rows.cpp
@@ -32,13 +32,13 @@ struct TProto {
using TDistributedEraseTx = NKikimrTxDataShard::TDistributedEraseTransaction;
};
-using EUnit = NKikimrSchemeOp::TTTLSettings::EUnit;
+using EUnit = NKikimrSchemeOp::TTTLSettings::EUnit;
struct TUnit {
- static constexpr EUnit AUTO = NKikimrSchemeOp::TTTLSettings::UNIT_AUTO;
- static constexpr EUnit SECONDS = NKikimrSchemeOp::TTTLSettings::UNIT_SECONDS;
- static constexpr EUnit MILLISECONDS = NKikimrSchemeOp::TTTLSettings::UNIT_MILLISECONDS;
- static constexpr EUnit MICROSECONDS = NKikimrSchemeOp::TTTLSettings::UNIT_MICROSECONDS;
- static constexpr EUnit NANOSECONDS = NKikimrSchemeOp::TTTLSettings::UNIT_NANOSECONDS;
+ static constexpr EUnit AUTO = NKikimrSchemeOp::TTTLSettings::UNIT_AUTO;
+ static constexpr EUnit SECONDS = NKikimrSchemeOp::TTTLSettings::UNIT_SECONDS;
+ static constexpr EUnit MILLISECONDS = NKikimrSchemeOp::TTTLSettings::UNIT_MILLISECONDS;
+ static constexpr EUnit MICROSECONDS = NKikimrSchemeOp::TTTLSettings::UNIT_MICROSECONDS;
+ static constexpr EUnit NANOSECONDS = NKikimrSchemeOp::TTTLSettings::UNIT_NANOSECONDS;
};
namespace {
@@ -355,13 +355,13 @@ void DistributedEraseTx(
} // anonymous
Y_UNIT_TEST_SUITE(EraseRowsTests) {
- void EraseRowsShouldSuccess(TMaybe<ui64> injectSchemaVersion, bool enableMvcc) {
+ void EraseRowsShouldSuccess(TMaybe<ui64> injectSchemaVersion, bool enableMvcc) {
TPortManager pm;
TServerSettings serverSettings(pm.GetPort(2134));
serverSettings
.SetEnableMvcc(enableMvcc)
.SetDomainName("Root")
- .SetUseRealThreads(false);
+ .SetUseRealThreads(false);
TServer::TPtr server = new TServer(serverSettings);
auto& runtime = *server->GetRuntime();
@@ -387,7 +387,7 @@ Y_UNIT_TEST_SUITE(EraseRowsTests) {
}
Y_UNIT_TEST_WITH_MVCC(EraseRowsShouldSuccess) {
- EraseRowsShouldSuccess(Nothing(), WithMvcc);
+ EraseRowsShouldSuccess(Nothing(), WithMvcc);
}
Y_UNIT_TEST_WITH_MVCC(EraseRowsShouldFailOnVariousErrors) {
@@ -396,7 +396,7 @@ Y_UNIT_TEST_SUITE(EraseRowsTests) {
serverSettings
.SetEnableMvcc(WithMvcc)
.SetDomainName("Root")
- .SetUseRealThreads(false);
+ .SetUseRealThreads(false);
TServer::TPtr server = new TServer(serverSettings);
auto& runtime = *server->GetRuntime();
@@ -435,7 +435,7 @@ Y_UNIT_TEST_SUITE(EraseRowsTests) {
serverSettings
.SetEnableMvcc(enableMvcc)
.SetDomainName("Root")
- .SetUseRealThreads(false);
+ .SetUseRealThreads(false);
TServer::TPtr server = new TServer(serverSettings);
auto& runtime = *server->GetRuntime();
@@ -623,7 +623,7 @@ key = 4, value = (empty maybe)
serverSettings
.SetEnableMvcc(WithMvcc)
.SetDomainName("Root")
- .SetUseRealThreads(false);
+ .SetUseRealThreads(false);
TServer::TPtr server = new TServer(serverSettings);
auto& runtime = *server->GetRuntime();
@@ -669,7 +669,7 @@ key = 4, value = (empty maybe)
serverSettings
.SetEnableMvcc(WithMvcc)
.SetDomainName("Root")
- .SetUseRealThreads(false);
+ .SetUseRealThreads(false);
TServer::TPtr server = new TServer(serverSettings);
auto& runtime = *server->GetRuntime();
@@ -732,7 +732,7 @@ key = 4, value = (empty maybe)
serverSettings
.SetEnableMvcc(WithMvcc)
.SetDomainName("Root")
- .SetUseRealThreads(false);
+ .SetUseRealThreads(false);
TServer::TPtr server = new TServer(serverSettings);
auto& runtime = *server->GetRuntime();
@@ -973,7 +973,7 @@ Y_UNIT_TEST_SUITE(DistributedEraseTests) {
TServerSettings serverSettings(pm.GetPort(2134));
serverSettings
.SetDomainName("Root")
- .SetUseRealThreads(false);
+ .SetUseRealThreads(false);
TServer::TPtr server = new TServer(serverSettings);
auto& runtime = *server->GetRuntime();
@@ -1108,7 +1108,7 @@ tkey = 100, key = 4
TServerSettings serverSettings(pm.GetPort(2134));
serverSettings
.SetDomainName("Root")
- .SetUseRealThreads(false);
+ .SetUseRealThreads(false);
TServer::TPtr server = new TServer(serverSettings);
auto& runtime = *server->GetRuntime();
@@ -1220,7 +1220,7 @@ tkey = 100, key = 4
TServerSettings serverSettings(pm.GetPort(2134));
serverSettings
.SetDomainName("Root")
- .SetUseRealThreads(false);
+ .SetUseRealThreads(false);
TServer::TPtr server = new TServer(serverSettings);
auto& runtime = *server->GetRuntime();
@@ -1276,7 +1276,7 @@ tkey = 100, key = 4
TServerSettings serverSettings(pm.GetPort(2134));
serverSettings
.SetDomainName("Root")
- .SetUseRealThreads(false);
+ .SetUseRealThreads(false);
TServer::TPtr server = new TServer(serverSettings);
auto& runtime = *server->GetRuntime();
@@ -1345,7 +1345,7 @@ tkey = 100, key = 4
check(TEvResponse::ProtoRecordType::SCHEME_ERROR, "Invalid index state", [](TAutoPtr<IEventHandle>& ev) {
if (ev->GetTypeRewrite() == TEvNavigate::EventType) {
- ev->Get<TEvNavigate>()->Request->ResultSet.at(0).Indexes.at(0).SetState(NKikimrSchemeOp::EIndexStateInvalid);
+ ev->Get<TEvNavigate>()->Request->ResultSet.at(0).Indexes.at(0).SetState(NKikimrSchemeOp::EIndexStateInvalid);
}
});
@@ -1448,7 +1448,7 @@ tkey = 100, key = 4
TServerSettings serverSettings(pm.GetPort(2134));
serverSettings
.SetDomainName("Root")
- .SetUseRealThreads(false);
+ .SetUseRealThreads(false);
TServer::TPtr server = new TServer(serverSettings);
auto& runtime = *server->GetRuntime();
@@ -1492,7 +1492,7 @@ tkey = 100, key = 4
TServerSettings serverSettings(pm.GetPort(2134));
serverSettings
.SetDomainName("Root")
- .SetUseRealThreads(false);
+ .SetUseRealThreads(false);
TServer::TPtr server = new TServer(serverSettings);
auto& runtime = *server->GetRuntime();
@@ -1532,7 +1532,7 @@ tkey = 100, key = 4
TServerSettings serverSettings(pm.GetPort(2134));
serverSettings
.SetDomainName("Root")
- .SetUseRealThreads(false);
+ .SetUseRealThreads(false);
TServer::TPtr server = new TServer(serverSettings);
auto& runtime = *server->GetRuntime();
@@ -1571,7 +1571,7 @@ tkey = 100, key = 4
TServerSettings serverSettings(pm.GetPort(2134));
serverSettings
.SetDomainName("Root")
- .SetUseRealThreads(false);
+ .SetUseRealThreads(false);
TServer::TPtr server = new TServer(serverSettings);
auto& runtime = *server->GetRuntime();
@@ -1631,7 +1631,7 @@ tkey = 100, key = 4
TServerSettings serverSettings(pm.GetPort(2134));
serverSettings
.SetDomainName("Root")
- .SetUseRealThreads(false);
+ .SetUseRealThreads(false);
TServer::TPtr server = new TServer(serverSettings);
auto& runtime = *server->GetRuntime();
diff --git a/ydb/core/tx/datashard/datashard_ut_followers.cpp b/ydb/core/tx/datashard/datashard_ut_followers.cpp
index 10c1f0ae8f3..c97c541e896 100644
--- a/ydb/core/tx/datashard/datashard_ut_followers.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_followers.cpp
@@ -7,7 +7,7 @@ namespace NKikimr {
using namespace NKikimr::NDataShard;
using namespace NKikimr::NDataShard::NKqpHelpers;
using namespace NKikimr::NDataShardReadTableTest;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace Tests;
Y_UNIT_TEST_SUITE(DataShardFollowers) {
diff --git a/ydb/core/tx/datashard/datashard_ut_init.cpp b/ydb/core/tx/datashard/datashard_ut_init.cpp
index 6cbff286a01..818e30ab0cb 100644
--- a/ydb/core/tx/datashard/datashard_ut_init.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_init.cpp
@@ -11,7 +11,7 @@
namespace NKikimr {
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace Tests;
using NClient::TValue;
@@ -42,7 +42,7 @@ TString GetTablePath(TTestActorRuntime &runtime,
TValue value = TValue::Create(res.GetValue(), res.GetType());
TString schema = value["myRes"]["Schema"];
- NKikimrSchemeOp::TTableDescription desc;
+ NKikimrSchemeOp::TTableDescription desc;
Y_PROTOBUF_SUPPRESS_NODISCARD desc.ParseFromArray(schema.data(), schema.size());
return desc.GetPath();
@@ -143,11 +143,11 @@ Y_UNIT_TEST_SUITE(TTxDataShardTestInit) {
NKikimrTxDataShard::TFlatSchemeTransaction tx;
Y_PROTOBUF_SUPPRESS_NODISCARD tx.ParseFromArray(body.Data(), body.Size());
if (tx.HasCreateTable()) {
- tableId = tx.GetCreateTable().GetId_Deprecated();
- if (tx.GetCreateTable().HasPathId()) {
- UNIT_ASSERT_EQUAL(ChangeStateStorage(Tests::SchemeRoot, serverSettings.Domain), tx.GetCreateTable().GetPathId().GetOwnerId());
- tableId = tx.GetCreateTable().GetPathId().GetLocalId();
- }
+ tableId = tx.GetCreateTable().GetId_Deprecated();
+ if (tx.GetCreateTable().HasPathId()) {
+ UNIT_ASSERT_EQUAL(ChangeStateStorage(Tests::SchemeRoot, serverSettings.Domain), tx.GetCreateTable().GetPathId().GetOwnerId());
+ tableId = tx.GetCreateTable().GetPathId().GetLocalId();
+ }
if (oldCreate) {
tx.MutableCreateTable()->ClearPath();
Y_PROTOBUF_SUPPRESS_NODISCARD tx.SerializeToString(&body);
@@ -155,8 +155,8 @@ Y_UNIT_TEST_SUITE(TTxDataShardTestInit) {
}
}
}
- } else if (event->GetTypeRewrite() == TEvSchemeShard::EvDescribeSchemeResult) {
- auto &rec = event->Get<TEvSchemeShard::TEvDescribeSchemeResult>()->GetRecord();
+ } else if (event->GetTypeRewrite() == TEvSchemeShard::EvDescribeSchemeResult) {
+ auto &rec = event->Get<TEvSchemeShard::TEvDescribeSchemeResult>()->GetRecord();
const bool hasPartitioning = rec.GetPathDescription().TablePartitionsSize();
// there are few in-flight TEvDescribeSchemeResult msgs, we need one with no partitioning
if (!hasPartitioning && rec.GetPathDescription().GetSelf().GetPathId() == tableId) {
@@ -181,7 +181,7 @@ Y_UNIT_TEST_SUITE(TTxDataShardTestInit) {
if (oldCreate) {
while (!sawResolve) {
TDispatchOptions options;
- options.FinalEvents.emplace_back(TEvSchemeShard::EvDescribeSchemeResult);
+ options.FinalEvents.emplace_back(TEvSchemeShard::EvDescribeSchemeResult);
runtime.DispatchEvents(options);
}
}
diff --git a/ydb/core/tx/datashard/datashard_ut_kqp_scan.cpp b/ydb/core/tx/datashard/datashard_ut_kqp_scan.cpp
index 4a966b79da2..b2b14de1904 100644
--- a/ydb/core/tx/datashard/datashard_ut_kqp_scan.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_kqp_scan.cpp
@@ -336,7 +336,7 @@ Y_UNIT_TEST_SUITE(KqpScan) {
auto request = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
request->Record.SetExecTimeoutPeriod(Max<ui64>());
auto &tx = *request->Record.MutableTransaction()->MutableModifyScheme();
- tx.SetOperationType(NKikimrSchemeOp::ESchemeOpSplitMergeTablePartitions);
+ tx.SetOperationType(NKikimrSchemeOp::ESchemeOpSplitMergeTablePartitions);
auto &desc = *tx.MutableSplitMergeTablePartitions();
desc.SetTablePath("/Root/table-1");
desc.AddSourceTabletId(tabletId);
diff --git a/ydb/core/tx/datashard/datashard_ut_locks.cpp b/ydb/core/tx/datashard/datashard_ut_locks.cpp
index 56de390b18a..1d25c39f99d 100644
--- a/ydb/core/tx/datashard/datashard_ut_locks.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_locks.cpp
@@ -13,7 +13,7 @@
namespace NKikimr {
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace Tests;
struct TTableId;
@@ -27,8 +27,8 @@ namespace NTest {
///
class TFakeDataShard {
public:
- ui64 PathOwnerId = 0;
- ui64 CurrentSchemeShardId = 0;
+ ui64 PathOwnerId = 0;
+ ui64 CurrentSchemeShardId = 0;
TRowVersion CompleteVersion = TRowVersion::Min();
TFakeDataShard() {
@@ -589,15 +589,15 @@ void CheckLocksCacheUsage(bool waitForLocksStore) {
Tests::TServer::TPtr server = new TServer(serverSettings);
auto &runtime = *server->GetRuntime();
- auto sender = runtime.AllocateEdgeActor();
-
+ auto sender = runtime.AllocateEdgeActor();
+
runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_TRACE);
//runtime.SetLogPriority(NKikimrServices::TX_PROXY, NLog::PRI_TRACE);
//runtime.SetLogPriority(NKikimrServices::KQP_YQL, NLog::PRI_TRACE);
- InitRoot(server, sender);
-
-
+ InitRoot(server, sender);
+
+
TAutoPtr<IEventHandle> handle;
NTabletPipe::TClientConfig pipeConfig;
pipeConfig.RetryPolicy = NTabletPipe::TClientRetryPolicy::WithRetries();
@@ -609,7 +609,7 @@ void CheckLocksCacheUsage(bool waitForLocksStore) {
auto request = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
request->Record.SetExecTimeoutPeriod(Max<ui64>());
auto &tx = *request->Record.MutableTransaction()->MutableModifyScheme();
- tx.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateTable);
+ tx.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateTable);
tx.SetWorkingDir("/Root");
auto &desc = *tx.MutableCreateTable();
desc.SetName("table-1");
@@ -632,10 +632,10 @@ void CheckLocksCacheUsage(bool waitForLocksStore) {
txId = reply->Record.GetTxId();
}
{
- auto request = MakeHolder<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion>();
+ auto request = MakeHolder<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion>();
request->Record.SetTxId(txId);
runtime.SendToPipe(pipe, sender, request.Release());
- runtime.GrabEdgeEventRethrow<TEvSchemeShard::TEvNotifyTxCompletionResult>(handle);
+ runtime.GrabEdgeEventRethrow<TEvSchemeShard::TEvNotifyTxCompletionResult>(handle);
}
{
@@ -654,7 +654,7 @@ void CheckLocksCacheUsage(bool waitForLocksStore) {
auto request = MakeHolder<TEvTxUserProxy::TEvNavigate>();
request->Record.MutableDescribePath()->SetPath("/Root/table-1");
runtime.Send(new IEventHandle(MakeTxProxyID(), sender, request.Release()));
- auto reply = runtime.GrabEdgeEventRethrow<TEvSchemeShard::TEvDescribeSchemeResult>(handle);
+ auto reply = runtime.GrabEdgeEventRethrow<TEvSchemeShard::TEvDescribeSchemeResult>(handle);
for (auto i = 0; i < 2; ++i)
shards[i] = reply->GetRecord().GetPathDescription()
.GetTablePartitions(i).GetDatashardId();
diff --git a/ydb/core/tx/datashard/datashard_ut_minstep.cpp b/ydb/core/tx/datashard/datashard_ut_minstep.cpp
index 4bcca34e726..99d72b2e457 100644
--- a/ydb/core/tx/datashard/datashard_ut_minstep.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_minstep.cpp
@@ -1,146 +1,146 @@
-#include "defs.h"
-#include "datashard_ut_common.h"
-
+#include "defs.h"
+#include "datashard_ut_common.h"
+
#include <ydb/core/testlib/test_client.h>
#include <ydb/core/tx/schemeshard/schemeshard.h>
#include <ydb/core/tx/tx_proxy/proxy.h>
#include <ydb/core/tx/tx.h>
-
+
#include <library/cpp/testing/unittest/registar.h>
-
-
-namespace NKikimr {
-
-using namespace NSchemeShard;
-using namespace Tests;
-
-TAutoPtr<IEventHandle> EjectDataPropose(TServer::TPtr server, ui64 dataShard)
-{
- auto &runtime = *server->GetRuntime();
- ui64 schemeShard = ChangeStateStorage(SchemeRoot, server->GetSettings().Domain);
-
- bool hasFound = false;
- TAutoPtr<IEventHandle> proposeEvent = nullptr;
-
+
+
+namespace NKikimr {
+
+using namespace NSchemeShard;
+using namespace Tests;
+
+TAutoPtr<IEventHandle> EjectDataPropose(TServer::TPtr server, ui64 dataShard)
+{
+ auto &runtime = *server->GetRuntime();
+ ui64 schemeShard = ChangeStateStorage(SchemeRoot, server->GetSettings().Domain);
+
+ bool hasFound = false;
+ TAutoPtr<IEventHandle> proposeEvent = nullptr;
+
auto captureProposes = [dataShard, schemeShard, &hasFound, &proposeEvent] (TTestActorRuntimeBase&, TAutoPtr<IEventHandle> &event) -> auto
- {
- if (event->GetTypeRewrite() == TEvTxProxy::EvProposeTransaction) {
- auto &rec = event->Get<TEvTxProxy::TEvProposeTransaction>()->Record;
- bool noSchemeShard = true;
- bool hasDataShard = false;
-
- for (auto& affected: rec.GetTransaction().GetAffectedSet()) {
- if (schemeShard == affected.GetTabletId()) {
- noSchemeShard = false;
- }
- if (dataShard == affected.GetTabletId()) {
- hasDataShard = true;
- }
- }
-
- if (noSchemeShard && hasDataShard) {
- Cerr << "\n\n\n got data transaction propose \n\n\n";
- Cerr << rec.DebugString();
- hasFound = true;
- proposeEvent = std::move(event);
- return TTestActorRuntime::EEventAction::DROP;
- }
- }
-
- return TTestActorRuntime::EEventAction::PROCESS;
- };
- auto prevObserver = runtime.SetObserverFunc(captureProposes);
-
- auto stopCondition = [&hasFound] () -> auto
- {
- return hasFound;
- };
-
- TDispatchOptions options;
- options.CustomFinalCondition = stopCondition;
- server->GetRuntime()->DispatchEvents(options);
- runtime.SetObserverFunc(prevObserver);
-
- Y_VERIFY(proposeEvent);
- return proposeEvent;
-}
-
-Y_UNIT_TEST_SUITE(TDataShardMinStepTest) {
+ {
+ if (event->GetTypeRewrite() == TEvTxProxy::EvProposeTransaction) {
+ auto &rec = event->Get<TEvTxProxy::TEvProposeTransaction>()->Record;
+ bool noSchemeShard = true;
+ bool hasDataShard = false;
+
+ for (auto& affected: rec.GetTransaction().GetAffectedSet()) {
+ if (schemeShard == affected.GetTabletId()) {
+ noSchemeShard = false;
+ }
+ if (dataShard == affected.GetTabletId()) {
+ hasDataShard = true;
+ }
+ }
+
+ if (noSchemeShard && hasDataShard) {
+ Cerr << "\n\n\n got data transaction propose \n\n\n";
+ Cerr << rec.DebugString();
+ hasFound = true;
+ proposeEvent = std::move(event);
+ return TTestActorRuntime::EEventAction::DROP;
+ }
+ }
+
+ return TTestActorRuntime::EEventAction::PROCESS;
+ };
+ auto prevObserver = runtime.SetObserverFunc(captureProposes);
+
+ auto stopCondition = [&hasFound] () -> auto
+ {
+ return hasFound;
+ };
+
+ TDispatchOptions options;
+ options.CustomFinalCondition = stopCondition;
+ server->GetRuntime()->DispatchEvents(options);
+ runtime.SetObserverFunc(prevObserver);
+
+ Y_VERIFY(proposeEvent);
+ return proposeEvent;
+}
+
+Y_UNIT_TEST_SUITE(TDataShardMinStepTest) {
void TestDropTablePlanComesNotTooEarly(const TString& query, Ydb::StatusIds::StatusCode expectedStatus) {
- TPortManager pm;
- TServerSettings serverSettings(pm.GetPort(2134));
- serverSettings.SetDomainName("Root")
- .SetUseRealThreads(false);
-
- Tests::TServer::TPtr server = new TServer(serverSettings);
- auto &runtime = *server->GetRuntime();
- auto sender = runtime.AllocateEdgeActor();
- TAutoPtr<IEventHandle> handle;
-
+ TPortManager pm;
+ TServerSettings serverSettings(pm.GetPort(2134));
+ serverSettings.SetDomainName("Root")
+ .SetUseRealThreads(false);
+
+ Tests::TServer::TPtr server = new TServer(serverSettings);
+ auto &runtime = *server->GetRuntime();
+ auto sender = runtime.AllocateEdgeActor();
+ TAutoPtr<IEventHandle> handle;
+
runtime.SetLogPriority(NKikimrServices::HIVE, NLog::PRI_DEBUG);
- runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_DEBUG);
- runtime.SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NLog::PRI_NOTICE);
- runtime.SetLogPriority(NKikimrServices::TX_COORDINATOR, NLog::PRI_TRACE);
- //runtime.SetLogPriority(NKikimrServices::TX_MEDIATOR_TABLETQUEUE, NLog::PRI_TRACE);
-
- //runtime.SetLogPriority(NKikimrServices::TX_PROXY, NLog::PRI_TRACE);
- runtime.SetLogPriority(NKikimrServices::KQP_YQL, NLog::PRI_TRACE);
-
- InitRoot(server, sender);
- CreateShardedTable(server, sender, "/Root", "table-1", 1);
- ExecSQL(server, sender, "UPSERT INTO [/Root/table-1] (key, value) VALUES (1, 1);");
- ui64 shard1 = GetTableShards(server, sender, "/Root/table-1")[0];
-
- CreateShardedTable(server, sender, "/Root", "table-2", 1);
- ui64 shard2 = GetTableShards(server, sender, "/Root/table-2")[0];
-
- // propose data tx for datashards but not to coordinator
- // eject propose message to coordinator
+ runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_DEBUG);
+ runtime.SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NLog::PRI_NOTICE);
+ runtime.SetLogPriority(NKikimrServices::TX_COORDINATOR, NLog::PRI_TRACE);
+ //runtime.SetLogPriority(NKikimrServices::TX_MEDIATOR_TABLETQUEUE, NLog::PRI_TRACE);
+
+ //runtime.SetLogPriority(NKikimrServices::TX_PROXY, NLog::PRI_TRACE);
+ runtime.SetLogPriority(NKikimrServices::KQP_YQL, NLog::PRI_TRACE);
+
+ InitRoot(server, sender);
+ CreateShardedTable(server, sender, "/Root", "table-1", 1);
+ ExecSQL(server, sender, "UPSERT INTO [/Root/table-1] (key, value) VALUES (1, 1);");
+ ui64 shard1 = GetTableShards(server, sender, "/Root/table-1")[0];
+
+ CreateShardedTable(server, sender, "/Root", "table-2", 1);
+ ui64 shard2 = GetTableShards(server, sender, "/Root/table-2")[0];
+
+ // propose data tx for datashards but not to coordinator
+ // eject propose message to coordinator
SendSQL(server, sender, query);
- auto proposeEvent = EjectDataPropose(server, shard2);
-
- // drop one table while proposes are active
+ auto proposeEvent = EjectDataPropose(server, shard2);
+
+ // drop one table while proposes are active
const TInstant dropStart = runtime.GetCurrentTime();
- ExecSQL(server, sender, "DROP TABLE [/Root/table-1]", false);
- WaitTabletBecomesOffline(server, shard1);
+ ExecSQL(server, sender, "DROP TABLE [/Root/table-1]", false);
+ WaitTabletBecomesOffline(server, shard1);
const TInstant dropEnd = runtime.GetCurrentTime();
-
+
UNIT_ASSERT_C((dropEnd - dropStart) < TDuration::Seconds(35),
"Drop has taken " << (dropEnd - dropStart) << " of simulated time");
- { // make sure that the ejeceted propose has become outdated
- auto request = MakeHolder<TEvTxProxy::TEvProposeTransaction>();
- request->Record.CopyFrom(proposeEvent->Get<TEvTxProxy::TEvProposeTransaction>()->Record);
- runtime.SendToPipe(request->Record.GetCoordinatorID(), sender, request.Release());
-
- TAutoPtr<IEventHandle> handle;
- auto reply = runtime.GrabEdgeEventRethrow<TEvTxProxy::TEvProposeTransactionStatus>(handle);
+ { // make sure that the ejeceted propose has become outdated
+ auto request = MakeHolder<TEvTxProxy::TEvProposeTransaction>();
+ request->Record.CopyFrom(proposeEvent->Get<TEvTxProxy::TEvProposeTransaction>()->Record);
+ runtime.SendToPipe(request->Record.GetCoordinatorID(), sender, request.Release());
+
+ TAutoPtr<IEventHandle> handle;
+ auto reply = runtime.GrabEdgeEventRethrow<TEvTxProxy::TEvProposeTransactionStatus>(handle);
UNIT_ASSERT_VALUES_EQUAL((TEvTxProxy::TEvProposeTransactionStatus::EStatus)reply->Record.GetStatus(),
TEvTxProxy::TEvProposeTransactionStatus::EStatus::StatusOutdated);
- }
-
- { // handle respond from unplanned data transaction because plan ejection
- TAutoPtr<IEventHandle> handle;
- auto reply = runtime.GrabEdgeEventRethrow<NKqp::TEvKqp::TEvQueryResponse>(handle);
+ }
+
+ { // handle respond from unplanned data transaction because plan ejection
+ TAutoPtr<IEventHandle> handle;
+ auto reply = runtime.GrabEdgeEventRethrow<NKqp::TEvKqp::TEvQueryResponse>(handle);
NYql::TIssues issues;
NYql::IssuesFromMessage(reply->Record.GetRef().GetResponse().GetQueryIssues(), issues);
UNIT_ASSERT_VALUES_EQUAL_C(reply->Record.GetRef().GetYdbStatus(), expectedStatus,
issues.ToString());
- }
-
- // make sure that second table is still operationable
- ExecSQL(server, sender, "UPSERT INTO [/Root/table-2] (key, value) VALUES (2, 2);");
- ExecSQL(server, sender, "DROP TABLE [/Root/table-2]", false);
- WaitTabletBecomesOffline(server, shard2);
- }
+ }
+
+ // make sure that second table is still operationable
+ ExecSQL(server, sender, "UPSERT INTO [/Root/table-2] (key, value) VALUES (2, 2);");
+ ExecSQL(server, sender, "DROP TABLE [/Root/table-2]", false);
+ WaitTabletBecomesOffline(server, shard2);
+ }
Y_UNIT_TEST(TestDropTablePlanComesNotTooEarlyRO) {
TestDropTablePlanComesNotTooEarly(
"SELECT * FROM [/Root/table-1]; SELECT * FROM [/Root/table-2];",
Ydb::StatusIds::UNAVAILABLE
);
- }
-
+ }
+
Y_UNIT_TEST(TestDropTablePlanComesNotTooEarlyRW) {
TestDropTablePlanComesNotTooEarly(
"UPSERT INTO [/Root/table-2] (key, value) SELECT key, value FROM [/Root/table-1];",
@@ -485,4 +485,4 @@ Y_UNIT_TEST_SUITE(TDataShardMinStepTest) {
}
-} // namespace NKikimr
+} // namespace NKikimr
diff --git a/ydb/core/tx/datashard/datashard_ut_order.cpp b/ydb/core/tx/datashard/datashard_ut_order.cpp
index 93c4d497963..32472dce59e 100644
--- a/ydb/core/tx/datashard/datashard_ut_order.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_order.cpp
@@ -22,7 +22,7 @@ using NClient::TValue;
using IEngineFlat = NMiniKQL::IEngineFlat;
using namespace NKikimr::NDataShard;
using namespace NKikimr::NDataShard::NKqpHelpers;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace Tests;
using TActiveTxPtr = std::shared_ptr<TActiveTransaction>;
@@ -2533,7 +2533,7 @@ namespace {
auto request = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
request->Record.SetExecTimeoutPeriod(Max<ui64>());
auto &tx = *request->Record.MutableTransaction()->MutableModifyScheme();
- tx.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateTable);
+ tx.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateTable);
tx.SetWorkingDir(root);
auto &desc = *tx.MutableCreateTable();
desc.SetName(name);
diff --git a/ydb/core/tx/datashard/datashard_ut_range_ops.cpp b/ydb/core/tx/datashard/datashard_ut_range_ops.cpp
index 7016ff67ee2..61f0bc94060 100644
--- a/ydb/core/tx/datashard/datashard_ut_range_ops.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_range_ops.cpp
@@ -1,877 +1,877 @@
-#include "datashard_ut_common.h"
-
+#include "datashard_ut_common.h"
+
#include <ydb/core/tx/datashard/range_ops.h>
-
-namespace NKikimr {
-
-Y_UNIT_TEST_SUITE(RangeOps) {
- TString MakeValue(ui64 value) {
- TRawTypeValue raw(&value, sizeof(value), NScheme::NTypeIds::Uint64);
- TCell cell(&raw);
- TVector<TCell> vec = {cell};
- TArrayRef<TCell> cells(vec);
- return TSerializedCellVec::Serialize(cells);
- }
- TString MakeLeftInf() {
- TCell cell;
- TVector<TCell> vec = {cell};
- TArrayRef<TCell> cells(vec);
- return TSerializedCellVec::Serialize(cells);
- }
-
- TString MakeRightInf() {
- return {};
- }
-
- TSerializedTableRange MakeRange(TString from, bool fromInclusive, TString to, bool toInclusive) {
- return TSerializedTableRange(from, to, fromInclusive, toInclusive);
- }
-
- void CheckRange(TConstArrayRef<NScheme::TTypeId> types,
- const TTableRange& first, const TTableRange& second) {
- if (first.IsEmptyRange(types)) {
- Y_ASSERT(second.IsEmptyRange(types));
- return;
- }
-
- int cmpFF = CompareBorders<false, false>(first.From,
- second.From,
- first.InclusiveFrom,
- second.InclusiveFrom,
- types);
- Y_ASSERT(cmpFF == 0);
-
- int cmpTT = CompareBorders<true, true>(first.To,
- second.To,
- first.InclusiveTo,
- second.InclusiveTo,
- types);
- Y_ASSERT(cmpTT == 0);
-
- }
-
- Y_UNIT_TEST(Intersection) {
- auto typeRegistry = MakeHolder<NScheme::TKikimrTypeRegistry>();
- typeRegistry->CalculateMetadataEtag();
-
- const TVector<NKikimr::NScheme::TTypeId> valueType = {NScheme::NTypeIds::Uint64};
-
- const auto emptyRange = MakeRange(
- MakeValue(20), true,
- MakeValue(10), true
- );
-
- {
- //=================
- //-----------[aaa]---
- //----[bbb]----------
- auto first = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(1), true,
- MakeValue(5), true
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- CheckRange(valueType, emptyRange.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //-----------[aaa]---
- //----[bbbbbb]-------
- auto first = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(1), true,
- MakeValue(10), true
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(10), true,
- MakeValue(10), true
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
-
- {
- //=================
- //-----------[aaa]---
- //----[bbbbbbbb]-----
- auto first = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(1), true,
- MakeValue(15), true
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(10), true,
- MakeValue(15), true
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //-----------[aaa]---
- //----[bbbbbbbbbb]---
- auto first = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(1), true,
- MakeValue(20), true
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //---------[aaa]----
- //--[bbbbbbbbbbbbb]-
- auto first = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(1), true,
- MakeValue(30), true
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
-
- {
- //=================
- //----[aaaaaa]----------
- //----[]----------
- auto first = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(10), true,
- MakeValue(10), true
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(10), true,
- MakeValue(10), true
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //----[aaaaaa]----------
- //----[bbb]----------
- auto first = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(10), true,
- MakeValue(15), true
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(10), true,
- MakeValue(15), true
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
-
- //=================
- //----[aaaaaa]----------
- //----[bbbbbb]----------
- auto first = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
-
- //=================
- //----[aaaaaa]----------
- //----[bbbbbbbb]----------
- auto first = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(10), true,
- MakeValue(30), true
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //-----[aaaaaaa]----------
- //-------[bbb]----------
- auto first = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(15), true,
- MakeValue(17), true
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(15), true,
- MakeValue(17), true
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //-----[aaaaaaa]----------
- //-------[bbbbb]----------
- auto first = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(15), true,
- MakeValue(20), true
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(15), true,
- MakeValue(20), true
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //-----[aaaaaaa]----------
- //-------[bbbbbbb]----------
- auto first = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(15), true,
- MakeValue(30), true
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(15), true,
- MakeValue(20), true
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //-----[aaa]----------
- //---------[]----------
- auto first = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(20), true,
- MakeValue(20), true
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(20), true,
- MakeValue(20), true
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //-----[aaa]----------
- //---------[bbb]----------
- auto first = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(20), true,
- MakeValue(30), true
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(20), true,
- MakeValue(20), true
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //-----[aaa]----------
- //------------[bbb]---
- auto first = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(25), true,
- MakeValue(30), true
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- CheckRange(valueType, emptyRange.ToTableRange(), range);
- Cerr << Endl;
- }
-
-
- {
- //=================
- //-----------(aaa]---
- //----[bbbbbb]-------
- auto first = MakeRange(
- MakeValue(10), false,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(1), true,
- MakeValue(10), true
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
-
- CheckRange(valueType, emptyRange.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //-----------[aaa]---
- //----[bbbbbb)-------
- auto first = MakeRange(
- MakeValue(10), true,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(1), true,
- MakeValue(10), false
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
-
- CheckRange(valueType, emptyRange.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //-----------(aaa]---
- //----[bbbbbb)-------
- auto first = MakeRange(
- MakeValue(10), false,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(1), true,
- MakeValue(10), false
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
-
- CheckRange(valueType, emptyRange.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //---------(aaa]---
- //----[bbbbbb]-------
- auto first = MakeRange(
- MakeValue(10), false,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(1), true,
- MakeValue(15), true
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(10), false,
- MakeValue(15), true
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //---------(aaa]---
- //----[bbbbbb)-------
- auto first = MakeRange(
- MakeValue(10), false,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(1), true,
- MakeValue(15), false
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(10), false,
- MakeValue(15), false
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //---------(aaa]---
- //----[bbbbbbbb)-------
- auto first = MakeRange(
- MakeValue(10), false,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(1), true,
- MakeValue(20), false
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(10), false,
- MakeValue(20), false
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //---------(aaa)---
- //----[bbbbbbbb)-------
- auto first = MakeRange(
- MakeValue(10), false,
- MakeValue(20), false
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
-
- auto second = MakeRange(
- MakeValue(1), true,
- MakeValue(20), false
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(10), false,
- MakeValue(20), false
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //(-inf; +inf)
- //----[bbbbbbbb)-------
- auto first = MakeRange(
- MakeLeftInf(), true,
- MakeRightInf(), false
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
- Y_ASSERT(!first.ToTableRange().IsEmptyRange(valueType));
-
- auto second = MakeRange(
- MakeValue(1), true,
- MakeValue(20), false
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(1), true,
- MakeValue(20), false
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //-------[aaaaa +inf)
- //----[bbbbbbbb)-------
- auto first = MakeRange(
- MakeValue(10), true,
- MakeRightInf(), false
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
- Y_ASSERT(!first.ToTableRange().IsEmptyRange(valueType));
-
- auto second = MakeRange(
- MakeValue(1), true,
- MakeValue(20), false
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(10), true,
- MakeValue(20), false
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //--------(aaaaa +inf)
- //----[bbb)-------
- auto first = MakeRange(
- MakeValue(10), false,
- MakeRightInf(), false
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
- Y_ASSERT(!first.ToTableRange().IsEmptyRange(valueType));
-
- auto second = MakeRange(
- MakeValue(1), true,
- MakeValue(10), false
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- CheckRange(valueType, emptyRange.ToTableRange(), range);
- Cerr << Endl;
- }
-
-
- {
- //=================
- //-------(aaaaa +inf)
- //----[bbbbbbbb)-------
- auto first = MakeRange(
- MakeValue(10), false,
- MakeRightInf(), false
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
- Y_ASSERT(!first.ToTableRange().IsEmptyRange(valueType));
-
- auto second = MakeRange(
- MakeValue(1), true,
- MakeValue(20), false
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(10), false,
- MakeValue(20), false
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //(-inf; aaa]------
- //----[bbbbbbbb)-------
- auto first = MakeRange(
- MakeLeftInf(), true,
- MakeValue(10), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
- Y_ASSERT(!first.ToTableRange().IsEmptyRange(valueType));
-
- auto second = MakeRange(
- MakeValue(1), true,
- MakeValue(20), false
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(1), true,
- MakeValue(10), true
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
-
- {
- //=================
- //(-inf; aaa]------
- //----[bbbbbbbb)-------
- auto first = MakeRange(
- MakeLeftInf(), true,
- MakeValue(20), true
- );
- Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
- Y_ASSERT(!first.ToTableRange().IsEmptyRange(valueType));
-
- auto second = MakeRange(
- MakeValue(1), true,
- MakeValue(10), false
- );
- Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
-
- auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
- Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
-
- auto correct = MakeRange(
- MakeValue(1), true,
- MakeValue(10), false
- );
-
- Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
-
- CheckRange(valueType, correct.ToTableRange(), range);
- Cerr << Endl;
- }
- }
-}}
+
+namespace NKikimr {
+
+Y_UNIT_TEST_SUITE(RangeOps) {
+ TString MakeValue(ui64 value) {
+ TRawTypeValue raw(&value, sizeof(value), NScheme::NTypeIds::Uint64);
+ TCell cell(&raw);
+ TVector<TCell> vec = {cell};
+ TArrayRef<TCell> cells(vec);
+ return TSerializedCellVec::Serialize(cells);
+ }
+ TString MakeLeftInf() {
+ TCell cell;
+ TVector<TCell> vec = {cell};
+ TArrayRef<TCell> cells(vec);
+ return TSerializedCellVec::Serialize(cells);
+ }
+
+ TString MakeRightInf() {
+ return {};
+ }
+
+ TSerializedTableRange MakeRange(TString from, bool fromInclusive, TString to, bool toInclusive) {
+ return TSerializedTableRange(from, to, fromInclusive, toInclusive);
+ }
+
+ void CheckRange(TConstArrayRef<NScheme::TTypeId> types,
+ const TTableRange& first, const TTableRange& second) {
+ if (first.IsEmptyRange(types)) {
+ Y_ASSERT(second.IsEmptyRange(types));
+ return;
+ }
+
+ int cmpFF = CompareBorders<false, false>(first.From,
+ second.From,
+ first.InclusiveFrom,
+ second.InclusiveFrom,
+ types);
+ Y_ASSERT(cmpFF == 0);
+
+ int cmpTT = CompareBorders<true, true>(first.To,
+ second.To,
+ first.InclusiveTo,
+ second.InclusiveTo,
+ types);
+ Y_ASSERT(cmpTT == 0);
+
+ }
+
+ Y_UNIT_TEST(Intersection) {
+ auto typeRegistry = MakeHolder<NScheme::TKikimrTypeRegistry>();
+ typeRegistry->CalculateMetadataEtag();
+
+ const TVector<NKikimr::NScheme::TTypeId> valueType = {NScheme::NTypeIds::Uint64};
+
+ const auto emptyRange = MakeRange(
+ MakeValue(20), true,
+ MakeValue(10), true
+ );
+
+ {
+ //=================
+ //-----------[aaa]---
+ //----[bbb]----------
+ auto first = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(1), true,
+ MakeValue(5), true
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ CheckRange(valueType, emptyRange.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //-----------[aaa]---
+ //----[bbbbbb]-------
+ auto first = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(1), true,
+ MakeValue(10), true
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(10), true,
+ MakeValue(10), true
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+
+ {
+ //=================
+ //-----------[aaa]---
+ //----[bbbbbbbb]-----
+ auto first = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(1), true,
+ MakeValue(15), true
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(10), true,
+ MakeValue(15), true
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //-----------[aaa]---
+ //----[bbbbbbbbbb]---
+ auto first = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(1), true,
+ MakeValue(20), true
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //---------[aaa]----
+ //--[bbbbbbbbbbbbb]-
+ auto first = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(1), true,
+ MakeValue(30), true
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+
+ {
+ //=================
+ //----[aaaaaa]----------
+ //----[]----------
+ auto first = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(10), true,
+ MakeValue(10), true
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(10), true,
+ MakeValue(10), true
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //----[aaaaaa]----------
+ //----[bbb]----------
+ auto first = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(10), true,
+ MakeValue(15), true
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(10), true,
+ MakeValue(15), true
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+
+ //=================
+ //----[aaaaaa]----------
+ //----[bbbbbb]----------
+ auto first = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+
+ //=================
+ //----[aaaaaa]----------
+ //----[bbbbbbbb]----------
+ auto first = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(10), true,
+ MakeValue(30), true
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //-----[aaaaaaa]----------
+ //-------[bbb]----------
+ auto first = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(15), true,
+ MakeValue(17), true
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(15), true,
+ MakeValue(17), true
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //-----[aaaaaaa]----------
+ //-------[bbbbb]----------
+ auto first = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(15), true,
+ MakeValue(20), true
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(15), true,
+ MakeValue(20), true
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //-----[aaaaaaa]----------
+ //-------[bbbbbbb]----------
+ auto first = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(15), true,
+ MakeValue(30), true
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(15), true,
+ MakeValue(20), true
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //-----[aaa]----------
+ //---------[]----------
+ auto first = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(20), true,
+ MakeValue(20), true
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(20), true,
+ MakeValue(20), true
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //-----[aaa]----------
+ //---------[bbb]----------
+ auto first = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(20), true,
+ MakeValue(30), true
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(20), true,
+ MakeValue(20), true
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //-----[aaa]----------
+ //------------[bbb]---
+ auto first = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(25), true,
+ MakeValue(30), true
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ CheckRange(valueType, emptyRange.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+
+ {
+ //=================
+ //-----------(aaa]---
+ //----[bbbbbb]-------
+ auto first = MakeRange(
+ MakeValue(10), false,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(1), true,
+ MakeValue(10), true
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+
+ CheckRange(valueType, emptyRange.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //-----------[aaa]---
+ //----[bbbbbb)-------
+ auto first = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(1), true,
+ MakeValue(10), false
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+
+ CheckRange(valueType, emptyRange.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //-----------(aaa]---
+ //----[bbbbbb)-------
+ auto first = MakeRange(
+ MakeValue(10), false,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(1), true,
+ MakeValue(10), false
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+
+ CheckRange(valueType, emptyRange.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //---------(aaa]---
+ //----[bbbbbb]-------
+ auto first = MakeRange(
+ MakeValue(10), false,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(1), true,
+ MakeValue(15), true
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(10), false,
+ MakeValue(15), true
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //---------(aaa]---
+ //----[bbbbbb)-------
+ auto first = MakeRange(
+ MakeValue(10), false,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(1), true,
+ MakeValue(15), false
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(10), false,
+ MakeValue(15), false
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //---------(aaa]---
+ //----[bbbbbbbb)-------
+ auto first = MakeRange(
+ MakeValue(10), false,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(1), true,
+ MakeValue(20), false
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(10), false,
+ MakeValue(20), false
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //---------(aaa)---
+ //----[bbbbbbbb)-------
+ auto first = MakeRange(
+ MakeValue(10), false,
+ MakeValue(20), false
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+
+ auto second = MakeRange(
+ MakeValue(1), true,
+ MakeValue(20), false
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(10), false,
+ MakeValue(20), false
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //(-inf; +inf)
+ //----[bbbbbbbb)-------
+ auto first = MakeRange(
+ MakeLeftInf(), true,
+ MakeRightInf(), false
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+ Y_ASSERT(!first.ToTableRange().IsEmptyRange(valueType));
+
+ auto second = MakeRange(
+ MakeValue(1), true,
+ MakeValue(20), false
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(1), true,
+ MakeValue(20), false
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //-------[aaaaa +inf)
+ //----[bbbbbbbb)-------
+ auto first = MakeRange(
+ MakeValue(10), true,
+ MakeRightInf(), false
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+ Y_ASSERT(!first.ToTableRange().IsEmptyRange(valueType));
+
+ auto second = MakeRange(
+ MakeValue(1), true,
+ MakeValue(20), false
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(10), true,
+ MakeValue(20), false
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //--------(aaaaa +inf)
+ //----[bbb)-------
+ auto first = MakeRange(
+ MakeValue(10), false,
+ MakeRightInf(), false
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+ Y_ASSERT(!first.ToTableRange().IsEmptyRange(valueType));
+
+ auto second = MakeRange(
+ MakeValue(1), true,
+ MakeValue(10), false
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ CheckRange(valueType, emptyRange.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+
+ {
+ //=================
+ //-------(aaaaa +inf)
+ //----[bbbbbbbb)-------
+ auto first = MakeRange(
+ MakeValue(10), false,
+ MakeRightInf(), false
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+ Y_ASSERT(!first.ToTableRange().IsEmptyRange(valueType));
+
+ auto second = MakeRange(
+ MakeValue(1), true,
+ MakeValue(20), false
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(10), false,
+ MakeValue(20), false
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //(-inf; aaa]------
+ //----[bbbbbbbb)-------
+ auto first = MakeRange(
+ MakeLeftInf(), true,
+ MakeValue(10), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+ Y_ASSERT(!first.ToTableRange().IsEmptyRange(valueType));
+
+ auto second = MakeRange(
+ MakeValue(1), true,
+ MakeValue(20), false
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(1), true,
+ MakeValue(10), true
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+
+ {
+ //=================
+ //(-inf; aaa]------
+ //----[bbbbbbbb)-------
+ auto first = MakeRange(
+ MakeLeftInf(), true,
+ MakeValue(20), true
+ );
+ Cerr << "first " << DebugPrintRange(valueType, first.ToTableRange(), *typeRegistry);
+ Y_ASSERT(!first.ToTableRange().IsEmptyRange(valueType));
+
+ auto second = MakeRange(
+ MakeValue(1), true,
+ MakeValue(10), false
+ );
+ Cerr << " second " << DebugPrintRange(valueType, second.ToTableRange(), *typeRegistry);
+
+ auto range = Intersect(valueType, first.ToTableRange(), second.ToTableRange());
+ Cerr << " result " << DebugPrintRange(valueType, range, *typeRegistry);
+
+ auto correct = MakeRange(
+ MakeValue(1), true,
+ MakeValue(10), false
+ );
+
+ Cerr << " correct " << DebugPrintRange(valueType, correct.ToTableRange(), *typeRegistry);
+
+ CheckRange(valueType, correct.ToTableRange(), range);
+ Cerr << Endl;
+ }
+ }
+}}
diff --git a/ydb/core/tx/datashard/datashard_ut_read_table.cpp b/ydb/core/tx/datashard/datashard_ut_read_table.cpp
index 24f9ef74e07..c11e21f2f2c 100644
--- a/ydb/core/tx/datashard/datashard_ut_read_table.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_read_table.cpp
@@ -5,7 +5,7 @@
namespace NKikimr {
using namespace NKikimr::NDataShard;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace Tests;
using namespace NDataShardReadTableTest;
diff --git a/ydb/core/tx/datashard/datashard_ut_reassign.cpp b/ydb/core/tx/datashard/datashard_ut_reassign.cpp
index f686bdae4df..b29a9c55a2b 100644
--- a/ydb/core/tx/datashard/datashard_ut_reassign.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_reassign.cpp
@@ -6,7 +6,7 @@
namespace NKikimr {
using namespace NKikimr::NDataShard;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace Tests;
Y_UNIT_TEST_SUITE(DataShardReassign) {
diff --git a/ydb/core/tx/datashard/datashard_ut_rs.cpp b/ydb/core/tx/datashard/datashard_ut_rs.cpp
index 27971fb7d5c..edbe2968da2 100644
--- a/ydb/core/tx/datashard/datashard_ut_rs.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_rs.cpp
@@ -10,7 +10,7 @@
namespace NKikimr {
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace Tests;
ui64 GetRSCount(TTestActorRuntime &runtime, TActorId sender, ui64 shard)
diff --git a/ydb/core/tx/datashard/datashard_ut_snapshot.cpp b/ydb/core/tx/datashard/datashard_ut_snapshot.cpp
index bbdf22a6d54..ca3bc867fa6 100644
--- a/ydb/core/tx/datashard/datashard_ut_snapshot.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_snapshot.cpp
@@ -7,7 +7,7 @@
namespace NKikimr {
using namespace NKikimr::NDataShard;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace Tests;
namespace {
diff --git a/ydb/core/tx/datashard/datashard_ut_stats.cpp b/ydb/core/tx/datashard/datashard_ut_stats.cpp
index fd399a45ace..c12ddd7fe4e 100644
--- a/ydb/core/tx/datashard/datashard_ut_stats.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_stats.cpp
@@ -4,7 +4,7 @@
namespace NKikimr {
using namespace NKikimr::NDataShard;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace Tests;
Y_UNIT_TEST_SUITE(DataShardStats) {
diff --git a/ydb/core/tx/datashard/datashard_ut_upload_rows.cpp b/ydb/core/tx/datashard/datashard_ut_upload_rows.cpp
index 3b761c1fe11..ab1c586d305 100644
--- a/ydb/core/tx/datashard/datashard_ut_upload_rows.cpp
+++ b/ydb/core/tx/datashard/datashard_ut_upload_rows.cpp
@@ -13,7 +13,7 @@
namespace NKikimr {
using namespace NKikimr::NDataShard::NKqpHelpers;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace Tests;
namespace {
@@ -337,7 +337,7 @@ Y_UNIT_TEST_SUITE(TTxDataShardUploadRows) {
auto sender = runtime.AllocateEdgeActor();
runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_TRACE);
- runtime.GetAppData().AllowShadowDataInSchemeShardForTests = true;
+ runtime.GetAppData().AllowShadowDataInSchemeShardForTests = true;
InitRoot(server, sender);
@@ -418,7 +418,7 @@ Y_UNIT_TEST_SUITE(TTxDataShardUploadRows) {
auto sender = runtime.AllocateEdgeActor();
runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_TRACE);
- runtime.GetAppData().AllowShadowDataInSchemeShardForTests = true;
+ runtime.GetAppData().AllowShadowDataInSchemeShardForTests = true;
InitRoot(server, sender);
@@ -517,7 +517,7 @@ Y_UNIT_TEST_SUITE(TTxDataShardUploadRows) {
auto sender = runtime.AllocateEdgeActor();
runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_TRACE);
- runtime.GetAppData().AllowShadowDataInSchemeShardForTests = true;
+ runtime.GetAppData().AllowShadowDataInSchemeShardForTests = true;
InitRoot(server, sender);
@@ -619,7 +619,7 @@ Y_UNIT_TEST_SUITE(TTxDataShardUploadRows) {
auto sender = runtime.AllocateEdgeActor();
runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_TRACE);
- runtime.GetAppData().AllowShadowDataInSchemeShardForTests = true;
+ runtime.GetAppData().AllowShadowDataInSchemeShardForTests = true;
InitRoot(server, sender);
diff --git a/ydb/core/tx/datashard/drop_index_notice_unit.cpp b/ydb/core/tx/datashard/drop_index_notice_unit.cpp
index a65d1155214..43110699580 100644
--- a/ydb/core/tx/datashard/drop_index_notice_unit.cpp
+++ b/ydb/core/tx/datashard/drop_index_notice_unit.cpp
@@ -1,38 +1,38 @@
-#include "datashard_impl.h"
-#include "datashard_pipeline.h"
-#include "execution_unit_ctors.h"
-
-namespace NKikimr {
+#include "datashard_impl.h"
+#include "datashard_pipeline.h"
+#include "execution_unit_ctors.h"
+
+namespace NKikimr {
namespace NDataShard {
-
-class TDropIndexNoticeUnit : public TExecutionUnit {
+
+class TDropIndexNoticeUnit : public TExecutionUnit {
THolder<TEvChangeExchange::TEvRemoveSender> RemoveSender;
-public:
+public:
TDropIndexNoticeUnit(TDataShard& dataShard, TPipeline& pipeline)
: TExecutionUnit(EExecutionUnitKind::DropIndexNotice, false, dataShard, pipeline)
- { }
-
- bool IsReadyToExecute(TOperation::TPtr) const override {
- return true;
- }
-
- EExecutionStatus Execute(TOperation::TPtr op, TTransactionContext& txc, const TActorContext& ctx) override {
- Y_VERIFY(op->IsSchemeTx());
-
- TActiveTransaction* tx = dynamic_cast<TActiveTransaction*>(op.Get());
- Y_VERIFY_S(tx, "cannot cast operation of kind " << op->GetKind());
-
- auto& schemeTx = tx->GetSchemeTx();
- if (!schemeTx.HasDropIndexNotice()) {
- return EExecutionStatus::Executed;
- }
-
- const auto& params = schemeTx.GetDropIndexNotice();
-
- auto pathId = TPathId(params.GetPathId().GetOwnerId(), params.GetPathId().GetLocalId());
- Y_VERIFY(pathId.OwnerId == DataShard.GetPathOwnerId());
-
+ { }
+
+ bool IsReadyToExecute(TOperation::TPtr) const override {
+ return true;
+ }
+
+ EExecutionStatus Execute(TOperation::TPtr op, TTransactionContext& txc, const TActorContext& ctx) override {
+ Y_VERIFY(op->IsSchemeTx());
+
+ TActiveTransaction* tx = dynamic_cast<TActiveTransaction*>(op.Get());
+ Y_VERIFY_S(tx, "cannot cast operation of kind " << op->GetKind());
+
+ auto& schemeTx = tx->GetSchemeTx();
+ if (!schemeTx.HasDropIndexNotice()) {
+ return EExecutionStatus::Executed;
+ }
+
+ const auto& params = schemeTx.GetDropIndexNotice();
+
+ auto pathId = TPathId(params.GetPathId().GetOwnerId(), params.GetPathId().GetLocalId());
+ Y_VERIFY(pathId.OwnerId == DataShard.GetPathOwnerId());
+
TUserTable::TPtr tableInfo;
if (params.HasIndexPathId()) {
auto indexPathId = TPathId(params.GetIndexPathId().GetOwnerId(), params.GetIndexPathId().GetLocalId());
@@ -42,7 +42,7 @@ public:
const auto& indexes = userTables.at(pathId.LocalPathId)->Indexes;
auto it = indexes.find(indexPathId);
- if (it != indexes.end() && it->second.Type == NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync) {
+ if (it != indexes.end() && it->second.Type == NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync) {
RemoveSender.Reset(new TEvChangeExchange::TEvRemoveSender(indexPathId));
}
@@ -53,26 +53,26 @@ public:
Y_VERIFY(tableInfo);
DataShard.AddUserTable(pathId, tableInfo);
-
- BuildResult(op, NKikimrTxDataShard::TEvProposeTransactionResult::COMPLETE);
- op->Result()->SetStepOrderId(op->GetStepOrder().ToPair());
-
+
+ BuildResult(op, NKikimrTxDataShard::TEvProposeTransactionResult::COMPLETE);
+ op->Result()->SetStepOrderId(op->GetStepOrder().ToPair());
+
return EExecutionStatus::DelayCompleteNoMoreRestarts;
- }
-
+ }
+
void Complete(TOperation::TPtr, const TActorContext& ctx) override {
if (RemoveSender) {
ctx.Send(DataShard.GetChangeSender(), RemoveSender.Release());
}
- }
-};
-
-THolder<TExecutionUnit> CreateDropIndexNoticeUnit(
+ }
+};
+
+THolder<TExecutionUnit> CreateDropIndexNoticeUnit(
TDataShard& dataShard,
- TPipeline& pipeline)
-{
+ TPipeline& pipeline)
+{
return THolder(new TDropIndexNoticeUnit(dataShard, pipeline));
-}
-
+}
+
} // namespace NDataShard
-} // namespace NKikimr
+} // namespace NKikimr
diff --git a/ydb/core/tx/datashard/drop_table_unit.cpp b/ydb/core/tx/datashard/drop_table_unit.cpp
index 70245ab20ab..8d8cfb960dd 100644
--- a/ydb/core/tx/datashard/drop_table_unit.cpp
+++ b/ydb/core/tx/datashard/drop_table_unit.cpp
@@ -70,16 +70,16 @@ EExecutionStatus TDropTableUnit::Execute(TOperation::TPtr op,
LOG_INFO_S(ctx, NKikimrServices::TX_DATASHARD,
"Trying to DROP TABLE at " << DataShard.TabletID());
- ui64 tableId = schemeTx.GetDropTable().GetId_Deprecated();
- if (schemeTx.GetDropTable().HasPathId()) {
- Y_VERIFY(DataShard.GetPathOwnerId() == schemeTx.GetDropTable().GetPathId().GetOwnerId());
- tableId = schemeTx.GetDropTable().GetPathId().GetLocalId();
- }
+ ui64 tableId = schemeTx.GetDropTable().GetId_Deprecated();
+ if (schemeTx.GetDropTable().HasPathId()) {
+ Y_VERIFY(DataShard.GetPathOwnerId() == schemeTx.GetDropTable().GetPathId().GetOwnerId());
+ tableId = schemeTx.GetDropTable().GetPathId().GetLocalId();
+ }
DataShard.DropUserTable(txc, tableId);
// FIXME: transactions need to specify ownerId
TVector<TSnapshotKey> snapshotsToRemove;
- TSnapshotTableKey snapshotsScope(DataShard.GetPathOwnerId(), tableId);
+ TSnapshotTableKey snapshotsScope(DataShard.GetPathOwnerId(), tableId);
for (const auto& kv : DataShard.GetSnapshotManager().GetSnapshots(snapshotsScope)) {
snapshotsToRemove.push_back(kv.first);
}
diff --git a/ydb/core/tx/datashard/erase_rows_condition.cpp b/ydb/core/tx/datashard/erase_rows_condition.cpp
index c30d5a6527c..d6960773513 100644
--- a/ydb/core/tx/datashard/erase_rows_condition.cpp
+++ b/ydb/core/tx/datashard/erase_rows_condition.cpp
@@ -11,17 +11,17 @@ namespace NKikimr {
namespace NDataShard {
class TExpirationCondition: public IEraseRowsCondition {
- using EUnit = NKikimrSchemeOp::TTTLSettings::EUnit;
+ using EUnit = NKikimrSchemeOp::TTTLSettings::EUnit;
static TMaybe<ui64> InstantValue(TInstant instant, EUnit unit) {
switch (unit) {
- case NKikimrSchemeOp::TTTLSettings::UNIT_SECONDS:
+ case NKikimrSchemeOp::TTTLSettings::UNIT_SECONDS:
return instant.Seconds();
- case NKikimrSchemeOp::TTTLSettings::UNIT_MILLISECONDS:
+ case NKikimrSchemeOp::TTTLSettings::UNIT_MILLISECONDS:
return instant.MilliSeconds();
- case NKikimrSchemeOp::TTTLSettings::UNIT_MICROSECONDS:
+ case NKikimrSchemeOp::TTTLSettings::UNIT_MICROSECONDS:
return instant.MicroSeconds();
- case NKikimrSchemeOp::TTTLSettings::UNIT_NANOSECONDS:
+ case NKikimrSchemeOp::TTTLSettings::UNIT_NANOSECONDS:
return instant.NanoSeconds();
default:
return Nothing();
@@ -68,13 +68,13 @@ class TExpirationCondition: public IEraseRowsCondition {
case NScheme::NTypeIds::Uint32:
case NScheme::NTypeIds::Uint64:
switch (Unit) {
- case NKikimrSchemeOp::TTTLSettings::UNIT_SECONDS:
+ case NKikimrSchemeOp::TTTLSettings::UNIT_SECONDS:
return TInstant::Seconds(value) <= WallClockInstant;
- case NKikimrSchemeOp::TTTLSettings::UNIT_MILLISECONDS:
+ case NKikimrSchemeOp::TTTLSettings::UNIT_MILLISECONDS:
return TInstant::MilliSeconds(value) <= WallClockInstant;
- case NKikimrSchemeOp::TTTLSettings::UNIT_MICROSECONDS:
+ case NKikimrSchemeOp::TTTLSettings::UNIT_MICROSECONDS:
return TInstant::MicroSeconds(value) <= WallClockInstant;
- case NKikimrSchemeOp::TTTLSettings::UNIT_NANOSECONDS:
+ case NKikimrSchemeOp::TTTLSettings::UNIT_NANOSECONDS:
return TInstant::MicroSeconds(value / 1000) <= WallClockInstant;
default:
LOG_CRIT_S(*TlsActivationContext, NKikimrServices::TX_DATASHARD,
diff --git a/ydb/core/tx/datashard/execution_unit.cpp b/ydb/core/tx/datashard/execution_unit.cpp
index 95557758b6a..9f6e13fa5c7 100644
--- a/ydb/core/tx/datashard/execution_unit.cpp
+++ b/ydb/core/tx/datashard/execution_unit.cpp
@@ -110,14 +110,14 @@ THolder<TExecutionUnit> CreateExecutionUnit(EExecutionUnitKind kind,
return CreateCreateVolatileSnapshotUnit(dataShard, pipeline);
case EExecutionUnitKind::DropVolatileSnapshot:
return CreateDropVolatileSnapshotUnit(dataShard, pipeline);
- case EExecutionUnitKind::InitiateBuildIndex:
- return CreateInitiateBuildIndexUnit(dataShard, pipeline);
- case EExecutionUnitKind::FinalizeBuildIndex:
- return CreateFinalizeBuildIndexUnit(dataShard, pipeline);
- case EExecutionUnitKind::DropIndexNotice:
- return CreateDropIndexNoticeUnit(dataShard, pipeline);
- case EExecutionUnitKind::MoveTable:
- return CreateMoveTableUnit(dataShard, pipeline);
+ case EExecutionUnitKind::InitiateBuildIndex:
+ return CreateInitiateBuildIndexUnit(dataShard, pipeline);
+ case EExecutionUnitKind::FinalizeBuildIndex:
+ return CreateFinalizeBuildIndexUnit(dataShard, pipeline);
+ case EExecutionUnitKind::DropIndexNotice:
+ return CreateDropIndexNoticeUnit(dataShard, pipeline);
+ case EExecutionUnitKind::MoveTable:
+ return CreateMoveTableUnit(dataShard, pipeline);
case EExecutionUnitKind::CreateCdcStream:
return CreateCreateCdcStreamUnit(dataShard, pipeline);
case EExecutionUnitKind::AlterCdcStream:
diff --git a/ydb/core/tx/datashard/execution_unit_kind.h b/ydb/core/tx/datashard/execution_unit_kind.h
index 5c0eabab229..88e763887f6 100644
--- a/ydb/core/tx/datashard/execution_unit_kind.h
+++ b/ydb/core/tx/datashard/execution_unit_kind.h
@@ -55,10 +55,10 @@ enum class EExecutionUnitKind : ui32 {
DropPersistentSnapshot,
CreateVolatileSnapshot,
DropVolatileSnapshot,
- InitiateBuildIndex,
- FinalizeBuildIndex,
- DropIndexNotice,
- MoveTable,
+ InitiateBuildIndex,
+ FinalizeBuildIndex,
+ DropIndexNotice,
+ MoveTable,
CreateCdcStream,
AlterCdcStream,
DropCdcStream,
diff --git a/ydb/core/tx/datashard/export_common.cpp b/ydb/core/tx/datashard/export_common.cpp
index b5b9c14030d..e00cc2b5601 100644
--- a/ydb/core/tx/datashard/export_common.cpp
+++ b/ydb/core/tx/datashard/export_common.cpp
@@ -31,7 +31,7 @@ static void ResortColumns(
TMaybe<Ydb::Table::CreateTableRequest> GenYdbScheme(
const TMap<ui32, TUserTable::TUserColumn>& columns,
- const NKikimrSchemeOp::TPathDescription& pathDesc)
+ const NKikimrSchemeOp::TPathDescription& pathDesc)
{
if (!pathDesc.HasTable()) {
return Nothing();
diff --git a/ydb/core/tx/datashard/export_common.h b/ydb/core/tx/datashard/export_common.h
index 337d32906c6..b9ccffe2a1a 100644
--- a/ydb/core/tx/datashard/export_common.h
+++ b/ydb/core/tx/datashard/export_common.h
@@ -33,7 +33,7 @@ namespace NDataShard {
TMaybe<Ydb::Table::CreateTableRequest> GenYdbScheme(
const TMap<ui32, TUserTable::TUserColumn>& columns,
- const NKikimrSchemeOp::TPathDescription& pathDesc);
+ const NKikimrSchemeOp::TPathDescription& pathDesc);
TString DecimalToString(const std::pair<ui64, i64>& loHi);
TString DyNumberToString(TStringBuf data);
diff --git a/ydb/core/tx/datashard/export_s3_base_uploader.h b/ydb/core/tx/datashard/export_s3_base_uploader.h
index c03ada4b642..8c72a8c3936 100644
--- a/ydb/core/tx/datashard/export_s3_base_uploader.h
+++ b/ydb/core/tx/datashard/export_s3_base_uploader.h
@@ -376,7 +376,7 @@ public:
explicit TS3UploaderBase(
const TActorId& dataShard, ui64 txId,
- const NKikimrSchemeOp::TBackupTask& task,
+ const NKikimrSchemeOp::TBackupTask& task,
TMaybe<Ydb::Table::CreateTableRequest>&& scheme)
: Settings(TS3Settings::FromBackupTask(task))
, DataShard(dataShard)
diff --git a/ydb/core/tx/datashard/finalize_build_index_unit.cpp b/ydb/core/tx/datashard/finalize_build_index_unit.cpp
index 21eea60f8ee..6f8a17ec503 100644
--- a/ydb/core/tx/datashard/finalize_build_index_unit.cpp
+++ b/ydb/core/tx/datashard/finalize_build_index_unit.cpp
@@ -1,74 +1,74 @@
-#include "datashard_impl.h"
-#include "datashard_pipeline.h"
-#include "execution_unit_ctors.h"
-
-namespace NKikimr {
+#include "datashard_impl.h"
+#include "datashard_pipeline.h"
+#include "execution_unit_ctors.h"
+
+namespace NKikimr {
namespace NDataShard {
-
-class TFinalizeBuildIndexUnit : public TExecutionUnit {
-public:
+
+class TFinalizeBuildIndexUnit : public TExecutionUnit {
+public:
TFinalizeBuildIndexUnit(TDataShard& dataShard, TPipeline& pipeline)
- : TExecutionUnit(EExecutionUnitKind::FinalizeBuildIndex, false, dataShard, pipeline)
- { }
-
- bool IsReadyToExecute(TOperation::TPtr) const override {
- return true;
- }
-
- EExecutionStatus Execute(TOperation::TPtr op, TTransactionContext& txc, const TActorContext& ctx) override {
- Y_VERIFY(op->IsSchemeTx());
-
- TActiveTransaction* tx = dynamic_cast<TActiveTransaction*>(op.Get());
- Y_VERIFY_S(tx, "cannot cast operation of kind " << op->GetKind());
-
- auto& schemeTx = tx->GetSchemeTx();
- if (!schemeTx.HasFinalizeBuildIndex()) {
- return EExecutionStatus::Executed;
- }
-
- const auto& params = schemeTx.GetFinalizeBuildIndex();
-
- auto pathId = TPathId(params.GetPathId().GetOwnerId(), params.GetPathId().GetLocalId());
- Y_VERIFY(pathId.OwnerId == DataShard.GetPathOwnerId());
-
- auto tableInfo = DataShard.AlterTableSchemaVersion(ctx, txc, pathId, params.GetTableSchemaVersion());
+ : TExecutionUnit(EExecutionUnitKind::FinalizeBuildIndex, false, dataShard, pipeline)
+ { }
+
+ bool IsReadyToExecute(TOperation::TPtr) const override {
+ return true;
+ }
+
+ EExecutionStatus Execute(TOperation::TPtr op, TTransactionContext& txc, const TActorContext& ctx) override {
+ Y_VERIFY(op->IsSchemeTx());
+
+ TActiveTransaction* tx = dynamic_cast<TActiveTransaction*>(op.Get());
+ Y_VERIFY_S(tx, "cannot cast operation of kind " << op->GetKind());
+
+ auto& schemeTx = tx->GetSchemeTx();
+ if (!schemeTx.HasFinalizeBuildIndex()) {
+ return EExecutionStatus::Executed;
+ }
+
+ const auto& params = schemeTx.GetFinalizeBuildIndex();
+
+ auto pathId = TPathId(params.GetPathId().GetOwnerId(), params.GetPathId().GetLocalId());
+ Y_VERIFY(pathId.OwnerId == DataShard.GetPathOwnerId());
+
+ auto tableInfo = DataShard.AlterTableSchemaVersion(ctx, txc, pathId, params.GetTableSchemaVersion());
DataShard.AddUserTable(pathId, tableInfo);
-
- ui64 step = params.GetSnapshotStep();
- ui64 txId = params.GetSnapshotTxId();
- Y_VERIFY(step != 0);
-
- const TSnapshotKey key(pathId.OwnerId, pathId.LocalPathId, step, txId);
-
- if (DataShard.GetBuildIndexManager().Contains(params.GetBuildIndexId())) {
- auto record = DataShard.GetBuildIndexManager().Get(params.GetBuildIndexId());
- DataShard.CancelScan(tableInfo->LocalTid, record.ScanId);
- DataShard.GetBuildIndexManager().Drop(params.GetBuildIndexId());
- }
-
- bool removed = DataShard.GetSnapshotManager().RemoveSnapshot(txc.DB, key);
-
- BuildResult(op, NKikimrTxDataShard::TEvProposeTransactionResult::COMPLETE);
- op->Result()->SetStepOrderId(op->GetStepOrder().ToPair());
-
- if (removed) {
- return EExecutionStatus::ExecutedNoMoreRestarts;
- } else {
- return EExecutionStatus::Executed;
- }
- }
-
- void Complete(TOperation::TPtr, const TActorContext&) override {
- // nothing
- }
-};
-
-THolder<TExecutionUnit> CreateFinalizeBuildIndexUnit(
+
+ ui64 step = params.GetSnapshotStep();
+ ui64 txId = params.GetSnapshotTxId();
+ Y_VERIFY(step != 0);
+
+ const TSnapshotKey key(pathId.OwnerId, pathId.LocalPathId, step, txId);
+
+ if (DataShard.GetBuildIndexManager().Contains(params.GetBuildIndexId())) {
+ auto record = DataShard.GetBuildIndexManager().Get(params.GetBuildIndexId());
+ DataShard.CancelScan(tableInfo->LocalTid, record.ScanId);
+ DataShard.GetBuildIndexManager().Drop(params.GetBuildIndexId());
+ }
+
+ bool removed = DataShard.GetSnapshotManager().RemoveSnapshot(txc.DB, key);
+
+ BuildResult(op, NKikimrTxDataShard::TEvProposeTransactionResult::COMPLETE);
+ op->Result()->SetStepOrderId(op->GetStepOrder().ToPair());
+
+ if (removed) {
+ return EExecutionStatus::ExecutedNoMoreRestarts;
+ } else {
+ return EExecutionStatus::Executed;
+ }
+ }
+
+ void Complete(TOperation::TPtr, const TActorContext&) override {
+ // nothing
+ }
+};
+
+THolder<TExecutionUnit> CreateFinalizeBuildIndexUnit(
TDataShard& dataShard,
- TPipeline& pipeline)
-{
+ TPipeline& pipeline)
+{
return THolder(new TFinalizeBuildIndexUnit(dataShard, pipeline));
-}
-
+}
+
} // namespace NDataShard
-} // namespace NKikimr
+} // namespace NKikimr
diff --git a/ydb/core/tx/datashard/import_s3.cpp b/ydb/core/tx/datashard/import_s3.cpp
index ed4adfda9a8..9ea7fbab5c0 100644
--- a/ydb/core/tx/datashard/import_s3.cpp
+++ b/ydb/core/tx/datashard/import_s3.cpp
@@ -85,7 +85,7 @@ class TS3Downloader: public TActorBootstrapped<TS3Downloader>, private TS3User {
class TUploadRowsRequestBuilder {
public:
- void New(const TTableInfo& tableInfo, const NKikimrSchemeOp::TTableDescription& scheme) {
+ void New(const TTableInfo& tableInfo, const NKikimrSchemeOp::TTableDescription& scheme) {
Request.Reset(new TEvDataShard::TEvUnsafeUploadRowsRequest());
Request->Record.SetTableId(tableInfo.GetId());
@@ -467,7 +467,7 @@ public:
return "s3";
}
- explicit TS3Downloader(const TActorId& dataShard, ui64 txId, const NKikimrSchemeOp::TRestoreTask& task, const TTableInfo& tableInfo)
+ explicit TS3Downloader(const TActorId& dataShard, ui64 txId, const NKikimrSchemeOp::TRestoreTask& task, const TTableInfo& tableInfo)
: DataShard(dataShard)
, TxId(txId)
, Settings(TS3Settings::FromRestoreTask(task))
@@ -515,7 +515,7 @@ private:
const ui64 TxId;
const TS3Settings Settings;
const TTableInfo TableInfo;
- const NKikimrSchemeOp::TTableDescription Scheme;
+ const NKikimrSchemeOp::TTableDescription Scheme;
const ui32 Retries;
ui32 Attempt = 0;
@@ -538,7 +538,7 @@ private:
}; // TS3Downloader
-IActor* CreateS3Downloader(const TActorId& dataShard, ui64 txId, const NKikimrSchemeOp::TRestoreTask& task, const TTableInfo& info) {
+IActor* CreateS3Downloader(const TActorId& dataShard, ui64 txId, const NKikimrSchemeOp::TRestoreTask& task, const TTableInfo& info) {
return new TS3Downloader(dataShard, txId, task, info);
}
diff --git a/ydb/core/tx/datashard/import_s3.h b/ydb/core/tx/datashard/import_s3.h
index adca70bad3a..f879693de8d 100644
--- a/ydb/core/tx/datashard/import_s3.h
+++ b/ydb/core/tx/datashard/import_s3.h
@@ -4,7 +4,7 @@
#include "defs.h"
-namespace NKikimrSchemeOp {
+namespace NKikimrSchemeOp {
class TRestoreTask;
}
@@ -13,7 +13,7 @@ namespace NDataShard {
class TTableInfo;
-IActor* CreateS3Downloader(const TActorId& dataShard, ui64 txId, const NKikimrSchemeOp::TRestoreTask& task, const TTableInfo& info);
+IActor* CreateS3Downloader(const TActorId& dataShard, ui64 txId, const NKikimrSchemeOp::TRestoreTask& task, const TTableInfo& info);
} // NDataShard
} // NKikimr
diff --git a/ydb/core/tx/datashard/initiate_build_index_unit.cpp b/ydb/core/tx/datashard/initiate_build_index_unit.cpp
index 0dc1be3b293..f52034aeea6 100644
--- a/ydb/core/tx/datashard/initiate_build_index_unit.cpp
+++ b/ydb/core/tx/datashard/initiate_build_index_unit.cpp
@@ -1,43 +1,43 @@
-#include "datashard_impl.h"
-#include "datashard_pipeline.h"
-#include "execution_unit_ctors.h"
-
-namespace NKikimr {
+#include "datashard_impl.h"
+#include "datashard_pipeline.h"
+#include "execution_unit_ctors.h"
+
+namespace NKikimr {
namespace NDataShard {
-
-class TInitiateBuildIndexUnit : public TExecutionUnit {
+
+class TInitiateBuildIndexUnit : public TExecutionUnit {
THolder<TEvChangeExchange::TEvAddSender> AddSender;
-public:
+public:
TInitiateBuildIndexUnit(TDataShard& dataShard, TPipeline& pipeline)
- : TExecutionUnit(EExecutionUnitKind::InitiateBuildIndex, false, dataShard, pipeline)
- { }
-
- bool IsReadyToExecute(TOperation::TPtr) const override {
- return true;
- }
-
- EExecutionStatus Execute(TOperation::TPtr op, TTransactionContext& txc, const TActorContext& ctx) override {
- Y_VERIFY(op->IsSchemeTx());
-
- TActiveTransaction* tx = dynamic_cast<TActiveTransaction*>(op.Get());
- Y_VERIFY_S(tx, "cannot cast operation of kind " << op->GetKind());
-
- auto& schemeTx = tx->GetSchemeTx();
- if (!schemeTx.HasInitiateBuildIndex()) {
- return EExecutionStatus::Executed;
- }
-
- const auto& params = schemeTx.GetInitiateBuildIndex();
-
- auto pathId = TPathId(params.GetPathId().GetOwnerId(), params.GetPathId().GetLocalId());
- Y_VERIFY(pathId.OwnerId == DataShard.GetPathOwnerId());
-
+ : TExecutionUnit(EExecutionUnitKind::InitiateBuildIndex, false, dataShard, pipeline)
+ { }
+
+ bool IsReadyToExecute(TOperation::TPtr) const override {
+ return true;
+ }
+
+ EExecutionStatus Execute(TOperation::TPtr op, TTransactionContext& txc, const TActorContext& ctx) override {
+ Y_VERIFY(op->IsSchemeTx());
+
+ TActiveTransaction* tx = dynamic_cast<TActiveTransaction*>(op.Get());
+ Y_VERIFY_S(tx, "cannot cast operation of kind " << op->GetKind());
+
+ auto& schemeTx = tx->GetSchemeTx();
+ if (!schemeTx.HasInitiateBuildIndex()) {
+ return EExecutionStatus::Executed;
+ }
+
+ const auto& params = schemeTx.GetInitiateBuildIndex();
+
+ auto pathId = TPathId(params.GetPathId().GetOwnerId(), params.GetPathId().GetLocalId());
+ Y_VERIFY(pathId.OwnerId == DataShard.GetPathOwnerId());
+
TUserTable::TPtr tableInfo;
if (params.HasIndexDescription()) {
const auto& indexDesc = params.GetIndexDescription();
- if (indexDesc.GetType() == NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync) {
+ if (indexDesc.GetType() == NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync) {
auto indexPathId = TPathId(indexDesc.GetPathOwnerId(), indexDesc.GetLocalPathId());
AddSender.Reset(new TEvChangeExchange::TEvAddSender(
pathId, TEvChangeExchange::ESenderType::AsyncIndex, indexPathId
@@ -51,41 +51,41 @@ public:
Y_VERIFY(tableInfo);
DataShard.AddUserTable(pathId, tableInfo);
-
- ui64 step = tx->GetStep();
- ui64 txId = tx->GetTxId();
- Y_VERIFY(step != 0);
-
- const TSnapshotKey key(pathId.OwnerId, pathId.LocalPathId, step, txId);
-
- ui64 flags = TSnapshot::FlagScheme;
-
- bool added = DataShard.GetSnapshotManager().AddSnapshot(
- txc.DB, key, params.GetSnapshotName(), flags, TDuration::Zero());
-
- BuildResult(op, NKikimrTxDataShard::TEvProposeTransactionResult::COMPLETE);
- op->Result()->SetStepOrderId(op->GetStepOrder().ToPair());
-
- if (added) {
+
+ ui64 step = tx->GetStep();
+ ui64 txId = tx->GetTxId();
+ Y_VERIFY(step != 0);
+
+ const TSnapshotKey key(pathId.OwnerId, pathId.LocalPathId, step, txId);
+
+ ui64 flags = TSnapshot::FlagScheme;
+
+ bool added = DataShard.GetSnapshotManager().AddSnapshot(
+ txc.DB, key, params.GetSnapshotName(), flags, TDuration::Zero());
+
+ BuildResult(op, NKikimrTxDataShard::TEvProposeTransactionResult::COMPLETE);
+ op->Result()->SetStepOrderId(op->GetStepOrder().ToPair());
+
+ if (added) {
return EExecutionStatus::DelayCompleteNoMoreRestarts;
- } else {
+ } else {
return EExecutionStatus::DelayComplete;
- }
- }
-
+ }
+ }
+
void Complete(TOperation::TPtr, const TActorContext& ctx) override {
if (AddSender) {
ctx.Send(DataShard.GetChangeSender(), AddSender.Release());
}
- }
-};
-
-THolder<TExecutionUnit> CreateInitiateBuildIndexUnit(
+ }
+};
+
+THolder<TExecutionUnit> CreateInitiateBuildIndexUnit(
TDataShard& dataShard,
- TPipeline& pipeline)
-{
+ TPipeline& pipeline)
+{
return THolder(new TInitiateBuildIndexUnit(dataShard, pipeline));
-}
-
+}
+
} // namespace NDataShard
-} // namespace NKikimr
+} // namespace NKikimr
diff --git a/ydb/core/tx/datashard/make_snapshot_unit.cpp b/ydb/core/tx/datashard/make_snapshot_unit.cpp
index dc9340a96ae..8532f04d29e 100644
--- a/ydb/core/tx/datashard/make_snapshot_unit.cpp
+++ b/ydb/core/tx/datashard/make_snapshot_unit.cpp
@@ -52,11 +52,11 @@ EExecutionStatus TMakeSnapshotUnit::Execute(TOperation::TPtr op,
if (!op->IsWaitingForSnapshot()) {
ui64 tableId = schemeTx.GetSendSnapshot().GetTableId_Deprecated();
- if (schemeTx.GetSendSnapshot().HasTableId()) {
- Y_VERIFY(DataShard.GetPathOwnerId() == schemeTx.GetSendSnapshot().GetTableId().GetOwnerId());
- tableId = schemeTx.GetSendSnapshot().GetTableId().GetTableId();
- }
-
+ if (schemeTx.GetSendSnapshot().HasTableId()) {
+ Y_VERIFY(DataShard.GetPathOwnerId() == schemeTx.GetSendSnapshot().GetTableId().GetOwnerId());
+ tableId = schemeTx.GetSendSnapshot().GetTableId().GetTableId();
+ }
+
Y_VERIFY(DataShard.GetUserTables().contains(tableId));
ui32 localTableId = DataShard.GetUserTables().at(tableId)->LocalTid;
TIntrusivePtr<TTableSnapshotContext> snapContext
diff --git a/ydb/core/tx/datashard/move_table_unit.cpp b/ydb/core/tx/datashard/move_table_unit.cpp
index 261b77d1c48..975cb115482 100644
--- a/ydb/core/tx/datashard/move_table_unit.cpp
+++ b/ydb/core/tx/datashard/move_table_unit.cpp
@@ -1,85 +1,85 @@
-#include "datashard_impl.h"
-#include "datashard_pipeline.h"
-#include "execution_unit_ctors.h"
-
-namespace NKikimr {
+#include "datashard_impl.h"
+#include "datashard_pipeline.h"
+#include "execution_unit_ctors.h"
+
+namespace NKikimr {
namespace NDataShard {
-
-class TMoveTableUnit : public TExecutionUnit {
-public:
+
+class TMoveTableUnit : public TExecutionUnit {
+public:
TMoveTableUnit(TDataShard& dataShard, TPipeline& pipeline)
- : TExecutionUnit(EExecutionUnitKind::DropIndexNotice, false, dataShard, pipeline)
- { }
-
- bool IsReadyToExecute(TOperation::TPtr) const override {
- return true;
- }
-
- void MoveChangeRecords(NIceDb::TNiceDb& db, const NKikimrTxDataShard::TMoveTable& move, TVector<TEvChangeExchange::TEvEnqueueRecords::TRecordInfo>& changeRecords) {
- const THashMap<TPathId, TPathId> remap = DataShard.GetRemapIndexes(move);
-
- for (auto& record: changeRecords) {
- if (remap.contains(record.PathId)) { // here could be the records for already deleted indexes, so skip them
- record.PathId = remap.at(record.PathId);
- DataShard.MoveChangeRecord(db, record.Order, record.PathId);
- }
- }
- }
-
- EExecutionStatus Execute(TOperation::TPtr op, TTransactionContext& txc, const TActorContext& ctx) override {
- Y_VERIFY(op->IsSchemeTx());
-
- TActiveTransaction* tx = dynamic_cast<TActiveTransaction*>(op.Get());
- Y_VERIFY_S(tx, "cannot cast operation of kind " << op->GetKind());
-
- if (tx->GetSchemeTxType() != TSchemaOperation::ETypeMoveTable) {
- return EExecutionStatus::Executed;
- }
-
- const auto& schemeTx = tx->GetSchemeTx();
- if (!schemeTx.HasMoveTable()) {
- return EExecutionStatus::Executed;
- }
-
- NIceDb::TNiceDb db(txc.DB);
- TVector<TEvChangeExchange::TEvEnqueueRecords::TRecordInfo> changeRecords;
- if (!DataShard.LoadChangeRecords(db, changeRecords)) {
- return EExecutionStatus::Restart;
- }
-
- LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::TX_DATASHARD, "TMoveTableUnit Execute"
- << ": schemeTx# " << schemeTx.DebugString()
- << ": changeRecords size# " << changeRecords.size()
- << ", at tablet# " << DataShard.TabletID());
-
- const auto& params = schemeTx.GetMoveTable();
-
- DataShard.KillChangeSender(ctx);
-
- DataShard.MoveUserTable(ctx, txc, params);
-
- DataShard.CreateChangeSender(ctx);
- MoveChangeRecords(db, params, changeRecords);
- DataShard.EnqueueChangeRecords(std::move(changeRecords));
- DataShard.MaybeActivateChangeSender(ctx);
-
- BuildResult(op, NKikimrTxDataShard::TEvProposeTransactionResult::COMPLETE);
- op->Result()->SetStepOrderId(op->GetStepOrder().ToPair());
-
- return EExecutionStatus::ExecutedNoMoreRestarts;
- }
-
- void Complete(TOperation::TPtr, const TActorContext&) override {
- // nothing
- }
-};
-
-THolder<TExecutionUnit> CreateMoveTableUnit(
+ : TExecutionUnit(EExecutionUnitKind::DropIndexNotice, false, dataShard, pipeline)
+ { }
+
+ bool IsReadyToExecute(TOperation::TPtr) const override {
+ return true;
+ }
+
+ void MoveChangeRecords(NIceDb::TNiceDb& db, const NKikimrTxDataShard::TMoveTable& move, TVector<TEvChangeExchange::TEvEnqueueRecords::TRecordInfo>& changeRecords) {
+ const THashMap<TPathId, TPathId> remap = DataShard.GetRemapIndexes(move);
+
+ for (auto& record: changeRecords) {
+ if (remap.contains(record.PathId)) { // here could be the records for already deleted indexes, so skip them
+ record.PathId = remap.at(record.PathId);
+ DataShard.MoveChangeRecord(db, record.Order, record.PathId);
+ }
+ }
+ }
+
+ EExecutionStatus Execute(TOperation::TPtr op, TTransactionContext& txc, const TActorContext& ctx) override {
+ Y_VERIFY(op->IsSchemeTx());
+
+ TActiveTransaction* tx = dynamic_cast<TActiveTransaction*>(op.Get());
+ Y_VERIFY_S(tx, "cannot cast operation of kind " << op->GetKind());
+
+ if (tx->GetSchemeTxType() != TSchemaOperation::ETypeMoveTable) {
+ return EExecutionStatus::Executed;
+ }
+
+ const auto& schemeTx = tx->GetSchemeTx();
+ if (!schemeTx.HasMoveTable()) {
+ return EExecutionStatus::Executed;
+ }
+
+ NIceDb::TNiceDb db(txc.DB);
+ TVector<TEvChangeExchange::TEvEnqueueRecords::TRecordInfo> changeRecords;
+ if (!DataShard.LoadChangeRecords(db, changeRecords)) {
+ return EExecutionStatus::Restart;
+ }
+
+ LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::TX_DATASHARD, "TMoveTableUnit Execute"
+ << ": schemeTx# " << schemeTx.DebugString()
+ << ": changeRecords size# " << changeRecords.size()
+ << ", at tablet# " << DataShard.TabletID());
+
+ const auto& params = schemeTx.GetMoveTable();
+
+ DataShard.KillChangeSender(ctx);
+
+ DataShard.MoveUserTable(ctx, txc, params);
+
+ DataShard.CreateChangeSender(ctx);
+ MoveChangeRecords(db, params, changeRecords);
+ DataShard.EnqueueChangeRecords(std::move(changeRecords));
+ DataShard.MaybeActivateChangeSender(ctx);
+
+ BuildResult(op, NKikimrTxDataShard::TEvProposeTransactionResult::COMPLETE);
+ op->Result()->SetStepOrderId(op->GetStepOrder().ToPair());
+
+ return EExecutionStatus::ExecutedNoMoreRestarts;
+ }
+
+ void Complete(TOperation::TPtr, const TActorContext&) override {
+ // nothing
+ }
+};
+
+THolder<TExecutionUnit> CreateMoveTableUnit(
TDataShard& dataShard,
- TPipeline& pipeline)
-{
- return THolder(new TMoveTableUnit(dataShard, pipeline));
-}
-
+ TPipeline& pipeline)
+{
+ return THolder(new TMoveTableUnit(dataShard, pipeline));
+}
+
} // namespace NDataShard
-} // namespace NKikimr
+} // namespace NKikimr
diff --git a/ydb/core/tx/datashard/range_ops.cpp b/ydb/core/tx/datashard/range_ops.cpp
index c65caa785df..64abea2b604 100644
--- a/ydb/core/tx/datashard/range_ops.cpp
+++ b/ydb/core/tx/datashard/range_ops.cpp
@@ -1,201 +1,201 @@
-#include "range_ops.h"
-
-NKikimr::TTableRange NKikimr::Intersect(TConstArrayRef<NScheme::TTypeId> types, const TTableRange& first, const TTableRange& second)
-{
- // all variants
- //=================
- //-----------[aaa]---
- //----[bbb]----------
- //=================
- //-----------[aaa]---
- //----[bbbbbb]-------
- //=================
- //-----------[aaa]---
- //----[bbbbbbbb]-----
- //=================
- //-----------[aaa]---
- //----[bbbbbbbbbb]---
- //=================
- //---------[aaa]----
- //--[bbbbbbbbbbbbb]-
-
- //=================
- //----[aaaaaa]----------
- //----[]----------
- //=================
- //----[aaaaaa]----------
- //----[bbb]----------
- //=================
- //----[aaaaaa]----------
- //----[bbbbbb]----------
- //=================
- //----[aaaaaa]----------
- //----[bbbbbbbb]----------
-
-
- //=================
- //-----[aaaaaaa]----------
- //-------[bbb]----------
- //=================
- //-----[aaaaaaa]----------
- //-------[bbbbb]----------
- //=================
- //-----[aaaaaaa]----------
- //-------[bbbbbbb]----------
-
- //=================
- //-----[aaa]----------
- //---------[]----------
- //=================
- //-----[aaa]----------
- //---------[bbb]----------
-
-
- //=================
- //-----[aaa]----------
- //------------[bbb]---
-
- if (first.IsEmptyRange(types)) {
- return first;
- }
-
- if (second.IsEmptyRange(types)) {
- return second;
- }
-
- int cmpFF = CompareBorders<false, false>(first.From,
- second.From,
- first.InclusiveFrom,
- second.InclusiveFrom,
- types);
- int cmpTT = CompareBorders<true, true>(first.To,
- second.To,
- first.InclusiveTo,
- second.InclusiveTo,
- types);
- int cmpFT = CompareBorders<false, true>(first.From,
- second.To,
- first.InclusiveFrom,
- second.InclusiveTo,
- types);
- int cmpTF = CompareBorders<true, false>(first.To,
- second.From,
- first.InclusiveTo,
- second.InclusiveFrom,
- types);
- if (cmpFF < 0)
- {
- if (cmpTF < 0) {
- //=================
- //-----------[aaa]----------
- //----[bbb]----------
- return TTableRange(second.From, second.InclusiveFrom,
- first.To, first.InclusiveTo);
- } else if (cmpTF == 0) {
- //=================
- //-----------[aaa]----------
- //----[bbbbbb]----------
- return TTableRange(second.From, second.InclusiveFrom,
- first.To, first.InclusiveTo);
- } else { // if (cmpTF > 0) {
- if (cmpTT < 0) {
- //=================
- //-----------[aaa]----------
- //----[bbbbbbbb]----------
- return TTableRange(second.From, second.InclusiveFrom,
- first.To, first.InclusiveTo);
- } else if (cmpTT == 0) {
- //=================
- //-----------[aaa]----------
- //----[bbbbbbbbbb]----------
- return TTableRange(second.From, second.InclusiveFrom,
- second.To, second.InclusiveTo);
- } else { // if (cmpTT > 0) {
- //=================
- //---------[aaa]----
- //--[bbbbbbbbbbbbb]-
- return TTableRange(second.From, second.InclusiveFrom,
- second.To, second.InclusiveTo);
- }
- }
- } else if (cmpFF == 0) {
- if (cmpTT < 0) {
- if (cmpTF == 0) {
- //=================
- //----[aaaaaa]----------
- //----[]----------
- return TTableRange(second.From, second.InclusiveFrom,
- first.To, first.InclusiveTo);
- } else if (cmpTF > 0) {
- //=================
- //----[aaaaaa]----------
- //----[bbb]----------
- return TTableRange(second.From, second.InclusiveFrom,
- first.To, first.InclusiveTo);
- } else { // if (cmpTF < 0)
- Y_FAIL("unreachable");
- }
- } else if (cmpTT == 0) {
- //=================
- //----[aaaaaa]----------
- //----[bbbbbb]----------
- return TTableRange(second.From, second.InclusiveFrom,
- first.To, first.InclusiveTo);
- } else { // if (cmpTT > 0)
- //=================
- //----[aaaaaa]----------
- //----[bbbbbbbb]----------
- return TTableRange(second.From, second.InclusiveFrom,
- second.To, second.InclusiveTo);
- }
- } else { //if (cmpFF > 0) {
- if (cmpFT < 0) {
- if (cmpTT < 0) {
- //=================
- //-----[aaaaaaa]----------
- //-------[bbb]----------
- return TTableRange(first.From, first.InclusiveFrom,
- first.To, first.InclusiveTo);
- } else if (cmpTT == 0) {
- //=================
- //-----[aaaaaaa]----------
- //-------[bbbbb]----------
- return TTableRange(first.From, first.InclusiveFrom,
- first.To, first.InclusiveTo);
- } else { //if (cmpTT > 0) {
- //=================
- //-----[aaaaaaa]----------
- //-------[bbbbbbb]----------
- return TTableRange(first.From, first.InclusiveFrom,
- second.To, second.InclusiveTo);
- }
- } else if (cmpFT == 0) {
- if (cmpTT == 0) {
- //=================
- //-----[aaa]----------
- //---------[]----------
- return TTableRange(first.From, first.InclusiveFrom,
- first.To, first.InclusiveTo);
- } else if (cmpTT > 0) {
- //=================
- //-----[aaa]----------
- //---------[bbb]----------
- return TTableRange(first.From, first.InclusiveFrom,
- second.To, second.InclusiveTo);
- } else {
- // cmpTT < 0
- Y_FAIL("unreachable");
- }
- } else { // if (cmpFT > 0)
- //=================
- //-----[aaa]----------
- //------------[bbb]---
- return TTableRange(first.From, first.InclusiveFrom,
- second.To, second.InclusiveTo);
- }
- }
-}
-
+#include "range_ops.h"
+
+NKikimr::TTableRange NKikimr::Intersect(TConstArrayRef<NScheme::TTypeId> types, const TTableRange& first, const TTableRange& second)
+{
+ // all variants
+ //=================
+ //-----------[aaa]---
+ //----[bbb]----------
+ //=================
+ //-----------[aaa]---
+ //----[bbbbbb]-------
+ //=================
+ //-----------[aaa]---
+ //----[bbbbbbbb]-----
+ //=================
+ //-----------[aaa]---
+ //----[bbbbbbbbbb]---
+ //=================
+ //---------[aaa]----
+ //--[bbbbbbbbbbbbb]-
+
+ //=================
+ //----[aaaaaa]----------
+ //----[]----------
+ //=================
+ //----[aaaaaa]----------
+ //----[bbb]----------
+ //=================
+ //----[aaaaaa]----------
+ //----[bbbbbb]----------
+ //=================
+ //----[aaaaaa]----------
+ //----[bbbbbbbb]----------
+
+
+ //=================
+ //-----[aaaaaaa]----------
+ //-------[bbb]----------
+ //=================
+ //-----[aaaaaaa]----------
+ //-------[bbbbb]----------
+ //=================
+ //-----[aaaaaaa]----------
+ //-------[bbbbbbb]----------
+
+ //=================
+ //-----[aaa]----------
+ //---------[]----------
+ //=================
+ //-----[aaa]----------
+ //---------[bbb]----------
+
+
+ //=================
+ //-----[aaa]----------
+ //------------[bbb]---
+
+ if (first.IsEmptyRange(types)) {
+ return first;
+ }
+
+ if (second.IsEmptyRange(types)) {
+ return second;
+ }
+
+ int cmpFF = CompareBorders<false, false>(first.From,
+ second.From,
+ first.InclusiveFrom,
+ second.InclusiveFrom,
+ types);
+ int cmpTT = CompareBorders<true, true>(first.To,
+ second.To,
+ first.InclusiveTo,
+ second.InclusiveTo,
+ types);
+ int cmpFT = CompareBorders<false, true>(first.From,
+ second.To,
+ first.InclusiveFrom,
+ second.InclusiveTo,
+ types);
+ int cmpTF = CompareBorders<true, false>(first.To,
+ second.From,
+ first.InclusiveTo,
+ second.InclusiveFrom,
+ types);
+ if (cmpFF < 0)
+ {
+ if (cmpTF < 0) {
+ //=================
+ //-----------[aaa]----------
+ //----[bbb]----------
+ return TTableRange(second.From, second.InclusiveFrom,
+ first.To, first.InclusiveTo);
+ } else if (cmpTF == 0) {
+ //=================
+ //-----------[aaa]----------
+ //----[bbbbbb]----------
+ return TTableRange(second.From, second.InclusiveFrom,
+ first.To, first.InclusiveTo);
+ } else { // if (cmpTF > 0) {
+ if (cmpTT < 0) {
+ //=================
+ //-----------[aaa]----------
+ //----[bbbbbbbb]----------
+ return TTableRange(second.From, second.InclusiveFrom,
+ first.To, first.InclusiveTo);
+ } else if (cmpTT == 0) {
+ //=================
+ //-----------[aaa]----------
+ //----[bbbbbbbbbb]----------
+ return TTableRange(second.From, second.InclusiveFrom,
+ second.To, second.InclusiveTo);
+ } else { // if (cmpTT > 0) {
+ //=================
+ //---------[aaa]----
+ //--[bbbbbbbbbbbbb]-
+ return TTableRange(second.From, second.InclusiveFrom,
+ second.To, second.InclusiveTo);
+ }
+ }
+ } else if (cmpFF == 0) {
+ if (cmpTT < 0) {
+ if (cmpTF == 0) {
+ //=================
+ //----[aaaaaa]----------
+ //----[]----------
+ return TTableRange(second.From, second.InclusiveFrom,
+ first.To, first.InclusiveTo);
+ } else if (cmpTF > 0) {
+ //=================
+ //----[aaaaaa]----------
+ //----[bbb]----------
+ return TTableRange(second.From, second.InclusiveFrom,
+ first.To, first.InclusiveTo);
+ } else { // if (cmpTF < 0)
+ Y_FAIL("unreachable");
+ }
+ } else if (cmpTT == 0) {
+ //=================
+ //----[aaaaaa]----------
+ //----[bbbbbb]----------
+ return TTableRange(second.From, second.InclusiveFrom,
+ first.To, first.InclusiveTo);
+ } else { // if (cmpTT > 0)
+ //=================
+ //----[aaaaaa]----------
+ //----[bbbbbbbb]----------
+ return TTableRange(second.From, second.InclusiveFrom,
+ second.To, second.InclusiveTo);
+ }
+ } else { //if (cmpFF > 0) {
+ if (cmpFT < 0) {
+ if (cmpTT < 0) {
+ //=================
+ //-----[aaaaaaa]----------
+ //-------[bbb]----------
+ return TTableRange(first.From, first.InclusiveFrom,
+ first.To, first.InclusiveTo);
+ } else if (cmpTT == 0) {
+ //=================
+ //-----[aaaaaaa]----------
+ //-------[bbbbb]----------
+ return TTableRange(first.From, first.InclusiveFrom,
+ first.To, first.InclusiveTo);
+ } else { //if (cmpTT > 0) {
+ //=================
+ //-----[aaaaaaa]----------
+ //-------[bbbbbbb]----------
+ return TTableRange(first.From, first.InclusiveFrom,
+ second.To, second.InclusiveTo);
+ }
+ } else if (cmpFT == 0) {
+ if (cmpTT == 0) {
+ //=================
+ //-----[aaa]----------
+ //---------[]----------
+ return TTableRange(first.From, first.InclusiveFrom,
+ first.To, first.InclusiveTo);
+ } else if (cmpTT > 0) {
+ //=================
+ //-----[aaa]----------
+ //---------[bbb]----------
+ return TTableRange(first.From, first.InclusiveFrom,
+ second.To, second.InclusiveTo);
+ } else {
+ // cmpTT < 0
+ Y_FAIL("unreachable");
+ }
+ } else { // if (cmpFT > 0)
+ //=================
+ //-----[aaa]----------
+ //------------[bbb]---
+ return TTableRange(first.From, first.InclusiveFrom,
+ second.To, second.InclusiveTo);
+ }
+ }
+}
+
TString NKikimr::DebugPrintRange(TConstArrayRef<NScheme::TTypeId> types, const NKikimr::TTableRange &range,
const NScheme::TTypeRegistry& typeRegistry)
{
@@ -203,20 +203,20 @@ TString NKikimr::DebugPrintRange(TConstArrayRef<NScheme::TTypeId> types, const N
return DebugPrintPoint(types, range.From, typeRegistry);
}
- return TStringBuilder()
- << (range.InclusiveFrom ? "[" : "(")
- << DebugPrintPoint(types, range.From, typeRegistry)
- << " ; "
- << DebugPrintPoint(types, range.To, typeRegistry)
- << (range.InclusiveTo ? "]" : ")");
-}
-
-TString NKikimr::DebugPrintPoint(TConstArrayRef<NScheme::TTypeId> types, const TConstArrayRef<TCell> &point, const NScheme::TTypeRegistry& typeRegistry) {
- Y_VERIFY(types.size() >= point.size());
- TDbTupleRef pointRef(types.data(), point.data(), point.size());
-
- return DbgPrintTuple(pointRef, typeRegistry);
-}
+ return TStringBuilder()
+ << (range.InclusiveFrom ? "[" : "(")
+ << DebugPrintPoint(types, range.From, typeRegistry)
+ << " ; "
+ << DebugPrintPoint(types, range.To, typeRegistry)
+ << (range.InclusiveTo ? "]" : ")");
+}
+
+TString NKikimr::DebugPrintPoint(TConstArrayRef<NScheme::TTypeId> types, const TConstArrayRef<TCell> &point, const NScheme::TTypeRegistry& typeRegistry) {
+ Y_VERIFY(types.size() >= point.size());
+ TDbTupleRef pointRef(types.data(), point.data(), point.size());
+
+ return DbgPrintTuple(pointRef, typeRegistry);
+}
TString NKikimr::DebugPrintPartitionInfo(const TKeyDesc::TPartitionInfo& partition,
const TVector<NScheme::TTypeId>& keyTypes, const NScheme::TTypeRegistry& typeRegistry)
diff --git a/ydb/core/tx/datashard/range_ops.h b/ydb/core/tx/datashard/range_ops.h
index e96bac5611a..0ca0a6eeb8b 100644
--- a/ydb/core/tx/datashard/range_ops.h
+++ b/ydb/core/tx/datashard/range_ops.h
@@ -1,15 +1,15 @@
-#pragma once
-
+#pragma once
+
#include <ydb/core/scheme/scheme_tabledefs.h>
-
-namespace NKikimr {
-
-TTableRange Intersect(TConstArrayRef<NScheme::TTypeId> types, const TTableRange& first, const TTableRange& second);
-
-TString DebugPrintRange(TConstArrayRef<NScheme::TTypeId> types, const TTableRange& range, const NScheme::TTypeRegistry& typeRegistry);
-TString DebugPrintPoint(TConstArrayRef<NScheme::TTypeId> types, const TConstArrayRef<TCell>& point, const NScheme::TTypeRegistry& typeRegistry);
-
+
+namespace NKikimr {
+
+TTableRange Intersect(TConstArrayRef<NScheme::TTypeId> types, const TTableRange& first, const TTableRange& second);
+
+TString DebugPrintRange(TConstArrayRef<NScheme::TTypeId> types, const TTableRange& range, const NScheme::TTypeRegistry& typeRegistry);
+TString DebugPrintPoint(TConstArrayRef<NScheme::TTypeId> types, const TConstArrayRef<TCell>& point, const NScheme::TTypeRegistry& typeRegistry);
+
TString DebugPrintPartitionInfo(const TKeyDesc::TPartitionInfo& partition, const TVector<NScheme::TTypeId>& keyTypes,
const NScheme::TTypeRegistry& typeRegistry);
-}
+}
diff --git a/ydb/core/tx/datashard/restore_unit.cpp b/ydb/core/tx/datashard/restore_unit.cpp
index 34b487c0d4d..6f80c11bcdf 100644
--- a/ydb/core/tx/datashard/restore_unit.cpp
+++ b/ydb/core/tx/datashard/restore_unit.cpp
@@ -38,7 +38,7 @@ protected:
const auto settingsKind = restore.GetSettingsCase();
switch (settingsKind) {
- case NKikimrSchemeOp::TRestoreTask::kS3Settings:
+ case NKikimrSchemeOp::TRestoreTask::kS3Settings:
#ifndef KIKIMR_DISABLE_S3_OPS
tx->SetAsyncJobActor(ctx.Register(CreateS3Downloader(DataShard.SelfId(), op->GetTxId(), restore, tableInfo),
TMailboxType::HTSwap, AppData(ctx)->BatchPoolId));
diff --git a/ydb/core/tx/datashard/s3_common.h b/ydb/core/tx/datashard/s3_common.h
index c3823e9879e..a9f7c570f9c 100644
--- a/ydb/core/tx/datashard/s3_common.h
+++ b/ydb/core/tx/datashard/s3_common.h
@@ -16,7 +16,7 @@
namespace NKikimr {
namespace NDataShard {
-inline Aws::Client::ClientConfiguration ConfigFromSettings(const NKikimrSchemeOp::TS3Settings& settings) {
+inline Aws::Client::ClientConfiguration ConfigFromSettings(const NKikimrSchemeOp::TS3Settings& settings) {
Aws::Client::ClientConfiguration config;
config.endpointOverride = settings.GetEndpoint();
@@ -24,10 +24,10 @@ inline Aws::Client::ClientConfiguration ConfigFromSettings(const NKikimrSchemeOp
config.maxConnections = 5;
switch (settings.GetScheme()) {
- case NKikimrSchemeOp::TS3Settings::HTTP:
+ case NKikimrSchemeOp::TS3Settings::HTTP:
config.scheme = Aws::Http::Scheme::HTTP;
break;
- case NKikimrSchemeOp::TS3Settings::HTTPS:
+ case NKikimrSchemeOp::TS3Settings::HTTPS:
config.scheme = Aws::Http::Scheme::HTTPS;
break;
default:
@@ -37,7 +37,7 @@ inline Aws::Client::ClientConfiguration ConfigFromSettings(const NKikimrSchemeOp
return config;
}
-inline Aws::Auth::AWSCredentials CredentialsFromSettings(const NKikimrSchemeOp::TS3Settings& settings) {
+inline Aws::Auth::AWSCredentials CredentialsFromSettings(const NKikimrSchemeOp::TS3Settings& settings) {
return Aws::Auth::AWSCredentials(settings.GetAccessKey(), settings.GetSecretKey());
}
@@ -50,7 +50,7 @@ struct TS3Settings {
Aws::S3::Model::StorageClass StorageClass;
private:
- explicit TS3Settings(const NKikimrSchemeOp::TS3Settings& settings, ui32 shard)
+ explicit TS3Settings(const NKikimrSchemeOp::TS3Settings& settings, ui32 shard)
: Config(ConfigFromSettings(settings))
, Credentials(CredentialsFromSettings(settings))
, Bucket(settings.GetBucket())
@@ -90,11 +90,11 @@ private:
}
public:
- static TS3Settings FromBackupTask(const NKikimrSchemeOp::TBackupTask& task) {
+ static TS3Settings FromBackupTask(const NKikimrSchemeOp::TBackupTask& task) {
return TS3Settings(task.GetS3Settings(), task.GetShardNum());
}
- static TS3Settings FromRestoreTask(const NKikimrSchemeOp::TRestoreTask& task) {
+ static TS3Settings FromRestoreTask(const NKikimrSchemeOp::TRestoreTask& task) {
return TS3Settings(task.GetS3Settings(), task.GetShardNum());
}
diff --git a/ydb/core/tx/datashard/store_scheme_tx_unit.cpp b/ydb/core/tx/datashard/store_scheme_tx_unit.cpp
index 83a66c461e9..6b1d8af9ed9 100644
--- a/ydb/core/tx/datashard/store_scheme_tx_unit.cpp
+++ b/ydb/core/tx/datashard/store_scheme_tx_unit.cpp
@@ -48,10 +48,10 @@ EExecutionStatus TStoreSchemeTxUnit::Execute(TOperation::TPtr op,
Y_VERIFY_S(tx, "cannot cast operation of kind " << op->GetKind());
ui64 ssTabletId = tx->GetSchemeShardId();
- if (DataShard.GetCurrentSchemeShardId() == INVALID_TABLET_ID) {
- DataShard.PersistCurrentSchemeShardId(ssTabletId, txc);
+ if (DataShard.GetCurrentSchemeShardId() == INVALID_TABLET_ID) {
+ DataShard.PersistCurrentSchemeShardId(ssTabletId, txc);
} else {
- Y_VERIFY(DataShard.GetCurrentSchemeShardId() == ssTabletId,
+ Y_VERIFY(DataShard.GetCurrentSchemeShardId() == ssTabletId,
"Got scheme transaction from unknown SchemeShard %" PRIu64, ssTabletId);
}
@@ -63,18 +63,18 @@ EExecutionStatus TStoreSchemeTxUnit::Execute(TOperation::TPtr op,
DataShard.StartFindSubDomainPathId();
}
- if (DataShard.GetPathOwnerId() == INVALID_TABLET_ID) {
- if (tx->GetSchemeTx().HasCreateTable() && tx->GetSchemeTx().GetCreateTable().HasPathId()) { // message from new SS
- ui64 ownerPathId = tx->GetSchemeTx().GetCreateTable().GetPathId().GetOwnerId();
- DataShard.PersistOwnerPathId(ownerPathId, txc);
- } else { // message from old SS
- DataShard.PersistOwnerPathId(ssTabletId, txc);
- }
- }
-
- if (!DataShard.GetProcessingParams()) {
+ if (DataShard.GetPathOwnerId() == INVALID_TABLET_ID) {
+ if (tx->GetSchemeTx().HasCreateTable() && tx->GetSchemeTx().GetCreateTable().HasPathId()) { // message from new SS
+ ui64 ownerPathId = tx->GetSchemeTx().GetCreateTable().GetPathId().GetOwnerId();
+ DataShard.PersistOwnerPathId(ownerPathId, txc);
+ } else { // message from old SS
+ DataShard.PersistOwnerPathId(ssTabletId, txc);
+ }
+ }
+
+ if (!DataShard.GetProcessingParams()) {
DataShard.PersistProcessingParams(tx->GetProcessingParams(), txc);
- }
+ }
TSchemaOperation schemeOp(op->GetTxId(), tx->GetSchemeTxType(), op->GetTarget(),
tx->GetSchemeShardId(), op->GetMinStep(), op->GetMaxStep(),
diff --git a/ydb/core/tx/datashard/sys_tables.h b/ydb/core/tx/datashard/sys_tables.h
index bdcad74a497..e9887bd8dbb 100644
--- a/ydb/core/tx/datashard/sys_tables.h
+++ b/ydb/core/tx/datashard/sys_tables.h
@@ -7,22 +7,22 @@
namespace NKikimr {
struct TSysTables {
- struct TTableColumnInfo {
- TString Name;
- ui32 Id = 0;
- ui32 PType = 0;
- i32 KeyOrder = -1;
-
- TTableColumnInfo() = default;
-
- TTableColumnInfo(TString name, ui32 colId, ui32 type, i32 keyOrder = -1)
- : Name(name)
- , Id(colId)
- , PType(type)
- , KeyOrder(keyOrder)
- {}
- };
-
+ struct TTableColumnInfo {
+ TString Name;
+ ui32 Id = 0;
+ ui32 PType = 0;
+ i32 KeyOrder = -1;
+
+ TTableColumnInfo() = default;
+
+ TTableColumnInfo(TString name, ui32 colId, ui32 type, i32 keyOrder = -1)
+ : Name(name)
+ , Id(colId)
+ , PType(type)
+ , KeyOrder(keyOrder)
+ {}
+ };
+
// fake TabletIds
enum ESysIds : ui64 {
SysSchemeShard = 1, // fake SchemeShard
diff --git a/ydb/core/tx/datashard/upload_stats.cpp b/ydb/core/tx/datashard/upload_stats.cpp
index 3e5f6101cc5..695a8d8d245 100644
--- a/ydb/core/tx/datashard/upload_stats.cpp
+++ b/ydb/core/tx/datashard/upload_stats.cpp
@@ -1,33 +1,33 @@
-#include "upload_stats.h"
-
+#include "upload_stats.h"
+
#include <ydb/core/base/appdata.h>
-
-#include <util/string/builder.h>
-
+
+#include <util/string/builder.h>
+
NKikimr::NDataShard::TUploadMonStats::TUploadMonStats(const TString service, const TString subsystem) {
- auto counters = GetServiceCounters(AppData()->Counters, service)->GetSubgroup("subsystem", subsystem);
-
- MonBytes = counters->GetCounter("Bytes", true);
- MonRows = counters->GetCounter("Records", true);
-}
-
+ auto counters = GetServiceCounters(AppData()->Counters, service)->GetSubgroup("subsystem", subsystem);
+
+ MonBytes = counters->GetCounter("Bytes", true);
+ MonRows = counters->GetCounter("Records", true);
+}
+
void NKikimr::NDataShard::TUploadMonStats::Aggr(ui64 rows, ui64 bytes) {
- if (MonRows && MonBytes) {
- *MonRows += rows;
- *MonBytes += bytes;
- }
- RowsSent += rows;
- BytesSent += bytes;
-}
-
+ if (MonRows && MonBytes) {
+ *MonRows += rows;
+ *MonBytes += bytes;
+ }
+ RowsSent += rows;
+ BytesSent += bytes;
+}
+
void NKikimr::NDataShard::TUploadMonStats::Aggr(const NKikimr::NDataShard::IStatHolder *other) {
- Aggr(other->GetRows(), other->GetBytes());
-}
-
+ Aggr(other->GetRows(), other->GetBytes());
+}
+
TString NKikimr::NDataShard::TUploadMonStats::ToString() const {
- return TStringBuilder()
- << "Stats { "
- << " RowsSent: " << RowsSent
- << " BytesSent: " << BytesSent
- << " }";
-}
+ return TStringBuilder()
+ << "Stats { "
+ << " RowsSent: " << RowsSent
+ << " BytesSent: " << BytesSent
+ << " }";
+}
diff --git a/ydb/core/tx/datashard/upload_stats.h b/ydb/core/tx/datashard/upload_stats.h
index d24f17d7a6a..f06ce7a255d 100644
--- a/ydb/core/tx/datashard/upload_stats.h
+++ b/ydb/core/tx/datashard/upload_stats.h
@@ -1,45 +1,45 @@
-#pragma once
-
-#include "defs.h"
-
+#pragma once
+
+#include "defs.h"
+
#include <ydb/core/base/counters.h>
-
-namespace NKikimr {
+
+namespace NKikimr {
namespace NDataShard {
-
-class IStatHolder {
-public:
- virtual ~IStatHolder() = default;
-
- virtual ui64 GetRows() const = 0;
- virtual ui64 GetBytes() const = 0;
-};
-
-class TUploadMonStats: public IStatHolder {
-public:
- explicit TUploadMonStats() = default;
- explicit TUploadMonStats(const TString service,
- const TString subsystem);
-
- void Aggr(ui64 rows, ui64 bytes);
- void Aggr(IStatHolder const* other);
-
- TString ToString() const;
-
- ui64 GetRows() const override final {
- return RowsSent;
- }
-
- ui64 GetBytes() const override final {
- return BytesSent;
- }
-
-private:
- ui64 RowsSent = 0;
- ui64 BytesSent = 0;
-
- NMonitoring::TDynamicCounters::TCounterPtr MonRows;
- NMonitoring::TDynamicCounters::TCounterPtr MonBytes;
-};
-
-}}
+
+class IStatHolder {
+public:
+ virtual ~IStatHolder() = default;
+
+ virtual ui64 GetRows() const = 0;
+ virtual ui64 GetBytes() const = 0;
+};
+
+class TUploadMonStats: public IStatHolder {
+public:
+ explicit TUploadMonStats() = default;
+ explicit TUploadMonStats(const TString service,
+ const TString subsystem);
+
+ void Aggr(ui64 rows, ui64 bytes);
+ void Aggr(IStatHolder const* other);
+
+ TString ToString() const;
+
+ ui64 GetRows() const override final {
+ return RowsSent;
+ }
+
+ ui64 GetBytes() const override final {
+ return BytesSent;
+ }
+
+private:
+ ui64 RowsSent = 0;
+ ui64 BytesSent = 0;
+
+ NMonitoring::TDynamicCounters::TCounterPtr MonRows;
+ NMonitoring::TDynamicCounters::TCounterPtr MonBytes;
+};
+
+}}
diff --git a/ydb/core/tx/datashard/ya.make b/ydb/core/tx/datashard/ya.make
index c2137fd353c..9c98e8e79b0 100644
--- a/ydb/core/tx/datashard/ya.make
+++ b/ydb/core/tx/datashard/ya.make
@@ -37,7 +37,7 @@ SRCS(
create_persistent_snapshot_unit.cpp
create_table_unit.cpp
create_volatile_snapshot_unit.cpp
- datashard__build_index.cpp
+ datashard__build_index.cpp
datashard__cancel_tx_proposal.cpp
datashard__compact_borrowed.cpp
datashard__compaction.cpp
@@ -49,7 +49,7 @@ SRCS(
datashard__engine_host.h
datashard__get_state_tx.cpp
datashard__schema_changed.cpp
- datashard__migrate_schemeshard.cpp
+ datashard__migrate_schemeshard.cpp
datashard__init.cpp
datashard__monitoring.cpp
datashard__mon_reset_schema_version.cpp
@@ -125,7 +125,7 @@ SRCS(
defs.h
direct_tx_unit.cpp
drop_cdc_stream_unit.cpp
- drop_index_notice_unit.cpp
+ drop_index_notice_unit.cpp
drop_persistent_snapshot_unit.cpp
drop_table_unit.cpp
drop_volatile_snapshot_unit.cpp
@@ -152,7 +152,7 @@ SRCS(
load_tx_details_unit.cpp
make_scan_snapshot_unit.cpp
make_snapshot_unit.cpp
- move_table_unit.cpp
+ move_table_unit.cpp
operation.cpp
operation.h
plan_queue_unit.cpp
@@ -167,7 +167,7 @@ SRCS(
read_table_scan_unit.cpp
receive_snapshot_unit.cpp
range_avl_tree.cpp
- range_ops.cpp
+ range_ops.cpp
range_treap.cpp
read_iterator.h
restore_unit.cpp
@@ -180,7 +180,7 @@ SRCS(
store_snapshot_tx_unit.cpp
wait_for_plan_unit.cpp
wait_for_stream_clearance_unit.cpp
- upload_stats.cpp
+ upload_stats.cpp
)
GENERATE_ENUM_SERIALIZATION(change_exchange.h)
diff --git a/ydb/core/tx/mediator/defs.h b/ydb/core/tx/mediator/defs.h
index 37eb937a4fd..6a846b7b06e 100644
--- a/ydb/core/tx/mediator/defs.h
+++ b/ydb/core/tx/mediator/defs.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
// unique tag to fix pragma once gcc glueing: ./ydb/core/tx/mediator/defs.h
#include <ydb/core/base/defs.h>
#include <ydb/core/base/events.h>
diff --git a/ydb/core/tx/mediator/execute_queue.cpp b/ydb/core/tx/mediator/execute_queue.cpp
index 4857beef829..07740e9f826 100644
--- a/ydb/core/tx/mediator/execute_queue.cpp
+++ b/ydb/core/tx/mediator/execute_queue.cpp
@@ -1,10 +1,10 @@
-#include "mediator_impl.h"
-
+#include "mediator_impl.h"
+
#include <ydb/core/base/appdata.h>
#include <ydb/core/base/tx_processing.h>
#include <library/cpp/actors/core/hfunc.h>
#include <ydb/core/tx/time_cast/time_cast.h>
-
+
#include <util/generic/hash.h>
#include <util/string/builder.h>
@@ -20,11 +20,11 @@ namespace NTxMediator {
const ui64 MediatorId;
const ui64 HashRange;
- TTimeCastBuckets BucketSelector;
+ TTimeCastBuckets BucketSelector;
TVector<TBucket> Buckets;
TBucket& SelectBucket(TTabletId tablet) {
- const ui32 bucketIdx = BucketSelector.Select(tablet);
+ const ui32 bucketIdx = BucketSelector.Select(tablet);
Y_VERIFY_DEBUG(bucketIdx < Buckets.size());
return Buckets[bucketIdx];
}
@@ -166,8 +166,8 @@ namespace NTxMediator {
}
void Bootstrap(const TActorContext &ctx) {
- Buckets.resize(BucketSelector.Buckets());
- for (ui32 bucketIdx = 0; bucketIdx < Buckets.size(); ++bucketIdx)
+ Buckets.resize(BucketSelector.Buckets());
+ for (ui32 bucketIdx = 0; bucketIdx < Buckets.size(); ++bucketIdx)
Buckets[bucketIdx].ActiveActor = ctx.ExecutorThread.RegisterActor(CreateTxMediatorTabletQueue(ctx.SelfID, MediatorId, 1, bucketIdx), TMailboxType::ReadAsFilled);
}
@@ -181,7 +181,7 @@ namespace NTxMediator {
, Owner(owner)
, MediatorId(mediator)
, HashRange(hashRange)
- , BucketSelector(timecastBuckets)
+ , BucketSelector(timecastBuckets)
{
Y_UNUSED(HashRange);
}
@@ -204,7 +204,7 @@ namespace NTxMediator {
}
IActor* CreateTxMediatorExecQueue(const TActorId &owner, ui64 mediator, ui64 hashRange, ui32 timecastBuckets) {
- return new NTxMediator::TTxMediatorExecQueue(owner, mediator, hashRange, timecastBuckets);
+ return new NTxMediator::TTxMediatorExecQueue(owner, mediator, hashRange, timecastBuckets);
}
}
diff --git a/ydb/core/tx/mediator/mediator.cpp b/ydb/core/tx/mediator/mediator.cpp
index e8254eee4fa..0fbd44403c0 100644
--- a/ydb/core/tx/mediator/mediator.cpp
+++ b/ydb/core/tx/mediator/mediator.cpp
@@ -1,6 +1,6 @@
-#include "mediator.h"
-#include "mediator_impl.h"
-
+#include "mediator.h"
+#include "mediator_impl.h"
+
#include <util/generic/intrlist.h>
namespace NKikimr {
diff --git a/ydb/core/tx/mediator/mediator.h b/ydb/core/tx/mediator/mediator.h
index 607f98c1e3d..93a66ef307a 100644
--- a/ydb/core/tx/mediator/mediator.h
+++ b/ydb/core/tx/mediator/mediator.h
@@ -1,10 +1,10 @@
-#pragma once
-#include "defs.h"
-
+#pragma once
+#include "defs.h"
+
#include <ydb/core/base/blobstorage.h>
-
-namespace NKikimr {
-
+
+namespace NKikimr {
+
IActor* CreateTxMediator(const TActorId &tablet, TTabletStorageInfo *info);
-
-}
+
+}
diff --git a/ydb/core/tx/mediator/mediator__configure.cpp b/ydb/core/tx/mediator/mediator__configure.cpp
index 1725319f3a7..4a368e321f1 100644
--- a/ydb/core/tx/mediator/mediator__configure.cpp
+++ b/ydb/core/tx/mediator/mediator__configure.cpp
@@ -1,91 +1,91 @@
-#include "mediator_impl.h"
-
-namespace NKikimr {
-namespace NTxMediator {
-
-using NTabletFlatExecutor::TTransactionBase;
-using NTabletFlatExecutor::TTransactionContext;
-
-struct TTxMediator::TTxConfigure : public TTransactionBase<TTxMediator> {
+#include "mediator_impl.h"
+
+namespace NKikimr {
+namespace NTxMediator {
+
+using NTabletFlatExecutor::TTransactionBase;
+using NTabletFlatExecutor::TTransactionContext;
+
+struct TTxMediator::TTxConfigure : public TTransactionBase<TTxMediator> {
TActorId AckTo;
- ui64 Version;
+ ui64 Version;
TVector<TCoordinatorId> Coordinators;
- ui32 TimeCastBuketsPerMediator;
- TAutoPtr<TEvSubDomain::TEvConfigureStatus> Respond;
- bool ConfigurationApplied;
-
+ ui32 TimeCastBuketsPerMediator;
+ TAutoPtr<TEvSubDomain::TEvConfigureStatus> Respond;
+ bool ConfigurationApplied;
+
TTxConfigure(TSelf *mediator, TActorId ackTo, ui64 version, const TVector<TCoordinatorId>& coordinators, ui32 timeCastBuckets)
- : TBase(mediator)
- , AckTo(ackTo)
- , Version(version)
- , Coordinators(coordinators)
- , TimeCastBuketsPerMediator(timeCastBuckets)
- , ConfigurationApplied(false)
- {
- Y_VERIFY(TimeCastBuketsPerMediator);
- }
-
- TTxType GetTxType() const override { return TXTYPE_INIT; }
-
- bool Execute(TTransactionContext &txc, const TActorContext&) override {
- NIceDb::TNiceDb db(txc.DB);
-
- auto rowset = db.Table<Schema::DomainConfiguration>().Range().Select();
-
- if (!rowset.IsReady())
- return false;
-
- ui32 curVersion = 0;
+ : TBase(mediator)
+ , AckTo(ackTo)
+ , Version(version)
+ , Coordinators(coordinators)
+ , TimeCastBuketsPerMediator(timeCastBuckets)
+ , ConfigurationApplied(false)
+ {
+ Y_VERIFY(TimeCastBuketsPerMediator);
+ }
+
+ TTxType GetTxType() const override { return TXTYPE_INIT; }
+
+ bool Execute(TTransactionContext &txc, const TActorContext&) override {
+ NIceDb::TNiceDb db(txc.DB);
+
+ auto rowset = db.Table<Schema::DomainConfiguration>().Range().Select();
+
+ if (!rowset.IsReady())
+ return false;
+
+ ui32 curVersion = 0;
TVector<TCoordinatorId> curCoordinators;
- ui32 curBuckets = 0;
-
- while (!rowset.EndOfSet()) {
- const ui64 ver = rowset.GetValue<Schema::DomainConfiguration::Version>();
+ ui32 curBuckets = 0;
+
+ while (!rowset.EndOfSet()) {
+ const ui64 ver = rowset.GetValue<Schema::DomainConfiguration::Version>();
TVector<TCoordinatorId> coordinators = rowset.GetValue<Schema::DomainConfiguration::Coordinators>();
- ui32 buckets = rowset.GetValue<Schema::DomainConfiguration::TimeCastBuckets>();
-
- if (ver >= curVersion) {
- curVersion = ver;
- curCoordinators.swap(coordinators);
- curBuckets = buckets;
- }
-
- if (!rowset.Next())
- return false;
- }
-
- if (curVersion == 0) {
- Respond = new TEvSubDomain::TEvConfigureStatus(NKikimrTx::TEvSubDomainConfigurationAck::SUCCESS, Self->TabletID());
- db.Table<Schema::DomainConfiguration>().Key(Version).Update(
- NIceDb::TUpdate<Schema::DomainConfiguration::Coordinators>(Coordinators),
- NIceDb::TUpdate<Schema::DomainConfiguration::TimeCastBuckets>(TimeCastBuketsPerMediator));
- ConfigurationApplied = true;
- } else if (curVersion == Version && curCoordinators == Coordinators && curBuckets == TimeCastBuketsPerMediator) {
- Respond = new TEvSubDomain::TEvConfigureStatus(NKikimrTx::TEvSubDomainConfigurationAck::ALREADY, Self->TabletID());
- } else {
- Respond = new TEvSubDomain::TEvConfigureStatus(NKikimrTx::TEvSubDomainConfigurationAck::REJECT, Self->TabletID());
- }
-
-
- return true;
- }
-
- void Complete(const TActorContext &ctx) override {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR,
- "tablet# " << Self->TabletID() <<
- " version# " << Version <<
- " TTxConfigure Complete");
- if (ConfigurationApplied)
- Self->Execute(Self->CreateTxInit(), ctx);
-
- if (AckTo)
- ctx.Send(AckTo, Respond.Release());
- }
-};
-
+ ui32 buckets = rowset.GetValue<Schema::DomainConfiguration::TimeCastBuckets>();
+
+ if (ver >= curVersion) {
+ curVersion = ver;
+ curCoordinators.swap(coordinators);
+ curBuckets = buckets;
+ }
+
+ if (!rowset.Next())
+ return false;
+ }
+
+ if (curVersion == 0) {
+ Respond = new TEvSubDomain::TEvConfigureStatus(NKikimrTx::TEvSubDomainConfigurationAck::SUCCESS, Self->TabletID());
+ db.Table<Schema::DomainConfiguration>().Key(Version).Update(
+ NIceDb::TUpdate<Schema::DomainConfiguration::Coordinators>(Coordinators),
+ NIceDb::TUpdate<Schema::DomainConfiguration::TimeCastBuckets>(TimeCastBuketsPerMediator));
+ ConfigurationApplied = true;
+ } else if (curVersion == Version && curCoordinators == Coordinators && curBuckets == TimeCastBuketsPerMediator) {
+ Respond = new TEvSubDomain::TEvConfigureStatus(NKikimrTx::TEvSubDomainConfigurationAck::ALREADY, Self->TabletID());
+ } else {
+ Respond = new TEvSubDomain::TEvConfigureStatus(NKikimrTx::TEvSubDomainConfigurationAck::REJECT, Self->TabletID());
+ }
+
+
+ return true;
+ }
+
+ void Complete(const TActorContext &ctx) override {
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR,
+ "tablet# " << Self->TabletID() <<
+ " version# " << Version <<
+ " TTxConfigure Complete");
+ if (ConfigurationApplied)
+ Self->Execute(Self->CreateTxInit(), ctx);
+
+ if (AckTo)
+ ctx.Send(AckTo, Respond.Release());
+ }
+};
+
ITransaction* TTxMediator::CreateTxConfigure(TActorId ackTo, ui64 version, const TVector<TCoordinatorId> &coordinators, ui32 timeCastBuckets) {
- return new TTxMediator::TTxConfigure(this, ackTo, version, coordinators, timeCastBuckets);
-}
-
-}
-}
+ return new TTxMediator::TTxConfigure(this, ackTo, version, coordinators, timeCastBuckets);
+}
+
+}
+}
diff --git a/ydb/core/tx/mediator/mediator__init.cpp b/ydb/core/tx/mediator/mediator__init.cpp
index 222d061f7f0..51c566699c0 100644
--- a/ydb/core/tx/mediator/mediator__init.cpp
+++ b/ydb/core/tx/mediator/mediator__init.cpp
@@ -1,101 +1,101 @@
-#include "mediator_impl.h"
-
+#include "mediator_impl.h"
+
#include <ydb/core/base/appdata.h>
-
-namespace NKikimr {
-namespace NTxMediator {
-
-using NTabletFlatExecutor::TTransactionBase;
-using NTabletFlatExecutor::TTransactionContext;
-
-struct TTxMediator::TTxInit : public TTransactionBase<TTxMediator> {
- ui64 Version;
+
+namespace NKikimr {
+namespace NTxMediator {
+
+using NTabletFlatExecutor::TTransactionBase;
+using NTabletFlatExecutor::TTransactionContext;
+
+struct TTxMediator::TTxInit : public TTransactionBase<TTxMediator> {
+ ui64 Version;
TVector<TCoordinatorId> Coordinators;
- ui32 TimeCastBuketsPerMediator;
-
- TTxInit(TSelf *mediator)
- : TBase(mediator)
- , Version(0)
- , TimeCastBuketsPerMediator(0)
- {}
-
- TTxType GetTxType() const override { return TXTYPE_INIT; }
-
- bool Execute(TTransactionContext &txc, const TActorContext&) override {
- NIceDb::TNiceDb db(txc.DB);
-
- auto rowset = db.Table<Schema::DomainConfiguration>().Range().Select();
-
- if (!rowset.IsReady())
- return false;
-
- while (!rowset.EndOfSet()) {
- const ui64 ver = rowset.GetValue<Schema::DomainConfiguration::Version>();
+ ui32 TimeCastBuketsPerMediator;
+
+ TTxInit(TSelf *mediator)
+ : TBase(mediator)
+ , Version(0)
+ , TimeCastBuketsPerMediator(0)
+ {}
+
+ TTxType GetTxType() const override { return TXTYPE_INIT; }
+
+ bool Execute(TTransactionContext &txc, const TActorContext&) override {
+ NIceDb::TNiceDb db(txc.DB);
+
+ auto rowset = db.Table<Schema::DomainConfiguration>().Range().Select();
+
+ if (!rowset.IsReady())
+ return false;
+
+ while (!rowset.EndOfSet()) {
+ const ui64 ver = rowset.GetValue<Schema::DomainConfiguration::Version>();
TVector<TCoordinatorId> coordinators = rowset.GetValue<Schema::DomainConfiguration::Coordinators>();
- ui32 buckets = rowset.GetValue<Schema::DomainConfiguration::TimeCastBuckets>();
-
- if (ver >= Version) {
- Version = ver;
- Coordinators.swap(coordinators);
- TimeCastBuketsPerMediator = buckets;
- }
-
- if (!rowset.Next())
- return false;
- }
-
- return true;
- }
-
- bool IsTabletInStaticDomain(const TAppData *appdata) {
- const ui32 selfDomain = appdata->DomainsInfo->GetDomainUidByTabletId(Self->TabletID());
- Y_VERIFY(selfDomain != appdata->DomainsInfo->BadDomainId);
- const auto& domain = appdata->DomainsInfo->GetDomain(selfDomain);
-
- for (auto domainMediatorId: domain.Mediators) {
- if (Self->TabletID() == domainMediatorId) {
- return true;
- }
- }
-
- return false;
- }
-
- void Complete(const TActorContext &ctx) override {
- if (Coordinators.size()) {
- LOG_INFO_S(ctx, NKikimrServices::TX_MEDIATOR
- , "tablet# " << Self->TabletID()
- << " CreateTxInit Complete");
- Self->Config.CoordinatorsVersion = Version;
- Self->Config.CoordinatorSeletor = new TCoordinators(std::move(Coordinators));
- Self->Config.Bukets = new TTimeCastBuckets(TimeCastBuketsPerMediator);
- Self->InitSelfState(ctx);
- Self->Become(&TThis::StateWork);
- Self->SignalTabletActive(ctx);
- return;
- }
-
- TAppData* appData = AppData(ctx);
- if (IsTabletInStaticDomain(appData)) {
- LOG_INFO_S(ctx, NKikimrServices::TX_MEDIATOR,
- "tablet# " << Self->TabletID() <<
- " CreateTxInit initialize himself");
- Self->DoConfigure(*CreateDomainConfigurationFromStatic(appData, Self->TabletID()), ctx);
- return;
- }
-
- Self->Become(&TThis::StateSync);
- Self->SignalTabletActive(ctx);
-
- LOG_INFO_S(ctx, NKikimrServices::TX_MEDIATOR,
- "tablet# " << Self->TabletID() <<
- " CreateTxInit wait TEvMediatorConfiguration for switching to StateWork from external");
- }
-};
-
+ ui32 buckets = rowset.GetValue<Schema::DomainConfiguration::TimeCastBuckets>();
+
+ if (ver >= Version) {
+ Version = ver;
+ Coordinators.swap(coordinators);
+ TimeCastBuketsPerMediator = buckets;
+ }
+
+ if (!rowset.Next())
+ return false;
+ }
+
+ return true;
+ }
+
+ bool IsTabletInStaticDomain(const TAppData *appdata) {
+ const ui32 selfDomain = appdata->DomainsInfo->GetDomainUidByTabletId(Self->TabletID());
+ Y_VERIFY(selfDomain != appdata->DomainsInfo->BadDomainId);
+ const auto& domain = appdata->DomainsInfo->GetDomain(selfDomain);
+
+ for (auto domainMediatorId: domain.Mediators) {
+ if (Self->TabletID() == domainMediatorId) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ void Complete(const TActorContext &ctx) override {
+ if (Coordinators.size()) {
+ LOG_INFO_S(ctx, NKikimrServices::TX_MEDIATOR
+ , "tablet# " << Self->TabletID()
+ << " CreateTxInit Complete");
+ Self->Config.CoordinatorsVersion = Version;
+ Self->Config.CoordinatorSeletor = new TCoordinators(std::move(Coordinators));
+ Self->Config.Bukets = new TTimeCastBuckets(TimeCastBuketsPerMediator);
+ Self->InitSelfState(ctx);
+ Self->Become(&TThis::StateWork);
+ Self->SignalTabletActive(ctx);
+ return;
+ }
+
+ TAppData* appData = AppData(ctx);
+ if (IsTabletInStaticDomain(appData)) {
+ LOG_INFO_S(ctx, NKikimrServices::TX_MEDIATOR,
+ "tablet# " << Self->TabletID() <<
+ " CreateTxInit initialize himself");
+ Self->DoConfigure(*CreateDomainConfigurationFromStatic(appData, Self->TabletID()), ctx);
+ return;
+ }
+
+ Self->Become(&TThis::StateSync);
+ Self->SignalTabletActive(ctx);
+
+ LOG_INFO_S(ctx, NKikimrServices::TX_MEDIATOR,
+ "tablet# " << Self->TabletID() <<
+ " CreateTxInit wait TEvMediatorConfiguration for switching to StateWork from external");
+ }
+};
+
ITransaction* TTxMediator::CreateTxInit() {
- return new TTxMediator::TTxInit(this);
-}
-
-}
-}
+ return new TTxMediator::TTxInit(this);
+}
+
+}
+}
diff --git a/ydb/core/tx/mediator/mediator__schema.cpp b/ydb/core/tx/mediator/mediator__schema.cpp
index 573d4dbcb50..8279ad5b055 100644
--- a/ydb/core/tx/mediator/mediator__schema.cpp
+++ b/ydb/core/tx/mediator/mediator__schema.cpp
@@ -1,33 +1,33 @@
-#include "mediator_impl.h"
-
-namespace NKikimr {
-namespace NTxMediator {
-
-using NTabletFlatExecutor::TTransactionBase;
-using NTabletFlatExecutor::TTransactionContext;
-
-struct TTxMediator::TTxSchema : public TTransactionBase<TTxMediator> {
- TTxSchema(TSelf *mediator)
- : TBase(mediator)
- {}
-
- TTxType GetTxType() const override { return TXTYPE_INIT; }
-
- bool Execute(TTransactionContext &txc, const TActorContext&) override {
- NIceDb::TNiceDb(txc.DB).Materialize<Schema>();
- return true;
- }
-
- void Complete(const TActorContext &ctx) override {
- LOG_INFO_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << Self->TabletID()
- << " TTxSchema Complete");
- Self->Execute(Self->CreateTxUpgrade(), ctx);
- }
-};
-
+#include "mediator_impl.h"
+
+namespace NKikimr {
+namespace NTxMediator {
+
+using NTabletFlatExecutor::TTransactionBase;
+using NTabletFlatExecutor::TTransactionContext;
+
+struct TTxMediator::TTxSchema : public TTransactionBase<TTxMediator> {
+ TTxSchema(TSelf *mediator)
+ : TBase(mediator)
+ {}
+
+ TTxType GetTxType() const override { return TXTYPE_INIT; }
+
+ bool Execute(TTransactionContext &txc, const TActorContext&) override {
+ NIceDb::TNiceDb(txc.DB).Materialize<Schema>();
+ return true;
+ }
+
+ void Complete(const TActorContext &ctx) override {
+ LOG_INFO_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << Self->TabletID()
+ << " TTxSchema Complete");
+ Self->Execute(Self->CreateTxUpgrade(), ctx);
+ }
+};
+
ITransaction* TTxMediator::CreateTxSchema() {
- return new TTxSchema(this);
-}
-
-}
-}
+ return new TTxSchema(this);
+}
+
+}
+}
diff --git a/ydb/core/tx/mediator/mediator__schema_upgrade.cpp b/ydb/core/tx/mediator/mediator__schema_upgrade.cpp
index b5cf21ba19c..7eb7228b869 100644
--- a/ydb/core/tx/mediator/mediator__schema_upgrade.cpp
+++ b/ydb/core/tx/mediator/mediator__schema_upgrade.cpp
@@ -1,64 +1,64 @@
-#include "mediator_impl.h"
-
-namespace NKikimr {
-namespace NTxMediator {
-
-using NTabletFlatExecutor::TTransactionBase;
-using NTabletFlatExecutor::TTransactionContext;
-
-struct TTxMediator::TTxUpgrade : public TTransactionBase<TTxMediator> {
- bool UpgradeFail;
-
- TTxUpgrade(TSelf *mediator)
- : TBase(mediator)
- , UpgradeFail(false)
- {}
-
- TTxType GetTxType() const override { return TXTYPE_INIT; }
-
- bool Execute(TTransactionContext &txc, const TActorContext& ctx) override {
- NIceDb::TNiceDb db(txc.DB);
-
-
- auto row = db.Table<Schema::State>().Key(Schema::State::DatabaseVersion).Select<Schema::State::StateValue>();
- if (!row.IsReady()) {
- return false;
- }
-
- if (!row.IsValid()) {
- db.Table<Schema::State>().Key(Schema::State::DatabaseVersion).Update(NIceDb::TUpdate<Schema::State::StateValue>(Schema::CurrentVersion));
- return true;
- }
-
- Schema::State::StateValue::Type databaseVersion = row.GetValue<Schema::State::StateValue>();
- if (Schema::CurrentVersion == databaseVersion) {
- return true;
- }
-
- UpgradeFail = true;
- LOG_CRIT_S(ctx, NKikimrServices::TX_MEDIATOR,
- "tablet# " << Self->Tablet() <<
- " SEND to self TEvents::TEvPoisonPill" <<
- " databaseVersion# " << databaseVersion <<
- " CurrentDataBaseVersion# " << Schema::CurrentVersion <<
- " reason# no realisation for upgrade scheme present");
- return true;
- }
-
- void Complete(const TActorContext &ctx) override {
- if (UpgradeFail) {
- Self->Become(&TSelf::StateBroken);
- ctx.Send(Self->Tablet(), new TEvents::TEvPoisonPill);
- return;
- }
-
- Self->Execute(Self->CreateTxInit(), ctx);
- }
-};
-
+#include "mediator_impl.h"
+
+namespace NKikimr {
+namespace NTxMediator {
+
+using NTabletFlatExecutor::TTransactionBase;
+using NTabletFlatExecutor::TTransactionContext;
+
+struct TTxMediator::TTxUpgrade : public TTransactionBase<TTxMediator> {
+ bool UpgradeFail;
+
+ TTxUpgrade(TSelf *mediator)
+ : TBase(mediator)
+ , UpgradeFail(false)
+ {}
+
+ TTxType GetTxType() const override { return TXTYPE_INIT; }
+
+ bool Execute(TTransactionContext &txc, const TActorContext& ctx) override {
+ NIceDb::TNiceDb db(txc.DB);
+
+
+ auto row = db.Table<Schema::State>().Key(Schema::State::DatabaseVersion).Select<Schema::State::StateValue>();
+ if (!row.IsReady()) {
+ return false;
+ }
+
+ if (!row.IsValid()) {
+ db.Table<Schema::State>().Key(Schema::State::DatabaseVersion).Update(NIceDb::TUpdate<Schema::State::StateValue>(Schema::CurrentVersion));
+ return true;
+ }
+
+ Schema::State::StateValue::Type databaseVersion = row.GetValue<Schema::State::StateValue>();
+ if (Schema::CurrentVersion == databaseVersion) {
+ return true;
+ }
+
+ UpgradeFail = true;
+ LOG_CRIT_S(ctx, NKikimrServices::TX_MEDIATOR,
+ "tablet# " << Self->Tablet() <<
+ " SEND to self TEvents::TEvPoisonPill" <<
+ " databaseVersion# " << databaseVersion <<
+ " CurrentDataBaseVersion# " << Schema::CurrentVersion <<
+ " reason# no realisation for upgrade scheme present");
+ return true;
+ }
+
+ void Complete(const TActorContext &ctx) override {
+ if (UpgradeFail) {
+ Self->Become(&TSelf::StateBroken);
+ ctx.Send(Self->Tablet(), new TEvents::TEvPoisonPill);
+ return;
+ }
+
+ Self->Execute(Self->CreateTxInit(), ctx);
+ }
+};
+
ITransaction* TTxMediator::CreateTxUpgrade() {
- return new TTxUpgrade(this);
-}
-
-}
-}
+ return new TTxUpgrade(this);
+}
+
+}
+}
diff --git a/ydb/core/tx/mediator/mediator_impl.cpp b/ydb/core/tx/mediator/mediator_impl.cpp
index 6536a695eab..c4b202b8221 100644
--- a/ydb/core/tx/mediator/mediator_impl.cpp
+++ b/ydb/core/tx/mediator/mediator_impl.cpp
@@ -1,321 +1,321 @@
-#include "mediator_impl.h"
-
+#include "mediator_impl.h"
+
#include <ydb/core/engine/minikql/flat_local_tx_factory.h>
-namespace NKikimr {
-namespace NTxMediator {
-
-const ui32 TTxMediator::Schema::CurrentVersion = 0;
-
-void TTxMediator::Die(const TActorContext &ctx) {
- if (!!ExecQueue) {
- ctx.Send(ExecQueue, new TEvents::TEvPoisonPill());
+namespace NKikimr {
+namespace NTxMediator {
+
+const ui32 TTxMediator::Schema::CurrentVersion = 0;
+
+void TTxMediator::Die(const TActorContext &ctx) {
+ if (!!ExecQueue) {
+ ctx.Send(ExecQueue, new TEvents::TEvPoisonPill());
ExecQueue = TActorId();
- }
-
- return TActor::Die(ctx);
-}
-
-void TTxMediator::OnActivateExecutor(const TActorContext &ctx) {
- Y_UNUSED(ctx);
-
- Become(&TThis::StateInit);
- Execute(CreateTxSchema(), ctx);
-}
-
-void TTxMediator::OnDetach(const TActorContext &ctx) {
- return Die(ctx);
-}
-
-void TTxMediator::OnTabletDead(TEvTablet::TEvTabletDead::TPtr &ev, const TActorContext &ctx) {
- Y_UNUSED(ev);
- return Die(ctx);
-}
-
-void TTxMediator::DefaultSignalTabletActive(const TActorContext &ctx) {
- Y_UNUSED(ctx); //unactivate incomming tablet's pipes until StateSync
-}
-
-ui64 TTxMediator::SubjectiveTime() {
- return TAppData::TimeProvider->Now().MilliSeconds();
-}
-
-void TTxMediator::InitSelfState(const TActorContext &ctx) {
- Y_VERIFY(Config.Bukets);
- ExecQueue = ctx.ExecutorThread.RegisterActor(CreateTxMediatorExecQueue(ctx.SelfID, TabletID(), 1, Config.Bukets->Buckets()));
- Y_VERIFY(!!ExecQueue);
-
- Y_VERIFY(Config.CoordinatorSeletor);
- Y_VERIFY(Config.CoordinatorSeletor->List().size());
-
- for (ui64 it: Config.CoordinatorSeletor->List()) {
- TCoordinatorInfo &x = VolatileState.Domain[it];
- Y_UNUSED(x);
- }
-
- ReplyEnqueuedSyncs(ctx);
- ReplyEnqueuedWatch(ctx);
-}
-
-void TTxMediator::ReplyEnqueuedSyncs(const TActorContext &ctx) {
- for (auto x: CoordinatorsSyncEnqueued) {
- ReplySync(x.first, x.second, ctx);
- }
- CoordinatorsSyncEnqueued.clear();
-}
-
-void TTxMediator::ReplyEnqueuedWatch(const TActorContext &ctx) {
- for (auto &x: WatchEnqueued) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR,
- "tablet# " << TabletID() <<
- " ReplyEnqueuedWatch" <<
- " SEND EvWatch to# " << ExecQueue.ToString() << " ExecQueue");
- ctx.Send(x->Forward(ExecQueue));
- }
- WatchEnqueued.clear();
-}
-
+ }
+
+ return TActor::Die(ctx);
+}
+
+void TTxMediator::OnActivateExecutor(const TActorContext &ctx) {
+ Y_UNUSED(ctx);
+
+ Become(&TThis::StateInit);
+ Execute(CreateTxSchema(), ctx);
+}
+
+void TTxMediator::OnDetach(const TActorContext &ctx) {
+ return Die(ctx);
+}
+
+void TTxMediator::OnTabletDead(TEvTablet::TEvTabletDead::TPtr &ev, const TActorContext &ctx) {
+ Y_UNUSED(ev);
+ return Die(ctx);
+}
+
+void TTxMediator::DefaultSignalTabletActive(const TActorContext &ctx) {
+ Y_UNUSED(ctx); //unactivate incomming tablet's pipes until StateSync
+}
+
+ui64 TTxMediator::SubjectiveTime() {
+ return TAppData::TimeProvider->Now().MilliSeconds();
+}
+
+void TTxMediator::InitSelfState(const TActorContext &ctx) {
+ Y_VERIFY(Config.Bukets);
+ ExecQueue = ctx.ExecutorThread.RegisterActor(CreateTxMediatorExecQueue(ctx.SelfID, TabletID(), 1, Config.Bukets->Buckets()));
+ Y_VERIFY(!!ExecQueue);
+
+ Y_VERIFY(Config.CoordinatorSeletor);
+ Y_VERIFY(Config.CoordinatorSeletor->List().size());
+
+ for (ui64 it: Config.CoordinatorSeletor->List()) {
+ TCoordinatorInfo &x = VolatileState.Domain[it];
+ Y_UNUSED(x);
+ }
+
+ ReplyEnqueuedSyncs(ctx);
+ ReplyEnqueuedWatch(ctx);
+}
+
+void TTxMediator::ReplyEnqueuedSyncs(const TActorContext &ctx) {
+ for (auto x: CoordinatorsSyncEnqueued) {
+ ReplySync(x.first, x.second, ctx);
+ }
+ CoordinatorsSyncEnqueued.clear();
+}
+
+void TTxMediator::ReplyEnqueuedWatch(const TActorContext &ctx) {
+ for (auto &x: WatchEnqueued) {
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR,
+ "tablet# " << TabletID() <<
+ " ReplyEnqueuedWatch" <<
+ " SEND EvWatch to# " << ExecQueue.ToString() << " ExecQueue");
+ ctx.Send(x->Forward(ExecQueue));
+ }
+ WatchEnqueued.clear();
+}
+
void TTxMediator::ReplySync(const TActorId &sender, const NKikimrTx::TEvCoordinatorSync &record, const TActorContext &ctx) {
- Y_VERIFY(record.GetMediatorID() == TabletID());
-
- LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID()
- << " SEND EvCoordinatorSyncResult to# " << sender.ToString() << " Cookie# " << record.GetCookie()
- << " CompleteStep# " << VolatileState.CompleteStep
- << " LatestKnownStep# " << VolatileState.LatestKnownStep << " SubjectiveTime# " << SubjectiveTime()
- << " Coordinator# " << record.GetCoordinatorID());
-
- ctx.Send(sender,
- new TEvTxCoordinator::TEvCoordinatorSyncResult(
- record.GetCookie(),
- VolatileState.CompleteStep,
- VolatileState.LatestKnownStep,
- SubjectiveTime(),
- TabletID(),
- record.GetCoordinatorID()
- ));
-}
-
-void TTxMediator::HandleEnqueue(TEvTxCoordinator::TEvCoordinatorSync::TPtr &ev, const TActorContext &ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID() << " HANDLE Enqueue EvCoordinatorSync ");
-
- CoordinatorsSyncEnqueued[ev->Sender] = ev->Get()->Record;
-}
-
-void TTxMediator::HandleEnqueue(TEvMediatorTimecast::TEvWatch::TPtr &ev, const TActorContext &ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID() << " HANDLE Enqueue EvWatch");
- WatchEnqueued.push_back(ev);
-}
-
+ Y_VERIFY(record.GetMediatorID() == TabletID());
+
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID()
+ << " SEND EvCoordinatorSyncResult to# " << sender.ToString() << " Cookie# " << record.GetCookie()
+ << " CompleteStep# " << VolatileState.CompleteStep
+ << " LatestKnownStep# " << VolatileState.LatestKnownStep << " SubjectiveTime# " << SubjectiveTime()
+ << " Coordinator# " << record.GetCoordinatorID());
+
+ ctx.Send(sender,
+ new TEvTxCoordinator::TEvCoordinatorSyncResult(
+ record.GetCookie(),
+ VolatileState.CompleteStep,
+ VolatileState.LatestKnownStep,
+ SubjectiveTime(),
+ TabletID(),
+ record.GetCoordinatorID()
+ ));
+}
+
+void TTxMediator::HandleEnqueue(TEvTxCoordinator::TEvCoordinatorSync::TPtr &ev, const TActorContext &ctx) {
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID() << " HANDLE Enqueue EvCoordinatorSync ");
+
+ CoordinatorsSyncEnqueued[ev->Sender] = ev->Get()->Record;
+}
+
+void TTxMediator::HandleEnqueue(TEvMediatorTimecast::TEvWatch::TPtr &ev, const TActorContext &ctx) {
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID() << " HANDLE Enqueue EvWatch");
+ WatchEnqueued.push_back(ev);
+}
+
void TTxMediator::DoConfigure(const TEvSubDomain::TEvConfigure &ev, const TActorContext &ctx, const TActorId &ackTo) {
- const TEvSubDomain::TEvConfigure::ProtoRecordType &record = ev.Record;
- if (0 == record.CoordinatorsSize() || 0 == record.GetTimeCastBucketsPerMediator()) {
- LOG_ERROR_S(ctx, NKikimrServices::TX_MEDIATOR
+ const TEvSubDomain::TEvConfigure::ProtoRecordType &record = ev.Record;
+ if (0 == record.CoordinatorsSize() || 0 == record.GetTimeCastBucketsPerMediator()) {
+ LOG_ERROR_S(ctx, NKikimrServices::TX_MEDIATOR
, "tablet# " << TabletID() << " actor# " << SelfId()
- << " Apply TEvMediatorConfiguration Version# " << record.GetVersion()
- << " recive empty coordinators set");
- Y_FAIL("empty coordinators set");
- return;
- }
-
+ << " Apply TEvMediatorConfiguration Version# " << record.GetVersion()
+ << " recive empty coordinators set");
+ Y_FAIL("empty coordinators set");
+ return;
+ }
+
TVector<TCoordinatorId> coordinators;
- coordinators.reserve(record.CoordinatorsSize());
-
- for (auto id: record.GetCoordinators()) {
- Y_VERIFY(TabletID() != id, "found self id in coordinators list");
- coordinators.push_back(id);
- }
-
- Execute(CreateTxConfigure(ackTo, record.GetVersion(), coordinators, record.GetTimeCastBucketsPerMediator()), ctx);
-}
-
-void TTxMediator::Handle(TEvSubDomain::TEvConfigure::TPtr &ev, const TActorContext &ctx) {
- const TEvSubDomain::TEvConfigure::ProtoRecordType &record = ev->Get()->Record;
- LOG_NOTICE_S(ctx, NKikimrServices::TX_MEDIATOR
+ coordinators.reserve(record.CoordinatorsSize());
+
+ for (auto id: record.GetCoordinators()) {
+ Y_VERIFY(TabletID() != id, "found self id in coordinators list");
+ coordinators.push_back(id);
+ }
+
+ Execute(CreateTxConfigure(ackTo, record.GetVersion(), coordinators, record.GetTimeCastBucketsPerMediator()), ctx);
+}
+
+void TTxMediator::Handle(TEvSubDomain::TEvConfigure::TPtr &ev, const TActorContext &ctx) {
+ const TEvSubDomain::TEvConfigure::ProtoRecordType &record = ev->Get()->Record;
+ LOG_NOTICE_S(ctx, NKikimrServices::TX_MEDIATOR
, "tablet# " << TabletID() << " actor# " << SelfId()
- << " HANDLE TEvMediatorConfiguration Version# " << record.GetVersion());
-
- DoConfigure(*ev->Get(), ctx, ev->Sender);
-}
-
-void TTxMediator::Handle(TEvTxCoordinator::TEvCoordinatorSync::TPtr &ev, const TActorContext &ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID() << " HANDLE EvCoordinatorSync ");
- const NKikimrTx::TEvCoordinatorSync &record = ev->Get()->Record;
- ReplySync(ev->Sender, record, ctx);
-}
-
+ << " HANDLE TEvMediatorConfiguration Version# " << record.GetVersion());
+
+ DoConfigure(*ev->Get(), ctx, ev->Sender);
+}
+
+void TTxMediator::Handle(TEvTxCoordinator::TEvCoordinatorSync::TPtr &ev, const TActorContext &ctx) {
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID() << " HANDLE EvCoordinatorSync ");
+ const NKikimrTx::TEvCoordinatorSync &record = ev->Get()->Record;
+ ReplySync(ev->Sender, record, ctx);
+}
+
void TTxMediator::ReplyStep(const TActorId &sender, NKikimrTx::TEvCoordinatorStepResult::EStatus status, const NKikimrTx::TEvCoordinatorStep &request, const TActorContext &ctx) {
-// LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID() << " SEND EvCoordinatorStepResult"
-// << " to# " << sender.ToString() << " sender status# " << status << " step# " << request.GetStep()
-// << " CompleteStep# " << VolatileState.CompleteStep
-// << " LatestKnownStep# " << VolatileState.LatestKnownStep << " SubjectiveTime# " << SubjectiveTime()
-// << " Coordinator# " << request.GetCoordinatorID());
- ctx.Send(sender,
- new TEvTxCoordinator::TEvCoordinatorStepResult(
- status,
- request.GetStep(),
- VolatileState.CompleteStep,
- VolatileState.LatestKnownStep,
- SubjectiveTime(),
- TabletID(),
- request.GetCoordinatorID()
- ));
-}
-
-ui64 TTxMediator::FindProgressCandidate() {
- // in perfect case here could be priority queue, but who cares? (domain coordinators count is bounded and steps are not so frequent).
- ui64 candidate = Max<ui64>();
+// LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID() << " SEND EvCoordinatorStepResult"
+// << " to# " << sender.ToString() << " sender status# " << status << " step# " << request.GetStep()
+// << " CompleteStep# " << VolatileState.CompleteStep
+// << " LatestKnownStep# " << VolatileState.LatestKnownStep << " SubjectiveTime# " << SubjectiveTime()
+// << " Coordinator# " << request.GetCoordinatorID());
+ ctx.Send(sender,
+ new TEvTxCoordinator::TEvCoordinatorStepResult(
+ status,
+ request.GetStep(),
+ VolatileState.CompleteStep,
+ VolatileState.LatestKnownStep,
+ SubjectiveTime(),
+ TabletID(),
+ request.GetCoordinatorID()
+ ));
+}
+
+ui64 TTxMediator::FindProgressCandidate() {
+ // in perfect case here could be priority queue, but who cares? (domain coordinators count is bounded and steps are not so frequent).
+ ui64 candidate = Max<ui64>();
for (TMap<ui64, TCoordinatorInfo>::iterator it = VolatileState.Domain.begin(), end = VolatileState.Domain.end(); it != end; ++it) {
- const TCoordinatorInfo &info = it->second;
- if (info.Queue.empty()) // could not progress w/o info from any domain coordinator
- return Max<ui64>();
-
- TCoordinatorStep *head = info.Queue.front().Get();
- if (head->Step < candidate)
- candidate = head->Step;
- }
-
- return candidate;
-}
-
-void TTxMediator::Progress(ui64 to, const TActorContext &ctx) {
- const ui64 from = VolatileState.CompleteStep;
-
- TAutoPtr<TMediateStep> mds(new TMediateStep(from, to));
-
- ui64 txCount = 0;
+ const TCoordinatorInfo &info = it->second;
+ if (info.Queue.empty()) // could not progress w/o info from any domain coordinator
+ return Max<ui64>();
+
+ TCoordinatorStep *head = info.Queue.front().Get();
+ if (head->Step < candidate)
+ candidate = head->Step;
+ }
+
+ return candidate;
+}
+
+void TTxMediator::Progress(ui64 to, const TActorContext &ctx) {
+ const ui64 from = VolatileState.CompleteStep;
+
+ TAutoPtr<TMediateStep> mds(new TMediateStep(from, to));
+
+ ui64 txCount = 0;
for (TMap<ui64, TCoordinatorInfo>::iterator it = VolatileState.Domain.begin(), end = VolatileState.Domain.end(); it != end; ++it) {
- TCoordinatorInfo &info = it->second;
- Y_VERIFY(!info.Queue.empty() && info.Queue.front()->Step >= to);
-
- if (info.Queue.front()->Step != to)
- continue;
-
- TAutoPtr<TCoordinatorStep> step = info.Queue.front();
- info.Queue.pop_front();
- info.KnownPrevStep = step->Step;
-
- txCount += step->Transactions.size();
- for (TTx &tx : step->Transactions)
- tx.AckTo = info.AckTo;
-
- mds->Steps.push_back(step);
- }
-
- if (txCount) {
- // push steps to execution
- LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID() << " SEND EvCommitStep to# " <<
- ExecQueue.ToString() << " ExecQueue " << mds->ToString() << " marker# M0");
- }
- ctx.Send(ExecQueue, new TEvTxMediator::TEvCommitStep(mds));
-
- VolatileState.CompleteStep = to;
-}
-
-void TTxMediator::CheckProgress(const TActorContext &ctx) {
- ui64 candidate = FindProgressCandidate();
- while (candidate != Max<ui64>()) {
- Progress(candidate, ctx);
- candidate = FindProgressCandidate();
- }
-}
-
+ TCoordinatorInfo &info = it->second;
+ Y_VERIFY(!info.Queue.empty() && info.Queue.front()->Step >= to);
+
+ if (info.Queue.front()->Step != to)
+ continue;
+
+ TAutoPtr<TCoordinatorStep> step = info.Queue.front();
+ info.Queue.pop_front();
+ info.KnownPrevStep = step->Step;
+
+ txCount += step->Transactions.size();
+ for (TTx &tx : step->Transactions)
+ tx.AckTo = info.AckTo;
+
+ mds->Steps.push_back(step);
+ }
+
+ if (txCount) {
+ // push steps to execution
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID() << " SEND EvCommitStep to# " <<
+ ExecQueue.ToString() << " ExecQueue " << mds->ToString() << " marker# M0");
+ }
+ ctx.Send(ExecQueue, new TEvTxMediator::TEvCommitStep(mds));
+
+ VolatileState.CompleteStep = to;
+}
+
+void TTxMediator::CheckProgress(const TActorContext &ctx) {
+ ui64 candidate = FindProgressCandidate();
+ while (candidate != Max<ui64>()) {
+ Progress(candidate, ctx);
+ candidate = FindProgressCandidate();
+ }
+}
+
void TTxMediator::RequestLostAcks(const TActorId &sender, const NKikimrTx::TEvCoordinatorStep &request, const TActorContext &ctx) {
- TAutoPtr<TCoordinatorStep> step(new TCoordinatorStep(request));
- LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID() << " SEND EvRequestLostAcks to# "
- << ExecQueue.ToString() << " ExecQueue step " << step->ToString());
- ctx.Send(ExecQueue, new TEvTxMediator::TEvRequestLostAcks(step, sender));
-}
-
+ TAutoPtr<TCoordinatorStep> step(new TCoordinatorStep(request));
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID() << " SEND EvRequestLostAcks to# "
+ << ExecQueue.ToString() << " ExecQueue step " << step->ToString());
+ ctx.Send(ExecQueue, new TEvTxMediator::TEvRequestLostAcks(step, sender));
+}
+
void TTxMediator::ProcessDomainStep(const TActorId &sender, const NKikimrTx::TEvCoordinatorStep &request, ui64 coordinator, TCoordinatorInfo &info, const TActorContext &ctx) {
- Y_UNUSED(coordinator);
- if (request.GetActiveCoordinatorGeneration() != info.ActiveCoordinatorGeneration) {
- if (request.GetActiveCoordinatorGeneration() < info.ActiveCoordinatorGeneration) // outdated request
- return;
- else {
- info.ActiveCoordinatorGeneration = request.GetActiveCoordinatorGeneration();
- info.AckTo = sender;
- }
- }
-
- const TStepId step = request.GetStep();
-
- if (step <= VolatileState.CompleteStep) {
- return RequestLostAcks(sender, request, ctx);
- }
-
- if (!info.Queue.empty() && info.Queue.back()->Step >= step) {
- // it is supposed that we already knew that plan step from previous connections
- // all recieved plans are immutable and order is fixed so just skip it
- ReplyStep(sender, NKikimrTx::TEvCoordinatorStepResult::ACCEPTED_DOMAIN, request, ctx);
- return;
- }
-
- info.Queue.push_back(new TCoordinatorStep(request));
-
- if (VolatileState.LatestKnownStep < step)
- VolatileState.LatestKnownStep = step;
-
- ReplyStep(sender, NKikimrTx::TEvCoordinatorStepResult::ACCEPTED_DOMAIN, request, ctx);
- CheckProgress(ctx);
-}
-
+ Y_UNUSED(coordinator);
+ if (request.GetActiveCoordinatorGeneration() != info.ActiveCoordinatorGeneration) {
+ if (request.GetActiveCoordinatorGeneration() < info.ActiveCoordinatorGeneration) // outdated request
+ return;
+ else {
+ info.ActiveCoordinatorGeneration = request.GetActiveCoordinatorGeneration();
+ info.AckTo = sender;
+ }
+ }
+
+ const TStepId step = request.GetStep();
+
+ if (step <= VolatileState.CompleteStep) {
+ return RequestLostAcks(sender, request, ctx);
+ }
+
+ if (!info.Queue.empty() && info.Queue.back()->Step >= step) {
+ // it is supposed that we already knew that plan step from previous connections
+ // all recieved plans are immutable and order is fixed so just skip it
+ ReplyStep(sender, NKikimrTx::TEvCoordinatorStepResult::ACCEPTED_DOMAIN, request, ctx);
+ return;
+ }
+
+ info.Queue.push_back(new TCoordinatorStep(request));
+
+ if (VolatileState.LatestKnownStep < step)
+ VolatileState.LatestKnownStep = step;
+
+ ReplyStep(sender, NKikimrTx::TEvCoordinatorStepResult::ACCEPTED_DOMAIN, request, ctx);
+ CheckProgress(ctx);
+}
+
void TTxMediator::ProcessForeignStep(const TActorId &sender, const NKikimrTx::TEvCoordinatorStep &request, ui64 coordinator, TCoordinatorInfo &info, const TActorContext &ctx) {
- Y_UNUSED(sender);
- Y_UNUSED(request);
- Y_UNUSED(coordinator);
- Y_UNUSED(info);
- Y_UNUSED(ctx);
-
- Y_FAIL("TODO");
-}
-
-void TTxMediator::Handle(TEvTxCoordinator::TEvCoordinatorStep::TPtr &ev, const TActorContext &ctx) {
- const NKikimrTx::TEvCoordinatorStep &record = ev->Get()->Record;
-
- Y_VERIFY(record.GetMediatorID() == TabletID());
- const ui64 coordinator = record.GetCoordinatorID();
- const ui64 step = record.GetStep();
- const ui64 transactionsCount = record.TransactionsSize();
-
- if (transactionsCount) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID()
- << " HANDLE EvCoordinatorStep coordinator# " << coordinator << " step# " << step);
-
- LOG_INFO(ctx, NKikimrServices::TX_MEDIATOR,
- "Coordinator step: Mediator [%" PRIu64 "],"
- " Coordinator [%" PRIu64 "],"
- " step# [%" PRIu64 "]"
- " transactions [%" PRIu64 "]",
- TabletID(), coordinator, step, transactionsCount);
- }
-
- // is domain?
+ Y_UNUSED(sender);
+ Y_UNUSED(request);
+ Y_UNUSED(coordinator);
+ Y_UNUSED(info);
+ Y_UNUSED(ctx);
+
+ Y_FAIL("TODO");
+}
+
+void TTxMediator::Handle(TEvTxCoordinator::TEvCoordinatorStep::TPtr &ev, const TActorContext &ctx) {
+ const NKikimrTx::TEvCoordinatorStep &record = ev->Get()->Record;
+
+ Y_VERIFY(record.GetMediatorID() == TabletID());
+ const ui64 coordinator = record.GetCoordinatorID();
+ const ui64 step = record.GetStep();
+ const ui64 transactionsCount = record.TransactionsSize();
+
+ if (transactionsCount) {
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID()
+ << " HANDLE EvCoordinatorStep coordinator# " << coordinator << " step# " << step);
+
+ LOG_INFO(ctx, NKikimrServices::TX_MEDIATOR,
+ "Coordinator step: Mediator [%" PRIu64 "],"
+ " Coordinator [%" PRIu64 "],"
+ " step# [%" PRIu64 "]"
+ " transactions [%" PRIu64 "]",
+ TabletID(), coordinator, step, transactionsCount);
+ }
+
+ // is domain?
TMap<ui64, TCoordinatorInfo>::iterator domainIt = VolatileState.Domain.find(coordinator);
- if (domainIt != VolatileState.Domain.end())
- return ProcessDomainStep(ev->Sender, record, coordinator, domainIt->second, ctx);
-
- // is foreign?
- return ProcessForeignStep(ev->Sender, record, coordinator, VolatileState.Foreign[coordinator], ctx);
-}
-
-void TTxMediator::Handle(TEvMediatorTimecast::TEvWatch::TPtr &ev, const TActorContext &ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID() << " HANDLE EvWatch");
- LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID() << " SEND EvWatch to# "
- << ExecQueue.ToString() << " ExecQueue");
- ctx.ExecutorThread.Send(ev->Forward(ExecQueue));
-}
-
-void TTxMediator::Handle(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx) {
- Y_UNUSED(ev);
- LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID() << " HANDLE TEvPoisonPill");
- Become(&TThis::StateBroken);
- ctx.Send(Tablet(), new TEvents::TEvPoisonPill);
-}
-
+ if (domainIt != VolatileState.Domain.end())
+ return ProcessDomainStep(ev->Sender, record, coordinator, domainIt->second, ctx);
+
+ // is foreign?
+ return ProcessForeignStep(ev->Sender, record, coordinator, VolatileState.Foreign[coordinator], ctx);
+}
+
+void TTxMediator::Handle(TEvMediatorTimecast::TEvWatch::TPtr &ev, const TActorContext &ctx) {
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID() << " HANDLE EvWatch");
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID() << " SEND EvWatch to# "
+ << ExecQueue.ToString() << " ExecQueue");
+ ctx.ExecutorThread.Send(ev->Forward(ExecQueue));
+}
+
+void TTxMediator::Handle(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx) {
+ Y_UNUSED(ev);
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR, "tablet# " << TabletID() << " HANDLE TEvPoisonPill");
+ Become(&TThis::StateBroken);
+ ctx.Send(Tablet(), new TEvents::TEvPoisonPill);
+}
+
TTxMediator::TTxMediator(TTabletStorageInfo *info, const TActorId &tablet)
- : TActor(&TThis::StateInit)
+ : TActor(&TThis::StateInit)
, TTabletExecutedFlat(info, tablet, new NMiniKQL::TMiniKQLFactory)
-{}
-
-}
-}
+{}
+
+}
+}
diff --git a/ydb/core/tx/mediator/mediator_impl.h b/ydb/core/tx/mediator/mediator_impl.h
index 5f912180a1e..c98bd4246b0 100644
--- a/ydb/core/tx/mediator/mediator_impl.h
+++ b/ydb/core/tx/mediator/mediator_impl.h
@@ -1,6 +1,6 @@
#pragma once
#include "defs.h"
-
+
#include <ydb/core/base/appdata.h>
#include <ydb/core/scheme_types/scheme_types.h>
#include <ydb/core/tx/coordinator/coordinator.h>
@@ -14,11 +14,11 @@
#include <ydb/core/base/tx_processing.h>
#include <ydb/core/tx/tx.h>
-
-#include <util/generic/map.h>
-
+
+#include <util/generic/map.h>
+
namespace NKikimr {
-namespace NTxMediator {
+namespace NTxMediator {
using TStepId = ui64;
using TTxId = ui64;
@@ -130,7 +130,7 @@ struct TEvTxMediator {
enum EEv {
EvCommitStep = EventSpaceBegin(TKikimrEvents::ES_TX_MEDIATOR),
EvRequestLostAcks,
- EvMediatorConfiguration,
+ EvMediatorConfiguration,
EvCommitTabletStep = EvCommitStep + 1 * 512,
EvStepPlanComplete,
@@ -253,166 +253,166 @@ struct TEvTxMediator {
return str.Str();
}
};
-};
+};
+
+namespace NTxMediator {
+
+typedef ui64 TCoordinatorId;
-namespace NTxMediator {
-
-typedef ui64 TCoordinatorId;
-
using NTabletFlatExecutor::ITransaction;
-using NActors::TActorContext;
-
-class TTxMediator : public TActor<TTxMediator>, public NTabletFlatExecutor::TTabletExecutedFlat {
- struct TConfig {
- ui64 CoordinatorsVersion;
- TCoordinators::TPtr CoordinatorSeletor;
- TTimeCastBuckets::TPtr Bukets;
-
- TConfig()
- : CoordinatorsVersion(0)
- {}
-
- TConfig(const TConfig& other) = default;
- };
-
- struct TCoordinatorInfo {
+using NActors::TActorContext;
+
+class TTxMediator : public TActor<TTxMediator>, public NTabletFlatExecutor::TTabletExecutedFlat {
+ struct TConfig {
+ ui64 CoordinatorsVersion;
+ TCoordinators::TPtr CoordinatorSeletor;
+ TTimeCastBuckets::TPtr Bukets;
+
+ TConfig()
+ : CoordinatorsVersion(0)
+ {}
+
+ TConfig(const TConfig& other) = default;
+ };
+
+ struct TCoordinatorInfo {
typedef TDeque<TAutoPtr<TCoordinatorStep>> TQueueType; // todo: list/queue
-
- ui64 KnownPrevStep;
+
+ ui64 KnownPrevStep;
TQueueType Queue;
-
- ui64 ActiveCoordinatorGeneration;
+
+ ui64 ActiveCoordinatorGeneration;
TActorId AckTo;
-
- TCoordinatorInfo()
- : KnownPrevStep(0)
- , ActiveCoordinatorGeneration(0)
- {}
- };
-
- struct TVolatileState {
+
+ TCoordinatorInfo()
+ : KnownPrevStep(0)
+ , ActiveCoordinatorGeneration(0)
+ {}
+ };
+
+ struct TVolatileState {
TMap<ui64, TCoordinatorInfo> Domain;
TMap<ui64, TCoordinatorInfo> Foreign;
-
- ui64 CompleteStep;
- ui64 LatestKnownStep;
-
- TVolatileState()
- : CompleteStep(0)
- , LatestKnownStep(0)
- {}
- };
-
- struct TTxInit;
- struct TTxConfigure;
- struct TTxSchema;
- struct TTxUpgrade;
-
+
+ ui64 CompleteStep;
+ ui64 LatestKnownStep;
+
+ TVolatileState()
+ : CompleteStep(0)
+ , LatestKnownStep(0)
+ {}
+ };
+
+ struct TTxInit;
+ struct TTxConfigure;
+ struct TTxSchema;
+ struct TTxUpgrade;
+
ITransaction* CreateTxInit();
ITransaction* CreateTxConfigure(TActorId ackTo, ui64 version, const TVector<TCoordinatorId> &coordinators, ui32 timeCastBuckets);
ITransaction* CreateTxSchema();
ITransaction* CreateTxUpgrade();
-
-
- TConfig Config;
- TVolatileState VolatileState;
-
+
+
+ TConfig Config;
+ TVolatileState VolatileState;
+
TActorId ExecQueue;
-
+
THashMap<TActorId, NKikimrTx::TEvCoordinatorSync> CoordinatorsSyncEnqueued;
TVector<TEvMediatorTimecast::TEvWatch::TPtr> WatchEnqueued;
-
- void Die(const TActorContext &ctx) override;
- void OnActivateExecutor(const TActorContext &ctx) override;
- void OnDetach(const TActorContext &ctx) override;
- void OnTabletDead(TEvTablet::TEvTabletDead::TPtr &ev, const TActorContext &ctx) override;
- void DefaultSignalTabletActive(const TActorContext &ctx) override;
-
- void Handle(TEvSubDomain::TEvConfigure::TPtr &ev, const TActorContext &ctx);
- void HandleEnqueue(TEvTxCoordinator::TEvCoordinatorSync::TPtr &ev, const TActorContext &ctx);
- void HandleEnqueue(TEvMediatorTimecast::TEvWatch::TPtr &ev, const TActorContext &ctx);
- void Handle(TEvTxCoordinator::TEvCoordinatorSync::TPtr &ev, const TActorContext &ctx);
- void Handle(TEvTxCoordinator::TEvCoordinatorStep::TPtr &ev, const TActorContext &ctx);
- void Handle(TEvMediatorTimecast::TEvWatch::TPtr &ev, const TActorContext &ctx);
- void Handle(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx);
-
+
+ void Die(const TActorContext &ctx) override;
+ void OnActivateExecutor(const TActorContext &ctx) override;
+ void OnDetach(const TActorContext &ctx) override;
+ void OnTabletDead(TEvTablet::TEvTabletDead::TPtr &ev, const TActorContext &ctx) override;
+ void DefaultSignalTabletActive(const TActorContext &ctx) override;
+
+ void Handle(TEvSubDomain::TEvConfigure::TPtr &ev, const TActorContext &ctx);
+ void HandleEnqueue(TEvTxCoordinator::TEvCoordinatorSync::TPtr &ev, const TActorContext &ctx);
+ void HandleEnqueue(TEvMediatorTimecast::TEvWatch::TPtr &ev, const TActorContext &ctx);
+ void Handle(TEvTxCoordinator::TEvCoordinatorSync::TPtr &ev, const TActorContext &ctx);
+ void Handle(TEvTxCoordinator::TEvCoordinatorStep::TPtr &ev, const TActorContext &ctx);
+ void Handle(TEvMediatorTimecast::TEvWatch::TPtr &ev, const TActorContext &ctx);
+ void Handle(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx);
+
void DoConfigure(const TEvSubDomain::TEvConfigure &ev, const TActorContext &ctx, const TActorId &ackTo = TActorId());
-
- static ui64 SubjectiveTime();
- void InitSelfState(const TActorContext &ctx);
- void ReplyEnqueuedSyncs(const TActorContext &ctx);
- void ReplyEnqueuedWatch(const TActorContext &ctx);
-
-
+
+ static ui64 SubjectiveTime();
+ void InitSelfState(const TActorContext &ctx);
+ void ReplyEnqueuedSyncs(const TActorContext &ctx);
+ void ReplyEnqueuedWatch(const TActorContext &ctx);
+
+
void ReplySync(const TActorId &sender, const NKikimrTx::TEvCoordinatorSync &record, const TActorContext &ctx);
void ReplyStep(const TActorId &sender, NKikimrTx::TEvCoordinatorStepResult::EStatus status, const NKikimrTx::TEvCoordinatorStep &request, const TActorContext &ctx);
- ui64 FindProgressCandidate();
- void Progress(ui64 to, const TActorContext &ctx);
- void CheckProgress(const TActorContext &ctx);
+ ui64 FindProgressCandidate();
+ void Progress(ui64 to, const TActorContext &ctx);
+ void CheckProgress(const TActorContext &ctx);
void RequestLostAcks(const TActorId &sender, const NKikimrTx::TEvCoordinatorStep &request, const TActorContext &ctx);
-
+
void ProcessDomainStep(const TActorId &sender, const NKikimrTx::TEvCoordinatorStep &request, ui64 coordinator, TCoordinatorInfo &info, const TActorContext &ctx);
void ProcessForeignStep(const TActorId &sender, const NKikimrTx::TEvCoordinatorStep &request, ui64 coordinator, TCoordinatorInfo &info, const TActorContext &ctx);
-
-public:
- struct Schema : NIceDb::Schema {
- static const ui32 CurrentVersion;
-
- struct State : Table<1> {
- enum EKeyType {
- DatabaseVersion,
- };
-
- struct StateKey : Column<0, NScheme::NTypeIds::Uint64> { using Type = EKeyType; }; // PK
- struct StateValue : Column<1, NScheme::NTypeIds::Uint64> {};
-
- using TKey = TableKey<StateKey>;
- using TColumns = TableColumns<StateKey, StateValue>;
- };
-
- struct DomainConfiguration : Table<2> {
- struct Version : Column<1, NScheme::NTypeIds::Uint64> {};
+
+public:
+ struct Schema : NIceDb::Schema {
+ static const ui32 CurrentVersion;
+
+ struct State : Table<1> {
+ enum EKeyType {
+ DatabaseVersion,
+ };
+
+ struct StateKey : Column<0, NScheme::NTypeIds::Uint64> { using Type = EKeyType; }; // PK
+ struct StateValue : Column<1, NScheme::NTypeIds::Uint64> {};
+
+ using TKey = TableKey<StateKey>;
+ using TColumns = TableColumns<StateKey, StateValue>;
+ };
+
+ struct DomainConfiguration : Table<2> {
+ struct Version : Column<1, NScheme::NTypeIds::Uint64> {};
struct Coordinators : Column<2, NScheme::NTypeIds::String> { using Type = TVector<TCoordinatorId>; };
- struct TimeCastBuckets : Column<3, NScheme::NTypeIds::Uint32> { static constexpr ui32 Default = TDomainsInfo::TDomain::TimecastBucketsPerMediator; };
-
- using TKey = TableKey<Version>;
- using TColumns = TableColumns<Version, Coordinators, TimeCastBuckets>;
- };
-
- using TTables = SchemaTables<State, DomainConfiguration>;
- };
-
+ struct TimeCastBuckets : Column<3, NScheme::NTypeIds::Uint32> { static constexpr ui32 Default = TDomainsInfo::TDomain::TimecastBucketsPerMediator; };
+
+ using TKey = TableKey<Version>;
+ using TColumns = TableColumns<Version, Coordinators, TimeCastBuckets>;
+ };
+
+ using TTables = SchemaTables<State, DomainConfiguration>;
+ };
+
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
return NKikimrServices::TActivity::TX_MEDIATOR_ACTOR;
- }
-
+ }
+
TTxMediator(TTabletStorageInfo *info, const TActorId &tablet);
-
- // no incomming pipes is allowed in StateInit
- STFUNC_TABLET_INIT(StateInit,
- HFunc(TEvents::TEvPoisonPill, Handle))
-
- STFUNC_TABLET_DEF(StateSync,
- HFunc(TEvents::TEvPoisonPill, Handle)
- HFunc(TEvTxCoordinator::TEvCoordinatorSync, HandleEnqueue)
- HFunc(TEvSubDomain::TEvConfigure, Handle)
- HFunc(TEvMediatorTimecast::TEvWatch, HandleEnqueue)
- IgnoreFunc(TEvTabletPipe::TEvServerConnected)
- IgnoreFunc(TEvTabletPipe::TEvServerDisconnected))
-
- STFUNC_TABLET_DEF(StateWork,
- HFunc(TEvents::TEvPoisonPill, Handle)
- HFunc(TEvSubDomain::TEvConfigure, Handle)
- HFunc(TEvTxCoordinator::TEvCoordinatorStep, Handle)
- HFunc(TEvTxCoordinator::TEvCoordinatorSync, Handle)
- HFunc(TEvMediatorTimecast::TEvWatch, Handle)
- HFunc(NMon::TEvRemoteHttpInfo, RenderHtmlPage)
- IgnoreFunc(TEvTabletPipe::TEvServerConnected)
- IgnoreFunc(TEvTabletPipe::TEvServerDisconnected))
-
- STFUNC_TABLET_IGN(StateBroken,)
+
+ // no incomming pipes is allowed in StateInit
+ STFUNC_TABLET_INIT(StateInit,
+ HFunc(TEvents::TEvPoisonPill, Handle))
+
+ STFUNC_TABLET_DEF(StateSync,
+ HFunc(TEvents::TEvPoisonPill, Handle)
+ HFunc(TEvTxCoordinator::TEvCoordinatorSync, HandleEnqueue)
+ HFunc(TEvSubDomain::TEvConfigure, Handle)
+ HFunc(TEvMediatorTimecast::TEvWatch, HandleEnqueue)
+ IgnoreFunc(TEvTabletPipe::TEvServerConnected)
+ IgnoreFunc(TEvTabletPipe::TEvServerDisconnected))
+
+ STFUNC_TABLET_DEF(StateWork,
+ HFunc(TEvents::TEvPoisonPill, Handle)
+ HFunc(TEvSubDomain::TEvConfigure, Handle)
+ HFunc(TEvTxCoordinator::TEvCoordinatorStep, Handle)
+ HFunc(TEvTxCoordinator::TEvCoordinatorSync, Handle)
+ HFunc(TEvMediatorTimecast::TEvWatch, Handle)
+ HFunc(NMon::TEvRemoteHttpInfo, RenderHtmlPage)
+ IgnoreFunc(TEvTabletPipe::TEvServerConnected)
+ IgnoreFunc(TEvTabletPipe::TEvServerDisconnected))
+
+ STFUNC_TABLET_IGN(StateBroken,)
};
-}
+}
IActor* CreateTxMediatorTabletQueue(const TActorId &owner, ui64 mediator, ui64 hashRange, ui64 hashBucket);
IActor* CreateTxMediatorExecQueue(const TActorId &owner, ui64 mediator, ui64 hashRange, ui32 timecastBuckets);
diff --git a/ydb/core/tx/mediator/tablet_queue.cpp b/ydb/core/tx/mediator/tablet_queue.cpp
index f35ad2fcee8..b28179517ca 100644
--- a/ydb/core/tx/mediator/tablet_queue.cpp
+++ b/ydb/core/tx/mediator/tablet_queue.cpp
@@ -1,5 +1,5 @@
-#include "mediator_impl.h"
-
+#include "mediator_impl.h"
+
#include <library/cpp/actors/core/log.h>
#include <library/cpp/actors/core/actor_bootstrapped.h>
#include <library/cpp/actors/core/hfunc.h>
@@ -11,7 +11,7 @@
#include <ydb/core/tx/tx_processing.h>
#include <ydb/core/tx/time_cast/time_cast.h>
#include <ydb/core/tablet/tablet_pipe_client_cache.h>
-
+
#include <util/string/builder.h>
#include <util/generic/hash_set.h>
@@ -193,30 +193,30 @@ class TTxMediatorTabletQueue : public TActor<TTxMediatorTabletQueue> {
Y_VERIFY(tabletEntry.State == TTabletEntry::StateConnect);
if (!Pipes->OnConnect(ev)) {
- if (msg->Dead) {
+ if (msg->Dead) {
LOG_WARN_S(ctx, NKikimrServices::TX_MEDIATOR_TABLETQUEUE, "Actor# " << ctx.SelfID.ToString()
<< " Mediator# " << Mediator << " HANDLE TEvClientConnected(Dead=true)");
- while (TTabletEntry::TStep *sx = tabletEntry.Queue->Head()) {
- tabletEntry.MergeOutOfOrder(sx);
- AckOoO(tablet, sx->StepRef->Step, sx->Transactions, ctx);
- --sx->StepRef->RefCounter;
- delete tabletEntry.Queue->Pop();
- }
- PerTabletPlanQueue.erase(tablet);
- CheckStepHead(ctx);
- return;
- }
-
+ while (TTabletEntry::TStep *sx = tabletEntry.Queue->Head()) {
+ tabletEntry.MergeOutOfOrder(sx);
+ AckOoO(tablet, sx->StepRef->Step, sx->Transactions, ctx);
+ --sx->StepRef->RefCounter;
+ delete tabletEntry.Queue->Pop();
+ }
+ PerTabletPlanQueue.erase(tablet);
+ CheckStepHead(ctx);
+ return;
+ }
+
Pipes->Prepare(ctx, tablet);
- return;
+ return;
}
-
- tabletEntry.State = TTabletEntry::StateConnected;
+
+ tabletEntry.State = TTabletEntry::StateConnected;
TTabletEntry::TQueueType::TReadIterator it = tabletEntry.Queue->Iterator();
- while (TTabletEntry::TStep *sx = it.Next()) {
- tabletEntry.MergeOutOfOrder(sx);
- SendToTablet(sx, tablet, ctx);
- }
+ while (TTabletEntry::TStep *sx = it.Next()) {
+ tabletEntry.MergeOutOfOrder(sx);
+ SendToTablet(sx, tablet, ctx);
+ }
}
void Handle(TEvTabletPipe::TEvClientDestroyed::TPtr &ev, const TActorContext &ctx) {
@@ -322,19 +322,19 @@ class TTxMediatorTabletQueue : public TActor<TTxMediatorTabletQueue> {
TActor::Die(ctx);
}
-
- static NTabletPipe::TClientConfig GetPipeClientConfig() {
- NTabletPipe::TClientConfig config;
- config.CheckAliveness = true;
+
+ static NTabletPipe::TClientConfig GetPipeClientConfig() {
+ NTabletPipe::TClientConfig config;
+ config.CheckAliveness = true;
config.RetryPolicy = {
.RetryLimitCount = 30,
.MinRetryTime = TDuration::MilliSeconds(10),
.MaxRetryTime = TDuration::MilliSeconds(500),
.BackoffMultiplier = 2,
};
- return config;
- }
-
+ return config;
+ }
+
public:
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
return NKikimrServices::TActivity::TX_MEDIATOR_ACTOR;
@@ -347,7 +347,7 @@ public:
, HashRange(hashRange)
, HashBucket(hashBucket)
, StepCommitQueue(new TStepCommitQueue())
- , Pipes(NTabletPipe::CreateUnboundedClientCache(GetPipeClientConfig()))
+ , Pipes(NTabletPipe::CreateUnboundedClientCache(GetPipeClientConfig()))
, AcceptedStep(0)
, CommitedStep(0)
, ActiveStep(nullptr)
diff --git a/ydb/core/tx/mediator/ya.make b/ydb/core/tx/mediator/ya.make
index ab99b7a1fef..d5359ee5948 100644
--- a/ydb/core/tx/mediator/ya.make
+++ b/ydb/core/tx/mediator/ya.make
@@ -1,22 +1,22 @@
-LIBRARY()
-
-OWNER(
- ddoarn
+LIBRARY()
+
+OWNER(
+ ddoarn
g:kikimr
-)
-
-SRCS(
- mediator.cpp
- mediator_impl.cpp
- mediator__init.cpp
- mediator__configure.cpp
- mediator__schema.cpp
- mediator__schema_upgrade.cpp
- tablet_queue.cpp
- execute_queue.cpp
-)
-
-PEERDIR(
+)
+
+SRCS(
+ mediator.cpp
+ mediator_impl.cpp
+ mediator__init.cpp
+ mediator__configure.cpp
+ mediator__schema.cpp
+ mediator__schema_upgrade.cpp
+ tablet_queue.cpp
+ execute_queue.cpp
+)
+
+PEERDIR(
library/cpp/actors/core
ydb/core/base
ydb/core/engine/minikql
@@ -28,6 +28,6 @@ PEERDIR(
ydb/core/tx/coordinator
ydb/core/tx/time_cast
ydb/core/util
-)
-
-END()
+)
+
+END()
diff --git a/ydb/core/tx/message_seqno.h b/ydb/core/tx/message_seqno.h
index 4f60e802fa6..a0151301ee7 100644
--- a/ydb/core/tx/message_seqno.h
+++ b/ydb/core/tx/message_seqno.h
@@ -2,8 +2,8 @@
#include "defs.h"
-#include <util/stream/output.h>
-
+#include <util/stream/output.h>
+
namespace NKikimr {
// A helper for check the order of messages sent by a tablet
struct TMessageSeqNo {
@@ -50,7 +50,7 @@ namespace NKikimr {
bool operator >= (const TMessageSeqNo& other) const {
return (other <= *this);
}
-
+
TMessageSeqNo& operator ++ () {
if (0 == ++Round) {
++Generation;
@@ -58,15 +58,15 @@ namespace NKikimr {
return *this;
}
- void Out(IOutputStream& o) const {
- o << Generation << ":" << Round;
- }
+ void Out(IOutputStream& o) const {
+ o << Generation << ":" << Round;
+ }
};
}
-
-
-template<>
-inline void Out<NKikimr::TMessageSeqNo>(IOutputStream& o, const NKikimr::TMessageSeqNo& x) {
- return x.Out(o);
-}
+
+
+template<>
+inline void Out<NKikimr::TMessageSeqNo>(IOutputStream& o, const NKikimr::TMessageSeqNo& x) {
+ return x.Out(o);
+}
diff --git a/ydb/core/tx/scheme_board/cache.cpp b/ydb/core/tx/scheme_board/cache.cpp
index 7c767b91d02..8e778a4a1d8 100644
--- a/ydb/core/tx/scheme_board/cache.cpp
+++ b/ydb/core/tx/scheme_board/cache.cpp
@@ -39,14 +39,14 @@ namespace NSchemeBoard {
#define SBC_LOG_T(stream) SB_LOG_T(TX_PROXY_SCHEME_CACHE, stream)
#define SBC_LOG_D(stream) SB_LOG_D(TX_PROXY_SCHEME_CACHE, stream)
#define SBC_LOG_N(stream) SB_LOG_N(TX_PROXY_SCHEME_CACHE, stream)
-#define SBC_LOG_W(stream) SB_LOG_W(TX_PROXY_SCHEME_CACHE, stream)
+#define SBC_LOG_W(stream) SB_LOG_W(TX_PROXY_SCHEME_CACHE, stream)
using TEvNavigate = TEvTxProxySchemeCache::TEvNavigateKeySet;
using TEvNavigateResult = TEvTxProxySchemeCache::TEvNavigateKeySetResult;
using TNavigate = NSchemeCache::TSchemeCacheNavigate;
using TNavigateContext = NSchemeCache::TSchemeCacheNavigateContext;
using TNavigateContextPtr = TIntrusivePtr<TNavigateContext>;
-
+
using TEvResolve = TEvTxProxySchemeCache::TEvResolveKeySet;
using TEvResolveResult = TEvTxProxySchemeCache::TEvResolveKeySetResult;
using TResolve = NSchemeCache::TSchemeCacheRequest;
@@ -678,10 +678,10 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
CreateStep = 0;
// pathid is never changed (yet) so must be kept
- AbandonedSchemeShardsIds.clear();
+ AbandonedSchemeShardsIds.clear();
SecurityObject.Drop();
- DomainInfo.Drop();
+ DomainInfo.Drop();
Attributes.clear();
ListNodeEntry.Drop();
@@ -711,7 +711,7 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
ReplicationInfo.Drop();
}
- void FillTableInfo(const NKikimrSchemeOp::TPathDescription& pathDesc) {
+ void FillTableInfo(const NKikimrSchemeOp::TPathDescription& pathDesc) {
const auto& tableDesc = pathDesc.GetTable();
for (const auto& columnDesc : tableDesc.GetColumns()) {
@@ -757,17 +757,17 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
}
if (pathDesc.HasDomainDescription()) {
- DomainInfo = new NSchemeCache::TDomainInfo(pathDesc.GetDomainDescription());
+ DomainInfo = new NSchemeCache::TDomainInfo(pathDesc.GetDomainDescription());
}
}
- void FillTableInfoFromOlapStore(const NKikimrSchemeOp::TPathDescription& pathDesc) {
+ void FillTableInfoFromOlapStore(const NKikimrSchemeOp::TPathDescription& pathDesc) {
if (pathDesc.HasDomainDescription()) {
DomainInfo = new NSchemeCache::TDomainInfo(pathDesc.GetDomainDescription());
}
}
- void FillTableInfoFromOlapTable(const NKikimrSchemeOp::TPathDescription& pathDesc) {
+ void FillTableInfoFromOlapTable(const NKikimrSchemeOp::TPathDescription& pathDesc) {
const auto& desc = pathDesc.GetColumnTableDescription();
THashMap<TString, ui32> nameToId;
@@ -795,23 +795,23 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
}
}
- static TResolve::EKind PathSubTypeToTableKind(NKikimrSchemeOp::EPathSubType subType) {
+ static TResolve::EKind PathSubTypeToTableKind(NKikimrSchemeOp::EPathSubType subType) {
switch (subType) {
- case NKikimrSchemeOp::EPathSubTypeSyncIndexImplTable:
+ case NKikimrSchemeOp::EPathSubTypeSyncIndexImplTable:
return TResolve::KindSyncIndexTable;
- case NKikimrSchemeOp::EPathSubTypeAsyncIndexImplTable:
+ case NKikimrSchemeOp::EPathSubTypeAsyncIndexImplTable:
return TResolve::KindAsyncIndexTable;
default:
return TResolve::KindRegularTable;
}
}
- static bool CalcPathIsPrivate(NKikimrSchemeOp::EPathType type, NKikimrSchemeOp::EPathSubType subType) {
+ static bool CalcPathIsPrivate(NKikimrSchemeOp::EPathType type, NKikimrSchemeOp::EPathSubType subType) {
switch (type) {
- case NKikimrSchemeOp::EPathTypeTable:
+ case NKikimrSchemeOp::EPathTypeTable:
switch (subType) {
- case NKikimrSchemeOp::EPathSubTypeSyncIndexImplTable:
- case NKikimrSchemeOp::EPathSubTypeAsyncIndexImplTable:
+ case NKikimrSchemeOp::EPathSubTypeSyncIndexImplTable:
+ case NKikimrSchemeOp::EPathSubTypeAsyncIndexImplTable:
return true;
default:
return false;
@@ -823,7 +823,7 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
default:
return false;
}
- case NKikimrSchemeOp::EPathTypeTableIndex:
+ case NKikimrSchemeOp::EPathTypeTableIndex:
return true;
case NKikimrSchemeOp::EPathTypeCdcStream:
return true;
@@ -903,15 +903,15 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
}
bool IsSysTable() const {
- return Kind == TNavigate::KindTable && PathId.OwnerId == TSysTables::SysSchemeShard;
+ return Kind == TNavigate::KindTable && PathId.OwnerId == TSysTables::SysSchemeShard;
}
- void SetPathId(const TPathId pathId) {
- if (PathId) {
- Y_VERIFY(PathId == pathId);
+ void SetPathId(const TPathId pathId) {
+ if (PathId) {
+ Y_VERIFY(PathId == pathId);
}
- PathId = pathId;
+ PathId = pathId;
}
void SendSyncRequest() const {
@@ -955,9 +955,9 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
: Owner(owner)
, Subscriber(subscriber)
, Filled(false)
- , Kind(TNavigate::EKind::KindUnknown)
+ , Kind(TNavigate::EKind::KindUnknown)
, TableKind(TResolve::EKind::KindUnknown)
- , Created(false)
+ , Created(false)
, CreateStep(0)
, IsPrivatePath(false)
, IsVirtual(isVirtual)
@@ -990,7 +990,7 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
return TStringBuilder() << "{"
<< " Subscriber: " << Subscriber.ToString()
<< " Filled: " << Filled
- << " Status: " << (Status ? NKikimrScheme::EStatus_Name(*Status) : "undefined")
+ << " Status: " << (Status ? NKikimrScheme::EStatus_Name(*Status) : "undefined")
<< " Kind: " << static_cast<ui32>(Kind)
<< " TableKind: " << static_cast<ui32>(TableKind)
<< " Created: " << Created
@@ -1039,7 +1039,7 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
root.WriteKey("SchemaVersion").WriteULongLong(SchemaVersion);
if (Status) {
- root.WriteKey("Status").WriteString(NKikimrScheme::EStatus_Name(*Status));
+ root.WriteKey("Status").WriteString(NKikimrScheme::EStatus_Name(*Status));
} else {
root.WriteKey("Status").WriteNull();
}
@@ -1155,7 +1155,7 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
} else {
ResendSyncRequests(other.InFlight);
}
-
+
InFlight.insert(other.InFlight.begin(), other.InFlight.end());
other.OnEvict(false);
@@ -1261,10 +1261,10 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
Clear();
Filled = true;
- Status = NKikimrScheme::StatusSuccess;
+ Status = NKikimrScheme::StatusSuccess;
Kind = TNavigate::KindPath;
Created = true;
- PathId = TPathId(TSysTables::SysSchemeShard, 0);
+ PathId = TPathId(TSysTables::SysSchemeShard, 0);
Path = "/sys";
IsVirtual = true;
@@ -1274,7 +1274,7 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
Clear();
Filled = true;
- Status = NKikimrScheme::StatusSuccess;
+ Status = NKikimrScheme::StatusSuccess;
Kind = TNavigate::KindTable;
Created = true;
PathId = TPathId(TSysTables::SysSchemeShard, v2 ? TSysTables::SysTableLocks2 : TSysTables::SysTableLocks);
@@ -1301,7 +1301,7 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
return;
} else {
Status = notify.DescribeSchemeResult.GetStatus();
- if (Status != NKikimrScheme::StatusSuccess) {
+ if (Status != NKikimrScheme::StatusSuccess) {
return;
}
}
@@ -1314,7 +1314,7 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
const auto& abandoned = pathDesc.GetAbandonedTenantsSchemeShards();
AbandonedSchemeShardsIds = TSet<ui64>(abandoned.begin(), abandoned.end());
-
+
Y_VERIFY(pathDesc.HasSelf());
const auto& entryDesc = pathDesc.GetSelf();
Self = new TNavigate::TDirEntryInfo();
@@ -1323,7 +1323,7 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
Created = entryDesc.HasCreateFinished() && entryDesc.GetCreateFinished();
CreateStep = entryDesc.GetCreateStep();
SecurityObject = new TSecurityObject(entryDesc.GetOwner(), entryDesc.GetEffectiveACL(), false);
- DomainInfo = new NSchemeCache::TDomainInfo(pathDesc.GetDomainDescription());
+ DomainInfo = new NSchemeCache::TDomainInfo(pathDesc.GetDomainDescription());
for (const auto& attr : pathDesc.GetUserAttributes()) {
Attributes[attr.GetKey()] = attr.GetValue();
@@ -1337,23 +1337,23 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
};
switch (entryDesc.GetPathType()) {
- case NKikimrSchemeOp::EPathTypeSubDomain:
+ case NKikimrSchemeOp::EPathTypeSubDomain:
Kind = TNavigate::KindSubdomain;
FillInfo(Kind, DomainDescription, std::move(*pathDesc.MutableDomainDescription()));
break;
- case NKikimrSchemeOp::EPathTypeExtSubDomain:
- Kind = TNavigate::KindExtSubdomain;
+ case NKikimrSchemeOp::EPathTypeExtSubDomain:
+ Kind = TNavigate::KindExtSubdomain;
FillInfo(Kind, DomainDescription, std::move(*pathDesc.MutableDomainDescription()));
- break;
- case NKikimrSchemeOp::EPathTypeDir:
- case NKikimrSchemeOp::EPathTypeBlockStoreVolume:
- case NKikimrSchemeOp::EPathTypeFileStore:
+ break;
+ case NKikimrSchemeOp::EPathTypeDir:
+ case NKikimrSchemeOp::EPathTypeBlockStoreVolume:
+ case NKikimrSchemeOp::EPathTypeFileStore:
Kind = TNavigate::KindPath;
if (entryDesc.GetPathId() == entryDesc.GetParentPathId()) {
FillInfo(Kind, DomainDescription, std::move(*pathDesc.MutableDomainDescription()));
}
break;
- case NKikimrSchemeOp::EPathTypeTable:
+ case NKikimrSchemeOp::EPathTypeTable:
Kind = TNavigate::KindTable;
TableKind = PathSubTypeToTableKind(entryDesc.GetPathSubType());
IsPrivatePath = CalcPathIsPrivate(entryDesc.GetPathType(), entryDesc.GetPathSubType());
@@ -1380,29 +1380,29 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
OlapTableInfo->OlapStoreId = TTableId(p.GetOwnerId(), p.GetLocalId());
}
break;
- case NKikimrSchemeOp::EPathTypeTableIndex:
+ case NKikimrSchemeOp::EPathTypeTableIndex:
Kind = TNavigate::KindIndex;
IsPrivatePath = CalcPathIsPrivate(entryDesc.GetPathType(), entryDesc.GetPathSubType());
SchemaVersion = tableIndexVersion(entryDesc);
break;
- case NKikimrSchemeOp::EPathTypeRtmrVolume:
+ case NKikimrSchemeOp::EPathTypeRtmrVolume:
Kind = TNavigate::KindRtmr;
FillInfo(Kind, RtmrVolumeInfo, std::move(*pathDesc.MutableRtmrVolumeDescription()));
break;
- case NKikimrSchemeOp::EPathTypeKesus:
+ case NKikimrSchemeOp::EPathTypeKesus:
Kind = TNavigate::KindKesus;
FillInfo(Kind, KesusInfo, std::move(*pathDesc.MutableKesus()));
break;
- case NKikimrSchemeOp::EPathTypeSolomonVolume:
+ case NKikimrSchemeOp::EPathTypeSolomonVolume:
Kind = TNavigate::KindSolomon;
FillInfo(Kind, SolomonVolumeInfo, std::move(*pathDesc.MutableSolomonDescription()));
break;
- case NKikimrSchemeOp::EPathTypePersQueueGroup:
+ case NKikimrSchemeOp::EPathTypePersQueueGroup:
Kind = TNavigate::KindTopic;
IsPrivatePath = CalcPathIsPrivate(entryDesc.GetPathType(), entryDesc.GetPathSubType());
FillInfo(Kind, PQGroupInfo, std::move(*pathDesc.MutablePersQueueGroup()));
break;
- case NKikimrSchemeOp::EPathTypeCdcStream:
+ case NKikimrSchemeOp::EPathTypeCdcStream:
Kind = TNavigate::KindCdcStream;
IsPrivatePath = CalcPathIsPrivate(entryDesc.GetPathType(), entryDesc.GetPathSubType());
FillInfo(Kind, CdcStreamInfo, std::move(*pathDesc.MutableCdcStreamDescription()));
@@ -1411,7 +1411,7 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
CdcStreamInfo->PathId = TPathId(pathId.GetOwnerId(), pathId.GetLocalId());
}
break;
- case NKikimrSchemeOp::EPathTypeSequence:
+ case NKikimrSchemeOp::EPathTypeSequence:
Kind = TNavigate::KindSequence;
FillInfo(Kind, SequenceInfo, std::move(*pathDesc.MutableSequenceDescription()));
break;
@@ -1419,9 +1419,9 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
Kind = TNavigate::KindReplication;
FillInfo(Kind, ReplicationInfo, std::move(*pathDesc.MutableReplicationDescription()));
break;
- case NKikimrSchemeOp::EPathTypeInvalid:
+ case NKikimrSchemeOp::EPathTypeInvalid:
Y_VERIFY_DEBUG(false, "Invalid path type");
- break;
+ break;
}
if (IsLikeDirectory(Kind)) {
@@ -1434,16 +1434,16 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
const auto pathId = TPathId(child.GetSchemeshardId(), child.GetPathId());
switch (child.GetPathType()) {
- case NKikimrSchemeOp::EPathTypeSubDomain:
- case NKikimrSchemeOp::EPathTypeDir:
- case NKikimrSchemeOp::EPathTypeBlockStoreVolume:
- case NKikimrSchemeOp::EPathTypeFileStore:
+ case NKikimrSchemeOp::EPathTypeSubDomain:
+ case NKikimrSchemeOp::EPathTypeDir:
+ case NKikimrSchemeOp::EPathTypeBlockStoreVolume:
+ case NKikimrSchemeOp::EPathTypeFileStore:
ListNodeEntry->Children.emplace_back(name, pathId, TNavigate::KindPath);
break;
- case NKikimrSchemeOp::EPathTypeExtSubDomain:
+ case NKikimrSchemeOp::EPathTypeExtSubDomain:
ListNodeEntry->Children.emplace_back(name, pathId, TNavigate::KindExtSubdomain);
break;
- case NKikimrSchemeOp::EPathTypeTable:
+ case NKikimrSchemeOp::EPathTypeTable:
ListNodeEntry->Children.emplace_back(name, pathId, TNavigate::KindTable, tableSchemaVersion(child));
break;
case NKikimrSchemeOp::EPathTypeColumnStore:
@@ -1452,31 +1452,31 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
case NKikimrSchemeOp::EPathTypeColumnTable:
ListNodeEntry->Children.emplace_back(name, pathId, TNavigate::KindOlapTable);
break;
- case NKikimrSchemeOp::EPathTypeRtmrVolume:
+ case NKikimrSchemeOp::EPathTypeRtmrVolume:
ListNodeEntry->Children.emplace_back(name, pathId, TNavigate::KindRtmr);
break;
- case NKikimrSchemeOp::EPathTypeKesus:
+ case NKikimrSchemeOp::EPathTypeKesus:
ListNodeEntry->Children.emplace_back(name, pathId, TNavigate::KindKesus);
break;
- case NKikimrSchemeOp::EPathTypeSolomonVolume:
+ case NKikimrSchemeOp::EPathTypeSolomonVolume:
ListNodeEntry->Children.emplace_back(name, pathId, TNavigate::KindSolomon);
break;
- case NKikimrSchemeOp::EPathTypePersQueueGroup:
+ case NKikimrSchemeOp::EPathTypePersQueueGroup:
ListNodeEntry->Children.emplace_back(name, pathId, TNavigate::KindTopic);
break;
- case NKikimrSchemeOp::EPathTypeCdcStream:
+ case NKikimrSchemeOp::EPathTypeCdcStream:
ListNodeEntry->Children.emplace_back(name, pathId, TNavigate::KindCdcStream);
break;
- case NKikimrSchemeOp::EPathTypeSequence:
+ case NKikimrSchemeOp::EPathTypeSequence:
ListNodeEntry->Children.emplace_back(name, pathId, TNavigate::KindSequence);
break;
case NKikimrSchemeOp::EPathTypeReplication:
ListNodeEntry->Children.emplace_back(name, pathId, TNavigate::KindReplication);
break;
- case NKikimrSchemeOp::EPathTypeTableIndex:
- case NKikimrSchemeOp::EPathTypeInvalid:
+ case NKikimrSchemeOp::EPathTypeTableIndex:
+ case NKikimrSchemeOp::EPathTypeInvalid:
Y_VERIFY_DEBUG(false, "Invalid path type");
- break;
+ break;
}
}
}
@@ -1492,7 +1492,7 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
Y_VERIFY_DEBUG(Subscriber.DomainOwnerId);
if (notify.Strong) {
- Status = NKikimrScheme::StatusPathDoesNotExist;
+ Status = NKikimrScheme::StatusPathDoesNotExist;
}
}
@@ -1503,26 +1503,26 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
return Filled;
}
- TMaybe<NKikimrScheme::EStatus> GetStatus() const {
+ TMaybe<NKikimrScheme::EStatus> GetStatus() const {
return Status;
}
- TPathId GetPathId() const {
- return IsFilled() ? PathId : TPathId();
- }
-
- TDomainId GetDomainId() const {
- return (IsFilled() && DomainInfo) ? DomainInfo->DomainKey : TDomainId();
- }
-
+ TPathId GetPathId() const {
+ return IsFilled() ? PathId : TPathId();
+ }
+
+ TDomainId GetDomainId() const {
+ return (IsFilled() && DomainInfo) ? DomainInfo->DomainKey : TDomainId();
+ }
+
auto GetDomainInfo() const {
return DomainInfo;
}
- const TSet<ui64>& GetAbandonedSchemeShardIds() const {
- return AbandonedSchemeShardsIds;
- }
-
+ const TSet<ui64>& GetAbandonedSchemeShardIds() const {
+ return AbandonedSchemeShardsIds;
+ }
+
void FillSystemViewEntry(TNavigateContext* context, TNavigate::TEntry& entry,
NSysView::ISystemViewResolver::ETarget target) const
{
@@ -1580,21 +1580,21 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
}
void FillEntry(TNavigateContext* context, TNavigate::TEntry& entry, const TResponseProps& props = TResponseProps()) const {
- SBC_LOG_D("FillEntry for TNavigate"
+ SBC_LOG_D("FillEntry for TNavigate"
<< ": self# " << Owner->SelfId()
<< ", cacheItem# " << ToString()
<< ", entry# " << entry.ToString()
<< ", props# " << props.ToString());
-
+
if (props.IsSync && props.Partial) {
return SetError(context, entry, TNavigate::EStatus::LookupError);
}
- if (Status && Status == NKikimrScheme::StatusPathDoesNotExist) {
+ if (Status && Status == NKikimrScheme::StatusPathDoesNotExist) {
return SetError(context, entry, TNavigate::EStatus::PathErrorUnknown);
}
- if (!Status || Status != NKikimrScheme::StatusSuccess) {
+ if (!Status || Status != NKikimrScheme::StatusSuccess) {
return SetError(context, entry, TNavigate::EStatus::LookupError);
}
@@ -1634,24 +1634,24 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
}
// common
- entry.SecurityObject = SecurityObject;
- entry.DomainInfo = DomainInfo;
+ entry.SecurityObject = SecurityObject;
+ entry.DomainInfo = DomainInfo;
entry.Attributes = Attributes;
-
- entry.Status = TNavigate::EStatus::Ok;
-
- if (Kind == TNavigate::KindExtSubdomain && entry.RedirectRequired) {
+
+ entry.Status = TNavigate::EStatus::Ok;
+
+ if (Kind == TNavigate::KindExtSubdomain && entry.RedirectRequired) {
SetError(context, entry, TNavigate::EStatus::RedirectLookupError);
- }
-
+ }
+
entry.Kind = Kind;
entry.CreateStep = CreateStep;
if (entry.RequestType == TNavigate::TEntry::ERequestType::ByPath) {
if (Kind == TNavigate::KindTable) {
- entry.TableId = TTableId(PathId.OwnerId, PathId.LocalPathId, SchemaVersion);
+ entry.TableId = TTableId(PathId.OwnerId, PathId.LocalPathId, SchemaVersion);
} else {
- entry.TableId = TTableId(PathId.OwnerId, PathId.LocalPathId);
+ entry.TableId = TTableId(PathId.OwnerId, PathId.LocalPathId);
}
} else {
entry.Path = SplitPath(Path);
@@ -1775,7 +1775,7 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
}
void FillEntry(TResolveContext* context, TResolve::TEntry& entry, const TResponseProps& props = TResponseProps()) const {
- SBC_LOG_D("FillEntry for TResolve"
+ SBC_LOG_D("FillEntry for TResolve"
<< ": self# " << Owner->SelfId()
<< ", cacheItem# " << ToString()
<< ", entry# " << entry.ToString()
@@ -1787,11 +1787,11 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
return SetError(context, entry, TResolve::EStatus::LookupError, TKeyDesc::EStatus::NotExists);
}
- if (Status && Status == NKikimrScheme::StatusPathDoesNotExist) {
+ if (Status && Status == NKikimrScheme::StatusPathDoesNotExist) {
return SetError(context, entry, TResolve::EStatus::PathErrorNotExist, TKeyDesc::EStatus::NotExists);
}
- if (!Status || Status != NKikimrScheme::StatusSuccess) {
+ if (!Status || Status != NKikimrScheme::StatusSuccess) {
return SetError(context, entry, TResolve::EStatus::LookupError, TKeyDesc::EStatus::NotExists);
}
@@ -1887,16 +1887,16 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
mutable THashMap<TVariantContextPtr, TVector<TRequest>> InFlight;
// common
- TMaybe<NKikimrScheme::EStatus> Status;
+ TMaybe<NKikimrScheme::EStatus> Status;
TNavigate::EKind Kind;
TResolve::EKind TableKind;
bool Created;
ui64 CreateStep;
- TPathId PathId;
+ TPathId PathId;
TString Path;
- TSet<ui64> AbandonedSchemeShardsIds;
+ TSet<ui64> AbandonedSchemeShardsIds;
TIntrusivePtr<TSecurityObject> SecurityObject;
- NSchemeCache::TDomainInfo::TPtr DomainInfo;
+ NSchemeCache::TDomainInfo::TPtr DomainInfo;
THashMap<TString, TString> Attributes;
bool IsPrivatePath;
bool IsVirtual;
@@ -1912,8 +1912,8 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
THashMap<ui32, TSysTables::TTableColumnInfo> Columns;
TVector<NScheme::TTypeId> KeyColumnTypes;
THashSet<TString> NotNullColumns;
- TVector<NKikimrSchemeOp::TIndexDescription> Indexes;
- TVector<NKikimrSchemeOp::TCdcStreamDescription> CdcStreams;
+ TVector<NKikimrSchemeOp::TIndexDescription> Indexes;
+ TVector<NKikimrSchemeOp::TCdcStreamDescription> CdcStreams;
TVector<TKeyDesc::TPartitionInfo> Partitioning;
TIntrusivePtr<TNavigate::TDirEntryInfo> Self;
@@ -1998,14 +1998,14 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
<< ", domainOwnerId# " << domainOwnerId);
const auto& domains = *AppData()->DomainsInfo;
- const ui32 domainId = domains.GetDomainUidByTabletId(tabletId);
- const ui32 boardSSId = domains.GetDomain(domainId).DefaultSchemeBoardGroup;
+ const ui32 domainId = domains.GetDomainUidByTabletId(tabletId);
+ const ui32 boardSSId = domains.GetDomain(domainId).DefaultSchemeBoardGroup;
return TSubscriber(
Register(CreateSchemeBoardSubscriber(SelfId(), path, boardSSId, domainOwnerId)), domainOwnerId, path
);
- }
-
+ }
+
TSubscriber CreateSubscriber(const TPathId& pathId, const ui64 domainOwnerId) const {
return CreateSubscriber(pathId, pathId.OwnerId, domainOwnerId);
}
@@ -2024,7 +2024,7 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
{
const ui64 tabletId = tabletIdExtractor(entry);
const ui32 domainId = AppData()->DomainsInfo->GetDomainUidByTabletId(tabletId);
- if (tabletId == ui64(NSchemeShard::InvalidTabletId) || domainId == TDomainsInfo::BadDomainId) {
+ if (tabletId == ui64(NSchemeShard::InvalidTabletId) || domainId == TDomainsInfo::BadDomainId) {
return SetRootUnknown(context.Get(), entry);
}
@@ -2036,11 +2036,11 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
}
auto status = dbItem->GetStatus();
- if (status && status == NKikimrScheme::StatusPathDoesNotExist) {
+ if (status && status == NKikimrScheme::StatusPathDoesNotExist) {
return SetPathNotExist(context.Get(), entry);
}
- if (!status || status != NKikimrScheme::StatusSuccess) {
+ if (!status || status != NKikimrScheme::StatusSuccess) {
return SetLookupError(context.Get(), entry);
}
@@ -2094,121 +2094,121 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
}
TCacheItem* ResolveCacheItemCommon(const TPathId& notifyPathId, const TString& notifyPath) {
- if (!notifyPathId) {
- return Cache.FindPtr(notifyPath);
- }
-
- if (!notifyPath) {
- return Cache.FindPtr(notifyPathId);
- }
-
- TCacheItem* byPath = Cache.FindPtr(notifyPath);
- TCacheItem* byPathId = Cache.FindPtr(notifyPathId);
-
- if (byPath == byPathId) {
- return byPathId;
- }
-
- if (!byPath) {
+ if (!notifyPathId) {
+ return Cache.FindPtr(notifyPath);
+ }
+
+ if (!notifyPath) {
+ return Cache.FindPtr(notifyPathId);
+ }
+
+ TCacheItem* byPath = Cache.FindPtr(notifyPath);
+ TCacheItem* byPathId = Cache.FindPtr(notifyPathId);
+
+ if (byPath == byPathId) {
+ return byPathId;
+ }
+
+ if (!byPath) {
TSubscriber subscriber = CreateSubscriber(notifyPath, notifyPathId.OwnerId, byPathId->GetSubcriber().DomainOwnerId);
- return &Cache.Upsert(notifyPath, notifyPathId, TCacheItem(this, subscriber, false));
- }
+ return &Cache.Upsert(notifyPath, notifyPathId, TCacheItem(this, subscriber, false));
+ }
- TCacheItem* byPathByPathId = Cache.FindPtr(byPath->GetPathId());
+ TCacheItem* byPathByPathId = Cache.FindPtr(byPath->GetPathId());
- if (!byPathByPathId) {
- return &Cache.Upsert(notifyPath, notifyPathId, TCacheItem(this, TSubscriber(), false));
- }
+ if (!byPathByPathId) {
+ return &Cache.Upsert(notifyPath, notifyPathId, TCacheItem(this, TSubscriber(), false));
+ }
- Y_VERIFY(byPath == byPathByPathId);
+ Y_VERIFY(byPath == byPathByPathId);
- if (!byPath->IsFilled() || byPath->GetPathId().OwnerId == notifyPathId.OwnerId) {
- if (byPath->GetPathId() < notifyPathId) {
+ if (!byPath->IsFilled() || byPath->GetPathId().OwnerId == notifyPathId.OwnerId) {
+ if (byPath->GetPathId() < notifyPathId) {
return SwapSubscriberAndUpsert(byPath, notifyPathId, notifyPath);
}
-
- return byPathId;
- }
-
- return nullptr;
- }
-
- template <typename TProtoNotify>
- TCacheItem* ResolveCacheItem(const TProtoNotify& notify,
- const TDomainId& notifyDomainId = {}, const TSet<ui64>& abandonedSchemeShardIds = {})
- {
- TCacheItem* byPath = Cache.FindPtr(notify.Path);
- TCacheItem* byPathId = Cache.FindPtr(notify.PathId);
-
- SBC_LOG_D("ResolveCacheItem"
+
+ return byPathId;
+ }
+
+ return nullptr;
+ }
+
+ template <typename TProtoNotify>
+ TCacheItem* ResolveCacheItem(const TProtoNotify& notify,
+ const TDomainId& notifyDomainId = {}, const TSet<ui64>& abandonedSchemeShardIds = {})
+ {
+ TCacheItem* byPath = Cache.FindPtr(notify.Path);
+ TCacheItem* byPathId = Cache.FindPtr(notify.PathId);
+
+ SBC_LOG_D("ResolveCacheItem"
<< ": self# " << SelfId()
<< ", notify# " << notify.ToString()
<< ", by path# " << (byPath ? byPath->ToString() : "nullptr")
<< ", by pathId# " << (byPathId ? byPathId->ToString() : "nullptr"));
-
- TCacheItem* commonResolve = ResolveCacheItemCommon(notify.PathId, notify.Path);
- if (commonResolve) {
- return commonResolve;
- }
-
- if (!byPath) {
- return nullptr;
- }
-
- Y_VERIFY(byPath);
- Y_VERIFY(byPathId != byPath);
-
+
+ TCacheItem* commonResolve = ResolveCacheItemCommon(notify.PathId, notify.Path);
+ if (commonResolve) {
+ return commonResolve;
+ }
+
+ if (!byPath) {
+ return nullptr;
+ }
+
+ Y_VERIFY(byPath);
+ Y_VERIFY(byPathId != byPath);
+
if (!byPath->GetDomainId() && notifyDomainId) {
return SwapSubscriberAndUpsert(byPath, notify.PathId, notify.Path);
- }
-
- SBC_LOG_D("ResolveCacheItemForNotify: subdomain case"
- << ": self# " << SelfId()
- << ", path# " << notify.Path
- << ", pathId# " << notify.PathId
- << ", byPath# " << (byPath ? byPath->ToString() : "nullptr")
- << ", byPathId# " << (byPathId ? byPathId->ToString() : "nullptr"));
-
+ }
+
+ SBC_LOG_D("ResolveCacheItemForNotify: subdomain case"
+ << ": self# " << SelfId()
+ << ", path# " << notify.Path
+ << ", pathId# " << notify.PathId
+ << ", byPath# " << (byPath ? byPath->ToString() : "nullptr")
+ << ", byPathId# " << (byPathId ? byPathId->ToString() : "nullptr"));
+
if (byPath->GetDomainId() != notifyDomainId && notifyDomainId) {
- SBC_LOG_D("ResolveCacheItemForNotify: recreation domain case"
+ SBC_LOG_D("ResolveCacheItemForNotify: recreation domain case"
<< ": self# " << SelfId()
<< ", path# " << notify.Path
<< ", pathId# " << notify.PathId
<< ", byPath# " << (byPath ? byPath->ToString() : "nullptr")
<< ", byPathId# " << (byPathId ? byPathId->ToString() : "nullptr"));
-
- if (byPath->GetPathId() < notify.PathId) {
+
+ if (byPath->GetPathId() < notify.PathId) {
return SwapSubscriberAndUpsert(byPath, notify.PathId, notify.Path);
- }
+ }
- return byPathId;
- }
-
- if (byPath->GetPathId() == notifyDomainId) { //Update from TSS, GSS->TSS
- if (byPath->GetAbandonedSchemeShardIds().contains(notify.PathId.OwnerId)) {
+ return byPathId;
+ }
+
+ if (byPath->GetPathId() == notifyDomainId) { //Update from TSS, GSS->TSS
+ if (byPath->GetAbandonedSchemeShardIds().contains(notify.PathId.OwnerId)) {
SBC_LOG_D("ResolveCacheItemForNotify: this is update from TSS, the update is ignored, present GSS reverted implicitly that TSS"
<< ": self# " << SelfId()
<< ", path# " << notify.Path
<< ", pathId# " << notify.PathId);
- return byPathId;
- }
-
+ return byPathId;
+ }
+
SBC_LOG_D("ResolveCacheItemForNotify: this is update from TSS, the update owerrides GSS by path"
<< ": self# " << SelfId()
<< ", path# " << notify.Path
<< ", pathId# " << notify.PathId);
return SwapSubscriberAndUpsert(byPath, notify.PathId, notify.Path);
- }
-
- if (byPath->GetDomainId() == notify.PathId) { //Update from GSS, TSS->GSS
- if (abandonedSchemeShardIds.contains(byPath->GetPathId().OwnerId)) { //GSS reverts TSS
+ }
+
+ if (byPath->GetDomainId() == notify.PathId) { //Update from GSS, TSS->GSS
+ if (abandonedSchemeShardIds.contains(byPath->GetPathId().OwnerId)) { //GSS reverts TSS
SBC_LOG_D("ResolveCacheItemForNotify: this is update from GSS, the update owerrides TSS by path, GSS implicilty reverts that TSS"
<< ": self# " << SelfId()
<< ", path# " << notify.Path
<< ", pathId# " << notify.PathId);
return SwapSubscriberAndUpsert(byPath, notify.PathId, notify.Path);
- }
-
+ }
+
if (!notifyDomainId) {
SBC_LOG_D("ResolveCacheItemForNotify: this is update from GSS that removes TSS"
<< ": self# " << SelfId()
@@ -2221,64 +2221,64 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
<< ": self# " << SelfId()
<< ", path# " << notify.Path
<< ", pathId# " << notify.PathId);
- return byPathId;
- }
-
- if (byPath->GetDomainId() == notifyDomainId && notifyDomainId) {
- SBC_LOG_D("ResolveCacheItemForNotify: recreation migrated path case"
- << ": self# " << SelfId()
- << ", path# " << notify.Path
- << ", pathId# " << notify.PathId
- << ", byPath# " << (byPath ? byPath->ToString() : "nullptr")
- << ", byPathId# " << (byPathId ? byPathId->ToString() : "nullptr"));
-
- if (byPath->GetPathId() < notify.PathId) {
- return SwapSubscriberAndUpsert(byPath, notify.PathId, notify.Path);
- }
-
- return byPathId;
- }
-
+ return byPathId;
+ }
+
+ if (byPath->GetDomainId() == notifyDomainId && notifyDomainId) {
+ SBC_LOG_D("ResolveCacheItemForNotify: recreation migrated path case"
+ << ": self# " << SelfId()
+ << ", path# " << notify.Path
+ << ", pathId# " << notify.PathId
+ << ", byPath# " << (byPath ? byPath->ToString() : "nullptr")
+ << ", byPathId# " << (byPathId ? byPathId->ToString() : "nullptr"));
+
+ if (byPath->GetPathId() < notify.PathId) {
+ return SwapSubscriberAndUpsert(byPath, notify.PathId, notify.Path);
+ }
+
+ return byPathId;
+ }
+
if (!notifyDomainId) {
- SBC_LOG_D("ResolveCacheItemForNotify: path has gone, update only by pathId"
+ SBC_LOG_D("ResolveCacheItemForNotify: path has gone, update only by pathId"
<< ": self# " << SelfId()
<< ", path# " << notify.Path
<< ", pathId# " << notify.PathId);
return byPathId;
}
- Y_FAIL_S("Unknown update");
- }
-
- TCacheItem* ResolveCacheItemForNotify(const TSchemeBoardEvents::TEvNotifyDelete& notify) {
- return ResolveCacheItem(notify);
- }
-
- TCacheItem* ResolveCacheItemForNotify(const TSchemeBoardEvents::TEvSyncResponse& notify) {
- return ResolveCacheItem(notify);
- }
-
- TCacheItem* ResolveCacheItemForNotify(const TSchemeBoardEvents::TEvNotifyUpdate& notify) {
- return ResolveCacheItem(notify, GetDomainId(notify.DescribeSchemeResult), GetAbandonedSchemeShardIds(notify.DescribeSchemeResult));
- }
-
- template <typename TEvent>
+ Y_FAIL_S("Unknown update");
+ }
+
+ TCacheItem* ResolveCacheItemForNotify(const TSchemeBoardEvents::TEvNotifyDelete& notify) {
+ return ResolveCacheItem(notify);
+ }
+
+ TCacheItem* ResolveCacheItemForNotify(const TSchemeBoardEvents::TEvSyncResponse& notify) {
+ return ResolveCacheItem(notify);
+ }
+
+ TCacheItem* ResolveCacheItemForNotify(const TSchemeBoardEvents::TEvNotifyUpdate& notify) {
+ return ResolveCacheItem(notify, GetDomainId(notify.DescribeSchemeResult), GetAbandonedSchemeShardIds(notify.DescribeSchemeResult));
+ }
+
+ template <typename TEvent>
void HandleNotify(TEvent& ev) {
const TResponseProps response = TResponseProps::FromEvent(ev);
- auto& notify = *ev->Get();
-
+ auto& notify = *ev->Get();
+
SBC_LOG_D("HandleNotify"
<< ": self# " << SelfId()
<< ", notify# " << notify.ToString());
- if (notify.Path && notify.PathId) {
+ if (notify.Path && notify.PathId) {
Y_VERIFY(!response.IsSync);
- }
-
- TCacheItem* cacheItem = ResolveCacheItemForNotify(notify);
-
+ }
+
+ TCacheItem* cacheItem = ResolveCacheItemForNotify(notify);
+
if (!cacheItem) {
- SBC_LOG_W("HandleNotify doesn't find any cacheItem for Fill"
+ SBC_LOG_W("HandleNotify doesn't find any cacheItem for Fill"
<< ": self# " << SelfId()
<< ", path# " << notify.Path
<< ", pathId# " << notify.PathId
@@ -2398,12 +2398,12 @@ class TSchemeCache: public TMonitorableActor<TSchemeCache> {
auto tabletIdExtractor = [this](const TNavigate::TEntry& entry) {
if (entry.Path.empty()) {
- return ui64(NSchemeShard::InvalidTabletId);
+ return ui64(NSchemeShard::InvalidTabletId);
}
auto it = Roots.find(entry.Path.front());
if (it == Roots.end()) {
- return ui64(NSchemeShard::InvalidTabletId);
+ return ui64(NSchemeShard::InvalidTabletId);
}
return it->second;
diff --git a/ydb/core/tx/scheme_board/cache_ut.cpp b/ydb/core/tx/scheme_board/cache_ut.cpp
index be8a10de350..c27b3517b34 100644
--- a/ydb/core/tx/scheme_board/cache_ut.cpp
+++ b/ydb/core/tx/scheme_board/cache_ut.cpp
@@ -30,13 +30,13 @@ public:
config->Roots.push_back(TConfig::TTagEntry(0, TTestTxConfig::SchemeShard, "Root"));
SchemeCache = Context->Register(CreateSchemeBoardSchemeCache(config.Get()));
Context->EnableScheduleForActor(SchemeCache, true);
-
- TestAlterSubDomain(*Context, 1, "/",
- "StoragePools { "
- " Name: \"pool-1\" "
- " Kind: \"pool-kind-1\" "
- "} "
- " Name: \"Root\" ");
+
+ TestAlterSubDomain(*Context, 1, "/",
+ "StoragePools { "
+ " Name: \"pool-1\" "
+ " Kind: \"pool-kind-1\" "
+ "} "
+ " Name: \"Root\" ");
}
UNIT_TEST_SUITE(TCacheTest);
@@ -51,11 +51,11 @@ public:
UNIT_TEST(SystemView);
UNIT_TEST(SysLocks);
UNIT_TEST(TableSchemaVersion);
- UNIT_TEST(MigrationCommon);
- UNIT_TEST(MigrationCommit);
- UNIT_TEST(MigrationLostMessage);
- UNIT_TEST(MigrationUndo);
- UNIT_TEST(MigrationDeletedPathNavigate);
+ UNIT_TEST(MigrationCommon);
+ UNIT_TEST(MigrationCommit);
+ UNIT_TEST(MigrationLostMessage);
+ UNIT_TEST(MigrationUndo);
+ UNIT_TEST(MigrationDeletedPathNavigate);
UNIT_TEST(WatchRoot);
UNIT_TEST_SUITE_END();
@@ -70,11 +70,11 @@ public:
void SystemView();
void SysLocks();
void TableSchemaVersion();
- void MigrationCommon();
- void MigrationCommit();
- void MigrationLostMessage();
- void MigrationUndo();
- void MigrationDeletedPathNavigate();
+ void MigrationCommon();
+ void MigrationCommit();
+ void MigrationLostMessage();
+ void MigrationUndo();
+ void MigrationDeletedPathNavigate();
void WatchRoot();
protected:
@@ -97,8 +97,8 @@ protected:
NSchemeCache::TDescribeResult::TCPtr ExpectWatchUpdated(const TActorId& watcher, const TString& expectedPath = {});
TPathId ExpectWatchDeleted(const TActorId& watcher);
- void CreateAndMigrateWithoutDecision(ui64& txId);
-
+ void CreateAndMigrateWithoutDecision(ui64& txId);
+
private:
TActorId SchemeCache;
@@ -121,13 +121,13 @@ void TCacheTest::Navigate() {
}
void TCacheTest::Attributes() {
- NKikimrSchemeOp::TAlterUserAttributes attrs;
+ NKikimrSchemeOp::TAlterUserAttributes attrs;
auto& attr = *attrs.AddUserAttributes();
attr.SetKey("key");
attr.SetValue("value");
ui64 txId = 100;
- TestMkDir(*Context, ++txId, "/Root", "DirA", {NKikimrScheme::StatusAccepted}, attrs);
+ TestMkDir(*Context, ++txId, "/Root", "DirA", {NKikimrScheme::StatusAccepted}, attrs);
TestWaitNotification(*Context, {txId}, CreateNotificationSubscriber(*Context, TTestTxConfig::SchemeShard));
auto entry = TestNavigate("/Root/DirA", TNavigate::EStatus::Ok);
@@ -346,7 +346,7 @@ void TCacheTest::TableSchemaVersion() {
CompactionPolicy {
}
}
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
TestWaitNotification(*Context, {txId}, CreateNotificationSubscriber(*Context, TTestTxConfig::SchemeShard));
{
@@ -372,7 +372,7 @@ TNavigate::TEntry TCacheTest::TestNavigateImpl(THolder<TNavigate> request, TNavi
auto& entry = request->ResultSet.back();
entry.Operation = op;
entry.ShowPrivatePath = showPrivatePath;
- entry.RedirectRequired = redirectRequired;
+ entry.RedirectRequired = redirectRequired;
if (sid) {
request->UserToken = new NACLib::TUserToken(sid, {});
@@ -469,434 +469,434 @@ TPathId TCacheTest::ExpectWatchDeleted(const TActorId& watcher) {
return ev->Get()->PathId;
}
-void TCacheTest::CreateAndMigrateWithoutDecision(ui64& txId) {
+void TCacheTest::CreateAndMigrateWithoutDecision(ui64& txId) {
auto domainSSNotifier = CreateNotificationSubscriber(*Context, TTestTxConfig::SchemeShard);
-
- TestCreateSubDomain(*Context, ++txId, "/Root",
- "Name: \"USER_0\"");
- TestAlterSubDomain(*Context, ++txId, "/Root",
- "Name: \"USER_0\" "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 ");
- TestWaitNotification(*Context, {txId, txId - 1}, domainSSNotifier);
-
- TestMkDir(*Context, ++txId, "/Root/USER_0", "DirA");
- TestCreateTable(*Context, ++txId, "/Root/USER_0/DirA", R"(
- Name: "Table1"
- Columns { Name: "key" Type: "Uint32" }
- KeyColumnNames: [ "key" ]
- PartitionConfig {
- CompactionPolicy {
- }
- }
- )");
-
- TestWaitNotification(*Context, {txId, txId - 1}, domainSSNotifier);
-
- {
- auto entry = TestNavigate("/Root/USER_0", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0");
+
+ TestCreateSubDomain(*Context, ++txId, "/Root",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(*Context, ++txId, "/Root",
+ "Name: \"USER_0\" "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 ");
+ TestWaitNotification(*Context, {txId, txId - 1}, domainSSNotifier);
+
+ TestMkDir(*Context, ++txId, "/Root/USER_0", "DirA");
+ TestCreateTable(*Context, ++txId, "/Root/USER_0/DirA", R"(
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint32" }
+ KeyColumnNames: [ "key" ]
+ PartitionConfig {
+ CompactionPolicy {
+ }
+ }
+ )");
+
+ TestWaitNotification(*Context, {txId, txId - 1}, domainSSNotifier);
+
+ {
+ auto entry = TestNavigate("/Root/USER_0", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0");
UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 2));
- UNIT_ASSERT(!entry.DomainInfo->Params.HasSchemeShard());
- }
-
- {
- auto entry = TestNavigate("/Root/USER_0/DirA", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA");
+ UNIT_ASSERT(!entry.DomainInfo->Params.HasSchemeShard());
+ }
+
+ {
+ auto entry = TestNavigate("/Root/USER_0/DirA", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA");
UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 3));
- UNIT_ASSERT(!entry.DomainInfo->Params.HasSchemeShard());
- }
- {
- auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
+ UNIT_ASSERT(!entry.DomainInfo->Params.HasSchemeShard());
+ }
+ {
+ auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 4));
- UNIT_ASSERT(!entry.DomainInfo->Params.HasSchemeShard());
- }
-
- TestUpgradeSubDomain(*Context, ++txId, "/Root", "USER_0");
-
- TestWaitNotification(*Context, {txId}, domainSSNotifier);
-}
-
-void TCacheTest::MigrationCommon() {
- Context->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_TRACE);
- Context->SetLogPriority(NKikimrServices::SCHEMESHARD_DESCRIBE, NActors::NLog::PRI_TRACE);
- Context->SetLogPriority(NKikimrServices::TX_COORDINATOR, NActors::NLog::PRI_TRACE);
-
- TurnOnTabletsScheduling();
-
- ui64 txId = 100;
-
- CreateAndMigrateWithoutDecision(txId);
-
- auto checkMigratedPathes = [&] () {
- {
- auto entry = TestNavigate("/Root/USER_0", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0");
+ UNIT_ASSERT(!entry.DomainInfo->Params.HasSchemeShard());
+ }
+
+ TestUpgradeSubDomain(*Context, ++txId, "/Root", "USER_0");
+
+ TestWaitNotification(*Context, {txId}, domainSSNotifier);
+}
+
+void TCacheTest::MigrationCommon() {
+ Context->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_TRACE);
+ Context->SetLogPriority(NKikimrServices::SCHEMESHARD_DESCRIBE, NActors::NLog::PRI_TRACE);
+ Context->SetLogPriority(NKikimrServices::TX_COORDINATOR, NActors::NLog::PRI_TRACE);
+
+ TurnOnTabletsScheduling();
+
+ ui64 txId = 100;
+
+ CreateAndMigrateWithoutDecision(txId);
+
+ auto checkMigratedPathes = [&] () {
+ {
+ auto entry = TestNavigate("/Root/USER_0", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0");
UNIT_ASSERT_UNEQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 2));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
- UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(entry.DomainInfo->Params.GetSchemeShard(), 1));
- }
- {
- auto entry = TestNavigate("/Root/USER_0/DirA", TNavigate::EStatus::Ok);
- Cerr << entry.ToString() << Endl;
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA");
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+ UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(entry.DomainInfo->Params.GetSchemeShard(), 1));
+ }
+ {
+ auto entry = TestNavigate("/Root/USER_0/DirA", TNavigate::EStatus::Ok);
+ Cerr << entry.ToString() << Endl;
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA");
UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 3));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
- }
- {
- auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+ }
+ {
+ auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 4));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
- }
- };
-
- checkMigratedPathes();
-
- // global ss do not wipe migrated pathes after restart
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+ }
+ };
+
+ checkMigratedPathes();
+
+ // global ss do not wipe migrated pathes after restart
RebootTablet(*Context, (ui64)TTestTxConfig::SchemeShard, Context->AllocateEdgeActor());
-
- checkMigratedPathes();
-}
-
-void TCacheTest::MigrationCommit() {
- TurnOnTabletsScheduling();
-
- ui64 txId = 100;
-
- CreateAndMigrateWithoutDecision(txId);
-
- auto checkMigratedPathes = [&] () {
- {
- auto entry = TestNavigate("/Root/USER_0", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0");
+
+ checkMigratedPathes();
+}
+
+void TCacheTest::MigrationCommit() {
+ TurnOnTabletsScheduling();
+
+ ui64 txId = 100;
+
+ CreateAndMigrateWithoutDecision(txId);
+
+ auto checkMigratedPathes = [&] () {
+ {
+ auto entry = TestNavigate("/Root/USER_0", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0");
UNIT_ASSERT_UNEQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 2));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
- UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(entry.DomainInfo->Params.GetSchemeShard(), 1));
- }
- {
- auto entry = TestNavigate("/Root/USER_0/DirA", TNavigate::EStatus::Ok);
- Cerr << entry.ToString() << Endl;
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA");
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+ UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(entry.DomainInfo->Params.GetSchemeShard(), 1));
+ }
+ {
+ auto entry = TestNavigate("/Root/USER_0/DirA", TNavigate::EStatus::Ok);
+ Cerr << entry.ToString() << Endl;
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA");
UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 3));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
- }
- {
- auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+ }
+ {
+ auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 4));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
- }
- };
-
- checkMigratedPathes();
-
- TestUpgradeSubDomainDecision(*Context, ++txId, "/Root", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
-
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+ }
+ };
+
+ checkMigratedPathes();
+
+ TestUpgradeSubDomainDecision(*Context, ++txId, "/Root", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
+
auto domainSSNotifier = CreateNotificationSubscriber(*Context, TTestTxConfig::SchemeShard);
- TestWaitNotification(*Context, {txId}, domainSSNotifier);
-
- checkMigratedPathes();
-
+ TestWaitNotification(*Context, {txId}, domainSSNotifier);
+
+ checkMigratedPathes();
+
RebootTablet(*Context, (ui64)TTestTxConfig::SchemeShard, Context->AllocateEdgeActor());
-
- checkMigratedPathes();
-}
-
-void TCacheTest::MigrationLostMessage() {
- TurnOnTabletsScheduling();
-
- ui64 txId = 100;
-
- CreateAndMigrateWithoutDecision(txId);
-
- auto checkMigratedPathes = [&] () {
- {
- auto entry = TestNavigate("/Root/USER_0", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0");
+
+ checkMigratedPathes();
+}
+
+void TCacheTest::MigrationLostMessage() {
+ TurnOnTabletsScheduling();
+
+ ui64 txId = 100;
+
+ CreateAndMigrateWithoutDecision(txId);
+
+ auto checkMigratedPathes = [&] () {
+ {
+ auto entry = TestNavigate("/Root/USER_0", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0");
UNIT_ASSERT_UNEQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 2));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
- UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(entry.DomainInfo->Params.GetSchemeShard(), 1));
- }
- {
- auto entry = TestNavigate("/Root/USER_0/DirA", TNavigate::EStatus::Ok);
- Cerr << entry.ToString() << Endl;
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA");
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+ UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(entry.DomainInfo->Params.GetSchemeShard(), 1));
+ }
+ {
+ auto entry = TestNavigate("/Root/USER_0/DirA", TNavigate::EStatus::Ok);
+ Cerr << entry.ToString() << Endl;
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA");
UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 3));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
- }
- {
- auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+ }
+ {
+ auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 4));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
- }
- };
-
- checkMigratedPathes();
-
- TestUpgradeSubDomainDecision(*Context, ++txId, "/Root", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
-
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+ }
+ };
+
+ checkMigratedPathes();
+
+ TestUpgradeSubDomainDecision(*Context, ++txId, "/Root", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
+
auto domainSSNotifier = CreateNotificationSubscriber(*Context, TTestTxConfig::SchemeShard);
- TestWaitNotification(*Context, {txId}, domainSSNotifier);
-
- checkMigratedPathes();
-
- ui64 tentantSchemeShard = 0;
- TPathId oldPathId;
- {
- auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
+ TestWaitNotification(*Context, {txId}, domainSSNotifier);
+
+ checkMigratedPathes();
+
+ ui64 tentantSchemeShard = 0;
+ TPathId oldPathId;
+ {
+ auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 4));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
-
- tentantSchemeShard = entry.DomainInfo->Params.GetSchemeShard();
- oldPathId = entry.TableId.PathId;
- }
-
- auto tenantSSNotifier = CreateNotificationSubscriber(*Context, tentantSchemeShard);
-
- bool deleteMsgHasBeenDropped = false;
- auto skipDeleteNotification = [&deleteMsgHasBeenDropped](TTestActorRuntimeBase&, TAutoPtr<IEventHandle>& ev) -> auto {
- if (ev->Type == TSchemeBoardEvents::EvNotifyDelete) {
- auto *msg = ev->Get<TSchemeBoardEvents::TEvNotifyDelete>();
- Cerr << Endl << Endl << Endl << "skipDeleteNotification"
- << " path: " << msg->Path
- << " pathId: " << msg->PathId
- << " Strong: " << msg->Strong
- << Endl << Endl << Endl;
- deleteMsgHasBeenDropped = true;
- return TTestActorRuntime::EEventAction::DROP;
-
- }
- return TTestActorRuntime::EEventAction::PROCESS;
- };
-
- auto prevObserverFunc = Context->SetObserverFunc(skipDeleteNotification);
-
- TestDropTable(*Context, tentantSchemeShard, ++txId, "/Root/USER_0/DirA", "Table1");
- TestWaitNotification(*Context, {txId}, tenantSSNotifier);
-
- UNIT_ASSERT_EQUAL(deleteMsgHasBeenDropped, true);
- deleteMsgHasBeenDropped = false;
-
- { // hang in chache
- auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+
+ tentantSchemeShard = entry.DomainInfo->Params.GetSchemeShard();
+ oldPathId = entry.TableId.PathId;
+ }
+
+ auto tenantSSNotifier = CreateNotificationSubscriber(*Context, tentantSchemeShard);
+
+ bool deleteMsgHasBeenDropped = false;
+ auto skipDeleteNotification = [&deleteMsgHasBeenDropped](TTestActorRuntimeBase&, TAutoPtr<IEventHandle>& ev) -> auto {
+ if (ev->Type == TSchemeBoardEvents::EvNotifyDelete) {
+ auto *msg = ev->Get<TSchemeBoardEvents::TEvNotifyDelete>();
+ Cerr << Endl << Endl << Endl << "skipDeleteNotification"
+ << " path: " << msg->Path
+ << " pathId: " << msg->PathId
+ << " Strong: " << msg->Strong
+ << Endl << Endl << Endl;
+ deleteMsgHasBeenDropped = true;
+ return TTestActorRuntime::EEventAction::DROP;
+
+ }
+ return TTestActorRuntime::EEventAction::PROCESS;
+ };
+
+ auto prevObserverFunc = Context->SetObserverFunc(skipDeleteNotification);
+
+ TestDropTable(*Context, tentantSchemeShard, ++txId, "/Root/USER_0/DirA", "Table1");
+ TestWaitNotification(*Context, {txId}, tenantSSNotifier);
+
+ UNIT_ASSERT_EQUAL(deleteMsgHasBeenDropped, true);
+ deleteMsgHasBeenDropped = false;
+
+ { // hang in chache
+ auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 4));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
- }
-
- TestRmDir(*Context, tentantSchemeShard, ++txId, "/Root/USER_0", "DirA");
- TestWaitNotification(*Context, {txId}, tenantSSNotifier);
-
- { // hang in chache
- auto entry = TestNavigate("/Root/USER_0/DirA", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA");
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+ }
+
+ TestRmDir(*Context, tentantSchemeShard, ++txId, "/Root/USER_0", "DirA");
+ TestWaitNotification(*Context, {txId}, tenantSSNotifier);
+
+ { // hang in chache
+ auto entry = TestNavigate("/Root/USER_0/DirA", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA");
UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 3));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
- }
-
- UNIT_ASSERT_EQUAL(deleteMsgHasBeenDropped, true);
- deleteMsgHasBeenDropped = false;
-
- TestMkDir(*Context, tentantSchemeShard, ++txId, "/Root/USER_0", "DirA");
- TestWaitNotification(*Context, {txId}, tenantSSNotifier);
-
- {
- auto entry = TestNavigate("/Root/USER_0/DirA", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA");
- UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(tentantSchemeShard, 2));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
- }
-
- {
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+ }
+
+ UNIT_ASSERT_EQUAL(deleteMsgHasBeenDropped, true);
+ deleteMsgHasBeenDropped = false;
+
+ TestMkDir(*Context, tentantSchemeShard, ++txId, "/Root/USER_0", "DirA");
+ TestWaitNotification(*Context, {txId}, tenantSSNotifier);
+
+ {
+ auto entry = TestNavigate("/Root/USER_0/DirA", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA");
+ UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(tentantSchemeShard, 2));
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+ }
+
+ {
TestNavigateByTableId(TTableId(TTestTxConfig::SchemeShard, 3), TNavigate::EStatus::Ok, "/Root/USER_0/DirA");
- TestNavigateByTableId(TTableId(tentantSchemeShard, 2), TNavigate::EStatus::Ok, "/Root/USER_0/DirA");
- }
-
- Context->SetObserverFunc(prevObserverFunc);
-
- { // hang in chache still
- auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
+ TestNavigateByTableId(TTableId(tentantSchemeShard, 2), TNavigate::EStatus::Ok, "/Root/USER_0/DirA");
+ }
+
+ Context->SetObserverFunc(prevObserverFunc);
+
+ { // hang in chache still
+ auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 4));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
- }
-
- TestCreateTable(*Context, tentantSchemeShard, ++txId, "/Root/USER_0/DirA", R"(
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- KeyColumnNames: [ "key" ]
- )");
- TestWaitNotification(*Context, {txId}, tenantSSNotifier);
-
- {
- auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
- UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(tentantSchemeShard, 3));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
-
- TestNavigateByTableId(TTableId(tentantSchemeShard, 3), TNavigate::EStatus::Ok, "/Root/USER_0/DirA/Table1");
- }
-}
-
-void TCacheTest::MigrationUndo() {
- Context->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_TRACE);
- Context->SetLogPriority(NKikimrServices::SCHEMESHARD_DESCRIBE, NActors::NLog::PRI_TRACE);
- //Context->SetLogPriority(NKikimrServices::TX_COORDINATOR, NActors::NLog::PRI_TRACE);
-
- //Context->SetLogPriority(NKikimrServices::SCHEME_BOARD_POPULATOR, NActors::NLog::PRI_TRACE);
- //Context->SetLogPriority(NKikimrServices::SCHEME_BOARD_REPLICA, NActors::NLog::PRI_TRACE);
- Context->SetLogPriority(NKikimrServices::SCHEME_BOARD_SUBSCRIBER, NActors::NLog::PRI_TRACE);
- Context->SetLogPriority(NKikimrServices::TX_PROXY_SCHEME_CACHE, NActors::NLog::PRI_TRACE);
-
-
- TurnOnTabletsScheduling();
-
- ui64 txId = 100;
-
- CreateAndMigrateWithoutDecision(txId);
-
- auto checkMigratedPathes = [&] () {
- {
- auto entry = TestNavigate("/Root/USER_0", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0");
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+ }
+
+ TestCreateTable(*Context, tentantSchemeShard, ++txId, "/Root/USER_0/DirA", R"(
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ KeyColumnNames: [ "key" ]
+ )");
+ TestWaitNotification(*Context, {txId}, tenantSSNotifier);
+
+ {
+ auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
+ UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(tentantSchemeShard, 3));
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+
+ TestNavigateByTableId(TTableId(tentantSchemeShard, 3), TNavigate::EStatus::Ok, "/Root/USER_0/DirA/Table1");
+ }
+}
+
+void TCacheTest::MigrationUndo() {
+ Context->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_TRACE);
+ Context->SetLogPriority(NKikimrServices::SCHEMESHARD_DESCRIBE, NActors::NLog::PRI_TRACE);
+ //Context->SetLogPriority(NKikimrServices::TX_COORDINATOR, NActors::NLog::PRI_TRACE);
+
+ //Context->SetLogPriority(NKikimrServices::SCHEME_BOARD_POPULATOR, NActors::NLog::PRI_TRACE);
+ //Context->SetLogPriority(NKikimrServices::SCHEME_BOARD_REPLICA, NActors::NLog::PRI_TRACE);
+ Context->SetLogPriority(NKikimrServices::SCHEME_BOARD_SUBSCRIBER, NActors::NLog::PRI_TRACE);
+ Context->SetLogPriority(NKikimrServices::TX_PROXY_SCHEME_CACHE, NActors::NLog::PRI_TRACE);
+
+
+ TurnOnTabletsScheduling();
+
+ ui64 txId = 100;
+
+ CreateAndMigrateWithoutDecision(txId);
+
+ auto checkMigratedPathes = [&] () {
+ {
+ auto entry = TestNavigate("/Root/USER_0", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0");
UNIT_ASSERT_UNEQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 2));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
- UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(entry.DomainInfo->Params.GetSchemeShard(), 1));
- }
- {
- auto entry = TestNavigate("/Root/USER_0/DirA", TNavigate::EStatus::Ok);
- Cerr << entry.ToString() << Endl;
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA");
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+ UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(entry.DomainInfo->Params.GetSchemeShard(), 1));
+ }
+ {
+ auto entry = TestNavigate("/Root/USER_0/DirA", TNavigate::EStatus::Ok);
+ Cerr << entry.ToString() << Endl;
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA");
UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 3));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
- }
- {
- auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+ }
+ {
+ auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 4));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
- }
- };
-
- checkMigratedPathes();
-
- TestUpgradeSubDomainDecision(*Context, ++txId, "/Root", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Undo);
-
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+ }
+ };
+
+ checkMigratedPathes();
+
+ TestUpgradeSubDomainDecision(*Context, ++txId, "/Root", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Undo);
+
auto domainSSNotifier = CreateNotificationSubscriber(*Context, TTestTxConfig::SchemeShard);
- TestWaitNotification(*Context, {txId}, domainSSNotifier);
-
- auto checkRevertedPathes = [&] () {
- {
- auto entry = TestNavigate("/Root/USER_0", TNavigate::EStatus::Ok);
- Cerr << entry.ToString() << Endl;
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0");
+ TestWaitNotification(*Context, {txId}, domainSSNotifier);
+
+ auto checkRevertedPathes = [&] () {
+ {
+ auto entry = TestNavigate("/Root/USER_0", TNavigate::EStatus::Ok);
+ Cerr << entry.ToString() << Endl;
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0");
UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 2));
- UNIT_ASSERT(!entry.DomainInfo->Params.HasSchemeShard());
- }
- {
- auto entry = TestNavigate("/Root/USER_0/DirA", TNavigate::EStatus::Ok);
- Cerr << entry.ToString() << Endl;
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA");
+ UNIT_ASSERT(!entry.DomainInfo->Params.HasSchemeShard());
+ }
+ {
+ auto entry = TestNavigate("/Root/USER_0/DirA", TNavigate::EStatus::Ok);
+ Cerr << entry.ToString() << Endl;
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA");
UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 3));
- UNIT_ASSERT(!entry.DomainInfo->Params.HasSchemeShard());
- }
- {
- auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
+ UNIT_ASSERT(!entry.DomainInfo->Params.HasSchemeShard());
+ }
+ {
+ auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 4));
- UNIT_ASSERT(!entry.DomainInfo->Params.HasSchemeShard());
- }
- };
-
-
- checkRevertedPathes();
-
+ UNIT_ASSERT(!entry.DomainInfo->Params.HasSchemeShard());
+ }
+ };
+
+
+ checkRevertedPathes();
+
RebootTablet(*Context, (ui64)TTestTxConfig::SchemeShard, Context->AllocateEdgeActor());
-
- checkRevertedPathes();
-}
-
-void SimulateSleep(TTestContext& context, TDuration duration) {
- auto sender = context.AllocateEdgeActor();
- context.Schedule(new IEventHandle(sender, sender, new TEvents::TEvWakeup()), duration);
- context.GrabEdgeEventRethrow<TEvents::TEvWakeup>(sender);
-}
-
-void TCacheTest::MigrationDeletedPathNavigate() {
- TurnOnTabletsScheduling();
-
- ui64 txId = 100;
-
- CreateAndMigrateWithoutDecision(txId);
-
- TestUpgradeSubDomainDecision(*Context, ++txId, "/Root", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
-
+
+ checkRevertedPathes();
+}
+
+void SimulateSleep(TTestContext& context, TDuration duration) {
+ auto sender = context.AllocateEdgeActor();
+ context.Schedule(new IEventHandle(sender, sender, new TEvents::TEvWakeup()), duration);
+ context.GrabEdgeEventRethrow<TEvents::TEvWakeup>(sender);
+}
+
+void TCacheTest::MigrationDeletedPathNavigate() {
+ TurnOnTabletsScheduling();
+
+ ui64 txId = 100;
+
+ CreateAndMigrateWithoutDecision(txId);
+
+ TestUpgradeSubDomainDecision(*Context, ++txId, "/Root", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
+
auto domainSSNotifier = CreateNotificationSubscriber(*Context, TTestTxConfig::SchemeShard);
- TestWaitNotification(*Context, {txId}, domainSSNotifier);
-
- ui64 tentantSchemeShard = 0;
- TPathId oldPathId;
- {
- auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
+ TestWaitNotification(*Context, {txId}, domainSSNotifier);
+
+ ui64 tentantSchemeShard = 0;
+ TPathId oldPathId;
+ {
+ auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
UNIT_ASSERT_EQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 4));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
-
- tentantSchemeShard = entry.DomainInfo->Params.GetSchemeShard();
- oldPathId = entry.TableId.PathId;
- }
-
- auto tenantSSNotifier = CreateNotificationSubscriber(*Context, tentantSchemeShard);
-
- TestDropTable(*Context, tentantSchemeShard, ++txId, "/Root/USER_0/DirA", "Table1");
- TestWaitNotification(*Context, {txId}, tenantSSNotifier);
-
- TestCreateTable(*Context, tentantSchemeShard, ++txId, "/Root/USER_0/DirA", R"(
- Name: "Table1"
- Columns { Name: "key" Type: "Uint32" }
- KeyColumnNames: [ "key" ]
- PartitionConfig {
- CompactionPolicy {
- }
- }
- )");
- TestWaitNotification(*Context, {txId}, tenantSSNotifier);
-
- TPathId newPathId;
- {
- auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+
+ tentantSchemeShard = entry.DomainInfo->Params.GetSchemeShard();
+ oldPathId = entry.TableId.PathId;
+ }
+
+ auto tenantSSNotifier = CreateNotificationSubscriber(*Context, tentantSchemeShard);
+
+ TestDropTable(*Context, tentantSchemeShard, ++txId, "/Root/USER_0/DirA", "Table1");
+ TestWaitNotification(*Context, {txId}, tenantSSNotifier);
+
+ TestCreateTable(*Context, tentantSchemeShard, ++txId, "/Root/USER_0/DirA", R"(
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint32" }
+ KeyColumnNames: [ "key" ]
+ PartitionConfig {
+ CompactionPolicy {
+ }
+ }
+ )");
+ TestWaitNotification(*Context, {txId}, tenantSSNotifier);
+
+ TPathId newPathId;
+ {
+ auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
UNIT_ASSERT_UNEQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 4));
- UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
-
- newPathId = entry.TableId.PathId;
- }
-
- for (int i = 0; i < 6; ++i) {
- SimulateSleep(*Context, TDuration::Seconds(30));
-
- auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
- UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
+ UNIT_ASSERT(entry.DomainInfo->Params.HasSchemeShard());
+
+ newPathId = entry.TableId.PathId;
+ }
+
+ for (int i = 0; i < 6; ++i) {
+ SimulateSleep(*Context, TDuration::Seconds(30));
+
+ auto entry = TestNavigate("/Root/USER_0/DirA/Table1", TNavigate::EStatus::Ok);
+ UNIT_ASSERT_EQUAL(JoinPath(entry.Path), "Root/USER_0/DirA/Table1");
UNIT_ASSERT_UNEQUAL(entry.TableId.PathId, TPathId(TTestTxConfig::SchemeShard, 4));
- }
-
- {
- TestResolve(TTableId(oldPathId.OwnerId, oldPathId.LocalPathId), TResolve::EStatus::PathErrorNotExist);
- }
-}
-
+ }
+
+ {
+ TestResolve(TTableId(oldPathId.OwnerId, oldPathId.LocalPathId), TResolve::EStatus::PathErrorNotExist);
+ }
+}
+
void TCacheTest::WatchRoot() {
auto watcher = TestWatch(TPathId(TTestTxConfig::SchemeShard, 1));
{
auto result = ExpectWatchUpdated(watcher, "/Root");
- UNIT_ASSERT_VALUES_EQUAL(result->GetStatus(), NKikimrScheme::StatusSuccess);
+ UNIT_ASSERT_VALUES_EQUAL(result->GetStatus(), NKikimrScheme::StatusSuccess);
UNIT_ASSERT_VALUES_EQUAL(result->GetPathDescription().GetSelf().GetPathId(), 1u);
UNIT_ASSERT_VALUES_EQUAL(result->GetPathDescription().GetChildren().size(), 0u);
}
@@ -912,7 +912,7 @@ void TCacheTest::WatchRoot() {
ui64 dirPathId;
{
auto result = ExpectWatchUpdated(watcher);
- UNIT_ASSERT_VALUES_EQUAL(result->GetStatus(), NKikimrScheme::StatusSuccess);
+ UNIT_ASSERT_VALUES_EQUAL(result->GetStatus(), NKikimrScheme::StatusSuccess);
UNIT_ASSERT_VALUES_EQUAL(result->GetPathDescription().GetSelf().GetPathId(), 1u);
UNIT_ASSERT_VALUES_EQUAL(result->GetPathDescription().GetChildren().size(), 1u);
dirPathId = result->GetPathDescription().GetChildren(0).GetPathId();
@@ -922,7 +922,7 @@ void TCacheTest::WatchRoot() {
{
auto result = ExpectWatchUpdated(watcher, "/Root/DirA");
- UNIT_ASSERT_VALUES_EQUAL(result->GetStatus(), NKikimrScheme::StatusSuccess);
+ UNIT_ASSERT_VALUES_EQUAL(result->GetStatus(), NKikimrScheme::StatusSuccess);
UNIT_ASSERT_VALUES_EQUAL(result->GetPathDescription().GetSelf().GetPathId(), dirPathId);
}
@@ -939,7 +939,7 @@ void TCacheTest::WatchRoot() {
{
auto result = ExpectWatchUpdated(watcher);
- UNIT_ASSERT_VALUES_EQUAL(result->GetStatus(), NKikimrScheme::StatusSuccess);
+ UNIT_ASSERT_VALUES_EQUAL(result->GetStatus(), NKikimrScheme::StatusSuccess);
UNIT_ASSERT_VALUES_EQUAL(result->GetPathDescription().GetSelf().GetPathId(), 1u);
UNIT_ASSERT_VALUES_EQUAL(result->GetPathDescription().GetChildren().size(), 0u);
}
diff --git a/ydb/core/tx/scheme_board/double_indexed.h b/ydb/core/tx/scheme_board/double_indexed.h
index 1995ac068a7..99dad5aea40 100644
--- a/ydb/core/tx/scheme_board/double_indexed.h
+++ b/ydb/core/tx/scheme_board/double_indexed.h
@@ -177,33 +177,33 @@ public:
auto sIt = EmplaceInIndex(std::forward<TSk>(sKey));
if (pIt.second && sIt.second) {
- // no pKey, no sKey, insert new element
-
+ // no pKey, no sKey, insert new element
+
EmplaceInStorage(std::forward<TV>(val));
auto it = std::prev(Storage.end());
CrossSetIterators(it, pIt.first);
CrossSetIterators(it, sIt.first);
} else if (!pIt.second && sIt.second) {
- // has pKey, no sKey, merge val into exited pKey
-
+ // has pKey, no sKey, merge val into exited pKey
+
Y_VERIFY(AnotherIndexIterator(pIt.first) == AnotherIndex(pIt.first).end());
Merge(pIt.first->second->Value, std::forward<TV>(val));
CrossSetIterators(pIt.first->second, sIt.first);
} else if (pIt.second && !sIt.second) {
- // no pKey, has sKey, merge val into exited sKey
-
+ // no pKey, has sKey, merge val into exited sKey
+
Y_VERIFY(AnotherIndexIterator(sIt.first) == AnotherIndex(sIt.first).end());
Merge(sIt.first->second->Value, std::forward<TV>(val));
CrossSetIterators(sIt.first->second, pIt.first);
} else if (pIt.first->second != sIt.first->second) {
- // has pKey, has sKey, pKey is not equal to sKey, merge val into merged pKey and sKey
-
+ // has pKey, has sKey, pKey is not equal to sKey, merge val into merged pKey and sKey
+
Merge(pIt.first->second->Value, std::forward<TV>(Merge(sIt.first->second->Value, std::forward<TV>(val))));
Storage.erase(sIt.first->second);
CrossSetIterators(pIt.first->second, sIt.first);
} else {
- // has pKey, has sKey, pKey is equal to sKey, merge val into existed item;
-
+ // has pKey, has sKey, pKey is equal to sKey, merge val into existed item;
+
Merge(pIt.first->second->Value, std::forward<TV>(val));
}
diff --git a/ydb/core/tx/scheme_board/events.h b/ydb/core/tx/scheme_board/events.h
index 1b98bb5a49f..018ebbff7db 100644
--- a/ydb/core/tx/scheme_board/events.h
+++ b/ydb/core/tx/scheme_board/events.h
@@ -15,7 +15,7 @@
namespace NKikimr {
struct TSchemeBoardEvents {
- using TDescribeSchemeResult = NKikimrScheme::TEvDescribeSchemeResult;
+ using TDescribeSchemeResult = NKikimrScheme::TEvDescribeSchemeResult;
enum EEv {
// populator events
@@ -52,13 +52,13 @@ struct TSchemeBoardEvents {
// populator events
struct TEvRequestDescribe: public TEventLocal<TEvRequestDescribe, EvRequestDescribe> {
- const TPathId PathId;
+ const TPathId PathId;
const TActorId Replica;
TEvRequestDescribe() = default;
explicit TEvRequestDescribe(const TPathId pathId, const TActorId& replica)
- : PathId(pathId)
+ : PathId(pathId)
, Replica(replica)
{
}
@@ -66,9 +66,9 @@ struct TSchemeBoardEvents {
struct TEvDescribeResult: public TEventLocal<TEvDescribeResult, EvDescribeResult> {
const bool Commit = false;
- const TLocalPathId DeletedPathBegin = 0; // The points are inclusive
- const TLocalPathId DeletedPathEnd = 0; // [DeletedPathBegin; DeletedPathEnd]
- const TLocalPathId MigratedPathId = InvalidLocalPathId;
+ const TLocalPathId DeletedPathBegin = 0; // The points are inclusive
+ const TLocalPathId DeletedPathEnd = 0; // [DeletedPathBegin; DeletedPathEnd]
+ const TLocalPathId MigratedPathId = InvalidLocalPathId;
NSchemeBoard::TTwoPartDescription Description;
TEvDescribeResult() = default;
@@ -95,36 +95,36 @@ struct TSchemeBoardEvents {
{
}
- explicit TEvDescribeResult(
- TLocalPathId deletedPathBegin, TLocalPathId deletedPathEnd,
- TLocalPathId migratedPathId)
- : Commit(false)
- , DeletedPathBegin(deletedPathBegin)
- , DeletedPathEnd(deletedPathEnd)
- , MigratedPathId(migratedPathId)
- {
- }
-
+ explicit TEvDescribeResult(
+ TLocalPathId deletedPathBegin, TLocalPathId deletedPathEnd,
+ TLocalPathId migratedPathId)
+ : Commit(false)
+ , DeletedPathBegin(deletedPathBegin)
+ , DeletedPathEnd(deletedPathEnd)
+ , MigratedPathId(migratedPathId)
+ {
+ }
+
bool HasDeletedLocalPathIds() const {
return DeletedPathBegin != 0;
}
bool HasMigratedPath() const {
- return MigratedPathId != InvalidLocalPathId;
- }
-
+ return MigratedPathId != InvalidLocalPathId;
+ }
+
bool HasDescription() const {
return Description;
}
-
- TString ToString() const override {
- return TStringBuilder() << ToStringHeader() << " {"
- << " Commit: " << (Commit ? "true" : "false")
- << " DeletedPathBegin: " << DeletedPathBegin
- << " DeletedPathEnd: " << DeletedPathEnd
- << " msg: " << Description.Record.ShortDebugString()
- << " }";
- }
+
+ TString ToString() const override {
+ return TStringBuilder() << ToStringHeader() << " {"
+ << " Commit: " << (Commit ? "true" : "false")
+ << " DeletedPathBegin: " << DeletedPathBegin
+ << " DeletedPathEnd: " << DeletedPathEnd
+ << " msg: " << Description.Record.ShortDebugString()
+ << " }";
+ }
};
struct TEvRequestUpdate: public TEventLocal<TEvRequestUpdate, EvRequestUpdate> {
@@ -198,28 +198,28 @@ struct TSchemeBoardEvents {
) {
Record.SetOwner(owner);
Record.SetGeneration(generation);
- if (describeSchemeResult.HasPath()) {
- Record.SetPath(describeSchemeResult.GetPath());
- }
- if (describeSchemeResult.HasPathDescription()
- && describeSchemeResult.GetPathDescription().HasSelf()) {
- Record.SetPathOwnerId(describeSchemeResult.GetPathDescription().GetSelf().GetSchemeshardId());
- }
+ if (describeSchemeResult.HasPath()) {
+ Record.SetPath(describeSchemeResult.GetPath());
+ }
+ if (describeSchemeResult.HasPathDescription()
+ && describeSchemeResult.GetPathDescription().HasSelf()) {
+ Record.SetPathOwnerId(describeSchemeResult.GetPathDescription().GetSelf().GetSchemeshardId());
+ }
Record.SetLocalPathId(describeSchemeResult.GetPathId());
- if (describeSchemeResult.HasPathOwnerId()) {
- Record.SetPathOwnerId(describeSchemeResult.GetPathOwnerId());
- }
+ if (describeSchemeResult.HasPathOwnerId()) {
+ Record.SetPathOwnerId(describeSchemeResult.GetPathOwnerId());
+ }
Record.SetIsDeletion(isDeletion);
}
-
+
void SetDescribeSchemeResult(TString preSerialized) {
PreSerializedData = NSchemeBoard::PreSerializedProtoField(
std::move(preSerialized), Record.kDescribeSchemeResultFieldNumber);
}
-
+
void SetDescribeSchemeResult(TDescribeSchemeResult describeSchemeResult) {
*Record.MutableDescribeSchemeResult() = std::move(describeSchemeResult);
- }
+ }
void SetDescribeSchemeResult(TString preSerialized, TDescribeSchemeResult describeSchemeResult) {
SetDescribeSchemeResult(std::move(preSerialized));
@@ -237,22 +237,22 @@ struct TSchemeBoardEvents {
explicit TEvUpdateAck(
const ui64 owner,
const ui64 generation,
- const TPathId pathId,
+ const TPathId pathId,
const ui64 version
) {
Record.SetOwner(owner);
Record.SetGeneration(generation);
- Record.SetLocalPathId(pathId.LocalPathId);
+ Record.SetLocalPathId(pathId.LocalPathId);
Record.SetVersion(version);
- Record.SetPathOwnerId(pathId.OwnerId);
+ Record.SetPathOwnerId(pathId.OwnerId);
}
-
- TPathId GetPathId() const {
- return TPathId(
- Record.HasPathOwnerId() ? Record.GetPathOwnerId() : Record.GetOwner(),
- Record.GetLocalPathId()
+
+ TPathId GetPathId() const {
+ return TPathId(
+ Record.HasPathOwnerId() ? Record.GetPathOwnerId() : Record.GetOwner(),
+ Record.GetLocalPathId()
);
- }
+ }
};
struct TEvCommitRequest: public TEventPB<TEvCommitRequest, NKikimrSchemeBoard::TEvCommitGeneration, EvCommitRequest> {
@@ -284,7 +284,7 @@ struct TSchemeBoardEvents {
}
explicit TEvSubscribe(const TPathId& pathId, const ui64 domainOwnerId) {
- Record.SetPathOwnerId(pathId.OwnerId);
+ Record.SetPathOwnerId(pathId.OwnerId);
Record.SetLocalPathId(pathId.LocalPathId);
Record.SetDomainOwnerId(domainOwnerId);
FillCapabilities(Record);
@@ -303,7 +303,7 @@ struct TSchemeBoardEvents {
}
explicit TEvUnsubscribe(const TPathId& pathId) {
- Record.SetPathOwnerId(pathId.OwnerId);
+ Record.SetPathOwnerId(pathId.OwnerId);
Record.SetLocalPathId(pathId.LocalPathId);
}
};
@@ -323,7 +323,7 @@ struct TSchemeBoardEvents {
}
explicit TEvNotifyBuilder(const TPathId& pathId, const bool isDeletion = false) {
- Record.SetPathOwnerId(pathId.OwnerId);
+ Record.SetPathOwnerId(pathId.OwnerId);
Record.SetLocalPathId(pathId.LocalPathId);
Record.SetIsDeletion(isDeletion);
}
@@ -334,7 +334,7 @@ struct TSchemeBoardEvents {
const bool isDeletion = false
) {
Record.SetPath(path);
- Record.SetPathOwnerId(pathId.OwnerId);
+ Record.SetPathOwnerId(pathId.OwnerId);
Record.SetLocalPathId(pathId.LocalPathId);
Record.SetIsDeletion(isDeletion);
}
@@ -361,7 +361,7 @@ struct TSchemeBoardEvents {
}
explicit TEvSyncVersionRequest(const TPathId& pathId) {
- Record.SetPathOwnerId(pathId.OwnerId);
+ Record.SetPathOwnerId(pathId.OwnerId);
Record.SetLocalPathId(pathId.LocalPathId);
}
};
diff --git a/ydb/core/tx/scheme_board/helpers.cpp b/ydb/core/tx/scheme_board/helpers.cpp
index 791b8680e72..3b53323ad3f 100644
--- a/ydb/core/tx/scheme_board/helpers.cpp
+++ b/ydb/core/tx/scheme_board/helpers.cpp
@@ -16,7 +16,7 @@ TActorId MakeInterconnectProxyId(const ui32 nodeId) {
return TActivationContext::InterconnectProxy(nodeId);
}
-ui64 GetPathVersion(const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ui64 GetPathVersion(const NKikimrScheme::TEvDescribeSchemeResult& record) {
if (!record.HasPathDescription()) {
return 0;
}
@@ -34,53 +34,53 @@ ui64 GetPathVersion(const NKikimrScheme::TEvDescribeSchemeResult& record) {
return self.GetPathVersion();
}
-TPathId GetPathId(const NKikimrScheme::TEvDescribeSchemeResult &record) {
- if (record.HasPathId() && record.HasPathOwnerId()) {
- return TPathId(record.GetPathOwnerId(), record.GetPathId());
- }
-
- // for compatibility look deeper if PathOwnerId hasn't been set
- if (!record.HasPathDescription()) {
- return TPathId();
- }
-
- const auto& pathDescription = record.GetPathDescription();
- if (!pathDescription.HasSelf()) {
- return TPathId();
- }
-
- const auto& self = pathDescription.GetSelf();
-
- return TPathId(self.GetSchemeshardId(), self.GetPathId());
-}
-
-TDomainId GetDomainId(const NKikimrScheme::TEvDescribeSchemeResult &record) {
- if (!record.HasPathDescription()) {
- return TDomainId();
- }
-
- const auto& pathDescription = record.GetPathDescription();
- if (!pathDescription.HasDomainDescription()) {
- return TDomainId();
- }
-
+TPathId GetPathId(const NKikimrScheme::TEvDescribeSchemeResult &record) {
+ if (record.HasPathId() && record.HasPathOwnerId()) {
+ return TPathId(record.GetPathOwnerId(), record.GetPathId());
+ }
+
+ // for compatibility look deeper if PathOwnerId hasn't been set
+ if (!record.HasPathDescription()) {
+ return TPathId();
+ }
+
+ const auto& pathDescription = record.GetPathDescription();
+ if (!pathDescription.HasSelf()) {
+ return TPathId();
+ }
+
+ const auto& self = pathDescription.GetSelf();
+
+ return TPathId(self.GetSchemeshardId(), self.GetPathId());
+}
+
+TDomainId GetDomainId(const NKikimrScheme::TEvDescribeSchemeResult &record) {
+ if (!record.HasPathDescription()) {
+ return TDomainId();
+ }
+
+ const auto& pathDescription = record.GetPathDescription();
+ if (!pathDescription.HasDomainDescription()) {
+ return TDomainId();
+ }
+
const auto& domainKey = pathDescription.GetDomainDescription().GetDomainKey();
-
+
return TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId());
-}
-
-TSet<ui64> GetAbandonedSchemeShardIds(const NKikimrScheme::TEvDescribeSchemeResult &record) {
- if (!record.HasPathDescription()) {
- return {};
- }
-
- const auto& pathDescription = record.GetPathDescription();
- return TSet<ui64>(
- pathDescription.GetAbandonedTenantsSchemeShards().begin(),
- pathDescription.GetAbandonedTenantsSchemeShards().end()
+}
+
+TSet<ui64> GetAbandonedSchemeShardIds(const NKikimrScheme::TEvDescribeSchemeResult &record) {
+ if (!record.HasPathDescription()) {
+ return {};
+ }
+
+ const auto& pathDescription = record.GetPathDescription();
+ return TSet<ui64>(
+ pathDescription.GetAbandonedTenantsSchemeShards().begin(),
+ pathDescription.GetAbandonedTenantsSchemeShards().end()
);
-}
-
+}
+
TIntrusivePtr<TEventSerializedData> SerializeEvent(IEventBase* ev) {
TAllocChunkSerializer serializer;
Y_VERIFY(ev->SerializeToArcadiaStream(&serializer));
diff --git a/ydb/core/tx/scheme_board/helpers.h b/ydb/core/tx/scheme_board/helpers.h
index a16b4b87b88..3b07df3e065 100644
--- a/ydb/core/tx/scheme_board/helpers.h
+++ b/ydb/core/tx/scheme_board/helpers.h
@@ -6,9 +6,9 @@
#include <ydb/core/protos/flat_tx_scheme.pb.h>
#include <library/cpp/actors/core/log.h>
-
+
#include <util/generic/vector.h>
-#include <util/generic/set.h>
+#include <util/generic/set.h>
#if defined SB_LOG_T || \
defined SB_LOG_D || \
@@ -31,13 +31,13 @@
namespace NKikimr {
namespace NSchemeBoard {
-using TDomainId = TPathId;
+using TDomainId = TPathId;
TActorId MakeInterconnectProxyId(const ui32 nodeId);
-ui64 GetPathVersion(const NKikimrScheme::TEvDescribeSchemeResult& record);
-TPathId GetPathId(const NKikimrScheme::TEvDescribeSchemeResult& record);
-TDomainId GetDomainId(const NKikimrScheme::TEvDescribeSchemeResult& record);
-TSet<ui64> GetAbandonedSchemeShardIds(const NKikimrScheme::TEvDescribeSchemeResult &record);
+ui64 GetPathVersion(const NKikimrScheme::TEvDescribeSchemeResult& record);
+TPathId GetPathId(const NKikimrScheme::TEvDescribeSchemeResult& record);
+TDomainId GetDomainId(const NKikimrScheme::TEvDescribeSchemeResult& record);
+TSet<ui64> GetAbandonedSchemeShardIds(const NKikimrScheme::TEvDescribeSchemeResult &record);
TIntrusivePtr<TEventSerializedData> SerializeEvent(IEventBase* ev);
diff --git a/ydb/core/tx/scheme_board/load_test.cpp b/ydb/core/tx/scheme_board/load_test.cpp
index a3faea3679f..d993f1e5ed2 100644
--- a/ydb/core/tx/scheme_board/load_test.cpp
+++ b/ydb/core/tx/scheme_board/load_test.cpp
@@ -23,9 +23,9 @@ namespace NSchemeBoard {
namespace {
- bool IsDir(const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ bool IsDir(const NKikimrScheme::TEvDescribeSchemeResult& record) {
const auto& self = record.GetPathDescription().GetSelf();
- return self.GetParentPathId() == NSchemeShard::RootPathId;
+ return self.GetParentPathId() == NSchemeShard::RootPathId;
}
bool IsDir(const TTwoPartDescription& desc) {
@@ -35,9 +35,9 @@ namespace {
} // anonymous
class TLoadProducer: public TActorBootstrapped<TLoadProducer> {
- using TDescription = NKikimrScheme::TEvDescribeSchemeResult;
+ using TDescription = NKikimrScheme::TEvDescribeSchemeResult;
using TDescriptions = TMap<TPathId, TTwoPartDescription>;
- using TDescribeSchemeResult = NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder;
+ using TDescribeSchemeResult = NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder;
enum EWakeupTag {
TAG_MODIFY,
@@ -56,7 +56,7 @@ class TLoadProducer: public TActorBootstrapped<TLoadProducer> {
TTwoPartDescription dirDescTwoPart;
TDescription& dirDesc = dirDescTwoPart.Record;
- dirDesc.SetStatus(NKikimrScheme::StatusSuccess);
+ dirDesc.SetStatus(NKikimrScheme::StatusSuccess);
dirDesc.SetPathOwner(owner);
dirDesc.SetPathId(nextPathId++);
dirDesc.SetPath(dirPath);
@@ -65,12 +65,12 @@ class TLoadProducer: public TActorBootstrapped<TLoadProducer> {
dirSelf.SetName(dirName);
dirSelf.SetPathId(dirDesc.GetPathId());
dirSelf.SetSchemeshardId(dirDesc.GetPathOwner());
- dirSelf.SetPathType(NKikimrSchemeOp::EPathTypeDir);
+ dirSelf.SetPathType(NKikimrSchemeOp::EPathTypeDir);
dirSelf.SetCreateFinished(true);
dirSelf.SetCreateTxId(1);
dirSelf.SetCreateStep(1);
- dirSelf.SetParentPathId(NSchemeShard::RootPathId);
- dirSelf.SetPathState(NKikimrSchemeOp::EPathStateNoChanges);
+ dirSelf.SetParentPathId(NSchemeShard::RootPathId);
+ dirSelf.SetPathState(NKikimrSchemeOp::EPathStateNoChanges);
dirSelf.SetPathVersion(version);
auto& dirChildren = *dirDesc.MutablePathDescription()->MutableChildren();
@@ -83,14 +83,14 @@ class TLoadProducer: public TActorBootstrapped<TLoadProducer> {
TTwoPartDescription objDescTwoPart;
TDescription& objDesc = objDescTwoPart.Record;
- objDesc.SetStatus(NKikimrScheme::StatusSuccess);
+ objDesc.SetStatus(NKikimrScheme::StatusSuccess);
objDesc.SetPathOwner(owner);
objDesc.SetPathId(nextPathId++);
objDesc.SetPath(objPath);
auto& objSelf = *objDesc.MutablePathDescription()->MutableSelf();
objSelf.SetName(objName);
- objSelf.SetPathType(NKikimrSchemeOp::EPathTypeDir);
+ objSelf.SetPathType(NKikimrSchemeOp::EPathTypeDir);
dirChildren.Add()->CopyFrom(objSelf);
objSelf.SetPathId(objDesc.GetPathId());
@@ -99,7 +99,7 @@ class TLoadProducer: public TActorBootstrapped<TLoadProducer> {
objSelf.SetCreateTxId(1);
objSelf.SetCreateStep(1);
objSelf.SetParentPathId(dirDesc.GetPathId());
- objSelf.SetPathState(NKikimrSchemeOp::EPathStateNoChanges);
+ objSelf.SetPathState(NKikimrSchemeOp::EPathStateNoChanges);
objSelf.SetPathVersion(version);
descriptions[TPathId(owner, objDesc.GetPathId())] = std::move(objDescTwoPart);
@@ -111,9 +111,9 @@ class TLoadProducer: public TActorBootstrapped<TLoadProducer> {
return descriptions;
}
- TPathId RandomPathId(bool allowDir = true) const {
+ TPathId RandomPathId(bool allowDir = true) const {
while (true) {
- const TPathId pathId(Owner, RandomNumber(NextPathId));
+ const TPathId pathId(Owner, RandomNumber(NextPathId));
if (!Descriptions.contains(pathId)) {
continue;
@@ -129,7 +129,7 @@ class TLoadProducer: public TActorBootstrapped<TLoadProducer> {
Y_FAIL("Unreachable");
}
- void Modify(TPathId pathId) {
+ void Modify(TPathId pathId) {
Y_VERIFY(Descriptions.contains(pathId));
TDescription& description = Descriptions.at(pathId).Record;
@@ -143,20 +143,20 @@ class TLoadProducer: public TActorBootstrapped<TLoadProducer> {
++*ModifiedPaths;
}
- void Delete(TPathId pathId) {
+ void Delete(TPathId pathId) {
Y_VERIFY(Descriptions.contains(pathId));
TDescription& description = Descriptions.at(pathId).Record;
Y_VERIFY(!IsDir(description));
- description.SetStatus(NKikimrScheme::StatusPathDoesNotExist);
+ description.SetStatus(NKikimrScheme::StatusPathDoesNotExist);
auto describeSchemeResult = MakeHolder<TDescribeSchemeResult>();
describeSchemeResult->Record.CopyFrom(description);
Send(Populator, std::move(describeSchemeResult));
- Modify(TPathId(description.GetPathDescription().GetSelf().GetSchemeshardId(),
- description.GetPathDescription().GetSelf().GetParentPathId()));
+ Modify(TPathId(description.GetPathDescription().GetSelf().GetSchemeshardId(),
+ description.GetPathDescription().GetSelf().GetParentPathId()));
Descriptions.erase(pathId);
++*DeletedPaths;
@@ -197,8 +197,8 @@ class TLoadProducer: public TActorBootstrapped<TLoadProducer> {
Owner, Max<ui64>(), ssId, Descriptions, NextPathId
));
- TPathId pathId(Owner, NextPathId - 1);
- Y_VERIFY(Descriptions.contains(pathId));
+ TPathId pathId(Owner, NextPathId - 1);
+ Y_VERIFY(Descriptions.contains(pathId));
const TString& topPath = Descriptions.at(pathId).Record.GetPath();
// subscriber will help us to know when sync is completed
@@ -207,7 +207,7 @@ class TLoadProducer: public TActorBootstrapped<TLoadProducer> {
ESchemeBoardSubscriberDeletionPolicy::Majority
));
- *TotalPaths = NextPathId - 1 - NSchemeShard::RootPathId;
+ *TotalPaths = NextPathId - 1 - NSchemeShard::RootPathId;
Become(&TThis::StatePopulate);
}
@@ -271,7 +271,7 @@ public:
explicit TLoadProducer(ui64 owner, const TTestConfig& config)
: Owner(owner)
, Config(config)
- , NextPathId(NSchemeShard::RootPathId + 1)
+ , NextPathId(NSchemeShard::RootPathId + 1)
{
SyncDuration = Config.Counters->GetCounter("Producer/SyncDuration", false);
TotalPaths = Config.Counters->GetCounter("Producer/TotalPaths", false);
@@ -377,7 +377,7 @@ public:
: Owner(owner)
, Config(config)
{
- MaxPathId = NSchemeShard::RootPathId
+ MaxPathId = NSchemeShard::RootPathId
+ Config.Dirs
+ Config.Dirs * Config.ObjectsPerDir;
@@ -387,7 +387,7 @@ public:
}
void Bootstrap() {
- BatchSubscribe(NSchemeShard::RootPathId + 1);
+ BatchSubscribe(NSchemeShard::RootPathId + 1);
Become(&TThis::StateWork);
}
diff --git a/ydb/core/tx/scheme_board/populator.cpp b/ydb/core/tx/scheme_board/populator.cpp
index 15aea1d3a6b..f860bb88cb1 100644
--- a/ydb/core/tx/scheme_board/populator.cpp
+++ b/ydb/core/tx/scheme_board/populator.cpp
@@ -73,7 +73,7 @@ class TReplicaPopulator: public TMonitorableActor<TReplicaPopulator> {
deletedLocalPathIds.SetBegin(msg->DeletedPathBegin);
deletedLocalPathIds.SetEnd(msg->DeletedPathEnd);
- CurPathId = TPathId(Owner, msg->DeletedPathEnd);
+ CurPathId = TPathId(Owner, msg->DeletedPathEnd);
}
if (msg->HasDescription()) {
@@ -82,33 +82,33 @@ class TReplicaPopulator: public TMonitorableActor<TReplicaPopulator> {
if (!record.HasStatus()) {
SBP_LOG_E("Ignore description without status"
<< ": self# " << SelfId());
- } else if (record.GetStatus() != NKikimrScheme::StatusSuccess) {
+ } else if (record.GetStatus() != NKikimrScheme::StatusSuccess) {
SBP_LOG_E("Ignore description"
<< ": self# " << SelfId()
- << ", status# " << record.GetStatus()
- << ", msg# " << record.ShortDebugString());
+ << ", status# " << record.GetStatus()
+ << ", msg# " << record.ShortDebugString());
} else {
- CurPathId = GetPathId(record);
+ CurPathId = GetPathId(record);
update->SetDescribeSchemeResult(std::move(msg->Description));
}
}
- if (msg->HasMigratedPath()) {
- SBP_LOG_D("Ignore description of migrated path"
+ if (msg->HasMigratedPath()) {
+ SBP_LOG_D("Ignore description of migrated path"
<< ": self# " << SelfId()
<< ", owner# " << Owner
<< ", localPathId# " << msg->MigratedPathId);
- //this path should be described by another owner (tenant schemeshard)
- auto& migratedLocalPathIds = *update->Record.MutableMigratedLocalPathIds();
- migratedLocalPathIds.SetBegin(msg->MigratedPathId);
- migratedLocalPathIds.SetEnd(msg->MigratedPathId);
-
- CurPathId = TPathId(Owner, msg->MigratedPathId);
- }
-
+ //this path should be described by another owner (tenant schemeshard)
+ auto& migratedLocalPathIds = *update->Record.MutableMigratedLocalPathIds();
+ migratedLocalPathIds.SetBegin(msg->MigratedPathId);
+ migratedLocalPathIds.SetEnd(msg->MigratedPathId);
+
+ CurPathId = TPathId(Owner, msg->MigratedPathId);
+ }
+
if (++BatchSize < BatchSizeLimit) {
- CurPathId = CurPathId.NextId();
- Send(Parent, new TSchemeBoardEvents::TEvRequestDescribe(CurPathId, Replica));
+ CurPathId = CurPathId.NextId();
+ Send(Parent, new TSchemeBoardEvents::TEvRequestDescribe(CurPathId, Replica));
} else {
update->Record.SetNeedAck(true);
BatchSize = 0;
@@ -304,9 +304,9 @@ class TReplicaPopulator: public TMonitorableActor<TReplicaPopulator> {
if (!ev->Cookie && ev->Get()->GetPathId() == CurPathId) {
LastAckedPathId = CurPathId;
-
- CurPathId = CurPathId.NextId();
- Send(Parent, new TSchemeBoardEvents::TEvRequestDescribe(CurPathId, Replica));
+
+ CurPathId = CurPathId.NextId();
+ Send(Parent, new TSchemeBoardEvents::TEvRequestDescribe(CurPathId, Replica));
}
DequeueUpdate(ev);
@@ -489,7 +489,7 @@ private:
THashMap<TPathId, TSet<std::pair<ui64, ui64>>> UpdatesInFlight;
// used during sync
- TPathId CurPathId;
+ TPathId CurPathId;
TPathId LastAckedPathId;
ui32 BatchSize;
static constexpr ui32 BatchSizeLimit = 100;
@@ -501,7 +501,7 @@ class TPopulator: public TMonitorableActor<TPopulator> {
SelectionReplicaCache.clear();
const ui64 pathHash = CityHash64(path);
- const ui64 idHash = pathId.Hash();
+ const ui64 idHash = pathId.Hash();
TStateStorageInfo::TSelection selection;
@@ -522,7 +522,7 @@ class TPopulator: public TMonitorableActor<TPopulator> {
}
}
- void Update(const TPathId pathId, const bool isDeletion, const ui64 cookie) {
+ void Update(const TPathId pathId, const bool isDeletion, const ui64 cookie) {
auto it = Descriptions.find(pathId);
Y_VERIFY(it != Descriptions.end());
@@ -547,7 +547,7 @@ class TPopulator: public TMonitorableActor<TPopulator> {
SBP_LOG_D("Handle TSchemeBoardEvents::TEvRequestDescribe"
<< ": self# " << SelfId()
<< ", sender# " << ev->Sender
- << ", pathId# " << ev->Get()->PathId);
+ << ", pathId# " << ev->Get()->PathId);
const TActorId replicaPopulator = ev->Sender;
const TActorId replica = ev->Get()->Replica;
@@ -560,85 +560,85 @@ class TPopulator: public TMonitorableActor<TPopulator> {
return;
}
- if (Descriptions.empty()) {
- Send(replicaPopulator, new TSchemeBoardEvents::TEvDescribeResult(true));
- return;
- }
+ if (Descriptions.empty()) {
+ Send(replicaPopulator, new TSchemeBoardEvents::TEvDescribeResult(true));
+ return;
+ }
- TPathId startPathId = ev->Get()->PathId;
+ TPathId startPathId = ev->Get()->PathId;
auto it = Descriptions.end();
-
- if (ev->Get()->PathId) {
- startPathId = ev->Get()->PathId;
+
+ if (ev->Get()->PathId) {
+ startPathId = ev->Get()->PathId;
it = Descriptions.lower_bound(startPathId);
- } else {
+ } else {
it = Descriptions.begin();
startPathId = it->first;
- }
-
+ }
+
while (it != Descriptions.end()) { // skip irrelevant to the replica
- if (it->second.Record.GetStatus() == NKikimrScheme::StatusPathDoesNotExist) {
- // KIKIMR-13173
- // it is assumed that not deleted pathes present in Descriptions
- // but it might be, since we have the difference at path description and init population
- // and it is in that path description consider path deteleted even when it only planned to delete (for BSV and PQ)
- // mean while init population consider path deteleted consider path deteleted only when it is dpropped
- // globally path description should do the same thing, we are correcting it
- ++it;
- continue;
- }
-
- TPathId pathId(it->second.Record.GetPathOwnerId(), it->second.Record.GetPathId());
+ if (it->second.Record.GetStatus() == NKikimrScheme::StatusPathDoesNotExist) {
+ // KIKIMR-13173
+ // it is assumed that not deleted pathes present in Descriptions
+ // but it might be, since we have the difference at path description and init population
+ // and it is in that path description consider path deteleted even when it only planned to delete (for BSV and PQ)
+ // mean while init population consider path deteleted consider path deteleted only when it is dpropped
+ // globally path description should do the same thing, we are correcting it
+ ++it;
+ continue;
+ }
+
+ TPathId pathId(it->second.Record.GetPathOwnerId(), it->second.Record.GetPathId());
TConstArrayRef<TActorId> replicas = SelectReplicas(pathId, it->second.Record.GetPath());
- if (Find(replicas, replica) != replicas.end()) {
- break;
+ if (Find(replicas, replica) != replicas.end()) {
+ break;
}
++it;
}
if (it == Descriptions.end()) {
- if (startPathId >= MaxPathId) {
- Send(replicaPopulator, new TSchemeBoardEvents::TEvDescribeResult(true));
- return;
+ if (startPathId >= MaxPathId) {
+ Send(replicaPopulator, new TSchemeBoardEvents::TEvDescribeResult(true));
+ return;
}
-
- if (startPathId.OwnerId == Owner) {
- Send(replicaPopulator, new TSchemeBoardEvents::TEvDescribeResult(startPathId.LocalPathId, MaxPathId.LocalPathId));
- } else {
- Send(replicaPopulator, new TSchemeBoardEvents::TEvDescribeResult(1, MaxPathId.LocalPathId));
- }
- return;
- }
-
- const auto& description = it->second;
- const auto& record = description.Record;
- auto pathId = TPathId(it->second.Record.GetPathOwnerId(), it->second.Record.GetPathId());
-
- if (pathId.OwnerId != Owner) {
- // this is an alien migrated migrated path from another owner, push it as a dot
+
+ if (startPathId.OwnerId == Owner) {
+ Send(replicaPopulator, new TSchemeBoardEvents::TEvDescribeResult(startPathId.LocalPathId, MaxPathId.LocalPathId));
+ } else {
+ Send(replicaPopulator, new TSchemeBoardEvents::TEvDescribeResult(1, MaxPathId.LocalPathId));
+ }
+ return;
+ }
+
+ const auto& description = it->second;
+ const auto& record = description.Record;
+ auto pathId = TPathId(it->second.Record.GetPathOwnerId(), it->second.Record.GetPathId());
+
+ if (pathId.OwnerId != Owner) {
+ // this is an alien migrated migrated path from another owner, push it as a dot
Send(replicaPopulator, new TSchemeBoardEvents::TEvDescribeResult(0, 0, description));
- return;
- }
-
- TLocalPathId deletedBegin = startPathId.LocalPathId;
+ return;
+ }
+
+ TLocalPathId deletedBegin = startPathId.LocalPathId;
TLocalPathId deletedEnd = record.GetPathId() - 1;
-
- if (startPathId.OwnerId != Owner) {
- deletedBegin = 1;
- }
-
- if (deletedEnd <= deletedBegin) {
- // if pushing migrated pathes hasn'n finished jet, we do not set up deteled ranges between them
- deletedBegin = 0;
- deletedEnd = 0;
- }
-
- if (record.GetStatus() == NKikimrScheme::EStatus::StatusRedirectDomain) {
- // this path has been migrated to another owner
+
+ if (startPathId.OwnerId != Owner) {
+ deletedBegin = 1;
+ }
+
+ if (deletedEnd <= deletedBegin) {
+ // if pushing migrated pathes hasn'n finished jet, we do not set up deteled ranges between them
+ deletedBegin = 0;
+ deletedEnd = 0;
+ }
+
+ if (record.GetStatus() == NKikimrScheme::EStatus::StatusRedirectDomain) {
+ // this path has been migrated to another owner
Send(replicaPopulator, new TSchemeBoardEvents::TEvDescribeResult(deletedBegin, deletedEnd, it->first.LocalPathId));
- return;
- }
-
+ return;
+ }
+
Send(replicaPopulator, new TSchemeBoardEvents::TEvDescribeResult(deletedBegin, deletedEnd, description));
}
@@ -664,24 +664,24 @@ class TPopulator: public TMonitorableActor<TPopulator> {
Send(ev->Sender, std::move(update));
}
- void DelayUpdate(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
- SBP_LOG_D("DelayUpdate TEvSchemeShard::TEvDescribeSchemeResult"
+ void DelayUpdate(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
+ SBP_LOG_D("DelayUpdate TEvSchemeShard::TEvDescribeSchemeResult"
<< ": self# " << SelfId()
<< ", sender# " << ev->Sender
<< ", cookie# " << ev->Cookie);
- SBP_LOG_T("Message:\n" << ev->Get()->ToString().substr(0, 1000));
-
+ SBP_LOG_T("Message:\n" << ev->Get()->ToString().substr(0, 1000));
+
DelayedUpdates.emplace_back(ev.Release());
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
- SBP_LOG_D("Handle TEvSchemeShard::TEvDescribeSchemeResult"
+ void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
+ SBP_LOG_D("Handle TEvSchemeShard::TEvDescribeSchemeResult"
<< ": self# " << SelfId()
<< ", sender# " << ev->Sender
<< ", cookie# " << ev->Cookie);
SBP_LOG_T("Message:\n" << ev->Get()->ToString().substr(0, 1000));
- auto* msg = static_cast<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder*>(ev->Get());
+ auto* msg = static_cast<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder*>(ev->Get());
auto& record = msg->Record;
if (!record.HasStatus()) {
@@ -690,32 +690,32 @@ class TPopulator: public TMonitorableActor<TPopulator> {
return;
}
- const TPathId pathId = GetPathId(record);
- const bool isDeletion = record.GetStatus() == NKikimrScheme::StatusPathDoesNotExist;
+ const TPathId pathId = GetPathId(record);
+ const bool isDeletion = record.GetStatus() == NKikimrScheme::StatusPathDoesNotExist;
const ui64 version = isDeletion ? Max<ui64>() : GetPathVersion(record);
SBP_LOG_N("Update description"
<< ": self# " << SelfId()
<< ", owner# " << Owner
- << ", pathId# " << pathId
- << ", cookie# " << ev->Cookie
+ << ", pathId# " << pathId
+ << ", cookie# " << ev->Cookie
<< ", is deletion# " << (isDeletion ? "true" : "false"));
if (isDeletion) {
- if (!Descriptions.contains(pathId)) {
+ if (!Descriptions.contains(pathId)) {
SBP_LOG_N("Immediate ack for deleted path"
<< ": self# " << SelfId()
<< ", sender# " << ev->Sender
<< ", cookie# " << ev->Cookie
- << ", pathId# " << pathId);
+ << ", pathId# " << pathId);
- auto ack = MakeHolder<TSchemeBoardEvents::TEvUpdateAck>(Owner, Generation, pathId, Max<ui64>());
+ auto ack = MakeHolder<TSchemeBoardEvents::TEvUpdateAck>(Owner, Generation, pathId, Max<ui64>());
Send(ev->Sender, std::move(ack), 0, ev->Cookie);
return;
}
} else {
Descriptions[pathId] = TTwoPartDescription(std::move(msg->PreSerializedData), std::move(record));
- MaxPathId = Max(MaxPathId, pathId.NextId());
+ MaxPathId = Max(MaxPathId, pathId.NextId());
}
auto it = UpdateAcks.find(ev->Cookie);
@@ -724,12 +724,12 @@ class TPopulator: public TMonitorableActor<TPopulator> {
}
it->second.AckTo = ev->Sender;
- it->second.PathAcks.emplace(std::make_pair(pathId, version), 0);
+ it->second.PathAcks.emplace(std::make_pair(pathId, version), 0);
- Update(pathId, isDeletion, ev->Cookie);
+ Update(pathId, isDeletion, ev->Cookie);
if (isDeletion) {
- Descriptions.erase(pathId);
+ Descriptions.erase(pathId);
}
}
@@ -751,22 +751,22 @@ class TPopulator: public TMonitorableActor<TPopulator> {
return;
}
- const TPathId pathId = ev->Get()->GetPathId();
+ const TPathId pathId = ev->Get()->GetPathId();
const ui64 version = record.GetVersion();
- auto pathIt = it->second.PathAcks.lower_bound({pathId, 0});
+ auto pathIt = it->second.PathAcks.lower_bound({pathId, 0});
while (pathIt != it->second.PathAcks.end()
- && pathIt->first.first == pathId
+ && pathIt->first.first == pathId
&& pathIt->first.second <= version) {
if (++pathIt->second > (GroupInfo->NToSelect / 2)) {
SBP_LOG_N("Ack update"
<< ": self# " << SelfId()
<< ", ack to# " << it->second.AckTo
<< ", cookie# " << ev->Cookie
- << ", pathId# " << pathId
+ << ", pathId# " << pathId
<< ", version# " << pathIt->first.second);
- auto ack = MakeHolder<TSchemeBoardEvents::TEvUpdateAck>(Owner, Generation, pathId, pathIt->first.second);
+ auto ack = MakeHolder<TSchemeBoardEvents::TEvUpdateAck>(Owner, Generation, pathId, pathIt->first.second);
Send(it->second.AckTo, std::move(ack), 0, ev->Cookie);
auto eraseIt = pathIt;
@@ -804,7 +804,7 @@ class TPopulator: public TMonitorableActor<TPopulator> {
ReplicaToReplicaPopulator.emplace(replica, Register(replicaPopulator, TMailboxType::ReadAsFilled));
}
- Become(&TThis::StateWork);
+ Become(&TThis::StateWork);
ReplayUpdates(DelayedUpdates);
}
@@ -862,7 +862,7 @@ class TPopulator: public TMonitorableActor<TPopulator> {
TString json;
if (desc) {
- NKikimrScheme::TEvDescribeSchemeResult fullProto;
+ NKikimrScheme::TEvDescribeSchemeResult fullProto;
Y_PROTOBUF_SUPPRESS_NODISCARD fullProto.ParseFromString(desc->PreSerialized);
fullProto.MergeFrom(desc->Record);
@@ -915,7 +915,7 @@ public:
, Generation(generation)
, StateStorageGroup(ssId)
, Descriptions(std::move(descriptions))
- , MaxPathId(TPathId(owner, maxPathId))
+ , MaxPathId(TPathId(owner, maxPathId))
{
}
@@ -931,7 +931,7 @@ public:
switch (ev->GetTypeRewrite()) {
hFunc(TEvStateStorage::TEvListSchemeBoardResult, Handle);
- hFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, DelayUpdate);
+ hFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, DelayUpdate);
hFunc(TSchemeBoardMonEvents::TEvInfoRequest, Handle);
hFunc(TSchemeBoardMonEvents::TEvDescribeRequest, Handle);
@@ -946,7 +946,7 @@ public:
hFunc(TSchemeBoardEvents::TEvRequestDescribe, Handle);
hFunc(TSchemeBoardEvents::TEvRequestUpdate, Handle);
- hFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ hFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
hFunc(TSchemeBoardEvents::TEvUpdateAck, Handle);
hFunc(TSchemeBoardMonEvents::TEvInfoRequest, Handle);
@@ -971,7 +971,7 @@ private:
const ui64 StateStorageGroup;
TMap<TPathId, TTwoPartDescription> Descriptions;
- TPathId MaxPathId;
+ TPathId MaxPathId;
TDelayedUpdates DelayedUpdates;
@@ -982,10 +982,10 @@ private:
struct TUpdateAckInfo {
TActorId AckTo;
- TMap<std::pair<TPathId, ui64>, ui32> PathAcks;
+ TMap<std::pair<TPathId, ui64>, ui32> PathAcks;
};
- THashMap<ui64, TUpdateAckInfo> UpdateAcks; // ui64 is a cookie
+ THashMap<ui64, TUpdateAckInfo> UpdateAcks; // ui64 is a cookie
}; // TPopulator
diff --git a/ydb/core/tx/scheme_board/replica.cpp b/ydb/core/tx/scheme_board/replica.cpp
index 31c09f76980..638656e91db 100644
--- a/ydb/core/tx/scheme_board/replica.cpp
+++ b/ydb/core/tx/scheme_board/replica.cpp
@@ -33,7 +33,7 @@ namespace NSchemeBoard {
#define SBR_LOG_E(stream) SB_LOG_E(SCHEME_BOARD_REPLICA, stream)
class TReplica: public TMonitorableActor<TReplica> {
- using TDescribeSchemeResult = NKikimrScheme::TEvDescribeSchemeResult;
+ using TDescribeSchemeResult = NKikimrScheme::TEvDescribeSchemeResult;
using TCapabilities = NKikimrSchemeBoard::TEvSubscribe::TCapabilities;
public:
@@ -222,31 +222,31 @@ public:
}
explicit TDescription(TReplica* owner, const TString& path, const TPathId& pathId)
- : Owner(owner)
- , Path(path)
- , PathId(pathId)
- {
+ : Owner(owner)
+ , Path(path)
+ , PathId(pathId)
+ {
TrackMemory();
- }
-
- explicit TDescription(
+ }
+
+ explicit TDescription(
TReplica* owner,
const TPathId& pathId,
TDescribeSchemeResult&& describeSchemeResult)
: Owner(owner)
- , PathId(pathId)
- , DescribeSchemeResult(std::move(describeSchemeResult))
- {
+ , PathId(pathId)
+ , DescribeSchemeResult(std::move(describeSchemeResult))
+ {
CalculateResultSize();
TrackMemory();
- }
-
- explicit TDescription(
+ }
+
+ explicit TDescription(
TReplica* owner,
- const TString& path,
- const TPathId& pathId,
- TDescribeSchemeResult&& describeSchemeResult)
- : Owner(owner)
+ const TString& path,
+ const TPathId& pathId,
+ TDescribeSchemeResult&& describeSchemeResult)
+ : Owner(owner)
, Path(path)
, PathId(pathId)
, DescribeSchemeResult(std::move(describeSchemeResult))
@@ -300,7 +300,7 @@ public:
<< ": self# " << ToString()
<< ", other# " << other.ToString());
- SBR_LOG_T("Merge descriptions"
+ SBR_LOG_T("Merge descriptions"
<< ": self# " << Owner->SelfId()
<< ", left path# " << Path
<< ", left pathId# " << PathId
@@ -308,7 +308,7 @@ public:
<< ", rigth path# " << other.Path
<< ", rigth pathId# " << other.PathId
<< ", rigth version# " << other.GetVersion());
-
+
UntrackMemory();
other.UntrackMemory();
TrackNotify = false;
@@ -374,14 +374,14 @@ public:
return ::NKikimr::NSchemeBoard::GetPathVersion(DescribeSchemeResult);
}
- TDomainId GetDomainId() const {
- return IsFilled() ? ::NKikimr::NSchemeBoard::GetDomainId(DescribeSchemeResult) : TDomainId();
- }
-
- TSet<ui64> GetAbandonedSchemeShardIds() const {
- return IsFilled() ? ::NKikimr::NSchemeBoard::GetAbandonedSchemeShardIds(DescribeSchemeResult) : TSet<ui64>();
- }
-
+ TDomainId GetDomainId() const {
+ return IsFilled() ? ::NKikimr::NSchemeBoard::GetDomainId(DescribeSchemeResult) : TDomainId();
+ }
+
+ TSet<ui64> GetAbandonedSchemeShardIds() const {
+ return IsFilled() ? ::NKikimr::NSchemeBoard::GetAbandonedSchemeShardIds(DescribeSchemeResult) : TSet<ui64>();
+ }
+
bool IsFilled() const {
return DescribeSchemeResult.ByteSizeLong();
}
@@ -520,25 +520,25 @@ private:
return Descriptions.Upsert(path, TDescription(this, path));
}
- TDescription& UpsertDescription(const TString& path, const TPathId& pathId) {
- SBR_LOG_I("Upsert description"
+ TDescription& UpsertDescription(const TString& path, const TPathId& pathId) {
+ SBR_LOG_I("Upsert description"
<< ": self# " << SelfId()
<< ", path# " << path
<< ", pathId# " << pathId);
-
- return Descriptions.Upsert(path, pathId, TDescription(this, path, pathId));
- }
-
- template <typename TPath>
+
+ return Descriptions.Upsert(path, pathId, TDescription(this, path, pathId));
+ }
+
+ template <typename TPath>
TDescription& UpsertDescription(const TPath path, TDescription&& description) {
- SBR_LOG_I("Upsert description"
+ SBR_LOG_I("Upsert description"
<< ": self# " << SelfId()
<< ", path# " << path);
-
+
return Descriptions.Upsert(path, std::move(description));
- }
-
- TDescription& UpsertDescription(
+ }
+
+ TDescription& UpsertDescription(
const TString& path,
const TPathId& pathId,
TDescribeSchemeResult&& describeSchemeResult
@@ -567,50 +567,50 @@ private:
return;
}
- auto path = desc->GetPath();
-
+ auto path = desc->GetPath();
+
SBR_LOG_I("Delete description"
<< ": self# " << SelfId()
- << ", path# " << path
+ << ", path# " << path
<< ", pathId# " << pathId);
- if (TDescription* descByPath = Descriptions.FindPtr(path)) {
- if (descByPath != desc && descByPath->IsFilled()) {
- if (descByPath->GetPathId().OwnerId != pathId.OwnerId) {
- auto curPathId = descByPath->GetPathId();
- auto curDomainId = descByPath->GetDomainId();
- auto domainId = desc->GetDomainId();
-
- if (curDomainId == pathId) { //Deletion from GSS
- SBR_LOG_N("Delete description by GSS"
+ if (TDescription* descByPath = Descriptions.FindPtr(path)) {
+ if (descByPath != desc && descByPath->IsFilled()) {
+ if (descByPath->GetPathId().OwnerId != pathId.OwnerId) {
+ auto curPathId = descByPath->GetPathId();
+ auto curDomainId = descByPath->GetDomainId();
+ auto domainId = desc->GetDomainId();
+
+ if (curDomainId == pathId) { //Deletion from GSS
+ SBR_LOG_N("Delete description by GSS"
<< ": self# " << SelfId()
<< ", path# " << path
<< ", pathId# " << pathId
<< ", domainId# " << domainId
<< ", curPathId# " << curPathId
<< ", curDomainId# " << curDomainId);
-
- Descriptions.DeleteIndex(path);
- UpsertDescription(path, pathId);
- RelinkSubscribers(descByPath, path);
+
+ Descriptions.DeleteIndex(path);
+ UpsertDescription(path, pathId);
+ RelinkSubscribers(descByPath, path);
descByPath->Clear();
- }
- }
- }
- }
-
+ }
+ }
+ }
+ }
+
desc->Clear();
}
- void RelinkSubscribers(TDescription* fromDesc, const TString& path) {
+ void RelinkSubscribers(TDescription* fromDesc, const TString& path) {
for (const auto& [subscriber, info] : fromDesc->GetSubscribers(SUBSCRIPTION_BY_PATH)) {
- fromDesc->Unsubscribe(subscriber);
+ fromDesc->Unsubscribe(subscriber);
Subscribers.erase(subscriber);
SubscribeBy(subscriber, path, info.GetDomainOwnerId(), info.GetCapabilities(), false);
- }
- }
-
+ }
+ }
+
void SoftDeleteDescriptions(const TPathId& begin, const TPathId& end) {
const auto& pathIdIndex = Descriptions.GetSecondaryIndex();
@@ -729,21 +729,21 @@ private:
return;
}
- TPathId ackPathId;
+ TPathId ackPathId;
if (record.HasDeletedLocalPathIds()) {
- ackPathId = TPathId(owner, record.GetDeletedLocalPathIds().GetEnd());
+ ackPathId = TPathId(owner, record.GetDeletedLocalPathIds().GetEnd());
}
if (record.HasLocalPathId()) {
- ackPathId = ev->Get()->GetPathId();
+ ackPathId = ev->Get()->GetPathId();
+ }
+
+ if (record.HasMigratedLocalPathIds()) {
+ ackPathId = TPathId(owner, record.GetMigratedLocalPathIds().GetEnd());
}
- if (record.HasMigratedLocalPathIds()) {
- ackPathId = TPathId(owner, record.GetMigratedLocalPathIds().GetEnd());
- }
-
- const ui64 version = GetVersion(ackPathId);
+ const ui64 version = GetVersion(ackPathId);
Send(ev->Sender, new TSchemeBoardEvents::TEvUpdateAck(owner, generation, ackPathId, version), 0, ev->Cookie);
}
@@ -793,7 +793,7 @@ private:
<< ", cookie# " << ev->Cookie
<< ", owner# " << owner
<< ", generation# " << generation);
- SBR_LOG_T("Message:\n" << ev->Get()->ToString().substr(0, 10000));
+ SBR_LOG_T("Message:\n" << ev->Get()->ToString().substr(0, 10000));
const auto populatorIt = Populators.find(owner);
if (populatorIt == Populators.end()) {
@@ -825,19 +825,19 @@ private:
}
const TString& path = record.GetPath();
- const TPathId pathId = ev->Get()->GetPathId();
+ const TPathId pathId = ev->Get()->GetPathId();
SBR_LOG_N("Update description"
<< ": self# " << SelfId()
<< ", path# " << path
- << ", pathId# " << pathId
- << ", deletion# " << (record.GetIsDeletion() ? "true" : "false"));
+ << ", pathId# " << pathId
+ << ", deletion# " << (record.GetIsDeletion() ? "true" : "false"));
if (record.GetIsDeletion()) {
SoftDeleteDescription(pathId, true);
- return AckUpdate(ev);
- }
-
+ return AckUpdate(ev);
+ }
+
if (TDescription* desc = Descriptions.FindPtr(pathId)) {
if (desc->IsExplicitlyDeleted()) {
SBR_LOG_N("Path was explicitly deleted, ignoring"
@@ -849,49 +849,49 @@ private:
}
}
- TDescription* desc = Descriptions.FindPtr(path);
- if (!desc) {
- UpsertDescription(path, pathId, std::move(*record.MutableDescribeSchemeResult()));
- return AckUpdate(ev);
- }
-
- if (!desc->GetPathId()) {
- UpsertDescription(path, pathId, std::move(*record.MutableDescribeSchemeResult()));
- return AckUpdate(ev);
- }
-
- auto curPathId = desc->GetPathId();
-
+ TDescription* desc = Descriptions.FindPtr(path);
+ if (!desc) {
+ UpsertDescription(path, pathId, std::move(*record.MutableDescribeSchemeResult()));
+ return AckUpdate(ev);
+ }
+
+ if (!desc->GetPathId()) {
+ UpsertDescription(path, pathId, std::move(*record.MutableDescribeSchemeResult()));
+ return AckUpdate(ev);
+ }
+
+ auto curPathId = desc->GetPathId();
+
if (curPathId.OwnerId == pathId.OwnerId || !desc->IsFilled()) {
- if (curPathId > pathId) {
+ if (curPathId > pathId) {
return AckUpdate(ev);
}
- if (curPathId < pathId) {
- SoftDeleteDescription(desc->GetPathId());
+ if (curPathId < pathId) {
+ SoftDeleteDescription(desc->GetPathId());
Descriptions.DeleteIndex(path);
RelinkSubscribers(desc, path);
}
UpsertDescription(path, pathId, std::move(*record.MutableDescribeSchemeResult()));
- return AckUpdate(ev);
+ return AckUpdate(ev);
}
- Y_VERIFY_S(desc->IsFilled(), "desc :"
+ Y_VERIFY_S(desc->IsFilled(), "desc :"
<< ": path# " << desc->GetPath()
<< ", pathId# " << desc->GetPathId()
<< ", domainId# " << desc->GetDomainId()
<< ", version# " << desc->GetVersion());
-
- auto curDomainId = desc->GetDomainId();
- auto domainId = GetDomainId(record.GetDescribeSchemeResult());
-
- if (curPathId == domainId) { //Update from TSS, GSS->TSS
-
- // it is only because we need to manage undo of upgrade subdomain, finally remove it
- auto abandonedSchemeShards = desc->GetAbandonedSchemeShardIds();
- if (abandonedSchemeShards.contains(pathId.OwnerId)) { //TSS is ignored, present GSS reverted it
- SBR_LOG_N("Replace GSS by TSS description is rejected, GSS implicitly knows that TSS has been reverted"
+
+ auto curDomainId = desc->GetDomainId();
+ auto domainId = GetDomainId(record.GetDescribeSchemeResult());
+
+ if (curPathId == domainId) { //Update from TSS, GSS->TSS
+
+ // it is only because we need to manage undo of upgrade subdomain, finally remove it
+ auto abandonedSchemeShards = desc->GetAbandonedSchemeShardIds();
+ if (abandonedSchemeShards.contains(pathId.OwnerId)) { //TSS is ignored, present GSS reverted it
+ SBR_LOG_N("Replace GSS by TSS description is rejected, GSS implicitly knows that TSS has been reverted"
", but still inject description only by pathId for safe"
<< ": self# " << SelfId()
<< ", path# " << path
@@ -899,44 +899,44 @@ private:
<< ", domainId# " << domainId
<< ", curPathId# " << curPathId
<< ", curDomainId# " << curDomainId);
- UpsertDescription(pathId, TDescription(this, path, pathId, std::move(*record.MutableDescribeSchemeResult())));
- return AckUpdate(ev);
- }
-
- SBR_LOG_N("Replace GSS by TSS description"
+ UpsertDescription(pathId, TDescription(this, path, pathId, std::move(*record.MutableDescribeSchemeResult())));
+ return AckUpdate(ev);
+ }
+
+ SBR_LOG_N("Replace GSS by TSS description"
<< ": self# " << SelfId()
<< ", path# " << path
<< ", pathId# " << pathId
<< ", domainId# " << domainId
<< ", curPathId# " << curPathId
<< ", curDomainId# " << curDomainId);
- //unlick GSS desc by path
- Descriptions.DeleteIndex(path);
- RelinkSubscribers(desc, path);
- UpsertDescription(path, pathId, std::move(*record.MutableDescribeSchemeResult()));
- return AckUpdate(ev);
- }
-
- if (curDomainId == pathId) { //Update from GSS, TSS->GSS
-
- // it is only because we need to manage undo of upgrade subdomain, finally remove it
- auto abandonedSchemeShards = GetAbandonedSchemeShardIds(record.GetDescribeSchemeResult());
- if (abandonedSchemeShards.contains(curPathId.OwnerId)) { //GSS reverts TSS
- SBR_LOG_N("Replace TSS by GSS description, TSS was implicitly reverted by GSS"
+ //unlick GSS desc by path
+ Descriptions.DeleteIndex(path);
+ RelinkSubscribers(desc, path);
+ UpsertDescription(path, pathId, std::move(*record.MutableDescribeSchemeResult()));
+ return AckUpdate(ev);
+ }
+
+ if (curDomainId == pathId) { //Update from GSS, TSS->GSS
+
+ // it is only because we need to manage undo of upgrade subdomain, finally remove it
+ auto abandonedSchemeShards = GetAbandonedSchemeShardIds(record.GetDescribeSchemeResult());
+ if (abandonedSchemeShards.contains(curPathId.OwnerId)) { //GSS reverts TSS
+ SBR_LOG_N("Replace TSS by GSS description, TSS was implicitly reverted by GSS"
<< ": self# " << SelfId()
<< ", path# " << path
<< ", pathId# " << pathId
<< ", domainId# " << domainId
<< ", curPathId# " << curPathId
<< ", curDomainId# " << curDomainId);
- //unlick TSS desc by path
- Descriptions.DeleteIndex(path);
- RelinkSubscribers(desc, path);
- UpsertDescription(path, pathId, std::move(*record.MutableDescribeSchemeResult()));
- return AckUpdate(ev);
- }
-
- SBR_LOG_N("Inject description only by pathId, it is update from GSS"
+ //unlick TSS desc by path
+ Descriptions.DeleteIndex(path);
+ RelinkSubscribers(desc, path);
+ UpsertDescription(path, pathId, std::move(*record.MutableDescribeSchemeResult()));
+ return AckUpdate(ev);
+ }
+
+ SBR_LOG_N("Inject description only by pathId, it is update from GSS"
<< ": self# " << SelfId()
<< ", path# " << path
<< ", pathId# " << pathId
@@ -944,60 +944,60 @@ private:
<< ", curPathId# " << curPathId
<< ", curDomainId# " << curDomainId);
UpsertDescription(pathId, TDescription(this, path, pathId, std::move(*record.MutableDescribeSchemeResult())));
- return AckUpdate(ev);
- }
-
- if (curDomainId == domainId) {
- if (curPathId > pathId) {
- SBR_LOG_N("Totally ignore description, path with obsolete pathId"
- << ": self# " << SelfId()
- << ", path# " << path
- << ", pathId# " << pathId
- << ", domainId# " << domainId
- << ", curPathId# " << curPathId
- << ", curDomainId# " << curDomainId);
- return AckUpdate(ev);
- }
-
- if (curPathId < pathId) {
- SBR_LOG_N("Update description by newest path form tenant schemeshard"
- << ": self# " << SelfId()
- << ", path# " << path
- << ", pathId# " << pathId
- << ", domainId# " << domainId
- << ", curPathId# " << curPathId
- << ", curDomainId# " << curDomainId);
-
- SoftDeleteDescription(desc->GetPathId());
- Descriptions.DeleteIndex(path);
- RelinkSubscribers(desc, path);
- }
-
- UpsertDescription(path, pathId, std::move(*record.MutableDescribeSchemeResult()));
- return AckUpdate(ev);
- } else if (curDomainId < domainId) {
- SBR_LOG_N("Update description by newest path with newer domainId"
+ return AckUpdate(ev);
+ }
+
+ if (curDomainId == domainId) {
+ if (curPathId > pathId) {
+ SBR_LOG_N("Totally ignore description, path with obsolete pathId"
+ << ": self# " << SelfId()
+ << ", path# " << path
+ << ", pathId# " << pathId
+ << ", domainId# " << domainId
+ << ", curPathId# " << curPathId
+ << ", curDomainId# " << curDomainId);
+ return AckUpdate(ev);
+ }
+
+ if (curPathId < pathId) {
+ SBR_LOG_N("Update description by newest path form tenant schemeshard"
+ << ": self# " << SelfId()
+ << ", path# " << path
+ << ", pathId# " << pathId
+ << ", domainId# " << domainId
+ << ", curPathId# " << curPathId
+ << ", curDomainId# " << curDomainId);
+
+ SoftDeleteDescription(desc->GetPathId());
+ Descriptions.DeleteIndex(path);
+ RelinkSubscribers(desc, path);
+ }
+
+ UpsertDescription(path, pathId, std::move(*record.MutableDescribeSchemeResult()));
+ return AckUpdate(ev);
+ } else if (curDomainId < domainId) {
+ SBR_LOG_N("Update description by newest path with newer domainId"
<< ": self# " << SelfId()
<< ", path# " << path
<< ", pathId# " << pathId
<< ", domainId# " << domainId
<< ", curPathId# " << curPathId
<< ", curDomainId# " << curDomainId);
- Descriptions.DeleteIndex(path);
- RelinkSubscribers(desc, path);
- UpsertDescription(path, pathId, std::move(*record.MutableDescribeSchemeResult()));
- return AckUpdate(ev);
- } else {
- SBR_LOG_N("Totally ignore description, path with obsolete domainId"
+ Descriptions.DeleteIndex(path);
+ RelinkSubscribers(desc, path);
+ UpsertDescription(path, pathId, std::move(*record.MutableDescribeSchemeResult()));
+ return AckUpdate(ev);
+ } else {
+ SBR_LOG_N("Totally ignore description, path with obsolete domainId"
<< ": self# " << SelfId()
<< ", path# " << path
<< ", pathId# " << pathId
<< ", domainId# " << domainId
<< ", curPathId# " << curPathId
<< ", curDomainId# " << curDomainId);
- return AckUpdate(ev);
- }
-
+ return AckUpdate(ev);
+ }
+
Y_FAIL_S("Can't insert old description, no relation between obj"
<< ": self# " << SelfId()
<< ", path# " << path
@@ -1087,7 +1087,7 @@ private:
if (record.HasPath()) {
SubscribeBy(ev->Sender, record.GetPath(), domainOwnerId, capabilities);
} else {
- Y_VERIFY(record.HasPathOwnerId() && record.HasLocalPathId());
+ Y_VERIFY(record.HasPathOwnerId() && record.HasLocalPathId());
SubscribeBy(ev->Sender, TPathId(record.GetPathOwnerId(), record.GetLocalPathId()), domainOwnerId, capabilities);
}
}
@@ -1103,7 +1103,7 @@ private:
if (record.HasPath()) {
UnsubscribeBy(ev->Sender, record.GetPath());
} else {
- Y_VERIFY(record.HasPathOwnerId() && record.HasLocalPathId());
+ Y_VERIFY(record.HasPathOwnerId() && record.HasLocalPathId());
UnsubscribeBy(ev->Sender, TPathId(record.GetPathOwnerId(), record.GetLocalPathId()));
}
}
diff --git a/ydb/core/tx/scheme_board/replica_ut.cpp b/ydb/core/tx/scheme_board/replica_ut.cpp
index 58b0d760081..10113c7bcce 100644
--- a/ydb/core/tx/scheme_board/replica_ut.cpp
+++ b/ydb/core/tx/scheme_board/replica_ut.cpp
@@ -168,7 +168,7 @@ void TReplicaTest::Update() {
const TActorId edge = Context->AllocateEdgeActor();
Context->HandshakeReplica(Replica, edge, 1, 1);
- Context->Send(Replica, edge, GenerateUpdate(GenerateDescribe("path", TPathId(1, 1)), 1, 1));
+ Context->Send(Replica, edge, GenerateUpdate(GenerateDescribe("path", TPathId(1, 1)), 1, 1));
auto checks = [](const auto& record) {
UNIT_ASSERT_VALUES_EQUAL(1, record.GetPathOwnerId());
@@ -192,21 +192,21 @@ void TReplicaTest::Update() {
}
void TReplicaTest::Delete() {
- auto describe = GenerateDescribe("path", TPathId(42, 1));
-
+ auto describe = GenerateDescribe("path", TPathId(42, 1));
+
const TActorId edge = Context->AllocateEdgeActor();
Context->HandshakeReplica(Replica, edge, 1, 1);
Context->Send(Replica, edge, GenerateUpdate(describe, 1, 1));
{
- auto ev = Context->SubscribeReplica(Replica, Context->AllocateEdgeActor(), "path");
+ auto ev = Context->SubscribeReplica(Replica, Context->AllocateEdgeActor(), "path");
UNIT_ASSERT_VALUES_EQUAL("path", ev->Get()->GetRecord().GetPath());
UNIT_ASSERT_VALUES_EQUAL(false, ev->Get()->GetRecord().GetIsDeletion());
}
{
- auto ev = Context->SubscribeReplica(Replica, Context->AllocateEdgeActor(), TPathId(42, 1));
+ auto ev = Context->SubscribeReplica(Replica, Context->AllocateEdgeActor(), TPathId(42, 1));
UNIT_ASSERT_VALUES_EQUAL(1, ev->Get()->GetRecord().GetLocalPathId());
UNIT_ASSERT_VALUES_EQUAL(false, ev->Get()->GetRecord().GetIsDeletion());
}
@@ -214,32 +214,32 @@ void TReplicaTest::Delete() {
Context->Send(Replica, edge, GenerateUpdate(describe, 1, 1, true));
{
- auto ev = Context->SubscribeReplica(Replica, Context->AllocateEdgeActor(), "path");
+ auto ev = Context->SubscribeReplica(Replica, Context->AllocateEdgeActor(), "path");
UNIT_ASSERT_VALUES_EQUAL("path", ev->Get()->GetRecord().GetPath());
UNIT_ASSERT_VALUES_EQUAL(true, ev->Get()->GetRecord().GetIsDeletion());
UNIT_ASSERT_VALUES_EQUAL(Max<ui64>(), ev->Get()->GetRecord().GetVersion());
- }
-
- {
- auto ev = Context->SubscribeReplica(Replica, Context->AllocateEdgeActor(), TPathId(42, 1));
+ }
+
+ {
+ auto ev = Context->SubscribeReplica(Replica, Context->AllocateEdgeActor(), TPathId(42, 1));
UNIT_ASSERT_VALUES_EQUAL(1, ev->Get()->GetRecord().GetLocalPathId());
UNIT_ASSERT_VALUES_EQUAL(true, ev->Get()->GetRecord().GetIsDeletion());
UNIT_ASSERT_VALUES_EQUAL(Max<ui64>(), ev->Get()->GetRecord().GetVersion());
}
{
- auto ev = Context->SubscribeReplica(Replica, Context->AllocateEdgeActor(), "path");
+ auto ev = Context->SubscribeReplica(Replica, Context->AllocateEdgeActor(), "path");
UNIT_ASSERT_VALUES_EQUAL("path", ev->Get()->GetRecord().GetPath());
UNIT_ASSERT_VALUES_EQUAL(true, ev->Get()->GetRecord().GetIsDeletion());
UNIT_ASSERT_VALUES_EQUAL(Max<ui64>(), ev->Get()->GetRecord().GetVersion());
}
-
+
}
void TReplicaTest::UpdateWithoutHandshake() {
const TActorId edge = Context->AllocateEdgeActor();
- Context->Send(Replica, edge, GenerateUpdate(GenerateDescribe("path", TPathId(1, 1)), 1, 1));
+ Context->Send(Replica, edge, GenerateUpdate(GenerateDescribe("path", TPathId(1, 1)), 1, 1));
{
auto ev = Context->SubscribeReplica(Replica, edge, "path");
@@ -258,7 +258,7 @@ void TReplicaTest::UpdateWithStaleGeneration() {
const TActorId edge = Context->AllocateEdgeActor();
Context->HandshakeReplica(Replica, edge, 1, 1);
- Context->Send(Replica, edge, GenerateUpdate(GenerateDescribe("path", TPathId(1, 1)), 1, 0));
+ Context->Send(Replica, edge, GenerateUpdate(GenerateDescribe("path", TPathId(1, 1)), 1, 0));
{
auto ev = Context->SubscribeReplica(Replica, edge, "path");
@@ -274,7 +274,7 @@ void TReplicaTest::UpdateWithStaleGeneration() {
}
void TReplicaTest::Subscribe() {
- auto describe = GenerateDescribe("path", TPathId(1, 1));
+ auto describe = GenerateDescribe("path", TPathId(1, 1));
const TActorId edge = Context->AllocateEdgeActor();
@@ -308,7 +308,7 @@ void TReplicaTest::SubscribeUnknownPath() {
}
void TReplicaTest::Unsubscribe() {
- auto describe = GenerateDescribe("path", TPathId(1, 1));
+ auto describe = GenerateDescribe("path", TPathId(1, 1));
const TActorId edge = Context->AllocateEdgeActor();
@@ -338,7 +338,7 @@ void TReplicaTest::UnsubscribeUnknownPath() {
}
void TReplicaTest::DoubleUnsubscribe() {
- auto describe = GenerateDescribe("path", TPathId(1, 1));
+ auto describe = GenerateDescribe("path", TPathId(1, 1));
const TActorId edge = Context->AllocateEdgeActor();
@@ -354,7 +354,7 @@ void TReplicaTest::DoubleUnsubscribe() {
}
void TReplicaTest::UnsubscribeWithoutSubscribe() {
- auto describe = GenerateDescribe("path", TPathId(1, 1));
+ auto describe = GenerateDescribe("path", TPathId(1, 1));
const TActorId edge = Context->AllocateEdgeActor();
@@ -365,7 +365,7 @@ void TReplicaTest::UnsubscribeWithoutSubscribe() {
}
void TReplicaTest::Merge() {
- auto describe = GenerateDescribe("path", TPathId(1, 1));
+ auto describe = GenerateDescribe("path", TPathId(1, 1));
const TActorId populator = Context->AllocateEdgeActor();
const TActorId subscriberA = Context->AllocateEdgeActor();
@@ -386,7 +386,7 @@ void TReplicaTest::Merge() {
}
void TReplicaTest::DoubleDelete() {
- auto describe = GenerateDescribe("path", TPathId(1, 1));
+ auto describe = GenerateDescribe("path", TPathId(1, 1));
const TActorId populator = Context->AllocateEdgeActor();
Context->HandshakeReplica(Replica, populator);
@@ -411,7 +411,7 @@ void TReplicaTest::SyncVersion() {
const ui64 version = 100500;
Context->HandshakeReplica(Replica, edge);
- Context->Send(Replica, edge, GenerateUpdate(GenerateDescribe("path", TPathId(1, 1), version)));
+ Context->Send(Replica, edge, GenerateUpdate(GenerateDescribe("path", TPathId(1, 1), version)));
Context->SubscribeReplica(Replica, edge, "path");
Context->Send(Replica, edge, new TSchemeBoardEvents::TEvSyncVersionRequest("path"), 0, 1);
@@ -549,347 +549,347 @@ void TReplicaTest::StrongNotificationAfterCommit() {
}
}
-class TReplicaCombinationTest: public NUnitTest::TTestBase {
-public:
- void SetUp() override {
- Context = MakeHolder<TTestContext>();
- Context->Initialize(TAppPrepare().Unwrap());
- Context->SetLogPriority(NKikimrServices::SCHEME_BOARD_REPLICA, NLog::PRI_DEBUG);
- Context->SetLogPriority(NKikimrServices::SCHEME_BOARD_SUBSCRIBER, NLog::PRI_DEBUG);
- }
-
+class TReplicaCombinationTest: public NUnitTest::TTestBase {
+public:
+ void SetUp() override {
+ Context = MakeHolder<TTestContext>();
+ Context->Initialize(TAppPrepare().Unwrap());
+ Context->SetLogPriority(NKikimrServices::SCHEME_BOARD_REPLICA, NLog::PRI_DEBUG);
+ Context->SetLogPriority(NKikimrServices::SCHEME_BOARD_SUBSCRIBER, NLog::PRI_DEBUG);
+ }
+
TActorId GetReplica() {
return CreateReplica(*Context);
- }
-
- void TearDown() override {
- Context.Reset();
- }
-
- UNIT_TEST_SUITE(TReplicaCombinationTest);
- UNIT_TEST(UpdatesCombinationsDomainRoot);
- UNIT_TEST(UpdatesCombinationsMigratedPath);
- UNIT_TEST(MigratedPathRecreation);
- UNIT_TEST_SUITE_END();
-
- void UpdatesCombinationsDomainRoot();
- void MigratedPathRecreation();
- void UpdatesCombinationsMigratedPath();
-
-
-private:
- THolder<TTestContext> Context;
-}; // TReplicaCombinationTest
-
-UNIT_TEST_SUITE_REGISTRATION(TReplicaCombinationTest);
-
-void TReplicaCombinationTest::UpdatesCombinationsDomainRoot() {
- ui64 gssOwnerID = 800;
- TVector<TCombinationsArgs> combinations = GenerateCombinationsDomainRoot("/Root/Tenant", gssOwnerID);
-
- //make all the variants
- for (const auto& argsLeft: combinations) {
- for (const auto& argsRight: combinations) {
+ }
+
+ void TearDown() override {
+ Context.Reset();
+ }
+
+ UNIT_TEST_SUITE(TReplicaCombinationTest);
+ UNIT_TEST(UpdatesCombinationsDomainRoot);
+ UNIT_TEST(UpdatesCombinationsMigratedPath);
+ UNIT_TEST(MigratedPathRecreation);
+ UNIT_TEST_SUITE_END();
+
+ void UpdatesCombinationsDomainRoot();
+ void MigratedPathRecreation();
+ void UpdatesCombinationsMigratedPath();
+
+
+private:
+ THolder<TTestContext> Context;
+}; // TReplicaCombinationTest
+
+UNIT_TEST_SUITE_REGISTRATION(TReplicaCombinationTest);
+
+void TReplicaCombinationTest::UpdatesCombinationsDomainRoot() {
+ ui64 gssOwnerID = 800;
+ TVector<TCombinationsArgs> combinations = GenerateCombinationsDomainRoot("/Root/Tenant", gssOwnerID);
+
+ //make all the variants
+ for (const auto& argsLeft: combinations) {
+ for (const auto& argsRight: combinations) {
const TActorId replica = GetReplica();
-
+
const TActorId populatorLeft = Context->AllocateEdgeActor();
- Context->HandshakeReplica(replica, populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
- Context->CommitReplica(replica, populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
-
+ Context->HandshakeReplica(replica, populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
+ Context->CommitReplica(replica, populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
+
const TActorId populatorRight = Context->AllocateEdgeActor();
- Context->HandshakeReplica(replica, populatorRight, argsRight.OwnerId, argsRight.Generation);
- Context->CommitReplica(replica, populatorRight, argsRight.OwnerId, argsRight.Generation);
-
- Context->Send(replica, populatorLeft, argsLeft.GenerateUpdate());
-
- Context->Send(replica, populatorRight, argsRight.GenerateUpdate());
-
- TCombinationsArgs::TSuperId winId = Max(argsLeft.GetSuperId(), argsRight.GetSuperId());
-
- auto finalSubscriber = Context->AllocateEdgeActor();
- auto ev = Context->SubscribeReplica(replica, finalSubscriber, "/Root/Tenant");
-
- Cerr << "=========== " << argsLeft.GenerateDescribe().ShortDebugString()
- << "\n=========== " << argsRight.GenerateDescribe().ShortDebugString() << Endl;
-
- // https://st.yandex-team.ru/KIKIMR-9236#5e70e0b141a0f221ddada730
- if (argsLeft.PathId == TPathId(800, 2) && !argsLeft.IsDeletion && argsLeft.DomainId == TPathId(800, 2)
- && argsRight.PathId == TPathId(800, 3) && argsRight.IsDeletion && argsRight.DomainId == TPathId(800, 3))
- {
- // 1 this is bug, skip it
- continue;
- }
-
- if (argsLeft.PathId == TPathId(900, 1) && !argsLeft.IsDeletion && argsLeft.DomainId == TPathId(800, 2)
- && argsRight.PathId == TPathId(800, 2) && argsRight.IsDeletion && argsRight.DomainId == TPathId(800, 2))
- {
- // 2 this is bug, skip it
- continue;
- }
-
- if (argsLeft.PathId == TPathId(900, 1) && !argsLeft.IsDeletion && argsLeft.DomainId == TPathId(800, 2)
- && argsRight.PathId == TPathId(800, 3) && argsRight.IsDeletion && argsRight.DomainId == TPathId(800, 3))
- {
- // 3 this is bug, skip it
- continue;
- }
-
- if (argsLeft.PathId == TPathId(800, 2) && argsLeft.IsDeletion && argsLeft.DomainId == TPathId(800, 2)
- && argsRight.PathId == TPathId(900, 1) && !argsRight.IsDeletion && argsRight.DomainId == TPathId(800, 2))
- {
- // 4 this is bug, skip it
- continue;
- }
-
- if (argsLeft.PathId == TPathId(910, 1) && !argsLeft.IsDeletion && argsLeft.DomainId == TPathId(800, 3)
- && argsRight.PathId == TPathId(gssOwnerID, 3) && argsRight.IsDeletion && argsRight.DomainId == TPathId(800, 3))
- {
- // 5 this is bug, skip it
- continue;
- }
-
- if (argsLeft.PathId == TPathId(800, 3) && argsLeft.IsDeletion && argsLeft.DomainId == TPathId(800, 3)
- && argsRight.PathId == TPathId(800, 2) && !argsRight.IsDeletion && argsRight.DomainId == TPathId(800, 2))
- {
- // 6 this is bug, skip it
- continue;
- }
-
- if (argsLeft.PathId == TPathId(800, 3) && argsLeft.IsDeletion && argsLeft.DomainId == TPathId(800, 3)
- && argsRight.PathId == TPathId(900, 1) && !argsRight.IsDeletion && argsRight.DomainId == TPathId(800, 2))
- {
- // 7 this is bug, skip it
- continue;
- }
-
- if (argsLeft.PathId == TPathId(800, 3) && argsLeft.IsDeletion && argsLeft.DomainId == TPathId(800, 3)
- && argsRight.PathId == TPathId(910, 1) && !argsRight.IsDeletion && argsRight.DomainId == TPathId(800, 3))
- {
- // 8 this is bug, skip it
- continue;
- }
-
-
-
+ Context->HandshakeReplica(replica, populatorRight, argsRight.OwnerId, argsRight.Generation);
+ Context->CommitReplica(replica, populatorRight, argsRight.OwnerId, argsRight.Generation);
+
+ Context->Send(replica, populatorLeft, argsLeft.GenerateUpdate());
+
+ Context->Send(replica, populatorRight, argsRight.GenerateUpdate());
+
+ TCombinationsArgs::TSuperId winId = Max(argsLeft.GetSuperId(), argsRight.GetSuperId());
+
+ auto finalSubscriber = Context->AllocateEdgeActor();
+ auto ev = Context->SubscribeReplica(replica, finalSubscriber, "/Root/Tenant");
+
+ Cerr << "=========== " << argsLeft.GenerateDescribe().ShortDebugString()
+ << "\n=========== " << argsRight.GenerateDescribe().ShortDebugString() << Endl;
+
+ // https://st.yandex-team.ru/KIKIMR-9236#5e70e0b141a0f221ddada730
+ if (argsLeft.PathId == TPathId(800, 2) && !argsLeft.IsDeletion && argsLeft.DomainId == TPathId(800, 2)
+ && argsRight.PathId == TPathId(800, 3) && argsRight.IsDeletion && argsRight.DomainId == TPathId(800, 3))
+ {
+ // 1 this is bug, skip it
+ continue;
+ }
+
+ if (argsLeft.PathId == TPathId(900, 1) && !argsLeft.IsDeletion && argsLeft.DomainId == TPathId(800, 2)
+ && argsRight.PathId == TPathId(800, 2) && argsRight.IsDeletion && argsRight.DomainId == TPathId(800, 2))
+ {
+ // 2 this is bug, skip it
+ continue;
+ }
+
+ if (argsLeft.PathId == TPathId(900, 1) && !argsLeft.IsDeletion && argsLeft.DomainId == TPathId(800, 2)
+ && argsRight.PathId == TPathId(800, 3) && argsRight.IsDeletion && argsRight.DomainId == TPathId(800, 3))
+ {
+ // 3 this is bug, skip it
+ continue;
+ }
+
+ if (argsLeft.PathId == TPathId(800, 2) && argsLeft.IsDeletion && argsLeft.DomainId == TPathId(800, 2)
+ && argsRight.PathId == TPathId(900, 1) && !argsRight.IsDeletion && argsRight.DomainId == TPathId(800, 2))
+ {
+ // 4 this is bug, skip it
+ continue;
+ }
+
+ if (argsLeft.PathId == TPathId(910, 1) && !argsLeft.IsDeletion && argsLeft.DomainId == TPathId(800, 3)
+ && argsRight.PathId == TPathId(gssOwnerID, 3) && argsRight.IsDeletion && argsRight.DomainId == TPathId(800, 3))
+ {
+ // 5 this is bug, skip it
+ continue;
+ }
+
+ if (argsLeft.PathId == TPathId(800, 3) && argsLeft.IsDeletion && argsLeft.DomainId == TPathId(800, 3)
+ && argsRight.PathId == TPathId(800, 2) && !argsRight.IsDeletion && argsRight.DomainId == TPathId(800, 2))
+ {
+ // 6 this is bug, skip it
+ continue;
+ }
+
+ if (argsLeft.PathId == TPathId(800, 3) && argsLeft.IsDeletion && argsLeft.DomainId == TPathId(800, 3)
+ && argsRight.PathId == TPathId(900, 1) && !argsRight.IsDeletion && argsRight.DomainId == TPathId(800, 2))
+ {
+ // 7 this is bug, skip it
+ continue;
+ }
+
+ if (argsLeft.PathId == TPathId(800, 3) && argsLeft.IsDeletion && argsLeft.DomainId == TPathId(800, 3)
+ && argsRight.PathId == TPathId(910, 1) && !argsRight.IsDeletion && argsRight.DomainId == TPathId(800, 3))
+ {
+ // 8 this is bug, skip it
+ continue;
+ }
+
+
+
UNIT_ASSERT_VALUES_EQUAL("/Root/Tenant", ev->Get()->GetRecord().GetPath());
UNIT_ASSERT_VALUES_EQUAL(std::get<1>(winId), ev->Get()->GetRecord().GetIsDeletion());
-
+
if (!ev->Get()->GetRecord().GetIsDeletion()) {
UNIT_ASSERT_VALUES_EQUAL(std::get<2>(winId), TPathId(ev->Get()->GetRecord().GetPathOwnerId(), ev->Get()->GetRecord().GetLocalPathId()));
UNIT_ASSERT_VALUES_EQUAL(std::get<3>(winId), ev->Get()->GetRecord().GetVersion());
-
+
UNIT_ASSERT(ev->Get()->GetRecord().HasDescribeSchemeResult());
- const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->GetRecord().GetDescribeSchemeResult();
- auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
- UNIT_ASSERT_VALUES_EQUAL(std::get<0>(winId), TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
- }
-
-
- }
- }
-}
-
-void TReplicaCombinationTest::MigratedPathRecreation() {
- ui64 gssOwnerID = 800;
- ui64 tssOwnerID = 900;
-
- auto domainId = TPathId(gssOwnerID, 1);
- auto migratedPathId = TPathId(gssOwnerID, 1111);
-
- auto recreatedPathId = TPathId(tssOwnerID, 11);
-
- auto argsLeft = TCombinationsArgs{
- "/root/db/dir_inside", migratedPathId, 1, domainId,
- gssOwnerID, 1, false};
- auto argsRight = TCombinationsArgs{
- "/root/db/dir_inside", recreatedPathId, 1, domainId,
- tssOwnerID, 1, false};
-
-
- const TActorId replica = GetReplica();
-
- const TActorId populatorLeft = Context->AllocateEdgeActor();
- Context->HandshakeReplica(replica, populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
- Context->CommitReplica(replica, populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
-
- const TActorId populatorRight = Context->AllocateEdgeActor();
- Context->HandshakeReplica(replica, populatorRight, argsRight.OwnerId, argsRight.Generation);
- Context->CommitReplica(replica, populatorRight, argsRight.OwnerId, argsRight.Generation);
-
- Context->Send(replica, populatorLeft, argsLeft.GenerateUpdate());
-
- Context->Send(replica, populatorRight, argsRight.GenerateUpdate());
-
- TCombinationsArgs::TSuperId winId = Max(argsLeft.GetSuperId(), argsRight.GetSuperId());
-
- auto finalSubscriber = Context->AllocateEdgeActor();
- auto ev = Context->SubscribeReplica(replica, finalSubscriber, "/root/db/dir_inside");
-
- Cerr << "=========== " << argsLeft.GenerateDescribe().ShortDebugString()
- << "\n=========== " << argsRight.GenerateDescribe().ShortDebugString()
- << "\n==========="
- << " DomainId: " << std::get<0>(winId)
- << " IsDeletion: " << std::get<1>(winId)
- << " PathId: " << std::get<2>(winId)
- << " Verions: " << std::get<3>(winId)
- << Endl;
-
- UNIT_ASSERT_VALUES_EQUAL("/root/db/dir_inside", ev->Get()->GetRecord().GetPath());
- UNIT_ASSERT_VALUES_EQUAL(std::get<1>(winId), ev->Get()->GetRecord().GetIsDeletion());
-
- UNIT_ASSERT_VALUES_EQUAL(std::get<2>(winId), TPathId(ev->Get()->GetRecord().GetPathOwnerId(), ev->Get()->GetRecord().GetLocalPathId()));
- UNIT_ASSERT_VALUES_EQUAL(std::get<3>(winId), ev->Get()->GetRecord().GetVersion());
-
- UNIT_ASSERT(ev->Get()->GetRecord().HasDescribeSchemeResult());
- const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->GetRecord().GetDescribeSchemeResult();
- auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
- UNIT_ASSERT_VALUES_EQUAL(std::get<0>(winId), TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
-}
-
-void TReplicaCombinationTest::UpdatesCombinationsMigratedPath() {
- ui64 gssID = 800;
- ui64 tssID = 900;
- ui64 tssIDrecreated = 910;
- ui64 gssLocalId = 5;
- ui64 tssLocalId = 9;
- TVector<TCombinationsArgs> combinations = GenerateCombinationsMigratedPath("/Root/Tenant/table_inside", gssID, {tssID, tssIDrecreated}, gssLocalId, tssLocalId);
-
- //make all the variants
- for (const auto& argsLeft: combinations) {
- for (const auto& argsRight: combinations) {
- const TActorId replica = GetReplica();
-
- const TActorId populatorLeft = Context->AllocateEdgeActor();
- Context->HandshakeReplica(replica, populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
- Context->CommitReplica(replica, populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
-
- const TActorId populatorRight = Context->AllocateEdgeActor();
- Context->HandshakeReplica(replica, populatorRight, argsRight.OwnerId, argsRight.Generation);
- Context->CommitReplica(replica, populatorRight, argsRight.OwnerId, argsRight.Generation);
-
- Context->Send(replica, populatorLeft, argsLeft.GenerateUpdate());
-
- Context->Send(replica, populatorRight, argsRight.GenerateUpdate());
-
- TCombinationsArgs::TSuperId winId = Max(argsLeft.GetSuperId(), argsRight.GetSuperId());
-
- auto finalSubscriber = Context->AllocateEdgeActor();
- auto ev = Context->SubscribeReplica(replica, finalSubscriber, "/Root/Tenant/table_inside");
-
- const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->GetRecord().GetDescribeSchemeResult();
- auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
-
- Cerr << "=========== Left ==" << argsLeft.GenerateDescribe().ShortDebugString()
- << "\n=========== Right ==" << argsRight.GenerateDescribe().ShortDebugString()
- << "\n=========== super id =="
- << " DomainId: " << std::get<0>(winId)
- << " IsDeletion: " << std::get<1>(winId)
- << " PathId: " << std::get<2>(winId)
- << " Verions: " << std::get<3>(winId)
- << Endl;
- Cerr << "=========== WIN =="
- << ev->Get()->GetRecord().GetPath()
- << " PathID: " << TPathId(ev->Get()->GetRecord().GetPathOwnerId(), ev->Get()->GetRecord().GetLocalPathId())
- << " deleted: " << ev->Get()->GetRecord().GetIsDeletion()
- << " version: " << ev->Get()->GetRecord().GetVersion()
- << " domainId: " << TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId())
- << Endl;
-
- if (argsLeft.PathId == TPathId(gssID, gssLocalId) && !argsLeft.IsDeletion && argsLeft.DomainId == TPathId(gssID, 2)
- && argsRight.PathId == TPathId(tssID, tssLocalId) && argsRight.IsDeletion && argsRight.DomainId == TPathId(gssID, 2))
- {
- // 1 this is bug
- continue;
- }
-
- if (argsLeft.PathId == TPathId(gssID, gssLocalId) && argsLeft.IsDeletion && argsLeft.DomainId == TPathId(gssID, 2)
- && argsRight.PathId == TPathId(tssID, tssLocalId) && !argsRight.IsDeletion && argsRight.DomainId == TPathId(gssID, 2))
- {
- // 2 this is NOT bug, this is super id violation
-
- UNIT_ASSERT_VALUES_EQUAL("/Root/Tenant/table_inside", ev->Get()->GetRecord().GetPath());
- UNIT_ASSERT_VALUES_EQUAL(std::get<1>(argsRight.GetSuperId()), ev->Get()->GetRecord().GetIsDeletion());
-
- UNIT_ASSERT_VALUES_EQUAL(std::get<2>(argsRight.GetSuperId()), TPathId(ev->Get()->GetRecord().GetPathOwnerId(), ev->Get()->GetRecord().GetLocalPathId()));
- UNIT_ASSERT_VALUES_EQUAL(std::get<3>(argsRight.GetSuperId()), ev->Get()->GetRecord().GetVersion());
-
- UNIT_ASSERT(ev->Get()->GetRecord().HasDescribeSchemeResult());
- const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->GetRecord().GetDescribeSchemeResult();
- auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
- UNIT_ASSERT_VALUES_EQUAL(std::get<0>(argsRight.GetSuperId()), TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
-
- continue;
- }
-
- if (argsLeft.PathId == TPathId(tssID, tssLocalId) && !argsLeft.IsDeletion && argsLeft.DomainId == TPathId(gssID, 2)
- && argsRight.PathId == TPathId(gssID, gssLocalId) && argsRight.IsDeletion && argsRight.DomainId == TPathId(gssID, 2))
- {
- // 3 this is NOT bug, this is super id violation
-
- UNIT_ASSERT_VALUES_EQUAL("/Root/Tenant/table_inside", ev->Get()->GetRecord().GetPath());
- UNIT_ASSERT_VALUES_EQUAL(std::get<1>(argsLeft.GetSuperId()), ev->Get()->GetRecord().GetIsDeletion());
-
- UNIT_ASSERT_VALUES_EQUAL(std::get<2>(argsLeft.GetSuperId()), TPathId(ev->Get()->GetRecord().GetPathOwnerId(), ev->Get()->GetRecord().GetLocalPathId()));
- UNIT_ASSERT_VALUES_EQUAL(std::get<3>(argsLeft.GetSuperId()), ev->Get()->GetRecord().GetVersion());
-
- UNIT_ASSERT(ev->Get()->GetRecord().HasDescribeSchemeResult());
- const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->GetRecord().GetDescribeSchemeResult();
- auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
- UNIT_ASSERT_VALUES_EQUAL(std::get<0>(argsLeft.GetSuperId()), TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
-
- continue;
- }
-
- if (argsLeft.PathId == TPathId(tssID, tssLocalId) && argsLeft.IsDeletion && argsLeft.DomainId == TPathId(gssID, 2)
- && argsRight.PathId == TPathId(gssID, gssLocalId) && !argsRight.IsDeletion && argsRight.DomainId == TPathId(gssID, 2))
- {
- // 4 this is bug
- continue;
- }
-
- if (argsLeft.PathId == TPathId(gssID, gssLocalId) && !argsLeft.IsDeletion && argsLeft.DomainId == TPathId(gssID, 2)
- && argsRight.PathId == TPathId(tssIDrecreated, tssLocalId) && argsRight.IsDeletion && argsRight.DomainId == TPathId(gssID, 333))
- {
- // 5 this is bug
- continue;
- }
-
- if (argsLeft.PathId == TPathId(tssID, tssLocalId) && !argsLeft.IsDeletion && argsLeft.DomainId == TPathId(gssID, 2)
- && argsRight.PathId == TPathId(tssIDrecreated, tssLocalId) && argsRight.IsDeletion && argsRight.DomainId == TPathId(gssID, 333))
- {
- // 6 this is bug
- continue;
- }
-
- if (argsLeft.PathId == TPathId(tssIDrecreated, tssLocalId) && argsLeft.IsDeletion && argsLeft.DomainId == TPathId(gssID, 333)
- && argsRight.PathId == TPathId(gssID, gssLocalId) && !argsRight.IsDeletion && argsRight.DomainId == TPathId(gssID, 2))
- {
- // 7 this is bug
- continue;
- }
-
- if (argsLeft.PathId == TPathId(tssIDrecreated, tssLocalId) && argsLeft.IsDeletion && argsLeft.DomainId == TPathId(gssID, 333)
- && argsRight.PathId == TPathId(tssID, tssLocalId) && !argsRight.IsDeletion && argsRight.DomainId == TPathId(gssID, 2))
- {
- // 8 this is bug
- continue;
- }
-
- UNIT_ASSERT_VALUES_EQUAL("/Root/Tenant/table_inside", ev->Get()->GetRecord().GetPath());
- UNIT_ASSERT_VALUES_EQUAL(std::get<1>(winId), ev->Get()->GetRecord().GetIsDeletion());
-
- if (!ev->Get()->GetRecord().GetIsDeletion()) {
- UNIT_ASSERT_VALUES_EQUAL(std::get<2>(winId), TPathId(ev->Get()->GetRecord().GetPathOwnerId(), ev->Get()->GetRecord().GetLocalPathId()));
- UNIT_ASSERT_VALUES_EQUAL(std::get<3>(winId), ev->Get()->GetRecord().GetVersion());
-
- UNIT_ASSERT(ev->Get()->GetRecord().HasDescribeSchemeResult());
- const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->GetRecord().GetDescribeSchemeResult();
- auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
- UNIT_ASSERT_VALUES_EQUAL(std::get<0>(winId), TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
- }
- }
- }
-}
-
+ const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->GetRecord().GetDescribeSchemeResult();
+ auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
+ UNIT_ASSERT_VALUES_EQUAL(std::get<0>(winId), TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
+ }
+
+
+ }
+ }
+}
+
+void TReplicaCombinationTest::MigratedPathRecreation() {
+ ui64 gssOwnerID = 800;
+ ui64 tssOwnerID = 900;
+
+ auto domainId = TPathId(gssOwnerID, 1);
+ auto migratedPathId = TPathId(gssOwnerID, 1111);
+
+ auto recreatedPathId = TPathId(tssOwnerID, 11);
+
+ auto argsLeft = TCombinationsArgs{
+ "/root/db/dir_inside", migratedPathId, 1, domainId,
+ gssOwnerID, 1, false};
+ auto argsRight = TCombinationsArgs{
+ "/root/db/dir_inside", recreatedPathId, 1, domainId,
+ tssOwnerID, 1, false};
+
+
+ const TActorId replica = GetReplica();
+
+ const TActorId populatorLeft = Context->AllocateEdgeActor();
+ Context->HandshakeReplica(replica, populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
+ Context->CommitReplica(replica, populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
+
+ const TActorId populatorRight = Context->AllocateEdgeActor();
+ Context->HandshakeReplica(replica, populatorRight, argsRight.OwnerId, argsRight.Generation);
+ Context->CommitReplica(replica, populatorRight, argsRight.OwnerId, argsRight.Generation);
+
+ Context->Send(replica, populatorLeft, argsLeft.GenerateUpdate());
+
+ Context->Send(replica, populatorRight, argsRight.GenerateUpdate());
+
+ TCombinationsArgs::TSuperId winId = Max(argsLeft.GetSuperId(), argsRight.GetSuperId());
+
+ auto finalSubscriber = Context->AllocateEdgeActor();
+ auto ev = Context->SubscribeReplica(replica, finalSubscriber, "/root/db/dir_inside");
+
+ Cerr << "=========== " << argsLeft.GenerateDescribe().ShortDebugString()
+ << "\n=========== " << argsRight.GenerateDescribe().ShortDebugString()
+ << "\n==========="
+ << " DomainId: " << std::get<0>(winId)
+ << " IsDeletion: " << std::get<1>(winId)
+ << " PathId: " << std::get<2>(winId)
+ << " Verions: " << std::get<3>(winId)
+ << Endl;
+
+ UNIT_ASSERT_VALUES_EQUAL("/root/db/dir_inside", ev->Get()->GetRecord().GetPath());
+ UNIT_ASSERT_VALUES_EQUAL(std::get<1>(winId), ev->Get()->GetRecord().GetIsDeletion());
+
+ UNIT_ASSERT_VALUES_EQUAL(std::get<2>(winId), TPathId(ev->Get()->GetRecord().GetPathOwnerId(), ev->Get()->GetRecord().GetLocalPathId()));
+ UNIT_ASSERT_VALUES_EQUAL(std::get<3>(winId), ev->Get()->GetRecord().GetVersion());
+
+ UNIT_ASSERT(ev->Get()->GetRecord().HasDescribeSchemeResult());
+ const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->GetRecord().GetDescribeSchemeResult();
+ auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
+ UNIT_ASSERT_VALUES_EQUAL(std::get<0>(winId), TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
+}
+
+void TReplicaCombinationTest::UpdatesCombinationsMigratedPath() {
+ ui64 gssID = 800;
+ ui64 tssID = 900;
+ ui64 tssIDrecreated = 910;
+ ui64 gssLocalId = 5;
+ ui64 tssLocalId = 9;
+ TVector<TCombinationsArgs> combinations = GenerateCombinationsMigratedPath("/Root/Tenant/table_inside", gssID, {tssID, tssIDrecreated}, gssLocalId, tssLocalId);
+
+ //make all the variants
+ for (const auto& argsLeft: combinations) {
+ for (const auto& argsRight: combinations) {
+ const TActorId replica = GetReplica();
+
+ const TActorId populatorLeft = Context->AllocateEdgeActor();
+ Context->HandshakeReplica(replica, populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
+ Context->CommitReplica(replica, populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
+
+ const TActorId populatorRight = Context->AllocateEdgeActor();
+ Context->HandshakeReplica(replica, populatorRight, argsRight.OwnerId, argsRight.Generation);
+ Context->CommitReplica(replica, populatorRight, argsRight.OwnerId, argsRight.Generation);
+
+ Context->Send(replica, populatorLeft, argsLeft.GenerateUpdate());
+
+ Context->Send(replica, populatorRight, argsRight.GenerateUpdate());
+
+ TCombinationsArgs::TSuperId winId = Max(argsLeft.GetSuperId(), argsRight.GetSuperId());
+
+ auto finalSubscriber = Context->AllocateEdgeActor();
+ auto ev = Context->SubscribeReplica(replica, finalSubscriber, "/Root/Tenant/table_inside");
+
+ const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->GetRecord().GetDescribeSchemeResult();
+ auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
+
+ Cerr << "=========== Left ==" << argsLeft.GenerateDescribe().ShortDebugString()
+ << "\n=========== Right ==" << argsRight.GenerateDescribe().ShortDebugString()
+ << "\n=========== super id =="
+ << " DomainId: " << std::get<0>(winId)
+ << " IsDeletion: " << std::get<1>(winId)
+ << " PathId: " << std::get<2>(winId)
+ << " Verions: " << std::get<3>(winId)
+ << Endl;
+ Cerr << "=========== WIN =="
+ << ev->Get()->GetRecord().GetPath()
+ << " PathID: " << TPathId(ev->Get()->GetRecord().GetPathOwnerId(), ev->Get()->GetRecord().GetLocalPathId())
+ << " deleted: " << ev->Get()->GetRecord().GetIsDeletion()
+ << " version: " << ev->Get()->GetRecord().GetVersion()
+ << " domainId: " << TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId())
+ << Endl;
+
+ if (argsLeft.PathId == TPathId(gssID, gssLocalId) && !argsLeft.IsDeletion && argsLeft.DomainId == TPathId(gssID, 2)
+ && argsRight.PathId == TPathId(tssID, tssLocalId) && argsRight.IsDeletion && argsRight.DomainId == TPathId(gssID, 2))
+ {
+ // 1 this is bug
+ continue;
+ }
+
+ if (argsLeft.PathId == TPathId(gssID, gssLocalId) && argsLeft.IsDeletion && argsLeft.DomainId == TPathId(gssID, 2)
+ && argsRight.PathId == TPathId(tssID, tssLocalId) && !argsRight.IsDeletion && argsRight.DomainId == TPathId(gssID, 2))
+ {
+ // 2 this is NOT bug, this is super id violation
+
+ UNIT_ASSERT_VALUES_EQUAL("/Root/Tenant/table_inside", ev->Get()->GetRecord().GetPath());
+ UNIT_ASSERT_VALUES_EQUAL(std::get<1>(argsRight.GetSuperId()), ev->Get()->GetRecord().GetIsDeletion());
+
+ UNIT_ASSERT_VALUES_EQUAL(std::get<2>(argsRight.GetSuperId()), TPathId(ev->Get()->GetRecord().GetPathOwnerId(), ev->Get()->GetRecord().GetLocalPathId()));
+ UNIT_ASSERT_VALUES_EQUAL(std::get<3>(argsRight.GetSuperId()), ev->Get()->GetRecord().GetVersion());
+
+ UNIT_ASSERT(ev->Get()->GetRecord().HasDescribeSchemeResult());
+ const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->GetRecord().GetDescribeSchemeResult();
+ auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
+ UNIT_ASSERT_VALUES_EQUAL(std::get<0>(argsRight.GetSuperId()), TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
+
+ continue;
+ }
+
+ if (argsLeft.PathId == TPathId(tssID, tssLocalId) && !argsLeft.IsDeletion && argsLeft.DomainId == TPathId(gssID, 2)
+ && argsRight.PathId == TPathId(gssID, gssLocalId) && argsRight.IsDeletion && argsRight.DomainId == TPathId(gssID, 2))
+ {
+ // 3 this is NOT bug, this is super id violation
+
+ UNIT_ASSERT_VALUES_EQUAL("/Root/Tenant/table_inside", ev->Get()->GetRecord().GetPath());
+ UNIT_ASSERT_VALUES_EQUAL(std::get<1>(argsLeft.GetSuperId()), ev->Get()->GetRecord().GetIsDeletion());
+
+ UNIT_ASSERT_VALUES_EQUAL(std::get<2>(argsLeft.GetSuperId()), TPathId(ev->Get()->GetRecord().GetPathOwnerId(), ev->Get()->GetRecord().GetLocalPathId()));
+ UNIT_ASSERT_VALUES_EQUAL(std::get<3>(argsLeft.GetSuperId()), ev->Get()->GetRecord().GetVersion());
+
+ UNIT_ASSERT(ev->Get()->GetRecord().HasDescribeSchemeResult());
+ const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->GetRecord().GetDescribeSchemeResult();
+ auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
+ UNIT_ASSERT_VALUES_EQUAL(std::get<0>(argsLeft.GetSuperId()), TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
+
+ continue;
+ }
+
+ if (argsLeft.PathId == TPathId(tssID, tssLocalId) && argsLeft.IsDeletion && argsLeft.DomainId == TPathId(gssID, 2)
+ && argsRight.PathId == TPathId(gssID, gssLocalId) && !argsRight.IsDeletion && argsRight.DomainId == TPathId(gssID, 2))
+ {
+ // 4 this is bug
+ continue;
+ }
+
+ if (argsLeft.PathId == TPathId(gssID, gssLocalId) && !argsLeft.IsDeletion && argsLeft.DomainId == TPathId(gssID, 2)
+ && argsRight.PathId == TPathId(tssIDrecreated, tssLocalId) && argsRight.IsDeletion && argsRight.DomainId == TPathId(gssID, 333))
+ {
+ // 5 this is bug
+ continue;
+ }
+
+ if (argsLeft.PathId == TPathId(tssID, tssLocalId) && !argsLeft.IsDeletion && argsLeft.DomainId == TPathId(gssID, 2)
+ && argsRight.PathId == TPathId(tssIDrecreated, tssLocalId) && argsRight.IsDeletion && argsRight.DomainId == TPathId(gssID, 333))
+ {
+ // 6 this is bug
+ continue;
+ }
+
+ if (argsLeft.PathId == TPathId(tssIDrecreated, tssLocalId) && argsLeft.IsDeletion && argsLeft.DomainId == TPathId(gssID, 333)
+ && argsRight.PathId == TPathId(gssID, gssLocalId) && !argsRight.IsDeletion && argsRight.DomainId == TPathId(gssID, 2))
+ {
+ // 7 this is bug
+ continue;
+ }
+
+ if (argsLeft.PathId == TPathId(tssIDrecreated, tssLocalId) && argsLeft.IsDeletion && argsLeft.DomainId == TPathId(gssID, 333)
+ && argsRight.PathId == TPathId(tssID, tssLocalId) && !argsRight.IsDeletion && argsRight.DomainId == TPathId(gssID, 2))
+ {
+ // 8 this is bug
+ continue;
+ }
+
+ UNIT_ASSERT_VALUES_EQUAL("/Root/Tenant/table_inside", ev->Get()->GetRecord().GetPath());
+ UNIT_ASSERT_VALUES_EQUAL(std::get<1>(winId), ev->Get()->GetRecord().GetIsDeletion());
+
+ if (!ev->Get()->GetRecord().GetIsDeletion()) {
+ UNIT_ASSERT_VALUES_EQUAL(std::get<2>(winId), TPathId(ev->Get()->GetRecord().GetPathOwnerId(), ev->Get()->GetRecord().GetLocalPathId()));
+ UNIT_ASSERT_VALUES_EQUAL(std::get<3>(winId), ev->Get()->GetRecord().GetVersion());
+
+ UNIT_ASSERT(ev->Get()->GetRecord().HasDescribeSchemeResult());
+ const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->GetRecord().GetDescribeSchemeResult();
+ auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
+ UNIT_ASSERT_VALUES_EQUAL(std::get<0>(winId), TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
+ }
+ }
+ }
+}
+
} // NSchemeBoard
} // NKikimr
diff --git a/ydb/core/tx/scheme_board/subscriber.cpp b/ydb/core/tx/scheme_board/subscriber.cpp
index ac26fa68623..97173d81ad5 100644
--- a/ydb/core/tx/scheme_board/subscriber.cpp
+++ b/ydb/core/tx/scheme_board/subscriber.cpp
@@ -55,29 +55,29 @@ namespace {
valid = IsSame(path, record.GetPath());
}
- if (!valid && (record.HasPathOwnerId() && record.HasLocalPathId())) {
- valid = IsSame(path, TPathId(record.GetPathOwnerId(), record.GetLocalPathId()));
+ if (!valid && (record.HasPathOwnerId() && record.HasLocalPathId())) {
+ valid = IsSame(path, TPathId(record.GetPathOwnerId(), record.GetLocalPathId()));
}
return valid;
}
- struct TPathVersion {
- TPathId PathId;
- ui64 Version;
-
- TPathVersion()
- : PathId(TPathId())
- , Version(0)
- {
- }
-
+ struct TPathVersion {
+ TPathId PathId;
+ ui64 Version;
+
+ TPathVersion()
+ : PathId(TPathId())
+ , Version(0)
+ {
+ }
+
explicit TPathVersion(const TPathId& pathId, const ui64 version)
- : PathId(pathId)
- , Version(version)
- {
- }
-
+ : PathId(pathId)
+ , Version(version)
+ {
+ }
+
static TPathVersion FromNotify(const NKikimrSchemeBoard::TEvNotify& record) {
TPathId pathId;
if (record.HasPathOwnerId() && record.HasLocalPathId()) {
@@ -87,44 +87,44 @@ namespace {
return TPathVersion(pathId, record.GetVersion());
}
- TString ToString() const {
- TString result;
- TStringOutput out(result);
- Out(out);
- return result;
- }
-
- void Out(IOutputStream& o) const {
+ TString ToString() const {
+ TString result;
+ TStringOutput out(result);
+ Out(out);
+ return result;
+ }
+
+ void Out(IOutputStream& o) const {
if (!*this) {
PathId.Out(o);
} else {
o << "(PathId: " << PathId.ToString() << ", Version: " << Version << ")";
}
- }
-
- bool operator<(const TPathVersion& x) const {
- return PathId != x.PathId ? PathId < x.PathId : Version < x.Version;
- }
- bool operator>(const TPathVersion& x) const {
- return x < *this;
- }
- bool operator<=(const TPathVersion& x) const {
- return PathId != x.PathId ? PathId < x.PathId : Version <= x.Version;
- }
- bool operator>=(const TPathVersion& x) const {
- return x <= *this;
- }
- bool operator==(const TPathVersion& x) const {
- return PathId == x.PathId && Version == x.Version;
- }
- bool operator!=(const TPathVersion& x) const {
- return PathId != x.PathId || Version != x.Version;
- }
- operator bool() const {
- return bool(PathId);
- }
- };
-
+ }
+
+ bool operator<(const TPathVersion& x) const {
+ return PathId != x.PathId ? PathId < x.PathId : Version < x.Version;
+ }
+ bool operator>(const TPathVersion& x) const {
+ return x < *this;
+ }
+ bool operator<=(const TPathVersion& x) const {
+ return PathId != x.PathId ? PathId < x.PathId : Version <= x.Version;
+ }
+ bool operator>=(const TPathVersion& x) const {
+ return x <= *this;
+ }
+ bool operator==(const TPathVersion& x) const {
+ return PathId == x.PathId && Version == x.Version;
+ }
+ bool operator!=(const TPathVersion& x) const {
+ return PathId != x.PathId || Version != x.Version;
+ }
+ operator bool() const {
+ return bool(PathId);
+ }
+ };
+
struct TState {
bool Deleted = false;
bool Strong = false;
@@ -203,7 +203,7 @@ namespace {
return true;
}
- if (Version.PathId.OwnerId == other.Version.PathId.OwnerId) {
+ if (Version.PathId.OwnerId == other.Version.PathId.OwnerId) {
if (other.Version <= Version) {
reason = "Path was already updated";
return false;
@@ -213,16 +213,16 @@ namespace {
return true;
}
- if (!DomainId && Deleted) {
- if (other.Version <= Version) {
- reason = "Path was already deleted";
- return false;
- }
-
- reason = "Path was updated to new version";
- return true;
- }
-
+ if (!DomainId && Deleted) {
+ if (other.Version <= Version) {
+ reason = "Path was already deleted";
+ return false;
+ }
+
+ reason = "Path was updated to new version";
+ return true;
+ }
+
// it is only because we need to manage undo of upgrade subdomain, finally remove it
if (Version.PathId == other.DomainId) { //Update from TSS, GSS->TSS
@@ -245,22 +245,22 @@ namespace {
return false;
}
- if (DomainId == other.DomainId) {
- if (other.Version <= Version) {
- reason = "Path was already updated";
- return false;
- }
-
- reason = "Path was updated to new version";
- return true;
- } else if (DomainId < other.DomainId) {
- reason = "New domain is detected, it is newer path then we know";
- return true;
- } else {
- reason = "Totally ignore the update";
- return false;
- }
-
+ if (DomainId == other.DomainId) {
+ if (other.Version <= Version) {
+ reason = "Path was already updated";
+ return false;
+ }
+
+ reason = "Path was updated to new version";
+ return true;
+ } else if (DomainId < other.DomainId) {
+ reason = "New domain is detected, it is newer path then we know";
+ return true;
+ } else {
+ reason = "Totally ignore the update";
+ return false;
+ }
+
Y_FAIL_S("Unknown update"
<< ": state# " << *this
<< ", other state# " << other);
@@ -600,8 +600,8 @@ class TSubscriber: public TMonitorableActor<TDerived> {
if (record.HasPath()) {
path = record.GetPath();
}
- if (record.HasPathOwnerId() && record.HasLocalPathId()) {
- pathId = TPathId(record.GetPathOwnerId(), record.GetLocalPathId());
+ if (record.HasPathOwnerId() && record.HasLocalPathId()) {
+ pathId = TPathId(record.GetPathOwnerId(), record.GetLocalPathId());
}
Y_VERIFY(path || pathId);
@@ -686,7 +686,7 @@ class TSubscriber: public TMonitorableActor<TDerived> {
SBS_LOG_E("Suspicious notification"
<< ": sender# " << ev->Sender
<< ", other path# " << record.GetPath()
- << ", other pathId# " << TPathId(record.GetPathOwnerId(), record.GetLocalPathId()));
+ << ", other pathId# " << TPathId(record.GetPathOwnerId(), record.GetLocalPathId()));
return;
}
@@ -726,14 +726,14 @@ class TSubscriber: public TMonitorableActor<TDerived> {
<< ": owner# " << Owner
<< ", state# " << *State
<< ", other state# " << newestState);
- return;
- }
+ return;
+ }
if (!record.GetIsDeletion()) {
- this->Send(Owner, BuildNotify<TSchemeBoardEvents::TEvNotifyUpdate>(record, std::move(*record.MutableDescribeSchemeResult())));
+ this->Send(Owner, BuildNotify<TSchemeBoardEvents::TEvNotifyUpdate>(record, std::move(*record.MutableDescribeSchemeResult())));
} else {
this->Send(Owner, BuildNotify<TSchemeBoardEvents::TEvNotifyDelete>(record, record.GetStrong()));
- }
+ }
}
void Handle(TSchemeBoardEvents::TEvSyncRequest::TPtr& ev) {
@@ -1049,10 +1049,10 @@ IActor* CreateSchemeBoardSubscriber(
}
} // NKikimr
-
+
Y_DECLARE_OUT_SPEC(inline, NKikimr::NSchemeBoard::TPathVersion, o, x) {
- return x.Out(o);
-}
+ return x.Out(o);
+}
Y_DECLARE_OUT_SPEC(inline, NKikimr::NSchemeBoard::TState, o, x) {
return x.Out(o);
diff --git a/ydb/core/tx/scheme_board/subscriber_ut.cpp b/ydb/core/tx/scheme_board/subscriber_ut.cpp
index 272c6aa6bd1..7e1d580305f 100644
--- a/ydb/core/tx/scheme_board/subscriber_ut.cpp
+++ b/ydb/core/tx/scheme_board/subscriber_ut.cpp
@@ -93,7 +93,7 @@ void TSubscriberTest::NotifyUpdate() {
auto replicas = ResolveReplicas();
Context->HandshakeReplica(replicas[0], edge);
- Context->Send(replicas[0], edge, GenerateUpdate(GenerateDescribe("path", TPathId(1, 1))));
+ Context->Send(replicas[0], edge, GenerateUpdate(GenerateDescribe("path", TPathId(1, 1))));
auto ev = Context->GrabEdgeEvent<TSchemeBoardEvents::TEvNotifyUpdate>(edge);
UNIT_ASSERT(ev->Get());
@@ -108,7 +108,7 @@ void TSubscriberTest::NotifyDelete() {
for (const auto& replica : replicas) {
Context->HandshakeReplica(replica, edge);
- Context->Send(replica, edge, GenerateUpdate(GenerateDescribe("path", TPathId(1, 1))));
+ Context->Send(replica, edge, GenerateUpdate(GenerateDescribe("path", TPathId(1, 1))));
}
Context->CreateSubscriber<TSchemeBoardEvents::TEvNotifyUpdate>(edge, "path");
@@ -152,7 +152,7 @@ void TSubscriberTest::InvalidNotification() {
// send notification directly to subscriber
auto* notify = new TSchemeBoardEvents::TEvNotifyBuilder(TPathId(1, 1));
- notify->Record.MutableDescribeSchemeResult()->CopyFrom(GenerateDescribe("another/path", TPathId(1, 1)));
+ notify->Record.MutableDescribeSchemeResult()->CopyFrom(GenerateDescribe("another/path", TPathId(1, 1)));
Context->Send(subscriber, edge, notify);
size_t counter = Context->CountEdgeEvents<TSchemeBoardEvents::TEvNotifyUpdate>();
@@ -170,7 +170,7 @@ void TSubscriberTest::ReconnectOnFailure() {
auto replicas = ResolveReplicas();
Context->HandshakeReplica(replicas[0], edge);
- Context->Send(replicas[0], edge, GenerateUpdate(GenerateDescribe("path", TPathId(1, 1))));
+ Context->Send(replicas[0], edge, GenerateUpdate(GenerateDescribe("path", TPathId(1, 1))));
auto ev = Context->GrabEdgeEvent<TSchemeBoardEvents::TEvNotifyUpdate>(edge);
UNIT_ASSERT(ev->Get());
@@ -183,7 +183,7 @@ void TSubscriberTest::Sync() {
auto replicas = ResolveReplicas();
for (const auto& replica : replicas) {
Context->HandshakeReplica(replica, edge);
- Context->Send(replica, edge, GenerateUpdate(GenerateDescribe("path", TPathId(1, 1))));
+ Context->Send(replica, edge, GenerateUpdate(GenerateDescribe("path", TPathId(1, 1))));
}
const TActorId subscriber = Context->CreateSubscriber<TSchemeBoardEvents::TEvNotifyUpdate>(edge, "path");
@@ -249,264 +249,264 @@ void TSubscriberTest::SyncWithOutdatedReplica() {
}
}
-class TSubscriberCombinationsTest: public NUnitTest::TTestBase {
+class TSubscriberCombinationsTest: public NUnitTest::TTestBase {
TVector<TActorId> ResolveReplicas(TTestContext& context) {
const TActorId proxy = MakeStateStorageProxyID(0);
const TActorId edge = context.AllocateEdgeActor();
-
- context.Send(proxy, edge, new TEvStateStorage::TEvListSchemeBoard());
- auto ev = context.GrabEdgeEvent<TEvStateStorage::TEvListSchemeBoardResult>(edge);
-
- Y_VERIFY(ev->Get()->Info);
- auto allReplicas = ev->Get()->Info->SelectAllReplicas();
+
+ context.Send(proxy, edge, new TEvStateStorage::TEvListSchemeBoard());
+ auto ev = context.GrabEdgeEvent<TEvStateStorage::TEvListSchemeBoardResult>(edge);
+
+ Y_VERIFY(ev->Get()->Info);
+ auto allReplicas = ev->Get()->Info->SelectAllReplicas();
return TVector<TActorId>(allReplicas.begin(), allReplicas.end());
- }
-
- THolder<TTestContext> CreateContext() {
- auto context = MakeHolder<TTestContext>(2);
-
- for (ui32 i : xrange(context->GetNodeCount())) {
- SetupStateStorage(*context, i, 0);
- }
-
- context->Initialize(TAppPrepare().Unwrap());
- context->SetLogPriority(NKikimrServices::SCHEME_BOARD_SUBSCRIBER, NLog::PRI_DEBUG);
- context->SetLogPriority(NKikimrServices::SCHEME_BOARD_REPLICA, NLog::PRI_DEBUG);
-
- return context;
- }
-
- UNIT_TEST_SUITE(TSubscriberCombinationsTest);
- UNIT_TEST(CombinationsRootDomain);
- UNIT_TEST(MigratedPathRecreation);
- UNIT_TEST(CombinationsMigratedPath);
- UNIT_TEST_SUITE_END();
-
- void CombinationsRootDomain();
- void MigratedPathRecreation();
- void CombinationsMigratedPath();
-}; // TSubscriberCombinationsTest
-
-UNIT_TEST_SUITE_REGISTRATION(TSubscriberCombinationsTest);
-
-
-void TSubscriberCombinationsTest::CombinationsRootDomain() {
- TString path = "/root/tenant";
- ui64 gssOwnerID = 800;
- TVector<TCombinationsArgs> combinations = GenerateCombinationsDomainRoot(path, gssOwnerID);
-
- //make all the variants
- for (const auto& argsLeft: combinations) {
- for (const auto& argsRight: combinations) {
- Cerr << "=========== " << argsLeft.GenerateDescribe().ShortDebugString()
- << "\n=========== " << argsRight.GenerateDescribe().ShortDebugString() << Endl;
-
- auto context = CreateContext();
-
+ }
+
+ THolder<TTestContext> CreateContext() {
+ auto context = MakeHolder<TTestContext>(2);
+
+ for (ui32 i : xrange(context->GetNodeCount())) {
+ SetupStateStorage(*context, i, 0);
+ }
+
+ context->Initialize(TAppPrepare().Unwrap());
+ context->SetLogPriority(NKikimrServices::SCHEME_BOARD_SUBSCRIBER, NLog::PRI_DEBUG);
+ context->SetLogPriority(NKikimrServices::SCHEME_BOARD_REPLICA, NLog::PRI_DEBUG);
+
+ return context;
+ }
+
+ UNIT_TEST_SUITE(TSubscriberCombinationsTest);
+ UNIT_TEST(CombinationsRootDomain);
+ UNIT_TEST(MigratedPathRecreation);
+ UNIT_TEST(CombinationsMigratedPath);
+ UNIT_TEST_SUITE_END();
+
+ void CombinationsRootDomain();
+ void MigratedPathRecreation();
+ void CombinationsMigratedPath();
+}; // TSubscriberCombinationsTest
+
+UNIT_TEST_SUITE_REGISTRATION(TSubscriberCombinationsTest);
+
+
+void TSubscriberCombinationsTest::CombinationsRootDomain() {
+ TString path = "/root/tenant";
+ ui64 gssOwnerID = 800;
+ TVector<TCombinationsArgs> combinations = GenerateCombinationsDomainRoot(path, gssOwnerID);
+
+ //make all the variants
+ for (const auto& argsLeft: combinations) {
+ for (const auto& argsRight: combinations) {
+ Cerr << "=========== " << argsLeft.GenerateDescribe().ShortDebugString()
+ << "\n=========== " << argsRight.GenerateDescribe().ShortDebugString() << Endl;
+
+ auto context = CreateContext();
+
TVector<TActorId> replicas = ResolveReplicas(*context);
- Y_ASSERT(replicas.size() >= 2);
-
+ Y_ASSERT(replicas.size() >= 2);
+
const TActorId populatorLeft = context->AllocateEdgeActor();
- context->HandshakeReplica(replicas[0], populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
- context->CommitReplica(replicas[0], populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
-
+ context->HandshakeReplica(replicas[0], populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
+ context->CommitReplica(replicas[0], populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
+
const TActorId populatorRight = context->AllocateEdgeActor();
- context->HandshakeReplica(replicas[1], populatorRight, argsRight.OwnerId, argsRight.Generation);
- context->CommitReplica(replicas[1], populatorRight, argsRight.OwnerId, argsRight.Generation);
-
+ context->HandshakeReplica(replicas[1], populatorRight, argsRight.OwnerId, argsRight.Generation);
+ context->CommitReplica(replicas[1], populatorRight, argsRight.OwnerId, argsRight.Generation);
+
const TActorId edge = context->AllocateEdgeActor();
- context->CreateSubscriber<TSchemeBoardEvents::TEvNotifyDelete>(edge, path);
-
- context->Send(replicas[0], populatorLeft, argsLeft.GenerateUpdate());
-
- if (!argsLeft.IsDeletion) {
- Cerr << "=========== !argsLeft.IsDeletion" << Endl;
- auto ev = context->GrabEdgeEvent<TSchemeBoardEvents::TEvNotifyUpdate>(edge);
- Y_ASSERT(ev);
- UNIT_ASSERT_VALUES_EQUAL(path, ev->Get()->Path);
- UNIT_ASSERT_VALUES_EQUAL(argsLeft.PathId, ev->Get()->PathId);
- const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->DescribeSchemeResult;
- const auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
- UNIT_ASSERT_VALUES_EQUAL(argsLeft.DomainId, TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
- }
-
- context->Send(replicas[1], populatorRight, argsRight.GenerateUpdate());
-
- if (argsLeft.GetSuperId() >= argsRight.GetSuperId()) {
- Cerr << "=========== argsLeft.GetSuperId() >= argsRight.GetSuperId()" << Endl;
-
- // there is no update comming
- continue;
- }
-
- Cerr << "=========== argsLeft.GetSuperId() < argsRight.GetSuperId()" << Endl;
-
- if (!argsRight.IsDeletion) {
- Cerr << "=========== !argsRight.IsDeletion" << Endl;
-
- auto ev = context->GrabEdgeEvent<TSchemeBoardEvents::TEvNotifyUpdate>(edge);
-
- Y_ASSERT(ev);
- UNIT_ASSERT_VALUES_EQUAL(path, ev->Get()->Path);
- UNIT_ASSERT_VALUES_EQUAL(argsRight.PathId, ev->Get()->PathId);
- const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->DescribeSchemeResult;
- const auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
- UNIT_ASSERT_VALUES_EQUAL(argsRight.DomainId, TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
-
- continue;
- }
- }
- }
-}
-
-void TSubscriberCombinationsTest::MigratedPathRecreation() {
- ui64 gssOwnerID = 800;
- ui64 tssOwnerID = 900;
-
- TString path = "/root/db/dir_inside";
-
- auto domainId = TPathId(gssOwnerID, 1);
- auto migratedPathId = TPathId(gssOwnerID, 1111);
-
- auto recreatedPathId = TPathId(tssOwnerID, 11);
-
- auto argsLeft = TCombinationsArgs{
- path, migratedPathId, 1, domainId,
- gssOwnerID, 1, false};
- auto argsRight = TCombinationsArgs{
- path, recreatedPathId, 1, domainId,
- tssOwnerID, 1, false};
-
-
- auto context = CreateContext();
-
- TVector<TActorId> replicas = ResolveReplicas(*context);
- Y_ASSERT(replicas.size() >= 2);
-
- const TActorId populatorLeft = context->AllocateEdgeActor();
- context->HandshakeReplica(replicas[0], populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
- context->CommitReplica(replicas[0], populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
-
- const TActorId populatorRight = context->AllocateEdgeActor();
- context->HandshakeReplica(replicas[1], populatorRight, argsRight.OwnerId, argsRight.Generation);
- context->CommitReplica(replicas[1], populatorRight, argsRight.OwnerId, argsRight.Generation);
-
- const TActorId edge = context->AllocateEdgeActor();
- context->CreateSubscriber<TSchemeBoardEvents::TEvNotifyDelete>(edge, path);
-
- context->Send(replicas[0], populatorLeft, argsLeft.GenerateUpdate());
-
- if (!argsLeft.IsDeletion) {
- Cerr << "=========== !argsLeft.IsDeletion" << Endl;
- auto ev = context->GrabEdgeEvent<TSchemeBoardEvents::TEvNotifyUpdate>(edge);
- Y_ASSERT(ev);
- UNIT_ASSERT_VALUES_EQUAL(path, ev->Get()->Path);
- UNIT_ASSERT_VALUES_EQUAL(argsLeft.PathId, ev->Get()->PathId);
- const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->DescribeSchemeResult;
- const auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
- UNIT_ASSERT_VALUES_EQUAL(argsLeft.DomainId, TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
- }
-
- context->Send(replicas[1], populatorRight, argsRight.GenerateUpdate());
-
- if (argsLeft.GetSuperId() >= argsRight.GetSuperId()) {
- Cerr << "=========== argsLeft.GetSuperId() >= argsRight.GetSuperId()" << Endl;
-
- // there is no update comming
- return;
- }
-
- Cerr << "=========== argsLeft.GetSuperId() < argsRight.GetSuperId()" << Endl;
-
- if (!argsRight.IsDeletion) {
- Cerr << "=========== !argsRight.IsDeletion" << Endl;
-
- auto ev = context->GrabEdgeEvent<TSchemeBoardEvents::TEvNotifyUpdate>(edge);
-
- Y_ASSERT(ev);
- UNIT_ASSERT_VALUES_EQUAL(path, ev->Get()->Path);
- UNIT_ASSERT_VALUES_EQUAL(argsRight.PathId, ev->Get()->PathId);
- const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->DescribeSchemeResult;
- const auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
- UNIT_ASSERT_VALUES_EQUAL(argsRight.DomainId, TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
-
- return;
- }
-}
-
-void TSubscriberCombinationsTest::CombinationsMigratedPath() {
- TString path = "/Root/Tenant/table_inside";
- ui64 gssID = 800;
- ui64 tssID = 900;
- ui64 tssIDrecreated = 910;
- ui64 gssLocalId = 5;
- ui64 tssLocalId = 9;
- TVector<TCombinationsArgs> combinations = GenerateCombinationsMigratedPath(path, gssID, {tssID, tssIDrecreated}, gssLocalId, tssLocalId);
-
- //make all the variants
- for (const auto& argsLeft: combinations) {
- for (const auto& argsRight: combinations) {
- Cerr << "=========== " << argsLeft.GenerateDescribe().ShortDebugString()
- << "\n=========== " << argsRight.GenerateDescribe().ShortDebugString() << Endl;
-
- auto context = CreateContext();
-
- TVector<TActorId> replicas = ResolveReplicas(*context);
- Y_ASSERT(replicas.size() >= 2);
-
- const TActorId populatorLeft = context->AllocateEdgeActor();
- context->HandshakeReplica(replicas[0], populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
- context->CommitReplica(replicas[0], populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
-
- const TActorId populatorRight = context->AllocateEdgeActor();
- context->HandshakeReplica(replicas[1], populatorRight, argsRight.OwnerId, argsRight.Generation);
- context->CommitReplica(replicas[1], populatorRight, argsRight.OwnerId, argsRight.Generation);
-
- const TActorId edge = context->AllocateEdgeActor();
- context->CreateSubscriber<TSchemeBoardEvents::TEvNotifyDelete>(edge, path);
-
- context->Send(replicas[0], populatorLeft, argsLeft.GenerateUpdate());
-
- if (!argsLeft.IsDeletion) {
- Cerr << "=========== !argsLeft.IsDeletion" << Endl;
- auto ev = context->GrabEdgeEvent<TSchemeBoardEvents::TEvNotifyUpdate>(edge);
- Y_ASSERT(ev);
- UNIT_ASSERT_VALUES_EQUAL(path, ev->Get()->Path);
- UNIT_ASSERT_VALUES_EQUAL(argsLeft.PathId, ev->Get()->PathId);
- const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->DescribeSchemeResult;
- const auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
- UNIT_ASSERT_VALUES_EQUAL(argsLeft.DomainId, TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
- }
-
- context->Send(replicas[1], populatorRight, argsRight.GenerateUpdate());
-
- if (argsLeft.GetSuperId() >= argsRight.GetSuperId()) {
- Cerr << "=========== argsLeft.GetSuperId() >= argsRight.GetSuperId()" << Endl;
-
- // there is no update comming
- continue;
- }
-
- Cerr << "=========== argsLeft.GetSuperId() < argsRight.GetSuperId()" << Endl;
-
- if (!argsRight.IsDeletion) {
- Cerr << "=========== !argsRight.IsDeletion" << Endl;
-
- auto ev = context->GrabEdgeEvent<TSchemeBoardEvents::TEvNotifyUpdate>(edge);
-
- Y_ASSERT(ev);
- UNIT_ASSERT_VALUES_EQUAL(path, ev->Get()->Path);
- UNIT_ASSERT_VALUES_EQUAL(argsRight.PathId, ev->Get()->PathId);
- const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->DescribeSchemeResult;
- const auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
- UNIT_ASSERT_VALUES_EQUAL(argsRight.DomainId, TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
-
- continue;
- }
- }
- }
-}
-
-
+ context->CreateSubscriber<TSchemeBoardEvents::TEvNotifyDelete>(edge, path);
+
+ context->Send(replicas[0], populatorLeft, argsLeft.GenerateUpdate());
+
+ if (!argsLeft.IsDeletion) {
+ Cerr << "=========== !argsLeft.IsDeletion" << Endl;
+ auto ev = context->GrabEdgeEvent<TSchemeBoardEvents::TEvNotifyUpdate>(edge);
+ Y_ASSERT(ev);
+ UNIT_ASSERT_VALUES_EQUAL(path, ev->Get()->Path);
+ UNIT_ASSERT_VALUES_EQUAL(argsLeft.PathId, ev->Get()->PathId);
+ const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->DescribeSchemeResult;
+ const auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
+ UNIT_ASSERT_VALUES_EQUAL(argsLeft.DomainId, TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
+ }
+
+ context->Send(replicas[1], populatorRight, argsRight.GenerateUpdate());
+
+ if (argsLeft.GetSuperId() >= argsRight.GetSuperId()) {
+ Cerr << "=========== argsLeft.GetSuperId() >= argsRight.GetSuperId()" << Endl;
+
+ // there is no update comming
+ continue;
+ }
+
+ Cerr << "=========== argsLeft.GetSuperId() < argsRight.GetSuperId()" << Endl;
+
+ if (!argsRight.IsDeletion) {
+ Cerr << "=========== !argsRight.IsDeletion" << Endl;
+
+ auto ev = context->GrabEdgeEvent<TSchemeBoardEvents::TEvNotifyUpdate>(edge);
+
+ Y_ASSERT(ev);
+ UNIT_ASSERT_VALUES_EQUAL(path, ev->Get()->Path);
+ UNIT_ASSERT_VALUES_EQUAL(argsRight.PathId, ev->Get()->PathId);
+ const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->DescribeSchemeResult;
+ const auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
+ UNIT_ASSERT_VALUES_EQUAL(argsRight.DomainId, TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
+
+ continue;
+ }
+ }
+ }
+}
+
+void TSubscriberCombinationsTest::MigratedPathRecreation() {
+ ui64 gssOwnerID = 800;
+ ui64 tssOwnerID = 900;
+
+ TString path = "/root/db/dir_inside";
+
+ auto domainId = TPathId(gssOwnerID, 1);
+ auto migratedPathId = TPathId(gssOwnerID, 1111);
+
+ auto recreatedPathId = TPathId(tssOwnerID, 11);
+
+ auto argsLeft = TCombinationsArgs{
+ path, migratedPathId, 1, domainId,
+ gssOwnerID, 1, false};
+ auto argsRight = TCombinationsArgs{
+ path, recreatedPathId, 1, domainId,
+ tssOwnerID, 1, false};
+
+
+ auto context = CreateContext();
+
+ TVector<TActorId> replicas = ResolveReplicas(*context);
+ Y_ASSERT(replicas.size() >= 2);
+
+ const TActorId populatorLeft = context->AllocateEdgeActor();
+ context->HandshakeReplica(replicas[0], populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
+ context->CommitReplica(replicas[0], populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
+
+ const TActorId populatorRight = context->AllocateEdgeActor();
+ context->HandshakeReplica(replicas[1], populatorRight, argsRight.OwnerId, argsRight.Generation);
+ context->CommitReplica(replicas[1], populatorRight, argsRight.OwnerId, argsRight.Generation);
+
+ const TActorId edge = context->AllocateEdgeActor();
+ context->CreateSubscriber<TSchemeBoardEvents::TEvNotifyDelete>(edge, path);
+
+ context->Send(replicas[0], populatorLeft, argsLeft.GenerateUpdate());
+
+ if (!argsLeft.IsDeletion) {
+ Cerr << "=========== !argsLeft.IsDeletion" << Endl;
+ auto ev = context->GrabEdgeEvent<TSchemeBoardEvents::TEvNotifyUpdate>(edge);
+ Y_ASSERT(ev);
+ UNIT_ASSERT_VALUES_EQUAL(path, ev->Get()->Path);
+ UNIT_ASSERT_VALUES_EQUAL(argsLeft.PathId, ev->Get()->PathId);
+ const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->DescribeSchemeResult;
+ const auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
+ UNIT_ASSERT_VALUES_EQUAL(argsLeft.DomainId, TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
+ }
+
+ context->Send(replicas[1], populatorRight, argsRight.GenerateUpdate());
+
+ if (argsLeft.GetSuperId() >= argsRight.GetSuperId()) {
+ Cerr << "=========== argsLeft.GetSuperId() >= argsRight.GetSuperId()" << Endl;
+
+ // there is no update comming
+ return;
+ }
+
+ Cerr << "=========== argsLeft.GetSuperId() < argsRight.GetSuperId()" << Endl;
+
+ if (!argsRight.IsDeletion) {
+ Cerr << "=========== !argsRight.IsDeletion" << Endl;
+
+ auto ev = context->GrabEdgeEvent<TSchemeBoardEvents::TEvNotifyUpdate>(edge);
+
+ Y_ASSERT(ev);
+ UNIT_ASSERT_VALUES_EQUAL(path, ev->Get()->Path);
+ UNIT_ASSERT_VALUES_EQUAL(argsRight.PathId, ev->Get()->PathId);
+ const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->DescribeSchemeResult;
+ const auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
+ UNIT_ASSERT_VALUES_EQUAL(argsRight.DomainId, TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
+
+ return;
+ }
+}
+
+void TSubscriberCombinationsTest::CombinationsMigratedPath() {
+ TString path = "/Root/Tenant/table_inside";
+ ui64 gssID = 800;
+ ui64 tssID = 900;
+ ui64 tssIDrecreated = 910;
+ ui64 gssLocalId = 5;
+ ui64 tssLocalId = 9;
+ TVector<TCombinationsArgs> combinations = GenerateCombinationsMigratedPath(path, gssID, {tssID, tssIDrecreated}, gssLocalId, tssLocalId);
+
+ //make all the variants
+ for (const auto& argsLeft: combinations) {
+ for (const auto& argsRight: combinations) {
+ Cerr << "=========== " << argsLeft.GenerateDescribe().ShortDebugString()
+ << "\n=========== " << argsRight.GenerateDescribe().ShortDebugString() << Endl;
+
+ auto context = CreateContext();
+
+ TVector<TActorId> replicas = ResolveReplicas(*context);
+ Y_ASSERT(replicas.size() >= 2);
+
+ const TActorId populatorLeft = context->AllocateEdgeActor();
+ context->HandshakeReplica(replicas[0], populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
+ context->CommitReplica(replicas[0], populatorLeft, argsLeft.OwnerId, argsLeft.Generation);
+
+ const TActorId populatorRight = context->AllocateEdgeActor();
+ context->HandshakeReplica(replicas[1], populatorRight, argsRight.OwnerId, argsRight.Generation);
+ context->CommitReplica(replicas[1], populatorRight, argsRight.OwnerId, argsRight.Generation);
+
+ const TActorId edge = context->AllocateEdgeActor();
+ context->CreateSubscriber<TSchemeBoardEvents::TEvNotifyDelete>(edge, path);
+
+ context->Send(replicas[0], populatorLeft, argsLeft.GenerateUpdate());
+
+ if (!argsLeft.IsDeletion) {
+ Cerr << "=========== !argsLeft.IsDeletion" << Endl;
+ auto ev = context->GrabEdgeEvent<TSchemeBoardEvents::TEvNotifyUpdate>(edge);
+ Y_ASSERT(ev);
+ UNIT_ASSERT_VALUES_EQUAL(path, ev->Get()->Path);
+ UNIT_ASSERT_VALUES_EQUAL(argsLeft.PathId, ev->Get()->PathId);
+ const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->DescribeSchemeResult;
+ const auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
+ UNIT_ASSERT_VALUES_EQUAL(argsLeft.DomainId, TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
+ }
+
+ context->Send(replicas[1], populatorRight, argsRight.GenerateUpdate());
+
+ if (argsLeft.GetSuperId() >= argsRight.GetSuperId()) {
+ Cerr << "=========== argsLeft.GetSuperId() >= argsRight.GetSuperId()" << Endl;
+
+ // there is no update comming
+ continue;
+ }
+
+ Cerr << "=========== argsLeft.GetSuperId() < argsRight.GetSuperId()" << Endl;
+
+ if (!argsRight.IsDeletion) {
+ Cerr << "=========== !argsRight.IsDeletion" << Endl;
+
+ auto ev = context->GrabEdgeEvent<TSchemeBoardEvents::TEvNotifyUpdate>(edge);
+
+ Y_ASSERT(ev);
+ UNIT_ASSERT_VALUES_EQUAL(path, ev->Get()->Path);
+ UNIT_ASSERT_VALUES_EQUAL(argsRight.PathId, ev->Get()->PathId);
+ const NKikimrScheme::TEvDescribeSchemeResult& descr = ev->Get()->DescribeSchemeResult;
+ const auto& domainKey = descr.GetPathDescription().GetDomainDescription().GetDomainKey();
+ UNIT_ASSERT_VALUES_EQUAL(argsRight.DomainId, TDomainId(domainKey.GetSchemeShard(), domainKey.GetPathId()));
+
+ continue;
+ }
+ }
+ }
+}
+
+
} // NSchemeBoard
} // NKikimr
diff --git a/ydb/core/tx/scheme_board/two_part_description.h b/ydb/core/tx/scheme_board/two_part_description.h
index b5e7a49af7a..0e7c8b48110 100644
--- a/ydb/core/tx/scheme_board/two_part_description.h
+++ b/ydb/core/tx/scheme_board/two_part_description.h
@@ -9,11 +9,11 @@ namespace NSchemeBoard {
struct TTwoPartDescription {
TString PreSerialized;
- NKikimrScheme::TEvDescribeSchemeResult Record;
+ NKikimrScheme::TEvDescribeSchemeResult Record;
TTwoPartDescription() = default;
- explicit TTwoPartDescription(TString preSerialized, NKikimrScheme::TEvDescribeSchemeResult record)
+ explicit TTwoPartDescription(TString preSerialized, NKikimrScheme::TEvDescribeSchemeResult record)
: PreSerialized(std::move(preSerialized))
, Record(std::move(record))
{
diff --git a/ydb/core/tx/scheme_board/ut_helpers.cpp b/ydb/core/tx/scheme_board/ut_helpers.cpp
index 707e36b74c5..762d8ddea12 100644
--- a/ydb/core/tx/scheme_board/ut_helpers.cpp
+++ b/ydb/core/tx/scheme_board/ut_helpers.cpp
@@ -3,30 +3,30 @@
namespace NKikimr {
namespace NSchemeBoard {
-NKikimrScheme::TEvDescribeSchemeResult GenerateDescribe(
+NKikimrScheme::TEvDescribeSchemeResult GenerateDescribe(
const TString& path,
- TPathId pathId,
- ui64 version,
- TDomainId domainId
+ TPathId pathId,
+ ui64 version,
+ TDomainId domainId
) {
- NKikimrScheme::TEvDescribeSchemeResult describeSchemeResult;
+ NKikimrScheme::TEvDescribeSchemeResult describeSchemeResult;
describeSchemeResult.SetPath(path);
- describeSchemeResult.SetPathId(pathId.LocalPathId);
- describeSchemeResult.SetPathOwnerId(pathId.OwnerId);
+ describeSchemeResult.SetPathId(pathId.LocalPathId);
+ describeSchemeResult.SetPathOwnerId(pathId.OwnerId);
describeSchemeResult.MutablePathDescription()->MutableSelf()->SetPathVersion(version);
- if (domainId) {
- auto domainKey = describeSchemeResult.MutablePathDescription()->MutableDomainDescription()->MutableDomainKey();
- domainKey->SetSchemeShard(domainId.OwnerId);
- domainKey->SetPathId(domainId.LocalPathId);
- }
-
+ if (domainId) {
+ auto domainKey = describeSchemeResult.MutablePathDescription()->MutableDomainDescription()->MutableDomainKey();
+ domainKey->SetSchemeShard(domainId.OwnerId);
+ domainKey->SetPathId(domainId.LocalPathId);
+ }
+
return describeSchemeResult;
}
TSchemeBoardEvents::TEvUpdate* GenerateUpdate(
- const NKikimrScheme::TEvDescribeSchemeResult& describe,
+ const NKikimrScheme::TEvDescribeSchemeResult& describe,
ui64 owner,
ui64 generation,
bool isDeletion
@@ -40,109 +40,109 @@ TSchemeBoardEvents::TEvUpdate* GenerateUpdate(
return update;
}
-TVector<TCombinationsArgs> GenerateCombinationsDomainRoot(TString path, ui64 gssOwnerID, TVector<ui64> tenantsOwners) {
- TVector<TCombinationsArgs> combinations;
-
- for (ui64 tssOwnerId: tenantsOwners) {
- const ui64 domainLocalPathId = FindIndex(tenantsOwners, tssOwnerId) + 2;
- const TPathId domainId = TPathId(gssOwnerID, domainLocalPathId);
- const TPathId tenantRoot = TPathId(tssOwnerId, 1);
-
- //firts
- combinations.emplace_back(
- TCombinationsArgs{
- path, domainId, 1, domainId,
- gssOwnerID, 1, false});
- combinations.push_back(
- TCombinationsArgs{
- path, tenantRoot, 1, domainId,
- tssOwnerId, 1, false});
-
- //update it
- combinations.push_back(
- TCombinationsArgs{
- path, domainId, 2, domainId,
- gssOwnerID, 1, false});
- combinations.push_back(
- TCombinationsArgs{
- path, tenantRoot, 2, domainId,
- tssOwnerId, 1, false});
-
- //delte it
- combinations.push_back(
- TCombinationsArgs{
- path, domainId, Max<ui64>(), domainId,
- gssOwnerID, 1, true});
- // fromTss.push_back( // we do not delete tenants from cache
- // GenerateUpdate(
- // path, tenantRoot, Max<ui64>, tenantRoot,
- // tssOwnerId, 1, true));
- }
-
- return combinations;
-}
-
-TVector<TCombinationsArgs> GenerateCombinationsMigratedPath(TString path,
- ui64 gssID, TVector<ui64> tssIDs,
- ui64 gssLocalPathId, ui64 tssLocalPathId)
-{
- TVector<TCombinationsArgs> combinations;
-
- TPathId domainId = TPathId(gssID, 2);
- auto migratedPath = TPathId(gssID, gssLocalPathId);
-
- //migratedPath from GSS
- combinations.emplace_back(
- TCombinationsArgs{
- path, migratedPath, 1, domainId,
- tssIDs[0], 1, false});
-
- //migratedPath from TSS
- combinations.push_back(
- TCombinationsArgs{
- path, migratedPath, 2, domainId,
- tssIDs[0], 1, false});
-
- //update it on TSS
- combinations.push_back(
- TCombinationsArgs{
- path, migratedPath, 3, domainId,
- tssIDs[0], 1, false});
-
- //remove it on TSS
- combinations.push_back(
- TCombinationsArgs{
- path, migratedPath, Max<ui64>(), domainId,
- tssIDs[0], 1, true});
-
- for (size_t i = 0; i < tssIDs.size(); ++i) {
- auto tssID = tssIDs[i];
-
- auto recreatedPath = TPathId(tssID, tssLocalPathId);
-
- //recreate it on TSS
- combinations.push_back(
- TCombinationsArgs{
- path, recreatedPath, 1, domainId,
- tssID, 1, false});
-
- //update it on TSS
- combinations.push_back(
- TCombinationsArgs{
- path, recreatedPath, 2, domainId,
- tssID, 1, false});
-
- //remove it on TSS
- combinations.push_back(
- TCombinationsArgs{
- path, recreatedPath, Max<ui64>(), domainId,
- tssID, 1, true});
-
- domainId.LocalPathId += 331;
- }
-
- return combinations;
-}
-
+TVector<TCombinationsArgs> GenerateCombinationsDomainRoot(TString path, ui64 gssOwnerID, TVector<ui64> tenantsOwners) {
+ TVector<TCombinationsArgs> combinations;
+
+ for (ui64 tssOwnerId: tenantsOwners) {
+ const ui64 domainLocalPathId = FindIndex(tenantsOwners, tssOwnerId) + 2;
+ const TPathId domainId = TPathId(gssOwnerID, domainLocalPathId);
+ const TPathId tenantRoot = TPathId(tssOwnerId, 1);
+
+ //firts
+ combinations.emplace_back(
+ TCombinationsArgs{
+ path, domainId, 1, domainId,
+ gssOwnerID, 1, false});
+ combinations.push_back(
+ TCombinationsArgs{
+ path, tenantRoot, 1, domainId,
+ tssOwnerId, 1, false});
+
+ //update it
+ combinations.push_back(
+ TCombinationsArgs{
+ path, domainId, 2, domainId,
+ gssOwnerID, 1, false});
+ combinations.push_back(
+ TCombinationsArgs{
+ path, tenantRoot, 2, domainId,
+ tssOwnerId, 1, false});
+
+ //delte it
+ combinations.push_back(
+ TCombinationsArgs{
+ path, domainId, Max<ui64>(), domainId,
+ gssOwnerID, 1, true});
+ // fromTss.push_back( // we do not delete tenants from cache
+ // GenerateUpdate(
+ // path, tenantRoot, Max<ui64>, tenantRoot,
+ // tssOwnerId, 1, true));
+ }
+
+ return combinations;
+}
+
+TVector<TCombinationsArgs> GenerateCombinationsMigratedPath(TString path,
+ ui64 gssID, TVector<ui64> tssIDs,
+ ui64 gssLocalPathId, ui64 tssLocalPathId)
+{
+ TVector<TCombinationsArgs> combinations;
+
+ TPathId domainId = TPathId(gssID, 2);
+ auto migratedPath = TPathId(gssID, gssLocalPathId);
+
+ //migratedPath from GSS
+ combinations.emplace_back(
+ TCombinationsArgs{
+ path, migratedPath, 1, domainId,
+ tssIDs[0], 1, false});
+
+ //migratedPath from TSS
+ combinations.push_back(
+ TCombinationsArgs{
+ path, migratedPath, 2, domainId,
+ tssIDs[0], 1, false});
+
+ //update it on TSS
+ combinations.push_back(
+ TCombinationsArgs{
+ path, migratedPath, 3, domainId,
+ tssIDs[0], 1, false});
+
+ //remove it on TSS
+ combinations.push_back(
+ TCombinationsArgs{
+ path, migratedPath, Max<ui64>(), domainId,
+ tssIDs[0], 1, true});
+
+ for (size_t i = 0; i < tssIDs.size(); ++i) {
+ auto tssID = tssIDs[i];
+
+ auto recreatedPath = TPathId(tssID, tssLocalPathId);
+
+ //recreate it on TSS
+ combinations.push_back(
+ TCombinationsArgs{
+ path, recreatedPath, 1, domainId,
+ tssID, 1, false});
+
+ //update it on TSS
+ combinations.push_back(
+ TCombinationsArgs{
+ path, recreatedPath, 2, domainId,
+ tssID, 1, false});
+
+ //remove it on TSS
+ combinations.push_back(
+ TCombinationsArgs{
+ path, recreatedPath, Max<ui64>(), domainId,
+ tssID, 1, true});
+
+ domainId.LocalPathId += 331;
+ }
+
+ return combinations;
+}
+
} // NSchemeBoard
} // NKikimr
diff --git a/ydb/core/tx/scheme_board/ut_helpers.h b/ydb/core/tx/scheme_board/ut_helpers.h
index 9c5a7e223da..1f2e4d5e9b8 100644
--- a/ydb/core/tx/scheme_board/ut_helpers.h
+++ b/ydb/core/tx/scheme_board/ut_helpers.h
@@ -202,24 +202,24 @@ class TTestWithSchemeshard: public NUnitTest::TTestBase {
TAppPrepare app;
AddDomain(runtime, app, "Root", 0, 0, TTestTxConfig::Hive, TTestTxConfig::SchemeShard);
- SetupChannelProfiles(app, 0, 1);
+ SetupChannelProfiles(app, 0, 1);
SetupTabletServices(runtime, &app, true);
}
static void BootSchemeShard(TTestActorRuntime& runtime, ui64 tabletId) {
- using namespace NSchemeShard;
+ using namespace NSchemeShard;
CreateTestBootstrapper(runtime, CreateTestTabletInfo(tabletId, TTabletTypes::FLAT_SCHEMESHARD), &CreateFlatTxSchemeShard);
const TActorId edge = runtime.AllocateEdgeActor();
- auto init = new TEvSchemeShard::TEvInitRootShard(edge, 32, "Root");
+ auto init = new TEvSchemeShard::TEvInitRootShard(edge, 32, "Root");
runtime.SendToPipe(tabletId, edge, init, 0, GetPipeConfigWithRetries());
- auto ev = runtime.GrabEdgeEvent<TEvSchemeShard::TEvInitRootShardResult>(edge);
+ auto ev = runtime.GrabEdgeEvent<TEvSchemeShard::TEvInitRootShardResult>(edge);
UNIT_ASSERT(ev->Get());
UNIT_ASSERT_VALUES_EQUAL(ev->Get()->Record.GetOrigin(), tabletId);
- UNIT_ASSERT_VALUES_EQUAL(ev->Get()->Record.GetStatus(), (ui32)TEvSchemeShard::TEvInitRootShardResult::StatusAlreadyInitialized);
+ UNIT_ASSERT_VALUES_EQUAL(ev->Get()->Record.GetStatus(), (ui32)TEvSchemeShard::TEvInitRootShardResult::StatusAlreadyInitialized);
}
static void BootTxAllocator(TTestActorRuntime& runtime, ui64 tabletId) {
@@ -253,30 +253,30 @@ public:
BootHive(*Context, TTestTxConfig::Hive);
}
- void TurnOnTabletsScheduling() {
- if (SchedulingGuard) {
- return;
- }
-
+ void TurnOnTabletsScheduling() {
+ if (SchedulingGuard) {
+ return;
+ }
+
TActorId sender = Context->AllocateEdgeActor();
- TVector<ui64> tabletIds;
+ TVector<ui64> tabletIds;
tabletIds.push_back((ui64)TTestTxConfig::SchemeShard);
for (auto x: xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 10)) {
- tabletIds.push_back(x);
- }
-
- SchedulingGuard = CreateTabletScheduledEventsGuard(tabletIds, *Context, sender);
-
- // make schemeShard visible for ScheduledEventsGuard
- // trigger actor resolving for existed tablet
+ tabletIds.push_back(x);
+ }
+
+ SchedulingGuard = CreateTabletScheduledEventsGuard(tabletIds, *Context, sender);
+
+ // make schemeShard visible for ScheduledEventsGuard
+ // trigger actor resolving for existed tablet
RebootTablet(*Context, (ui64)TTestTxConfig::SchemeShard, sender);
- }
-
+ }
+
void TearDown() override {
- SchedulingGuard.Reset();
+ SchedulingGuard.Reset();
CoordinatorState.Drop();
HiveState.Drop();
- Context.Reset();
+ Context.Reset();
}
protected:
@@ -285,53 +285,53 @@ protected:
private:
TFakeCoordinator::TState::TPtr CoordinatorState;
TFakeHiveState::TPtr HiveState;
- THolder<ITabletScheduledEventsGuard> SchedulingGuard;
+ THolder<ITabletScheduledEventsGuard> SchedulingGuard;
}; // TTestWithSchemeshard
-NKikimrScheme::TEvDescribeSchemeResult GenerateDescribe(
+NKikimrScheme::TEvDescribeSchemeResult GenerateDescribe(
const TString& path,
- TPathId pathId,
- ui64 version = 1,
- TDomainId domainId = TDomainId()
+ TPathId pathId,
+ ui64 version = 1,
+ TDomainId domainId = TDomainId()
);
TSchemeBoardEvents::TEvUpdate* GenerateUpdate(
- const NKikimrScheme::TEvDescribeSchemeResult& describe,
+ const NKikimrScheme::TEvDescribeSchemeResult& describe,
ui64 owner = 1,
ui64 generation = 1,
bool isDeletion = false
);
-struct TCombinationsArgs {
- TString Path;
- TPathId PathId;
- ui64 Version;
- TDomainId DomainId;
-
- ui64 OwnerId;
- ui64 Generation;
- bool IsDeletion;
-
- TSchemeBoardEvents::TEvUpdate* GenerateUpdate() const {
- return ::NKikimr::NSchemeBoard::GenerateUpdate(GenerateDescribe(), OwnerId, Generation, IsDeletion);
- }
-
- NKikimrScheme::TEvDescribeSchemeResult GenerateDescribe() const {
- return ::NKikimr::NSchemeBoard::GenerateDescribe(Path, PathId, Version, DomainId);
- }
-
- using TSuperId = std::tuple<TDomainId, bool, TPathId, ui64>;
-
- TSuperId GetSuperId() const {
- return {DomainId, IsDeletion, PathId, Version};
- }
-};
-
-TVector<TCombinationsArgs> GenerateCombinationsDomainRoot(TString path = TString("/Root/Tenant"), ui64 gssOwnerID = 800, TVector<ui64> tenantsOwners = TVector<ui64>{900, 910});
-TVector<TCombinationsArgs> GenerateCombinationsMigratedPath(TString path,
- ui64 gssID, TVector<ui64> tssIDs,
- ui64 gssLocalPathId, ui64 tssLocalPathId);
-
+struct TCombinationsArgs {
+ TString Path;
+ TPathId PathId;
+ ui64 Version;
+ TDomainId DomainId;
+
+ ui64 OwnerId;
+ ui64 Generation;
+ bool IsDeletion;
+
+ TSchemeBoardEvents::TEvUpdate* GenerateUpdate() const {
+ return ::NKikimr::NSchemeBoard::GenerateUpdate(GenerateDescribe(), OwnerId, Generation, IsDeletion);
+ }
+
+ NKikimrScheme::TEvDescribeSchemeResult GenerateDescribe() const {
+ return ::NKikimr::NSchemeBoard::GenerateDescribe(Path, PathId, Version, DomainId);
+ }
+
+ using TSuperId = std::tuple<TDomainId, bool, TPathId, ui64>;
+
+ TSuperId GetSuperId() const {
+ return {DomainId, IsDeletion, PathId, Version};
+ }
+};
+
+TVector<TCombinationsArgs> GenerateCombinationsDomainRoot(TString path = TString("/Root/Tenant"), ui64 gssOwnerID = 800, TVector<ui64> tenantsOwners = TVector<ui64>{900, 910});
+TVector<TCombinationsArgs> GenerateCombinationsMigratedPath(TString path,
+ ui64 gssID, TVector<ui64> tssIDs,
+ ui64 gssLocalPathId, ui64 tssLocalPathId);
+
} // NSchemeBoard
} // NKikimr
diff --git a/ydb/core/tx/scheme_cache/scheme_cache.cpp b/ydb/core/tx/scheme_cache/scheme_cache.cpp
index 4e2c91007dc..5cf9a0b0d5e 100644
--- a/ydb/core/tx/scheme_cache/scheme_cache.cpp
+++ b/ydb/core/tx/scheme_cache/scheme_cache.cpp
@@ -1,11 +1,11 @@
#include "scheme_cache.h"
#include <ydb/core/base/path.h>
-
+
#include <util/string/builder.h>
-
+
namespace NKikimr {
-namespace NSchemeCache {
+namespace NSchemeCache {
TSchemeCacheConfig::TSchemeCacheConfig(const TAppData* appData, NMonitoring::TDynamicCounterPtr counters)
: Counters(counters)
@@ -15,15 +15,15 @@ TSchemeCacheConfig::TSchemeCacheConfig(const TAppData* appData, NMonitoring::TDy
for (const auto& [_, domain] : appData->DomainsInfo->Domains) {
Y_VERIFY(domain);
-
+
if (!domain->SchemeRoot) {
continue;
}
Roots.emplace_back(domain->DomainRootTag(), domain->SchemeRoot, domain->Name);
- }
+ }
}
-
+
TString TDomainInfo::ToString() const {
return TStringBuilder() << "{"
<< " DomainKey: " << DomainKey
@@ -50,8 +50,8 @@ TString TSchemeCacheNavigate::TEntry::ToString() const {
TString TSchemeCacheNavigate::TEntry::ToString(const NScheme::TTypeRegistry& typeRegistry) const {
Y_UNUSED(typeRegistry);
return ToString();
-}
-
+}
+
template <typename TResultSet>
static TString ResultSetToString(const TResultSet& rs, const NScheme::TTypeRegistry& typeRegistry) {
TStringBuilder out;
@@ -59,7 +59,7 @@ static TString ResultSetToString(const TResultSet& rs, const NScheme::TTypeRegis
for (ui32 i = 0; i < rs.size(); ++i) {
if (i) {
out << ",";
- }
+ }
out << rs.at(i).ToString(typeRegistry);
}
@@ -105,12 +105,12 @@ TString TSchemeCacheRequest::TEntry::ToString(const NScheme::TTypeRegistry& type
if (KeyDescription->Range.Point) {
out << " Point: " << DbgPrintTuple(from, typeRegistry);
- } else {
+ } else {
out << " From: " << DbgPrintTuple(from, typeRegistry)
<< " IncFrom: " << KeyDescription->Range.InclusiveFrom
<< " To: " << DbgPrintTuple(to, typeRegistry)
<< " IncTo: " << KeyDescription->Range.InclusiveTo;
- }
+ }
}
out << " }";
diff --git a/ydb/core/tx/scheme_cache/scheme_cache.h b/ydb/core/tx/scheme_cache/scheme_cache.h
index 8d489c11a01..26a07897a11 100644
--- a/ydb/core/tx/scheme_cache/scheme_cache.h
+++ b/ydb/core/tx/scheme_cache/scheme_cache.h
@@ -1,5 +1,5 @@
#pragma once
-
+
#include <ydb/core/base/appdata.h>
#include <ydb/core/base/events.h>
#include <ydb/core/base/pathid.h>
@@ -11,14 +11,14 @@
#include <ydb/core/scheme_types/scheme_type_registry.h>
#include <ydb/core/tx/datashard/sys_tables.h>
#include <ydb/library/aclib/aclib.h>
-
+
#include <util/datetime/base.h>
#include <util/generic/hash.h>
#include <util/generic/hash_set.h>
#include <util/generic/ptr.h>
namespace NKikimr {
-namespace NSchemeCache {
+namespace NSchemeCache {
struct TSchemeCacheConfig : public TThrRefBase {
struct TTagEntry {
@@ -37,18 +37,18 @@ struct TSchemeCacheConfig : public TThrRefBase {
explicit TSchemeCacheConfig(const TAppData* appData, NMonitoring::TDynamicCounterPtr counters);
TVector<TTagEntry> Roots;
- NMonitoring::TDynamicCounterPtr Counters;
+ NMonitoring::TDynamicCounterPtr Counters;
};
-struct TDomainInfo : public TAtomicRefCount<TDomainInfo> {
- using TPtr = TIntrusivePtr<TDomainInfo>;
-
+struct TDomainInfo : public TAtomicRefCount<TDomainInfo> {
+ using TPtr = TIntrusivePtr<TDomainInfo>;
+
explicit TDomainInfo(const TPathId& domainKey, const TPathId& resourcesDomainKey)
- : DomainKey(domainKey)
+ : DomainKey(domainKey)
, ResourcesDomainKey(resourcesDomainKey)
, Coordinators(TVector<ui64>{})
- {}
-
+ {}
+
explicit TDomainInfo(const NKikimrSubDomains::TDomainDescription& descr)
: DomainKey(GetDomainKey(descr.GetDomainKey()))
, Params(descr.GetProcessingParams())
@@ -60,11 +60,11 @@ struct TDomainInfo : public TAtomicRefCount<TDomainInfo> {
ResourcesDomainKey = DomainKey;
}
}
-
+
inline ui64 GetVersion() const {
- return Params.GetVersion();
- }
-
+ return Params.GetVersion();
+ }
+
inline ui64 ExtractSchemeShard() const {
if (Params.HasSchemeShard()) {
return Params.GetSchemeShard();
@@ -75,8 +75,8 @@ struct TDomainInfo : public TAtomicRefCount<TDomainInfo> {
TPathId DomainKey;
TPathId ResourcesDomainKey;
- NKikimrSubDomains::TProcessingParams Params;
- TCoordinators Coordinators;
+ NKikimrSubDomains::TProcessingParams Params;
+ TCoordinators Coordinators;
TString ToString() const;
@@ -84,11 +84,11 @@ private:
inline static TPathId GetDomainKey(const NKikimrSubDomains::TDomainKey& protoKey) {
return TPathId(protoKey.GetSchemeShard(), protoKey.GetPathId());
}
-
+
}; // TDomainInfo
-struct TSchemeCacheNavigate {
- enum class EStatus {
+struct TSchemeCacheNavigate {
+ enum class EStatus {
Unknown = 0,
RootUnknown = 1,
PathErrorUnknown = 2,
@@ -98,16 +98,16 @@ struct TSchemeCacheNavigate {
LookupError = 6,
RedirectLookupError = 7,
Ok = 128,
- };
-
- enum EOp {
- OpUnknown = 0,
- OpTable = 1, // would return table info
- OpPath = 2, // would return owning scheme shard id
+ };
+
+ enum EOp {
+ OpUnknown = 0,
+ OpTable = 1, // would return table info
+ OpPath = 2, // would return owning scheme shard id
OpTopic = 3, // would return topic info
OpList = 4, // would list children and cache them
- };
-
+ };
+
enum EKind {
KindUnknown = 0,
KindPath = 2,
@@ -117,7 +117,7 @@ struct TSchemeCacheNavigate {
KindKesus = 6,
KindSolomon = 7,
KindSubdomain = 8,
- KindExtSubdomain = 9,
+ KindExtSubdomain = 9,
KindIndex = 10,
KindOlapStore = 11,
KindOlapTable = 12,
@@ -146,7 +146,7 @@ struct TSchemeCacheNavigate {
};
struct TDirEntryInfo : public TAtomicRefCount<TDirEntryInfo>{
- NKikimrSchemeOp::TDirEntry Info;
+ NKikimrSchemeOp::TDirEntry Info;
};
struct TDomainDescription : public TAtomicRefCount<TDomainDescription> {
@@ -156,24 +156,24 @@ struct TSchemeCacheNavigate {
struct TPQGroupInfo : public TAtomicRefCount<TPQGroupInfo> {
EKind Kind = KindUnknown;
- NKikimrSchemeOp::TPersQueueGroupDescription Description;
+ NKikimrSchemeOp::TPersQueueGroupDescription Description;
};
struct TRtmrVolumeInfo : public TAtomicRefCount<TRtmrVolumeInfo> {
EKind Kind = KindUnknown;
- NKikimrSchemeOp::TRtmrVolumeDescription Description;
+ NKikimrSchemeOp::TRtmrVolumeDescription Description;
};
struct TKesusInfo : public TAtomicRefCount<TKesusInfo> {
EKind Kind = KindUnknown;
- NKikimrSchemeOp::TKesusDescription Description;
+ NKikimrSchemeOp::TKesusDescription Description;
+ };
+
+ struct TSolomonVolumeInfo : public TAtomicRefCount<TSolomonVolumeInfo> {
+ EKind Kind = KindUnknown;
+ NKikimrSchemeOp::TSolomonVolumeDescription Description;
};
- struct TSolomonVolumeInfo : public TAtomicRefCount<TSolomonVolumeInfo> {
- EKind Kind = KindUnknown;
- NKikimrSchemeOp::TSolomonVolumeDescription Description;
- };
-
struct TOlapStoreInfo : public TAtomicRefCount<TOlapStoreInfo> {
EKind Kind = KindUnknown;
NKikimrSchemeOp::TColumnStoreDescription Description;
@@ -187,13 +187,13 @@ struct TSchemeCacheNavigate {
struct TCdcStreamInfo : public TAtomicRefCount<TCdcStreamInfo> {
EKind Kind = KindUnknown;
- NKikimrSchemeOp::TCdcStreamDescription Description;
+ NKikimrSchemeOp::TCdcStreamDescription Description;
TPathId PathId;
};
struct TSequenceInfo : public TAtomicRefCount<TSequenceInfo> {
EKind Kind = KindUnknown;
- NKikimrSchemeOp::TSequenceDescription Description;
+ NKikimrSchemeOp::TSequenceDescription Description;
};
struct TReplicationInfo : public TAtomicRefCount<TReplicationInfo> {
@@ -201,7 +201,7 @@ struct TSchemeCacheNavigate {
NKikimrSchemeOp::TReplicationDescription Description;
};
- struct TEntry {
+ struct TEntry {
enum class ERequestType : ui8 {
ByPath,
ByTableId
@@ -212,27 +212,27 @@ struct TSchemeCacheNavigate {
TTableId TableId;
ERequestType RequestType = ERequestType::ByPath;
EOp Operation = OpUnknown;
- bool RedirectRequired = true;
+ bool RedirectRequired = true;
bool ShowPrivatePath = false;
bool SyncVersion = false;
-
+
// out
- EStatus Status = EStatus::Unknown;
+ EStatus Status = EStatus::Unknown;
EKind Kind = KindUnknown;
ui64 CreateStep = 0;
-
+
// common
TIntrusivePtr<TDomainInfo> DomainInfo;
TIntrusivePtr<TSecurityObject> SecurityObject;
TIntrusiveConstPtr<TDirEntryInfo> Self;
TIntrusiveConstPtr<TListNodeEntry> ListNodeEntry;
-
+
// table specific
THashMap<TString, TString> Attributes;
THashMap<ui32, TSysTables::TTableColumnInfo> Columns;
THashSet<TString> NotNullColumns;
- TVector<NKikimrSchemeOp::TIndexDescription> Indexes;
- TVector<NKikimrSchemeOp::TCdcStreamDescription> CdcStreams;
+ TVector<NKikimrSchemeOp::TIndexDescription> Indexes;
+ TVector<NKikimrSchemeOp::TCdcStreamDescription> CdcStreams;
// other
TIntrusiveConstPtr<TDomainDescription> DomainDescription;
@@ -248,21 +248,21 @@ struct TSchemeCacheNavigate {
TString ToString() const;
TString ToString(const NScheme::TTypeRegistry& typeRegistry) const;
- };
-
+ };
+
using TResultSet = TVector<TEntry>;
-
- TResultSet ResultSet;
+
+ TResultSet ResultSet;
TAutoPtr<const NACLib::TUserToken> UserToken;
TString DatabaseName;
ui64 DomainOwnerId = 0;
ui64 ErrorCount = 0;
const ui64 Instant; // deprecated, used by pq
- TSchemeCacheNavigate()
- : Instant(0)
- {}
-
+ TSchemeCacheNavigate()
+ : Instant(0)
+ {}
+
explicit TSchemeCacheNavigate(ui64 instant)
: Instant(instant)
{}
@@ -271,8 +271,8 @@ struct TSchemeCacheNavigate {
}; // TSchemeCacheNavigate
-struct TSchemeCacheRequest {
- enum class EStatus {
+struct TSchemeCacheRequest {
+ enum class EStatus {
Unknown = 0,
TypeCheckError = 1,
NotMaterialized = 2,
@@ -281,15 +281,15 @@ struct TSchemeCacheRequest {
LookupError = 5,
OkScheme = 128,
OkData = 129,
- };
-
- enum EOp {
- OpUnknown = 0,
- OpRead = 1 << 0,
- OpWrite = 1 << 2,
- OpScheme = 1 << 3,
- };
-
+ };
+
+ enum EOp {
+ OpUnknown = 0,
+ OpRead = 1 << 0,
+ OpWrite = 1 << 2,
+ OpScheme = 1 << 3,
+ };
+
enum EKind {
KindUnknown = 0,
KindRegularTable = 1,
@@ -297,7 +297,7 @@ struct TSchemeCacheRequest {
KindAsyncIndexTable= 3,
};
- struct TEntry {
+ struct TEntry {
// in
THolder<TKeyDesc> KeyDescription;
ui32 Access = 0;
@@ -308,29 +308,29 @@ struct TSchemeCacheRequest {
EStatus Status = EStatus::Unknown;
EKind Kind = EKind::KindUnknown;
TIntrusivePtr<TDomainInfo> DomainInfo;
-
+
explicit TEntry(THolder<TKeyDesc> keyDesc)
: KeyDescription(std::move(keyDesc))
{
Y_VERIFY_DEBUG(KeyDescription);
}
-
+
TEntry(TKeyDesc* keyDesc) = delete;
TString ToString() const;
TString ToString(const NScheme::TTypeRegistry& typeRegistry) const;
- };
-
+ };
+
using TResultSet = TVector<TEntry>;
-
- TResultSet ResultSet;
+
+ TResultSet ResultSet;
TAutoPtr<const NACLib::TUserToken> UserToken;
TString DatabaseName;
ui64 DomainOwnerId = 0;
ui64 ErrorCount = 0;
TString ToString(const NScheme::TTypeRegistry& typeRegistry) const;
-
+
}; // TSchemeCacheRequest
struct TSchemeCacheRequestContext : TAtomicRefCount<TSchemeCacheRequestContext>, TNonCopyable {
@@ -363,7 +363,7 @@ struct TSchemeCacheNavigateContext : TAtomicRefCount<TSchemeCacheNavigateContext
class TDescribeResult
: public TAtomicRefCount<TDescribeResult>
- , public NKikimrScheme::TEvDescribeSchemeResult
+ , public NKikimrScheme::TEvDescribeSchemeResult
{
public:
using TPtr = TIntrusivePtr<TDescribeResult>;
@@ -379,90 +379,90 @@ public:
TDescribeResult& operator=(TDescribeResult&&) = delete;
private:
- explicit TDescribeResult(const NKikimrScheme::TEvDescribeSchemeResult& result)
+ explicit TDescribeResult(const NKikimrScheme::TEvDescribeSchemeResult& result)
: TEvDescribeSchemeResult(result)
{}
- explicit TDescribeResult(NKikimrScheme::TEvDescribeSchemeResult&& result)
+ explicit TDescribeResult(NKikimrScheme::TEvDescribeSchemeResult&& result)
: TEvDescribeSchemeResult(std::move(result))
{}
public:
- static TPtr Create(const NKikimrScheme::TEvDescribeSchemeResult& result) {
+ static TPtr Create(const NKikimrScheme::TEvDescribeSchemeResult& result) {
return new TDescribeResult(result);
}
- static TPtr Create(NKikimrScheme::TEvDescribeSchemeResult&& result) {
+ static TPtr Create(NKikimrScheme::TEvDescribeSchemeResult&& result) {
return new TDescribeResult(std::move(result));
}
};
} // NSchemeCache
-
-struct TEvTxProxySchemeCache {
- enum EEv {
+
+struct TEvTxProxySchemeCache {
+ enum EEv {
EvResolveKeySet = EventSpaceBegin(TKikimrEvents::ES_SCHEME_CACHE),
EvInvalidateDistEntry, // unused
- EvResolveKeySetResult,
- EvNavigateKeySet,
+ EvResolveKeySetResult,
+ EvNavigateKeySet,
EvNavigateKeySetResult,
- EvInvalidateTable,
- EvInvalidateTableResult,
+ EvInvalidateTable,
+ EvInvalidateTableResult,
EvWatchPathId,
EvWatchRemove,
EvWatchNotifyUpdated,
EvWatchNotifyDeleted,
EvWatchNotifyUnavailable,
-
- EvEnd,
- };
-
+
+ EvEnd,
+ };
+
static_assert(EvEnd < EventSpaceEnd(TKikimrEvents::ES_SCHEME_CACHE), "expect EvEnd < EventSpaceEnd(ES_SCHEME_CACHE)");
-
+
private:
template <typename TDerived, ui32 EventType, typename TRequest>
struct TEvBasic : public TEventLocal<TDerived, EventType> {
TAutoPtr<TRequest> Request;
-
+
TEvBasic(TAutoPtr<TRequest> request)
- : Request(request)
- {}
- };
-
+ : Request(request)
+ {}
+ };
+
public:
struct TEvResolveKeySet : public TEvBasic<TEvResolveKeySet, EvResolveKeySet, NSchemeCache::TSchemeCacheRequest> {
using TEvBasic::TEvBasic;
};
-
+
struct TEvResolveKeySetResult : public TEvBasic<TEvResolveKeySetResult, EvResolveKeySetResult, NSchemeCache::TSchemeCacheRequest> {
using TEvBasic::TEvBasic;
- };
-
+ };
+
struct TEvNavigateKeySet : public TEvBasic<TEvNavigateKeySet, EvNavigateKeySet, NSchemeCache::TSchemeCacheNavigate> {
using TEvBasic::TEvBasic;
- };
-
+ };
+
struct TEvNavigateKeySetResult : public TEvBasic<TEvNavigateKeySetResult, EvNavigateKeySetResult, NSchemeCache::TSchemeCacheNavigate> {
using TEvBasic::TEvBasic;
- };
-
- struct TEvInvalidateTable : public TEventLocal<TEvInvalidateTable, EvInvalidateTable> {
- const TTableId TableId;
+ };
+
+ struct TEvInvalidateTable : public TEventLocal<TEvInvalidateTable, EvInvalidateTable> {
+ const TTableId TableId;
const TActorId Sender;
-
+
TEvInvalidateTable(const TTableId& tableId, const TActorId& sender)
- : TableId(tableId)
- , Sender(sender)
- {}
- };
-
- struct TEvInvalidateTableResult : public TEventLocal<TEvInvalidateTableResult, EvInvalidateTableResult> {
+ : TableId(tableId)
+ , Sender(sender)
+ {}
+ };
+
+ struct TEvInvalidateTableResult : public TEventLocal<TEvInvalidateTableResult, EvInvalidateTableResult> {
const TActorId Sender;
-
+
TEvInvalidateTableResult(const TActorId& sender)
- : Sender(sender)
- {}
- };
+ : Sender(sender)
+ {}
+ };
struct TEvWatchPathId : public TEventLocal<TEvWatchPathId, EvWatchPathId> {
const TPathId PathId;
@@ -521,10 +521,10 @@ public:
, PathId(pathId)
{}
};
-};
+};
inline TActorId MakeSchemeCacheID() {
return TActorId(0, TStringBuf("SchmCcheSrv"));
-}
+}
} // NKikimr
diff --git a/ydb/core/tx/scheme_cache/ya.make b/ydb/core/tx/scheme_cache/ya.make
index ccb1eae2c10..c9ead108c08 100644
--- a/ydb/core/tx/scheme_cache/ya.make
+++ b/ydb/core/tx/scheme_cache/ya.make
@@ -1,24 +1,24 @@
-LIBRARY()
-
-OWNER(
+LIBRARY()
+
+OWNER(
ilnaz
- svc
+ svc
g:kikimr
-)
-
-PEERDIR(
+)
+
+PEERDIR(
ydb/core/base
ydb/core/protos
ydb/core/scheme
ydb/library/aclib
-)
-
-SRCS(
- scheme_cache.cpp
-)
-
+)
+
+SRCS(
+ scheme_cache.cpp
+)
+
GENERATE_ENUM_SERIALIZATION(scheme_cache.h)
YQL_LAST_ABI_VERSION()
-END()
+END()
diff --git a/ydb/core/tx/schemeshard/schemeshard.cpp b/ydb/core/tx/schemeshard/schemeshard.cpp
index cd80b0fee38..24b73f590cc 100644
--- a/ydb/core/tx/schemeshard/schemeshard.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard.cpp
@@ -1,38 +1,38 @@
-#include "schemeshard.h"
-#include "schemeshard_impl.h"
-#include "schemeshard_types.h"
-
-namespace NKikimr {
-namespace NSchemeShard {
- TEvSchemeShard::TEvInitTenantSchemeShard::TEvInitTenantSchemeShard(
- ui64 selfTabletId,
- ui64 pathId, TString tenanatRootPath,
- TString owner, TString effectiveRootACL, ui64 effectiveRootACLVersion,
- const NKikimrSubDomains::TProcessingParams &processingParams, const TStoragePools &storagePools,
- const TMap<TString, TString> userAttrData, ui64 UserAttrsVersion, const NSchemeShard::TSchemeLimits &limits,
+#include "schemeshard.h"
+#include "schemeshard_impl.h"
+#include "schemeshard_types.h"
+
+namespace NKikimr {
+namespace NSchemeShard {
+ TEvSchemeShard::TEvInitTenantSchemeShard::TEvInitTenantSchemeShard(
+ ui64 selfTabletId,
+ ui64 pathId, TString tenanatRootPath,
+ TString owner, TString effectiveRootACL, ui64 effectiveRootACLVersion,
+ const NKikimrSubDomains::TProcessingParams &processingParams, const TStoragePools &storagePools,
+ const TMap<TString, TString> userAttrData, ui64 UserAttrsVersion, const NSchemeShard::TSchemeLimits &limits,
ui64 sharedHive, const TPathId& resourcesDomainId)
- {
- Record.SetDomainSchemeShard(selfTabletId);
- Record.SetDomainPathId(pathId);
- Record.SetRootPath(tenanatRootPath);
- Record.SetOwner(owner);
-
- Record.SetEffectiveACL(effectiveRootACL);
- Record.SetEffectiveACLVersion(effectiveRootACLVersion);
-
- Record.MutableProcessingParams()->CopyFrom(processingParams);
- for (auto& x: storagePools) {
- *Record.AddStoragePools() = x;
- }
-
- for (auto& x: userAttrData) {
- auto item = Record.AddUserAttributes();
- item->SetKey(x.first);
- item->SetValue(x.second);
- }
- Record.SetUserAttributesVersion(UserAttrsVersion);
-
- *Record.MutableSchemeLimits() = limits.AsProto();
+ {
+ Record.SetDomainSchemeShard(selfTabletId);
+ Record.SetDomainPathId(pathId);
+ Record.SetRootPath(tenanatRootPath);
+ Record.SetOwner(owner);
+
+ Record.SetEffectiveACL(effectiveRootACL);
+ Record.SetEffectiveACLVersion(effectiveRootACLVersion);
+
+ Record.MutableProcessingParams()->CopyFrom(processingParams);
+ for (auto& x: storagePools) {
+ *Record.AddStoragePools() = x;
+ }
+
+ for (auto& x: userAttrData) {
+ auto item = Record.AddUserAttributes();
+ item->SetKey(x.first);
+ item->SetValue(x.second);
+ }
+ Record.SetUserAttributesVersion(UserAttrsVersion);
+
+ *Record.MutableSchemeLimits() = limits.AsProto();
if (sharedHive != ui64(InvalidTabletId)) {
Record.SetSharedHive(sharedHive);
@@ -42,42 +42,42 @@ namespace NSchemeShard {
Record.SetResourcesDomainOwnerId(resourcesDomainId.OwnerId);
Record.SetResourcesDomainPathId(resourcesDomainId.LocalPathId);
}
- }
-}
-
+ }
+}
+
IActor* CreateFlatTxSchemeShard(const TActorId &tablet, TTabletStorageInfo *info) {
- return new NSchemeShard::TSchemeShard(tablet, info);
-}
-
-bool PartitionConfigHasExternalBlobsEnabled(const NKikimrSchemeOp::TPartitionConfig &partitionConfig) {
- for (auto &family : partitionConfig.GetColumnFamilies()) {
- if (family.GetId() != 0) {
- // We don't currently support per-family settings for external
- // blobs or legacy storage mapping, so we may safely ignore
- // non-primary column families.
- continue;
- }
- if (family.HasStorageConfig()) {
- const ui32 externalThreshold = family.GetStorageConfig().GetExternalThreshold();
- if (externalThreshold != 0 && externalThreshold != Max<ui32>())
- return true;
- }
- if (family.HasStorage()) {
- switch (family.GetStorage()) {
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage2:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Ext1:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Ext2:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Ext1:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Ext2:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Med2Ext2:
- case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Med2Ext2:
- return true;
- default:
- break;
- }
- }
- }
- return false;
-}
-
-}
+ return new NSchemeShard::TSchemeShard(tablet, info);
+}
+
+bool PartitionConfigHasExternalBlobsEnabled(const NKikimrSchemeOp::TPartitionConfig &partitionConfig) {
+ for (auto &family : partitionConfig.GetColumnFamilies()) {
+ if (family.GetId() != 0) {
+ // We don't currently support per-family settings for external
+ // blobs or legacy storage mapping, so we may safely ignore
+ // non-primary column families.
+ continue;
+ }
+ if (family.HasStorageConfig()) {
+ const ui32 externalThreshold = family.GetStorageConfig().GetExternalThreshold();
+ if (externalThreshold != 0 && externalThreshold != Max<ui32>())
+ return true;
+ }
+ if (family.HasStorage()) {
+ switch (family.GetStorage()) {
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage2:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Ext1:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Ext2:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Ext1:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Ext2:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage1Med2Ext2:
+ case NKikimrSchemeOp::EColumnStorage::ColumnStorage2Med2Ext2:
+ return true;
+ default:
+ break;
+ }
+ }
+ }
+ return false;
+}
+
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard.h b/ydb/core/tx/schemeshard/schemeshard.h
index c0d71417ba4..d33173508ce 100644
--- a/ydb/core/tx/schemeshard/schemeshard.h
+++ b/ydb/core/tx/schemeshard/schemeshard.h
@@ -15,16 +15,16 @@
#include "schemeshard_identificators.h"
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
static constexpr ui64 RootSchemeShardId = 0;
static constexpr ui64 RootPathId = 1;
-struct TSchemeLimits;
-
-struct TEvSchemeShard {
+struct TSchemeLimits;
+
+struct TEvSchemeShard {
enum EEv {
- EvModifySchemeTransaction = EventSpaceBegin(TKikimrEvents::ES_FLAT_TX_SCHEMESHARD), // 271122432
+ EvModifySchemeTransaction = EventSpaceBegin(TKikimrEvents::ES_FLAT_TX_SCHEMESHARD), // 271122432
EvModifySchemeTransactionResult = EvModifySchemeTransaction + 1 * 512,
EvDescribeScheme,
EvDescribeSchemeResult,
@@ -40,22 +40,22 @@ struct TEvSchemeShard {
EvNotifyTxCompletionResult,
EvMeasureSelfResponseTime,
EvWakeupToMeasureSelfResponseTime,
- EvInitTenantSchemeShard,
- EvInitTenantSchemeShardResult, // 271125002
- EvSyncTenantSchemeShard,
- EvUpdateTenantSchemeShard,
- EvMigrateSchemeShard,
- EvMigrateSchemeShardResult,
- EvPublishTenantAsReadOnly,
- EvPublishTenantAsReadOnlyResult,
- EvRewriteOwner,
- EvRewriteOwnerResult,
- EvPublishTenant,
- EvPublishTenantResult, // 271125012
+ EvInitTenantSchemeShard,
+ EvInitTenantSchemeShardResult, // 271125002
+ EvSyncTenantSchemeShard,
+ EvUpdateTenantSchemeShard,
+ EvMigrateSchemeShard,
+ EvMigrateSchemeShardResult,
+ EvPublishTenantAsReadOnly,
+ EvPublishTenantAsReadOnlyResult,
+ EvRewriteOwner,
+ EvRewriteOwnerResult,
+ EvPublishTenant,
+ EvPublishTenantResult, // 271125012
EvLogin,
EvLoginResult,
-
+
EvBackupDatashard = EvModifySchemeTransaction + 6 * 512,
EvBackupDatashardResult,
EvCancelTx,
@@ -67,12 +67,12 @@ struct TEvSchemeShard {
static_assert(EvEnd < EventSpaceEnd(TKikimrEvents::ES_FLAT_TX_SCHEMESHARD), "expect EvEnd < EventSpaceEnd(TKikimrEvents::ES_FLAT_TX_SCHEMESHARD)");
struct TEvModifySchemeTransaction : public TEventPB<TEvModifySchemeTransaction,
- NKikimrScheme::TEvModifySchemeTransaction,
+ NKikimrScheme::TEvModifySchemeTransaction,
EvModifySchemeTransaction> {
TEvModifySchemeTransaction()
{}
- TEvModifySchemeTransaction(ui64 txid, ui64 tabletId)
+ TEvModifySchemeTransaction(ui64 txid, ui64 tabletId)
{
Record.SetTxId(txid);
Record.SetTabletId(tabletId);
@@ -94,27 +94,27 @@ struct TEvSchemeShard {
struct TEvCancelTx
: public TEventPB<TEvCancelTx,
- NKikimrScheme::TEvCancelTx,
+ NKikimrScheme::TEvCancelTx,
EvCancelTx>
{
};
struct TEvCancelTxResult:
public TEventPB<TEvCancelTxResult,
- NKikimrScheme::TEvCancelTxResult,
+ NKikimrScheme::TEvCancelTxResult,
EvCancelTxResult>
{
TEvCancelTxResult() = default;
TEvCancelTxResult(ui64 targetTxId, ui64 txId) {
Record.SetTargetTxId(targetTxId);
- Record.SetTxId(txId);
+ Record.SetTxId(txId);
}
};
- using EStatus = NKikimrScheme::EStatus;
+ using EStatus = NKikimrScheme::EStatus;
struct TEvModifySchemeTransactionResult : public TEventPB<TEvModifySchemeTransactionResult,
- NKikimrScheme::TEvModifySchemeTransactionResult,
+ NKikimrScheme::TEvModifySchemeTransactionResult,
EvModifySchemeTransactionResult> {
TEvModifySchemeTransactionResult()
@@ -134,19 +134,19 @@ struct TEvSchemeShard {
}
}
- bool IsAccepted() const {
+ bool IsAccepted() const {
return Record.GetReason().empty() && (Record.GetStatus() == EStatus::StatusAccepted);
- }
-
- bool IsConditionalAccepted() const {
- //happens on retries, we answer like StatusAccepted with error message and do nothing in operation
+ }
+
+ bool IsConditionalAccepted() const {
+ //happens on retries, we answer like StatusAccepted with error message and do nothing in operation
return !Record.GetReason().empty() && (Record.GetStatus() == EStatus::StatusAccepted);
- }
-
- bool IsDone() const {
+ }
+
+ bool IsDone() const {
return Record.GetReason().empty() && (Record.GetStatus() == EStatus::StatusSuccess);
- }
-
+ }
+
void SetStatus(EStatus status, const TString& reason = {}) {
Record.SetStatus(status);
if (reason) {
@@ -212,12 +212,12 @@ struct TEvSchemeShard {
};
struct TEvDescribeScheme : public TEventPB<TEvDescribeScheme,
- NKikimrSchemeOp::TDescribePath,
+ NKikimrSchemeOp::TDescribePath,
EvDescribeScheme> {
TEvDescribeScheme()
{}
- TEvDescribeScheme(const NKikimrSchemeOp::TDescribePath& describePath)
+ TEvDescribeScheme(const NKikimrSchemeOp::TDescribePath& describePath)
{
Record.CopyFrom(describePath);
}
@@ -247,16 +247,16 @@ struct TEvSchemeShard {
};
struct TEvDescribeSchemeResult : public TEventPreSerializedPB<TEvDescribeSchemeResult,
- NKikimrScheme::TEvDescribeSchemeResult,
+ NKikimrScheme::TEvDescribeSchemeResult,
EvDescribeSchemeResult> {
- TEvDescribeSchemeResult() = default;
+ TEvDescribeSchemeResult() = default;
- TEvDescribeSchemeResult(const TString& path, ui64 pathOwner, TPathId pathId)
+ TEvDescribeSchemeResult(const TString& path, ui64 pathOwner, TPathId pathId)
{
Record.SetPath(path);
Record.SetPathOwner(pathOwner);
- Record.SetPathId(pathId.LocalPathId);
- Record.SetPathOwnerId(pathId.OwnerId);
+ Record.SetPathId(pathId.LocalPathId);
+ Record.SetPathOwnerId(pathId.OwnerId);
}
};
@@ -265,14 +265,14 @@ struct TEvSchemeShard {
TEvDescribeSchemeResultBuilder() = default;
- TEvDescribeSchemeResultBuilder(const TString& path, ui64 pathOwner, TPathId pathId)
- : TEvDescribeSchemeResult(path, pathOwner, pathId)
+ TEvDescribeSchemeResultBuilder(const TString& path, ui64 pathOwner, TPathId pathId)
+ : TEvDescribeSchemeResult(path, pathOwner, pathId)
{
}
};
struct TEvNotifyTxCompletion : public TEventPB<TEvNotifyTxCompletion,
- NKikimrScheme::TEvNotifyTxCompletion,
+ NKikimrScheme::TEvNotifyTxCompletion,
EvNotifyTxCompletion> {
explicit TEvNotifyTxCompletion(ui64 txId = 0)
{
@@ -281,7 +281,7 @@ struct TEvSchemeShard {
};
struct TEvNotifyTxCompletionRegistered : public TEventPB<TEvNotifyTxCompletionRegistered,
- NKikimrScheme::TEvNotifyTxCompletionRegistered,
+ NKikimrScheme::TEvNotifyTxCompletionRegistered,
EvNotifyTxCompletionRegistered> {
explicit TEvNotifyTxCompletionRegistered(ui64 txId = 0)
{
@@ -290,7 +290,7 @@ struct TEvSchemeShard {
};
struct TEvNotifyTxCompletionResult : public TEventPB<TEvNotifyTxCompletionResult,
- NKikimrScheme::TEvNotifyTxCompletionResult,
+ NKikimrScheme::TEvNotifyTxCompletionResult,
EvNotifyTxCompletionResult> {
explicit TEvNotifyTxCompletionResult(ui64 txId = 0)
{
@@ -303,199 +303,199 @@ struct TEvSchemeShard {
struct TEvWakeupToMeasureSelfResponseTime : public TEventLocal<TEvWakeupToMeasureSelfResponseTime, EvWakeupToMeasureSelfResponseTime> {
};
-
- struct TEvInitTenantSchemeShard: public TEventPB<TEvInitTenantSchemeShard,
- NKikimrScheme::TEvInitTenantSchemeShard,
- EvInitTenantSchemeShard> {
-
- TEvInitTenantSchemeShard() = default;
-
- TEvInitTenantSchemeShard(ui64 selfTabletId,
- ui64 pathId, TString tenanatRootPath,
- TString owner, TString effectiveRootACL, ui64 effectiveRootACLVersion,
- const NKikimrSubDomains::TProcessingParams& processingParams,
- const TStoragePools& storagePools,
- const TMap<TString, TString> userAttrData, ui64 UserAttrsVersion,
+
+ struct TEvInitTenantSchemeShard: public TEventPB<TEvInitTenantSchemeShard,
+ NKikimrScheme::TEvInitTenantSchemeShard,
+ EvInitTenantSchemeShard> {
+
+ TEvInitTenantSchemeShard() = default;
+
+ TEvInitTenantSchemeShard(ui64 selfTabletId,
+ ui64 pathId, TString tenanatRootPath,
+ TString owner, TString effectiveRootACL, ui64 effectiveRootACLVersion,
+ const NKikimrSubDomains::TProcessingParams& processingParams,
+ const TStoragePools& storagePools,
+ const TMap<TString, TString> userAttrData, ui64 UserAttrsVersion,
const TSchemeLimits& limits, ui64 sharedHive, const TPathId& resourcesDomainId = TPathId());
- };
-
- struct TEvInitTenantSchemeShardResult: public TEventPB<TEvInitTenantSchemeShardResult,
- NKikimrScheme::TEvInitTenantSchemeShardResult,
- EvInitTenantSchemeShardResult> {
-
- TEvInitTenantSchemeShardResult() = default;
-
- TEvInitTenantSchemeShardResult(ui64 tenantSchemeShard, EStatus status) {
- Record.SetTenantSchemeShard(tenantSchemeShard);
- Record.SetStatus(status);
- }
- };
-
- struct TEvMigrateSchemeShard: public TEventPB<TEvMigrateSchemeShard,
- NKikimrScheme::TEvMigrate,
- EvMigrateSchemeShard> {
- TEvMigrateSchemeShard() = default;
-
- TPathId GetPathId() const {
- if (!Record.GetPath().HasPathId()) {
- return NKikimr::TPathId();
- }
-
- auto& pathId = Record.GetPath().GetPathId();
- return NKikimr::TPathId(pathId.GetOwnerId(), pathId.GetLocalId());
- }
- };
-
- struct TEvMigrateSchemeShardResult: public TEventPB<TEvMigrateSchemeShardResult,
- NKikimrScheme::TEvMigrateResult,
- EvMigrateSchemeShardResult> {
- TEvMigrateSchemeShardResult() = default;
-
- TEvMigrateSchemeShardResult(ui64 tenantSchemeShard) {
- Record.SetTenantSchemeShard(tenantSchemeShard);
- }
-
- TPathId GetPathId() const {
- if (!Record.HasPathId()) {
- return NKikimr::TPathId();
- }
-
- auto& pathId = Record.GetPathId();
- return NKikimr::TPathId(pathId.GetOwnerId(), pathId.GetLocalId());
- }
- };
-
- struct TEvPublishTenantAsReadOnly: public TEventPB<TEvPublishTenantAsReadOnly,
- NKikimrScheme::TEvPublishTenantAsReadOnly,
- EvPublishTenantAsReadOnly> {
- TEvPublishTenantAsReadOnly() = default;
- TEvPublishTenantAsReadOnly(ui64 domainSchemeShardID) {
- Record.SetDomainSchemeShard(domainSchemeShardID);
- }
- };
-
- struct TEvPublishTenantAsReadOnlyResult: public TEventPB<TEvPublishTenantAsReadOnlyResult,
- NKikimrScheme::TEvPublishTenantAsReadOnlyResult,
- EvPublishTenantAsReadOnlyResult> {
- TEvPublishTenantAsReadOnlyResult() = default;
- TEvPublishTenantAsReadOnlyResult(ui64 tenantSchemeShard, EStatus status) {
- Record.SetTenantSchemeShard(tenantSchemeShard);
- Record.SetStatus(status);
- }
- };
-
- struct TEvRewriteOwner: public TEventPB<TEvRewriteOwner,
- NKikimrScheme::TEvRewriteOwner,
- EvRewriteOwner> {
- TEvRewriteOwner() = default;
- };
-
- struct TEvRewriteOwnerResult: public TEventPB<TEvRewriteOwnerResult,
- NKikimrScheme::TEvRewriteOwnerResult,
- EvRewriteOwnerResult> {
- TEvRewriteOwnerResult() = default;
- };
-
- struct TEvPublishTenant: public TEventPB<TEvPublishTenant,
- NKikimrScheme::TEvPublishTenant,
- EvPublishTenant> {
- TEvPublishTenant() = default;
- TEvPublishTenant(ui64 domainSchemeShardID) {
- Record.SetDomainSchemeShard(domainSchemeShardID);
- }
- };
-
- struct TEvPublishTenantResult: public TEventPB<TEvPublishTenantResult,
- NKikimrScheme::TEvPublishTenantResult,
- EvPublishTenantResult> {
- TEvPublishTenantResult() = default;
- TEvPublishTenantResult(ui64 tenantSchemeShard) {
- Record.SetTenantSchemeShard(tenantSchemeShard);
- }
- };
-
- struct TEvSyncTenantSchemeShard: public TEventPB<TEvSyncTenantSchemeShard,
- NKikimrScheme::TEvSyncTenantSchemeShard,
- EvSyncTenantSchemeShard> {
- TEvSyncTenantSchemeShard() = default;
-
- TEvSyncTenantSchemeShard(const TPathId& domainKey,
- ui64 tabletId,
- ui64 generation,
- ui64 effectiveACLVersion,
- ui64 subdomainVersion,
- ui64 userAttrsVersion,
+ };
+
+ struct TEvInitTenantSchemeShardResult: public TEventPB<TEvInitTenantSchemeShardResult,
+ NKikimrScheme::TEvInitTenantSchemeShardResult,
+ EvInitTenantSchemeShardResult> {
+
+ TEvInitTenantSchemeShardResult() = default;
+
+ TEvInitTenantSchemeShardResult(ui64 tenantSchemeShard, EStatus status) {
+ Record.SetTenantSchemeShard(tenantSchemeShard);
+ Record.SetStatus(status);
+ }
+ };
+
+ struct TEvMigrateSchemeShard: public TEventPB<TEvMigrateSchemeShard,
+ NKikimrScheme::TEvMigrate,
+ EvMigrateSchemeShard> {
+ TEvMigrateSchemeShard() = default;
+
+ TPathId GetPathId() const {
+ if (!Record.GetPath().HasPathId()) {
+ return NKikimr::TPathId();
+ }
+
+ auto& pathId = Record.GetPath().GetPathId();
+ return NKikimr::TPathId(pathId.GetOwnerId(), pathId.GetLocalId());
+ }
+ };
+
+ struct TEvMigrateSchemeShardResult: public TEventPB<TEvMigrateSchemeShardResult,
+ NKikimrScheme::TEvMigrateResult,
+ EvMigrateSchemeShardResult> {
+ TEvMigrateSchemeShardResult() = default;
+
+ TEvMigrateSchemeShardResult(ui64 tenantSchemeShard) {
+ Record.SetTenantSchemeShard(tenantSchemeShard);
+ }
+
+ TPathId GetPathId() const {
+ if (!Record.HasPathId()) {
+ return NKikimr::TPathId();
+ }
+
+ auto& pathId = Record.GetPathId();
+ return NKikimr::TPathId(pathId.GetOwnerId(), pathId.GetLocalId());
+ }
+ };
+
+ struct TEvPublishTenantAsReadOnly: public TEventPB<TEvPublishTenantAsReadOnly,
+ NKikimrScheme::TEvPublishTenantAsReadOnly,
+ EvPublishTenantAsReadOnly> {
+ TEvPublishTenantAsReadOnly() = default;
+ TEvPublishTenantAsReadOnly(ui64 domainSchemeShardID) {
+ Record.SetDomainSchemeShard(domainSchemeShardID);
+ }
+ };
+
+ struct TEvPublishTenantAsReadOnlyResult: public TEventPB<TEvPublishTenantAsReadOnlyResult,
+ NKikimrScheme::TEvPublishTenantAsReadOnlyResult,
+ EvPublishTenantAsReadOnlyResult> {
+ TEvPublishTenantAsReadOnlyResult() = default;
+ TEvPublishTenantAsReadOnlyResult(ui64 tenantSchemeShard, EStatus status) {
+ Record.SetTenantSchemeShard(tenantSchemeShard);
+ Record.SetStatus(status);
+ }
+ };
+
+ struct TEvRewriteOwner: public TEventPB<TEvRewriteOwner,
+ NKikimrScheme::TEvRewriteOwner,
+ EvRewriteOwner> {
+ TEvRewriteOwner() = default;
+ };
+
+ struct TEvRewriteOwnerResult: public TEventPB<TEvRewriteOwnerResult,
+ NKikimrScheme::TEvRewriteOwnerResult,
+ EvRewriteOwnerResult> {
+ TEvRewriteOwnerResult() = default;
+ };
+
+ struct TEvPublishTenant: public TEventPB<TEvPublishTenant,
+ NKikimrScheme::TEvPublishTenant,
+ EvPublishTenant> {
+ TEvPublishTenant() = default;
+ TEvPublishTenant(ui64 domainSchemeShardID) {
+ Record.SetDomainSchemeShard(domainSchemeShardID);
+ }
+ };
+
+ struct TEvPublishTenantResult: public TEventPB<TEvPublishTenantResult,
+ NKikimrScheme::TEvPublishTenantResult,
+ EvPublishTenantResult> {
+ TEvPublishTenantResult() = default;
+ TEvPublishTenantResult(ui64 tenantSchemeShard) {
+ Record.SetTenantSchemeShard(tenantSchemeShard);
+ }
+ };
+
+ struct TEvSyncTenantSchemeShard: public TEventPB<TEvSyncTenantSchemeShard,
+ NKikimrScheme::TEvSyncTenantSchemeShard,
+ EvSyncTenantSchemeShard> {
+ TEvSyncTenantSchemeShard() = default;
+
+ TEvSyncTenantSchemeShard(const TPathId& domainKey,
+ ui64 tabletId,
+ ui64 generation,
+ ui64 effectiveACLVersion,
+ ui64 subdomainVersion,
+ ui64 userAttrsVersion,
ui64 tenantHive,
- ui64 tenantSysViewProcessor,
- const TString& rootACL)
- {
- Record.SetDomainSchemeShard(domainKey.OwnerId);
- Record.SetDomainPathId(domainKey.LocalPathId);
-
- Record.SetTabletID(tabletId);
- Record.SetGeneration(generation);
-
- Record.SetEffectiveACLVersion(effectiveACLVersion);
- Record.SetSubdomainVersion(subdomainVersion);
- Record.SetUserAttributesVersion(userAttrsVersion);
-
- Record.SetTenantHive(tenantHive);
+ ui64 tenantSysViewProcessor,
+ const TString& rootACL)
+ {
+ Record.SetDomainSchemeShard(domainKey.OwnerId);
+ Record.SetDomainPathId(domainKey.LocalPathId);
+
+ Record.SetTabletID(tabletId);
+ Record.SetGeneration(generation);
+
+ Record.SetEffectiveACLVersion(effectiveACLVersion);
+ Record.SetSubdomainVersion(subdomainVersion);
+ Record.SetUserAttributesVersion(userAttrsVersion);
+
+ Record.SetTenantHive(tenantHive);
Record.SetTenantSysViewProcessor(tenantSysViewProcessor);
-
- Record.SetTenantRootACL(rootACL);
- }
-
- };
-
- struct TEvUpdateTenantSchemeShard: public TEventPB<TEvUpdateTenantSchemeShard,
- NKikimrScheme::TEvUpdateTenantSchemeShard,
- EvUpdateTenantSchemeShard> {
-
- TEvUpdateTenantSchemeShard() = default;
-
- TEvUpdateTenantSchemeShard(ui64 tabletId, ui64 generation) {
- Record.SetTabletId(tabletId);
- Record.SetGeneration(generation);
- }
-
- void SetEffectiveACL(const TString& owner, const TString& effectiveACL, ui64 version) {
- Record.SetOwner(owner);
- Record.SetEffectiveACL(effectiveACL);
- Record.SetEffectiveACLVersion(version);
- }
-
- void SetStoragePools(const TStoragePools& storagePools, ui64 version) {
- for (auto& x: storagePools) {
- *Record.AddStoragePools() = x;
- }
- Record.SetSubdomainVersion(version);
- }
-
- void SetUserAttrs(const TMap<TString, TString>& userAttrData, ui64 version) {
- for (auto& x: userAttrData) {
- auto item = Record.AddUserAttributes();
- item->SetKey(x.first);
- item->SetValue(x.second);
- }
- Record.SetUserAttributesVersion(version);
- }
-
- void SetTenantHive(ui64 hive) {
- Record.SetTenantHive(hive);
- }
+
+ Record.SetTenantRootACL(rootACL);
+ }
+
+ };
+
+ struct TEvUpdateTenantSchemeShard: public TEventPB<TEvUpdateTenantSchemeShard,
+ NKikimrScheme::TEvUpdateTenantSchemeShard,
+ EvUpdateTenantSchemeShard> {
+
+ TEvUpdateTenantSchemeShard() = default;
+
+ TEvUpdateTenantSchemeShard(ui64 tabletId, ui64 generation) {
+ Record.SetTabletId(tabletId);
+ Record.SetGeneration(generation);
+ }
+
+ void SetEffectiveACL(const TString& owner, const TString& effectiveACL, ui64 version) {
+ Record.SetOwner(owner);
+ Record.SetEffectiveACL(effectiveACL);
+ Record.SetEffectiveACLVersion(version);
+ }
+
+ void SetStoragePools(const TStoragePools& storagePools, ui64 version) {
+ for (auto& x: storagePools) {
+ *Record.AddStoragePools() = x;
+ }
+ Record.SetSubdomainVersion(version);
+ }
+
+ void SetUserAttrs(const TMap<TString, TString>& userAttrData, ui64 version) {
+ for (auto& x: userAttrData) {
+ auto item = Record.AddUserAttributes();
+ item->SetKey(x.first);
+ item->SetValue(x.second);
+ }
+ Record.SetUserAttributesVersion(version);
+ }
+
+ void SetTenantHive(ui64 hive) {
+ Record.SetTenantHive(hive);
+ }
void SetTenantSysViewProcessor(ui64 svp) {
Record.SetTenantSysViewProcessor(svp);
}
-
- void SetUpdateTenantRootACL(const TString& acl) {
- Record.SetUpdateTenantRootACL(acl);
- }
- };
+
+ void SetUpdateTenantRootACL(const TString& acl) {
+ Record.SetUpdateTenantRootACL(acl);
+ }
+ };
struct TEvFindTabletSubDomainPathId
: public TEventPB<TEvFindTabletSubDomainPathId,
- NKikimrScheme::TEvFindTabletSubDomainPathId,
+ NKikimrScheme::TEvFindTabletSubDomainPathId,
EvFindTabletSubDomainPathId>
{
TEvFindTabletSubDomainPathId() = default;
@@ -507,10 +507,10 @@ struct TEvSchemeShard {
struct TEvFindTabletSubDomainPathIdResult
: public TEventPB<TEvFindTabletSubDomainPathIdResult,
- NKikimrScheme::TEvFindTabletSubDomainPathIdResult,
+ NKikimrScheme::TEvFindTabletSubDomainPathIdResult,
EvFindTabletSubDomainPathIdResult>
{
- using EStatus = NKikimrScheme::TEvFindTabletSubDomainPathIdResult::EStatus;
+ using EStatus = NKikimrScheme::TEvFindTabletSubDomainPathIdResult::EStatus;
TEvFindTabletSubDomainPathIdResult() = default;
@@ -522,18 +522,18 @@ struct TEvSchemeShard {
// Success
TEvFindTabletSubDomainPathIdResult(ui64 tabletId, ui64 schemeShardId, ui64 subDomainPathId) {
- Record.SetStatus(NKikimrScheme::TEvFindTabletSubDomainPathIdResult::SUCCESS);
+ Record.SetStatus(NKikimrScheme::TEvFindTabletSubDomainPathIdResult::SUCCESS);
Record.SetTabletId(tabletId);
Record.SetSchemeShardId(schemeShardId);
Record.SetSubDomainPathId(subDomainPathId);
}
};
- struct TEvLogin : TEventPB<TEvLogin, NKikimrScheme::TEvLogin, EvLogin> {
+ struct TEvLogin : TEventPB<TEvLogin, NKikimrScheme::TEvLogin, EvLogin> {
TEvLogin() = default;
};
- struct TEvLoginResult : TEventPB<TEvLoginResult, NKikimrScheme::TEvLoginResult, EvLoginResult> {
+ struct TEvLoginResult : TEventPB<TEvLoginResult, NKikimrScheme::TEvLoginResult, EvLoginResult> {
TEvLoginResult() = default;
};
};
@@ -541,11 +541,11 @@ struct TEvSchemeShard {
}
IActor* CreateFlatTxSchemeShard(const TActorId &tablet, TTabletStorageInfo *info);
-bool PartitionConfigHasExternalBlobsEnabled(const NKikimrSchemeOp::TPartitionConfig &partitionConfig);
-}
-
+bool PartitionConfigHasExternalBlobsEnabled(const NKikimrSchemeOp::TPartitionConfig &partitionConfig);
+}
+
template<>
-inline void Out<NKikimrScheme::EStatus>(IOutputStream& o, NKikimrScheme::EStatus x) {
- o << NKikimrScheme::EStatus_Name(x);
+inline void Out<NKikimrScheme::EStatus>(IOutputStream& o, NKikimrScheme::EStatus x) {
+ o << NKikimrScheme::EStatus_Name(x);
return;
}
diff --git a/ydb/core/tx/schemeshard/schemeshard__clean_pathes.cpp b/ydb/core/tx/schemeshard/schemeshard__clean_pathes.cpp
index 03cb9e6b9cb..258699bba93 100644
--- a/ydb/core/tx/schemeshard/schemeshard__clean_pathes.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__clean_pathes.cpp
@@ -1,41 +1,41 @@
-#include "schemeshard_impl.h"
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-using namespace NTabletFlatExecutor;
-
-struct TSchemeShard::TTxCleanTables : public TTransactionBase<TSchemeShard> {
- static const ui32 BacketSize = 100;
- TVector<TPathId> TablesToClean;
- ui32 RemovedCount;
-
- TTxCleanTables(TSelf* self, TVector<TPathId> tablesToClean)
- : TTransactionBase<TSchemeShard>(self)
- , TablesToClean(std::move(tablesToClean))
- , RemovedCount(0)
- {}
-
- TTxType GetTxType() const override {
- return TXTYPE_CLEAN_TABLES;
- }
-
+#include "schemeshard_impl.h"
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+using namespace NTabletFlatExecutor;
+
+struct TSchemeShard::TTxCleanTables : public TTransactionBase<TSchemeShard> {
+ static const ui32 BacketSize = 100;
+ TVector<TPathId> TablesToClean;
+ ui32 RemovedCount;
+
+ TTxCleanTables(TSelf* self, TVector<TPathId> tablesToClean)
+ : TTransactionBase<TSchemeShard>(self)
+ , TablesToClean(std::move(tablesToClean))
+ , RemovedCount(0)
+ {}
+
+ TTxType GetTxType() const override {
+ return TXTYPE_CLEAN_TABLES;
+ }
+
bool Execute(TTransactionContext &txc, const TActorContext &ctx) override {
- NIceDb::TNiceDb db(txc.DB);
-
- ui32 RemovedCount = 0;
- while (RemovedCount < BacketSize && TablesToClean) {
- TPathId tableId = TablesToClean.back();
+ NIceDb::TNiceDb db(txc.DB);
+
+ ui32 RemovedCount = 0;
+ while (RemovedCount < BacketSize && TablesToClean) {
+ TPathId tableId = TablesToClean.back();
Self->PersistRemoveTable(db, tableId, ctx);
-
- ++RemovedCount;
- TablesToClean.pop_back();
- }
-
- return true;
- }
-
- void Complete(const TActorContext &ctx) override {
+
+ ++RemovedCount;
+ TablesToClean.pop_back();
+ }
+
+ return true;
+ }
+
+ void Complete(const TActorContext &ctx) override {
if (RemovedCount) {
LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"TTxCleanPathes Complete"
@@ -43,23 +43,23 @@ struct TSchemeShard::TTxCleanTables : public TTransactionBase<TSchemeShard> {
<< ", left " << TablesToClean.size()
<< ", at schemeshard: "<< Self->TabletID());
}
-
- if (TablesToClean) {
- Self->Execute(Self->CreateTxCleanTables(std::move(TablesToClean)), ctx);
- }
- }
-};
-
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxCleanTables(TVector<TPathId> tablesToClean) {
- return new TTxCleanTables(this, std::move(tablesToClean));
-}
-
-struct TSchemeShard::TTxCleanBlockStoreVolumes : public TTransactionBase<TSchemeShard> {
+
+ if (TablesToClean) {
+ Self->Execute(Self->CreateTxCleanTables(std::move(TablesToClean)), ctx);
+ }
+ }
+};
+
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxCleanTables(TVector<TPathId> tablesToClean) {
+ return new TTxCleanTables(this, std::move(tablesToClean));
+}
+
+struct TSchemeShard::TTxCleanBlockStoreVolumes : public TTransactionBase<TSchemeShard> {
static constexpr ui32 BucketSize = 1000;
TDeque<TPathId> BlockStoreVolumesToClean;
size_t RemovedCount = 0;
- TTxCleanBlockStoreVolumes(TSchemeShard* self, TDeque<TPathId>&& blockStoreVolumesToClean)
+ TTxCleanBlockStoreVolumes(TSchemeShard* self, TDeque<TPathId>&& blockStoreVolumesToClean)
: TTransactionBase(self)
, BlockStoreVolumesToClean(std::move(blockStoreVolumesToClean))
{ }
@@ -98,16 +98,16 @@ struct TSchemeShard::TTxCleanBlockStoreVolumes : public TTransactionBase<TScheme
}
};
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxCleanBlockStoreVolumes(TDeque<TPathId>&& blockStoreVolumesToClean) {
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxCleanBlockStoreVolumes(TDeque<TPathId>&& blockStoreVolumesToClean) {
return new TTxCleanBlockStoreVolumes(this, std::move(blockStoreVolumesToClean));
}
-struct TSchemeShard::TTxCleanDroppedPaths : public TTransactionBase<TSchemeShard> {
+struct TSchemeShard::TTxCleanDroppedPaths : public TTransactionBase<TSchemeShard> {
static constexpr size_t BucketSize = 1000;
size_t RemovedCount = 0;
size_t SkippedCount = 0;
- TTxCleanDroppedPaths(TSchemeShard* self)
+ TTxCleanDroppedPaths(TSchemeShard* self)
: TTransactionBase(self)
{ }
@@ -168,28 +168,28 @@ struct TSchemeShard::TTxCleanDroppedPaths : public TTransactionBase<TSchemeShard
}
};
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxCleanDroppedPaths() {
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxCleanDroppedPaths() {
return new TTxCleanDroppedPaths(this);
}
-void TSchemeShard::ScheduleCleanDroppedPaths() {
+void TSchemeShard::ScheduleCleanDroppedPaths() {
if (!CleanDroppedPathsCandidates.empty() && !CleanDroppedPathsInFly && !CleanDroppedPathsDisabled) {
Send(SelfId(), new TEvPrivate::TEvCleanDroppedPaths);
CleanDroppedPathsInFly = true;
}
}
-void TSchemeShard::Handle(TEvPrivate::TEvCleanDroppedPaths::TPtr&, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvPrivate::TEvCleanDroppedPaths::TPtr&, const TActorContext& ctx) {
Y_VERIFY(CleanDroppedPathsInFly);
Execute(CreateTxCleanDroppedPaths(), ctx);
}
-struct TSchemeShard::TTxCleanDroppedSubDomains : public TTransactionBase<TSchemeShard> {
+struct TSchemeShard::TTxCleanDroppedSubDomains : public TTransactionBase<TSchemeShard> {
static constexpr size_t BucketSize = 1000;
size_t RemovedCount = 0;
size_t SkippedCount = 0;
- TTxCleanDroppedSubDomains(TSchemeShard* self)
+ TTxCleanDroppedSubDomains(TSchemeShard* self)
: TTransactionBase(self)
{ }
@@ -253,21 +253,21 @@ struct TSchemeShard::TTxCleanDroppedSubDomains : public TTransactionBase<TScheme
}
};
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxCleanDroppedSubDomains() {
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxCleanDroppedSubDomains() {
return new TTxCleanDroppedSubDomains(this);
}
-void TSchemeShard::ScheduleCleanDroppedSubDomains() {
+void TSchemeShard::ScheduleCleanDroppedSubDomains() {
if (!CleanDroppedSubDomainsCandidates.empty() && !CleanDroppedSubDomainsInFly && !CleanDroppedPathsDisabled) {
Send(SelfId(), new TEvPrivate::TEvCleanDroppedSubDomains);
CleanDroppedSubDomainsInFly = true;
}
}
-void TSchemeShard::Handle(TEvPrivate::TEvCleanDroppedSubDomains::TPtr&, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvPrivate::TEvCleanDroppedSubDomains::TPtr&, const TActorContext& ctx) {
Y_VERIFY(CleanDroppedSubDomainsInFly);
Execute(CreateTxCleanDroppedSubDomains(), ctx);
}
-} // NSchemeShard
-} // NKikimr
+} // NSchemeShard
+} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__compaction.cpp b/ydb/core/tx/schemeshard/schemeshard__compaction.cpp
index 2a9cc08e815..faad71935cb 100644
--- a/ydb/core/tx/schemeshard/schemeshard__compaction.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__compaction.cpp
@@ -1,7 +1,7 @@
#include "schemeshard_impl.h"
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
NOperationQueue::EStartStatus TSchemeShard::StartBackgroundCompaction(const TShardIdx& shardId) {
TabletCounters->Simple()[COUNTER_BACKGROUND_COMPACTION_QUEUE_SIZE].Set(CompactionQueue->Size());
@@ -35,7 +35,7 @@ NOperationQueue::EStartStatus TSchemeShard::StartBackgroundCompaction(const TSha
return NOperationQueue::EStartStatus::EOperationRunning;
}
-void TSchemeShard::Handle(TEvDataShard::TEvCompactTableResult::TPtr &ev, const TActorContext &ctx) {
+void TSchemeShard::Handle(TEvDataShard::TEvCompactTableResult::TPtr &ev, const TActorContext &ctx) {
const auto& record = ev->Get()->Record;
const TTabletId tabletId(record.GetTabletId());
@@ -78,5 +78,5 @@ void TSchemeShard::Handle(TEvDataShard::TEvCompactTableResult::TPtr &ev, const T
}
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__conditional_erase.cpp b/ydb/core/tx/schemeshard/schemeshard__conditional_erase.cpp
index 1fe8e7a6ddb..d804955b69b 100644
--- a/ydb/core/tx/schemeshard/schemeshard__conditional_erase.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__conditional_erase.cpp
@@ -3,11 +3,11 @@
#include <util/string/join.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TTxRunConditionalErase: public TSchemeShard::TRwTxBase {
+struct TSchemeShard::TTxRunConditionalErase: public TSchemeShard::TRwTxBase {
TTableInfo::TPtr TableInfo;
THashMap<TTabletId, NKikimrTxDataShard::TEvConditionalEraseRowsRequest> RunOnTablets;
@@ -241,10 +241,10 @@ private:
Y_VERIFY(indexPath->GetChildren().size() == 1);
for (const auto& [_, indexImplPathId] : indexPath->GetChildren()) {
- auto childPath = Self->PathsById.at(indexImplPathId);
-
- Y_VERIFY(!childPath->Dropped());
-
+ auto childPath = Self->PathsById.at(indexImplPathId);
+
+ Y_VERIFY(!childPath->Dropped());
+
Y_VERIFY(Self->Tables.contains(indexImplPathId));
return std::make_pair(indexImplPathId, Self->Tables.at(indexImplPathId));
}
@@ -299,7 +299,7 @@ private:
}; // TTxRunConditionalErase
-struct TSchemeShard::TTxScheduleConditionalErase : public TTransactionBase<TSchemeShard> {
+struct TSchemeShard::TTxScheduleConditionalErase : public TTransactionBase<TSchemeShard> {
TEvDataShard::TEvConditionalEraseRowsResponse::TPtr Ev;
THolder<NSysView::TEvSysView::TEvUpdateTtlStats> StatsCollectorEv;
TTableInfo::TPtr TableInfo;
@@ -459,13 +459,13 @@ struct TSchemeShard::TTxScheduleConditionalErase : public TTransactionBase<TSche
}; // TTxScheduleConditionalErase
-ITransaction* TSchemeShard::CreateTxRunConditionalErase(TEvPrivate::TEvRunConditionalErase::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxRunConditionalErase(TEvPrivate::TEvRunConditionalErase::TPtr& ev) {
return new TTxRunConditionalErase(this, ev);
}
-ITransaction* TSchemeShard::CreateTxScheduleConditionalErase(TEvDataShard::TEvConditionalEraseRowsResponse::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxScheduleConditionalErase(TEvDataShard::TEvConditionalEraseRowsResponse::TPtr& ev) {
return new TTxScheduleConditionalErase(this, ev);
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__delete_tablet_reply.cpp b/ydb/core/tx/schemeshard/schemeshard__delete_tablet_reply.cpp
index 0b9f81022e8..855553cddc8 100644
--- a/ydb/core/tx/schemeshard/schemeshard__delete_tablet_reply.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__delete_tablet_reply.cpp
@@ -4,30 +4,30 @@
#include <ydb/core/tablet_flat/flat_cxx_database.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TTxDeleteTabletReply : public TSchemeShard::TRwTxBase {
+struct TSchemeShard::TTxDeleteTabletReply : public TSchemeShard::TRwTxBase {
TEvHive::TEvDeleteTabletReply::TPtr Ev;
TTxDeleteTabletReply(TSelf* self, TEvHive::TEvDeleteTabletReply::TPtr& ev)
- : TRwTxBase(self)
+ : TRwTxBase(self)
, Ev(ev)
- , ShardIdx(self->MakeLocalId(TLocalShardIdx(Ev->Get()->Record.GetTxId_Deprecated()))) // We use TxId field as a cookie where we store shrdIdx
+ , ShardIdx(self->MakeLocalId(TLocalShardIdx(Ev->Get()->Record.GetTxId_Deprecated()))) // We use TxId field as a cookie where we store shrdIdx
, TabletId(InvalidTabletId)
, Status(Ev->Get()->Record.GetStatus())
, HiveId(Ev->Get()->Record.GetOrigin())
- {
- if (Ev->Get()->Record.HasShardOwnerId()) {
- Y_VERIFY(Ev->Get()->Record.ShardLocalIdxSize() == 1);
- ShardIdx = TShardIdx(Ev->Get()->Record.GetShardOwnerId(),
- Ev->Get()->Record.GetShardLocalIdx(0));
- }
+ {
+ if (Ev->Get()->Record.HasShardOwnerId()) {
+ Y_VERIFY(Ev->Get()->Record.ShardLocalIdxSize() == 1);
+ ShardIdx = TShardIdx(Ev->Get()->Record.GetShardOwnerId(),
+ Ev->Get()->Record.GetShardLocalIdx(0));
+ }
if (Ev->Get()->Record.HasForwardRequest()) {
ForwardToHiveId = TTabletId(Ev->Get()->Record.GetForwardRequest().GetHiveTabletId());
}
- }
+ }
TTxType GetTxType() const override { return TXTYPE_FREE_TABLET_RESULT; }
@@ -50,80 +50,80 @@ struct TSchemeShard::TTxDeleteTabletReply : public TSchemeShard::TRwTxBase {
if (Self->ShardInfos.contains(ShardIdx)) {
auto tabletType = Self->ShardInfos[ShardIdx].TabletType;
switch (tabletType) {
- case ETabletType::DataShard:
- Self->TabletCounters->Simple()[COUNTER_TABLE_SHARD_INACTIVE_COUNT].Sub(1);
- break;
- case ETabletType::Coordinator:
- Self->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_COORDINATOR_COUNT].Sub(1);
- break;
- case ETabletType::Mediator:
- Self->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_MEDIATOR_COUNT].Sub(1);
- break;
- case ETabletType::SchemeShard:
- Self->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_SCHEME_SHARD_COUNT].Sub(1);
- break;
+ case ETabletType::DataShard:
+ Self->TabletCounters->Simple()[COUNTER_TABLE_SHARD_INACTIVE_COUNT].Sub(1);
+ break;
+ case ETabletType::Coordinator:
+ Self->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_COORDINATOR_COUNT].Sub(1);
+ break;
+ case ETabletType::Mediator:
+ Self->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_MEDIATOR_COUNT].Sub(1);
+ break;
+ case ETabletType::SchemeShard:
+ Self->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_SCHEME_SHARD_COUNT].Sub(1);
+ break;
case ETabletType::Hive:
- Self->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_HIVE_COUNT].Sub(1);
- break;
- case ETabletType::BlockStoreVolume:
- Self->TabletCounters->Simple()[COUNTER_BLOCKSTORE_VOLUME_SHARD_COUNT].Sub(1);
- break;
- case ETabletType::BlockStorePartition:
- Self->TabletCounters->Simple()[COUNTER_BLOCKSTORE_PARTITION_SHARD_COUNT].Sub(1);
- break;
- case ETabletType::BlockStorePartition2:
- Self->TabletCounters->Simple()[COUNTER_BLOCKSTORE_PARTITION2_SHARD_COUNT].Sub(1);
- break;
+ Self->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_HIVE_COUNT].Sub(1);
+ break;
+ case ETabletType::BlockStoreVolume:
+ Self->TabletCounters->Simple()[COUNTER_BLOCKSTORE_VOLUME_SHARD_COUNT].Sub(1);
+ break;
+ case ETabletType::BlockStorePartition:
+ Self->TabletCounters->Simple()[COUNTER_BLOCKSTORE_PARTITION_SHARD_COUNT].Sub(1);
+ break;
+ case ETabletType::BlockStorePartition2:
+ Self->TabletCounters->Simple()[COUNTER_BLOCKSTORE_PARTITION2_SHARD_COUNT].Sub(1);
+ break;
case ETabletType::FileStore:
- Self->TabletCounters->Simple()[COUNTER_FILESTORE_SHARD_COUNT].Sub(1);
- break;
- case ETabletType::Kesus:
- Self->TabletCounters->Simple()[COUNTER_KESUS_SHARD_COUNT].Sub(1);
- break;
- case ETabletType::KeyValue:
- Self->TabletCounters->Simple()[COUNTER_SOLOMON_PARTITIONS_COUNT].Sub(1);
- break;
- case ETabletType::PersQueue:
- Self->TabletCounters->Simple()[COUNTER_PQ_SHARD_COUNT].Sub(1);
- break;
- case ETabletType::PersQueueReadBalancer:
- Self->TabletCounters->Simple()[COUNTER_PQ_RB_SHARD_COUNT].Sub(1);
- break;
+ Self->TabletCounters->Simple()[COUNTER_FILESTORE_SHARD_COUNT].Sub(1);
+ break;
+ case ETabletType::Kesus:
+ Self->TabletCounters->Simple()[COUNTER_KESUS_SHARD_COUNT].Sub(1);
+ break;
+ case ETabletType::KeyValue:
+ Self->TabletCounters->Simple()[COUNTER_SOLOMON_PARTITIONS_COUNT].Sub(1);
+ break;
+ case ETabletType::PersQueue:
+ Self->TabletCounters->Simple()[COUNTER_PQ_SHARD_COUNT].Sub(1);
+ break;
+ case ETabletType::PersQueueReadBalancer:
+ Self->TabletCounters->Simple()[COUNTER_PQ_RB_SHARD_COUNT].Sub(1);
+ break;
case ETabletType::SysViewProcessor:
- Self->TabletCounters->Simple()[COUNTER_SYS_VIEW_PROCESSOR_COUNT].Sub(1);
+ Self->TabletCounters->Simple()[COUNTER_SYS_VIEW_PROCESSOR_COUNT].Sub(1);
break;
case ETabletType::ColumnShard:
- Self->TabletCounters->Simple()[COUNTER_OLAP_COLUMN_SHARDS].Sub(-1);
+ Self->TabletCounters->Simple()[COUNTER_OLAP_COLUMN_SHARDS].Sub(-1);
break;
case ETabletType::SequenceShard:
- Self->TabletCounters->Simple()[COUNTER_SEQUENCESHARD_COUNT].Sub(1);
+ Self->TabletCounters->Simple()[COUNTER_SEQUENCESHARD_COUNT].Sub(1);
break;
case ETabletType::ReplicationController:
Self->TabletCounters->Simple()[COUNTER_REPLICATION_CONTROLLER_COUNT].Sub(1);
break;
- default:
- Y_FAIL_S("Unknown TabletType"
- << ", ShardIdx " << ShardIdx
+ default:
+ Y_FAIL_S("Unknown TabletType"
+ << ", ShardIdx " << ShardIdx
<< ", (ui32)TabletType" << (ui32)tabletType);
- };
-
- auto& shardInfo = Self->ShardInfos.at(ShardIdx);
+ };
+
+ auto& shardInfo = Self->ShardInfos.at(ShardIdx);
auto pathId = shardInfo.PathId;
auto it = Self->Tables.find(pathId);
- if (it != Self->Tables.end()) {
+ if (it != Self->Tables.end()) {
it->second->PerShardPartitionConfig.erase(ShardIdx);
}
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistShardDeleted(db, ShardIdx, shardInfo.BindedChannels);
-
- Y_VERIFY_S(Self->PathsById.contains(pathId), "pathid: " << pathId);
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistShardDeleted(db, ShardIdx, shardInfo.BindedChannels);
+
+ Y_VERIFY_S(Self->PathsById.contains(pathId), "pathid: " << pathId);
auto path = Self->PathsById.at(pathId);
- path->DecShardsInside();
-
- auto domain = Self->ResolveDomainInfo(path);
- domain->RemoveInternalShard(ShardIdx);
+ path->DecShardsInside();
+
+ auto domain = Self->ResolveDomainInfo(path);
+ domain->RemoveInternalShard(ShardIdx);
switch (tabletType) {
case ETabletType::SequenceShard:
domain->RemoveSequenceShard(ShardIdx);
@@ -134,13 +134,13 @@ struct TSchemeShard::TTxDeleteTabletReply : public TSchemeShard::TRwTxBase {
default:
break;
}
-
- TabletId = shardInfo.TabletID;
+
+ TabletId = shardInfo.TabletID;
Self->TabletIdToShardIdx[TabletId] = ShardIdx;
-
+
Self->ShardInfos.erase(ShardIdx);
- Self->DecrementPathDbRefCount(pathId, "shard deleted");
+ Self->DecrementPathDbRefCount(pathId, "shard deleted");
// This is for tests, so it's kinda ok to reply from execute
auto itSubscribers = Self->ShardDeletionSubscribers.find(ShardIdx);
@@ -153,37 +153,37 @@ struct TSchemeShard::TTxDeleteTabletReply : public TSchemeShard::TRwTxBase {
} else {
NIceDb::TNiceDb db(txc.DB);
Self->PersistUnknownShardDeleted(db, ShardIdx);
- }
+ }
}
void DoComplete(const TActorContext &ctx) override {
if (Status == NKikimrProto::OK) {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Deleted shardIdx " << ShardIdx);
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Deleted shardIdx " << ShardIdx);
Self->ShardDeleter.ShardDeleted(ShardIdx, ctx);
if (TabletId != InvalidTabletId) {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Close pipe to deleted shardIdx " << ShardIdx << " tabletId " << TabletId);
- Self->PipeClientCache->ForceClose(ctx, ui64(TabletId));
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Close pipe to deleted shardIdx " << ShardIdx << " tabletId " << TabletId);
+ Self->PipeClientCache->ForceClose(ctx, ui64(TabletId));
}
}
}
private:
- TShardIdx ShardIdx;
- TTabletId TabletId;
+ TShardIdx ShardIdx;
+ TTabletId TabletId;
NKikimrProto::EReplyStatus Status;
- TTabletId HiveId;
+ TTabletId HiveId;
TTabletId ForwardToHiveId = {};
};
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxDeleteTabletReply(TEvHive::TEvDeleteTabletReply::TPtr& ev) {
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxDeleteTabletReply(TEvHive::TEvDeleteTabletReply::TPtr& ev) {
return new TTxDeleteTabletReply(this, ev);
}
-void TSchemeShard::Handle(TEvPrivate::TEvSubscribeToShardDeletion::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvPrivate::TEvSubscribeToShardDeletion::TPtr& ev, const TActorContext& ctx) {
auto shardIdx = ev->Get()->ShardIdx;
if (ShardInfos.contains(shardIdx)) {
ShardDeletionSubscribers[shardIdx].push_back(ev->Sender);
diff --git a/ydb/core/tx/schemeshard/schemeshard__describe_scheme.cpp b/ydb/core/tx/schemeshard/schemeshard__describe_scheme.cpp
index dbe6a281689..e6d96356527 100644
--- a/ydb/core/tx/schemeshard/schemeshard__describe_scheme.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__describe_scheme.cpp
@@ -4,19 +4,19 @@
#include <util/stream/format.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TTxDescribeScheme : public TSchemeShard::TRwTxBase {
+struct TSchemeShard::TTxDescribeScheme : public TSchemeShard::TRwTxBase {
const TActorId Sender;
const ui64 Cookie;
TPathDescriber PathDescriber;
- THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder> Result;
+ THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder> Result;
- TTxDescribeScheme(TSelf *self, TEvSchemeShard::TEvDescribeScheme::TPtr &ev)
- : TRwTxBase(self)
+ TTxDescribeScheme(TSelf *self, TEvSchemeShard::TEvDescribeScheme::TPtr &ev)
+ : TRwTxBase(self)
, Sender(ev->Sender)
, Cookie(ev->Cookie)
, PathDescriber(self, std::move(ev->Get()->Record))
@@ -24,12 +24,12 @@ struct TSchemeShard::TTxDescribeScheme : public TSchemeShard::TRwTxBase {
TTxType GetTxType() const override { return TXTYPE_DESCRIBE_SCHEME; }
- void DoExecute(TTransactionContext& /*txc*/, const TActorContext& ctx) override {
- LOG_DEBUG_S(ctx, NKikimrServices::SCHEMESHARD_DESCRIBE,
- "TTxDescribeScheme DoExecute"
+ void DoExecute(TTransactionContext& /*txc*/, const TActorContext& ctx) override {
+ LOG_DEBUG_S(ctx, NKikimrServices::SCHEMESHARD_DESCRIBE,
+ "TTxDescribeScheme DoExecute"
<< ", record: " << PathDescriber.GetParams().ShortDebugString()
- << ", at schemeshard: " << Self->TabletID());
-
+ << ", at schemeshard: " << Self->TabletID());
+
Result = PathDescriber.Describe(ctx);
}
@@ -37,30 +37,30 @@ struct TSchemeShard::TTxDescribeScheme : public TSchemeShard::TRwTxBase {
const auto& params = PathDescriber.GetParams();
if (params.HasPathId()) {
- LOG_INFO_S(ctx, NKikimrServices::SCHEMESHARD_DESCRIBE,
- "Tablet " << Self->TabletID()
+ LOG_INFO_S(ctx, NKikimrServices::SCHEMESHARD_DESCRIBE,
+ "Tablet " << Self->TabletID()
<< " describe pathId " << params.GetPathId()
- << " took " << HumanReadable(ExecuteDuration)
- << " result status " <<NKikimrScheme::EStatus_Name(Result->Record.GetStatus()));
+ << " took " << HumanReadable(ExecuteDuration)
+ << " result status " <<NKikimrScheme::EStatus_Name(Result->Record.GetStatus()));
} else {
- LOG_INFO_S(ctx, NKikimrServices::SCHEMESHARD_DESCRIBE,
- "Tablet " << Self->TabletID()
+ LOG_INFO_S(ctx, NKikimrServices::SCHEMESHARD_DESCRIBE,
+ "Tablet " << Self->TabletID()
<< " describe path \"" << params.GetPath() << "\""
- << " took " << HumanReadable(ExecuteDuration)
- << " result status " <<NKikimrScheme::EStatus_Name(Result->Record.GetStatus()));
+ << " took " << HumanReadable(ExecuteDuration)
+ << " result status " <<NKikimrScheme::EStatus_Name(Result->Record.GetStatus()));
}
-
- LOG_DEBUG_S(ctx, NKikimrServices::SCHEMESHARD_DESCRIBE,
- "TTxDescribeScheme DoComplete"
- << ", result: " << Result->GetRecord().ShortDebugString()
- << ", at schemeshard: " << Self->TabletID());
-
+
+ LOG_DEBUG_S(ctx, NKikimrServices::SCHEMESHARD_DESCRIBE,
+ "TTxDescribeScheme DoComplete"
+ << ", result: " << Result->GetRecord().ShortDebugString()
+ << ", at schemeshard: " << Self->TabletID());
+
ctx.Send(Sender, std::move(Result), 0, Cookie);
}
};
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxDescribeScheme(TEvSchemeShard::TEvDescribeScheme::TPtr &ev) {
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxDescribeScheme(TEvSchemeShard::TEvDescribeScheme::TPtr &ev) {
return new TTxDescribeScheme(this, ev);
}
diff --git a/ydb/core/tx/schemeshard/schemeshard__find_subdomain_path_id.cpp b/ydb/core/tx/schemeshard/schemeshard__find_subdomain_path_id.cpp
index 89de5e090b1..a28c46ee39a 100644
--- a/ydb/core/tx/schemeshard/schemeshard__find_subdomain_path_id.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__find_subdomain_path_id.cpp
@@ -1,11 +1,11 @@
#include "schemeshard_impl.h"
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
-class TTxFindTabletSubDomainPathId : public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
+class TTxFindTabletSubDomainPathId : public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
public:
- TTxFindTabletSubDomainPathId(TSchemeShard* self, TEvSchemeShard::TEvFindTabletSubDomainPathId::TPtr& ev)
+ TTxFindTabletSubDomainPathId(TSchemeShard* self, TEvSchemeShard::TEvFindTabletSubDomainPathId::TPtr& ev)
: TTransactionBase(self)
, Ev(ev)
{ }
@@ -21,29 +21,29 @@ public:
auto it1 = Self->TabletIdToShardIdx.find(TTabletId(tabletId));
if (it1 == Self->TabletIdToShardIdx.end()) {
- Result = MakeHolder<TEvSchemeShard::TEvFindTabletSubDomainPathIdResult>(
- tabletId, NKikimrScheme::TEvFindTabletSubDomainPathIdResult::SHARD_NOT_FOUND);
+ Result = MakeHolder<TEvSchemeShard::TEvFindTabletSubDomainPathIdResult>(
+ tabletId, NKikimrScheme::TEvFindTabletSubDomainPathIdResult::SHARD_NOT_FOUND);
return true;
}
auto shardIdx = it1->second;
auto it2 = Self->ShardInfos.find(shardIdx);
if (it2 == Self->ShardInfos.end()) {
- Result = MakeHolder<TEvSchemeShard::TEvFindTabletSubDomainPathIdResult>(
- tabletId, NKikimrScheme::TEvFindTabletSubDomainPathIdResult::SHARD_NOT_FOUND);
+ Result = MakeHolder<TEvSchemeShard::TEvFindTabletSubDomainPathIdResult>(
+ tabletId, NKikimrScheme::TEvFindTabletSubDomainPathIdResult::SHARD_NOT_FOUND);
return true;
}
auto& shardInfo = it2->second;
auto path = TPath::Init(shardInfo.PathId, Self);
if (!path) {
- Result = MakeHolder<TEvSchemeShard::TEvFindTabletSubDomainPathIdResult>(
- tabletId, NKikimrScheme::TEvFindTabletSubDomainPathIdResult::PATH_NOT_FOUND);
+ Result = MakeHolder<TEvSchemeShard::TEvFindTabletSubDomainPathIdResult>(
+ tabletId, NKikimrScheme::TEvFindTabletSubDomainPathIdResult::PATH_NOT_FOUND);
return true;
}
auto domainId = path.DomainId();
- Result = MakeHolder<TEvSchemeShard::TEvFindTabletSubDomainPathIdResult>(
+ Result = MakeHolder<TEvSchemeShard::TEvFindTabletSubDomainPathIdResult>(
tabletId, domainId.OwnerId, domainId.LocalPathId);
return true;
}
@@ -54,13 +54,13 @@ public:
}
private:
- TEvSchemeShard::TEvFindTabletSubDomainPathId::TPtr Ev;
- THolder<TEvSchemeShard::TEvFindTabletSubDomainPathIdResult> Result;
+ TEvSchemeShard::TEvFindTabletSubDomainPathId::TPtr Ev;
+ THolder<TEvSchemeShard::TEvFindTabletSubDomainPathIdResult> Result;
};
-void TSchemeShard::Handle(TEvSchemeShard::TEvFindTabletSubDomainPathId::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvSchemeShard::TEvFindTabletSubDomainPathId::TPtr& ev, const TActorContext& ctx) {
Execute(new TTxFindTabletSubDomainPathId(this, ev), ctx);
}
-} // namespace NSchemeShard
+} // namespace NSchemeShard
} // namespace NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__fix_bad_paths.cpp b/ydb/core/tx/schemeshard/schemeshard__fix_bad_paths.cpp
index e9ea215ac2f..b1755db0c1b 100644
--- a/ydb/core/tx/schemeshard/schemeshard__fix_bad_paths.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__fix_bad_paths.cpp
@@ -7,11 +7,11 @@
#define SS_LOG_W(ctx, stream) LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, stream)
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TTxFixBadPaths : public TTransactionBase<TSchemeShard> {
+struct TSchemeShard::TTxFixBadPaths : public TTransactionBase<TSchemeShard> {
explicit TTxFixBadPaths(TSelf *self)
: TBase(self)
{
@@ -28,14 +28,14 @@ struct TSchemeShard::TTxFixBadPaths : public TTransactionBase<TSchemeShard> {
continue;
}
- if (pathEl->CreateTxId == TTxId(0)) {
- pathEl->CreateTxId = TTxId(1);
+ if (pathEl->CreateTxId == TTxId(0)) {
+ pathEl->CreateTxId = TTxId(1);
Self->PersistCreateTxId(db, pathId, pathEl->CreateTxId);
SS_LOG_W(ctx, "Fix CreateTxId, self# " << Self->TabletID() << ", pathId# " << pathId);
}
- if (pathId != Self->RootPathId() && pathEl->StepCreated == InvalidStepId) {
- pathEl->StepCreated = TStepId(1);
+ if (pathId != Self->RootPathId() && pathEl->StepCreated == InvalidStepId) {
+ pathEl->StepCreated = TStepId(1);
Self->PersistCreateStep(db, pathId, pathEl->StepCreated);
SS_LOG_W(ctx, "Fix StepCreated, self# " << Self->TabletID() << ", pathId# " << pathId);
@@ -49,11 +49,11 @@ struct TSchemeShard::TTxFixBadPaths : public TTransactionBase<TSchemeShard> {
Self->Execute(Self->CreateTxInitPopulator(TSideEffects::TPublications()), ctx);
}
-}; // TSchemeShard::TTxFixBadPaths
+}; // TSchemeShard::TTxFixBadPaths
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxFixBadPaths() {
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxFixBadPaths() {
return new TTxFixBadPaths(this);
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__init.cpp b/ydb/core/tx/schemeshard/schemeshard__init.cpp
index 772ab8e4a52..650506549e0 100644
--- a/ydb/core/tx/schemeshard/schemeshard__init.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__init.cpp
@@ -5,16 +5,16 @@
#include <ydb/core/util/pb.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
- TSideEffects OnComplete;
- TMemoryChanges MemChanges;
- TStorageChanges DbChanges;
+struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
+ TSideEffects OnComplete;
+ TMemoryChanges MemChanges;
+ TStorageChanges DbChanges;
THashMap<TTxId, TDeque<TPathId>> Publications;
- TVector<TPathId> TablesToClean;
+ TVector<TPathId> TablesToClean;
TDeque<TPathId> BlockStoreVolumesToClean;
TVector<ui64> ExportsToResume;
TVector<ui64> ImportsToResume;
@@ -33,24 +33,24 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
}
void CollectObjectsToClean() {
- THashSet<TPathId> underOperation;
- for (auto& item : Self->TxInFlight) {
- const TTxState& txState = item.second;
- underOperation.insert(txState.TargetPathId);
- if (txState.SourcePathId) {
- underOperation.insert(txState.SourcePathId);
- }
- }
-
- TablesToClean.clear();
- for (auto& tItem : Self->Tables) {
- TPathId pathId = tItem.first;
- TPathElement::TPtr path = Self->PathsById.at(pathId);
-
- if (path->IsTable() && path->Dropped() && !underOperation.contains(pathId)) {
- TablesToClean.push_back(pathId);
- }
- }
+ THashSet<TPathId> underOperation;
+ for (auto& item : Self->TxInFlight) {
+ const TTxState& txState = item.second;
+ underOperation.insert(txState.TargetPathId);
+ if (txState.SourcePathId) {
+ underOperation.insert(txState.SourcePathId);
+ }
+ }
+
+ TablesToClean.clear();
+ for (auto& tItem : Self->Tables) {
+ TPathId pathId = tItem.first;
+ TPathElement::TPtr path = Self->PathsById.at(pathId);
+
+ if (path->IsTable() && path->Dropped() && !underOperation.contains(pathId)) {
+ TablesToClean.push_back(pathId);
+ }
+ }
BlockStoreVolumesToClean.clear();
for (auto& xpair : Self->BlockStoreVolumes) {
@@ -79,906 +79,906 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
Self->CleanDroppedSubDomainsCandidates.insert(item.first);
}
}
- }
-
- typedef std::tuple<TPathId, TPathId, TString, TString,
- TPathElement::EPathType,
- TStepId, TTxId, TStepId, TTxId,
- TString, TTxId,
- ui64, ui64, ui64> TPathRec;
- typedef TDeque<TPathRec> TPathesRows;
-
- TPathElement::TPtr MakePathElement(const TPathRec& rec) const {
- TPathId pathId = std::get<0>(rec);
- TPathId parentPathId = std::get<1>(rec);
-
- TString name = std::get<2>(rec);
- TString owner = std::get<3>(rec);
-
- TPathId domainId = Self->RootPathId();
- if (pathId != Self->RootPathId()) {
- Y_VERIFY_S(Self->PathsById.contains(parentPathId), "Parent path not found"
- << ", pathId: " << pathId
- << ", parentPathId: " << parentPathId);
- auto parent = Self->PathsById.at(parentPathId);
- if (parent->IsDomainRoot()) {
- domainId = parentPathId;
- } else {
- domainId = parent->DomainPathId;
- }
- }
-
- TPathElement::TPtr path = new TPathElement(pathId, parentPathId, domainId, name, owner);
-
- std::tie(
- std::ignore, //pathId
- std::ignore, //parentPathId
- std::ignore, //name
- std::ignore, //owner
- path->PathType,
- path->StepCreated,
- path->CreateTxId,
- path->StepDropped,
- path->DropTxId,
- path->ACL,
- path->LastTxId,
- path->DirAlterVersion,
- path->UserAttrs->AlterVersion,
- path->ACLVersion
- ) = rec;
-
- path->PathState = TPathElement::EPathState::EPathStateNoChanges;
- if (path->StepDropped) {
- path->PathState = TPathElement::EPathState::EPathStateNotExist;
- }
-
- return path;
- }
-
- bool LoadPathes(NIceDb::TNiceDb& db, TPathesRows& pathesRows) const {
- {
- {
- auto rows = db.Table<Schema::MigratedPaths>().Range().Select();
- if (!rows.IsReady()) {
- return false;
- }
- while (!rows.EndOfSet()) {
- TPathId pathId = TPathId(rows.GetValue<Schema::MigratedPaths::OwnerPathId>(), rows.GetValue<Schema::MigratedPaths::LocalPathId>());
- TPathId parentPathId = TPathId(rows.GetValue<Schema::MigratedPaths::ParentOwnerId>(), rows.GetValue<Schema::MigratedPaths::ParentLocalId>());
-
- TString name = rows.GetValue<Schema::MigratedPaths::Name>();
-
- TPathElement::EPathType pathType = (TPathElement::EPathType)rows.GetValue<Schema::MigratedPaths::PathType>();
-
- TStepId stepCreated = rows.GetValueOrDefault<Schema::MigratedPaths::StepCreated>(InvalidStepId);
- TTxId txIdCreated = rows.GetValue<Schema::MigratedPaths::CreateTxId>();
-
- TStepId stepDropped = rows.GetValueOrDefault<Schema::MigratedPaths::StepDropped>(InvalidStepId);
- TTxId txIdDropped = rows.GetValueOrDefault<Schema::MigratedPaths::DropTxId>(InvalidTxId);
-
- TString owner = rows.GetValueOrDefault<Schema::MigratedPaths::Owner>();
- TString acl = rows.GetValueOrDefault<Schema::MigratedPaths::ACL>();
-
- TTxId lastTxId = rows.GetValueOrDefault<Schema::MigratedPaths::LastTxId>(InvalidTxId);
-
- ui64 dirAlterVer = rows.GetValueOrDefault<Schema::MigratedPaths::DirAlterVersion>(1);
- ui64 userAttrsAlterVer = rows.GetValueOrDefault<Schema::MigratedPaths::UserAttrsAlterVersion>(1);
- ui64 aclAlterVer = rows.GetValueOrDefault<Schema::MigratedPaths::ACLVersion>(0);
-
- pathesRows.emplace_back(pathId, parentPathId, name, owner, pathType,
- stepCreated, txIdCreated, stepDropped, txIdDropped,
- acl, lastTxId, dirAlterVer, userAttrsAlterVer, aclAlterVer);
-
- if (!rows.Next()) {
- return false;
- }
- }
-
- }
-
-
- auto rows = db.Table<Schema::Paths>().Range().Select();
- if (!rows.IsReady()) {
- return false;
- }
- while (!rows.EndOfSet()) {
- TPathId pathId = Self->MakeLocalId(rows.GetValue<Schema::Paths::Id>());
- TPathId parentPathId = TPathId(rows.GetValueOrDefault<Schema::Paths::ParentOwnerId>(Self->TabletID()),
- rows.GetValue<Schema::Paths::ParentId>());
-
- TString name = rows.GetValue<Schema::Paths::Name>();
-
- TPathElement::EPathType pathType = (TPathElement::EPathType)rows.GetValue<Schema::Paths::PathType>();
-
- TStepId stepCreated = rows.GetValueOrDefault<Schema::Paths::StepCreated>(InvalidStepId);
- TTxId txIdCreated = rows.GetValue<Schema::Paths::CreateTxId>();
-
- TStepId stepDropped = rows.GetValueOrDefault<Schema::Paths::StepDropped>(InvalidStepId);
- TTxId txIdDropped = rows.GetValueOrDefault<Schema::Paths::DropTxId>(InvalidTxId);
-
- TString owner = rows.GetValueOrDefault<Schema::Paths::Owner>();
- TString acl = rows.GetValueOrDefault<Schema::Paths::ACL>();
-
- TTxId lastTxId = rows.GetValueOrDefault<Schema::Paths::LastTxId>(InvalidTxId);
-
- ui64 dirAlterVer = rows.GetValueOrDefault<Schema::Paths::DirAlterVersion>(1);
- ui64 userAttrsAlterVer = rows.GetValueOrDefault<Schema::Paths::UserAttrsAlterVersion>(1);
- ui64 aclAlterVer = rows.GetValueOrDefault<Schema::Paths::ACLVersion>(0);
-
- if (pathId == parentPathId) {
- pathesRows.emplace_front(pathId, parentPathId, name, owner, pathType,
- stepCreated, txIdCreated, stepDropped, txIdDropped,
- acl, lastTxId, dirAlterVer, userAttrsAlterVer, aclAlterVer);
- } else {
- pathesRows.emplace_back(pathId, parentPathId, name, owner, pathType,
- stepCreated, txIdCreated, stepDropped, txIdDropped,
- acl, lastTxId, dirAlterVer, userAttrsAlterVer, aclAlterVer);
- }
-
- if (!rows.Next()) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- typedef std::tuple<TPathId, TString, TString> TUserAttrsRec;
- typedef TDeque<TUserAttrsRec> TUserAttrsRows;
-
- bool LoadUserAttrs(NIceDb::TNiceDb& db, TUserAttrsRows& userAttrsRows) const {
- {
- auto rowSet = db.Table<Schema::UserAttributes>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
- while (!rowSet.EndOfSet()) {
- TPathId pathId = Self->MakeLocalId(rowSet.GetValue<Schema::UserAttributes::PathId>());
-
- TString name = rowSet.GetValue<Schema::UserAttributes::AttrName>();
- TString value = rowSet.GetValue<Schema::UserAttributes::AttrValue>();
-
- userAttrsRows.emplace_back(pathId, name, value);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- {
- auto rowSet = db.Table<Schema::MigratedUserAttributes>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
- while (!rowSet.EndOfSet()) {
- TPathId pathId = TPathId(rowSet.GetValue<Schema::MigratedUserAttributes::OwnerPathId>(),
- rowSet.GetValue<Schema::MigratedUserAttributes::LocalPathId>());
-
- TString name = rowSet.GetValue<Schema::MigratedUserAttributes::AttrName>();
- TString value = rowSet.GetValue<Schema::MigratedUserAttributes::AttrValue>();
-
- userAttrsRows.emplace_back(pathId, name, value);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- bool LoadUserAttrsAlterData(NIceDb::TNiceDb& db, TUserAttrsRows& userAttrsRows) const {
- {
- auto rowSet = db.Table<Schema::UserAttributesAlterData>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
- while (!rowSet.EndOfSet()) {
- TPathId pathId = Self->MakeLocalId(rowSet.GetValue<Schema::UserAttributesAlterData::PathId>());
-
- TString name = rowSet.GetValue<Schema::UserAttributesAlterData::AttrName>();
- TString value = rowSet.GetValue<Schema::UserAttributesAlterData::AttrValue>();
-
- userAttrsRows.emplace_back(pathId, name, value);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- {
- auto rowSet = db.Table<Schema::MigratedUserAttributesAlterData>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
- while (!rowSet.EndOfSet()) {
- TPathId pathId = TPathId(rowSet.GetValue<Schema::MigratedUserAttributesAlterData::OwnerPathId>(),
- rowSet.GetValue<Schema::MigratedUserAttributesAlterData::LocalPathId>());
-
- TString name = rowSet.GetValue<Schema::MigratedUserAttributesAlterData::AttrName>();
- TString value = rowSet.GetValue<Schema::MigratedUserAttributesAlterData::AttrValue>();
-
- userAttrsRows.emplace_back(pathId, name, value);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- return true;
- }
-
+ }
+
+ typedef std::tuple<TPathId, TPathId, TString, TString,
+ TPathElement::EPathType,
+ TStepId, TTxId, TStepId, TTxId,
+ TString, TTxId,
+ ui64, ui64, ui64> TPathRec;
+ typedef TDeque<TPathRec> TPathesRows;
+
+ TPathElement::TPtr MakePathElement(const TPathRec& rec) const {
+ TPathId pathId = std::get<0>(rec);
+ TPathId parentPathId = std::get<1>(rec);
+
+ TString name = std::get<2>(rec);
+ TString owner = std::get<3>(rec);
+
+ TPathId domainId = Self->RootPathId();
+ if (pathId != Self->RootPathId()) {
+ Y_VERIFY_S(Self->PathsById.contains(parentPathId), "Parent path not found"
+ << ", pathId: " << pathId
+ << ", parentPathId: " << parentPathId);
+ auto parent = Self->PathsById.at(parentPathId);
+ if (parent->IsDomainRoot()) {
+ domainId = parentPathId;
+ } else {
+ domainId = parent->DomainPathId;
+ }
+ }
+
+ TPathElement::TPtr path = new TPathElement(pathId, parentPathId, domainId, name, owner);
+
+ std::tie(
+ std::ignore, //pathId
+ std::ignore, //parentPathId
+ std::ignore, //name
+ std::ignore, //owner
+ path->PathType,
+ path->StepCreated,
+ path->CreateTxId,
+ path->StepDropped,
+ path->DropTxId,
+ path->ACL,
+ path->LastTxId,
+ path->DirAlterVersion,
+ path->UserAttrs->AlterVersion,
+ path->ACLVersion
+ ) = rec;
+
+ path->PathState = TPathElement::EPathState::EPathStateNoChanges;
+ if (path->StepDropped) {
+ path->PathState = TPathElement::EPathState::EPathStateNotExist;
+ }
+
+ return path;
+ }
+
+ bool LoadPathes(NIceDb::TNiceDb& db, TPathesRows& pathesRows) const {
+ {
+ {
+ auto rows = db.Table<Schema::MigratedPaths>().Range().Select();
+ if (!rows.IsReady()) {
+ return false;
+ }
+ while (!rows.EndOfSet()) {
+ TPathId pathId = TPathId(rows.GetValue<Schema::MigratedPaths::OwnerPathId>(), rows.GetValue<Schema::MigratedPaths::LocalPathId>());
+ TPathId parentPathId = TPathId(rows.GetValue<Schema::MigratedPaths::ParentOwnerId>(), rows.GetValue<Schema::MigratedPaths::ParentLocalId>());
+
+ TString name = rows.GetValue<Schema::MigratedPaths::Name>();
+
+ TPathElement::EPathType pathType = (TPathElement::EPathType)rows.GetValue<Schema::MigratedPaths::PathType>();
+
+ TStepId stepCreated = rows.GetValueOrDefault<Schema::MigratedPaths::StepCreated>(InvalidStepId);
+ TTxId txIdCreated = rows.GetValue<Schema::MigratedPaths::CreateTxId>();
+
+ TStepId stepDropped = rows.GetValueOrDefault<Schema::MigratedPaths::StepDropped>(InvalidStepId);
+ TTxId txIdDropped = rows.GetValueOrDefault<Schema::MigratedPaths::DropTxId>(InvalidTxId);
+
+ TString owner = rows.GetValueOrDefault<Schema::MigratedPaths::Owner>();
+ TString acl = rows.GetValueOrDefault<Schema::MigratedPaths::ACL>();
+
+ TTxId lastTxId = rows.GetValueOrDefault<Schema::MigratedPaths::LastTxId>(InvalidTxId);
+
+ ui64 dirAlterVer = rows.GetValueOrDefault<Schema::MigratedPaths::DirAlterVersion>(1);
+ ui64 userAttrsAlterVer = rows.GetValueOrDefault<Schema::MigratedPaths::UserAttrsAlterVersion>(1);
+ ui64 aclAlterVer = rows.GetValueOrDefault<Schema::MigratedPaths::ACLVersion>(0);
+
+ pathesRows.emplace_back(pathId, parentPathId, name, owner, pathType,
+ stepCreated, txIdCreated, stepDropped, txIdDropped,
+ acl, lastTxId, dirAlterVer, userAttrsAlterVer, aclAlterVer);
+
+ if (!rows.Next()) {
+ return false;
+ }
+ }
+
+ }
+
+
+ auto rows = db.Table<Schema::Paths>().Range().Select();
+ if (!rows.IsReady()) {
+ return false;
+ }
+ while (!rows.EndOfSet()) {
+ TPathId pathId = Self->MakeLocalId(rows.GetValue<Schema::Paths::Id>());
+ TPathId parentPathId = TPathId(rows.GetValueOrDefault<Schema::Paths::ParentOwnerId>(Self->TabletID()),
+ rows.GetValue<Schema::Paths::ParentId>());
+
+ TString name = rows.GetValue<Schema::Paths::Name>();
+
+ TPathElement::EPathType pathType = (TPathElement::EPathType)rows.GetValue<Schema::Paths::PathType>();
+
+ TStepId stepCreated = rows.GetValueOrDefault<Schema::Paths::StepCreated>(InvalidStepId);
+ TTxId txIdCreated = rows.GetValue<Schema::Paths::CreateTxId>();
+
+ TStepId stepDropped = rows.GetValueOrDefault<Schema::Paths::StepDropped>(InvalidStepId);
+ TTxId txIdDropped = rows.GetValueOrDefault<Schema::Paths::DropTxId>(InvalidTxId);
+
+ TString owner = rows.GetValueOrDefault<Schema::Paths::Owner>();
+ TString acl = rows.GetValueOrDefault<Schema::Paths::ACL>();
+
+ TTxId lastTxId = rows.GetValueOrDefault<Schema::Paths::LastTxId>(InvalidTxId);
+
+ ui64 dirAlterVer = rows.GetValueOrDefault<Schema::Paths::DirAlterVersion>(1);
+ ui64 userAttrsAlterVer = rows.GetValueOrDefault<Schema::Paths::UserAttrsAlterVersion>(1);
+ ui64 aclAlterVer = rows.GetValueOrDefault<Schema::Paths::ACLVersion>(0);
+
+ if (pathId == parentPathId) {
+ pathesRows.emplace_front(pathId, parentPathId, name, owner, pathType,
+ stepCreated, txIdCreated, stepDropped, txIdDropped,
+ acl, lastTxId, dirAlterVer, userAttrsAlterVer, aclAlterVer);
+ } else {
+ pathesRows.emplace_back(pathId, parentPathId, name, owner, pathType,
+ stepCreated, txIdCreated, stepDropped, txIdDropped,
+ acl, lastTxId, dirAlterVer, userAttrsAlterVer, aclAlterVer);
+ }
+
+ if (!rows.Next()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ typedef std::tuple<TPathId, TString, TString> TUserAttrsRec;
+ typedef TDeque<TUserAttrsRec> TUserAttrsRows;
+
+ bool LoadUserAttrs(NIceDb::TNiceDb& db, TUserAttrsRows& userAttrsRows) const {
+ {
+ auto rowSet = db.Table<Schema::UserAttributes>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+ while (!rowSet.EndOfSet()) {
+ TPathId pathId = Self->MakeLocalId(rowSet.GetValue<Schema::UserAttributes::PathId>());
+
+ TString name = rowSet.GetValue<Schema::UserAttributes::AttrName>();
+ TString value = rowSet.GetValue<Schema::UserAttributes::AttrValue>();
+
+ userAttrsRows.emplace_back(pathId, name, value);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ {
+ auto rowSet = db.Table<Schema::MigratedUserAttributes>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+ while (!rowSet.EndOfSet()) {
+ TPathId pathId = TPathId(rowSet.GetValue<Schema::MigratedUserAttributes::OwnerPathId>(),
+ rowSet.GetValue<Schema::MigratedUserAttributes::LocalPathId>());
+
+ TString name = rowSet.GetValue<Schema::MigratedUserAttributes::AttrName>();
+ TString value = rowSet.GetValue<Schema::MigratedUserAttributes::AttrValue>();
+
+ userAttrsRows.emplace_back(pathId, name, value);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ bool LoadUserAttrsAlterData(NIceDb::TNiceDb& db, TUserAttrsRows& userAttrsRows) const {
+ {
+ auto rowSet = db.Table<Schema::UserAttributesAlterData>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+ while (!rowSet.EndOfSet()) {
+ TPathId pathId = Self->MakeLocalId(rowSet.GetValue<Schema::UserAttributesAlterData::PathId>());
+
+ TString name = rowSet.GetValue<Schema::UserAttributesAlterData::AttrName>();
+ TString value = rowSet.GetValue<Schema::UserAttributesAlterData::AttrValue>();
+
+ userAttrsRows.emplace_back(pathId, name, value);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ {
+ auto rowSet = db.Table<Schema::MigratedUserAttributesAlterData>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+ while (!rowSet.EndOfSet()) {
+ TPathId pathId = TPathId(rowSet.GetValue<Schema::MigratedUserAttributesAlterData::OwnerPathId>(),
+ rowSet.GetValue<Schema::MigratedUserAttributesAlterData::LocalPathId>());
+
+ TString name = rowSet.GetValue<Schema::MigratedUserAttributesAlterData::AttrName>();
+ TString value = rowSet.GetValue<Schema::MigratedUserAttributesAlterData::AttrValue>();
+
+ userAttrsRows.emplace_back(pathId, name, value);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
typedef std::tuple<TPathId, ui32, ui64, TString, TString, TString, ui64, TString, bool> TTableRec;
- typedef TDeque<TTableRec> TTableRows;
-
- bool LoadTables(NIceDb::TNiceDb& db, TTableRows& tableRows) const {
- {
- auto rowSet = db.Table<Schema::Tables>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
- while (!rowSet.EndOfSet()) {
- TPathId pathId = Self->MakeLocalId(rowSet.GetValue<Schema::Tables::TabId>());
-
- ui32 nextCollId = rowSet.GetValue<Schema::Tables::NextColId>();
- ui64 alterVersion = rowSet.GetValueOrDefault<Schema::Tables::AlterVersion>(0);
- TString partitionConfig = rowSet.GetValueOrDefault<Schema::Tables::PartitionConfig>();
- TString alterTabletFull = rowSet.GetValueOrDefault<Schema::Tables::AlterTableFull>();
- TString alterTabletDiff = rowSet.GetValueOrDefault<Schema::Tables::AlterTable>();
- ui64 partitionVersion = rowSet.GetValueOrDefault<Schema::Tables::PartitioningVersion>(0);
+ typedef TDeque<TTableRec> TTableRows;
+
+ bool LoadTables(NIceDb::TNiceDb& db, TTableRows& tableRows) const {
+ {
+ auto rowSet = db.Table<Schema::Tables>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+ while (!rowSet.EndOfSet()) {
+ TPathId pathId = Self->MakeLocalId(rowSet.GetValue<Schema::Tables::TabId>());
+
+ ui32 nextCollId = rowSet.GetValue<Schema::Tables::NextColId>();
+ ui64 alterVersion = rowSet.GetValueOrDefault<Schema::Tables::AlterVersion>(0);
+ TString partitionConfig = rowSet.GetValueOrDefault<Schema::Tables::PartitionConfig>();
+ TString alterTabletFull = rowSet.GetValueOrDefault<Schema::Tables::AlterTableFull>();
+ TString alterTabletDiff = rowSet.GetValueOrDefault<Schema::Tables::AlterTable>();
+ ui64 partitionVersion = rowSet.GetValueOrDefault<Schema::Tables::PartitioningVersion>(0);
TString ttlSettings = rowSet.GetValueOrDefault<Schema::Tables::TTLSettings>();
bool isBackup = rowSet.GetValueOrDefault<Schema::Tables::IsBackup>(false);
-
- tableRows.emplace_back(pathId,
+
+ tableRows.emplace_back(pathId,
nextCollId, alterVersion, partitionConfig, alterTabletFull, alterTabletDiff, partitionVersion, ttlSettings, isBackup);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- {
- auto rowSet = db.Table<Schema::MigratedTables>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
- while (!rowSet.EndOfSet()) {
- TPathId pathId = TPathId(
- rowSet.GetValue<Schema::MigratedTables::OwnerPathId>(),
- rowSet.GetValue<Schema::MigratedTables::LocalPathId>());
-
- ui32 nextCollId = rowSet.GetValue<Schema::MigratedTables::NextColId>();
- ui64 alterVersion = rowSet.GetValueOrDefault<Schema::MigratedTables::AlterVersion>(0);
- TString partitionConfig = rowSet.GetValueOrDefault<Schema::MigratedTables::PartitionConfig>();
- TString alterTabletFull = rowSet.GetValueOrDefault<Schema::MigratedTables::AlterTableFull>();
- TString alterTabletDiff = rowSet.GetValueOrDefault<Schema::MigratedTables::AlterTable>();
- ui64 partitionVersion = rowSet.GetValueOrDefault<Schema::MigratedTables::PartitioningVersion>(0);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ {
+ auto rowSet = db.Table<Schema::MigratedTables>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+ while (!rowSet.EndOfSet()) {
+ TPathId pathId = TPathId(
+ rowSet.GetValue<Schema::MigratedTables::OwnerPathId>(),
+ rowSet.GetValue<Schema::MigratedTables::LocalPathId>());
+
+ ui32 nextCollId = rowSet.GetValue<Schema::MigratedTables::NextColId>();
+ ui64 alterVersion = rowSet.GetValueOrDefault<Schema::MigratedTables::AlterVersion>(0);
+ TString partitionConfig = rowSet.GetValueOrDefault<Schema::MigratedTables::PartitionConfig>();
+ TString alterTabletFull = rowSet.GetValueOrDefault<Schema::MigratedTables::AlterTableFull>();
+ TString alterTabletDiff = rowSet.GetValueOrDefault<Schema::MigratedTables::AlterTable>();
+ ui64 partitionVersion = rowSet.GetValueOrDefault<Schema::MigratedTables::PartitioningVersion>(0);
TString ttlSettings = rowSet.GetValueOrDefault<Schema::MigratedTables::TTLSettings>();
bool isBackup = rowSet.GetValueOrDefault<Schema::MigratedTables::IsBackup>(false);
-
- tableRows.emplace_back(pathId,
+
+ tableRows.emplace_back(pathId,
nextCollId, alterVersion, partitionConfig, alterTabletFull, alterTabletDiff, partitionVersion, ttlSettings, isBackup);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- return true;
- }
-
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
typedef std::tuple<TPathId, ui32, TString, NScheme::TTypeId, ui32, ui64, ui64, ui32, ETableColumnDefaultKind, TString, bool> TColumnRec;
- typedef TDeque<TColumnRec> TColumnRows;
-
- bool LoadColumns(NIceDb::TNiceDb& db, TColumnRows& columnRows) const {
- {
- auto rowSet = db.Table<Schema::Columns>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- TPathId pathId = Self->MakeLocalId(rowSet.GetValue<Schema::Columns::TabId>());
-
- ui32 colId = rowSet.GetValue<Schema::Columns::ColId>();
- TString colName = rowSet.GetValue<Schema::Columns::ColName>();
- NScheme::TTypeId typeId = (NScheme::TTypeId)rowSet.GetValue<Schema::Columns::ColType>();
- ui32 keyOrder = rowSet.GetValue<Schema::Columns::ColKeyOrder>();
- ui64 createVersion = rowSet.GetValueOrDefault<Schema::Columns::CreateVersion>(0);
- ui64 deleteVersion = rowSet.GetValueOrDefault<Schema::Columns::DeleteVersion>(-1);
- ui32 family = rowSet.GetValueOrDefault<Schema::Columns::Family>(0);
+ typedef TDeque<TColumnRec> TColumnRows;
+
+ bool LoadColumns(NIceDb::TNiceDb& db, TColumnRows& columnRows) const {
+ {
+ auto rowSet = db.Table<Schema::Columns>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ TPathId pathId = Self->MakeLocalId(rowSet.GetValue<Schema::Columns::TabId>());
+
+ ui32 colId = rowSet.GetValue<Schema::Columns::ColId>();
+ TString colName = rowSet.GetValue<Schema::Columns::ColName>();
+ NScheme::TTypeId typeId = (NScheme::TTypeId)rowSet.GetValue<Schema::Columns::ColType>();
+ ui32 keyOrder = rowSet.GetValue<Schema::Columns::ColKeyOrder>();
+ ui64 createVersion = rowSet.GetValueOrDefault<Schema::Columns::CreateVersion>(0);
+ ui64 deleteVersion = rowSet.GetValueOrDefault<Schema::Columns::DeleteVersion>(-1);
+ ui32 family = rowSet.GetValueOrDefault<Schema::Columns::Family>(0);
auto defaultKind = rowSet.GetValue<Schema::Columns::DefaultKind>();
auto defaultValue = rowSet.GetValue<Schema::Columns::DefaultValue>();
auto notNull = rowSet.GetValueOrDefault<Schema::Columns::NotNull>(false);
-
- columnRows.emplace_back(pathId, colId,
+
+ columnRows.emplace_back(pathId, colId,
colName, typeId, keyOrder, createVersion, deleteVersion,
family, defaultKind, defaultValue, notNull);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- {
- auto rowSet = db.Table<Schema::MigratedColumns>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- TPathId pathId = TPathId(
- rowSet.GetValue<Schema::MigratedColumns::OwnerPathId>(),
- rowSet.GetValue<Schema::MigratedColumns::LocalPathId>());
-
- ui32 colId = rowSet.GetValue<Schema::MigratedColumns::ColId>();
- TString colName = rowSet.GetValue<Schema::MigratedColumns::ColName>();
- NScheme::TTypeId typeId = (NScheme::TTypeId)rowSet.GetValue<Schema::MigratedColumns::ColType>();
- ui32 keyOrder = rowSet.GetValue<Schema::MigratedColumns::ColKeyOrder>();
- ui64 createVersion = rowSet.GetValueOrDefault<Schema::MigratedColumns::CreateVersion>(0);
- ui64 deleteVersion = rowSet.GetValueOrDefault<Schema::MigratedColumns::DeleteVersion>(-1);
- ui32 family = rowSet.GetValueOrDefault<Schema::MigratedColumns::Family>(0);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ {
+ auto rowSet = db.Table<Schema::MigratedColumns>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ TPathId pathId = TPathId(
+ rowSet.GetValue<Schema::MigratedColumns::OwnerPathId>(),
+ rowSet.GetValue<Schema::MigratedColumns::LocalPathId>());
+
+ ui32 colId = rowSet.GetValue<Schema::MigratedColumns::ColId>();
+ TString colName = rowSet.GetValue<Schema::MigratedColumns::ColName>();
+ NScheme::TTypeId typeId = (NScheme::TTypeId)rowSet.GetValue<Schema::MigratedColumns::ColType>();
+ ui32 keyOrder = rowSet.GetValue<Schema::MigratedColumns::ColKeyOrder>();
+ ui64 createVersion = rowSet.GetValueOrDefault<Schema::MigratedColumns::CreateVersion>(0);
+ ui64 deleteVersion = rowSet.GetValueOrDefault<Schema::MigratedColumns::DeleteVersion>(-1);
+ ui32 family = rowSet.GetValueOrDefault<Schema::MigratedColumns::Family>(0);
auto defaultKind = rowSet.GetValue<Schema::MigratedColumns::DefaultKind>();
auto defaultValue = rowSet.GetValue<Schema::MigratedColumns::DefaultValue>();
auto notNull = rowSet.GetValueOrDefault<Schema::MigratedColumns::NotNull>(false);
-
- columnRows.emplace_back(pathId, colId,
+
+ columnRows.emplace_back(pathId, colId,
colName, typeId, keyOrder, createVersion, deleteVersion,
family, defaultKind, defaultValue, notNull);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- bool LoadColumnsAlters(NIceDb::TNiceDb& db, TColumnRows& columnRows) const {
- {
- auto rowSet = db.Table<Schema::ColumnAlters>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- TPathId pathId = Self->MakeLocalId(rowSet.GetValue<Schema::ColumnAlters::TabId>());
-
- ui32 colId = rowSet.GetValue<Schema::ColumnAlters::ColId>();
- TString colName = rowSet.GetValue<Schema::ColumnAlters::ColName>();
- NScheme::TTypeId typeId = (NScheme::TTypeId)rowSet.GetValue<Schema::ColumnAlters::ColType>();
- ui32 keyOrder = rowSet.GetValue<Schema::ColumnAlters::ColKeyOrder>();
- ui64 createVersion = rowSet.GetValueOrDefault<Schema::ColumnAlters::CreateVersion>(0);
- ui64 deleteVersion = rowSet.GetValueOrDefault<Schema::ColumnAlters::DeleteVersion>(-1);
- ui32 family = rowSet.GetValueOrDefault<Schema::ColumnAlters::Family>(0);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ bool LoadColumnsAlters(NIceDb::TNiceDb& db, TColumnRows& columnRows) const {
+ {
+ auto rowSet = db.Table<Schema::ColumnAlters>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ TPathId pathId = Self->MakeLocalId(rowSet.GetValue<Schema::ColumnAlters::TabId>());
+
+ ui32 colId = rowSet.GetValue<Schema::ColumnAlters::ColId>();
+ TString colName = rowSet.GetValue<Schema::ColumnAlters::ColName>();
+ NScheme::TTypeId typeId = (NScheme::TTypeId)rowSet.GetValue<Schema::ColumnAlters::ColType>();
+ ui32 keyOrder = rowSet.GetValue<Schema::ColumnAlters::ColKeyOrder>();
+ ui64 createVersion = rowSet.GetValueOrDefault<Schema::ColumnAlters::CreateVersion>(0);
+ ui64 deleteVersion = rowSet.GetValueOrDefault<Schema::ColumnAlters::DeleteVersion>(-1);
+ ui32 family = rowSet.GetValueOrDefault<Schema::ColumnAlters::Family>(0);
auto defaultKind = rowSet.GetValue<Schema::ColumnAlters::DefaultKind>();
auto defaultValue = rowSet.GetValue<Schema::ColumnAlters::DefaultValue>();
auto notNull = rowSet.GetValueOrDefault<Schema::ColumnAlters::NotNull>(false);
-
- columnRows.emplace_back(pathId, colId,
+
+ columnRows.emplace_back(pathId, colId,
colName, typeId, keyOrder, createVersion, deleteVersion,
family, defaultKind, defaultValue, notNull);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- {
- auto rowSet = db.Table<Schema::MigratedColumnAlters>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- TPathId pathId = TPathId(
- rowSet.GetValue<Schema::MigratedColumnAlters::OwnerPathId>(),
- rowSet.GetValue<Schema::MigratedColumnAlters::LocalPathId>());
-
- ui32 colId = rowSet.GetValue<Schema::MigratedColumnAlters::ColId>();
- TString colName = rowSet.GetValue<Schema::MigratedColumnAlters::ColName>();
- NScheme::TTypeId typeId = (NScheme::TTypeId)rowSet.GetValue<Schema::MigratedColumnAlters::ColType>();
- ui32 keyOrder = rowSet.GetValue<Schema::MigratedColumnAlters::ColKeyOrder>();
- ui64 createVersion = rowSet.GetValueOrDefault<Schema::MigratedColumnAlters::CreateVersion>(0);
- ui64 deleteVersion = rowSet.GetValueOrDefault<Schema::MigratedColumnAlters::DeleteVersion>(-1);
- ui32 family = rowSet.GetValueOrDefault<Schema::MigratedColumnAlters::Family>(0);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ {
+ auto rowSet = db.Table<Schema::MigratedColumnAlters>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ TPathId pathId = TPathId(
+ rowSet.GetValue<Schema::MigratedColumnAlters::OwnerPathId>(),
+ rowSet.GetValue<Schema::MigratedColumnAlters::LocalPathId>());
+
+ ui32 colId = rowSet.GetValue<Schema::MigratedColumnAlters::ColId>();
+ TString colName = rowSet.GetValue<Schema::MigratedColumnAlters::ColName>();
+ NScheme::TTypeId typeId = (NScheme::TTypeId)rowSet.GetValue<Schema::MigratedColumnAlters::ColType>();
+ ui32 keyOrder = rowSet.GetValue<Schema::MigratedColumnAlters::ColKeyOrder>();
+ ui64 createVersion = rowSet.GetValueOrDefault<Schema::MigratedColumnAlters::CreateVersion>(0);
+ ui64 deleteVersion = rowSet.GetValueOrDefault<Schema::MigratedColumnAlters::DeleteVersion>(-1);
+ ui32 family = rowSet.GetValueOrDefault<Schema::MigratedColumnAlters::Family>(0);
auto defaultKind = rowSet.GetValue<Schema::MigratedColumnAlters::DefaultKind>();
auto defaultValue = rowSet.GetValue<Schema::MigratedColumnAlters::DefaultValue>();
auto notNull = rowSet.GetValueOrDefault<Schema::MigratedColumnAlters::NotNull>(false);
-
- columnRows.emplace_back(pathId, colId,
+
+ columnRows.emplace_back(pathId, colId,
colName, typeId, keyOrder, createVersion, deleteVersion,
family, defaultKind, defaultValue, notNull);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- return true;
- }
-
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
typedef std::tuple<TPathId, ui64, TString, TShardIdx, ui64, ui64> TTablePartitionRec;
- typedef TDeque<TTablePartitionRec> TTablePartitionsRows;
-
- bool LoadTablePartitions(NIceDb::TNiceDb& db, TTablePartitionsRows& partitionsRows) const {
- {
- auto rowSet = db.Table<Schema::TablePartitions>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- TPathId pathId = Self->MakeLocalId(rowSet.GetValue<Schema::TablePartitions::TabId>());
- ui64 id = rowSet.GetValue<Schema::TablePartitions::Id>();
- TString rangeEnd = rowSet.GetValue<Schema::TablePartitions::RangeEnd>();
- TShardIdx datashardIdx = Self->MakeLocalId(rowSet.GetValue<Schema::TablePartitions::DatashardIdx>());
+ typedef TDeque<TTablePartitionRec> TTablePartitionsRows;
+
+ bool LoadTablePartitions(NIceDb::TNiceDb& db, TTablePartitionsRows& partitionsRows) const {
+ {
+ auto rowSet = db.Table<Schema::TablePartitions>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ TPathId pathId = Self->MakeLocalId(rowSet.GetValue<Schema::TablePartitions::TabId>());
+ ui64 id = rowSet.GetValue<Schema::TablePartitions::Id>();
+ TString rangeEnd = rowSet.GetValue<Schema::TablePartitions::RangeEnd>();
+ TShardIdx datashardIdx = Self->MakeLocalId(rowSet.GetValue<Schema::TablePartitions::DatashardIdx>());
ui64 lastCondErase = rowSet.GetValueOrDefault<Schema::TablePartitions::LastCondErase>(0);
ui64 nextCondErase = rowSet.GetValueOrDefault<Schema::TablePartitions::NextCondErase>(0);
-
+
partitionsRows.emplace_back(pathId, id, rangeEnd, datashardIdx, lastCondErase, nextCondErase);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- {
- auto rowSet = db.Table<Schema::MigratedTablePartitions>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- TPathId pathId = TPathId(
- rowSet.GetValue<Schema::MigratedTablePartitions::OwnerPathId>(),
- rowSet.GetValue<Schema::MigratedTablePartitions::LocalPathId>());
- ui64 id = rowSet.GetValue<Schema::MigratedTablePartitions::Id>();
- TString rangeEnd = rowSet.GetValue<Schema::MigratedTablePartitions::RangeEnd>();
- TShardIdx datashardIdx = TShardIdx(rowSet.GetValue<Schema::MigratedTablePartitions::OwnerShardIdx>(),
- rowSet.GetValue<Schema::MigratedTablePartitions::LocalShardIdx>());
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ {
+ auto rowSet = db.Table<Schema::MigratedTablePartitions>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ TPathId pathId = TPathId(
+ rowSet.GetValue<Schema::MigratedTablePartitions::OwnerPathId>(),
+ rowSet.GetValue<Schema::MigratedTablePartitions::LocalPathId>());
+ ui64 id = rowSet.GetValue<Schema::MigratedTablePartitions::Id>();
+ TString rangeEnd = rowSet.GetValue<Schema::MigratedTablePartitions::RangeEnd>();
+ TShardIdx datashardIdx = TShardIdx(rowSet.GetValue<Schema::MigratedTablePartitions::OwnerShardIdx>(),
+ rowSet.GetValue<Schema::MigratedTablePartitions::LocalShardIdx>());
ui64 lastCondErase = rowSet.GetValueOrDefault<Schema::MigratedTablePartitions::LastCondErase>(0);
ui64 nextCondErase = rowSet.GetValueOrDefault<Schema::MigratedTablePartitions::NextCondErase>(0);
-
+
partitionsRows.emplace_back(pathId, id, rangeEnd, datashardIdx, lastCondErase, nextCondErase);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- typedef std::tuple<TShardIdx, TString> TTableShardPartitionConfigRec;
- typedef TDeque<TTableShardPartitionConfigRec> TTableShardPartitionConfigRows;
-
- bool LoadTableShardPartitionConfigs(NIceDb::TNiceDb& db, TTableShardPartitionConfigRows& partitionsRows) const {
- {
- auto rowSet = db.Table<Schema::TableShardPartitionConfigs>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- TShardIdx shardIdx = Self->MakeLocalId(rowSet.GetValue<Schema::TableShardPartitionConfigs::ShardIdx>());
- TString data = rowSet.GetValue<Schema::TableShardPartitionConfigs::PartitionConfig>();
-
- partitionsRows.emplace_back(shardIdx, data);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- {
- auto rowSet = db.Table<Schema::MigratedTableShardPartitionConfigs>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- TShardIdx shardIdx = TShardIdx(
- rowSet.GetValue<Schema::MigratedTableShardPartitionConfigs::OwnerShardIdx>(),
- rowSet.GetValue<Schema::MigratedTableShardPartitionConfigs::LocalShardIdx>());
- TString data = rowSet.GetValue<Schema::MigratedTableShardPartitionConfigs::PartitionConfig>();
-
- partitionsRows.emplace_back(shardIdx, data);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- typedef std::tuple<TTxId, TPathId, ui64> TPublicationRec;
- typedef TDeque<TPublicationRec> TPublicationsRows;
-
- bool LoadPublications(NIceDb::TNiceDb& db, TPublicationsRows& publicationsRows) const {
- {
- auto rowSet = db.Table<Schema::PublishingPaths>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- TTxId txId = rowSet.GetValue<Schema::PublishingPaths::TxId>();
- TPathId pathId = Self->MakeLocalId(rowSet.GetValue<Schema::PublishingPaths::PathId>());
- ui64 version = rowSet.GetValue<Schema::PublishingPaths::Version>();
-
- publicationsRows.emplace_back(txId, pathId, version);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- {
- auto rowSet = db.Table<Schema::MigratedPublishingPaths>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- TTxId txId = rowSet.GetValue<Schema::MigratedPublishingPaths::TxId>();
- TPathId pathId = TPathId(
- rowSet.GetValue<Schema::MigratedPublishingPaths::PathOwnerId>(),
- rowSet.GetValue<Schema::MigratedPublishingPaths::LocalPathId>());
- ui64 version = rowSet.GetValue<Schema::MigratedPublishingPaths::Version>();
-
- publicationsRows.emplace_back(txId, pathId, version);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- typedef std::tuple<TShardIdx> TShardsToDeleteRec;
- typedef TDeque<TShardsToDeleteRec> TShardsToDeleteRows;
-
- bool LoadShardsToDelete(NIceDb::TNiceDb& db, TShardsToDeleteRows& shardsToDelete) const {
- {
- auto rowSet = db.Table<Schema::ShardsToDelete>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- TShardIdx shardIdx = Self->MakeLocalId(rowSet.GetValue<Schema::ShardsToDelete::ShardIdx>());
-
- shardsToDelete.emplace_back(shardIdx);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- {
- auto rowSet = db.Table<Schema::MigratedShardsToDelete>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- TShardIdx shardIdx = TShardIdx(
- rowSet.GetValue<Schema::MigratedShardsToDelete::ShardOwnerId>(),
- rowSet.GetValue<Schema::MigratedShardsToDelete::ShardLocalIdx>());
-
- shardsToDelete.emplace_back(shardIdx);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- typedef std::tuple<TOperationId, TShardIdx, TTxState::ETxState> TTxShardRec;
- typedef TVector<TTxShardRec> TTxShardsRows;
-
- bool LoadTxShards(NIceDb::TNiceDb& db, TTxShardsRows& txShards) const {
- {
- auto rowset = db.Table<Schema::TxShards>().Range().Select();
- if (!rowset.IsReady()) {
- return false;
- }
-
- while (!rowset.EndOfSet()) {
- auto operationId = TOperationId(rowset.GetValue<Schema::TxShards::TxId>(), 0);
- TShardIdx shardIdx = Self->MakeLocalId(rowset.GetValue<Schema::TxShards::ShardIdx>());
- TTxState::ETxState operation = (TTxState::ETxState)rowset.GetValue<Schema::TxShards::Operation>();
-
- txShards.emplace_back(operationId, shardIdx, operation);
-
- if (!rowset.Next()) {
- return false;
- }
- }
- }
- {
- auto rowset = db.Table<Schema::TxShardsV2>().Range().Select();
- if (!rowset.IsReady()) {
- return false;
- }
-
- while (!rowset.EndOfSet()) {
- auto operationId = TOperationId(rowset.GetValue<Schema::TxShardsV2::TxId>(),
- rowset.GetValue<Schema::TxShardsV2::TxPartId>());
- TShardIdx shardIdx = Self->MakeLocalId(rowset.GetValue<Schema::TxShardsV2::ShardIdx>());
- TTxState::ETxState operation = (TTxState::ETxState)rowset.GetValue<Schema::TxShardsV2::Operation>();
-
- txShards.emplace_back(operationId, shardIdx, operation);
-
- if (!rowset.Next()) {
- return false;
- }
- }
- }
-
- {
- auto rowset = db.Table<Schema::MigratedTxShards>().Range().Select();
- if (!rowset.IsReady()) {
- return false;
- }
-
- while (!rowset.EndOfSet()) {
- auto operationId = TOperationId(rowset.GetValue<Schema::MigratedTxShards::TxId>(),
- rowset.GetValue<Schema::MigratedTxShards::TxPartId>());
- TShardIdx shardIdx = TShardIdx(rowset.GetValue<Schema::MigratedTxShards::ShardOwnerId>(),
- rowset.GetValue<Schema::MigratedTxShards::ShardLocalIdx>());
- TTxState::ETxState operation = (TTxState::ETxState)rowset.GetValue<Schema::MigratedTxShards::Operation>();
-
- txShards.emplace_back(operationId, shardIdx, operation);
-
- if (!rowset.Next()) {
- return false;
- }
- }
- }
-
- Sort(txShards);
- auto last = Unique(txShards.begin(), txShards.end());
- txShards.erase(last, txShards.end());
-
- return true;
- }
-
- typedef std::tuple<TShardIdx, TTabletId, TPathId, TTxId, TTabletTypes::EType> TShardsRec;
- typedef TDeque<TShardsRec> TShardsRows;
-
- bool LoadShards(NIceDb::TNiceDb& db, TShardsRows& shards) const {
- {
- auto rowSet = db.Table<Schema::Shards>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- auto shardIdx = Self->MakeLocalId(rowSet.GetValue<Schema::Shards::ShardIdx>());
- auto tabletID = rowSet.GetValue<Schema::Shards::TabletId>();
- auto pathId = TPathId(rowSet.GetValueOrDefault<Schema::Shards::OwnerPathId>(Self->TabletID()),
- rowSet.GetValue<Schema::Shards::PathId>());
- auto currentTxId = rowSet.GetValueOrDefault<Schema::Shards::LastTxId>(InvalidTxId);
- auto tabletType = rowSet.GetValue<Schema::Shards::TabletType>();
-
- shards.emplace_back(shardIdx, tabletID, pathId, currentTxId, tabletType);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- {
- auto rowSet = db.Table<Schema::MigratedShards>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- auto shardIdx = TShardIdx(rowSet.GetValue<Schema::MigratedShards::OwnerShardId>(),
- rowSet.GetValue<Schema::MigratedShards::LocalShardId>());
- auto tabletID = rowSet.GetValue<Schema::MigratedShards::TabletId>();
- auto pathId = TPathId(rowSet.GetValue<Schema::MigratedShards::OwnerPathId>(),
- rowSet.GetValue<Schema::MigratedShards::LocalPathId>());
- auto currentTxId = rowSet.GetValueOrDefault<Schema::MigratedShards::LastTxId>(InvalidTxId);
- auto tabletType = rowSet.GetValue<Schema::MigratedShards::TabletType>();
-
- shards.emplace_back(shardIdx, tabletID, pathId, currentTxId, tabletType);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- return true;
- }
-
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ typedef std::tuple<TShardIdx, TString> TTableShardPartitionConfigRec;
+ typedef TDeque<TTableShardPartitionConfigRec> TTableShardPartitionConfigRows;
+
+ bool LoadTableShardPartitionConfigs(NIceDb::TNiceDb& db, TTableShardPartitionConfigRows& partitionsRows) const {
+ {
+ auto rowSet = db.Table<Schema::TableShardPartitionConfigs>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ TShardIdx shardIdx = Self->MakeLocalId(rowSet.GetValue<Schema::TableShardPartitionConfigs::ShardIdx>());
+ TString data = rowSet.GetValue<Schema::TableShardPartitionConfigs::PartitionConfig>();
+
+ partitionsRows.emplace_back(shardIdx, data);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ {
+ auto rowSet = db.Table<Schema::MigratedTableShardPartitionConfigs>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ TShardIdx shardIdx = TShardIdx(
+ rowSet.GetValue<Schema::MigratedTableShardPartitionConfigs::OwnerShardIdx>(),
+ rowSet.GetValue<Schema::MigratedTableShardPartitionConfigs::LocalShardIdx>());
+ TString data = rowSet.GetValue<Schema::MigratedTableShardPartitionConfigs::PartitionConfig>();
+
+ partitionsRows.emplace_back(shardIdx, data);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ typedef std::tuple<TTxId, TPathId, ui64> TPublicationRec;
+ typedef TDeque<TPublicationRec> TPublicationsRows;
+
+ bool LoadPublications(NIceDb::TNiceDb& db, TPublicationsRows& publicationsRows) const {
+ {
+ auto rowSet = db.Table<Schema::PublishingPaths>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ TTxId txId = rowSet.GetValue<Schema::PublishingPaths::TxId>();
+ TPathId pathId = Self->MakeLocalId(rowSet.GetValue<Schema::PublishingPaths::PathId>());
+ ui64 version = rowSet.GetValue<Schema::PublishingPaths::Version>();
+
+ publicationsRows.emplace_back(txId, pathId, version);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ {
+ auto rowSet = db.Table<Schema::MigratedPublishingPaths>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ TTxId txId = rowSet.GetValue<Schema::MigratedPublishingPaths::TxId>();
+ TPathId pathId = TPathId(
+ rowSet.GetValue<Schema::MigratedPublishingPaths::PathOwnerId>(),
+ rowSet.GetValue<Schema::MigratedPublishingPaths::LocalPathId>());
+ ui64 version = rowSet.GetValue<Schema::MigratedPublishingPaths::Version>();
+
+ publicationsRows.emplace_back(txId, pathId, version);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ typedef std::tuple<TShardIdx> TShardsToDeleteRec;
+ typedef TDeque<TShardsToDeleteRec> TShardsToDeleteRows;
+
+ bool LoadShardsToDelete(NIceDb::TNiceDb& db, TShardsToDeleteRows& shardsToDelete) const {
+ {
+ auto rowSet = db.Table<Schema::ShardsToDelete>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ TShardIdx shardIdx = Self->MakeLocalId(rowSet.GetValue<Schema::ShardsToDelete::ShardIdx>());
+
+ shardsToDelete.emplace_back(shardIdx);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ {
+ auto rowSet = db.Table<Schema::MigratedShardsToDelete>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ TShardIdx shardIdx = TShardIdx(
+ rowSet.GetValue<Schema::MigratedShardsToDelete::ShardOwnerId>(),
+ rowSet.GetValue<Schema::MigratedShardsToDelete::ShardLocalIdx>());
+
+ shardsToDelete.emplace_back(shardIdx);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ typedef std::tuple<TOperationId, TShardIdx, TTxState::ETxState> TTxShardRec;
+ typedef TVector<TTxShardRec> TTxShardsRows;
+
+ bool LoadTxShards(NIceDb::TNiceDb& db, TTxShardsRows& txShards) const {
+ {
+ auto rowset = db.Table<Schema::TxShards>().Range().Select();
+ if (!rowset.IsReady()) {
+ return false;
+ }
+
+ while (!rowset.EndOfSet()) {
+ auto operationId = TOperationId(rowset.GetValue<Schema::TxShards::TxId>(), 0);
+ TShardIdx shardIdx = Self->MakeLocalId(rowset.GetValue<Schema::TxShards::ShardIdx>());
+ TTxState::ETxState operation = (TTxState::ETxState)rowset.GetValue<Schema::TxShards::Operation>();
+
+ txShards.emplace_back(operationId, shardIdx, operation);
+
+ if (!rowset.Next()) {
+ return false;
+ }
+ }
+ }
+ {
+ auto rowset = db.Table<Schema::TxShardsV2>().Range().Select();
+ if (!rowset.IsReady()) {
+ return false;
+ }
+
+ while (!rowset.EndOfSet()) {
+ auto operationId = TOperationId(rowset.GetValue<Schema::TxShardsV2::TxId>(),
+ rowset.GetValue<Schema::TxShardsV2::TxPartId>());
+ TShardIdx shardIdx = Self->MakeLocalId(rowset.GetValue<Schema::TxShardsV2::ShardIdx>());
+ TTxState::ETxState operation = (TTxState::ETxState)rowset.GetValue<Schema::TxShardsV2::Operation>();
+
+ txShards.emplace_back(operationId, shardIdx, operation);
+
+ if (!rowset.Next()) {
+ return false;
+ }
+ }
+ }
+
+ {
+ auto rowset = db.Table<Schema::MigratedTxShards>().Range().Select();
+ if (!rowset.IsReady()) {
+ return false;
+ }
+
+ while (!rowset.EndOfSet()) {
+ auto operationId = TOperationId(rowset.GetValue<Schema::MigratedTxShards::TxId>(),
+ rowset.GetValue<Schema::MigratedTxShards::TxPartId>());
+ TShardIdx shardIdx = TShardIdx(rowset.GetValue<Schema::MigratedTxShards::ShardOwnerId>(),
+ rowset.GetValue<Schema::MigratedTxShards::ShardLocalIdx>());
+ TTxState::ETxState operation = (TTxState::ETxState)rowset.GetValue<Schema::MigratedTxShards::Operation>();
+
+ txShards.emplace_back(operationId, shardIdx, operation);
+
+ if (!rowset.Next()) {
+ return false;
+ }
+ }
+ }
+
+ Sort(txShards);
+ auto last = Unique(txShards.begin(), txShards.end());
+ txShards.erase(last, txShards.end());
+
+ return true;
+ }
+
+ typedef std::tuple<TShardIdx, TTabletId, TPathId, TTxId, TTabletTypes::EType> TShardsRec;
+ typedef TDeque<TShardsRec> TShardsRows;
+
+ bool LoadShards(NIceDb::TNiceDb& db, TShardsRows& shards) const {
+ {
+ auto rowSet = db.Table<Schema::Shards>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ auto shardIdx = Self->MakeLocalId(rowSet.GetValue<Schema::Shards::ShardIdx>());
+ auto tabletID = rowSet.GetValue<Schema::Shards::TabletId>();
+ auto pathId = TPathId(rowSet.GetValueOrDefault<Schema::Shards::OwnerPathId>(Self->TabletID()),
+ rowSet.GetValue<Schema::Shards::PathId>());
+ auto currentTxId = rowSet.GetValueOrDefault<Schema::Shards::LastTxId>(InvalidTxId);
+ auto tabletType = rowSet.GetValue<Schema::Shards::TabletType>();
+
+ shards.emplace_back(shardIdx, tabletID, pathId, currentTxId, tabletType);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ {
+ auto rowSet = db.Table<Schema::MigratedShards>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ auto shardIdx = TShardIdx(rowSet.GetValue<Schema::MigratedShards::OwnerShardId>(),
+ rowSet.GetValue<Schema::MigratedShards::LocalShardId>());
+ auto tabletID = rowSet.GetValue<Schema::MigratedShards::TabletId>();
+ auto pathId = TPathId(rowSet.GetValue<Schema::MigratedShards::OwnerPathId>(),
+ rowSet.GetValue<Schema::MigratedShards::LocalPathId>());
+ auto currentTxId = rowSet.GetValueOrDefault<Schema::MigratedShards::LastTxId>(InvalidTxId);
+ auto tabletType = rowSet.GetValue<Schema::MigratedShards::TabletType>();
+
+ shards.emplace_back(shardIdx, tabletID, pathId, currentTxId, tabletType);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
typedef std::tuple<TPathId, TString, TString, TString, TString, bool, TString, ui32> TBackupSettingsRec;
- typedef TDeque<TBackupSettingsRec> TBackupSettingsRows;
-
- bool LoadBackupSettings(NIceDb::TNiceDb& db, TBackupSettingsRows& settings) const {
- {
- auto rowSet = db.Table<Schema::BackupSettings>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- auto pathId = Self->MakeLocalId(rowSet.GetValue<Schema::BackupSettings::PathId>());
- auto tableName = rowSet.GetValue<Schema::BackupSettings::TableName>();
+ typedef TDeque<TBackupSettingsRec> TBackupSettingsRows;
+
+ bool LoadBackupSettings(NIceDb::TNiceDb& db, TBackupSettingsRows& settings) const {
+ {
+ auto rowSet = db.Table<Schema::BackupSettings>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ auto pathId = Self->MakeLocalId(rowSet.GetValue<Schema::BackupSettings::PathId>());
+ auto tableName = rowSet.GetValue<Schema::BackupSettings::TableName>();
auto ytSettings = rowSet.GetValueOrDefault<Schema::BackupSettings::YTSettings>("");
auto s3Settings = rowSet.GetValueOrDefault<Schema::BackupSettings::S3Settings>("");
auto scanSettings = rowSet.GetValueOrDefault<Schema::BackupSettings::ScanSettings>("");
auto needToBill = rowSet.GetValueOrDefault<Schema::BackupSettings::NeedToBill>(true);
auto tableDesc = rowSet.GetValueOrDefault<Schema::BackupSettings::TableDescription>("");
auto nRetries = rowSet.GetValueOrDefault<Schema::BackupSettings::NumberOfRetries>(0);
-
+
settings.emplace_back(pathId, tableName, ytSettings, s3Settings, scanSettings, needToBill, tableDesc, nRetries);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- {
- auto rowSet = db.Table<Schema::MigratedBackupSettings>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- auto pathId = TPathId(rowSet.GetValue<Schema::MigratedBackupSettings::OwnerPathId>(),
- rowSet.GetValue<Schema::MigratedBackupSettings::LocalPathId>());
- auto tableName = rowSet.GetValue<Schema::MigratedBackupSettings::TableName>();
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ {
+ auto rowSet = db.Table<Schema::MigratedBackupSettings>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ auto pathId = TPathId(rowSet.GetValue<Schema::MigratedBackupSettings::OwnerPathId>(),
+ rowSet.GetValue<Schema::MigratedBackupSettings::LocalPathId>());
+ auto tableName = rowSet.GetValue<Schema::MigratedBackupSettings::TableName>();
auto ytSettings = rowSet.GetValueOrDefault<Schema::MigratedBackupSettings::YTSettings>("");
auto s3Settings = rowSet.GetValueOrDefault<Schema::MigratedBackupSettings::S3Settings>("");
auto scanSettings = rowSet.GetValueOrDefault<Schema::MigratedBackupSettings::ScanSettings>("");
auto needToBill = rowSet.GetValueOrDefault<Schema::MigratedBackupSettings::NeedToBill>(true);
auto tableDesc = rowSet.GetValueOrDefault<Schema::MigratedBackupSettings::TableDescription>("");
auto nRetries = rowSet.GetValueOrDefault<Schema::MigratedBackupSettings::NumberOfRetries>(0);
-
+
settings.emplace_back(pathId, tableName, ytSettings, s3Settings, scanSettings, needToBill, tableDesc, nRetries);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- return true;
- }
-
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
typedef std::tuple<TPathId, TTxId, ui64, ui32, ui32, ui64, ui64, ui8> TCompletedBackupRestoreRec;
typedef TDeque<TCompletedBackupRestoreRec> TCompletedBackupRestoreRows;
-
+
bool LoadBackupRestoreHistory(NIceDb::TNiceDb& db, TCompletedBackupRestoreRows& history) const {
- {
- auto rowSet = db.Table<Schema::CompletedBackups>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- auto pathId = Self->MakeLocalId(rowSet.GetValue<Schema::CompletedBackups::PathId>());
- auto txId = rowSet.GetValue<Schema::CompletedBackups::TxId>();
- auto completeTime = rowSet.GetValue<Schema::CompletedBackups::DateTimeOfCompletion>();
-
- auto successShardsCount = rowSet.GetValue<Schema::CompletedBackups::SuccessShardCount>();
- auto totalShardCount = rowSet.GetValue<Schema::CompletedBackups::TotalShardCount>();
- auto startTime = rowSet.GetValue<Schema::CompletedBackups::StartTime>();
- auto dataSize = rowSet.GetValue<Schema::CompletedBackups::DataTotalSize>();
+ {
+ auto rowSet = db.Table<Schema::CompletedBackups>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ auto pathId = Self->MakeLocalId(rowSet.GetValue<Schema::CompletedBackups::PathId>());
+ auto txId = rowSet.GetValue<Schema::CompletedBackups::TxId>();
+ auto completeTime = rowSet.GetValue<Schema::CompletedBackups::DateTimeOfCompletion>();
+
+ auto successShardsCount = rowSet.GetValue<Schema::CompletedBackups::SuccessShardCount>();
+ auto totalShardCount = rowSet.GetValue<Schema::CompletedBackups::TotalShardCount>();
+ auto startTime = rowSet.GetValue<Schema::CompletedBackups::StartTime>();
+ auto dataSize = rowSet.GetValue<Schema::CompletedBackups::DataTotalSize>();
auto kind = rowSet.GetValueOrDefault<Schema::CompletedBackups::Kind>(0);
-
+
history.emplace_back(pathId, txId, completeTime, successShardsCount, totalShardCount, startTime, dataSize, kind);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- {
- auto rowSet = db.Table<Schema::MigratedCompletedBackups>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- auto pathId = TPathId(rowSet.GetValue<Schema::MigratedCompletedBackups::OwnerPathId>(),
- rowSet.GetValue<Schema::MigratedCompletedBackups::LocalPathId>());
- auto txId = rowSet.GetValue<Schema::MigratedCompletedBackups::TxId>();
- auto completeTime = rowSet.GetValue<Schema::MigratedCompletedBackups::DateTimeOfCompletion>();
-
- auto successShardsCount = rowSet.GetValue<Schema::MigratedCompletedBackups::SuccessShardCount>();
- auto totalShardCount = rowSet.GetValue<Schema::MigratedCompletedBackups::TotalShardCount>();
- auto startTime = rowSet.GetValue<Schema::MigratedCompletedBackups::StartTime>();
- auto dataSize = rowSet.GetValue<Schema::MigratedCompletedBackups::DataTotalSize>();
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ {
+ auto rowSet = db.Table<Schema::MigratedCompletedBackups>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ auto pathId = TPathId(rowSet.GetValue<Schema::MigratedCompletedBackups::OwnerPathId>(),
+ rowSet.GetValue<Schema::MigratedCompletedBackups::LocalPathId>());
+ auto txId = rowSet.GetValue<Schema::MigratedCompletedBackups::TxId>();
+ auto completeTime = rowSet.GetValue<Schema::MigratedCompletedBackups::DateTimeOfCompletion>();
+
+ auto successShardsCount = rowSet.GetValue<Schema::MigratedCompletedBackups::SuccessShardCount>();
+ auto totalShardCount = rowSet.GetValue<Schema::MigratedCompletedBackups::TotalShardCount>();
+ auto startTime = rowSet.GetValue<Schema::MigratedCompletedBackups::StartTime>();
+ auto dataSize = rowSet.GetValue<Schema::MigratedCompletedBackups::DataTotalSize>();
auto kind = rowSet.GetValueOrDefault<Schema::MigratedCompletedBackups::Kind>(0);
-
+
history.emplace_back(pathId, txId, completeTime, successShardsCount, totalShardCount, startTime, dataSize, kind);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- return true;
- }
-
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
typedef std::tuple<TTxId, TShardIdx, bool, TString, ui64, ui64> TShardBackupStatusRec;
- typedef TDeque<TShardBackupStatusRec> TShardBackupStatusRows;
-
+ typedef TDeque<TShardBackupStatusRec> TShardBackupStatusRows;
+
template <typename T, typename U, typename V>
bool LoadBackupStatusesImpl(TShardBackupStatusRows& statuses,
T& byShardBackupStatus, U& byMigratedShardBackupStatus, V& byTxShardStatus) const {
- {
+ {
T& rowSet = byShardBackupStatus;
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
auto txId = rowSet.template GetValue<Schema::ShardBackupStatus::TxId>();
auto shardIdx = Self->MakeLocalId(rowSet.template GetValue<Schema::ShardBackupStatus::ShardIdx>());
auto explain = rowSet.template GetValue<Schema::ShardBackupStatus::Explain>();
-
+
statuses.emplace_back(txId, shardIdx, false, explain, 0, 0);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- {
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ {
U& rowSet = byMigratedShardBackupStatus;
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
auto txId = rowSet.template GetValue<Schema::MigratedShardBackupStatus::TxId>();
auto shardIdx = TShardIdx(rowSet.template GetValue<Schema::MigratedShardBackupStatus::OwnerShardId>(),
rowSet.template GetValue<Schema::MigratedShardBackupStatus::LocalShardId>());
auto explain = rowSet.template GetValue<Schema::MigratedShardBackupStatus::Explain>();
-
+
statuses.emplace_back(txId, shardIdx, false, explain, 0, 0);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
{
V& rowSet = byTxShardStatus;
if (!rowSet.IsReady()) {
@@ -1004,9 +1004,9 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
}
}
- return true;
- }
-
+ return true;
+ }
+
bool LoadBackupStatuses(NIceDb::TNiceDb& db, TShardBackupStatusRows& statuses) const {
auto byShardBackupStatus = db.Table<Schema::ShardBackupStatus>().Range().Select();
auto byMigratedShardBackupStatus = db.Table<Schema::MigratedShardBackupStatus>().Range().Select();
@@ -1015,101 +1015,101 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
return LoadBackupStatusesImpl(statuses, byShardBackupStatus, byMigratedShardBackupStatus, byTxShardStatus);
}
- typedef std::tuple<TPathId, ui64, NKikimrSchemeOp::EIndexType, NKikimrSchemeOp::EIndexState> TTableIndexRec;
- typedef TDeque<TTableIndexRec> TTableIndexRows;
-
- bool LoadTableIndexes(NIceDb::TNiceDb& db, TTableIndexRows& tableIndexes) const {
- {
- auto rowSet = db.Table<Schema::TableIndex>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- auto pathId = Self->MakeLocalId(TLocalPathId(rowSet.GetValue<Schema::TableIndex::PathId>()));
- auto alterVersion = rowSet.GetValue<Schema::TableIndex::AlterVersion>();
- auto type = rowSet.GetValue<Schema::TableIndex::IndexType>();
- auto state = rowSet.GetValue<Schema::TableIndex::State>();
-
- tableIndexes.emplace_back(pathId, alterVersion, type, state);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- {
- auto rowSet = db.Table<Schema::MigratedTableIndex>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- auto pathId = TPathId(TOwnerId(rowSet.GetValue<Schema::MigratedTableIndex::OwnerPathId>()),
- TLocalPathId(rowSet.GetValue<Schema::MigratedTableIndex::LocalPathId>()));
- auto alterVersion = rowSet.GetValue<Schema::MigratedTableIndex::AlterVersion>();
- auto type = rowSet.GetValue<Schema::MigratedTableIndex::IndexType>();
- auto state = rowSet.GetValue<Schema::MigratedTableIndex::State>();
-
- tableIndexes.emplace_back(pathId, alterVersion, type, state);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- return true;
- }
-
+ typedef std::tuple<TPathId, ui64, NKikimrSchemeOp::EIndexType, NKikimrSchemeOp::EIndexState> TTableIndexRec;
+ typedef TDeque<TTableIndexRec> TTableIndexRows;
+
+ bool LoadTableIndexes(NIceDb::TNiceDb& db, TTableIndexRows& tableIndexes) const {
+ {
+ auto rowSet = db.Table<Schema::TableIndex>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ auto pathId = Self->MakeLocalId(TLocalPathId(rowSet.GetValue<Schema::TableIndex::PathId>()));
+ auto alterVersion = rowSet.GetValue<Schema::TableIndex::AlterVersion>();
+ auto type = rowSet.GetValue<Schema::TableIndex::IndexType>();
+ auto state = rowSet.GetValue<Schema::TableIndex::State>();
+
+ tableIndexes.emplace_back(pathId, alterVersion, type, state);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ {
+ auto rowSet = db.Table<Schema::MigratedTableIndex>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ auto pathId = TPathId(TOwnerId(rowSet.GetValue<Schema::MigratedTableIndex::OwnerPathId>()),
+ TLocalPathId(rowSet.GetValue<Schema::MigratedTableIndex::LocalPathId>()));
+ auto alterVersion = rowSet.GetValue<Schema::MigratedTableIndex::AlterVersion>();
+ auto type = rowSet.GetValue<Schema::MigratedTableIndex::IndexType>();
+ auto state = rowSet.GetValue<Schema::MigratedTableIndex::State>();
+
+ tableIndexes.emplace_back(pathId, alterVersion, type, state);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
typedef std::tuple<TPathId, ui64, TString> TTableIndexColRec;
typedef TDeque<TTableIndexColRec> TTableIndexKeyRows;
typedef TDeque<TTableIndexColRec> TTableIndexDataRows;
-
- bool LoadTableIndexeKeys(NIceDb::TNiceDb& db, TTableIndexKeyRows& tableIndexKeys) const {
- {
- auto rowSet = db.Table<Schema::TableIndexKeys>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- auto pathId = Self->MakeLocalId(TLocalPathId(rowSet.GetValue<Schema::TableIndexKeys::PathId>()));
- auto id = rowSet.GetValue<Schema::TableIndexKeys::KeyId>();
- auto name = rowSet.GetValue<Schema::TableIndexKeys::KeyName>();
-
- tableIndexKeys.emplace_back(pathId, id, name);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- {
- auto rowSet = db.Table<Schema::MigratedTableIndexKeys>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- auto pathId = TPathId(rowSet.GetValue<Schema::MigratedTableIndexKeys::OwnerPathId>(),
- rowSet.GetValue<Schema::MigratedTableIndexKeys::LocalPathId>());
- auto id = rowSet.GetValue<Schema::MigratedTableIndexKeys::KeyId>();
- auto name = rowSet.GetValue<Schema::MigratedTableIndexKeys::KeyName>();
-
- tableIndexKeys.emplace_back(pathId, id, name);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- return true;
- }
-
+
+ bool LoadTableIndexeKeys(NIceDb::TNiceDb& db, TTableIndexKeyRows& tableIndexKeys) const {
+ {
+ auto rowSet = db.Table<Schema::TableIndexKeys>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ auto pathId = Self->MakeLocalId(TLocalPathId(rowSet.GetValue<Schema::TableIndexKeys::PathId>()));
+ auto id = rowSet.GetValue<Schema::TableIndexKeys::KeyId>();
+ auto name = rowSet.GetValue<Schema::TableIndexKeys::KeyName>();
+
+ tableIndexKeys.emplace_back(pathId, id, name);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ {
+ auto rowSet = db.Table<Schema::MigratedTableIndexKeys>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ auto pathId = TPathId(rowSet.GetValue<Schema::MigratedTableIndexKeys::OwnerPathId>(),
+ rowSet.GetValue<Schema::MigratedTableIndexKeys::LocalPathId>());
+ auto id = rowSet.GetValue<Schema::MigratedTableIndexKeys::KeyId>();
+ auto name = rowSet.GetValue<Schema::MigratedTableIndexKeys::KeyName>();
+
+ tableIndexKeys.emplace_back(pathId, id, name);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
bool LoadTableIndexDataColumns(NIceDb::TNiceDb& db, TTableIndexDataRows& tableIndexData) const {
auto rowSet = db.Table<Schema::TableIndexDataColumns>().Range().Select();
if (!rowSet.IsReady()) {
@@ -1130,332 +1130,332 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
return true;
}
- typedef std::tuple<TShardIdx, ui32, TString, TString> TChannelBindingRec;
- typedef TDeque<TChannelBindingRec> TChannelBindingRows;
-
- bool LoadChannelBindings(NIceDb::TNiceDb& db, TChannelBindingRows& tableIndexKeys) const {
- {
- auto rowSet = db.Table<Schema::ChannelsBinding>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- auto shardIdx = Self->MakeLocalId(rowSet.GetValue<Schema::ChannelsBinding::ShardId>());
- ui32 channelId = rowSet.GetValue<Schema::ChannelsBinding::ChannelId>();
- TString binding = rowSet.GetValue<Schema::ChannelsBinding::Binding>();
- TString poolName = rowSet.GetValue<Schema::ChannelsBinding::PoolName>();
-
- tableIndexKeys.emplace_back(shardIdx, channelId, binding, poolName);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- {
- auto rowSet = db.Table<Schema::MigratedChannelsBinding>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- auto shardIdx = TShardIdx(rowSet.GetValue<Schema::MigratedChannelsBinding::OwnerShardId>(),
- rowSet.GetValue<Schema::MigratedChannelsBinding::LocalShardId>());
- ui32 channelId = rowSet.GetValue<Schema::MigratedChannelsBinding::ChannelId>();
- TString binding = rowSet.GetValue<Schema::MigratedChannelsBinding::Binding>();
- TString poolName = rowSet.GetValue<Schema::MigratedChannelsBinding::PoolName>();
-
- tableIndexKeys.emplace_back(shardIdx, channelId, binding, poolName);
-
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- typedef std::tuple<TPathId, TString, ui64> TKesusInfosRec;
- typedef TDeque<TKesusInfosRec> TKesusInfosRows;
-
- bool LoadKesusInfos(NIceDb::TNiceDb& db, TKesusInfosRows& kesusInfosData) const {
- {
- auto rowSet = db.Table<Schema::KesusInfos>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- auto pathId = Self->MakeLocalId(rowSet.GetValue<Schema::KesusInfos::PathId>());
- auto config = rowSet.GetValue<Schema::KesusInfos::Config>();
- auto version = rowSet.GetValueOrDefault<Schema::KesusInfos::Version>();
-
- kesusInfosData.emplace_back(pathId, config, version);
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- {
- auto rowSet = db.Table<Schema::MigratedKesusInfos>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- auto pathId = TPathId(rowSet.GetValue<Schema::MigratedKesusInfos::OwnerPathId>(),
- rowSet.GetValue<Schema::MigratedKesusInfos::LocalPathId>());
- auto config = rowSet.GetValue<Schema::MigratedKesusInfos::Config>();
- auto version = rowSet.GetValueOrDefault<Schema::MigratedKesusInfos::Version>();
-
- kesusInfosData.emplace_back(pathId, config, version);
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- typedef std::tuple<TPathId, TString, ui64> TKesusAlterRec;
- typedef TDeque<TKesusAlterRec> TKesusAlterRows;
-
- bool LoadKesusAlters(NIceDb::TNiceDb& db, TKesusAlterRows& kesusAlterData) const {
- {
- auto rowSet = db.Table<Schema::KesusAlters>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- auto pathId = Self->MakeLocalId(rowSet.GetValue<Schema::KesusAlters::PathId>());
- auto config = rowSet.GetValue<Schema::KesusAlters::Config>();
- auto version = rowSet.GetValueOrDefault<Schema::KesusAlters::Version>();
-
- kesusAlterData.emplace_back(pathId, config, version);
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- {
- auto rowSet = db.Table<Schema::MigratedKesusAlters>().Range().Select();
- if (!rowSet.IsReady()) {
- return false;
- }
-
- while (!rowSet.EndOfSet()) {
- auto pathId = TPathId(rowSet.GetValue<Schema::MigratedKesusAlters::OwnerPathId>(),
- rowSet.GetValue<Schema::MigratedKesusAlters::LocalPathId>());
- auto config = rowSet.GetValue<Schema::MigratedKesusAlters::Config>();
- auto version = rowSet.GetValueOrDefault<Schema::MigratedKesusAlters::Version>();
-
- kesusAlterData.emplace_back(pathId, config, version);
- if (!rowSet.Next()) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- bool ReadEverything(TTransactionContext& txc, const TActorContext& ctx) {
- const TOwnerId selfId = Self->TabletID();
-
- Self->Clear();
-
- NIceDb::TNiceDb db(txc.DB);
- if (!db.Precharge<Schema>()) {
- return false;
- }
-
-#define RETURN_IF_NO_PRECHARGED(readIsOk) \
- if (!readIsOk) { \
- return false;\
- }
-
- {
- ui64 initStateVal = (ui64)TTenantInitState::InvalidState;
- RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_TenantInitState, initStateVal, (ui64)TTenantInitState::InvalidState));
- Self->InitState = TTenantInitState::EInitState(initStateVal);
- }
-
- RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_NextPathId, Self->NextLocalPathId));
- RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_NextShardIdx, Self->NextLocalShardIdx));
-
- {
- ui64 isReadOnlyModeVal = 0;
- RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_IsReadOnlyMode, isReadOnlyModeVal));
- Self->IsReadOnlyMode = isReadOnlyModeVal;
- }
-
- if (!Self->IsDomainSchemeShard) {
- ui64 parentDomainSchemeShard = 0;
- RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_ParentDomainSchemeShard, parentDomainSchemeShard));
-
- ui64 parentDomainPathId = 0;
- RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_ParentDomainPathId, parentDomainPathId));
-
- Self->ParentDomainId = TPathId(parentDomainSchemeShard, parentDomainPathId);
-
- RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_ParentDomainOwner, Self->ParentDomainOwner));
- RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_ParentDomainEffectiveACL, Self->ParentDomainEffectiveACL));
- RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_ParentDomainEffectiveACLVersion, Self->ParentDomainEffectiveACLVersion));
-
- Self->ParentDomainCachedEffectiveACL.Init(Self->ParentDomainEffectiveACL);
- } else {
- Self->ParentDomainId = Self->RootPathId();
- }
-
- {
- ui64 secondsSinceEpoch = 0;
- RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_ServerlessStorageLastBillTime, secondsSinceEpoch));
- Self->ServerlessStorageLastBillTime = TInstant::Seconds(secondsSinceEpoch);
- }
-
-#undef RETURN_IF_NO_PRECHARGED
-
- if (!Self->IsShemeShardConfigured()) {
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit, SS hasn't been configured jet"
- << ", state: " << (ui64)Self->InitState
- << ", at schemeshard: " << Self->TabletID());
- return true;
- }
-
- // Read reversed migrations
- {
- auto attrsRowset = db.Table<Schema::RevertedMigrations>().Range().Select();
- if (!attrsRowset.IsReady()) {
- return false;
- }
-
- while (!attrsRowset.EndOfSet()) {
- TLocalPathId localPathId = attrsRowset.GetValue<Schema::RevertedMigrations::LocalPathId>();
- TPathId pathId = Self->MakeLocalId(localPathId);
- TTabletId abandonedSchemeShardID = attrsRowset.GetValue<Schema::RevertedMigrations::SchemeShardId>();
-
- Self->RevertedMigrations[pathId].push_back(abandonedSchemeShardID);
-
- if (!attrsRowset.Next()) {
- return false;
- }
- }
- }
-
- // Read paths
- {
-
- TPathesRows pathesRows;
- if (!LoadPathes(db, pathesRows)) {
- return false;
- }
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for Pathes"
- << ", readed records: " << pathesRows.size()
- << ", at schemeshard: " << Self->TabletID());
-
- if (pathesRows) {
- // read Root
- TPathElement::TPtr rootPath = MakePathElement(pathesRows.front());
- Y_VERIFY(rootPath->PathId == Self->RootPathId());
- Y_VERIFY(rootPath->ParentPathId == Self->RootPathId());
- Y_VERIFY(rootPath->DomainPathId == Self->RootPathId());
-
- Y_VERIFY(!IsStartWithSlash(rootPath->Name));
- Self->RootPathElemets = SplitPath(rootPath->Name);
-
- Y_VERIFY(!rootPath->StepDropped);
- Self->PathsById[rootPath->PathId ] = rootPath;
-
- pathesRows.pop_front();
- }
-
- Y_VERIFY_DEBUG(IsSorted(pathesRows.begin(), pathesRows.end()));
-
- for (auto& rec: pathesRows) {
- TPathElement::TPtr path = MakePathElement(rec);
-
- Y_VERIFY(path->PathId != Self->RootPathId());
-
- Y_VERIFY_S(!Self->PathsById.contains(path->PathId), "Path already exists"
- << ", pathId: " << path->PathId);
-
- TPathElement::TPtr parent = Self->PathsById.at(path->ParentPathId);
+ typedef std::tuple<TShardIdx, ui32, TString, TString> TChannelBindingRec;
+ typedef TDeque<TChannelBindingRec> TChannelBindingRows;
+
+ bool LoadChannelBindings(NIceDb::TNiceDb& db, TChannelBindingRows& tableIndexKeys) const {
+ {
+ auto rowSet = db.Table<Schema::ChannelsBinding>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ auto shardIdx = Self->MakeLocalId(rowSet.GetValue<Schema::ChannelsBinding::ShardId>());
+ ui32 channelId = rowSet.GetValue<Schema::ChannelsBinding::ChannelId>();
+ TString binding = rowSet.GetValue<Schema::ChannelsBinding::Binding>();
+ TString poolName = rowSet.GetValue<Schema::ChannelsBinding::PoolName>();
+
+ tableIndexKeys.emplace_back(shardIdx, channelId, binding, poolName);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ {
+ auto rowSet = db.Table<Schema::MigratedChannelsBinding>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ auto shardIdx = TShardIdx(rowSet.GetValue<Schema::MigratedChannelsBinding::OwnerShardId>(),
+ rowSet.GetValue<Schema::MigratedChannelsBinding::LocalShardId>());
+ ui32 channelId = rowSet.GetValue<Schema::MigratedChannelsBinding::ChannelId>();
+ TString binding = rowSet.GetValue<Schema::MigratedChannelsBinding::Binding>();
+ TString poolName = rowSet.GetValue<Schema::MigratedChannelsBinding::PoolName>();
+
+ tableIndexKeys.emplace_back(shardIdx, channelId, binding, poolName);
+
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ typedef std::tuple<TPathId, TString, ui64> TKesusInfosRec;
+ typedef TDeque<TKesusInfosRec> TKesusInfosRows;
+
+ bool LoadKesusInfos(NIceDb::TNiceDb& db, TKesusInfosRows& kesusInfosData) const {
+ {
+ auto rowSet = db.Table<Schema::KesusInfos>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ auto pathId = Self->MakeLocalId(rowSet.GetValue<Schema::KesusInfos::PathId>());
+ auto config = rowSet.GetValue<Schema::KesusInfos::Config>();
+ auto version = rowSet.GetValueOrDefault<Schema::KesusInfos::Version>();
+
+ kesusInfosData.emplace_back(pathId, config, version);
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ {
+ auto rowSet = db.Table<Schema::MigratedKesusInfos>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ auto pathId = TPathId(rowSet.GetValue<Schema::MigratedKesusInfos::OwnerPathId>(),
+ rowSet.GetValue<Schema::MigratedKesusInfos::LocalPathId>());
+ auto config = rowSet.GetValue<Schema::MigratedKesusInfos::Config>();
+ auto version = rowSet.GetValueOrDefault<Schema::MigratedKesusInfos::Version>();
+
+ kesusInfosData.emplace_back(pathId, config, version);
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ typedef std::tuple<TPathId, TString, ui64> TKesusAlterRec;
+ typedef TDeque<TKesusAlterRec> TKesusAlterRows;
+
+ bool LoadKesusAlters(NIceDb::TNiceDb& db, TKesusAlterRows& kesusAlterData) const {
+ {
+ auto rowSet = db.Table<Schema::KesusAlters>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ auto pathId = Self->MakeLocalId(rowSet.GetValue<Schema::KesusAlters::PathId>());
+ auto config = rowSet.GetValue<Schema::KesusAlters::Config>();
+ auto version = rowSet.GetValueOrDefault<Schema::KesusAlters::Version>();
+
+ kesusAlterData.emplace_back(pathId, config, version);
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ {
+ auto rowSet = db.Table<Schema::MigratedKesusAlters>().Range().Select();
+ if (!rowSet.IsReady()) {
+ return false;
+ }
+
+ while (!rowSet.EndOfSet()) {
+ auto pathId = TPathId(rowSet.GetValue<Schema::MigratedKesusAlters::OwnerPathId>(),
+ rowSet.GetValue<Schema::MigratedKesusAlters::LocalPathId>());
+ auto config = rowSet.GetValue<Schema::MigratedKesusAlters::Config>();
+ auto version = rowSet.GetValueOrDefault<Schema::MigratedKesusAlters::Version>();
+
+ kesusAlterData.emplace_back(pathId, config, version);
+ if (!rowSet.Next()) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ bool ReadEverything(TTransactionContext& txc, const TActorContext& ctx) {
+ const TOwnerId selfId = Self->TabletID();
+
+ Self->Clear();
+
+ NIceDb::TNiceDb db(txc.DB);
+ if (!db.Precharge<Schema>()) {
+ return false;
+ }
+
+#define RETURN_IF_NO_PRECHARGED(readIsOk) \
+ if (!readIsOk) { \
+ return false;\
+ }
+
+ {
+ ui64 initStateVal = (ui64)TTenantInitState::InvalidState;
+ RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_TenantInitState, initStateVal, (ui64)TTenantInitState::InvalidState));
+ Self->InitState = TTenantInitState::EInitState(initStateVal);
+ }
+
+ RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_NextPathId, Self->NextLocalPathId));
+ RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_NextShardIdx, Self->NextLocalShardIdx));
+
+ {
+ ui64 isReadOnlyModeVal = 0;
+ RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_IsReadOnlyMode, isReadOnlyModeVal));
+ Self->IsReadOnlyMode = isReadOnlyModeVal;
+ }
+
+ if (!Self->IsDomainSchemeShard) {
+ ui64 parentDomainSchemeShard = 0;
+ RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_ParentDomainSchemeShard, parentDomainSchemeShard));
+
+ ui64 parentDomainPathId = 0;
+ RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_ParentDomainPathId, parentDomainPathId));
+
+ Self->ParentDomainId = TPathId(parentDomainSchemeShard, parentDomainPathId);
+
+ RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_ParentDomainOwner, Self->ParentDomainOwner));
+ RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_ParentDomainEffectiveACL, Self->ParentDomainEffectiveACL));
+ RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_ParentDomainEffectiveACLVersion, Self->ParentDomainEffectiveACLVersion));
+
+ Self->ParentDomainCachedEffectiveACL.Init(Self->ParentDomainEffectiveACL);
+ } else {
+ Self->ParentDomainId = Self->RootPathId();
+ }
+
+ {
+ ui64 secondsSinceEpoch = 0;
+ RETURN_IF_NO_PRECHARGED(Self->ReadSysValue(db, Schema::SysParam_ServerlessStorageLastBillTime, secondsSinceEpoch));
+ Self->ServerlessStorageLastBillTime = TInstant::Seconds(secondsSinceEpoch);
+ }
+
+#undef RETURN_IF_NO_PRECHARGED
+
+ if (!Self->IsShemeShardConfigured()) {
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit, SS hasn't been configured jet"
+ << ", state: " << (ui64)Self->InitState
+ << ", at schemeshard: " << Self->TabletID());
+ return true;
+ }
+
+ // Read reversed migrations
+ {
+ auto attrsRowset = db.Table<Schema::RevertedMigrations>().Range().Select();
+ if (!attrsRowset.IsReady()) {
+ return false;
+ }
+
+ while (!attrsRowset.EndOfSet()) {
+ TLocalPathId localPathId = attrsRowset.GetValue<Schema::RevertedMigrations::LocalPathId>();
+ TPathId pathId = Self->MakeLocalId(localPathId);
+ TTabletId abandonedSchemeShardID = attrsRowset.GetValue<Schema::RevertedMigrations::SchemeShardId>();
+
+ Self->RevertedMigrations[pathId].push_back(abandonedSchemeShardID);
+
+ if (!attrsRowset.Next()) {
+ return false;
+ }
+ }
+ }
+
+ // Read paths
+ {
+
+ TPathesRows pathesRows;
+ if (!LoadPathes(db, pathesRows)) {
+ return false;
+ }
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for Pathes"
+ << ", readed records: " << pathesRows.size()
+ << ", at schemeshard: " << Self->TabletID());
+
+ if (pathesRows) {
+ // read Root
+ TPathElement::TPtr rootPath = MakePathElement(pathesRows.front());
+ Y_VERIFY(rootPath->PathId == Self->RootPathId());
+ Y_VERIFY(rootPath->ParentPathId == Self->RootPathId());
+ Y_VERIFY(rootPath->DomainPathId == Self->RootPathId());
+
+ Y_VERIFY(!IsStartWithSlash(rootPath->Name));
+ Self->RootPathElemets = SplitPath(rootPath->Name);
+
+ Y_VERIFY(!rootPath->StepDropped);
+ Self->PathsById[rootPath->PathId ] = rootPath;
+
+ pathesRows.pop_front();
+ }
+
+ Y_VERIFY_DEBUG(IsSorted(pathesRows.begin(), pathesRows.end()));
+
+ for (auto& rec: pathesRows) {
+ TPathElement::TPtr path = MakePathElement(rec);
+
+ Y_VERIFY(path->PathId != Self->RootPathId());
+
+ Y_VERIFY_S(!Self->PathsById.contains(path->PathId), "Path already exists"
+ << ", pathId: " << path->PathId);
+
+ TPathElement::TPtr parent = Self->PathsById.at(path->ParentPathId);
parent->DbRefCount++;
parent->AllChildrenCount++;
-
- Self->AttachChild(path);
- Self->PathsById[path->PathId] = path;
- }
- }
-
- // Read user attrs
- {
- TUserAttrsRows userAttrsRows;
- if (!LoadUserAttrs(db, userAttrsRows)) {
- return false;
- }
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for UserAttributes"
- << ", readed records: " << userAttrsRows.size()
- << ", at schemeshard: " << Self->TabletID());
-
- for (auto& rec: userAttrsRows) {
- TPathId pathId = std::get<0>(rec);
- TString name = std::get<1>(rec);
- TString value = std::get<2>(rec);
-
- Y_VERIFY_S(Self->PathsById.contains(pathId), "Unknown pathId: " << pathId);
- auto pathElem = Self->PathsById.at(pathId);
-
- Y_VERIFY(pathElem->UserAttrs);
- Y_VERIFY(pathElem->UserAttrs->AlterVersion > 0);
- pathElem->UserAttrs->Set(name, value);
- }
- }
-
- // Read user attrs alter data
- {
- TUserAttrsRows userAttrsRows;
- if (!LoadUserAttrsAlterData(db, userAttrsRows)) {
- return false;
- }
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for UserAttributesAlterData"
- << ", readed records: " << userAttrsRows.size()
- << ", at schemeshard: " << Self->TabletID());
-
- for (auto& rec: userAttrsRows) {
- TPathId pathId = std::get<0>(rec);
- TString name = std::get<1>(rec);
- TString value = std::get<2>(rec);
-
- Y_VERIFY_S(Self->PathsById.contains(pathId), "Unknown pathId: " << pathId);
- auto pathElem = Self->PathsById.at(pathId);
-
- Y_VERIFY(pathElem->UserAttrs);
- if (pathElem->UserAttrs->AlterData == nullptr) {
- pathElem->UserAttrs->AlterData = new TUserAttributes(pathElem->UserAttrs->AlterVersion + 1);
- }
-
- pathElem->UserAttrs->AlterData->Set(name, value);
- }
- }
-
+
+ Self->AttachChild(path);
+ Self->PathsById[path->PathId] = path;
+ }
+ }
+
+ // Read user attrs
+ {
+ TUserAttrsRows userAttrsRows;
+ if (!LoadUserAttrs(db, userAttrsRows)) {
+ return false;
+ }
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for UserAttributes"
+ << ", readed records: " << userAttrsRows.size()
+ << ", at schemeshard: " << Self->TabletID());
+
+ for (auto& rec: userAttrsRows) {
+ TPathId pathId = std::get<0>(rec);
+ TString name = std::get<1>(rec);
+ TString value = std::get<2>(rec);
+
+ Y_VERIFY_S(Self->PathsById.contains(pathId), "Unknown pathId: " << pathId);
+ auto pathElem = Self->PathsById.at(pathId);
+
+ Y_VERIFY(pathElem->UserAttrs);
+ Y_VERIFY(pathElem->UserAttrs->AlterVersion > 0);
+ pathElem->UserAttrs->Set(name, value);
+ }
+ }
+
+ // Read user attrs alter data
+ {
+ TUserAttrsRows userAttrsRows;
+ if (!LoadUserAttrsAlterData(db, userAttrsRows)) {
+ return false;
+ }
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for UserAttributesAlterData"
+ << ", readed records: " << userAttrsRows.size()
+ << ", at schemeshard: " << Self->TabletID());
+
+ for (auto& rec: userAttrsRows) {
+ TPathId pathId = std::get<0>(rec);
+ TString name = std::get<1>(rec);
+ TString value = std::get<2>(rec);
+
+ Y_VERIFY_S(Self->PathsById.contains(pathId), "Unknown pathId: " << pathId);
+ auto pathElem = Self->PathsById.at(pathId);
+
+ Y_VERIFY(pathElem->UserAttrs);
+ if (pathElem->UserAttrs->AlterData == nullptr) {
+ pathElem->UserAttrs->AlterData = new TUserAttributes(pathElem->UserAttrs->AlterVersion + 1);
+ }
+
+ pathElem->UserAttrs->AlterData->Set(name, value);
+ }
+ }
+
// Read SubDomains
{
- TSchemeLimits rootLimits = TSchemeShard::DefaultLimits;
+ TSchemeLimits rootLimits = TSchemeShard::DefaultLimits;
if (Self->PathsById.contains(Self->RootPathId()) && Self->IsDomainSchemeShard) {
auto row = db.Table<Schema::SubDomains>().Key(Self->RootPathId().LocalPathId).Select();
@@ -1730,66 +1730,66 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
}
{
- TTableRows tableRows;
- if (!LoadTables(db, tableRows)) {
+ TTableRows tableRows;
+ if (!LoadTables(db, tableRows)) {
return false;
- }
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for Tables"
- << ", readed records: " << tableRows.size()
- << ", at schemeshard: " << Self->TabletID());
-
- for (const auto& rec: tableRows) {
- TPathId pathId = std::get<0>(rec);
-
- Y_VERIFY_S(Self->PathsById.contains(pathId), "Path doesn't exist, pathId: " << pathId);
- Y_VERIFY_S(Self->PathsById.at(pathId)->IsTable(), "Path is not a table, pathId: " << pathId);
- Y_VERIFY_S(Self->Tables.FindPtr(pathId) == nullptr, "Table duplicated in DB, pathId: " << pathId);
-
- TTableInfo::TPtr tableInfo = new TTableInfo();
- tableInfo->NextColumnId = std::get<1>(rec);
- tableInfo->AlterVersion = std::get<2>(rec);
-
- TString partitionConfig = std::get<3>(rec);
- if (partitionConfig) {
+ }
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for Tables"
+ << ", readed records: " << tableRows.size()
+ << ", at schemeshard: " << Self->TabletID());
+
+ for (const auto& rec: tableRows) {
+ TPathId pathId = std::get<0>(rec);
+
+ Y_VERIFY_S(Self->PathsById.contains(pathId), "Path doesn't exist, pathId: " << pathId);
+ Y_VERIFY_S(Self->PathsById.at(pathId)->IsTable(), "Path is not a table, pathId: " << pathId);
+ Y_VERIFY_S(Self->Tables.FindPtr(pathId) == nullptr, "Table duplicated in DB, pathId: " << pathId);
+
+ TTableInfo::TPtr tableInfo = new TTableInfo();
+ tableInfo->NextColumnId = std::get<1>(rec);
+ tableInfo->AlterVersion = std::get<2>(rec);
+
+ TString partitionConfig = std::get<3>(rec);
+ if (partitionConfig) {
auto& config = tableInfo->MutablePartitionConfig();
bool parseOk = ParseFromStringNoSizeLimit(config, partitionConfig);
Y_VERIFY(parseOk);
if (config.ColumnFamiliesSize() > 1) {
// Fix any incorrect legacy config at load time
- TPartitionConfigMerger::DeduplicateColumnFamiliesById(config);
+ TPartitionConfigMerger::DeduplicateColumnFamiliesById(config);
}
-
+
if (config.HasCrossDataCenterFollowerCount()) {
config.ClearFollowerCount();
- }
- }
-
- TString alterTabletFull = std::get<4>(rec);
- TString alterTabletDiff = std::get<5>(rec);
- if (alterTabletFull) {
- tableInfo->InitAlterData();
- tableInfo->AlterData->TableDescriptionFull = NKikimrSchemeOp::TTableDescription();
+ }
+ }
+
+ TString alterTabletFull = std::get<4>(rec);
+ TString alterTabletDiff = std::get<5>(rec);
+ if (alterTabletFull) {
+ tableInfo->InitAlterData();
+ tableInfo->AlterData->TableDescriptionFull = NKikimrSchemeOp::TTableDescription();
auto& tableDesc = tableInfo->AlterData->TableDescriptionFull.GetRef();
bool parseOk = ParseFromStringNoSizeLimit(tableDesc, alterTabletFull);
- Y_VERIFY(parseOk);
+ Y_VERIFY(parseOk);
if (tableDesc.HasPartitionConfig() &&
tableDesc.GetPartitionConfig().ColumnFamiliesSize() > 1)
{
// Fix any incorrect legacy config at load time
- TPartitionConfigMerger::DeduplicateColumnFamiliesById(*tableDesc.MutablePartitionConfig());
+ TPartitionConfigMerger::DeduplicateColumnFamiliesById(*tableDesc.MutablePartitionConfig());
}
- } else if (alterTabletDiff) {
- tableInfo->InitAlterData();
- bool parseOk = ParseFromStringNoSizeLimit(tableInfo->AlterData->TableDescriptionDiff, alterTabletDiff);
- Y_VERIFY(parseOk);
- }
-
- tableInfo->PartitioningVersion = std::get<6>(rec);
-
+ } else if (alterTabletDiff) {
+ tableInfo->InitAlterData();
+ bool parseOk = ParseFromStringNoSizeLimit(tableInfo->AlterData->TableDescriptionDiff, alterTabletDiff);
+ Y_VERIFY(parseOk);
+ }
+
+ tableInfo->PartitioningVersion = std::get<6>(rec);
+
TString ttlSettings = std::get<7>(rec);
if (ttlSettings) {
bool parseOk = ParseFromStringNoSizeLimit(tableInfo->MutableTTLSettings(), ttlSettings);
@@ -1798,61 +1798,61 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
tableInfo->IsBackup = std::get<8>(rec);
- Self->Tables[pathId] = tableInfo;
+ Self->Tables[pathId] = tableInfo;
Self->IncrementPathDbRefCount(pathId);
if (tableInfo->IsTTLEnabled()) {
Self->TTLEnabledTables[pathId] = tableInfo;
Self->TabletCounters->Simple()[COUNTER_TTL_ENABLED_TABLE_COUNT].Add(1);
}
}
-
+
}
// Read table columns
{
- TColumnRows columnRows;
- if (!LoadColumns(db, columnRows)) {
+ TColumnRows columnRows;
+ if (!LoadColumns(db, columnRows)) {
return false;
- }
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for Columns"
- << ", readed records: " << columnRows.size()
- << ", at schemeshard: " << Self->TabletID());
-
- for (const auto& rec: columnRows) {
- TPathId pathId = std::get<0>(rec);
- ui32 colId = std::get<1>(rec);
- TString colName = std::get<2>(rec);
- NScheme::TTypeId typeId = std::get<3>(rec);
- ui32 keyOrder = std::get<4>(rec);
- ui64 createVersion = std::get<5>(rec);
- ui64 deleteVersion = std::get<6>(rec);
- ui32 family = std::get<7>(rec);
+ }
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for Columns"
+ << ", readed records: " << columnRows.size()
+ << ", at schemeshard: " << Self->TabletID());
+
+ for (const auto& rec: columnRows) {
+ TPathId pathId = std::get<0>(rec);
+ ui32 colId = std::get<1>(rec);
+ TString colName = std::get<2>(rec);
+ NScheme::TTypeId typeId = std::get<3>(rec);
+ ui32 keyOrder = std::get<4>(rec);
+ ui64 createVersion = std::get<5>(rec);
+ ui64 deleteVersion = std::get<6>(rec);
+ ui32 family = std::get<7>(rec);
auto defaultKind = std::get<8>(rec);
auto defaultValue = std::get<9>(rec);
auto notNull = std::get<10>(rec);
-
- Y_VERIFY_S(Self->PathsById.contains(pathId), "Path doesn't exist, pathId: " << pathId);
- Y_VERIFY_S(Self->PathsById.at(pathId)->IsTable(), "Path is not a table, pathId: " << pathId);
- Y_VERIFY_S(Self->Tables.FindPtr(pathId), "Table doen't exist, pathId: " << pathId);
- TTableInfo::TPtr tableInfo = Self->Tables[pathId];
- Y_VERIFY_S(colId < tableInfo->NextColumnId, "Column id should be less than NextColId"
- << ", columnId: " << colId
- << ", NextColId: " << tableInfo->NextColumnId);
+ Y_VERIFY_S(Self->PathsById.contains(pathId), "Path doesn't exist, pathId: " << pathId);
+ Y_VERIFY_S(Self->PathsById.at(pathId)->IsTable(), "Path is not a table, pathId: " << pathId);
+ Y_VERIFY_S(Self->Tables.FindPtr(pathId), "Table doen't exist, pathId: " << pathId);
+
+ TTableInfo::TPtr tableInfo = Self->Tables[pathId];
+ Y_VERIFY_S(colId < tableInfo->NextColumnId, "Column id should be less than NextColId"
+ << ", columnId: " << colId
+ << ", NextColId: " << tableInfo->NextColumnId);
TTableInfo::TColumn colInfo(colName, colId, typeId);
- colInfo.KeyOrder = keyOrder;
- colInfo.CreateVersion = createVersion;
- colInfo.DeleteVersion = deleteVersion;
- colInfo.Family = family;
+ colInfo.KeyOrder = keyOrder;
+ colInfo.CreateVersion = createVersion;
+ colInfo.DeleteVersion = deleteVersion;
+ colInfo.Family = family;
colInfo.DefaultKind = defaultKind;
colInfo.DefaultValue = defaultValue;
colInfo.NotNull = notNull;
-
+
tableInfo->Columns[colId] = colInfo;
-
+
if (colInfo.KeyOrder != (ui32)-1) {
tableInfo->KeyColumnIds.resize(Max<ui32>(tableInfo->KeyColumnIds.size(), colInfo.KeyOrder + 1));
tableInfo->KeyColumnIds[colInfo.KeyOrder] = colId;
@@ -1862,45 +1862,45 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
// Read table columns' alters
{
- TColumnRows columnRows;
- if (!LoadColumnsAlters(db, columnRows)) {
+ TColumnRows columnRows;
+ if (!LoadColumnsAlters(db, columnRows)) {
return false;
- }
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for ColumnsAlters"
- << ", readed records: " << columnRows.size()
- << ", at schemeshard: " << Self->TabletID());
-
- for (const auto& rec: columnRows) {
- TPathId pathId = std::get<0>(rec);
- ui32 colId = std::get<1>(rec);
- TString colName = std::get<2>(rec);
- NScheme::TTypeId typeId = std::get<3>(rec);
- ui32 keyOrder = std::get<4>(rec);
- ui64 createVersion = std::get<5>(rec);
- ui64 deleteVersion = std::get<6>(rec);
- ui32 family = std::get<7>(rec);
+ }
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for ColumnsAlters"
+ << ", readed records: " << columnRows.size()
+ << ", at schemeshard: " << Self->TabletID());
+
+ for (const auto& rec: columnRows) {
+ TPathId pathId = std::get<0>(rec);
+ ui32 colId = std::get<1>(rec);
+ TString colName = std::get<2>(rec);
+ NScheme::TTypeId typeId = std::get<3>(rec);
+ ui32 keyOrder = std::get<4>(rec);
+ ui64 createVersion = std::get<5>(rec);
+ ui64 deleteVersion = std::get<6>(rec);
+ ui32 family = std::get<7>(rec);
auto defaultKind = std::get<8>(rec);
auto defaultValue = std::get<9>(rec);
auto notNull = std::get<10>(rec);
-
- Y_VERIFY_S(Self->PathsById.contains(pathId), "Path doesn't exist, pathId: " << pathId);
- Y_VERIFY_S(Self->PathsById.at(pathId)->IsTable(), "Path is not a table, pathId: " << pathId);
-
- Y_VERIFY_S(Self->Tables.FindPtr(pathId), "Table doen't exist, pathId: " << pathId);
-
- TTableInfo::TPtr tableInfo = Self->Tables[pathId];
- tableInfo->InitAlterData();
- if (colId >= tableInfo->AlterData->NextColumnId) {
+
+ Y_VERIFY_S(Self->PathsById.contains(pathId), "Path doesn't exist, pathId: " << pathId);
+ Y_VERIFY_S(Self->PathsById.at(pathId)->IsTable(), "Path is not a table, pathId: " << pathId);
+
+ Y_VERIFY_S(Self->Tables.FindPtr(pathId), "Table doen't exist, pathId: " << pathId);
+
+ TTableInfo::TPtr tableInfo = Self->Tables[pathId];
+ tableInfo->InitAlterData();
+ if (colId >= tableInfo->AlterData->NextColumnId) {
tableInfo->AlterData->NextColumnId = colId + 1; // calc next NextColumnId
- }
+ }
TTableInfo::TColumn colInfo(colName, colId, typeId);
- colInfo.KeyOrder = keyOrder;
- colInfo.CreateVersion = createVersion;
- colInfo.DeleteVersion = deleteVersion;
- colInfo.Family = family;
+ colInfo.KeyOrder = keyOrder;
+ colInfo.CreateVersion = createVersion;
+ colInfo.DeleteVersion = deleteVersion;
+ colInfo.Family = family;
colInfo.DefaultKind = defaultKind;
colInfo.DefaultValue = defaultValue;
colInfo.NotNull = notNull;
@@ -1909,45 +1909,45 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
}
// Read shards (any tipe of tablets)
- THashMap<TPathId, TShardIdx> pqBalancers; // pathId -> shardIdx
- THashMap<TPathId, TShardIdx> nbsVolumeShards; // pathId -> shardIdx
+ THashMap<TPathId, TShardIdx> pqBalancers; // pathId -> shardIdx
+ THashMap<TPathId, TShardIdx> nbsVolumeShards; // pathId -> shardIdx
THashMap<TPathId, TShardIdx> fileStoreShards; // pathId -> shardIdx
- THashMap<TPathId, TShardIdx> kesusShards; // pathId -> shardIdx
+ THashMap<TPathId, TShardIdx> kesusShards; // pathId -> shardIdx
THashMap<TPathId, TVector<TShardIdx>> olapColumnShards;
{
- TShardsRows shards;
- if (!LoadShards(db, shards)) {
+ TShardsRows shards;
+ if (!LoadShards(db, shards)) {
return false;
- }
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for Shards"
- << ", readed records: " << shards.size()
- << ", at schemeshard: " << Self->TabletID());
-
- for (auto& rec: shards) {
- TShardIdx idx = std::get<0>(rec);
-
- LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for Shards"
- << ", read: " << idx
- << ", tabetId: " << std::get<1>(rec)
- << ", PathId: " << std::get<2>(rec)
- << ", TabletType: " << TTabletTypes::TypeToStr(std::get<4>(rec))
- << ", at schemeshard: " << Self->TabletID());
-
- Y_VERIFY(!Self->ShardInfos.contains(idx));
- TShardInfo& shard = Self->ShardInfos[idx];
-
- shard.TabletID = std::get<1>(rec);
- shard.PathId = std::get<2>(rec);
- shard.CurrentTxId = std::get<3>(rec);
- shard.TabletType = std::get<4>(rec);
-
+ }
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for Shards"
+ << ", readed records: " << shards.size()
+ << ", at schemeshard: " << Self->TabletID());
+
+ for (auto& rec: shards) {
+ TShardIdx idx = std::get<0>(rec);
+
+ LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for Shards"
+ << ", read: " << idx
+ << ", tabetId: " << std::get<1>(rec)
+ << ", PathId: " << std::get<2>(rec)
+ << ", TabletType: " << TTabletTypes::TypeToStr(std::get<4>(rec))
+ << ", at schemeshard: " << Self->TabletID());
+
+ Y_VERIFY(!Self->ShardInfos.contains(idx));
+ TShardInfo& shard = Self->ShardInfos[idx];
+
+ shard.TabletID = std::get<1>(rec);
+ shard.PathId = std::get<2>(rec);
+ shard.CurrentTxId = std::get<3>(rec);
+ shard.TabletType = std::get<4>(rec);
+
Self->IncrementPathDbRefCount(shard.PathId);
- Y_VERIFY(shard.TabletType != ETabletType::TypeInvalid, "upgrage schema was wrong");
-
+ Y_VERIFY(shard.TabletType != ETabletType::TypeInvalid, "upgrage schema was wrong");
+
switch (shard.TabletType) {
case ETabletType::PersQueueReadBalancer:
pqBalancers[shard.PathId] = idx;
@@ -1966,67 +1966,67 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
break;
default:
break;
- }
- }
- }
-
- {
- auto adoptedRowset = db.Table<Schema::AdoptedShards>().Range().Select();
- if (!adoptedRowset.IsReady())
- return false;
- while (!adoptedRowset.EndOfSet()) {
- TLocalShardIdx localShardIdx = adoptedRowset.GetValue<Schema::AdoptedShards::ShardIdx>();
- TShardIdx shardIdx = Self->MakeLocalId(localShardIdx);
- TAdoptedShard& adoptedShard = Self->AdoptedShards[shardIdx];
- adoptedShard.PrevOwner = adoptedRowset.GetValue<Schema::AdoptedShards::PrevOwner>();
- adoptedShard.PrevShardIdx = adoptedRowset.GetValue<Schema::AdoptedShards::PrevShardIdx>();
-
- TShardInfo* shard = Self->ShardInfos.FindPtr(shardIdx);
- Y_VERIFY(shard);
-
- TTabletId tabletId = adoptedRowset.GetValue<Schema::AdoptedShards::TabletId>();
- Y_VERIFY(shard->TabletID == InvalidTabletId || shard->TabletID == tabletId);
- shard->TabletID = tabletId;
-
- if (!adoptedRowset.Next())
- return false;
- }
- }
-
+ }
+ }
+ }
+
+ {
+ auto adoptedRowset = db.Table<Schema::AdoptedShards>().Range().Select();
+ if (!adoptedRowset.IsReady())
+ return false;
+ while (!adoptedRowset.EndOfSet()) {
+ TLocalShardIdx localShardIdx = adoptedRowset.GetValue<Schema::AdoptedShards::ShardIdx>();
+ TShardIdx shardIdx = Self->MakeLocalId(localShardIdx);
+ TAdoptedShard& adoptedShard = Self->AdoptedShards[shardIdx];
+ adoptedShard.PrevOwner = adoptedRowset.GetValue<Schema::AdoptedShards::PrevOwner>();
+ adoptedShard.PrevShardIdx = adoptedRowset.GetValue<Schema::AdoptedShards::PrevShardIdx>();
+
+ TShardInfo* shard = Self->ShardInfos.FindPtr(shardIdx);
+ Y_VERIFY(shard);
+
+ TTabletId tabletId = adoptedRowset.GetValue<Schema::AdoptedShards::TabletId>();
+ Y_VERIFY(shard->TabletID == InvalidTabletId || shard->TabletID == tabletId);
+ shard->TabletID = tabletId;
+
+ if (!adoptedRowset.Next())
+ return false;
+ }
+ }
+
// Read partitions
{
- TTablePartitionsRows tablePartitions;
- if (!LoadTablePartitions(db, tablePartitions)) {
+ TTablePartitionsRows tablePartitions;
+ if (!LoadTablePartitions(db, tablePartitions)) {
return false;
- }
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for TablePartitions"
- << ", readed records: " << tablePartitions.size()
- << ", at schemeshard: " << Self->TabletID());
-
- TPathId prevTableId;
+ }
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for TablePartitions"
+ << ", readed records: " << tablePartitions.size()
+ << ", at schemeshard: " << Self->TabletID());
+
+ TPathId prevTableId;
TVector<TTableShardInfo> partitions;
const auto now = ctx.Now();
- for (auto& rec: tablePartitions) {
- TPathId tableId = std::get<0>(rec);
- ui64 id = std::get<1>(rec);
- TString rangeEnd = std::get<2>(rec);
- TShardIdx datashardIdx = std::get<3>(rec);
+ for (auto& rec: tablePartitions) {
+ TPathId tableId = std::get<0>(rec);
+ ui64 id = std::get<1>(rec);
+ TString rangeEnd = std::get<2>(rec);
+ TShardIdx datashardIdx = std::get<3>(rec);
ui64 lastCondErase = std::get<4>(rec);
ui64 nextCondErase = std::get<5>(rec);
-
- if (tableId != prevTableId) {
- if (prevTableId) {
+
+ if (tableId != prevTableId) {
+ if (prevTableId) {
Y_VERIFY(!partitions.empty());
- Y_VERIFY(Self->Tables.contains(prevTableId));
- TTableInfo::TPtr tableInfo = Self->Tables.at(prevTableId);
+ Y_VERIFY(Self->Tables.contains(prevTableId));
+ TTableInfo::TPtr tableInfo = Self->Tables.at(prevTableId);
Self->SetPartitioning(prevTableId, tableInfo, std::move(partitions));
partitions.clear();
}
-
- prevTableId = tableId;
+
+ prevTableId = tableId;
}
// TODO: check that table exists
@@ -2051,30 +2051,30 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
// TODO: check datashard idx existence
}
- if (prevTableId) {
+ if (prevTableId) {
Y_VERIFY(!partitions.empty());
- Y_VERIFY(Self->Tables.contains(prevTableId));
- TTableInfo::TPtr tableInfo = Self->Tables.at(prevTableId);
+ Y_VERIFY(Self->Tables.contains(prevTableId));
+ TTableInfo::TPtr tableInfo = Self->Tables.at(prevTableId);
Self->SetPartitioning(prevTableId, tableInfo, std::move(partitions));
}
}
// Read partition config patches
{
- TTableShardPartitionConfigRows tablePartitions;
- if (!LoadTableShardPartitionConfigs(db, tablePartitions)) {
+ TTableShardPartitionConfigRows tablePartitions;
+ if (!LoadTableShardPartitionConfigs(db, tablePartitions)) {
return false;
- }
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for TableShardPartitionConfigs"
- << ", readed records: " << tablePartitions.size()
- << ", at schemeshard: " << Self->TabletID());
-
- for (auto& rec: tablePartitions) {
- TShardIdx shardIdx = std::get<0>(rec);
- TString data = std::get<1>(rec);
-
+ }
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for TableShardPartitionConfigs"
+ << ", readed records: " << tablePartitions.size()
+ << ", at schemeshard: " << Self->TabletID());
+
+ for (auto& rec: tablePartitions) {
+ TShardIdx shardIdx = std::get<0>(rec);
+ TString data = std::get<1>(rec);
+
// NOTE: we ignore rows for shards we don't know
if (auto* shardInfo = Self->ShardInfos.FindPtr(shardIdx)) {
// NOTE: we ignore rows for shards that don't belong to known tables
@@ -2105,7 +2105,7 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
if (prevTableId) {
Y_VERIFY(Self->Tables.contains(prevTableId));
TTableInfo::TPtr tableInfo = Self->Tables.at(prevTableId);
- if (!tableInfo->IsBackup && !tableInfo->IsShardsStatsDetached()) {
+ if (!tableInfo->IsBackup && !tableInfo->IsShardsStatsDetached()) {
Self->ResolveDomainInfo(prevTableId)->AggrDiskSpaceUsage(Self, tableInfo->GetStats().Aggregated);
}
}
@@ -2122,13 +2122,13 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
const TShardIdx shardIdx = tableInfo->GetPartitions()[partitionId].ShardIdx;
Y_VERIFY(shardIdx != InvalidShardIdx);
- if (Self->ShardInfos.contains(shardIdx)) {
- const TShardInfo& shardInfo = Self->ShardInfos.at(shardIdx);
- if (shardInfo.PathId != tableId) {
- tableInfo->DetachShardsStats();
- }
- }
-
+ if (Self->ShardInfos.contains(shardIdx)) {
+ const TShardInfo& shardInfo = Self->ShardInfos.at(shardIdx);
+ if (shardInfo.PathId != tableId) {
+ tableInfo->DetachShardsStats();
+ }
+ }
+
TTableInfo::TPartitionStats stats;
stats.SeqNo = TMessageSeqNo(
@@ -2175,56 +2175,56 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
if (prevTableId) {
Y_VERIFY(Self->Tables.contains(prevTableId));
TTableInfo::TPtr tableInfo = Self->Tables.at(prevTableId);
- if (!tableInfo->IsBackup && !tableInfo->IsShardsStatsDetached()) {
+ if (!tableInfo->IsBackup && !tableInfo->IsShardsStatsDetached()) {
Self->ResolveDomainInfo(prevTableId)->AggrDiskSpaceUsage(Self, tableInfo->GetStats().Aggregated);
}
}
}
- // Read channels binding
- {
- TChannelBindingRows channelBindingRows;
- if (!LoadChannelBindings(db, channelBindingRows)) {
- return false;
- }
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for ChannelsBinding"
- << ", readed records: " << channelBindingRows.size()
- << ", at schemeshard: " << Self->TabletID());
-
- for (auto& rec: channelBindingRows) {
- TShardIdx shardIdx = std::get<0>(rec);
- ui32 channelId = std::get<1>(rec);
- TString bindingData = std::get<2>(rec);
- TString poolName = std::get<3>(rec);
-
- Y_VERIFY(Self->ShardInfos.contains(shardIdx));
- TShardInfo& shardInfo = Self->ShardInfos[shardIdx];
+ // Read channels binding
+ {
+ TChannelBindingRows channelBindingRows;
+ if (!LoadChannelBindings(db, channelBindingRows)) {
+ return false;
+ }
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for ChannelsBinding"
+ << ", readed records: " << channelBindingRows.size()
+ << ", at schemeshard: " << Self->TabletID());
+
+ for (auto& rec: channelBindingRows) {
+ TShardIdx shardIdx = std::get<0>(rec);
+ ui32 channelId = std::get<1>(rec);
+ TString bindingData = std::get<2>(rec);
+ TString poolName = std::get<3>(rec);
+
+ Y_VERIFY(Self->ShardInfos.contains(shardIdx));
+ TShardInfo& shardInfo = Self->ShardInfos[shardIdx];
if (shardInfo.BindedChannels.size() <= channelId) {
shardInfo.BindedChannels.resize(channelId + 1);
}
TChannelBind& channelBind = shardInfo.BindedChannels[channelId];
-
- if (bindingData) {
- bool parseOk = ParseFromStringNoSizeLimit(channelBind, bindingData);
- Y_VERIFY(parseOk);
- }
- if (poolName) {
- channelBind.SetStoragePoolName(poolName);
- }
- }
-
- }
-
+
+ if (bindingData) {
+ bool parseOk = ParseFromStringNoSizeLimit(channelBind, bindingData);
+ Y_VERIFY(parseOk);
+ }
+ if (poolName) {
+ channelBind.SetStoragePoolName(poolName);
+ }
+ }
+
+ }
+
// Read PersQueue groups
{
auto rowset = db.Table<Schema::PersQueueGroups>().Range().Select();
if (!rowset.IsReady())
return false;
while (!rowset.EndOfSet()) {
- TLocalPathId localPathId = rowset.GetValue<Schema::PersQueueGroups::PathId>();
- TPathId pathId(selfId, localPathId);
+ TLocalPathId localPathId = rowset.GetValue<Schema::PersQueueGroups::PathId>();
+ TPathId pathId(selfId, localPathId);
TPersQueueGroupInfo::TPtr pqGroup = new TPersQueueGroupInfo();
pqGroup->TabletConfig = rowset.GetValue<Schema::PersQueueGroups::TabletConfig>();
@@ -2241,9 +2241,9 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
auto it = pqBalancers.find(pathId);
if (it != pqBalancers.end()) {
- auto idx = it->second;
- Y_VERIFY(Self->ShardInfos.contains(idx));
- const TShardInfo& shard = Self->ShardInfos.at(idx);
+ auto idx = it->second;
+ Y_VERIFY(Self->ShardInfos.contains(idx));
+ const TShardInfo& shard = Self->ShardInfos.at(idx);
pqGroup->BalancerTabletID = shard.TabletID;
pqGroup->BalancerShardIdx = idx;
}
@@ -2260,12 +2260,12 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
return false;
while (!rowset.EndOfSet()) {
TPQShardInfo::TPersQueueInfo pqInfo;
- TLocalPathId localPathId = rowset.GetValue<Schema::PersQueues::PathId>();
- TPathId pathId(selfId, localPathId);
+ TLocalPathId localPathId = rowset.GetValue<Schema::PersQueues::PathId>();
+ TPathId pathId(selfId, localPathId);
pqInfo.PqId = rowset.GetValue<Schema::PersQueues::PqId>();
pqInfo.GroupId = rowset.GetValueOrDefault<Schema::PersQueues::GroupId>(pqInfo.PqId + 1);
- TLocalShardIdx localShardIdx = rowset.GetValue<Schema::PersQueues::ShardIdx>();
- TShardIdx shardIdx = Self->MakeLocalId(localShardIdx);
+ TLocalShardIdx localShardIdx = rowset.GetValue<Schema::PersQueues::ShardIdx>();
+ TShardIdx shardIdx = Self->MakeLocalId(localShardIdx);
pqInfo.AlterVersion = rowset.GetValue<Schema::PersQueues::AlterVersion>();
if (rowset.HaveValue<Schema::PersQueues::RangeBegin>()) {
@@ -2312,8 +2312,8 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
if (!rowset.IsReady())
return false;
while (!rowset.EndOfSet()) {
- TLocalPathId localPathId = rowset.GetValue<Schema::PersQueueGroupAlters::PathId>();
- TPathId pathId(selfId, localPathId);
+ TLocalPathId localPathId = rowset.GetValue<Schema::PersQueueGroupAlters::PathId>();
+ TPathId pathId(selfId, localPathId);
TPersQueueGroupInfo::TPtr alterData = new TPersQueueGroupInfo();
alterData->TabletConfig = rowset.GetValue<Schema::PersQueueGroupAlters::TabletConfig>();
@@ -2347,9 +2347,9 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
return false;
while (!rowset.EndOfSet()) {
- TLocalPathId localPathId = rowset.GetValue<Schema::RtmrVolumes::PathId>();
- TPathId pathId(selfId, localPathId);
-
+ TLocalPathId localPathId = rowset.GetValue<Schema::RtmrVolumes::PathId>();
+ TPathId pathId(selfId, localPathId);
+
Self->RtmrVolumes[pathId] = new TRtmrVolumeInfo();
Self->IncrementPathDbRefCount(pathId);
@@ -2365,8 +2365,8 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
return false;
while (!rowset.EndOfSet()) {
- TLocalPathId localPathId = rowset.GetValue<Schema::RTMRPartitions::PathId>();
- TPathId pathId(selfId, localPathId);
+ TLocalPathId localPathId = rowset.GetValue<Schema::RTMRPartitions::PathId>();
+ TPathId pathId(selfId, localPathId);
auto it = Self->RtmrVolumes.find(pathId);
Y_VERIFY(it != Self->RtmrVolumes.end());
@@ -2379,9 +2379,9 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
Copy(partitionId.cbegin(), partitionId.cend(), (char*)guidId.dw);
ui64 busKey = rowset.GetValue<Schema::RTMRPartitions::BusKey>();
- TLocalShardIdx localShardIdx = rowset.GetValue<Schema::RTMRPartitions::ShardIdx>();
- TShardIdx shardIdx = Self->MakeLocalId(localShardIdx);
- auto tabletId = Self->ShardInfos.at(shardIdx).TabletID;
+ TLocalShardIdx localShardIdx = rowset.GetValue<Schema::RTMRPartitions::ShardIdx>();
+ TShardIdx shardIdx = Self->MakeLocalId(localShardIdx);
+ auto tabletId = Self->ShardInfos.at(shardIdx).TabletID;
TRtmrPartitionInfo::TPtr partitionInfo = new TRtmrPartitionInfo(guidId, busKey, shardIdx, tabletId);
it->second->Partitions[shardIdx] = partitionInfo;
@@ -2391,227 +2391,227 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
}
}
- // Read Solomon volumes
- {
- auto rowset = db.Table<Schema::SolomonVolumes>().Range().Select();
- if (!rowset.IsReady())
- return false;
-
- while (!rowset.EndOfSet()) {
- TLocalPathId localPathId = rowset.GetValue<Schema::SolomonVolumes::PathId>();
- TPathId pathId = Self->MakeLocalId(localPathId);
- ui64 version = rowset.GetValueOrDefault<Schema::SolomonVolumes::Version>(1);
-
- TSolomonVolumeInfo::TPtr solomon = new TSolomonVolumeInfo(version);
- solomon->Version = version;
-
- Self->SolomonVolumes[pathId] = solomon;
+ // Read Solomon volumes
+ {
+ auto rowset = db.Table<Schema::SolomonVolumes>().Range().Select();
+ if (!rowset.IsReady())
+ return false;
+
+ while (!rowset.EndOfSet()) {
+ TLocalPathId localPathId = rowset.GetValue<Schema::SolomonVolumes::PathId>();
+ TPathId pathId = Self->MakeLocalId(localPathId);
+ ui64 version = rowset.GetValueOrDefault<Schema::SolomonVolumes::Version>(1);
+
+ TSolomonVolumeInfo::TPtr solomon = new TSolomonVolumeInfo(version);
+ solomon->Version = version;
+
+ Self->SolomonVolumes[pathId] = solomon;
Self->IncrementPathDbRefCount(pathId);
-
- if (!rowset.Next())
- return false;
- }
- }
-
- // Read Solomon partitions
- {
- auto rowset = db.Table<Schema::SolomonPartitions>().Range().Select();
- if (!rowset.IsReady())
- return false;
-
- while (!rowset.EndOfSet()) {
- TLocalPathId localPathId = rowset.GetValue<Schema::SolomonPartitions::PathId>();
- TPathId pathId = Self->MakeLocalId(localPathId);
-
- auto it = Self->SolomonVolumes.find(pathId);
- Y_VERIFY(it != Self->SolomonVolumes.end());
- Y_VERIFY(it->second);
-
- ui64 partitionId = rowset.GetValue<Schema::SolomonPartitions::PartitionId>();
- TLocalShardIdx localShardIdx = rowset.GetValue<Schema::SolomonPartitions::ShardId>();
- TShardIdx shardIdx = Self->MakeLocalId(localShardIdx);
-
- auto shardInfo = Self->ShardInfos.FindPtr(shardIdx);
- if (shardInfo) {
- it->second->Partitions[shardIdx] = new TSolomonPartitionInfo(partitionId, shardInfo->TabletID);
- } else {
- it->second->Partitions[shardIdx] = new TSolomonPartitionInfo(partitionId);
- }
-
-
- if (!rowset.Next())
- return false;
- }
- }
-
- // Read Alter Solomon volumes
- {
- auto rowset = db.Table<Schema::AlterSolomonVolumes>().Range().Select();
- if (!rowset.IsReady())
- return false;
-
- while (!rowset.EndOfSet()) {
- auto pathId = TPathId(rowset.GetValue<Schema::AlterSolomonVolumes::OwnerPathId>(),
- rowset.GetValue<Schema::AlterSolomonVolumes::LocalPathId>());
- ui64 version = rowset.GetValue<Schema::AlterSolomonVolumes::Version>();
-
- Y_VERIFY(Self->SolomonVolumes.contains(pathId));
- TSolomonVolumeInfo::TPtr solomon = Self->SolomonVolumes.at(pathId);
-
- Y_VERIFY(solomon->AlterData == nullptr);
- solomon->AlterData = solomon->CreateAlter(version);
-
- if (!rowset.Next())
- return false;
- }
- }
-
- // Read Alter Solomon partitions
- {
- auto rowset = db.Table<Schema::AlterSolomonPartitions>().Range().Select();
- if (!rowset.IsReady())
- return false;
-
- while (!rowset.EndOfSet()) {
- const auto pathId = TPathId(rowset.GetValue<Schema::AlterSolomonPartitions::OwnerPathId>(),
- rowset.GetValue<Schema::AlterSolomonPartitions::LocalPathId>());
-
- const auto shardIdx = TShardIdx(rowset.GetValue<Schema::AlterSolomonPartitions::ShardOwnerId>(),
- rowset.GetValue<Schema::AlterSolomonPartitions::ShardLocalIdx>());
-
- const ui64 partitionId = rowset.GetValue<Schema::AlterSolomonPartitions::PartitionId>();
-
- Y_VERIFY(Self->SolomonVolumes.contains(pathId));
- TSolomonVolumeInfo::TPtr solomon = Self->SolomonVolumes.at(pathId);
- Y_VERIFY(solomon->AlterData);
-
- if (solomon->Partitions.size() <= partitionId) {
- Y_VERIFY(!solomon->AlterData->Partitions.contains(shardIdx));
-
- auto shardInfo = Self->ShardInfos.FindPtr(shardIdx);
- if (shardInfo) {
- solomon->AlterData->Partitions[shardIdx] = new TSolomonPartitionInfo(partitionId, shardInfo->TabletID);
- } else {
- solomon->AlterData->Partitions[shardIdx] = new TSolomonPartitionInfo(partitionId);
- }
-
- } else {
- //old partition
- Y_VERIFY(solomon->AlterData->Partitions.contains(shardIdx));
- Y_VERIFY(solomon->AlterData->Partitions.at(shardIdx)->PartitionId == partitionId);
- Y_VERIFY(Self->ShardInfos.contains(shardIdx));
- }
-
- if (!rowset.Next())
- return false;
- }
- }
-
- // Read Table Indexes
- {
- TTableIndexRows indexes;
- if (!LoadTableIndexes(db, indexes)) {
- return false;
- }
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for TableIndexes"
- << ", readed records: " << indexes.size()
- << ", at schemeshard: " << Self->TabletID());
-
- for (auto& rec: indexes) {
- TPathId pathId = std::get<0>(rec);
- ui64 alterVersion = std::get<1>(rec);
- TTableIndexInfo::EType indexType = std::get<2>(rec);
- TTableIndexInfo::EState state = std::get<3>(rec);
-
- Y_VERIFY_S(Self->PathsById.contains(pathId), "Path doesn't exist, pathId: " << pathId);
- TPathElement::TPtr path = Self->PathsById.at(pathId);
- Y_VERIFY_S(path->IsTableIndex(), "Path is not a table index"
- << ", pathId: " << pathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(path->PathType));
-
- Y_VERIFY(!Self->Indexes.contains(pathId));
- Self->Indexes[pathId] = new TTableIndexInfo(alterVersion, indexType, state);
+
+ if (!rowset.Next())
+ return false;
+ }
+ }
+
+ // Read Solomon partitions
+ {
+ auto rowset = db.Table<Schema::SolomonPartitions>().Range().Select();
+ if (!rowset.IsReady())
+ return false;
+
+ while (!rowset.EndOfSet()) {
+ TLocalPathId localPathId = rowset.GetValue<Schema::SolomonPartitions::PathId>();
+ TPathId pathId = Self->MakeLocalId(localPathId);
+
+ auto it = Self->SolomonVolumes.find(pathId);
+ Y_VERIFY(it != Self->SolomonVolumes.end());
+ Y_VERIFY(it->second);
+
+ ui64 partitionId = rowset.GetValue<Schema::SolomonPartitions::PartitionId>();
+ TLocalShardIdx localShardIdx = rowset.GetValue<Schema::SolomonPartitions::ShardId>();
+ TShardIdx shardIdx = Self->MakeLocalId(localShardIdx);
+
+ auto shardInfo = Self->ShardInfos.FindPtr(shardIdx);
+ if (shardInfo) {
+ it->second->Partitions[shardIdx] = new TSolomonPartitionInfo(partitionId, shardInfo->TabletID);
+ } else {
+ it->second->Partitions[shardIdx] = new TSolomonPartitionInfo(partitionId);
+ }
+
+
+ if (!rowset.Next())
+ return false;
+ }
+ }
+
+ // Read Alter Solomon volumes
+ {
+ auto rowset = db.Table<Schema::AlterSolomonVolumes>().Range().Select();
+ if (!rowset.IsReady())
+ return false;
+
+ while (!rowset.EndOfSet()) {
+ auto pathId = TPathId(rowset.GetValue<Schema::AlterSolomonVolumes::OwnerPathId>(),
+ rowset.GetValue<Schema::AlterSolomonVolumes::LocalPathId>());
+ ui64 version = rowset.GetValue<Schema::AlterSolomonVolumes::Version>();
+
+ Y_VERIFY(Self->SolomonVolumes.contains(pathId));
+ TSolomonVolumeInfo::TPtr solomon = Self->SolomonVolumes.at(pathId);
+
+ Y_VERIFY(solomon->AlterData == nullptr);
+ solomon->AlterData = solomon->CreateAlter(version);
+
+ if (!rowset.Next())
+ return false;
+ }
+ }
+
+ // Read Alter Solomon partitions
+ {
+ auto rowset = db.Table<Schema::AlterSolomonPartitions>().Range().Select();
+ if (!rowset.IsReady())
+ return false;
+
+ while (!rowset.EndOfSet()) {
+ const auto pathId = TPathId(rowset.GetValue<Schema::AlterSolomonPartitions::OwnerPathId>(),
+ rowset.GetValue<Schema::AlterSolomonPartitions::LocalPathId>());
+
+ const auto shardIdx = TShardIdx(rowset.GetValue<Schema::AlterSolomonPartitions::ShardOwnerId>(),
+ rowset.GetValue<Schema::AlterSolomonPartitions::ShardLocalIdx>());
+
+ const ui64 partitionId = rowset.GetValue<Schema::AlterSolomonPartitions::PartitionId>();
+
+ Y_VERIFY(Self->SolomonVolumes.contains(pathId));
+ TSolomonVolumeInfo::TPtr solomon = Self->SolomonVolumes.at(pathId);
+ Y_VERIFY(solomon->AlterData);
+
+ if (solomon->Partitions.size() <= partitionId) {
+ Y_VERIFY(!solomon->AlterData->Partitions.contains(shardIdx));
+
+ auto shardInfo = Self->ShardInfos.FindPtr(shardIdx);
+ if (shardInfo) {
+ solomon->AlterData->Partitions[shardIdx] = new TSolomonPartitionInfo(partitionId, shardInfo->TabletID);
+ } else {
+ solomon->AlterData->Partitions[shardIdx] = new TSolomonPartitionInfo(partitionId);
+ }
+
+ } else {
+ //old partition
+ Y_VERIFY(solomon->AlterData->Partitions.contains(shardIdx));
+ Y_VERIFY(solomon->AlterData->Partitions.at(shardIdx)->PartitionId == partitionId);
+ Y_VERIFY(Self->ShardInfos.contains(shardIdx));
+ }
+
+ if (!rowset.Next())
+ return false;
+ }
+ }
+
+ // Read Table Indexes
+ {
+ TTableIndexRows indexes;
+ if (!LoadTableIndexes(db, indexes)) {
+ return false;
+ }
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for TableIndexes"
+ << ", readed records: " << indexes.size()
+ << ", at schemeshard: " << Self->TabletID());
+
+ for (auto& rec: indexes) {
+ TPathId pathId = std::get<0>(rec);
+ ui64 alterVersion = std::get<1>(rec);
+ TTableIndexInfo::EType indexType = std::get<2>(rec);
+ TTableIndexInfo::EState state = std::get<3>(rec);
+
+ Y_VERIFY_S(Self->PathsById.contains(pathId), "Path doesn't exist, pathId: " << pathId);
+ TPathElement::TPtr path = Self->PathsById.at(pathId);
+ Y_VERIFY_S(path->IsTableIndex(), "Path is not a table index"
+ << ", pathId: " << pathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(path->PathType));
+
+ Y_VERIFY(!Self->Indexes.contains(pathId));
+ Self->Indexes[pathId] = new TTableIndexInfo(alterVersion, indexType, state);
Self->IncrementPathDbRefCount(pathId);
- }
-
- // Read IndexesAlterData
- {
- auto rowset = db.Table<Schema::TableIndexAlterData>().Range().Select();
- if (!rowset.IsReady())
- return false;
-
- while (!rowset.EndOfSet()) {
- TLocalPathId localPathId = rowset.GetValue<Schema::TableIndexAlterData::PathId>();
- TPathId pathId(selfId, localPathId);
-
- ui64 alterVersion = rowset.GetValue<Schema::TableIndexAlterData::AlterVersion>();
- TTableIndexInfo::EType indexType = rowset.GetValue<Schema::TableIndexAlterData::IndexType>();
- TTableIndexInfo::EState state = rowset.GetValue<Schema::TableIndexAlterData::State>();
-
- Y_VERIFY_S(Self->PathsById.contains(pathId), "Path doesn't exist, pathId: " << pathId);
- TPathElement::TPtr path = Self->PathsById.at(pathId);
- Y_VERIFY_S(path->IsTableIndex(), "Path is not a table index, pathId: " << pathId);
-
- if (!Self->Indexes.contains(pathId)) {
- Self->Indexes[pathId] = TTableIndexInfo::NotExistedYet(indexType);
+ }
+
+ // Read IndexesAlterData
+ {
+ auto rowset = db.Table<Schema::TableIndexAlterData>().Range().Select();
+ if (!rowset.IsReady())
+ return false;
+
+ while (!rowset.EndOfSet()) {
+ TLocalPathId localPathId = rowset.GetValue<Schema::TableIndexAlterData::PathId>();
+ TPathId pathId(selfId, localPathId);
+
+ ui64 alterVersion = rowset.GetValue<Schema::TableIndexAlterData::AlterVersion>();
+ TTableIndexInfo::EType indexType = rowset.GetValue<Schema::TableIndexAlterData::IndexType>();
+ TTableIndexInfo::EState state = rowset.GetValue<Schema::TableIndexAlterData::State>();
+
+ Y_VERIFY_S(Self->PathsById.contains(pathId), "Path doesn't exist, pathId: " << pathId);
+ TPathElement::TPtr path = Self->PathsById.at(pathId);
+ Y_VERIFY_S(path->IsTableIndex(), "Path is not a table index, pathId: " << pathId);
+
+ if (!Self->Indexes.contains(pathId)) {
+ Self->Indexes[pathId] = TTableIndexInfo::NotExistedYet(indexType);
Self->IncrementPathDbRefCount(pathId);
- }
- auto tableIndex = Self->Indexes.at(pathId);
- Y_VERIFY(tableIndex->AlterData == nullptr);
- Y_VERIFY(tableIndex->AlterVersion < alterVersion);
- tableIndex->AlterData = new TTableIndexInfo(alterVersion, indexType, state);
-
- Y_VERIFY_S(Self->PathsById.contains(path->ParentPathId), "Parent path is not found"
- << ", index pathId: " << pathId
- << ", parent pathId: " << path->ParentPathId);
- TPathElement::TPtr parent = Self->PathsById.at(path->ParentPathId);
- Y_VERIFY_S(parent->IsTable(), "Parent path is not a table"
- << ", index pathId: " << pathId
- << ", parent pathId: " << path->ParentPathId);
-
- if (!rowset.Next()) {
- return false;
- }
- }
- }
- }
-
- // Read Table TableIndexKeys
- {
-
- TTableIndexKeyRows indexKeys;
+ }
+ auto tableIndex = Self->Indexes.at(pathId);
+ Y_VERIFY(tableIndex->AlterData == nullptr);
+ Y_VERIFY(tableIndex->AlterVersion < alterVersion);
+ tableIndex->AlterData = new TTableIndexInfo(alterVersion, indexType, state);
+
+ Y_VERIFY_S(Self->PathsById.contains(path->ParentPathId), "Parent path is not found"
+ << ", index pathId: " << pathId
+ << ", parent pathId: " << path->ParentPathId);
+ TPathElement::TPtr parent = Self->PathsById.at(path->ParentPathId);
+ Y_VERIFY_S(parent->IsTable(), "Parent path is not a table"
+ << ", index pathId: " << pathId
+ << ", parent pathId: " << path->ParentPathId);
+
+ if (!rowset.Next()) {
+ return false;
+ }
+ }
+ }
+ }
+
+ // Read Table TableIndexKeys
+ {
+
+ TTableIndexKeyRows indexKeys;
TTableIndexDataRows indexData;
- if (!LoadTableIndexeKeys(db, indexKeys)) {
- return false;
- }
-
+ if (!LoadTableIndexeKeys(db, indexKeys)) {
+ return false;
+ }
+
if (!LoadTableIndexDataColumns(db, indexData)) {
return false;
}
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for TableIndexKeys"
- << ", readed records: " << indexKeys.size()
- << ", at schemeshard: " << Self->TabletID());
-
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for TableIndexKeys"
+ << ", readed records: " << indexKeys.size()
+ << ", at schemeshard: " << Self->TabletID());
+
for (const auto& rec: indexKeys) {
- TPathId pathId = std::get<0>(rec);
- ui32 keyId = std::get<1>(rec);
- TString keyName = std::get<2>(rec);
-
- Y_VERIFY_S(Self->PathsById.contains(pathId), "Path doesn't exist, pathId: " << pathId);
- TPathElement::TPtr path = Self->PathsById.at(pathId);
- Y_VERIFY_S(path->IsTableIndex(), "Path is not a table index, pathId: " << pathId);
-
- Y_VERIFY(Self->Indexes.contains(pathId));
- auto tableIndex = Self->Indexes.at(pathId);
-
- Y_VERIFY(keyId == tableIndex->IndexKeys.size());
- tableIndex->IndexKeys.emplace_back(keyName);
- }
-
+ TPathId pathId = std::get<0>(rec);
+ ui32 keyId = std::get<1>(rec);
+ TString keyName = std::get<2>(rec);
+
+ Y_VERIFY_S(Self->PathsById.contains(pathId), "Path doesn't exist, pathId: " << pathId);
+ TPathElement::TPtr path = Self->PathsById.at(pathId);
+ Y_VERIFY_S(path->IsTableIndex(), "Path is not a table index, pathId: " << pathId);
+
+ Y_VERIFY(Self->Indexes.contains(pathId));
+ auto tableIndex = Self->Indexes.at(pathId);
+
+ Y_VERIFY(keyId == tableIndex->IndexKeys.size());
+ tableIndex->IndexKeys.emplace_back(keyName);
+ }
+
// See KIKIMR-13300 and restore VERIFY after at least one restart
TVector<std::pair<TPathId, ui32>> leakedDataColumns;
for (const auto& rec: indexData) {
@@ -2641,37 +2641,37 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
}
leakedDataColumns.clear();
- // Read TableIndexKeysAlterData
- {
- auto rowset = db.Table<Schema::TableIndexKeysAlterData>().Range().Select();
- if (!rowset.IsReady())
- return false;
-
- while (!rowset.EndOfSet()) {
- TLocalPathId localPathId = rowset.GetValue<Schema::TableIndexKeysAlterData::PathId>();
- TPathId pathId(selfId, localPathId);
-
- ui32 keyId = rowset.GetValue<Schema::TableIndexKeysAlterData::KeyId>();
- TString keyName = rowset.GetValue<Schema::TableIndexKeysAlterData::KeyName>();
-
- Y_VERIFY_S(Self->PathsById.contains(pathId), "Path doesn't exist, pathId: " << pathId);
- TPathElement::TPtr path = Self->PathsById.at(pathId);
- Y_VERIFY_S(path->IsTableIndex(), "Path is not a table index, pathId: " << pathId);
-
- Y_VERIFY(Self->Indexes.contains(pathId));
- auto tableIndex = Self->Indexes.at(pathId);
-
- Y_VERIFY(tableIndex->AlterData != nullptr);
- auto alterData = tableIndex->AlterData;
- Y_VERIFY(tableIndex->AlterVersion < alterData->AlterVersion);
-
- Y_VERIFY(keyId == alterData->IndexKeys.size());
- alterData->IndexKeys.emplace_back(keyName);
-
- if (!rowset.Next())
- return false;
- }
- }
+ // Read TableIndexKeysAlterData
+ {
+ auto rowset = db.Table<Schema::TableIndexKeysAlterData>().Range().Select();
+ if (!rowset.IsReady())
+ return false;
+
+ while (!rowset.EndOfSet()) {
+ TLocalPathId localPathId = rowset.GetValue<Schema::TableIndexKeysAlterData::PathId>();
+ TPathId pathId(selfId, localPathId);
+
+ ui32 keyId = rowset.GetValue<Schema::TableIndexKeysAlterData::KeyId>();
+ TString keyName = rowset.GetValue<Schema::TableIndexKeysAlterData::KeyName>();
+
+ Y_VERIFY_S(Self->PathsById.contains(pathId), "Path doesn't exist, pathId: " << pathId);
+ TPathElement::TPtr path = Self->PathsById.at(pathId);
+ Y_VERIFY_S(path->IsTableIndex(), "Path is not a table index, pathId: " << pathId);
+
+ Y_VERIFY(Self->Indexes.contains(pathId));
+ auto tableIndex = Self->Indexes.at(pathId);
+
+ Y_VERIFY(tableIndex->AlterData != nullptr);
+ auto alterData = tableIndex->AlterData;
+ Y_VERIFY(tableIndex->AlterVersion < alterData->AlterVersion);
+
+ Y_VERIFY(keyId == alterData->IndexKeys.size());
+ alterData->IndexKeys.emplace_back(keyName);
+
+ if (!rowset.Next())
+ return false;
+ }
+ }
// Read TableIndexDataColumnsAlterData
{
@@ -2715,8 +2715,8 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
db.Table<Schema::TableIndexDataColumnsAlterData>().Key(pair.first.OwnerId, pair.first.LocalPathId, pair.second).Delete();
}
}
- }
-
+ }
+
// Read CdcStream
{
auto rowset = db.Table<Schema::CdcStream>().Range().Select();
@@ -2738,7 +2738,7 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
Y_VERIFY_S(path->IsCdcStream(), "Path is not a cdc stream"
<< ", pathId: " << pathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(path->PathType));
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(path->PathType));
Y_VERIFY(!Self->CdcStreams.contains(pathId));
Self->CdcStreams[pathId] = new TCdcStreamInfo(alterVersion, mode, state);
@@ -2772,7 +2772,7 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
Y_VERIFY_S(path->IsCdcStream(), "Path is not a cdc stream"
<< ", pathId: " << pathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(path->PathType));
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(path->PathType));
if (!Self->CdcStreams.contains(pathId)) {
Y_VERIFY(alterVersion == 1);
@@ -2803,81 +2803,81 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
}
}
- // Read DomainsPools
- {
- auto rowset = db.Table<Schema::StoragePools>().Range().Select();
- if (!rowset.IsReady())
- return false;
- while (!rowset.EndOfSet()) {
- TLocalPathId localPathId = rowset.GetValue<Schema::StoragePools::PathId>();
- TPathId pathId(selfId, localPathId);
-
- TString name = rowset.GetValue<Schema::StoragePools::PoolName>();
- TString kind = rowset.GetValue<Schema::StoragePools::PoolKind>();
-
+ // Read DomainsPools
+ {
+ auto rowset = db.Table<Schema::StoragePools>().Range().Select();
+ if (!rowset.IsReady())
+ return false;
+ while (!rowset.EndOfSet()) {
+ TLocalPathId localPathId = rowset.GetValue<Schema::StoragePools::PathId>();
+ TPathId pathId(selfId, localPathId);
+
+ TString name = rowset.GetValue<Schema::StoragePools::PoolName>();
+ TString kind = rowset.GetValue<Schema::StoragePools::PoolKind>();
+
Y_VERIFY(Self->SubDomains.contains(pathId));
- Self->SubDomains[pathId]->AddStoragePool(TStoragePool(name, kind));
-
- if (!rowset.Next())
- return false;
- }
-
- // Read DomainsPoolsAlterData
- {
- auto rowset = db.Table<Schema::StoragePoolsAlterData>().Range().Select();
- if (!rowset.IsReady())
- return false;
-
- while (!rowset.EndOfSet()) {
- TLocalPathId localPathId = rowset.GetValue<Schema::StoragePoolsAlterData::PathId>();
- TPathId pathId(selfId, localPathId);
-
- TString name = rowset.GetValue<Schema::StoragePoolsAlterData::PoolName>();
- TString kind = rowset.GetValue<Schema::StoragePoolsAlterData::PoolKind>();
-
+ Self->SubDomains[pathId]->AddStoragePool(TStoragePool(name, kind));
+
+ if (!rowset.Next())
+ return false;
+ }
+
+ // Read DomainsPoolsAlterData
+ {
+ auto rowset = db.Table<Schema::StoragePoolsAlterData>().Range().Select();
+ if (!rowset.IsReady())
+ return false;
+
+ while (!rowset.EndOfSet()) {
+ TLocalPathId localPathId = rowset.GetValue<Schema::StoragePoolsAlterData::PathId>();
+ TPathId pathId(selfId, localPathId);
+
+ TString name = rowset.GetValue<Schema::StoragePoolsAlterData::PoolName>();
+ TString kind = rowset.GetValue<Schema::StoragePoolsAlterData::PoolKind>();
+
Y_VERIFY(Self->SubDomains.contains(pathId));
- auto subdomainInfo = Self->SubDomains[pathId];
- Y_VERIFY(subdomainInfo->GetAlter());
- subdomainInfo->GetAlter()->AddStoragePool(TStoragePool(name, kind));
-
- if (!rowset.Next())
- return false;
- }
- }
- }
-
- {
- for(auto item: Self->SubDomains) {
- auto pathId = item.first;
- Y_VERIFY_S(Self->PathsById.contains(pathId), "Unknown pathId: " << pathId);
- auto pathItem = Self->PathsById.at(pathId);
- if (pathItem->Dropped()) {
- continue;
- }
- if (pathItem->IsRoot() && Self->IsDomainSchemeShard) {
- continue;
- }
- auto subDomainInfo = item.second;
- subDomainInfo->Initialize(Self->ShardInfos);
- if (subDomainInfo->GetAlter()) {
- subDomainInfo->GetAlter()->Initialize(Self->ShardInfos);
- }
- }
-
- if (!Self->IsDomainSchemeShard && Self->SubDomains.contains(Self->RootPathId())) {
- Self->SubDomains.at(Self->RootPathId())->Initialize(Self->ShardInfos);
- }
- }
-
+ auto subdomainInfo = Self->SubDomains[pathId];
+ Y_VERIFY(subdomainInfo->GetAlter());
+ subdomainInfo->GetAlter()->AddStoragePool(TStoragePool(name, kind));
+
+ if (!rowset.Next())
+ return false;
+ }
+ }
+ }
+
+ {
+ for(auto item: Self->SubDomains) {
+ auto pathId = item.first;
+ Y_VERIFY_S(Self->PathsById.contains(pathId), "Unknown pathId: " << pathId);
+ auto pathItem = Self->PathsById.at(pathId);
+ if (pathItem->Dropped()) {
+ continue;
+ }
+ if (pathItem->IsRoot() && Self->IsDomainSchemeShard) {
+ continue;
+ }
+ auto subDomainInfo = item.second;
+ subDomainInfo->Initialize(Self->ShardInfos);
+ if (subDomainInfo->GetAlter()) {
+ subDomainInfo->GetAlter()->Initialize(Self->ShardInfos);
+ }
+ }
+
+ if (!Self->IsDomainSchemeShard && Self->SubDomains.contains(Self->RootPathId())) {
+ Self->SubDomains.at(Self->RootPathId())->Initialize(Self->ShardInfos);
+ }
+ }
+
// Read BlockStoreVolumes
{
auto rowset = db.Table<Schema::BlockStoreVolumes>().Range().Select();
if (!rowset.IsReady())
return false;
-
+
while (!rowset.EndOfSet()) {
- TLocalPathId localPathId = rowset.GetValue<Schema::BlockStoreVolumes::PathId>();
- TPathId pathId(selfId, localPathId);
+ TLocalPathId localPathId = rowset.GetValue<Schema::BlockStoreVolumes::PathId>();
+ TPathId pathId(selfId, localPathId);
TBlockStoreVolumeInfo::TPtr volume = new TBlockStoreVolumeInfo();
{
@@ -2893,7 +2893,7 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
auto it = nbsVolumeShards.find(pathId);
if (it != nbsVolumeShards.end()) {
- auto shardIdx = it->second;
+ auto shardIdx = it->second;
const auto& shard = Self->ShardInfos[shardIdx];
volume->VolumeTabletId = shard.TabletID;
volume->VolumeShardIdx = shardIdx;
@@ -2909,13 +2909,13 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
auto rowset = db.Table<Schema::BlockStorePartitions>().Range().Select();
if (!rowset.IsReady())
return false;
-
+
while (!rowset.EndOfSet()) {
- TLocalPathId localPathId = rowset.GetValue<Schema::BlockStorePartitions::PathId>();
- TPathId pathId(selfId, localPathId);
-
- TLocalShardIdx localShardIdx = rowset.GetValue<Schema::BlockStorePartitions::ShardIdx>();
- TShardIdx shardIdx = Self->MakeLocalId(localShardIdx);
+ TLocalPathId localPathId = rowset.GetValue<Schema::BlockStorePartitions::PathId>();
+ TPathId pathId(selfId, localPathId);
+
+ TLocalShardIdx localShardIdx = rowset.GetValue<Schema::BlockStorePartitions::ShardIdx>();
+ TShardIdx shardIdx = Self->MakeLocalId(localShardIdx);
auto it = Self->BlockStoreVolumes.find(pathId);
Y_VERIFY(it != Self->BlockStoreVolumes.end());
@@ -2939,10 +2939,10 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
auto rowset = db.Table<Schema::BlockStoreVolumeAlters>().Range().Select();
if (!rowset.IsReady())
return false;
-
+
while (!rowset.EndOfSet()) {
- TLocalPathId localPathId = rowset.GetValue<Schema::BlockStoreVolumeAlters::PathId>();
- TPathId pathId(selfId, localPathId);
+ TLocalPathId localPathId = rowset.GetValue<Schema::BlockStoreVolumeAlters::PathId>();
+ TPathId pathId(selfId, localPathId);
TBlockStoreVolumeInfo::TPtr alterData = new TBlockStoreVolumeInfo();
{
@@ -3032,159 +3032,159 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
// Read KesusInfos
{
- TKesusInfosRows kesusRows;
- if (!LoadKesusInfos(db, kesusRows)) {
+ TKesusInfosRows kesusRows;
+ if (!LoadKesusInfos(db, kesusRows)) {
return false;
- }
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for KesusInfos"
- << ", readed records: " << kesusRows.size()
- << ", at schemeshard: " << Self->TabletID());
-
- for (const auto& rec: kesusRows) {
- const TPathId& pathId = std::get<0>(rec);
- const TString& config = std::get<1>(rec);
- const ui64& version = std::get<2>(rec);
-
+ }
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for KesusInfos"
+ << ", readed records: " << kesusRows.size()
+ << ", at schemeshard: " << Self->TabletID());
+
+ for (const auto& rec: kesusRows) {
+ const TPathId& pathId = std::get<0>(rec);
+ const TString& config = std::get<1>(rec);
+ const ui64& version = std::get<2>(rec);
+
TKesusInfo::TPtr kesus = new TKesusInfo();
{
- bool parseOk = ParseFromStringNoSizeLimit(kesus->Config, config);
+ bool parseOk = ParseFromStringNoSizeLimit(kesus->Config, config);
Y_VERIFY(parseOk);
- kesus->Version = version;
+ kesus->Version = version;
}
Self->KesusInfos[pathId] = kesus;
Self->IncrementPathDbRefCount(pathId);
auto it = kesusShards.find(pathId);
if (it != kesusShards.end()) {
- const auto& shardIdx = it->second;
+ const auto& shardIdx = it->second;
const auto& shard = Self->ShardInfos[shardIdx];
kesus->KesusShardIdx = shardIdx;
kesus->KesusTabletId = shard.TabletID;
}
- }
- }
+ }
+ }
- // Read KesusAlters
- {
- TKesusAlterRows kesusAlterRows;
- if (!LoadKesusAlters(db, kesusAlterRows)) {
- return false;
+ // Read KesusAlters
+ {
+ TKesusAlterRows kesusAlterRows;
+ if (!LoadKesusAlters(db, kesusAlterRows)) {
+ return false;
}
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for KesusAlters"
- << ", readed records: " << kesusAlterRows.size()
- << ", at schemeshard: " << Self->TabletID());
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for KesusAlters"
+ << ", readed records: " << kesusAlterRows.size()
+ << ", at schemeshard: " << Self->TabletID());
- for (const auto& rec: kesusAlterRows) {
- const TPathId& pathId = std::get<0>(rec);
- const TString& config = std::get<1>(rec);
- const ui64& version = std::get<2>(rec);
+ for (const auto& rec: kesusAlterRows) {
+ const TPathId& pathId = std::get<0>(rec);
+ const TString& config = std::get<1>(rec);
+ const ui64& version = std::get<2>(rec);
- auto it = Self->KesusInfos.find(pathId);
- Y_VERIFY(it != Self->KesusInfos.end());
- TKesusInfo::TPtr kesus = it->second;
- Y_VERIFY(kesus);
- {
+ auto it = Self->KesusInfos.find(pathId);
+ Y_VERIFY(it != Self->KesusInfos.end());
+ TKesusInfo::TPtr kesus = it->second;
+ Y_VERIFY(kesus);
+ {
kesus->AlterConfig.Reset(new Ydb::Coordination::Config);
- bool parseOk = ParseFromStringNoSizeLimit(*kesus->AlterConfig, config);
- Y_VERIFY(parseOk);
- kesus->AlterVersion = version;
+ bool parseOk = ParseFromStringNoSizeLimit(*kesus->AlterConfig, config);
+ Y_VERIFY(parseOk);
+ kesus->AlterVersion = version;
}
}
}
- TVector<TOperationId> splitOpIds;
- TVector<TOperationId> forceDropOpIds;
+ TVector<TOperationId> splitOpIds;
+ TVector<TOperationId> forceDropOpIds;
THashSet<TPathId> pathsUnderOperation;
// Read in-flight txid
{
- auto txInFlightRowset = db.Table<Schema::TxInFlightV2>().Range().Select();
+ auto txInFlightRowset = db.Table<Schema::TxInFlightV2>().Range().Select();
if (!txInFlightRowset.IsReady())
return false;
while (!txInFlightRowset.EndOfSet()) {
- auto operationId = TOperationId(txInFlightRowset.GetValue<Schema::TxInFlightV2::TxId>(),
- txInFlightRowset.GetValue<Schema::TxInFlightV2::TxPartId>());
-
- TTxState& txState = Self->TxInFlight[operationId];
-
- txState.TxType = (TTxState::ETxType)txInFlightRowset.GetValue<Schema::TxInFlightV2::TxType>();
-
- txState.State = (TTxState::ETxState)txInFlightRowset.GetValue<Schema::TxInFlightV2::State>();
-
- TLocalPathId ownerTarget = txInFlightRowset.GetValue<Schema::TxInFlightV2::TargetOwnerPathId>();
- TLocalPathId localTarget = txInFlightRowset.GetValue<Schema::TxInFlightV2::TargetPathId>();
- txState.TargetPathId = ownerTarget == InvalidOwnerId
- ? TPathId(selfId, localTarget)
- : TPathId(ownerTarget, localTarget);
-
- txState.MinStep = txInFlightRowset.GetValueOrDefault<Schema::TxInFlightV2::MinStep>(InvalidStepId);
- txState.PlanStep = txInFlightRowset.GetValueOrDefault<Schema::TxInFlightV2::PlanStep>(InvalidStepId);
-
- TString extraData = txInFlightRowset.GetValueOrDefault<Schema::TxInFlightV2::ExtraBytes>("");
- txState.StartTime = TInstant::MicroSeconds(txInFlightRowset.GetValueOrDefault<Schema::TxInFlightV2::StartTime>());
+ auto operationId = TOperationId(txInFlightRowset.GetValue<Schema::TxInFlightV2::TxId>(),
+ txInFlightRowset.GetValue<Schema::TxInFlightV2::TxPartId>());
+
+ TTxState& txState = Self->TxInFlight[operationId];
+
+ txState.TxType = (TTxState::ETxType)txInFlightRowset.GetValue<Schema::TxInFlightV2::TxType>();
+
+ txState.State = (TTxState::ETxState)txInFlightRowset.GetValue<Schema::TxInFlightV2::State>();
+
+ TLocalPathId ownerTarget = txInFlightRowset.GetValue<Schema::TxInFlightV2::TargetOwnerPathId>();
+ TLocalPathId localTarget = txInFlightRowset.GetValue<Schema::TxInFlightV2::TargetPathId>();
+ txState.TargetPathId = ownerTarget == InvalidOwnerId
+ ? TPathId(selfId, localTarget)
+ : TPathId(ownerTarget, localTarget);
+
+ txState.MinStep = txInFlightRowset.GetValueOrDefault<Schema::TxInFlightV2::MinStep>(InvalidStepId);
+ txState.PlanStep = txInFlightRowset.GetValueOrDefault<Schema::TxInFlightV2::PlanStep>(InvalidStepId);
+
+ TString extraData = txInFlightRowset.GetValueOrDefault<Schema::TxInFlightV2::ExtraBytes>("");
+ txState.StartTime = TInstant::MicroSeconds(txInFlightRowset.GetValueOrDefault<Schema::TxInFlightV2::StartTime>());
txState.DataTotalSize = txInFlightRowset.GetValueOrDefault<Schema::TxInFlightV2::DataTotalSize>(0);
txState.Cancel = txInFlightRowset.GetValueOrDefault<Schema::TxInFlightV2::CancelBackup>(false);
- txState.BuildIndexId = txInFlightRowset.GetValueOrDefault<Schema::TxInFlightV2::BuildIndexId>();
-
- txState.SourcePathId = TPathId(txInFlightRowset.GetValueOrDefault<Schema::TxInFlightV2::SourceOwnerId>(),
- txInFlightRowset.GetValueOrDefault<Schema::TxInFlightV2::SourceLocalPathId>());
-
- if (txState.TxType == TTxState::TxCopyTable && txState.SourcePathId) {
- Y_VERIFY(txState.SourcePathId);
- TPathElement::TPtr srcPath = Self->PathsById.at(txState.SourcePathId);
- Y_VERIFY_S(srcPath, "Null path element, pathId: " << txState.SourcePathId);
-
- // CopyTable source must not be altered or dropped while the Tx is in progress
- srcPath->PathState = TPathElement::EPathState::EPathStateCopying;
- srcPath->DbRefCount++;
- }
-
- if (txState.TxType == TTxState::TxMoveTable || txState.TxType == TTxState::TxMoveTableIndex) {
- Y_VERIFY(txState.SourcePathId);
- TPathElement::TPtr srcPath = Self->PathsById.at(txState.SourcePathId);
- Y_VERIFY_S(srcPath, "Null path element, pathId: " << txState.SourcePathId);
-
- // Moving source must not be altered or dropped while the Tx is in progress
- if (!srcPath->Dropped()) {
- srcPath->PathState = TPathElement::EPathState::EPathStateMoving;
- }
- srcPath->DbRefCount++;
- }
-
- if (txState.TxType == TTxState::TxCreateSubDomain) {
+ txState.BuildIndexId = txInFlightRowset.GetValueOrDefault<Schema::TxInFlightV2::BuildIndexId>();
+
+ txState.SourcePathId = TPathId(txInFlightRowset.GetValueOrDefault<Schema::TxInFlightV2::SourceOwnerId>(),
+ txInFlightRowset.GetValueOrDefault<Schema::TxInFlightV2::SourceLocalPathId>());
+
+ if (txState.TxType == TTxState::TxCopyTable && txState.SourcePathId) {
+ Y_VERIFY(txState.SourcePathId);
+ TPathElement::TPtr srcPath = Self->PathsById.at(txState.SourcePathId);
+ Y_VERIFY_S(srcPath, "Null path element, pathId: " << txState.SourcePathId);
+
+ // CopyTable source must not be altered or dropped while the Tx is in progress
+ srcPath->PathState = TPathElement::EPathState::EPathStateCopying;
+ srcPath->DbRefCount++;
+ }
+
+ if (txState.TxType == TTxState::TxMoveTable || txState.TxType == TTxState::TxMoveTableIndex) {
+ Y_VERIFY(txState.SourcePathId);
+ TPathElement::TPtr srcPath = Self->PathsById.at(txState.SourcePathId);
+ Y_VERIFY_S(srcPath, "Null path element, pathId: " << txState.SourcePathId);
+
+ // Moving source must not be altered or dropped while the Tx is in progress
+ if (!srcPath->Dropped()) {
+ srcPath->PathState = TPathElement::EPathState::EPathStateMoving;
+ }
+ srcPath->DbRefCount++;
+ }
+
+ if (txState.TxType == TTxState::TxCreateSubDomain) {
Y_VERIFY(Self->SubDomains.contains(txState.TargetPathId));
- auto subDomainInfo = Self->SubDomains.at(txState.TargetPathId);
+ auto subDomainInfo = Self->SubDomains.at(txState.TargetPathId);
if (txState.State <= TTxState::Propose) {
Y_VERIFY(subDomainInfo->GetAlter());
}
- } else if (txState.TxType == TTxState::TxSplitTablePartition || txState.TxType == TTxState::TxMergeTablePartition) {
+ } else if (txState.TxType == TTxState::TxSplitTablePartition || txState.TxType == TTxState::TxMergeTablePartition) {
Y_VERIFY(!extraData.empty(), "Split Tx must have non-empty split description");
txState.SplitDescription = std::make_shared<NKikimrTxDataShard::TSplitMergeDescription>();
bool deserializeRes = ParseFromStringNoSizeLimit(*txState.SplitDescription, extraData);
Y_VERIFY(deserializeRes);
- splitOpIds.push_back(operationId);
+ splitOpIds.push_back(operationId);
- Y_VERIFY(Self->Tables.contains(txState.TargetPathId));
- TTableInfo::TPtr tableInfo = Self->Tables.at(txState.TargetPathId);
- tableInfo->RegisterSplitMegreOp(operationId, txState);
+ Y_VERIFY(Self->Tables.contains(txState.TargetPathId));
+ TTableInfo::TPtr tableInfo = Self->Tables.at(txState.TargetPathId);
+ tableInfo->RegisterSplitMegreOp(operationId, txState);
} else if (txState.TxType == TTxState::TxAlterTable) {
if (txState.State <= TTxState::Propose) {
// If state is >=Propose then alter has already been applied to the table
// and AlterData should be cleared
- TPathId tablePathId = txState.TargetPathId;
+ TPathId tablePathId = txState.TargetPathId;
+
+ Y_VERIFY_S(Self->PathsById.contains(tablePathId), "Path doesn't exist, pathId: " << tablePathId);
+ Y_VERIFY_S(Self->PathsById.at(tablePathId)->IsTable(), "Path is not a table, pathId: " << tablePathId);
+ Y_VERIFY_S(Self->Tables.FindPtr(tablePathId), "Table doen't exist, pathId: " << tablePathId);
- Y_VERIFY_S(Self->PathsById.contains(tablePathId), "Path doesn't exist, pathId: " << tablePathId);
- Y_VERIFY_S(Self->PathsById.at(tablePathId)->IsTable(), "Path is not a table, pathId: " << tablePathId);
- Y_VERIFY_S(Self->Tables.FindPtr(tablePathId), "Table doen't exist, pathId: " << tablePathId);
-
- // legacy, ???
- Y_VERIFY(Self->Tables.contains(tablePathId));
- TTableInfo::TPtr tableInfo = Self->Tables.at(tablePathId);
- tableInfo->InitAlterData();
+ // legacy, ???
+ Y_VERIFY(Self->Tables.contains(tablePathId));
+ TTableInfo::TPtr tableInfo = Self->Tables.at(tablePathId);
+ tableInfo->InitAlterData();
tableInfo->DeserializeAlterExtraData(extraData);
}
} else if (txState.TxType == TTxState::TxBackup || txState.TxType == TTxState::TxRestore) {
@@ -3206,59 +3206,59 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
txState.ShardStatuses[shardIdx] = TTxState::TShardStatus(success, error, bytes, rows);
}
- } else if (txState.TxType == TTxState::TxForceDropSubDomain || txState.TxType == TTxState::TxForceDropExtSubDomain) {
- forceDropOpIds.push_back(operationId);
- } else if (txState.TxType == TTxState::TxAlterUserAttributes) {
- Y_VERIFY_S(Self->PathsById.contains(txState.TargetPathId), "Unknown pathId: " << txState.TargetPathId);
- TPathElement::TPtr path = Self->PathsById.at(txState.TargetPathId);
- if (!path->UserAttrs->AlterData) {
- path->UserAttrs->AlterData = new TUserAttributes(path->UserAttrs->AlterVersion + 1);
- }
+ } else if (txState.TxType == TTxState::TxForceDropSubDomain || txState.TxType == TTxState::TxForceDropExtSubDomain) {
+ forceDropOpIds.push_back(operationId);
+ } else if (txState.TxType == TTxState::TxAlterUserAttributes) {
+ Y_VERIFY_S(Self->PathsById.contains(txState.TargetPathId), "Unknown pathId: " << txState.TargetPathId);
+ TPathElement::TPtr path = Self->PathsById.at(txState.TargetPathId);
+ if (!path->UserAttrs->AlterData) {
+ path->UserAttrs->AlterData = new TUserAttributes(path->UserAttrs->AlterVersion + 1);
+ }
}
-
+
Y_VERIFY(txState.TxType != TTxState::TxInvalid);
Y_VERIFY(txState.State != TTxState::Invalid);
// Change path state (cause there's a transaction on it)
// It's possible to restore Create or Alter TX on dropped PathId. Preserve 'NotExists' state.
- Y_VERIFY_S(Self->PathsById.contains(txState.TargetPathId), "No path element"
- << ", txId: " << operationId.GetTxId()
- << ", pathId: " << txState.TargetPathId);
- TPathElement::TPtr path = Self->PathsById.at(txState.TargetPathId);
- Y_VERIFY_S(path, "No path element for Tx: " << operationId.GetTxId() << ", pathId: " << txState.TargetPathId);
+ Y_VERIFY_S(Self->PathsById.contains(txState.TargetPathId), "No path element"
+ << ", txId: " << operationId.GetTxId()
+ << ", pathId: " << txState.TargetPathId);
+ TPathElement::TPtr path = Self->PathsById.at(txState.TargetPathId);
+ Y_VERIFY_S(path, "No path element for Tx: " << operationId.GetTxId() << ", pathId: " << txState.TargetPathId);
path->PathState = CalcPathState(txState.TxType, path->PathState);
-
- if (path->PathState == TPathElement::EPathState::EPathStateDrop) {
- path->DropTxId = operationId.GetTxId();
- }
-
- if (txState.TxType != TTxState::TxSplitTablePartition && txState.TxType != TTxState::TxMergeTablePartition) {
- path->LastTxId = operationId.GetTxId();
- }
+
+ if (path->PathState == TPathElement::EPathState::EPathStateDrop) {
+ path->DropTxId = operationId.GetTxId();
+ }
+
+ if (txState.TxType != TTxState::TxSplitTablePartition && txState.TxType != TTxState::TxMergeTablePartition) {
+ path->LastTxId = operationId.GetTxId();
+ }
path->DbRefCount++;
// Remember which paths are still under operation
pathsUnderOperation.insert(txState.TargetPathId);
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Adjusted PathState"
- << ", pathId: " << txState.TargetPathId
- << ", name: " << path->Name.data()
- << ", state: " << NKikimrSchemeOp::EPathState_Name(path->PathState)
- << ", txId: " << operationId.GetTxId()
- << ", TxType: " << TTxState::TypeName(txState.TxType)
- << ", LastTxId: " << path->LastTxId);
-
- if (!Self->Operations.contains(operationId.GetTxId())) {
- Self->Operations[operationId.GetTxId()] = new TOperation(operationId.GetTxId());
- }
-
- TOperation::TPtr operation = Self->Operations.at(operationId.GetTxId());
- Y_VERIFY(operationId.GetSubTxId() == operation->Parts.size());
- ISubOperationBase::TPtr part = operation->RestorePart(txState.TxType, txState.State);
- operation->AddPart(part);
-
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Adjusted PathState"
+ << ", pathId: " << txState.TargetPathId
+ << ", name: " << path->Name.data()
+ << ", state: " << NKikimrSchemeOp::EPathState_Name(path->PathState)
+ << ", txId: " << operationId.GetTxId()
+ << ", TxType: " << TTxState::TypeName(txState.TxType)
+ << ", LastTxId: " << path->LastTxId);
+
+ if (!Self->Operations.contains(operationId.GetTxId())) {
+ Self->Operations[operationId.GetTxId()] = new TOperation(operationId.GetTxId());
+ }
+
+ TOperation::TPtr operation = Self->Operations.at(operationId.GetTxId());
+ Y_VERIFY(operationId.GetSubTxId() == operation->Parts.size());
+ ISubOperationBase::TPtr part = operation->RestorePart(txState.TxType, txState.State);
+ operation->AddPart(part);
+
if (!txInFlightRowset.Next())
return false;
}
@@ -3266,53 +3266,53 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
// Read tx's shards
{
- TTxShardsRows txShardsRows;
- if (!LoadTxShards(db, txShardsRows)) {
+ TTxShardsRows txShardsRows;
+ if (!LoadTxShards(db, txShardsRows)) {
return false;
- }
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for TxShards"
- << ", readed records: " << txShardsRows.size()
- << ", at schemeshard: " << Self->TabletID());
-
- for (auto& rec: txShardsRows) {
- TOperationId operationId = std::get<0>(rec);
- TShardIdx shardIdx = std::get<1>(rec);;
- TTxState::ETxState operation = std::get<2>(rec);
-
- TTxState* txState = Self->FindTx(operationId);
- Y_VERIFY_S(txState, "There's shard for unknown Operation"
- << ", shardIdx: " << shardIdx
- << ", txId: " << operationId.GetTxId());
-
- // shard no present in ShardInfos if it is deleted, type unknown
- auto type = Self->ShardInfos.contains(shardIdx) ? Self->ShardInfos.at(shardIdx).TabletType : ETabletType::TypeInvalid;
- txState->Shards.emplace_back(TTxState::TShardOperation(shardIdx, type, operation));
-
- if (!Self->ShardInfos.contains(shardIdx)) {
- if (txState->CanDeleteParts()
- || ((txState->TxType == TTxState::TxAlterTable || txState->TxType == TTxState::TxCopyTable) //KIKIMR-7723
- && (txState->State == TTxState::Waiting || txState->State == TTxState::CreateParts)))
- {
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Already deleted shard in operation"
- << ", shardIdx: " << shardIdx
- << ", txId: " << operationId.GetTxId()
- << ", TxType: " << TTxState::TypeName(txState->TxType)
- << ", TxState: " << TTxState::StateName(txState->State)
- );
- } else {
- Y_VERIFY_S(Self->ShardInfos.contains(shardIdx), "Unknown shard"
- << ", shardIdx: " << shardIdx
- << ", txId: " << operationId.GetTxId()
- << ", TxType: " << TTxState::TypeName(txState->TxType)
- << ", TxState: " << TTxState::StateName(txState->State));
- }
- } else { // remove that branch since we sure in persisting SourcePathId
+ }
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for TxShards"
+ << ", readed records: " << txShardsRows.size()
+ << ", at schemeshard: " << Self->TabletID());
+
+ for (auto& rec: txShardsRows) {
+ TOperationId operationId = std::get<0>(rec);
+ TShardIdx shardIdx = std::get<1>(rec);;
+ TTxState::ETxState operation = std::get<2>(rec);
+
+ TTxState* txState = Self->FindTx(operationId);
+ Y_VERIFY_S(txState, "There's shard for unknown Operation"
+ << ", shardIdx: " << shardIdx
+ << ", txId: " << operationId.GetTxId());
+
+ // shard no present in ShardInfos if it is deleted, type unknown
+ auto type = Self->ShardInfos.contains(shardIdx) ? Self->ShardInfos.at(shardIdx).TabletType : ETabletType::TypeInvalid;
+ txState->Shards.emplace_back(TTxState::TShardOperation(shardIdx, type, operation));
+
+ if (!Self->ShardInfos.contains(shardIdx)) {
+ if (txState->CanDeleteParts()
+ || ((txState->TxType == TTxState::TxAlterTable || txState->TxType == TTxState::TxCopyTable) //KIKIMR-7723
+ && (txState->State == TTxState::Waiting || txState->State == TTxState::CreateParts)))
+ {
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Already deleted shard in operation"
+ << ", shardIdx: " << shardIdx
+ << ", txId: " << operationId.GetTxId()
+ << ", TxType: " << TTxState::TypeName(txState->TxType)
+ << ", TxState: " << TTxState::StateName(txState->State)
+ );
+ } else {
+ Y_VERIFY_S(Self->ShardInfos.contains(shardIdx), "Unknown shard"
+ << ", shardIdx: " << shardIdx
+ << ", txId: " << operationId.GetTxId()
+ << ", TxType: " << TTxState::TypeName(txState->TxType)
+ << ", TxState: " << TTxState::StateName(txState->State));
+ }
+ } else { // remove that branch since we sure in persisting SourcePathId
// Figure out source path id for the Tx (for CopyTable)
if (Self->ShardInfos.at(shardIdx).PathId != txState->TargetPathId &&
- !txState->SourcePathId &&
+ !txState->SourcePathId &&
txState->TxType != TTxState::TxForceDropSubDomain &&
txState->TxType != TTxState::TxForceDropExtSubDomain &&
txState->TxType != TTxState::TxCreateOlapTable &&
@@ -3325,77 +3325,77 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
txState->TxType != TTxState::TxAlterReplication &&
txState->TxType != TTxState::TxDropReplication)
{
- Y_VERIFY_S(txState->TxType == TTxState::TxCopyTable, "Only CopyTable Tx can have participating shards from a different table"
- << ", txId: " << operationId.GetTxId()
- << ", targetPathId: " << txState->TargetPathId
- << ", shardIdx: " << shardIdx
- << ", shardPathId: " << Self->ShardInfos.at(shardIdx).PathId);
-
- txState->SourcePathId = Self->ShardInfos.at(shardIdx).PathId;
+ Y_VERIFY_S(txState->TxType == TTxState::TxCopyTable, "Only CopyTable Tx can have participating shards from a different table"
+ << ", txId: " << operationId.GetTxId()
+ << ", targetPathId: " << txState->TargetPathId
+ << ", shardIdx: " << shardIdx
+ << ", shardPathId: " << Self->ShardInfos.at(shardIdx).PathId);
+
+ txState->SourcePathId = Self->ShardInfos.at(shardIdx).PathId;
Y_VERIFY(txState->SourcePathId != InvalidPathId);
- Y_VERIFY_S(Self->PathsById.contains(txState->SourcePathId), "No source path element for Operation"
- << ", txId: " << operationId.GetTxId()
- << ", pathId: " << txState->SourcePathId);
-
- TPathElement::TPtr srcPath = Self->PathsById.at(txState->SourcePathId);
- Y_VERIFY_S(srcPath, "Null path element, pathId: " << txState->SourcePathId);
-
+ Y_VERIFY_S(Self->PathsById.contains(txState->SourcePathId), "No source path element for Operation"
+ << ", txId: " << operationId.GetTxId()
+ << ", pathId: " << txState->SourcePathId);
+
+ TPathElement::TPtr srcPath = Self->PathsById.at(txState->SourcePathId);
+ Y_VERIFY_S(srcPath, "Null path element, pathId: " << txState->SourcePathId);
+
// CopyTable source must not be altered or dropped while the Tx is in progress
srcPath->PathState = TPathElement::EPathState::EPathStateCopying;
- srcPath->DbRefCount++;
+ srcPath->DbRefCount++;
}
}
}
}
// After all shard operations are loaded we can fill range ends for shards participating in split operations
- for (TOperationId opId : splitOpIds) {
- THashMap<TShardIdx, TString> shardIdxToRangeEnd;
- TTxState* txState = Self->FindTx(opId);
- Y_VERIFY_S(txState, "No txState for split/merge opId, txId: " << opId.GetTxId());
+ for (TOperationId opId : splitOpIds) {
+ THashMap<TShardIdx, TString> shardIdxToRangeEnd;
+ TTxState* txState = Self->FindTx(opId);
+ Y_VERIFY_S(txState, "No txState for split/merge opId, txId: " << opId.GetTxId());
Y_VERIFY(txState->SplitDescription);
for (ui32 i = 0; i < txState->SplitDescription->DestinationRangesSize(); ++i) {
const auto& dst = txState->SplitDescription->GetDestinationRanges(i);
- auto localShardIdx = TLocalShardIdx(dst.GetShardIdx());
- auto shardIdx = Self->MakeLocalId(localShardIdx);
+ auto localShardIdx = TLocalShardIdx(dst.GetShardIdx());
+ auto shardIdx = Self->MakeLocalId(localShardIdx);
shardIdxToRangeEnd[shardIdx] = dst.GetKeyRangeEnd();
}
for (TTxState::TShardOperation& shardOp : txState->Shards) {
if (shardOp.Operation == TTxState::CreateParts) {
Y_VERIFY(shardIdxToRangeEnd.contains(shardOp.Idx));
- shardOp.RangeEnd = shardIdxToRangeEnd.at(shardOp.Idx);
+ shardOp.RangeEnd = shardIdxToRangeEnd.at(shardOp.Idx);
}
}
}
- //after all txs and splitTxs was loaded and processed, it is valid to initiate force drops
- for (TOperationId opId: forceDropOpIds) {
- TTxState* txState = Self->FindTx(opId);
- Y_VERIFY(txState);
- auto pathes = Self->ListSubThee(txState->TargetPathId, ctx);
- Self->MarkAsDroping(pathes, opId.GetTxId(), ctx);
- }
-
+ //after all txs and splitTxs was loaded and processed, it is valid to initiate force drops
+ for (TOperationId opId: forceDropOpIds) {
+ TTxState* txState = Self->FindTx(opId);
+ Y_VERIFY(txState);
+ auto pathes = Self->ListSubThee(txState->TargetPathId, ctx);
+ Self->MarkAsDroping(pathes, opId.GetTxId(), ctx);
+ }
+
// Read txid dependencies
{
- auto txDependenciesRowset = db.Table<Schema::TxDependencies>().Range().Select();
+ auto txDependenciesRowset = db.Table<Schema::TxDependencies>().Range().Select();
if (!txDependenciesRowset.IsReady())
return false;
-
+
while (!txDependenciesRowset.EndOfSet()) {
- auto txId = txDependenciesRowset.GetValue<Schema::TxDependencies::TxId>();
- auto dependentTxId = txDependenciesRowset.GetValue<Schema::TxDependencies::DependentTxId>();
+ auto txId = txDependenciesRowset.GetValue<Schema::TxDependencies::TxId>();
+ auto dependentTxId = txDependenciesRowset.GetValue<Schema::TxDependencies::DependentTxId>();
+
+ Y_VERIFY_S(Self->Operations.contains(txId), "Parent operation is not found"
+ << ", parent txId " << txId
+ << ", dependentTxId " << dependentTxId);
- Y_VERIFY_S(Self->Operations.contains(txId), "Parent operation is not found"
- << ", parent txId " << txId
- << ", dependentTxId " << dependentTxId);
-
- Y_VERIFY_S(Self->Operations.contains(dependentTxId), "Dependent operation is not found"
- << ", dependent txId:" << dependentTxId
- << ", parent txId " << txId);
+ Y_VERIFY_S(Self->Operations.contains(dependentTxId), "Dependent operation is not found"
+ << ", dependent txId:" << dependentTxId
+ << ", parent txId " << txId);
- Self->Operations.at(txId)->DependentOperations.insert(dependentTxId);
- Self->Operations.at(dependentTxId)->WaitOperations.insert(txId);
+ Self->Operations.at(txId)->DependentOperations.insert(dependentTxId);
+ Self->Operations.at(dependentTxId)->WaitOperations.insert(txId);
if (!txDependenciesRowset.Next())
return false;
@@ -3404,46 +3404,46 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
// Read shards to delete
{
- TShardsToDeleteRows shardsToDelete;
- if (!LoadShardsToDelete(db, shardsToDelete)) {
+ TShardsToDeleteRows shardsToDelete;
+ if (!LoadShardsToDelete(db, shardsToDelete)) {
return false;
- }
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for ShardToDelete"
- << ", readed records: " << shardsToDelete.size()
- << ", at schemeshard: " << Self->TabletID());
-
- for (auto& rec: shardsToDelete) {
- OnComplete.DeleteShard(std::get<0>(rec));
+ }
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for ShardToDelete"
+ << ", readed records: " << shardsToDelete.size()
+ << ", at schemeshard: " << Self->TabletID());
+
+ for (auto& rec: shardsToDelete) {
+ OnComplete.DeleteShard(std::get<0>(rec));
}
}
// Read backup settings
{
- TBackupSettingsRows backupSettings;
- if (!LoadBackupSettings(db, backupSettings)) {
+ TBackupSettingsRows backupSettings;
+ if (!LoadBackupSettings(db, backupSettings)) {
return false;
}
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for BackupSettings"
- << ", readed records: " << backupSettings.size()
- << ", at schemeshard: " << Self->TabletID());
-
- for (auto& rec: backupSettings) {
- TPathId pathId = std::get<0>(rec);
- TString tableName = std::get<1>(rec);
- TString ytSerializedSettings = std::get<2>(rec);
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for BackupSettings"
+ << ", readed records: " << backupSettings.size()
+ << ", at schemeshard: " << Self->TabletID());
+
+ for (auto& rec: backupSettings) {
+ TPathId pathId = std::get<0>(rec);
+ TString tableName = std::get<1>(rec);
+ TString ytSerializedSettings = std::get<2>(rec);
TString s3SerializedSettings = std::get<3>(rec);
TString scanSettings = std::get<4>(rec);
bool needToBill = std::get<5>(rec);
TString tableDesc = std::get<6>(rec);
ui32 nRetries = std::get<7>(rec);
-
+
Y_VERIFY(tableName.size() > 0);
- TTableInfo::TPtr tableInfo = Self->Tables.at(pathId);
+ TTableInfo::TPtr tableInfo = Self->Tables.at(pathId);
Y_VERIFY(tableInfo.Get() != nullptr);
tableInfo->BackupSettings.SetTableName(tableName);
@@ -3470,9 +3470,9 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
Y_VERIFY(ParseFromStringNoSizeLimit(*desc, tableDesc));
}
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "Loaded backup settings"
- << ", pathId: " << pathId
- << ", tablename: " << tableName.data());
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "Loaded backup settings"
+ << ", pathId: " << pathId
+ << ", tablename: " << tableName.data());
}
}
@@ -3563,43 +3563,43 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
Self->LoginProvider.UpdateSecurityState(std::move(securityState));
{
- TShardBackupStatusRows backupStatuses;
- if (!LoadBackupStatuses(db, backupStatuses)) {
+ TShardBackupStatusRows backupStatuses;
+ if (!LoadBackupStatuses(db, backupStatuses)) {
return false;
}
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for ShardBackupStatus"
- << ", readed records: " << backupStatuses.size()
- << ", at schemeshard: " << Self->TabletID());
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for ShardBackupStatus"
+ << ", readed records: " << backupStatuses.size()
+ << ", at schemeshard: " << Self->TabletID());
- THashMap<TTxId, TShardBackupStatusRows> statusesByTxId;
- for (auto& rec: backupStatuses) {
- TTxId txId = std::get<0>(rec);
- statusesByTxId[txId].push_back(rec);
- }
+ THashMap<TTxId, TShardBackupStatusRows> statusesByTxId;
+ for (auto& rec: backupStatuses) {
+ TTxId txId = std::get<0>(rec);
+ statusesByTxId[txId].push_back(rec);
+ }
TCompletedBackupRestoreRows history;
if (!LoadBackupRestoreHistory(db, history)) {
- return false;
- }
+ return false;
+ }
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for CompletedBackup"
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for CompletedBackup"
<< ", readed records: " << history.size()
- << ", at schemeshard: " << Self->TabletID());
-
+ << ", at schemeshard: " << Self->TabletID());
+
for (auto& rec: history) {
- auto pathId = std::get<0>(rec);
- auto txId = std::get<1>(rec);
- auto completeTime = std::get<2>(rec);
-
- auto successShardsCount = std::get<3>(rec);
- auto totalShardCount = std::get<4>(rec);
- auto startTime = std::get<5>(rec);
+ auto pathId = std::get<0>(rec);
+ auto txId = std::get<1>(rec);
+ auto completeTime = std::get<2>(rec);
+
+ auto successShardsCount = std::get<3>(rec);
+ auto totalShardCount = std::get<4>(rec);
+ auto startTime = std::get<5>(rec);
auto dataSize = std::get<6>(rec);
auto kind = static_cast<TTableInfo::TBackupRestoreResult::EKind>(std::get<7>(rec));
-
+
TTableInfo::TBackupRestoreResult info;
info.CompletionDateTime = completeTime;
info.TotalShardCount = totalShardCount;
@@ -3608,18 +3608,18 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
info.DataTotalSize = dataSize;
if (!Self->Tables.FindPtr(pathId)) {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Skip record in CompletedBackups"
- << ", pathId: " << pathId
- << ", txid: " << txId);
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Skip record in CompletedBackups"
+ << ", pathId: " << pathId
+ << ", txid: " << txId);
continue;
}
- TTableInfo::TPtr tableInfo = Self->Tables.at(pathId);
+ TTableInfo::TPtr tableInfo = Self->Tables.at(pathId);
- if (statusesByTxId.contains(txId)) {
- for (auto& recByTxId: statusesByTxId.at(txId)) {
- auto shardIdx = std::get<1>(recByTxId);
+ if (statusesByTxId.contains(txId)) {
+ for (auto& recByTxId: statusesByTxId.at(txId)) {
+ auto shardIdx = std::get<1>(recByTxId);
auto success = std::get<2>(recByTxId);
auto error = std::get<3>(recByTxId);
auto bytes = std::get<4>(recByTxId);
@@ -3638,35 +3638,35 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
break;
}
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Loaded completed backup status"
- << ", pathId: " << pathId
- << ", txid: " << txId);
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Loaded completed backup status"
+ << ", pathId: " << pathId
+ << ", txid: " << txId);
}
}
// Other persistent params
for (const auto& si : Self->ShardInfos) {
- auto shardIdx = si.first;
- auto tabletId = si.second.TabletID;
- auto pathId = si.second.PathId;
- Self->TabletIdToShardIdx[tabletId] = shardIdx;
-
- Y_VERIFY(Self->PathsById.contains(pathId));
- auto path = Self->PathsById.at(pathId); //path should't be dropeed?
- path->IncShardsInside();
-
- auto domainInfo = Self->ResolveDomainInfo(pathId); //domain should't be dropeed?
- domainInfo->AddInternalShard(shardIdx);
-
+ auto shardIdx = si.first;
+ auto tabletId = si.second.TabletID;
+ auto pathId = si.second.PathId;
+ Self->TabletIdToShardIdx[tabletId] = shardIdx;
+
+ Y_VERIFY(Self->PathsById.contains(pathId));
+ auto path = Self->PathsById.at(pathId); //path should't be dropeed?
+ path->IncShardsInside();
+
+ auto domainInfo = Self->ResolveDomainInfo(pathId); //domain should't be dropeed?
+ domainInfo->AddInternalShard(shardIdx);
+
switch (si.second.TabletType) {
case ETabletType::DataShard:
{
const auto table = Self->Tables.FindPtr(pathId);
if (tabletId != InvalidTabletId) {
- bool active = !path->Dropped() &&
- !path->PlannedToDrop() &&
- table && (*table)->GetStats().PartitionStats.contains(shardIdx);
+ bool active = !path->Dropped() &&
+ !path->PlannedToDrop() &&
+ table && (*table)->GetStats().PartitionStats.contains(shardIdx);
Self->TabletCounters->Simple()[active ? COUNTER_TABLE_SHARD_ACTIVE_COUNT : COUNTER_TABLE_SHARD_INACTIVE_COUNT].Add(1);
}
break;
@@ -3693,20 +3693,20 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
Self->TabletCounters->Simple()[COUNTER_KESUS_SHARD_COUNT].Add(1);
break;
case ETabletType::Coordinator:
- Self->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_COORDINATOR_COUNT].Add(1);
+ Self->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_COORDINATOR_COUNT].Add(1);
break;
case ETabletType::Mediator:
- Self->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_MEDIATOR_COUNT].Add(1);
- break;
+ Self->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_MEDIATOR_COUNT].Add(1);
+ break;
case ETabletType::RTMRPartition:
Self->TabletCounters->Simple()[COUNTER_RTMR_PARTITIONS_COUNT].Add(1);
break;
- case ETabletType::KeyValue:
- Self->TabletCounters->Simple()[COUNTER_SOLOMON_PARTITIONS_COUNT].Add(1);
- break;
- case ETabletType::SchemeShard:
- Self->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_SCHEME_SHARD_COUNT].Add(1);
- break;
+ case ETabletType::KeyValue:
+ Self->TabletCounters->Simple()[COUNTER_SOLOMON_PARTITIONS_COUNT].Add(1);
+ break;
+ case ETabletType::SchemeShard:
+ Self->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_SCHEME_SHARD_COUNT].Add(1);
+ break;
case ETabletType::Hive:
Self->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_HIVE_COUNT].Add(1);
break;
@@ -3724,41 +3724,41 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
Self->TabletCounters->Simple()[COUNTER_REPLICATION_CONTROLLER_COUNT].Add(1);
domainInfo->AddReplicationController(shardIdx);
break;
- default:
- Y_FAIL_S("dont know how to interpret tablet type"
- << ", type id: " << (ui32)si.second.TabletType
- << ", pathId: " << pathId
- << ", shardId: " << shardIdx
- << ", tabletId: " << tabletId);
+ default:
+ Y_FAIL_S("dont know how to interpret tablet type"
+ << ", type id: " << (ui32)si.second.TabletType
+ << ", pathId: " << pathId
+ << ", shardId: " << shardIdx
+ << ", tabletId: " << tabletId);
}
}
- for (const auto& item : Self->PathsById) {
- auto& path = item.second;
-
- if (path->Dropped()) {
+ for (const auto& item : Self->PathsById) {
+ auto& path = item.second;
+
+ if (path->Dropped()) {
continue;
}
- TPathElement::TPtr parent = Self->PathsById.at(path->ParentPathId);
- TPathElement::TPtr inclusiveDomainPath = Self->PathsById.at(Self->ResolveDomainId(parent)); // take upper domain id info even when the path is domain by itself
- TSubDomainInfo::TPtr inclusivedomainInfo = Self->ResolveDomainInfo(parent);
-
- if (inclusiveDomainPath->IsExternalSubDomainRoot()) {
- path->PathState = TPathElement::EPathState::EPathStateMigrated;
- continue;
- }
-
- if (!path->IsRoot()) {
- parent->IncAliveChildren();
- inclusivedomainInfo->IncPathsInside();
- }
-
- Self->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Add(path->UserAttrs->Size());
-
- if (path->IsPQGroup()) {
- auto pqGroup = Self->PersQueueGroups.at(path->PathId);
- auto delta = pqGroup->AlterData ? pqGroup->AlterData->TotalGroupCount : pqGroup->TotalGroupCount;
+ TPathElement::TPtr parent = Self->PathsById.at(path->ParentPathId);
+ TPathElement::TPtr inclusiveDomainPath = Self->PathsById.at(Self->ResolveDomainId(parent)); // take upper domain id info even when the path is domain by itself
+ TSubDomainInfo::TPtr inclusivedomainInfo = Self->ResolveDomainInfo(parent);
+
+ if (inclusiveDomainPath->IsExternalSubDomainRoot()) {
+ path->PathState = TPathElement::EPathState::EPathStateMigrated;
+ continue;
+ }
+
+ if (!path->IsRoot()) {
+ parent->IncAliveChildren();
+ inclusivedomainInfo->IncPathsInside();
+ }
+
+ Self->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Add(path->UserAttrs->Size());
+
+ if (path->IsPQGroup()) {
+ auto pqGroup = Self->PersQueueGroups.at(path->PathId);
+ auto delta = pqGroup->AlterData ? pqGroup->AlterData->TotalGroupCount : pqGroup->TotalGroupCount;
auto tabletConfig = pqGroup->AlterData ? (pqGroup->AlterData->TabletConfig.empty() ? pqGroup->TabletConfig : pqGroup->AlterData->TabletConfig)
: pqGroup->TabletConfig;
NKikimrPQ::TPQTabletConfig config;
@@ -3769,34 +3769,34 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
ui64 throughput = ((ui64)delta) * config.GetPartitionConfig().GetWriteSpeedInBytesPerSecond();
ui64 storage = throughput * config.GetPartitionConfig().GetLifetimeSeconds();
- inclusivedomainInfo->IncPQPartitionsInside(delta);
+ inclusivedomainInfo->IncPQPartitionsInside(delta);
inclusivedomainInfo->IncPQReservedStorage(storage);
- Self->TabletCounters->Simple()[COUNTER_STREAM_SHARDS_COUNT].Add(delta);
+ Self->TabletCounters->Simple()[COUNTER_STREAM_SHARDS_COUNT].Add(delta);
Self->TabletCounters->Simple()[COUNTER_STREAM_RESERVED_THROUGHPUT].Add(throughput);
Self->TabletCounters->Simple()[COUNTER_STREAM_RESERVED_STORAGE].Add(storage);
- }
-
- if (path->PlannedToDrop()) {
- continue;
- }
-
- if (path->IsDirectory()) {
+ }
+
+ if (path->PlannedToDrop()) {
+ continue;
+ }
+
+ if (path->IsDirectory()) {
Self->TabletCounters->Simple()[COUNTER_DIR_COUNT].Add(1);
- } else if (path->IsTable()) {
+ } else if (path->IsTable()) {
Self->TabletCounters->Simple()[COUNTER_TABLE_COUNT].Add(1);
- } else if (path->IsPQGroup()) {
+ } else if (path->IsPQGroup()) {
Self->TabletCounters->Simple()[COUNTER_PQ_GROUP_COUNT].Add(1);
- } if (path->IsSubDomainRoot()) {
- Self->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_COUNT].Add(1);
- } if (path->IsExternalSubDomainRoot()) {
- Self->TabletCounters->Simple()[COUNTER_EXTSUB_DOMAIN_COUNT].Add(1);
- } else if (path->IsBlockStoreVolume()) {
+ } if (path->IsSubDomainRoot()) {
+ Self->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_COUNT].Add(1);
+ } if (path->IsExternalSubDomainRoot()) {
+ Self->TabletCounters->Simple()[COUNTER_EXTSUB_DOMAIN_COUNT].Add(1);
+ } else if (path->IsBlockStoreVolume()) {
Self->TabletCounters->Simple()[COUNTER_BLOCKSTORE_VOLUME_COUNT].Add(1);
- } else if (path->IsKesus()) {
+ } else if (path->IsKesus()) {
Self->TabletCounters->Simple()[COUNTER_KESUS_COUNT].Add(1);
- } else if (path->IsSolomon()) {
- Self->TabletCounters->Simple()[COUNTER_SOLOMON_VOLUME_COUNT].Add(1);
+ } else if (path->IsSolomon()) {
+ Self->TabletCounters->Simple()[COUNTER_SOLOMON_VOLUME_COUNT].Add(1);
} else if (path->IsOlapStore()) {
Self->TabletCounters->Simple()[COUNTER_OLAP_STORE_COUNT].Add(1);
} else if (path->IsOlapTable()) {
@@ -3807,7 +3807,7 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
Self->TabletCounters->Simple()[COUNTER_REPLICATION_COUNT].Add(1);
}
- path->ApplySpecialAttributes();
+ path->ApplySpecialAttributes();
}
for (const auto& kv : Self->BlockStoreVolumes) {
@@ -3821,30 +3821,30 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
}
// Find all operations that were in the process of execution
- for (auto& item : Self->TxInFlight) {
- const TTxState& txState = item.second;
-
- ui32 inFlightCounter = TTxState::TxTypeInFlightCounter(txState.TxType);
+ for (auto& item : Self->TxInFlight) {
+ const TTxState& txState = item.second;
+
+ ui32 inFlightCounter = TTxState::TxTypeInFlightCounter(txState.TxType);
Self->TabletCounters->Simple()[inFlightCounter].Add(1);
- }
-
+ }
+
// Publications
{
- TPublicationsRows publicationRows;
- if (!LoadPublications(db, publicationRows)) {
+ TPublicationsRows publicationRows;
+ if (!LoadPublications(db, publicationRows)) {
return false;
}
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for Publications"
- << ", readed records: " << publicationRows.size()
- << ", at schemeshard: " << Self->TabletID());
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for Publications"
+ << ", readed records: " << publicationRows.size()
+ << ", at schemeshard: " << Self->TabletID());
+
+ for (auto& rec: publicationRows) {
+ TTxId txId = std::get<0>(rec);
+ TPathId pathId = std::get<1>(rec);
+ ui64 version = std::get<2>(rec);
- for (auto& rec: publicationRows) {
- TTxId txId = std::get<0>(rec);
- TPathId pathId = std::get<1>(rec);
- ui64 version = std::get<2>(rec);
-
LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Resume publishing for paths"
<< ", tx: " << txId
@@ -3878,8 +3878,8 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
TString uid = rowset.GetValue<Schema::Exports::Uid>();
TExportInfo::EKind kind = static_cast<TExportInfo::EKind>(rowset.GetValueOrDefault<Schema::Exports::Kind>(0));
TString settings = rowset.GetValue<Schema::Exports::Settings>();
- auto domainPathId = TPathId(rowset.GetValueOrDefault<Schema::Exports::DomainPathOwnerId>(selfId),
- rowset.GetValue<Schema::Exports::DomainPathId>());
+ auto domainPathId = TPathId(rowset.GetValueOrDefault<Schema::Exports::DomainPathOwnerId>(selfId),
+ rowset.GetValue<Schema::Exports::DomainPathId>());
TExportInfo::TPtr exportInfo = new TExportInfo(id, uid, kind, settings, domainPathId);
@@ -3890,11 +3890,11 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
ui32 items = rowset.GetValue<Schema::Exports::Items>();
exportInfo->Items.resize(items);
- exportInfo->ExportPathId = TPathId(rowset.GetValueOrDefault<Schema::Exports::ExportOwnerPathId>(selfId),
- rowset.GetValueOrDefault<Schema::Exports::ExportPathId>(InvalidLocalPathId));
- if (exportInfo->ExportPathId.LocalPathId == InvalidLocalPathId) {
- exportInfo->ExportPathId = InvalidPathId;
- }
+ exportInfo->ExportPathId = TPathId(rowset.GetValueOrDefault<Schema::Exports::ExportOwnerPathId>(selfId),
+ rowset.GetValueOrDefault<Schema::Exports::ExportPathId>(InvalidLocalPathId));
+ if (exportInfo->ExportPathId.LocalPathId == InvalidLocalPathId) {
+ exportInfo->ExportPathId = InvalidPathId;
+ }
exportInfo->State = static_cast<TExportInfo::EState>(rowset.GetValue<Schema::Exports::State>());
exportInfo->WaitTxId = rowset.GetValueOrDefault<Schema::Exports::WaitTxId>(InvalidTxId);
exportInfo->Issue = rowset.GetValueOrDefault<Schema::Exports::Issue>(TString());
@@ -3940,9 +3940,9 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
TExportInfo::TItem& item = exportInfo->Items[itemIdx];
item.SourcePathName = rowset.GetValue<Schema::ExportItems::SourcePathName>();
- item.SourcePathId.OwnerId = rowset.GetValueOrDefault<Schema::ExportItems::SourceOwnerPathId>(selfId);
- item.SourcePathId.LocalPathId = rowset.GetValue<Schema::ExportItems::SourcePathId>();
-
+ item.SourcePathId.OwnerId = rowset.GetValueOrDefault<Schema::ExportItems::SourceOwnerPathId>(selfId);
+ item.SourcePathId.LocalPathId = rowset.GetValue<Schema::ExportItems::SourcePathId>();
+
item.State = static_cast<TExportInfo::EState>(rowset.GetValue<Schema::ExportItems::State>());
item.WaitTxId = rowset.GetValueOrDefault<Schema::ExportItems::BackupTxId>(InvalidTxId);
item.Issue = rowset.GetValueOrDefault<Schema::ExportItems::Issue>(TString());
@@ -4057,103 +4057,103 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
}
}
- // Read index build
- {
- // read main info
- {
- auto rowset = db.Table<Schema::IndexBuild>().Range().Select();
- if (!rowset.IsReady()) {
- return false;
- }
-
- while (!rowset.EndOfSet()) {
- TIndexBuildId id = rowset.GetValue<Schema::IndexBuild::Id>();
- TString uid = rowset.GetValue<Schema::IndexBuild::Uid>();
-
- TIndexBuildInfo::TPtr indexInfo = new TIndexBuildInfo(id, uid);
-
- indexInfo->DomainPathId = TPathId(
- rowset.GetValue<Schema::IndexBuild::DomainOwnerId>(),
- rowset.GetValue<Schema::IndexBuild::DomainLocalId>());
-
- indexInfo->TablePathId = TPathId(
- rowset.GetValue<Schema::IndexBuild::TableOwnerId>(),
- rowset.GetValue<Schema::IndexBuild::TableLocalId>());
-
- indexInfo->IndexName = rowset.GetValue<Schema::IndexBuild::IndexName>();
- indexInfo->IndexType = rowset.GetValue<Schema::IndexBuild::IndexType>();
-
- indexInfo->State = TIndexBuildInfo::EState(rowset.GetValue<Schema::IndexBuild::State>());
- indexInfo->Issue = rowset.GetValueOrDefault<Schema::IndexBuild::Issue>();
- indexInfo->CancelRequested = rowset.GetValueOrDefault<Schema::IndexBuild::CancelRequest>(false);
-
- indexInfo->LockTxId = rowset.GetValueOrDefault<Schema::IndexBuild::LockTxId>(indexInfo->LockTxId);
- indexInfo->LockTxStatus = rowset.GetValueOrDefault<Schema::IndexBuild::LockTxStatus>(indexInfo->LockTxStatus);
- indexInfo->LockTxDone = rowset.GetValueOrDefault<Schema::IndexBuild::LockTxDone>(indexInfo->LockTxDone);
-
- indexInfo->InitiateTxId = rowset.GetValueOrDefault<Schema::IndexBuild::InitiateTxId>(indexInfo->InitiateTxId);
- indexInfo->InitiateTxStatus = rowset.GetValueOrDefault<Schema::IndexBuild::InitiateTxStatus>(indexInfo->InitiateTxStatus);
- indexInfo->InitiateTxDone = rowset.GetValueOrDefault<Schema::IndexBuild::InitiateTxDone>(indexInfo->InitiateTxDone);
-
- indexInfo->Limits.MaxBatchRows = rowset.GetValue<Schema::IndexBuild::MaxBatchRows>();
- indexInfo->Limits.MaxBatchBytes = rowset.GetValue<Schema::IndexBuild::MaxBatchBytes>();
- indexInfo->Limits.MaxShards = rowset.GetValue<Schema::IndexBuild::MaxShards>();
- indexInfo->Limits.MaxRetries = rowset.GetValueOrDefault<Schema::IndexBuild::MaxRetries>(indexInfo->Limits.MaxRetries);
-
- indexInfo->ApplyTxId = rowset.GetValueOrDefault<Schema::IndexBuild::ApplyTxId>(indexInfo->ApplyTxId);
- indexInfo->ApplyTxStatus = rowset.GetValueOrDefault<Schema::IndexBuild::ApplyTxStatus>(indexInfo->ApplyTxStatus);
- indexInfo->ApplyTxDone = rowset.GetValueOrDefault<Schema::IndexBuild::ApplyTxDone>(indexInfo->ApplyTxDone);
-
- indexInfo->UnlockTxId = rowset.GetValueOrDefault<Schema::IndexBuild::UnlockTxId>(indexInfo->UnlockTxId);
- indexInfo->UnlockTxStatus = rowset.GetValueOrDefault<Schema::IndexBuild::UnlockTxStatus>(indexInfo->UnlockTxStatus);
- indexInfo->UnlockTxDone = rowset.GetValueOrDefault<Schema::IndexBuild::UnlockTxDone>(indexInfo->UnlockTxDone);
-
- indexInfo->Billed = TBillingStats(
- rowset.GetValueOrDefault<Schema::IndexBuild::RowsBilled>(0),
- rowset.GetValueOrDefault<Schema::IndexBuild::BytesBilled>(0));
-
- Y_VERIFY(!Self->IndexBuilds.contains(id));
- Self->IndexBuilds[id] = indexInfo;
- if (uid) {
- Self->IndexBuildsByUid[uid] = indexInfo;
- }
-
- OnComplete.ToProgress(id);
-
- if (!rowset.Next()) {
- return false;
- }
- }
- }
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "IndexBuild "
- << ", records: " << Self->IndexBuilds.size()
- << ", at schemeshard: " << Self->TabletID());
-
- // read index build columns
- {
- auto rowset = db.Table<Schema::IndexBuildColumns>().Range().Select();
- if (!rowset.IsReady()) {
- return false;
- }
-
- while (!rowset.EndOfSet()) {
- TIndexBuildId id = rowset.GetValue<Schema::IndexBuildColumns::Id>();
- Y_VERIFY_S(Self->IndexBuilds.contains(id), "BuildIndex not found"
- << ": id# " << id);
-
- TIndexBuildInfo::TPtr buildInfo = Self->IndexBuilds.at(id);
-
+ // Read index build
+ {
+ // read main info
+ {
+ auto rowset = db.Table<Schema::IndexBuild>().Range().Select();
+ if (!rowset.IsReady()) {
+ return false;
+ }
+
+ while (!rowset.EndOfSet()) {
+ TIndexBuildId id = rowset.GetValue<Schema::IndexBuild::Id>();
+ TString uid = rowset.GetValue<Schema::IndexBuild::Uid>();
+
+ TIndexBuildInfo::TPtr indexInfo = new TIndexBuildInfo(id, uid);
+
+ indexInfo->DomainPathId = TPathId(
+ rowset.GetValue<Schema::IndexBuild::DomainOwnerId>(),
+ rowset.GetValue<Schema::IndexBuild::DomainLocalId>());
+
+ indexInfo->TablePathId = TPathId(
+ rowset.GetValue<Schema::IndexBuild::TableOwnerId>(),
+ rowset.GetValue<Schema::IndexBuild::TableLocalId>());
+
+ indexInfo->IndexName = rowset.GetValue<Schema::IndexBuild::IndexName>();
+ indexInfo->IndexType = rowset.GetValue<Schema::IndexBuild::IndexType>();
+
+ indexInfo->State = TIndexBuildInfo::EState(rowset.GetValue<Schema::IndexBuild::State>());
+ indexInfo->Issue = rowset.GetValueOrDefault<Schema::IndexBuild::Issue>();
+ indexInfo->CancelRequested = rowset.GetValueOrDefault<Schema::IndexBuild::CancelRequest>(false);
+
+ indexInfo->LockTxId = rowset.GetValueOrDefault<Schema::IndexBuild::LockTxId>(indexInfo->LockTxId);
+ indexInfo->LockTxStatus = rowset.GetValueOrDefault<Schema::IndexBuild::LockTxStatus>(indexInfo->LockTxStatus);
+ indexInfo->LockTxDone = rowset.GetValueOrDefault<Schema::IndexBuild::LockTxDone>(indexInfo->LockTxDone);
+
+ indexInfo->InitiateTxId = rowset.GetValueOrDefault<Schema::IndexBuild::InitiateTxId>(indexInfo->InitiateTxId);
+ indexInfo->InitiateTxStatus = rowset.GetValueOrDefault<Schema::IndexBuild::InitiateTxStatus>(indexInfo->InitiateTxStatus);
+ indexInfo->InitiateTxDone = rowset.GetValueOrDefault<Schema::IndexBuild::InitiateTxDone>(indexInfo->InitiateTxDone);
+
+ indexInfo->Limits.MaxBatchRows = rowset.GetValue<Schema::IndexBuild::MaxBatchRows>();
+ indexInfo->Limits.MaxBatchBytes = rowset.GetValue<Schema::IndexBuild::MaxBatchBytes>();
+ indexInfo->Limits.MaxShards = rowset.GetValue<Schema::IndexBuild::MaxShards>();
+ indexInfo->Limits.MaxRetries = rowset.GetValueOrDefault<Schema::IndexBuild::MaxRetries>(indexInfo->Limits.MaxRetries);
+
+ indexInfo->ApplyTxId = rowset.GetValueOrDefault<Schema::IndexBuild::ApplyTxId>(indexInfo->ApplyTxId);
+ indexInfo->ApplyTxStatus = rowset.GetValueOrDefault<Schema::IndexBuild::ApplyTxStatus>(indexInfo->ApplyTxStatus);
+ indexInfo->ApplyTxDone = rowset.GetValueOrDefault<Schema::IndexBuild::ApplyTxDone>(indexInfo->ApplyTxDone);
+
+ indexInfo->UnlockTxId = rowset.GetValueOrDefault<Schema::IndexBuild::UnlockTxId>(indexInfo->UnlockTxId);
+ indexInfo->UnlockTxStatus = rowset.GetValueOrDefault<Schema::IndexBuild::UnlockTxStatus>(indexInfo->UnlockTxStatus);
+ indexInfo->UnlockTxDone = rowset.GetValueOrDefault<Schema::IndexBuild::UnlockTxDone>(indexInfo->UnlockTxDone);
+
+ indexInfo->Billed = TBillingStats(
+ rowset.GetValueOrDefault<Schema::IndexBuild::RowsBilled>(0),
+ rowset.GetValueOrDefault<Schema::IndexBuild::BytesBilled>(0));
+
+ Y_VERIFY(!Self->IndexBuilds.contains(id));
+ Self->IndexBuilds[id] = indexInfo;
+ if (uid) {
+ Self->IndexBuildsByUid[uid] = indexInfo;
+ }
+
+ OnComplete.ToProgress(id);
+
+ if (!rowset.Next()) {
+ return false;
+ }
+ }
+ }
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "IndexBuild "
+ << ", records: " << Self->IndexBuilds.size()
+ << ", at schemeshard: " << Self->TabletID());
+
+ // read index build columns
+ {
+ auto rowset = db.Table<Schema::IndexBuildColumns>().Range().Select();
+ if (!rowset.IsReady()) {
+ return false;
+ }
+
+ while (!rowset.EndOfSet()) {
+ TIndexBuildId id = rowset.GetValue<Schema::IndexBuildColumns::Id>();
+ Y_VERIFY_S(Self->IndexBuilds.contains(id), "BuildIndex not found"
+ << ": id# " << id);
+
+ TIndexBuildInfo::TPtr buildInfo = Self->IndexBuilds.at(id);
+
TString columnName = rowset.GetValue<Schema::IndexBuildColumns::ColumnName>();
EIndexColumnKind columnKind = rowset.GetValueOrDefault<Schema::IndexBuildColumns::ColumnKind>(EIndexColumnKind::KeyColumn);
- ui32 columnNo = rowset.GetValue<Schema::IndexBuildColumns::ColumnNo>();
-
+ ui32 columnNo = rowset.GetValue<Schema::IndexBuildColumns::ColumnNo>();
+
Y_VERIFY_S(columnNo == (buildInfo->IndexColumns.size() + buildInfo->DataColumns.size()),
"Unexpected non contiguous column number# " << columnNo <<
" indexColumns# " << buildInfo->IndexColumns.size() <<
" dataColumns# " << buildInfo->DataColumns.size());
-
+
switch (columnKind) {
case EIndexColumnKind::KeyColumn:
buildInfo->IndexColumns.push_back(columnName);
@@ -4166,139 +4166,139 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
break;
}
- if (!rowset.Next()) {
- return false;
- }
- }
- }
-
- // read index build upload progress
- {
- auto rowset = db.Table<Schema::IndexBuildShardStatus>().Range().Select();
- if (!rowset.IsReady()) {
- return false;
- }
-
- while (!rowset.EndOfSet()) {
- TIndexBuildId id = rowset.GetValue<Schema::IndexBuildShardStatus::Id>();
- Y_VERIFY_S(Self->IndexBuilds.contains(id), "BuildIndex not found"
- << ": id# " << id);
-
- TIndexBuildInfo::TPtr buildInfo = Self->IndexBuilds.at(id);
-
- TShardIdx shardIdx = TShardIdx(rowset.GetValue<Schema::IndexBuildShardStatus::OwnerShardIdx>(),
- rowset.GetValue<Schema::IndexBuildShardStatus::LocalShardIdx>());
-
-
- TIndexBuildInfo::TShardStatus& shardStatus = buildInfo->Shards[shardIdx];
-
- NKikimrTx::TKeyRange range = rowset.GetValue<Schema::IndexBuildShardStatus::Range>();
- shardStatus.Range.Load(range);
-
- shardStatus.LastKeyAck = rowset.GetValue<Schema::IndexBuildShardStatus::LastKeyAck>();
- shardStatus.Status = rowset.GetValue<Schema::IndexBuildShardStatus::Status>();
-
- shardStatus.DebugMessage = rowset.GetValueOrDefault<Schema::IndexBuildShardStatus::Message>();
- shardStatus.UploadStatus = rowset.GetValueOrDefault<Schema::IndexBuildShardStatus::UploadStatus>(Ydb::StatusIds::STATUS_CODE_UNSPECIFIED);
-
- shardStatus.Processed = TBillingStats(
- rowset.GetValueOrDefault<Schema::IndexBuildShardStatus::RowsProcessed>(0),
- rowset.GetValueOrDefault<Schema::IndexBuildShardStatus::BytesProcessed>(0));
-
- buildInfo->Processed += shardStatus.Processed;
-
- if (!rowset.Next()) {
- return false;
- }
- }
- }
- }
-
- // Read snapshot tables
- {
- ui64 records = 0;
- {
- auto rowset = db.Table<Schema::SnapshotTables>().Range().Select();
- if (!rowset.IsReady()) {
- return false;
- }
-
- while (!rowset.EndOfSet()) {
- TTxId id = rowset.GetValue<Schema::SnapshotTables::Id>();
-
- TPathId tableId = TPathId(
- rowset.GetValue<Schema::SnapshotTables::TableOwnerId>(),
- rowset.GetValue<Schema::SnapshotTables::TableLocalId>());
-
- Self->TablesWithSnaphots.emplace(tableId, id);
- Self->SnapshotTables[id].insert(tableId);
- ++records;
-
- if (!rowset.Next()) {
- return false;
- }
- }
- }
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "SnapshotTables: "
- << " snapshots: " << Self->SnapshotTables.size()
- << " tables: " << records
- << ", at schemeshard: " << Self->TabletID());
-
-
- // read snapshot steps
- {
- auto rowset = db.Table<Schema::SnapshotSteps>().Range().Select();
- if (!rowset.IsReady()) {
- return false;
- }
-
- while (!rowset.EndOfSet()) {
- TTxId id = rowset.GetValue<Schema::SnapshotSteps::Id>();
- Y_VERIFY_S(Self->SnapshotTables.contains(id), "Snapshot not found"
- << ": id# " << id);
-
- TStepId stepId = rowset.GetValue<Schema::SnapshotSteps::StepId>();
-
- Self->SnapshotsStepIds[id] = stepId;
-
- if (!rowset.Next()) {
- return false;
- }
- }
- }
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "SnapshotSteps: "
- << " snapshots: " << Self->SnapshotsStepIds.size()
- << ", at schemeshard: " << Self->TabletID());
- }
-
- // Read long locks
- {
- auto rowset = db.Table<Schema::LongLocks>().Range().Select();
- if (!rowset.IsReady()) {
- return false;
- }
-
- while (!rowset.EndOfSet()) {
- auto pathId = TPathId(
- rowset.GetValue<Schema::LongLocks::PathOwnerId>(),
- rowset.GetValue<Schema::LongLocks::PathLocalId>());
-
- TTxId txId = rowset.GetValue<Schema::LongLocks::LockId>();
-
- Self->LockedPaths[pathId] = txId;
-
- if (!rowset.Next()) {
- return false;
- }
- }
- }
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "LongLocks: "
- << " records: " << Self->LockedPaths.size()
- << ", at schemeshard: " << Self->TabletID());
-
+ if (!rowset.Next()) {
+ return false;
+ }
+ }
+ }
+
+ // read index build upload progress
+ {
+ auto rowset = db.Table<Schema::IndexBuildShardStatus>().Range().Select();
+ if (!rowset.IsReady()) {
+ return false;
+ }
+
+ while (!rowset.EndOfSet()) {
+ TIndexBuildId id = rowset.GetValue<Schema::IndexBuildShardStatus::Id>();
+ Y_VERIFY_S(Self->IndexBuilds.contains(id), "BuildIndex not found"
+ << ": id# " << id);
+
+ TIndexBuildInfo::TPtr buildInfo = Self->IndexBuilds.at(id);
+
+ TShardIdx shardIdx = TShardIdx(rowset.GetValue<Schema::IndexBuildShardStatus::OwnerShardIdx>(),
+ rowset.GetValue<Schema::IndexBuildShardStatus::LocalShardIdx>());
+
+
+ TIndexBuildInfo::TShardStatus& shardStatus = buildInfo->Shards[shardIdx];
+
+ NKikimrTx::TKeyRange range = rowset.GetValue<Schema::IndexBuildShardStatus::Range>();
+ shardStatus.Range.Load(range);
+
+ shardStatus.LastKeyAck = rowset.GetValue<Schema::IndexBuildShardStatus::LastKeyAck>();
+ shardStatus.Status = rowset.GetValue<Schema::IndexBuildShardStatus::Status>();
+
+ shardStatus.DebugMessage = rowset.GetValueOrDefault<Schema::IndexBuildShardStatus::Message>();
+ shardStatus.UploadStatus = rowset.GetValueOrDefault<Schema::IndexBuildShardStatus::UploadStatus>(Ydb::StatusIds::STATUS_CODE_UNSPECIFIED);
+
+ shardStatus.Processed = TBillingStats(
+ rowset.GetValueOrDefault<Schema::IndexBuildShardStatus::RowsProcessed>(0),
+ rowset.GetValueOrDefault<Schema::IndexBuildShardStatus::BytesProcessed>(0));
+
+ buildInfo->Processed += shardStatus.Processed;
+
+ if (!rowset.Next()) {
+ return false;
+ }
+ }
+ }
+ }
+
+ // Read snapshot tables
+ {
+ ui64 records = 0;
+ {
+ auto rowset = db.Table<Schema::SnapshotTables>().Range().Select();
+ if (!rowset.IsReady()) {
+ return false;
+ }
+
+ while (!rowset.EndOfSet()) {
+ TTxId id = rowset.GetValue<Schema::SnapshotTables::Id>();
+
+ TPathId tableId = TPathId(
+ rowset.GetValue<Schema::SnapshotTables::TableOwnerId>(),
+ rowset.GetValue<Schema::SnapshotTables::TableLocalId>());
+
+ Self->TablesWithSnaphots.emplace(tableId, id);
+ Self->SnapshotTables[id].insert(tableId);
+ ++records;
+
+ if (!rowset.Next()) {
+ return false;
+ }
+ }
+ }
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "SnapshotTables: "
+ << " snapshots: " << Self->SnapshotTables.size()
+ << " tables: " << records
+ << ", at schemeshard: " << Self->TabletID());
+
+
+ // read snapshot steps
+ {
+ auto rowset = db.Table<Schema::SnapshotSteps>().Range().Select();
+ if (!rowset.IsReady()) {
+ return false;
+ }
+
+ while (!rowset.EndOfSet()) {
+ TTxId id = rowset.GetValue<Schema::SnapshotSteps::Id>();
+ Y_VERIFY_S(Self->SnapshotTables.contains(id), "Snapshot not found"
+ << ": id# " << id);
+
+ TStepId stepId = rowset.GetValue<Schema::SnapshotSteps::StepId>();
+
+ Self->SnapshotsStepIds[id] = stepId;
+
+ if (!rowset.Next()) {
+ return false;
+ }
+ }
+ }
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "SnapshotSteps: "
+ << " snapshots: " << Self->SnapshotsStepIds.size()
+ << ", at schemeshard: " << Self->TabletID());
+ }
+
+ // Read long locks
+ {
+ auto rowset = db.Table<Schema::LongLocks>().Range().Select();
+ if (!rowset.IsReady()) {
+ return false;
+ }
+
+ while (!rowset.EndOfSet()) {
+ auto pathId = TPathId(
+ rowset.GetValue<Schema::LongLocks::PathOwnerId>(),
+ rowset.GetValue<Schema::LongLocks::PathLocalId>());
+
+ TTxId txId = rowset.GetValue<Schema::LongLocks::LockId>();
+
+ Self->LockedPaths[pathId] = txId;
+
+ if (!rowset.Next()) {
+ return false;
+ }
+ }
+ }
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "LongLocks: "
+ << " records: " << Self->LockedPaths.size()
+ << ", at schemeshard: " << Self->TabletID());
+
// Read olap stores
{
auto rowset = db.Table<Schema::OlapStores>().Select();
@@ -4427,9 +4427,9 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
while (!rowset.EndOfSet()) {
TPathId pathId = Self->MakeLocalId(rowset.GetValue<Schema::Sequences::PathId>());
ui64 alterVersion = rowset.GetValue<Schema::Sequences::AlterVersion>();
- NKikimrSchemeOp::TSequenceDescription description;
+ NKikimrSchemeOp::TSequenceDescription description;
Y_VERIFY(description.ParseFromString(rowset.GetValue<Schema::Sequences::Description>()));
- NKikimrSchemeOp::TSequenceSharding sharding;
+ NKikimrSchemeOp::TSequenceSharding sharding;
Y_VERIFY(sharding.ParseFromString(rowset.GetValue<Schema::Sequences::Sharding>()));
TSequenceInfo::TPtr sequenceInfo = new TSequenceInfo(alterVersion, std::move(description), std::move(sharding));
@@ -4452,9 +4452,9 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
while (!rowset.EndOfSet()) {
TPathId pathId = Self->MakeLocalId(rowset.GetValue<Schema::SequencesAlters::PathId>());
ui64 alterVersion = rowset.GetValue<Schema::SequencesAlters::AlterVersion>();
- NKikimrSchemeOp::TSequenceDescription description;
+ NKikimrSchemeOp::TSequenceDescription description;
Y_VERIFY(description.ParseFromString(rowset.GetValue<Schema::SequencesAlters::Description>()));
- NKikimrSchemeOp::TSequenceSharding sharding;
+ NKikimrSchemeOp::TSequenceSharding sharding;
Y_VERIFY(sharding.ParseFromString(rowset.GetValue<Schema::SequencesAlters::Sharding>()));
TSequenceInfo::TPtr alterData = new TSequenceInfo(alterVersion, std::move(description), std::move(sharding));
@@ -4515,31 +4515,31 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
}
}
- for (auto& item : Self->Operations) {
- auto& operation = item.second;
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInit for TxInFlight"
- << " execute ProgressState for all parts "
- << ", txId: " << operation->TxId
- << ", parts: " << operation->Parts.size()
- << ", await num: " << operation->WaitOperations.size()
- << ", dependet num: " << operation->DependentOperations.size()
- << ", at schemeshard: " << Self->TabletID());
-
- if (operation->WaitOperations.size()) {
- continue;
- }
-
- for (auto& part: operation->Parts) {
- TOperationContext context{Self, txc, ctx, OnComplete, MemChanges, DbChanges};
- part->ProgressState(context);
- }
+ for (auto& item : Self->Operations) {
+ auto& operation = item.second;
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInit for TxInFlight"
+ << " execute ProgressState for all parts "
+ << ", txId: " << operation->TxId
+ << ", parts: " << operation->Parts.size()
+ << ", await num: " << operation->WaitOperations.size()
+ << ", dependet num: " << operation->DependentOperations.size()
+ << ", at schemeshard: " << Self->TabletID());
+
+ if (operation->WaitOperations.size()) {
+ continue;
+ }
+
+ for (auto& part: operation->Parts) {
+ TOperationContext context{Self, txc, ctx, OnComplete, MemChanges, DbChanges};
+ part->ProgressState(context);
+ }
}
CollectObjectsToClean();
-
- OnComplete.ApplyOnExecute(Self, txc, ctx);
- DbChanges.Apply(Self, txc, ctx);
+
+ OnComplete.ApplyOnExecute(Self, txc, ctx);
+ DbChanges.Apply(Self, txc, ctx);
return true;
}
@@ -4563,33 +4563,33 @@ struct TSchemeShard::TTxInit : public TTransactionBase<TSchemeShard> {
}
void Complete(const TActorContext &ctx) override {
- auto delayPublications = OnComplete.ExtractPublicationsToSchemeBoard(); //there no Populator exist jet
+ auto delayPublications = OnComplete.ExtractPublicationsToSchemeBoard(); //there no Populator exist jet
for (auto& [txId, pathIds] : Publications) {
std::move(pathIds.begin(), pathIds.end(), std::back_inserter(delayPublications[txId]));
}
- OnComplete.ApplyOnComplete(Self, ctx);
-
- if (!Self->IsShemeShardConfigured()) {
- if (Self->IsDomainSchemeShard) { // self initiation
- Self->Execute(Self->CreateTxInitRoot(), ctx);
- } else { // wait initiation msg
- Self->SignalTabletActive(ctx);
- Self->Become(&TSelf::StateConfigure);
- }
- return;
- }
-
- Self->ActivateAfterInitialization(
- ctx,
- std::move(delayPublications),
- ExportsToResume, ImportsToResume,
- std::move(TablesToClean), std::move(BlockStoreVolumesToClean)
- );
+ OnComplete.ApplyOnComplete(Self, ctx);
+
+ if (!Self->IsShemeShardConfigured()) {
+ if (Self->IsDomainSchemeShard) { // self initiation
+ Self->Execute(Self->CreateTxInitRoot(), ctx);
+ } else { // wait initiation msg
+ Self->SignalTabletActive(ctx);
+ Self->Become(&TSelf::StateConfigure);
+ }
+ return;
+ }
+
+ Self->ActivateAfterInitialization(
+ ctx,
+ std::move(delayPublications),
+ ExportsToResume, ImportsToResume,
+ std::move(TablesToClean), std::move(BlockStoreVolumesToClean)
+ );
}
};
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxInit() {
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxInit() {
return new TTxInit(this);
}
diff --git a/ydb/core/tx/schemeshard/schemeshard__init_populator.cpp b/ydb/core/tx/schemeshard/schemeshard__init_populator.cpp
index 3d4799ee9ed..299757e38b3 100644
--- a/ydb/core/tx/schemeshard/schemeshard__init_populator.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__init_populator.cpp
@@ -6,47 +6,47 @@
#include <ydb/core/tx/scheme_board/populator.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TTxInitPopulator : public TTransactionBase<TSchemeShard> {
+struct TSchemeShard::TTxInitPopulator : public TTransactionBase<TSchemeShard> {
using TDescription = NSchemeBoard::TTwoPartDescription;
TMap<TPathId, TDescription> Descriptions;
- TSideEffects::TPublications DelayedPublications;
+ TSideEffects::TPublications DelayedPublications;
- explicit TTxInitPopulator(TSelf *self, TSideEffects::TPublications&& publications)
+ explicit TTxInitPopulator(TSelf *self, TSideEffects::TPublications&& publications)
: TBase(self)
- , DelayedPublications(publications)
+ , DelayedPublications(publications)
{
}
- TTxType GetTxType() const override { return TXTYPE_INIT_POPULATOR; }
-
+ TTxType GetTxType() const override { return TXTYPE_INIT_POPULATOR; }
+
bool Execute(TTransactionContext&, const TActorContext& ctx) override {
- Y_VERIFY(Self->IsShemeShardConfigured());
-
- for (auto item: Self->PathsById) {
- TPathId pathId = item.first;
- TPathElement::TPtr pathEl = item.second;
-
- // KIKIMR-13173
- // planned to drop pathes are added to populator
- // also such pathes (like BSV PQ) can be considered as deleted by path description however they aren't dropped jet
-
- if (pathEl->Dropped()) {
- // migrated pathes should be published directly
- // but once they published on the quorum replicas as deleted directly, further publishing is unnecessary
- // actually they are publishing strongly on the quorum as part of deleting operation
- // so it's ok to skip migrated pathes is they has beem marked as deleted
+ Y_VERIFY(Self->IsShemeShardConfigured());
+
+ for (auto item: Self->PathsById) {
+ TPathId pathId = item.first;
+ TPathElement::TPtr pathEl = item.second;
+
+ // KIKIMR-13173
+ // planned to drop pathes are added to populator
+ // also such pathes (like BSV PQ) can be considered as deleted by path description however they aren't dropped jet
+
+ if (pathEl->Dropped()) {
+ // migrated pathes should be published directly
+ // but once they published on the quorum replicas as deleted directly, further publishing is unnecessary
+ // actually they are publishing strongly on the quorum as part of deleting operation
+ // so it's ok to skip migrated pathes is they has beem marked as deleted
+ continue;
+ }
+
+ if (!Self->PathIsActive(pathId)) {
continue;
}
- if (!Self->PathIsActive(pathId)) {
- continue;
- }
-
auto result = DescribePath(Self, ctx, pathId);
TDescription description(std::move(result->PreSerializedData), std::move(result->Record));
Descriptions.emplace(pathId, std::move(description));
@@ -63,21 +63,21 @@ struct TSchemeShard::TTxInitPopulator : public TTransactionBase<TSchemeShard> {
IActor* populator = CreateSchemeBoardPopulator(
tabletId, Self->Generation(), boardSSId,
- std::move(Descriptions), Self->NextLocalPathId
+ std::move(Descriptions), Self->NextLocalPathId
);
-
- Y_VERIFY(!Self->SchemeBoardPopulator);
+
+ Y_VERIFY(!Self->SchemeBoardPopulator);
Self->SchemeBoardPopulator = Self->Register(populator);
Self->PublishToSchemeBoard(std::move(DelayedPublications), ctx);
Self->SignalTabletActive(ctx);
}
-}; // TSchemeShard::TTxInitPopulator
+}; // TSchemeShard::TTxInitPopulator
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxInitPopulator(TSideEffects::TPublications&& publications) {
- return new TTxInitPopulator(this, std::move(publications));
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxInitPopulator(TSideEffects::TPublications&& publications) {
+ return new TTxInitPopulator(this, std::move(publications));
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__init_root.cpp b/ydb/core/tx/schemeshard/schemeshard__init_root.cpp
index a11c825d6d3..74399680cda 100644
--- a/ydb/core/tx/schemeshard/schemeshard__init_root.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__init_root.cpp
@@ -6,13 +6,13 @@
#include <ydb/library/aclib/aclib.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TTxInitRoot : public TSchemeShard::TRwTxBase {
- TTxInitRoot(TSelf *self)
- : TRwTxBase(self)
+struct TSchemeShard::TTxInitRoot : public TSchemeShard::TRwTxBase {
+ TTxInitRoot(TSelf *self)
+ : TRwTxBase(self)
{}
TTxType GetTxType() const override { return TXTYPE_INIT_ROOT; }
@@ -20,300 +20,300 @@ struct TSchemeShard::TTxInitRoot : public TSchemeShard::TRwTxBase {
void DoExecute(TTransactionContext &txc, const TActorContext &ctx) override {
NIceDb::TNiceDb db(txc.DB);
- const TDomainsInfo::TDomain& selfDomain = Self->GetDomainDescription(ctx);
-
- TString rootName = selfDomain.Name;
- TString owner = BUILTIN_ACL_ROOT;
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInitRoot DoExecute"
- << ", path: " << rootName
- << ", pathId: " << Self->RootPathId()
- << ", at schemeshard: " << Self->TabletID());
-
- Y_VERIFY_S(Self->IsDomainSchemeShard, "Do not run this transaction on tenant schemeshard"
- ", tenant schemeshard needs proper initiation by domain schemeshard");
- Y_VERIFY(!Self->IsShemeShardConfigured());
- Y_VERIFY_S(!rootName.empty(), "invalid root name in domain config");
-
- TVector<TString> rootPathElemets = SplitPath(rootName);
- TString joinedRootPath = JoinPath(rootPathElemets);
- Y_VERIFY_S(rootPathElemets.size() == 1, "invalid root name in domain config: " << rootName << " parts count: " << rootPathElemets.size());
-
- TPathElement::TPtr newPath = new TPathElement(Self->RootPathId(), Self->RootPathId(), Self->RootPathId(), joinedRootPath, owner);
- newPath->CreateTxId = TTxId(1);
+ const TDomainsInfo::TDomain& selfDomain = Self->GetDomainDescription(ctx);
+
+ TString rootName = selfDomain.Name;
+ TString owner = BUILTIN_ACL_ROOT;
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInitRoot DoExecute"
+ << ", path: " << rootName
+ << ", pathId: " << Self->RootPathId()
+ << ", at schemeshard: " << Self->TabletID());
+
+ Y_VERIFY_S(Self->IsDomainSchemeShard, "Do not run this transaction on tenant schemeshard"
+ ", tenant schemeshard needs proper initiation by domain schemeshard");
+ Y_VERIFY(!Self->IsShemeShardConfigured());
+ Y_VERIFY_S(!rootName.empty(), "invalid root name in domain config");
+
+ TVector<TString> rootPathElemets = SplitPath(rootName);
+ TString joinedRootPath = JoinPath(rootPathElemets);
+ Y_VERIFY_S(rootPathElemets.size() == 1, "invalid root name in domain config: " << rootName << " parts count: " << rootPathElemets.size());
+
+ TPathElement::TPtr newPath = new TPathElement(Self->RootPathId(), Self->RootPathId(), Self->RootPathId(), joinedRootPath, owner);
+ newPath->CreateTxId = TTxId(1);
newPath->PathState = TPathElement::EPathState::EPathStateNoChanges;
newPath->PathType = TPathElement::EPathType::EPathTypeDir;
- newPath->DirAlterVersion = 1;
- newPath->UserAttrs->AlterVersion = 1;
- newPath->CachedEffectiveACL.Init(newPath->ACL);
- Self->PathsById[Self->RootPathId()] = newPath;
- Self->NextLocalPathId = Self->RootPathId().LocalPathId + 1;
- Self->NextLocalShardIdx = 1;
+ newPath->DirAlterVersion = 1;
+ newPath->UserAttrs->AlterVersion = 1;
+ newPath->CachedEffectiveACL.Init(newPath->ACL);
+ Self->PathsById[Self->RootPathId()] = newPath;
+ Self->NextLocalPathId = Self->RootPathId().LocalPathId + 1;
+ Self->NextLocalShardIdx = 1;
Self->ShardInfos.clear();
- Self->RootPathElemets = std::move(rootPathElemets);
+ Self->RootPathElemets = std::move(rootPathElemets);
TSubDomainInfo::TPtr newDomain = new TSubDomainInfo(0, Self->RootPathId());
- newDomain->InitializeAsGlobal(Self->CreateRootProcessingParams(ctx));
- Self->SubDomains[Self->RootPathId()] = newDomain;
+ newDomain->InitializeAsGlobal(Self->CreateRootProcessingParams(ctx));
+ Self->SubDomains[Self->RootPathId()] = newDomain;
- Self->PersistUserAttributes(db, Self->RootPathId(), nullptr, newPath->UserAttrs);
- Self->PersistPath(db, newPath->PathId);
+ Self->PersistUserAttributes(db, Self->RootPathId(), nullptr, newPath->UserAttrs);
+ Self->PersistPath(db, newPath->PathId);
Self->PersistUpdateNextPathId(db);
Self->PersistUpdateNextShardIdx(db);
- Self->PersistStoragePools(db, Self->RootPathId(), *newDomain);
-
- Self->InitState = TTenantInitState::Done;
- Self->PersistInitState(db);
+ Self->PersistStoragePools(db, Self->RootPathId(), *newDomain);
+
+ Self->InitState = TTenantInitState::Done;
+ Self->PersistInitState(db);
}
void DoComplete(const TActorContext &ctx) override {
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInitRoot DoComplete"
- << ", at schemeshard: " << Self->TabletID());
-
- Self->SignalTabletActive(ctx);
-
- Self->ActivateAfterInitialization(ctx);
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInitRoot DoComplete"
+ << ", at schemeshard: " << Self->TabletID());
+
+ Self->SignalTabletActive(ctx);
+
+ Self->ActivateAfterInitialization(ctx);
}
};
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxInitRoot() {
- return new TTxInitRoot(this);
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxInitRoot() {
+ return new TTxInitRoot(this);
}
-struct TSchemeShard::TTxInitRootCompatibility : public TSchemeShard::TRwTxBase {
- TEvSchemeShard::TEvInitRootShard::TPtr Ev;
- TSideEffects OnComplete;
-
- TTxInitRootCompatibility(TSelf *self, TEvSchemeShard::TEvInitRootShard::TPtr &ev)
- : TRwTxBase(self)
- , Ev(ev)
- {}
-
- TTxType GetTxType() const override { return TXTYPE_INIT_ROOT; }
-
- void DoExecute(TTransactionContext &txc, const TActorContext &ctx) override {
- NIceDb::TNiceDb db(txc.DB);
-
- TPath root = TPath::Root(Self);
- auto answerTo = ActorIdFromProto(Ev->Get()->Record.GetSource());
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInitRootCompatibility DoExecute"
- << ", event: " << Ev->Get()->Record.ShortDebugString()
- << ", pathId: " << Self->RootPathId()
- << ", at schemeshard: " << Self->TabletID());
-
- auto reply = MakeHolder<TEvSchemeShard::TEvInitRootShardResult>(Self->TabletID(), TEvSchemeShard::TEvInitRootShardResult::StatusAlreadyInitialized);
-
- if (!Self->IsDomainSchemeShard) {
- reply->Record.SetStatus(TEvSchemeShard::TEvInitRootShardResult::StatusBadArgument);
- OnComplete.Send(answerTo, reply.Release());
- return;
- }
-
- if (Ev->Get()->Record.GetRootTagName() != root.Base()->Name) {
- reply->Record.SetStatus(TEvSchemeShard::TEvInitRootShardResult::StatusBadArgument);
- OnComplete.Send(answerTo, reply.Release());
- return;
- }
-
- if (!Ev->Get()->Record.HasOwner()) {
- OnComplete.Send(answerTo, reply.Release());
- return;
- }
-
- if (root.Base()->Owner != BUILTIN_ACL_ROOT) {
- OnComplete.Send(answerTo, reply.Release());
- return;
- }
-
- if (root.Base()->Owner == Ev->Get()->Record.GetOwner()) {
- OnComplete.Send(answerTo, reply.Release());
- return;
- }
-
- reply->Record.SetStatus(TEvSchemeShard::TEvInitRootShardResult::StatusSuccess);
- OnComplete.Send(answerTo, reply.Release());
-
- root.Base()->Owner = Ev->Get()->Record.GetOwner();
- Self->PersistOwner(db, root.Base());
-
- ++root.Base()->DirAlterVersion;
- Self->PersistPathDirAlterVersion(db, root.Base());
-
- // we already inited, so we have to publish changes
- OnComplete.PublishToSchemeBoard(TOperationId(0,0), root.Base()->PathId);
-
- OnComplete.ApplyOnExecute(Self, txc, ctx);
- }
-
- void DoComplete(const TActorContext &ctx) override {
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxInitRootCompatibility DoComplete"
- << ", at schemeshard: " << Self->TabletID());
- OnComplete.ApplyOnComplete(Self, ctx);
- }
-};
-
+struct TSchemeShard::TTxInitRootCompatibility : public TSchemeShard::TRwTxBase {
+ TEvSchemeShard::TEvInitRootShard::TPtr Ev;
+ TSideEffects OnComplete;
+
+ TTxInitRootCompatibility(TSelf *self, TEvSchemeShard::TEvInitRootShard::TPtr &ev)
+ : TRwTxBase(self)
+ , Ev(ev)
+ {}
+
+ TTxType GetTxType() const override { return TXTYPE_INIT_ROOT; }
+
+ void DoExecute(TTransactionContext &txc, const TActorContext &ctx) override {
+ NIceDb::TNiceDb db(txc.DB);
+
+ TPath root = TPath::Root(Self);
+ auto answerTo = ActorIdFromProto(Ev->Get()->Record.GetSource());
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInitRootCompatibility DoExecute"
+ << ", event: " << Ev->Get()->Record.ShortDebugString()
+ << ", pathId: " << Self->RootPathId()
+ << ", at schemeshard: " << Self->TabletID());
+
+ auto reply = MakeHolder<TEvSchemeShard::TEvInitRootShardResult>(Self->TabletID(), TEvSchemeShard::TEvInitRootShardResult::StatusAlreadyInitialized);
+
+ if (!Self->IsDomainSchemeShard) {
+ reply->Record.SetStatus(TEvSchemeShard::TEvInitRootShardResult::StatusBadArgument);
+ OnComplete.Send(answerTo, reply.Release());
+ return;
+ }
+
+ if (Ev->Get()->Record.GetRootTagName() != root.Base()->Name) {
+ reply->Record.SetStatus(TEvSchemeShard::TEvInitRootShardResult::StatusBadArgument);
+ OnComplete.Send(answerTo, reply.Release());
+ return;
+ }
+
+ if (!Ev->Get()->Record.HasOwner()) {
+ OnComplete.Send(answerTo, reply.Release());
+ return;
+ }
+
+ if (root.Base()->Owner != BUILTIN_ACL_ROOT) {
+ OnComplete.Send(answerTo, reply.Release());
+ return;
+ }
+
+ if (root.Base()->Owner == Ev->Get()->Record.GetOwner()) {
+ OnComplete.Send(answerTo, reply.Release());
+ return;
+ }
+
+ reply->Record.SetStatus(TEvSchemeShard::TEvInitRootShardResult::StatusSuccess);
+ OnComplete.Send(answerTo, reply.Release());
+
+ root.Base()->Owner = Ev->Get()->Record.GetOwner();
+ Self->PersistOwner(db, root.Base());
+
+ ++root.Base()->DirAlterVersion;
+ Self->PersistPathDirAlterVersion(db, root.Base());
+
+ // we already inited, so we have to publish changes
+ OnComplete.PublishToSchemeBoard(TOperationId(0,0), root.Base()->PathId);
+
+ OnComplete.ApplyOnExecute(Self, txc, ctx);
+ }
+
+ void DoComplete(const TActorContext &ctx) override {
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxInitRootCompatibility DoComplete"
+ << ", at schemeshard: " << Self->TabletID());
+ OnComplete.ApplyOnComplete(Self, ctx);
+ }
+};
+
NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxInitRootCompatibility(TEvSchemeShard::TEvInitRootShard::TPtr &ev) {
- return new TTxInitRootCompatibility(this, ev);
-}
-
-struct TSchemeShard::TTxInitTenantSchemeShard : public TSchemeShard::TRwTxBase {
- TEvSchemeShard::TEvInitTenantSchemeShard::TPtr Ev;
- TAutoPtr<TEvSchemeShard::TEvInitTenantSchemeShardResult> Reply;
-
- TTxInitTenantSchemeShard(TSelf *self, TEvSchemeShard::TEvInitTenantSchemeShard::TPtr &ev)
- : TRwTxBase(self)
- , Ev(ev)
- {}
-
- TTxType GetTxType() const override { return TXTYPE_INIT_ROOT; }
-
- template<class TContainer>
- void RegisterShard(NIceDb::TNiceDb& db, TSubDomainInfo::TPtr& subdomain, const TContainer& tabletIds, TTabletTypes::EType type) {
- for (ui32 i = 0; i < (ui64)tabletIds.size(); ++i) {
+ return new TTxInitRootCompatibility(this, ev);
+}
+
+struct TSchemeShard::TTxInitTenantSchemeShard : public TSchemeShard::TRwTxBase {
+ TEvSchemeShard::TEvInitTenantSchemeShard::TPtr Ev;
+ TAutoPtr<TEvSchemeShard::TEvInitTenantSchemeShardResult> Reply;
+
+ TTxInitTenantSchemeShard(TSelf *self, TEvSchemeShard::TEvInitTenantSchemeShard::TPtr &ev)
+ : TRwTxBase(self)
+ , Ev(ev)
+ {}
+
+ TTxType GetTxType() const override { return TXTYPE_INIT_ROOT; }
+
+ template<class TContainer>
+ void RegisterShard(NIceDb::TNiceDb& db, TSubDomainInfo::TPtr& subdomain, const TContainer& tabletIds, TTabletTypes::EType type) {
+ for (ui32 i = 0; i < (ui64)tabletIds.size(); ++i) {
const auto id = TTabletId(tabletIds[i]);
const auto shardIdx = Self->RegisterShardInfo(
TShardInfo(InvalidTxId, Self->RootPathId(), type)
.WithTabletID(id));
-
- Self->PersistShardMapping(db, shardIdx, id, Self->RootPathId(), InvalidTxId, type);
-
- subdomain->AddPrivateShard(shardIdx);
- subdomain->AddInternalShard(shardIdx);
- }
- }
-
- void DoExecute(TTransactionContext &txc, const TActorContext &ctx) override {
- NIceDb::TNiceDb db(txc.DB);
-
- const auto selfTabletId = Self->SelfTabletId();
- const NKikimrScheme::TEvInitTenantSchemeShard& record = Ev->Get()->Record;
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TEvInitTenantSchemeShard DoExecute"
- << ", message: " << record.ShortDebugString()
- << ", at schemeshard: " << selfTabletId);
-
- const TOwnerId domainSchemeShard = record.GetDomainSchemeShard();
- const TLocalPathId domainPathId = record.GetDomainPathId();
-
- const TString& rootPath = record.GetRootPath();
- const TString& owner = record.GetOwner();
- const TString& effectiveACL = record.GetEffectiveACL();
- const ui64 effectiveACLVersion = record.GetEffectiveACLVersion();
- const NKikimrSubDomains::TProcessingParams& processingParams = record.GetProcessingParams();
- const auto& storagePools = record.GetStoragePools();
- const auto& userAttrData = record.GetUserAttributes();
- const ui64 userAttrsVersion = record.GetUserAttributesVersion();
- const auto& schemeLimits = record.GetSchemeLimits();
- const bool initiateMigration = record.GetInitiateMigration();
-
- Reply.Reset(new TEvSchemeShard::TEvInitTenantSchemeShardResult(Self->TabletID(), NKikimrScheme::StatusSuccess));
-
- if (Self->IsDomainSchemeShard) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TEvInitTenantSchemeShard DoExecute"
- << ", this is wrong message for domain SchemeShard "
- << ", at schemeshard: " << selfTabletId);
- Reply->Record.SetStatus(NKikimrScheme::StatusInvalidParameter);
- return;
- }
-
- TVector<TString> rootPathElemets = SplitPath(rootPath);
-
- TString joinedRootPath = JoinPath(rootPathElemets);
- Y_VERIFY(!IsStartWithSlash(joinedRootPath)); //skip lead '/'
-
-
-
- if (Self->IsShemeShardConfigured()) {
- TPathElement::TPtr root = Self->PathsById.at(Self->RootPathId());
- if (joinedRootPath != root->Name) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TEvInitTenantSchemeShard DoExecute"
- << ", tenant SchemeShard has been alredy initialized with different root path"
- << ", at schemeshard: " << selfTabletId);
- Reply->Record.SetStatus(NKikimrScheme::StatusInvalidParameter);
- return;
- }
-
- if (TTabletId(processingParams.GetSchemeShard()) != selfTabletId) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TEvInitTenantSchemeShard DoExecute"
- << ", tenant SchemeShard has been alredy initialized, unexpected scheme shard ID in params"
- << ", at schemeshard: " << selfTabletId);
- Reply->Record.SetStatus(NKikimrScheme::StatusInvalidParameter);
- return;
- }
-
- Reply->Record.SetStatus(NKikimrScheme::StatusAlreadyExists);
- return;
- }
-
- if (rootPath.empty() || owner.empty()) {
- Reply->Record.SetStatus(NKikimrScheme::StatusInvalidParameter);
- return;
- }
-
- if (rootPathElemets.size() <= 1) {
- Reply->Record.SetStatus(NKikimrScheme::StatusInvalidParameter);
- return;
- }
-
- TUserAttributes::TPtr userAttrs = new TUserAttributes(userAttrsVersion);
- {
- TString errStr;
+
+ Self->PersistShardMapping(db, shardIdx, id, Self->RootPathId(), InvalidTxId, type);
+
+ subdomain->AddPrivateShard(shardIdx);
+ subdomain->AddInternalShard(shardIdx);
+ }
+ }
+
+ void DoExecute(TTransactionContext &txc, const TActorContext &ctx) override {
+ NIceDb::TNiceDb db(txc.DB);
+
+ const auto selfTabletId = Self->SelfTabletId();
+ const NKikimrScheme::TEvInitTenantSchemeShard& record = Ev->Get()->Record;
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TEvInitTenantSchemeShard DoExecute"
+ << ", message: " << record.ShortDebugString()
+ << ", at schemeshard: " << selfTabletId);
+
+ const TOwnerId domainSchemeShard = record.GetDomainSchemeShard();
+ const TLocalPathId domainPathId = record.GetDomainPathId();
+
+ const TString& rootPath = record.GetRootPath();
+ const TString& owner = record.GetOwner();
+ const TString& effectiveACL = record.GetEffectiveACL();
+ const ui64 effectiveACLVersion = record.GetEffectiveACLVersion();
+ const NKikimrSubDomains::TProcessingParams& processingParams = record.GetProcessingParams();
+ const auto& storagePools = record.GetStoragePools();
+ const auto& userAttrData = record.GetUserAttributes();
+ const ui64 userAttrsVersion = record.GetUserAttributesVersion();
+ const auto& schemeLimits = record.GetSchemeLimits();
+ const bool initiateMigration = record.GetInitiateMigration();
+
+ Reply.Reset(new TEvSchemeShard::TEvInitTenantSchemeShardResult(Self->TabletID(), NKikimrScheme::StatusSuccess));
+
+ if (Self->IsDomainSchemeShard) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TEvInitTenantSchemeShard DoExecute"
+ << ", this is wrong message for domain SchemeShard "
+ << ", at schemeshard: " << selfTabletId);
+ Reply->Record.SetStatus(NKikimrScheme::StatusInvalidParameter);
+ return;
+ }
+
+ TVector<TString> rootPathElemets = SplitPath(rootPath);
+
+ TString joinedRootPath = JoinPath(rootPathElemets);
+ Y_VERIFY(!IsStartWithSlash(joinedRootPath)); //skip lead '/'
+
+
+
+ if (Self->IsShemeShardConfigured()) {
+ TPathElement::TPtr root = Self->PathsById.at(Self->RootPathId());
+ if (joinedRootPath != root->Name) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TEvInitTenantSchemeShard DoExecute"
+ << ", tenant SchemeShard has been alredy initialized with different root path"
+ << ", at schemeshard: " << selfTabletId);
+ Reply->Record.SetStatus(NKikimrScheme::StatusInvalidParameter);
+ return;
+ }
+
+ if (TTabletId(processingParams.GetSchemeShard()) != selfTabletId) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TEvInitTenantSchemeShard DoExecute"
+ << ", tenant SchemeShard has been alredy initialized, unexpected scheme shard ID in params"
+ << ", at schemeshard: " << selfTabletId);
+ Reply->Record.SetStatus(NKikimrScheme::StatusInvalidParameter);
+ return;
+ }
+
+ Reply->Record.SetStatus(NKikimrScheme::StatusAlreadyExists);
+ return;
+ }
+
+ if (rootPath.empty() || owner.empty()) {
+ Reply->Record.SetStatus(NKikimrScheme::StatusInvalidParameter);
+ return;
+ }
+
+ if (rootPathElemets.size() <= 1) {
+ Reply->Record.SetStatus(NKikimrScheme::StatusInvalidParameter);
+ return;
+ }
+
+ TUserAttributes::TPtr userAttrs = new TUserAttributes(userAttrsVersion);
+ {
+ TString errStr;
bool isOk = userAttrs->ApplyPatch(EUserAttributesOp::InitRoot, userAttrData, errStr);
- Y_VERIFY_S(isOk, errStr);
- }
-
-
- TPathElement::TPtr newPath = new TPathElement(Self->RootPathId(), Self->RootPathId(), Self->RootPathId(), joinedRootPath, owner);
- newPath->CreateTxId = TTxId(1);
- newPath->PathState = TPathElement::EPathState::EPathStateNoChanges;
- newPath->PathType = TPathElement::EPathType::EPathTypeSubDomain;
- newPath->DirAlterVersion = 1;
- newPath->UserAttrs->AlterData = userAttrs;
- Self->PathsById[Self->RootPathId()] = newPath;
- Self->NextLocalPathId = Self->RootPathId().LocalPathId + 1;
- Self->NextLocalShardIdx = 1;
+ Y_VERIFY_S(isOk, errStr);
+ }
+
+
+ TPathElement::TPtr newPath = new TPathElement(Self->RootPathId(), Self->RootPathId(), Self->RootPathId(), joinedRootPath, owner);
+ newPath->CreateTxId = TTxId(1);
+ newPath->PathState = TPathElement::EPathState::EPathStateNoChanges;
+ newPath->PathType = TPathElement::EPathType::EPathTypeSubDomain;
+ newPath->DirAlterVersion = 1;
+ newPath->UserAttrs->AlterData = userAttrs;
+ Self->PathsById[Self->RootPathId()] = newPath;
+ Self->NextLocalPathId = Self->RootPathId().LocalPathId + 1;
+ Self->NextLocalShardIdx = 1;
Self->ShardInfos.clear();
-
- Self->RootPathElemets = std::move(rootPathElemets);
-
- Self->ParentDomainId = TPathId(domainSchemeShard, domainPathId);
- Self->ParentDomainOwner = owner;
- Self->ParentDomainEffectiveACL = effectiveACL;
- Self->ParentDomainEffectiveACLVersion = effectiveACLVersion;
- Self->ParentDomainCachedEffectiveACL.Init(Self->ParentDomainEffectiveACL);
-
- newPath->CachedEffectiveACL.Update(Self->ParentDomainCachedEffectiveACL, newPath->ACL, newPath->IsContainer());
-
+
+ Self->RootPathElemets = std::move(rootPathElemets);
+
+ Self->ParentDomainId = TPathId(domainSchemeShard, domainPathId);
+ Self->ParentDomainOwner = owner;
+ Self->ParentDomainEffectiveACL = effectiveACL;
+ Self->ParentDomainEffectiveACLVersion = effectiveACLVersion;
+ Self->ParentDomainCachedEffectiveACL.Init(Self->ParentDomainEffectiveACL);
+
+ newPath->CachedEffectiveACL.Update(Self->ParentDomainCachedEffectiveACL, newPath->ACL, newPath->IsContainer());
+
TPathId resourcesDomainId = Self->ParentDomainId;
if (record.HasResourcesDomainOwnerId() && record.HasResourcesDomainPathId()) {
resourcesDomainId = TPathId(record.GetResourcesDomainOwnerId(), record.GetResourcesDomainPathId());
}
- TSubDomainInfo::TPtr subdomain = new TSubDomainInfo(processingParams.GetVersion(),
- processingParams.GetPlanResolution(),
+ TSubDomainInfo::TPtr subdomain = new TSubDomainInfo(processingParams.GetVersion(),
+ processingParams.GetPlanResolution(),
processingParams.GetTimeCastBucketsPerMediator(),
resourcesDomainId);
-
+
if (record.HasSharedHive()) {
subdomain->SetSharedHive(TTabletId(record.GetSharedHive()));
}
- for (auto& x: storagePools) {
- subdomain->AddStoragePool(x);
- }
-
- subdomain->SetSchemeLimits(TSchemeLimits(schemeLimits));
-
+ for (auto& x: storagePools) {
+ subdomain->AddStoragePool(x);
+ }
+
+ subdomain->SetSchemeLimits(TSchemeLimits(schemeLimits));
+
if (record.HasDeclaredSchemeQuotas()) {
subdomain->ApplyDeclaredSchemeQuotas(record.GetDeclaredSchemeQuotas(), ctx.Now());
}
@@ -322,367 +322,367 @@ struct TSchemeShard::TTxInitTenantSchemeShard : public TSchemeShard::TRwTxBase {
subdomain->SetDatabaseQuotas(record.GetDatabaseQuotas(), Self);
}
- RegisterShard(db, subdomain, processingParams.GetCoordinators(), TTabletTypes::Coordinator);
- RegisterShard(db, subdomain, processingParams.GetMediators(), TTabletTypes::Mediator);
- RegisterShard(db, subdomain, TVector<ui64>{processingParams.GetSchemeShard()}, TTabletTypes::SchemeShard);
+ RegisterShard(db, subdomain, processingParams.GetCoordinators(), TTabletTypes::Coordinator);
+ RegisterShard(db, subdomain, processingParams.GetMediators(), TTabletTypes::Mediator);
+ RegisterShard(db, subdomain, TVector<ui64>{processingParams.GetSchemeShard()}, TTabletTypes::SchemeShard);
if (processingParams.HasHive()) {
RegisterShard(db, subdomain, TVector<ui64>{processingParams.GetHive()}, TTabletTypes::Hive);
}
if (processingParams.HasSysViewProcessor()) {
RegisterShard(db, subdomain, TVector<ui64>{processingParams.GetSysViewProcessor()}, TTabletTypes::SysViewProcessor);
}
-
- subdomain->Initialize(Self->ShardInfos);
-
- Self->PersistParentDomain(db, Self->ParentDomainId);
- Self->PersistParentDomainEffectiveACL(db, owner, effectiveACL, effectiveACLVersion);
-
- Self->PersistPath(db, newPath->PathId);
- Self->ApplyAndPersistUserAttrs(db, newPath->PathId);
-
- Self->PersistSubDomain(db, Self->RootPathId(), *subdomain);
- Self->PersistSchemeLimit(db, Self->RootPathId(), *subdomain);
+
+ subdomain->Initialize(Self->ShardInfos);
+
+ Self->PersistParentDomain(db, Self->ParentDomainId);
+ Self->PersistParentDomainEffectiveACL(db, owner, effectiveACL, effectiveACLVersion);
+
+ Self->PersistPath(db, newPath->PathId);
+ Self->ApplyAndPersistUserAttrs(db, newPath->PathId);
+
+ Self->PersistSubDomain(db, Self->RootPathId(), *subdomain);
+ Self->PersistSchemeLimit(db, Self->RootPathId(), *subdomain);
Self->PersistSubDomainSchemeQuotas(db, Self->RootPathId(), *subdomain);
-
- Self->PersistUpdateNextPathId(db);
- Self->PersistUpdateNextShardIdx(db);
-
- Self->SubDomains[Self->RootPathId()] = subdomain;
-
- Self->InitState = initiateMigration ? TTenantInitState::Inprogress : TTenantInitState::Done;
- Self->PersistInitState(db);
- }
-
- void DoComplete(const TActorContext &ctx) override {
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TEvInitTenantSchemeShard DoComplete"
- << ", status: " <<Reply->Record.GetStatus()
- << ", at schemeshard: " << Self->TabletID());
-
- if (Reply->Record.GetStatus() != NKikimrScheme::StatusSuccess || !Self->IsShemeShardConfigured()) {
- ctx.Send(Ev->Sender, Reply.Release());
- return;
- }
-
- Self->DelayedInitTenantDestination = Ev->Sender;
- Self->DelayedInitTenantReply = Reply.Release();
-
- auto publications = TSideEffects::TPublications();
- publications[TTxId()] = TSideEffects::TPublications::mapped_type{Self->RootPathId()};
-
- Self->ActivateAfterInitialization(ctx, std::move(publications));
- }
-};
-
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxInitTenantSchemeShard(TEvSchemeShard::TEvInitTenantSchemeShard::TPtr &ev) {
- return new TTxInitTenantSchemeShard(this, ev);
-}
-
-struct TSchemeShard::TTxPublishTenantAsReadOnly : public TSchemeShard::TRwTxBase {
- TEvSchemeShard::TEvPublishTenantAsReadOnly::TPtr Ev;
- TAutoPtr<TEvSchemeShard::TEvPublishTenantAsReadOnlyResult> Reply;
-
- TTxPublishTenantAsReadOnly(TSelf *self, TEvSchemeShard::TEvPublishTenantAsReadOnly::TPtr &ev)
- : TRwTxBase(self)
- , Ev(ev)
- {}
-
- TTxType GetTxType() const override { return TXTYPE_SUBDOMAIN_MIGRATE; }
-
-
- void DoExecute(TTransactionContext &txc, const TActorContext &ctx) override {
- NIceDb::TNiceDb db(txc.DB);
-
- const TTabletId selfTabletId = Self->SelfTabletId();
- const NKikimrScheme::TEvPublishTenantAsReadOnly& record = Ev->Get()->Record;
- Y_VERIFY(Self->ParentDomainId.OwnerId == record.GetDomainSchemeShard());
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxPublishTenantAsReadOnly DoExecute"
- << ", message: " << record.ShortDebugString()
- << ", at schemeshard: " << selfTabletId);
-
- Reply = new TEvSchemeShard::TEvPublishTenantAsReadOnlyResult(ui64(selfTabletId), NKikimrScheme::StatusSuccess);
-
- switch (Self->InitState) {
- case TTenantInitState::Inprogress:
- Self->InitState = TTenantInitState::ReadOnlyPreview;;
- Self->PersistInitState(db);
-
- Self->IsReadOnlyMode = true;
- db.Table<Schema::SysParams>().Key(Schema::SysParam_IsReadOnlyMode).Update(
- NIceDb::TUpdate<Schema::SysParams::Value>("1"));
- break;
- case TTenantInitState::ReadOnlyPreview:
- Reply->Record.SetStatus(NKikimrScheme::StatusAlreadyExists);
- break;
- case TTenantInitState::InvalidState:
- case TTenantInitState::Uninitialized:
- case TTenantInitState::Done:
- Y_FAIL("Invalid state");
- };
- }
-
- void DoComplete(const TActorContext &ctx) override {
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxPublishTenantAsReadOnly DoComplete"
- << ", at schemeshard: " << Self->TabletID());
-
- if (Reply->Record.GetStatus() == NKikimrScheme::StatusSuccess) {
- Self->Execute(Self->CreateTxInit(), ctx);
- }
-
- ctx.Send(Ev->Sender, Reply.Release());
- }
-};
-
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxPublishTenantAsReadOnly(TEvSchemeShard::TEvPublishTenantAsReadOnly::TPtr &ev) {
- return new TTxPublishTenantAsReadOnly(this, ev);
-}
-
-
-struct TSchemeShard::TTxPublishTenant : public TSchemeShard::TRwTxBase {
- TEvSchemeShard::TEvPublishTenant::TPtr Ev;
- TAutoPtr<TEvSchemeShard::TEvPublishTenantResult> Reply;
-
- TTxPublishTenant(TSelf *self, TEvSchemeShard::TEvPublishTenant::TPtr &ev)
- : TRwTxBase(self)
- , Ev(ev)
- {}
-
- TTxType GetTxType() const override { return TXTYPE_SUBDOMAIN_MIGRATE; }
-
- void DoExecute(TTransactionContext &txc, const TActorContext &ctx) override {
- NIceDb::TNiceDb db(txc.DB);
-
- const TTabletId selfTabletId = Self->SelfTabletId();
- const NKikimrScheme::TEvPublishTenant& record = Ev->Get()->Record;
- Y_VERIFY(Self->ParentDomainId.OwnerId == record.GetDomainSchemeShard());
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxPublishTenant DoExecute"
- << ", message: " << record.ShortDebugString()
- << ", at schemeshard: " << selfTabletId);
-
- Reply = new TEvSchemeShard::TEvPublishTenantResult(ui64(selfTabletId));
-
- switch (Self->InitState) {
- case TTenantInitState::ReadOnlyPreview:
- Self->InitState = TTenantInitState::Done;
- Self->PersistInitState(db);
-
- Self->IsReadOnlyMode = false;
- db.Table<Schema::SysParams>().Key(Schema::SysParam_IsReadOnlyMode).Update(
- NIceDb::TUpdate<Schema::SysParams::Value>("0"));
- break;
- case TTenantInitState::Done:
- break;
- case TTenantInitState::InvalidState:
- case TTenantInitState::Uninitialized:
- case TTenantInitState::Inprogress:
- Y_FAIL("Invalid state");
- };
- }
-
- void DoComplete(const TActorContext &ctx) override {
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxPublishTenant DoComplete"
- << ", at schemeshard: " << Self->TabletID());
-
- ctx.Send(Ev->Sender, Reply.Release());
- }
-};
-
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxPublishTenant(TEvSchemeShard::TEvPublishTenant::TPtr &ev) {
- return new TTxPublishTenant(this, ev);
-}
-
-struct TSchemeShard::TTxMigrate : public TSchemeShard::TRwTxBase {
- TEvSchemeShard::TEvMigrateSchemeShard::TPtr Ev;
- TAutoPtr<TEvSchemeShard::TEvMigrateSchemeShardResult> Reply;
-
- TTxMigrate(TSelf *self, TEvSchemeShard::TEvMigrateSchemeShard::TPtr &ev)
- : TRwTxBase(self)
- , Ev(ev)
- {}
-
- TTxType GetTxType() const override { return TXTYPE_SUBDOMAIN_MIGRATE; }
-
-
- void DoExecute(TTransactionContext &txc, const TActorContext &ctx) override {
-
- const TTabletId selfTabletId = Self->SelfTabletId();
- const NKikimrScheme::TEvMigrate& record = Ev->Get()->Record;
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxMigrate DoExecute"
- << ", message: " << record.ShortDebugString()
- << ", at schemeshard: " << selfTabletId);
-
- Reply = new TEvSchemeShard::TEvMigrateSchemeShardResult(ui64(selfTabletId));
-
- const NKikimrScheme::TMigratePath& pathDescr = record.GetPath();
-
- NIceDb::TNiceDb db(txc.DB);
-
- auto pathId = TPathId(pathDescr.GetPathId().GetOwnerId(), pathDescr.GetPathId().GetLocalId());
- auto parentPathId = TPathId(pathDescr.GetParentPathId().GetOwnerId(), pathDescr.GetParentPathId().GetLocalId());
- if (parentPathId == Self->ParentDomainId) { // relink root
- parentPathId = Self->RootPathId();
- }
-
- db.Table<Schema::MigratedPaths>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::MigratedPaths::ParentOwnerId>(parentPathId.OwnerId),
- NIceDb::TUpdate<Schema::MigratedPaths::ParentLocalId>(parentPathId.LocalPathId),
- NIceDb::TUpdate<Schema::MigratedPaths::Name>(pathDescr.GetName()),
- NIceDb::TUpdate<Schema::MigratedPaths::PathType>(pathDescr.GetPathType()),
- NIceDb::TUpdate<Schema::MigratedPaths::StepCreated>(TStepId(pathDescr.GetStepCreated())),
- NIceDb::TUpdate<Schema::MigratedPaths::CreateTxId>(TTxId(pathDescr.GetCreateTxId())),
- NIceDb::TUpdate<Schema::MigratedPaths::Owner>(pathDescr.GetOwner()),
- NIceDb::TUpdate<Schema::MigratedPaths::ACL>(pathDescr.GetACL()),
- NIceDb::TUpdate<Schema::MigratedPaths::DirAlterVersion>(pathDescr.GetDirAlterVersion() + 1), // we need to bump version on 1 to override data at SB
- NIceDb::TUpdate<Schema::MigratedPaths::UserAttrsAlterVersion>(pathDescr.GetUserAttrsAlterVersion()),
- NIceDb::TUpdate<Schema::MigratedPaths::ACLVersion>(pathDescr.GetACLVersion())
- );
-
- for (auto& userAttr: pathDescr.GetUserAttributes()) {
- db.Table<Schema::MigratedUserAttributes>().Key(pathId.OwnerId, pathId.LocalPathId, userAttr.GetKey()).Update(
- NIceDb::TUpdate<Schema::MigratedUserAttributes::AttrValue>(userAttr.GetValue())
- );
- }
-
-
- Reply->Record.MutablePathId()->SetOwnerId(pathId.OwnerId);
- Reply->Record.MutablePathId()->SetLocalId(pathId.LocalPathId);
-
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxMigrate DoExecute"
- << " PathInfo OK"
- << ", at schemeshard: " << selfTabletId);
-
- for (const auto& shard: record.GetShards()) {
- auto shardIdx = TShardIdx(
- TOwnerId(shard.GetShardIdx().GetOwnerId()),
- TLocalShardIdx(shard.GetShardIdx().GetLocalId())
- );
- Y_VERIFY(shardIdx.GetOwnerId() != Self->TabletID());
-
- TTabletTypes::EType type = (TTabletTypes::EType)shard.GetType();
-
- db.Table<Schema::MigratedShards>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
- NIceDb::TUpdate<Schema::MigratedShards::TabletId>(TTabletId(shard.GetTabletId())),
- NIceDb::TUpdate<Schema::MigratedShards::OwnerPathId>(pathId.OwnerId),
- NIceDb::TUpdate<Schema::MigratedShards::LocalPathId>(pathId.LocalPathId),
- NIceDb::TUpdate<Schema::MigratedShards::TabletType>(type)
- );
-
- for (ui32 channelId = 0; channelId < shard.BindedStoragePoolSize(); ++channelId) {
- const NKikimrStoragePool::TChannelBind& bind = shard.GetBindedStoragePool(channelId);
-
- db.Table<Schema::MigratedChannelsBinding>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId(), channelId).Update(
- NIceDb::TUpdate<Schema::MigratedChannelsBinding::PoolName>(bind.GetStoragePoolName()),
- NIceDb::TUpdate<Schema::MigratedChannelsBinding::Binding>(bind.SerializeAsString())
- );
- }
-
- {
- auto item = Reply->Record.MutableShardIds()->Add();
- item->SetOwnerId(shardIdx.GetOwnerId());
- item->SetLocalId(ui64(shardIdx.GetLocalId()));
- }
- }
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxMigrate DoExecute"
- << " ShardInfo OK"
- << ", at schemeshard: " << selfTabletId);
-
- if ((TPathElement::EPathType)pathDescr.GetPathType() == TPathElement::EPathType::EPathTypeTable) {
- Y_VERIFY(record.HasTable());
- const NKikimrScheme::TMigrateTable& tableDescr = record.GetTable();
-
- db.Table<Schema::MigratedTables>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::MigratedTables::NextColId>(tableDescr.GetNextColId()),
- NIceDb::TUpdate<Schema::MigratedTables::PartitionConfig>(tableDescr.GetPartitionConfig()),
- NIceDb::TUpdate<Schema::MigratedTables::AlterVersion>(tableDescr.GetAlterVersion()),
- //NIceDb::TUpdate<Schema::MigratedTables::AlterTable>(),
- //NIceDb::TUpdate<Schema::MigratedTables::AlterTableFull>(),
- NIceDb::TUpdate<Schema::MigratedTables::PartitioningVersion>(tableDescr.GetPartitioningVersion()));
-
- for (const NKikimrScheme::TMigrateColumn& colDescr: tableDescr.GetColumns()) {
- db.Table<Schema::MigratedColumns>().Key(pathId.OwnerId, pathId.LocalPathId, colDescr.GetId()).Update(
- NIceDb::TUpdate<Schema::MigratedColumns::ColName>(colDescr.GetName()),
- NIceDb::TUpdate<Schema::MigratedColumns::ColType>(colDescr.GetColType()),
- NIceDb::TUpdate<Schema::MigratedColumns::ColKeyOrder>(colDescr.GetColKeyOrder()),
- NIceDb::TUpdate<Schema::MigratedColumns::CreateVersion>(colDescr.GetCreateVersion()),
- NIceDb::TUpdate<Schema::MigratedColumns::DeleteVersion>(colDescr.GetDeleteVersion()),
+
+ Self->PersistUpdateNextPathId(db);
+ Self->PersistUpdateNextShardIdx(db);
+
+ Self->SubDomains[Self->RootPathId()] = subdomain;
+
+ Self->InitState = initiateMigration ? TTenantInitState::Inprogress : TTenantInitState::Done;
+ Self->PersistInitState(db);
+ }
+
+ void DoComplete(const TActorContext &ctx) override {
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TEvInitTenantSchemeShard DoComplete"
+ << ", status: " <<Reply->Record.GetStatus()
+ << ", at schemeshard: " << Self->TabletID());
+
+ if (Reply->Record.GetStatus() != NKikimrScheme::StatusSuccess || !Self->IsShemeShardConfigured()) {
+ ctx.Send(Ev->Sender, Reply.Release());
+ return;
+ }
+
+ Self->DelayedInitTenantDestination = Ev->Sender;
+ Self->DelayedInitTenantReply = Reply.Release();
+
+ auto publications = TSideEffects::TPublications();
+ publications[TTxId()] = TSideEffects::TPublications::mapped_type{Self->RootPathId()};
+
+ Self->ActivateAfterInitialization(ctx, std::move(publications));
+ }
+};
+
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxInitTenantSchemeShard(TEvSchemeShard::TEvInitTenantSchemeShard::TPtr &ev) {
+ return new TTxInitTenantSchemeShard(this, ev);
+}
+
+struct TSchemeShard::TTxPublishTenantAsReadOnly : public TSchemeShard::TRwTxBase {
+ TEvSchemeShard::TEvPublishTenantAsReadOnly::TPtr Ev;
+ TAutoPtr<TEvSchemeShard::TEvPublishTenantAsReadOnlyResult> Reply;
+
+ TTxPublishTenantAsReadOnly(TSelf *self, TEvSchemeShard::TEvPublishTenantAsReadOnly::TPtr &ev)
+ : TRwTxBase(self)
+ , Ev(ev)
+ {}
+
+ TTxType GetTxType() const override { return TXTYPE_SUBDOMAIN_MIGRATE; }
+
+
+ void DoExecute(TTransactionContext &txc, const TActorContext &ctx) override {
+ NIceDb::TNiceDb db(txc.DB);
+
+ const TTabletId selfTabletId = Self->SelfTabletId();
+ const NKikimrScheme::TEvPublishTenantAsReadOnly& record = Ev->Get()->Record;
+ Y_VERIFY(Self->ParentDomainId.OwnerId == record.GetDomainSchemeShard());
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxPublishTenantAsReadOnly DoExecute"
+ << ", message: " << record.ShortDebugString()
+ << ", at schemeshard: " << selfTabletId);
+
+ Reply = new TEvSchemeShard::TEvPublishTenantAsReadOnlyResult(ui64(selfTabletId), NKikimrScheme::StatusSuccess);
+
+ switch (Self->InitState) {
+ case TTenantInitState::Inprogress:
+ Self->InitState = TTenantInitState::ReadOnlyPreview;;
+ Self->PersistInitState(db);
+
+ Self->IsReadOnlyMode = true;
+ db.Table<Schema::SysParams>().Key(Schema::SysParam_IsReadOnlyMode).Update(
+ NIceDb::TUpdate<Schema::SysParams::Value>("1"));
+ break;
+ case TTenantInitState::ReadOnlyPreview:
+ Reply->Record.SetStatus(NKikimrScheme::StatusAlreadyExists);
+ break;
+ case TTenantInitState::InvalidState:
+ case TTenantInitState::Uninitialized:
+ case TTenantInitState::Done:
+ Y_FAIL("Invalid state");
+ };
+ }
+
+ void DoComplete(const TActorContext &ctx) override {
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxPublishTenantAsReadOnly DoComplete"
+ << ", at schemeshard: " << Self->TabletID());
+
+ if (Reply->Record.GetStatus() == NKikimrScheme::StatusSuccess) {
+ Self->Execute(Self->CreateTxInit(), ctx);
+ }
+
+ ctx.Send(Ev->Sender, Reply.Release());
+ }
+};
+
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxPublishTenantAsReadOnly(TEvSchemeShard::TEvPublishTenantAsReadOnly::TPtr &ev) {
+ return new TTxPublishTenantAsReadOnly(this, ev);
+}
+
+
+struct TSchemeShard::TTxPublishTenant : public TSchemeShard::TRwTxBase {
+ TEvSchemeShard::TEvPublishTenant::TPtr Ev;
+ TAutoPtr<TEvSchemeShard::TEvPublishTenantResult> Reply;
+
+ TTxPublishTenant(TSelf *self, TEvSchemeShard::TEvPublishTenant::TPtr &ev)
+ : TRwTxBase(self)
+ , Ev(ev)
+ {}
+
+ TTxType GetTxType() const override { return TXTYPE_SUBDOMAIN_MIGRATE; }
+
+ void DoExecute(TTransactionContext &txc, const TActorContext &ctx) override {
+ NIceDb::TNiceDb db(txc.DB);
+
+ const TTabletId selfTabletId = Self->SelfTabletId();
+ const NKikimrScheme::TEvPublishTenant& record = Ev->Get()->Record;
+ Y_VERIFY(Self->ParentDomainId.OwnerId == record.GetDomainSchemeShard());
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxPublishTenant DoExecute"
+ << ", message: " << record.ShortDebugString()
+ << ", at schemeshard: " << selfTabletId);
+
+ Reply = new TEvSchemeShard::TEvPublishTenantResult(ui64(selfTabletId));
+
+ switch (Self->InitState) {
+ case TTenantInitState::ReadOnlyPreview:
+ Self->InitState = TTenantInitState::Done;
+ Self->PersistInitState(db);
+
+ Self->IsReadOnlyMode = false;
+ db.Table<Schema::SysParams>().Key(Schema::SysParam_IsReadOnlyMode).Update(
+ NIceDb::TUpdate<Schema::SysParams::Value>("0"));
+ break;
+ case TTenantInitState::Done:
+ break;
+ case TTenantInitState::InvalidState:
+ case TTenantInitState::Uninitialized:
+ case TTenantInitState::Inprogress:
+ Y_FAIL("Invalid state");
+ };
+ }
+
+ void DoComplete(const TActorContext &ctx) override {
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxPublishTenant DoComplete"
+ << ", at schemeshard: " << Self->TabletID());
+
+ ctx.Send(Ev->Sender, Reply.Release());
+ }
+};
+
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxPublishTenant(TEvSchemeShard::TEvPublishTenant::TPtr &ev) {
+ return new TTxPublishTenant(this, ev);
+}
+
+struct TSchemeShard::TTxMigrate : public TSchemeShard::TRwTxBase {
+ TEvSchemeShard::TEvMigrateSchemeShard::TPtr Ev;
+ TAutoPtr<TEvSchemeShard::TEvMigrateSchemeShardResult> Reply;
+
+ TTxMigrate(TSelf *self, TEvSchemeShard::TEvMigrateSchemeShard::TPtr &ev)
+ : TRwTxBase(self)
+ , Ev(ev)
+ {}
+
+ TTxType GetTxType() const override { return TXTYPE_SUBDOMAIN_MIGRATE; }
+
+
+ void DoExecute(TTransactionContext &txc, const TActorContext &ctx) override {
+
+ const TTabletId selfTabletId = Self->SelfTabletId();
+ const NKikimrScheme::TEvMigrate& record = Ev->Get()->Record;
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxMigrate DoExecute"
+ << ", message: " << record.ShortDebugString()
+ << ", at schemeshard: " << selfTabletId);
+
+ Reply = new TEvSchemeShard::TEvMigrateSchemeShardResult(ui64(selfTabletId));
+
+ const NKikimrScheme::TMigratePath& pathDescr = record.GetPath();
+
+ NIceDb::TNiceDb db(txc.DB);
+
+ auto pathId = TPathId(pathDescr.GetPathId().GetOwnerId(), pathDescr.GetPathId().GetLocalId());
+ auto parentPathId = TPathId(pathDescr.GetParentPathId().GetOwnerId(), pathDescr.GetParentPathId().GetLocalId());
+ if (parentPathId == Self->ParentDomainId) { // relink root
+ parentPathId = Self->RootPathId();
+ }
+
+ db.Table<Schema::MigratedPaths>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::MigratedPaths::ParentOwnerId>(parentPathId.OwnerId),
+ NIceDb::TUpdate<Schema::MigratedPaths::ParentLocalId>(parentPathId.LocalPathId),
+ NIceDb::TUpdate<Schema::MigratedPaths::Name>(pathDescr.GetName()),
+ NIceDb::TUpdate<Schema::MigratedPaths::PathType>(pathDescr.GetPathType()),
+ NIceDb::TUpdate<Schema::MigratedPaths::StepCreated>(TStepId(pathDescr.GetStepCreated())),
+ NIceDb::TUpdate<Schema::MigratedPaths::CreateTxId>(TTxId(pathDescr.GetCreateTxId())),
+ NIceDb::TUpdate<Schema::MigratedPaths::Owner>(pathDescr.GetOwner()),
+ NIceDb::TUpdate<Schema::MigratedPaths::ACL>(pathDescr.GetACL()),
+ NIceDb::TUpdate<Schema::MigratedPaths::DirAlterVersion>(pathDescr.GetDirAlterVersion() + 1), // we need to bump version on 1 to override data at SB
+ NIceDb::TUpdate<Schema::MigratedPaths::UserAttrsAlterVersion>(pathDescr.GetUserAttrsAlterVersion()),
+ NIceDb::TUpdate<Schema::MigratedPaths::ACLVersion>(pathDescr.GetACLVersion())
+ );
+
+ for (auto& userAttr: pathDescr.GetUserAttributes()) {
+ db.Table<Schema::MigratedUserAttributes>().Key(pathId.OwnerId, pathId.LocalPathId, userAttr.GetKey()).Update(
+ NIceDb::TUpdate<Schema::MigratedUserAttributes::AttrValue>(userAttr.GetValue())
+ );
+ }
+
+
+ Reply->Record.MutablePathId()->SetOwnerId(pathId.OwnerId);
+ Reply->Record.MutablePathId()->SetLocalId(pathId.LocalPathId);
+
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxMigrate DoExecute"
+ << " PathInfo OK"
+ << ", at schemeshard: " << selfTabletId);
+
+ for (const auto& shard: record.GetShards()) {
+ auto shardIdx = TShardIdx(
+ TOwnerId(shard.GetShardIdx().GetOwnerId()),
+ TLocalShardIdx(shard.GetShardIdx().GetLocalId())
+ );
+ Y_VERIFY(shardIdx.GetOwnerId() != Self->TabletID());
+
+ TTabletTypes::EType type = (TTabletTypes::EType)shard.GetType();
+
+ db.Table<Schema::MigratedShards>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
+ NIceDb::TUpdate<Schema::MigratedShards::TabletId>(TTabletId(shard.GetTabletId())),
+ NIceDb::TUpdate<Schema::MigratedShards::OwnerPathId>(pathId.OwnerId),
+ NIceDb::TUpdate<Schema::MigratedShards::LocalPathId>(pathId.LocalPathId),
+ NIceDb::TUpdate<Schema::MigratedShards::TabletType>(type)
+ );
+
+ for (ui32 channelId = 0; channelId < shard.BindedStoragePoolSize(); ++channelId) {
+ const NKikimrStoragePool::TChannelBind& bind = shard.GetBindedStoragePool(channelId);
+
+ db.Table<Schema::MigratedChannelsBinding>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId(), channelId).Update(
+ NIceDb::TUpdate<Schema::MigratedChannelsBinding::PoolName>(bind.GetStoragePoolName()),
+ NIceDb::TUpdate<Schema::MigratedChannelsBinding::Binding>(bind.SerializeAsString())
+ );
+ }
+
+ {
+ auto item = Reply->Record.MutableShardIds()->Add();
+ item->SetOwnerId(shardIdx.GetOwnerId());
+ item->SetLocalId(ui64(shardIdx.GetLocalId()));
+ }
+ }
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxMigrate DoExecute"
+ << " ShardInfo OK"
+ << ", at schemeshard: " << selfTabletId);
+
+ if ((TPathElement::EPathType)pathDescr.GetPathType() == TPathElement::EPathType::EPathTypeTable) {
+ Y_VERIFY(record.HasTable());
+ const NKikimrScheme::TMigrateTable& tableDescr = record.GetTable();
+
+ db.Table<Schema::MigratedTables>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::MigratedTables::NextColId>(tableDescr.GetNextColId()),
+ NIceDb::TUpdate<Schema::MigratedTables::PartitionConfig>(tableDescr.GetPartitionConfig()),
+ NIceDb::TUpdate<Schema::MigratedTables::AlterVersion>(tableDescr.GetAlterVersion()),
+ //NIceDb::TUpdate<Schema::MigratedTables::AlterTable>(),
+ //NIceDb::TUpdate<Schema::MigratedTables::AlterTableFull>(),
+ NIceDb::TUpdate<Schema::MigratedTables::PartitioningVersion>(tableDescr.GetPartitioningVersion()));
+
+ for (const NKikimrScheme::TMigrateColumn& colDescr: tableDescr.GetColumns()) {
+ db.Table<Schema::MigratedColumns>().Key(pathId.OwnerId, pathId.LocalPathId, colDescr.GetId()).Update(
+ NIceDb::TUpdate<Schema::MigratedColumns::ColName>(colDescr.GetName()),
+ NIceDb::TUpdate<Schema::MigratedColumns::ColType>(colDescr.GetColType()),
+ NIceDb::TUpdate<Schema::MigratedColumns::ColKeyOrder>(colDescr.GetColKeyOrder()),
+ NIceDb::TUpdate<Schema::MigratedColumns::CreateVersion>(colDescr.GetCreateVersion()),
+ NIceDb::TUpdate<Schema::MigratedColumns::DeleteVersion>(colDescr.GetDeleteVersion()),
NIceDb::TUpdate<Schema::MigratedColumns::Family>(colDescr.GetFamily()),
NIceDb::TUpdate<Schema::MigratedColumns::DefaultKind>(ETableColumnDefaultKind(colDescr.GetDefaultKind())),
NIceDb::TUpdate<Schema::MigratedColumns::DefaultValue>(colDescr.GetDefaultValue()),
NIceDb::TUpdate<Schema::MigratedColumns::NotNull>(colDescr.GetNotNull()));
- }
-
- for (const NKikimrScheme::TMigratePartition& partDescr: tableDescr.GetPartitions()) {
- const auto shardIdx = TShardIdx(partDescr.GetShardIdx().GetOwnerId(), partDescr.GetShardIdx().GetLocalId());
- ui64 id = partDescr.GetId();
- db.Table<Schema::MigratedTablePartitions>().Key(pathId.OwnerId, pathId.LocalPathId, id).Update(
- NIceDb::TUpdate<Schema::MigratedTablePartitions::RangeEnd>(partDescr.GetRangeEnd()),
- NIceDb::TUpdate<Schema::MigratedTablePartitions::OwnerShardIdx>(shardIdx.GetOwnerId()),
- NIceDb::TUpdate<Schema::MigratedTablePartitions::LocalShardIdx>(shardIdx.GetLocalId()));
-
- if (partDescr.HasPartitionConfig()) {
- db.Table<Schema::MigratedTableShardPartitionConfigs>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
- NIceDb::TUpdate<Schema::MigratedTableShardPartitionConfigs::PartitionConfig>(partDescr.GetPartitionConfig()));
- }
- }
- }
-
- if ((TPathElement::EPathType)pathDescr.GetPathType() == TPathElement::EPathType::EPathTypeTableIndex) {
- Y_VERIFY(record.HasTableIndex());
- const NKikimrScheme::TMigrateTableIndex& tableIndexDescr = record.GetTableIndex();
-
- db.Table<Schema::MigratedTableIndex>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::MigratedTableIndex::AlterVersion>(tableIndexDescr.GetAlterVersion()),
- NIceDb::TUpdate<Schema::MigratedTableIndex::IndexType>(NKikimrSchemeOp::EIndexType(tableIndexDescr.GetType())),
- NIceDb::TUpdate<Schema::MigratedTableIndex::State>(NKikimrSchemeOp::EIndexState(tableIndexDescr.GetState())));
-
- for (ui32 keyId = 0; keyId < tableIndexDescr.KeysSize(); ++keyId) {
- db.Table<Schema::MigratedTableIndexKeys>().Key(pathId.OwnerId, pathId.LocalPathId, keyId).Update(
- NIceDb::TUpdate<Schema::MigratedTableIndexKeys::KeyName>(tableIndexDescr.GetKeys(keyId)));
- }
- }
-
- if ((TPathElement::EPathType)pathDescr.GetPathType() == TPathElement::EPathType::EPathTypeKesus) {
- Y_VERIFY(record.HasKesus());
- const NKikimrScheme::TMigrateKesus& kesusDescr = record.GetKesus();
-
- db.Table<Schema::MigratedKesusInfos>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::MigratedKesusInfos::Config>(kesusDescr.GetConfig()),
- NIceDb::TUpdate<Schema::MigratedKesusInfos::Version>(kesusDescr.GetVersion()));
- }
-
-// PersQueueGroups,
-// PersQueues,
-// RtmrVolumes,
-// RTMRPartitions,
-// BlockStorePartitions,
-// BlockStoreVolumes,
-// KesusInfos,
-// SolomonVolumes,
-// SolomonPartitions,
- }
-
- void DoComplete(const TActorContext &ctx) override {
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxMigrate DoComplete"
- << ", at schemeshard: " << Self->TabletID());
-
- ctx.Send(Ev->Sender, Reply.Release());
- }
-};
-
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxMigrate(TEvSchemeShard::TEvMigrateSchemeShard::TPtr &ev) {
- return new TTxMigrate(this, ev);
-}
+ }
+
+ for (const NKikimrScheme::TMigratePartition& partDescr: tableDescr.GetPartitions()) {
+ const auto shardIdx = TShardIdx(partDescr.GetShardIdx().GetOwnerId(), partDescr.GetShardIdx().GetLocalId());
+ ui64 id = partDescr.GetId();
+ db.Table<Schema::MigratedTablePartitions>().Key(pathId.OwnerId, pathId.LocalPathId, id).Update(
+ NIceDb::TUpdate<Schema::MigratedTablePartitions::RangeEnd>(partDescr.GetRangeEnd()),
+ NIceDb::TUpdate<Schema::MigratedTablePartitions::OwnerShardIdx>(shardIdx.GetOwnerId()),
+ NIceDb::TUpdate<Schema::MigratedTablePartitions::LocalShardIdx>(shardIdx.GetLocalId()));
+
+ if (partDescr.HasPartitionConfig()) {
+ db.Table<Schema::MigratedTableShardPartitionConfigs>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
+ NIceDb::TUpdate<Schema::MigratedTableShardPartitionConfigs::PartitionConfig>(partDescr.GetPartitionConfig()));
+ }
+ }
+ }
+
+ if ((TPathElement::EPathType)pathDescr.GetPathType() == TPathElement::EPathType::EPathTypeTableIndex) {
+ Y_VERIFY(record.HasTableIndex());
+ const NKikimrScheme::TMigrateTableIndex& tableIndexDescr = record.GetTableIndex();
+
+ db.Table<Schema::MigratedTableIndex>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::MigratedTableIndex::AlterVersion>(tableIndexDescr.GetAlterVersion()),
+ NIceDb::TUpdate<Schema::MigratedTableIndex::IndexType>(NKikimrSchemeOp::EIndexType(tableIndexDescr.GetType())),
+ NIceDb::TUpdate<Schema::MigratedTableIndex::State>(NKikimrSchemeOp::EIndexState(tableIndexDescr.GetState())));
+
+ for (ui32 keyId = 0; keyId < tableIndexDescr.KeysSize(); ++keyId) {
+ db.Table<Schema::MigratedTableIndexKeys>().Key(pathId.OwnerId, pathId.LocalPathId, keyId).Update(
+ NIceDb::TUpdate<Schema::MigratedTableIndexKeys::KeyName>(tableIndexDescr.GetKeys(keyId)));
+ }
+ }
+
+ if ((TPathElement::EPathType)pathDescr.GetPathType() == TPathElement::EPathType::EPathTypeKesus) {
+ Y_VERIFY(record.HasKesus());
+ const NKikimrScheme::TMigrateKesus& kesusDescr = record.GetKesus();
+
+ db.Table<Schema::MigratedKesusInfos>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::MigratedKesusInfos::Config>(kesusDescr.GetConfig()),
+ NIceDb::TUpdate<Schema::MigratedKesusInfos::Version>(kesusDescr.GetVersion()));
+ }
+
+// PersQueueGroups,
+// PersQueues,
+// RtmrVolumes,
+// RTMRPartitions,
+// BlockStorePartitions,
+// BlockStoreVolumes,
+// KesusInfos,
+// SolomonVolumes,
+// SolomonPartitions,
+ }
+
+ void DoComplete(const TActorContext &ctx) override {
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxMigrate DoComplete"
+ << ", at schemeshard: " << Self->TabletID());
+
+ ctx.Send(Ev->Sender, Reply.Release());
+ }
+};
+
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxMigrate(TEvSchemeShard::TEvMigrateSchemeShard::TPtr &ev) {
+ return new TTxMigrate(this, ev);
+}
}}
diff --git a/ydb/core/tx/schemeshard/schemeshard__init_schema.cpp b/ydb/core/tx/schemeshard/schemeshard__init_schema.cpp
index da8ca4322ed..b27131388a9 100644
--- a/ydb/core/tx/schemeshard/schemeshard__init_schema.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__init_schema.cpp
@@ -1,13 +1,13 @@
#include "schemeshard_impl.h"
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TTxInitSchema : public TTransactionBase<TSchemeShard> {
+struct TSchemeShard::TTxInitSchema : public TTransactionBase<TSchemeShard> {
TTxInitSchema(TSelf* self)
- : TTransactionBase<TSchemeShard>(self)
+ : TTransactionBase<TSchemeShard>(self)
{}
bool Execute(TTransactionContext &txc, const TActorContext &ctx) override {
@@ -18,13 +18,13 @@ struct TSchemeShard::TTxInitSchema : public TTransactionBase<TSchemeShard> {
void Complete(const TActorContext &ctx) override {
LOG_DEBUG(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TxInitSchema.Complete");
- Self->Execute(Self->CreateTxUpgradeSchema(), ctx);
+ Self->Execute(Self->CreateTxUpgradeSchema(), ctx);
}
};
-ITransaction* TSchemeShard::CreateTxInitSchema() {
+ITransaction* TSchemeShard::CreateTxInitSchema() {
return new TTxInitSchema(this);
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__login.cpp b/ydb/core/tx/schemeshard/schemeshard__login.cpp
index d5eee723aaf..ad8058e3807 100644
--- a/ydb/core/tx/schemeshard/schemeshard__login.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__login.cpp
@@ -2,16 +2,16 @@
#include <ydb/library/security/util.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TTxLogin : TSchemeShard::TRwTxBase {
- TEvSchemeShard::TEvLogin::TPtr Request;
+struct TSchemeShard::TTxLogin : TSchemeShard::TRwTxBase {
+ TEvSchemeShard::TEvLogin::TPtr Request;
TPathId SubDomainPathId;
bool NeedPublishOnComplete = false;
- TTxLogin(TSelf *self, TEvSchemeShard::TEvLogin::TPtr &ev)
+ TTxLogin(TSelf *self, TEvSchemeShard::TEvLogin::TPtr &ev)
: TRwTxBase(self)
, Request(std::move(ev))
{}
@@ -66,7 +66,7 @@ struct TSchemeShard::TTxLogin : TSchemeShard::TRwTxBase {
}
NLogin::TLoginProvider::TLoginUserResponse LoginResponse = Self->LoginProvider.LoginUser(GetLoginRequest());
- THolder<TEvSchemeShard::TEvLoginResult> result = MakeHolder<TEvSchemeShard::TEvLoginResult>();
+ THolder<TEvSchemeShard::TEvLoginResult> result = MakeHolder<TEvSchemeShard::TEvLoginResult>();
if (LoginResponse.Error) {
result->Record.SetError(LoginResponse.Error);
}
@@ -84,7 +84,7 @@ struct TSchemeShard::TTxLogin : TSchemeShard::TRwTxBase {
};
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxLogin(TEvSchemeShard::TEvLogin::TPtr &ev) {
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxLogin(TEvSchemeShard::TEvLogin::TPtr &ev) {
return new TTxLogin(this, ev);
}
diff --git a/ydb/core/tx/schemeshard/schemeshard__make_access_database_no_inheritable.cpp b/ydb/core/tx/schemeshard/schemeshard__make_access_database_no_inheritable.cpp
index fe8965f31ca..56719d8b401 100644
--- a/ydb/core/tx/schemeshard/schemeshard__make_access_database_no_inheritable.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__make_access_database_no_inheritable.cpp
@@ -1,125 +1,125 @@
-#include "schemeshard_impl.h"
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-using namespace NTabletFlatExecutor;
-
-struct TSchemeShard::TTxMakeAccessDatabaseNoInheritable : public TTransactionBase<TSchemeShard> {
- bool IsDryRun;
- TActorId AnswerTo;
- std::function< NActors::IEventBase* (const TMap<TPathId, TSet<TString>>&) > AnswerFunc;
- TSideEffects SideEffects;
-
- TTxMakeAccessDatabaseNoInheritable(TSelf* self,
- const bool isDryRun,
- const TActorId& answerTo,
- std::function< NActors::IEventBase* (const TMap<TPathId, TSet<TString>>&) > answerFunc)
- : TTransactionBase<TSchemeShard>(self)
- , IsDryRun(isDryRun)
- , AnswerTo(answerTo)
- , AnswerFunc(answerFunc)
- {}
-
- TTxType GetTxType() const override {
- return TXTYPE_UPGRADE_SCHEME;
- }
-
- TSet<TString> GetSidsWithInheritedConnect(const TString& aclData) {
- TSet<TString> result;
-
- NACLib::TACL acl(aclData);
-
- for (const NACLibProto::TACE& ace : acl.GetACE()) {
- if (ace.GetAccessType() == static_cast<ui32>(NACLib::EAccessType::Allow)
- && ace.GetAccessRight() == NACLib::EAccessRights::ConnectDatabase
- && ace.GetInheritanceType() == (NACLib::EInheritanceType::InheritObject | NACLib::EInheritanceType::InheritContainer))
- {
- result.insert(ace.GetSID());
- }
- }
- return result;
- }
-
- TString FixAccess(const TString& aclData, const TSet<TString>& sids) {
- NACLib::TACL acl(aclData);
-
- for (const auto& x: sids) {
- acl.RemoveAccess(NACLib::EAccessType::Allow, NACLib::EAccessRights::ConnectDatabase, x, NACLib::EInheritanceType::InheritObject | NACLib::EInheritanceType::InheritContainer);
- acl.AddAccess(NACLib::EAccessType::Allow, NACLib::EAccessRights::ConnectDatabase, x, NACLib::InheritNone);
- }
-
- TString proto;
+#include "schemeshard_impl.h"
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+using namespace NTabletFlatExecutor;
+
+struct TSchemeShard::TTxMakeAccessDatabaseNoInheritable : public TTransactionBase<TSchemeShard> {
+ bool IsDryRun;
+ TActorId AnswerTo;
+ std::function< NActors::IEventBase* (const TMap<TPathId, TSet<TString>>&) > AnswerFunc;
+ TSideEffects SideEffects;
+
+ TTxMakeAccessDatabaseNoInheritable(TSelf* self,
+ const bool isDryRun,
+ const TActorId& answerTo,
+ std::function< NActors::IEventBase* (const TMap<TPathId, TSet<TString>>&) > answerFunc)
+ : TTransactionBase<TSchemeShard>(self)
+ , IsDryRun(isDryRun)
+ , AnswerTo(answerTo)
+ , AnswerFunc(answerFunc)
+ {}
+
+ TTxType GetTxType() const override {
+ return TXTYPE_UPGRADE_SCHEME;
+ }
+
+ TSet<TString> GetSidsWithInheritedConnect(const TString& aclData) {
+ TSet<TString> result;
+
+ NACLib::TACL acl(aclData);
+
+ for (const NACLibProto::TACE& ace : acl.GetACE()) {
+ if (ace.GetAccessType() == static_cast<ui32>(NACLib::EAccessType::Allow)
+ && ace.GetAccessRight() == NACLib::EAccessRights::ConnectDatabase
+ && ace.GetInheritanceType() == (NACLib::EInheritanceType::InheritObject | NACLib::EInheritanceType::InheritContainer))
+ {
+ result.insert(ace.GetSID());
+ }
+ }
+ return result;
+ }
+
+ TString FixAccess(const TString& aclData, const TSet<TString>& sids) {
+ NACLib::TACL acl(aclData);
+
+ for (const auto& x: sids) {
+ acl.RemoveAccess(NACLib::EAccessType::Allow, NACLib::EAccessRights::ConnectDatabase, x, NACLib::EInheritanceType::InheritObject | NACLib::EInheritanceType::InheritContainer);
+ acl.AddAccess(NACLib::EAccessType::Allow, NACLib::EAccessRights::ConnectDatabase, x, NACLib::InheritNone);
+ }
+
+ TString proto;
Y_PROTOBUF_SUPPRESS_NODISCARD acl.SerializeToString(&proto);
-
- return proto;
- }
-
- bool Execute(TTransactionContext &txc, const TActorContext &ctx) override {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TTxUpgradeSchema.Execute");
-
- if (!Self->IsShemeShardConfigured()) {
- return true;
- }
-
- TMap<TPathId, TSet<TString>> sidsByDomain;
-
- for (const auto& item: Self->PathsById) {
- const TPathElement::TPtr pathElem = item.second;
-
- if (pathElem->Dropped() || pathElem->IsMigrated()) {
- continue;
- }
-
- if (!pathElem->IsDomainRoot()) {
- continue;
- }
-
- if (!pathElem->ACL) {
- continue;
- }
-
- TPathId domainId = pathElem->PathId;
-
- auto affectedSids = GetSidsWithInheritedConnect(pathElem->ACL);
- if (affectedSids) {
- sidsByDomain[domainId] = std::move(affectedSids);
- }
- }
-
- if (!IsDryRun) {
- NIceDb::TNiceDb db(txc.DB);
-
- for (const auto& item: sidsByDomain) {
- TPathId domainId = item.first;
- const TPathElement::TPtr domainElem = Self->PathsById.at(domainId);
- Y_VERIFY(domainElem->IsDomainRoot());
-
- domainElem->ACL = FixAccess(domainElem->ACL, item.second);
- domainElem->ACLVersion += 1;
-
- Self->PersistACL(db, domainElem);
-
- SideEffects.PublishToSchemeBoard(InvalidOperationId, domainId);
- SideEffects.UpdateTenant(domainId);
- }
- }
-
- SideEffects.Send(AnswerTo, AnswerFunc(sidsByDomain));
-
- SideEffects.ApplyOnExecute(Self, txc, ctx);
- return true;
- }
-
- void Complete(const TActorContext &ctx) override {
- SideEffects.ApplyOnComplete(Self, ctx);
- }
-};
-
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxMakeAccessDatabaseNoInheritable(
- const TActorId& answerTo, bool isDryRun, std::function< NActors::IEventBase*(const TMap<TPathId, TSet<TString>>&) > func) {
- return new TTxMakeAccessDatabaseNoInheritable(this, isDryRun, answerTo, func);
-}
-
-} // NSchemeShard
-} // NKikimr
+
+ return proto;
+ }
+
+ bool Execute(TTransactionContext &txc, const TActorContext &ctx) override {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TTxUpgradeSchema.Execute");
+
+ if (!Self->IsShemeShardConfigured()) {
+ return true;
+ }
+
+ TMap<TPathId, TSet<TString>> sidsByDomain;
+
+ for (const auto& item: Self->PathsById) {
+ const TPathElement::TPtr pathElem = item.second;
+
+ if (pathElem->Dropped() || pathElem->IsMigrated()) {
+ continue;
+ }
+
+ if (!pathElem->IsDomainRoot()) {
+ continue;
+ }
+
+ if (!pathElem->ACL) {
+ continue;
+ }
+
+ TPathId domainId = pathElem->PathId;
+
+ auto affectedSids = GetSidsWithInheritedConnect(pathElem->ACL);
+ if (affectedSids) {
+ sidsByDomain[domainId] = std::move(affectedSids);
+ }
+ }
+
+ if (!IsDryRun) {
+ NIceDb::TNiceDb db(txc.DB);
+
+ for (const auto& item: sidsByDomain) {
+ TPathId domainId = item.first;
+ const TPathElement::TPtr domainElem = Self->PathsById.at(domainId);
+ Y_VERIFY(domainElem->IsDomainRoot());
+
+ domainElem->ACL = FixAccess(domainElem->ACL, item.second);
+ domainElem->ACLVersion += 1;
+
+ Self->PersistACL(db, domainElem);
+
+ SideEffects.PublishToSchemeBoard(InvalidOperationId, domainId);
+ SideEffects.UpdateTenant(domainId);
+ }
+ }
+
+ SideEffects.Send(AnswerTo, AnswerFunc(sidsByDomain));
+
+ SideEffects.ApplyOnExecute(Self, txc, ctx);
+ return true;
+ }
+
+ void Complete(const TActorContext &ctx) override {
+ SideEffects.ApplyOnComplete(Self, ctx);
+ }
+};
+
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxMakeAccessDatabaseNoInheritable(
+ const TActorId& answerTo, bool isDryRun, std::function< NActors::IEventBase*(const TMap<TPathId, TSet<TString>>&) > func) {
+ return new TTxMakeAccessDatabaseNoInheritable(this, isDryRun, answerTo, func);
+}
+
+} // NSchemeShard
+} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__monitoring.cpp b/ydb/core/tx/schemeshard/schemeshard__monitoring.cpp
index 78dbc386143..76e73182496 100644
--- a/ydb/core/tx/schemeshard/schemeshard__monitoring.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__monitoring.cpp
@@ -4,79 +4,79 @@
#include <ydb/core/protos/tx_datashard.pb.h>
#include <ydb/core/tx/datashard/range_ops.h>
#include <ydb/core/tx/tx_proxy/proxy.h>
-
+
#include <library/cpp/html/pcdata/pcdata.h>
#include <util/string/cast.h>
-static ui64 TryParseTabletId(TStringBuf tabletIdParam) {
- if (tabletIdParam.StartsWith("0x"))
- return IntFromString<ui64, 16>(tabletIdParam.substr(2));
- else
- return FromStringWithDefault<ui64>(tabletIdParam, ui64(NKikimr::NSchemeShard::InvalidTabletId));
+static ui64 TryParseTabletId(TStringBuf tabletIdParam) {
+ if (tabletIdParam.StartsWith("0x"))
+ return IntFromString<ui64, 16>(tabletIdParam.substr(2));
+ else
+ return FromStringWithDefault<ui64>(tabletIdParam, ui64(NKikimr::NSchemeShard::InvalidTabletId));
}
namespace NKikimr {
-namespace NSchemeShard {
-
-struct TCgi {
- struct TParam {
- const TStringBuf Name;
-
- inline TParam(const TStringBuf name) noexcept
- : Name(name)
- {}
-
- operator TStringBuf () const {
- return Name;
- }
-
- operator TString () const {
- return ToString(Name);
- }
-
- template <class TDefVal>
- TString AsHiddenInput(const TDefVal value) const {
- return TStringBuilder()
- << "<input type=\"hidden\" id=\"" << Name << "\" name=\"" << Name << "\" value=\"" << value << "\"/>";
- }
-
- template <class TDefVal>
- TString AsInput(const TDefVal defValue) const {
- return TStringBuilder()
- << "<label> " << Name << ": <input type=\"text\" id=\"" << Name << "\" name=\"" << Name << "\" value=\"" << defValue << "\" /> </label>";
- }
-
- TString AsInput() const {
- return TStringBuilder()
- << "<label> " << Name << ": <input type=\"text\" id=\"" << Name << "\" name=\"" << Name << "\" /> </label>";
- }
-
- template <class TVal>
- TString AsCgiParam(const TVal value) const {
- return TStringBuilder() << Name << "=" << value;
- }
- };
-
- static const TParam TabletID;
- static const TParam TxId;
- static const TParam PartId;
- static const TParam OperationId;
- static const TParam OwnerShardIdx;
- static const TParam LocalShardIdx;
- static const TParam ShardID;
- static const TParam OwnerPathId;
- static const TParam LocalPathId;
- static const TParam IsReadOnlyMode;
- static const TParam UpdateAccessDatabaseRights;
- static const TParam UpdateAccessDatabaseRightsDryRun;
- static const TParam FixAccessDatabaseInheritance;
- static const TParam FixAccessDatabaseInheritanceDryRun;
- static const TParam Page;
- static const TParam BuildIndexId;
+namespace NSchemeShard {
+
+struct TCgi {
+ struct TParam {
+ const TStringBuf Name;
+
+ inline TParam(const TStringBuf name) noexcept
+ : Name(name)
+ {}
+
+ operator TStringBuf () const {
+ return Name;
+ }
+
+ operator TString () const {
+ return ToString(Name);
+ }
+
+ template <class TDefVal>
+ TString AsHiddenInput(const TDefVal value) const {
+ return TStringBuilder()
+ << "<input type=\"hidden\" id=\"" << Name << "\" name=\"" << Name << "\" value=\"" << value << "\"/>";
+ }
+
+ template <class TDefVal>
+ TString AsInput(const TDefVal defValue) const {
+ return TStringBuilder()
+ << "<label> " << Name << ": <input type=\"text\" id=\"" << Name << "\" name=\"" << Name << "\" value=\"" << defValue << "\" /> </label>";
+ }
+
+ TString AsInput() const {
+ return TStringBuilder()
+ << "<label> " << Name << ": <input type=\"text\" id=\"" << Name << "\" name=\"" << Name << "\" /> </label>";
+ }
+
+ template <class TVal>
+ TString AsCgiParam(const TVal value) const {
+ return TStringBuilder() << Name << "=" << value;
+ }
+ };
+
+ static const TParam TabletID;
+ static const TParam TxId;
+ static const TParam PartId;
+ static const TParam OperationId;
+ static const TParam OwnerShardIdx;
+ static const TParam LocalShardIdx;
+ static const TParam ShardID;
+ static const TParam OwnerPathId;
+ static const TParam LocalPathId;
+ static const TParam IsReadOnlyMode;
+ static const TParam UpdateAccessDatabaseRights;
+ static const TParam UpdateAccessDatabaseRightsDryRun;
+ static const TParam FixAccessDatabaseInheritance;
+ static const TParam FixAccessDatabaseInheritanceDryRun;
+ static const TParam Page;
+ static const TParam BuildIndexId;
static const TParam UpdateCoordinatorsConfig;
static const TParam UpdateCoordinatorsConfigDryRun;
-
- struct TPages {
+
+ struct TPages {
static constexpr TStringBuf MainPage = "Main";
static constexpr TStringBuf AdminPage = "Admin";
static constexpr TStringBuf AdminRequest = "AdminRequest";
@@ -86,9 +86,9 @@ struct TCgi {
static constexpr TStringBuf ShardInfoByTabletId = "ShardInfoByTabletId";
static constexpr TStringBuf ShardInfoByShardIdx = "ShardInfoByShardIdx";
static constexpr TStringBuf BuildIndexInfo = "BuildIndexInfo";
- };
-};
-
+ };
+};
+
const TCgi::TParam TCgi::TabletID = TStringBuf("TabletID");
const TCgi::TParam TCgi::TxId = TStringBuf("TxId");
const TCgi::TParam TCgi::PartId = TStringBuf("PartId");
@@ -107,8 +107,8 @@ const TCgi::TParam TCgi::Page = TStringBuf("Page");
const TCgi::TParam TCgi::BuildIndexId = TStringBuf("BuildIndexId");
const TCgi::TParam TCgi::UpdateCoordinatorsConfig = TStringBuf("UpdateCoordinatorsConfig");
const TCgi::TParam TCgi::UpdateCoordinatorsConfigDryRun = TStringBuf("UpdateCoordinatorsConfigDryRun");
-
-
+
+
class TUpdateCoordinatorsConfigActor : public TActorBootstrapped<TUpdateCoordinatorsConfigActor> {
public:
struct TItem {
@@ -227,220 +227,220 @@ private:
THashMap<ui64, const TItem*> InFlight;
};
-struct TSchemeShard::TTxMonitoring : public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
+struct TSchemeShard::TTxMonitoring : public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
NMon::TEvRemoteHttpInfo::TPtr Ev;
- TStringStream Answer;
-
+ TStringStream Answer;
+
public:
- TTxMonitoring(TSchemeShard *self, NMon::TEvRemoteHttpInfo::TPtr ev)
+ TTxMonitoring(TSchemeShard *self, NMon::TEvRemoteHttpInfo::TPtr ev)
: TBase(self)
, Ev(ev)
- {
- }
+ {
+ }
bool Execute(NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx) override {
Y_UNUSED(txc);
const TCgiParameters& cgi = Ev->Get()->Cgi();
- const TString page = cgi.Has(TCgi::Page) ? cgi.Get(TCgi::Page) : ToString(TCgi::TPages::MainPage);
-
- if (page == TCgi::TPages::AdminRequest) {
- NIceDb::TNiceDb db(txc.DB);
- db.NoMoreReadsForTx();
-
- LinkToMain(Answer);
- OutputAdminRequestPage(Answer, db, cgi, ctx);
- return true;
- }
-
- if (page == TCgi::TPages::MainPage) {
- OutputMainPage(Answer);
- return true;
- }
-
- LinkToMain(Answer);
-
- if (page == TCgi::TPages::TransactionList)
- {
- OutputTxListPage(Answer);
- }
- else if (page == TCgi::TPages::TransactionInfo)
- {
- auto txId = TTxId(FromStringWithDefault<ui64>(cgi.Get(TCgi::TxId), ui64(InvalidTxId)));
- auto partId = cgi.Has(TCgi::PartId)
- ? TSubTxId(FromStringWithDefault<ui64>(cgi.Get(TCgi::PartId), ui64(InvalidSubTxId)))
- : FirstSubTxId;
- OutputTxInfoPage(TOperationId(txId, partId), Answer);
- }
- else if (page == TCgi::TPages::ShardInfoByTabletId)
- {
- TTabletId tabletId = TTabletId(TryParseTabletId(cgi.Get(TCgi::ShardID)));
- OutputShardInfoPageByShardID(tabletId, Answer);
- }
- else if (page == TCgi::TPages::ShardInfoByShardIdx)
- {
- auto shardIdx = TShardIdx(
- FromStringWithDefault<ui64>(cgi.Get(TCgi::OwnerShardIdx), InvalidOwnerId),
- TLocalShardIdx(FromStringWithDefault<ui64>(cgi.Get(TCgi::LocalShardIdx), ui64(InvalidLocalShardIdx)))
- );
- OutputShardInfoPageByShardIdx(shardIdx, Answer);
- }
- else if (page == TCgi::TPages::PathInfo)
- {
- TLocalPathId ownerPathId = FromStringWithDefault<ui64>(cgi.Get(TCgi::OwnerPathId), InvalidOwnerId);
- TLocalPathId localPathId = FromStringWithDefault<ui64>(cgi.Get(TCgi::LocalPathId), InvalidLocalPathId);
- TPathId pathId(ownerPathId, localPathId);
- OutputPathInfoPage(pathId, Answer);
- }
- else if (page == TCgi::TPages::AdminPage)
- {
- OutputAdminPage(Answer);
+ const TString page = cgi.Has(TCgi::Page) ? cgi.Get(TCgi::Page) : ToString(TCgi::TPages::MainPage);
+
+ if (page == TCgi::TPages::AdminRequest) {
+ NIceDb::TNiceDb db(txc.DB);
+ db.NoMoreReadsForTx();
+
+ LinkToMain(Answer);
+ OutputAdminRequestPage(Answer, db, cgi, ctx);
+ return true;
+ }
+
+ if (page == TCgi::TPages::MainPage) {
+ OutputMainPage(Answer);
+ return true;
+ }
+
+ LinkToMain(Answer);
+
+ if (page == TCgi::TPages::TransactionList)
+ {
+ OutputTxListPage(Answer);
+ }
+ else if (page == TCgi::TPages::TransactionInfo)
+ {
+ auto txId = TTxId(FromStringWithDefault<ui64>(cgi.Get(TCgi::TxId), ui64(InvalidTxId)));
+ auto partId = cgi.Has(TCgi::PartId)
+ ? TSubTxId(FromStringWithDefault<ui64>(cgi.Get(TCgi::PartId), ui64(InvalidSubTxId)))
+ : FirstSubTxId;
+ OutputTxInfoPage(TOperationId(txId, partId), Answer);
+ }
+ else if (page == TCgi::TPages::ShardInfoByTabletId)
+ {
+ TTabletId tabletId = TTabletId(TryParseTabletId(cgi.Get(TCgi::ShardID)));
+ OutputShardInfoPageByShardID(tabletId, Answer);
+ }
+ else if (page == TCgi::TPages::ShardInfoByShardIdx)
+ {
+ auto shardIdx = TShardIdx(
+ FromStringWithDefault<ui64>(cgi.Get(TCgi::OwnerShardIdx), InvalidOwnerId),
+ TLocalShardIdx(FromStringWithDefault<ui64>(cgi.Get(TCgi::LocalShardIdx), ui64(InvalidLocalShardIdx)))
+ );
+ OutputShardInfoPageByShardIdx(shardIdx, Answer);
+ }
+ else if (page == TCgi::TPages::PathInfo)
+ {
+ TLocalPathId ownerPathId = FromStringWithDefault<ui64>(cgi.Get(TCgi::OwnerPathId), InvalidOwnerId);
+ TLocalPathId localPathId = FromStringWithDefault<ui64>(cgi.Get(TCgi::LocalPathId), InvalidLocalPathId);
+ TPathId pathId(ownerPathId, localPathId);
+ OutputPathInfoPage(pathId, Answer);
+ }
+ else if (page == TCgi::TPages::AdminPage)
+ {
+ OutputAdminPage(Answer);
+ }
+ else if (page == TCgi::TPages::BuildIndexInfo)
+ {
+ auto id = TIndexBuildId(FromStringWithDefault<ui64>(cgi.Get(TCgi::BuildIndexId), ui64(InvalidIndexBuildId)));
+ BuildIndexInfoPage(id, Answer);
}
- else if (page == TCgi::TPages::BuildIndexInfo)
- {
- auto id = TIndexBuildId(FromStringWithDefault<ui64>(cgi.Get(TCgi::BuildIndexId), ui64(InvalidIndexBuildId)));
- BuildIndexInfoPage(id, Answer);
- }
return true;
}
- void Complete(const TActorContext &ctx) override {
- if (Answer) {
- ctx.Send(Ev->Sender, new NMon::TEvRemoteHttpInfoRes(Answer.Str()));
- }
- }
-
+ void Complete(const TActorContext &ctx) override {
+ if (Answer) {
+ ctx.Send(Ev->Sender, new NMon::TEvRemoteHttpInfoRes(Answer.Str()));
+ }
+ }
+
private:
- void LinkToMain(TStringStream& str) const {
- str << "<a href='app?" << TCgi::TabletID.AsCgiParam(Self->TabletID())
- << "&" << TCgi::Page.AsCgiParam(TCgi::TPages::MainPage) << "'>";
- str << "Back to main scheme shard page";
- str << "</a><br>";
- }
-
- void OutputAdminRequestPage(TStringStream& str, NIceDb::TNiceDb& db, const TCgiParameters& cgi, const TActorContext& ctx) const {
- if (cgi.Has(TCgi::IsReadOnlyMode)) {
- TString rowStr = cgi.Get(TCgi::IsReadOnlyMode);
- auto value = FromStringWithDefault<ui64>(rowStr, ui64(0));
- auto valueStr = ToString(value);
-
- TStringBuilder debug;
- debug << "IsReadOnlyMode changed from " << ToString(Self->IsReadOnlyMode)
- << " to " << valueStr;
-
- LOG_EMERG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TSchemeShard::TTxMonitoring AdminRequest " << debug);
- str << debug;
-
- db.Table<Schema::SysParams>().Key(Schema::SysParam_IsReadOnlyMode).Update(
- NIceDb::TUpdate<Schema::SysParams::Value>(valueStr));
- Self->IsReadOnlyMode = value;
- }
-
- if (cgi.Has(TCgi::UpdateAccessDatabaseRights)) {
- TString rowDryRunStr = cgi.Get(TCgi::UpdateAccessDatabaseRightsDryRun);
- auto valueDryRun = FromStringWithDefault<ui64>(rowDryRunStr, ui64(1));
- auto valueDryRunStr = ToString(valueDryRun);
-
- TStringBuilder debug;
- debug << "Triggered UpdateAccessDatabaseRights with DryRunVal: " << valueDryRunStr;
-
- LOG_EMERG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TSchemeShard::TTxMonitoring AdminRequest " << debug);
- str << debug;
-
- TStringStream templateAnsver = str;
- str.clear();
-
- OutputAdminPage(templateAnsver);
-
- auto func = [templateAnsver] (const TMap<TPathId, TSet<TString>>& done) -> NActors::IEventBase* {
- TStringStream str = templateAnsver;
- HTML(str) {
- TABLE_SORTABLE_CLASS("table") {
- TABLEHEAD() {
- TABLER() {
- TABLEH() {str << "DomainId";}
- TABLEH() {str << "Sid";}
- }
- str << "\n";
- }
-
- for (const auto& item: done) {
- const TPathId& domainId = item.first;
-
- for (const auto& sid: item.second) {
- TABLER() {
- TABLED() { str << domainId; }
- TABLED() { str << sid; }
- }
- str << "\n";
- }
- }
- }
- }
-
- return new NMon::TEvRemoteHttpInfoRes(str.Str());
- };
-
- Self->Execute(Self->CreateTxUpgradeAccessDatabaseRights(Ev->Sender, bool(valueDryRun), func), ctx);
-
- return;
- }
-
- if (cgi.Has(TCgi::FixAccessDatabaseInheritance)) {
- TString rowDryRunStr = cgi.Get(TCgi::FixAccessDatabaseInheritanceDryRun);
- auto valueDryRun = FromStringWithDefault<ui64>(rowDryRunStr, ui64(1));
- auto valueDryRunStr = ToString(valueDryRun);
-
- TStringBuilder debug;
- debug << "Triggered FixAccessDatabaseInheritance with DryRunVal: " << valueDryRunStr;
-
- LOG_EMERG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TSchemeShard::TTxMonitoring AdminRequest " << debug);
- str << debug;
-
- TStringStream templateAnsver = str;
- str.clear();
-
- OutputAdminPage(templateAnsver);
-
- auto func = [templateAnsver] (const TMap<TPathId, TSet<TString>>& done) -> NActors::IEventBase* {
- TStringStream str = templateAnsver;
- HTML(str) {
- TABLE_SORTABLE_CLASS("table") {
- TABLEHEAD() {
- TABLER() {
- TABLEH() {str << "DomainId";}
- TABLEH() {str << "Sid";}
- }
- str << "\n";
- }
-
- for (const auto& item: done) {
- const TPathId& domainId = item.first;
-
- for (const auto& sid: item.second) {
- TABLER() {
- TABLED() { str << domainId; }
- TABLED() { str << sid; }
- }
- str << "\n";
- }
- }
- }
- }
-
- return new NMon::TEvRemoteHttpInfoRes(str.Str());
- };
-
- Self->Execute(Self->CreateTxMakeAccessDatabaseNoInheritable(Ev->Sender, bool(valueDryRun), func), ctx);
-
- return;
- }
-
+ void LinkToMain(TStringStream& str) const {
+ str << "<a href='app?" << TCgi::TabletID.AsCgiParam(Self->TabletID())
+ << "&" << TCgi::Page.AsCgiParam(TCgi::TPages::MainPage) << "'>";
+ str << "Back to main scheme shard page";
+ str << "</a><br>";
+ }
+
+ void OutputAdminRequestPage(TStringStream& str, NIceDb::TNiceDb& db, const TCgiParameters& cgi, const TActorContext& ctx) const {
+ if (cgi.Has(TCgi::IsReadOnlyMode)) {
+ TString rowStr = cgi.Get(TCgi::IsReadOnlyMode);
+ auto value = FromStringWithDefault<ui64>(rowStr, ui64(0));
+ auto valueStr = ToString(value);
+
+ TStringBuilder debug;
+ debug << "IsReadOnlyMode changed from " << ToString(Self->IsReadOnlyMode)
+ << " to " << valueStr;
+
+ LOG_EMERG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TSchemeShard::TTxMonitoring AdminRequest " << debug);
+ str << debug;
+
+ db.Table<Schema::SysParams>().Key(Schema::SysParam_IsReadOnlyMode).Update(
+ NIceDb::TUpdate<Schema::SysParams::Value>(valueStr));
+ Self->IsReadOnlyMode = value;
+ }
+
+ if (cgi.Has(TCgi::UpdateAccessDatabaseRights)) {
+ TString rowDryRunStr = cgi.Get(TCgi::UpdateAccessDatabaseRightsDryRun);
+ auto valueDryRun = FromStringWithDefault<ui64>(rowDryRunStr, ui64(1));
+ auto valueDryRunStr = ToString(valueDryRun);
+
+ TStringBuilder debug;
+ debug << "Triggered UpdateAccessDatabaseRights with DryRunVal: " << valueDryRunStr;
+
+ LOG_EMERG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TSchemeShard::TTxMonitoring AdminRequest " << debug);
+ str << debug;
+
+ TStringStream templateAnsver = str;
+ str.clear();
+
+ OutputAdminPage(templateAnsver);
+
+ auto func = [templateAnsver] (const TMap<TPathId, TSet<TString>>& done) -> NActors::IEventBase* {
+ TStringStream str = templateAnsver;
+ HTML(str) {
+ TABLE_SORTABLE_CLASS("table") {
+ TABLEHEAD() {
+ TABLER() {
+ TABLEH() {str << "DomainId";}
+ TABLEH() {str << "Sid";}
+ }
+ str << "\n";
+ }
+
+ for (const auto& item: done) {
+ const TPathId& domainId = item.first;
+
+ for (const auto& sid: item.second) {
+ TABLER() {
+ TABLED() { str << domainId; }
+ TABLED() { str << sid; }
+ }
+ str << "\n";
+ }
+ }
+ }
+ }
+
+ return new NMon::TEvRemoteHttpInfoRes(str.Str());
+ };
+
+ Self->Execute(Self->CreateTxUpgradeAccessDatabaseRights(Ev->Sender, bool(valueDryRun), func), ctx);
+
+ return;
+ }
+
+ if (cgi.Has(TCgi::FixAccessDatabaseInheritance)) {
+ TString rowDryRunStr = cgi.Get(TCgi::FixAccessDatabaseInheritanceDryRun);
+ auto valueDryRun = FromStringWithDefault<ui64>(rowDryRunStr, ui64(1));
+ auto valueDryRunStr = ToString(valueDryRun);
+
+ TStringBuilder debug;
+ debug << "Triggered FixAccessDatabaseInheritance with DryRunVal: " << valueDryRunStr;
+
+ LOG_EMERG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TSchemeShard::TTxMonitoring AdminRequest " << debug);
+ str << debug;
+
+ TStringStream templateAnsver = str;
+ str.clear();
+
+ OutputAdminPage(templateAnsver);
+
+ auto func = [templateAnsver] (const TMap<TPathId, TSet<TString>>& done) -> NActors::IEventBase* {
+ TStringStream str = templateAnsver;
+ HTML(str) {
+ TABLE_SORTABLE_CLASS("table") {
+ TABLEHEAD() {
+ TABLER() {
+ TABLEH() {str << "DomainId";}
+ TABLEH() {str << "Sid";}
+ }
+ str << "\n";
+ }
+
+ for (const auto& item: done) {
+ const TPathId& domainId = item.first;
+
+ for (const auto& sid: item.second) {
+ TABLER() {
+ TABLED() { str << domainId; }
+ TABLED() { str << sid; }
+ }
+ str << "\n";
+ }
+ }
+ }
+ }
+
+ return new NMon::TEvRemoteHttpInfoRes(str.Str());
+ };
+
+ Self->Execute(Self->CreateTxMakeAccessDatabaseNoInheritable(Ev->Sender, bool(valueDryRun), func), ctx);
+
+ return;
+ }
+
if (cgi.Has(TCgi::UpdateCoordinatorsConfig)) {
TString rawDryRunStr = cgi.Get(TCgi::UpdateCoordinatorsConfigDryRun);
auto valueDryRun = FromStringWithDefault<ui64>(rawDryRunStr, ui64(1));
@@ -449,7 +449,7 @@ private:
debug << "Triggered UpdateCoordinatorsConfig, dryRun = " << valueDryRun;
LOG_EMERG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TSchemeShard::TTxMonitoring AdminRequest " << debug);
+ "TSchemeShard::TTxMonitoring AdminRequest " << debug);
str << "<pre>";
str << debug << Endl;
@@ -492,41 +492,41 @@ private:
return;
}
- OutputAdminPage(str);
- }
-
-
- void OutputAdminPage(TStringStream& str) const {
- {
- str << "<form method=\"GET\" id=\"tblMonSSFrm\" name=\"tblMonSSFrm\">" << Endl;
- str << "<legend> Settings to change: </legend>";
- str << TCgi::TabletID.AsHiddenInput(Self->TabletID());
- str << TCgi::Page.AsHiddenInput(TCgi::TPages::AdminRequest);
- str << TCgi::IsReadOnlyMode.AsInput(Self->IsReadOnlyMode);
- str << "<input class=\"btn btn-default\" type=\"submit\" value=\"Set\"/>" << Endl;
- str << "</form>" << Endl;
- }
- {
- str << "<form method=\"GET\" id=\"tblMonSSFrm\" name=\"tblMonSSFrm\">" << Endl;
- str << "<legend> Execute upgrade DB's ACL, grant ACCESS to all existed users: </legend>";
- str << TCgi::TabletID.AsHiddenInput(Self->TabletID());
- str << TCgi::Page.AsHiddenInput(TCgi::TPages::AdminRequest);
- str << TCgi::UpdateAccessDatabaseRights.AsHiddenInput("1");
- str << TCgi::UpdateAccessDatabaseRightsDryRun.AsInput(1);
- str << "<input class=\"btn btn-default\" type=\"submit\" value=\"Run\"/>" << Endl;
- str << "</form>" << Endl;
- }
+ OutputAdminPage(str);
+ }
+
+
+ void OutputAdminPage(TStringStream& str) const {
+ {
+ str << "<form method=\"GET\" id=\"tblMonSSFrm\" name=\"tblMonSSFrm\">" << Endl;
+ str << "<legend> Settings to change: </legend>";
+ str << TCgi::TabletID.AsHiddenInput(Self->TabletID());
+ str << TCgi::Page.AsHiddenInput(TCgi::TPages::AdminRequest);
+ str << TCgi::IsReadOnlyMode.AsInput(Self->IsReadOnlyMode);
+ str << "<input class=\"btn btn-default\" type=\"submit\" value=\"Set\"/>" << Endl;
+ str << "</form>" << Endl;
+ }
+ {
+ str << "<form method=\"GET\" id=\"tblMonSSFrm\" name=\"tblMonSSFrm\">" << Endl;
+ str << "<legend> Execute upgrade DB's ACL, grant ACCESS to all existed users: </legend>";
+ str << TCgi::TabletID.AsHiddenInput(Self->TabletID());
+ str << TCgi::Page.AsHiddenInput(TCgi::TPages::AdminRequest);
+ str << TCgi::UpdateAccessDatabaseRights.AsHiddenInput("1");
+ str << TCgi::UpdateAccessDatabaseRightsDryRun.AsInput(1);
+ str << "<input class=\"btn btn-default\" type=\"submit\" value=\"Run\"/>" << Endl;
+ str << "</form>" << Endl;
+ }
+ {
+ str << "<form method=\"GET\" id=\"tblMonSSFrm\" name=\"tblMonSSFrm\">" << Endl;
+ str << "<legend> Make all Access Database rights no inheritable at all datatabase: </legend>";
+ str << TCgi::TabletID.AsHiddenInput(Self->TabletID());
+ str << TCgi::Page.AsHiddenInput(TCgi::TPages::AdminRequest);
+ str << TCgi::FixAccessDatabaseInheritance.AsHiddenInput("1");
+ str << TCgi::FixAccessDatabaseInheritanceDryRun.AsInput(1);
+ str << "<input class=\"btn btn-default\" type=\"submit\" value=\"Run\"/>" << Endl;
+ str << "</form>" << Endl;
+ }
{
- str << "<form method=\"GET\" id=\"tblMonSSFrm\" name=\"tblMonSSFrm\">" << Endl;
- str << "<legend> Make all Access Database rights no inheritable at all datatabase: </legend>";
- str << TCgi::TabletID.AsHiddenInput(Self->TabletID());
- str << TCgi::Page.AsHiddenInput(TCgi::TPages::AdminRequest);
- str << TCgi::FixAccessDatabaseInheritance.AsHiddenInput("1");
- str << TCgi::FixAccessDatabaseInheritanceDryRun.AsInput(1);
- str << "<input class=\"btn btn-default\" type=\"submit\" value=\"Run\"/>" << Endl;
- str << "</form>" << Endl;
- }
- {
str << "<form method=\"GET\" id=\"tblMonSSFrmUpdateCoordinatorsConfig\" name=\"tblMonSSFrmUpdateCoordinatorsConfig\">" << Endl;
str << "<legend> Send configuration update to all coordinators: </legend>";
str << TCgi::TabletID.AsHiddenInput(Self->TabletID());
@@ -536,280 +536,280 @@ private:
str << "<input class=\"btn btn-default\" type=\"submit\" value=\"Run\"/>" << Endl;
str << "</form>" << Endl;
}
- }
-
- void OutputMainPage(TStringStream& str) const {
+ }
+
+ void OutputMainPage(TStringStream& str) const {
HTML(str) {
- H3() {str << "SchemeShard main page:";}
-
- {
- str << "<legend>";
- str << "<a href='app?"
- << TCgi::TabletID.AsCgiParam(Self->TabletID())
- << "&" << TCgi::Page.AsCgiParam(TCgi::TPages::AdminPage)
- << "'> Administration settings </a>";
- str << "</legend>";
- }
-
- {
- str << "<form method=\"GET\" id=\"tblMonSSFrm\" name=\"tblMonSSFrm\">" << Endl;
- str << "<legend> Path info by Path Id: </legend>";
- str << TCgi::TabletID.AsHiddenInput(Self->TabletID());
- str << TCgi::Page.AsHiddenInput(TCgi::TPages::PathInfo);
- str << TCgi::OwnerPathId.AsInput(Self->TabletID());
- str << TCgi::LocalPathId.AsInput();
- str << "<input class=\"btn btn-default\" type=\"submit\" value=\"Watch\"/>" << Endl;
- str << "</form>" << Endl;
- }
-
- {
- str << "<form method=\"GET\" id=\"tblMonSSFrm\" name=\"tblMonSSFrm\">" << Endl;
- str << "<legend> Shard info by ID: </legend>";
- str << TCgi::TabletID.AsHiddenInput(Self->TabletID());
- str << TCgi::Page.AsHiddenInput(TCgi::TPages::ShardInfoByTabletId);
- str << TCgi::ShardID.AsInput();
- str << "<input class=\"btn btn-default\" type=\"submit\" value=\"Watch\"/>" << Endl;
- str << "</form>" << Endl;
- }
- {
- str << "<form method=\"GET\" id=\"tblMonSSFrm\" name=\"tblMonSSFrm\">" << Endl;
- str << "<legend> Shard info by Idx: </legend>";
- str << TCgi::TabletID.AsHiddenInput(Self->TabletID());
- str << TCgi::Page.AsHiddenInput(TCgi::TPages::ShardInfoByShardIdx);
- str << TCgi::OwnerShardIdx.AsInput(Self->TabletID());
- str << TCgi::LocalShardIdx.AsInput();
- str << "<input class=\"btn btn-default\" type=\"submit\" value=\"Watch\"/>" << Endl;
- str << "</form>" << Endl;
- }
-
- {
- str << "<form method=\"GET\" id=\"tblMonSSFrm\" name=\"tblMonSSFrm\">" << Endl;
- str << "<fieldset>";
- str << "<legend>TxInFly info by OperationId: </legend>";
- str << TCgi::TabletID.AsHiddenInput(Self->TabletID());
- str << TCgi::Page.AsHiddenInput(TCgi::TPages::TransactionInfo);
- str << TCgi::TxId.AsInput();
- str << TCgi::PartId.AsInput();
- str << "<input class=\"btn btn-default\" type=\"submit\" value=\"Watch\"/>" << Endl;
- str << "</fieldset>";
- str << "</form>" << Endl;
- }
-
- {
- str << "<legend>";
- H3() {str << "Transactions in flight:"; }
- str << "</legend>";
- TableTxInfly(str);
- }
-
- {
- str << "<legend>";
- H3() {str << "Active Build Indexes in flight:"; }
- str << "</legend>";
- BuildIndexesInfly(str, /*forActive=*/ true);
- }
-
- {
- str << "<legend>";
- H3() {str << "Finished Build Indexes:"; }
- str << "</legend>";
- BuildIndexesInfly(str, /*forActive=*/ false);
- }
- }
- }
-
- void BuildIndexesInfly(TStringStream& str, bool forActive) const {
- HTML(str) {
- TABLE_SORTABLE_CLASS("table") {
- TABLEHEAD() {
- TABLER() {
- TABLEH() {str << "Id";}
- TABLEH() {str << "State";}
- }
- str << "\n";
- }
-
- for (const auto& item : Self->IndexBuilds) {
- TIndexBuildId buildIndexId = item.first;
- const TIndexBuildInfo::TPtr& info = item.second;
-
- bool print = false;
- if (forActive) {
- print = !info->IsFinished();
- } else {
- print = info->IsFinished();
- }
-
- if (print) {
- TABLER() {
- TABLED() {
- str << "<a href='app?" << TCgi::Page.AsCgiParam(TCgi::TPages::BuildIndexInfo)
- << "&" << TCgi::TabletID.AsCgiParam(Self->TabletID())
- << "&" << TCgi::BuildIndexId.AsCgiParam(ui64(buildIndexId))
- << "'>" << buildIndexId << "</a>"; }
- TABLED() { str << info->State; }
- }
- str << "\n";
- }
- }
- }
- }
- }
-
- void BuildIndexInfoPage(TIndexBuildId buildIndexId, TStringStream& str) const {
- HTML(str) {
- H3() {str << "Build index id " << buildIndexId;}
-
- if (!Self->IndexBuilds.contains(buildIndexId)) {
- PRE() {
- str << "Unknown Tx\n";
- }
- return;
- }
-
- const TIndexBuildInfo::TPtr& info = Self->IndexBuilds.at(buildIndexId);
- H4() {str << "Fields";}
- PRE () {
- str << "BuildInfoId: " << info->Id << Endl
- << "Uid: " << info->Uid << Endl
-
- << "CancelRequested: " << (info->CancelRequested ? "YES" : "NO") << Endl
-
- << "State: " << info->State << Endl
- << "Issue: " << info->Issue << Endl
-
- << "Shards.size: " << info->Shards.size() << Endl
- << "ToUploadShards.size: " << info->ToUploadShards.size() << Endl
- << "DoneShards.size: " << info->DoneShards.size() << Endl
- << "InProgressShards.size: " << info->InProgressShards.size() << Endl
-
- << "DomainPathId: " << LinkToPathInfo(info->DomainPathId) << Endl
- << "DomainPath: " << TPath::Init(info->DomainPathId, Self).PathString() << Endl
-
- << "TablePathId: " << LinkToPathInfo(info->TablePathId) << Endl
- << "TablePath: " << TPath::Init(info->TablePathId, Self).PathString() << Endl
-
- << "IndexType: " << NKikimrSchemeOp::EIndexType_Name(info->IndexType) << Endl
-
- << "IndexName: " << info->IndexName << Endl;
-
- for (const auto& column: info->IndexColumns) {
- str << "IndexColumns: " << column << Endl;
- }
-
- str << "Subscribers.size: " << info->Subscribers.size() << Endl
-
- << "LockTxId: " << info->LockTxId << Endl
- << "LockTxStatus: " << NKikimrScheme::EStatus_Name(info->LockTxStatus) << Endl
- << "LockTxDone " << (info->LockTxDone ? "DONE" : "not done") << Endl
-
- << "InitiateTxId: " << info->InitiateTxId << Endl
- << "InitiateTxStatus: " << NKikimrScheme::EStatus_Name(info->InitiateTxStatus) << Endl
- << "InitiateTxDone " << (info->InitiateTxDone ? "DONE" : "not done") << Endl
-
- << "ApplyTxId: " << info->ApplyTxId << Endl
- << "ApplyTxStatus: " << NKikimrScheme::EStatus_Name(info->ApplyTxStatus) << Endl
- << "ApplyTxDone " << (info->ApplyTxDone ? "DONE" : "not done") << Endl
-
- << "UnlockTxId: " << info->UnlockTxId << Endl
- << "UnlockTxStatus: " << NKikimrScheme::EStatus_Name(info->UnlockTxStatus) << Endl
- << "UnlockTxDone " << (info->UnlockTxDone ? "DONE" : "not done") << Endl
-
- << "SnapshotStep: " << info->SnapshotStep << Endl
- << "SnapshotTxId: " << info->SnapshotTxId << Endl
-
- << "Processed: " << info->Processed << Endl
- << "Billed: " << info->Billed << Endl;
-
- }
-
- TVector<ui16> keyTypes;
- if (Self->Tables.contains(info->TablePathId)) {
- TTableInfo::TPtr tableInfo = Self->Tables.at(info->TablePathId);
- for (ui32 keyPos: tableInfo->KeyColumnIds) {
- keyTypes.push_back(tableInfo->Columns.at(keyPos).PType);
- }
- }
-
- {
- H3() {str << "Shards : " << info->Shards.size() << "\n";}
- TABLE_SORTABLE_CLASS("table") {
- TABLEHEAD() {
- TABLER() {
- TABLEH() {str << "ShardIdx";}
- TABLEH() {str << "DatashardId";}
- TABLEH() {str << "Range";}
- TABLEH() {str << "LastKeyAck";}
- TABLEH() {str << "Status";}
- TABLEH() {str << "UploadStatus";}
- TABLEH() {str << "DebugMessage";}
- TABLEH() {str << "SeqNo";}
- TABLEH() {str << "Processed";}
- TABLEH() {str << "Billed";}
- }
- }
- for (auto item : info->Shards) {
- TShardIdx idx = item.first;
- const TIndexBuildInfo::TShardStatus& status = item.second;
- TABLER() {
- TABLED() {
- str << idx;
- }
- TABLED() {
- if (Self->ShardInfos.contains(idx)) {
- str << Self->ShardInfos.at(idx).TabletID;
- } else {
- str << "shard " << idx << " has been dropped";
- }
- }
- TABLED() {
- if (keyTypes) {
- str << DebugPrintRange(keyTypes, status.Range.ToTableRange(), *AppData()->TypeRegistry);
- } else {
- str << "table has been dropped";
- }
- }
- TABLED() {
- if (keyTypes) {
- TSerializedCellVec vec;
- vec.Parse(status.LastKeyAck);
- str << DebugPrintPoint(keyTypes, vec.GetCells(), *AppData()->TypeRegistry);
- } else {
- str << "table has been dropped";
- }
- }
- TABLED() {
- str << NKikimrTxDataShard::TEvBuildIndexProgressResponse_EStatus_Name(status.Status);
- }
- TABLED() {
- str << Ydb::StatusIds::StatusCode_Name(status.UploadStatus);
- }
- TABLED() {
- str << status.DebugMessage;
+ H3() {str << "SchemeShard main page:";}
+
+ {
+ str << "<legend>";
+ str << "<a href='app?"
+ << TCgi::TabletID.AsCgiParam(Self->TabletID())
+ << "&" << TCgi::Page.AsCgiParam(TCgi::TPages::AdminPage)
+ << "'> Administration settings </a>";
+ str << "</legend>";
+ }
+
+ {
+ str << "<form method=\"GET\" id=\"tblMonSSFrm\" name=\"tblMonSSFrm\">" << Endl;
+ str << "<legend> Path info by Path Id: </legend>";
+ str << TCgi::TabletID.AsHiddenInput(Self->TabletID());
+ str << TCgi::Page.AsHiddenInput(TCgi::TPages::PathInfo);
+ str << TCgi::OwnerPathId.AsInput(Self->TabletID());
+ str << TCgi::LocalPathId.AsInput();
+ str << "<input class=\"btn btn-default\" type=\"submit\" value=\"Watch\"/>" << Endl;
+ str << "</form>" << Endl;
+ }
+
+ {
+ str << "<form method=\"GET\" id=\"tblMonSSFrm\" name=\"tblMonSSFrm\">" << Endl;
+ str << "<legend> Shard info by ID: </legend>";
+ str << TCgi::TabletID.AsHiddenInput(Self->TabletID());
+ str << TCgi::Page.AsHiddenInput(TCgi::TPages::ShardInfoByTabletId);
+ str << TCgi::ShardID.AsInput();
+ str << "<input class=\"btn btn-default\" type=\"submit\" value=\"Watch\"/>" << Endl;
+ str << "</form>" << Endl;
+ }
+ {
+ str << "<form method=\"GET\" id=\"tblMonSSFrm\" name=\"tblMonSSFrm\">" << Endl;
+ str << "<legend> Shard info by Idx: </legend>";
+ str << TCgi::TabletID.AsHiddenInput(Self->TabletID());
+ str << TCgi::Page.AsHiddenInput(TCgi::TPages::ShardInfoByShardIdx);
+ str << TCgi::OwnerShardIdx.AsInput(Self->TabletID());
+ str << TCgi::LocalShardIdx.AsInput();
+ str << "<input class=\"btn btn-default\" type=\"submit\" value=\"Watch\"/>" << Endl;
+ str << "</form>" << Endl;
+ }
+
+ {
+ str << "<form method=\"GET\" id=\"tblMonSSFrm\" name=\"tblMonSSFrm\">" << Endl;
+ str << "<fieldset>";
+ str << "<legend>TxInFly info by OperationId: </legend>";
+ str << TCgi::TabletID.AsHiddenInput(Self->TabletID());
+ str << TCgi::Page.AsHiddenInput(TCgi::TPages::TransactionInfo);
+ str << TCgi::TxId.AsInput();
+ str << TCgi::PartId.AsInput();
+ str << "<input class=\"btn btn-default\" type=\"submit\" value=\"Watch\"/>" << Endl;
+ str << "</fieldset>";
+ str << "</form>" << Endl;
+ }
+
+ {
+ str << "<legend>";
+ H3() {str << "Transactions in flight:"; }
+ str << "</legend>";
+ TableTxInfly(str);
+ }
+
+ {
+ str << "<legend>";
+ H3() {str << "Active Build Indexes in flight:"; }
+ str << "</legend>";
+ BuildIndexesInfly(str, /*forActive=*/ true);
+ }
+
+ {
+ str << "<legend>";
+ H3() {str << "Finished Build Indexes:"; }
+ str << "</legend>";
+ BuildIndexesInfly(str, /*forActive=*/ false);
+ }
+ }
+ }
+
+ void BuildIndexesInfly(TStringStream& str, bool forActive) const {
+ HTML(str) {
+ TABLE_SORTABLE_CLASS("table") {
+ TABLEHEAD() {
+ TABLER() {
+ TABLEH() {str << "Id";}
+ TABLEH() {str << "State";}
+ }
+ str << "\n";
+ }
+
+ for (const auto& item : Self->IndexBuilds) {
+ TIndexBuildId buildIndexId = item.first;
+ const TIndexBuildInfo::TPtr& info = item.second;
+
+ bool print = false;
+ if (forActive) {
+ print = !info->IsFinished();
+ } else {
+ print = info->IsFinished();
+ }
+
+ if (print) {
+ TABLER() {
+ TABLED() {
+ str << "<a href='app?" << TCgi::Page.AsCgiParam(TCgi::TPages::BuildIndexInfo)
+ << "&" << TCgi::TabletID.AsCgiParam(Self->TabletID())
+ << "&" << TCgi::BuildIndexId.AsCgiParam(ui64(buildIndexId))
+ << "'>" << buildIndexId << "</a>"; }
+ TABLED() { str << info->State; }
+ }
+ str << "\n";
+ }
+ }
+ }
+ }
+ }
+
+ void BuildIndexInfoPage(TIndexBuildId buildIndexId, TStringStream& str) const {
+ HTML(str) {
+ H3() {str << "Build index id " << buildIndexId;}
+
+ if (!Self->IndexBuilds.contains(buildIndexId)) {
+ PRE() {
+ str << "Unknown Tx\n";
+ }
+ return;
+ }
+
+ const TIndexBuildInfo::TPtr& info = Self->IndexBuilds.at(buildIndexId);
+ H4() {str << "Fields";}
+ PRE () {
+ str << "BuildInfoId: " << info->Id << Endl
+ << "Uid: " << info->Uid << Endl
+
+ << "CancelRequested: " << (info->CancelRequested ? "YES" : "NO") << Endl
+
+ << "State: " << info->State << Endl
+ << "Issue: " << info->Issue << Endl
+
+ << "Shards.size: " << info->Shards.size() << Endl
+ << "ToUploadShards.size: " << info->ToUploadShards.size() << Endl
+ << "DoneShards.size: " << info->DoneShards.size() << Endl
+ << "InProgressShards.size: " << info->InProgressShards.size() << Endl
+
+ << "DomainPathId: " << LinkToPathInfo(info->DomainPathId) << Endl
+ << "DomainPath: " << TPath::Init(info->DomainPathId, Self).PathString() << Endl
+
+ << "TablePathId: " << LinkToPathInfo(info->TablePathId) << Endl
+ << "TablePath: " << TPath::Init(info->TablePathId, Self).PathString() << Endl
+
+ << "IndexType: " << NKikimrSchemeOp::EIndexType_Name(info->IndexType) << Endl
+
+ << "IndexName: " << info->IndexName << Endl;
+
+ for (const auto& column: info->IndexColumns) {
+ str << "IndexColumns: " << column << Endl;
+ }
+
+ str << "Subscribers.size: " << info->Subscribers.size() << Endl
+
+ << "LockTxId: " << info->LockTxId << Endl
+ << "LockTxStatus: " << NKikimrScheme::EStatus_Name(info->LockTxStatus) << Endl
+ << "LockTxDone " << (info->LockTxDone ? "DONE" : "not done") << Endl
+
+ << "InitiateTxId: " << info->InitiateTxId << Endl
+ << "InitiateTxStatus: " << NKikimrScheme::EStatus_Name(info->InitiateTxStatus) << Endl
+ << "InitiateTxDone " << (info->InitiateTxDone ? "DONE" : "not done") << Endl
+
+ << "ApplyTxId: " << info->ApplyTxId << Endl
+ << "ApplyTxStatus: " << NKikimrScheme::EStatus_Name(info->ApplyTxStatus) << Endl
+ << "ApplyTxDone " << (info->ApplyTxDone ? "DONE" : "not done") << Endl
+
+ << "UnlockTxId: " << info->UnlockTxId << Endl
+ << "UnlockTxStatus: " << NKikimrScheme::EStatus_Name(info->UnlockTxStatus) << Endl
+ << "UnlockTxDone " << (info->UnlockTxDone ? "DONE" : "not done") << Endl
+
+ << "SnapshotStep: " << info->SnapshotStep << Endl
+ << "SnapshotTxId: " << info->SnapshotTxId << Endl
+
+ << "Processed: " << info->Processed << Endl
+ << "Billed: " << info->Billed << Endl;
+
+ }
+
+ TVector<ui16> keyTypes;
+ if (Self->Tables.contains(info->TablePathId)) {
+ TTableInfo::TPtr tableInfo = Self->Tables.at(info->TablePathId);
+ for (ui32 keyPos: tableInfo->KeyColumnIds) {
+ keyTypes.push_back(tableInfo->Columns.at(keyPos).PType);
+ }
+ }
+
+ {
+ H3() {str << "Shards : " << info->Shards.size() << "\n";}
+ TABLE_SORTABLE_CLASS("table") {
+ TABLEHEAD() {
+ TABLER() {
+ TABLEH() {str << "ShardIdx";}
+ TABLEH() {str << "DatashardId";}
+ TABLEH() {str << "Range";}
+ TABLEH() {str << "LastKeyAck";}
+ TABLEH() {str << "Status";}
+ TABLEH() {str << "UploadStatus";}
+ TABLEH() {str << "DebugMessage";}
+ TABLEH() {str << "SeqNo";}
+ TABLEH() {str << "Processed";}
+ TABLEH() {str << "Billed";}
+ }
+ }
+ for (auto item : info->Shards) {
+ TShardIdx idx = item.first;
+ const TIndexBuildInfo::TShardStatus& status = item.second;
+ TABLER() {
+ TABLED() {
+ str << idx;
+ }
+ TABLED() {
+ if (Self->ShardInfos.contains(idx)) {
+ str << Self->ShardInfos.at(idx).TabletID;
+ } else {
+ str << "shard " << idx << " has been dropped";
+ }
+ }
+ TABLED() {
+ if (keyTypes) {
+ str << DebugPrintRange(keyTypes, status.Range.ToTableRange(), *AppData()->TypeRegistry);
+ } else {
+ str << "table has been dropped";
+ }
+ }
+ TABLED() {
+ if (keyTypes) {
+ TSerializedCellVec vec;
+ vec.Parse(status.LastKeyAck);
+ str << DebugPrintPoint(keyTypes, vec.GetCells(), *AppData()->TypeRegistry);
+ } else {
+ str << "table has been dropped";
+ }
+ }
+ TABLED() {
+ str << NKikimrTxDataShard::TEvBuildIndexProgressResponse_EStatus_Name(status.Status);
}
- TABLED() {
- str << Self->Generation() << ":" << status.SeqNoRound;
- }
- TABLED() {
- str << status.Processed;
- }
- TABLED() {
- str << status.Billed;
- }
- }
- str << "\n";
- }
- }
- }
- }
- }
-
- void TableTxInfly(TStringStream& str) const {
- HTML(str) {
+ TABLED() {
+ str << Ydb::StatusIds::StatusCode_Name(status.UploadStatus);
+ }
+ TABLED() {
+ str << status.DebugMessage;
+ }
+ TABLED() {
+ str << Self->Generation() << ":" << status.SeqNoRound;
+ }
+ TABLED() {
+ str << status.Processed;
+ }
+ TABLED() {
+ str << status.Billed;
+ }
+ }
+ str << "\n";
+ }
+ }
+ }
+ }
+ }
+
+ void TableTxInfly(TStringStream& str) const {
+ HTML(str) {
TABLE_SORTABLE_CLASS("table") {
TABLEHEAD() {
TABLER() {
- TABLEH() {str << "OpId";}
+ TABLEH() {str << "OpId";}
TABLEH() {str << "Type";}
TABLEH() {str << "State";}
TABLEH() {str << "Shards in progress";}
@@ -818,14 +818,14 @@ private:
}
for (const auto& tx : Self->TxInFlight) {
- TOperationId opId = tx.first;
- const TTxState txState = tx.second;
+ TOperationId opId = tx.first;
+ const TTxState txState = tx.second;
TABLER() {
- TABLED() { str << "<a href='app?" << TCgi::Page.AsCgiParam(TCgi::TPages::TransactionInfo)
- << "&" << TCgi::TabletID.AsCgiParam(Self->TabletID())
- << "&" << TCgi::TxId.AsCgiParam(opId.GetTxId())
- << "&" << TCgi::PartId.AsCgiParam(opId.GetSubTxId())
- << "'>" << opId << "</a>"; }
+ TABLED() { str << "<a href='app?" << TCgi::Page.AsCgiParam(TCgi::TPages::TransactionInfo)
+ << "&" << TCgi::TabletID.AsCgiParam(Self->TabletID())
+ << "&" << TCgi::TxId.AsCgiParam(opId.GetTxId())
+ << "&" << TCgi::PartId.AsCgiParam(opId.GetSubTxId())
+ << "'>" << opId << "</a>"; }
TABLED() { str << TTxState::TypeName(txState.TxType); }
TABLED() { str << TTxState::StateName(txState.State); }
TABLED() { str << txState.ShardsInProgress.size(); }
@@ -836,49 +836,49 @@ private:
}
}
- void OutputTxListPage(TStringStream& str) const {
- HTML(str) {
- H3() {str << "Transactions in flight:";}
-
- TableTxInfly(str);
- }
- }
-
- void OutputTxInfoPage(TOperationId operationId, TStringStream& str) const {
+ void OutputTxListPage(TStringStream& str) const {
+ HTML(str) {
+ H3() {str << "Transactions in flight:";}
+
+ TableTxInfly(str);
+ }
+ }
+
+ void OutputTxInfoPage(TOperationId operationId, TStringStream& str) const {
HTML(str) {
- H3() {str << "Transaction " << operationId;}
+ H3() {str << "Transaction " << operationId;}
- auto txInfo = Self->FindTx(operationId);
+ auto txInfo = Self->FindTx(operationId);
if (!txInfo) {
PRE() {
str << "Unknown Tx\n";
}
} else {
- const TTxState txState = *txInfo;
+ const TTxState txState = *txInfo;
H3() {str << "Shards in progress : " << txState.ShardsInProgress.size() << "\n";}
TABLE_SORTABLE_CLASS("table") {
TABLEHEAD() {
TABLER() {
- TABLEH() {str << "OwnerShardIdx";}
- TABLEH() {str << "LocalShardIdx";}
+ TABLEH() {str << "OwnerShardIdx";}
+ TABLEH() {str << "LocalShardIdx";}
TABLEH() {str << "TabletId";}
}
}
- for (auto shardIdx : txState.ShardsInProgress) {
+ for (auto shardIdx : txState.ShardsInProgress) {
TABLER() {
TABLED() {
- str << "<a href='../tablets/app?" << TCgi::TabletID.AsCgiParam(Self->TabletID())
- << "&" << TCgi::Page.AsCgiParam(TCgi::TPages::ShardInfoByShardIdx)
- << "&" << TCgi::OwnerShardIdx.AsCgiParam(shardIdx.GetOwnerId())
- << "&" << TCgi::LocalShardIdx.AsCgiParam(shardIdx.GetLocalId())
- << "'>" << shardIdx <<"</a>";
- }
- TABLED() {
+ str << "<a href='../tablets/app?" << TCgi::TabletID.AsCgiParam(Self->TabletID())
+ << "&" << TCgi::Page.AsCgiParam(TCgi::TPages::ShardInfoByShardIdx)
+ << "&" << TCgi::OwnerShardIdx.AsCgiParam(shardIdx.GetOwnerId())
+ << "&" << TCgi::LocalShardIdx.AsCgiParam(shardIdx.GetLocalId())
+ << "'>" << shardIdx <<"</a>";
+ }
+ TABLED() {
if (Self->ShardInfos.contains(shardIdx)) {
- TTabletId tabletId = Self->ShardInfos.FindPtr(shardIdx)->TabletID;
- str << "<a href='../tablets?"
- << TCgi::TabletID.AsCgiParam(tabletId)
- << "'>" << tabletId <<"</a>";
+ TTabletId tabletId = Self->ShardInfos.FindPtr(shardIdx)->TabletID;
+ str << "<a href='../tablets?"
+ << TCgi::TabletID.AsCgiParam(tabletId)
+ << "'>" << tabletId <<"</a>";
} else {
str << "UNKNOWN_TABLET!";
}
@@ -891,442 +891,442 @@ private:
}
}
- void OutputShardInfo(TShardIdx shardIdx, TStringStream& str) const {
+ void OutputShardInfo(TShardIdx shardIdx, TStringStream& str) const {
HTML(str) {
- if (!Self->ShardInfos.contains(shardIdx)) {
- H4() {
- str << "No shard item for shard " << shardIdx << "</a>";
- }
- return;
- }
-
- const TShardInfo& shard = Self->ShardInfos.at(shardIdx);
-
- H4() {str << "Shard idx " << shardIdx << "</a>";}
- PRE () {
- str << "TabletID: " << shard.TabletID<< Endl
- << "CurrentTxId: " << shard.CurrentTxId << Endl
- << "PathId: " << LinkToPathInfo(shard.PathId) << Endl
- << "TabletType: " << TTabletTypes::TypeToStr(shard.TabletType) << Endl;
- }
-
- H4() {str << "BindedChannels for shard idx " << shardIdx << "</a>";}
- TABLE_SORTABLE_CLASS("BindedChannels") {
- TABLEHEAD() {
- TABLER() {
- TABLEH() {str << "ChannelId";}
- TABLEH() {str << "PoolName";}
- }
- }
+ if (!Self->ShardInfos.contains(shardIdx)) {
+ H4() {
+ str << "No shard item for shard " << shardIdx << "</a>";
+ }
+ return;
+ }
+
+ const TShardInfo& shard = Self->ShardInfos.at(shardIdx);
+
+ H4() {str << "Shard idx " << shardIdx << "</a>";}
+ PRE () {
+ str << "TabletID: " << shard.TabletID<< Endl
+ << "CurrentTxId: " << shard.CurrentTxId << Endl
+ << "PathId: " << LinkToPathInfo(shard.PathId) << Endl
+ << "TabletType: " << TTabletTypes::TypeToStr(shard.TabletType) << Endl;
+ }
+
+ H4() {str << "BindedChannels for shard idx " << shardIdx << "</a>";}
+ TABLE_SORTABLE_CLASS("BindedChannels") {
+ TABLEHEAD() {
+ TABLER() {
+ TABLEH() {str << "ChannelId";}
+ TABLEH() {str << "PoolName";}
+ }
+ }
ui32 channelId = 0;
- for (auto& bind: shard.BindedChannels) {
- TABLER() {
+ for (auto& bind: shard.BindedChannels) {
+ TABLER() {
TABLED() { str << channelId; }
- TABLED() { str << bind.GetStoragePoolName(); }
- }
+ TABLED() { str << bind.GetStoragePoolName(); }
+ }
++channelId;
- }
- }
- }
- }
-
- TString LinkToPathInfo(TPathId pathId) const {
- return TStringBuilder()
- << "<a href='../tablets/app?" << TCgi::TabletID.AsCgiParam(Self->TabletID())
- << "&" << TCgi::Page.AsCgiParam(TCgi::TPages::PathInfo)
- << "&" << TCgi::OwnerPathId.AsCgiParam(pathId.OwnerId)
- << "&" << TCgi::LocalPathId.AsCgiParam(pathId.LocalPathId)
- << "'>" << pathId <<"</a>";
- }
-
- TString LinkToShardInfo(TShardIdx shardIdx) const {
- return TStringBuilder()
- << "<a href='../tablets/app?" << TCgi::TabletID.AsCgiParam(Self->TabletID())
- << "&" << TCgi::Page.AsCgiParam(TCgi::TPages::ShardInfoByShardIdx)
- << "&" << TCgi::OwnerShardIdx.AsCgiParam(shardIdx.GetOwnerId())
- << "&" << TCgi::LocalShardIdx.AsCgiParam(shardIdx.GetLocalId())
- << "'>" << shardIdx <<"</a>";
- }
-
- TString LinkToTablet(TShardIdx shardIdx) const {
- if (Self->ShardInfos.contains(shardIdx)) {
- TTabletId tabletId = Self->ShardInfos.FindPtr(shardIdx)->TabletID;
- return TStringBuilder()
- << "<a href='../tablets?"
- << TCgi::TabletID.AsCgiParam(tabletId)
- << "'>" << tabletId <<"</a>";
- } else {
- return TStringBuilder()
- << "UNKNOWN_TABLET!";
- }
- }
-
- void OutputPathInfo(TPathId pathId, TStringStream& str) const {
- HTML(str) {
- if (!Self->PathsById.contains(pathId)) {
- H4() {
- str << "No path item for shard " << pathId << "</a>";
- }
- return;
- }
-
- auto& path = Self->PathsById.at(pathId);
-
- auto localACL = TSecurityObject(path->Owner, path->ACL, path->IsContainer());
- auto effectiveACL = TSecurityObject(path->Owner, path->CachedEffectiveACL.GetForSelf(), path->IsContainer());
-
- H4() {str << "Path info " << pathId << "</a>";}
- PRE () {
- str << "Path: " << Self->PathToString(path) << Endl
- << "PathId: " << pathId << Endl
- << "Parent Path Id: " << LinkToPathInfo(path->ParentPathId) << Endl
- << "Name: " << path->Name << Endl
- << "Owner: " << path->Owner << Endl
- << "ACL: " << localACL.ToString() << Endl
- << "ACLVersion: " << path->ACLVersion << Endl
- << "EffectiveACL: " << effectiveACL.ToString() << Endl
- << "Path Type: " << NKikimrSchemeOp::EPathType_Name(path->PathType) << Endl
- << "Path State: " << NKikimrSchemeOp::EPathState_Name(path->PathState) << Endl
- << "Created step: " << path->StepCreated << Endl
- << "Dropped step: " << path->StepDropped << Endl
- << "Created tx: " << path->CreateTxId << Endl
- << "Dropped tx: " << path->DropTxId << Endl
- << "Last tx: " << path->LastTxId << Endl
- << "Has PreSerializedChildrenListing: " << !path->PreSerializedChildrenListing.empty() << Endl
- << "Children count: " << path->GetChildren().size() << Endl
- << "Alive children count: " << path->GetAliveChildren() << Endl
- << "Dir alter version: " << path->DirAlterVersion << Endl
- << "User attrs alter version " << path->UserAttrs->AlterVersion << Endl
- << "User attrs count " << path->UserAttrs->Attrs.size() << Endl
- << "DbRefCount count " << path->DbRefCount << Endl
- << "ShardsInside count " << path->GetShardsInside() << Endl;
- }
-
- if (path->UserAttrs->Attrs) {
- H4() {str << "UserAttrs for pathId " << pathId << "</a>";}
- TABLE_SORTABLE_CLASS("UserAttrs") {
- TABLEHEAD() {
- TABLER() {
- TABLEH() {str << "Name";}
- TABLEH() {str << "Value";}
- }
- }
- for (auto& item: path->UserAttrs->Attrs) {
- TABLER() {
- TABLED() { str << item.first; }
- TABLED() { str << item.second; }
- }
- }
- }
- }
-
- if (path->GetChildren().size()) {
- H4() {str << "Childrens for pathId " << pathId << "</a>";}
- TABLE_SORTABLE_CLASS("UserAttrs") {
- TABLEHEAD() {
- TABLER() {
- TABLEH() {str << "Name";}
- TABLEH() {str << "PathId";}
- TABLEH() {str << "IsAlive";}
- }
- }
- for (auto& item: path->GetChildren()) {
- auto& child = Self->PathsById.at(item.second);
-
- TABLER() {
- TABLED() { str << item.first; }
- TABLED() {
- str << LinkToPathInfo(item.second);
- }
- TABLED() {
- str << (child->Dropped() ? "Deleted" : "Alive");
- }
- }
- }
- }
- }
-
- auto shards = Self->CollectAllShards({pathId});
-
- H4() {str << "Shards for pathId " << pathId << "</a>";}
- TABLE_SORTABLE_CLASS("ShardForPath") {
- TABLEHEAD() {
- TABLER() {
- TABLEH() {str << "ShardIdx";}
- TABLEH() {str << "TableId";}
- TABLEH() {str << "IsActive";}
- }
- }
-
- TPath path_ = TPath::Init(pathId, Self);
-
- for (const auto shardIdx: shards) {
- TABLER() {
- TABLED() {
- str << LinkToShardInfo(shardIdx);
- }
- TABLED() {
- str << LinkToTablet(shardIdx);
- }
- TABLED() {
- if (path->Dropped() || !path->IsTable() || !Self->Tables.contains(pathId)) {
- str << "path is dropped or is not a table";
- } else {
- const TTableInfo::TPtr table = Self->Tables.at(pathId);
- str << (table->GetShard2PartitionIdx().contains(shardIdx) ? "Active" : "Inactive");
- }
- }
- }
- }
- str << "\n";
- }
- }
- }
-
- void OutputOperationPartInfo(TOperationId opId, TStringStream& str) const {
- HTML(str) {
- if (!Self->Operations.contains(opId.GetTxId())) {
- H4() {
- str << "No operations for tx id " << opId << "</a>";
- }
- return;
- }
-
- TOperation::TPtr operation = Self->Operations.at(opId.GetTxId());
-
- if (ui64(opId.GetSubTxId()) >= operation->Parts.size()) {
- H4() {
- str << "No part operations for operation id " << opId << "</a>";
- }
- return;
- }
-
- if (!Self->TxInFlight.contains(opId)) {
- H4() {
- str << "No txInfly record for operation id " << opId << "</a>";
- }
- return;
- }
-
- const TTxState& txState = Self->TxInFlight.at(opId);
-
-
- H4() {str << "TxState info " << opId << "</a>";}
- PRE () {
- str << "TxType: " << TTxState::TypeName(txState.TxType) << Endl
- << "TargetPathId: " << LinkToPathInfo(txState.TargetPathId) << Endl
- << "SourcePathId: " << LinkToPathInfo(txState.SourcePathId) << Endl
- << "State: " << TTxState::StateName(txState.State) << Endl
- << "MinStep: " << txState.MinStep << Endl
- << "ReadyForNotifications: " << txState.ReadyForNotifications << Endl
+ }
+ }
+ }
+ }
+
+ TString LinkToPathInfo(TPathId pathId) const {
+ return TStringBuilder()
+ << "<a href='../tablets/app?" << TCgi::TabletID.AsCgiParam(Self->TabletID())
+ << "&" << TCgi::Page.AsCgiParam(TCgi::TPages::PathInfo)
+ << "&" << TCgi::OwnerPathId.AsCgiParam(pathId.OwnerId)
+ << "&" << TCgi::LocalPathId.AsCgiParam(pathId.LocalPathId)
+ << "'>" << pathId <<"</a>";
+ }
+
+ TString LinkToShardInfo(TShardIdx shardIdx) const {
+ return TStringBuilder()
+ << "<a href='../tablets/app?" << TCgi::TabletID.AsCgiParam(Self->TabletID())
+ << "&" << TCgi::Page.AsCgiParam(TCgi::TPages::ShardInfoByShardIdx)
+ << "&" << TCgi::OwnerShardIdx.AsCgiParam(shardIdx.GetOwnerId())
+ << "&" << TCgi::LocalShardIdx.AsCgiParam(shardIdx.GetLocalId())
+ << "'>" << shardIdx <<"</a>";
+ }
+
+ TString LinkToTablet(TShardIdx shardIdx) const {
+ if (Self->ShardInfos.contains(shardIdx)) {
+ TTabletId tabletId = Self->ShardInfos.FindPtr(shardIdx)->TabletID;
+ return TStringBuilder()
+ << "<a href='../tablets?"
+ << TCgi::TabletID.AsCgiParam(tabletId)
+ << "'>" << tabletId <<"</a>";
+ } else {
+ return TStringBuilder()
+ << "UNKNOWN_TABLET!";
+ }
+ }
+
+ void OutputPathInfo(TPathId pathId, TStringStream& str) const {
+ HTML(str) {
+ if (!Self->PathsById.contains(pathId)) {
+ H4() {
+ str << "No path item for shard " << pathId << "</a>";
+ }
+ return;
+ }
+
+ auto& path = Self->PathsById.at(pathId);
+
+ auto localACL = TSecurityObject(path->Owner, path->ACL, path->IsContainer());
+ auto effectiveACL = TSecurityObject(path->Owner, path->CachedEffectiveACL.GetForSelf(), path->IsContainer());
+
+ H4() {str << "Path info " << pathId << "</a>";}
+ PRE () {
+ str << "Path: " << Self->PathToString(path) << Endl
+ << "PathId: " << pathId << Endl
+ << "Parent Path Id: " << LinkToPathInfo(path->ParentPathId) << Endl
+ << "Name: " << path->Name << Endl
+ << "Owner: " << path->Owner << Endl
+ << "ACL: " << localACL.ToString() << Endl
+ << "ACLVersion: " << path->ACLVersion << Endl
+ << "EffectiveACL: " << effectiveACL.ToString() << Endl
+ << "Path Type: " << NKikimrSchemeOp::EPathType_Name(path->PathType) << Endl
+ << "Path State: " << NKikimrSchemeOp::EPathState_Name(path->PathState) << Endl
+ << "Created step: " << path->StepCreated << Endl
+ << "Dropped step: " << path->StepDropped << Endl
+ << "Created tx: " << path->CreateTxId << Endl
+ << "Dropped tx: " << path->DropTxId << Endl
+ << "Last tx: " << path->LastTxId << Endl
+ << "Has PreSerializedChildrenListing: " << !path->PreSerializedChildrenListing.empty() << Endl
+ << "Children count: " << path->GetChildren().size() << Endl
+ << "Alive children count: " << path->GetAliveChildren() << Endl
+ << "Dir alter version: " << path->DirAlterVersion << Endl
+ << "User attrs alter version " << path->UserAttrs->AlterVersion << Endl
+ << "User attrs count " << path->UserAttrs->Attrs.size() << Endl
+ << "DbRefCount count " << path->DbRefCount << Endl
+ << "ShardsInside count " << path->GetShardsInside() << Endl;
+ }
+
+ if (path->UserAttrs->Attrs) {
+ H4() {str << "UserAttrs for pathId " << pathId << "</a>";}
+ TABLE_SORTABLE_CLASS("UserAttrs") {
+ TABLEHEAD() {
+ TABLER() {
+ TABLEH() {str << "Name";}
+ TABLEH() {str << "Value";}
+ }
+ }
+ for (auto& item: path->UserAttrs->Attrs) {
+ TABLER() {
+ TABLED() { str << item.first; }
+ TABLED() { str << item.second; }
+ }
+ }
+ }
+ }
+
+ if (path->GetChildren().size()) {
+ H4() {str << "Childrens for pathId " << pathId << "</a>";}
+ TABLE_SORTABLE_CLASS("UserAttrs") {
+ TABLEHEAD() {
+ TABLER() {
+ TABLEH() {str << "Name";}
+ TABLEH() {str << "PathId";}
+ TABLEH() {str << "IsAlive";}
+ }
+ }
+ for (auto& item: path->GetChildren()) {
+ auto& child = Self->PathsById.at(item.second);
+
+ TABLER() {
+ TABLED() { str << item.first; }
+ TABLED() {
+ str << LinkToPathInfo(item.second);
+ }
+ TABLED() {
+ str << (child->Dropped() ? "Deleted" : "Alive");
+ }
+ }
+ }
+ }
+ }
+
+ auto shards = Self->CollectAllShards({pathId});
+
+ H4() {str << "Shards for pathId " << pathId << "</a>";}
+ TABLE_SORTABLE_CLASS("ShardForPath") {
+ TABLEHEAD() {
+ TABLER() {
+ TABLEH() {str << "ShardIdx";}
+ TABLEH() {str << "TableId";}
+ TABLEH() {str << "IsActive";}
+ }
+ }
+
+ TPath path_ = TPath::Init(pathId, Self);
+
+ for (const auto shardIdx: shards) {
+ TABLER() {
+ TABLED() {
+ str << LinkToShardInfo(shardIdx);
+ }
+ TABLED() {
+ str << LinkToTablet(shardIdx);
+ }
+ TABLED() {
+ if (path->Dropped() || !path->IsTable() || !Self->Tables.contains(pathId)) {
+ str << "path is dropped or is not a table";
+ } else {
+ const TTableInfo::TPtr table = Self->Tables.at(pathId);
+ str << (table->GetShard2PartitionIdx().contains(shardIdx) ? "Active" : "Inactive");
+ }
+ }
+ }
+ }
+ str << "\n";
+ }
+ }
+ }
+
+ void OutputOperationPartInfo(TOperationId opId, TStringStream& str) const {
+ HTML(str) {
+ if (!Self->Operations.contains(opId.GetTxId())) {
+ H4() {
+ str << "No operations for tx id " << opId << "</a>";
+ }
+ return;
+ }
+
+ TOperation::TPtr operation = Self->Operations.at(opId.GetTxId());
+
+ if (ui64(opId.GetSubTxId()) >= operation->Parts.size()) {
+ H4() {
+ str << "No part operations for operation id " << opId << "</a>";
+ }
+ return;
+ }
+
+ if (!Self->TxInFlight.contains(opId)) {
+ H4() {
+ str << "No txInfly record for operation id " << opId << "</a>";
+ }
+ return;
+ }
+
+ const TTxState& txState = Self->TxInFlight.at(opId);
+
+
+ H4() {str << "TxState info " << opId << "</a>";}
+ PRE () {
+ str << "TxType: " << TTxState::TypeName(txState.TxType) << Endl
+ << "TargetPathId: " << LinkToPathInfo(txState.TargetPathId) << Endl
+ << "SourcePathId: " << LinkToPathInfo(txState.SourcePathId) << Endl
+ << "State: " << TTxState::StateName(txState.State) << Endl
+ << "MinStep: " << txState.MinStep << Endl
+ << "ReadyForNotifications: " << txState.ReadyForNotifications << Endl
<< "DataTotalSize: " << txState.DataTotalSize << Endl
- << "TxShardsListFinalized: " << txState.TxShardsListFinalized << Endl
- << "SchemeOpSeqNo: " << txState.SchemeOpSeqNo.Generation << ":" << txState.SchemeOpSeqNo.Round << Endl
- << "StartTime: " << txState.StartTime << Endl
- << "Shards count: " << txState.Shards.size() << Endl
- << "Shards in progress count: " << txState.ShardsInProgress.size() << Endl
- << "SchemeChangeNotificationReceived count: " << txState.SchemeChangeNotificationReceived.size() << Endl
- << "SplitDescription: " << (txState.SplitDescription ? txState.SplitDescription->ShortDebugString() : "") << Endl
- << "Dependent operations count: " << operation->DependentOperations.size() << Endl
- << "Wait operations count: " << operation->WaitOperations.size() << Endl;
- }
-
- H4() {str << "Dependent operations for txId " << opId.GetTxId() << "</a>";}
- TABLE_SORTABLE_CLASS("DependentTxId") {
- TABLEHEAD() {
- TABLER() {
- TABLEH() {str << "TxId";}
- }
- }
- for (auto& txId: operation->DependentOperations) {
- TABLER() {
- TABLED() { str << txId; }
- }
- }
- }
-
- H4() {str << "Wait operations for txId " << opId.GetTxId() << "</a>";}
- TABLE_SORTABLE_CLASS("WaitTxId") {
- TABLEHEAD() {
- TABLER() {
- TABLEH() {str << "TxId";}
- }
- }
- for (auto& txId: operation->WaitOperations) {
- TABLER() {
- TABLED() { str << txId; }
- }
- }
- }
-
-
- H4() {str << "Shards for opId " << opId << "</a>";}
- TABLE_SORTABLE_CLASS("Shards") {
- TABLEHEAD() {
- TABLER() {
- TABLEH() {str << "ShardId";}
- TABLEH() {str << "TabletType";}
- TABLEH() {str << "Operation";}
- TABLEH() {str << "RangeEnd";}
- }
- }
- ui32 maxItems = 100;
- for (auto& item: txState.Shards) {
- if (0 == maxItems) { break; }
- --maxItems;
- TABLER() {
- TABLED() { str << item.Idx; }
- TABLED() { str << TTabletTypes::TypeToStr(item.TabletType); }
- TABLED() { str << TTxState::StateName(item.Operation); }
- TABLED() { str << item.RangeEnd; }
- }
- }
- }
-
- H4() {str << "Shards in progress for opId " << opId << "</a>";}
- TABLE_SORTABLE_CLASS("Shards") {
- TABLEHEAD() {
- TABLER() {
- TABLEH() {str << "ShardId";}
- }
- }
- ui32 maxItems = 100;
- for (auto& shardId: txState.ShardsInProgress) {
- if (0 == maxItems) { break; }
- --maxItems;
- TABLER() {
- TABLED() { str << shardId; }
- }
- }
- }
-
- H4() {str << "SchemeChangeNotificationReceived for opId " << opId << "</a>";}
- TABLE_SORTABLE_CLASS("SchemeChangeNotificationReceived") {
- TABLEHEAD() {
- TABLER() {
- TABLEH() {str << "ShardId";}
- }
- }
- ui32 maxItems = 100;
- for (auto& item: txState.SchemeChangeNotificationReceived) {
- if (0 == maxItems) { break; }
- --maxItems;
- TABLER() {
- TABLED() { str << item.first; }
- }
- }
- }
-
+ << "TxShardsListFinalized: " << txState.TxShardsListFinalized << Endl
+ << "SchemeOpSeqNo: " << txState.SchemeOpSeqNo.Generation << ":" << txState.SchemeOpSeqNo.Round << Endl
+ << "StartTime: " << txState.StartTime << Endl
+ << "Shards count: " << txState.Shards.size() << Endl
+ << "Shards in progress count: " << txState.ShardsInProgress.size() << Endl
+ << "SchemeChangeNotificationReceived count: " << txState.SchemeChangeNotificationReceived.size() << Endl
+ << "SplitDescription: " << (txState.SplitDescription ? txState.SplitDescription->ShortDebugString() : "") << Endl
+ << "Dependent operations count: " << operation->DependentOperations.size() << Endl
+ << "Wait operations count: " << operation->WaitOperations.size() << Endl;
+ }
+
+ H4() {str << "Dependent operations for txId " << opId.GetTxId() << "</a>";}
+ TABLE_SORTABLE_CLASS("DependentTxId") {
+ TABLEHEAD() {
+ TABLER() {
+ TABLEH() {str << "TxId";}
+ }
+ }
+ for (auto& txId: operation->DependentOperations) {
+ TABLER() {
+ TABLED() { str << txId; }
+ }
+ }
+ }
+
+ H4() {str << "Wait operations for txId " << opId.GetTxId() << "</a>";}
+ TABLE_SORTABLE_CLASS("WaitTxId") {
+ TABLEHEAD() {
+ TABLER() {
+ TABLEH() {str << "TxId";}
+ }
+ }
+ for (auto& txId: operation->WaitOperations) {
+ TABLER() {
+ TABLED() { str << txId; }
+ }
+ }
+ }
+
+
+ H4() {str << "Shards for opId " << opId << "</a>";}
+ TABLE_SORTABLE_CLASS("Shards") {
+ TABLEHEAD() {
+ TABLER() {
+ TABLEH() {str << "ShardId";}
+ TABLEH() {str << "TabletType";}
+ TABLEH() {str << "Operation";}
+ TABLEH() {str << "RangeEnd";}
+ }
+ }
+ ui32 maxItems = 100;
+ for (auto& item: txState.Shards) {
+ if (0 == maxItems) { break; }
+ --maxItems;
+ TABLER() {
+ TABLED() { str << item.Idx; }
+ TABLED() { str << TTabletTypes::TypeToStr(item.TabletType); }
+ TABLED() { str << TTxState::StateName(item.Operation); }
+ TABLED() { str << item.RangeEnd; }
+ }
+ }
+ }
+
+ H4() {str << "Shards in progress for opId " << opId << "</a>";}
+ TABLE_SORTABLE_CLASS("Shards") {
+ TABLEHEAD() {
+ TABLER() {
+ TABLEH() {str << "ShardId";}
+ }
+ }
+ ui32 maxItems = 100;
+ for (auto& shardId: txState.ShardsInProgress) {
+ if (0 == maxItems) { break; }
+ --maxItems;
+ TABLER() {
+ TABLED() { str << shardId; }
+ }
+ }
+ }
+
+ H4() {str << "SchemeChangeNotificationReceived for opId " << opId << "</a>";}
+ TABLE_SORTABLE_CLASS("SchemeChangeNotificationReceived") {
+ TABLEHEAD() {
+ TABLER() {
+ TABLEH() {str << "ShardId";}
+ }
+ }
+ ui32 maxItems = 100;
+ for (auto& item: txState.SchemeChangeNotificationReceived) {
+ if (0 == maxItems) { break; }
+ --maxItems;
+ TABLER() {
+ TABLED() { str << item.first; }
+ }
+ }
+ }
+
H4() {str << "ShardStatuses for opId " << opId << "</a>";}
TABLE_SORTABLE_CLASS("ShardStatuses") {
- TABLEHEAD() {
- TABLER() {
- TABLEH() {str << "ShardId";}
+ TABLEHEAD() {
+ TABLER() {
+ TABLEH() {str << "ShardId";}
TABLEH() {str << "Success";}
- TABLEH() {str << "Error";}
+ TABLEH() {str << "Error";}
TABLEH() {str << "BytesProcessed";}
TABLEH() {str << "RowsProcessed";}
- }
- }
- ui32 maxItems = 10;
+ }
+ }
+ ui32 maxItems = 10;
for (auto& item: txState.ShardStatuses) {
- if (0 == maxItems) { break; }
- --maxItems;
- TABLER() {
- TABLED() { str << item.first; }
+ if (0 == maxItems) { break; }
+ --maxItems;
+ TABLER() {
+ TABLED() { str << item.first; }
TABLED() { str << item.second.Success; }
TABLED() { str << item.second.Error; }
TABLED() { str << item.second.BytesProcessed; }
TABLED() { str << item.second.RowsProcessed; }
- }
- }
- }
- }
- }
-
- void OutputOperationInfo(TTxId txId, TStringStream& str) const {
- HTML(str) {
- if (!Self->Operations.contains(txId)) {
- H4() {
- str << "No operations for tx id " << txId << "</a>";
- }
- return;
- }
-
- TOperation::TPtr operation = Self->Operations.at(txId);
- for (ui32 partId = 0; partId < operation->Parts.size(); ++partId) {
- OutputOperationPartInfo(TOperationId(txId, partId), str);
- }
- }
- }
-
- void OutputPathInfoPage(TPathId pathId, TStringStream& str) {
- HTML(str) {
- if (!Self->PathsById.contains(pathId)) {
- H4() {
- str << "No path item for tablet " << pathId << "</a>";
- }
- return;
- }
-
- OutputPathInfo(pathId, str);
-
- auto& path = Self->PathsById.at(pathId);
-
- if (Self->Operations.contains(path->LastTxId)) {
- OutputOperationInfo(path->LastTxId, str);
- }
-
- //add path specific object
- }
- }
- void OutputShardInfoPageByShardIdx(TShardIdx shardIdx, TStringStream& str) const {
- HTML(str) {
+ }
+ }
+ }
+ }
+ }
+
+ void OutputOperationInfo(TTxId txId, TStringStream& str) const {
+ HTML(str) {
+ if (!Self->Operations.contains(txId)) {
+ H4() {
+ str << "No operations for tx id " << txId << "</a>";
+ }
+ return;
+ }
+
+ TOperation::TPtr operation = Self->Operations.at(txId);
+ for (ui32 partId = 0; partId < operation->Parts.size(); ++partId) {
+ OutputOperationPartInfo(TOperationId(txId, partId), str);
+ }
+ }
+ }
+
+ void OutputPathInfoPage(TPathId pathId, TStringStream& str) {
+ HTML(str) {
+ if (!Self->PathsById.contains(pathId)) {
+ H4() {
+ str << "No path item for tablet " << pathId << "</a>";
+ }
+ return;
+ }
+
+ OutputPathInfo(pathId, str);
+
+ auto& path = Self->PathsById.at(pathId);
+
+ if (Self->Operations.contains(path->LastTxId)) {
+ OutputOperationInfo(path->LastTxId, str);
+ }
+
+ //add path specific object
+ }
+ }
+ void OutputShardInfoPageByShardIdx(TShardIdx shardIdx, TStringStream& str) const {
+ HTML(str) {
if (!Self->ShardInfos.contains(shardIdx)) {
H4() {
- str << "No shard info for shard idx " << shardIdx;
+ str << "No shard info for shard idx " << shardIdx;
}
return;
}
- OutputShardInfo(shardIdx, str);
-
+ OutputShardInfo(shardIdx, str);
+
const TShardInfo& shard = Self->ShardInfos[shardIdx];
-
+
if (!Self->PathsById.contains(shard.PathId)) {
H4() {
- str << "No path item path id " << shard.PathId;
+ str << "No path item path id " << shard.PathId;
}
return;
}
- OutputPathInfo(shard.PathId, str);
+ OutputPathInfo(shard.PathId, str);
- if (Self->Operations.contains(shard.CurrentTxId)) {
- OutputOperationInfo(shard.CurrentTxId, str);
+ if (Self->Operations.contains(shard.CurrentTxId)) {
+ OutputOperationInfo(shard.CurrentTxId, str);
}
}
}
- void OutputShardInfoPageByShardID(TTabletId tabletId, TStringStream& str) const {
- HTML(str) {
- if (!Self->TabletIdToShardIdx.contains(tabletId)) {
- H4() {
- str << "No shard info for shard ID "
- << "<a href='../tablets?TabletID=" << tabletId << "'>" << tabletId << "</a>";
- }
- return;
- }
-
- TShardIdx shardIdx = Self->TabletIdToShardIdx[tabletId];
- OutputShardInfoPageByShardIdx(shardIdx, str);
- }
- }
-
+ void OutputShardInfoPageByShardID(TTabletId tabletId, TStringStream& str) const {
+ HTML(str) {
+ if (!Self->TabletIdToShardIdx.contains(tabletId)) {
+ H4() {
+ str << "No shard info for shard ID "
+ << "<a href='../tablets?TabletID=" << tabletId << "'>" << tabletId << "</a>";
+ }
+ return;
+ }
+
+ TShardIdx shardIdx = Self->TabletIdToShardIdx[tabletId];
+ OutputShardInfoPageByShardIdx(shardIdx, str);
+ }
+ }
+
TTxType GetTxType() const override { return TXTYPE_MONITORING; }
};
-bool TSchemeShard::OnRenderAppHtmlPage(NMon::TEvRemoteHttpInfo::TPtr ev, const TActorContext &ctx) {
+bool TSchemeShard::OnRenderAppHtmlPage(NMon::TEvRemoteHttpInfo::TPtr ev, const TActorContext &ctx) {
if (!Executor() || !Executor()->GetStats().IsActive)
return false;
diff --git a/ydb/core/tx/schemeshard/schemeshard__notify.cpp b/ydb/core/tx/schemeshard/schemeshard__notify.cpp
index 0893fb7fe3c..d390367947a 100644
--- a/ydb/core/tx/schemeshard/schemeshard__notify.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__notify.cpp
@@ -3,26 +3,26 @@
#include <ydb/core/base/appdata.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TTxNotifyCompletion : public TSchemeShard::TRwTxBase {
- TEvSchemeShard::TEvNotifyTxCompletion::TPtr Ev;
+struct TSchemeShard::TTxNotifyCompletion : public TSchemeShard::TRwTxBase {
+ TEvSchemeShard::TEvNotifyTxCompletion::TPtr Ev;
TAutoPtr<IEventBase> Result;
- TTxNotifyCompletion(TSelf *self, TEvSchemeShard::TEvNotifyTxCompletion::TPtr &ev)
- : TRwTxBase(self)
+ TTxNotifyCompletion(TSelf *self, TEvSchemeShard::TEvNotifyTxCompletion::TPtr &ev)
+ : TRwTxBase(self)
, Ev(ev)
{}
void DoExecute(TTransactionContext &txc, const TActorContext &ctx) override {
Y_UNUSED(txc);
Y_UNUSED(ctx);
- auto rawTxId = Ev->Get()->Record.GetTxId();
+ auto rawTxId = Ev->Get()->Record.GetTxId();
- if (Self->Operations.contains(TTxId(rawTxId))) {
- auto txId = TTxId(rawTxId);
+ if (Self->Operations.contains(TTxId(rawTxId))) {
+ auto txId = TTxId(rawTxId);
LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"NotifyTxCompletion"
<< " operation in-flight"
@@ -36,44 +36,44 @@ struct TSchemeShard::TTxNotifyCompletion : public TSchemeShard::TRwTxBase {
<< ", operation is ready to notificate"
<< ", txId: " << txId
<< ", at schemeshard: " << Self->TabletID());
- Result = new TEvSchemeShard::TEvNotifyTxCompletionResult(ui64(txId));
+ Result = new TEvSchemeShard::TEvNotifyTxCompletionResult(ui64(txId));
return;
}
operation->AddNotifySubscriber(Ev->Sender);
- Result = new TEvSchemeShard::TEvNotifyTxCompletionRegistered(ui64(txId));
- } else if (Self->Publications.contains(TTxId(rawTxId))) {
- auto txId = TTxId(rawTxId);
+ Result = new TEvSchemeShard::TEvNotifyTxCompletionRegistered(ui64(txId));
+ } else if (Self->Publications.contains(TTxId(rawTxId))) {
+ auto txId = TTxId(rawTxId);
LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"NotifyTxCompletion"
<< " publication in-flight"
- << ", count: " << Self->Publications.at(txId).Paths.size()
+ << ", count: " << Self->Publications.at(txId).Paths.size()
<< ", txId: " << txId
<< ", at schemeshard: " << Self->TabletID());
Self->Publications.at(txId).Subscribers.insert(Ev->Sender);
- Result = new TEvSchemeShard::TEvNotifyTxCompletionRegistered(ui64(txId));
- } else if (Self->Exports.contains(rawTxId)) {
- auto txId = rawTxId;
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "NotifyTxCompletion"
- << " export in-flight"
- << ", txId: " << txId
- << ", at schemeshard: " << Self->TabletID());
-
- TExportInfo::TPtr exportInfo = Self->Exports.at(txId);
- if (exportInfo->IsFinished()) {
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "NotifyTxCompletion"
- << ", export is ready to notificate"
- << ", txId: " << txId
- << ", at schemeshard: " << Self->TabletID());
- Result = new TEvSchemeShard::TEvNotifyTxCompletionResult(txId);
- return;
- }
-
- exportInfo->AddNotifySubscriber(Ev->Sender);
- Result = new TEvSchemeShard::TEvNotifyTxCompletionRegistered(ui64(txId));
+ Result = new TEvSchemeShard::TEvNotifyTxCompletionRegistered(ui64(txId));
+ } else if (Self->Exports.contains(rawTxId)) {
+ auto txId = rawTxId;
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "NotifyTxCompletion"
+ << " export in-flight"
+ << ", txId: " << txId
+ << ", at schemeshard: " << Self->TabletID());
+
+ TExportInfo::TPtr exportInfo = Self->Exports.at(txId);
+ if (exportInfo->IsFinished()) {
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "NotifyTxCompletion"
+ << ", export is ready to notificate"
+ << ", txId: " << txId
+ << ", at schemeshard: " << Self->TabletID());
+ Result = new TEvSchemeShard::TEvNotifyTxCompletionResult(txId);
+ return;
+ }
+
+ exportInfo->AddNotifySubscriber(Ev->Sender);
+ Result = new TEvSchemeShard::TEvNotifyTxCompletionRegistered(ui64(txId));
} else if (Self->Imports.contains(rawTxId)) {
auto txId = rawTxId;
LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
@@ -89,49 +89,49 @@ struct TSchemeShard::TTxNotifyCompletion : public TSchemeShard::TRwTxBase {
<< ", import is ready to notificate"
<< ", txId: " << txId
<< ", at schemeshard: " << Self->TabletID());
- Result = new TEvSchemeShard::TEvNotifyTxCompletionResult(txId);
+ Result = new TEvSchemeShard::TEvNotifyTxCompletionResult(txId);
return;
}
importInfo->AddNotifySubscriber(Ev->Sender);
- Result = new TEvSchemeShard::TEvNotifyTxCompletionRegistered(ui64(txId));
- } else if (Self->IndexBuilds.contains(TIndexBuildId(rawTxId))) {
- auto txId = TIndexBuildId(rawTxId);
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "NotifyTxCompletion"
- << " index build in-flight"
- << ", txId: " << txId
- << ", at schemeshard: " << Self->TabletID());
-
- TIndexBuildInfo::TPtr indexInfo = Self->IndexBuilds.at(txId);
- if (indexInfo->IsFinished()) {
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "NotifyTxCompletion"
- << ", index build is ready to notificate"
- << ", txId: " << txId
- << ", at schemeshard: " << Self->TabletID());
- Result = new TEvSchemeShard::TEvNotifyTxCompletionResult(ui64(txId));
- return;
- }
-
- indexInfo->AddNotifySubscriber(Ev->Sender);
- Result = new TEvSchemeShard::TEvNotifyTxCompletionRegistered(ui64(txId));
+ Result = new TEvSchemeShard::TEvNotifyTxCompletionRegistered(ui64(txId));
+ } else if (Self->IndexBuilds.contains(TIndexBuildId(rawTxId))) {
+ auto txId = TIndexBuildId(rawTxId);
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "NotifyTxCompletion"
+ << " index build in-flight"
+ << ", txId: " << txId
+ << ", at schemeshard: " << Self->TabletID());
+
+ TIndexBuildInfo::TPtr indexInfo = Self->IndexBuilds.at(txId);
+ if (indexInfo->IsFinished()) {
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "NotifyTxCompletion"
+ << ", index build is ready to notificate"
+ << ", txId: " << txId
+ << ", at schemeshard: " << Self->TabletID());
+ Result = new TEvSchemeShard::TEvNotifyTxCompletionResult(ui64(txId));
+ return;
+ }
+
+ indexInfo->AddNotifySubscriber(Ev->Sender);
+ Result = new TEvSchemeShard::TEvNotifyTxCompletionRegistered(ui64(txId));
} else {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "NotifyTxCompletion"
- << ", unknown transaction"
- << ", txId: " << rawTxId
- << ", at schemeshard: " << Self->TabletID());
- Result = new TEvSchemeShard::TEvNotifyTxCompletionResult(rawTxId);
- return;
- }
-
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "NotifyTxCompletion"
- << " transaction is registered"
- << ", txId: " << rawTxId
- << ", at schemeshard: " << Self->TabletID());
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "NotifyTxCompletion"
+ << ", unknown transaction"
+ << ", txId: " << rawTxId
+ << ", at schemeshard: " << Self->TabletID());
+ Result = new TEvSchemeShard::TEvNotifyTxCompletionResult(rawTxId);
+ return;
+ }
+
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "NotifyTxCompletion"
+ << " transaction is registered"
+ << ", txId: " << rawTxId
+ << ", at schemeshard: " << Self->TabletID());
}
void DoComplete(const TActorContext &ctx) override {
@@ -141,7 +141,7 @@ struct TSchemeShard::TTxNotifyCompletion : public TSchemeShard::TRwTxBase {
}
};
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxNotifyTxCompletion(TEvSchemeShard::TEvNotifyTxCompletion::TPtr &ev) {
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxNotifyTxCompletion(TEvSchemeShard::TEvNotifyTxCompletion::TPtr &ev) {
return new TTxNotifyCompletion(this, ev);
}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation.cpp b/ydb/core/tx/schemeshard/schemeshard__operation.cpp
index 96a16f5c786..daf1218bcf7 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation.cpp
@@ -1,486 +1,486 @@
-#include "schemeshard__operation.h"
-
-#include "schemeshard__operation_side_effects.h"
-#include "schemeshard__operation_memory_changes.h"
-#include "schemeshard__operation_db_changes.h"
-
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation.h"
+
+#include "schemeshard__operation_side_effects.h"
+#include "schemeshard__operation_memory_changes.h"
+#include "schemeshard__operation_db_changes.h"
+
+#include "schemeshard_impl.h"
+
#include <ydb/core/tablet/tablet_exception.h>
#include <ydb/core/tablet_flat/flat_cxx_database.h>
#include <ydb/core/tablet_flat/tablet_flat_executor.h>
-
+
#include <util/generic/algorithm.h>
-namespace NKikimr {
-namespace NSchemeShard {
-
-using namespace NTabletFlatExecutor;
-
-struct TSchemeShard::TTxOperationProposeCancelTx: public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
- TEvSchemeShard::TEvCancelTx::TPtr Ev;
-
- TSideEffects OnComplete;
- TMemoryChanges MemChanges;
- TStorageChanges DbChanges;
-
- TTxOperationProposeCancelTx(TSchemeShard* self, TEvSchemeShard::TEvCancelTx::TPtr ev)
- : TBase(self)
+namespace NKikimr {
+namespace NSchemeShard {
+
+using namespace NTabletFlatExecutor;
+
+struct TSchemeShard::TTxOperationProposeCancelTx: public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
+ TEvSchemeShard::TEvCancelTx::TPtr Ev;
+
+ TSideEffects OnComplete;
+ TMemoryChanges MemChanges;
+ TStorageChanges DbChanges;
+
+ TTxOperationProposeCancelTx(TSchemeShard* self, TEvSchemeShard::TEvCancelTx::TPtr ev)
+ : TBase(self)
, Ev(ev)
- {}
-
+ {}
+
TTxType GetTxType() const override { return TXTYPE_CANCEL_BACKUP_IMPL; }
-
- bool Execute(NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx) override {
+
+ bool Execute(NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx) override {
const auto& record = Ev->Get()->Record;
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"TTxOperationProposeCancelTx Execute"
- << ", at schemeshard: " << Self->TabletID()
- << ", message: " << record.ShortDebugString());
-
- txc.DB.NoMoreReadsForTx();
-
+ << ", at schemeshard: " << Self->TabletID()
+ << ", message: " << record.ShortDebugString());
+
+ txc.DB.NoMoreReadsForTx();
+
ISubOperationBase::TPtr part = CreateTxCancelTx(Ev);
- TOperationContext context{Self, txc, ctx, OnComplete, MemChanges, DbChanges};
- auto fakeResponse = part->Propose(TString(), context);
- Y_UNUSED(fakeResponse);
-
- OnComplete.ApplyOnExecute(Self, txc, ctx);
- DbChanges.Apply(Self, txc, ctx);
- return true;
- }
-
- void Complete(const TActorContext& ctx) override {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ TOperationContext context{Self, txc, ctx, OnComplete, MemChanges, DbChanges};
+ auto fakeResponse = part->Propose(TString(), context);
+ Y_UNUSED(fakeResponse);
+
+ OnComplete.ApplyOnExecute(Self, txc, ctx);
+ DbChanges.Apply(Self, txc, ctx);
+ return true;
+ }
+
+ void Complete(const TActorContext& ctx) override {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"TTxOperationProposeCancelTx Complete"
- << ", at schemeshard: " << Self->TabletID());
-
- OnComplete.ApplyOnComplete(Self, ctx);
- }
-};
-
-NKikimrScheme::TEvModifySchemeTransaction GetRecordForPrint(const NKikimrScheme::TEvModifySchemeTransaction& record) {
- auto recordForPrint = record;
- if (record.HasUserToken()) {
- recordForPrint.SetUserToken("***hide token***");
- }
- return recordForPrint;
-}
-
-THolder<TProposeResponse> TSchemeShard::IgniteOperation(TProposeRequest& request, TOperationContext& context) {
- THolder<TProposeResponse> response = nullptr;
-
- auto selfId = SelfTabletId();
- auto& record = request.Record;
- auto txId = TTxId(record.GetTxId());
-
- if (Operations.contains(txId)) {
- response.Reset(new TEvSchemeShard::TEvModifySchemeTransactionResult(
- NKikimrScheme::StatusAccepted, ui64(txId), ui64(selfId)));
-
+ << ", at schemeshard: " << Self->TabletID());
+
+ OnComplete.ApplyOnComplete(Self, ctx);
+ }
+};
+
+NKikimrScheme::TEvModifySchemeTransaction GetRecordForPrint(const NKikimrScheme::TEvModifySchemeTransaction& record) {
+ auto recordForPrint = record;
+ if (record.HasUserToken()) {
+ recordForPrint.SetUserToken("***hide token***");
+ }
+ return recordForPrint;
+}
+
+THolder<TProposeResponse> TSchemeShard::IgniteOperation(TProposeRequest& request, TOperationContext& context) {
+ THolder<TProposeResponse> response = nullptr;
+
+ auto selfId = SelfTabletId();
+ auto& record = request.Record;
+ auto txId = TTxId(record.GetTxId());
+
+ if (Operations.contains(txId)) {
+ response.Reset(new TEvSchemeShard::TEvModifySchemeTransactionResult(
+ NKikimrScheme::StatusAccepted, ui64(txId), ui64(selfId)));
+
response->SetError(NKikimrScheme::StatusAccepted, "There is operation with the same txId has been found in flight. Actually that shouldn't have happened."
- " Note that tx body equality isn't granted. StatusAccepted is just returned on retries.");
- return std::move(response);
- }
-
- TOperation::TPtr operation = new TOperation(txId);
- Operations[operation->GetTxId()] = operation; //record is erased at ApplyOnExecute if all parts are done at propose
-
- if (record.GetUserToken()) {
- NACLibProto::TUserToken tokenPb;
- bool parseOk = tokenPb.ParseFromString(record.GetUserToken());
- if (!parseOk) {
- response.Reset(new TEvSchemeShard::TEvModifySchemeTransactionResult(
- NKikimrScheme::StatusInvalidParameter, ui64(txId), ui64(selfId)));
- response->SetError(NKikimrScheme::StatusInvalidParameter, "Failed to parse user token");
- return std::move(response);
- }
- context.UserToken.Reset(new NACLib::TUserToken(tokenPb));
- }
-
- if (!EnableSchemeTransactionsAtSchemeShard && record.TransactionSize() > 1) {
- response.Reset(new TEvSchemeShard::TEvModifySchemeTransactionResult(
- NKikimrScheme::StatusInvalidParameter, ui64(txId), ui64(selfId)));
- response->SetError(NKikimrScheme::StatusInvalidParameter,
- "Do not accept several transactions as one until EnableSchemeTransactionsAtSchemeShard isn't set");
- Operations.erase(operation->GetTxId());
- return std::move(response);
- }
-
- for (const auto& transaction: record.GetTransaction()) {
- auto quotaResult = operation->ConsumeQuota(transaction, context);
- if (quotaResult.Status != NKikimrScheme::StatusSuccess) {
- response.Reset(new TEvSchemeShard::TEvModifySchemeTransactionResult(
- quotaResult.Status, ui64(txId), ui64(selfId)));
- response->SetError(quotaResult.Status, quotaResult.Reason);
- Operations.erase(operation->GetTxId());
- return std::move(response);
- }
- }
-
- if (record.HasFailOnExist()) {
- // inherit FailOnExist from TEvModifySchemeTransaction into TModifyScheme
- for (auto transaction: *record.MutableTransaction()) {
- if (!transaction.HasFailOnExist()) {
- transaction.SetFailOnExist(record.GetFailOnExist());
- }
- }
- }
-
- TVector<TTxTransaction> transactions;
- for (const auto& transaction: record.GetTransaction()) {
- auto splitResult = operation->SplitIntoTransactions(transaction, context);
- if (splitResult.Status != NKikimrScheme::StatusSuccess) {
- response.Reset(new TEvSchemeShard::TEvModifySchemeTransactionResult(
- splitResult.Status, ui64(txId), ui64(selfId)));
- response->SetError(splitResult.Status, splitResult.Reason);
- Operations.erase(operation->GetTxId());
- return std::move(response);
- }
-
- transactions.insert(transactions.end(), splitResult.Transactions.begin(), splitResult.Transactions.end());
- }
-
- //for all tx in transactions
- for (const auto& transaction: transactions) {
- const TOperationId pathOpId = TOperationId(txId, operation->Parts.size());
- TVector<ISubOperationBase::TPtr> parts = operation->ConstructParts(transaction, context);
-
- if (parts.size() > 1) {
- // les't allow altering impl index tables as part of consistent operation
- context.IsAllowedPrivateTables = true;
- }
-
- const TString owner = record.HasOwner() ? record.GetOwner() : BUILTIN_ACL_ROOT;
-
- for (auto& part: parts) {
- response = part->Propose(owner, context);
- Y_VERIFY(response);
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "IgniteOperation"
- << ", opId: " << pathOpId
- << ", propose status:" << NKikimrScheme::EStatus_Name(response->Record.GetStatus())
- << ", reason: " << response->Record.GetReason()
- << ", at schemeshard: " << selfId);
-
- if (response->IsDone()) {
- operation->AddPart(part); //at ApplyOnExecute parts is erased
- context.OnComplete.DoneOperation(pathOpId); //mark it here by self for sure
- } else if (response->IsConditionalAccepted()) {
- //happens on retries, we answer like AlreadyExist or StatusSuccess with error message and do nothing in operation
- operation->AddPart(part); //at ApplyOnExecute parts is erased
- context.OnComplete.DoneOperation(pathOpId); //mark it here by self for sure
- } else if (response->IsAccepted()) {
- operation->AddPart(part);
- //context.OnComplete.ActivateTx(pathOpId) ///TODO maybe it is good idea
- } else {
-
-
-
- if (!operation->Parts.empty()) {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Abort operation: IgniteOperation fail to propose a part"
- << ", opId: " << pathOpId
- << ", at schemeshard: " << selfId
- << ", already assepted parts: " << operation->Parts.size()
- << ", propose result status: " << NKikimrScheme::EStatus_Name(response->Record.GetStatus())
- << ", with reason: " << response->Record.GetReason()
- << ", tx message: " << GetRecordForPrint(record).ShortDebugString());
- }
-
- context.OnComplete = {}; // recreate
- context.DbChanges = {};
-
- for (auto& toAbort: operation->Parts) {
- toAbort->AbortPropose(context);
- }
-
- context.MemChanges.UnDo(context.SS);
- context.OnComplete.ApplyOnExecute(context.SS, context.Txc, context.Ctx);
- Operations.erase(operation->GetTxId());
- return std::move(response);
- }
- }
- }
-
- return std::move(response);
-}
-
-struct TSchemeShard::TTxOperationPropose: public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
- using TBase = NTabletFlatExecutor::TTransactionBase<TSchemeShard>;
-
- TProposeRequest::TPtr Request;
- THolder<TProposeResponse> Response = nullptr;
-
- TSideEffects OnComplete;
-
- TTxOperationPropose(TSchemeShard* self, TProposeRequest::TPtr request)
- : TBase(self)
- , Request(request)
- {}
-
- TTxType GetTxType() const override { return TXTYPE_PROPOSE; }
-
- bool Execute(NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx) override {
- TTabletId selfId = Self->SelfTabletId();
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxOperationPropose Execute"
- << ", message: " << GetRecordForPrint(Request->Get()->Record).ShortDebugString()
- << ", at schemeshard: " << selfId);
-
- txc.DB.NoMoreReadsForTx();
-
- TMemoryChanges memChanges;
- TStorageChanges dbChanges;
- auto context = TOperationContext{Self, txc, ctx, OnComplete, memChanges, dbChanges};
-
- Response = Self->IgniteOperation(*Request->Get(), context);
-
- OnComplete.ApplyOnExecute(Self, txc, ctx);
- dbChanges.Apply(Self, txc, ctx);
- return true;
- }
-
- void Complete(const TActorContext& ctx) override {
- Y_VERIFY(Response);
-
- const auto& record = Request->Get()->Record;
- const auto txId = TTxId(record.GetTxId());
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxOperationPropose Complete"
- << ", txId: " << txId
- << ", response: " << Response->Record.ShortDebugString()
- << ", at schemeshard: " << Self->TabletID());
-
+ " Note that tx body equality isn't granted. StatusAccepted is just returned on retries.");
+ return std::move(response);
+ }
+
+ TOperation::TPtr operation = new TOperation(txId);
+ Operations[operation->GetTxId()] = operation; //record is erased at ApplyOnExecute if all parts are done at propose
+
+ if (record.GetUserToken()) {
+ NACLibProto::TUserToken tokenPb;
+ bool parseOk = tokenPb.ParseFromString(record.GetUserToken());
+ if (!parseOk) {
+ response.Reset(new TEvSchemeShard::TEvModifySchemeTransactionResult(
+ NKikimrScheme::StatusInvalidParameter, ui64(txId), ui64(selfId)));
+ response->SetError(NKikimrScheme::StatusInvalidParameter, "Failed to parse user token");
+ return std::move(response);
+ }
+ context.UserToken.Reset(new NACLib::TUserToken(tokenPb));
+ }
+
+ if (!EnableSchemeTransactionsAtSchemeShard && record.TransactionSize() > 1) {
+ response.Reset(new TEvSchemeShard::TEvModifySchemeTransactionResult(
+ NKikimrScheme::StatusInvalidParameter, ui64(txId), ui64(selfId)));
+ response->SetError(NKikimrScheme::StatusInvalidParameter,
+ "Do not accept several transactions as one until EnableSchemeTransactionsAtSchemeShard isn't set");
+ Operations.erase(operation->GetTxId());
+ return std::move(response);
+ }
+
+ for (const auto& transaction: record.GetTransaction()) {
+ auto quotaResult = operation->ConsumeQuota(transaction, context);
+ if (quotaResult.Status != NKikimrScheme::StatusSuccess) {
+ response.Reset(new TEvSchemeShard::TEvModifySchemeTransactionResult(
+ quotaResult.Status, ui64(txId), ui64(selfId)));
+ response->SetError(quotaResult.Status, quotaResult.Reason);
+ Operations.erase(operation->GetTxId());
+ return std::move(response);
+ }
+ }
+
+ if (record.HasFailOnExist()) {
+ // inherit FailOnExist from TEvModifySchemeTransaction into TModifyScheme
+ for (auto transaction: *record.MutableTransaction()) {
+ if (!transaction.HasFailOnExist()) {
+ transaction.SetFailOnExist(record.GetFailOnExist());
+ }
+ }
+ }
+
+ TVector<TTxTransaction> transactions;
+ for (const auto& transaction: record.GetTransaction()) {
+ auto splitResult = operation->SplitIntoTransactions(transaction, context);
+ if (splitResult.Status != NKikimrScheme::StatusSuccess) {
+ response.Reset(new TEvSchemeShard::TEvModifySchemeTransactionResult(
+ splitResult.Status, ui64(txId), ui64(selfId)));
+ response->SetError(splitResult.Status, splitResult.Reason);
+ Operations.erase(operation->GetTxId());
+ return std::move(response);
+ }
+
+ transactions.insert(transactions.end(), splitResult.Transactions.begin(), splitResult.Transactions.end());
+ }
+
+ //for all tx in transactions
+ for (const auto& transaction: transactions) {
+ const TOperationId pathOpId = TOperationId(txId, operation->Parts.size());
+ TVector<ISubOperationBase::TPtr> parts = operation->ConstructParts(transaction, context);
+
+ if (parts.size() > 1) {
+ // les't allow altering impl index tables as part of consistent operation
+ context.IsAllowedPrivateTables = true;
+ }
+
+ const TString owner = record.HasOwner() ? record.GetOwner() : BUILTIN_ACL_ROOT;
+
+ for (auto& part: parts) {
+ response = part->Propose(owner, context);
+ Y_VERIFY(response);
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "IgniteOperation"
+ << ", opId: " << pathOpId
+ << ", propose status:" << NKikimrScheme::EStatus_Name(response->Record.GetStatus())
+ << ", reason: " << response->Record.GetReason()
+ << ", at schemeshard: " << selfId);
+
+ if (response->IsDone()) {
+ operation->AddPart(part); //at ApplyOnExecute parts is erased
+ context.OnComplete.DoneOperation(pathOpId); //mark it here by self for sure
+ } else if (response->IsConditionalAccepted()) {
+ //happens on retries, we answer like AlreadyExist or StatusSuccess with error message and do nothing in operation
+ operation->AddPart(part); //at ApplyOnExecute parts is erased
+ context.OnComplete.DoneOperation(pathOpId); //mark it here by self for sure
+ } else if (response->IsAccepted()) {
+ operation->AddPart(part);
+ //context.OnComplete.ActivateTx(pathOpId) ///TODO maybe it is good idea
+ } else {
+
+
+
+ if (!operation->Parts.empty()) {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Abort operation: IgniteOperation fail to propose a part"
+ << ", opId: " << pathOpId
+ << ", at schemeshard: " << selfId
+ << ", already assepted parts: " << operation->Parts.size()
+ << ", propose result status: " << NKikimrScheme::EStatus_Name(response->Record.GetStatus())
+ << ", with reason: " << response->Record.GetReason()
+ << ", tx message: " << GetRecordForPrint(record).ShortDebugString());
+ }
+
+ context.OnComplete = {}; // recreate
+ context.DbChanges = {};
+
+ for (auto& toAbort: operation->Parts) {
+ toAbort->AbortPropose(context);
+ }
+
+ context.MemChanges.UnDo(context.SS);
+ context.OnComplete.ApplyOnExecute(context.SS, context.Txc, context.Ctx);
+ Operations.erase(operation->GetTxId());
+ return std::move(response);
+ }
+ }
+ }
+
+ return std::move(response);
+}
+
+struct TSchemeShard::TTxOperationPropose: public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
+ using TBase = NTabletFlatExecutor::TTransactionBase<TSchemeShard>;
+
+ TProposeRequest::TPtr Request;
+ THolder<TProposeResponse> Response = nullptr;
+
+ TSideEffects OnComplete;
+
+ TTxOperationPropose(TSchemeShard* self, TProposeRequest::TPtr request)
+ : TBase(self)
+ , Request(request)
+ {}
+
+ TTxType GetTxType() const override { return TXTYPE_PROPOSE; }
+
+ bool Execute(NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx) override {
+ TTabletId selfId = Self->SelfTabletId();
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxOperationPropose Execute"
+ << ", message: " << GetRecordForPrint(Request->Get()->Record).ShortDebugString()
+ << ", at schemeshard: " << selfId);
+
+ txc.DB.NoMoreReadsForTx();
+
+ TMemoryChanges memChanges;
+ TStorageChanges dbChanges;
+ auto context = TOperationContext{Self, txc, ctx, OnComplete, memChanges, dbChanges};
+
+ Response = Self->IgniteOperation(*Request->Get(), context);
+
+ OnComplete.ApplyOnExecute(Self, txc, ctx);
+ dbChanges.Apply(Self, txc, ctx);
+ return true;
+ }
+
+ void Complete(const TActorContext& ctx) override {
+ Y_VERIFY(Response);
+
+ const auto& record = Request->Get()->Record;
+ const auto txId = TTxId(record.GetTxId());
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxOperationPropose Complete"
+ << ", txId: " << txId
+ << ", response: " << Response->Record.ShortDebugString()
+ << ", at schemeshard: " << Self->TabletID());
+
const TActorId sender = Request->Sender;
- const ui64 cookie = Request->Cookie;
- ctx.Send(sender, Response.Release(), 0, cookie);
-
- OnComplete.ApplyOnComplete(Self, ctx);
- }
-};
-
-struct TSchemeShard::TTxOperationProgress: public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
- TOperationId OpId;
- TSideEffects OnComplete;
- TMemoryChanges MemChanges;
- TStorageChanges DbChanges;
-
- TTxOperationProgress(TSchemeShard* self, TOperationId id)
- : TBase(self)
- , OpId(id)
- {}
-
- TTxType GetTxType() const override { return TXTYPE_PROGRESS_OP; }
-
- bool Execute(NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx) override {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxOperationProgress Execute"
- << ", operationId: " << OpId
- << ", at schemeshard: " << Self->TabletID());
-
- if (!Self->Operations.contains(OpId.GetTxId())) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxOperationProgress Execute"
- << " for unknown txId " << OpId.GetTxId());
- return true;
- }
-
- TOperation::TPtr operation = Self->Operations.at(OpId.GetTxId());
- if (operation->DoneParts.contains(OpId.GetSubTxId())) {
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxOperationProgress Execute"
- << " operation already done"
- << ", operationId: " << OpId
- << ", at schemeshard: " << Self->TabletID());
- return true;
- }
-
- ISubOperationBase::TPtr part = operation->Parts.at(ui64(OpId.GetSubTxId()));
-
- TOperationContext context{Self, txc, ctx, OnComplete, MemChanges, DbChanges};
-
- part->ProgressState(context);
-
- OnComplete.ApplyOnExecute(Self, txc, ctx);
- DbChanges.Apply(Self, txc, ctx);
- return true;
- }
-
- void Complete(const TActorContext& ctx) override {
- OnComplete.ApplyOnComplete(Self, ctx);
- }
-};
-
-
-template <class TEvType>
-struct TSchemeShard::TTxOperationReply {};
-
-#define DefineTTxOperationReply(TEvType, TxType) \
- template<> \
- struct TSchemeShard::TTxOperationReply<TEvType>: public NTabletFlatExecutor::TTransactionBase<TSchemeShard> { \
- TOperationId OperationId; \
- TEvType::TPtr EvReply; \
- TSideEffects OnComplete; \
- TMemoryChanges MemChanges; \
- TStorageChanges DbChanges; \
-\
- TTxType GetTxType() const override { return TxType; } \
-\
- TTxOperationReply(TSchemeShard* self, TOperationId id, TEvType::TPtr& ev) \
- : TBase(self) \
- , OperationId(id) \
- , EvReply(ev) \
- { \
- Y_VERIFY(TEvType::EventType != TEvPrivate::TEvOperationPlan::EventType); \
- Y_VERIFY(TEvType::EventType != TEvTxProcessing::TEvPlanStep::EventType); \
- } \
-\
- bool Execute(NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx) override { \
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, \
- "TTxOperationReply<" #TEvType "> execute " \
- << ", operationId: " << OperationId \
- << ", at schemeshard: " << Self->TabletID() \
- << ", message: " << IOperationBase::DebugReply(EvReply)); \
- if (!Self->Operations.contains(OperationId.GetTxId())) { \
- return true; \
- } \
- TOperation::TPtr operation = Self->Operations.at(OperationId.GetTxId()); \
- if (operation->DoneParts.contains(OperationId.GetSubTxId())) { \
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, \
- "TTxOperationReply<" #TEvType "> execute " \
- << ", operation already done" \
- << ", operationId: " << OperationId \
- << ", at schemeshard: " << Self->TabletID()); \
- return true; \
- } \
- ISubOperationBase::TPtr part = operation->Parts.at(ui64(OperationId.GetSubTxId())); \
- TOperationContext context{Self, txc, ctx, OnComplete, MemChanges, DbChanges}; \
- Y_VERIFY(EvReply); \
- part->HandleReply(EvReply, context); \
- OnComplete.ApplyOnExecute(Self, txc, ctx); \
- DbChanges.Apply(Self, txc, ctx); \
- return true; \
- } \
- void Complete(const TActorContext& ctx) override { \
- OnComplete.ApplyOnComplete(Self, ctx); \
- } \
- };
-
- SCHEMESHARD_INCOMING_EVENTS(DefineTTxOperationReply)
-#undef DefineTxOperationReply
-
-struct TSchemeShard::TTxOperationPlanStep: public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
- TEvTxProcessing::TEvPlanStep::TPtr Ev;
- TSideEffects OnComplete;
- TMemoryChanges MemChanges;
- TStorageChanges DbChanges;
-
- TTxOperationPlanStep(TSchemeShard* self, TEvTxProcessing::TEvPlanStep::TPtr ev)
- : TBase(self)
- , Ev(ev)
-
- {}
-
- TTxType GetTxType() const override { return TXTYPE_PLAN_STEP; }
-
- bool Execute(NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx) override {
- const NKikimrTx::TEvMediatorPlanStep& record = Ev->Get()->Record;
- const auto step = TStepId(record.GetStep());
- const size_t txCount = record.TransactionsSize();
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxOperationPlanStep Execute"
- << ", stepId: " << step
- << ", transactions count in step: " << txCount
- << ", at schemeshard: " << Self->TabletID());
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxOperationPlanStep Execute"
- << ", message: " << record.ShortDebugString()
- << ", at schemeshard: " << Self->TabletID());
-
- for (size_t i = 0; i < txCount; ++i) {
- const auto txId = TTxId(record.GetTransactions(i).GetTxId());
+ const ui64 cookie = Request->Cookie;
+ ctx.Send(sender, Response.Release(), 0, cookie);
+
+ OnComplete.ApplyOnComplete(Self, ctx);
+ }
+};
+
+struct TSchemeShard::TTxOperationProgress: public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
+ TOperationId OpId;
+ TSideEffects OnComplete;
+ TMemoryChanges MemChanges;
+ TStorageChanges DbChanges;
+
+ TTxOperationProgress(TSchemeShard* self, TOperationId id)
+ : TBase(self)
+ , OpId(id)
+ {}
+
+ TTxType GetTxType() const override { return TXTYPE_PROGRESS_OP; }
+
+ bool Execute(NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx) override {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxOperationProgress Execute"
+ << ", operationId: " << OpId
+ << ", at schemeshard: " << Self->TabletID());
+
+ if (!Self->Operations.contains(OpId.GetTxId())) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxOperationProgress Execute"
+ << " for unknown txId " << OpId.GetTxId());
+ return true;
+ }
+
+ TOperation::TPtr operation = Self->Operations.at(OpId.GetTxId());
+ if (operation->DoneParts.contains(OpId.GetSubTxId())) {
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxOperationProgress Execute"
+ << " operation already done"
+ << ", operationId: " << OpId
+ << ", at schemeshard: " << Self->TabletID());
+ return true;
+ }
+
+ ISubOperationBase::TPtr part = operation->Parts.at(ui64(OpId.GetSubTxId()));
+
+ TOperationContext context{Self, txc, ctx, OnComplete, MemChanges, DbChanges};
+
+ part->ProgressState(context);
+
+ OnComplete.ApplyOnExecute(Self, txc, ctx);
+ DbChanges.Apply(Self, txc, ctx);
+ return true;
+ }
+
+ void Complete(const TActorContext& ctx) override {
+ OnComplete.ApplyOnComplete(Self, ctx);
+ }
+};
+
+
+template <class TEvType>
+struct TSchemeShard::TTxOperationReply {};
+
+#define DefineTTxOperationReply(TEvType, TxType) \
+ template<> \
+ struct TSchemeShard::TTxOperationReply<TEvType>: public NTabletFlatExecutor::TTransactionBase<TSchemeShard> { \
+ TOperationId OperationId; \
+ TEvType::TPtr EvReply; \
+ TSideEffects OnComplete; \
+ TMemoryChanges MemChanges; \
+ TStorageChanges DbChanges; \
+\
+ TTxType GetTxType() const override { return TxType; } \
+\
+ TTxOperationReply(TSchemeShard* self, TOperationId id, TEvType::TPtr& ev) \
+ : TBase(self) \
+ , OperationId(id) \
+ , EvReply(ev) \
+ { \
+ Y_VERIFY(TEvType::EventType != TEvPrivate::TEvOperationPlan::EventType); \
+ Y_VERIFY(TEvType::EventType != TEvTxProcessing::TEvPlanStep::EventType); \
+ } \
+\
+ bool Execute(NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx) override { \
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, \
+ "TTxOperationReply<" #TEvType "> execute " \
+ << ", operationId: " << OperationId \
+ << ", at schemeshard: " << Self->TabletID() \
+ << ", message: " << IOperationBase::DebugReply(EvReply)); \
+ if (!Self->Operations.contains(OperationId.GetTxId())) { \
+ return true; \
+ } \
+ TOperation::TPtr operation = Self->Operations.at(OperationId.GetTxId()); \
+ if (operation->DoneParts.contains(OperationId.GetSubTxId())) { \
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, \
+ "TTxOperationReply<" #TEvType "> execute " \
+ << ", operation already done" \
+ << ", operationId: " << OperationId \
+ << ", at schemeshard: " << Self->TabletID()); \
+ return true; \
+ } \
+ ISubOperationBase::TPtr part = operation->Parts.at(ui64(OperationId.GetSubTxId())); \
+ TOperationContext context{Self, txc, ctx, OnComplete, MemChanges, DbChanges}; \
+ Y_VERIFY(EvReply); \
+ part->HandleReply(EvReply, context); \
+ OnComplete.ApplyOnExecute(Self, txc, ctx); \
+ DbChanges.Apply(Self, txc, ctx); \
+ return true; \
+ } \
+ void Complete(const TActorContext& ctx) override { \
+ OnComplete.ApplyOnComplete(Self, ctx); \
+ } \
+ };
+
+ SCHEMESHARD_INCOMING_EVENTS(DefineTTxOperationReply)
+#undef DefineTxOperationReply
+
+struct TSchemeShard::TTxOperationPlanStep: public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
+ TEvTxProcessing::TEvPlanStep::TPtr Ev;
+ TSideEffects OnComplete;
+ TMemoryChanges MemChanges;
+ TStorageChanges DbChanges;
+
+ TTxOperationPlanStep(TSchemeShard* self, TEvTxProcessing::TEvPlanStep::TPtr ev)
+ : TBase(self)
+ , Ev(ev)
+
+ {}
+
+ TTxType GetTxType() const override { return TXTYPE_PLAN_STEP; }
+
+ bool Execute(NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx) override {
+ const NKikimrTx::TEvMediatorPlanStep& record = Ev->Get()->Record;
+ const auto step = TStepId(record.GetStep());
+ const size_t txCount = record.TransactionsSize();
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxOperationPlanStep Execute"
+ << ", stepId: " << step
+ << ", transactions count in step: " << txCount
+ << ", at schemeshard: " << Self->TabletID());
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxOperationPlanStep Execute"
+ << ", message: " << record.ShortDebugString()
+ << ", at schemeshard: " << Self->TabletID());
+
+ for (size_t i = 0; i < txCount; ++i) {
+ const auto txId = TTxId(record.GetTransactions(i).GetTxId());
const auto coordinator = ActorIdFromProto(record.GetTransactions(i).GetAckTo());
- const auto coordinatorId = TTabletId(record.GetTransactions(i).GetCoordinator());
-
- if (!Self->Operations.contains(txId)) {
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxOperationPlanStep Execute"
- << " unknown operation, assumed as already done"
- << ", transaction Id: " << txId);
-
- OnComplete.CoordinatorAck(coordinator, step, txId);
- continue;
- }
-
- TOperation::TPtr operation = Self->Operations.at(txId);
-
- for (ui32 partIdx = 0; partIdx < operation->Parts.size(); ++partIdx) {
- auto opId = TOperationId(txId, partIdx);
-
- if (operation->DoneParts.contains(TSubTxId(partIdx))) {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxOperationPlanStep Execute"
- << " operation part is already done"
- << ", operationId: " << opId);
- continue;
- }
-
- TOperationContext context{Self, txc, ctx, OnComplete, MemChanges, DbChanges};
+ const auto coordinatorId = TTabletId(record.GetTransactions(i).GetCoordinator());
+
+ if (!Self->Operations.contains(txId)) {
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxOperationPlanStep Execute"
+ << " unknown operation, assumed as already done"
+ << ", transaction Id: " << txId);
+
+ OnComplete.CoordinatorAck(coordinator, step, txId);
+ continue;
+ }
+
+ TOperation::TPtr operation = Self->Operations.at(txId);
+
+ for (ui32 partIdx = 0; partIdx < operation->Parts.size(); ++partIdx) {
+ auto opId = TOperationId(txId, partIdx);
+
+ if (operation->DoneParts.contains(TSubTxId(partIdx))) {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxOperationPlanStep Execute"
+ << " operation part is already done"
+ << ", operationId: " << opId);
+ continue;
+ }
+
+ TOperationContext context{Self, txc, ctx, OnComplete, MemChanges, DbChanges};
THolder<TEvPrivate::TEvOperationPlan> msg = MakeHolder<TEvPrivate::TEvOperationPlan>(ui64(step), ui64(txId));
- TEvPrivate::TEvOperationPlan::TPtr personalEv = (TEventHandle<TEvPrivate::TEvOperationPlan>*) new IEventHandle(
+ TEvPrivate::TEvOperationPlan::TPtr personalEv = (TEventHandle<TEvPrivate::TEvOperationPlan>*) new IEventHandle(
context.SS->SelfId(), context.SS->SelfId(), msg.Release());
-
- operation->Parts.at(partIdx)->HandleReply(personalEv, context);
- }
-
- OnComplete.CoordinatorAck(coordinator, step, txId);
- OnComplete.UnbindMsgFromPipe(TOperationId(txId, InvalidSubTxId), coordinatorId, TPipeMessageId(0, txId));
- }
-
+
+ operation->Parts.at(partIdx)->HandleReply(personalEv, context);
+ }
+
+ OnComplete.CoordinatorAck(coordinator, step, txId);
+ OnComplete.UnbindMsgFromPipe(TOperationId(txId, InvalidSubTxId), coordinatorId, TPipeMessageId(0, txId));
+ }
+
const TActorId mediator = Ev->Sender;
- OnComplete.MediatorAck(mediator, step);
-
- OnComplete.ApplyOnExecute(Self, txc, ctx);
- DbChanges.Apply(Self, txc, ctx);
- return true;
- }
-
- void Complete(const TActorContext& ctx) override {
- OnComplete.ApplyOnComplete(Self, ctx);
- }
-};
-
-
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxOperationPropose(TEvSchemeShard::TEvCancelTx::TPtr& ev) {
+ OnComplete.MediatorAck(mediator, step);
+
+ OnComplete.ApplyOnExecute(Self, txc, ctx);
+ DbChanges.Apply(Self, txc, ctx);
+ return true;
+ }
+
+ void Complete(const TActorContext& ctx) override {
+ OnComplete.ApplyOnComplete(Self, ctx);
+ }
+};
+
+
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxOperationPropose(TEvSchemeShard::TEvCancelTx::TPtr& ev) {
return new TTxOperationProposeCancelTx(this, ev);
-}
-
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxOperationPropose(TEvSchemeShard::TEvModifySchemeTransaction::TPtr& ev) {
- return new TTxOperationPropose(this, ev);
-}
-
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxOperationPlanStep(TEvTxProcessing::TEvPlanStep::TPtr& ev) {
- return new TTxOperationPlanStep(this, ev);
-}
-
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxOperationProgress(TOperationId opId) {
- return new TTxOperationProgress(this, opId);
-}
-
-#define DefineCreateTxOperationReply(TEvType, TxType) \
- NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxOperationReply(TOperationId id, TEvType::TPtr& ev) { \
- return new TTxOperationReply<TEvType>(this, id, ev); \
- }
-
- SCHEMESHARD_INCOMING_EVENTS(DefineCreateTxOperationReply)
-#undef DefineTxOperationReply
-
+}
+
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxOperationPropose(TEvSchemeShard::TEvModifySchemeTransaction::TPtr& ev) {
+ return new TTxOperationPropose(this, ev);
+}
+
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxOperationPlanStep(TEvTxProcessing::TEvPlanStep::TPtr& ev) {
+ return new TTxOperationPlanStep(this, ev);
+}
+
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxOperationProgress(TOperationId opId) {
+ return new TTxOperationProgress(this, opId);
+}
+
+#define DefineCreateTxOperationReply(TEvType, TxType) \
+ NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxOperationReply(TOperationId id, TEvType::TPtr& ev) { \
+ return new TTxOperationReply<TEvType>(this, id, ev); \
+ }
+
+ SCHEMESHARD_INCOMING_EVENTS(DefineCreateTxOperationReply)
+#undef DefineTxOperationReply
+
TString JoinPath(const TString& workingDir, const TString& name) {
Y_VERIFY(!name.StartsWith('/') && !name.EndsWith('/'));
return TStringBuilder()
@@ -499,16 +499,16 @@ TOperation::TConsumeQuotaResult TOperation::ConsumeQuota(const TTxTransaction& t
// These operations never consume quota
switch (tx.GetOperationType()) {
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateSubDomain:
- case NKikimrSchemeOp::EOperationType::ESchemeOpDropSubDomain:
- case NKikimrSchemeOp::EOperationType::ESchemeOpForceDropSubDomain:
- case NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain:
- case NKikimrSchemeOp::EOperationType::ESchemeOpForceDropUnsafe:
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateExtSubDomain:
- case NKikimrSchemeOp::EOperationType::ESchemeOpAlterExtSubDomain:
- case NKikimrSchemeOp::EOperationType::ESchemeOpForceDropExtSubDomain:
- case NKikimrSchemeOp::EOperationType::ESchemeOpUpgradeSubDomain:
- case NKikimrSchemeOp::EOperationType::ESchemeOpUpgradeSubDomainDecision:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateSubDomain:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpDropSubDomain:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpForceDropSubDomain:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpForceDropUnsafe:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateExtSubDomain:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpAlterExtSubDomain:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpForceDropExtSubDomain:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpUpgradeSubDomain:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpUpgradeSubDomainDecision:
return result;
default:
break;
@@ -528,7 +528,7 @@ TOperation::TConsumeQuotaResult TOperation::ConsumeQuota(const TTxTransaction& t
auto domainId = path.DomainId();
auto domainInfo = path.DomainInfo();
if (!domainInfo->TryConsumeSchemeQuota(context.Ctx.Now())) {
- result.Status = NKikimrScheme::StatusQuotaExceeded;
+ result.Status = NKikimrScheme::StatusQuotaExceeded;
result.Reason = "Request exceeded a limit on the number of schema operations, try again later.";
}
@@ -551,7 +551,7 @@ TOperation::TSplitTransactionsResult TOperation::SplitIntoTransactions(const TTx
.NotDeleted()
.NotUnderDeleting()
.IsCommonSensePath()
- .IsLikeDirectory();
+ .IsLikeDirectory();
if (!checks) {
result.Transactions.push_back(tx);
@@ -562,39 +562,39 @@ TOperation::TSplitTransactionsResult TOperation::SplitIntoTransactions(const TTx
TString targetName;
switch (tx.GetOperationType()) {
- case NKikimrSchemeOp::EOperationType::ESchemeOpMkDir:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpMkDir:
targetName = tx.GetMkDir().GetName();
break;
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable:
if (tx.GetCreateTable().HasCopyFromTable()) {
result.Transactions.push_back(tx);
return result;
}
targetName = tx.GetCreateTable().GetName();
break;
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreatePersQueueGroup:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreatePersQueueGroup:
targetName = tx.GetCreatePersQueueGroup().GetName();
break;
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateSubDomain:
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateExtSubDomain:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateSubDomain:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateExtSubDomain:
targetName = tx.GetSubDomain().GetName();
break;
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateRtmrVolume:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateRtmrVolume:
targetName = tx.GetCreateRtmrVolume().GetName();
break;
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateBlockStoreVolume:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateBlockStoreVolume:
targetName = tx.GetCreateBlockStoreVolume().GetName();
break;
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateFileStore:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateFileStore:
targetName = tx.GetCreateFileStore().GetName();
break;
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateKesus:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateKesus:
targetName = tx.GetKesus().GetName();
break;
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateSolomonVolume:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateSolomonVolume:
targetName = tx.GetCreateSolomonVolume().GetName();
break;
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexedTable:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexedTable:
targetName = tx.GetCreateIndexedTable().GetTableDescription().GetName();
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateColumnStore:
@@ -650,38 +650,38 @@ TOperation::TSplitTransactionsResult TOperation::SplitIntoTransactions(const TTx
TTxTransaction create(tx);
create.SetWorkingDir(path.PathString());
- create.SetFailOnExist(tx.GetFailOnExist());
+ create.SetFailOnExist(tx.GetFailOnExist());
switch (tx.GetOperationType()) {
- case NKikimrSchemeOp::EOperationType::ESchemeOpMkDir:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpMkDir:
create.MutableMkDir()->SetName(name);
break;
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable:
create.MutableCreateTable()->SetName(name);
break;
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreatePersQueueGroup:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreatePersQueueGroup:
create.MutableCreatePersQueueGroup()->SetName(name);
break;
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateSubDomain:
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateExtSubDomain:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateSubDomain:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateExtSubDomain:
create.MutableSubDomain()->SetName(name);
break;
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateRtmrVolume:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateRtmrVolume:
create.MutableCreateRtmrVolume()->SetName(name);
break;
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateBlockStoreVolume:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateBlockStoreVolume:
create.MutableCreateBlockStoreVolume()->SetName(name);
break;
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateFileStore:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateFileStore:
create.MutableCreateFileStore()->SetName(name);
break;
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateKesus:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateKesus:
create.MutableKesus()->SetName(name);
break;
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateSolomonVolume:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateSolomonVolume:
create.MutableCreateSolomonVolume()->SetName(name);
break;
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexedTable:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexedTable:
create.MutableCreateIndexedTable()->MutableTableDescription()->SetName(name);
break;
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateColumnStore:
@@ -717,7 +717,7 @@ TOperation::TSplitTransactionsResult TOperation::SplitIntoTransactions(const TTx
.NotDeleted()
.NotUnderDeleting()
.IsCommonSensePath()
- .IsLikeDirectory();
+ .IsLikeDirectory();
if (checks) {
break;
@@ -751,8 +751,8 @@ TOperation::TSplitTransactionsResult TOperation::SplitIntoTransactions(const TTx
path.Rise();
TTxTransaction mkdir;
- mkdir.SetFailOnExist(true);
- mkdir.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpMkDir);
+ mkdir.SetFailOnExist(true);
+ mkdir.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpMkDir);
mkdir.SetWorkingDir(path.PathString());
mkdir.MutableMkDir()->SetName(name);
result.Transactions.push_back(mkdir);
@@ -762,37 +762,37 @@ TOperation::TSplitTransactionsResult TOperation::SplitIntoTransactions(const TTx
return result;
}
-ISubOperationBase::TPtr TOperation::RestorePart(TTxState::ETxType txType, TTxState::ETxState txState) {
- switch (txType) {
- case TTxState::ETxType::TxMkDir:
- return CreateMkDir(NextPartId(), txState);
- case TTxState::ETxType::TxRmDir:
- return CreateRmDir(NextPartId(), txState);
- case TTxState::ETxType::TxModifyACL:
- return CreateModifyACL(NextPartId(), txState);
- case TTxState::ETxType::TxAlterUserAttributes:
- return CreateAlterUserAttrs(NextPartId(), txState);
- case TTxState::ETxType::TxCreateTable:
- return CreateNewTable(NextPartId(), txState);
- case TTxState::ETxType::TxCopyTable:
- return CreateCopyTable(NextPartId(), txState);
- case TTxState::ETxType::TxAlterTable:
- return CreateAlterTable(NextPartId(), txState);
- case TTxState::ETxType::TxSplitTablePartition:
- case TTxState::ETxType::TxMergeTablePartition:
- return CreateSplitMerge(NextPartId(), txState);
- case TTxState::ETxType::TxBackup:
+ISubOperationBase::TPtr TOperation::RestorePart(TTxState::ETxType txType, TTxState::ETxState txState) {
+ switch (txType) {
+ case TTxState::ETxType::TxMkDir:
+ return CreateMkDir(NextPartId(), txState);
+ case TTxState::ETxType::TxRmDir:
+ return CreateRmDir(NextPartId(), txState);
+ case TTxState::ETxType::TxModifyACL:
+ return CreateModifyACL(NextPartId(), txState);
+ case TTxState::ETxType::TxAlterUserAttributes:
+ return CreateAlterUserAttrs(NextPartId(), txState);
+ case TTxState::ETxType::TxCreateTable:
+ return CreateNewTable(NextPartId(), txState);
+ case TTxState::ETxType::TxCopyTable:
+ return CreateCopyTable(NextPartId(), txState);
+ case TTxState::ETxType::TxAlterTable:
+ return CreateAlterTable(NextPartId(), txState);
+ case TTxState::ETxType::TxSplitTablePartition:
+ case TTxState::ETxType::TxMergeTablePartition:
+ return CreateSplitMerge(NextPartId(), txState);
+ case TTxState::ETxType::TxBackup:
return CreateBackup(NextPartId(), txState);
case TTxState::ETxType::TxRestore:
return CreateRestore(NextPartId(), txState);
- case TTxState::ETxType::TxDropTable:
- return CreateDropTable(NextPartId(), txState);
- case TTxState::ETxType::TxCreateTableIndex:
- return CreateNewTableIndex(NextPartId(), txState);
- case TTxState::ETxType::TxDropTableIndex:
- return CreateDropTableIndex(NextPartId(), txState);
- case TTxState::ETxType::TxCreateRtmrVolume:
- return CreateNewRTMR(NextPartId(), txState);
+ case TTxState::ETxType::TxDropTable:
+ return CreateDropTable(NextPartId(), txState);
+ case TTxState::ETxType::TxCreateTableIndex:
+ return CreateNewTableIndex(NextPartId(), txState);
+ case TTxState::ETxType::TxDropTableIndex:
+ return CreateDropTableIndex(NextPartId(), txState);
+ case TTxState::ETxType::TxCreateRtmrVolume:
+ return CreateNewRTMR(NextPartId(), txState);
case TTxState::ETxType::TxCreateOlapStore:
return CreateNewOlapStore(NextPartId(), txState);
case TTxState::ETxType::TxAlterOlapStore:
@@ -805,55 +805,55 @@ ISubOperationBase::TPtr TOperation::RestorePart(TTxState::ETxType txType, TTxSta
return CreateAlterOlapTable(NextPartId(), txState);
case TTxState::ETxType::TxDropOlapTable:
return CreateDropOlapTable(NextPartId(), txState);
- case TTxState::ETxType::TxCreatePQGroup:
- return CreateNewPQ(NextPartId(), txState);
- case TTxState::ETxType::TxAlterPQGroup:
- return CreateAlterPQ(NextPartId(), txState);
- case TTxState::ETxType::TxDropPQGroup:
- return CreateDropPQ(NextPartId(), txState);
- case TTxState::ETxType::TxCreateSolomonVolume:
- return CreateNewSolomon(NextPartId(), txState);
- case TTxState::ETxType::TxDropSolomonVolume:
- return CreateDropSolomon(NextPartId(), txState);
- case TTxState::ETxType::TxCreateSubDomain:
- return CreateSubDomain(NextPartId(), txState);
- case TTxState::ETxType::TxAlterSubDomain:
- return CreateAlterSubDomain(NextPartId(), txState);
- case TTxState::ETxType::TxUpgradeSubDomain:
- return CreateUpgradeSubDomain(NextPartId(), txState);
- case TTxState::ETxType::TxUpgradeSubDomainDecision:
- return CreateUpgradeSubDomainDecision(NextPartId(), txState);
- case TTxState::ETxType::TxDropSubDomain:
- return CreateDropSubdomain(NextPartId(), txState);
- case TTxState::ETxType::TxForceDropSubDomain:
- return CreateFroceDropSubDomain(NextPartId(), txState);
- case TTxState::ETxType::TxCreateExtSubDomain:
- return CreateExtSubDomain(NextPartId(), txState);
- case TTxState::ETxType::TxCreateKesus:
- return CreateNewKesus(NextPartId(), txState);
- case TTxState::ETxType::TxAlterKesus:
- return CreateAlterKesus(NextPartId(), txState);
- case TTxState::ETxType::TxDropKesus:
- return CreateDropKesus(NextPartId(), txState);
- case TTxState::ETxType::TxAlterExtSubDomain:
- return CreateAlterExtSubDomain(NextPartId(), txState);
- case TTxState::ETxType::TxForceDropExtSubDomain:
- return CreateFroceDropExtSubDomain(NextPartId(), txState);
- case TTxState::ETxType::TxInitializeBuildIndex:
- return CreateInitializeBuildIndexMainTable(NextPartId(), txState);
- case TTxState::ETxType::TxFinalizeBuildIndex:
- return CreateFinalizeBuildIndexMainTable(NextPartId(), txState);
- case TTxState::ETxType::TxDropTableIndexAtMainTable:
- return CreateDropTableIndexAtMainTable(NextPartId(), txState);
- case TTxState::ETxType::TxCreateLockForIndexBuild:
- return CreateLockForIndexBuild(NextPartId(), txState);
- case TTxState::ETxType::TxDropLock:
- return DropLock(NextPartId(), txState);
- case TTxState::ETxType::TxAlterTableIndex:
- return CreateAlterTableIndex(NextPartId(), txState);
- case TTxState::ETxType::TxAlterSolomonVolume:
- return CreateAlterSolomon(NextPartId(), txState);
-
+ case TTxState::ETxType::TxCreatePQGroup:
+ return CreateNewPQ(NextPartId(), txState);
+ case TTxState::ETxType::TxAlterPQGroup:
+ return CreateAlterPQ(NextPartId(), txState);
+ case TTxState::ETxType::TxDropPQGroup:
+ return CreateDropPQ(NextPartId(), txState);
+ case TTxState::ETxType::TxCreateSolomonVolume:
+ return CreateNewSolomon(NextPartId(), txState);
+ case TTxState::ETxType::TxDropSolomonVolume:
+ return CreateDropSolomon(NextPartId(), txState);
+ case TTxState::ETxType::TxCreateSubDomain:
+ return CreateSubDomain(NextPartId(), txState);
+ case TTxState::ETxType::TxAlterSubDomain:
+ return CreateAlterSubDomain(NextPartId(), txState);
+ case TTxState::ETxType::TxUpgradeSubDomain:
+ return CreateUpgradeSubDomain(NextPartId(), txState);
+ case TTxState::ETxType::TxUpgradeSubDomainDecision:
+ return CreateUpgradeSubDomainDecision(NextPartId(), txState);
+ case TTxState::ETxType::TxDropSubDomain:
+ return CreateDropSubdomain(NextPartId(), txState);
+ case TTxState::ETxType::TxForceDropSubDomain:
+ return CreateFroceDropSubDomain(NextPartId(), txState);
+ case TTxState::ETxType::TxCreateExtSubDomain:
+ return CreateExtSubDomain(NextPartId(), txState);
+ case TTxState::ETxType::TxCreateKesus:
+ return CreateNewKesus(NextPartId(), txState);
+ case TTxState::ETxType::TxAlterKesus:
+ return CreateAlterKesus(NextPartId(), txState);
+ case TTxState::ETxType::TxDropKesus:
+ return CreateDropKesus(NextPartId(), txState);
+ case TTxState::ETxType::TxAlterExtSubDomain:
+ return CreateAlterExtSubDomain(NextPartId(), txState);
+ case TTxState::ETxType::TxForceDropExtSubDomain:
+ return CreateFroceDropExtSubDomain(NextPartId(), txState);
+ case TTxState::ETxType::TxInitializeBuildIndex:
+ return CreateInitializeBuildIndexMainTable(NextPartId(), txState);
+ case TTxState::ETxType::TxFinalizeBuildIndex:
+ return CreateFinalizeBuildIndexMainTable(NextPartId(), txState);
+ case TTxState::ETxType::TxDropTableIndexAtMainTable:
+ return CreateDropTableIndexAtMainTable(NextPartId(), txState);
+ case TTxState::ETxType::TxCreateLockForIndexBuild:
+ return CreateLockForIndexBuild(NextPartId(), txState);
+ case TTxState::ETxType::TxDropLock:
+ return DropLock(NextPartId(), txState);
+ case TTxState::ETxType::TxAlterTableIndex:
+ return CreateAlterTableIndex(NextPartId(), txState);
+ case TTxState::ETxType::TxAlterSolomonVolume:
+ return CreateAlterSolomon(NextPartId(), txState);
+
// BlockStore
case TTxState::ETxType::TxCreateBlockStoreVolume:
return CreateNewBSV(NextPartId(), txState);
@@ -894,14 +894,14 @@ ISubOperationBase::TPtr TOperation::RestorePart(TTxState::ETxType txType, TTxSta
case TTxState::ETxType::TxDropSequence:
return CreateDropSequence(NextPartId(), txState);
- case TTxState::ETxType::TxFillIndex:
- Y_FAIL("deprecated");
-
- case TTxState::ETxType::TxMoveTable:
- return CreateMoveTable(NextPartId(), txState);
- case TTxState::ETxType::TxMoveTableIndex:
- return CreateMoveTableIndex(NextPartId(), txState);
-
+ case TTxState::ETxType::TxFillIndex:
+ Y_FAIL("deprecated");
+
+ case TTxState::ETxType::TxMoveTable:
+ return CreateMoveTable(NextPartId(), txState);
+ case TTxState::ETxType::TxMoveTableIndex:
+ return CreateMoveTableIndex(NextPartId(), txState);
+
// Replication
case TTxState::ETxType::TxCreateReplication:
return CreateNewReplication(NextPartId(), txState);
@@ -910,46 +910,46 @@ ISubOperationBase::TPtr TOperation::RestorePart(TTxState::ETxType txType, TTxSta
case TTxState::ETxType::TxDropReplication:
return CreateDropReplication(NextPartId(), txState);
- case TTxState::ETxType::TxInvalid:
- Y_UNREACHABLE();
- }
-
- Y_UNREACHABLE();
-}
-
-ISubOperationBase::TPtr TOperation::ConstructPart(NKikimrSchemeOp::EOperationType opType, const TTxTransaction& tx) {
- switch (opType) {
- case NKikimrSchemeOp::EOperationType::ESchemeOpMkDir:
+ case TTxState::ETxType::TxInvalid:
+ Y_UNREACHABLE();
+ }
+
+ Y_UNREACHABLE();
+}
+
+ISubOperationBase::TPtr TOperation::ConstructPart(NKikimrSchemeOp::EOperationType opType, const TTxTransaction& tx) {
+ switch (opType) {
+ case NKikimrSchemeOp::EOperationType::ESchemeOpMkDir:
return CreateMkDir(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpRmDir:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpRmDir:
return CreateRmDir(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL:
return CreateModifyACL(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpAlterUserAttributes:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpAlterUserAttributes:
return CreateAlterUserAttrs(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpForceDropUnsafe:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpForceDropUnsafe:
return CreateFroceDropUnsafe(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable:
- return CreateNewTable(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpAlterTable:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable:
+ return CreateNewTable(NextPartId(), tx);
+ case NKikimrSchemeOp::EOperationType::ESchemeOpAlterTable:
return CreateAlterTable(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpSplitMergeTablePartitions:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpSplitMergeTablePartitions:
return CreateSplitMerge(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpBackup:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpBackup:
return CreateBackup(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpRestore:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpRestore:
return CreateRestore(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpDropTable:
- Y_FAIL("in general, drop table is multipart operation now due table indexes");
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexedTable:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpDropTable:
+ Y_FAIL("in general, drop table is multipart operation now due table indexes");
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexedTable:
Y_FAIL("multipart operations are handled before, also they require transaction details");
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateTableIndex:
- Y_FAIL("is handled as part of ESchemeOpCreateIndexedTable");
- case NKikimrSchemeOp::EOperationType::ESchemeOpDropTableIndex:
- Y_FAIL("is handled as part of ESchemeOpDropTable");
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateConsistentCopyTables:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateTableIndex:
+ Y_FAIL("is handled as part of ESchemeOpCreateIndexedTable");
+ case NKikimrSchemeOp::EOperationType::ESchemeOpDropTableIndex:
+ Y_FAIL("is handled as part of ESchemeOpDropTable");
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateConsistentCopyTables:
Y_FAIL("multipart operations are handled before, also they require transaction details");
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateRtmrVolume:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateRtmrVolume:
return CreateNewRTMR(NextPartId(), tx);
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateColumnStore:
return CreateNewOlapStore(NextPartId(), tx);
@@ -963,125 +963,125 @@ ISubOperationBase::TPtr TOperation::ConstructPart(NKikimrSchemeOp::EOperationTyp
return CreateAlterOlapTable(NextPartId(), tx);
case NKikimrSchemeOp::EOperationType::ESchemeOpDropColumnTable:
return CreateDropOlapTable(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreatePersQueueGroup:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreatePersQueueGroup:
return CreateNewPQ(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpAlterPersQueueGroup:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpAlterPersQueueGroup:
return CreateAlterPQ(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpDropPersQueueGroup:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpDropPersQueueGroup:
return CreateDropPQ(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateSolomonVolume:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateSolomonVolume:
return CreateNewSolomon(NextPartId(), tx);
case NKikimrSchemeOp::EOperationType::ESchemeOpAlterSolomonVolume:
return CreateAlterSolomon(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpDropSolomonVolume:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpDropSolomonVolume:
return CreateDropSolomon(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateSubDomain:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateSubDomain:
return CreateSubDomain(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain:
- Y_FAIL("run in compatible");
- case NKikimrSchemeOp::EOperationType::ESchemeOpDropSubDomain:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain:
+ Y_FAIL("run in compatible");
+ case NKikimrSchemeOp::EOperationType::ESchemeOpDropSubDomain:
return CreateDropSubdomain(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpForceDropSubDomain:
- Y_FAIL("run in compatible");
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateExtSubDomain:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpForceDropSubDomain:
+ Y_FAIL("run in compatible");
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateExtSubDomain:
return CreateExtSubDomain(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpAlterExtSubDomain:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpAlterExtSubDomain:
return CreateAlterExtSubDomain(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpForceDropExtSubDomain:
- return CreateFroceDropExtSubDomain(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateKesus:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpForceDropExtSubDomain:
+ return CreateFroceDropExtSubDomain(NextPartId(), tx);
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateKesus:
return CreateNewKesus(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpAlterKesus:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpAlterKesus:
return CreateAlterKesus(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpDropKesus:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpDropKesus:
return CreateDropKesus(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpUpgradeSubDomain:
- return CreateUpgradeSubDomain(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpUpgradeSubDomainDecision:
- return CreateUpgradeSubDomainDecision(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexBuild:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpUpgradeSubDomain:
+ return CreateUpgradeSubDomain(NextPartId(), tx);
+ case NKikimrSchemeOp::EOperationType::ESchemeOpUpgradeSubDomainDecision:
+ return CreateUpgradeSubDomainDecision(NextPartId(), tx);
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexBuild:
Y_FAIL("multipart operations are handled before, also they require transaction details");
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateLockForIndexBuild:
- return CreateLockForIndexBuild(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpDropLock:
- return DropLock(NextPartId(), tx);
-
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateLockForIndexBuild:
+ return CreateLockForIndexBuild(NextPartId(), tx);
+ case NKikimrSchemeOp::EOperationType::ESchemeOpDropLock:
+ return DropLock(NextPartId(), tx);
+
// BlockStore
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateBlockStoreVolume:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateBlockStoreVolume:
return CreateNewBSV(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpAssignBlockStoreVolume:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpAssignBlockStoreVolume:
return CreateAssignBSV(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpAlterBlockStoreVolume:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpAlterBlockStoreVolume:
return CreateAlterBSV(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpDropBlockStoreVolume:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpDropBlockStoreVolume:
return CreateDropBSV(NextPartId(), tx);
// FileStore
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateFileStore:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateFileStore:
return CreateNewFileStore(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpAlterFileStore:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpAlterFileStore:
return CreateAlterFileStore(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpDropFileStore:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpDropFileStore:
return CreateDropFileStore(NextPartId(), tx);
// Login
- case NKikimrSchemeOp::EOperationType::ESchemeOpAlterLogin:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpAlterLogin:
return CreateAlterLogin(NextPartId(), tx);
// Sequence
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateSequence:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateSequence:
return CreateNewSequence(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpAlterSequence:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpAlterSequence:
Y_FAIL("TODO: implement");
- case NKikimrSchemeOp::EOperationType::ESchemeOpDropSequence:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpDropSequence:
return CreateDropSequence(NextPartId(), tx);
// Index
- case NKikimrSchemeOp::EOperationType::ESchemeOpApplyIndexBuild:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpApplyIndexBuild:
Y_FAIL("multipart operations are handled before, also they require transaction details");
- case NKikimrSchemeOp::EOperationType::ESchemeOpAlterTableIndex:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpAlterTableIndex:
Y_FAIL("multipart operations are handled before, also they require transaction details");
-
- case NKikimrSchemeOp::EOperationType::ESchemeOpInitiateBuildIndexImplTable:
+
+ case NKikimrSchemeOp::EOperationType::ESchemeOpInitiateBuildIndexImplTable:
Y_FAIL("multipart operations are handled before, also they require transaction details");
- case NKikimrSchemeOp::EOperationType::ESchemeOpFinalizeBuildIndexImplTable:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpFinalizeBuildIndexImplTable:
Y_FAIL("multipart operations are handled before, also they require transaction details");
-
- case NKikimrSchemeOp::EOperationType::ESchemeOpInitiateBuildIndexMainTable:
+
+ case NKikimrSchemeOp::EOperationType::ESchemeOpInitiateBuildIndexMainTable:
Y_FAIL("multipart operations are handled before, also they require transaction details");
- case NKikimrSchemeOp::EOperationType::ESchemeOpFinalizeBuildIndexMainTable:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpFinalizeBuildIndexMainTable:
Y_FAIL("multipart operations are handled before, also they require transaction details");
-
- case NKikimrSchemeOp::EOperationType::ESchemeOpCancelIndexBuild:
+
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCancelIndexBuild:
Y_FAIL("multipart operations are handled before, also they require transaction details");
-
- case NKikimrSchemeOp::EOperationType::ESchemeOpDropIndex:
+
+ case NKikimrSchemeOp::EOperationType::ESchemeOpDropIndex:
Y_FAIL("multipart operations are handled before, also they require transaction details");
- case NKikimrSchemeOp::EOperationType::ESchemeOpDropTableIndexAtMainTable:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpDropTableIndexAtMainTable:
Y_FAIL("multipart operations are handled before, also they require transaction details");
-
+
// CDC
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateCdcStream:
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateCdcStreamImpl:
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateCdcStreamAtTable:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateCdcStream:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateCdcStreamImpl:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateCdcStreamAtTable:
Y_FAIL("multipart operations are handled before, also they require transaction details");
- case NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStream:
- case NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStreamImpl:
- case NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStreamAtTable:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStream:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStreamImpl:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStreamAtTable:
Y_FAIL("multipart operations are handled before, also they require transaction details");
- case NKikimrSchemeOp::EOperationType::ESchemeOpDropCdcStream:
- case NKikimrSchemeOp::EOperationType::ESchemeOpDropCdcStreamImpl:
- case NKikimrSchemeOp::EOperationType::ESchemeOpDropCdcStreamAtTable:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpDropCdcStream:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpDropCdcStreamImpl:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpDropCdcStreamAtTable:
Y_FAIL("multipart operations are handled before, also they require transaction details");
- case NKikimrSchemeOp::EOperationType::ESchemeOp_DEPRECATED_35:
- Y_FAIL("imposible");
-
+ case NKikimrSchemeOp::EOperationType::ESchemeOp_DEPRECATED_35:
+ Y_FAIL("imposible");
+
// Move
- case NKikimrSchemeOp::EOperationType::ESchemeOpMoveTable:
- return CreateMoveTable(NextPartId(), tx);
- case NKikimrSchemeOp::EOperationType::ESchemeOpMoveTableIndex:
- return CreateMoveTableIndex(NextPartId(), tx);
+ case NKikimrSchemeOp::EOperationType::ESchemeOpMoveTable:
+ return CreateMoveTable(NextPartId(), tx);
+ case NKikimrSchemeOp::EOperationType::ESchemeOpMoveTableIndex:
+ return CreateMoveTableIndex(NextPartId(), tx);
// Replication
case NKikimrSchemeOp::EOperationType::ESchemeOpCreateReplication:
@@ -1090,51 +1090,51 @@ ISubOperationBase::TPtr TOperation::ConstructPart(NKikimrSchemeOp::EOperationTyp
Y_FAIL("TODO: implement");
case NKikimrSchemeOp::EOperationType::ESchemeOpDropReplication:
return CreateDropReplication(NextPartId(), tx);
- }
-
- Y_UNREACHABLE();
-}
-
-TVector<ISubOperationBase::TPtr> TOperation::ConstructParts(const TTxTransaction& tx, TOperationContext& context) {
- const auto& opType = tx.GetOperationType();
-
+ }
+
+ Y_UNREACHABLE();
+}
+
+TVector<ISubOperationBase::TPtr> TOperation::ConstructParts(const TTxTransaction& tx, TOperationContext& context) {
+ const auto& opType = tx.GetOperationType();
+
switch (opType) {
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable:
- if (tx.GetCreateTable().HasCopyFromTable()) {
- return {CreateCopyTable(NextPartId(), tx, context)}; // Copy indexes table as well as common table
- }
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable:
+ if (tx.GetCreateTable().HasCopyFromTable()) {
+ return {CreateCopyTable(NextPartId(), tx, context)}; // Copy indexes table as well as common table
+ }
return {ConstructPart(opType, tx)};
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexedTable:
- return CreateIndexedTable(NextPartId(), tx, context);
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateConsistentCopyTables:
- return CreateConsistentCopyTables(NextPartId(), tx, context);
- case NKikimrSchemeOp::EOperationType::ESchemeOpDropTable:
- return CreateDropIndexedTable(NextPartId(), tx, context);
- case NKikimrSchemeOp::EOperationType::ESchemeOpForceDropSubDomain:
- return {CreateCompatibleSubdomainDrop(context.SS, NextPartId(), tx)};
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexBuild:
- return CreateBuildIndex(NextPartId(), tx, context);
- case NKikimrSchemeOp::EOperationType::ESchemeOpApplyIndexBuild:
- return ApplyBuildIndex(NextPartId(), tx, context);
- case NKikimrSchemeOp::EOperationType::ESchemeOpDropIndex:
- return CreateDropIndex(NextPartId(), tx, context);
- case NKikimrSchemeOp::EOperationType::ESchemeOpCancelIndexBuild:
- return CancelBuildIndex(NextPartId(), tx, context);
- case NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain:
- return {CreateCompatibleSubdomainAlter(context.SS, NextPartId(), tx)};
- case NKikimrSchemeOp::EOperationType::ESchemeOpCreateCdcStream:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexedTable:
+ return CreateIndexedTable(NextPartId(), tx, context);
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateConsistentCopyTables:
+ return CreateConsistentCopyTables(NextPartId(), tx, context);
+ case NKikimrSchemeOp::EOperationType::ESchemeOpDropTable:
+ return CreateDropIndexedTable(NextPartId(), tx, context);
+ case NKikimrSchemeOp::EOperationType::ESchemeOpForceDropSubDomain:
+ return {CreateCompatibleSubdomainDrop(context.SS, NextPartId(), tx)};
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexBuild:
+ return CreateBuildIndex(NextPartId(), tx, context);
+ case NKikimrSchemeOp::EOperationType::ESchemeOpApplyIndexBuild:
+ return ApplyBuildIndex(NextPartId(), tx, context);
+ case NKikimrSchemeOp::EOperationType::ESchemeOpDropIndex:
+ return CreateDropIndex(NextPartId(), tx, context);
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCancelIndexBuild:
+ return CancelBuildIndex(NextPartId(), tx, context);
+ case NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain:
+ return {CreateCompatibleSubdomainAlter(context.SS, NextPartId(), tx)};
+ case NKikimrSchemeOp::EOperationType::ESchemeOpCreateCdcStream:
return CreateNewCdcStream(NextPartId(), tx, context);
- case NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStream:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStream:
return CreateAlterCdcStream(NextPartId(), tx, context);
- case NKikimrSchemeOp::EOperationType::ESchemeOpDropCdcStream:
+ case NKikimrSchemeOp::EOperationType::ESchemeOpDropCdcStream:
return CreateDropCdcStream(NextPartId(), tx, context);
- case NKikimrSchemeOp::EOperationType::ESchemeOpMoveTable:
- return CreateConsistentMoveTable(NextPartId(), tx, context);
+ case NKikimrSchemeOp::EOperationType::ESchemeOpMoveTable:
+ return CreateConsistentMoveTable(NextPartId(), tx, context);
default:
return {ConstructPart(opType, tx)};
- }
-}
-
+ }
+}
+
bool TOperation::AddPublishingPath(TPathId pathId, ui64 version) {
Y_VERIFY(!IsReadyToNotify());
return Publications.emplace(pathId, version).second;
@@ -1144,214 +1144,214 @@ bool TOperation::IsPublished() const {
return Publications.empty();
}
-void TOperation::ReadyToNotifyPart(TSubTxId partId) {
- ReadyToNotifyParts.insert(partId);
-}
-
-bool TOperation::IsReadyToNotify(const TActorContext& ctx) const {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TOperation IsReadyToNotify"
- << ", TxId: " << TxId
+void TOperation::ReadyToNotifyPart(TSubTxId partId) {
+ ReadyToNotifyParts.insert(partId);
+}
+
+bool TOperation::IsReadyToNotify(const TActorContext& ctx) const {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TOperation IsReadyToNotify"
+ << ", TxId: " << TxId
<< ", ready parts: " << ReadyToNotifyParts.size() << "/" << Parts.size()
<< ", is published: " << (IsPublished() ? "true" : "false"));
-
- return IsReadyToNotify();
-}
-
-bool TOperation::IsReadyToNotify() const {
+
+ return IsReadyToNotify();
+}
+
+bool TOperation::IsReadyToNotify() const {
return IsPublished() && ReadyToNotifyParts.size() == Parts.size();
-}
-
+}
+
void TOperation::AddNotifySubscriber(const TActorId& actorId) {
- Y_VERIFY(!IsReadyToNotify());
- Subscribers.insert(actorId);
-}
-
-void TOperation::DoNotify(TSchemeShard*, TSideEffects& sideEffects, const TActorContext& ctx) {
- Y_VERIFY(IsReadyToNotify());
-
- for (auto& subsriber: Subscribers) {
- THolder<TEvSchemeShard::TEvNotifyTxCompletionResult> msg = MakeHolder<TEvSchemeShard::TEvNotifyTxCompletionResult>(ui64(TxId));
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TOperation DoNotify"
- << " send TEvNotifyTxCompletionResult"
- << " to actorId: " << subsriber
- << " message: " << msg->Record.ShortDebugString());
-
- sideEffects.Send(subsriber, msg.Release(), ui64(TxId));
- }
-
- Subscribers.clear();
-}
-
-bool TOperation::IsReadyToDone(const TActorContext& ctx) const {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TOperation IsReadyToDone "
- << " TxId: " << TxId
- << " ready parts: " << DoneParts.size() << "/" << Parts.size());
-
- return DoneParts.size() == Parts.size();
-}
-
-bool TOperation::IsReadyToPropose(const TActorContext& ctx) const {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TOperation IsReadyToPropose "
- << ", TxId: " << TxId
- << " ready parts: " << ReadyToProposeParts.size() << "/" << Parts.size());
-
- return IsReadyToPropose();
-}
-
-bool TOperation::IsReadyToPropose() const {
- return ReadyToProposeParts.size() == Parts.size();
-}
-
-void TOperation::ProposePart(TSubTxId partId, TPathId pathId, TStepId minStep) {
- Proposes.push_back(TProposeRec(partId, pathId, minStep));
- ReadyToProposeParts.insert(partId);
-}
-
-void TOperation::ProposePart(TSubTxId partId, TTabletId tableId) {
- ShardsProposes.push_back(TProposeShards(partId, tableId));
- ReadyToProposeParts.insert(partId);
-}
-
-void TOperation::DoPropose(TSchemeShard* ss, TSideEffects& sideEffects, const TActorContext& ctx) const {
- Y_VERIFY(IsReadyToPropose());
-
- //agregate
- TTabletId selfTabletId = ss->SelfTabletId();
- TTabletId coordinatorId = InvalidTabletId; //common for all part
- TStepId effectiveMinStep = TStepId(0);
-
- for (auto& rec: Proposes) {
- TSubTxId partId = InvalidSubTxId;
- TPathId pathId = InvalidPathId;
- TStepId minStep = InvalidStepId;
- std::tie(partId, pathId, minStep) = rec;
-
- {
- TTabletId curCoordinatorId = ss->SelectCoordinator(TxId, pathId);
- if (coordinatorId == InvalidTabletId) {
- coordinatorId = curCoordinatorId;
- }
- Y_VERIFY(coordinatorId == curCoordinatorId);
- }
-
- effectiveMinStep = Max<TStepId>(effectiveMinStep, minStep);
- }
-
- TSet<TTabletId> shards;
- for (auto& rec: ShardsProposes) {
- TSubTxId partId = InvalidSubTxId;
- TTabletId shard = InvalidTabletId;
- std::tie(partId, shard) = rec;
- shards.insert(shard);
-
- sideEffects.RouteByTablet(TOperationId(TxId, partId), shard);
- }
-
- shards.insert(selfTabletId);
-
- {
- const ui8 execLevel = 0;
- const TStepId maxStep = TStepId(Max<ui64>());
- THolder<TEvTxProxy::TEvProposeTransaction> message(
- new TEvTxProxy::TEvProposeTransaction(ui64(coordinatorId), ui64(TxId), execLevel, ui64(effectiveMinStep), ui64(maxStep)));
+ Y_VERIFY(!IsReadyToNotify());
+ Subscribers.insert(actorId);
+}
+
+void TOperation::DoNotify(TSchemeShard*, TSideEffects& sideEffects, const TActorContext& ctx) {
+ Y_VERIFY(IsReadyToNotify());
+
+ for (auto& subsriber: Subscribers) {
+ THolder<TEvSchemeShard::TEvNotifyTxCompletionResult> msg = MakeHolder<TEvSchemeShard::TEvNotifyTxCompletionResult>(ui64(TxId));
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TOperation DoNotify"
+ << " send TEvNotifyTxCompletionResult"
+ << " to actorId: " << subsriber
+ << " message: " << msg->Record.ShortDebugString());
+
+ sideEffects.Send(subsriber, msg.Release(), ui64(TxId));
+ }
+
+ Subscribers.clear();
+}
+
+bool TOperation::IsReadyToDone(const TActorContext& ctx) const {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TOperation IsReadyToDone "
+ << " TxId: " << TxId
+ << " ready parts: " << DoneParts.size() << "/" << Parts.size());
+
+ return DoneParts.size() == Parts.size();
+}
+
+bool TOperation::IsReadyToPropose(const TActorContext& ctx) const {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TOperation IsReadyToPropose "
+ << ", TxId: " << TxId
+ << " ready parts: " << ReadyToProposeParts.size() << "/" << Parts.size());
+
+ return IsReadyToPropose();
+}
+
+bool TOperation::IsReadyToPropose() const {
+ return ReadyToProposeParts.size() == Parts.size();
+}
+
+void TOperation::ProposePart(TSubTxId partId, TPathId pathId, TStepId minStep) {
+ Proposes.push_back(TProposeRec(partId, pathId, minStep));
+ ReadyToProposeParts.insert(partId);
+}
+
+void TOperation::ProposePart(TSubTxId partId, TTabletId tableId) {
+ ShardsProposes.push_back(TProposeShards(partId, tableId));
+ ReadyToProposeParts.insert(partId);
+}
+
+void TOperation::DoPropose(TSchemeShard* ss, TSideEffects& sideEffects, const TActorContext& ctx) const {
+ Y_VERIFY(IsReadyToPropose());
+
+ //agregate
+ TTabletId selfTabletId = ss->SelfTabletId();
+ TTabletId coordinatorId = InvalidTabletId; //common for all part
+ TStepId effectiveMinStep = TStepId(0);
+
+ for (auto& rec: Proposes) {
+ TSubTxId partId = InvalidSubTxId;
+ TPathId pathId = InvalidPathId;
+ TStepId minStep = InvalidStepId;
+ std::tie(partId, pathId, minStep) = rec;
+
+ {
+ TTabletId curCoordinatorId = ss->SelectCoordinator(TxId, pathId);
+ if (coordinatorId == InvalidTabletId) {
+ coordinatorId = curCoordinatorId;
+ }
+ Y_VERIFY(coordinatorId == curCoordinatorId);
+ }
+
+ effectiveMinStep = Max<TStepId>(effectiveMinStep, minStep);
+ }
+
+ TSet<TTabletId> shards;
+ for (auto& rec: ShardsProposes) {
+ TSubTxId partId = InvalidSubTxId;
+ TTabletId shard = InvalidTabletId;
+ std::tie(partId, shard) = rec;
+ shards.insert(shard);
+
+ sideEffects.RouteByTablet(TOperationId(TxId, partId), shard);
+ }
+
+ shards.insert(selfTabletId);
+
+ {
+ const ui8 execLevel = 0;
+ const TStepId maxStep = TStepId(Max<ui64>());
+ THolder<TEvTxProxy::TEvProposeTransaction> message(
+ new TEvTxProxy::TEvProposeTransaction(ui64(coordinatorId), ui64(TxId), execLevel, ui64(effectiveMinStep), ui64(maxStep)));
auto* proposal = message->Record.MutableTransaction();
auto* reqAffectedSet = proposal->MutableAffectedSet();
- reqAffectedSet->Reserve(shards.size());
- for (auto affectedTablet : shards) {
- auto* x = reqAffectedSet->Add();
- x->SetTabletId(ui64(affectedTablet));
- x->SetFlags(2 /*todo: use generic enum*/);
- }
-
+ reqAffectedSet->Reserve(shards.size());
+ for (auto affectedTablet : shards) {
+ auto* x = reqAffectedSet->Add();
+ x->SetTabletId(ui64(affectedTablet));
+ x->SetFlags(2 /*todo: use generic enum*/);
+ }
+
// TODO: probably want this for drops only
proposal->SetIgnoreLowDiskSpace(true);
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TOperation DoPropose"
- << " send propose"
- << " to coordinator: " << coordinatorId
- << " message:" << message->Record.ShortDebugString());
-
- sideEffects.BindMsgToPipe(TOperationId(TxId, InvalidSubTxId), coordinatorId, TPipeMessageId(0, TxId), message.Release());
- }
-}
-
-void TOperation::RegisterRelationByTabletId(TSubTxId partId, TTabletId tablet, const TActorContext& ctx) {
- if (RelationsByTabletId.contains(tablet)) {
- if (RelationsByTabletId.at(tablet) != partId) {
- // it is Ok if Hive otherwise it is error
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TOperation RegisterRelationByTabletId"
- << " collision in routes has found"
- << ", TxId: " << TxId
- << ", partId: " << partId
- << ", prev tablet: " << RelationsByTabletId.at(tablet)
- << ", new tablet: " << tablet);
-
- RelationsByTabletId.erase(tablet);
- }
- return;
- }
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TOperation RegisterRelationByTabletId"
- << ", TxId: " << TxId
- << ", partId: " << partId
- << ", tablet: " << tablet);
-
- RelationsByTabletId[tablet] = partId;
-}
-
-TSubTxId TOperation::FindRelatedPartByTabletId(TTabletId tablet, const TActorContext& ctx) {
- auto partIdPtr = RelationsByTabletId.FindPtr(tablet);
- auto partId = partIdPtr == nullptr ? InvalidSubTxId : *partIdPtr;
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TOperation FindRelatedPartByTabletId"
- << ", TxId: " << TxId
- << ", tablet: " << tablet
- << ", partId: " << partId);
-
- return partId;
-}
-
-void TOperation::RegisterRelationByShardIdx(TSubTxId partId, TShardIdx shardIdx, const TActorContext& ctx) {
- if (RelationsByShardIdx.contains(shardIdx)) {
- Y_VERIFY(RelationsByShardIdx.at(shardIdx) == partId);
- return;
- }
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TOperation RegisterRelationByShardIdx"
- << ", TxId: " << TxId
- << ", shardIdx: " << shardIdx
- << ", partId: " << partId);
-
- RelationsByShardIdx[shardIdx] = partId;
-}
-
-
-TSubTxId TOperation::FindRelatedPartByShardIdx(TShardIdx shardIdx, const TActorContext& ctx) {
- auto partIdPtr = RelationsByShardIdx.FindPtr(shardIdx);
- auto partId = partIdPtr == nullptr ? InvalidSubTxId : *partIdPtr;
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TOperation FindRelatedPartByShardIdx"
- << ", TxId: " << TxId
- << ", shardIdx: " << shardIdx
- << ", partId: " << partId);
-
- return partId;
-}
-
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TOperation DoPropose"
+ << " send propose"
+ << " to coordinator: " << coordinatorId
+ << " message:" << message->Record.ShortDebugString());
+
+ sideEffects.BindMsgToPipe(TOperationId(TxId, InvalidSubTxId), coordinatorId, TPipeMessageId(0, TxId), message.Release());
+ }
+}
+
+void TOperation::RegisterRelationByTabletId(TSubTxId partId, TTabletId tablet, const TActorContext& ctx) {
+ if (RelationsByTabletId.contains(tablet)) {
+ if (RelationsByTabletId.at(tablet) != partId) {
+ // it is Ok if Hive otherwise it is error
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TOperation RegisterRelationByTabletId"
+ << " collision in routes has found"
+ << ", TxId: " << TxId
+ << ", partId: " << partId
+ << ", prev tablet: " << RelationsByTabletId.at(tablet)
+ << ", new tablet: " << tablet);
+
+ RelationsByTabletId.erase(tablet);
+ }
+ return;
+ }
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TOperation RegisterRelationByTabletId"
+ << ", TxId: " << TxId
+ << ", partId: " << partId
+ << ", tablet: " << tablet);
+
+ RelationsByTabletId[tablet] = partId;
+}
+
+TSubTxId TOperation::FindRelatedPartByTabletId(TTabletId tablet, const TActorContext& ctx) {
+ auto partIdPtr = RelationsByTabletId.FindPtr(tablet);
+ auto partId = partIdPtr == nullptr ? InvalidSubTxId : *partIdPtr;
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TOperation FindRelatedPartByTabletId"
+ << ", TxId: " << TxId
+ << ", tablet: " << tablet
+ << ", partId: " << partId);
+
+ return partId;
+}
+
+void TOperation::RegisterRelationByShardIdx(TSubTxId partId, TShardIdx shardIdx, const TActorContext& ctx) {
+ if (RelationsByShardIdx.contains(shardIdx)) {
+ Y_VERIFY(RelationsByShardIdx.at(shardIdx) == partId);
+ return;
+ }
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TOperation RegisterRelationByShardIdx"
+ << ", TxId: " << TxId
+ << ", shardIdx: " << shardIdx
+ << ", partId: " << partId);
+
+ RelationsByShardIdx[shardIdx] = partId;
+}
+
+
+TSubTxId TOperation::FindRelatedPartByShardIdx(TShardIdx shardIdx, const TActorContext& ctx) {
+ auto partIdPtr = RelationsByShardIdx.FindPtr(shardIdx);
+ auto partId = partIdPtr == nullptr ? InvalidSubTxId : *partIdPtr;
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TOperation FindRelatedPartByShardIdx"
+ << ", TxId: " << TxId
+ << ", shardIdx: " << shardIdx
+ << ", partId: " << partId);
+
+ return partId;
+}
+
void TOperation::WaitShardCreated(TShardIdx shardIdx, TSubTxId partId) {
WaitingShardCreatedByShard[shardIdx].insert(partId);
WaitingShardCreatedByPart[partId].insert(shardIdx);
-}
+}
TVector<TSubTxId> TOperation::ActivateShardCreated(TShardIdx shardIdx) {
TVector<TSubTxId> parts;
@@ -1371,50 +1371,50 @@ TVector<TSubTxId> TOperation::ActivateShardCreated(TShardIdx shardIdx) {
}
return parts;
-}
+}
+
+void TOperation::RegisterWaitPublication(TSubTxId partId, TPathId pathId, ui64 pathVersion) {
+ auto publication = TPublishPath(pathId, pathVersion);
+ WaitingPublicationsByPart[partId].insert(publication);
+ WaitingPublicationsByPath[publication].insert(partId);
+}
+
+TSet<TOperationId> TOperation::ActivatePartsWaitPublication(TPathId pathId, ui64 pathVersion) {
+ TSet<TOperationId> activateParts;
+
+ auto it = WaitingPublicationsByPath.lower_bound({pathId, 0}); // iterate all path version [0; pathVersion]
+ while (it != WaitingPublicationsByPath.end()
+ && it->first.first == pathId && it->first.second <= pathVersion)
+ {
+ auto waitVersion = it->first.second;
+
+ for (const auto& partId: it->second) {
+ LOG_INFO_S(TlsActivationContext->AsActorContext(), NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "ActivateWaitPublication, publication confirmed"
+ << ", opId: " << TOperationId(TxId, partId)
+ << ", pathId: " << pathId
+ << ", version: " << waitVersion);
+
+ WaitingPublicationsByPart[partId].erase(TPublishPath(pathId, waitVersion));
+ if (WaitingPublicationsByPart.at(partId).empty()) {
+ WaitingPublicationsByPart.erase(partId);
+ }
+
+ activateParts.insert(TOperationId(TxId, partId)); // activate on every path
+ }
+
+ it = WaitingPublicationsByPath.erase(it); // move iterator it forwart to the next element
+ }
+
+ return activateParts;
+}
+
+ui64 TOperation::CountWaitPublication(TOperationId opId) {
+ if (WaitingPublicationsByPart.contains(opId.GetSubTxId())) {
+ return WaitingPublicationsByPart.at(opId.GetSubTxId()).size();
+ }
+ return 0;
+}
-void TOperation::RegisterWaitPublication(TSubTxId partId, TPathId pathId, ui64 pathVersion) {
- auto publication = TPublishPath(pathId, pathVersion);
- WaitingPublicationsByPart[partId].insert(publication);
- WaitingPublicationsByPath[publication].insert(partId);
}
-
-TSet<TOperationId> TOperation::ActivatePartsWaitPublication(TPathId pathId, ui64 pathVersion) {
- TSet<TOperationId> activateParts;
-
- auto it = WaitingPublicationsByPath.lower_bound({pathId, 0}); // iterate all path version [0; pathVersion]
- while (it != WaitingPublicationsByPath.end()
- && it->first.first == pathId && it->first.second <= pathVersion)
- {
- auto waitVersion = it->first.second;
-
- for (const auto& partId: it->second) {
- LOG_INFO_S(TlsActivationContext->AsActorContext(), NKikimrServices::FLAT_TX_SCHEMESHARD,
- "ActivateWaitPublication, publication confirmed"
- << ", opId: " << TOperationId(TxId, partId)
- << ", pathId: " << pathId
- << ", version: " << waitVersion);
-
- WaitingPublicationsByPart[partId].erase(TPublishPath(pathId, waitVersion));
- if (WaitingPublicationsByPart.at(partId).empty()) {
- WaitingPublicationsByPart.erase(partId);
- }
-
- activateParts.insert(TOperationId(TxId, partId)); // activate on every path
- }
-
- it = WaitingPublicationsByPath.erase(it); // move iterator it forwart to the next element
- }
-
- return activateParts;
}
-
-ui64 TOperation::CountWaitPublication(TOperationId opId) {
- if (WaitingPublicationsByPart.contains(opId.GetSubTxId())) {
- return WaitingPublicationsByPart.at(opId.GetSubTxId()).size();
- }
- return 0;
-}
-
-}
-}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation.h b/ydb/core/tx/schemeshard/schemeshard__operation.h
index ae4b16d0cb5..52f1848aa12 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation.h
+++ b/ydb/core/tx/schemeshard/schemeshard__operation.h
@@ -1,144 +1,144 @@
-#pragma once
-
-#include "schemeshard__operation_part.h"
-#include "schemeshard_tx_infly.h"
-
-#include <util/generic/set.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-struct TOperation: TSimpleRefCount<TOperation> {
- using TPtr = TIntrusivePtr<TOperation>;
-
- TTxId TxId;
- TVector<ISubOperationBase::TPtr> Parts;
-
+#pragma once
+
+#include "schemeshard__operation_part.h"
+#include "schemeshard_tx_infly.h"
+
+#include <util/generic/set.h>
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+struct TOperation: TSimpleRefCount<TOperation> {
+ using TPtr = TIntrusivePtr<TOperation>;
+
+ TTxId TxId;
+ TVector<ISubOperationBase::TPtr> Parts;
+
THashSet<TActorId> Subscribers;
- THashSet<TTxId> DependentOperations;
- THashSet<TTxId> WaitOperations;
-
- using TPreSerialisedMessage = std::pair<ui32, TIntrusivePtr<TEventSerializedData>>; // ui32 it's a type
- THashMap<TTabletId, TMap<TPipeMessageId, TPreSerialisedMessage>> PipeBindedMessages; // std::pair<ui64, ui64> it's a cookie
-
- THashMap<TTabletId, TSubTxId> RelationsByTabletId;
- THashMap<TShardIdx, TSubTxId> RelationsByShardIdx;
-
- TSet<TSubTxId> ReadyToProposeParts;
- using TProposeRec = std::tuple<TSubTxId, TPathId, TStepId>;
- TDeque<TProposeRec> Proposes;
-
- using TProposeShards = std::tuple<TSubTxId, TTabletId>;
- TDeque<TProposeShards> ShardsProposes;
-
+ THashSet<TTxId> DependentOperations;
+ THashSet<TTxId> WaitOperations;
+
+ using TPreSerialisedMessage = std::pair<ui32, TIntrusivePtr<TEventSerializedData>>; // ui32 it's a type
+ THashMap<TTabletId, TMap<TPipeMessageId, TPreSerialisedMessage>> PipeBindedMessages; // std::pair<ui64, ui64> it's a cookie
+
+ THashMap<TTabletId, TSubTxId> RelationsByTabletId;
+ THashMap<TShardIdx, TSubTxId> RelationsByShardIdx;
+
+ TSet<TSubTxId> ReadyToProposeParts;
+ using TProposeRec = std::tuple<TSubTxId, TPathId, TStepId>;
+ TDeque<TProposeRec> Proposes;
+
+ using TProposeShards = std::tuple<TSubTxId, TTabletId>;
+ TDeque<TProposeShards> ShardsProposes;
+
using TPublishPath = std::pair<TPathId, ui64>;
TSet<TPublishPath> Publications;
- THashSet<TSubTxId> ReadyToNotifyParts;
- THashSet<TSubTxId> DoneParts;
- THashMap<TPathId, NKikimrSchemeOp::EPathState> ReleasePathAtDone;
-
+ THashSet<TSubTxId> ReadyToNotifyParts;
+ THashSet<TSubTxId> DoneParts;
+ THashMap<TPathId, NKikimrSchemeOp::EPathState> ReleasePathAtDone;
+
THashMap<TShardIdx, THashSet<TSubTxId>> WaitingShardCreatedByShard;
THashMap<TSubTxId, THashSet<TShardIdx>> WaitingShardCreatedByPart;
- TMap<TSubTxId, TSet<TPublishPath>> WaitingPublicationsByPart;
- TMap<TPublishPath, TSet<TSubTxId>> WaitingPublicationsByPath;
-
- TMap<TString, TSet<TSubTxId>> Barriers;
-
+ TMap<TSubTxId, TSet<TPublishPath>> WaitingPublicationsByPart;
+ TMap<TPublishPath, TSet<TSubTxId>> WaitingPublicationsByPath;
+
+ TMap<TString, TSet<TSubTxId>> Barriers;
+
struct TConsumeQuotaResult {
- NKikimrScheme::EStatus Status = NKikimrScheme::StatusSuccess;
+ NKikimrScheme::EStatus Status = NKikimrScheme::StatusSuccess;
TString Reason;
};
struct TSplitTransactionsResult {
- NKikimrScheme::EStatus Status = NKikimrScheme::StatusSuccess;
+ NKikimrScheme::EStatus Status = NKikimrScheme::StatusSuccess;
TString Reason;
TVector<TTxTransaction> Transactions;
};
- TOperation(TTxId txId)
- : TxId(txId)
- {}
- ~TOperation() = default;
-
- TTxId GetTxId() const { return TxId; }
-
+ TOperation(TTxId txId)
+ : TxId(txId)
+ {}
+ ~TOperation() = default;
+
+ TTxId GetTxId() const { return TxId; }
+
static TConsumeQuotaResult ConsumeQuota(const TTxTransaction& tx, const TOperationContext& context);
static TSplitTransactionsResult SplitIntoTransactions(const TTxTransaction& tx, const TOperationContext& context);
- ISubOperationBase::TPtr RestorePart(TTxState::ETxType opType, TTxState::ETxState opState);
-
- ISubOperationBase::TPtr ConstructPart(NKikimrSchemeOp::EOperationType opType, const TTxTransaction& tx);
- TVector<ISubOperationBase::TPtr> ConstructParts(const TTxTransaction& tx, TOperationContext& context);
- void AddPart(ISubOperationBase::TPtr part) { Parts.push_back(part);}
-
+ ISubOperationBase::TPtr RestorePart(TTxState::ETxType opType, TTxState::ETxState opState);
+
+ ISubOperationBase::TPtr ConstructPart(NKikimrSchemeOp::EOperationType opType, const TTxTransaction& tx);
+ TVector<ISubOperationBase::TPtr> ConstructParts(const TTxTransaction& tx, TOperationContext& context);
+ void AddPart(ISubOperationBase::TPtr part) { Parts.push_back(part);}
+
bool AddPublishingPath(TPathId pathId, ui64 version);
bool IsPublished() const;
- void ReadyToNotifyPart(TSubTxId partId);
- bool IsReadyToNotify(const TActorContext& ctx) const;
- bool IsReadyToNotify() const;
+ void ReadyToNotifyPart(TSubTxId partId);
+ bool IsReadyToNotify(const TActorContext& ctx) const;
+ bool IsReadyToNotify() const;
void AddNotifySubscriber(const TActorId& actorId);
- void DoNotify(TSchemeShard* ss, TSideEffects& sideEffects, const TActorContext& ctx);
-
- bool IsReadyToDone(const TActorContext& ctx) const;
-
- //propose operation to coordinator
- bool IsReadyToPropose(const TActorContext& ctx) const;
- bool IsReadyToPropose() const;
- void ProposePart(TSubTxId partId, TPathId pathId, TStepId minStep);
- void ProposePart(TSubTxId partId, TTabletId tableId);
- void DoPropose(TSchemeShard* ss, TSideEffects& sideEffects, const TActorContext& ctx) const;
-
- //route incomming messages to the parts
- void RegisterRelationByTabletId(TSubTxId partId, TTabletId tablet, const TActorContext& ctx);
- void RegisterRelationByShardIdx(TSubTxId partId, TShardIdx shardIdx, const TActorContext& ctx);
- TSubTxId FindRelatedPartByTabletId(TTabletId tablet, const TActorContext& ctx);
- TSubTxId FindRelatedPartByShardIdx(TShardIdx shardIdx, const TActorContext& ctx);
-
+ void DoNotify(TSchemeShard* ss, TSideEffects& sideEffects, const TActorContext& ctx);
+
+ bool IsReadyToDone(const TActorContext& ctx) const;
+
+ //propose operation to coordinator
+ bool IsReadyToPropose(const TActorContext& ctx) const;
+ bool IsReadyToPropose() const;
+ void ProposePart(TSubTxId partId, TPathId pathId, TStepId minStep);
+ void ProposePart(TSubTxId partId, TTabletId tableId);
+ void DoPropose(TSchemeShard* ss, TSideEffects& sideEffects, const TActorContext& ctx) const;
+
+ //route incomming messages to the parts
+ void RegisterRelationByTabletId(TSubTxId partId, TTabletId tablet, const TActorContext& ctx);
+ void RegisterRelationByShardIdx(TSubTxId partId, TShardIdx shardIdx, const TActorContext& ctx);
+ TSubTxId FindRelatedPartByTabletId(TTabletId tablet, const TActorContext& ctx);
+ TSubTxId FindRelatedPartByShardIdx(TShardIdx shardIdx, const TActorContext& ctx);
+
void WaitShardCreated(TShardIdx shardIdx, TSubTxId partId);
TVector<TSubTxId> ActivateShardCreated(TShardIdx shardIdx);
- void RegisterWaitPublication(TSubTxId partId, TPathId pathId, ui64 pathVersion);
- TSet<TOperationId> ActivatePartsWaitPublication(TPathId pathId, ui64 pathVersion);
- ui64 CountWaitPublication(TOperationId opId);
-
- void RegisterBarrier(TSubTxId partId, TString name) {
- Barriers[name].insert(partId);
- Y_VERIFY(Barriers.size() == 1);
- }
-
- bool HasBarrier() {
- Y_VERIFY(Barriers.size() <= 1);
- return Barriers.size() == 1;
- }
-
- bool IsDoneBarrier() {
- Y_VERIFY(Barriers.size() <= 1);
- for (const auto& item: Barriers) {
- for (TSubTxId blocked: item.second) {
- Y_VERIFY_S(!DoneParts.contains(blocked), "part is blocked and done: " << blocked);
- }
- return item.second.size() + DoneParts.size() == Parts.size();
- }
-
- return false;
- }
-
- void DropBarrier(TString name) {
- Y_VERIFY(IsDoneBarrier());
- Y_VERIFY(Barriers.begin()->first == name);
- Barriers.erase(name);
- }
-private:
- TOperationId NextPartId() { return TOperationId(TxId, TSubTxId(Parts.size())); }
-};
-
+ void RegisterWaitPublication(TSubTxId partId, TPathId pathId, ui64 pathVersion);
+ TSet<TOperationId> ActivatePartsWaitPublication(TPathId pathId, ui64 pathVersion);
+ ui64 CountWaitPublication(TOperationId opId);
+
+ void RegisterBarrier(TSubTxId partId, TString name) {
+ Barriers[name].insert(partId);
+ Y_VERIFY(Barriers.size() == 1);
+ }
+
+ bool HasBarrier() {
+ Y_VERIFY(Barriers.size() <= 1);
+ return Barriers.size() == 1;
+ }
+
+ bool IsDoneBarrier() {
+ Y_VERIFY(Barriers.size() <= 1);
+ for (const auto& item: Barriers) {
+ for (TSubTxId blocked: item.second) {
+ Y_VERIFY_S(!DoneParts.contains(blocked), "part is blocked and done: " << blocked);
+ }
+ return item.second.size() + DoneParts.size() == Parts.size();
+ }
+
+ return false;
+ }
+
+ void DropBarrier(TString name) {
+ Y_VERIFY(IsDoneBarrier());
+ Y_VERIFY(Barriers.begin()->first == name);
+ Barriers.erase(name);
+ }
+private:
+ TOperationId NextPartId() { return TOperationId(TxId, TSubTxId(Parts.size())); }
+};
+
inline TOperationId NextPartId(const TOperationId& opId, const TVector<ISubOperationBase::TPtr>& parts) {
return TOperationId(opId.GetTxId(), opId.GetSubTxId() + parts.size());
-}
+}
-}
+}
}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp
index 8a0ba4dd257..27455e46270 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_bsv.cpp
@@ -1,103 +1,103 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
#include <ydb/core/persqueue/config/config.h>
#include <ydb/core/mind/hive/hive.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TAlterBlockStoreVolume: public TSubOperation {
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TAlterBlockStoreVolume: public TSubOperation {
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::CreateParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
- return TTxState::ConfigureParts;
- case TTxState::ConfigureParts:
- return TTxState::Propose; // DONE ???
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::CreateParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
+ return TTxState::ConfigureParts;
+ case TTxState::ConfigureParts:
+ return TTxState::Propose; // DONE ???
case TTxState::Propose:
return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
return THolder(new TCreateParts(OperationId));
- case TTxState::ConfigureParts:
+ case TTxState::ConfigureParts:
return THolder(new NBSVState::TConfigureParts(OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new NBSVState::TPropose(OperationId));
case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TAlterBlockStoreVolume(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TAlterBlockStoreVolume(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- TTxState& PrepareChanges(
- TOperationId operationId, TPathElement::TPtr item,
- TBlockStoreVolumeInfo::TPtr volume,
+
+ TAlterBlockStoreVolume(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ TTxState& PrepareChanges(
+ TOperationId operationId, TPathElement::TPtr item,
+ TBlockStoreVolumeInfo::TPtr volume,
const TChannelsBindings& partitionChannels,
const TChannelsBindings& volumeChannels,
- ui64 shardsToCreate,
- TOperationContext& context)
- {
- NIceDb::TNiceDb db(context.Txc.DB);
-
- item->LastTxId = operationId.GetTxId();
- item->PathState = TPathElement::EPathState::EPathStateAlter;
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxAlterBlockStoreVolume, item->PathId);
- txState.State = TTxState::CreateParts;
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "AlterBlockStoreVolume opId# " << operationId
- << " AlterVersion# " << volume->AlterData->AlterVersion
+ ui64 shardsToCreate,
+ TOperationContext& context)
+ {
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ item->LastTxId = operationId.GetTxId();
+ item->PathState = TPathElement::EPathState::EPathStateAlter;
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxAlterBlockStoreVolume, item->PathId);
+ txState.State = TTxState::CreateParts;
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "AlterBlockStoreVolume opId# " << operationId
+ << " AlterVersion# " << volume->AlterData->AlterVersion
<< " DefaultPartitions#" << volume->DefaultPartitionCount
<< "->" << volume->AlterData->DefaultPartitionCount
<< " ExplicitChannelProfiles#" << volume->ExplicitChannelProfileCount
<< "->" << volume->AlterData->ExplicitChannelProfileCount);
-
+
bool needMoreShards = ApplySharding(
operationId.GetTxId(),
item->PathId,
@@ -107,26 +107,26 @@ public:
volumeChannels,
context);
- if (needMoreShards) {
- context.SS->PersistUpdateNextShardIdx(db);
- }
-
- for (const auto& kv : volume->Shards) {
- auto shardIdx = kv.first;
- const auto& part = kv.second;
- context.SS->PersistBlockStorePartition(db, item->PathId, part->PartitionId, shardIdx, part->AlterVersion);
- }
-
- context.SS->PersistAddBlockStoreVolumeAlter(db, item->PathId, volume->AlterData);
-
- context.OnComplete.ActivateTx(operationId);
-
- context.SS->PersistTxState(db, operationId);
- ui32 checkShardToCreate = 0;
- for (auto shard : txState.Shards) {
+ if (needMoreShards) {
+ context.SS->PersistUpdateNextShardIdx(db);
+ }
+
+ for (const auto& kv : volume->Shards) {
+ auto shardIdx = kv.first;
+ const auto& part = kv.second;
+ context.SS->PersistBlockStorePartition(db, item->PathId, part->PartitionId, shardIdx, part->AlterVersion);
+ }
+
+ context.SS->PersistAddBlockStoreVolumeAlter(db, item->PathId, volume->AlterData);
+
+ context.OnComplete.ActivateTx(operationId);
+
+ context.SS->PersistTxState(db, operationId);
+ ui32 checkShardToCreate = 0;
+ for (auto shard : txState.Shards) {
auto& shardInfo = context.SS->ShardInfos.at(shard.Idx);
shardInfo.CurrentTxId = operationId.GetTxId();
- if (shard.Operation == TTxState::CreateParts) {
+ if (shard.Operation == TTxState::CreateParts) {
context.SS->PersistChannelsBinding(db, shard.Idx, shardInfo.BindedChannels);
context.SS->PersistShardMapping(db, shard.Idx, shardInfo.TabletID, item->PathId, operationId.GetTxId(), shard.TabletType);
if (shardInfo.TabletID == InvalidTabletId) {
@@ -135,37 +135,37 @@ public:
}
} else {
context.SS->PersistShardTx(db, shard.Idx, operationId.GetTxId());
- }
- }
- Y_VERIFY(shardsToCreate == checkShardToCreate);
-
- return txState;
- }
-
+ }
+ }
+ Y_VERIFY(shardsToCreate == checkShardToCreate);
+
+ return txState;
+ }
+
static bool Compare(const TChannelBind& a, const TChannelBind& b)
{
return a.SerializeAsString() == b.SerializeAsString();
}
- bool ApplySharding(
- TTxId txId,
- TPathId pathId,
- TBlockStoreVolumeInfo::TPtr volume,
- TTxState& txState,
+ bool ApplySharding(
+ TTxId txId,
+ TPathId pathId,
+ TBlockStoreVolumeInfo::TPtr volume,
+ TTxState& txState,
const TChannelsBindings& partitionChannels,
const TChannelsBindings& volumeChannels,
- TOperationContext& context)
- {
+ TOperationContext& context)
+ {
Y_VERIFY(volume->AlterData->DefaultPartitionCount
>= volume->DefaultPartitionCount);
ui64 count = volume->AlterData->DefaultPartitionCount + 1;
ui64 shardsToCreate = volume->AlterData->DefaultPartitionCount
- volume->DefaultPartitionCount;
- txState.Shards.reserve(count + 1);
-
- // reconfigure old shards
- for (const auto& kv : volume->Shards) {
- auto shardIdx = kv.first;
+ txState.Shards.reserve(count + 1);
+
+ // reconfigure old shards
+ for (const auto& kv : volume->Shards) {
+ auto shardIdx = kv.first;
auto& shardInfo = context.SS->ShardInfos[shardIdx];
auto partitionOp = TTxState::ConfigureParts;
@@ -186,10 +186,10 @@ public:
} else {
txState.Shards.emplace_back(shardIdx, ETabletType::BlockStorePartition, partitionOp);
}
- }
-
- // create new shards
- for (ui64 i = 0; i < shardsToCreate; ++i) {
+ }
+
+ // create new shards
+ for (ui64 i = 0; i < shardsToCreate; ++i) {
TShardIdx shardIdx;
if (volume->VolumeConfig.GetTabletVersion() == 2) {
shardIdx = context.SS->RegisterShardInfo(TShardInfo::BlockStorePartition2Info(txId, pathId));
@@ -201,13 +201,13 @@ public:
auto& shardInfo = context.SS->ShardInfos.at(shardIdx);
shardInfo.BindedChannels = partitionChannels;
txState.Shards.emplace_back(shardIdx, shardInfo.TabletType, TTxState::CreateParts);
-
- TBlockStorePartitionInfo::TPtr part = new TBlockStorePartitionInfo();
+
+ TBlockStorePartitionInfo::TPtr part = new TBlockStorePartitionInfo();
part->PartitionId = i + volume->DefaultPartitionCount;
- part->AlterVersion = volume->AlterData->AlterVersion;
- volume->Shards[shardIdx] = std::move(part);
- }
-
+ part->AlterVersion = volume->AlterData->AlterVersion;
+ volume->Shards[shardIdx] = std::move(part);
+ }
+
// update the volume shard if needed
auto volumeOp = TTxState::ConfigureParts;
auto shardIdx = volume->VolumeShardIdx;
@@ -220,58 +220,58 @@ public:
shardInfo.BindedChannels[i] = volumeChannels[i];
volumeOp = TTxState::CreateParts;
}
- }
+ }
txState.Shards.emplace_back(shardIdx, ETabletType::BlockStoreVolume, volumeOp);
-
- return shardsToCreate > 0;
- }
-
- const NKikimrBlockStore::TVolumeConfig* ParseParams(
+
+ return shardsToCreate > 0;
+ }
+
+ const NKikimrBlockStore::TVolumeConfig* ParseParams(
const NKikimrBlockStore::TVolumeConfig& baseline,
- const NKikimrSchemeOp::TBlockStoreVolumeDescription& alter,
- TString& errStr)
- {
- if (alter.PartitionsSize() > 0 || alter.HasVolumeTabletId() || alter.HasAlterVersion()) {
- errStr = "Setting schemeshard owned properties is not allowed";
- return nullptr;
- }
- if (alter.HasMountToken()) {
- errStr = "Changing mount token must be done with an assign operation";
- return nullptr;
- }
-
- if (!alter.HasVolumeConfig()) {
- errStr = "Missing changes to volume config";
- return nullptr;
- }
-
- const auto& volumeConfig = alter.GetVolumeConfig();
- if (volumeConfig.HasBlockSize()) {
- errStr = "Cannot change block size after creation";
- return nullptr;
- }
- if (volumeConfig.HasStripeSize()) {
- errStr = "Cannot change stripe size after creation";
- return nullptr;
- }
-
+ const NKikimrSchemeOp::TBlockStoreVolumeDescription& alter,
+ TString& errStr)
+ {
+ if (alter.PartitionsSize() > 0 || alter.HasVolumeTabletId() || alter.HasAlterVersion()) {
+ errStr = "Setting schemeshard owned properties is not allowed";
+ return nullptr;
+ }
+ if (alter.HasMountToken()) {
+ errStr = "Changing mount token must be done with an assign operation";
+ return nullptr;
+ }
+
+ if (!alter.HasVolumeConfig()) {
+ errStr = "Missing changes to volume config";
+ return nullptr;
+ }
+
+ const auto& volumeConfig = alter.GetVolumeConfig();
+ if (volumeConfig.HasBlockSize()) {
+ errStr = "Cannot change block size after creation";
+ return nullptr;
+ }
+ if (volumeConfig.HasStripeSize()) {
+ errStr = "Cannot change stripe size after creation";
+ return nullptr;
+ }
+
// treating missing media kind and 0 (default media kind) in the same way
if (baseline.GetStorageMediaKind() && volumeConfig.HasStorageMediaKind()) {
errStr = TStringBuilder() << "Cannot change media kind after creation"
<< ", current media kind: " << baseline.GetStorageMediaKind()
<< ", attempted to change to: " << volumeConfig.GetStorageMediaKind()
;
- return nullptr;
- }
-
- if (volumeConfig.HasTabletVersion()) {
- errStr = "Cannot change tablet version after creation";
- return nullptr;
- }
-
- return &volumeConfig;
- }
-
+ return nullptr;
+ }
+
+ if (volumeConfig.HasTabletVersion()) {
+ errStr = "Cannot change tablet version after creation";
+ return nullptr;
+ }
+
+ return &volumeConfig;
+ }
+
bool ProcessVolumeChannelProfiles(
const TPath& path,
const NKikimrBlockStore::TVolumeConfig& volumeConfig,
@@ -288,7 +288,7 @@ public:
auto errStr = Sprintf("Wrong number of channels %u , should be %lu",
alterVolumeEcps.size(),
TBlockStoreVolumeInfo::NumVolumeTabletChannels);
- result.SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ result.SetError(NKikimrScheme::StatusInvalidParameter, errStr);
return false;
}
@@ -309,7 +309,7 @@ public:
*volumeChannelsBinding);
if (!volumeChannelsResolved) {
- result.SetError(NKikimrScheme::StatusInvalidParameter,
+ result.SetError(NKikimrScheme::StatusInvalidParameter,
"Unable to construct channel binding for volume with the storage pool");
return false;
}
@@ -317,7 +317,7 @@ public:
} else {
const ui32 volumeProfileId = 0;
if (!context.SS->ResolveTabletChannels(volumeProfileId, path.DomainId(), *volumeChannelsBinding)) {
- result.SetError(NKikimrScheme::StatusInvalidParameter,
+ result.SetError(NKikimrScheme::StatusInvalidParameter,
"Unable to construct channel binding for volume with the profile");
return false;
}
@@ -341,7 +341,7 @@ public:
auto errStr = Sprintf("Wrong number of channels %u , should be [1 .. %lu]",
alterEcps.size(),
NHive::MAX_TABLET_CHANNELS);
- result.SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ result.SetError(NKikimrScheme::StatusInvalidParameter, errStr);
return false;
}
@@ -350,7 +350,7 @@ public:
< volumeConfig.ExplicitChannelProfilesSize())
{
result.SetError(
- NKikimrScheme::StatusInvalidParameter,
+ NKikimrScheme::StatusInvalidParameter,
"Cannot reduce the number of channel profiles");
return false;
}
@@ -365,7 +365,7 @@ public:
alterVolumeConfig.GetExplicitChannelProfiles(i);
if (prevProfile.GetPoolKind() != newProfile.GetPoolKind()) {
result.SetError(
- NKikimrScheme::StatusInvalidParameter,
+ NKikimrScheme::StatusInvalidParameter,
TStringBuilder() << "Cannot change PoolKind for channel " << i
<< ", " << prevProfile.GetPoolKind()
<< " -> " << newProfile.GetPoolKind());
@@ -391,7 +391,7 @@ public:
*partitionChannelsBinding
);
if (!partitionChannelsResolved) {
- result.SetError(NKikimrScheme::StatusInvalidParameter,
+ result.SetError(NKikimrScheme::StatusInvalidParameter,
"Unable to construct channel binding for partition with the storage pool");
return false;
}
@@ -401,84 +401,84 @@ public:
return true;
}
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const auto& alter = Transaction.GetAlterBlockStoreVolume();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = alter.GetName();
const TPathId pathId = alter.HasPathId()
? context.SS->MakeLocalId(alter.GetPathId()) : InvalidPathId;
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterBlockStoreVolume Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", pathId: " << pathId
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterBlockStoreVolume Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", pathId: " << pathId
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
auto result = MakeHolder<TProposeResponse>(
- NKikimrScheme::StatusAccepted,
+ NKikimrScheme::StatusAccepted,
ui64(OperationId.GetTxId()),
ui64(ssId)
);
-
- TString errStr;
-
- if (!alter.HasName() && !alter.HasPathId()) {
+
+ TString errStr;
+
+ if (!alter.HasName() && !alter.HasPathId()) {
errStr = "Neither volume name nor pathId are present in BlockStoreVolume";
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
-
- TPath path = alter.HasPathId()
- ? TPath::Init(pathId, context.SS)
- : TPath::Resolve(parentPathStr, context.SS).Dive(name);
-
- {
- TPath::TChecker checks = path.Check();
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+
+ TPath path = alter.HasPathId()
+ ? TPath::Init(pathId, context.SS)
+ : TPath::Resolve(parentPathStr, context.SS).Dive(name);
+
+ {
+ TPath::TChecker checks = path.Check();
checks
.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .IsBlockStoreVolume()
- .NotUnderOperation()
- .IsCommonSensePath();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .IsBlockStoreVolume()
+ .NotUnderOperation()
+ .IsCommonSensePath();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
TBlockStoreVolumeInfo::TPtr volume = context.SS->BlockStoreVolumes.at(path.Base()->PathId);
Y_VERIFY(volume);
const auto* alterVolumeConfig = ParseParams(volume->VolumeConfig, alter, errStr);
- if (!alterVolumeConfig) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
-
- if (volume->AlterVersion == 0) {
- result->SetError(
- NKikimrScheme::StatusMultipleModifications,
- "Block store volume is not created yet");
- return result;
- }
- if (volume->AlterData) {
- result->SetError(
- NKikimrScheme::StatusMultipleModifications,
- "There's another alter in flight");
- return result;
- }
-
+ if (!alterVolumeConfig) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+
+ if (volume->AlterVersion == 0) {
+ result->SetError(
+ NKikimrScheme::StatusMultipleModifications,
+ "Block store volume is not created yet");
+ return result;
+ }
+ if (volume->AlterData) {
+ result->SetError(
+ NKikimrScheme::StatusMultipleModifications,
+ "There's another alter in flight");
+ return result;
+ }
+
const auto defaultPartitionCount =
TBlockStoreVolumeInfo::CalculateDefaultPartitionCount(volume->VolumeConfig);
const auto newDefaultPartitionCount =
@@ -494,12 +494,12 @@ public:
*result,
&partitionChannelsBinding
);
-
+
if (!channelProfilesProcessed) {
- return result;
- }
- }
-
+ return result;
+ }
+ }
+
TChannelsBindings volumeChannelsBinding;
const auto channelProfilesProcessed = ProcessVolumeChannelProfiles(
path,
@@ -520,11 +520,11 @@ public:
< volume->VolumeConfig.PartitionsSize())
{
result->SetError(
- NKikimrScheme::StatusInvalidParameter,
+ NKikimrScheme::StatusInvalidParameter,
"Cannot reduce the number of partitions");
return result;
}
-
+
for (ui32 i = 0; i < volume->VolumeConfig.PartitionsSize(); ++i) {
if (!volume->VolumeConfig.GetSizeDecreaseAllowed()) {
const auto newBlockCount =
@@ -533,7 +533,7 @@ public:
volume->VolumeConfig.GetPartitions(i).GetBlockCount();
if (newBlockCount < prevBlockCount) {
result->SetError(
- NKikimrScheme::StatusInvalidParameter,
+ NKikimrScheme::StatusInvalidParameter,
"Decreasing block count is not allowed");
return result;
}
@@ -543,7 +543,7 @@ public:
!= volume->VolumeConfig.GetPartitions(i).GetType())
{
result->SetError(
- NKikimrScheme::StatusInvalidParameter,
+ NKikimrScheme::StatusInvalidParameter,
"partition type can't be changed");
return result;
}
@@ -554,43 +554,43 @@ public:
alterVolumeConfig->GetVersion() != volume->AlterVersion)
{
result->SetError(
- NKikimrScheme::StatusPreconditionFailed,
+ NKikimrScheme::StatusPreconditionFailed,
"Wrong version in VolumeConfig");
return result;
}
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
ui64 shardsToCreate = newDefaultPartitionCount
? newDefaultPartitionCount - defaultPartitionCount
- : 0;
-
- {
- TPath::TChecker checks = path.Check();
- checks
- .ShardsLimit(shardsToCreate)
- .PathShardsLimit(shardsToCreate);
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
+ : 0;
+
+ {
+ TPath::TChecker checks = path.Check();
+ checks
+ .ShardsLimit(shardsToCreate)
+ .PathShardsLimit(shardsToCreate);
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
auto oldVolumeSpace = volume->GetVolumeSpace();
-
- TBlockStoreVolumeInfo::TPtr alterData = new TBlockStoreVolumeInfo();
- alterData->VolumeConfig.CopyFrom(volume->VolumeConfig);
- if (alterVolumeConfig->PartitionsSize() > 0) {
- // MergeFrom will append partitions, we want a replace operation instead
- alterData->VolumeConfig.ClearPartitions();
- }
+
+ TBlockStoreVolumeInfo::TPtr alterData = new TBlockStoreVolumeInfo();
+ alterData->VolumeConfig.CopyFrom(volume->VolumeConfig);
+ if (alterVolumeConfig->PartitionsSize() > 0) {
+ // MergeFrom will append partitions, we want a replace operation instead
+ alterData->VolumeConfig.ClearPartitions();
+ }
if (alterVolumeConfig->ExplicitChannelProfilesSize() > 0) {
// MergeFrom will append explicit channel profiles, we want a replace operation instead
alterData->VolumeConfig.ClearExplicitChannelProfiles();
@@ -603,29 +603,29 @@ public:
// MergeFrom will append tags, we want a replace operation instead
alterData->VolumeConfig.ClearTags();
}
- alterData->VolumeConfig.MergeFrom(*alterVolumeConfig);
+ alterData->VolumeConfig.MergeFrom(*alterVolumeConfig);
alterData->VolumeConfig.ClearSizeDecreaseAllowed();
alterData->VolumeConfig.ClearPoolKindChangeAllowed();
alterData->DefaultPartitionCount =
TBlockStoreVolumeInfo::CalculateDefaultPartitionCount(alterData->VolumeConfig);
alterData->ExplicitChannelProfileCount = alterData->VolumeConfig.ExplicitChannelProfilesSize();
- volume->PrepareAlter(alterData);
-
+ volume->PrepareAlter(alterData);
+
auto newVolumeSpace = volume->GetVolumeSpace();
-
+
auto domainDir = context.SS->PathsById.at(path.DomainId());
Y_VERIFY(domainDir);
auto checkedSpaceChange = domainDir->CheckVolumeSpaceChange(newVolumeSpace, oldVolumeSpace, errStr);
if (!checkedSpaceChange) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- volume->ForgetAlter();
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ volume->ForgetAlter();
+ return result;
+ }
+
// Increase in occupied space is applied immediately
domainDir->ChangeVolumeSpaceBegin(newVolumeSpace, oldVolumeSpace);
-
+
const TTxState& txState = PrepareChanges(
OperationId,
path.Base(),
@@ -634,48 +634,48 @@ public:
volumeChannelsBinding,
shardsToCreate,
context);
-
- context.SS->ClearDescribePathCaches(path.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
-
- TSubDomainInfo::TPtr domainInfo = path.DomainInfo();
- domainInfo->AddInternalShards(txState);
-
- path.Base()->IncShardsInside(shardsToCreate);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+
+ context.SS->ClearDescribePathCaches(path.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
+
+ TSubDomainInfo::TPtr domainInfo = path.DomainInfo();
+ domainInfo->AddInternalShards(txState);
+
+ path.Base()->IncShardsInside(shardsToCreate);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TAlterBlockStoreVolume");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterBlockStoreVolume AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterBlockStoreVolume AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateAlterBSV(TOperationId id, const TTxTransaction& tx) {
return new TAlterBlockStoreVolume(id, tx);
}
-ISubOperationBase::TPtr CreateAlterBSV(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateAlterBSV(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TAlterBlockStoreVolume(id, state);
-}
-
-}
-}
+ return new TAlterBlockStoreVolume(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_cdc_stream.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_cdc_stream.cpp
index 76ba6a1b742..d7027b570e6 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_cdc_stream.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_cdc_stream.cpp
@@ -7,7 +7,7 @@
#define LOG_N(stream) LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "[" << context.SS->TabletID() << "] " << stream)
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
namespace {
@@ -121,7 +121,7 @@ public:
SetState(SelectStateFunc(state));
}
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
const auto& workingDir = Transaction.GetWorkingDir();
const auto& op = Transaction.GetAlterCdcStream();
const auto& streamName = op.GetStreamName();
@@ -130,7 +130,7 @@ public:
<< ": opId# " << OperationId
<< ", stream# " << workingDir << "/" << streamName);
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), context.SS->TabletID());
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), context.SS->TabletID());
const auto streamPath = TPath::Resolve(workingDir, context.SS).Dive(streamName);
{
@@ -183,11 +183,11 @@ public:
Y_VERIFY(streamAlter);
switch (op.GetActionCase()) {
- case NKikimrSchemeOp::TAlterCdcStream::kDisable:
+ case NKikimrSchemeOp::TAlterCdcStream::kDisable:
streamAlter->State = TCdcStreamInfo::EState::ECdcStreamStateDisabled;
break;
default:
- result->SetError(NKikimrScheme::StatusInvalidParameter, TStringBuilder()
+ result->SetError(NKikimrScheme::StatusInvalidParameter, TStringBuilder()
<< "Unknown action: " << static_cast<ui32>(op.GetActionCase()));
return result;
}
@@ -327,7 +327,7 @@ public:
SetState(SelectStateFunc(state));
}
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
const auto& workingDir = Transaction.GetWorkingDir();
const auto& op = Transaction.GetAlterCdcStream();
const auto& tableName = op.GetTableName();
@@ -337,7 +337,7 @@ public:
<< ": opId# " << OperationId
<< ", stream# " << workingDir << "/" << tableName << "/" << streamName);
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), context.SS->TabletID());
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), context.SS->TabletID());
const auto tablePath = TPath::Resolve(workingDir, context.SS).Dive(tableName);
{
@@ -384,12 +384,12 @@ public:
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
return result;
}
if (!context.SS->CheckLocks(tablePath.Base()->PathId, Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
+ result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
return result;
}
@@ -411,7 +411,7 @@ public:
auto& txState = context.SS->CreateTx(OperationId, TTxState::TxAlterCdcStreamAtTable, tablePath.Base()->PathId);
txState.State = TTxState::ConfigureParts;
- tablePath.Base()->PathState = NKikimrSchemeOp::EPathStateAlter;
+ tablePath.Base()->PathState = NKikimrSchemeOp::EPathStateAlter;
tablePath.Base()->LastTxId = OperationId.GetTxId();
for (const auto& splitOpId : table->GetSplitOpsInFlight()) {
@@ -463,7 +463,7 @@ ISubOperationBase::TPtr CreateAlterCdcStreamAtTable(TOperationId id, TTxState::E
}
TVector<ISubOperationBase::TPtr> CreateAlterCdcStream(TOperationId opId, const TTxTransaction& tx, TOperationContext& context) {
- Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStream);
+ Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStream);
LOG_D("CreateAlterCdcStream"
<< ": opId# " << opId
@@ -516,24 +516,24 @@ TVector<ISubOperationBase::TPtr> CreateAlterCdcStream(TOperationId opId, const T
TString errStr;
if (!context.SS->CheckApplyIf(tx, errStr)) {
- return {CreateReject(opId, NKikimrScheme::StatusPreconditionFailed, errStr)};
+ return {CreateReject(opId, NKikimrScheme::StatusPreconditionFailed, errStr)};
}
if (!context.SS->CheckLocks(tablePath.Base()->PathId, tx, errStr)) {
- return {CreateReject(opId, NKikimrScheme::StatusMultipleModifications, errStr)};
+ return {CreateReject(opId, NKikimrScheme::StatusMultipleModifications, errStr)};
}
TVector<ISubOperationBase::TPtr> result;
{
- auto outTx = TransactionTemplate(tablePath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStreamImpl);
+ auto outTx = TransactionTemplate(tablePath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStreamImpl);
outTx.MutableAlterCdcStream()->CopyFrom(op);
result.push_back(CreateAlterCdcStreamImpl(NextPartId(opId, result), outTx));
}
{
- auto outTx = TransactionTemplate(workingDirPath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStreamAtTable);
+ auto outTx = TransactionTemplate(workingDirPath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpAlterCdcStreamAtTable);
outTx.MutableAlterCdcStream()->CopyFrom(op);
result.push_back(CreateAlterCdcStreamAtTable(NextPartId(opId, result), outTx));
@@ -542,5 +542,5 @@ TVector<ISubOperationBase::TPtr> CreateAlterCdcStream(TOperationId opId, const T
return result;
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_extsubdomain.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_extsubdomain.cpp
index c1bf41898da..463f3bb3cf9 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_extsubdomain.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_extsubdomain.cpp
@@ -1,388 +1,388 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
#include <ydb/core/persqueue/config/config.h>
-
-namespace {
-
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-void DeclareShards(TTxState& txState, TTxId txId, TPathId pathId,
- ui32 count, TTabletTypes::EType type,
- const TChannelsBindings& channelsBindings,
- TSchemeShard* ss)
-{
- txState.Shards.reserve(count);
- for (ui64 i = 0; i < count; ++i) {
+
+namespace {
+
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+void DeclareShards(TTxState& txState, TTxId txId, TPathId pathId,
+ ui32 count, TTabletTypes::EType type,
+ const TChannelsBindings& channelsBindings,
+ TSchemeShard* ss)
+{
+ txState.Shards.reserve(count);
+ for (ui64 i = 0; i < count; ++i) {
auto shardId = ss->RegisterShardInfo(
TShardInfo(txId, pathId, type)
.WithBindedChannels(channelsBindings));
- txState.Shards.emplace_back(shardId, type, TTxState::CreateParts);
- }
-}
-
-void PersistShards(NIceDb::TNiceDb& db, TTxState& txState, ui64 shardsToCreate, TSchemeShard* ss) {
- for (const auto& shard : txState.Shards) {
- Y_VERIFY(shard.Operation == TTxState::ETxState::CreateParts);
- Y_VERIFY(ss->ShardInfos.contains(shard.Idx), "shard info is set before");
- auto& shardInfo = ss->ShardInfos[shard.Idx];
- ss->PersistShardMapping(db, shard.Idx, InvalidTabletId, shardInfo.PathId, shardInfo.CurrentTxId, shardInfo.TabletType);
- ss->PersistChannelsBinding(db, shard.Idx, shardInfo.BindedChannels);
- }
- Y_VERIFY(shardsToCreate == txState.Shards.size());
-}
-
-class TAlterExtSubDomain: public TSubOperation {
+ txState.Shards.emplace_back(shardId, type, TTxState::CreateParts);
+ }
+}
+
+void PersistShards(NIceDb::TNiceDb& db, TTxState& txState, ui64 shardsToCreate, TSchemeShard* ss) {
+ for (const auto& shard : txState.Shards) {
+ Y_VERIFY(shard.Operation == TTxState::ETxState::CreateParts);
+ Y_VERIFY(ss->ShardInfos.contains(shard.Idx), "shard info is set before");
+ auto& shardInfo = ss->ShardInfos[shard.Idx];
+ ss->PersistShardMapping(db, shard.Idx, InvalidTabletId, shardInfo.PathId, shardInfo.CurrentTxId, shardInfo.TabletType);
+ ss->PersistChannelsBinding(db, shard.Idx, shardInfo.BindedChannels);
+ }
+ Y_VERIFY(shardsToCreate == txState.Shards.size());
+}
+
+class TAlterExtSubDomain: public TSubOperation {
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::CreateParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
- return TTxState::ConfigureParts;
- case TTxState::ConfigureParts:
- return TTxState::Propose; // DONE ???
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::CreateParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
+ return TTxState::ConfigureParts;
+ case TTxState::ConfigureParts:
+ return TTxState::Propose; // DONE ???
case TTxState::Propose:
return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
return THolder(new TCreateParts(OperationId));
- case TTxState::ConfigureParts:
+ case TTxState::ConfigureParts:
return THolder(new NSubDomainState::TConfigureParts(OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new NSubDomainState::TPropose(OperationId));
case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TAlterExtSubDomain(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TAlterExtSubDomain(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+
+ TAlterExtSubDomain(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const auto& settings = Transaction.GetSubDomain();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = settings.GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterExtSubDomain Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
- auto result = MakeHolder<TProposeResponse>(status, ui64(OperationId.GetTxId()), ui64(ssId));
-
- if (!parentPathStr) {
- result->SetError(NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: no working dir");
- return result;
- }
-
- if (!name) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: no name");
- return result;
- }
-
- TPath path = TPath::Resolve(parentPathStr, context.SS).Dive(name);
-
- {
- TPath::TChecker checks = path.Check();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterExtSubDomain Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
+ auto result = MakeHolder<TProposeResponse>(status, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ if (!parentPathStr) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: no working dir");
+ return result;
+ }
+
+ if (!name) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: no name");
+ return result;
+ }
+
+ TPath path = TPath::Resolve(parentPathStr, context.SS).Dive(name);
+
+ {
+ TPath::TChecker checks = path.Check();
checks
.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .IsExternalSubDomain()
- .NotUnderOperation()
- .IsCommonSensePath();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- TPathElement::TPtr subDomain = path.Base();
-
- Y_VERIFY(context.SS->SubDomains.contains(subDomain->PathId));
- auto subDomainInfo = context.SS->SubDomains.at(subDomain->PathId);
- Y_VERIFY(subDomainInfo);
-
- if (subDomainInfo->GetAlter()) {
- result->SetError(NKikimrScheme::StatusPathDoesNotExist, "SubDomain is under another alter 2");
- return result;
- }
-
- result->SetPathId(subDomain->PathId.LocalPathId);
-
- if (0 != settings.GetPlanResolution()) {
- if (subDomainInfo->GetPlanResolution() != 0 && subDomainInfo->GetPlanResolution() != settings.GetPlanResolution()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: unable to change PlanResolution, only set it up");
- return result;
- }
- if (subDomain->IsRoot()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: unable to change PlanResolution at root, only additiong storage pools is allowed");
- return result;
- }
- }
-
- if (0 != settings.GetTimeCastBucketsPerMediator()) {
- if (subDomainInfo->GetTCB() != 0 && subDomainInfo->GetTCB() != settings.GetTimeCastBucketsPerMediator()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: unable to change TimeCastBucketsPerMediator, only set it up");
- return result;
- }
- if (subDomain->IsRoot()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: unable to change TimeCastBucketsPerMediator at root, only additiong storage pools is allowed");
- return result;
- }
- }
-
- if (0 == settings.GetCoordinators() && 0 != settings.GetMediators()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: cant create subdomain with mediators, but no coordinators");
- return result;
- }
-
- if (0 != settings.GetCoordinators() && 0 == settings.GetMediators()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: cant create subdomain with coordinators, but no mediators");
- return result;
- }
-
- const bool wasSharedTxSupported = subDomainInfo->IsSupportTransactions();
- const bool setSupportSharedTx = bool(settings.GetCoordinators()) || bool(settings.GetMediators());
-
- const bool wasExternalSchemeShard = bool(subDomainInfo->GetTenantSchemeShardID());
- const bool setExternalSchemeShard = settings.HasExternalSchemeShard();
- const bool addExternalSchemeShard = !wasExternalSchemeShard && setExternalSchemeShard && settings.GetExternalSchemeShard();
-
- const bool wasExternalHive = bool(subDomainInfo->GetTenantHiveID());
- const bool setExternalHive = settings.HasExternalHive();
- const bool addExternalHive = !wasExternalHive && setExternalHive && settings.GetExternalHive();
-
- const bool wasViewProcessors = bool(subDomainInfo->GetTenantSysViewProcessorID());
- const bool setViewProcessors = settings.HasExternalSysViewProcessor();
- const bool addViewProcessors = !wasViewProcessors && setViewProcessors && settings.GetExternalSysViewProcessor();
-
- ui64 shardsToCreate = 0;
- ui64 allowOverTheLimitShards = 0;
-
- if (wasExternalSchemeShard && setExternalSchemeShard) {
- if (bool(subDomainInfo->GetTenantSchemeShardID()) != settings.GetExternalSchemeShard()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: unable to change ExternalSchemeShard, only set it up");
- return result;
- }
- }
-
- if (addExternalSchemeShard) {
- shardsToCreate += 1;
-
- if (!wasSharedTxSupported && !setSupportSharedTx) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: ExtSubdomain without coordinators/mediators is usefull for NBS, but not supported yet, use SubDomain");
- return result;
- }
- }
-
- if (wasExternalHive && setExternalHive) {
- if (bool(subDomainInfo->GetTenantHiveID()) != settings.GetExternalHive()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: unable to change ExternalHive, only set it up");
- return result;
- }
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .IsExternalSubDomain()
+ .NotUnderOperation()
+ .IsCommonSensePath();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ TPathElement::TPtr subDomain = path.Base();
+
+ Y_VERIFY(context.SS->SubDomains.contains(subDomain->PathId));
+ auto subDomainInfo = context.SS->SubDomains.at(subDomain->PathId);
+ Y_VERIFY(subDomainInfo);
+
+ if (subDomainInfo->GetAlter()) {
+ result->SetError(NKikimrScheme::StatusPathDoesNotExist, "SubDomain is under another alter 2");
+ return result;
+ }
+
+ result->SetPathId(subDomain->PathId.LocalPathId);
+
+ if (0 != settings.GetPlanResolution()) {
+ if (subDomainInfo->GetPlanResolution() != 0 && subDomainInfo->GetPlanResolution() != settings.GetPlanResolution()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: unable to change PlanResolution, only set it up");
+ return result;
+ }
+ if (subDomain->IsRoot()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: unable to change PlanResolution at root, only additiong storage pools is allowed");
+ return result;
+ }
+ }
+
+ if (0 != settings.GetTimeCastBucketsPerMediator()) {
+ if (subDomainInfo->GetTCB() != 0 && subDomainInfo->GetTCB() != settings.GetTimeCastBucketsPerMediator()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: unable to change TimeCastBucketsPerMediator, only set it up");
+ return result;
+ }
+ if (subDomain->IsRoot()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: unable to change TimeCastBucketsPerMediator at root, only additiong storage pools is allowed");
+ return result;
+ }
+ }
+
+ if (0 == settings.GetCoordinators() && 0 != settings.GetMediators()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: cant create subdomain with mediators, but no coordinators");
+ return result;
+ }
+
+ if (0 != settings.GetCoordinators() && 0 == settings.GetMediators()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: cant create subdomain with coordinators, but no mediators");
+ return result;
+ }
+
+ const bool wasSharedTxSupported = subDomainInfo->IsSupportTransactions();
+ const bool setSupportSharedTx = bool(settings.GetCoordinators()) || bool(settings.GetMediators());
+
+ const bool wasExternalSchemeShard = bool(subDomainInfo->GetTenantSchemeShardID());
+ const bool setExternalSchemeShard = settings.HasExternalSchemeShard();
+ const bool addExternalSchemeShard = !wasExternalSchemeShard && setExternalSchemeShard && settings.GetExternalSchemeShard();
+
+ const bool wasExternalHive = bool(subDomainInfo->GetTenantHiveID());
+ const bool setExternalHive = settings.HasExternalHive();
+ const bool addExternalHive = !wasExternalHive && setExternalHive && settings.GetExternalHive();
+
+ const bool wasViewProcessors = bool(subDomainInfo->GetTenantSysViewProcessorID());
+ const bool setViewProcessors = settings.HasExternalSysViewProcessor();
+ const bool addViewProcessors = !wasViewProcessors && setViewProcessors && settings.GetExternalSysViewProcessor();
+
+ ui64 shardsToCreate = 0;
+ ui64 allowOverTheLimitShards = 0;
+
+ if (wasExternalSchemeShard && setExternalSchemeShard) {
+ if (bool(subDomainInfo->GetTenantSchemeShardID()) != settings.GetExternalSchemeShard()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: unable to change ExternalSchemeShard, only set it up");
+ return result;
+ }
+ }
+
+ if (addExternalSchemeShard) {
+ shardsToCreate += 1;
+
+ if (!wasSharedTxSupported && !setSupportSharedTx) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: ExtSubdomain without coordinators/mediators is usefull for NBS, but not supported yet, use SubDomain");
+ return result;
+ }
+ }
+
+ if (wasExternalHive && setExternalHive) {
+ if (bool(subDomainInfo->GetTenantHiveID()) != settings.GetExternalHive()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: unable to change ExternalHive, only set it up");
+ return result;
+ }
+ }
+
+ if (addExternalHive) {
+ shardsToCreate += 1;
+ allowOverTheLimitShards += 1;
+ }
+
+ if (wasViewProcessors && setViewProcessors) {
+ if (bool(subDomainInfo->GetTenantSysViewProcessorID()) != settings.GetExternalSysViewProcessor()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: unable to change ViewProcessors, only set it up");
+ return result;
+ }
+ }
+
+ if (addViewProcessors) {
+ shardsToCreate += 1;
+ allowOverTheLimitShards += 1;
+ }
+
+ if (wasSharedTxSupported && setSupportSharedTx) {
+ if (subDomainInfo->GetProcessingParams().CoordinatorsSize() != settings.GetCoordinators()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: unable to change Coordinators count, only set it up");
+ return result;
+ }
+
+ if (subDomainInfo->GetProcessingParams().MediatorsSize() != settings.GetMediators()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: unable to change Mediators count, only set it up");
+ return result;
+ }
+ }
+
+ if (!wasSharedTxSupported && setSupportSharedTx) {
+ shardsToCreate += settings.GetCoordinators() + settings.GetMediators();
+
+ if (settings.GetTimeCastBucketsPerMediator() == 0) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: TimeCastBucketsPerMediator should be set when coordinators create");
+ return result;
+ }
+
+ if (settings.GetPlanResolution() == 0) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: PlanResolution should be set when coordinators create");
+ return result;
+ }
+
+ if (!wasExternalSchemeShard && !setExternalSchemeShard) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: ExtSubdomain without External SchemeShard is useless, use SubDomain");
+ return result;
+ }
+ }
+
+ {
+ TPath::TChecker checks = path.Check();
+ checks
+ .ShardsLimit(shardsToCreate - allowOverTheLimitShards)
+ .PathShardsLimit(shardsToCreate - allowOverTheLimitShards);
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ auto actualPools = TStoragePools(subDomainInfo->GetStoragePools());
+ std::sort(actualPools.begin(), actualPools.end());
+
+ auto requestedPools = TVector<TStoragePool>(settings.GetStoragePools().begin(), settings.GetStoragePools().end());
+ std::sort(requestedPools.begin(), requestedPools.end());
+
+ auto uniqEnd = std::unique(requestedPools.begin(), requestedPools.end());
+ if (uniqEnd != requestedPools.end()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: requested storage pools is not qunique, for example, the pool '" + uniqEnd->GetName() +"' repeats several times");
+ return result;
+ }
+
+ {
+ TVector<TStoragePool> omitedPools;
+ std::set_difference(actualPools.begin(), actualPools.end(),
+ requestedPools.begin(), requestedPools.end(),
+ std::back_inserter(omitedPools));
+
+ if (omitedPools && requestedPools) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: deleting storage pool is not allowed, for example, requested deletion '" + omitedPools.begin()->GetName() +"'");
+ return result;
+ }
+ }
+
+ TVector<TStoragePool> addedPools;
+ std::set_difference(requestedPools.begin(), requestedPools.end(),
+ actualPools.begin(), actualPools.end(),
+ std::back_inserter(addedPools));
+
+ TSubDomainInfo::TPtr alterData = new TSubDomainInfo(*subDomainInfo,
+ settings.GetPlanResolution(),
+ settings.GetTimeCastBucketsPerMediator(),
+ addedPools);
+
+ TChannelsBindings channelBindings;
+ if (setSupportSharedTx || setExternalSchemeShard || setExternalHive || setViewProcessors) {
+ if (!context.SS->ResolveSubdomainsChannels(alterData->GetStoragePools(), channelBindings)) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable construct channels binding");
+ return result;
+ }
}
- if (addExternalHive) {
- shardsToCreate += 1;
- allowOverTheLimitShards += 1;
- }
-
- if (wasViewProcessors && setViewProcessors) {
- if (bool(subDomainInfo->GetTenantSysViewProcessorID()) != settings.GetExternalSysViewProcessor()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: unable to change ViewProcessors, only set it up");
- return result;
- }
- }
-
- if (addViewProcessors) {
- shardsToCreate += 1;
- allowOverTheLimitShards += 1;
- }
-
- if (wasSharedTxSupported && setSupportSharedTx) {
- if (subDomainInfo->GetProcessingParams().CoordinatorsSize() != settings.GetCoordinators()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: unable to change Coordinators count, only set it up");
- return result;
- }
-
- if (subDomainInfo->GetProcessingParams().MediatorsSize() != settings.GetMediators()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: unable to change Mediators count, only set it up");
- return result;
- }
- }
-
- if (!wasSharedTxSupported && setSupportSharedTx) {
- shardsToCreate += settings.GetCoordinators() + settings.GetMediators();
-
- if (settings.GetTimeCastBucketsPerMediator() == 0) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: TimeCastBucketsPerMediator should be set when coordinators create");
- return result;
- }
-
- if (settings.GetPlanResolution() == 0) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: PlanResolution should be set when coordinators create");
- return result;
- }
-
- if (!wasExternalSchemeShard && !setExternalSchemeShard) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: ExtSubdomain without External SchemeShard is useless, use SubDomain");
- return result;
- }
- }
-
- {
- TPath::TChecker checks = path.Check();
- checks
- .ShardsLimit(shardsToCreate - allowOverTheLimitShards)
- .PathShardsLimit(shardsToCreate - allowOverTheLimitShards);
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- auto actualPools = TStoragePools(subDomainInfo->GetStoragePools());
- std::sort(actualPools.begin(), actualPools.end());
-
- auto requestedPools = TVector<TStoragePool>(settings.GetStoragePools().begin(), settings.GetStoragePools().end());
- std::sort(requestedPools.begin(), requestedPools.end());
-
- auto uniqEnd = std::unique(requestedPools.begin(), requestedPools.end());
- if (uniqEnd != requestedPools.end()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: requested storage pools is not qunique, for example, the pool '" + uniqEnd->GetName() +"' repeats several times");
- return result;
- }
-
- {
- TVector<TStoragePool> omitedPools;
- std::set_difference(actualPools.begin(), actualPools.end(),
- requestedPools.begin(), requestedPools.end(),
- std::back_inserter(omitedPools));
-
- if (omitedPools && requestedPools) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: deleting storage pool is not allowed, for example, requested deletion '" + omitedPools.begin()->GetName() +"'");
- return result;
- }
- }
-
- TVector<TStoragePool> addedPools;
- std::set_difference(requestedPools.begin(), requestedPools.end(),
- actualPools.begin(), actualPools.end(),
- std::back_inserter(addedPools));
-
- TSubDomainInfo::TPtr alterData = new TSubDomainInfo(*subDomainInfo,
- settings.GetPlanResolution(),
- settings.GetTimeCastBucketsPerMediator(),
- addedPools);
-
- TChannelsBindings channelBindings;
- if (setSupportSharedTx || setExternalSchemeShard || setExternalHive || setViewProcessors) {
- if (!context.SS->ResolveSubdomainsChannels(alterData->GetStoragePools(), channelBindings)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable construct channels binding");
- return result;
- }
- }
-
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
if (settings.HasDeclaredSchemeQuotas()) {
alterData->SetDeclaredSchemeQuotas(settings.GetDeclaredSchemeQuotas());
}
@@ -391,84 +391,84 @@ public:
alterData->SetDatabaseQuotas(settings.GetDatabaseQuotas());
}
- NIceDb::TNiceDb db(context.Txc.DB);
-
- subDomain->LastTxId = OperationId.GetTxId();
- subDomain->PathState = TPathElement::EPathState::EPathStateAlter;
- context.SS->PersistPath(db, subDomain->PathId);
-
- Y_VERIFY(!context.SS->FindTx(OperationId));
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxAlterExtSubDomain, subDomain->PathId);
- txState.State = TTxState::CreateParts;
-
- if (!wasSharedTxSupported && setSupportSharedTx) {
- DeclareShards(txState, OperationId.GetTxId(), subDomain->PathId, settings.GetCoordinators(), TTabletTypes::FLAT_TX_COORDINATOR, channelBindings, context.SS);
- DeclareShards(txState, OperationId.GetTxId(), subDomain->PathId, settings.GetMediators(), TTabletTypes::TX_MEDIATOR, channelBindings, context.SS);
- }
-
- if (addExternalSchemeShard) {
- DeclareShards(txState, OperationId.GetTxId(), subDomain->PathId, 1, TTabletTypes::FLAT_SCHEMESHARD, channelBindings, context.SS);
- }
-
- if (addExternalHive) {
- DeclareShards(txState, OperationId.GetTxId(), subDomain->PathId, 1, TTabletTypes::Hive, channelBindings, context.SS);
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ subDomain->LastTxId = OperationId.GetTxId();
+ subDomain->PathState = TPathElement::EPathState::EPathStateAlter;
+ context.SS->PersistPath(db, subDomain->PathId);
+
+ Y_VERIFY(!context.SS->FindTx(OperationId));
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxAlterExtSubDomain, subDomain->PathId);
+ txState.State = TTxState::CreateParts;
+
+ if (!wasSharedTxSupported && setSupportSharedTx) {
+ DeclareShards(txState, OperationId.GetTxId(), subDomain->PathId, settings.GetCoordinators(), TTabletTypes::FLAT_TX_COORDINATOR, channelBindings, context.SS);
+ DeclareShards(txState, OperationId.GetTxId(), subDomain->PathId, settings.GetMediators(), TTabletTypes::TX_MEDIATOR, channelBindings, context.SS);
+ }
+
+ if (addExternalSchemeShard) {
+ DeclareShards(txState, OperationId.GetTxId(), subDomain->PathId, 1, TTabletTypes::FLAT_SCHEMESHARD, channelBindings, context.SS);
+ }
+
+ if (addExternalHive) {
+ DeclareShards(txState, OperationId.GetTxId(), subDomain->PathId, 1, TTabletTypes::Hive, channelBindings, context.SS);
} else if (!alterData->GetSharedHive()) {
- alterData->SetSharedHive(context.SS->GetGlobalHive(context.Ctx));
+ alterData->SetSharedHive(context.SS->GetGlobalHive(context.Ctx));
}
- if (addViewProcessors) {
- DeclareShards(txState, OperationId.GetTxId(), subDomain->PathId, 1, TTabletTypes::SysViewProcessor, channelBindings, context.SS);
+ if (addViewProcessors) {
+ DeclareShards(txState, OperationId.GetTxId(), subDomain->PathId, 1, TTabletTypes::SysViewProcessor, channelBindings, context.SS);
}
- for (auto& shard: txState.Shards) {
- alterData->AddPrivateShard(shard.Idx);
- }
-
- PersistShards(db, txState, shardsToCreate, context.SS);
- context.SS->PersistUpdateNextShardIdx(db);
-
- subDomainInfo->SetAlter(alterData);
- context.SS->PersistSubDomainAlter(db, subDomain->PathId, *alterData);
-
- context.SS->PersistTxState(db, OperationId);
- context.OnComplete.ActivateTx(OperationId);
-
- path.DomainInfo()->AddInternalShards(txState);
- path.Base()->IncShardsInside(shardsToCreate);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+ for (auto& shard: txState.Shards) {
+ alterData->AddPrivateShard(shard.Idx);
+ }
+
+ PersistShards(db, txState, shardsToCreate, context.SS);
+ context.SS->PersistUpdateNextShardIdx(db);
+
+ subDomainInfo->SetAlter(alterData);
+ context.SS->PersistSubDomainAlter(db, subDomain->PathId, *alterData);
+
+ context.SS->PersistTxState(db, OperationId);
+ context.OnComplete.ActivateTx(OperationId);
+
+ path.DomainInfo()->AddInternalShards(txState);
+ path.Base()->IncShardsInside(shardsToCreate);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TAlterSubDomain");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterSubDomain AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterSubDomain AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateAlterExtSubDomain(TOperationId id, const TTxTransaction& tx) {
return new TAlterExtSubDomain(id, tx);
}
-ISubOperationBase::TPtr CreateAlterExtSubDomain(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateAlterExtSubDomain(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TAlterExtSubDomain(id, state);
-}
-
-}
-}
+ return new TAlterExtSubDomain(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_fs.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_fs.cpp
index 6fb03125684..ee2a3fb3e52 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_fs.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_fs.cpp
@@ -8,7 +8,7 @@
namespace {
using namespace NKikimr;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
////////////////////////////////////////////////////////////////////////////////
@@ -282,7 +282,7 @@ private:
TOperationContext& context);
const NKikimrFileStore::TConfig* ParseParams(
- const NKikimrSchemeOp::TFileStoreDescription& operation,
+ const NKikimrSchemeOp::TFileStoreDescription& operation,
TString& errStr);
bool ProcessChannelProfiles(
@@ -324,14 +324,14 @@ THolder<TProposeResponse> TAlterFileStore::Propose(
<< ", at schemeshard: " << ssId);
auto result = MakeHolder<TProposeResponse>(
- NKikimrScheme::StatusAccepted,
+ NKikimrScheme::StatusAccepted,
ui64(OperationId.GetTxId()),
ui64(ssId));
TString errStr;
if (!operation.HasName() && !operation.HasPathId()) {
errStr = "Neither name nor pathId are present in FileStore";
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
return result;
}
@@ -369,20 +369,20 @@ THolder<TProposeResponse> TAlterFileStore::Propose(
if (fs->AlterConfig) {
result->SetError(
- NKikimrScheme::StatusMultipleModifications,
+ NKikimrScheme::StatusMultipleModifications,
"There is another operation in flight");
return result;
}
const auto* alterConfig = ParseParams(operation, errStr);
if (!alterConfig) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
return result;
}
if (alterConfig->HasVersion() && alterConfig->GetVersion() != fs->Version) {
result->SetError(
- NKikimrScheme::StatusPreconditionFailed,
+ NKikimrScheme::StatusPreconditionFailed,
"Wrong version in config");
return result;
}
@@ -401,7 +401,7 @@ THolder<TProposeResponse> TAlterFileStore::Propose(
}
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
return result;
}
@@ -418,7 +418,7 @@ THolder<TProposeResponse> TAlterFileStore::Propose(
}
const NKikimrFileStore::TConfig* TAlterFileStore::ParseParams(
- const NKikimrSchemeOp::TFileStoreDescription& operation,
+ const NKikimrSchemeOp::TFileStoreDescription& operation,
TString& errStr)
{
if (operation.HasIndexTabletId() || operation.HasVersion()) {
@@ -479,7 +479,7 @@ TTxState& TAlterFileStore::PrepareChanges(
operationId.GetTxId(), fs->AlterVersion);
context.SS->PersistAddFileStoreAlter(db, item->PathId, fs);
- context.SS->PersistTxState(db, operationId);
+ context.SS->PersistTxState(db, operationId);
context.OnComplete.ActivateTx(operationId);
return txState;
@@ -500,13 +500,13 @@ bool TAlterFileStore::ProcessChannelProfiles(
auto errStr = Sprintf("Wrong number of channels %u , should be [1 .. %lu]",
alterEcps.size(), NHive::MAX_TABLET_CHANNELS);
- result.SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ result.SetError(NKikimrScheme::StatusInvalidParameter, errStr);
return false;
}
// Cannot delete explicit profiles for existing channels
if (alterConfig.ExplicitChannelProfilesSize() < config.ExplicitChannelProfilesSize()) {
- result.SetError(NKikimrScheme::StatusInvalidParameter,
+ result.SetError(NKikimrScheme::StatusInvalidParameter,
"Cannot reduce the number of channel profiles");
return false;
}
@@ -519,7 +519,7 @@ bool TAlterFileStore::ProcessChannelProfiles(
const auto& newProfile = alterConfig.GetExplicitChannelProfiles(i);
if (prevProfile.GetPoolKind() != newProfile.GetPoolKind()) {
result.SetError(
- NKikimrScheme::StatusInvalidParameter,
+ NKikimrScheme::StatusInvalidParameter,
TStringBuilder() << "Cannot change PoolKind for channel " << i
<< ", " << prevProfile.GetPoolKind()
<< " -> " << newProfile.GetPoolKind());
@@ -542,7 +542,7 @@ bool TAlterFileStore::ProcessChannelProfiles(
storeChannelsBinding);
if (!storeChannelsResolved) {
- result.SetError(NKikimrScheme::StatusInvalidParameter,
+ result.SetError(NKikimrScheme::StatusInvalidParameter,
"Unable to construct channel binding for filestore with the storage pool");
return false;
}
@@ -567,7 +567,7 @@ void TAlterFileStore::ApplyChannelBindings(
} // namespace
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
////////////////////////////////////////////////////////////////////////////////
@@ -580,5 +580,5 @@ ISubOperationBase::TPtr CreateAlterFileStore(TOperationId id, TTxState::ETxState
return new TAlterFileStore(id, state);
}
-} // namespace NSchemeShard
+} // namespace NSchemeShard
} // namespace NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_index.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_index.cpp
index 5a66661e039..10688f09916 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_index.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_index.cpp
@@ -1,270 +1,270 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-using namespace NTableIndex;
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+using namespace NTableIndex;
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TAlterTableIndex TPropose"
- << " operationId#" << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", step: " << step
- << ", at schemeshard: " << context.SS->TabletID());
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxAlterTableIndex);
- Y_VERIFY(txState->State == TTxState::Propose);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
- path->StepCreated = step;
- context.SS->PersistCreateStep(db, path->PathId, step);
-
- Y_VERIFY(context.SS->Indexes.contains(path->PathId));
- TTableIndexInfo::TPtr indexData = context.SS->Indexes.at(path->PathId);
- context.SS->PersistTableIndex(db, path->PathId);
- context.SS->Indexes[path->PathId] = indexData->AlterData;
-
- context.SS->ClearDescribePathCaches(path);
- context.OnComplete.PublishToSchemeBoard(OperationId, path->PathId);
-
- context.SS->ChangeTxState(db, OperationId, TTxState::Done);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << context.SS->TabletID());
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxAlterTableIndex);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-class TAlterTableIndex: public TSubOperation {
- const TOperationId OperationId;
- const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::Propose;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Propose:
- return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Propose:
+ return TStringBuilder()
+ << "TAlterTableIndex TPropose"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", step: " << step
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxAlterTableIndex);
+ Y_VERIFY(txState->State == TTxState::Propose);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+ path->StepCreated = step;
+ context.SS->PersistCreateStep(db, path->PathId, step);
+
+ Y_VERIFY(context.SS->Indexes.contains(path->PathId));
+ TTableIndexInfo::TPtr indexData = context.SS->Indexes.at(path->PathId);
+ context.SS->PersistTableIndex(db, path->PathId);
+ context.SS->Indexes[path->PathId] = indexData->AlterData;
+
+ context.SS->ClearDescribePathCaches(path);
+ context.OnComplete.PublishToSchemeBoard(OperationId, path->PathId);
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::Done);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxAlterTableIndex);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+class TAlterTableIndex: public TSubOperation {
+ const TOperationId OperationId;
+ const TTxTransaction Transaction;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::Propose;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Propose:
+ return TTxState::Done;
+ default:
+ return TTxState::Invalid;
+ }
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Propose:
return THolder(new TPropose(OperationId));
- case TTxState::Done:
+ case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
- TAlterTableIndex(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
- , Transaction(tx)
- {
- }
-
- TAlterTableIndex(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
- const auto& tableIndexAlter = Transaction.GetAlterTableIndex();
-
- const TString& parentPathStr = Transaction.GetWorkingDir();
- const TString& name = tableIndexAlter.GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterTableIndex Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", operationId: " << OperationId
- << ", transaction: " << Transaction.ShortDebugString()
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- if (!Transaction.HasAlterTableIndex()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "AlterTableIndex is not present");
- return result;
- }
-
-
- if (!tableIndexAlter.HasName()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "Name is not present in AlterTableIndex");
- return result;
- }
-
- NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
- NSchemeShard::TPath dstPath = parentPath.Child(name);
- {
- NSchemeShard::TPath::TChecker checks = parentPath.Check();
- checks
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsCommonSensePath()
- .IsTable();
-
- if (!checks) {
- TString explain = TStringBuilder() << "parent path fail checks"
- << ", path: " << parentPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- {
- NSchemeShard::TPath::TChecker checks = dstPath.Check();
- checks
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsTableIndex();
-
- if (!context.IsAllowedPrivateTables) {
- checks.IsCommonSensePath();
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "dst path fail checks"
- << ", path: " << parentPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- if (dstPath.IsResolved()) {
- result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
- }
- return result;
- }
- }
-
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
-
- TString errMsg;
-
- if (!context.SS->CheckLocks(parentPath.Base()->PathId, Transaction, errMsg)) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, errMsg);
- return result;
- }
-
- TTableIndexInfo::TPtr indexData = context.SS->Indexes.at(dstPath.Base()->PathId);
- TTableIndexInfo::TPtr newIndexData = indexData->CreateNextVersion();
- if (!newIndexData) {
- result->SetError(TEvSchemeShard::EStatus::StatusInvalidParameter, errMsg);
- return result;
- }
- newIndexData->State = tableIndexAlter.GetState();
-
- NIceDb::TNiceDb db(context.Txc.DB);
- // store table index description
- auto indexPath = dstPath.Base();
-
- Y_VERIFY(!context.SS->FindTx(OperationId));
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxAlterTableIndex, indexPath->PathId);
- txState.State = TTxState::Propose;
-
- indexPath->PathState = NKikimrSchemeOp::EPathStateAlter;
- indexPath->LastTxId = OperationId.GetTxId();
- context.SS->PersistLastTxId(db, indexPath);
-
- context.SS->PersistTableIndexAlterData(db, indexPath->PathId);
-
- context.SS->PersistTxState(db, OperationId);
-
- context.OnComplete.ActivateTx(OperationId);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
- void AbortPropose(TOperationContext&) override {
- Y_FAIL("no AbortPropose for TAlterTableIndex");
- }
-
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterTableIndex AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
- << ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-ISubOperationBase::TPtr CreateAlterTableIndex(TOperationId id, const TTxTransaction& tx) {
- return new TAlterTableIndex(id, tx);
-}
-
-ISubOperationBase::TPtr CreateAlterTableIndex(TOperationId id, TTxState::ETxState state) {
- return new TAlterTableIndex(id, state);
-}
-
-}
-}
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
+ TAlterTableIndex(TOperationId id, const TTxTransaction& tx)
+ : OperationId(id)
+ , Transaction(tx)
+ {
+ }
+
+ TAlterTableIndex(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ const auto& tableIndexAlter = Transaction.GetAlterTableIndex();
+
+ const TString& parentPathStr = Transaction.GetWorkingDir();
+ const TString& name = tableIndexAlter.GetName();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterTableIndex Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", operationId: " << OperationId
+ << ", transaction: " << Transaction.ShortDebugString()
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ if (!Transaction.HasAlterTableIndex()) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "AlterTableIndex is not present");
+ return result;
+ }
+
+
+ if (!tableIndexAlter.HasName()) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "Name is not present in AlterTableIndex");
+ return result;
+ }
+
+ NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
+ NSchemeShard::TPath dstPath = parentPath.Child(name);
+ {
+ NSchemeShard::TPath::TChecker checks = parentPath.Check();
+ checks
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsCommonSensePath()
+ .IsTable();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent path fail checks"
+ << ", path: " << parentPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ {
+ NSchemeShard::TPath::TChecker checks = dstPath.Check();
+ checks
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsTableIndex();
+
+ if (!context.IsAllowedPrivateTables) {
+ checks.IsCommonSensePath();
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "dst path fail checks"
+ << ", path: " << parentPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ if (dstPath.IsResolved()) {
+ result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+ }
+ return result;
+ }
+ }
+
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+
+ TString errMsg;
+
+ if (!context.SS->CheckLocks(parentPath.Base()->PathId, Transaction, errMsg)) {
+ result->SetError(NKikimrScheme::StatusMultipleModifications, errMsg);
+ return result;
+ }
+
+ TTableIndexInfo::TPtr indexData = context.SS->Indexes.at(dstPath.Base()->PathId);
+ TTableIndexInfo::TPtr newIndexData = indexData->CreateNextVersion();
+ if (!newIndexData) {
+ result->SetError(TEvSchemeShard::EStatus::StatusInvalidParameter, errMsg);
+ return result;
+ }
+ newIndexData->State = tableIndexAlter.GetState();
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ // store table index description
+ auto indexPath = dstPath.Base();
+
+ Y_VERIFY(!context.SS->FindTx(OperationId));
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxAlterTableIndex, indexPath->PathId);
+ txState.State = TTxState::Propose;
+
+ indexPath->PathState = NKikimrSchemeOp::EPathStateAlter;
+ indexPath->LastTxId = OperationId.GetTxId();
+ context.SS->PersistLastTxId(db, indexPath);
+
+ context.SS->PersistTableIndexAlterData(db, indexPath->PathId);
+
+ context.SS->PersistTxState(db, OperationId);
+
+ context.OnComplete.ActivateTx(OperationId);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
+ void AbortPropose(TOperationContext&) override {
+ Y_FAIL("no AbortPropose for TAlterTableIndex");
+ }
+
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterTableIndex AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+ISubOperationBase::TPtr CreateAlterTableIndex(TOperationId id, const TTxTransaction& tx) {
+ return new TAlterTableIndex(id, tx);
+}
+
+ISubOperationBase::TPtr CreateAlterTableIndex(TOperationId id, TTxState::ETxState state) {
+ return new TAlterTableIndex(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_kesus.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_kesus.cpp
index d33cf44dda2..38e5f747774 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_kesus.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_kesus.cpp
@@ -1,409 +1,409 @@
-
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
#include <ydb/core/persqueue/config/config.h>
-
-namespace {
-
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-void PrepareChanges(TOperationId operationId,
- TPathElement::TPtr item,
- TKesusInfo::TPtr kesus,
- TOperationContext& context)
-{
- NIceDb::TNiceDb db(context.Txc.DB);
-
- item->LastTxId = operationId.GetTxId();
- item->PathState = TPathElement::EPathState::EPathStateAlter;
-
- TTxState& txState = context.SS->CreateTx(operationId, TTxState::TxAlterKesus, item->PathId);
- txState.State = TTxState::ConfigureParts;
-
- txState.Shards.reserve(1);
- {
- TShardIdx shardIdx = kesus->KesusShardIdx;
- TTabletId tabletId = kesus->KesusTabletId;
-
- Y_VERIFY(context.SS->ShardInfos.contains(shardIdx));
- auto& shardInfo = context.SS->ShardInfos[shardIdx];
- Y_VERIFY(shardInfo.TabletID == tabletId);
- txState.Shards.emplace_back(shardIdx, ETabletType::Kesus, TTxState::ConfigureParts);
- shardInfo.CurrentTxId = operationId.GetTxId();
- context.SS->PersistShardTx(db, shardIdx, operationId.GetTxId());
- }
-
- LOG_DEBUG(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "AlterKesus txid# %" PRIu64 ", AlterVersion %" PRIu64,
- operationId.GetTxId(), kesus->AlterVersion);
-
- context.SS->PersistAddKesusAlter(db, item->PathId, kesus);
-
- context.SS->PersistTxState(db, operationId);
- context.OnComplete.ActivateTx(operationId);
-}
-
-class TConfigureParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+namespace {
+
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+void PrepareChanges(TOperationId operationId,
+ TPathElement::TPtr item,
+ TKesusInfo::TPtr kesus,
+ TOperationContext& context)
+{
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ item->LastTxId = operationId.GetTxId();
+ item->PathState = TPathElement::EPathState::EPathStateAlter;
+
+ TTxState& txState = context.SS->CreateTx(operationId, TTxState::TxAlterKesus, item->PathId);
+ txState.State = TTxState::ConfigureParts;
+
+ txState.Shards.reserve(1);
+ {
+ TShardIdx shardIdx = kesus->KesusShardIdx;
+ TTabletId tabletId = kesus->KesusTabletId;
+
+ Y_VERIFY(context.SS->ShardInfos.contains(shardIdx));
+ auto& shardInfo = context.SS->ShardInfos[shardIdx];
+ Y_VERIFY(shardInfo.TabletID == tabletId);
+ txState.Shards.emplace_back(shardIdx, ETabletType::Kesus, TTxState::ConfigureParts);
+ shardInfo.CurrentTxId = operationId.GetTxId();
+ context.SS->PersistShardTx(db, shardIdx, operationId.GetTxId());
+ }
+
+ LOG_DEBUG(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "AlterKesus txid# %" PRIu64 ", AlterVersion %" PRIu64,
+ operationId.GetTxId(), kesus->AlterVersion);
+
+ context.SS->PersistAddKesusAlter(db, item->PathId, kesus);
+
+ context.SS->PersistTxState(db, operationId);
+ context.OnComplete.ActivateTx(operationId);
+}
+
+class TConfigureParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TAlterKesus TConfigureParts"
- << " operationId#" << OperationId;
- }
-
-public:
- TConfigureParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool HandleReply(NKesus::TEvKesus::TEvSetConfigResult::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateKesus TConfigureParts HandleReply TEvSetConfigResult"
- << ", operationId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- TTabletId tabletId =TTabletId(ev->Get()->Record.GetTabletId());
- auto status = ev->Get()->Record.GetError().GetStatus();
-
- // SetConfig may fail if schemeshard tries to downgrade configuration
- // That likely means this is a very outdated version
- Y_VERIFY_S(status == Ydb::StatusIds::SUCCESS,
- "Unexpected error in SetConfigResult."
- << " status: " << Ydb::StatusIds::StatusCode_Name(status)
- << " txId: " << OperationId
- << " tablet: " << tabletId
- << " at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxAlterKesus);
- Y_VERIFY(txState->State == TTxState::ConfigureParts);
-
+ return TStringBuilder()
+ << "TAlterKesus TConfigureParts"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TConfigureParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool HandleReply(NKesus::TEvKesus::TEvSetConfigResult::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateKesus TConfigureParts HandleReply TEvSetConfigResult"
+ << ", operationId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ TTabletId tabletId =TTabletId(ev->Get()->Record.GetTabletId());
+ auto status = ev->Get()->Record.GetError().GetStatus();
+
+ // SetConfig may fail if schemeshard tries to downgrade configuration
+ // That likely means this is a very outdated version
+ Y_VERIFY_S(status == Ydb::StatusIds::SUCCESS,
+ "Unexpected error in SetConfigResult."
+ << " status: " << Ydb::StatusIds::StatusCode_Name(status)
+ << " txId: " << OperationId
+ << " tablet: " << tabletId
+ << " at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxAlterKesus);
+ Y_VERIFY(txState->State == TTxState::ConfigureParts);
+
TShardIdx idx = context.SS->MustGetShardIdx(tabletId);
- txState->ShardsInProgress.erase(idx);
-
- context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, idx);
-
- if (txState->ShardsInProgress.empty()) {
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
- context.OnComplete.ActivateTx(OperationId);
- return true;
- }
-
- return false;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateKesus TConfigureParts ProgressState"
- << ", operationId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxAlterKesus);
- Y_VERIFY(!txState->Shards.empty());
-
- txState->ClearShardsInProgress();
-
- TKesusInfo::TPtr kesus = context.SS->KesusInfos[txState->TargetPathId];
- Y_VERIFY_S(kesus, "kesus is null. PathId: " << txState->TargetPathId);
-
- TPath kesusPath = TPath::Init(txState->TargetPathId, context.SS);
- Y_VERIFY(kesusPath.IsResolved());
-
- Y_VERIFY(txState->Shards.size() == 1);
- for (auto shard : txState->Shards) {
- auto shardIdx = shard.Idx;
- auto tabletId = context.SS->ShardInfos[shardIdx].TabletID;
- Y_VERIFY(shard.TabletType == ETabletType::Kesus);
-
+ txState->ShardsInProgress.erase(idx);
+
+ context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, idx);
+
+ if (txState->ShardsInProgress.empty()) {
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
+ context.OnComplete.ActivateTx(OperationId);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateKesus TConfigureParts ProgressState"
+ << ", operationId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxAlterKesus);
+ Y_VERIFY(!txState->Shards.empty());
+
+ txState->ClearShardsInProgress();
+
+ TKesusInfo::TPtr kesus = context.SS->KesusInfos[txState->TargetPathId];
+ Y_VERIFY_S(kesus, "kesus is null. PathId: " << txState->TargetPathId);
+
+ TPath kesusPath = TPath::Init(txState->TargetPathId, context.SS);
+ Y_VERIFY(kesusPath.IsResolved());
+
+ Y_VERIFY(txState->Shards.size() == 1);
+ for (auto shard : txState->Shards) {
+ auto shardIdx = shard.Idx;
+ auto tabletId = context.SS->ShardInfos[shardIdx].TabletID;
+ Y_VERIFY(shard.TabletType == ETabletType::Kesus);
+
auto event = MakeHolder<NKesus::TEvKesus::TEvSetConfig>(ui64(OperationId.GetTxId()), *kesus->AlterConfig, kesus->AlterVersion);
- event->Record.MutableConfig()->set_path(kesusPath.PathString()); // TODO: remove legacy field eventually
- event->Record.SetPath(kesusPath.PathString());
-
- context.OnComplete.BindMsgToPipe(OperationId, tabletId, shardIdx, event.Release());
-
- // Wait for results from this shard
- txState->ShardsInProgress.insert(shardIdx);
- }
-
- return false;
- }
-};
-
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ event->Record.MutableConfig()->set_path(kesusPath.PathString()); // TODO: remove legacy field eventually
+ event->Record.SetPath(kesusPath.PathString());
+
+ context.OnComplete.BindMsgToPipe(OperationId, tabletId, shardIdx, event.Release());
+
+ // Wait for results from this shard
+ txState->ShardsInProgress.insert(shardIdx);
+ }
+
+ return false;
+ }
+};
+
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TAlterKesus TPropose"
- << " operationId#" << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr&, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterKesus TPropose HandleReply TEvOperationPlan"
- << ", operationId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- if (!txState) {
- return false;
- }
- Y_VERIFY(txState->TxType == TTxState::TxAlterKesus);
-
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- path->PathState = TPathElement::EPathState::EPathStateNoChanges;
-
- TKesusInfo::TPtr kesus = context.SS->KesusInfos.at(pathId);
- kesus->FinishAlter();
- context.SS->PersistKesusInfo(db, pathId, kesus);
- context.SS->PersistRemoveKesusAlter(db, pathId);
-
- context.SS->ClearDescribePathCaches(path);
+ return TStringBuilder()
+ << "TAlterKesus TPropose"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr&, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterKesus TPropose HandleReply TEvOperationPlan"
+ << ", operationId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ if (!txState) {
+ return false;
+ }
+ Y_VERIFY(txState->TxType == TTxState::TxAlterKesus);
+
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ path->PathState = TPathElement::EPathState::EPathStateNoChanges;
+
+ TKesusInfo::TPtr kesus = context.SS->KesusInfos.at(pathId);
+ kesus->FinishAlter();
+ context.SS->PersistKesusInfo(db, pathId, kesus);
+ context.SS->PersistRemoveKesusAlter(db, pathId);
+
+ context.SS->ClearDescribePathCaches(path);
context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
- context.OnComplete.DoneOperation(OperationId);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterKesus TPropose ProgressState"
- << ", operationId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxAlterKesus);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-
-class TAlterKesus: public TSubOperation {
+ context.OnComplete.DoneOperation(OperationId);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterKesus TPropose ProgressState"
+ << ", operationId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxAlterKesus);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+
+class TAlterKesus: public TSubOperation {
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::ConfigureParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::ConfigureParts:
- return TTxState::Propose;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::ConfigureParts:
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::ConfigureParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::ConfigureParts:
+ return TTxState::Propose;
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::ConfigureParts:
return THolder(new TConfigureParts(OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new TPropose(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TAlterKesus(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TAlterKesus(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- const Ydb::Coordination::Config* ParseParams(
- const NKikimrSchemeOp::TKesusDescription& alter,
- TString& errStr) {
- if (alter.HasKesusTabletId() || alter.HasVersion()) {
- errStr = "Setting schemeshard owned properties is not allowed";
- return nullptr;
- }
- if (!alter.HasConfig()) {
- errStr = "Missing changes to coordination node config";
- return nullptr;
- }
-
- const auto& config = alter.GetConfig();
- if (!config.path().empty()) {
- errStr = "Setting path is not allowed";
- return nullptr;
- }
-
- return &config;
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+
+ TAlterKesus(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ const Ydb::Coordination::Config* ParseParams(
+ const NKikimrSchemeOp::TKesusDescription& alter,
+ TString& errStr) {
+ if (alter.HasKesusTabletId() || alter.HasVersion()) {
+ errStr = "Setting schemeshard owned properties is not allowed";
+ return nullptr;
+ }
+ if (!alter.HasConfig()) {
+ errStr = "Missing changes to coordination node config";
+ return nullptr;
+ }
+
+ const auto& config = alter.GetConfig();
+ if (!config.path().empty()) {
+ errStr = "Setting path is not allowed";
+ return nullptr;
+ }
+
+ return &config;
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const auto& alter = Transaction.GetKesus();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = alter.GetName();
- const TPathId pathId = alter.HasPathId() ? context.SS->MakeLocalId(alter.GetPathId()) : InvalidPathId;
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterKesus Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", pathId: " << pathId
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- TString errStr;
- if (!alter.HasName() && !alter.HasPathId()) {
- errStr = "Niether kesus name nor pathId in Kesus";
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
-
- TPath path = alter.HasPathId()
- ? TPath::Init(pathId, context.SS)
- : TPath::Resolve(parentPathStr, context.SS).Dive(name);
-
- {
- TPath::TChecker checks = path.Check();
+ const TPathId pathId = alter.HasPathId() ? context.SS->MakeLocalId(alter.GetPathId()) : InvalidPathId;
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterKesus Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", pathId: " << pathId
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ TString errStr;
+ if (!alter.HasName() && !alter.HasPathId()) {
+ errStr = "Niether kesus name nor pathId in Kesus";
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+
+ TPath path = alter.HasPathId()
+ ? TPath::Init(pathId, context.SS)
+ : TPath::Resolve(parentPathStr, context.SS).Dive(name);
+
+ {
+ TPath::TChecker checks = path.Check();
checks
.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .IsKesus()
- .NotUnderOperation()
- .IsCommonSensePath();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- const auto* alterConfig = ParseParams(alter, errStr);
- if (!alterConfig) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
-
- TKesusInfo::TPtr kesus = context.SS->KesusInfos.at(path.Base()->PathId);
- Y_VERIFY(kesus);
- Y_VERIFY(path.Base()->IsCreateFinished()); // checks.NotUnderOperation checks that path not under creation
-
- if (kesus->AlterConfig) {
- result->SetError(
- NKikimrScheme::StatusMultipleModifications,
- "There's another alter in flight");
- return result;
- }
-
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .IsKesus()
+ .NotUnderOperation()
+ .IsCommonSensePath();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ const auto* alterConfig = ParseParams(alter, errStr);
+ if (!alterConfig) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+
+ TKesusInfo::TPtr kesus = context.SS->KesusInfos.at(path.Base()->PathId);
+ Y_VERIFY(kesus);
+ Y_VERIFY(path.Base()->IsCreateFinished()); // checks.NotUnderOperation checks that path not under creation
+
+ if (kesus->AlterConfig) {
+ result->SetError(
+ NKikimrScheme::StatusMultipleModifications,
+ "There's another alter in flight");
+ return result;
+ }
+
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
kesus->AlterConfig.Reset(new Ydb::Coordination::Config);
- kesus->AlterConfig->CopyFrom(kesus->Config);
- kesus->AlterConfig->MergeFrom(*alterConfig);
- kesus->AlterVersion = kesus->Version + 1;
- PrepareChanges(OperationId, path.Base(), kesus, context);
-
- context.SS->ClearDescribePathCaches(path.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+ kesus->AlterConfig->CopyFrom(kesus->Config);
+ kesus->AlterConfig->MergeFrom(*alterConfig);
+ kesus->AlterVersion = kesus->Version + 1;
+ PrepareChanges(OperationId, path.Base(), kesus, context);
+
+ context.SS->ClearDescribePathCaches(path.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TAlterKesus");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterKesus AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterKesus AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateAlterKesus(TOperationId id, const TTxTransaction& tx) {
return new TAlterKesus(id, tx);
}
-ISubOperationBase::TPtr CreateAlterKesus(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateAlterKesus(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TAlterKesus(id, state);
-}
-
-}
-}
+ return new TAlterKesus(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_login.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_login.cpp
index c718e5e176a..0b420f75b41 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_login.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_login.cpp
@@ -5,7 +5,7 @@
namespace {
using namespace NKikimr;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
class TAlterLogin: public ISubOperationBase {
const TOperationId OperationId;
@@ -23,7 +23,7 @@ public:
{
}
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
NIceDb::TNiceDb db(context.Txc.DB);
TTabletId ssId = context.SS->SelfTabletId();
auto result = MakeHolder<TProposeResponse>(OperationId.GetTxId(), ssId);
@@ -134,7 +134,7 @@ public:
}
}
- if (result->Record.GetStatus() == NKikimrScheme::StatusSuccess) {
+ if (result->Record.GetStatus() == NKikimrScheme::StatusSuccess) {
TPathId subDomainPathId = context.SS->GetCurrentSubDomainPathId();
TSubDomainInfo::TPtr domainPtr = context.SS->ResolveDomainInfo(subDomainPathId);
domainPtr->UpdateSecurityState(context.SS->LoginProvider.GetSecurityState());
@@ -163,7 +163,7 @@ public:
}
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
ISubOperationBase::TPtr CreateAlterLogin(TOperationId id, const TTxTransaction& tx) {
return new TAlterLogin(id, tx);
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_olap_store.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_olap_store.cpp
index fdd03269ca2..7141c76ae7f 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_olap_store.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_olap_store.cpp
@@ -5,12 +5,12 @@
namespace {
using namespace NKikimr;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
TOlapStoreInfo::TPtr ParseParams(
const TPath& path, const TOlapStoreInfo::TPtr& storeInfo,
const NKikimrSchemeOp::TAlterColumnStore& alter,
- NKikimrScheme::EStatus& status, TString& errStr, TOperationContext& context)
+ NKikimrScheme::EStatus& status, TString& errStr, TOperationContext& context)
{
Y_UNUSED(path);
Y_UNUSED(context);
@@ -22,7 +22,7 @@ TOlapStoreInfo::TPtr ParseParams(
for (const auto& removeSchemaPreset : alter.GetRemoveSchemaPresets()) {
Y_UNUSED(removeSchemaPreset);
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
errStr = "Removing schema presets is not supported yet";
return nullptr;
}
@@ -32,12 +32,12 @@ TOlapStoreInfo::TPtr ParseParams(
#if 0
const TString& presetName = alterSchemaPreset.GetName();
if (alteredSchemaPresets.contains(presetName)) {
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
errStr = TStringBuilder() << "Cannot alter schema preset '" << presetName << "' multiple times";
return nullptr;
}
if (!alterData->SchemaPresetByName.contains(presetName)) {
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
errStr = TStringBuilder() << "Cannot alter unknown schema preset '" << presetName << "'";
return nullptr;
}
@@ -54,13 +54,13 @@ TOlapStoreInfo::TPtr ParseParams(
const TString& columnName = dropColumn.GetName();
const auto* column = preset.FindColumnByName(columnName);
if (!column) {
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
errStr = TStringBuilder() << "Cannot drop non-existant column '" << columnName << "'";
return nullptr;
}
const ui32 columnId = column->Id;
if (column->IsKeyColumn()) {
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
errStr = TStringBuilder() << "Cannot drop key column '" << columnName << "'";
return nullptr;
}
@@ -88,7 +88,7 @@ TOlapStoreInfo::TPtr ParseParams(
for (const auto& alterColumn : alterSchema.GetAlterColumns()) {
Y_UNUSED(alterColumn);
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
errStr = "Altering existing columns is not supported yet";
return nullptr;
}
@@ -100,27 +100,27 @@ TOlapStoreInfo::TPtr ParseParams(
columnProto = addColumn;
const TString& columnName = columnProto.GetName();
if (columnName.empty()) {
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
errStr = "Columns cannot have an empty name";
return nullptr;
}
if (preset.ColumnsByName.contains(columnName)) {
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
errStr = TStringBuilder() << "Cannot add duplicate column '" << columnName << "'";
return nullptr;
}
if (columnProto.HasId()) {
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
errStr = TStringBuilder() << "New column '" << columnName << "' cannot have an Id specified";
return nullptr;
}
if (columnProto.HasTypeId()) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = TStringBuilder() << "Cannot set TypeId for column '" << columnName << "', use Type";
return nullptr;
}
if (!columnProto.HasType()) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = TStringBuilder() << "Missing Type for column '" << columnName << "'";
return nullptr;
}
@@ -136,7 +136,7 @@ TOlapStoreInfo::TPtr ParseParams(
auto typeName = NMiniKQL::AdaptLegacyYqlType(columnProto.GetType());
const NScheme::IType* type = typeRegistry->GetType(typeName);
if (!type || !NScheme::NTypeIds::IsYqlType(type->GetTypeId())) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = TStringBuilder() << "Type '" << columnProto.GetType() << "' specified for column '" << columnName << "' is not supported";
return nullptr;
}
@@ -147,7 +147,7 @@ TOlapStoreInfo::TPtr ParseParams(
for (const auto& addKeyColumnName : alterSchema.GetAddKeyColumnNames()) {
Y_UNUSED(addKeyColumnName);
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
errStr = "Adding key columns is not supported yet";
return nullptr;
}
@@ -159,7 +159,7 @@ TOlapStoreInfo::TPtr ParseParams(
#else
Y_UNUSED(alterSchemaPreset);
Y_UNUSED(alteredSchemaPresets);
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
errStr = "Altering schema presets is not supported yet";
return nullptr;
#endif
@@ -167,14 +167,14 @@ TOlapStoreInfo::TPtr ParseParams(
for (const auto& addSchemaPreset : alter.GetAddSchemaPresets()) {
Y_UNUSED(addSchemaPreset);
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
errStr = "Adding schema presets is not supported yet";
return nullptr;
}
for (const auto& removeTtlSettingsPreset : alter.GetRESERVED_RemoveTtlSettingsPresets()) {
Y_UNUSED(removeTtlSettingsPreset);
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
errStr = "TTL presets are not supported";
return nullptr;
}
@@ -626,7 +626,7 @@ public:
SetState(SelectStateFunc(state));
}
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
const TTabletId ssId = context.SS->SelfTabletId();
const auto& alter = Transaction.GetAlterColumnStore();
@@ -640,10 +640,10 @@ public:
<< ", opId: " << OperationId
<< ", at schemeshard: " << ssId);
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
if (!alter.HasName()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "No store name in Alter");
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "No store name in Alter");
return result;
}
@@ -672,26 +672,26 @@ public:
TOlapStoreInfo::TPtr storeInfo = context.SS->OlapStores.at(path->PathId);
if (!storeInfo->OlapTablesUnderOperation.empty()) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, "Store has unfinished table operations");
+ result->SetError(NKikimrScheme::StatusMultipleModifications, "Store has unfinished table operations");
return result;
}
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
return result;
}
if (storeInfo->AlterVersion == 0) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, "Store is not created yet");
+ result->SetError(NKikimrScheme::StatusMultipleModifications, "Store is not created yet");
return result;
}
if (storeInfo->AlterData) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, "There's another Alter in flight");
+ result->SetError(NKikimrScheme::StatusMultipleModifications, "There's another Alter in flight");
return result;
}
- NKikimrScheme::EStatus status;
+ NKikimrScheme::EStatus status;
TOlapStoreInfo::TPtr alterData = ParseParams(path, storeInfo, alter, status, errStr, context);
if (!alterData) {
result->SetError(status, errStr);
@@ -716,7 +716,7 @@ public:
context.SS->PersistLastTxId(db, path.Base());
context.SS->PersistOlapStoreAlter(db, path->PathId, *alterData);
- context.SS->PersistTxState(db, OperationId);
+ context.SS->PersistTxState(db, OperationId);
context.OnComplete.ActivateTx(OperationId);
@@ -743,7 +743,7 @@ public:
}
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
ISubOperationBase::TPtr CreateAlterOlapStore(TOperationId id, const TTxTransaction& tx) {
return new TAlterOlapStore(id, tx);
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_olap_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_olap_table.cpp
index efba11725af..2e89cad9869 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_olap_table.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_olap_table.cpp
@@ -5,25 +5,25 @@
namespace {
using namespace NKikimr;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
TOlapTableInfo::TPtr ParseParams(
const TPath& path, const TOlapTableInfo::TPtr& tableInfo, const TOlapStoreInfo::TPtr& storeInfo,
const NKikimrSchemeOp::TAlterColumnTable& alter, const TSubDomainInfo& subDomain,
- NKikimrScheme::EStatus& status, TString& errStr, TOperationContext& context)
+ NKikimrScheme::EStatus& status, TString& errStr, TOperationContext& context)
{
Y_UNUSED(path);
Y_UNUSED(context);
Y_UNUSED(subDomain);
if (alter.HasAlterSchema() || alter.HasAlterSchemaPresetName()) {
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
errStr = "Changing table schema is not supported";
return nullptr;
}
if (alter.HasRESERVED_AlterTtlSettingsPresetName()) {
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
errStr = "TTL presets are not supported";
return nullptr;
}
@@ -70,12 +70,12 @@ TOlapTableInfo::TPtr ParseParams(
}
if (!ValidateTtlSettings(alter.GetAlterTtlSettings(), columns, columnsByName, knownTiers, errStr)) {
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
return nullptr;
}
if (!ValidateTtlSettingsChange(tableInfo->Description.GetTtlSettings(), alter.GetAlterTtlSettings(), errStr)) {
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
return nullptr;
}
@@ -95,7 +95,7 @@ TOlapTableInfo::TPtr ParseParams(
#else
auto it = storeInfo->TtlSettingsPresetByName.find(alter.GetAlterTtlSettingsPresetName());
if (it == storeInfo->TtlSettingsPresetByName.end()) {
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
errStr = TStringBuilder()
<< "Cannot find ttl settings preset '" << alter.GetAlterTtlSettingsPresetName() << "'";
return nullptr;
@@ -457,7 +457,7 @@ public:
SetState(SelectStateFunc(state));
}
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
const TTabletId ssId = context.SS->SelfTabletId();
const auto& alter = Transaction.GetAlterColumnTable();
@@ -471,10 +471,10 @@ public:
<< ", opId: " << OperationId
<< ", at schemeshard: " << ssId);
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
if (!alter.HasName()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "No table name in Alter");
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "No table name in Alter");
return result;
}
@@ -525,20 +525,20 @@ public:
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
return result;
}
if (tableInfo->AlterVersion == 0) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, "Table is not created yet");
+ result->SetError(NKikimrScheme::StatusMultipleModifications, "Table is not created yet");
return result;
}
if (tableInfo->AlterData) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, "There's another Alter in flight");
+ result->SetError(NKikimrScheme::StatusMultipleModifications, "There's another Alter in flight");
return result;
}
- NKikimrScheme::EStatus status;
+ NKikimrScheme::EStatus status;
TOlapTableInfo::TPtr alterData = ParseParams(path, tableInfo, storeInfo, alter, *path.DomainInfo(), status, errStr, context);
if (!alterData) {
result->SetError(status, errStr);
@@ -577,7 +577,7 @@ public:
context.SS->PersistLastTxId(db, storePath.Base());
context.SS->PersistOlapTableAlter(db, path->PathId, *alterData);
- context.SS->PersistTxState(db, OperationId);
+ context.SS->PersistTxState(db, OperationId);
context.OnComplete.ActivateTx(OperationId);
@@ -604,7 +604,7 @@ public:
}
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
ISubOperationBase::TPtr CreateAlterOlapTable(TOperationId id, const TTxTransaction& tx) {
return new TAlterOlapTable(id, tx);
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_pq.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_pq.cpp
index 02e2c7f842d..f7a47459b97 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_pq.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_pq.cpp
@@ -1,117 +1,117 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
#include <ydb/core/persqueue/config/config.h>
#include <ydb/core/mind/hive/hive.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TAlterPQ: public TSubOperation {
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TAlterPQ: public TSubOperation {
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::CreateParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
- return TTxState::ConfigureParts;
- case TTxState::ConfigureParts:
- return TTxState::Propose;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::CreateParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
+ return TTxState::ConfigureParts;
+ case TTxState::ConfigureParts:
+ return TTxState::Propose;
case TTxState::Propose:
return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
return THolder(new TCreateParts(OperationId));
- case TTxState::ConfigureParts:
+ case TTxState::ConfigureParts:
return THolder(new NPQState::TConfigureParts(OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new NPQState::TPropose(OperationId));
case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TAlterPQ(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TAlterPQ(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- TPersQueueGroupInfo::TPtr ParseParams(
+
+ TAlterPQ(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ TPersQueueGroupInfo::TPtr ParseParams(
TOperationContext& context,
NKikimrPQ::TPQTabletConfig* tabletConfig,
- const NKikimrSchemeOp::TPersQueueGroupDescription& alter,
- TString& errStr)
- {
- TPersQueueGroupInfo::TPtr params = new TPersQueueGroupInfo();
+ const NKikimrSchemeOp::TPersQueueGroupDescription& alter,
+ TString& errStr)
+ {
+ TPersQueueGroupInfo::TPtr params = new TPersQueueGroupInfo();
const bool hasKeySchema = tabletConfig->PartitionKeySchemaSize();
- if (alter.HasTotalGroupCount()) {
+ if (alter.HasTotalGroupCount()) {
if (hasKeySchema) {
errStr = "Cannot change partition count. Use split/merge instead";
return nullptr;
}
- ui32 totalGroupCount = alter.GetTotalGroupCount();
- if (!totalGroupCount) {
- errStr = Sprintf("Invalid total groups count specified: %u", totalGroupCount);
- return nullptr;
- }
- params->TotalGroupCount = totalGroupCount;
- }
- if (alter.HasPartitionPerTablet()) {
- ui32 maxPartsPerTablet = alter.GetPartitionPerTablet();
- if (!maxPartsPerTablet) {
- errStr = Sprintf("Invalid partition per tablet count specified: %u", maxPartsPerTablet);
- return nullptr;
- }
- params->MaxPartsPerTablet = maxPartsPerTablet;
- }
- if (alter.HasPQTabletConfig()) {
+ ui32 totalGroupCount = alter.GetTotalGroupCount();
+ if (!totalGroupCount) {
+ errStr = Sprintf("Invalid total groups count specified: %u", totalGroupCount);
+ return nullptr;
+ }
+ params->TotalGroupCount = totalGroupCount;
+ }
+ if (alter.HasPartitionPerTablet()) {
+ ui32 maxPartsPerTablet = alter.GetPartitionPerTablet();
+ if (!maxPartsPerTablet) {
+ errStr = Sprintf("Invalid partition per tablet count specified: %u", maxPartsPerTablet);
+ return nullptr;
+ }
+ params->MaxPartsPerTablet = maxPartsPerTablet;
+ }
+ if (alter.HasPQTabletConfig()) {
NKikimrPQ::TPQTabletConfig alterConfig = alter.GetPQTabletConfig();
alterConfig.ClearPartitionIds();
alterConfig.ClearPartitions();
if (!CheckPersQueueConfig(alterConfig, false, &errStr)) {
- return nullptr;
- }
+ return nullptr;
+ }
if (alterConfig.GetPartitionConfig().ExplicitChannelProfilesSize() > 0) {
// Validate explicit channel profiles alter attempt
@@ -158,97 +158,97 @@ public:
alterConfig.MutablePartitionKeySchema()->Swap(tabletConfig->MutablePartitionKeySchema());
Y_PROTOBUF_SUPPRESS_NODISCARD alterConfig.SerializeToString(&params->TabletConfig);
alterConfig.Swap(tabletConfig);
- }
- if (alter.PartitionsToDeleteSize()) {
- errStr = Sprintf("deletion of partitions is not supported yet");
- return nullptr;
- }
- if (alter.PartitionsToAddSize()) {
+ }
+ if (alter.PartitionsToDeleteSize()) {
+ errStr = Sprintf("deletion of partitions is not supported yet");
+ return nullptr;
+ }
+ if (alter.PartitionsToAddSize()) {
if (hasKeySchema) {
errStr = "Cannot change partition count. Use split/merge instead";
return nullptr;
}
- if (params->TotalGroupCount) {
- errStr = Sprintf("providing TotalGroupCount and PartitionsToAdd at the same time is forbidden");
- return nullptr;
- }
-
- THashSet<ui32> parts;
- for (const auto& p : alter.GetPartitionsToAdd()) {
- if (!parts.insert(p.GetPartitionId()).second) {
- errStr = TStringBuilder()
- << "providing partition " << p.GetPartitionId() << " serveral times in PartitionsToAdd is forbidden";
- return nullptr;
- }
+ if (params->TotalGroupCount) {
+ errStr = Sprintf("providing TotalGroupCount and PartitionsToAdd at the same time is forbidden");
+ return nullptr;
+ }
+
+ THashSet<ui32> parts;
+ for (const auto& p : alter.GetPartitionsToAdd()) {
+ if (!parts.insert(p.GetPartitionId()).second) {
+ errStr = TStringBuilder()
+ << "providing partition " << p.GetPartitionId() << " serveral times in PartitionsToAdd is forbidden";
+ return nullptr;
+ }
params->PartitionsToAdd.emplace(p.GetPartitionId(), p.GetGroupId());
- }
- }
+ }
+ }
if (alter.HasBootstrapConfig()) {
errStr = "Bootstrap config can be passed only upon creation";
return nullptr;
}
- return params;
- }
-
- TTxState& PrepareChanges(
+ return params;
+ }
+
+ TTxState& PrepareChanges(
TOperationId operationId,
const TPath& path,
- TPersQueueGroupInfo::TPtr pqGroup,
- ui64 shardsToCreate,
+ TPersQueueGroupInfo::TPtr pqGroup,
+ ui64 shardsToCreate,
const TChannelsBindings& rbChannelsBinding,
const TChannelsBindings& pqChannelsBinding,
- TOperationContext& context)
- {
+ TOperationContext& context)
+ {
TPathElement::TPtr item = path.Base();
- NIceDb::TNiceDb db(context.Txc.DB);
-
- item->LastTxId = operationId.GetTxId();
- item->PathState = TPathElement::EPathState::EPathStateAlter;
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxAlterPQGroup, item->PathId);
- txState.State = TTxState::CreateParts;
-
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ item->LastTxId = operationId.GetTxId();
+ item->PathState = TPathElement::EPathState::EPathStateAlter;
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxAlterPQGroup, item->PathId);
+ txState.State = TTxState::CreateParts;
+
bool needMoreShards = ApplySharding(operationId.GetTxId(), item->PathId, pqGroup, txState, rbChannelsBinding, pqChannelsBinding, context);
- if (needMoreShards) {
- context.SS->PersistUpdateNextShardIdx(db);
- }
-
- for (auto& shard : pqGroup->Shards) {
- auto shardIdx = shard.first;
- for (const auto& pqInfo : shard.second->PQInfos) {
+ if (needMoreShards) {
+ context.SS->PersistUpdateNextShardIdx(db);
+ }
+
+ for (auto& shard : pqGroup->Shards) {
+ auto shardIdx = shard.first;
+ for (const auto& pqInfo : shard.second->PQInfos) {
context.SS->PersistPersQueue(db, item->PathId, shardIdx, pqInfo);
- }
- }
-
- context.SS->PersistAddPersQueueGroupAlter(db, item->PathId, pqGroup->AlterData);
-
- context.SS->PersistTxState(db, operationId);
- ui64 checkShardsToCreate = 0;
- for (auto shard : txState.Shards) {
- if (shard.Operation == TTxState::CreateParts) {
+ }
+ }
+
+ context.SS->PersistAddPersQueueGroupAlter(db, item->PathId, pqGroup->AlterData);
+
+ context.SS->PersistTxState(db, operationId);
+ ui64 checkShardsToCreate = 0;
+ for (auto shard : txState.Shards) {
+ if (shard.Operation == TTxState::CreateParts) {
TShardInfo& shardInfo = context.SS->ShardInfos[shard.Idx];
context.SS->PersistShardMapping(db, shard.Idx, shardInfo.TabletID, item->PathId, operationId.GetTxId(), shard.TabletType);
switch (shard.TabletType) {
case ETabletType::PersQueueReadBalancer:
context.SS->PersistChannelsBinding(db, shard.Idx, rbChannelsBinding);
- context.SS->TabletCounters->Simple()[COUNTER_PQ_RB_SHARD_COUNT].Add(1);
+ context.SS->TabletCounters->Simple()[COUNTER_PQ_RB_SHARD_COUNT].Add(1);
break;
default:
context.SS->PersistChannelsBinding(db, shard.Idx, pqChannelsBinding);
- context.SS->TabletCounters->Simple()[COUNTER_PQ_SHARD_COUNT].Add(1);
+ context.SS->TabletCounters->Simple()[COUNTER_PQ_SHARD_COUNT].Add(1);
break;
}
if (!shardInfo.TabletID) {
++checkShardsToCreate;
}
- }
- }
- Y_VERIFY(shardsToCreate == checkShardsToCreate);
-
- return txState;
- }
-
+ }
+ }
+ Y_VERIFY(shardsToCreate == checkShardsToCreate);
+
+ return txState;
+ }
+
static bool IsChannelsEqual(const TChannelsBindings& a, const TChannelsBindings& b) {
// for some reason, the default equality operator doesn't work with this proto message
return std::equal(a.begin(), a.end(), b.begin(), b.end(),
@@ -271,49 +271,49 @@ public:
return false;
}
- bool ApplySharding(
- TTxId txId,
- const TPathId& pathId,
- TPersQueueGroupInfo::TPtr pqGroup,
- TTxState& txState,
+ bool ApplySharding(
+ TTxId txId,
+ const TPathId& pathId,
+ TPersQueueGroupInfo::TPtr pqGroup,
+ TTxState& txState,
const TChannelsBindings& rbBindedChannels,
const TChannelsBindings& pqBindedChannels,
- TOperationContext& context)
- {
+ TOperationContext& context)
+ {
TShardInfo defaultShardInfo = TShardInfo::PersQShardInfo(txId, pathId);
defaultShardInfo.BindedChannels = pqBindedChannels;
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "AlterPQGroup txid# " << txId
- << " AlterVersion# " << pqGroup->AlterData->AlterVersion
- << " Parts count# " << pqGroup->TotalPartitionCount << "->" << pqGroup->AlterData->TotalPartitionCount
- << " Groups count# " << pqGroup->TotalGroupCount << "->" << pqGroup->AlterData->TotalGroupCount
- << " MaxPerPQ# " << pqGroup->MaxPartsPerTablet << "->" << pqGroup->AlterData->MaxPartsPerTablet
- << " adding partitions# " << pqGroup->AlterData->PartitionsToAdd.size()
- << " deleting partitions# " << pqGroup->AlterData->PartitionsToDelete.size());
-
- // Leave pqGroup->AlterVersion unchanged. It will be updated in TxPlanStep.
- ui32 shardsNeeded = pqGroup->AlterData->ExpectedShardCount();
- ui32 shardsCurrent = pqGroup->ShardCount();
- if (shardsNeeded < shardsCurrent) // can't reduce counts
- shardsNeeded = shardsCurrent;
-
- ui32 pqShardsToCreate = shardsNeeded - shardsCurrent;
-
- txState.Shards.reserve(shardsNeeded);
-
- ui32 shardsToCreate = pqShardsToCreate;
-
- bool hasBalancer = pqGroup->HasBalancer();
- if (!hasBalancer) {
- shardsToCreate += 1;
- }
-
- // reconfig old shards
- for (auto& shard : pqGroup->Shards) {
- auto shardIdx = shard.first;
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "AlterPQGroup txid# " << txId
+ << " AlterVersion# " << pqGroup->AlterData->AlterVersion
+ << " Parts count# " << pqGroup->TotalPartitionCount << "->" << pqGroup->AlterData->TotalPartitionCount
+ << " Groups count# " << pqGroup->TotalGroupCount << "->" << pqGroup->AlterData->TotalGroupCount
+ << " MaxPerPQ# " << pqGroup->MaxPartsPerTablet << "->" << pqGroup->AlterData->MaxPartsPerTablet
+ << " adding partitions# " << pqGroup->AlterData->PartitionsToAdd.size()
+ << " deleting partitions# " << pqGroup->AlterData->PartitionsToDelete.size());
+
+ // Leave pqGroup->AlterVersion unchanged. It will be updated in TxPlanStep.
+ ui32 shardsNeeded = pqGroup->AlterData->ExpectedShardCount();
+ ui32 shardsCurrent = pqGroup->ShardCount();
+ if (shardsNeeded < shardsCurrent) // can't reduce counts
+ shardsNeeded = shardsCurrent;
+
+ ui32 pqShardsToCreate = shardsNeeded - shardsCurrent;
+
+ txState.Shards.reserve(shardsNeeded);
+
+ ui32 shardsToCreate = pqShardsToCreate;
+
+ bool hasBalancer = pqGroup->HasBalancer();
+ if (!hasBalancer) {
+ shardsToCreate += 1;
+ }
+
+ // reconfig old shards
+ for (auto& shard : pqGroup->Shards) {
+ auto shardIdx = shard.first;
auto& shardInfo = context.SS->ShardInfos[shardIdx];
-
+
if (IsShardRequiresRecreation(shardInfo, defaultShardInfo)) {
txState.Shards.emplace_back(shardIdx, ETabletType::PersQueue, TTxState::CreateParts);
shardInfo.CurrentTxId = defaultShardInfo.CurrentTxId;
@@ -321,130 +321,130 @@ public:
} else {
txState.Shards.emplace_back(shardIdx, ETabletType::PersQueue, TTxState::ConfigureParts);
}
- }
-
- // create new shards
- const auto startShardIdx = context.SS->ReserveShardIdxs(shardsToCreate);
- for (ui64 i = 0; i < pqShardsToCreate; ++i) {
- const auto idx = context.SS->NextShardIdx(startShardIdx, i);
- txState.Shards.emplace_back(idx, ETabletType::PersQueue, TTxState::CreateParts);
-
+ }
+
+ // create new shards
+ const auto startShardIdx = context.SS->ReserveShardIdxs(shardsToCreate);
+ for (ui64 i = 0; i < pqShardsToCreate; ++i) {
+ const auto idx = context.SS->NextShardIdx(startShardIdx, i);
+ txState.Shards.emplace_back(idx, ETabletType::PersQueue, TTxState::CreateParts);
+
context.SS->RegisterShardInfo(idx, defaultShardInfo);
- pqGroup->Shards[idx] = new TPQShardInfo();
- }
-
- if (!hasBalancer) {
- const auto idx = context.SS->NextShardIdx(startShardIdx, pqShardsToCreate);
- pqGroup->BalancerShardIdx = idx;
- txState.Shards.emplace_back(idx, ETabletType::PersQueueReadBalancer, TTxState::CreateParts);
+ pqGroup->Shards[idx] = new TPQShardInfo();
+ }
+
+ if (!hasBalancer) {
+ const auto idx = context.SS->NextShardIdx(startShardIdx, pqShardsToCreate);
+ pqGroup->BalancerShardIdx = idx;
+ txState.Shards.emplace_back(idx, ETabletType::PersQueueReadBalancer, TTxState::CreateParts);
context.SS->RegisterShardInfo(idx,
defaultShardInfo
.WithTabletType(ETabletType::PersQueueReadBalancer)
.WithBindedChannels(rbBindedChannels));
- } else {
- auto shardIdx = pqGroup->BalancerShardIdx;
- txState.Shards.emplace_back(shardIdx, ETabletType::PersQueueReadBalancer, TTxState::ConfigureParts);
- }
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "AlterPQGroup txid# " << txId
- << ". Shard count " << shardsCurrent << "->" << shardsNeeded
- << ", first new shardIdx " << startShardIdx
- << " hasBalancer " << hasBalancer);
-
- ReassignIds(pqGroup);
- return shardsToCreate > 0;
- }
-
- void ReassignIds(TPersQueueGroupInfo::TPtr pqGroup) {
- Y_VERIFY(pqGroup->TotalPartitionCount >= pqGroup->TotalGroupCount);
- ui32 numOld = pqGroup->TotalPartitionCount;
- ui32 numNew = pqGroup->AlterData->PartitionsToAdd.size() + numOld;
- //ui32 maxPerPart = pqGroup->AlterData->MaxPartsPerTablet;
- ui32 average = numNew / pqGroup->Shards.size(); // TODO: not optimal
- if (numNew % pqGroup->Shards.size())
- ++average;
- ui64 alterVersion = pqGroup->AlterData->AlterVersion;
-
- auto it = pqGroup->Shards.begin();
-
- for (const auto& p : pqGroup->AlterData->PartitionsToAdd) {
- TPQShardInfo::TPersQueueInfo pqInfo;
+ } else {
+ auto shardIdx = pqGroup->BalancerShardIdx;
+ txState.Shards.emplace_back(shardIdx, ETabletType::PersQueueReadBalancer, TTxState::ConfigureParts);
+ }
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "AlterPQGroup txid# " << txId
+ << ". Shard count " << shardsCurrent << "->" << shardsNeeded
+ << ", first new shardIdx " << startShardIdx
+ << " hasBalancer " << hasBalancer);
+
+ ReassignIds(pqGroup);
+ return shardsToCreate > 0;
+ }
+
+ void ReassignIds(TPersQueueGroupInfo::TPtr pqGroup) {
+ Y_VERIFY(pqGroup->TotalPartitionCount >= pqGroup->TotalGroupCount);
+ ui32 numOld = pqGroup->TotalPartitionCount;
+ ui32 numNew = pqGroup->AlterData->PartitionsToAdd.size() + numOld;
+ //ui32 maxPerPart = pqGroup->AlterData->MaxPartsPerTablet;
+ ui32 average = numNew / pqGroup->Shards.size(); // TODO: not optimal
+ if (numNew % pqGroup->Shards.size())
+ ++average;
+ ui64 alterVersion = pqGroup->AlterData->AlterVersion;
+
+ auto it = pqGroup->Shards.begin();
+
+ for (const auto& p : pqGroup->AlterData->PartitionsToAdd) {
+ TPQShardInfo::TPersQueueInfo pqInfo;
pqInfo.PqId = p.PartitionId;
pqInfo.GroupId = p.GroupId;
pqInfo.KeyRange = p.KeyRange;
- pqInfo.AlterVersion = alterVersion;
- while (it->second->PQInfos.size() >= average) {
- ++it;
- }
- it->second->PQInfos.push_back(pqInfo);
- }
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+ pqInfo.AlterVersion = alterVersion;
+ while (it->second->PQInfos.size() >= average) {
+ ++it;
+ }
+ it->second->PQInfos.push_back(pqInfo);
+ }
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const auto& alter = Transaction.GetAlterPersQueueGroup();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
- const TString& name = alter.GetName();
- const TPathId pathId = alter.HasPathId() ? context.SS->MakeLocalId(alter.GetPathId()) : InvalidPathId;
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterPQ Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", pathId: " << pathId
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- TString errStr;
-
- if (!alter.HasName() && !alter.HasPathId()) {
- errStr = "Niether topic name nor pathId in Alter";
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
-
- TPath path = alter.HasPathId()
- ? TPath::Init(pathId, context.SS)
- : TPath::Resolve(parentPathStr, context.SS).Dive(name);
-
- {
- TPath::TChecker checks = path.Check();
+ const TString& name = alter.GetName();
+ const TPathId pathId = alter.HasPathId() ? context.SS->MakeLocalId(alter.GetPathId()) : InvalidPathId;
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterPQ Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", pathId: " << pathId
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ TString errStr;
+
+ if (!alter.HasName() && !alter.HasPathId()) {
+ errStr = "Niether topic name nor pathId in Alter";
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+
+ TPath path = alter.HasPathId()
+ ? TPath::Init(pathId, context.SS)
+ : TPath::Resolve(parentPathStr, context.SS).Dive(name);
+
+ {
+ TPath::TChecker checks = path.Check();
checks
.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
.IsPQGroup()
- .NotUnderOperation()
- .IsCommonSensePath();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- TPersQueueGroupInfo::TPtr pqGroup = context.SS->PersQueueGroups.at(path.Base()->PathId);
- Y_VERIFY(pqGroup);
-
- if (pqGroup->AlterVersion == 0) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, "PQGroup is not created yet");
- return result;
- }
- if (pqGroup->AlterData) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, "There's another Alter in flight");
- return result;
- }
-
+ .NotUnderOperation()
+ .IsCommonSensePath();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ TPersQueueGroupInfo::TPtr pqGroup = context.SS->PersQueueGroups.at(path.Base()->PathId);
+ Y_VERIFY(pqGroup);
+
+ if (pqGroup->AlterVersion == 0) {
+ result->SetError(NKikimrScheme::StatusMultipleModifications, "PQGroup is not created yet");
+ return result;
+ }
+ if (pqGroup->AlterData) {
+ result->SetError(NKikimrScheme::StatusMultipleModifications, "There's another Alter in flight");
+ return result;
+ }
+
NKikimrPQ::TPQTabletConfig tabletConfig, newTabletConfig;
if (!pqGroup->TabletConfig.empty()) {
bool parseOk = ParseFromStringNoSizeLimit(tabletConfig, pqGroup->TabletConfig);
@@ -455,63 +455,63 @@ public:
TPersQueueGroupInfo::TPtr alterData = ParseParams(context, &newTabletConfig, alter, errStr);
if (!alterData) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
return result;
}
- // do not change if not set
- if (!alterData->TotalGroupCount) {
- alterData->TotalGroupCount = pqGroup->TotalGroupCount;
- }
-
- if (!alterData->MaxPartsPerTablet) {
- alterData->MaxPartsPerTablet = pqGroup->MaxPartsPerTablet;
- }
-
- if (alterData->TotalGroupCount < pqGroup->TotalGroupCount) {
- errStr = TStringBuilder()
- << "Invalid total groups count specified: " << alterData->TotalGroupCount
- << " vs " << pqGroup->TotalGroupCount << " (current)";
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
-
- ui32 diff = alterData->TotalGroupCount - pqGroup->TotalGroupCount;
-
- for (ui32 i = 0; i < diff; ++i) {
+ // do not change if not set
+ if (!alterData->TotalGroupCount) {
+ alterData->TotalGroupCount = pqGroup->TotalGroupCount;
+ }
+
+ if (!alterData->MaxPartsPerTablet) {
+ alterData->MaxPartsPerTablet = pqGroup->MaxPartsPerTablet;
+ }
+
+ if (alterData->TotalGroupCount < pqGroup->TotalGroupCount) {
+ errStr = TStringBuilder()
+ << "Invalid total groups count specified: " << alterData->TotalGroupCount
+ << " vs " << pqGroup->TotalGroupCount << " (current)";
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+
+ ui32 diff = alterData->TotalGroupCount - pqGroup->TotalGroupCount;
+
+ for (ui32 i = 0; i < diff; ++i) {
alterData->PartitionsToAdd.emplace(pqGroup->NextPartitionId + i, pqGroup->TotalGroupCount + 1 + i);
- }
-
- if (diff > 0) {
- alterData->TotalGroupCount = pqGroup->TotalGroupCount + diff;
- }
-
- alterData->TotalPartitionCount = pqGroup->TotalPartitionCount + alterData->PartitionsToAdd.size();
- alterData->NextPartitionId = pqGroup->NextPartitionId;
- for (const auto& p : alterData->PartitionsToAdd) {
+ }
+
+ if (diff > 0) {
+ alterData->TotalGroupCount = pqGroup->TotalGroupCount + diff;
+ }
+
+ alterData->TotalPartitionCount = pqGroup->TotalPartitionCount + alterData->PartitionsToAdd.size();
+ alterData->NextPartitionId = pqGroup->NextPartitionId;
+ for (const auto& p : alterData->PartitionsToAdd) {
if (p.GroupId == 0 || p.GroupId > alterData->TotalGroupCount) {
- errStr = TStringBuilder()
+ errStr = TStringBuilder()
<< "Invalid partition group id " << p.GroupId
- << " vs " << pqGroup->TotalGroupCount;
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
-
+ << " vs " << pqGroup->TotalGroupCount;
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+
alterData->NextPartitionId = Max<ui32>(alterData->NextPartitionId, p.PartitionId + 1);
- }
-
- if (alterData->MaxPartsPerTablet < pqGroup->MaxPartsPerTablet) {
- errStr = TStringBuilder()
- << "Invalid partition per tablet count specified: " << alterData->MaxPartsPerTablet
- << " vs " << pqGroup->MaxPartsPerTablet << " (current)";
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
-
- ui64 shardsToCreate = ui64(!pqGroup->HasBalancer());
- if (alterData->ExpectedShardCount() > pqGroup->ShardCount()) {
- shardsToCreate += alterData->ExpectedShardCount() - pqGroup->ShardCount();
- }
+ }
+
+ if (alterData->MaxPartsPerTablet < pqGroup->MaxPartsPerTablet) {
+ errStr = TStringBuilder()
+ << "Invalid partition per tablet count specified: " << alterData->MaxPartsPerTablet
+ << " vs " << pqGroup->MaxPartsPerTablet << " (current)";
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+
+ ui64 shardsToCreate = ui64(!pqGroup->HasBalancer());
+ if (alterData->ExpectedShardCount() > pqGroup->ShardCount()) {
+ shardsToCreate += alterData->ExpectedShardCount() - pqGroup->ShardCount();
+ }
ui64 partitionsToCreate = alterData->PartitionsToAdd.size();
if (alterData->TotalGroupCount > TSchemeShard::MaxPQGroupPartitionsCount) {
@@ -544,35 +544,35 @@ public:
ui64 storageToReserve = newStorage > oldStorage ? newStorage - oldStorage : 0;
- {
- TPath::TChecker checks = path.Check();
- checks
- .ShardsLimit(shardsToCreate)
+ {
+ TPath::TChecker checks = path.Check();
+ checks
+ .ShardsLimit(shardsToCreate)
.PathShardsLimit(shardsToCreate)
.PQPartitionsLimit(partitionsToCreate)
.PQReservedStorageLimit(storageToReserve);
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
// This profile id is only used for pq read balancer tablet when
// explicit channel profiles are specified. Read balancer tablet is
// a tablet with local db which doesn't use extra channels in any way.
const ui32 tabletProfileId = 0;
TChannelsBindings tabletChannelsBinding;
if (!context.SS->ResolvePqChannels(tabletProfileId, path.DomainId(), tabletChannelsBinding)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter,
+ result->SetError(NKikimrScheme::StatusInvalidParameter,
"Unable to construct channel binding for PQ with the storage pool");
return result;
}
@@ -596,7 +596,7 @@ public:
path.DomainId(),
pqChannelsBinding);
if (!resolved) {
- result->SetError(NKikimrScheme::StatusInvalidParameter,
+ result->SetError(NKikimrScheme::StatusInvalidParameter,
"Unable to construct channel binding for PersQueue with the storage pool");
return result;
}
@@ -606,14 +606,14 @@ public:
pqChannelsBinding = tabletChannelsBinding;
}
- pqGroup->PrepareAlter(alterData);
+ pqGroup->PrepareAlter(alterData);
const TTxState& txState = PrepareChanges(OperationId, path, pqGroup, shardsToCreate, tabletChannelsBinding, pqChannelsBinding, context);
-
- context.OnComplete.ActivateTx(OperationId);
- context.SS->ClearDescribePathCaches(path.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
-
- path.DomainInfo()->AddInternalShards(txState);
+
+ context.OnComplete.ActivateTx(OperationId);
+ context.SS->ClearDescribePathCaches(path.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
+
+ path.DomainInfo()->AddInternalShards(txState);
path.DomainInfo()->IncPQPartitionsInside(partitionsToCreate);
path.DomainInfo()->UpdatePQReservedStorage(oldStorage, newStorage);
@@ -625,41 +625,41 @@ public:
context.SS->TabletCounters->Simple()[COUNTER_STREAM_RESERVED_STORAGE].Sub(oldStorage);
context.SS->TabletCounters->Simple()[COUNTER_STREAM_SHARDS_COUNT].Add(partitionsToCreate);
-
- path.Base()->IncShardsInside(shardsToCreate);
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+
+ path.Base()->IncShardsInside(shardsToCreate);
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TAlterPQ");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterPQ AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterPQ AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateAlterPQ(TOperationId id, const TTxTransaction& tx) {
return new TAlterPQ(id, tx);
}
-ISubOperationBase::TPtr CreateAlterPQ(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateAlterPQ(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TAlterPQ(id, state);
-}
-
-}
-}
+ return new TAlterPQ(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_solomon.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_solomon.cpp
index 88be85aba51..1c17ee60955 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_solomon.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_solomon.cpp
@@ -1,53 +1,53 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
#include <ydb/core/persqueue/config/config.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TConfigureParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TConfigureParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TAlterSolomon TConfigureParts"
- << ", operationId: " << OperationId;
- }
-
-public:
- TConfigureParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(),
- {TEvHive::TEvCreateTabletReply::EventType, TEvHive::TEvAdoptTabletReply::EventType});
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at tablet" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxAlterSolomonVolume);
-
- auto solomon = context.SS->SolomonVolumes[txState->TargetPathId];
- Y_VERIFY_S(solomon, "solomon volume is null. PathId: " << txState->TargetPathId);
- Y_VERIFY_S(solomon->AlterData, "solomon volume alter data is null. PathId: " << txState->TargetPathId);
-
- for (const auto& shard: txState->Shards) {
- auto solomonPartition = solomon->AlterData->Partitions[shard.Idx];
- Y_VERIFY_S(solomonPartition, "rtmr partitions is null shard idx: " << shard.Idx << " Path: " << txState->TargetPathId);
-
- auto tabletId = context.SS->ShardInfos[shard.Idx].TabletID;
+ return TStringBuilder()
+ << "TAlterSolomon TConfigureParts"
+ << ", operationId: " << OperationId;
+ }
+
+public:
+ TConfigureParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(),
+ {TEvHive::TEvCreateTabletReply::EventType, TEvHive::TEvAdoptTabletReply::EventType});
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at tablet" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxAlterSolomonVolume);
+
+ auto solomon = context.SS->SolomonVolumes[txState->TargetPathId];
+ Y_VERIFY_S(solomon, "solomon volume is null. PathId: " << txState->TargetPathId);
+ Y_VERIFY_S(solomon->AlterData, "solomon volume alter data is null. PathId: " << txState->TargetPathId);
+
+ for (const auto& shard: txState->Shards) {
+ auto solomonPartition = solomon->AlterData->Partitions[shard.Idx];
+ Y_VERIFY_S(solomonPartition, "rtmr partitions is null shard idx: " << shard.Idx << " Path: " << txState->TargetPathId);
+
+ auto tabletId = context.SS->ShardInfos[shard.Idx].TabletID;
if (solomonPartition->TabletId != InvalidTabletId && tabletId != solomonPartition->TabletId) {
Y_FAIL_S("Solomon partition tablet id mismatch"
@@ -55,278 +55,278 @@ public:
<< ", got: " << tabletId);
}
- solomonPartition->TabletId = tabletId;
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
- return true;
- }
-};
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ solomonPartition->TabletId = tabletId;
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
+ return true;
+ }
+};
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TAlterSolomon TPropose"
- << ", operationId: " << OperationId;
- }
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
+ return TStringBuilder()
+ << "TAlterSolomon TPropose"
+ << ", operationId: " << OperationId;
+ }
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
IgnoreMessages(DebugHint(),
{TEvHive::TEvCreateTabletReply::EventType, TEvHive::TEvAdoptTabletReply::EventType});
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", step: " << step
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- if(!txState) {
- return false;
- }
-
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- auto solomon = context.SS->SolomonVolumes[txState->TargetPathId];
- Y_VERIFY_S(solomon, "solomon volume is null. PathId: " << txState->TargetPathId);
- Y_VERIFY_S(solomon->AlterData, "solomon volume alter data is null. PathId: " << txState->TargetPathId);
-
- context.SS->TabletCounters->Simple()[COUNTER_SOLOMON_PARTITIONS_COUNT].Sub(solomon->Partitions.size());
- context.SS->TabletCounters->Simple()[COUNTER_SOLOMON_PARTITIONS_COUNT].Add(solomon->AlterData->Partitions.size());
-
- context.SS->PersistSolomonVolume(db, txState->TargetPathId, solomon->AlterData);
- context.SS->SolomonVolumes[txState->TargetPathId] = solomon->AlterData;
-
- context.SS->ClearDescribePathCaches(path);
- context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
-
- context.SS->ChangeTxState(db, OperationId, TTxState::Done);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxAlterSolomonVolume);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-class TAlterSolomon: public TSubOperation {
- const TOperationId OperationId;
- const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::CreateParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
- return TTxState::ConfigureParts;
- case TTxState::ConfigureParts:
- return TTxState::Propose;
- case TTxState::Propose:
- return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", step: " << step
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ if(!txState) {
+ return false;
+ }
+
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ auto solomon = context.SS->SolomonVolumes[txState->TargetPathId];
+ Y_VERIFY_S(solomon, "solomon volume is null. PathId: " << txState->TargetPathId);
+ Y_VERIFY_S(solomon->AlterData, "solomon volume alter data is null. PathId: " << txState->TargetPathId);
+
+ context.SS->TabletCounters->Simple()[COUNTER_SOLOMON_PARTITIONS_COUNT].Sub(solomon->Partitions.size());
+ context.SS->TabletCounters->Simple()[COUNTER_SOLOMON_PARTITIONS_COUNT].Add(solomon->AlterData->Partitions.size());
+
+ context.SS->PersistSolomonVolume(db, txState->TargetPathId, solomon->AlterData);
+ context.SS->SolomonVolumes[txState->TargetPathId] = solomon->AlterData;
+
+ context.SS->ClearDescribePathCaches(path);
+ context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::Done);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxAlterSolomonVolume);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+class TAlterSolomon: public TSubOperation {
+ const TOperationId OperationId;
+ const TTxTransaction Transaction;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::CreateParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
+ return TTxState::ConfigureParts;
+ case TTxState::ConfigureParts:
+ return TTxState::Propose;
+ case TTxState::Propose:
+ return TTxState::Done;
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
return MakeHolder<TCreateParts>(OperationId);
- case TTxState::ConfigureParts:
+ case TTxState::ConfigureParts:
return MakeHolder<TConfigureParts>(OperationId);
- case TTxState::Propose:
+ case TTxState::Propose:
return MakeHolder<TPropose>(OperationId);
- case TTxState::Done:
+ case TTxState::Done:
return MakeHolder<TDone>(OperationId);
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
- TAlterSolomon(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
- , Transaction(tx)
- {
- }
-
- TAlterSolomon(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
- const auto& alter = Transaction.GetAlterSolomonVolume();
-
- const TString& parentPathStr = Transaction.GetWorkingDir();
- const TString& name = alter.GetName();
- const ui32 channelProfileId = alter.GetChannelProfileId();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterSolomon Propose"
- << ", path: "<< parentPathStr << "/" << name
- << ", opId: " << OperationId
- << ", channelProfileId: " << channelProfileId
- << ", at schemeshard: " << ssId);
-
- THolder<TProposeResponse> result;
- result.Reset(new TEvSchemeShard::TEvModifySchemeTransactionResult(
- NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId)));
-
- TString errStr;
-
- TPath path = TPath::Resolve(parentPathStr, context.SS).Dive(name);
- {
- TPath::TChecker checks = path.Check();
- checks
- .NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .IsSolomon()
- .NotUnderOperation()
- .IsCommonSensePath();
-
- if (checks) {
- TSolomonVolumeInfo::TPtr solomon = context.SS->SolomonVolumes.at(path.Base()->PathId);
- if (alter.GetPartitionCount() > solomon->Partitions.size()) {
- const ui64 shardsToCreate = alter.GetPartitionCount() - solomon->Partitions.size();
-
- checks
- .ShardsLimit(shardsToCreate)
- .PathShardsLimit(shardsToCreate);
- }
-
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- TSolomonVolumeInfo::TPtr solomon = context.SS->SolomonVolumes.at(path.Base()->PathId);
-
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
+ TAlterSolomon(TOperationId id, const TTxTransaction& tx)
+ : OperationId(id)
+ , Transaction(tx)
+ {
+ }
+
+ TAlterSolomon(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ const auto& alter = Transaction.GetAlterSolomonVolume();
+
+ const TString& parentPathStr = Transaction.GetWorkingDir();
+ const TString& name = alter.GetName();
+ const ui32 channelProfileId = alter.GetChannelProfileId();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterSolomon Propose"
+ << ", path: "<< parentPathStr << "/" << name
+ << ", opId: " << OperationId
+ << ", channelProfileId: " << channelProfileId
+ << ", at schemeshard: " << ssId);
+
+ THolder<TProposeResponse> result;
+ result.Reset(new TEvSchemeShard::TEvModifySchemeTransactionResult(
+ NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId)));
+
+ TString errStr;
+
+ TPath path = TPath::Resolve(parentPathStr, context.SS).Dive(name);
+ {
+ TPath::TChecker checks = path.Check();
+ checks
+ .NotEmpty()
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .IsSolomon()
+ .NotUnderOperation()
+ .IsCommonSensePath();
+
+ if (checks) {
+ TSolomonVolumeInfo::TPtr solomon = context.SS->SolomonVolumes.at(path.Base()->PathId);
+ if (alter.GetPartitionCount() > solomon->Partitions.size()) {
+ const ui64 shardsToCreate = alter.GetPartitionCount() - solomon->Partitions.size();
+
+ checks
+ .ShardsLimit(shardsToCreate)
+ .PathShardsLimit(shardsToCreate);
+ }
+
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ TSolomonVolumeInfo::TPtr solomon = context.SS->SolomonVolumes.at(path.Base()->PathId);
+
if (!alter.HasPartitionCount() && !alter.GetUpdateChannelsBinding()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "Empty alter");
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "Empty alter");
+ return result;
+ }
+
if (alter.GetUpdateChannelsBinding() && !AppData()->FeatureFlags.GetAllowUpdateChannelsBindingOfSolomonPartitions()) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, "Updating of channels binding is not available");
- }
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, "Updating of channels binding is not available");
+ }
+
if (alter.HasPartitionCount()) {
if (alter.GetPartitionCount() < solomon->Partitions.size()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "solomon volume has more shards than requested");
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "solomon volume has more shards than requested");
return result;
}
if (alter.GetPartitionCount() == solomon->Partitions.size()) {
- result->SetError(NKikimrScheme::StatusSuccess, "solomon volume has olready the same shards as requested");
+ result->SetError(NKikimrScheme::StatusSuccess, "solomon volume has olready the same shards as requested");
return result;
}
}
- if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- if (!alter.HasChannelProfileId()) {
- result->SetError(TEvSchemeShard::EStatus::StatusInvalidParameter, "set channel profile id, please");
- return result;
- }
-
- TChannelsBindings channelsBinding;
- if (!context.SS->ResolveSolomonChannels(channelProfileId, path.DomainId(), channelsBinding)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable to construct channel binding with the storage pool");
- return result;
- }
-
- result->SetPathId(path.Base()->PathId.LocalPathId);
-
- TSolomonVolumeInfo::TPtr alterSolomon = solomon->CreateAlter();
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxAlterSolomonVolume, path.Base()->PathId);
-
- TShardInfo solomonPartitionInfo = TShardInfo::SolomonPartitionInfo(OperationId.GetTxId(), path.Base()->PathId);
- solomonPartitionInfo.BindedChannels = channelsBinding;
-
- path.Base()->LastTxId = OperationId.GetTxId();
- path.Base()->PathState = TPathElement::EPathState::EPathStateAlter;
-
- context.SS->PersistLastTxId(db, path.Base());
-
+ if (!context.SS->CheckApplyIf(Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ if (!alter.HasChannelProfileId()) {
+ result->SetError(TEvSchemeShard::EStatus::StatusInvalidParameter, "set channel profile id, please");
+ return result;
+ }
+
+ TChannelsBindings channelsBinding;
+ if (!context.SS->ResolveSolomonChannels(channelProfileId, path.DomainId(), channelsBinding)) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable to construct channel binding with the storage pool");
+ return result;
+ }
+
+ result->SetPathId(path.Base()->PathId.LocalPathId);
+
+ TSolomonVolumeInfo::TPtr alterSolomon = solomon->CreateAlter();
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxAlterSolomonVolume, path.Base()->PathId);
+
+ TShardInfo solomonPartitionInfo = TShardInfo::SolomonPartitionInfo(OperationId.GetTxId(), path.Base()->PathId);
+ solomonPartitionInfo.BindedChannels = channelsBinding;
+
+ path.Base()->LastTxId = OperationId.GetTxId();
+ path.Base()->PathState = TPathElement::EPathState::EPathStateAlter;
+
+ context.SS->PersistLastTxId(db, path.Base());
+
if (alter.GetUpdateChannelsBinding()) {
txState.Shards.reserve(alter.HasPartitionCount() ? alter.GetPartitionCount() : solomon->Partitions.size());
} else {
Y_VERIFY(alter.HasPartitionCount());
txState.Shards.reserve(alter.GetPartitionCount() - solomon->Partitions.size());
}
-
+
if (alter.GetUpdateChannelsBinding()) {
for (const auto& [shardIdx, partitionInfo] : solomon->Partitions) {
txState.Shards.emplace_back(shardIdx, TTabletTypes::KeyValue, TTxState::CreateParts);
-
+
auto& shardInfo = context.SS->ShardInfos.at(shardIdx);
shardInfo.CurrentTxId = OperationId.GetTxId();
shardInfo.BindedChannels = channelsBinding;
-
+
context.SS->PersistShardMapping(db, shardIdx, partitionInfo->TabletId, path.Base()->PathId, OperationId.GetTxId(), solomonPartitionInfo.TabletType);
context.SS->PersistChannelsBinding(db, shardIdx, channelsBinding);
}
- }
-
+ }
+
if (alter.HasPartitionCount()) {
const ui64 shardsToCreate = alter.GetPartitionCount() - solomon->Partitions.size();
@@ -343,49 +343,49 @@ public:
path.Base()->IncShardsInside(shardsToCreate);
}
- solomon->AlterData = alterSolomon;
- context.SS->PersistAlterSolomonVolume(db, path.Base()->PathId, solomon);
-
- context.SS->ChangeTxState(db, OperationId, TTxState::CreateParts);
- context.OnComplete.ActivateTx(OperationId);
-
- context.SS->PersistTxState(db, OperationId);
-
- path.DomainInfo()->AddInternalShards(txState);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
- void AbortPropose(TOperationContext&) override {
- Y_FAIL("no AbortPropose for TAlterSolomon");
- }
-
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterSolomon AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
- << ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-ISubOperationBase::TPtr CreateAlterSolomon(TOperationId id, const TTxTransaction& tx) {
- return new TAlterSolomon(id, tx);
-}
-
-ISubOperationBase::TPtr CreateAlterSolomon(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state != TTxState::Invalid);
- return new TAlterSolomon(id, state);
-}
-
-}
-}
+ solomon->AlterData = alterSolomon;
+ context.SS->PersistAlterSolomonVolume(db, path.Base()->PathId, solomon);
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::CreateParts);
+ context.OnComplete.ActivateTx(OperationId);
+
+ context.SS->PersistTxState(db, OperationId);
+
+ path.DomainInfo()->AddInternalShards(txState);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
+ void AbortPropose(TOperationContext&) override {
+ Y_FAIL("no AbortPropose for TAlterSolomon");
+ }
+
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterSolomon AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+ISubOperationBase::TPtr CreateAlterSolomon(TOperationId id, const TTxTransaction& tx) {
+ return new TAlterSolomon(id, tx);
+}
+
+ISubOperationBase::TPtr CreateAlterSolomon(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state != TTxState::Invalid);
+ return new TAlterSolomon(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_subdomain.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_subdomain.cpp
index d0d3e214c90..dc1208bbb9c 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_subdomain.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_subdomain.cpp
@@ -1,318 +1,318 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
#include <ydb/core/persqueue/config/config.h>
-
-namespace {
-
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-void DeclareShards(TTxState& txState, TTxId txId, TPathId pathId,
- ui32 count, TTabletTypes::EType type,
- const TChannelsBindings& channelsBindings,
- TSchemeShard* ss)
-{
- txState.Shards.reserve(count);
- for (ui64 i = 0; i < count; ++i) {
+
+namespace {
+
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+void DeclareShards(TTxState& txState, TTxId txId, TPathId pathId,
+ ui32 count, TTabletTypes::EType type,
+ const TChannelsBindings& channelsBindings,
+ TSchemeShard* ss)
+{
+ txState.Shards.reserve(count);
+ for (ui64 i = 0; i < count; ++i) {
auto shardId = ss->RegisterShardInfo(
TShardInfo(txId, pathId, type)
.WithBindedChannels(channelsBindings));
- txState.Shards.emplace_back(shardId, type, TTxState::CreateParts);
- }
-}
-
-void PersistShards(NIceDb::TNiceDb& db, TTxState& txState, ui64 shardsToCreate, TSchemeShard* ss) {
- for (const auto& shard : txState.Shards) {
- Y_VERIFY(shard.Operation == TTxState::ETxState::CreateParts);
- Y_VERIFY(ss->ShardInfos.contains(shard.Idx), "shard info is set before");
- auto& shardInfo = ss->ShardInfos[shard.Idx];
- ss->PersistShardMapping(db, shard.Idx, InvalidTabletId, shardInfo.PathId, shardInfo.CurrentTxId, shardInfo.TabletType);
- ss->PersistChannelsBinding(db, shard.Idx, shardInfo.BindedChannels);
- }
- Y_VERIFY(shardsToCreate == txState.Shards.size());
-}
-
-class TAlterSubDomain: public TSubOperation {
+ txState.Shards.emplace_back(shardId, type, TTxState::CreateParts);
+ }
+}
+
+void PersistShards(NIceDb::TNiceDb& db, TTxState& txState, ui64 shardsToCreate, TSchemeShard* ss) {
+ for (const auto& shard : txState.Shards) {
+ Y_VERIFY(shard.Operation == TTxState::ETxState::CreateParts);
+ Y_VERIFY(ss->ShardInfos.contains(shard.Idx), "shard info is set before");
+ auto& shardInfo = ss->ShardInfos[shard.Idx];
+ ss->PersistShardMapping(db, shard.Idx, InvalidTabletId, shardInfo.PathId, shardInfo.CurrentTxId, shardInfo.TabletType);
+ ss->PersistChannelsBinding(db, shard.Idx, shardInfo.BindedChannels);
+ }
+ Y_VERIFY(shardsToCreate == txState.Shards.size());
+}
+
+class TAlterSubDomain: public TSubOperation {
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::CreateParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
- return TTxState::ConfigureParts;
- case TTxState::ConfigureParts:
- return TTxState::Propose;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::CreateParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
+ return TTxState::ConfigureParts;
+ case TTxState::ConfigureParts:
+ return TTxState::Propose;
case TTxState::Propose:
return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
return THolder(new TCreateParts(OperationId));
- case TTxState::ConfigureParts:
+ case TTxState::ConfigureParts:
return THolder(new NSubDomainState::TConfigureParts(OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new NSubDomainState::TPropose(OperationId));
case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TAlterSubDomain(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TAlterSubDomain(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+
+ TAlterSubDomain(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const auto& settings = Transaction.GetSubDomain();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = settings.GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterSubDomain Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
- auto result = MakeHolder<TProposeResponse>(status, ui64(OperationId.GetTxId()), ui64(ssId));
-
- if (!parentPathStr) {
- result->SetError(NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: no working dir");
- return result;
- }
-
- if (!name) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: no name");
- return result;
- }
-
- TPath path = TPath::Resolve(parentPathStr, context.SS).Dive(name);
-
- {
- TPath::TChecker checks = path.Check();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterSubDomain Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
+ auto result = MakeHolder<TProposeResponse>(status, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ if (!parentPathStr) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: no working dir");
+ return result;
+ }
+
+ if (!name) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: no name");
+ return result;
+ }
+
+ TPath path = TPath::Resolve(parentPathStr, context.SS).Dive(name);
+
+ {
+ TPath::TChecker checks = path.Check();
checks
.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .IsSubDomain()
- .NotUnderOperation()
- .IsCommonSensePath();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- TPathElement::TPtr subDomain = path.Base();
-
- Y_VERIFY(context.SS->SubDomains.contains(subDomain->PathId));
- auto subDomainInfo = context.SS->SubDomains.at(subDomain->PathId);
- Y_VERIFY(subDomainInfo);
-
- if (subDomainInfo->GetAlter()) {
- result->SetError(NKikimrScheme::StatusPathDoesNotExist, "SubDomain is under another alter 2");
- return result;
- }
-
- result->SetPathId(subDomain->PathId.LocalPathId);
-
- if (0 != settings.GetPlanResolution()) {
- if (subDomainInfo->GetPlanResolution() != 0 && subDomainInfo->GetPlanResolution() != settings.GetPlanResolution()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: unable to change PlanResolution, only set it up");
- return result;
- }
- if (subDomain->IsRoot()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: unable to change PlanResolution at root, only additiong storage pools is allowed");
- return result;
- }
- }
-
- if (0 != settings.GetTimeCastBucketsPerMediator()) {
- if (subDomainInfo->GetTCB() != 0 && subDomainInfo->GetTCB() != settings.GetTimeCastBucketsPerMediator()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: unable to change TimeCastBucketsPerMediator, only set it up");
- return result;
- }
- if (subDomain->IsRoot()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: unable to change TimeCastBucketsPerMediator at root, only additiong storage pools is allowed");
- return result;
- }
- }
-
- if (0 == settings.GetCoordinators() && 0 != settings.GetMediators()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: cant create subdomain with mediators, but no coordinators");
- return result;
- }
-
- if (0 != settings.GetCoordinators() && 0 == settings.GetMediators()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: cant create subdomain with coordinators, but no mediators");
- return result;
- }
-
- const bool wasSharedTxSupported = subDomainInfo->IsSupportTransactions();
- const bool setSupportSharedTx = bool(settings.GetCoordinators()) || bool(settings.GetMediators());
- const ui64 shardsToCreate = settings.GetCoordinators() + settings.GetMediators();
-
- if (wasSharedTxSupported && setSupportSharedTx) {
- if (subDomainInfo->GetProcessingParams().CoordinatorsSize() != settings.GetCoordinators()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: unable to change Coordinators count, only set it up");
- return result;
- }
-
- if (subDomainInfo->GetProcessingParams().MediatorsSize() != settings.GetMediators()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: unable to change Mediators count, only set it up");
- return result;
- }
- }
-
- if (!wasSharedTxSupported && setSupportSharedTx) {
- if (settings.GetTimeCastBucketsPerMediator() == 0) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: TimeCastBucketsPerMediator should be set when coordinators create");
- return result;
- }
-
- if (settings.GetPlanResolution() == 0) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: PlanResolution should be set when coordinators create");
- return result;
- }
-
-
- {
- TPath::TChecker checks = path.Check();
- checks
- .ShardsLimit(shardsToCreate)
- .PathShardsLimit(shardsToCreate);
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
- }
-
- auto actualPools = TStoragePools(subDomainInfo->GetStoragePools());
- std::sort(actualPools.begin(), actualPools.end());
-
- auto requestedPools = TVector<TStoragePool>(settings.GetStoragePools().begin(), settings.GetStoragePools().end());
- std::sort(requestedPools.begin(), requestedPools.end());
-
- auto uniqEnd = std::unique(requestedPools.begin(), requestedPools.end());
- if (uniqEnd != requestedPools.end()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .IsSubDomain()
+ .NotUnderOperation()
+ .IsCommonSensePath();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ TPathElement::TPtr subDomain = path.Base();
+
+ Y_VERIFY(context.SS->SubDomains.contains(subDomain->PathId));
+ auto subDomainInfo = context.SS->SubDomains.at(subDomain->PathId);
+ Y_VERIFY(subDomainInfo);
+
+ if (subDomainInfo->GetAlter()) {
+ result->SetError(NKikimrScheme::StatusPathDoesNotExist, "SubDomain is under another alter 2");
+ return result;
+ }
+
+ result->SetPathId(subDomain->PathId.LocalPathId);
+
+ if (0 != settings.GetPlanResolution()) {
+ if (subDomainInfo->GetPlanResolution() != 0 && subDomainInfo->GetPlanResolution() != settings.GetPlanResolution()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: unable to change PlanResolution, only set it up");
+ return result;
+ }
+ if (subDomain->IsRoot()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: unable to change PlanResolution at root, only additiong storage pools is allowed");
+ return result;
+ }
+ }
+
+ if (0 != settings.GetTimeCastBucketsPerMediator()) {
+ if (subDomainInfo->GetTCB() != 0 && subDomainInfo->GetTCB() != settings.GetTimeCastBucketsPerMediator()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: unable to change TimeCastBucketsPerMediator, only set it up");
+ return result;
+ }
+ if (subDomain->IsRoot()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: unable to change TimeCastBucketsPerMediator at root, only additiong storage pools is allowed");
+ return result;
+ }
+ }
+
+ if (0 == settings.GetCoordinators() && 0 != settings.GetMediators()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: cant create subdomain with mediators, but no coordinators");
+ return result;
+ }
+
+ if (0 != settings.GetCoordinators() && 0 == settings.GetMediators()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: cant create subdomain with coordinators, but no mediators");
+ return result;
+ }
+
+ const bool wasSharedTxSupported = subDomainInfo->IsSupportTransactions();
+ const bool setSupportSharedTx = bool(settings.GetCoordinators()) || bool(settings.GetMediators());
+ const ui64 shardsToCreate = settings.GetCoordinators() + settings.GetMediators();
+
+ if (wasSharedTxSupported && setSupportSharedTx) {
+ if (subDomainInfo->GetProcessingParams().CoordinatorsSize() != settings.GetCoordinators()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: unable to change Coordinators count, only set it up");
+ return result;
+ }
+
+ if (subDomainInfo->GetProcessingParams().MediatorsSize() != settings.GetMediators()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: unable to change Mediators count, only set it up");
+ return result;
+ }
+ }
+
+ if (!wasSharedTxSupported && setSupportSharedTx) {
+ if (settings.GetTimeCastBucketsPerMediator() == 0) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: TimeCastBucketsPerMediator should be set when coordinators create");
+ return result;
+ }
+
+ if (settings.GetPlanResolution() == 0) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: PlanResolution should be set when coordinators create");
+ return result;
+ }
+
+
+ {
+ TPath::TChecker checks = path.Check();
+ checks
+ .ShardsLimit(shardsToCreate)
+ .PathShardsLimit(shardsToCreate);
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+ }
+
+ auto actualPools = TStoragePools(subDomainInfo->GetStoragePools());
+ std::sort(actualPools.begin(), actualPools.end());
+
+ auto requestedPools = TVector<TStoragePool>(settings.GetStoragePools().begin(), settings.GetStoragePools().end());
+ std::sort(requestedPools.begin(), requestedPools.end());
+
+ auto uniqEnd = std::unique(requestedPools.begin(), requestedPools.end());
+ if (uniqEnd != requestedPools.end()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
"Malformed subdomain request: requested storage pools is not unique, for example, the pool '" + uniqEnd->GetName() +"' repeats several times");
- return result;
- }
-
- {
- TVector<TStoragePool> omitedPools;
- std::set_difference(actualPools.begin(), actualPools.end(),
- requestedPools.begin(), requestedPools.end(),
- std::back_inserter(omitedPools));
-
- if (omitedPools && requestedPools) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: deleting storage pool is not allowed, for example, requested deletion '" + omitedPools.begin()->GetName() +"'");
- return result;
- }
- }
-
- TVector<TStoragePool> addedPools;
- std::set_difference(requestedPools.begin(), requestedPools.end(),
- actualPools.begin(), actualPools.end(),
- std::back_inserter(addedPools));
-
- TSubDomainInfo::TPtr alterData = new TSubDomainInfo(*subDomainInfo,
- settings.GetPlanResolution(),
- settings.GetTimeCastBucketsPerMediator(),
- addedPools);
-
- TChannelsBindings channelBindings;
- if (wasSharedTxSupported || setSupportSharedTx) {
- if (!context.SS->ResolveSubdomainsChannels(alterData->GetStoragePools(), channelBindings)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable construct channels binding");
- return result;
- }
- }
-
+ return result;
+ }
+
+ {
+ TVector<TStoragePool> omitedPools;
+ std::set_difference(actualPools.begin(), actualPools.end(),
+ requestedPools.begin(), requestedPools.end(),
+ std::back_inserter(omitedPools));
+
+ if (omitedPools && requestedPools) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: deleting storage pool is not allowed, for example, requested deletion '" + omitedPools.begin()->GetName() +"'");
+ return result;
+ }
+ }
+
+ TVector<TStoragePool> addedPools;
+ std::set_difference(requestedPools.begin(), requestedPools.end(),
+ actualPools.begin(), actualPools.end(),
+ std::back_inserter(addedPools));
+
+ TSubDomainInfo::TPtr alterData = new TSubDomainInfo(*subDomainInfo,
+ settings.GetPlanResolution(),
+ settings.GetTimeCastBucketsPerMediator(),
+ addedPools);
+
+ TChannelsBindings channelBindings;
+ if (wasSharedTxSupported || setSupportSharedTx) {
+ if (!context.SS->ResolveSubdomainsChannels(alterData->GetStoragePools(), channelBindings)) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable construct channels binding");
+ return result;
+ }
+ }
+
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
if (settings.HasDeclaredSchemeQuotas()) {
alterData->SetDeclaredSchemeQuotas(settings.GetDeclaredSchemeQuotas());
}
@@ -321,69 +321,69 @@ public:
alterData->SetDatabaseQuotas(settings.GetDatabaseQuotas());
}
- NIceDb::TNiceDb db(context.Txc.DB);
-
- subDomain->LastTxId = OperationId.GetTxId();
- subDomain->PathState = TPathElement::EPathState::EPathStateAlter;
- context.SS->PersistPath(db, subDomain->PathId);
-
- Y_VERIFY(!context.SS->FindTx(OperationId));
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxAlterSubDomain, subDomain->PathId);
- txState.State = TTxState::CreateParts;
-
- if (!wasSharedTxSupported && setSupportSharedTx) {
- DeclareShards(txState, OperationId.GetTxId(), subDomain->PathId, settings.GetCoordinators(), TTabletTypes::FLAT_TX_COORDINATOR, channelBindings, context.SS);
- DeclareShards(txState, OperationId.GetTxId(), subDomain->PathId, settings.GetMediators(), TTabletTypes::TX_MEDIATOR, channelBindings, context.SS);
-
- for (auto& shard: txState.Shards) {
- alterData->AddPrivateShard(shard.Idx);
- }
-
- PersistShards(db, txState, shardsToCreate, context.SS);
- context.SS->PersistUpdateNextShardIdx(db);
- }
- subDomainInfo->SetAlter(alterData);
- context.SS->PersistSubDomainAlter(db, subDomain->PathId, *alterData);
-
- context.SS->PersistTxState(db, OperationId);
- context.OnComplete.ActivateTx(OperationId);
-
- path.DomainInfo()->AddInternalShards(txState);
- path.Base()->IncShardsInside(shardsToCreate);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ subDomain->LastTxId = OperationId.GetTxId();
+ subDomain->PathState = TPathElement::EPathState::EPathStateAlter;
+ context.SS->PersistPath(db, subDomain->PathId);
+
+ Y_VERIFY(!context.SS->FindTx(OperationId));
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxAlterSubDomain, subDomain->PathId);
+ txState.State = TTxState::CreateParts;
+
+ if (!wasSharedTxSupported && setSupportSharedTx) {
+ DeclareShards(txState, OperationId.GetTxId(), subDomain->PathId, settings.GetCoordinators(), TTabletTypes::FLAT_TX_COORDINATOR, channelBindings, context.SS);
+ DeclareShards(txState, OperationId.GetTxId(), subDomain->PathId, settings.GetMediators(), TTabletTypes::TX_MEDIATOR, channelBindings, context.SS);
+
+ for (auto& shard: txState.Shards) {
+ alterData->AddPrivateShard(shard.Idx);
+ }
+
+ PersistShards(db, txState, shardsToCreate, context.SS);
+ context.SS->PersistUpdateNextShardIdx(db);
+ }
+ subDomainInfo->SetAlter(alterData);
+ context.SS->PersistSubDomainAlter(db, subDomain->PathId, *alterData);
+
+ context.SS->PersistTxState(db, OperationId);
+ context.OnComplete.ActivateTx(OperationId);
+
+ path.DomainInfo()->AddInternalShards(txState);
+ path.Base()->IncShardsInside(shardsToCreate);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TAlterSubDomain");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterSubDomain AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterSubDomain AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateAlterSubDomain(TOperationId id, const TTxTransaction& tx) {
return new TAlterSubDomain(id, tx);
}
-ISubOperationBase::TPtr CreateAlterSubDomain(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateAlterSubDomain(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TAlterSubDomain(id, state);
-}
-
-}
-}
+ return new TAlterSubDomain(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_table.cpp
index e4a403f82b7..b6c0b6c8b25 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_table.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_table.cpp
@@ -1,15 +1,15 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-bool CheckFreezeStateAlredySet(const TTableInfo::TPtr table, const NKikimrSchemeOp::TTableDescription& alter) {
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+bool CheckFreezeStateAlredySet(const TTableInfo::TPtr table, const NKikimrSchemeOp::TTableDescription& alter) {
if (!alter.HasPartitionConfig())
return false;
if (alter.GetPartitionConfig().HasFreezeState()) {
@@ -19,7 +19,7 @@ bool CheckFreezeStateAlredySet(const TTableInfo::TPtr table, const NKikimrScheme
return true;
}
} else {
- if (alter.GetPartitionConfig().GetFreezeState() == NKikimrSchemeOp::EFreezeState::Unfreeze) {
+ if (alter.GetPartitionConfig().GetFreezeState() == NKikimrSchemeOp::EFreezeState::Unfreeze) {
return true;
}
}
@@ -40,115 +40,115 @@ bool IsSuperUser(const NACLib::TUserToken* userToken) {
return (it != adminSids.end());
}
-TTableInfo::TAlterDataPtr ParseParams(const TPath& path, TTableInfo::TPtr table, const NKikimrSchemeOp::TTableDescription& alter,
- const bool shadowDataAllowed,
- TString& errStr, NKikimrScheme::EStatus& status, TOperationContext& context) {
- const TAppData* appData = AppData(context.Ctx);
-
+TTableInfo::TAlterDataPtr ParseParams(const TPath& path, TTableInfo::TPtr table, const NKikimrSchemeOp::TTableDescription& alter,
+ const bool shadowDataAllowed,
+ TString& errStr, NKikimrScheme::EStatus& status, TOperationContext& context) {
+ const TAppData* appData = AppData(context.Ctx);
+
if (!path.IsCommonSensePath()) {
- Y_VERIFY_DEBUG(IsSuperUser(context.UserToken.Get()) || context.IsAllowedPrivateTables, "Only superuser can alter index impl table");
+ Y_VERIFY_DEBUG(IsSuperUser(context.UserToken.Get()) || context.IsAllowedPrivateTables, "Only superuser can alter index impl table");
if (alter.ColumnsSize() != 0 || alter.DropColumnsSize() != 0) {
errStr = "Adding or dropping columns in index table is not supported";
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
return nullptr;
}
if (alter.HasTTLSettings()) {
errStr = "TTL on index table is not supported";
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
return nullptr;
}
}
- auto copyAlter = alter;
-
+ auto copyAlter = alter;
+
const bool hasSchemaChanges = (
copyAlter.ColumnsSize() != 0 ||
copyAlter.DropColumnsSize() != 0);
- if (copyAlter.HasIsBackup() && copyAlter.GetIsBackup() != table->IsBackup) {
+ if (copyAlter.HasIsBackup() && copyAlter.GetIsBackup() != table->IsBackup) {
errStr = Sprintf("Cannot add/remove 'IsBackup' property");
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
return nullptr;
}
if (!hasSchemaChanges && !copyAlter.HasPartitionConfig() && !copyAlter.HasTTLSettings()) {
- errStr = Sprintf("No changes specified");
- status = NKikimrScheme::StatusInvalidParameter;
- return nullptr;
- }
-
+ errStr = Sprintf("No changes specified");
+ status = NKikimrScheme::StatusInvalidParameter;
+ return nullptr;
+ }
+
if (copyAlter.HasPartitionConfig() && copyAlter.GetPartitionConfig().HasFreezeState()) {
if (hasSchemaChanges) {
errStr = Sprintf("Mix freeze cmd with other options is forbiden");
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
+ return nullptr;
+ }
+ }
+
+ // Ignore column ids if they were passed by user!
+ for (auto& col : *copyAlter.MutableColumns()) {
+ col.ClearId();
+ }
+
+ for (auto& col : *copyAlter.MutableDropColumns()) {
+ if (col.GetName().empty()) {
+ errStr = Sprintf("Must specify name for the column to drop");
+ status = NKikimrScheme::StatusInvalidParameter;
return nullptr;
}
+ col.ClearId();
}
- // Ignore column ids if they were passed by user!
- for (auto& col : *copyAlter.MutableColumns()) {
- col.ClearId();
- }
-
- for (auto& col : *copyAlter.MutableDropColumns()) {
- if (col.GetName().empty()) {
- errStr = Sprintf("Must specify name for the column to drop");
- status = NKikimrScheme::StatusInvalidParameter;
- return nullptr;
- }
- col.ClearId();
- }
-
- if (CheckFreezeStateAlredySet(table, copyAlter)) {
+ if (CheckFreezeStateAlredySet(table, copyAlter)) {
errStr = Sprintf("Requested freeze state alredy set");
- status = NKikimrScheme::StatusAlreadyExists;
+ status = NKikimrScheme::StatusAlreadyExists;
return nullptr;
}
- NKikimrSchemeOp::TPartitionConfig compilationPartitionConfig;
- if (!TPartitionConfigMerger::ApplyChanges(compilationPartitionConfig, table->PartitionConfig(), copyAlter.GetPartitionConfig(), appData, errStr)
- || !TPartitionConfigMerger::VerifyAlterParams(table->PartitionConfig(), compilationPartitionConfig, appData, shadowDataAllowed, errStr)) {
- status = NKikimrScheme::StatusInvalidParameter;
- return nullptr;
+ NKikimrSchemeOp::TPartitionConfig compilationPartitionConfig;
+ if (!TPartitionConfigMerger::ApplyChanges(compilationPartitionConfig, table->PartitionConfig(), copyAlter.GetPartitionConfig(), appData, errStr)
+ || !TPartitionConfigMerger::VerifyAlterParams(table->PartitionConfig(), compilationPartitionConfig, appData, shadowDataAllowed, errStr)) {
+ status = NKikimrScheme::StatusInvalidParameter;
+ return nullptr;
}
- copyAlter.MutablePartitionConfig()->CopyFrom(compilationPartitionConfig);
-
+ copyAlter.MutablePartitionConfig()->CopyFrom(compilationPartitionConfig);
+
const TSubDomainInfo& subDomain = *path.DomainInfo();
const TSchemeLimits& limits = subDomain.GetSchemeLimits();
TTableInfo::TAlterDataPtr alterData = TTableInfo::CreateAlterData(table, copyAlter, *appData->TypeRegistry, limits, subDomain, errStr);
- if (!alterData) {
- status = NKikimrScheme::StatusInvalidParameter;
- return nullptr;
- }
-
- return alterData;
-}
-
+ if (!alterData) {
+ status = NKikimrScheme::StatusInvalidParameter;
+ return nullptr;
+ }
+
+ return alterData;
+}
+
void PrepareChanges(TOperationId opId, TPathElement::TPtr path, TTableInfo::TPtr table, const TBindingsRoomsChanges& bindingChanges, TOperationContext& context) {
-
- path->LastTxId = opId.GetTxId();
- path->PathState = TPathElement::EPathState::EPathStateAlter;
-
- TTxState& txState = context.SS->CreateTx(opId, TTxState::TxAlterTable, path->PathId);
- txState.State = TTxState::CreateParts;
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
+
+ path->LastTxId = opId.GetTxId();
+ path->PathState = TPathElement::EPathState::EPathStateAlter;
+
+ TTxState& txState = context.SS->CreateTx(opId, TTxState::TxAlterTable, path->PathId);
+ txState.State = TTxState::CreateParts;
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
TTxState::ETxState commonShardOp = table->NeedRecreateParts()
- ? TTxState::CreateParts
- : TTxState::ConfigureParts;
-
- txState.Shards.reserve(table->GetPartitions().size());
- for (const auto& shard : table->GetPartitions()) {
- auto shardIdx = shard.ShardIdx;
+ ? TTxState::CreateParts
+ : TTxState::ConfigureParts;
+
+ txState.Shards.reserve(table->GetPartitions().size());
+ for (const auto& shard : table->GetPartitions()) {
+ auto shardIdx = shard.ShardIdx;
TShardInfo& shardInfo = context.SS->ShardInfos[shardIdx];
auto shardOp = commonShardOp;
- auto it = bindingChanges.find(GetPoolsMapping(shardInfo.BindedChannels));
- if (it != bindingChanges.end()) {
+ auto it = bindingChanges.find(GetPoolsMapping(shardInfo.BindedChannels));
+ if (it != bindingChanges.end()) {
if (it->second.ChannelsBindingsUpdated) {
// We must recreate this shard to apply new channel bindings
shardOp = TTxState::CreateParts;
@@ -160,52 +160,52 @@ void PrepareChanges(TOperationId opId, TPathElement::TPtr path, TTableInfo::TPtr
context.SS->PersistAddTableShardPartitionConfig(db, shardIdx, it->second.PerShardConfig);
}
- txState.Shards.emplace_back(shardIdx, ETabletType::DataShard, shardOp);
-
- shardInfo.CurrentTxId = opId.GetTxId();
- context.SS->PersistShardTx(db, shardIdx, opId.GetTxId());
- }
-
- context.SS->PersistAddAlterTable(db, path->PathId, table->AlterData);
- context.SS->PersistTxState(db, opId);
-
-
- for (auto splitTx: table->GetSplitOpsInFlight()) {
- context.OnComplete.Dependence(splitTx.GetTxId(), opId.GetTxId());
- }
-
- context.OnComplete.ActivateTx(opId);
-}
-
-bool CheckDropingColumns(const TSchemeShard* ss, const NKikimrSchemeOp::TTableDescription& alter, const TPath& tablePath, TString& errStr) {
- TSet<TString> deletedColumns;
-
- for (const auto& colDescr: alter.GetDropColumns()) {
- if (colDescr.GetName()) {
- deletedColumns.insert(colDescr.GetName());
- }
- }
-
+ txState.Shards.emplace_back(shardIdx, ETabletType::DataShard, shardOp);
+
+ shardInfo.CurrentTxId = opId.GetTxId();
+ context.SS->PersistShardTx(db, shardIdx, opId.GetTxId());
+ }
+
+ context.SS->PersistAddAlterTable(db, path->PathId, table->AlterData);
+ context.SS->PersistTxState(db, opId);
+
+
+ for (auto splitTx: table->GetSplitOpsInFlight()) {
+ context.OnComplete.Dependence(splitTx.GetTxId(), opId.GetTxId());
+ }
+
+ context.OnComplete.ActivateTx(opId);
+}
+
+bool CheckDropingColumns(const TSchemeShard* ss, const NKikimrSchemeOp::TTableDescription& alter, const TPath& tablePath, TString& errStr) {
+ TSet<TString> deletedColumns;
+
+ for (const auto& colDescr: alter.GetDropColumns()) {
+ if (colDescr.GetName()) {
+ deletedColumns.insert(colDescr.GetName());
+ }
+ }
+
for (const auto& child : tablePath.Base()->GetChildren()) {
const auto& childName = child.first;
const auto& childPathId = child.second;
-
+
auto childPath = ss->PathsById.at(childPathId);
if (!childPath->IsTableIndex() || childPath->Dropped()) {
- continue;
- }
-
+ continue;
+ }
+
const TTableIndexInfo::TPtr indexInfo = ss->Indexes.at(childPathId);
- for (const auto& indexKey: indexInfo->IndexKeys) {
- if (deletedColumns.contains(indexKey)) {
- errStr = TStringBuilder ()
- << "Imposible drop column because table has an index with that column"
+ for (const auto& indexKey: indexInfo->IndexKeys) {
+ if (deletedColumns.contains(indexKey)) {
+ errStr = TStringBuilder ()
+ << "Imposible drop column because table has an index with that column"
<< ", column name: " << indexKey
- << ", table name: " << tablePath.PathString()
+ << ", table name: " << tablePath.PathString()
<< ", index name: " << childName;
- return false;
- }
- }
+ return false;
+ }
+ }
for (const auto& col: indexInfo->IndexDataColumns) {
if (deletedColumns.contains(col)) {
@@ -217,137 +217,137 @@ bool CheckDropingColumns(const TSchemeShard* ss, const NKikimrSchemeOp::TTableDe
return false;
}
}
- }
-
- return true;
-}
-
-class TConfigureParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ }
+
+ return true;
+}
+
+class TConfigureParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TAlterTable TConfigureParts"
- << " operationId#" << OperationId;
- }
-
-public:
- TConfigureParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvProposeTransactionResult"
- << ", at schemeshard: " << ssId
- << " message# " << ev->Get()->Record.ShortDebugString());
-
- return NTableState::CollectProposeTransactionResults(OperationId, ev, context);
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxAlterTable);
-
- txState->ClearShardsInProgress();
-
- for (ui32 i = 0; i < txState->Shards.size(); ++i) {
- auto idx = txState->Shards[i].Idx;
- auto datashardId = context.SS->ShardInfos[idx].TabletID;
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Propose modify scheme on datashard " << datashardId << " txid: " << OperationId << " at schemeshard" << ssId);
-
- auto seqNo = context.SS->StartRound(*txState);
+ return TStringBuilder()
+ << "TAlterTable TConfigureParts"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TConfigureParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvProposeTransactionResult"
+ << ", at schemeshard: " << ssId
+ << " message# " << ev->Get()->Record.ShortDebugString());
+
+ return NTableState::CollectProposeTransactionResults(OperationId, ev, context);
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxAlterTable);
+
+ txState->ClearShardsInProgress();
+
+ for (ui32 i = 0; i < txState->Shards.size(); ++i) {
+ auto idx = txState->Shards[i].Idx;
+ auto datashardId = context.SS->ShardInfos[idx].TabletID;
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Propose modify scheme on datashard " << datashardId << " txid: " << OperationId << " at schemeshard" << ssId);
+
+ auto seqNo = context.SS->StartRound(*txState);
TString txBody = context.SS->FillAlterTableTxBody(txState->TargetPathId, idx, seqNo);
- THolder<TEvDataShard::TEvProposeTransaction> event =
+ THolder<TEvDataShard::TEvProposeTransaction> event =
MakeHolder<TEvDataShard::TEvProposeTransaction>(NKikimrTxDataShard::TX_KIND_SCHEME,
- ui64(ssId), //owner schemeshard tablet id
- context.Ctx.SelfID,
- ui64(OperationId.GetTxId()),
- txBody,
- context.SS->SelectProcessingPrarams(txState->TargetPathId));
-
- context.OnComplete.BindMsgToPipe(OperationId, datashardId, idx, event.Release());
- }
-
- txState->UpdateShardsInProgress();
- return false;
- }
-};
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ ui64(ssId), //owner schemeshard tablet id
+ context.Ctx.SelfID,
+ ui64(OperationId.GetTxId()),
+ txBody,
+ context.SS->SelectProcessingPrarams(txState->TargetPathId));
+
+ context.OnComplete.BindMsgToPipe(OperationId, datashardId, idx, event.Release());
+ }
+
+ txState->UpdateShardsInProgress();
+ return false;
+ }
+};
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TAlterTable TPropose"
- << " operationId#" << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvDataShard::TEvProposeTransactionResult::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- const auto& evRecord = ev->Get()->Record;
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvSchemaChanged"
- << " triggers early"
- << ", at schemeshard: " << ssId
- << " message# " << evRecord.ShortDebugString());
-
- NTableState::CollectSchemaChanged(OperationId, ev, context);
- return false;
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", operationId: " << OperationId
- << ", stepId: " << step
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxAlterTable);
-
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- TTableInfo::TPtr table = context.SS->Tables.at(pathId);
- table->FinishAlter();
-
+ return TStringBuilder()
+ << "TAlterTable TPropose"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvDataShard::TEvProposeTransactionResult::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ const auto& evRecord = ev->Get()->Record;
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvSchemaChanged"
+ << " triggers early"
+ << ", at schemeshard: " << ssId
+ << " message# " << evRecord.ShortDebugString());
+
+ NTableState::CollectSchemaChanged(OperationId, ev, context);
+ return false;
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", operationId: " << OperationId
+ << ", stepId: " << step
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxAlterTable);
+
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ TTableInfo::TPtr table = context.SS->Tables.at(pathId);
+ table->FinishAlter();
+
auto ttlIt = context.SS->TTLEnabledTables.find(pathId);
if (table->IsTTLEnabled() && ttlIt == context.SS->TTLEnabledTables.end()) {
context.SS->TTLEnabledTables[pathId] = table;
context.SS->TabletCounters->Simple()[COUNTER_TTL_ENABLED_TABLE_COUNT].Add(1);
} else if (!table->IsTTLEnabled() && ttlIt != context.SS->TTLEnabledTables.end()) {
context.SS->TTLEnabledTables.erase(ttlIt);
- context.SS->TabletCounters->Simple()[COUNTER_TTL_ENABLED_TABLE_COUNT].Sub(1);
+ context.SS->TabletCounters->Simple()[COUNTER_TTL_ENABLED_TABLE_COUNT].Sub(1);
for (ui32 i = 0; i < table->GetPartitions().size(); ++i) {
auto& shardInfo = table->GetPartitions().at(i);
@@ -358,199 +358,199 @@ public:
}
}
- context.SS->PersistTableAltered(db, pathId, table);
-
- context.SS->ClearDescribePathCaches(path);
+ context.SS->PersistTableAltered(db, pathId, table);
+
+ context.SS->ClearDescribePathCaches(path);
context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
- context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxAlterTable);
-
- TSet<TTabletId> shardSet;
- for (const auto& shard : txState->Shards) {
- TShardIdx idx = shard.Idx;
- TTabletId tablet = context.SS->ShardInfos.at(idx).TabletID;
- shardSet.insert(tablet);
- }
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, txState->MinStep, shardSet);
- return false;
- }
-};
-
-class TAlterTable: public TSubOperation {
-private:
+ context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxAlterTable);
+
+ TSet<TTabletId> shardSet;
+ for (const auto& shard : txState->Shards) {
+ TShardIdx idx = shard.Idx;
+ TTabletId tablet = context.SS->ShardInfos.at(idx).TabletID;
+ shardSet.insert(tablet);
+ }
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, txState->MinStep, shardSet);
+ return false;
+ }
+};
+
+class TAlterTable: public TSubOperation {
+private:
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- bool AllowShadowData = false;
-
- TTxState::ETxState NextState() {
- return TTxState::CreateParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
- return TTxState::ConfigureParts;
- case TTxState::ConfigureParts:
- return TTxState::Propose;
- case TTxState::Propose:
- return TTxState::ProposedWaitParts;
- case TTxState::ProposedWaitParts:
- return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
+ TTxState::ETxState State = TTxState::Invalid;
+
+ bool AllowShadowData = false;
+
+ TTxState::ETxState NextState() {
+ return TTxState::CreateParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
+ return TTxState::ConfigureParts;
+ case TTxState::ConfigureParts:
+ return TTxState::Propose;
+ case TTxState::Propose:
+ return TTxState::ProposedWaitParts;
+ case TTxState::ProposedWaitParts:
+ return TTxState::Done;
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
return THolder(new TCreateParts(OperationId));
- case TTxState::ConfigureParts:
+ case TTxState::ConfigureParts:
return THolder(new TConfigureParts(OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new TPropose(OperationId));
- case TTxState::ProposedWaitParts:
+ case TTxState::ProposedWaitParts:
return THolder(new NTableState::TProposedWaitParts(OperationId));
- case TTxState::Done:
+ case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TAlterTable(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TAlterTable(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
-
- void SetAllowShadowDataForBuildIndex() {
- AllowShadowData = true;
- }
-
- bool IsShadowDataAllowed() const {
- return AllowShadowData || AppData()->AllowShadowDataInSchemeShardForTests;
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+
+ TAlterTable(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+
+ void SetAllowShadowDataForBuildIndex() {
+ AllowShadowData = true;
+ }
+
+ bool IsShadowDataAllowed() const {
+ return AllowShadowData || AppData()->AllowShadowDataInSchemeShardForTests;
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const auto& alter = Transaction.GetAlterTable();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = alter.GetName();
-
- TPathId pathId;
- if (alter.HasId_Deprecated() || alter.HasPathId()) {
- pathId = alter.HasPathId()
+
+ TPathId pathId;
+ if (alter.HasId_Deprecated() || alter.HasPathId()) {
+ pathId = alter.HasPathId()
? PathIdFromPathId(alter.GetPathId())
- : context.SS->MakeLocalId(alter.GetId_Deprecated());
- }
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterTable Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", pathId: " << pathId
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- if (!alter.HasName() && !pathId) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "No table name or pathId in Alter");
- return result;
- }
-
- TPath path = pathId
- ? TPath::Init(pathId, context.SS)
- : TPath::Resolve(parentPathStr, context.SS).Dive(name);
- {
- TPath::TChecker checks = path.Check();
+ : context.SS->MakeLocalId(alter.GetId_Deprecated());
+ }
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterTable Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", pathId: " << pathId
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ if (!alter.HasName() && !pathId) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "No table name or pathId in Alter");
+ return result;
+ }
+
+ TPath path = pathId
+ ? TPath::Init(pathId, context.SS)
+ : TPath::Resolve(parentPathStr, context.SS).Dive(name);
+ {
+ TPath::TChecker checks = path.Check();
checks
.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .IsTable()
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .IsTable()
.NotUnderOperation();
-
- if (!context.IsAllowedPrivateTables && !IsSuperUser(context.UserToken.Get())) {
+
+ if (!context.IsAllowedPrivateTables && !IsSuperUser(context.UserToken.Get())) {
checks.IsCommonSensePath(); //forbid alter impl index tables
}
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- TString errStr;
-
- if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- if (!context.SS->CheckLocks(path.Base()->PathId, Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
- return result;
- }
-
- Y_VERIFY(context.SS->Tables.contains(path.Base()->PathId));
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ TString errStr;
+
+ if (!context.SS->CheckApplyIf(Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ if (!context.SS->CheckLocks(path.Base()->PathId, Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
+ return result;
+ }
+
+ Y_VERIFY(context.SS->Tables.contains(path.Base()->PathId));
TTableInfo::TPtr table = context.SS->Tables.at(path.Base()->PathId);
-
- if (table->AlterVersion == 0) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, "Table is not created yet");
- return result;
- }
- if (table->AlterData) {
- auto lastOpId = TOperationId(path.Base()->LastTxId, 0);
- Y_VERIFY(context.SS->TxInFlight.contains(lastOpId), "AlterData without Alter tx");
- result->SetError(NKikimrScheme::StatusMultipleModifications, "There's another Alter in flight");
- return result;
- }
-
+
+ if (table->AlterVersion == 0) {
+ result->SetError(NKikimrScheme::StatusMultipleModifications, "Table is not created yet");
+ return result;
+ }
+ if (table->AlterData) {
+ auto lastOpId = TOperationId(path.Base()->LastTxId, 0);
+ Y_VERIFY(context.SS->TxInFlight.contains(lastOpId), "AlterData without Alter tx");
+ result->SetError(NKikimrScheme::StatusMultipleModifications, "There's another Alter in flight");
+ return result;
+ }
+
if (path.Base()->GetAliveChildren() && alter.HasTTLSettings()) {
for (const auto& [_, childPathId] : path.Base()->GetChildren()) {
Y_VERIFY(context.SS->PathsById.contains(childPathId));
@@ -564,83 +564,83 @@ public:
auto indexInfo = context.SS->Indexes.at(childPathId);
if (indexInfo->Type == NKikimrSchemeOp::EIndexTypeGlobalAsync && !AppData()->FeatureFlags.GetEnableTtlOnAsyncIndexedTables()) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, "TTL is not currently supported on tables with async indices");
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, "TTL is not currently supported on tables with async indices");
return result;
}
}
}
- NKikimrScheme::EStatus status;
- TTableInfo::TAlterDataPtr alterData = ParseParams(path, table, alter, IsShadowDataAllowed(), errStr, status, context);
- if (!alterData) {
+ NKikimrScheme::EStatus status;
+ TTableInfo::TAlterDataPtr alterData = ParseParams(path, table, alter, IsShadowDataAllowed(), errStr, status, context);
+ if (!alterData) {
result->SetError(status, errStr);
- return result;
- }
-
- Y_VERIFY(alterData->AlterVersion == table->AlterVersion + 1);
-
- if (!CheckDropingColumns(context.SS, alter, path, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
+ return result;
+ }
+
+ Y_VERIFY(alterData->AlterVersion == table->AlterVersion + 1);
+
+ if (!CheckDropingColumns(context.SS, alter, path, errStr)) {
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
TBindingsRoomsChanges bindingChanges;
if (context.SS->IsStorageConfigLogic(table)) {
if (!context.SS->GetBindingsRoomsChanges(path.DomainId(), table->GetPartitions(), alterData->PartitionConfigFull(), bindingChanges, errStr)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
return result;
}
}
- table->PrepareAlter(alterData);
+ table->PrepareAlter(alterData);
PrepareChanges(OperationId, path.Base(), table, bindingChanges, context);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TAlterTable");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterTable AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterTable AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateAlterTable(TOperationId id, const TTxTransaction& tx) {
return new TAlterTable(id, tx);
}
-ISubOperationBase::TPtr CreateAlterTable(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateAlterTable(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state != TTxState::Invalid);
+ return new TAlterTable(id, state);
+}
+
+ISubOperationBase::TPtr CreateFinalizeBuildIndexImplTable(TOperationId id, const TTxTransaction& tx) {
+ auto obj = MakeHolder<TAlterTable>(id, tx);
+ obj->SetAllowShadowDataForBuildIndex();
+ return obj.Release();
+}
+ISubOperationBase::TPtr CreateFinalizeBuildIndexImplTable(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TAlterTable(id, state);
-}
-
-ISubOperationBase::TPtr CreateFinalizeBuildIndexImplTable(TOperationId id, const TTxTransaction& tx) {
- auto obj = MakeHolder<TAlterTable>(id, tx);
- obj->SetAllowShadowDataForBuildIndex();
- return obj.Release();
-}
-ISubOperationBase::TPtr CreateFinalizeBuildIndexImplTable(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state != TTxState::Invalid);
- auto obj = MakeHolder<TAlterTable>(id, state);
- obj->SetAllowShadowDataForBuildIndex();
- return obj.Release();
-}
-
-}
-}
+ auto obj = MakeHolder<TAlterTable>(id, state);
+ obj->SetAllowShadowDataForBuildIndex();
+ return obj.Release();
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_user_attrs.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_user_attrs.cpp
index 11bdfb820c6..4f7dd3314e3 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_user_attrs.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_user_attrs.cpp
@@ -1,188 +1,188 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TAlterUserAttrs: public ISubOperationBase {
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TAlterUserAttrs: public ISubOperationBase {
const TOperationId OperationId;
const TTxTransaction Transaction;
-
-public:
+
+public:
TAlterUserAttrs(TOperationId id, const TTxTransaction& tx)
: OperationId(id)
, Transaction(tx)
{
}
- TAlterUserAttrs(TOperationId id)
- : OperationId(id)
+ TAlterUserAttrs(TOperationId id)
+ : OperationId(id)
{
}
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const auto& userAttrsPatch = Transaction.GetAlterUserAttributes();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = userAttrsPatch.GetPathName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterUserAttrs Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", operationId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterUserAttrs Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", operationId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
if (!Transaction.HasAlterUserAttributes()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "UserAttributes are not present");
- return result;
- }
-
- if (!userAttrsPatch.HasPathName()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "Name is not present in UserAttributes");
- return result;
- }
-
- TPath path = TPath::Resolve(parentPathStr, context.SS).Dive(name);
- {
- TPath::TChecker checks = path.Check();
- checks.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderOperation()
- .IsCommonSensePath(); //forbid alter user attrs at impl index tables and indexes
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "UserAttributes are not present");
+ return result;
+ }
+
+ if (!userAttrsPatch.HasPathName()) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "Name is not present in UserAttributes");
+ return result;
+ }
+
+ TPath path = TPath::Resolve(parentPathStr, context.SS).Dive(name);
+ {
+ TPath::TChecker checks = path.Check();
+ checks.NotEmpty()
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderOperation()
+ .IsCommonSensePath(); //forbid alter user attrs at impl index tables and indexes
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
TString errStr;
- TUserAttributes::TPtr alterData = path.Base()->UserAttrs->CreateNextVersion();
+ TUserAttributes::TPtr alterData = path.Base()->UserAttrs->CreateNextVersion();
if (!alterData->ApplyPatch(EUserAttributesOp::AlterUserAttrs, userAttrsPatch, errStr) ||
!alterData->CheckLimits(errStr))
{
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- Y_VERIFY(!context.SS->FindTx(OperationId));
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxAlterUserAttributes, path.Base()->PathId);
-
- path.Base()->PathState = NKikimrSchemeOp::EPathStateAlter;
- path.Base()->LastTxId = OperationId.GetTxId();
- path.Base()->UserAttrs->AlterData = alterData;
- context.SS->PersistAlterUserAttributes(db, path.Base()->PathId);
-
- txState.State = TTxState::Propose;
- context.SS->PersistTxState(db, OperationId);
-
- context.OnComplete.ActivateTx(OperationId);
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ Y_VERIFY(!context.SS->FindTx(OperationId));
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxAlterUserAttributes, path.Base()->PathId);
+
+ path.Base()->PathState = NKikimrSchemeOp::EPathStateAlter;
+ path.Base()->LastTxId = OperationId.GetTxId();
+ path.Base()->UserAttrs->AlterData = alterData;
+ context.SS->PersistAlterUserAttributes(db, path.Base()->PathId);
+
+ txState.State = TTxState::Propose;
+ context.SS->PersistTxState(db, OperationId);
+
+ context.OnComplete.ActivateTx(OperationId);
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TAlterUserAttrs");
}
- void ProgressState(TOperationContext& context) override {
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterUserAttrs ProgressState"
- << ", opId: " << OperationId
- << ", at schemeshard: " << context.SS->TabletID());
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- }
-
- void HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- const TStepId step = TStepId(ev->Get()->StepId);
- const TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterUserAttrs HandleReply TEvOperationPlan"
- << ", opId: " << OperationId
- << ", stepId:" << step
+ void ProgressState(TOperationContext& context) override {
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterUserAttrs ProgressState"
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ }
+
+ void HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ const TStepId step = TStepId(ev->Get()->StepId);
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterUserAttrs HandleReply TEvOperationPlan"
+ << ", opId: " << OperationId
+ << ", stepId:" << step
<< ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- if (txState->State != TTxState::Propose) {
- LOG_WARN_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Duplicate PlanStep opId#" << OperationId
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ if (txState->State != TTxState::Propose) {
+ LOG_WARN_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Duplicate PlanStep opId#" << OperationId
<< " at schemeshard: " << ssId
<< " txState is in state#" << TTxState::StateName(txState->State));
- return;
- }
-
- Y_VERIFY(txState->TxType == TTxState::TxAlterUserAttributes);
-
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
- context.OnComplete.ReleasePathState(OperationId, pathId, TPathElement::EPathState::EPathStateNoChanges);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- Y_VERIFY(path->UserAttrs);
- Y_VERIFY(path->UserAttrs->AlterData);
- Y_VERIFY(path->UserAttrs->AlterVersion < path->UserAttrs->AlterData->AlterVersion);
- context.SS->ApplyAndPersistUserAttrs(db, path->PathId);
-
- context.SS->ClearDescribePathCaches(path);
+ return;
+ }
+
+ Y_VERIFY(txState->TxType == TTxState::TxAlterUserAttributes);
+
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+ context.OnComplete.ReleasePathState(OperationId, pathId, TPathElement::EPathState::EPathStateNoChanges);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ Y_VERIFY(path->UserAttrs);
+ Y_VERIFY(path->UserAttrs->AlterData);
+ Y_VERIFY(path->UserAttrs->AlterVersion < path->UserAttrs->AlterData->AlterVersion);
+ context.SS->ApplyAndPersistUserAttrs(db, path->PathId);
+
+ context.SS->ClearDescribePathCaches(path);
context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
-
- context.OnComplete.UpdateTenants({pathId});
-
- context.OnComplete.DoneOperation(OperationId);
- }
-
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAlterUserAttrs AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+
+ context.OnComplete.UpdateTenants({pathId});
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAlterUserAttrs AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateAlterUserAttrs(TOperationId id, const TTxTransaction& tx) {
return new TAlterUserAttrs(id, tx);
}
-ISubOperationBase::TPtr CreateAlterUserAttrs(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state == TTxState::Invalid || state == TTxState::Propose);
- return new TAlterUserAttrs(id);
-}
-
-}
-}
+ISubOperationBase::TPtr CreateAlterUserAttrs(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state == TTxState::Invalid || state == TTxState::Propose);
+ return new TAlterUserAttrs(id);
+}
+
+}
+}
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 b6f78370c2c..c1ac9556511 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_apply_build_index.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_apply_build_index.cpp
@@ -1,145 +1,145 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_path_element.h"
-#include "schemeshard_utils.h"
-
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_path_element.h"
+#include "schemeshard_utils.h"
+
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/table_index.h>
#include <ydb/core/protos/flat_tx_scheme.pb.h>
#include <ydb/core/protos/flat_scheme_op.pb.h>
-
+
#include <ydb/library/yql/minikql/mkql_type_ops.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-TVector<ISubOperationBase::TPtr> ApplyBuildIndex(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context) {
- Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpApplyIndexBuild);
-
- auto config = tx.GetApplyIndexBuild();
- TString tablePath = config.GetTablePath();
- TString indexName = config.GetIndexName();
-
- TPath table = TPath::Resolve(tablePath, context.SS);
- TPath index = table.Child(indexName);
- TPath implIndexTable = index.Child("indexImplTable");
-
-
- TTableInfo::TPtr implInxexTableInfo = context.SS->Tables.at(implIndexTable.Base()->PathId);
-
- //check idempotence
-
- //check limits
-
- TVector<ISubOperationBase::TPtr> result;
-
- {
- auto finalize = TransactionTemplate(table.Parent().PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpFinalizeBuildIndexMainTable);
- *finalize.MutableLockGuard() = tx.GetLockGuard();
- auto op = finalize.MutableFinalizeBuildIndexMainTable();
- op->SetTableName(table.LeafName());
- op->SetSnapshotTxId(config.GetSnaphotTxId());
- op->SetBuildIndexId(config.GetBuildIndexId());
-
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+TVector<ISubOperationBase::TPtr> ApplyBuildIndex(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context) {
+ Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpApplyIndexBuild);
+
+ auto config = tx.GetApplyIndexBuild();
+ TString tablePath = config.GetTablePath();
+ TString indexName = config.GetIndexName();
+
+ TPath table = TPath::Resolve(tablePath, context.SS);
+ TPath index = table.Child(indexName);
+ TPath implIndexTable = index.Child("indexImplTable");
+
+
+ TTableInfo::TPtr implInxexTableInfo = context.SS->Tables.at(implIndexTable.Base()->PathId);
+
+ //check idempotence
+
+ //check limits
+
+ TVector<ISubOperationBase::TPtr> result;
+
+ {
+ auto finalize = TransactionTemplate(table.Parent().PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpFinalizeBuildIndexMainTable);
+ *finalize.MutableLockGuard() = tx.GetLockGuard();
+ auto op = finalize.MutableFinalizeBuildIndexMainTable();
+ op->SetTableName(table.LeafName());
+ op->SetSnapshotTxId(config.GetSnaphotTxId());
+ op->SetBuildIndexId(config.GetBuildIndexId());
+
result.push_back(CreateFinalizeBuildIndexMainTable(NextPartId(nextId, result), finalize));
- }
-
- {
- auto tableIndexAltering = TransactionTemplate(table.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpAlterTableIndex);
- *tableIndexAltering.MutableLockGuard() = tx.GetLockGuard();
- auto alterIndex = tableIndexAltering.MutableAlterTableIndex();
- alterIndex->SetName(index.LeafName());
- alterIndex->SetState(NKikimrSchemeOp::EIndexState::EIndexStateReady);
-
+ }
+
+ {
+ auto tableIndexAltering = TransactionTemplate(table.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpAlterTableIndex);
+ *tableIndexAltering.MutableLockGuard() = tx.GetLockGuard();
+ auto alterIndex = tableIndexAltering.MutableAlterTableIndex();
+ alterIndex->SetName(index.LeafName());
+ alterIndex->SetState(NKikimrSchemeOp::EIndexState::EIndexStateReady);
+
result.push_back(CreateAlterTableIndex(NextPartId(nextId, result), tableIndexAltering));
- }
-
- {
- auto indexImplTableAltering = TransactionTemplate(index.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpFinalizeBuildIndexImplTable);
- auto alterTable = indexImplTableAltering.MutableAlterTable();
- alterTable->SetName(implIndexTable.LeafName());
- alterTable->MutablePartitionConfig()->MutableCompactionPolicy()->CopyFrom(implInxexTableInfo->PartitionConfig().GetCompactionPolicy());
- alterTable->MutablePartitionConfig()->MutableCompactionPolicy()->SetKeepEraseMarkers(false);
- alterTable->MutablePartitionConfig()->SetShadowData(false);
-
+ }
+
+ {
+ auto indexImplTableAltering = TransactionTemplate(index.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpFinalizeBuildIndexImplTable);
+ auto alterTable = indexImplTableAltering.MutableAlterTable();
+ alterTable->SetName(implIndexTable.LeafName());
+ alterTable->MutablePartitionConfig()->MutableCompactionPolicy()->CopyFrom(implInxexTableInfo->PartitionConfig().GetCompactionPolicy());
+ alterTable->MutablePartitionConfig()->MutableCompactionPolicy()->SetKeepEraseMarkers(false);
+ alterTable->MutablePartitionConfig()->SetShadowData(false);
+
result.push_back(CreateFinalizeBuildIndexImplTable(NextPartId(nextId, result), indexImplTableAltering));
- }
-
- return result;
-}
-
-TVector<ISubOperationBase::TPtr> CancelBuildIndex(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context) {
- Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpCancelIndexBuild);
-
- auto config = tx.GetCancelIndexBuild();
- TString tablePath = config.GetTablePath();
- TString indexName = config.GetIndexName();
-
- TPath table = TPath::Resolve(tablePath, context.SS);
- TPath index = table.Child(indexName);
-
- //check idempotence
-
- //check limits
-
- TVector<ISubOperationBase::TPtr> result;
-
- {
- auto finalize = TransactionTemplate(table.Parent().PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpFinalizeBuildIndexMainTable);
- *finalize.MutableLockGuard() = tx.GetLockGuard();
- auto op = finalize.MutableFinalizeBuildIndexMainTable();
- op->SetTableName(table.LeafName());
- op->SetSnapshotTxId(config.GetSnaphotTxId());
- op->SetBuildIndexId(config.GetBuildIndexId());
-
+ }
+
+ return result;
+}
+
+TVector<ISubOperationBase::TPtr> CancelBuildIndex(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context) {
+ Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpCancelIndexBuild);
+
+ auto config = tx.GetCancelIndexBuild();
+ TString tablePath = config.GetTablePath();
+ TString indexName = config.GetIndexName();
+
+ TPath table = TPath::Resolve(tablePath, context.SS);
+ TPath index = table.Child(indexName);
+
+ //check idempotence
+
+ //check limits
+
+ TVector<ISubOperationBase::TPtr> result;
+
+ {
+ auto finalize = TransactionTemplate(table.Parent().PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpFinalizeBuildIndexMainTable);
+ *finalize.MutableLockGuard() = tx.GetLockGuard();
+ auto op = finalize.MutableFinalizeBuildIndexMainTable();
+ op->SetTableName(table.LeafName());
+ op->SetSnapshotTxId(config.GetSnaphotTxId());
+ op->SetBuildIndexId(config.GetBuildIndexId());
+
result.push_back(CreateFinalizeBuildIndexMainTable(NextPartId(nextId, result), finalize));
- }
-
- {
- auto tableIndexDropping = TransactionTemplate(table.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpDropTableIndex);
- auto operation = tableIndexDropping.MutableDrop();
- operation->SetName(ToString(index.Base()->Name));
+ }
+
+ {
+ auto tableIndexDropping = TransactionTemplate(table.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpDropTableIndex);
+ auto operation = tableIndexDropping.MutableDrop();
+ operation->SetName(ToString(index.Base()->Name));
result.push_back(CreateDropTableIndex(NextPartId(nextId, result), tableIndexDropping));
- }
-
- Y_VERIFY(index.Base()->GetChildren().size() == 1);
- for (auto& indexChildItems: index.Base()->GetChildren()) {
- const TString& implTableName = indexChildItems.first;
- Y_VERIFY(implTableName == "indexImplTable", "unexpected name %s", implTableName.c_str());
-
- TPath implTable = index.Child(implTableName);
- {
- TPath::TChecker checks = implTable.Check();
- checks.NotEmpty()
- .IsResolved()
- .NotDeleted()
- .IsTable()
- .IsInsideTableIndexPath()
- .NotUnderDeleting()
- .NotUnderOperation();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path impl table fail checks"
- << ", index path: " << implTable.PathString();
- auto status = checks.GetStatus(&explain);
- return {CreateReject(nextId, status, explain)};
- }
- }
- Y_VERIFY(implTable.Base()->PathId == indexChildItems.second);
-
- {
- auto implTableDropping = TransactionTemplate(index.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
- auto operation = implTableDropping.MutableDrop();
- operation->SetName(ToString(implTable.Base()->Name));
+ }
+
+ Y_VERIFY(index.Base()->GetChildren().size() == 1);
+ for (auto& indexChildItems: index.Base()->GetChildren()) {
+ const TString& implTableName = indexChildItems.first;
+ Y_VERIFY(implTableName == "indexImplTable", "unexpected name %s", implTableName.c_str());
+
+ TPath implTable = index.Child(implTableName);
+ {
+ TPath::TChecker checks = implTable.Check();
+ checks.NotEmpty()
+ .IsResolved()
+ .NotDeleted()
+ .IsTable()
+ .IsInsideTableIndexPath()
+ .NotUnderDeleting()
+ .NotUnderOperation();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path impl table fail checks"
+ << ", index path: " << implTable.PathString();
+ auto status = checks.GetStatus(&explain);
+ return {CreateReject(nextId, status, explain)};
+ }
+ }
+ Y_VERIFY(implTable.Base()->PathId == indexChildItems.second);
+
+ {
+ auto implTableDropping = TransactionTemplate(index.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
+ auto operation = implTableDropping.MutableDrop();
+ operation->SetName(ToString(implTable.Base()->Name));
result.push_back(CreateDropTable(NextPartId(nextId,result), implTableDropping));
- }
- }
-
- return result;
-}
-
-}
-}
+ }
+ }
+
+ return result;
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_assign_bsv.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_assign_bsv.cpp
index 08ac6a22098..de1576f2b18 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_assign_bsv.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_assign_bsv.cpp
@@ -1,131 +1,131 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard_impl.h"
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TAssignBlockStoreVolume: public ISubOperationBase {
+#include "schemeshard__operation_part.h"
+#include "schemeshard_impl.h"
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TAssignBlockStoreVolume: public ISubOperationBase {
const TOperationId OperationId;
const TTxTransaction Transaction;
-
-public:
+
+public:
TAssignBlockStoreVolume(TOperationId id, const TTxTransaction& tx)
: OperationId(id)
, Transaction(tx)
{
}
- TAssignBlockStoreVolume(TOperationId id)
- : OperationId(id)
+ TAssignBlockStoreVolume(TOperationId id)
+ : OperationId(id)
{
}
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = Transaction.GetAssignBlockStoreVolume().GetName();
const TString mountToken = Transaction.GetAssignBlockStoreVolume().GetNewMountToken();
const auto version = Transaction.GetAssignBlockStoreVolume().GetTokenVersion();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TAssignBlockStoreVolume Propose"
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TAssignBlockStoreVolume Propose"
<< ", path: " << parentPathStr << "/" << name
- << ", operationId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusSuccess, ui64(OperationId.GetTxId()), context.SS->TabletID());
-
- TPath path = TPath::Resolve(parentPathStr, context.SS).Dive(name);
-
- {
- TPath::TChecker checks = path.Check();
+ << ", operationId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusSuccess, ui64(OperationId.GetTxId()), context.SS->TabletID());
+
+ TPath path = TPath::Resolve(parentPathStr, context.SS).Dive(name);
+
+ {
+ TPath::TChecker checks = path.Check();
checks
.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .IsBlockStoreVolume()
- .IsCommonSensePath(); //forbid alter impl index tables
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- if (!context.SS->BlockStoreVolumes.contains(path.Base()->PathId)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "Specified path is not a block store volume");
- return result;
- }
-
- TBlockStoreVolumeInfo::TPtr volume = context.SS->BlockStoreVolumes[path.Base()->PathId];
- if (volume->AlterVersion == 0) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, "Block store volume is not created yet");
- return result;
- }
-
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .IsBlockStoreVolume()
+ .IsCommonSensePath(); //forbid alter impl index tables
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ if (!context.SS->BlockStoreVolumes.contains(path.Base()->PathId)) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "Specified path is not a block store volume");
+ return result;
+ }
+
+ TBlockStoreVolumeInfo::TPtr volume = context.SS->BlockStoreVolumes[path.Base()->PathId];
+ if (volume->AlterVersion == 0) {
+ result->SetError(NKikimrScheme::StatusMultipleModifications, "Block store volume is not created yet");
+ return result;
+ }
+
if (version &&
version != volume->TokenVersion)
{
result->SetError(
- NKikimrScheme::StatusPreconditionFailed,
+ NKikimrScheme::StatusPreconditionFailed,
"Wrong version in Assign Volume");
return result;
}
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- volume->MountToken = mountToken;
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ volume->MountToken = mountToken;
++volume->TokenVersion;
- context.SS->PersistBlockStoreVolumeMountToken(db, path.Base()->PathId, volume);
-
+ context.SS->PersistBlockStoreVolumeMountToken(db, path.Base()->PathId, volume);
+
context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
- context.OnComplete.DoneOperation(OperationId);
- return result;
- }
-
+ context.OnComplete.DoneOperation(OperationId);
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TAssignBlockStoreVolume");
}
- void ProgressState(TOperationContext&) override {
- Y_FAIL("no progress state for assign bsc");
- return;
- }
-
- void AbortUnsafe(TTxId, TOperationContext&) override {
- Y_FAIL("no AbortUnsafe for assign bsc");
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+ void ProgressState(TOperationContext&) override {
+ Y_FAIL("no progress state for assign bsc");
+ return;
+ }
+
+ void AbortUnsafe(TTxId, TOperationContext&) override {
+ Y_FAIL("no AbortUnsafe for assign bsc");
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateAssignBSV(TOperationId id, const TTxTransaction& tx) {
return new TAssignBlockStoreVolume(id, tx);
}
-ISubOperationBase::TPtr CreateAssignBSV(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state == TTxState::Invalid || state == TTxState::Propose);
- return new TAssignBlockStoreVolume(id);
-}
-
-}
-}
+ISubOperationBase::TPtr CreateAssignBSV(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state == TTxState::Invalid || state == TTxState::Propose);
+ return new TAssignBlockStoreVolume(id);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_backup_restore_common.h b/ydb/core/tx/schemeshard/schemeshard__operation_backup_restore_common.h
index 6a430480e55..640f5f13565 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_backup_restore_common.h
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_backup_restore_common.h
@@ -1,93 +1,93 @@
#pragma once
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
#include "schemeshard_billing_helpers.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
#include <ydb/core/metering/metering.h>
-
+
#include <util/generic/utility.h>
namespace NKikimr {
-namespace NSchemeShard {
-
+namespace NSchemeShard {
+
template <typename TKind>
-class TConfigurePart: public TSubOperationState {
+class TConfigurePart: public TSubOperationState {
const TTxState::ETxType TxType;
const TOperationId OperationId;
-
+
TString DebugHint() const override {
- return TStringBuilder()
+ return TStringBuilder()
<< TKind::Name() << " TConfigurePart"
<< ", opId: " << OperationId;
- }
-
-public:
+ }
+
+public:
TConfigurePart(TTxState::ETxType type, TOperationId id)
: TxType(type)
, OperationId(id)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool HandleReply(TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context) override {
- auto ssId = context.SS->SelfTabletId();
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvProposeTransactionResult"
- << " at tabletId# " << ssId
- << " message# " << ev->Get()->Record.ShortDebugString());
-
- return NTableState::CollectProposeTransactionResults(OperationId, ev, context);
- }
-
- bool ProgressState(TOperationContext& context) override {
- auto ssId = context.SS->SelfTabletId();
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool HandleReply(TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context) override {
+ auto ssId = context.SS->SelfTabletId();
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvProposeTransactionResult"
+ << " at tabletId# " << ssId
+ << " message# " << ev->Get()->Record.ShortDebugString());
+
+ return NTableState::CollectProposeTransactionResults(OperationId, ev, context);
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ auto ssId = context.SS->SelfTabletId();
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
TKind::Name() << " TConfigurePart ProgressState"
<< ", opId: " << OperationId
<< ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->TxInFlight.FindPtr(OperationId);
- Y_VERIFY(txState);
+
+ TTxState* txState = context.SS->TxInFlight.FindPtr(OperationId);
+ Y_VERIFY(txState);
Y_VERIFY(txState->TxType == TxType);
- Y_VERIFY(txState->State == TTxState::ConfigureParts);
-
- txState->ClearShardsInProgress();
+ Y_VERIFY(txState->State == TTxState::ConfigureParts);
+
+ txState->ClearShardsInProgress();
TKind::ProposeTx(OperationId, *txState, context);
txState->UpdateShardsInProgress(TTxState::ConfigureParts);
-
- return false;
- }
-};
-
+
+ return false;
+ }
+};
+
template <typename TKind>
-class TProposedWaitParts: public TSubOperationState {
+class TProposedWaitParts: public TSubOperationState {
protected:
const TTxState::ETxType TxType;
const TOperationId OperationId;
-private:
+private:
TString DebugHint() const override {
- return TStringBuilder()
+ return TStringBuilder()
<< TKind::Name() << " TProposedWaitParts"
<< ", opId: " << OperationId;
- }
-
-public:
+ }
+
+public:
TProposedWaitParts(TTxState::ETxType type, TOperationId id)
: TxType(type)
, OperationId(id)
- {
- IgnoreMessages(DebugHint(),
- { TEvHive::TEvCreateTabletReply::EventType
- , TEvDataShard::TEvProposeTransactionResult::EventType
- , TEvPrivate::TEvOperationPlan::EventType }
- );
- }
-
+ {
+ IgnoreMessages(DebugHint(),
+ { TEvHive::TEvCreateTabletReply::EventType
+ , TEvDataShard::TEvProposeTransactionResult::EventType
+ , TEvPrivate::TEvOperationPlan::EventType }
+ );
+ }
+
static void Bill(TOperationId operationId, const TPathId& pathId, const TShardIdx& shardIdx, ui64 ru, TOperationContext& context) {
const auto path = TPath::Init(pathId, context.SS);
const auto domainId = path.DomainId();
@@ -151,30 +151,30 @@ public:
new NMetering::TEvMetering::TEvWriteMeteringJson(std::move(billRecord)));
}
- static void CollectStats(TOperationId operationId, const TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) {
- const auto& evRecord = ev->Get()->Record;
-
+ static void CollectStats(TOperationId operationId, const TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) {
+ const auto& evRecord = ev->Get()->Record;
+
if (!evRecord.HasOpResult() || !evRecord.GetOpResult().HasSuccess()) {
- return;
- }
-
- Y_VERIFY(context.SS->FindTx(operationId));
- TTxState& txState = *context.SS->FindTx(operationId);
-
- auto tabletId = TTabletId(evRecord.GetOrigin());
+ return;
+ }
+
+ Y_VERIFY(context.SS->FindTx(operationId));
+ TTxState& txState = *context.SS->FindTx(operationId);
+
+ auto tabletId = TTabletId(evRecord.GetOrigin());
auto shardIdx = context.SS->MustGetShardIdx(tabletId);
- Y_VERIFY(context.SS->ShardInfos.contains(shardIdx));
-
- if (!txState.SchemeChangeNotificationReceived.contains(shardIdx)) {
- return;
- }
-
- ui32 generation = evRecord.GetGeneration();
- if (txState.SchemeChangeNotificationReceived[shardIdx].second != generation) {
- return;
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
+ Y_VERIFY(context.SS->ShardInfos.contains(shardIdx));
+
+ if (!txState.SchemeChangeNotificationReceived.contains(shardIdx)) {
+ return;
+ }
+
+ ui32 generation = evRecord.GetGeneration();
+ if (txState.SchemeChangeNotificationReceived[shardIdx].second != generation) {
+ return;
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
const auto& result = evRecord.GetOpResult();
if (!txState.ShardStatuses.contains(shardIdx)) {
@@ -193,286 +193,286 @@ public:
if (result.GetSuccess()) {
if (result.HasBytesProcessed()) {
txState.DataTotalSize += result.GetBytesProcessed();
-
- db.Table<Schema::TxInFlightV2>().Key(operationId.GetTxId(), operationId.GetSubTxId()).Update(
+
+ db.Table<Schema::TxInFlightV2>().Key(operationId.GetTxId(), operationId.GetSubTxId()).Update(
NIceDb::TUpdate<Schema::TxInFlightV2::DataTotalSize>(txState.DataTotalSize));
- }
- } else {
+ }
+ } else {
if (result.HasExplain()) {
TString explain = result.GetExplain();
-
- if (context.SS->IsLocalId(shardIdx)) {
- db.Table<Schema::ShardBackupStatus>().Key(operationId.GetTxId(), shardIdx.GetLocalId()).Update(
- NIceDb::TUpdate<Schema::ShardBackupStatus::Explain>(explain));
- } else {
- db.Table<Schema::MigratedShardBackupStatus>().Key(operationId.GetTxId(), shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
- NIceDb::TUpdate<Schema::MigratedShardBackupStatus::Explain>(explain));
- }
- }
- }
- }
-
- bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
- auto ssId = context.SS->SelfTabletId();
- const auto& evRecord = ev->Get()->Record;
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+
+ if (context.SS->IsLocalId(shardIdx)) {
+ db.Table<Schema::ShardBackupStatus>().Key(operationId.GetTxId(), shardIdx.GetLocalId()).Update(
+ NIceDb::TUpdate<Schema::ShardBackupStatus::Explain>(explain));
+ } else {
+ db.Table<Schema::MigratedShardBackupStatus>().Key(operationId.GetTxId(), shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
+ NIceDb::TUpdate<Schema::MigratedShardBackupStatus::Explain>(explain));
+ }
+ }
+ }
+ }
+
+ bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
+ auto ssId = context.SS->SelfTabletId();
+ const auto& evRecord = ev->Get()->Record;
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
DebugHint() << " HandleReply TEvSchemaChanged"
<< " at tablet# " << ssId
- << " message# " << evRecord.ShortDebugString());
-
- bool allnotificationRecieved = NTableState::CollectSchemaChanged(OperationId, ev, context);
- CollectStats(OperationId, ev, context);
-
- if (!allnotificationRecieved) {
- return false;
- }
-
- Y_VERIFY(context.SS->FindTx(OperationId));
- TTxState& txState = *context.SS->FindTx(OperationId);
-
- if (!txState.ReadyForNotifications) {
- return false;
- }
-
+ << " message# " << evRecord.ShortDebugString());
+
+ bool allnotificationRecieved = NTableState::CollectSchemaChanged(OperationId, ev, context);
+ CollectStats(OperationId, ev, context);
+
+ if (!allnotificationRecieved) {
+ return false;
+ }
+
+ Y_VERIFY(context.SS->FindTx(OperationId));
+ TTxState& txState = *context.SS->FindTx(OperationId);
+
+ if (!txState.ReadyForNotifications) {
+ return false;
+ }
+
TKind::FinishStats(OperationId, txState, context);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- auto ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- txState->ClearShardsInProgress();
- for (TTxState::TShardOperation& shard : txState->Shards) {
- if (shard.Operation < TTxState::ProposedWaitParts) {
- shard.Operation = TTxState::ProposedWaitParts;
- context.SS->PersistUpdateTxShard(db, OperationId, shard.Idx, shard.Operation);
- }
- context.OnComplete.RouteByTablet(OperationId, context.SS->ShardInfos.at(shard.Idx).TabletID);
- }
- txState->UpdateShardsInProgress(TTxState::ProposedWaitParts);
-
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ auto ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ txState->ClearShardsInProgress();
+ for (TTxState::TShardOperation& shard : txState->Shards) {
+ if (shard.Operation < TTxState::ProposedWaitParts) {
+ shard.Operation = TTxState::ProposedWaitParts;
+ context.SS->PersistUpdateTxShard(db, OperationId, shard.Idx, shard.Operation);
+ }
+ context.OnComplete.RouteByTablet(OperationId, context.SS->ShardInfos.at(shard.Idx).TabletID);
+ }
+ txState->UpdateShardsInProgress(TTxState::ProposedWaitParts);
+
if (txState->Cancel) {
context.SS->ChangeTxState(db, OperationId, TTxState::Aborting);
- return true;
- }
-
- // Move all notifications that were already received
- // NOTE: SchemeChangeNotification is sent form DS after it has got PlanStep from coordinator and the schema tx has completed
- // At that moment the SS might not have received PlanStep from coordinator yet (this message might be still on its way to SS)
- // So we are going to accumulate SchemeChangeNotification that are received before this Tx switches to WaitParts state
- txState->AcceptPendingSchemeNotification();
-
- // Got notifications from all datashards?
- if (txState->ShardsInProgress.empty()) {
- NTableState::AckAllSchemaChanges(OperationId, *txState, context);
- context.SS->ChangeTxState(db, OperationId, TTxState::Done);
+ return true;
+ }
+
+ // Move all notifications that were already received
+ // NOTE: SchemeChangeNotification is sent form DS after it has got PlanStep from coordinator and the schema tx has completed
+ // At that moment the SS might not have received PlanStep from coordinator yet (this message might be still on its way to SS)
+ // So we are going to accumulate SchemeChangeNotification that are received before this Tx switches to WaitParts state
+ txState->AcceptPendingSchemeNotification();
+
+ // Got notifications from all datashards?
+ if (txState->ShardsInProgress.empty()) {
+ NTableState::AckAllSchemaChanges(OperationId, *txState, context);
+ context.SS->ChangeTxState(db, OperationId, TTxState::Done);
TKind::FinishStats(OperationId, *txState, context);
- return true;
- }
-
- return false;
- }
-};
-
+ return true;
+ }
+
+ return false;
+ }
+};
+
template <typename TKind, typename TEvCancel>
class TAborting: public TProposedWaitParts<TKind> {
using TProposedWaitParts<TKind>::OperationId;
using TProposedWaitParts<TKind>::TxType;
-
+
TString DebugHint() const override {
- return TStringBuilder()
+ return TStringBuilder()
<< TKind::Name() << " TAborting"
<< ", opId: " << OperationId;
- }
-
-public:
+ }
+
+public:
TAborting(TTxState::ETxType type, TOperationId id)
: TProposedWaitParts<TKind>(type, id)
- {
+ {
this->IgnoreMessages(DebugHint(),
- { TEvHive::TEvCreateTabletReply::EventType
- , TEvDataShard::TEvProposeTransactionResult::EventType
- , TEvPrivate::TEvOperationPlan::EventType }
- );
- }
-
- bool ProgressState(TOperationContext& context) override {
- auto ssId = context.SS->SelfTabletId();
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << " at tablet" << ssId);
-
- TTxState* txState = context.SS->TxInFlight.FindPtr(OperationId);
- Y_VERIFY(txState);
+ { TEvHive::TEvCreateTabletReply::EventType
+ , TEvDataShard::TEvProposeTransactionResult::EventType
+ , TEvPrivate::TEvOperationPlan::EventType }
+ );
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ auto ssId = context.SS->SelfTabletId();
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << " at tablet" << ssId);
+
+ TTxState* txState = context.SS->TxInFlight.FindPtr(OperationId);
+ Y_VERIFY(txState);
Y_VERIFY(txState->TxType == TxType);
Y_VERIFY(txState->State == TTxState::Aborting);
-
- txState->ClearShardsInProgress();
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- for (TTxState::TShardOperation& shard : txState->Shards) {
- if (shard.Operation < TTxState::ProposedWaitParts) {
- shard.Operation = TTxState::ProposedWaitParts;
- context.SS->PersistUpdateTxShard(
- db, OperationId, shard.Idx, shard.Operation);
- }
- }
-
- for (ui32 i = 0; i < txState->Shards.size(); ++i) {
- auto idx = txState->Shards[i].Idx;
- auto datashardId = context.SS->ShardInfos[idx].TabletID;
-
+
+ txState->ClearShardsInProgress();
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ for (TTxState::TShardOperation& shard : txState->Shards) {
+ if (shard.Operation < TTxState::ProposedWaitParts) {
+ shard.Operation = TTxState::ProposedWaitParts;
+ context.SS->PersistUpdateTxShard(
+ db, OperationId, shard.Idx, shard.Operation);
+ }
+ }
+
+ for (ui32 i = 0; i < txState->Shards.size(); ++i) {
+ auto idx = txState->Shards[i].Idx;
+ auto datashardId = context.SS->ShardInfos[idx].TabletID;
+
LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
TKind::Name() << " Abort"
<< ", on datashard: " << datashardId
<< ", opId: " << OperationId
<< ", at schemeshard: " << context.SS->TabletID());
-
+
THolder<TEvCancel> event =
THolder(new TEvCancel(ui64(OperationId.GetTxId()), txState->TargetPathId.LocalPathId));
-
- context.OnComplete.BindMsgToPipe(OperationId, datashardId, idx, event.Release());
- }
-
- txState->UpdateShardsInProgress(TTxState::ProposedWaitParts);
-
- txState->AcceptPendingSchemeNotification();
-
- // Got notifications from all datashards?
- if (txState->ShardsInProgress.empty()) {
- NTableState::AckAllSchemaChanges(OperationId, *txState, context);
- context.SS->ChangeTxState(db, OperationId, TTxState::Done);
+
+ context.OnComplete.BindMsgToPipe(OperationId, datashardId, idx, event.Release());
+ }
+
+ txState->UpdateShardsInProgress(TTxState::ProposedWaitParts);
+
+ txState->AcceptPendingSchemeNotification();
+
+ // Got notifications from all datashards?
+ if (txState->ShardsInProgress.empty()) {
+ NTableState::AckAllSchemaChanges(OperationId, *txState, context);
+ context.SS->ChangeTxState(db, OperationId, TTxState::Done);
TKind::FinishStats(OperationId, *txState, context);
- return true;
- }
-
- return false;
- }
-};
-
+ return true;
+ }
+
+ return false;
+ }
+};
+
template <typename TKind>
-class TPropose: public TSubOperationState {
+class TPropose: public TSubOperationState {
const TTxState::ETxType TxType;
const TOperationId OperationId;
-
+
TString DebugHint() const override {
- return TStringBuilder()
+ return TStringBuilder()
<< TKind::Name() << " TPropose"
<< ", opId: " << OperationId;
- }
+ }
-public:
+public:
TPropose(TTxState::ETxType type, TOperationId id)
: TxType(type)
, OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvDataShard::TEvProposeTransactionResult::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
- auto ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvSchemaChanged"
- << " triggers early, save it"
- << ", at schemeshard: " << ssId);
-
- NTableState::CollectSchemaChanged(OperationId, ev, context);
+ {
+ IgnoreMessages(DebugHint(), {TEvDataShard::TEvProposeTransactionResult::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
+ auto ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvSchemaChanged"
+ << " triggers early, save it"
+ << ", at schemeshard: " << ssId);
+
+ NTableState::CollectSchemaChanged(OperationId, ev, context);
TProposedWaitParts<TKind>::CollectStats(OperationId, ev, context);
- return false;
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- auto step = TStepId(ev->Get()->StepId);
- auto ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", stepId: " << step
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
+ return false;
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ auto step = TStepId(ev->Get()->StepId);
+ auto ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", stepId: " << step
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
Y_VERIFY(txState->TxType == TxType);
-
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
-
+
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+
TKind::PersistDone(pathId, context);
-
- context.SS->ClearDescribePathCaches(path);
+
+ context.SS->ClearDescribePathCaches(path);
context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
-
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- auto ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
+ context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
+
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ auto ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
Y_VERIFY(txState->TxType == TxType);
-
- TSet<TTabletId> shardSet;
- for (const auto& shard : txState->Shards) {
- auto idx = shard.Idx;
- auto tablet = context.SS->ShardInfos.at(idx).TabletID;
- shardSet.insert(tablet);
- }
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, txState->MinStep, shardSet);
- return false;
- }
-};
-
+
+ TSet<TTabletId> shardSet;
+ for (const auto& shard : txState->Shards) {
+ auto idx = shard.Idx;
+ auto tablet = context.SS->ShardInfos.at(idx).TabletID;
+ shardSet.insert(tablet);
+ }
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, txState->MinStep, shardSet);
+ return false;
+ }
+};
+
template <typename TKind, typename TEvCancel>
class TBackupRestoreOperationBase: public TSubOperation {
const TTxState::ETxType TxType;
const TPathElement::EPathState Lock;
-
+
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::CreateParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state, TOperationContext& context) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
- return TTxState::ConfigureParts;
-
- case TTxState::ConfigureParts:
- return TTxState::Propose;
-
- case TTxState::Propose:
- return TTxState::ProposedWaitParts;
-
- case TTxState::ProposedWaitParts: {
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::CreateParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state, TOperationContext& context) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
+ return TTxState::ConfigureParts;
+
+ case TTxState::ConfigureParts:
+ return TTxState::Propose;
+
+ case TTxState::Propose:
+ return TTxState::ProposedWaitParts;
+
+ case TTxState::ProposedWaitParts: {
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
Y_VERIFY(txState->TxType == TxType);
-
+
if (txState->Cancel) {
if (txState->State == TTxState::Done) {
return TTxState::Done;
@@ -480,48 +480,48 @@ class TBackupRestoreOperationBase: public TSubOperation {
Y_VERIFY(txState->State == TTxState::Aborting);
return TTxState::Aborting;
- }
- return TTxState::Done;
- }
+ }
+ return TTxState::Done;
+ }
case TTxState::Aborting:
- return TTxState::Done;
-
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
+ return TTxState::Done;
+
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
return THolder(new TCreateParts(OperationId));
- case TTxState::ConfigureParts:
+ case TTxState::ConfigureParts:
return THolder(new TConfigurePart<TKind>(TxType, OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new TPropose<TKind>(TxType, OperationId));
- case TTxState::ProposedWaitParts:
+ case TTxState::ProposedWaitParts:
return THolder(new TProposedWaitParts<TKind>(TxType, OperationId));
case TTxState::Aborting:
return THolder(new TAborting<TKind, TEvCancel>(TxType, OperationId));
- case TTxState::Done:
+ case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State, context);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State, context);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TBackupRestoreOperationBase(
TTxState::ETxType type, TPathElement::EPathState lock,
TOperationId id, const TTxTransaction& tx)
@@ -531,135 +531,135 @@ public:
, Transaction(tx)
{
}
-
+
TBackupRestoreOperationBase(
TTxState::ETxType type, TPathElement::EPathState lock,
TOperationId id, TTxState::ETxState state)
: TxType(type)
, Lock(lock)
, OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
void PrepareChanges(TPathElement::TPtr path, TOperationContext& context) {
Y_VERIFY(context.SS->Tables.contains(path->PathId));
TTableInfo::TPtr& table = context.SS->Tables.at(path->PathId);
-
+
path->LastTxId = OperationId.GetTxId();
path->PathState = Lock;
-
+
TTxState& txState = context.SS->CreateTx(OperationId, TxType, path->PathId);
- txState.Shards.reserve(table->GetPartitions().size());
- for (const auto& shard : table->GetPartitions()) {
- auto shardIdx = shard.ShardIdx;
- txState.Shards.emplace_back(shardIdx, ETabletType::DataShard, TTxState::ConfigureParts);
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->PersistTxState(db, OperationId);
-
+ txState.Shards.reserve(table->GetPartitions().size());
+ for (const auto& shard : table->GetPartitions()) {
+ auto shardIdx = shard.ShardIdx;
+ txState.Shards.emplace_back(shardIdx, ETabletType::DataShard, TTxState::ConfigureParts);
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->PersistTxState(db, OperationId);
+
TKind::PersistTask(path->PathId, Transaction, context);
-
- for (auto splitTx: table->GetSplitOpsInFlight()) {
+
+ for (auto splitTx: table->GetSplitOpsInFlight()) {
context.OnComplete.Dependence(splitTx.GetTxId(), OperationId.GetTxId());
- }
-
- txState.State = TTxState::CreateParts;
+ }
+
+ txState.State = TTxState::CreateParts;
context.OnComplete.ActivateTx(OperationId);
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const TString& parentPath = Transaction.GetWorkingDir();
const TString name = TKind::GetTableName(Transaction);
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
TKind::Name() << " Propose"
- << ", path: " << parentPath << "/" << name
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
+ << ", path: " << parentPath << "/" << name
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
if (!Transaction.HasWorkingDir()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter,
+ result->SetError(NKikimrScheme::StatusInvalidParameter,
"Malformed request: no working dir");
- return result;
- }
-
+ return result;
+ }
+
if (!TKind::HasTask(Transaction)) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
"Malformed request");
- return result;
- }
-
+ return result;
+ }
+
if (name.empty()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
"No table name in task");
- return result;
- }
-
- TPath path = TPath::Resolve(parentPath, context.SS).Dive(name);
- {
- TPath::TChecker checks = path.Check();
+ return result;
+ }
+
+ TPath path = TPath::Resolve(parentPath, context.SS).Dive(name);
+ {
+ TPath::TChecker checks = path.Check();
checks
.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .IsTable()
- .NotUnderOperation()
- .IsCommonSensePath() //forbid alter impl index tables
- .NotChildren(); //forbid backup table with indexes
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .IsTable()
+ .NotUnderOperation()
+ .IsCommonSensePath() //forbid alter impl index tables
+ .NotChildren(); //forbid backup table with indexes
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- if (!context.SS->CheckLocks(path.Base()->PathId, Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ if (!context.SS->CheckLocks(path.Base()->PathId, Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
+ return result;
+ }
+
PrepareChanges(path.Base(), context);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TBackupRestoreOperationBase");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
TKind::Name() << " AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_cancel_tx.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_cancel_tx.cpp
index f88cc63c668..aceebc37860 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_cancel_tx.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_cancel_tx.cpp
@@ -1,97 +1,97 @@
-#include "schemeshard__operation.h"
-#include "schemeshard_impl.h"
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
+#include "schemeshard__operation.h"
+#include "schemeshard_impl.h"
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
class TTxCancelTx: public ISubOperationBase {
-private:
- TEvSchemeShard::TEvCancelTx::TPtr Event;
-
-public:
- TTxCancelTx(TEvSchemeShard::TEvCancelTx::TPtr ev)
- : Event(ev)
- {}
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const auto& evRecord = Event->Get()->Record;
-
- Y_VERIFY(evRecord.HasTxId());
+private:
+ TEvSchemeShard::TEvCancelTx::TPtr Event;
+
+public:
+ TTxCancelTx(TEvSchemeShard::TEvCancelTx::TPtr ev)
+ : Event(ev)
+ {}
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const auto& evRecord = Event->Get()->Record;
+
+ Y_VERIFY(evRecord.HasTxId());
Y_VERIFY(evRecord.HasTargetTxId());
-
- LOG_DEBUG(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+
+ LOG_DEBUG(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Execute cancel tx txid #%" PRIu64,
evRecord.GetTargetTxId());
-
- auto proposeResult = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, evRecord.GetTxId(), context.SS->TabletID());
-
- THolder<TEvSchemeShard::TEvCancelTxResult> result = MakeHolder<TEvSchemeShard::TEvCancelTxResult>(evRecord.GetTargetTxId(), evRecord.GetTxId());
-
+
+ auto proposeResult = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, evRecord.GetTxId(), context.SS->TabletID());
+
+ THolder<TEvSchemeShard::TEvCancelTxResult> result = MakeHolder<TEvSchemeShard::TEvCancelTxResult>(evRecord.GetTargetTxId(), evRecord.GetTxId());
+
TOperationId targetOpId = TOperationId(evRecord.GetTargetTxId(), 0);
-
+
auto found = context.SS->FindTx(targetOpId);
- if (!found) {
- result->Record.SetStatus(NKikimrScheme::StatusTxIdNotExists);
+ if (!found) {
+ result->Record.SetStatus(NKikimrScheme::StatusTxIdNotExists);
result->Record.SetResult("Transaction not found");
context.OnComplete.Send(Event->Sender, std::move(result), evRecord.GetTxId());
- return proposeResult;
- }
-
- TTxState& txState = *found;
+ return proposeResult;
+ }
+
+ TTxState& txState = *found;
if (txState.TxType != TTxState::TxBackup && txState.TxType != TTxState::TxRestore) {
- result->Record.SetStatus(NKikimrScheme::StatusTxIsNotCancellable);
+ result->Record.SetStatus(NKikimrScheme::StatusTxIsNotCancellable);
result->Record.SetResult("Transaction is not cancellable");
context.OnComplete.Send(Event->Sender, std::move(result), evRecord.GetTxId());
- return proposeResult;
- }
-
+ return proposeResult;
+ }
+
if (txState.State == TTxState::Aborting) {
- result->Record.SetStatus(NKikimrScheme::StatusAccepted);
+ result->Record.SetStatus(NKikimrScheme::StatusAccepted);
result->Record.SetResult("Tx is cancelling at SchemeShard already");
- context.OnComplete.Send(Event->Sender, std::move(result), evRecord.GetTxId());
- return proposeResult;
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- /* Let's abort at the final stage of the transaction */
+ context.OnComplete.Send(Event->Sender, std::move(result), evRecord.GetTxId());
+ return proposeResult;
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ /* Let's abort at the final stage of the transaction */
txState.Cancel = true;
context.SS->PersistCancelTx(db, targetOpId, txState);
-
- result->Record.SetStatus(NKikimrScheme::StatusAccepted);
- result->Record.SetResult("Cancelled at SchemeShard");
+
+ result->Record.SetStatus(NKikimrScheme::StatusAccepted);
+ result->Record.SetResult("Cancelled at SchemeShard");
context.OnComplete.Send(Event->Sender, std::move(result), evRecord.GetTxId());
-
+
context.OnComplete.ActivateTx(targetOpId);
- return proposeResult;
- }
-
+ return proposeResult;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TTxCancelTx");
}
- void ProgressState(TOperationContext&) override {
+ void ProgressState(TOperationContext&) override {
Y_FAIL("no progress state for cancel tx");
- return;
- }
-
- void AbortUnsafe(TTxId, TOperationContext&) override {
+ return;
+ }
+
+ void AbortUnsafe(TTxId, TOperationContext&) override {
Y_FAIL("no AbortUnsafe for cancel tx");
- }
-};
-
-}
-
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-ISubOperationBase::TPtr CreateTxCancelTx(TEvSchemeShard::TEvCancelTx::TPtr ev)
-{
+ }
+};
+
+}
+
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+ISubOperationBase::TPtr CreateTxCancelTx(TEvSchemeShard::TEvCancelTx::TPtr ev)
+{
return new TTxCancelTx(ev);
-}
-
-}
-}
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_common.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_common.cpp
index 70959b50e98..5a88636ffae 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_common.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_common.cpp
@@ -1,87 +1,87 @@
-#include "schemeshard__operation_common.h"
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+#include "schemeshard__operation_common.h"
+
+namespace NKikimr {
+namespace NSchemeShard {
+
namespace
-{
+{
template <typename T, typename TFuncCheck, typename TFuncToString>
bool CollectProposeTxResults(
const T& ev,
- const NKikimr::NSchemeShard::TOperationId& operationId,
- NKikimr::NSchemeShard::TOperationContext& context,
+ const NKikimr::NSchemeShard::TOperationId& operationId,
+ NKikimr::NSchemeShard::TOperationContext& context,
TFuncCheck checkPrepared,
TFuncToString toString)
{
- auto ssId = context.SS->SelfTabletId();
-
+ auto ssId = context.SS->SelfTabletId();
+
LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"TEvProposeTransactionResult at tablet: " << ssId);
auto tabletId = TTabletId(ev->Get()->Record.GetOrigin());
- auto shardMinStep = TStepId(ev->Get()->Record.GetMinStep());
- auto status = ev->Get()->Record.GetStatus();
-
- // Ignore COMPLETE
+ auto shardMinStep = TStepId(ev->Get()->Record.GetMinStep());
+ auto status = ev->Get()->Record.GetStatus();
+
+ // Ignore COMPLETE
if (!checkPrepared(status)) {
- LOG_ERROR_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ LOG_ERROR_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Ignore TEvProposeTransactionResult as not prepared"
<< ", shard: " << tabletId
- << ", operationId: " << operationId
+ << ", operationId: " << operationId
<< ", result status: " << toString(status)
- << ", at schemeshard: " << ssId);
- return false;
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- TTxState& txState = *context.SS->FindTx(operationId);
-
- if (txState.MinStep < shardMinStep) {
- txState.MinStep = shardMinStep;
- context.SS->PersistTxMinStep(db, operationId, txState.MinStep);
- }
-
+ << ", at schemeshard: " << ssId);
+ return false;
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ TTxState& txState = *context.SS->FindTx(operationId);
+
+ if (txState.MinStep < shardMinStep) {
+ txState.MinStep = shardMinStep;
+ context.SS->PersistTxMinStep(db, operationId, txState.MinStep);
+ }
+
auto shardIdx = context.SS->MustGetShardIdx(tabletId);
-
- // Ignore if this is a repeated message
- if (!txState.ShardsInProgress.contains(shardIdx)) {
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+
+ // Ignore if this is a repeated message
+ if (!txState.ShardsInProgress.contains(shardIdx)) {
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Ignore TEvProposeTransactionResult as duplicate"
<< ", shard: " << tabletId
- << ", shardIdx: " << shardIdx
- << ", operationId: " << operationId
- << ", at schemeshard: " << ssId);
- return false;
- }
-
- txState.ShardsInProgress.erase(shardIdx);
+ << ", shardIdx: " << shardIdx
+ << ", operationId: " << operationId
+ << ", at schemeshard: " << ssId);
+ return false;
+ }
+
+ txState.ShardsInProgress.erase(shardIdx);
context.OnComplete.UnbindMsgFromPipe(operationId, tabletId, shardIdx);
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"CollectProposeTransactionResults accept TEvProposeTransactionResult"
<< ", shard: " << tabletId
- << ", shardIdx: " << shardIdx
- << ", operationId: " << operationId
- << ", left await: " << txState.ShardsInProgress.size()
- << ", at schemeshard: " << ssId);
-
- if (txState.ShardsInProgress.empty()) {
- // All datashards have replied so we can proceed with this transaction
- context.SS->ChangeTxState(db, operationId, TTxState::Propose);
- return true;
- }
-
- return false;
-}
-
+ << ", shardIdx: " << shardIdx
+ << ", operationId: " << operationId
+ << ", left await: " << txState.ShardsInProgress.size()
+ << ", at schemeshard: " << ssId);
+
+ if (txState.ShardsInProgress.empty()) {
+ // All datashards have replied so we can proceed with this transaction
+ context.SS->ChangeTxState(db, operationId, TTxState::Propose);
+ return true;
+ }
+
+ return false;
+}
+
}
bool NTableState::CollectProposeTransactionResults(
- const NKikimr::NSchemeShard::TOperationId &operationId,
+ const NKikimr::NSchemeShard::TOperationId &operationId,
const TEvDataShard::TEvProposeTransactionResult::TPtr &ev,
- NKikimr::NSchemeShard::TOperationContext &context)
+ NKikimr::NSchemeShard::TOperationContext &context)
{
auto prepared = [](NKikimrTxDataShard::TEvProposeTransactionResult::EStatus status) -> bool {
return status == NKikimrTxDataShard::TEvProposeTransactionResult::PREPARED;
@@ -95,9 +95,9 @@ bool NTableState::CollectProposeTransactionResults(
}
bool NTableState::CollectProposeTransactionResults(
- const NKikimr::NSchemeShard::TOperationId& operationId,
+ const NKikimr::NSchemeShard::TOperationId& operationId,
const TEvColumnShard::TEvProposeTransactionResult::TPtr& ev,
- NKikimr::NSchemeShard::TOperationContext& context)
+ NKikimr::NSchemeShard::TOperationContext& context)
{
auto prepared = [](NKikimrTxColumnShard::EResultStatus status) -> bool {
return status == NKikimrTxColumnShard::EResultStatus::PREPARED;
@@ -110,174 +110,174 @@ bool NTableState::CollectProposeTransactionResults(
return CollectProposeTxResults(ev, operationId, context, prepared, toString);
}
-bool NTableState::CollectSchemaChanged(
- const TOperationId& operationId,
- const TEvDataShard::TEvSchemaChanged::TPtr& ev,
- TOperationContext& context)
-{
- auto ssId = context.SS->SelfTabletId();
-
- const auto& evRecord = ev->Get()->Record;
+bool NTableState::CollectSchemaChanged(
+ const TOperationId& operationId,
+ const TEvDataShard::TEvSchemaChanged::TPtr& ev,
+ TOperationContext& context)
+{
+ auto ssId = context.SS->SelfTabletId();
+
+ const auto& evRecord = ev->Get()->Record;
const TActorId ackTo = ev->Get()->GetSource();
-
- auto datashardId = TTabletId(evRecord.GetOrigin());
-
- Y_VERIFY(context.SS->FindTx(operationId));
- TTxState& txState = *context.SS->FindTx(operationId);
-
+
+ auto datashardId = TTabletId(evRecord.GetOrigin());
+
+ Y_VERIFY(context.SS->FindTx(operationId));
+ TTxState& txState = *context.SS->FindTx(operationId);
+
auto shardIdx = context.SS->MustGetShardIdx(datashardId);
- Y_VERIFY(context.SS->ShardInfos.contains(shardIdx));
-
- // Save this notification if was received earlier than the Tx swithched to ProposedWaitParts state
- ui32 generation = evRecord.GetGeneration();
- auto pTablet = txState.SchemeChangeNotificationReceived.FindPtr(shardIdx);
- if (pTablet && pTablet->second >= generation) {
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "CollectSchemaChanged Ignore TEvDataShard::TEvSchemaChanged as outdated"
- << ", operationId: " << operationId
- << ", shardIdx: " << shardIdx
- << ", datashard " << datashardId
- << ", event generation: " << generation
- << ", known generation: " << pTablet->second
- << ", at schemeshard: " << ssId);
- return false;
- }
-
- txState.SchemeChangeNotificationReceived[shardIdx] = std::make_pair(ackTo, generation);
-
+ Y_VERIFY(context.SS->ShardInfos.contains(shardIdx));
+
+ // Save this notification if was received earlier than the Tx swithched to ProposedWaitParts state
+ ui32 generation = evRecord.GetGeneration();
+ auto pTablet = txState.SchemeChangeNotificationReceived.FindPtr(shardIdx);
+ if (pTablet && pTablet->second >= generation) {
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "CollectSchemaChanged Ignore TEvDataShard::TEvSchemaChanged as outdated"
+ << ", operationId: " << operationId
+ << ", shardIdx: " << shardIdx
+ << ", datashard " << datashardId
+ << ", event generation: " << generation
+ << ", known generation: " << pTablet->second
+ << ", at schemeshard: " << ssId);
+ return false;
+ }
+
+ txState.SchemeChangeNotificationReceived[shardIdx] = std::make_pair(ackTo, generation);
+
if (evRecord.HasOpResult()) {
// TODO: remove TxBackup handling
Y_VERIFY_DEBUG(txState.TxType == TTxState::TxBackup || txState.TxType == TTxState::TxRestore);
}
- if (!txState.ReadyForNotifications) {
- return false;
- }
+ if (!txState.ReadyForNotifications) {
+ return false;
+ }
if (txState.TxType == TTxState::TxBackup || txState.TxType == TTxState::TxRestore) {
Y_VERIFY(txState.State == TTxState::ProposedWaitParts || txState.State == TTxState::Aborting);
- } else {
- Y_VERIFY(txState.State == TTxState::ProposedWaitParts);
- }
-
- txState.ShardsInProgress.erase(shardIdx);
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "CollectSchemaChanged accept TEvDataShard::TEvSchemaChanged"
- << ", operationId: " << operationId
- << ", shardIdx: " << shardIdx
- << ", datashard: " << datashardId
- << ", left await: " << txState.ShardsInProgress.size()
- << ", txState.State: " << TTxState::StateName(txState.State)
- << ", txState.ReadyForNotifications: " << txState.ReadyForNotifications
- << ", at schemeshard: " << ssId);
-
- if (txState.ShardsInProgress.empty()) {
- AckAllSchemaChanges(operationId, txState, context);
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, operationId, TTxState::Done);
- return true;
- }
-
- return false;
-}
-
-void NTableState::AckAllSchemaChanges(const TOperationId &operationId, TTxState &txState, TOperationContext &context) {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "all shard schema changes has been recieved"
- << ", operationId: " << operationId
- << ", at schemeshard: " << ssId);
-
- // Ack to all participating datashards
- for (const auto& items : txState.SchemeChangeNotificationReceived) {
+ } else {
+ Y_VERIFY(txState.State == TTxState::ProposedWaitParts);
+ }
+
+ txState.ShardsInProgress.erase(shardIdx);
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "CollectSchemaChanged accept TEvDataShard::TEvSchemaChanged"
+ << ", operationId: " << operationId
+ << ", shardIdx: " << shardIdx
+ << ", datashard: " << datashardId
+ << ", left await: " << txState.ShardsInProgress.size()
+ << ", txState.State: " << TTxState::StateName(txState.State)
+ << ", txState.ReadyForNotifications: " << txState.ReadyForNotifications
+ << ", at schemeshard: " << ssId);
+
+ if (txState.ShardsInProgress.empty()) {
+ AckAllSchemaChanges(operationId, txState, context);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, operationId, TTxState::Done);
+ return true;
+ }
+
+ return false;
+}
+
+void NTableState::AckAllSchemaChanges(const TOperationId &operationId, TTxState &txState, TOperationContext &context) {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "all shard schema changes has been recieved"
+ << ", operationId: " << operationId
+ << ", at schemeshard: " << ssId);
+
+ // Ack to all participating datashards
+ for (const auto& items : txState.SchemeChangeNotificationReceived) {
const TActorId ackTo = items.second.first;
- const auto shardIdx = items.first;
- const auto tabletId = context.SS->ShardInfos[shardIdx].TabletID;
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "send schema changes ack message"
- << ", operation: " << operationId
- << ", datashard: " << tabletId
- << ", at schemeshard: " << ssId);
-
- THolder<TEvDataShard::TEvSchemaChangedResult> event =
+ const auto shardIdx = items.first;
+ const auto tabletId = context.SS->ShardInfos[shardIdx].TabletID;
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "send schema changes ack message"
+ << ", operation: " << operationId
+ << ", datashard: " << tabletId
+ << ", at schemeshard: " << ssId);
+
+ THolder<TEvDataShard::TEvSchemaChangedResult> event =
THolder(new TEvDataShard::TEvSchemaChangedResult());
- event->Record.SetTxId(ui64(operationId.GetTxId()));
-
- context.OnComplete.Send(ackTo, std::move(event), ui64(shardIdx.GetLocalId()));
- }
-}
-
-bool NTableState::CheckPartitioningChangedForTableModification(TTxState &txState, TOperationContext &context) {
- Y_VERIFY(context.SS->Tables.contains(txState.TargetPathId));
- TTableInfo::TPtr table = context.SS->Tables.at(txState.TargetPathId);
-
- THashSet<TShardIdx> shardIdxsLeft;
- for (auto& shard : table->GetPartitions()) {
- shardIdxsLeft.insert(shard.ShardIdx);
- }
-
- for (auto& shardOp : txState.Shards) {
- // Is this shard still on the list of partitions?
- if (shardIdxsLeft.erase(shardOp.Idx) == 0)
- return true;
- }
-
- // Any new partitions?
- return !shardIdxsLeft.empty();
-}
-
-void NTableState::UpdatePartitioningForTableModification(TOperationId operationId, TTxState &txState, TOperationContext &context) {
- Y_VERIFY(!txState.TxShardsListFinalized, "Rebuilding the list of shards must not happen twice");
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- THashSet<TShardIdx> prevAlterCreateParts;
-
- // Delete old tx shards from db
- for (const auto& shard : txState.Shards) {
+ event->Record.SetTxId(ui64(operationId.GetTxId()));
+
+ context.OnComplete.Send(ackTo, std::move(event), ui64(shardIdx.GetLocalId()));
+ }
+}
+
+bool NTableState::CheckPartitioningChangedForTableModification(TTxState &txState, TOperationContext &context) {
+ Y_VERIFY(context.SS->Tables.contains(txState.TargetPathId));
+ TTableInfo::TPtr table = context.SS->Tables.at(txState.TargetPathId);
+
+ THashSet<TShardIdx> shardIdxsLeft;
+ for (auto& shard : table->GetPartitions()) {
+ shardIdxsLeft.insert(shard.ShardIdx);
+ }
+
+ for (auto& shardOp : txState.Shards) {
+ // Is this shard still on the list of partitions?
+ if (shardIdxsLeft.erase(shardOp.Idx) == 0)
+ return true;
+ }
+
+ // Any new partitions?
+ return !shardIdxsLeft.empty();
+}
+
+void NTableState::UpdatePartitioningForTableModification(TOperationId operationId, TTxState &txState, TOperationContext &context) {
+ Y_VERIFY(!txState.TxShardsListFinalized, "Rebuilding the list of shards must not happen twice");
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ THashSet<TShardIdx> prevAlterCreateParts;
+
+ // Delete old tx shards from db
+ for (const auto& shard : txState.Shards) {
if (txState.TxType == TTxState::TxAlterTable && shard.Operation == TTxState::CreateParts) {
// Remember alter table parts that had CreateParts set (possible channel bindings change)
prevAlterCreateParts.insert(shard.Idx);
}
- context.SS->PersistRemoveTxShard(db, operationId, shard.Idx);
- }
- txState.Shards.clear();
- Y_VERIFY(txState.ShardsInProgress.empty());
-
- Y_VERIFY(context.SS->Tables.contains(txState.TargetPathId));
- TTableInfo::TPtr table = context.SS->Tables.at(txState.TargetPathId);
+ context.SS->PersistRemoveTxShard(db, operationId, shard.Idx);
+ }
+ txState.Shards.clear();
+ Y_VERIFY(txState.ShardsInProgress.empty());
+
+ Y_VERIFY(context.SS->Tables.contains(txState.TargetPathId));
+ TTableInfo::TPtr table = context.SS->Tables.at(txState.TargetPathId);
TTxState::ETxState commonShardOp = TTxState::CreateParts;
-
- if (txState.TxType == TTxState::TxAlterTable) {
+
+ if (txState.TxType == TTxState::TxAlterTable) {
commonShardOp = table->NeedRecreateParts()
- ? TTxState::CreateParts
- : TTxState::ConfigureParts;
- } else if (txState.TxType == TTxState::TxDropTable) {
+ ? TTxState::CreateParts
+ : TTxState::ConfigureParts;
+ } else if (txState.TxType == TTxState::TxDropTable) {
commonShardOp = TTxState::DropParts;
- } else if (txState.TxType == TTxState::TxBackup) {
+ } else if (txState.TxType == TTxState::TxBackup) {
commonShardOp = TTxState::ConfigureParts;
} else if (txState.TxType == TTxState::TxRestore) {
commonShardOp = TTxState::ConfigureParts;
- } else if (txState.TxType == TTxState::TxInitializeBuildIndex) {
- commonShardOp = TTxState::ConfigureParts;
- } else if (txState.TxType == TTxState::TxFinalizeBuildIndex) {
- commonShardOp = TTxState::ConfigureParts;
- } else if (txState.TxType == TTxState::TxDropTableIndexAtMainTable) {
- commonShardOp = TTxState::ConfigureParts;
+ } else if (txState.TxType == TTxState::TxInitializeBuildIndex) {
+ commonShardOp = TTxState::ConfigureParts;
+ } else if (txState.TxType == TTxState::TxFinalizeBuildIndex) {
+ commonShardOp = TTxState::ConfigureParts;
+ } else if (txState.TxType == TTxState::TxDropTableIndexAtMainTable) {
+ commonShardOp = TTxState::ConfigureParts;
} else if (txState.TxType == TTxState::TxCreateCdcStreamAtTable) {
commonShardOp = TTxState::ConfigureParts;
} else if (txState.TxType == TTxState::TxAlterCdcStreamAtTable) {
commonShardOp = TTxState::ConfigureParts;
} else if (txState.TxType == TTxState::TxDropCdcStreamAtTable) {
commonShardOp = TTxState::ConfigureParts;
- } else {
- Y_FAIL("UNREACHABLE");
- }
-
+ } else {
+ Y_FAIL("UNREACHABLE");
+ }
+
TBindingsRoomsChanges bindingChanges;
bool tryApplyBindingChanges = (
@@ -299,17 +299,17 @@ void NTableState::UpdatePartitioningForTableModification(TOperationId operationI
}
}
- // Fill new list of tx shards
- for (auto& shard : table->GetPartitions()) {
- auto shardIdx = shard.ShardIdx;
+ // Fill new list of tx shards
+ for (auto& shard : table->GetPartitions()) {
+ auto shardIdx = shard.ShardIdx;
Y_VERIFY(context.SS->ShardInfos.contains(shardIdx));
auto& shardInfo = context.SS->ShardInfos.at(shardIdx);
auto shardOp = commonShardOp;
if (txState.TxType == TTxState::TxAlterTable) {
if (tryApplyBindingChanges && shardInfo.BindedChannels) {
- auto it = bindingChanges.find(GetPoolsMapping(shardInfo.BindedChannels));
- if (it != bindingChanges.end()) {
+ auto it = bindingChanges.find(GetPoolsMapping(shardInfo.BindedChannels));
+ if (it != bindingChanges.end()) {
if (it->second.ChannelsBindingsUpdated) {
// We must recreate this shard to apply new channel bindings
shardOp = TTxState::CreateParts;
@@ -330,90 +330,90 @@ void NTableState::UpdatePartitioningForTableModification(TOperationId operationI
}
}
- txState.Shards.emplace_back(shardIdx, ETabletType::DataShard, shardOp);
-
+ txState.Shards.emplace_back(shardIdx, ETabletType::DataShard, shardOp);
+
shardInfo.CurrentTxId = operationId.GetTxId();
- context.SS->PersistShardTx(db, shardIdx, operationId.GetTxId());
- context.SS->PersistUpdateTxShard(db, operationId, shardIdx, shardOp);
- }
- txState.TxShardsListFinalized = true;
-}
-
-bool NTableState::SourceTablePartitioningChangedForCopyTable(const TTxState &txState, TOperationContext &context) {
- Y_VERIFY(txState.SourcePathId != InvalidPathId);
- Y_VERIFY(txState.TargetPathId != InvalidPathId);
- const TTableInfo::TPtr srcTableInfo = *context.SS->Tables.FindPtr(txState.SourcePathId);
-
- THashSet<TShardIdx> srcShardIdxsLeft;
- for (const auto& p : srcTableInfo->GetPartitions()) {
- srcShardIdxsLeft.insert(p.ShardIdx);
- }
-
- for (const auto& shard : txState.Shards) {
- // Skip shards of the new table
- if (shard.Operation == TTxState::CreateParts)
- continue;
-
- Y_VERIFY(shard.Operation == TTxState::ConfigureParts);
- // Is this shard still present in src table partitioning?
- if (srcShardIdxsLeft.erase(shard.Idx) == 0)
- return true;
- }
-
- // Any new shards were added to src table?
- return !srcShardIdxsLeft.empty();
-}
-
-void NTableState::UpdatePartitioningForCopyTable(TOperationId operationId, TTxState &txState, TOperationContext &context) {
- Y_VERIFY(!txState.TxShardsListFinalized, "CopyTable can adjust partitioning only once");
-
- // Source table must not be altered or drop while we are performing copying. So we put it into a special state.
- Y_VERIFY(context.SS->PathsById.contains(txState.SourcePathId));
- Y_VERIFY(context.SS->PathsById.at(txState.SourcePathId)->PathState == TPathElement::EPathState::EPathStateCopying);
- Y_VERIFY(context.SS->PathsById.contains(txState.TargetPathId));
- auto dstPath = context.SS->PathsById.at(txState.TargetPathId);
- auto domainInfo = context.SS->SubDomains.at(dstPath->DomainPathId);
-
- auto srcTableInfo = context.SS->Tables.at(txState.SourcePathId);
- auto dstTableInfo = context.SS->Tables.at(txState.TargetPathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- // Erase previous partitioning as we are going to generate new one
- context.SS->DeleteTablePartitioning(db, txState.TargetPathId, dstTableInfo);
-
- // Remove old shardIdx info and old txShards
- for (const auto& shard : txState.Shards) {
- context.SS->PersistRemoveTxShard(db, operationId, shard.Idx);
- if (shard.Operation == TTxState::CreateParts) {
- Y_VERIFY(context.SS->ShardInfos.contains(shard.Idx));
- Y_VERIFY(context.SS->ShardInfos[shard.Idx].TabletID == InvalidTabletId, "Dst shard must not exist yet");
+ context.SS->PersistShardTx(db, shardIdx, operationId.GetTxId());
+ context.SS->PersistUpdateTxShard(db, operationId, shardIdx, shardOp);
+ }
+ txState.TxShardsListFinalized = true;
+}
+
+bool NTableState::SourceTablePartitioningChangedForCopyTable(const TTxState &txState, TOperationContext &context) {
+ Y_VERIFY(txState.SourcePathId != InvalidPathId);
+ Y_VERIFY(txState.TargetPathId != InvalidPathId);
+ const TTableInfo::TPtr srcTableInfo = *context.SS->Tables.FindPtr(txState.SourcePathId);
+
+ THashSet<TShardIdx> srcShardIdxsLeft;
+ for (const auto& p : srcTableInfo->GetPartitions()) {
+ srcShardIdxsLeft.insert(p.ShardIdx);
+ }
+
+ for (const auto& shard : txState.Shards) {
+ // Skip shards of the new table
+ if (shard.Operation == TTxState::CreateParts)
+ continue;
+
+ Y_VERIFY(shard.Operation == TTxState::ConfigureParts);
+ // Is this shard still present in src table partitioning?
+ if (srcShardIdxsLeft.erase(shard.Idx) == 0)
+ return true;
+ }
+
+ // Any new shards were added to src table?
+ return !srcShardIdxsLeft.empty();
+}
+
+void NTableState::UpdatePartitioningForCopyTable(TOperationId operationId, TTxState &txState, TOperationContext &context) {
+ Y_VERIFY(!txState.TxShardsListFinalized, "CopyTable can adjust partitioning only once");
+
+ // Source table must not be altered or drop while we are performing copying. So we put it into a special state.
+ Y_VERIFY(context.SS->PathsById.contains(txState.SourcePathId));
+ Y_VERIFY(context.SS->PathsById.at(txState.SourcePathId)->PathState == TPathElement::EPathState::EPathStateCopying);
+ Y_VERIFY(context.SS->PathsById.contains(txState.TargetPathId));
+ auto dstPath = context.SS->PathsById.at(txState.TargetPathId);
+ auto domainInfo = context.SS->SubDomains.at(dstPath->DomainPathId);
+
+ auto srcTableInfo = context.SS->Tables.at(txState.SourcePathId);
+ auto dstTableInfo = context.SS->Tables.at(txState.TargetPathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ // Erase previous partitioning as we are going to generate new one
+ context.SS->DeleteTablePartitioning(db, txState.TargetPathId, dstTableInfo);
+
+ // Remove old shardIdx info and old txShards
+ for (const auto& shard : txState.Shards) {
+ context.SS->PersistRemoveTxShard(db, operationId, shard.Idx);
+ if (shard.Operation == TTxState::CreateParts) {
+ Y_VERIFY(context.SS->ShardInfos.contains(shard.Idx));
+ Y_VERIFY(context.SS->ShardInfos[shard.Idx].TabletID == InvalidTabletId, "Dst shard must not exist yet");
auto pathId = context.SS->ShardInfos[shard.Idx].PathId;
dstTableInfo->PerShardPartitionConfig.erase(shard.Idx);
- context.SS->PersistShardDeleted(db, shard.Idx, context.SS->ShardInfos[shard.Idx].BindedChannels);
- context.SS->ShardInfos.erase(shard.Idx);
- domainInfo->RemoveInternalShard(shard.Idx);
- context.SS->DecrementPathDbRefCount(pathId, "remove shard from txState");
- }
- }
- txState.Shards.clear();
-
- TChannelsBindings channelsBinding;
-
+ context.SS->PersistShardDeleted(db, shard.Idx, context.SS->ShardInfos[shard.Idx].BindedChannels);
+ context.SS->ShardInfos.erase(shard.Idx);
+ domainInfo->RemoveInternalShard(shard.Idx);
+ context.SS->DecrementPathDbRefCount(pathId, "remove shard from txState");
+ }
+ }
+ txState.Shards.clear();
+
+ TChannelsBindings channelsBinding;
+
bool storePerShardConfig = false;
- NKikimrSchemeOp::TPartitionConfig perShardConfig;
+ NKikimrSchemeOp::TPartitionConfig perShardConfig;
- if (context.SS->IsStorageConfigLogic(dstTableInfo)) {
+ if (context.SS->IsStorageConfigLogic(dstTableInfo)) {
TVector<TStorageRoom> storageRooms;
storageRooms.emplace_back(0);
THashMap<ui32, ui32> familyRooms;
- TString errStr;
+ TString errStr;
bool isOk = context.SS->GetBindingsRooms(dstPath->DomainPathId, dstTableInfo->PartitionConfig(), storageRooms, familyRooms, channelsBinding, errStr);
- if (!isOk) {
- errStr = TString("database must have required storage pools to create tablet with storage config, details: ") + errStr;
- Y_FAIL("%s", errStr.c_str());
- }
+ if (!isOk) {
+ errStr = TString("database must have required storage pools to create tablet with storage config, details: ") + errStr;
+ Y_FAIL("%s", errStr.c_str());
+ }
storePerShardConfig = true;
for (const auto& room : storageRooms) {
@@ -424,141 +424,141 @@ void NTableState::UpdatePartitioningForCopyTable(TOperationId operationId, TTxSt
protoFamily->SetId(familyRoom.first);
protoFamily->SetRoom(familyRoom.second);
}
- } else if (context.SS->IsCompatibleChannelProfileLogic(dstPath->DomainPathId, dstTableInfo)) {
- TString errStr;
- bool isOk = context.SS->GetChannelsBindings(dstPath->DomainPathId, dstTableInfo, channelsBinding, errStr);
- if (!isOk) {
- errStr = TString("database must have required storage pools to create tablet with channel profile, details: ") + errStr;
- Y_FAIL("%s", errStr.c_str());
- }
- }
-
- TShardInfo datashardInfo = TShardInfo::DataShardInfo(operationId.GetTxId(), txState.TargetPathId);
- datashardInfo.BindedChannels = channelsBinding;
-
+ } else if (context.SS->IsCompatibleChannelProfileLogic(dstPath->DomainPathId, dstTableInfo)) {
+ TString errStr;
+ bool isOk = context.SS->GetChannelsBindings(dstPath->DomainPathId, dstTableInfo, channelsBinding, errStr);
+ if (!isOk) {
+ errStr = TString("database must have required storage pools to create tablet with channel profile, details: ") + errStr;
+ Y_FAIL("%s", errStr.c_str());
+ }
+ }
+
+ TShardInfo datashardInfo = TShardInfo::DataShardInfo(operationId.GetTxId(), txState.TargetPathId);
+ datashardInfo.BindedChannels = channelsBinding;
+
context.SS->SetPartitioning(txState.TargetPathId, dstTableInfo,
ApplyPartitioningCopyTable(datashardInfo, srcTableInfo, txState, context.SS));
- ui32 newShardCout = dstTableInfo->GetPartitions().size();
-
- dstPath->SetShardsInside(newShardCout);
- domainInfo->AddInternalShards(txState);
-
- context.SS->PersistTable(db, txState.TargetPathId);
- context.SS->PersistTxState(db, operationId);
-
- context.SS->PersistUpdateNextPathId(db);
- context.SS->PersistUpdateNextShardIdx(db);
- // Persist new shards info
- for (const auto& shard : dstTableInfo->GetPartitions()) {
- Y_VERIFY(context.SS->ShardInfos.contains(shard.ShardIdx), "shard info is set before");
- const auto tabletType = context.SS->ShardInfos[shard.ShardIdx].TabletType;
- context.SS->PersistShardMapping(db, shard.ShardIdx, InvalidTabletId, txState.TargetPathId, operationId.GetTxId(), tabletType);
- context.SS->PersistChannelsBinding(db, shard.ShardIdx, channelsBinding);
+ ui32 newShardCout = dstTableInfo->GetPartitions().size();
+
+ dstPath->SetShardsInside(newShardCout);
+ domainInfo->AddInternalShards(txState);
+
+ context.SS->PersistTable(db, txState.TargetPathId);
+ context.SS->PersistTxState(db, operationId);
+
+ context.SS->PersistUpdateNextPathId(db);
+ context.SS->PersistUpdateNextShardIdx(db);
+ // Persist new shards info
+ for (const auto& shard : dstTableInfo->GetPartitions()) {
+ Y_VERIFY(context.SS->ShardInfos.contains(shard.ShardIdx), "shard info is set before");
+ const auto tabletType = context.SS->ShardInfos[shard.ShardIdx].TabletType;
+ context.SS->PersistShardMapping(db, shard.ShardIdx, InvalidTabletId, txState.TargetPathId, operationId.GetTxId(), tabletType);
+ context.SS->PersistChannelsBinding(db, shard.ShardIdx, channelsBinding);
if (storePerShardConfig) {
dstTableInfo->PerShardPartitionConfig[shard.ShardIdx].CopyFrom(perShardConfig);
context.SS->PersistAddTableShardPartitionConfig(db, shard.ShardIdx, perShardConfig);
}
- }
-
- txState.TxShardsListFinalized = true;
-}
-
-TVector<TTableShardInfo> NTableState::ApplyPartitioningCopyTable(const TShardInfo &templateDatashardInfo, TTableInfo::TPtr srcTableInfo, TTxState &txState, TSchemeShard *ss) {
- TVector<TTableShardInfo> dstPartitions = srcTableInfo->GetPartitions();
-
- // Source table must not be altered or drop while we are performing copying. So we put it into a special state.
- ui64 count = dstPartitions.size();
- txState.Shards.reserve(count*2);
- for (ui64 i = 0; i < count; ++i) {
- // Source shards need to get "Send parts" transaction
- auto srcShardIdx = srcTableInfo->GetPartitions()[i].ShardIdx;
- Y_VERIFY(ss->ShardInfos.contains(srcShardIdx), "Source table shard not found");
- auto srcTabletId = ss->ShardInfos[srcShardIdx].TabletID;
- Y_VERIFY(srcTabletId != InvalidTabletId);
- txState.Shards.emplace_back(srcShardIdx, ETabletType::DataShard, TTxState::ConfigureParts);
- // Destination shards need to be created, configured and then they will receive parts
+ }
+
+ txState.TxShardsListFinalized = true;
+}
+
+TVector<TTableShardInfo> NTableState::ApplyPartitioningCopyTable(const TShardInfo &templateDatashardInfo, TTableInfo::TPtr srcTableInfo, TTxState &txState, TSchemeShard *ss) {
+ TVector<TTableShardInfo> dstPartitions = srcTableInfo->GetPartitions();
+
+ // Source table must not be altered or drop while we are performing copying. So we put it into a special state.
+ ui64 count = dstPartitions.size();
+ txState.Shards.reserve(count*2);
+ for (ui64 i = 0; i < count; ++i) {
+ // Source shards need to get "Send parts" transaction
+ auto srcShardIdx = srcTableInfo->GetPartitions()[i].ShardIdx;
+ Y_VERIFY(ss->ShardInfos.contains(srcShardIdx), "Source table shard not found");
+ auto srcTabletId = ss->ShardInfos[srcShardIdx].TabletID;
+ Y_VERIFY(srcTabletId != InvalidTabletId);
+ txState.Shards.emplace_back(srcShardIdx, ETabletType::DataShard, TTxState::ConfigureParts);
+ // Destination shards need to be created, configured and then they will receive parts
auto idx = ss->RegisterShardInfo(templateDatashardInfo);
- txState.Shards.emplace_back(idx, ETabletType::DataShard, TTxState::CreateParts);
- // Properly set new shard idx
- dstPartitions[i].ShardIdx = idx;
- }
-
- return dstPartitions;
-}
-
-TSet<ui32> AllIncomingEvents() {
- TSet<ui32> result;
-
-#define AddToList(TEvType, TxType) \
- result.insert(TEvType::EventType);
-
- SCHEMESHARD_INCOMING_EVENTS(AddToList)
-#undef AddToList
-
- return result;
-}
-
-void NForceDrop::CollectShards(const THashSet<TPathId>& pathes, TOperationId operationId, TTxState *txState, TOperationContext &context) {
- NIceDb::TNiceDb db(context.Txc.DB);
-
- auto shards = context.SS->CollectAllShards(pathes);
- for (auto shardIdx: shards) {
- Y_VERIFY_S(context.SS->ShardInfos.contains(shardIdx), "Unknown shardIdx " << shardIdx);
- auto& shardInfo = context.SS->ShardInfos.at(shardIdx);
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Collect shard"
- << ", shard idx: " << shardIdx
- << ", tabletID: " << shardInfo.TabletID
- << ", path id: " << shardInfo.PathId);
-
- txState->Shards.emplace_back(shardIdx, shardInfo.TabletType, txState->State);
-
- shardInfo.CurrentTxId = operationId.GetTxId();
- context.SS->PersistShardTx(db, shardIdx, operationId.GetTxId());
-
- if (TTabletTypes::DataShard == shardInfo.TabletType) {
- context.SS->TabletCounters->Simple()[COUNTER_TABLE_SHARD_ACTIVE_COUNT].Sub(1);
- context.SS->TabletCounters->Simple()[COUNTER_TABLE_SHARD_INACTIVE_COUNT].Add(1);
- }
- }
-
- context.SS->PersistTxState(db, operationId);
-}
-
-void NForceDrop::ValidateNoTrasactionOnPathes(TOperationId operationId, const THashSet<TPathId>& pathes, TOperationContext &context) {
- // it is not supposed that someone transaction is able to materialise in dropping subdomain
- // all transaction should check parent dir status
- // however, it is better to check that all locks are ours
- auto transactions = context.SS->GetRelatedTransactions(pathes, context.Ctx);
- for (auto otherTxId: transactions) {
- if (otherTxId == operationId.GetTxId()) {
- continue;
- }
- Y_VERIFY_S(false, "transaction: " << otherTxId << " found on deleted subdomain");
- }
-}
-
-void IncParentDirAlterVersionWithRepublish(const TOperationId& opId, const TPath& path, TOperationContext &context) {
- NIceDb::TNiceDb db(context.Txc.DB);
-
- auto parent = path.Parent();
- if (parent.Base()->IsDirectory() || parent.Base()->IsDomainRoot()) {
- ++parent.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parent.Base());
- }
-
- if (parent.IsActive()) {
- context.SS->ClearDescribePathCaches(parent.Base());
- context.OnComplete.PublishToSchemeBoard(opId, parent->PathId);
- }
-
- if (path.IsActive()) {
- context.SS->ClearDescribePathCaches(path.Base());
- context.OnComplete.PublishToSchemeBoard(opId, path->PathId);
- }
-}
-
-}
-}
+ txState.Shards.emplace_back(idx, ETabletType::DataShard, TTxState::CreateParts);
+ // Properly set new shard idx
+ dstPartitions[i].ShardIdx = idx;
+ }
+
+ return dstPartitions;
+}
+
+TSet<ui32> AllIncomingEvents() {
+ TSet<ui32> result;
+
+#define AddToList(TEvType, TxType) \
+ result.insert(TEvType::EventType);
+
+ SCHEMESHARD_INCOMING_EVENTS(AddToList)
+#undef AddToList
+
+ return result;
+}
+
+void NForceDrop::CollectShards(const THashSet<TPathId>& pathes, TOperationId operationId, TTxState *txState, TOperationContext &context) {
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ auto shards = context.SS->CollectAllShards(pathes);
+ for (auto shardIdx: shards) {
+ Y_VERIFY_S(context.SS->ShardInfos.contains(shardIdx), "Unknown shardIdx " << shardIdx);
+ auto& shardInfo = context.SS->ShardInfos.at(shardIdx);
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Collect shard"
+ << ", shard idx: " << shardIdx
+ << ", tabletID: " << shardInfo.TabletID
+ << ", path id: " << shardInfo.PathId);
+
+ txState->Shards.emplace_back(shardIdx, shardInfo.TabletType, txState->State);
+
+ shardInfo.CurrentTxId = operationId.GetTxId();
+ context.SS->PersistShardTx(db, shardIdx, operationId.GetTxId());
+
+ if (TTabletTypes::DataShard == shardInfo.TabletType) {
+ context.SS->TabletCounters->Simple()[COUNTER_TABLE_SHARD_ACTIVE_COUNT].Sub(1);
+ context.SS->TabletCounters->Simple()[COUNTER_TABLE_SHARD_INACTIVE_COUNT].Add(1);
+ }
+ }
+
+ context.SS->PersistTxState(db, operationId);
+}
+
+void NForceDrop::ValidateNoTrasactionOnPathes(TOperationId operationId, const THashSet<TPathId>& pathes, TOperationContext &context) {
+ // it is not supposed that someone transaction is able to materialise in dropping subdomain
+ // all transaction should check parent dir status
+ // however, it is better to check that all locks are ours
+ auto transactions = context.SS->GetRelatedTransactions(pathes, context.Ctx);
+ for (auto otherTxId: transactions) {
+ if (otherTxId == operationId.GetTxId()) {
+ continue;
+ }
+ Y_VERIFY_S(false, "transaction: " << otherTxId << " found on deleted subdomain");
+ }
+}
+
+void IncParentDirAlterVersionWithRepublish(const TOperationId& opId, const TPath& path, TOperationContext &context) {
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ auto parent = path.Parent();
+ if (parent.Base()->IsDirectory() || parent.Base()->IsDomainRoot()) {
+ ++parent.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parent.Base());
+ }
+
+ if (parent.IsActive()) {
+ context.SS->ClearDescribePathCaches(parent.Base());
+ context.OnComplete.PublishToSchemeBoard(opId, parent->PathId);
+ }
+
+ if (path.IsActive()) {
+ context.SS->ClearDescribePathCaches(path.Base());
+ context.OnComplete.PublishToSchemeBoard(opId, path->PathId);
+ }
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_common.h b/ydb/core/tx/schemeshard/schemeshard__operation_common.h
index 92ee25d84ce..5a3da32cade 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_common.h
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_common.h
@@ -1,312 +1,312 @@
-#pragma once
-
-#include "schemeshard__operation_part.h"
-#include "schemeshard_impl.h"
+#pragma once
+
+#include "schemeshard__operation_part.h"
+#include "schemeshard_impl.h"
#include <ydb/core/tx/columnshard/columnshard.h>
#include <ydb/core/base/subdomain.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-TSet<ui32> AllIncomingEvents();
-
-void IncParentDirAlterVersionWithRepublish(const TOperationId& opId, const TPath& path, TOperationContext& context);
-
-namespace NTableState {
-
-bool CollectProposeTransactionResults(const TOperationId& operationId, const TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context);
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+TSet<ui32> AllIncomingEvents();
+
+void IncParentDirAlterVersionWithRepublish(const TOperationId& opId, const TPath& path, TOperationContext& context);
+
+namespace NTableState {
+
+bool CollectProposeTransactionResults(const TOperationId& operationId, const TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context);
bool CollectProposeTransactionResults(const TOperationId& operationId, const TEvColumnShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context);
-bool CollectSchemaChanged(const TOperationId& operationId, const TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context);
-
+bool CollectSchemaChanged(const TOperationId& operationId, const TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context);
+
void SendSchemaChangedNotificationAck(const TOperationId& operationId, TActorId ackTo, TShardIdx shardIdx, TOperationContext& context);
-void AckAllSchemaChanges(const TOperationId& operationId, TTxState& txState, TOperationContext& context);
-
-bool CheckPartitioningChangedForTableModification(TTxState& txState, TOperationContext& context);
-void UpdatePartitioningForTableModification(TOperationId txId, TTxState& txState, TOperationContext& context);
-
-TVector<TTableShardInfo> ApplyPartitioningCopyTable(const TShardInfo& templateDatashardInfo, TTableInfo::TPtr srcTableInfo, TTxState& txState, TSchemeShard* ss);
-
-bool SourceTablePartitioningChangedForCopyTable(const TTxState& txState, TOperationContext& context);
-void UpdatePartitioningForCopyTable(TOperationId operationId, TTxState& txState, TOperationContext& context);
-
-class TProposedWaitParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+void AckAllSchemaChanges(const TOperationId& operationId, TTxState& txState, TOperationContext& context);
+
+bool CheckPartitioningChangedForTableModification(TTxState& txState, TOperationContext& context);
+void UpdatePartitioningForTableModification(TOperationId txId, TTxState& txState, TOperationContext& context);
+
+TVector<TTableShardInfo> ApplyPartitioningCopyTable(const TShardInfo& templateDatashardInfo, TTableInfo::TPtr srcTableInfo, TTxState& txState, TSchemeShard* ss);
+
+bool SourceTablePartitioningChangedForCopyTable(const TTxState& txState, TOperationContext& context);
+void UpdatePartitioningForCopyTable(TOperationId operationId, TTxState& txState, TOperationContext& context);
+
+class TProposedWaitParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "NTableState::TProposedWaitParts"
- << " operationId# " << OperationId;
- }
-
-public:
- TProposedWaitParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(),
- { TEvHive::TEvCreateTabletReply::EventType
- , TEvDataShard::TEvProposeTransactionResult::EventType
- , TEvPrivate::TEvOperationPlan::EventType }
- );
- }
-
- bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- const auto& evRecord = ev->Get()->Record;
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvSchemaChanged"
- << " at tablet: " << ssId);
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvSchemaChanged"
- << " at tablet: " << ssId
- << " message: " << evRecord.ShortDebugString());
-
- if (!NTableState::CollectSchemaChanged(OperationId, ev, context)) {
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvSchemaChanged"
- << " CollectSchemaChanged: false");
- return false;
- }
-
- Y_VERIFY(context.SS->FindTx(OperationId));
- TTxState& txState = *context.SS->FindTx(OperationId);
-
- if (!txState.ReadyForNotifications) {
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvSchemaChanged"
- << " ReadyForNotifications: false");
- return false;
- }
-
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << " at tablet: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- txState->ClearShardsInProgress();
- for (TTxState::TShardOperation& shard : txState->Shards) {
- if (shard.Operation < TTxState::ProposedWaitParts) {
- shard.Operation = TTxState::ProposedWaitParts;
- context.SS->PersistUpdateTxShard(db, OperationId, shard.Idx, shard.Operation);
- }
- Y_VERIFY(context.SS->ShardInfos.contains(shard.Idx));
- context.OnComplete.RouteByTablet(OperationId, context.SS->ShardInfos.at(shard.Idx).TabletID);
- }
- txState->UpdateShardsInProgress(TTxState::ProposedWaitParts);
-
- // Move all notifications that were already received
- // NOTE: SchemeChangeNotification is sent form DS after it has got PlanStep from coordinator and the schema tx has completed
- // At that moment the SS might not have received PlanStep from coordinator yet (this message might be still on its way to SS)
- // So we are going to accumulate SchemeChangeNotification that are received before this Tx switches to WaitParts state
- txState->AcceptPendingSchemeNotification();
-
- // Got notifications from all datashards?
- if (txState->ShardsInProgress.empty()) {
- NTableState::AckAllSchemaChanges(OperationId, *txState, context);
- context.SS->ChangeTxState(db, OperationId, TTxState::Done);
- return true;
- }
-
- return false;
- }
-};
-
-}
-
-namespace NSubDomainState {
-
-class TConfigureParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ return TStringBuilder()
+ << "NTableState::TProposedWaitParts"
+ << " operationId# " << OperationId;
+ }
+
+public:
+ TProposedWaitParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(),
+ { TEvHive::TEvCreateTabletReply::EventType
+ , TEvDataShard::TEvProposeTransactionResult::EventType
+ , TEvPrivate::TEvOperationPlan::EventType }
+ );
+ }
+
+ bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ const auto& evRecord = ev->Get()->Record;
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvSchemaChanged"
+ << " at tablet: " << ssId);
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvSchemaChanged"
+ << " at tablet: " << ssId
+ << " message: " << evRecord.ShortDebugString());
+
+ if (!NTableState::CollectSchemaChanged(OperationId, ev, context)) {
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvSchemaChanged"
+ << " CollectSchemaChanged: false");
+ return false;
+ }
+
+ Y_VERIFY(context.SS->FindTx(OperationId));
+ TTxState& txState = *context.SS->FindTx(OperationId);
+
+ if (!txState.ReadyForNotifications) {
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvSchemaChanged"
+ << " ReadyForNotifications: false");
+ return false;
+ }
+
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << " at tablet: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ txState->ClearShardsInProgress();
+ for (TTxState::TShardOperation& shard : txState->Shards) {
+ if (shard.Operation < TTxState::ProposedWaitParts) {
+ shard.Operation = TTxState::ProposedWaitParts;
+ context.SS->PersistUpdateTxShard(db, OperationId, shard.Idx, shard.Operation);
+ }
+ Y_VERIFY(context.SS->ShardInfos.contains(shard.Idx));
+ context.OnComplete.RouteByTablet(OperationId, context.SS->ShardInfos.at(shard.Idx).TabletID);
+ }
+ txState->UpdateShardsInProgress(TTxState::ProposedWaitParts);
+
+ // Move all notifications that were already received
+ // NOTE: SchemeChangeNotification is sent form DS after it has got PlanStep from coordinator and the schema tx has completed
+ // At that moment the SS might not have received PlanStep from coordinator yet (this message might be still on its way to SS)
+ // So we are going to accumulate SchemeChangeNotification that are received before this Tx switches to WaitParts state
+ txState->AcceptPendingSchemeNotification();
+
+ // Got notifications from all datashards?
+ if (txState->ShardsInProgress.empty()) {
+ NTableState::AckAllSchemaChanges(OperationId, *txState, context);
+ context.SS->ChangeTxState(db, OperationId, TTxState::Done);
+ return true;
+ }
+
+ return false;
+ }
+};
+
+}
+
+namespace NSubDomainState {
+
+class TConfigureParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "NSubDomainState::TConfigureParts"
- << " operationId#" << OperationId;
- }
-public:
- TConfigureParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
- }
-
- bool HandleReply(TEvSchemeShard::TEvInitTenantSchemeShardResult::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint()
- << " HandleReply TEvInitTenantSchemeShardResult"
- << " operationId: " << OperationId
- << " at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreateSubDomain
- || txState->TxType == TTxState::TxAlterSubDomain
- || txState->TxType == TTxState::TxAlterExtSubDomain);
-
- const auto& record = ev->Get()->Record;
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- TTabletId tabletId = TTabletId(record.GetTenantSchemeShard());
- auto status = record.GetStatus();
-
+ return TStringBuilder()
+ << "NSubDomainState::TConfigureParts"
+ << " operationId#" << OperationId;
+ }
+public:
+ TConfigureParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
+ }
+
+ bool HandleReply(TEvSchemeShard::TEvInitTenantSchemeShardResult::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint()
+ << " HandleReply TEvInitTenantSchemeShardResult"
+ << " operationId: " << OperationId
+ << " at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateSubDomain
+ || txState->TxType == TTxState::TxAlterSubDomain
+ || txState->TxType == TTxState::TxAlterExtSubDomain);
+
+ const auto& record = ev->Get()->Record;
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ TTabletId tabletId = TTabletId(record.GetTenantSchemeShard());
+ auto status = record.GetStatus();
+
auto shardIdx = context.SS->MustGetShardIdx(tabletId);
- Y_VERIFY(context.SS->ShardInfos.contains(shardIdx));
-
- if (status != NKikimrScheme::EStatus::StatusSuccess && status != NKikimrScheme::EStatus::StatusAlreadyExists) {
- LOG_CRIT_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint()
- << " Got error status on SubDomain Configure"
- << "from tenant schemeshard tablet: " << tabletId
- << " shard: " << shardIdx
- << " status: " << NKikimrScheme::EStatus_Name(status)
- << " opId: " << OperationId
- << " schemeshard: " << ssId);
- return false;
- }
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint()
- << " Got OK TEvInitTenantSchemeShardResult from schemeshard"
- << " tablet: " << tabletId
- << " shardIdx: " << shardIdx
- << " at schemeshard: " << ssId);
-
- txState->ShardsInProgress.erase(shardIdx);
- context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, shardIdx);
-
- if (txState->ShardsInProgress.empty()) {
- // All tablets have replied so we can done this transaction
- context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
- context.OnComplete.ActivateTx(OperationId);
- return true;
- }
-
- return false;
- }
-
- bool HandleReply(TEvSubDomain::TEvConfigureStatus::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint()
- << " HandleReply TEvConfigureStatus"
- << " operationId:" << OperationId
- << " at schemeshard:" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreateSubDomain
- || txState->TxType == TTxState::TxAlterSubDomain
- || txState->TxType == TTxState::TxAlterExtSubDomain);
-
- const auto& record = ev->Get()->Record;
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- TTabletId tabletId = TTabletId(record.GetOnTabletId());
- auto status = record.GetStatus();
-
+ Y_VERIFY(context.SS->ShardInfos.contains(shardIdx));
+
+ if (status != NKikimrScheme::EStatus::StatusSuccess && status != NKikimrScheme::EStatus::StatusAlreadyExists) {
+ LOG_CRIT_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint()
+ << " Got error status on SubDomain Configure"
+ << "from tenant schemeshard tablet: " << tabletId
+ << " shard: " << shardIdx
+ << " status: " << NKikimrScheme::EStatus_Name(status)
+ << " opId: " << OperationId
+ << " schemeshard: " << ssId);
+ return false;
+ }
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint()
+ << " Got OK TEvInitTenantSchemeShardResult from schemeshard"
+ << " tablet: " << tabletId
+ << " shardIdx: " << shardIdx
+ << " at schemeshard: " << ssId);
+
+ txState->ShardsInProgress.erase(shardIdx);
+ context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, shardIdx);
+
+ if (txState->ShardsInProgress.empty()) {
+ // All tablets have replied so we can done this transaction
+ context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
+ context.OnComplete.ActivateTx(OperationId);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool HandleReply(TEvSubDomain::TEvConfigureStatus::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint()
+ << " HandleReply TEvConfigureStatus"
+ << " operationId:" << OperationId
+ << " at schemeshard:" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateSubDomain
+ || txState->TxType == TTxState::TxAlterSubDomain
+ || txState->TxType == TTxState::TxAlterExtSubDomain);
+
+ const auto& record = ev->Get()->Record;
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ TTabletId tabletId = TTabletId(record.GetOnTabletId());
+ auto status = record.GetStatus();
+
auto shardIdx = context.SS->MustGetShardIdx(tabletId);
- Y_VERIFY(context.SS->ShardInfos.contains(shardIdx));
-
- if (status == NKikimrTx::TEvSubDomainConfigurationAck::REJECT) {
- LOG_CRIT_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint()
- << " Got REJECT on SubDomain Configure"
- << "from tablet: " << tabletId
- << " shard: " << shardIdx
- << " opId: " << OperationId
- << " schemeshard: " << ssId);
- return false;
- }
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() <<
- " Got OK TEvConfigureStatus from "
- << " tablet# " << tabletId
- << " shardIdx# " << shardIdx
- << " at schemeshard# " << ssId);
-
- txState->ShardsInProgress.erase(shardIdx);
- context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, shardIdx);
-
- if (txState->ShardsInProgress.empty()) {
- // All tablets have replied so we can done this transaction
- context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
- context.OnComplete.ActivateTx(OperationId);
- return true;
- }
-
- return false;
- }
-
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint()
- << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreateSubDomain
- || txState->TxType == TTxState::TxAlterSubDomain
- || txState->TxType == TTxState::TxAlterExtSubDomain);
-
- txState->ClearShardsInProgress();
-
- if (txState->Shards.empty()) {
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
- context.OnComplete.ActivateTx(OperationId);
- return true;
- }
-
- auto pathId = txState->TargetPathId;
- Y_VERIFY(context.SS->PathsById.contains(pathId));
- TPath path = TPath::Init(pathId, context.SS);
-
- Y_VERIFY(context.SS->SubDomains.contains(pathId));
- auto subDomain = context.SS->SubDomains.at(pathId);
- auto alterData = subDomain->GetAlter();
- Y_VERIFY(alterData);
- alterData->Initialize(context.SS->ShardInfos);
- auto processing = alterData->GetProcessingParams();
- auto storagePools = alterData->GetStoragePools();
- auto& schemeLimits = subDomain->GetSchemeLimits();
-
- for (ui32 i = 0; i < txState->Shards.size(); ++i) {
- auto &shard = txState->Shards[i];
- TShardIdx idx = shard.Idx;
- Y_VERIFY(context.SS->ShardInfos.contains(idx));
- TTabletId tabletID = context.SS->ShardInfos[idx].TabletID;
- auto type = context.SS->ShardInfos[idx].TabletType;
-
- switch (type) {
- case ETabletType::Coordinator:
+ Y_VERIFY(context.SS->ShardInfos.contains(shardIdx));
+
+ if (status == NKikimrTx::TEvSubDomainConfigurationAck::REJECT) {
+ LOG_CRIT_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint()
+ << " Got REJECT on SubDomain Configure"
+ << "from tablet: " << tabletId
+ << " shard: " << shardIdx
+ << " opId: " << OperationId
+ << " schemeshard: " << ssId);
+ return false;
+ }
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() <<
+ " Got OK TEvConfigureStatus from "
+ << " tablet# " << tabletId
+ << " shardIdx# " << shardIdx
+ << " at schemeshard# " << ssId);
+
+ txState->ShardsInProgress.erase(shardIdx);
+ context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, shardIdx);
+
+ if (txState->ShardsInProgress.empty()) {
+ // All tablets have replied so we can done this transaction
+ context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
+ context.OnComplete.ActivateTx(OperationId);
+ return true;
+ }
+
+ return false;
+ }
+
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint()
+ << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateSubDomain
+ || txState->TxType == TTxState::TxAlterSubDomain
+ || txState->TxType == TTxState::TxAlterExtSubDomain);
+
+ txState->ClearShardsInProgress();
+
+ if (txState->Shards.empty()) {
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
+ context.OnComplete.ActivateTx(OperationId);
+ return true;
+ }
+
+ auto pathId = txState->TargetPathId;
+ Y_VERIFY(context.SS->PathsById.contains(pathId));
+ TPath path = TPath::Init(pathId, context.SS);
+
+ Y_VERIFY(context.SS->SubDomains.contains(pathId));
+ auto subDomain = context.SS->SubDomains.at(pathId);
+ auto alterData = subDomain->GetAlter();
+ Y_VERIFY(alterData);
+ alterData->Initialize(context.SS->ShardInfos);
+ auto processing = alterData->GetProcessingParams();
+ auto storagePools = alterData->GetStoragePools();
+ auto& schemeLimits = subDomain->GetSchemeLimits();
+
+ for (ui32 i = 0; i < txState->Shards.size(); ++i) {
+ auto &shard = txState->Shards[i];
+ TShardIdx idx = shard.Idx;
+ Y_VERIFY(context.SS->ShardInfos.contains(idx));
+ TTabletId tabletID = context.SS->ShardInfos[idx].TabletID;
+ auto type = context.SS->ShardInfos[idx].TabletType;
+
+ switch (type) {
+ case ETabletType::Coordinator:
case ETabletType::Mediator: {
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Send configure request to coordinator/mediator: " << tabletID <<
- " opId: " << OperationId <<
- " schemeshard: " << ssId);
- shard.Operation = TTxState::ConfigureParts;
- auto event = new TEvSubDomain::TEvConfigure(processing);
- context.OnComplete.BindMsgToPipe(OperationId, tabletID, idx, event);
- break;
- }
+ " opId: " << OperationId <<
+ " schemeshard: " << ssId);
+ shard.Operation = TTxState::ConfigureParts;
+ auto event = new TEvSubDomain::TEvConfigure(processing);
+ context.OnComplete.BindMsgToPipe(OperationId, tabletID, idx, event);
+ break;
+ }
case ETabletType::Hive: {
LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Send configure request to hive: " << tabletID <<
@@ -327,297 +327,297 @@ public:
context.OnComplete.BindMsgToPipe(OperationId, tabletID, idx, event);
break;
}
- case ETabletType::SchemeShard: {
- auto event = new TEvSchemeShard::TEvInitTenantSchemeShard(ui64(ssId),
- pathId.LocalPathId, path.PathString(),
- path.Base()->Owner, path.GetEffectiveACL(), path.GetEffectiveACLVersion(),
- processing, storagePools,
- path.Base()->UserAttrs->Attrs, path.Base()->UserAttrs->AlterVersion,
+ case ETabletType::SchemeShard: {
+ auto event = new TEvSchemeShard::TEvInitTenantSchemeShard(ui64(ssId),
+ pathId.LocalPathId, path.PathString(),
+ path.Base()->Owner, path.GetEffectiveACL(), path.GetEffectiveACLVersion(),
+ processing, storagePools,
+ path.Base()->UserAttrs->Attrs, path.Base()->UserAttrs->AlterVersion,
schemeLimits, ui64(alterData->GetSharedHive()), alterData->GetResourcesDomainId()
- );
+ );
if (alterData->GetDeclaredSchemeQuotas()) {
event->Record.MutableDeclaredSchemeQuotas()->CopyFrom(*alterData->GetDeclaredSchemeQuotas());
}
if (alterData->GetDatabaseQuotas()) {
event->Record.MutableDatabaseQuotas()->CopyFrom(*alterData->GetDatabaseQuotas());
}
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Send configure request to schemeshard: " << tabletID <<
- " opId: " << OperationId <<
- " schemeshard: " << ssId <<
- " msg: " << event->Record.ShortDebugString());
-
- shard.Operation = TTxState::ConfigureParts;
- context.OnComplete.BindMsgToPipe(OperationId, tabletID, idx, event);
- break;
- }
- default:
- Y_FAIL_S("Unexpected type, we don't create tablets with type " << ETabletType::TypeToStr(type));
- }
- }
-
- txState->UpdateShardsInProgress(TTxState::ConfigureParts);
- return false;
- }
-};
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Send configure request to schemeshard: " << tabletID <<
+ " opId: " << OperationId <<
+ " schemeshard: " << ssId <<
+ " msg: " << event->Record.ShortDebugString());
+
+ shard.Operation = TTxState::ConfigureParts;
+ context.OnComplete.BindMsgToPipe(OperationId, tabletID, idx, event);
+ break;
+ }
+ default:
+ Y_FAIL_S("Unexpected type, we don't create tablets with type " << ETabletType::TypeToStr(type));
+ }
+ }
+
+ txState->UpdateShardsInProgress(TTxState::ConfigureParts);
+ return false;
+ }
+};
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "NSubDomainState::TPropose"
- << " operationId#" << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(),
- {TEvHive::TEvCreateTabletReply::EventType, TEvSubDomain::TEvConfigureStatus::EventType});
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "NSubDomainState::TPropose HandleReply TEvOperationPlan"
- << " operationId#" << OperationId
- << " at tablet" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- if (!txState) {
- return false;
- }
- Y_VERIFY(txState->TxType == TTxState::TxCreateSubDomain
- || txState->TxType == TTxState::TxAlterSubDomain
- || txState->TxType == TTxState::TxCreateExtSubDomain
- || txState->TxType == TTxState::TxAlterExtSubDomain);
-
- TPathId pathId = txState->TargetPathId;
- Y_VERIFY(context.SS->PathsById.contains(pathId));
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- path->StepCreated = step;
- context.SS->PersistCreateStep(db, pathId, step);
-
- Y_VERIFY(context.SS->SubDomains.contains(pathId));
- auto subDomain = context.SS->SubDomains.at(pathId);
- auto alter = subDomain->GetAlter();
- Y_VERIFY(alter);
- Y_VERIFY(subDomain->GetVersion() < alter->GetVersion());
-
+ return TStringBuilder()
+ << "NSubDomainState::TPropose"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(),
+ {TEvHive::TEvCreateTabletReply::EventType, TEvSubDomain::TEvConfigureStatus::EventType});
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "NSubDomainState::TPropose HandleReply TEvOperationPlan"
+ << " operationId#" << OperationId
+ << " at tablet" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ if (!txState) {
+ return false;
+ }
+ Y_VERIFY(txState->TxType == TTxState::TxCreateSubDomain
+ || txState->TxType == TTxState::TxAlterSubDomain
+ || txState->TxType == TTxState::TxCreateExtSubDomain
+ || txState->TxType == TTxState::TxAlterExtSubDomain);
+
+ TPathId pathId = txState->TargetPathId;
+ Y_VERIFY(context.SS->PathsById.contains(pathId));
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ path->StepCreated = step;
+ context.SS->PersistCreateStep(db, pathId, step);
+
+ Y_VERIFY(context.SS->SubDomains.contains(pathId));
+ auto subDomain = context.SS->SubDomains.at(pathId);
+ auto alter = subDomain->GetAlter();
+ Y_VERIFY(alter);
+ Y_VERIFY(subDomain->GetVersion() < alter->GetVersion());
+
subDomain->ActualizeAlterData(context.SS->ShardInfos, context.Ctx.Now(),
/* isExternal */ path->PathType == TPathElement::EPathType::EPathTypeExtSubDomain,
context.SS);
-
- context.SS->SubDomains[pathId] = alter;
- context.SS->PersistSubDomain(db, pathId, *alter);
+
+ context.SS->SubDomains[pathId] = alter;
+ context.SS->PersistSubDomain(db, pathId, *alter);
context.SS->PersistSubDomainSchemeQuotas(db, pathId, *alter);
-
- if (txState->TxType == TTxState::TxCreateSubDomain || txState->TxType == TTxState::TxCreateExtSubDomain) {
- auto parentDir = context.SS->PathsById.at(path->ParentPathId);
- ++parentDir->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir);
- context.SS->ClearDescribePathCaches(parentDir);
+
+ if (txState->TxType == TTxState::TxCreateSubDomain || txState->TxType == TTxState::TxCreateExtSubDomain) {
+ auto parentDir = context.SS->PathsById.at(path->ParentPathId);
+ ++parentDir->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir);
+ context.SS->ClearDescribePathCaches(parentDir);
context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
- }
-
- context.OnComplete.UpdateTenant(pathId);
- context.SS->ClearDescribePathCaches(path);
+ }
+
+ context.OnComplete.UpdateTenant(pathId);
+ context.SS->ClearDescribePathCaches(path);
context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
context.SS->ChangeTxState(db, OperationId, TTxState::Done);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "NSubDomainState::TPropose ProgressState"
- << ", operationId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreateSubDomain
- || txState->TxType == TTxState::TxAlterSubDomain
- || txState->TxType == TTxState::TxCreateExtSubDomain
- || txState->TxType == TTxState::TxAlterExtSubDomain);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-}
-
-
-class TCreateParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "NSubDomainState::TPropose ProgressState"
+ << ", operationId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateSubDomain
+ || txState->TxType == TTxState::TxAlterSubDomain
+ || txState->TxType == TTxState::TxCreateExtSubDomain
+ || txState->TxType == TTxState::TxAlterExtSubDomain);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+}
+
+
+class TCreateParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TCreateParts"
- << " operationId: " << OperationId;
- }
-
-public:
- TCreateParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool HandleReply(TEvHive::TEvAdoptTabletReply::TPtr& ev, TOperationContext& context) override {
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvAdoptTablet"
- << ", at tabletId: " << context.SS->TabletID());
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvAdoptTablet"
- << ", message% " << DebugReply(ev));
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- const TString& explain = ev->Get()->Record.GetExplain();
- TTabletId tabletId = TTabletId(ev->Get()->Record.GetTabletID()); // global id from hive
- auto shardIdx = context.SS->MakeLocalId(TLocalShardIdx(ev->Get()->Record.GetOwnerIdx())); // global id from hive
- TTabletId hive = TTabletId(ev->Get()->Record.GetOrigin());
-
- Y_VERIFY(context.SS->TabletID() == ev->Get()->Record.GetOwner());
-
- NKikimrProto::EReplyStatus status = ev->Get()->Record.GetStatus();
- Y_VERIFY_S(status == NKikimrProto::OK || status == NKikimrProto::ALREADY,
- "Unexpected status " << NKikimrProto::EReplyStatus_Name(status)
- << " in AdoptTabletReply for tabletId " << tabletId
- << " with explain " << explain);
-
- // Note that HIVE might send duplicate TTxAdoptTabletReply in case of restarts
- // So we just ignore the event if we cannot find the Tx or if it is in a different
- // state
-
- Y_VERIFY(context.SS->ShardInfos.contains(shardIdx));
-
- if (!context.SS->AdoptedShards.contains(shardIdx)) {
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvAdoptTablet"
- << " Got TTxAdoptTabletReply for shard but it is not present in AdoptedShards"
- << ", shardIdx: " << shardIdx
- << ", tabletId:" << tabletId);
- return false;
- }
-
- TShardInfo& shardInfo = context.SS->ShardInfos[shardIdx];
- Y_VERIFY(shardInfo.TabletID == InvalidTabletId || shardInfo.TabletID == tabletId);
-
+ return TStringBuilder()
+ << "TCreateParts"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TCreateParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool HandleReply(TEvHive::TEvAdoptTabletReply::TPtr& ev, TOperationContext& context) override {
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvAdoptTablet"
+ << ", at tabletId: " << context.SS->TabletID());
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvAdoptTablet"
+ << ", message% " << DebugReply(ev));
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ const TString& explain = ev->Get()->Record.GetExplain();
+ TTabletId tabletId = TTabletId(ev->Get()->Record.GetTabletID()); // global id from hive
+ auto shardIdx = context.SS->MakeLocalId(TLocalShardIdx(ev->Get()->Record.GetOwnerIdx())); // global id from hive
+ TTabletId hive = TTabletId(ev->Get()->Record.GetOrigin());
+
+ Y_VERIFY(context.SS->TabletID() == ev->Get()->Record.GetOwner());
+
+ NKikimrProto::EReplyStatus status = ev->Get()->Record.GetStatus();
+ Y_VERIFY_S(status == NKikimrProto::OK || status == NKikimrProto::ALREADY,
+ "Unexpected status " << NKikimrProto::EReplyStatus_Name(status)
+ << " in AdoptTabletReply for tabletId " << tabletId
+ << " with explain " << explain);
+
+ // Note that HIVE might send duplicate TTxAdoptTabletReply in case of restarts
+ // So we just ignore the event if we cannot find the Tx or if it is in a different
+ // state
+
+ Y_VERIFY(context.SS->ShardInfos.contains(shardIdx));
+
+ if (!context.SS->AdoptedShards.contains(shardIdx)) {
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvAdoptTablet"
+ << " Got TTxAdoptTabletReply for shard but it is not present in AdoptedShards"
+ << ", shardIdx: " << shardIdx
+ << ", tabletId:" << tabletId);
+ return false;
+ }
+
+ TShardInfo& shardInfo = context.SS->ShardInfos[shardIdx];
+ Y_VERIFY(shardInfo.TabletID == InvalidTabletId || shardInfo.TabletID == tabletId);
+
Y_VERIFY(tabletId != InvalidTabletId);
- shardInfo.TabletID = tabletId;
- context.SS->TabletIdToShardIdx[tabletId] = shardIdx;
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->State == TTxState::CreateParts);
-
- txState->ShardsInProgress.erase(shardIdx);
-
- context.SS->AdoptedShards.erase(shardIdx);
- context.SS->PersistDeleteAdopted(db, shardIdx);
- context.SS->PersistShardMapping(db, shardIdx, tabletId, shardInfo.PathId, OperationId.GetTxId(), shardInfo.TabletType);
-
- context.OnComplete.UnbindMsgFromPipe(OperationId, hive, shardIdx);
+ shardInfo.TabletID = tabletId;
+ context.SS->TabletIdToShardIdx[tabletId] = shardIdx;
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->State == TTxState::CreateParts);
+
+ txState->ShardsInProgress.erase(shardIdx);
+
+ context.SS->AdoptedShards.erase(shardIdx);
+ context.SS->PersistDeleteAdopted(db, shardIdx);
+ context.SS->PersistShardMapping(db, shardIdx, tabletId, shardInfo.PathId, OperationId.GetTxId(), shardInfo.TabletType);
+
+ context.OnComplete.UnbindMsgFromPipe(OperationId, hive, shardIdx);
context.OnComplete.ActivateShardCreated(shardIdx, OperationId.GetTxId());
-
- // If all datashards have been created
- if (txState->ShardsInProgress.empty()) {
- context.SS->ChangeTxState(db, OperationId, TTxState::ConfigureParts);
- return true;
- }
-
- return false;
- }
-
- bool HandleReply(TEvHive::TEvCreateTabletReply::TPtr& ev, TOperationContext& context) override {
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvCreateTabletReply"
- << ", at tabletId: " << context.SS->TabletID());
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvCreateTabletReply"
- << ", message: " << DebugReply(ev));
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- auto shardIdx = TShardIdx(ev->Get()->Record.GetOwner(),
- TLocalShardIdx(ev->Get()->Record.GetOwnerIdx()));
-
- auto tabletId = TTabletId(ev->Get()->Record.GetTabletID()); // global id from hive
- auto hive = TTabletId(ev->Get()->Record.GetOrigin());
-
- NKikimrProto::EReplyStatus status = ev->Get()->Record.GetStatus();
-
- Y_VERIFY_S(status == NKikimrProto::OK
- || status == NKikimrProto::ALREADY
- || status == NKikimrProto::INVALID_OWNER
- || status == NKikimrProto::BLOCKED,
- "Unexpected status " << NKikimrProto::EReplyStatus_Name(status)
- << " in CreateTabletReply shard idx " << shardIdx << " tabletId " << tabletId);
-
- if (status == NKikimrProto::BLOCKED) {
- Y_VERIFY(!context.SS->IsDomainSchemeShard);
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " CreateRequest BLOCKED "
- << " at Hive: " << hive
- << " msg: " << DebugReply(ev));
-
- // do not unsubscribe message
- // context.OnComplete.UnbindMsgFromPipe(OperationId, hive, shardIdx);
-
- // just stay calm and hung until tenant schemeshard is deleted
- return false;
- }
-
- TTxState& txState = *context.SS->FindTx(OperationId);
-
- TShardInfo& shardInfo = context.SS->ShardInfos.at(shardIdx);
- Y_VERIFY(shardInfo.TabletID == InvalidTabletId || shardInfo.TabletID == tabletId);
-
- if (status == NKikimrProto::INVALID_OWNER) {
- auto redirectTo = TTabletId(ev->Get()->Record.GetForwardRequest().GetHiveTabletId());
- Y_VERIFY(redirectTo);
- Y_VERIFY(tabletId);
-
- context.OnComplete.UnbindMsgFromPipe(OperationId, hive, shardIdx);
-
- auto path = context.SS->PathsById.at(txState.TargetPathId);
- auto request = CreateRequest(path, shardIdx, context);
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " CreateRequest"
- << " Redirect from Hive: " << hive
- << " to Hive: " << redirectTo
- << " msg: " << request->Record.DebugString());
-
- context.OnComplete.BindMsgToPipe(OperationId, redirectTo, shardIdx, request.Release());
- return false;
- }
-
- if (shardInfo.TabletID == InvalidTabletId) {
+
+ // If all datashards have been created
+ if (txState->ShardsInProgress.empty()) {
+ context.SS->ChangeTxState(db, OperationId, TTxState::ConfigureParts);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool HandleReply(TEvHive::TEvCreateTabletReply::TPtr& ev, TOperationContext& context) override {
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvCreateTabletReply"
+ << ", at tabletId: " << context.SS->TabletID());
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvCreateTabletReply"
+ << ", message: " << DebugReply(ev));
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ auto shardIdx = TShardIdx(ev->Get()->Record.GetOwner(),
+ TLocalShardIdx(ev->Get()->Record.GetOwnerIdx()));
+
+ auto tabletId = TTabletId(ev->Get()->Record.GetTabletID()); // global id from hive
+ auto hive = TTabletId(ev->Get()->Record.GetOrigin());
+
+ NKikimrProto::EReplyStatus status = ev->Get()->Record.GetStatus();
+
+ Y_VERIFY_S(status == NKikimrProto::OK
+ || status == NKikimrProto::ALREADY
+ || status == NKikimrProto::INVALID_OWNER
+ || status == NKikimrProto::BLOCKED,
+ "Unexpected status " << NKikimrProto::EReplyStatus_Name(status)
+ << " in CreateTabletReply shard idx " << shardIdx << " tabletId " << tabletId);
+
+ if (status == NKikimrProto::BLOCKED) {
+ Y_VERIFY(!context.SS->IsDomainSchemeShard);
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " CreateRequest BLOCKED "
+ << " at Hive: " << hive
+ << " msg: " << DebugReply(ev));
+
+ // do not unsubscribe message
+ // context.OnComplete.UnbindMsgFromPipe(OperationId, hive, shardIdx);
+
+ // just stay calm and hung until tenant schemeshard is deleted
+ return false;
+ }
+
+ TTxState& txState = *context.SS->FindTx(OperationId);
+
+ TShardInfo& shardInfo = context.SS->ShardInfos.at(shardIdx);
+ Y_VERIFY(shardInfo.TabletID == InvalidTabletId || shardInfo.TabletID == tabletId);
+
+ if (status == NKikimrProto::INVALID_OWNER) {
+ auto redirectTo = TTabletId(ev->Get()->Record.GetForwardRequest().GetHiveTabletId());
+ Y_VERIFY(redirectTo);
+ Y_VERIFY(tabletId);
+
+ context.OnComplete.UnbindMsgFromPipe(OperationId, hive, shardIdx);
+
+ auto path = context.SS->PathsById.at(txState.TargetPathId);
+ auto request = CreateRequest(path, shardIdx, context);
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " CreateRequest"
+ << " Redirect from Hive: " << hive
+ << " to Hive: " << redirectTo
+ << " msg: " << request->Record.DebugString());
+
+ context.OnComplete.BindMsgToPipe(OperationId, redirectTo, shardIdx, request.Release());
+ return false;
+ }
+
+ if (shardInfo.TabletID == InvalidTabletId) {
switch (shardInfo.TabletType) {
case ETabletType::DataShard:
- context.SS->TabletCounters->Simple()[COUNTER_TABLE_SHARD_ACTIVE_COUNT].Add(1);
+ context.SS->TabletCounters->Simple()[COUNTER_TABLE_SHARD_ACTIVE_COUNT].Add(1);
break;
case ETabletType::Coordinator:
- context.SS->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_COORDINATOR_COUNT].Add(1);
+ context.SS->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_COORDINATOR_COUNT].Add(1);
break;
case ETabletType::Mediator:
- context.SS->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_MEDIATOR_COUNT].Add(1);
+ context.SS->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_MEDIATOR_COUNT].Add(1);
break;
case ETabletType::Hive:
context.SS->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_HIVE_COUNT].Add(1);
@@ -627,60 +627,60 @@ public:
break;
default:
break;
- }
- }
-
+ }
+ }
+
Y_VERIFY(tabletId != InvalidTabletId);
- shardInfo.TabletID = tabletId;
- context.SS->TabletIdToShardIdx[tabletId] = shardIdx;
-
- Y_VERIFY(OperationId.GetTxId() == shardInfo.CurrentTxId);
-
- txState.ShardsInProgress.erase(shardIdx);
-
- context.SS->PersistShardMapping(db, shardIdx, tabletId, shardInfo.PathId, OperationId.GetTxId(), shardInfo.TabletType);
- context.OnComplete.UnbindMsgFromPipe(OperationId, hive, shardIdx);
+ shardInfo.TabletID = tabletId;
+ context.SS->TabletIdToShardIdx[tabletId] = shardIdx;
+
+ Y_VERIFY(OperationId.GetTxId() == shardInfo.CurrentTxId);
+
+ txState.ShardsInProgress.erase(shardIdx);
+
+ context.SS->PersistShardMapping(db, shardIdx, tabletId, shardInfo.PathId, OperationId.GetTxId(), shardInfo.TabletType);
+ context.OnComplete.UnbindMsgFromPipe(OperationId, hive, shardIdx);
context.OnComplete.ActivateShardCreated(shardIdx, OperationId.GetTxId());
-
- // If all datashards have been created
- if (txState.ShardsInProgress.empty()) {
- context.SS->ChangeTxState(db, OperationId, TTxState::ConfigureParts);
- return true;
- }
-
- return false;
- }
-
- THolder<TEvHive::TEvCreateTablet> CreateRequest(TPathElement::TPtr targetPath, TShardIdx shardIdx, TOperationContext& context) {
- auto tablePartitionConfig = context.SS->GetTablePartitionConfigWithAlterData(targetPath->PathId);
- const auto& shard = context.SS->ShardInfos[shardIdx];
-
+
+ // If all datashards have been created
+ if (txState.ShardsInProgress.empty()) {
+ context.SS->ChangeTxState(db, OperationId, TTxState::ConfigureParts);
+ return true;
+ }
+
+ return false;
+ }
+
+ THolder<TEvHive::TEvCreateTablet> CreateRequest(TPathElement::TPtr targetPath, TShardIdx shardIdx, TOperationContext& context) {
+ auto tablePartitionConfig = context.SS->GetTablePartitionConfigWithAlterData(targetPath->PathId);
+ const auto& shard = context.SS->ShardInfos[shardIdx];
+
if (shard.TabletType == ETabletType::BlockStorePartition ||
- shard.TabletType == ETabletType::BlockStorePartition2)
- {
- auto it = context.SS->BlockStoreVolumes.FindPtr(targetPath->PathId);
- Y_VERIFY(it, "Missing BlockStoreVolume while creating BlockStorePartition tablet");
- auto volume = *it;
- const auto* volumeConfig = &volume->VolumeConfig;
- if (volume->AlterData) {
- volumeConfig = &volume->AlterData->VolumeConfig;
- }
- }
-
+ shard.TabletType == ETabletType::BlockStorePartition2)
+ {
+ auto it = context.SS->BlockStoreVolumes.FindPtr(targetPath->PathId);
+ Y_VERIFY(it, "Missing BlockStoreVolume while creating BlockStorePartition tablet");
+ auto volume = *it;
+ const auto* volumeConfig = &volume->VolumeConfig;
+ if (volume->AlterData) {
+ volumeConfig = &volume->AlterData->VolumeConfig;
+ }
+ }
+
THolder<TEvHive::TEvCreateTablet> ev = MakeHolder<TEvHive::TEvCreateTablet>(ui64(shardIdx.GetOwnerId()), ui64(shardIdx.GetLocalId()), shard.TabletType, shard.BindedChannels);
-
- TPathId domainId = context.SS->ResolveDomainId(targetPath);
-
- TPathElement::TPtr domainEl = context.SS->PathsById.at(domainId);
+
+ TPathId domainId = context.SS->ResolveDomainId(targetPath);
+
+ TPathElement::TPtr domainEl = context.SS->PathsById.at(domainId);
auto objectDomain = ev->Record.MutableObjectDomain();
- if (domainEl->IsRoot()) {
+ if (domainEl->IsRoot()) {
objectDomain->SetSchemeShard(context.SS->ParentDomainId.OwnerId);
objectDomain->SetPathId(context.SS->ParentDomainId.LocalPathId);
- } else {
+ } else {
objectDomain->SetSchemeShard(domainId.OwnerId);
objectDomain->SetPathId(domainId.LocalPathId);
- }
-
+ }
+
Y_VERIFY(context.SS->SubDomains.contains(domainId));
TSubDomainInfo::TPtr subDomain = context.SS->SubDomains.at(domainId);
@@ -697,188 +697,188 @@ public:
allowedDomain->SetSchemeShard(resourcesDomainId.OwnerId);
allowedDomain->SetPathId(resourcesDomainId.LocalPathId);
- if (tablePartitionConfig) {
+ if (tablePartitionConfig) {
if (tablePartitionConfig->FollowerGroupsSize()) {
ev->Record.MutableFollowerGroups()->CopyFrom(tablePartitionConfig->GetFollowerGroups());
- } else {
+ } else {
if (tablePartitionConfig->HasAllowFollowerPromotion()) {
ev->Record.SetAllowFollowerPromotion(tablePartitionConfig->GetAllowFollowerPromotion());
- }
-
+ }
+
if (tablePartitionConfig->HasCrossDataCenterFollowerCount()) {
ev->Record.SetCrossDataCenterFollowerCount(tablePartitionConfig->GetCrossDataCenterFollowerCount());
} else if (tablePartitionConfig->HasFollowerCount()) {
ev->Record.SetFollowerCount(tablePartitionConfig->GetFollowerCount());
- }
- }
- }
-
+ }
+ }
+ }
+
if (shard.TabletType == ETabletType::BlockStorePartition ||
shard.TabletType == ETabletType::BlockStorePartition2 ||
- shard.TabletType == ETabletType::RTMRPartition) {
- // Partitions should never be booted by local
- ev->Record.SetTabletBootMode(NKikimrHive::TABLET_BOOT_MODE_EXTERNAL);
- }
-
- ev->Record.SetObjectId(targetPath->PathId.LocalPathId);
-
+ shard.TabletType == ETabletType::RTMRPartition) {
+ // Partitions should never be booted by local
+ ev->Record.SetTabletBootMode(NKikimrHive::TABLET_BOOT_MODE_EXTERNAL);
+ }
+
+ ev->Record.SetObjectId(targetPath->PathId.LocalPathId);
+
if (shard.TabletID) {
ev->Record.SetTabletID(ui64(shard.TabletID));
}
- return ev;
- }
-
- THolder<TEvHive::TEvAdoptTablet> AdoptRequest(TShardIdx shardIdx, TOperationContext& context) {
- Y_VERIFY(context.SS->AdoptedShards.contains(shardIdx));
- auto& adoptedShard = context.SS->AdoptedShards[shardIdx];
- auto& shard = context.SS->ShardInfos[shardIdx];
-
+ return ev;
+ }
+
+ THolder<TEvHive::TEvAdoptTablet> AdoptRequest(TShardIdx shardIdx, TOperationContext& context) {
+ Y_VERIFY(context.SS->AdoptedShards.contains(shardIdx));
+ auto& adoptedShard = context.SS->AdoptedShards[shardIdx];
+ auto& shard = context.SS->ShardInfos[shardIdx];
+
THolder<TEvHive::TEvAdoptTablet> ev = MakeHolder<TEvHive::TEvAdoptTablet>(
- ui64(shard.TabletID),
- adoptedShard.PrevOwner, ui64(adoptedShard.PrevShardIdx),
- shard.TabletType,
- context.SS->TabletID(), ui64(shardIdx.GetLocalId()));
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " AdoptRequest"
- << " Event to Hive: " << ev->Record.DebugString().c_str());
-
- return ev;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", operation type: " << TTxState::TypeName(txState->TxType)
- << ", at tablet" << ssId);
-
- if (txState->TxType == TTxState::TxDropTable
- || txState->TxType == TTxState::TxAlterTable
+ ui64(shard.TabletID),
+ adoptedShard.PrevOwner, ui64(adoptedShard.PrevShardIdx),
+ shard.TabletType,
+ context.SS->TabletID(), ui64(shardIdx.GetLocalId()));
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " AdoptRequest"
+ << " Event to Hive: " << ev->Record.DebugString().c_str());
+
+ return ev;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", operation type: " << TTxState::TypeName(txState->TxType)
+ << ", at tablet" << ssId);
+
+ if (txState->TxType == TTxState::TxDropTable
+ || txState->TxType == TTxState::TxAlterTable
|| txState->TxType == TTxState::TxBackup
|| txState->TxType == TTxState::TxRestore) {
- if (NTableState::CheckPartitioningChangedForTableModification(*txState, context)) {
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << " SourceTablePartitioningChangedForModification"
- << ", tx type: " << TTxState::TypeName(txState->TxType));
- NTableState::UpdatePartitioningForTableModification(OperationId, *txState, context);
- }
- } else if (txState->TxType == TTxState::TxCopyTable) {
- if (NTableState::SourceTablePartitioningChangedForCopyTable(*txState, context)) {
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << " SourceTablePartitioningChangedForCopyTable"
- << ", tx type: " << TTxState::TypeName(txState->TxType));
- NTableState::UpdatePartitioningForCopyTable(OperationId, *txState, context);
- }
- }
-
- txState->ClearShardsInProgress();
-
- bool nothingToDo = true;
- for (const auto& shard : txState->Shards) {
- if (shard.Operation != TTxState::CreateParts) {
- continue;
- }
- nothingToDo = false;
-
- if (context.SS->AdoptedShards.contains(shard.Idx)) {
- auto ev = AdoptRequest(shard.Idx, context);
- context.OnComplete.BindMsgToPipe(OperationId, context.SS->GetGlobalHive(context.Ctx) , shard.Idx, ev.Release());
- } else {
- auto path = context.SS->PathsById.at(txState->TargetPathId);
- auto ev = CreateRequest(path, shard.Idx, context);
-
- auto hiveToRequest = context.SS->ResolveHive(shard.Idx, context.Ctx);
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " CreateRequest"
- << " Event to Hive: " << hiveToRequest
- << " msg: "<< ev->Record.DebugString().c_str());
-
- context.OnComplete.BindMsgToPipe(OperationId, hiveToRequest, shard.Idx, ev.Release());
- }
- context.OnComplete.RouteByShardIdx(OperationId, shard.Idx);
- }
-
- if (nothingToDo) {
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << " no shards to create, do next state");
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::ConfigureParts);
- return true;
- }
-
- txState->UpdateShardsInProgress(TTxState::CreateParts);
- return false;
- }
-};
-
-
-class TDone: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ if (NTableState::CheckPartitioningChangedForTableModification(*txState, context)) {
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << " SourceTablePartitioningChangedForModification"
+ << ", tx type: " << TTxState::TypeName(txState->TxType));
+ NTableState::UpdatePartitioningForTableModification(OperationId, *txState, context);
+ }
+ } else if (txState->TxType == TTxState::TxCopyTable) {
+ if (NTableState::SourceTablePartitioningChangedForCopyTable(*txState, context)) {
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << " SourceTablePartitioningChangedForCopyTable"
+ << ", tx type: " << TTxState::TypeName(txState->TxType));
+ NTableState::UpdatePartitioningForCopyTable(OperationId, *txState, context);
+ }
+ }
+
+ txState->ClearShardsInProgress();
+
+ bool nothingToDo = true;
+ for (const auto& shard : txState->Shards) {
+ if (shard.Operation != TTxState::CreateParts) {
+ continue;
+ }
+ nothingToDo = false;
+
+ if (context.SS->AdoptedShards.contains(shard.Idx)) {
+ auto ev = AdoptRequest(shard.Idx, context);
+ context.OnComplete.BindMsgToPipe(OperationId, context.SS->GetGlobalHive(context.Ctx) , shard.Idx, ev.Release());
+ } else {
+ auto path = context.SS->PathsById.at(txState->TargetPathId);
+ auto ev = CreateRequest(path, shard.Idx, context);
+
+ auto hiveToRequest = context.SS->ResolveHive(shard.Idx, context.Ctx);
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " CreateRequest"
+ << " Event to Hive: " << hiveToRequest
+ << " msg: "<< ev->Record.DebugString().c_str());
+
+ context.OnComplete.BindMsgToPipe(OperationId, hiveToRequest, shard.Idx, ev.Release());
+ }
+ context.OnComplete.RouteByShardIdx(OperationId, shard.Idx);
+ }
+
+ if (nothingToDo) {
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << " no shards to create, do next state");
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::ConfigureParts);
+ return true;
+ }
+
+ txState->UpdateShardsInProgress(TTxState::CreateParts);
+ return false;
+ }
+};
+
+
+class TDone: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDone operationId#" << OperationId;
- }
-
-public:
- TDone(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), AllIncomingEvents());
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
-
- TPathId pathId = txState->TargetPathId;
- Y_VERIFY(context.SS->PathsById.contains(pathId));
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
- Y_VERIFY_S(path->PathState != TPathElement::EPathState::EPathStateNoChanges,
- "with context"
- << ", PathState: " << NKikimrSchemeOp::EPathState_Name(path->PathState)
- << ", PathId: " << path->PathId
- << ", PathName: " << path->Name);
-
- if (path->IsPQGroup() && txState->IsCreate()) {
- TPathElement::TPtr parentDir = context.SS->PathsById.at(path->ParentPathId);
- // can't be removed until KIKIMR-8861
- // at least lets wrap it into condition
- // it helps to actualize PATHSTATE inside children listing
- context.SS->ClearDescribePathCaches(parentDir);
- }
-
- if (txState->IsDrop()) {
- context.OnComplete.ReleasePathState(OperationId, path->PathId, TPathElement::EPathState::EPathStateNotExist);
- } else {
- context.OnComplete.ReleasePathState(OperationId, path->PathId, TPathElement::EPathState::EPathStateNoChanges);
- }
-
- if (txState->SourcePathId != InvalidPathId) {
- Y_VERIFY(context.SS->PathsById.contains(txState->SourcePathId));
- TPathElement::TPtr srcPath = context.SS->PathsById.at(txState->SourcePathId);
- if (srcPath->PathState == TPathElement::EPathState::EPathStateCopying) {
- context.OnComplete.ReleasePathState(OperationId, srcPath->PathId, TPathElement::EPathState::EPathStateNoChanges);
- }
- }
-
+ return TStringBuilder()
+ << "TDone operationId#" << OperationId;
+ }
+
+public:
+ TDone(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), AllIncomingEvents());
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+
+ TPathId pathId = txState->TargetPathId;
+ Y_VERIFY(context.SS->PathsById.contains(pathId));
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+ Y_VERIFY_S(path->PathState != TPathElement::EPathState::EPathStateNoChanges,
+ "with context"
+ << ", PathState: " << NKikimrSchemeOp::EPathState_Name(path->PathState)
+ << ", PathId: " << path->PathId
+ << ", PathName: " << path->Name);
+
+ if (path->IsPQGroup() && txState->IsCreate()) {
+ TPathElement::TPtr parentDir = context.SS->PathsById.at(path->ParentPathId);
+ // can't be removed until KIKIMR-8861
+ // at least lets wrap it into condition
+ // it helps to actualize PATHSTATE inside children listing
+ context.SS->ClearDescribePathCaches(parentDir);
+ }
+
+ if (txState->IsDrop()) {
+ context.OnComplete.ReleasePathState(OperationId, path->PathId, TPathElement::EPathState::EPathStateNotExist);
+ } else {
+ context.OnComplete.ReleasePathState(OperationId, path->PathId, TPathElement::EPathState::EPathStateNoChanges);
+ }
+
+ if (txState->SourcePathId != InvalidPathId) {
+ Y_VERIFY(context.SS->PathsById.contains(txState->SourcePathId));
+ TPathElement::TPtr srcPath = context.SS->PathsById.at(txState->SourcePathId);
+ if (srcPath->PathState == TPathElement::EPathState::EPathStateCopying) {
+ context.OnComplete.ReleasePathState(OperationId, srcPath->PathId, TPathElement::EPathState::EPathStateNoChanges);
+ }
+ }
+
// OlapStore tracks all tables that are under operation, make sure to unlink
if (context.SS->OlapTables.contains(pathId)) {
auto tableInfo = context.SS->OlapTables.at(pathId);
@@ -888,142 +888,142 @@ public:
}
}
- context.OnComplete.DoneOperation(OperationId);
- return true;
- }
-};
-
-
-namespace NPQState {
-
-class TConfigureParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ context.OnComplete.DoneOperation(OperationId);
+ return true;
+ }
+};
+
+
+namespace NPQState {
+
+class TConfigureParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "NPQState::TConfigureParts"
- << " operationId#" << OperationId;
- }
-
-public:
- TConfigureParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
- }
-
- bool HandleReply(TEvPersQueue::TEvUpdateConfigResponse::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvUpdateConfigResponse"
- << " at tablet" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreatePQGroup || txState->TxType == TTxState::TxAlterPQGroup);
-
- TTabletId tabletId = TTabletId(ev->Get()->Record.GetOrigin());
- NKikimrPQ::EStatus status = ev->Get()->Record.GetStatus();
-
- // Schemeshard always sends a valid config to the PQ tablet and PQ tablet is not supposed to reject it
- // Also Schemeshard never send multiple different config updates simultaneously (same config
- // can be sent more than once in case of retries due to restarts or disconnects)
- // If PQ tablet is not able to save a valid config it should kill itself and restart without
- // sending error response
- Y_VERIFY_S(status == NKikimrPQ::OK || status == NKikimrPQ::ERROR_UPDATE_IN_PROGRESS,
- "Unexpected error in UpdateConfigResponse,"
- << " status: " << NKikimrPQ::EStatus_Name(status)
- << " Tx " << OperationId
- << " tablet "<< tabletId
- << " at schemeshard: " << ssId);
-
- if (status == NKikimrPQ::ERROR_UPDATE_IN_PROGRESS) {
- LOG_ERROR_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "PQ reconfiguration is in progress. We'll try to finish it later."
- << " Tx " << OperationId
- << " tablet " << tabletId
- << " at schemeshard: " << ssId);
- return false;
- }
-
- Y_VERIFY(txState->State == TTxState::ConfigureParts);
-
+ return TStringBuilder()
+ << "NPQState::TConfigureParts"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TConfigureParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
+ }
+
+ bool HandleReply(TEvPersQueue::TEvUpdateConfigResponse::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvUpdateConfigResponse"
+ << " at tablet" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreatePQGroup || txState->TxType == TTxState::TxAlterPQGroup);
+
+ TTabletId tabletId = TTabletId(ev->Get()->Record.GetOrigin());
+ NKikimrPQ::EStatus status = ev->Get()->Record.GetStatus();
+
+ // Schemeshard always sends a valid config to the PQ tablet and PQ tablet is not supposed to reject it
+ // Also Schemeshard never send multiple different config updates simultaneously (same config
+ // can be sent more than once in case of retries due to restarts or disconnects)
+ // If PQ tablet is not able to save a valid config it should kill itself and restart without
+ // sending error response
+ Y_VERIFY_S(status == NKikimrPQ::OK || status == NKikimrPQ::ERROR_UPDATE_IN_PROGRESS,
+ "Unexpected error in UpdateConfigResponse,"
+ << " status: " << NKikimrPQ::EStatus_Name(status)
+ << " Tx " << OperationId
+ << " tablet "<< tabletId
+ << " at schemeshard: " << ssId);
+
+ if (status == NKikimrPQ::ERROR_UPDATE_IN_PROGRESS) {
+ LOG_ERROR_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "PQ reconfiguration is in progress. We'll try to finish it later."
+ << " Tx " << OperationId
+ << " tablet " << tabletId
+ << " at schemeshard: " << ssId);
+ return false;
+ }
+
+ Y_VERIFY(txState->State == TTxState::ConfigureParts);
+
TShardIdx idx = context.SS->MustGetShardIdx(tabletId);
- txState->ShardsInProgress.erase(idx);
-
- // Dettach datashard pipe
- context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, idx);
-
- if (txState->ShardsInProgress.empty()) {
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
- return true;
- }
-
- return false;
- }
-
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint()
- << " HandleReply ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreatePQGroup || txState->TxType == TTxState::TxAlterPQGroup);
-
- txState->ClearShardsInProgress();
-
- TString topicName = context.SS->PathsById.at(txState->TargetPathId)->Name;
- Y_VERIFY_S(topicName.size(),
- "topicName is empty"
- <<", pathId: " << txState->TargetPathId);
-
- TPersQueueGroupInfo::TPtr pqGroup = context.SS->PersQueueGroups[txState->TargetPathId];
- Y_VERIFY_S(pqGroup,
- "pqGroup is null"
- << ", pathId " << txState->TargetPathId);
-
- TString* tabletConfig = &pqGroup->TabletConfig;
- if (pqGroup->AlterData) {
- if (!pqGroup->AlterData->TabletConfig.empty())
- tabletConfig = &pqGroup->AlterData->TabletConfig;
- }
-
- for (auto shard : txState->Shards) {
- TShardIdx idx = shard.Idx;
- TTabletId tabletId = context.SS->ShardInfos.at(idx).TabletID;
-
- if (shard.TabletType == ETabletType::PersQueue) {
- TPQShardInfo::TPtr pqShard = pqGroup->Shards.at(idx);
- Y_VERIFY_S(pqShard, "pqShard is null, idx is " << idx << " has was "<< THash<TShardIdx>()(idx));
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Propose configure PersQueue"
- << ", opId: " << OperationId
- << ", tabletId: " << tabletId
- << ", PQInfos size: " << pqShard->PQInfos.size()
- << ", at schemeshard: " << ssId);
-
- TAutoPtr<TEvPersQueue::TEvUpdateConfig> event(new TEvPersQueue::TEvUpdateConfig());
- event->Record.SetTxId(ui64(OperationId.GetTxId()));
- if (!tabletConfig->empty()) {
- bool parseOk = ParseFromStringNoSizeLimit(*event->Record.MutableTabletConfig(), *tabletConfig);
- Y_VERIFY(parseOk);
- }
+ txState->ShardsInProgress.erase(idx);
+
+ // Dettach datashard pipe
+ context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, idx);
+
+ if (txState->ShardsInProgress.empty()) {
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
+ return true;
+ }
+
+ return false;
+ }
+
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint()
+ << " HandleReply ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreatePQGroup || txState->TxType == TTxState::TxAlterPQGroup);
+
+ txState->ClearShardsInProgress();
+
+ TString topicName = context.SS->PathsById.at(txState->TargetPathId)->Name;
+ Y_VERIFY_S(topicName.size(),
+ "topicName is empty"
+ <<", pathId: " << txState->TargetPathId);
+
+ TPersQueueGroupInfo::TPtr pqGroup = context.SS->PersQueueGroups[txState->TargetPathId];
+ Y_VERIFY_S(pqGroup,
+ "pqGroup is null"
+ << ", pathId " << txState->TargetPathId);
+
+ TString* tabletConfig = &pqGroup->TabletConfig;
+ if (pqGroup->AlterData) {
+ if (!pqGroup->AlterData->TabletConfig.empty())
+ tabletConfig = &pqGroup->AlterData->TabletConfig;
+ }
+
+ for (auto shard : txState->Shards) {
+ TShardIdx idx = shard.Idx;
+ TTabletId tabletId = context.SS->ShardInfos.at(idx).TabletID;
+
+ if (shard.TabletType == ETabletType::PersQueue) {
+ TPQShardInfo::TPtr pqShard = pqGroup->Shards.at(idx);
+ Y_VERIFY_S(pqShard, "pqShard is null, idx is " << idx << " has was "<< THash<TShardIdx>()(idx));
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Propose configure PersQueue"
+ << ", opId: " << OperationId
+ << ", tabletId: " << tabletId
+ << ", PQInfos size: " << pqShard->PQInfos.size()
+ << ", at schemeshard: " << ssId);
+
+ TAutoPtr<TEvPersQueue::TEvUpdateConfig> event(new TEvPersQueue::TEvUpdateConfig());
+ event->Record.SetTxId(ui64(OperationId.GetTxId()));
+ if (!tabletConfig->empty()) {
+ bool parseOk = ParseFromStringNoSizeLimit(*event->Record.MutableTabletConfig(), *tabletConfig);
+ Y_VERIFY(parseOk);
+ }
event->Record.MutableTabletConfig()->SetTopicName(topicName);
event->Record.MutableTabletConfig()->SetTopicPath(TPath::Init(txState->TargetPathId, context.SS).PathString());
- event->Record.MutableTabletConfig()->MutablePartitionConfig()->SetTotalPartitions(pqGroup->AlterData ? pqGroup->AlterData->TotalGroupCount : pqGroup->TotalGroupCount);
-
- event->Record.MutableTabletConfig()->SetVersion(pqGroup->AlterVersion + 1);
-
- for (const auto& pq : pqShard->PQInfos) {
+ event->Record.MutableTabletConfig()->MutablePartitionConfig()->SetTotalPartitions(pqGroup->AlterData ? pqGroup->AlterData->TotalGroupCount : pqGroup->TotalGroupCount);
+
+ event->Record.MutableTabletConfig()->SetVersion(pqGroup->AlterVersion + 1);
+
+ for (const auto& pq : pqShard->PQInfos) {
event->Record.MutableTabletConfig()->AddPartitionIds(pq.PqId);
auto& partition = *event->Record.MutableTabletConfig()->AddPartitions();
@@ -1031,373 +1031,373 @@ public:
if (pq.KeyRange) {
pq.KeyRange->SerializeToProto(*partition.MutableKeyRange());
}
- }
-
+ }
+
if (pqGroup->AlterData && pqGroup->AlterData->BootstrapConfig) {
Y_VERIFY(txState->TxType == TTxState::TxCreatePQGroup);
const bool ok = ParseFromStringNoSizeLimit(*event->Record.MutableBootstrapConfig(), pqGroup->AlterData->BootstrapConfig);
Y_VERIFY(ok);
}
- context.OnComplete.BindMsgToPipe(OperationId, tabletId, idx, event.Release());
- } else {
- Y_VERIFY(shard.TabletType == ETabletType::PersQueueReadBalancer);
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Propose configure PersQueueReadBalancer"
- << ", opId: " << OperationId
- << ", tabletId: " << tabletId
- << ", at schemeshard: " << ssId);
-
- pqGroup->BalancerTabletID = tabletId;
- if (pqGroup->AlterData) {
- pqGroup->AlterData->BalancerTabletID = tabletId;
- }
-
- if (pqGroup->AlterData) {
- pqGroup->AlterData->BalancerShardIdx = idx;
- }
-
- TAutoPtr<TEvPersQueue::TEvUpdateBalancerConfig> event(new TEvPersQueue::TEvUpdateBalancerConfig());
- event->Record.SetTxId(ui64(OperationId.GetTxId()));
-
- if (!tabletConfig->empty()) {
- bool parseOk = ParseFromStringNoSizeLimit(*event->Record.MutableTabletConfig(), *tabletConfig);
- Y_VERIFY(parseOk);
- }
-
- Y_VERIFY(pqGroup->AlterData);
-
- event->Record.SetTopicName(topicName);
- event->Record.SetPathId(txState->TargetPathId.LocalPathId);
+ context.OnComplete.BindMsgToPipe(OperationId, tabletId, idx, event.Release());
+ } else {
+ Y_VERIFY(shard.TabletType == ETabletType::PersQueueReadBalancer);
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Propose configure PersQueueReadBalancer"
+ << ", opId: " << OperationId
+ << ", tabletId: " << tabletId
+ << ", at schemeshard: " << ssId);
+
+ pqGroup->BalancerTabletID = tabletId;
+ if (pqGroup->AlterData) {
+ pqGroup->AlterData->BalancerTabletID = tabletId;
+ }
+
+ if (pqGroup->AlterData) {
+ pqGroup->AlterData->BalancerShardIdx = idx;
+ }
+
+ TAutoPtr<TEvPersQueue::TEvUpdateBalancerConfig> event(new TEvPersQueue::TEvUpdateBalancerConfig());
+ event->Record.SetTxId(ui64(OperationId.GetTxId()));
+
+ if (!tabletConfig->empty()) {
+ bool parseOk = ParseFromStringNoSizeLimit(*event->Record.MutableTabletConfig(), *tabletConfig);
+ Y_VERIFY(parseOk);
+ }
+
+ Y_VERIFY(pqGroup->AlterData);
+
+ event->Record.SetTopicName(topicName);
+ event->Record.SetPathId(txState->TargetPathId.LocalPathId);
event->Record.SetPath(TPath::Init(txState->TargetPathId, context.SS).PathString());
- event->Record.SetPartitionPerTablet(pqGroup->AlterData ? pqGroup->AlterData->MaxPartsPerTablet : pqGroup->MaxPartsPerTablet);
- event->Record.SetSchemeShardId(context.SS->TabletID());
-
- event->Record.SetTotalGroupCount(pqGroup->AlterData ? pqGroup->AlterData->TotalGroupCount : pqGroup->TotalGroupCount);
- event->Record.SetNextPartitionId(pqGroup->AlterData ? pqGroup->AlterData->NextPartitionId : pqGroup->NextPartitionId);
-
- event->Record.SetVersion(pqGroup->AlterVersion + 1);
-
- for (const auto& p : pqGroup->Shards) {
- const auto& pqShard = p.second;
- const auto& tabletId = context.SS->ShardInfos[p.first].TabletID;
- auto tablet = event->Record.AddTablets();
- tablet->SetTabletId(ui64(tabletId));
- tablet->SetOwner(context.SS->TabletID());
- tablet->SetIdx(ui64(p.first.GetLocalId()));
- for (const auto& pq : pqShard->PQInfos) {
- auto info = event->Record.AddPartitions();
- info->SetPartition(pq.PqId);
- info->SetTabletId(ui64(tabletId));
- info->SetGroup(pq.GroupId);
- }
- }
-
- context.OnComplete.BindMsgToPipe(OperationId, tabletId, idx, event.Release());
- }
- }
-
- txState->UpdateShardsInProgress();
- return false;
- }
-};
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ event->Record.SetPartitionPerTablet(pqGroup->AlterData ? pqGroup->AlterData->MaxPartsPerTablet : pqGroup->MaxPartsPerTablet);
+ event->Record.SetSchemeShardId(context.SS->TabletID());
+
+ event->Record.SetTotalGroupCount(pqGroup->AlterData ? pqGroup->AlterData->TotalGroupCount : pqGroup->TotalGroupCount);
+ event->Record.SetNextPartitionId(pqGroup->AlterData ? pqGroup->AlterData->NextPartitionId : pqGroup->NextPartitionId);
+
+ event->Record.SetVersion(pqGroup->AlterVersion + 1);
+
+ for (const auto& p : pqGroup->Shards) {
+ const auto& pqShard = p.second;
+ const auto& tabletId = context.SS->ShardInfos[p.first].TabletID;
+ auto tablet = event->Record.AddTablets();
+ tablet->SetTabletId(ui64(tabletId));
+ tablet->SetOwner(context.SS->TabletID());
+ tablet->SetIdx(ui64(p.first.GetLocalId()));
+ for (const auto& pq : pqShard->PQInfos) {
+ auto info = event->Record.AddPartitions();
+ info->SetPartition(pq.PqId);
+ info->SetTabletId(ui64(tabletId));
+ info->SetGroup(pq.GroupId);
+ }
+ }
+
+ context.OnComplete.BindMsgToPipe(OperationId, tabletId, idx, event.Release());
+ }
+ }
+
+ txState->UpdateShardsInProgress();
+ return false;
+ }
+};
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "NPQState::TPropose"
- << " operationId#" << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvPersQueue::TEvUpdateConfigResponse::EventType});
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint()
- << " HandleReply TEvOperationPlan"
- << ", step: " << step
- << ", at tablet: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- if(!txState) {
- return false;
- }
- Y_VERIFY(txState->TxType == TTxState::TxCreatePQGroup || txState->TxType == TTxState::TxAlterPQGroup);
-
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- path->StepCreated = step;
- context.SS->PersistCreateStep(db, pathId, step);
-
- if (txState->TxType == TTxState::TxCreatePQGroup) {
- auto parentDir = context.SS->PathsById.at(path->ParentPathId);
- ++parentDir->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir);
- context.SS->ClearDescribePathCaches(parentDir);
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
- }
-
- context.SS->ClearDescribePathCaches(path);
- context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
-
- TPersQueueGroupInfo::TPtr pqGroup = context.SS->PersQueueGroups[pathId];
- pqGroup->FinishAlter();
- context.SS->PersistPersQueueGroup(db, pathId, pqGroup);
- context.SS->PersistRemovePersQueueGroupAlter(db, pathId);
-
+ return TStringBuilder()
+ << "NPQState::TPropose"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvPersQueue::TEvUpdateConfigResponse::EventType});
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint()
+ << " HandleReply TEvOperationPlan"
+ << ", step: " << step
+ << ", at tablet: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ if(!txState) {
+ return false;
+ }
+ Y_VERIFY(txState->TxType == TTxState::TxCreatePQGroup || txState->TxType == TTxState::TxAlterPQGroup);
+
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ path->StepCreated = step;
+ context.SS->PersistCreateStep(db, pathId, step);
+
+ if (txState->TxType == TTxState::TxCreatePQGroup) {
+ auto parentDir = context.SS->PathsById.at(path->ParentPathId);
+ ++parentDir->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir);
+ context.SS->ClearDescribePathCaches(parentDir);
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
+ }
+
+ context.SS->ClearDescribePathCaches(path);
+ context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
+
+ TPersQueueGroupInfo::TPtr pqGroup = context.SS->PersQueueGroups[pathId];
+ pqGroup->FinishAlter();
+ context.SS->PersistPersQueueGroup(db, pathId, pqGroup);
+ context.SS->PersistRemovePersQueueGroupAlter(db, pathId);
+
context.SS->ChangeTxState(db, OperationId, TTxState::Done);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "NPQState::TPropose ProgressState"
- << ", operationId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreatePQGroup || txState->TxType == TTxState::TxAlterPQGroup);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-}
-
-namespace NBSVState {
-
-class TConfigureParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "NPQState::TPropose ProgressState"
+ << ", operationId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreatePQGroup || txState->TxType == TTxState::TxAlterPQGroup);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+}
+
+namespace NBSVState {
+
+class TConfigureParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "NBSVState::TConfigureParts"
- << " operationId: " << OperationId;
- }
-
-public:
- TConfigureParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
- }
-
- bool HandleReply(TEvBlockStore::TEvUpdateVolumeConfigResponse::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvSetConfigResult"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreateBlockStoreVolume || txState->TxType == TTxState::TxAlterBlockStoreVolume);
- Y_VERIFY(txState->State == TTxState::ConfigureParts);
-
- TTabletId tabletId = TTabletId(ev->Get()->Record.GetOrigin());
- NKikimrBlockStore::EStatus status = ev->Get()->Record.GetStatus();
-
- // Schemeshard never sends invalid or outdated configs
- Y_VERIFY_S(status == NKikimrBlockStore::OK || status == NKikimrBlockStore::ERROR_UPDATE_IN_PROGRESS,
- "Unexpected error in UpdateVolumeConfigResponse,"
- << " status " << NKikimrBlockStore::EStatus_Name(status)
- << " Tx " << OperationId
- << " tablet " << tabletId);
-
- if (status == NKikimrBlockStore::ERROR_UPDATE_IN_PROGRESS) {
- LOG_ERROR_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "BlockStore reconfiguration is in progress. We'll try to finish it later."
- << " Tx " << OperationId
- << " tablet " << tabletId);
- return false;
- }
-
+ return TStringBuilder()
+ << "NBSVState::TConfigureParts"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TConfigureParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
+ }
+
+ bool HandleReply(TEvBlockStore::TEvUpdateVolumeConfigResponse::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvSetConfigResult"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateBlockStoreVolume || txState->TxType == TTxState::TxAlterBlockStoreVolume);
+ Y_VERIFY(txState->State == TTxState::ConfigureParts);
+
+ TTabletId tabletId = TTabletId(ev->Get()->Record.GetOrigin());
+ NKikimrBlockStore::EStatus status = ev->Get()->Record.GetStatus();
+
+ // Schemeshard never sends invalid or outdated configs
+ Y_VERIFY_S(status == NKikimrBlockStore::OK || status == NKikimrBlockStore::ERROR_UPDATE_IN_PROGRESS,
+ "Unexpected error in UpdateVolumeConfigResponse,"
+ << " status " << NKikimrBlockStore::EStatus_Name(status)
+ << " Tx " << OperationId
+ << " tablet " << tabletId);
+
+ if (status == NKikimrBlockStore::ERROR_UPDATE_IN_PROGRESS) {
+ LOG_ERROR_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "BlockStore reconfiguration is in progress. We'll try to finish it later."
+ << " Tx " << OperationId
+ << " tablet " << tabletId);
+ return false;
+ }
+
TShardIdx idx = context.SS->MustGetShardIdx(tabletId);
- txState->ShardsInProgress.erase(idx);
-
- context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, idx);
-
- if (txState->ShardsInProgress.empty()) {
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
- context.OnComplete.ActivateTx(OperationId);
- return true;
- }
-
- return false;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreateBlockStoreVolume || txState->TxType == TTxState::TxAlterBlockStoreVolume);
- Y_VERIFY(!txState->Shards.empty());
-
- txState->ClearShardsInProgress();
-
- TBlockStoreVolumeInfo::TPtr volume = context.SS->BlockStoreVolumes[txState->TargetPathId];
- Y_VERIFY_S(volume, "volume is null. PathId: " << txState->TargetPathId);
-
- ui64 version = volume->AlterVersion;
- const auto* volumeConfig = &volume->VolumeConfig;
- if (volume->AlterData) {
- version = volume->AlterData->AlterVersion;
- volumeConfig = &volume->AlterData->VolumeConfig;
- }
-
- for (auto shard : txState->Shards) {
+ txState->ShardsInProgress.erase(idx);
+
+ context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, idx);
+
+ if (txState->ShardsInProgress.empty()) {
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
+ context.OnComplete.ActivateTx(OperationId);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateBlockStoreVolume || txState->TxType == TTxState::TxAlterBlockStoreVolume);
+ Y_VERIFY(!txState->Shards.empty());
+
+ txState->ClearShardsInProgress();
+
+ TBlockStoreVolumeInfo::TPtr volume = context.SS->BlockStoreVolumes[txState->TargetPathId];
+ Y_VERIFY_S(volume, "volume is null. PathId: " << txState->TargetPathId);
+
+ ui64 version = volume->AlterVersion;
+ const auto* volumeConfig = &volume->VolumeConfig;
+ if (volume->AlterData) {
+ version = volume->AlterData->AlterVersion;
+ volumeConfig = &volume->AlterData->VolumeConfig;
+ }
+
+ for (auto shard : txState->Shards) {
if (shard.TabletType == ETabletType::BlockStorePartition ||
shard.TabletType == ETabletType::BlockStorePartition2) {
- continue;
- }
-
- Y_VERIFY(shard.TabletType == ETabletType::BlockStoreVolume);
- TShardIdx shardIdx = shard.Idx;
- TTabletId tabletId = context.SS->ShardInfos[shardIdx].TabletID;
-
- volume->VolumeTabletId = tabletId;
- if (volume->AlterData) {
- volume->AlterData->VolumeTabletId = tabletId;
- volume->AlterData->VolumeShardIdx = shardIdx;
- }
-
- TAutoPtr<TEvBlockStore::TEvUpdateVolumeConfig> event(new TEvBlockStore::TEvUpdateVolumeConfig());
- event->Record.SetTxId(ui64(OperationId.GetTxId()));
-
- event->Record.MutableVolumeConfig()->CopyFrom(*volumeConfig);
- event->Record.MutableVolumeConfig()->SetVersion(version);
-
- for (const auto& p : volume->Shards) {
- const auto& part = p.second;
- const auto& partTabletId = context.SS->ShardInfos[p.first].TabletID;
- auto info = event->Record.AddPartitions();
- info->SetPartitionId(part->PartitionId);
- info->SetTabletId(ui64(partTabletId));
- }
-
- context.OnComplete.BindMsgToPipe(OperationId, tabletId, shardIdx, event.Release());
-
- // Wait for results from this shard
- txState->ShardsInProgress.insert(shardIdx);
- }
-
- return false;
- }
-};
-
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ continue;
+ }
+
+ Y_VERIFY(shard.TabletType == ETabletType::BlockStoreVolume);
+ TShardIdx shardIdx = shard.Idx;
+ TTabletId tabletId = context.SS->ShardInfos[shardIdx].TabletID;
+
+ volume->VolumeTabletId = tabletId;
+ if (volume->AlterData) {
+ volume->AlterData->VolumeTabletId = tabletId;
+ volume->AlterData->VolumeShardIdx = shardIdx;
+ }
+
+ TAutoPtr<TEvBlockStore::TEvUpdateVolumeConfig> event(new TEvBlockStore::TEvUpdateVolumeConfig());
+ event->Record.SetTxId(ui64(OperationId.GetTxId()));
+
+ event->Record.MutableVolumeConfig()->CopyFrom(*volumeConfig);
+ event->Record.MutableVolumeConfig()->SetVersion(version);
+
+ for (const auto& p : volume->Shards) {
+ const auto& part = p.second;
+ const auto& partTabletId = context.SS->ShardInfos[p.first].TabletID;
+ auto info = event->Record.AddPartitions();
+ info->SetPartitionId(part->PartitionId);
+ info->SetTabletId(ui64(partTabletId));
+ }
+
+ context.OnComplete.BindMsgToPipe(OperationId, tabletId, shardIdx, event.Release());
+
+ // Wait for results from this shard
+ txState->ShardsInProgress.insert(shardIdx);
+ }
+
+ return false;
+ }
+};
+
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "NBSVState::TPropose"
- << " operationId#" << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvBlockStore::TEvUpdateVolumeConfigResponse::EventType});
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- if (!txState) {
- return false;
- }
- Y_VERIFY(txState->TxType == TTxState::TxCreateBlockStoreVolume || txState->TxType == TTxState::TxAlterBlockStoreVolume);
-
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- path->StepCreated = step;
- context.SS->PersistCreateStep(db, pathId, step);
-
- TBlockStoreVolumeInfo::TPtr volume = context.SS->BlockStoreVolumes.at(pathId);
-
+ return TStringBuilder()
+ << "NBSVState::TPropose"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvBlockStore::TEvUpdateVolumeConfigResponse::EventType});
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ if (!txState) {
+ return false;
+ }
+ Y_VERIFY(txState->TxType == TTxState::TxCreateBlockStoreVolume || txState->TxType == TTxState::TxAlterBlockStoreVolume);
+
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ path->StepCreated = step;
+ context.SS->PersistCreateStep(db, pathId, step);
+
+ TBlockStoreVolumeInfo::TPtr volume = context.SS->BlockStoreVolumes.at(pathId);
+
auto oldVolumeSpace = volume->GetVolumeSpace();
- volume->FinishAlter();
+ volume->FinishAlter();
auto newVolumeSpace = volume->GetVolumeSpace();
// Decrease in occupied space is appled on tx finish
auto domainDir = context.SS->PathsById.at(context.SS->ResolveDomainId(path));
Y_VERIFY(domainDir);
domainDir->ChangeVolumeSpaceCommit(newVolumeSpace, oldVolumeSpace);
-
- context.SS->PersistBlockStoreVolume(db, pathId, volume);
- context.SS->PersistRemoveBlockStoreVolumeAlter(db, pathId);
-
- if (txState->TxType == TTxState::TxCreateBlockStoreVolume) {
- auto parentDir = context.SS->PathsById.at(path->ParentPathId);
- ++parentDir->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir);
- context.SS->ClearDescribePathCaches(parentDir);
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
- }
-
- context.SS->ClearDescribePathCaches(path);
+
+ context.SS->PersistBlockStoreVolume(db, pathId, volume);
+ context.SS->PersistRemoveBlockStoreVolumeAlter(db, pathId);
+
+ if (txState->TxType == TTxState::TxCreateBlockStoreVolume) {
+ auto parentDir = context.SS->PathsById.at(path->ParentPathId);
+ ++parentDir->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir);
+ context.SS->ClearDescribePathCaches(parentDir);
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
+ }
+
+ context.SS->ClearDescribePathCaches(path);
context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
-
+
context.SS->ChangeTxState(db, OperationId, TTxState::Done);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreateBlockStoreVolume || txState->TxType == TTxState::TxAlterBlockStoreVolume);
-
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-}
-
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateBlockStoreVolume || txState->TxType == TTxState::TxAlterBlockStoreVolume);
+
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+}
+
namespace NCdcStreamState {
class TConfigurePartsAtTable: public TSubOperationState {
@@ -1576,11 +1576,11 @@ private:
} // NCdcStreamState
-namespace NForceDrop {
-void ValidateNoTrasactionOnPathes(TOperationId operationId, const THashSet<TPathId>& pathes, TOperationContext& context);
-
-void CollectShards(const THashSet<TPathId>& pathes, TOperationId operationId, TTxState* txState, TOperationContext& context);
-}
-
-}
-}
+namespace NForceDrop {
+void ValidateNoTrasactionOnPathes(TOperationId operationId, const THashSet<TPathId>& pathes, TOperationContext& context);
+
+void CollectShards(const THashSet<TPathId>& pathes, TOperationId operationId, TTxState* txState, TOperationContext& context);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_consistent_copy_tables.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_consistent_copy_tables.cpp
index 684d09d2813..4cc467dedc2 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_consistent_copy_tables.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_consistent_copy_tables.cpp
@@ -1,162 +1,162 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_path_element.h"
-
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_path_element.h"
+
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/path.h>
#include <ydb/core/protos/flat_tx_scheme.pb.h>
#include <ydb/core/protos/flat_scheme_op.pb.h>
-
-NKikimrSchemeOp::TModifyScheme CopyTableTask(NKikimr::NSchemeShard::TPath& src, NKikimr::NSchemeShard::TPath& dst, bool omitFollowers, bool isBackup) {
- using namespace NKikimr::NSchemeShard;
-
- auto scheme = TransactionTemplate(dst.Parent().PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
- scheme.SetFailOnExist(true);
-
- auto operation = scheme.MutableCreateTable();
+
+NKikimrSchemeOp::TModifyScheme CopyTableTask(NKikimr::NSchemeShard::TPath& src, NKikimr::NSchemeShard::TPath& dst, bool omitFollowers, bool isBackup) {
+ using namespace NKikimr::NSchemeShard;
+
+ auto scheme = TransactionTemplate(dst.Parent().PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
+ scheme.SetFailOnExist(true);
+
+ auto operation = scheme.MutableCreateTable();
operation->SetName(dst.LeafName());
operation->SetCopyFromTable(src.PathString());
operation->SetOmitFollowers(omitFollowers);
operation->SetIsBackup(isBackup);
-
- return scheme;
-}
-
-
-NKikimrSchemeOp::TModifyScheme CreateIndexTask(NKikimr::NSchemeShard::TTableIndexInfo::TPtr indexInfo, NKikimr::NSchemeShard::TPath& dst) {
- using namespace NKikimr::NSchemeShard;
-
- auto scheme = TransactionTemplate(dst.Parent().PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpCreateTableIndex);
- scheme.SetFailOnExist(true);
-
- auto operation = scheme.MutableCreateTableIndex();
- operation->SetName(dst.LeafName());
-
- operation->SetType(indexInfo->Type);
+
+ return scheme;
+}
+
+
+NKikimrSchemeOp::TModifyScheme CreateIndexTask(NKikimr::NSchemeShard::TTableIndexInfo::TPtr indexInfo, NKikimr::NSchemeShard::TPath& dst) {
+ using namespace NKikimr::NSchemeShard;
+
+ auto scheme = TransactionTemplate(dst.Parent().PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpCreateTableIndex);
+ scheme.SetFailOnExist(true);
+
+ auto operation = scheme.MutableCreateTableIndex();
+ operation->SetName(dst.LeafName());
+
+ operation->SetType(indexInfo->Type);
for (const auto& keyName: indexInfo->IndexKeys) {
- *operation->MutableKeyColumnNames()->Add() = keyName;
- }
-
+ *operation->MutableKeyColumnNames()->Add() = keyName;
+ }
+
for (const auto& dataColumn: indexInfo->IndexDataColumns) {
*operation->MutableDataColumnNames()->Add() = dataColumn;
}
- return scheme;
-}
-
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+ return scheme;
+}
+
+
+namespace NKikimr {
+namespace NSchemeShard {
+
TVector<ISubOperationBase::TPtr> CreateConsistentCopyTables(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context) {
- Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpCreateConsistentCopyTables);
-
+ Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpCreateConsistentCopyTables);
+
auto consistentCopying = tx.GetCreateConsistentCopyTables();
-
- if (0 == consistentCopying.CopyTableDescriptionsSize()) {
- TString msg = TStringBuilder() << "no task to do, empty list CopyTableDescriptions";
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
- }
-
+
+ if (0 == consistentCopying.CopyTableDescriptionsSize()) {
+ TString msg = TStringBuilder() << "no task to do, empty list CopyTableDescriptions";
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
+ }
+
TPath firstPath = TPath::Resolve(consistentCopying.GetCopyTableDescriptions(0).GetSrcPath(), context.SS);
- {
- auto checks = TPath::TChecker(firstPath);
- checks
- .NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard();
-
- if (!checks) {
- TStringBuilder explain = TStringBuilder() << "a path fails checks"
- << ", path: " << firstPath.PathString();
- auto status = checks.GetStatus(&explain);
- return {CreateReject(nextId, status, explain)};
- }
- }
-
- TSubDomainInfo::TPtr domainInfo = firstPath.DomainInfo();
- if (consistentCopying.CopyTableDescriptionsSize() > domainInfo->GetSchemeLimits().MaxConsistentCopyTargets) {
- auto msg = TStringBuilder() << "Targets count has reached maximum value"
- << ", limit for consistent copying in domain: " << domainInfo->GetSchemeLimits().MaxConsistentCopyTargets
- << ", intention to consistent copy: " << consistentCopying.CopyTableDescriptionsSize();
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
- }
-
- {
- TString errStr;
- if (!context.SS->CheckApplyIf(tx, errStr)) {
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusPreconditionFailed, errStr)};
- }
- }
-
- TVector<ISubOperationBase::TPtr> result;
-
+ {
+ auto checks = TPath::TChecker(firstPath);
+ checks
+ .NotEmpty()
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard();
+
+ if (!checks) {
+ TStringBuilder explain = TStringBuilder() << "a path fails checks"
+ << ", path: " << firstPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ return {CreateReject(nextId, status, explain)};
+ }
+ }
+
+ TSubDomainInfo::TPtr domainInfo = firstPath.DomainInfo();
+ if (consistentCopying.CopyTableDescriptionsSize() > domainInfo->GetSchemeLimits().MaxConsistentCopyTargets) {
+ auto msg = TStringBuilder() << "Targets count has reached maximum value"
+ << ", limit for consistent copying in domain: " << domainInfo->GetSchemeLimits().MaxConsistentCopyTargets
+ << ", intention to consistent copy: " << consistentCopying.CopyTableDescriptionsSize();
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
+ }
+
+ {
+ TString errStr;
+ if (!context.SS->CheckApplyIf(tx, errStr)) {
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusPreconditionFailed, errStr)};
+ }
+ }
+
+ TVector<ISubOperationBase::TPtr> result;
+
for (auto& descr: consistentCopying.GetCopyTableDescriptions()) {
- auto& srcStr = descr.GetSrcPath();
- auto& dstStr = descr.GetDstPath();
-
- TPath srcPath = TPath::Resolve(srcStr, context.SS);
- {
- TPath::TChecker checks = srcPath.Check();
- checks.IsResolved()
- .NotDeleted()
- .IsTable()
- .IsCommonSensePath()
- .IsTheSameDomain(firstPath);
-
- if (!checks) {
- TStringBuilder explain = TStringBuilder() << "src path fail checks"
- << ", path: " << srcStr;
- auto status = checks.GetStatus(&explain);
- return {CreateReject(nextId, status, explain)};
- }
- }
-
- TPath dstPath = TPath::Resolve(dstStr, context.SS);
- TPath dstParentPath = dstPath.Parent();
-
- result.push_back(CreateCopyTable(TOperationId(nextId.GetTxId(),
- nextId.GetSubTxId() + result.size()),
+ auto& srcStr = descr.GetSrcPath();
+ auto& dstStr = descr.GetDstPath();
+
+ TPath srcPath = TPath::Resolve(srcStr, context.SS);
+ {
+ TPath::TChecker checks = srcPath.Check();
+ checks.IsResolved()
+ .NotDeleted()
+ .IsTable()
+ .IsCommonSensePath()
+ .IsTheSameDomain(firstPath);
+
+ if (!checks) {
+ TStringBuilder explain = TStringBuilder() << "src path fail checks"
+ << ", path: " << srcStr;
+ auto status = checks.GetStatus(&explain);
+ return {CreateReject(nextId, status, explain)};
+ }
+ }
+
+ TPath dstPath = TPath::Resolve(dstStr, context.SS);
+ TPath dstParentPath = dstPath.Parent();
+
+ result.push_back(CreateCopyTable(TOperationId(nextId.GetTxId(),
+ nextId.GetSubTxId() + result.size()),
CopyTableTask(srcPath, dstPath, descr.GetOmitFollowers(), descr.GetIsBackup())));
-
- if (descr.GetOmitIndexes()) {
- continue;
- }
-
+
+ if (descr.GetOmitIndexes()) {
+ continue;
+ }
+
for (const auto& child: srcPath.Base()->GetChildren()) {
const auto& name = child.first;
const auto& pathId = child.second;
-
- TPath srcIndexPath = srcPath.Child(name);
- TPath dstIndexPath = dstPath.Child(name);
-
- if (srcIndexPath.IsDeleted()) {
- continue;
- }
-
+
+ TPath srcIndexPath = srcPath.Child(name);
+ TPath dstIndexPath = dstPath.Child(name);
+
+ if (srcIndexPath.IsDeleted()) {
+ continue;
+ }
+
if (!srcIndexPath.IsTableIndex()) {
continue;
}
Y_VERIFY(srcIndexPath.Base()->PathId == pathId);
- Y_VERIFY_S(srcIndexPath.Base()->GetChildren().size() == 1, srcIndexPath.PathString() << " has children " << srcIndexPath.Base()->GetChildren().size() << " but 1 exected");
-
- TTableIndexInfo::TPtr indexInfo = context.SS->Indexes.at(pathId);
+ Y_VERIFY_S(srcIndexPath.Base()->GetChildren().size() == 1, srcIndexPath.PathString() << " has children " << srcIndexPath.Base()->GetChildren().size() << " but 1 exected");
+
+ TTableIndexInfo::TPtr indexInfo = context.SS->Indexes.at(pathId);
result.push_back(CreateNewTableIndex(NextPartId(nextId, result), CreateIndexTask(indexInfo, dstIndexPath)));
-
- TString srcImplTableName = srcIndexPath.Base()->GetChildren().begin()->first;
- TPath srcImplTable = srcIndexPath.Child(srcImplTableName);
+
+ TString srcImplTableName = srcIndexPath.Base()->GetChildren().begin()->first;
+ TPath srcImplTable = srcIndexPath.Child(srcImplTableName);
Y_VERIFY(srcImplTable.Base()->PathId == srcIndexPath.Base()->GetChildren().begin()->second);
- TPath dstImplTable = dstIndexPath.Child(srcImplTableName);
-
+ TPath dstImplTable = dstIndexPath.Child(srcImplTableName);
+
result.push_back(CreateCopyTable(NextPartId(nextId, result),
CopyTableTask(srcImplTable, dstImplTable, descr.GetOmitFollowers(), descr.GetIsBackup())));
- }
- }
-
- return result;
-}
-
-}
-}
+ }
+ }
+
+ return result;
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp
index 70a4b49c4c0..f504c34ef58 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_copy_table.cpp
@@ -1,427 +1,427 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-void PrepareScheme(NKikimrSchemeOp::TTableDescription* schema, const TString& name, const TTableInfo::TPtr srcTableInfo, TOperationContext &context) {
- const NScheme::TTypeRegistry* typeRegistry = AppData(context.Ctx)->TypeRegistry;
-
- NKikimrSchemeOp::TTableDescription completedSchema;
- context.SS->DescribeTable(srcTableInfo, typeRegistry, true, false, &completedSchema);
- completedSchema.SetName(name);
-
- //inherit all from Src exept PartitionConfig, PartitionConfig could be altered
- completedSchema.MutablePartitionConfig()->CopyFrom(schema->GetPartitionConfig());
- schema->Swap(&completedSchema);
-}
-
-class TConfigureParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
- TString DebugHint() const override {
- return TStringBuilder()
- << "TCopyTable TConfigureParts"
- << " operationId#" << OperationId;
- }
-
-public:
- TConfigureParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, });
- }
-
- bool HandleReply(TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvProposeTransactionResult"
- << " at tabletId# " << ssId
- << " message# " << ev->Get()->Record.ShortDebugString());
-
- return NTableState::CollectProposeTransactionResults(OperationId, ev, context);
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << " at tablet" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- txState->ClearShardsInProgress();
-
- Y_VERIFY(txState->SourcePathId != InvalidPathId);
- Y_VERIFY(txState->TargetPathId != InvalidPathId);
- const TTableInfo::TPtr srcTableInfo = *context.SS->Tables.FindPtr(txState->SourcePathId);
- const TTableInfo::TPtr dstTableInfo = *context.SS->Tables.FindPtr(txState->TargetPathId);
-
- Y_VERIFY(srcTableInfo->GetPartitions().size() == dstTableInfo->GetPartitions().size(),
- "CopyTable paritition counts don't match");
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+void PrepareScheme(NKikimrSchemeOp::TTableDescription* schema, const TString& name, const TTableInfo::TPtr srcTableInfo, TOperationContext &context) {
+ const NScheme::TTypeRegistry* typeRegistry = AppData(context.Ctx)->TypeRegistry;
+
+ NKikimrSchemeOp::TTableDescription completedSchema;
+ context.SS->DescribeTable(srcTableInfo, typeRegistry, true, false, &completedSchema);
+ completedSchema.SetName(name);
+
+ //inherit all from Src exept PartitionConfig, PartitionConfig could be altered
+ completedSchema.MutablePartitionConfig()->CopyFrom(schema->GetPartitionConfig());
+ schema->Swap(&completedSchema);
+}
+
+class TConfigureParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
+ TString DebugHint() const override {
+ return TStringBuilder()
+ << "TCopyTable TConfigureParts"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TConfigureParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, });
+ }
+
+ bool HandleReply(TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvProposeTransactionResult"
+ << " at tabletId# " << ssId
+ << " message# " << ev->Get()->Record.ShortDebugString());
+
+ return NTableState::CollectProposeTransactionResults(OperationId, ev, context);
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << " at tablet" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ txState->ClearShardsInProgress();
+
+ Y_VERIFY(txState->SourcePathId != InvalidPathId);
+ Y_VERIFY(txState->TargetPathId != InvalidPathId);
+ const TTableInfo::TPtr srcTableInfo = *context.SS->Tables.FindPtr(txState->SourcePathId);
+ const TTableInfo::TPtr dstTableInfo = *context.SS->Tables.FindPtr(txState->TargetPathId);
+
+ Y_VERIFY(srcTableInfo->GetPartitions().size() == dstTableInfo->GetPartitions().size(),
+ "CopyTable paritition counts don't match");
const ui64 dstSchemaVersion = NEW_TABLE_ALTER_VERSION;
-
+
const ui64 subDomainPathId = context.SS->ResolveDomainId(txState->TargetPathId).LocalPathId;
- for (ui32 i = 0; i < dstTableInfo->GetPartitions().size(); ++i) {
- TShardIdx srcShardIdx = srcTableInfo->GetPartitions()[i].ShardIdx;
- TTabletId srcDatashardId = context.SS->ShardInfos[srcShardIdx].TabletID;
-
- TShardIdx dstShardIdx = dstTableInfo->GetPartitions()[i].ShardIdx;
- TTabletId dstDatashardId = context.SS->ShardInfos[dstShardIdx].TabletID;
-
- auto seqNo = context.SS->StartRound(*txState);
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " Propose modify scheme on dstDatashard# " << dstDatashardId
- << " idx# " << dstShardIdx
- << " srcDatashard# " << srcDatashardId
- << " idx# " << srcShardIdx
- << " operationId# " << OperationId
- << " seqNo# " << seqNo
- << " at tablet# " << ssId);
-
- // Send "CreateTable + ReceiveParts" transaction to destination datashard
- NKikimrTxDataShard::TFlatSchemeTransaction newShardTx;
- context.SS->FillSeqNo(newShardTx, seqNo);
+ for (ui32 i = 0; i < dstTableInfo->GetPartitions().size(); ++i) {
+ TShardIdx srcShardIdx = srcTableInfo->GetPartitions()[i].ShardIdx;
+ TTabletId srcDatashardId = context.SS->ShardInfos[srcShardIdx].TabletID;
+
+ TShardIdx dstShardIdx = dstTableInfo->GetPartitions()[i].ShardIdx;
+ TTabletId dstDatashardId = context.SS->ShardInfos[dstShardIdx].TabletID;
+
+ auto seqNo = context.SS->StartRound(*txState);
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " Propose modify scheme on dstDatashard# " << dstDatashardId
+ << " idx# " << dstShardIdx
+ << " srcDatashard# " << srcDatashardId
+ << " idx# " << srcShardIdx
+ << " operationId# " << OperationId
+ << " seqNo# " << seqNo
+ << " at tablet# " << ssId);
+
+ // Send "CreateTable + ReceiveParts" transaction to destination datashard
+ NKikimrTxDataShard::TFlatSchemeTransaction newShardTx;
+ context.SS->FillSeqNo(newShardTx, seqNo);
context.SS->FillTableDescription(txState->TargetPathId, i, dstSchemaVersion, newShardTx.MutableCreateTable());
- newShardTx.MutableReceiveSnapshot()->SetTableId_Deprecated(txState->TargetPathId.LocalPathId);
- newShardTx.MutableReceiveSnapshot()->MutableTableId()->SetOwnerId(txState->TargetPathId.OwnerId);
- newShardTx.MutableReceiveSnapshot()->MutableTableId()->SetTableId(txState->TargetPathId.LocalPathId);
- newShardTx.MutableReceiveSnapshot()->AddReceiveFrom()->SetShard(ui64(srcDatashardId));
- TString txBody;
+ newShardTx.MutableReceiveSnapshot()->SetTableId_Deprecated(txState->TargetPathId.LocalPathId);
+ newShardTx.MutableReceiveSnapshot()->MutableTableId()->SetOwnerId(txState->TargetPathId.OwnerId);
+ newShardTx.MutableReceiveSnapshot()->MutableTableId()->SetTableId(txState->TargetPathId.LocalPathId);
+ newShardTx.MutableReceiveSnapshot()->AddReceiveFrom()->SetShard(ui64(srcDatashardId));
+ TString txBody;
Y_PROTOBUF_SUPPRESS_NODISCARD newShardTx.SerializeToString(&txBody);
-
- THolder<TEvDataShard::TEvProposeTransaction> dstEvent =
+
+ THolder<TEvDataShard::TEvProposeTransaction> dstEvent =
THolder(new TEvDataShard::TEvProposeTransaction(NKikimrTxDataShard::TX_KIND_SCHEME,
- context.SS->TabletID(),
+ context.SS->TabletID(),
subDomainPathId,
- context.Ctx.SelfID,
- ui64(OperationId.GetTxId()),
- txBody,
+ context.Ctx.SelfID,
+ ui64(OperationId.GetTxId()),
+ txBody,
context.SS->SelectProcessingPrarams(txState->TargetPathId)));
- context.OnComplete.BindMsgToPipe(OperationId, dstDatashardId, dstShardIdx, dstEvent.Release());
-
- // Send "SendParts" transaction to source datashard
- NKikimrTxDataShard::TFlatSchemeTransaction oldShardTx;
- context.SS->FillSeqNo(oldShardTx, seqNo);
- oldShardTx.MutableSendSnapshot()->SetTableId_Deprecated(txState->SourcePathId.LocalPathId);
- oldShardTx.MutableSendSnapshot()->MutableTableId()->SetOwnerId(txState->SourcePathId.OwnerId);
- oldShardTx.MutableSendSnapshot()->MutableTableId()->SetTableId(txState->SourcePathId.LocalPathId);
- oldShardTx.MutableSendSnapshot()->AddSendTo()->SetShard(ui64(dstDatashardId));
- oldShardTx.SetReadOnly(true);
- txBody.clear();
+ context.OnComplete.BindMsgToPipe(OperationId, dstDatashardId, dstShardIdx, dstEvent.Release());
+
+ // Send "SendParts" transaction to source datashard
+ NKikimrTxDataShard::TFlatSchemeTransaction oldShardTx;
+ context.SS->FillSeqNo(oldShardTx, seqNo);
+ oldShardTx.MutableSendSnapshot()->SetTableId_Deprecated(txState->SourcePathId.LocalPathId);
+ oldShardTx.MutableSendSnapshot()->MutableTableId()->SetOwnerId(txState->SourcePathId.OwnerId);
+ oldShardTx.MutableSendSnapshot()->MutableTableId()->SetTableId(txState->SourcePathId.LocalPathId);
+ oldShardTx.MutableSendSnapshot()->AddSendTo()->SetShard(ui64(dstDatashardId));
+ oldShardTx.SetReadOnly(true);
+ txBody.clear();
Y_PROTOBUF_SUPPRESS_NODISCARD oldShardTx.SerializeToString(&txBody);
- THolder<TEvDataShard::TEvProposeTransaction> srcEvent =
+ THolder<TEvDataShard::TEvProposeTransaction> srcEvent =
THolder(new TEvDataShard::TEvProposeTransaction(NKikimrTxDataShard::TX_KIND_SCHEME,
- context.SS->TabletID(),
- context.Ctx.SelfID,
- ui64(OperationId.GetTxId()),
- txBody,
+ context.SS->TabletID(),
+ context.Ctx.SelfID,
+ ui64(OperationId.GetTxId()),
+ txBody,
context.SS->SelectProcessingPrarams(txState->TargetPathId)));
- context.OnComplete.BindMsgToPipe(OperationId, srcDatashardId, srcShardIdx, srcEvent.Release());
- }
-
- txState->UpdateShardsInProgress();
- return false;
- }
-};
-
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
- TString DebugHint() const override {
- return TStringBuilder()
- << "TCopyTable TPropose"
- << " operationId#" << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(),
- {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvDataShard::TEvSchemaChanged"
- << " triggers early, save it"
- << ", at schemeshard: " << ssId);
-
- NTableState::CollectSchemaChanged(OperationId, ev, context);
- return false;
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", stepId: " << step
- << ", at schemeshard" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
-
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- path->StepCreated = step;
- context.SS->PersistCreateStep(db, pathId, step);
-
- TTableInfo::TPtr table = context.SS->Tables[pathId];
- Y_VERIFY(table);
+ context.OnComplete.BindMsgToPipe(OperationId, srcDatashardId, srcShardIdx, srcEvent.Release());
+ }
+
+ txState->UpdateShardsInProgress();
+ return false;
+ }
+};
+
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
+ TString DebugHint() const override {
+ return TStringBuilder()
+ << "TCopyTable TPropose"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(),
+ {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvDataShard::TEvSchemaChanged"
+ << " triggers early, save it"
+ << ", at schemeshard: " << ssId);
+
+ NTableState::CollectSchemaChanged(OperationId, ev, context);
+ return false;
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", stepId: " << step
+ << ", at schemeshard" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ path->StepCreated = step;
+ context.SS->PersistCreateStep(db, pathId, step);
+
+ TTableInfo::TPtr table = context.SS->Tables[pathId];
+ Y_VERIFY(table);
table->AlterVersion = NEW_TABLE_ALTER_VERSION;
- context.SS->PersistTableCreated(db, pathId);
-
- context.SS->TabletCounters->Simple()[COUNTER_TABLE_COUNT].Add(1);
-
- auto parentDir = context.SS->PathsById.at(path->ParentPathId); // TargetPathId has been created
- ++parentDir->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir);
- context.SS->ClearDescribePathCaches(parentDir);
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
-
- context.SS->ClearDescribePathCaches(path);
+ context.SS->PersistTableCreated(db, pathId);
+
+ context.SS->TabletCounters->Simple()[COUNTER_TABLE_COUNT].Add(1);
+
+ auto parentDir = context.SS->PathsById.at(path->ParentPathId); // TargetPathId has been created
+ ++parentDir->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir);
+ context.SS->ClearDescribePathCaches(parentDir);
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
+
+ context.SS->ClearDescribePathCaches(path);
context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
- context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- TSet<TTabletId> shardSet;
- for (const auto& shard : txState->Shards) {
- TShardIdx idx = shard.Idx;
- TTabletId tablet = context.SS->ShardInfos.at(idx).TabletID;
- shardSet.insert(tablet);
- }
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, txState->MinStep, shardSet);
- return false;
- }
-};
-
-
-class TCopyTable: public TSubOperation {
- const TOperationId OperationId;
+ context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ TSet<TTabletId> shardSet;
+ for (const auto& shard : txState->Shards) {
+ TShardIdx idx = shard.Idx;
+ TTabletId tablet = context.SS->ShardInfos.at(idx).TabletID;
+ shardSet.insert(tablet);
+ }
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, txState->MinStep, shardSet);
+ return false;
+ }
+};
+
+
+class TCopyTable: public TSubOperation {
+ const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::CreateParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
- return TTxState::ConfigureParts;
- case TTxState::ConfigureParts:
- return TTxState::Propose;
- case TTxState::Propose:
- return TTxState::ProposedWaitParts;
- case TTxState::ProposedWaitParts:
- return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::CreateParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
+ return TTxState::ConfigureParts;
+ case TTxState::ConfigureParts:
+ return TTxState::Propose;
+ case TTxState::Propose:
+ return TTxState::ProposedWaitParts;
+ case TTxState::ProposedWaitParts:
+ return TTxState::Done;
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
return THolder(new TCreateParts(OperationId));
- case TTxState::ConfigureParts:
+ case TTxState::ConfigureParts:
return THolder(new TConfigureParts(OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new TPropose(OperationId));
- case TTxState::ProposedWaitParts:
+ case TTxState::ProposedWaitParts:
return THolder(new NTableState::TProposedWaitParts(OperationId));
- case TTxState::Done:
+ case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TCopyTable(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TCopyTable(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- bool IsShadowDataAllowed() const {
- return AppData()->AllowShadowDataInSchemeShardForTests;
- }
-
-
- THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
- const TString& parentPath = Transaction.GetWorkingDir();
+
+ TCopyTable(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ bool IsShadowDataAllowed() const {
+ return AppData()->AllowShadowDataInSchemeShardForTests;
+ }
+
+
+ THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ const TString& parentPath = Transaction.GetWorkingDir();
const TString& name = Transaction.GetCreateTable().GetName();
- const auto acceptExisted = !Transaction.GetFailOnExist();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCopyTable Propose"
- << ", path: " << parentPath << "/" << name
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- TPath parent = TPath::Resolve(parentPath, context.SS);
- {
- TPath::TChecker checks = parent.Check();
+ const auto acceptExisted = !Transaction.GetFailOnExist();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCopyTable Propose"
+ << ", path: " << parentPath << "/" << name
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ TPath parent = TPath::Resolve(parentPath, context.SS);
+ {
+ TPath::TChecker checks = parent.Check();
checks
.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting();
-
- if (checks) {
- if (parent.Base()->IsTableIndex()) {
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting();
+
+ if (checks) {
+ if (parent.Base()->IsTableIndex()) {
checks
.IsInsideTableIndexPath()
- .IsUnderCreating(NKikimrScheme::StatusNameConflict)
- .IsUnderTheSameOperation(OperationId.GetTxId()); //allow only as part of copying base table
- } else {
+ .IsUnderCreating(NKikimrScheme::StatusNameConflict)
+ .IsUnderTheSameOperation(OperationId.GetTxId()); //allow only as part of copying base table
+ } else {
checks
.NotUnderOperation()
- .IsCommonSensePath()
- .IsLikeDirectory();
- }
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "parent path fail checks"
- << ", path: " << parent.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
+ .IsCommonSensePath()
+ .IsLikeDirectory();
+ }
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent path fail checks"
+ << ", path: " << parent.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
TPath srcPath = TPath::Resolve(Transaction.GetCreateTable().GetCopyFromTable(), context.SS);
- {
- TPath::TChecker checks = srcPath.Check();
+ {
+ TPath::TChecker checks = srcPath.Check();
checks
.NotEmpty()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsTable()
- .NotUnderTheSameOperation(OperationId.GetTxId())
- .NotUnderOperation();
-
- if (checks) {
- if (parent.Base()->IsTableIndex()) {
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsTable()
+ .NotUnderTheSameOperation(OperationId.GetTxId())
+ .NotUnderOperation();
+
+ if (checks) {
+ if (parent.Base()->IsTableIndex()) {
checks
.IsInsideTableIndexPath() //copy imp index table as index index table, not a separate one
- .NotChildren(); //imp table doesnt have indexes
- } else {
- checks.IsCommonSensePath();
- }
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "src path fail checks"
- << ", path: " << srcPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- const ui32 maxShardsToCreate = srcPath.Shards();
+ .NotChildren(); //imp table doesnt have indexes
+ } else {
+ checks.IsCommonSensePath();
+ }
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "src path fail checks"
+ << ", path: " << srcPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ const ui32 maxShardsToCreate = srcPath.Shards();
const TString acl = Transaction.GetModifyACL().GetDiffACL();
- TPath dstPath = parent.Child(name);
- {
- TPath::TChecker checks = dstPath.Check();
- if (dstPath.IsResolved()) {
+ TPath dstPath = parent.Child(name);
+ {
+ TPath::TChecker checks = dstPath.Check();
+ if (dstPath.IsResolved()) {
checks
.IsResolved()
- .NotUnderDeleting()
- .FailOnExist(TPathElement::EPathType::EPathTypeTable, acceptExisted);
- } else {
+ .NotUnderDeleting()
+ .FailOnExist(TPathElement::EPathType::EPathTypeTable, acceptExisted);
+ } else {
checks
.NotEmpty()
- .NotResolved();
- }
-
- if (checks) {
- if (!parent.Base()->IsTableIndex()) {
- checks.DepthLimit();
- }
-
- checks
- .IsValidLeafName()
- .IsTheSameDomain(srcPath)
- .PathsLimit()
- .DirChildrenLimit()
- .ShardsLimit(maxShardsToCreate)
+ .NotResolved();
+ }
+
+ if (checks) {
+ if (!parent.Base()->IsTableIndex()) {
+ checks.DepthLimit();
+ }
+
+ checks
+ .IsValidLeafName()
+ .IsTheSameDomain(srcPath)
+ .PathsLimit()
+ .DirChildrenLimit()
+ .ShardsLimit(maxShardsToCreate)
.PathShardsLimit(maxShardsToCreate)
.IsValidACL(acl);
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << dstPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << dstPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
auto domainInfo = parent.DomainInfo();
bool transactionSupport = domainInfo->IsSupportTransactions();
if (domainInfo->GetAlter()) {
@@ -429,38 +429,38 @@ public:
Y_VERIFY(context.SS->PathsById.contains(domainId));
TPathElement::TPtr domain = context.SS->PathsById.at(domainId);
Y_VERIFY(domain->PlannedToCreate() || domain->HasActiveChanges());
-
+
transactionSupport |= domainInfo->GetAlter()->IsSupportTransactions();
- }
+ }
if (!transactionSupport) {
- result->SetError(NKikimrScheme::StatusNameConflict, "Inclusive subDomian do not support shared transactions");
+ result->SetError(NKikimrScheme::StatusNameConflict, "Inclusive subDomian do not support shared transactions");
+ return result;
+ }
+
+ TString errStr;
+
+ if (!context.SS->CheckApplyIf(Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
return result;
}
-
- TString errStr;
-
- if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- if (!context.SS->CheckLocks(srcPath.Base()->PathId, Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
- return result;
- }
-
- Y_VERIFY(context.SS->Tables.contains(srcPath.Base()->PathId));
- TTableInfo::TPtr srcTableInfo = context.SS->Tables.at(srcPath.Base()->PathId);
-
+
+ if (!context.SS->CheckLocks(srcPath.Base()->PathId, Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
+ return result;
+ }
+
+ Y_VERIFY(context.SS->Tables.contains(srcPath.Base()->PathId));
+ TTableInfo::TPtr srcTableInfo = context.SS->Tables.at(srcPath.Base()->PathId);
+
// do not allow copy from table with enabled external blobs
{
- const NKikimrSchemeOp::TPartitionConfig &srcPartitionConfig = srcTableInfo->PartitionConfig();
+ const NKikimrSchemeOp::TPartitionConfig &srcPartitionConfig = srcTableInfo->PartitionConfig();
if (PartitionConfigHasExternalBlobsEnabled(srcPartitionConfig)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, "source table contains external blobs, copy operation is not safe so prohibited");
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, "source table contains external blobs, copy operation is not safe so prohibited");
return result;
}
if (srcPartitionConfig.GetShadowData()) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, "Cannot copy tables with enabled ShadowData");
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, "Cannot copy tables with enabled ShadowData");
return result;
}
}
@@ -468,46 +468,46 @@ public:
auto schema = Transaction.GetCreateTable();
const bool omitFollowers = schema.GetOmitFollowers();
const bool isBackup = schema.GetIsBackup();
- PrepareScheme(&schema, name, srcTableInfo, context);
+ PrepareScheme(&schema, name, srcTableInfo, context);
if (omitFollowers) {
schema.MutablePartitionConfig()->AddFollowerGroups()->Clear();
}
schema.SetIsBackup(isBackup);
-
- NKikimrSchemeOp::TPartitionConfig compilationPartitionConfig;
- if (!TPartitionConfigMerger::ApplyChanges(compilationPartitionConfig, srcTableInfo->PartitionConfig(), schema.GetPartitionConfig(), AppData(), errStr)
- || !TPartitionConfigMerger::VerifyCreateParams(compilationPartitionConfig, AppData(), IsShadowDataAllowed(), errStr)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
- schema.MutablePartitionConfig()->CopyFrom(compilationPartitionConfig);
-
- const NScheme::TTypeRegistry* typeRegistry = AppData()->TypeRegistry;
+
+ NKikimrSchemeOp::TPartitionConfig compilationPartitionConfig;
+ if (!TPartitionConfigMerger::ApplyChanges(compilationPartitionConfig, srcTableInfo->PartitionConfig(), schema.GetPartitionConfig(), AppData(), errStr)
+ || !TPartitionConfigMerger::VerifyCreateParams(compilationPartitionConfig, AppData(), IsShadowDataAllowed(), errStr)) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+ schema.MutablePartitionConfig()->CopyFrom(compilationPartitionConfig);
+
+ const NScheme::TTypeRegistry* typeRegistry = AppData()->TypeRegistry;
const TSchemeLimits& limits = domainInfo->GetSchemeLimits();
TTableInfo::TAlterDataPtr alterData = TTableInfo::CreateAlterData(nullptr, schema, *typeRegistry, limits, *domainInfo, errStr);
- if (!alterData.Get()) {
- result->SetError(NKikimrScheme::StatusSchemeError, errStr);
- return result;
- }
-
- TTableInfo::TPtr tableInfo = new TTableInfo(std::move(*alterData));
- alterData.Reset();
-
- TChannelsBindings channelsBinding;
-
+ if (!alterData.Get()) {
+ result->SetError(NKikimrScheme::StatusSchemeError, errStr);
+ return result;
+ }
+
+ TTableInfo::TPtr tableInfo = new TTableInfo(std::move(*alterData));
+ alterData.Reset();
+
+ TChannelsBindings channelsBinding;
+
bool storePerShardConfig = false;
- NKikimrSchemeOp::TPartitionConfig perShardConfig;
+ NKikimrSchemeOp::TPartitionConfig perShardConfig;
- if (context.SS->IsStorageConfigLogic(tableInfo)) {
+ if (context.SS->IsStorageConfigLogic(tableInfo)) {
TVector<TStorageRoom> storageRooms;
THashMap<ui32, ui32> familyRooms;
storageRooms.emplace_back(0);
if (!context.SS->GetBindingsRooms(dstPath.DomainId(), tableInfo->PartitionConfig(), storageRooms, familyRooms, channelsBinding, errStr)) {
- errStr = TString("database doesn't have required storage pools to create tablet with storage config, details: ") + errStr;
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
+ errStr = TString("database doesn't have required storage pools to create tablet with storage config, details: ") + errStr;
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
tableInfo->SetRoom(storageRooms[0]);
storePerShardConfig = true;
@@ -519,245 +519,245 @@ public:
protoFamily->SetId(familyRoom.first);
protoFamily->SetRoom(familyRoom.second);
}
- } else if (context.SS->IsCompatibleChannelProfileLogic(dstPath.DomainId(), tableInfo)) {
- if (!context.SS->GetChannelsBindings(dstPath.DomainId(), tableInfo, channelsBinding, errStr)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
- }
-
- TPathId allocatedPathId = context.SS->AllocatePathId();
- context.MemChanges.GrabNewPath(context.SS, allocatedPathId);
- context.MemChanges.GrabPath(context.SS, parent.Base()->PathId);
- context.MemChanges.GrabPath(context.SS, srcPath.Base()->PathId);
- context.MemChanges.GrabNewTxState(context.SS, OperationId);
- context.MemChanges.GrabDomain(context.SS, parent.DomainId());
- context.MemChanges.GrabNewTable(context.SS, allocatedPathId);
-
- context.DbChanges.PersistPath(allocatedPathId);
- context.DbChanges.PersistPath(parent.Base()->PathId);
- context.DbChanges.PersistPath(srcPath.Base()->PathId);
- context.DbChanges.PersistApplyUserAttrs(allocatedPathId);
- context.DbChanges.PersistTable(allocatedPathId);
- context.DbChanges.PersistTxState(OperationId);
-
+ } else if (context.SS->IsCompatibleChannelProfileLogic(dstPath.DomainId(), tableInfo)) {
+ if (!context.SS->GetChannelsBindings(dstPath.DomainId(), tableInfo, channelsBinding, errStr)) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+ }
+
+ TPathId allocatedPathId = context.SS->AllocatePathId();
+ context.MemChanges.GrabNewPath(context.SS, allocatedPathId);
+ context.MemChanges.GrabPath(context.SS, parent.Base()->PathId);
+ context.MemChanges.GrabPath(context.SS, srcPath.Base()->PathId);
+ context.MemChanges.GrabNewTxState(context.SS, OperationId);
+ context.MemChanges.GrabDomain(context.SS, parent.DomainId());
+ context.MemChanges.GrabNewTable(context.SS, allocatedPathId);
+
+ context.DbChanges.PersistPath(allocatedPathId);
+ context.DbChanges.PersistPath(parent.Base()->PathId);
+ context.DbChanges.PersistPath(srcPath.Base()->PathId);
+ context.DbChanges.PersistApplyUserAttrs(allocatedPathId);
+ context.DbChanges.PersistTable(allocatedPathId);
+ context.DbChanges.PersistTxState(OperationId);
+
// copy attrs without any checks
TUserAttributes::TPtr userAttrs = new TUserAttributes(1);
userAttrs->Attrs = srcPath.Base()->UserAttrs->Attrs;
- dstPath.MaterializeLeaf(owner, allocatedPathId);
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
-
- TPathElement::TPtr newTable = dstPath.Base();
- newTable->CreateTxId = OperationId.GetTxId();
- newTable->LastTxId = OperationId.GetTxId();
- newTable->PathState = TPathElement::EPathState::EPathStateCreate;
- newTable->PathType = TPathElement::EPathType::EPathTypeTable;
+ dstPath.MaterializeLeaf(owner, allocatedPathId);
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+
+ TPathElement::TPtr newTable = dstPath.Base();
+ newTable->CreateTxId = OperationId.GetTxId();
+ newTable->LastTxId = OperationId.GetTxId();
+ newTable->PathState = TPathElement::EPathState::EPathStateCreate;
+ newTable->PathType = TPathElement::EPathType::EPathTypeTable;
newTable->UserAttrs->AlterData = userAttrs;
-
- srcPath.Base()->PathState = TPathElement::EPathState::EPathStateCopying;
- srcPath.Base()->LastTxId = OperationId.GetTxId();
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxCopyTable, newTable->PathId, srcPath.Base()->PathId);
- txState.State = TTxState::CreateParts;
-
- TShardInfo datashardInfo = TShardInfo::DataShardInfo(OperationId.GetTxId(), newTable->PathId);
- datashardInfo.BindedChannels = channelsBinding;
- auto newPartition = NTableState::ApplyPartitioningCopyTable(datashardInfo, srcTableInfo, txState, context.SS);
- for (const auto& part: newPartition) {
- context.MemChanges.GrabNewShard(context.SS, part.ShardIdx);
- context.DbChanges.PersistShard(part.ShardIdx);
- }
- context.SS->SetPartitioning(newTable->PathId, tableInfo, std::move(newPartition));
- for (const auto& shard : tableInfo->GetPartitions()) {
- Y_VERIFY(context.SS->ShardInfos.contains(shard.ShardIdx), "shard info is set before");
- if (storePerShardConfig) {
- tableInfo->PerShardPartitionConfig[shard.ShardIdx].CopyFrom(perShardConfig);
- }
- }
-
- Y_VERIFY(tableInfo->GetPartitions().back().EndOfRange.empty(), "End of last range must be +INF");
-
- context.SS->Tables[newTable->PathId] = tableInfo;
+
+ srcPath.Base()->PathState = TPathElement::EPathState::EPathStateCopying;
+ srcPath.Base()->LastTxId = OperationId.GetTxId();
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxCopyTable, newTable->PathId, srcPath.Base()->PathId);
+ txState.State = TTxState::CreateParts;
+
+ TShardInfo datashardInfo = TShardInfo::DataShardInfo(OperationId.GetTxId(), newTable->PathId);
+ datashardInfo.BindedChannels = channelsBinding;
+ auto newPartition = NTableState::ApplyPartitioningCopyTable(datashardInfo, srcTableInfo, txState, context.SS);
+ for (const auto& part: newPartition) {
+ context.MemChanges.GrabNewShard(context.SS, part.ShardIdx);
+ context.DbChanges.PersistShard(part.ShardIdx);
+ }
+ context.SS->SetPartitioning(newTable->PathId, tableInfo, std::move(newPartition));
+ for (const auto& shard : tableInfo->GetPartitions()) {
+ Y_VERIFY(context.SS->ShardInfos.contains(shard.ShardIdx), "shard info is set before");
+ if (storePerShardConfig) {
+ tableInfo->PerShardPartitionConfig[shard.ShardIdx].CopyFrom(perShardConfig);
+ }
+ }
+
+ Y_VERIFY(tableInfo->GetPartitions().back().EndOfRange.empty(), "End of last range must be +INF");
+
+ context.SS->Tables[newTable->PathId] = tableInfo;
context.SS->IncrementPathDbRefCount(newTable->PathId);
-
- if (parent.Base()->HasActiveChanges()) {
- TTxId parentTxId = parent.Base()->PlannedToCreate() ? parent.Base()->CreateTxId : parent.Base()->LastTxId;
- context.OnComplete.Dependence(parentTxId, OperationId.GetTxId());
- }
-
- // Add dependencies on in-flight split operations for source table in case of CopyTable
- Y_VERIFY(txState.SourcePathId != InvalidPathId);
- for (auto splitTx: context.SS->Tables.at(srcPath.Base()->PathId)->GetSplitOpsInFlight()) {
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCopyTable Propose "
- << " opId: " << OperationId
- << " wait split ops in flight on src table " << splitTx);
- context.OnComplete.Dependence(splitTx.GetTxId(), OperationId.GetTxId());
- }
-
- context.OnComplete.ActivateTx(OperationId);
-
- ++parent.Base()->DirAlterVersion;
- context.SS->ClearDescribePathCaches(parent.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, parent.Base()->PathId);
-
- context.SS->ClearDescribePathCaches(newTable);
- context.OnComplete.PublishToSchemeBoard(OperationId, newTable->PathId);
-
- const ui32 shardsToCreate = tableInfo->GetPartitions().size();
- Y_VERIFY_S(shardsToCreate <= maxShardsToCreate, "shardsToCreate: " << shardsToCreate << " maxShardsToCreate: " << maxShardsToCreate);
-
- dstPath.DomainInfo()->IncPathsInside();
- dstPath.DomainInfo()->AddInternalShards(txState);
- dstPath.Base()->IncShardsInside(shardsToCreate);
- parent.Base()->IncAliveChildren();
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
- void AbortPropose(TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCopyTable AbortPropose"
- << ", opId: " << OperationId
- << ", at schemeshard: " << context.SS->TabletID());
+
+ if (parent.Base()->HasActiveChanges()) {
+ TTxId parentTxId = parent.Base()->PlannedToCreate() ? parent.Base()->CreateTxId : parent.Base()->LastTxId;
+ context.OnComplete.Dependence(parentTxId, OperationId.GetTxId());
+ }
+
+ // Add dependencies on in-flight split operations for source table in case of CopyTable
+ Y_VERIFY(txState.SourcePathId != InvalidPathId);
+ for (auto splitTx: context.SS->Tables.at(srcPath.Base()->PathId)->GetSplitOpsInFlight()) {
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCopyTable Propose "
+ << " opId: " << OperationId
+ << " wait split ops in flight on src table " << splitTx);
+ context.OnComplete.Dependence(splitTx.GetTxId(), OperationId.GetTxId());
+ }
+
+ context.OnComplete.ActivateTx(OperationId);
+
+ ++parent.Base()->DirAlterVersion;
+ context.SS->ClearDescribePathCaches(parent.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, parent.Base()->PathId);
+
+ context.SS->ClearDescribePathCaches(newTable);
+ context.OnComplete.PublishToSchemeBoard(OperationId, newTable->PathId);
+
+ const ui32 shardsToCreate = tableInfo->GetPartitions().size();
+ Y_VERIFY_S(shardsToCreate <= maxShardsToCreate, "shardsToCreate: " << shardsToCreate << " maxShardsToCreate: " << maxShardsToCreate);
+
+ dstPath.DomainInfo()->IncPathsInside();
+ dstPath.DomainInfo()->AddInternalShards(txState);
+ dstPath.Base()->IncShardsInside(shardsToCreate);
+ parent.Base()->IncAliveChildren();
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCopyTable AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortPropose(TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCopyTable AbortPropose"
+ << ", opId: " << OperationId
<< ", at schemeshard: " << context.SS->TabletID());
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- //txState->TargetPathId should be marked as drop by forceDropTxId
-
- TPathId srcPathId = txState->SourcePathId;
- Y_VERIFY(srcPathId != InvalidPathId);
- Y_VERIFY(context.SS->PathsById.contains(srcPathId));
- TPathElement::TPtr srcPath = context.SS->PathsById.at(srcPathId);
- srcPath->PathState = TPathElement::EPathState::EPathStateDrop;
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+ }
+
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCopyTable AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ //txState->TargetPathId should be marked as drop by forceDropTxId
+
+ TPathId srcPathId = txState->SourcePathId;
+ Y_VERIFY(srcPathId != InvalidPathId);
+ Y_VERIFY(context.SS->PathsById.contains(srcPathId));
+ TPathElement::TPtr srcPath = context.SS->PathsById.at(srcPathId);
+ srcPath->PathState = TPathElement::EPathState::EPathStateDrop;
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateCopyTable(TOperationId id, const TTxTransaction& tx) {
return new TCopyTable(id, tx);
}
-ISubOperationBase::TPtr CreateCopyTable(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state != TTxState::Invalid);
- return new TCopyTable(id, state);
-}
-
+ISubOperationBase::TPtr CreateCopyTable(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state != TTxState::Invalid);
+ return new TCopyTable(id, state);
+}
+
TVector<ISubOperationBase::TPtr> CreateCopyTable(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context) {
- Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
-
- auto copying = tx.GetCreateTable();
- Y_VERIFY(copying.HasCopyFromTable());
-
- TPath srcPath = TPath::Resolve(copying.GetCopyFromTable(), context.SS);
- {
- TPath::TChecker checks = srcPath.Check();
- checks.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsTable()
- .NotUnderOperation()
- .IsCommonSensePath(); //forbid copy impl index tables directly
-
- if (!checks) {
- TString explain = TStringBuilder() << "src path fail checks"
- << ", path: " << srcPath.PathString();
- auto status = checks.GetStatus(&explain);
- return {CreateReject(nextId, status, explain)};
- }
- }
-
- TPath workDir = TPath::Resolve(tx.GetWorkingDir(), context.SS);
- TPath dstPath = workDir.Child(copying.GetName());
-
- TVector<ISubOperationBase::TPtr> result;
- {
- auto schema = TransactionTemplate(tx.GetWorkingDir(), NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
- schema.SetFailOnExist(tx.GetFailOnExist());
-
- auto operation = schema.MutableCreateTable();
- operation->SetName(copying.GetName());
- operation->SetCopyFromTable(copying.GetCopyFromTable());
+ Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
+
+ auto copying = tx.GetCreateTable();
+ Y_VERIFY(copying.HasCopyFromTable());
+
+ TPath srcPath = TPath::Resolve(copying.GetCopyFromTable(), context.SS);
+ {
+ TPath::TChecker checks = srcPath.Check();
+ checks.NotEmpty()
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsTable()
+ .NotUnderOperation()
+ .IsCommonSensePath(); //forbid copy impl index tables directly
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "src path fail checks"
+ << ", path: " << srcPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ return {CreateReject(nextId, status, explain)};
+ }
+ }
+
+ TPath workDir = TPath::Resolve(tx.GetWorkingDir(), context.SS);
+ TPath dstPath = workDir.Child(copying.GetName());
+
+ TVector<ISubOperationBase::TPtr> result;
+ {
+ auto schema = TransactionTemplate(tx.GetWorkingDir(), NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
+ schema.SetFailOnExist(tx.GetFailOnExist());
+
+ auto operation = schema.MutableCreateTable();
+ operation->SetName(copying.GetName());
+ operation->SetCopyFromTable(copying.GetCopyFromTable());
operation->SetOmitFollowers(copying.GetOmitFollowers());
operation->SetIsBackup(copying.GetIsBackup());
- operation->MutablePartitionConfig()->CopyFrom(copying.GetPartitionConfig());
-
- result.push_back(CreateCopyTable(NextPartId(nextId, result), schema));
- }
-
- for (auto& child: srcPath.Base()->GetChildren()) {
- auto name = child.first;
- auto pathId = child.second;
-
+ operation->MutablePartitionConfig()->CopyFrom(copying.GetPartitionConfig());
+
+ result.push_back(CreateCopyTable(NextPartId(nextId, result), schema));
+ }
+
+ for (auto& child: srcPath.Base()->GetChildren()) {
+ auto name = child.first;
+ auto pathId = child.second;
+
TPath childPath = srcPath.Child(name);
if (!childPath.IsTableIndex() || childPath.IsDeleted()) {
- continue;
- }
-
+ continue;
+ }
+
Y_VERIFY(childPath.Base()->PathId == pathId);
Y_VERIFY_S(childPath.Base()->GetChildren().size() == 1, childPath.PathString() << " has children " << childPath.Base()->GetChildren().size());
-
- TTableIndexInfo::TPtr indexInfo = context.SS->Indexes.at(pathId);
- {
- auto schema = TransactionTemplate(dstPath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpCreateTableIndex);
- schema.SetFailOnExist(tx.GetFailOnExist());
-
- auto operation = schema.MutableCreateTableIndex();
- operation->SetName(name);
- operation->SetType(indexInfo->Type);
+
+ TTableIndexInfo::TPtr indexInfo = context.SS->Indexes.at(pathId);
+ {
+ auto schema = TransactionTemplate(dstPath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpCreateTableIndex);
+ schema.SetFailOnExist(tx.GetFailOnExist());
+
+ auto operation = schema.MutableCreateTableIndex();
+ operation->SetName(name);
+ operation->SetType(indexInfo->Type);
for (const auto& keyName: indexInfo->IndexKeys) {
- *operation->MutableKeyColumnNames()->Add() = keyName;
- }
+ *operation->MutableKeyColumnNames()->Add() = keyName;
+ }
for (const auto& dataColumn: indexInfo->IndexDataColumns) {
*operation->MutableDataColumnNames()->Add() = dataColumn;
}
- result.push_back(CreateNewTableIndex(NextPartId(nextId, result), schema));
- }
-
+ result.push_back(CreateNewTableIndex(NextPartId(nextId, result), schema));
+ }
+
TString implTableName = childPath.Base()->GetChildren().begin()->first;
TPath implTable = childPath.Child(implTableName);
Y_VERIFY(implTable.Base()->PathId == childPath.Base()->GetChildren().begin()->second);
-
- {
- NKikimrSchemeOp::TModifyScheme schema;
- schema.SetFailOnExist(tx.GetFailOnExist());
- schema.SetWorkingDir(JoinPath({dstPath.PathString(), name}));
- schema.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
-
- auto operation = schema.MutableCreateTable();
- operation->SetName(implTableName);
- operation->SetCopyFromTable(implTable.PathString());
+
+ {
+ NKikimrSchemeOp::TModifyScheme schema;
+ schema.SetFailOnExist(tx.GetFailOnExist());
+ schema.SetWorkingDir(JoinPath({dstPath.PathString(), name}));
+ schema.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
+
+ auto operation = schema.MutableCreateTable();
+ operation->SetName(implTableName);
+ operation->SetCopyFromTable(implTable.PathString());
operation->SetOmitFollowers(copying.GetOmitFollowers());
operation->SetIsBackup(copying.GetIsBackup());
-
- result.push_back(CreateCopyTable(NextPartId(nextId, result), schema));
- }
- }
-
- return result;
-}
-
-}
-}
+
+ result.push_back(CreateCopyTable(NextPartId(nextId, result), schema));
+ }
+ }
+
+ return result;
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_backup.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_backup.cpp
index a46dfed4349..4c0c967af0f 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_backup.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_backup.cpp
@@ -1,55 +1,55 @@
#include "schemeshard__operation_backup_restore_common.h"
#include "schemeshard_billing_helpers.h"
-
+
namespace NKikimr {
-namespace NSchemeShard {
-
+namespace NSchemeShard {
+
struct TBackup {
static constexpr TStringBuf Name() {
return "TBackup";
- }
-
+ }
+
static bool HasTask(const TTxTransaction& tx) {
return tx.HasBackup();
- }
-
+ }
+
static TString GetTableName(const TTxTransaction& tx) {
return tx.GetBackup().GetTableName();
- }
-
+ }
+
static void ProposeTx(const TOperationId& opId, TTxState& txState, TOperationContext& context) {
auto seqNo = context.SS->StartRound(txState);
const auto& processingParams = context.SS->SelectProcessingPrarams(txState.TargetPathId);
-
+
Y_VERIFY(context.SS->Tables.contains(txState.TargetPathId));
TTableInfo::TPtr table = context.SS->Tables.at(txState.TargetPathId);
- NKikimrSchemeOp::TBackupTask backup = table->BackupSettings;
+ NKikimrSchemeOp::TBackupTask backup = table->BackupSettings;
for (ui32 i = 0; i < txState.Shards.size(); ++i) {
auto idx = txState.Shards[i].Idx;
- auto datashardId = context.SS->ShardInfos[idx].TabletID;
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Propose backup"
- << " to datashard " << datashardId
+ auto datashardId = context.SS->ShardInfos[idx].TabletID;
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Propose backup"
+ << " to datashard " << datashardId
<< " txid " << opId
<< " at schemeshard " << context.SS->SelfTabletId());
-
+
TString txBody = context.SS->FillBackupTxBody(txState.TargetPathId, backup, i, seqNo);
- THolder<TEvDataShard::TEvProposeTransaction> event =
+ THolder<TEvDataShard::TEvProposeTransaction> event =
THolder(new TEvDataShard::TEvProposeTransaction(NKikimrTxDataShard::TX_KIND_SCHEME,
- context.SS->TabletID(),
- context.Ctx.SelfID,
+ context.SS->TabletID(),
+ context.Ctx.SelfID,
ui64(opId.GetTxId()),
- txBody,
+ txBody,
processingParams));
-
+
context.OnComplete.BindMsgToPipe(opId, datashardId, idx, event.Release());
backup.ClearTable();
- }
- }
-
+ }
+ }
+
static ui64 RequestUnits(ui64 bytes, ui64 rows) {
Y_UNUSED(rows);
return TRUCalculator::ReadTable(bytes);
@@ -57,17 +57,17 @@ struct TBackup {
static void FinishStats(const TOperationId& opId, TTxState& txState, TOperationContext& context) {
if (txState.TxType != TTxState::TxBackup) {
- return;
- }
-
+ return;
+ }
+
Y_VERIFY(TAppData::TimeProvider.Get() != nullptr);
const ui64 ts = TAppData::TimeProvider->Now().Seconds();
-
+
Y_VERIFY(context.SS->Tables.contains(txState.TargetPathId));
TTableInfo::TPtr table = context.SS->Tables[txState.TargetPathId];
-
+
auto& backupInfo = table->BackupHistory[opId.GetTxId()];
-
+
backupInfo.StartDateTime = txState.StartTime.Seconds();
backupInfo.CompletionDateTime = ts;
backupInfo.TotalShardCount = table->GetPartitions().size();
@@ -76,33 +76,33 @@ struct TBackup {
});
backupInfo.ShardStatuses = std::move(txState.ShardStatuses);
backupInfo.DataTotalSize = txState.DataTotalSize;
-
- NIceDb::TNiceDb db(context.Txc.DB);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
context.SS->PersistCompletedBackup(db, opId.GetTxId(), txState, backupInfo);
- }
-
+ }
+
static void PersistTask(const TPathId& pathId, const TTxTransaction& tx, TOperationContext& context) {
Y_VERIFY(context.SS->Tables.contains(pathId));
TTableInfo::TPtr table = context.SS->Tables.at(pathId);
-
+
table->BackupSettings = tx.GetBackup();
-
- NIceDb::TNiceDb db(context.Txc.DB);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
context.SS->PersistBackupSettings(db, pathId, table->BackupSettings);
- }
-
+ }
+
static void PersistDone(const TPathId& pathId, TOperationContext& context) {
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->PersistBackupDone(db, pathId);
- }
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->PersistBackupDone(db, pathId);
+ }
static bool NeedToBill(const TPathId& pathId, TOperationContext& context) {
Y_VERIFY(context.SS->Tables.contains(pathId));
auto table = context.SS->Tables.at(pathId);
return table->BackupSettings.GetNeedToBill();
}
-};
-
+};
+
ISubOperationBase::TPtr CreateBackup(TOperationId id, const TTxTransaction& tx) {
return new TBackupRestoreOperationBase<TBackup, TEvDataShard::TEvCancelBackup>(
TTxState::TxBackup, TPathElement::EPathState::EPathStateBackup, id, tx
@@ -114,7 +114,7 @@ ISubOperationBase::TPtr CreateBackup(TOperationId id, TTxState::ETxState state)
return new TBackupRestoreOperationBase<TBackup, TEvDataShard::TEvCancelBackup>(
TTxState::TxBackup, TPathElement::EPathState::EPathStateBackup, id, state
);
-}
-
-}
-}
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_bsv.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_bsv.cpp
index 90367e4eb4c..b32fb7d9692 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_bsv.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_bsv.cpp
@@ -1,59 +1,59 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
#include <ydb/core/persqueue/config/config.h>
#include <ydb/core/mind/hive/hive.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-TBlockStoreVolumeInfo::TPtr CreateBlockStoreVolumeInfo(const NKikimrSchemeOp::TBlockStoreVolumeDescription& op,
- TEvSchemeShard::EStatus& status,
- TString& errStr)
-{
- TBlockStoreVolumeInfo::TPtr volume = new TBlockStoreVolumeInfo();
-
- const auto& volumeConfig = op.GetVolumeConfig();
- if (!volumeConfig.HasBlockSize()) {
- status = NKikimrScheme::StatusSchemeError;
- errStr = "Block size is required";
- return nullptr;
- }
-
- ui32 partitionCount = op.GetVolumeConfig().PartitionsSize();
- if (partitionCount == 0) {
- status = NKikimrScheme::StatusSchemeError;
- errStr = Sprintf("Invalid number of partitions specified: %u", partitionCount);
- return nullptr;
- }
-
- if (volumeConfig.HasVersion()) {
- status = NKikimrScheme::StatusSchemeError;
- errStr = "Setting version is not allowed";
- return nullptr;
- }
-
- volume->AlterVersion = 1;
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+TBlockStoreVolumeInfo::TPtr CreateBlockStoreVolumeInfo(const NKikimrSchemeOp::TBlockStoreVolumeDescription& op,
+ TEvSchemeShard::EStatus& status,
+ TString& errStr)
+{
+ TBlockStoreVolumeInfo::TPtr volume = new TBlockStoreVolumeInfo();
+
+ const auto& volumeConfig = op.GetVolumeConfig();
+ if (!volumeConfig.HasBlockSize()) {
+ status = NKikimrScheme::StatusSchemeError;
+ errStr = "Block size is required";
+ return nullptr;
+ }
+
+ ui32 partitionCount = op.GetVolumeConfig().PartitionsSize();
+ if (partitionCount == 0) {
+ status = NKikimrScheme::StatusSchemeError;
+ errStr = Sprintf("Invalid number of partitions specified: %u", partitionCount);
+ return nullptr;
+ }
+
+ if (volumeConfig.HasVersion()) {
+ status = NKikimrScheme::StatusSchemeError;
+ errStr = "Setting version is not allowed";
+ return nullptr;
+ }
+
+ volume->AlterVersion = 1;
volume->TokenVersion = 0;
volume->DefaultPartitionCount =
TBlockStoreVolumeInfo::CalculateDefaultPartitionCount(op.GetVolumeConfig());
- volume->VolumeConfig.CopyFrom(op.GetVolumeConfig());
-
- return volume;
-}
-
-void ApplySharding(TTxId txId, TPathId pathId, TBlockStoreVolumeInfo::TPtr volume, TTxState& txState,
- const TChannelsBindings& partitionChannels, const TChannelsBindings& volumeChannels,
- TOperationContext& context) {
+ volume->VolumeConfig.CopyFrom(op.GetVolumeConfig());
+
+ return volume;
+}
+
+void ApplySharding(TTxId txId, TPathId pathId, TBlockStoreVolumeInfo::TPtr volume, TTxState& txState,
+ const TChannelsBindings& partitionChannels, const TChannelsBindings& volumeChannels,
+ TOperationContext& context) {
Y_VERIFY(volume->VolumeConfig.GetTabletVersion() <= 2);
ui64 count = volume->DefaultPartitionCount;
- txState.Shards.reserve(count + 1);
-
- for (ui64 i = 0; i < count; ++i) {
+ txState.Shards.reserve(count + 1);
+
+ for (ui64 i = 0; i < count; ++i) {
TShardIdx shardIdx;
if (volume->VolumeConfig.GetTabletVersion() == 2) {
shardIdx = context.SS->RegisterShardInfo(
@@ -68,243 +68,243 @@ void ApplySharding(TTxId txId, TPathId pathId, TBlockStoreVolumeInfo::TPtr volum
context.SS->TabletCounters->Simple()[COUNTER_BLOCKSTORE_PARTITION_SHARD_COUNT].Add(1);
txState.Shards.emplace_back(shardIdx, ETabletType::BlockStorePartition, TTxState::CreateParts);
}
-
- TBlockStorePartitionInfo::TPtr part = new TBlockStorePartitionInfo();
- part->PartitionId = i;
- part->AlterVersion = 1;
- volume->Shards[shardIdx] = std::move(part);
- }
-
+
+ TBlockStorePartitionInfo::TPtr part = new TBlockStorePartitionInfo();
+ part->PartitionId = i;
+ part->AlterVersion = 1;
+ volume->Shards[shardIdx] = std::move(part);
+ }
+
const auto shardIdx = context.SS->RegisterShardInfo(
TShardInfo::BlockStoreVolumeInfo(txId, pathId)
.WithBindedChannels(volumeChannels));
context.SS->TabletCounters->Simple()[COUNTER_BLOCKSTORE_VOLUME_SHARD_COUNT].Add(1);
- txState.Shards.emplace_back(shardIdx, ETabletType::BlockStoreVolume, TTxState::CreateParts);
- volume->VolumeShardIdx = shardIdx;
-}
-
-TTxState& PrepareChanges(TOperationId operationId, TPathElement::TPtr parentDir,
- TPathElement::TPtr volumePath, TBlockStoreVolumeInfo::TPtr volume, const TString& acl,
- const TChannelsBindings& partitionChannels, const TChannelsBindings& volumeChannels,
- ui64 shardsToCreate,
- TOperationContext& context)
-{
- NIceDb::TNiceDb db(context.Txc.DB);
-
- volumePath->CreateTxId = operationId.GetTxId();
- volumePath->LastTxId = operationId.GetTxId();
- volumePath->PathState = TPathElement::EPathState::EPathStateCreate;
- volumePath->PathType = TPathElement::EPathType::EPathTypeBlockStoreVolume;
- TPathId pathId = volumePath->PathId;
-
- TTxState& txState = context.SS->CreateTx(operationId, TTxState::TxCreateBlockStoreVolume, pathId);
-
- ApplySharding(operationId.GetTxId(), pathId, volume, txState, partitionChannels, volumeChannels, context);
-
- if (parentDir->HasActiveChanges()) {
- TTxId parentTxId = parentDir->PlannedToCreate() ? parentDir->CreateTxId : parentDir->LastTxId;
- context.OnComplete.Dependence(parentTxId, operationId.GetTxId());
- }
-
- context.SS->ChangeTxState(db, operationId, TTxState::CreateParts);
- context.OnComplete.ActivateTx(operationId);
-
- context.SS->PersistPath(db, volumePath->PathId);
- if (!acl.empty()) {
- volumePath->ApplyACL(acl);
- context.SS->PersistACL(db, volumePath);
- }
- for (auto& shard : volume->Shards) {
- auto shardIdx = shard.first;
- const auto& part = shard.second;
- context.SS->PersistBlockStorePartition(db, pathId, part->PartitionId, shardIdx, part->AlterVersion);
- }
-
- TBlockStoreVolumeInfo::TPtr emptyVolume = new TBlockStoreVolumeInfo();
- emptyVolume->Shards.swap(volume->Shards);
- context.SS->BlockStoreVolumes[pathId] = emptyVolume;
- context.SS->BlockStoreVolumes[pathId]->AlterData = volume;
+ txState.Shards.emplace_back(shardIdx, ETabletType::BlockStoreVolume, TTxState::CreateParts);
+ volume->VolumeShardIdx = shardIdx;
+}
+
+TTxState& PrepareChanges(TOperationId operationId, TPathElement::TPtr parentDir,
+ TPathElement::TPtr volumePath, TBlockStoreVolumeInfo::TPtr volume, const TString& acl,
+ const TChannelsBindings& partitionChannels, const TChannelsBindings& volumeChannels,
+ ui64 shardsToCreate,
+ TOperationContext& context)
+{
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ volumePath->CreateTxId = operationId.GetTxId();
+ volumePath->LastTxId = operationId.GetTxId();
+ volumePath->PathState = TPathElement::EPathState::EPathStateCreate;
+ volumePath->PathType = TPathElement::EPathType::EPathTypeBlockStoreVolume;
+ TPathId pathId = volumePath->PathId;
+
+ TTxState& txState = context.SS->CreateTx(operationId, TTxState::TxCreateBlockStoreVolume, pathId);
+
+ ApplySharding(operationId.GetTxId(), pathId, volume, txState, partitionChannels, volumeChannels, context);
+
+ if (parentDir->HasActiveChanges()) {
+ TTxId parentTxId = parentDir->PlannedToCreate() ? parentDir->CreateTxId : parentDir->LastTxId;
+ context.OnComplete.Dependence(parentTxId, operationId.GetTxId());
+ }
+
+ context.SS->ChangeTxState(db, operationId, TTxState::CreateParts);
+ context.OnComplete.ActivateTx(operationId);
+
+ context.SS->PersistPath(db, volumePath->PathId);
+ if (!acl.empty()) {
+ volumePath->ApplyACL(acl);
+ context.SS->PersistACL(db, volumePath);
+ }
+ for (auto& shard : volume->Shards) {
+ auto shardIdx = shard.first;
+ const auto& part = shard.second;
+ context.SS->PersistBlockStorePartition(db, pathId, part->PartitionId, shardIdx, part->AlterVersion);
+ }
+
+ TBlockStoreVolumeInfo::TPtr emptyVolume = new TBlockStoreVolumeInfo();
+ emptyVolume->Shards.swap(volume->Shards);
+ context.SS->BlockStoreVolumes[pathId] = emptyVolume;
+ context.SS->BlockStoreVolumes[pathId]->AlterData = volume;
context.SS->IncrementPathDbRefCount(pathId);
-
- context.SS->PersistBlockStoreVolume(db, pathId, emptyVolume);
- context.SS->PersistAddBlockStoreVolumeAlter(db, pathId, volume);
-
- context.SS->PersistTxState(db, operationId);
- context.SS->PersistUpdateNextPathId(db);
- context.SS->PersistUpdateNextShardIdx(db);
- for (auto shard : txState.Shards) {
- Y_VERIFY(shard.Operation == TTxState::CreateParts);
- context.SS->PersistChannelsBinding(db, shard.Idx, context.SS->ShardInfos[shard.Idx].BindedChannels);
- context.SS->PersistShardMapping(db, shard.Idx, InvalidTabletId, pathId, operationId.GetTxId(), shard.TabletType);
- }
- Y_VERIFY(txState.Shards.size() == shardsToCreate);
-
- return txState;
-}
-
-
-
-
-class TCreateBlockStoreVolume: public TSubOperation {
+
+ context.SS->PersistBlockStoreVolume(db, pathId, emptyVolume);
+ context.SS->PersistAddBlockStoreVolumeAlter(db, pathId, volume);
+
+ context.SS->PersistTxState(db, operationId);
+ context.SS->PersistUpdateNextPathId(db);
+ context.SS->PersistUpdateNextShardIdx(db);
+ for (auto shard : txState.Shards) {
+ Y_VERIFY(shard.Operation == TTxState::CreateParts);
+ context.SS->PersistChannelsBinding(db, shard.Idx, context.SS->ShardInfos[shard.Idx].BindedChannels);
+ context.SS->PersistShardMapping(db, shard.Idx, InvalidTabletId, pathId, operationId.GetTxId(), shard.TabletType);
+ }
+ Y_VERIFY(txState.Shards.size() == shardsToCreate);
+
+ return txState;
+}
+
+
+
+
+class TCreateBlockStoreVolume: public TSubOperation {
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::CreateParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
- return TTxState::ConfigureParts;
- case TTxState::ConfigureParts:
- return TTxState::Propose;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::CreateParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
+ return TTxState::ConfigureParts;
+ case TTxState::ConfigureParts:
+ return TTxState::Propose;
case TTxState::Propose:
return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
return MakeHolder<TCreateParts>(OperationId);
- case TTxState::ConfigureParts:
+ case TTxState::ConfigureParts:
return MakeHolder<NBSVState::TConfigureParts>(OperationId);
- case TTxState::Propose:
+ case TTxState::Propose:
return MakeHolder<NBSVState::TPropose>(OperationId);
case TTxState::Done:
return MakeHolder<TDone>(OperationId);
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TCreateBlockStoreVolume(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TCreateBlockStoreVolume(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+
+ TCreateBlockStoreVolume(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const auto& operation = Transaction.GetCreateBlockStoreVolume();
- const auto acceptExisted = !Transaction.GetFailOnExist();
-
+ const auto acceptExisted = !Transaction.GetFailOnExist();
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = Transaction.GetCreateBlockStoreVolume().GetName();
const auto defaultPartitionCount =
TBlockStoreVolumeInfo::CalculateDefaultPartitionCount(
operation.GetVolumeConfig());
const ui64 shardsToCreate = defaultPartitionCount + 1;
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateBlockStoreVolume Propose"
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateBlockStoreVolume Propose"
<< ", path: " << parentPathStr << "/" << name
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
- auto result = MakeHolder<TProposeResponse>(status, ui64(OperationId.GetTxId()), ui64(ssId));
-
- NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
- {
- NSchemeShard::TPath::TChecker checks = parentPath.Check();
- checks
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsCommonSensePath()
- .IsLikeDirectory();
-
- if (!checks) {
- TString explain = TStringBuilder() << "parent path fail checks"
- << ", path: " << parentPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
+ auto result = MakeHolder<TProposeResponse>(status, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
+ {
+ NSchemeShard::TPath::TChecker checks = parentPath.Check();
+ checks
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsCommonSensePath()
+ .IsLikeDirectory();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent path fail checks"
+ << ", path: " << parentPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
const TString acl = Transaction.GetModifyACL().GetDiffACL();
- NSchemeShard::TPath dstPath = parentPath.Child(name);
- {
- NSchemeShard::TPath::TChecker checks = dstPath.Check();
- checks.IsAtLocalSchemeShard();
- if (dstPath.IsResolved()) {
+ NSchemeShard::TPath dstPath = parentPath.Child(name);
+ {
+ NSchemeShard::TPath::TChecker checks = dstPath.Check();
+ checks.IsAtLocalSchemeShard();
+ if (dstPath.IsResolved()) {
checks
.IsResolved()
- .NotUnderDeleting()
- .FailOnExist(TPathElement::EPathType::EPathTypeBlockStoreVolume, acceptExisted);
- } else {
+ .NotUnderDeleting()
+ .FailOnExist(TPathElement::EPathType::EPathTypeBlockStoreVolume, acceptExisted);
+ } else {
checks
.NotEmpty()
- .NotResolved();
- }
-
- if (checks) {
- checks
- .IsValidLeafName()
- .DepthLimit()
- .PathsLimit()
- .DirChildrenLimit()
- .ShardsLimit(shardsToCreate)
+ .NotResolved();
+ }
+
+ if (checks) {
+ checks
+ .IsValidLeafName()
+ .DepthLimit()
+ .PathsLimit()
+ .DirChildrenLimit()
+ .ShardsLimit(shardsToCreate)
.PathShardsLimit(shardsToCreate)
.IsValidACL(acl);
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "dst path fail checks"
- << ", path: " << dstPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- if (dstPath.IsResolved()) {
- result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
- }
- return result;
- }
- }
-
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "dst path fail checks"
+ << ", path: " << dstPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ if (dstPath.IsResolved()) {
+ result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+ }
+ return result;
+ }
+ }
+
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- TBlockStoreVolumeInfo::TPtr volume = CreateBlockStoreVolumeInfo(operation, status, errStr);
- if (!volume) {
- result->SetError(status, errStr);
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ TBlockStoreVolumeInfo::TPtr volume = CreateBlockStoreVolumeInfo(operation, status, errStr);
+ if (!volume) {
+ result->SetError(status, errStr);
+ return result;
+ }
+
auto resolveChannels = [&] (const auto& ecps, TChannelsBindings& binding)
{
TVector<TStringBuf> poolKinds;
@@ -326,12 +326,12 @@ public:
auto errStr = Sprintf("Wrong number of channels %u , should be [1 .. %lu]",
ecps.size(),
NHive::MAX_TABLET_CHANNELS);
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
return result;
}
if (!resolveChannels(ecps, partitionChannelsBinding)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter,
+ result->SetError(NKikimrScheme::StatusInvalidParameter,
"Unable to construct channel binding for partition with the storage pool");
return result;
}
@@ -339,19 +339,19 @@ public:
context.SS->SetNbsChannelsParams(ecps, partitionChannelsBinding);
}
- TChannelsBindings volumeChannelsBinding;
+ TChannelsBindings volumeChannelsBinding;
const auto& ecps = operation.GetVolumeConfig().GetVolumeExplicitChannelProfiles();
if (ecps.size()) {
if ((ui32)ecps.size() != TBlockStoreVolumeInfo::NumVolumeTabletChannels) {
auto errStr = Sprintf("Wrong number of channels %u , should be %lu",
ecps.size(),
TBlockStoreVolumeInfo::NumVolumeTabletChannels);
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
return result;
}
if (!resolveChannels(ecps, volumeChannelsBinding)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter,
+ result->SetError(NKikimrScheme::StatusInvalidParameter,
"Unable to construct channel binding for volume with the storage pool");
return result;
}
@@ -359,76 +359,76 @@ public:
} else {
const ui32 volumeProfileId = 0;
if (!context.SS->ResolveTabletChannels(volumeProfileId, dstPath.DomainId(), volumeChannelsBinding)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter,
+ result->SetError(NKikimrScheme::StatusInvalidParameter,
"Unable to construct channel binding for volume with the profile");
return result;
}
- }
-
+ }
+
auto domainDir = context.SS->PathsById.at(dstPath.DomainId());
Y_VERIFY(domainDir);
auto volumeSpace = volume->GetVolumeSpace();
if (!domainDir->CheckVolumeSpaceChange(volumeSpace, { }, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- dstPath.MaterializeLeaf(owner);
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
-
- context.SS->TabletCounters->Simple()[COUNTER_BLOCKSTORE_VOLUME_COUNT].Add(1);
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ dstPath.MaterializeLeaf(owner);
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+
+ context.SS->TabletCounters->Simple()[COUNTER_BLOCKSTORE_VOLUME_COUNT].Add(1);
domainDir->ChangeVolumeSpaceBegin(volumeSpace, { });
-
- const TTxState& txState = PrepareChanges(OperationId, parentPath.Base(), dstPath.Base(), volume, acl, partitionChannelsBinding, volumeChannelsBinding, shardsToCreate, context);
-
- NIceDb::TNiceDb db(context.Txc.DB);
- ++parentPath.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentPath.Base());
- context.SS->ClearDescribePathCaches(parentPath.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, parentPath.Base()->PathId);
-
- context.SS->ClearDescribePathCaches(dstPath.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, dstPath.Base()->PathId);
-
- dstPath.DomainInfo()->IncPathsInside();
- dstPath.DomainInfo()->AddInternalShards(txState);
- dstPath.Base()->IncShardsInside(shardsToCreate);
- parentPath.Base()->IncAliveChildren();
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+
+ const TTxState& txState = PrepareChanges(OperationId, parentPath.Base(), dstPath.Base(), volume, acl, partitionChannelsBinding, volumeChannelsBinding, shardsToCreate, context);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ ++parentPath.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentPath.Base());
+ context.SS->ClearDescribePathCaches(parentPath.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentPath.Base()->PathId);
+
+ context.SS->ClearDescribePathCaches(dstPath.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, dstPath.Base()->PathId);
+
+ dstPath.DomainInfo()->IncPathsInside();
+ dstPath.DomainInfo()->AddInternalShards(txState);
+ dstPath.Base()->IncShardsInside(shardsToCreate);
+ parentPath.Base()->IncAliveChildren();
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TCreateBlockStoreVolume");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateBlockStoreVolume AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateBlockStoreVolume AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateNewBSV(TOperationId id, const TTxTransaction& tx) {
return new TCreateBlockStoreVolume(id, tx);
}
-ISubOperationBase::TPtr CreateNewBSV(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateNewBSV(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TCreateBlockStoreVolume(id, state);
-}
-
-}
-}
+ return new TCreateBlockStoreVolume(id, state);
+}
+
+}
+}
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 52ff121727f..2d957165c6a 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_build_index.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_build_index.cpp
@@ -1,85 +1,85 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_path_element.h"
-#include "schemeshard_utils.h"
-
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_path_element.h"
+#include "schemeshard_utils.h"
+
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/table_index.h>
#include <ydb/core/protos/flat_tx_scheme.pb.h>
#include <ydb/core/protos/flat_scheme_op.pb.h>
-
+
#include <ydb/library/yql/minikql/mkql_type_ops.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-TVector<ISubOperationBase::TPtr> CreateBuildIndex(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context) {
- Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexBuild);
-
- auto config = tx.GetInitiateIndexBuild();
- TString tablePath = config.GetTable();
- const NKikimrSchemeOp::TIndexCreationConfig& indexConfig = config.GetIndex();
-
- TPath table = TPath::Resolve(tablePath, context.SS);
- TPath index = table.Child(indexConfig.GetName());
-
-
- TTableInfo::TPtr tableInfo = context.SS->Tables.at(table.Base()->PathId);
-
- //check idempotence
-
- //check limits
-
- TVector<ISubOperationBase::TPtr> result;
-
- {
- auto tableIndexCreation = TransactionTemplate(table.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpCreateTableIndex);
- *tableIndexCreation.MutableLockGuard() = tx.GetLockGuard();
- tableIndexCreation.MutableCreateTableIndex()->CopyFrom(indexConfig);
-
- if (!indexConfig.HasType()) {
- tableIndexCreation.MutableCreateTableIndex()->SetType(NKikimrSchemeOp::EIndexTypeGlobal);
- }
- tableIndexCreation.MutableCreateTableIndex()->SetState(NKikimrSchemeOp::EIndexStateWriteOnly);
-
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+TVector<ISubOperationBase::TPtr> CreateBuildIndex(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context) {
+ Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexBuild);
+
+ auto config = tx.GetInitiateIndexBuild();
+ TString tablePath = config.GetTable();
+ const NKikimrSchemeOp::TIndexCreationConfig& indexConfig = config.GetIndex();
+
+ TPath table = TPath::Resolve(tablePath, context.SS);
+ TPath index = table.Child(indexConfig.GetName());
+
+
+ TTableInfo::TPtr tableInfo = context.SS->Tables.at(table.Base()->PathId);
+
+ //check idempotence
+
+ //check limits
+
+ TVector<ISubOperationBase::TPtr> result;
+
+ {
+ auto tableIndexCreation = TransactionTemplate(table.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpCreateTableIndex);
+ *tableIndexCreation.MutableLockGuard() = tx.GetLockGuard();
+ tableIndexCreation.MutableCreateTableIndex()->CopyFrom(indexConfig);
+
+ if (!indexConfig.HasType()) {
+ tableIndexCreation.MutableCreateTableIndex()->SetType(NKikimrSchemeOp::EIndexTypeGlobal);
+ }
+ tableIndexCreation.MutableCreateTableIndex()->SetState(NKikimrSchemeOp::EIndexStateWriteOnly);
+
result.push_back(CreateNewTableIndex(NextPartId(nextId, result), tableIndexCreation));
- }
-
- {
- auto initialize = TransactionTemplate(table.Parent().PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpInitiateBuildIndexMainTable);
- *initialize.MutableLockGuard() = tx.GetLockGuard();
- auto& shapshot = *initialize.MutableInitiateBuildIndexMainTable();
- shapshot.SetTableName(table.LeafName());
-
+ }
+
+ {
+ auto initialize = TransactionTemplate(table.Parent().PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpInitiateBuildIndexMainTable);
+ *initialize.MutableLockGuard() = tx.GetLockGuard();
+ auto& shapshot = *initialize.MutableInitiateBuildIndexMainTable();
+ shapshot.SetTableName(table.LeafName());
+
result.push_back(CreateInitializeBuildIndexMainTable(NextPartId(nextId, result), initialize));
- }
-
- {
- auto indexImplTableCreation = TransactionTemplate(index.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpInitiateBuildIndexImplTable);
- NTableIndex::TTableColumns baseTableColumns = NTableIndex::ExtractInfo(tableInfo);
+ }
+
+ {
+ auto indexImplTableCreation = TransactionTemplate(index.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpInitiateBuildIndexImplTable);
+ NTableIndex::TTableColumns baseTableColumns = NTableIndex::ExtractInfo(tableInfo);
NTableIndex::TIndexColumns indexKeys = NTableIndex::ExtractInfo(indexConfig);
-
- TString explain;
- if (!NTableIndex::IsCompatibleIndex(baseTableColumns, indexKeys, explain)) {
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, explain)};
- }
-
- NTableIndex::TTableColumns impTableColumns = NTableIndex::CalcTableImplDescription(baseTableColumns, indexKeys);
-
- auto& indexImplTableDescription = *indexImplTableCreation.MutableCreateTable();
- // This description provided by user to override partition policy
- const auto& userIndexDesc = indexConfig.GetIndexImplTableDescription();
- indexImplTableDescription = NTableIndex::CalcImplTableDesc(tableInfo, impTableColumns, userIndexDesc);
-
- indexImplTableDescription.MutablePartitionConfig()->MutableCompactionPolicy()->SetKeepEraseMarkers(true);
- indexImplTableDescription.MutablePartitionConfig()->SetShadowData(true);
-
+
+ TString explain;
+ if (!NTableIndex::IsCompatibleIndex(baseTableColumns, indexKeys, explain)) {
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, explain)};
+ }
+
+ NTableIndex::TTableColumns impTableColumns = NTableIndex::CalcTableImplDescription(baseTableColumns, indexKeys);
+
+ auto& indexImplTableDescription = *indexImplTableCreation.MutableCreateTable();
+ // This description provided by user to override partition policy
+ const auto& userIndexDesc = indexConfig.GetIndexImplTableDescription();
+ indexImplTableDescription = NTableIndex::CalcImplTableDesc(tableInfo, impTableColumns, userIndexDesc);
+
+ indexImplTableDescription.MutablePartitionConfig()->MutableCompactionPolicy()->SetKeepEraseMarkers(true);
+ indexImplTableDescription.MutablePartitionConfig()->SetShadowData(true);
+
result.push_back(CreateInitializeBuildIndexImplTable(NextPartId(nextId, result), indexImplTableCreation));
- }
-
- return result;
-}
-
-}
-}
+ }
+
+ return result;
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_cdc_stream.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_cdc_stream.cpp
index 0dd806a4341..01e4cd9df82 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_cdc_stream.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_cdc_stream.cpp
@@ -10,7 +10,7 @@
#define LOG_N(stream) LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "[" << context.SS->TabletID() << "] " << stream)
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
namespace {
@@ -126,18 +126,18 @@ public:
SetState(SelectStateFunc(state));
}
- THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
+ THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
const auto& workingDir = Transaction.GetWorkingDir();
const auto& op = Transaction.GetCreateCdcStream();
const auto& streamDesc = op.GetStreamDescription();
const auto& streamName = streamDesc.GetName();
- const auto acceptExisted = !Transaction.GetFailOnExist();
+ const auto acceptExisted = !Transaction.GetFailOnExist();
LOG_N("TNewCdcStream Propose"
<< ": opId# " << OperationId
<< ", stream# " << workingDir << "/" << streamName);
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), context.SS->TabletID());
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), context.SS->TabletID());
const auto tablePath = TPath::Resolve(workingDir, context.SS);
{
@@ -197,21 +197,21 @@ public:
}
switch (streamDesc.GetMode()) {
- case NKikimrSchemeOp::ECdcStreamModeKeysOnly:
- case NKikimrSchemeOp::ECdcStreamModeUpdate:
- case NKikimrSchemeOp::ECdcStreamModeNewImage:
- case NKikimrSchemeOp::ECdcStreamModeOldImage:
- case NKikimrSchemeOp::ECdcStreamModeNewAndOldImages:
+ case NKikimrSchemeOp::ECdcStreamModeKeysOnly:
+ case NKikimrSchemeOp::ECdcStreamModeUpdate:
+ case NKikimrSchemeOp::ECdcStreamModeNewImage:
+ case NKikimrSchemeOp::ECdcStreamModeOldImage:
+ case NKikimrSchemeOp::ECdcStreamModeNewAndOldImages:
break;
default:
- result->SetError(NKikimrScheme::StatusInvalidParameter, TStringBuilder()
+ result->SetError(NKikimrScheme::StatusInvalidParameter, TStringBuilder()
<< "Invalid stream mode: " << static_cast<ui32>(streamDesc.GetMode()));
return result;
}
TString errStr;
if (!context.SS->CheckLocks(tablePath.Base()->PathId, Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
+ result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
return result;
}
@@ -237,7 +237,7 @@ public:
auto& txState = context.SS->CreateTx(OperationId, TTxState::TxCreateCdcStream, streamPath.Base()->PathId);
txState.State = TTxState::Propose;
- streamPath.Base()->PathState = NKikimrSchemeOp::EPathStateCreate;
+ streamPath.Base()->PathState = NKikimrSchemeOp::EPathStateCreate;
streamPath.Base()->CreateTxId = OperationId.GetTxId();
streamPath.Base()->LastTxId = OperationId.GetTxId();
streamPath.Base()->PathType = TPathElement::EPathType::EPathTypeCdcStream;
@@ -379,7 +379,7 @@ public:
SetState(SelectStateFunc(state));
}
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
const auto& workingDir = Transaction.GetWorkingDir();
const auto& op = Transaction.GetCreateCdcStream();
const auto& tableName = op.GetTableName();
@@ -389,7 +389,7 @@ public:
<< ": opId# " << OperationId
<< ", stream# " << workingDir << "/" << tableName << "/" << streamName);
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), context.SS->TabletID());
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), context.SS->TabletID());
const auto workingDirPath = TPath::Resolve(workingDir, context.SS);
{
@@ -435,7 +435,7 @@ public:
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
return result;
}
@@ -451,7 +451,7 @@ public:
auto& txState = context.SS->CreateTx(OperationId, TTxState::TxCreateCdcStreamAtTable, tablePath.Base()->PathId);
txState.State = TTxState::ConfigureParts;
- tablePath.Base()->PathState = NKikimrSchemeOp::EPathStateAlter;
+ tablePath.Base()->PathState = NKikimrSchemeOp::EPathStateAlter;
tablePath.Base()->LastTxId = OperationId.GetTxId();
for (const auto& splitOpId : table->GetSplitOpsInFlight()) {
@@ -503,13 +503,13 @@ ISubOperationBase::TPtr CreateNewCdcStreamAtTable(TOperationId id, TTxState::ETx
}
TVector<ISubOperationBase::TPtr> CreateNewCdcStream(TOperationId opId, const TTxTransaction& tx, TOperationContext& context) {
- Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpCreateCdcStream);
+ Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpCreateCdcStream);
LOG_D("CreateNewCdcStream"
<< ": opId# " << opId
<< ", tx# " << tx.ShortDebugString());
- const auto acceptExisted = !tx.GetFailOnExist();
+ const auto acceptExisted = !tx.GetFailOnExist();
const auto& op = tx.GetCreateCdcStream();
const auto& tableName = op.GetTableName();
const auto& streamDesc = op.GetStreamDescription();
@@ -548,7 +548,7 @@ TVector<ISubOperationBase::TPtr> CreateNewCdcStream(TOperationId opId, const TTx
checks
.IsResolved()
.NotUnderDeleting()
- .FailOnExist(TPathElement::EPathType::EPathTypeCdcStream, acceptExisted);
+ .FailOnExist(TPathElement::EPathType::EPathTypeCdcStream, acceptExisted);
} else {
checks
.NotEmpty()
@@ -570,39 +570,39 @@ TVector<ISubOperationBase::TPtr> CreateNewCdcStream(TOperationId opId, const TTx
}
switch (streamDesc.GetMode()) {
- case NKikimrSchemeOp::ECdcStreamModeKeysOnly:
- case NKikimrSchemeOp::ECdcStreamModeUpdate:
- case NKikimrSchemeOp::ECdcStreamModeNewImage:
- case NKikimrSchemeOp::ECdcStreamModeOldImage:
- case NKikimrSchemeOp::ECdcStreamModeNewAndOldImages:
+ case NKikimrSchemeOp::ECdcStreamModeKeysOnly:
+ case NKikimrSchemeOp::ECdcStreamModeUpdate:
+ case NKikimrSchemeOp::ECdcStreamModeNewImage:
+ case NKikimrSchemeOp::ECdcStreamModeOldImage:
+ case NKikimrSchemeOp::ECdcStreamModeNewAndOldImages:
break;
default:
- return {CreateReject(opId, NKikimrScheme::StatusInvalidParameter, TStringBuilder()
+ return {CreateReject(opId, NKikimrScheme::StatusInvalidParameter, TStringBuilder()
<< "Invalid stream mode: " << static_cast<ui32>(streamDesc.GetMode()))};
}
TString errStr;
if (!context.SS->CheckApplyIf(tx, errStr)) {
- return {CreateReject(opId, NKikimrScheme::StatusPreconditionFailed, errStr)};
+ return {CreateReject(opId, NKikimrScheme::StatusPreconditionFailed, errStr)};
}
if (!context.SS->CheckLocks(tablePath.Base()->PathId, tx, errStr)) {
- return {CreateReject(opId, NKikimrScheme::StatusMultipleModifications, errStr)};
+ return {CreateReject(opId, NKikimrScheme::StatusMultipleModifications, errStr)};
}
TVector<ISubOperationBase::TPtr> result;
{
- auto outTx = TransactionTemplate(tablePath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpCreateCdcStreamImpl);
- outTx.SetFailOnExist(!acceptExisted);
+ auto outTx = TransactionTemplate(tablePath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpCreateCdcStreamImpl);
+ outTx.SetFailOnExist(!acceptExisted);
outTx.MutableCreateCdcStream()->CopyFrom(op);
result.push_back(CreateNewCdcStreamImpl(NextPartId(opId, result), outTx));
}
{
- auto outTx = TransactionTemplate(workingDirPath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpCreateCdcStreamAtTable);
- outTx.SetFailOnExist(!acceptExisted);
+ auto outTx = TransactionTemplate(workingDirPath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpCreateCdcStreamAtTable);
+ outTx.SetFailOnExist(!acceptExisted);
outTx.MutableCreateCdcStream()->CopyFrom(op);
result.push_back(CreateNewCdcStreamAtTable(NextPartId(opId, result), outTx));
@@ -674,5 +674,5 @@ TVector<ISubOperationBase::TPtr> CreateNewCdcStream(TOperationId opId, const TTx
return result;
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_extsubdomain.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_extsubdomain.cpp
index 4356656566b..9b6b9a49600 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_extsubdomain.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_extsubdomain.cpp
@@ -1,262 +1,262 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
#include <ydb/core/persqueue/config/config.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TCreateExtSubDomain: public TSubOperation {
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TCreateExtSubDomain: public TSubOperation {
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::Propose;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- return TTxState::Propose;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::Propose;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ return TTxState::Propose;
case TTxState::Propose:
return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::Propose:
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::Propose:
return THolder(new NSubDomainState::TPropose(OperationId));
case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TCreateExtSubDomain(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TCreateExtSubDomain(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+
+ TCreateExtSubDomain(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const auto& settings = Transaction.GetSubDomain();
- const auto acceptExisted = !Transaction.GetFailOnExist();
-
+ const auto acceptExisted = !Transaction.GetFailOnExist();
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = settings.GetName();
-
- ui64 shardsToCreate = settings.GetCoordinators() + settings.GetMediators();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateExtSubDomain Propose"
- << ", path" << parentPathStr << "/" << name
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
- auto result = MakeHolder<TProposeResponse>(status, ui64(OperationId.GetTxId()), ui64(ssId));
-
- if (!parentPathStr) {
- result->SetError(NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: no working dir");
- return result;
- }
-
- if (!name) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: no name");
- return result;
- }
-
- NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
- {
- NSchemeShard::TPath::TChecker checks = parentPath.Check();
- checks
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsCommonSensePath()
- .IsLikeDirectory();
-
- if (!checks) {
- TString explain = TStringBuilder() << "parent path fail checks"
- << ", path: " << parentPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
+
+ ui64 shardsToCreate = settings.GetCoordinators() + settings.GetMediators();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateExtSubDomain Propose"
+ << ", path" << parentPathStr << "/" << name
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
+ auto result = MakeHolder<TProposeResponse>(status, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ if (!parentPathStr) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: no working dir");
+ return result;
+ }
+
+ if (!name) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: no name");
+ return result;
+ }
+
+ NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
+ {
+ NSchemeShard::TPath::TChecker checks = parentPath.Check();
+ checks
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsCommonSensePath()
+ .IsLikeDirectory();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent path fail checks"
+ << ", path: " << parentPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
const TString acl = Transaction.GetModifyACL().GetDiffACL();
- NSchemeShard::TPath dstPath = parentPath.Child(name);
- {
- NSchemeShard::TPath::TChecker checks = dstPath.Check();
- checks.IsAtLocalSchemeShard();
- if (dstPath.IsResolved()) {
+ NSchemeShard::TPath dstPath = parentPath.Child(name);
+ {
+ NSchemeShard::TPath::TChecker checks = dstPath.Check();
+ checks.IsAtLocalSchemeShard();
+ if (dstPath.IsResolved()) {
checks
.IsResolved()
- .NotUnderDeleting()
- .FailOnExist(TPathElement::EPathType::EPathTypeExtSubDomain, acceptExisted);
- } else {
+ .NotUnderDeleting()
+ .FailOnExist(TPathElement::EPathType::EPathTypeExtSubDomain, acceptExisted);
+ } else {
checks
.NotEmpty()
- .NotResolved();
- }
-
- if (checks) {
- checks
- .IsValidLeafName()
- .DepthLimit()
- .PathsLimit() //check capacity on root Domain
- .DirChildrenLimit()
- .PathShardsLimit(shardsToCreate)
+ .NotResolved();
+ }
+
+ if (checks) {
+ checks
+ .IsValidLeafName()
+ .DepthLimit()
+ .PathsLimit() //check capacity on root Domain
+ .DirChildrenLimit()
+ .PathShardsLimit(shardsToCreate)
.ShardsLimit(shardsToCreate) //check capacity on root Domain
.IsValidACL(acl);
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "dst path fail checks"
- << ", path: " << dstPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- if (dstPath.IsResolved()) {
- result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
- }
- return result;
- }
- }
-
- const bool onlyDeclaration = settings.GetTimeCastBucketsPerMediator() == 0 &&
- settings.GetPlanResolution() == 0 &&
- settings.GetCoordinators() == 0 &&
- settings.GetMediators() == 0;
-
- if (!onlyDeclaration) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: only declaration at creation is allowed, do not set up tables");
- return result;
- }
-
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "dst path fail checks"
+ << ", path: " << dstPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ if (dstPath.IsResolved()) {
+ result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+ }
+ return result;
+ }
+ }
+
+ const bool onlyDeclaration = settings.GetTimeCastBucketsPerMediator() == 0 &&
+ settings.GetPlanResolution() == 0 &&
+ settings.GetCoordinators() == 0 &&
+ settings.GetMediators() == 0;
+
+ if (!onlyDeclaration) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: only declaration at creation is allowed, do not set up tables");
+ return result;
+ }
+
TPathId resourcesDomainId;
if (settings.HasResourcesDomainKey()) {
const auto& resourcesDomainKey = settings.GetResourcesDomainKey();
resourcesDomainId = TPathId(resourcesDomainKey.GetSchemeShard(), resourcesDomainKey.GetPathId());
if (!context.SS->SubDomains.contains(resourcesDomainId)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "Unknown resources domain key");
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "Unknown resources domain key");
return result;
}
}
- auto domainId = parentPath.DomainId();
- Y_VERIFY(context.SS->PathsById.contains(domainId));
- Y_VERIFY(context.SS->SubDomains.contains(domainId));
- if (domainId != context.SS->RootPathId()) {
- result->SetError(NKikimrScheme::StatusNameConflict, "Nested subdomains is forbidden");
- return result;
- }
-
-
- bool requestedStoragePools = !settings.GetStoragePools().empty();
- if (requestedStoragePools) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: only declaration at creation is allowed, do not set up storage");
- return result;
- }
-
+ auto domainId = parentPath.DomainId();
+ Y_VERIFY(context.SS->PathsById.contains(domainId));
+ Y_VERIFY(context.SS->SubDomains.contains(domainId));
+ if (domainId != context.SS->RootPathId()) {
+ result->SetError(NKikimrScheme::StatusNameConflict, "Nested subdomains is forbidden");
+ return result;
+ }
+
+
+ bool requestedStoragePools = !settings.GetStoragePools().empty();
+ if (requestedStoragePools) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: only declaration at creation is allowed, do not set up storage");
+ return result;
+ }
+
const auto& userAttrsDetails = Transaction.GetAlterUserAttributes();
- TUserAttributes::TPtr userAttrs = new TUserAttributes(1);
+ TUserAttributes::TPtr userAttrs = new TUserAttributes(1);
TString errStr;
if (!userAttrs->ApplyPatch(EUserAttributesOp::CreateExtSubDomain, userAttrsDetails, errStr) ||
!userAttrs->CheckLimits(errStr))
{
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- dstPath.MaterializeLeaf(owner);
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
-
- TPathElement::TPtr newNode = dstPath.Base();
- newNode->CreateTxId = OperationId.GetTxId();
- newNode->LastTxId = OperationId.GetTxId();
- newNode->PathState = TPathElement::EPathState::EPathStateCreate;
- newNode->PathType = TPathElement::EPathType::EPathTypeExtSubDomain;
- newNode->UserAttrs->AlterData = userAttrs;
- newNode->DirAlterVersion = 1;
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- context.SS->PersistPath(db, newNode->PathId);
- context.SS->ApplyAndPersistUserAttrs(db, newNode->PathId);
-
- if (!acl.empty()) {
- newNode->ApplyACL(acl);
- context.SS->PersistACL(db, newNode);
- }
-
- context.SS->PersistUpdateNextPathId(db);
-
- context.SS->TabletCounters->Simple()[COUNTER_EXTSUB_DOMAIN_COUNT].Add(1);
-
- Y_VERIFY(!context.SS->FindTx(OperationId));
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxCreateExtSubDomain, newNode->PathId);
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ dstPath.MaterializeLeaf(owner);
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+
+ TPathElement::TPtr newNode = dstPath.Base();
+ newNode->CreateTxId = OperationId.GetTxId();
+ newNode->LastTxId = OperationId.GetTxId();
+ newNode->PathState = TPathElement::EPathState::EPathStateCreate;
+ newNode->PathType = TPathElement::EPathType::EPathTypeExtSubDomain;
+ newNode->UserAttrs->AlterData = userAttrs;
+ newNode->DirAlterVersion = 1;
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ context.SS->PersistPath(db, newNode->PathId);
+ context.SS->ApplyAndPersistUserAttrs(db, newNode->PathId);
+
+ if (!acl.empty()) {
+ newNode->ApplyACL(acl);
+ context.SS->PersistACL(db, newNode);
+ }
+
+ context.SS->PersistUpdateNextPathId(db);
+
+ context.SS->TabletCounters->Simple()[COUNTER_EXTSUB_DOMAIN_COUNT].Add(1);
+
+ Y_VERIFY(!context.SS->FindTx(OperationId));
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxCreateExtSubDomain, newNode->PathId);
+
TSubDomainInfo::TPtr alter = new TSubDomainInfo(1, 0, 0, resourcesDomainId ? resourcesDomainId : newNode->PathId);
- alter->SetSchemeLimits(parentPath.DomainInfo()->GetSchemeLimits()); //inherit from root
-
+ alter->SetSchemeLimits(parentPath.DomainInfo()->GetSchemeLimits()); //inherit from root
+
if (resourcesDomainId) {
TSubDomainInfo::TPtr resourcesDomain = context.SS->SubDomains.at(resourcesDomainId);
- TTabletId sharedHive = context.SS->GetGlobalHive(context.Ctx);
- if (resourcesDomain->GetTenantHiveID()) {
- sharedHive = resourcesDomain->GetTenantHiveID();
+ TTabletId sharedHive = context.SS->GetGlobalHive(context.Ctx);
+ if (resourcesDomain->GetTenantHiveID()) {
+ sharedHive = resourcesDomain->GetTenantHiveID();
}
-
- alter->SetSharedHive(sharedHive);
+
+ alter->SetSharedHive(sharedHive);
}
if (settings.HasDeclaredSchemeQuotas()) {
@@ -267,70 +267,70 @@ public:
alter->SetDatabaseQuotas(settings.GetDatabaseQuotas());
}
- Y_VERIFY(!context.SS->SubDomains.contains(newNode->PathId));
- auto& subDomainInfo = context.SS->SubDomains[newNode->PathId];
- subDomainInfo = new TSubDomainInfo();
- subDomainInfo->SetAlter(alter);
-
- context.SS->PersistSubDomain(db, newNode->PathId, *subDomainInfo);
- context.SS->PersistSubDomainAlter(db, newNode->PathId, *alter);
+ Y_VERIFY(!context.SS->SubDomains.contains(newNode->PathId));
+ auto& subDomainInfo = context.SS->SubDomains[newNode->PathId];
+ subDomainInfo = new TSubDomainInfo();
+ subDomainInfo->SetAlter(alter);
+
+ context.SS->PersistSubDomain(db, newNode->PathId, *subDomainInfo);
+ context.SS->PersistSubDomainAlter(db, newNode->PathId, *alter);
context.SS->IncrementPathDbRefCount(newNode->PathId);
-
- if (parentPath.Base()->HasActiveChanges()) {
- TTxId parentTxId = parentPath.Base()->PlannedToCreate() ? parentPath.Base()->CreateTxId : parentPath.Base()->LastTxId;
- context.OnComplete.Dependence(parentTxId, OperationId.GetTxId());
- }
-
- txState.State = TTxState::Propose;
- context.OnComplete.ActivateTx(OperationId);
-
- context.SS->PersistTxState(db, OperationId);
-
- ++parentPath.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentPath.Base());
- context.SS->ClearDescribePathCaches(parentPath.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, parentPath.Base()->PathId);
-
- context.SS->ClearDescribePathCaches(newNode);
- context.OnComplete.PublishToSchemeBoard(OperationId, newNode->PathId);
-
- Y_VERIFY(0 == txState.Shards.size());
- parentPath.DomainInfo()->IncPathsInside();
- parentPath.Base()->IncAliveChildren();
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+
+ if (parentPath.Base()->HasActiveChanges()) {
+ TTxId parentTxId = parentPath.Base()->PlannedToCreate() ? parentPath.Base()->CreateTxId : parentPath.Base()->LastTxId;
+ context.OnComplete.Dependence(parentTxId, OperationId.GetTxId());
+ }
+
+ txState.State = TTxState::Propose;
+ context.OnComplete.ActivateTx(OperationId);
+
+ context.SS->PersistTxState(db, OperationId);
+
+ ++parentPath.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentPath.Base());
+ context.SS->ClearDescribePathCaches(parentPath.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentPath.Base()->PathId);
+
+ context.SS->ClearDescribePathCaches(newNode);
+ context.OnComplete.PublishToSchemeBoard(OperationId, newNode->PathId);
+
+ Y_VERIFY(0 == txState.Shards.size());
+ parentPath.DomainInfo()->IncPathsInside();
+ parentPath.Base()->IncAliveChildren();
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TCreateExtSubDomain");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateExtSubDomain AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateExtSubDomain AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateExtSubDomain(TOperationId id, const TTxTransaction& tx) {
return new TCreateExtSubDomain(id, tx);
}
-ISubOperationBase::TPtr CreateExtSubDomain(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateExtSubDomain(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TCreateExtSubDomain(id, state);
-}
-
-}
-}
+ return new TCreateExtSubDomain(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_fs.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_fs.cpp
index 29e1d073f60..6d908a55e8f 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_fs.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_fs.cpp
@@ -8,7 +8,7 @@
namespace {
using namespace NKikimr;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
////////////////////////////////////////////////////////////////////////////////
@@ -282,8 +282,8 @@ private:
}
TFileStoreInfo::TPtr CreateFileStoreInfo(
- const NKikimrSchemeOp::TFileStoreDescription& op,
- TEvSchemeShard::EStatus& status,
+ const NKikimrSchemeOp::TFileStoreDescription& op,
+ TEvSchemeShard::EStatus& status,
TString& errStr);
TTxState& PrepareChanges(
@@ -304,7 +304,7 @@ THolder<TProposeResponse> TCreateFileStore::Propose(
{
const auto ssId = context.SS->SelfTabletId();
- const auto acceptExisted = !Transaction.GetFailOnExist();
+ const auto acceptExisted = !Transaction.GetFailOnExist();
const auto& operation = Transaction.GetCreateFileStore();
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = Transaction.GetCreateFileStore().GetName();
@@ -316,13 +316,13 @@ THolder<TProposeResponse> TCreateFileStore::Propose(
<< ", opId: " << OperationId
<< ", at schemeshard: " << ssId);
- auto status = NKikimrScheme::StatusAccepted;
+ auto status = NKikimrScheme::StatusAccepted;
auto result = MakeHolder<TProposeResponse>(
status,
ui64(OperationId.GetTxId()),
ui64(ssId));
- auto parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
+ auto parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
{
auto checks = parentPath.Check();
checks
@@ -393,7 +393,7 @@ THolder<TProposeResponse> TCreateFileStore::Propose(
auto errStr = Sprintf("Wrong number of channels %u , should be [1 .. %lu]",
ecps.size(), NHive::MAX_TABLET_CHANNELS);
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
return result;
}
@@ -410,7 +410,7 @@ THolder<TProposeResponse> TCreateFileStore::Propose(
);
if (!storeChannelsResolved) {
- result->SetError(NKikimrScheme::StatusInvalidParameter,
+ result->SetError(NKikimrScheme::StatusInvalidParameter,
"Unable to construct channel binding for filestore with the storage pool");
return result;
}
@@ -419,7 +419,7 @@ THolder<TProposeResponse> TCreateFileStore::Propose(
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
return result;
}
@@ -463,21 +463,21 @@ THolder<TProposeResponse> TCreateFileStore::Propose(
}
TFileStoreInfo::TPtr TCreateFileStore::CreateFileStoreInfo(
- const NKikimrSchemeOp::TFileStoreDescription& op,
- TEvSchemeShard::EStatus& status,
+ const NKikimrSchemeOp::TFileStoreDescription& op,
+ TEvSchemeShard::EStatus& status,
TString& errStr)
{
TFileStoreInfo::TPtr fs = new TFileStoreInfo();
const auto& config = op.GetConfig();
if (!config.HasBlockSize()) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = "Block size is required";
return nullptr;
}
if (config.HasVersion()) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = "Setting version is not allowed";
return nullptr;
}
@@ -522,7 +522,7 @@ TTxState& TCreateFileStore::PrepareChanges(
context.SS->ChangeTxState(db, operationId, TTxState::CreateParts);
context.OnComplete.ActivateTx(operationId);
- context.SS->PersistPath(db, fsPath->PathId);
+ context.SS->PersistPath(db, fsPath->PathId);
if (!acl.empty()) {
fsPath->ApplyACL(acl);
context.SS->PersistACL(db, fsPath);
@@ -532,7 +532,7 @@ TTxState& TCreateFileStore::PrepareChanges(
context.SS->PersistFileStoreInfo(db, pathId, fs);
context.SS->IncrementPathDbRefCount(pathId);
- context.SS->PersistTxState(db, operationId);
+ context.SS->PersistTxState(db, operationId);
context.SS->PersistUpdateNextPathId(db);
context.SS->PersistUpdateNextShardIdx(db);
@@ -548,7 +548,7 @@ TTxState& TCreateFileStore::PrepareChanges(
} // namespace
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
////////////////////////////////////////////////////////////////////////////////
@@ -561,5 +561,5 @@ ISubOperationBase::TPtr CreateNewFileStore(TOperationId id, TTxState::ETxState s
return new TCreateFileStore(id, state);
}
-} // namespace NSchemeShard
+} // namespace NSchemeShard
} // namespace NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_index.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_index.cpp
index 28a18536170..4713823eef6 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_index.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_index.cpp
@@ -1,311 +1,311 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-using namespace NTableIndex;
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+using namespace NTableIndex;
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TCreateTableIndex TPropose"
- << " operationId#" << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", step: " << step
- << ", at schemeshard: " << context.SS->TabletID());
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreateTableIndex);
- Y_VERIFY(txState->State == TTxState::Propose);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
- path->StepCreated = step;
- context.SS->PersistCreateStep(db, path->PathId, step);
-
- context.SS->TabletCounters->Simple()[COUNTER_TABLE_INDEXES_COUNT].Add(1);
-
- Y_VERIFY(context.SS->Indexes.contains(path->PathId));
- TTableIndexInfo::TPtr indexData = context.SS->Indexes.at(path->PathId);
- context.SS->PersistTableIndex(db, path->PathId);
- context.SS->Indexes[path->PathId] = indexData->AlterData;
-
- context.SS->ClearDescribePathCaches(path);
- context.OnComplete.PublishToSchemeBoard(OperationId, path->PathId);
-
- context.SS->ChangeTxState(db, OperationId, TTxState::Done);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << context.SS->TabletID());
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreateTableIndex);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-class TCreateTableIndex: public TSubOperation {
- const TOperationId OperationId;
- const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::Propose;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Propose:
- return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Propose:
+ return TStringBuilder()
+ << "TCreateTableIndex TPropose"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", step: " << step
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateTableIndex);
+ Y_VERIFY(txState->State == TTxState::Propose);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+ path->StepCreated = step;
+ context.SS->PersistCreateStep(db, path->PathId, step);
+
+ context.SS->TabletCounters->Simple()[COUNTER_TABLE_INDEXES_COUNT].Add(1);
+
+ Y_VERIFY(context.SS->Indexes.contains(path->PathId));
+ TTableIndexInfo::TPtr indexData = context.SS->Indexes.at(path->PathId);
+ context.SS->PersistTableIndex(db, path->PathId);
+ context.SS->Indexes[path->PathId] = indexData->AlterData;
+
+ context.SS->ClearDescribePathCaches(path);
+ context.OnComplete.PublishToSchemeBoard(OperationId, path->PathId);
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::Done);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateTableIndex);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+class TCreateTableIndex: public TSubOperation {
+ const TOperationId OperationId;
+ const TTxTransaction Transaction;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::Propose;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Propose:
+ return TTxState::Done;
+ default:
+ return TTxState::Invalid;
+ }
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Propose:
return THolder(new TPropose(OperationId));
- case TTxState::Done:
+ case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
- TCreateTableIndex(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
- , Transaction(tx)
- {
- }
-
- TCreateTableIndex(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
- const auto acceptExisted = !Transaction.GetFailOnExist();
- const auto& tableIndexCreation = Transaction.GetCreateTableIndex();
-
- const TString& parentPathStr = Transaction.GetWorkingDir();
- const TString& name = tableIndexCreation.GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateTableIndex Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", operationId: " << OperationId
- << ", transaction: " << Transaction.ShortDebugString()
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- if (!Transaction.HasCreateTableIndex()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "CreateTableIndex is not present");
- return result;
- }
-
- if (!tableIndexCreation.HasName()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "Name is not present in CreateTableIndex");
- return result;
- }
-
- NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
- {
- NSchemeShard::TPath::TChecker checks = parentPath.Check();
- checks
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsCommonSensePath()
- .IsTable();
-
- if (tableIndexCreation.GetState() == NKikimrSchemeOp::EIndexState::EIndexStateReady) {
- checks
- .IsUnderCreating(NKikimrScheme::StatusNameConflict)
- .IsUnderTheSameOperation(OperationId.GetTxId()); //allow only as part of creating base table
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "parent path fail checks"
- << ", path: " << parentPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- const TString acl = Transaction.GetModifyACL().GetDiffACL();
-
- NSchemeShard::TPath dstPath = parentPath.Child(name);
- {
- NSchemeShard::TPath::TChecker checks = dstPath.Check();
- if (dstPath.IsResolved()) {
- checks
- .IsResolved()
- .NotUnderDeleting()
- .FailOnExist(TPathElement::EPathType::EPathTypeTableIndex, acceptExisted);
- } else {
- checks
- .NotEmpty()
- .NotResolved();
- }
-
- if (checks) {
- checks
- .PathsLimit()
- .IsValidLeafName()
- .IsValidACL(acl);
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "dst path fail checks"
- << ", path: " << parentPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- if (dstPath.IsResolved()) {
- result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
- }
- return result;
- }
- }
-
- TString errMsg;
-
- if (!context.SS->CheckLocks(parentPath.Base()->PathId, Transaction, errMsg)) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, errMsg);
- return result;
- }
-
- TTableIndexInfo::TPtr newIndexData = nullptr;
- {
- newIndexData = TTableIndexInfo::Create(tableIndexCreation, errMsg);
- if (!newIndexData) {
- result->SetError(TEvSchemeShard::EStatus::StatusInvalidParameter, errMsg);
- return result;
- }
- }
-
- TPathId allocatedPathId = context.SS->AllocatePathId();
- context.MemChanges.GrabNewPath(context.SS, allocatedPathId);
- context.MemChanges.GrabPath(context.SS, parentPath.Base()->PathId);
- context.MemChanges.GrabNewTxState(context.SS, OperationId);
- context.MemChanges.GrabNewIndex(context.SS, allocatedPathId);
-
- context.DbChanges.PersistPath(allocatedPathId);
- context.DbChanges.PersistPath(parentPath.Base()->PathId);
- context.DbChanges.PersistAlterIndex(allocatedPathId);
- context.DbChanges.PersistTxState(OperationId);
-
- dstPath.MaterializeLeaf(owner, allocatedPathId);
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
-
- auto newIndexPath = dstPath.Base();
-
- // store table index description
-
- Y_VERIFY(!context.SS->FindTx(OperationId));
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxCreateTableIndex, newIndexPath->PathId);
- txState.State = TTxState::Propose;
-
- newIndexPath->PathState = NKikimrSchemeOp::EPathStateCreate;
- newIndexPath->CreateTxId = OperationId.GetTxId();
- newIndexPath->LastTxId = OperationId.GetTxId();
- newIndexPath->PathType = TPathElement::EPathType::EPathTypeTableIndex;
-
- context.SS->Indexes[newIndexPath->PathId] = newIndexData;
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
+ TCreateTableIndex(TOperationId id, const TTxTransaction& tx)
+ : OperationId(id)
+ , Transaction(tx)
+ {
+ }
+
+ TCreateTableIndex(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ const auto acceptExisted = !Transaction.GetFailOnExist();
+ const auto& tableIndexCreation = Transaction.GetCreateTableIndex();
+
+ const TString& parentPathStr = Transaction.GetWorkingDir();
+ const TString& name = tableIndexCreation.GetName();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateTableIndex Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", operationId: " << OperationId
+ << ", transaction: " << Transaction.ShortDebugString()
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ if (!Transaction.HasCreateTableIndex()) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "CreateTableIndex is not present");
+ return result;
+ }
+
+ if (!tableIndexCreation.HasName()) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "Name is not present in CreateTableIndex");
+ return result;
+ }
+
+ NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
+ {
+ NSchemeShard::TPath::TChecker checks = parentPath.Check();
+ checks
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsCommonSensePath()
+ .IsTable();
+
+ if (tableIndexCreation.GetState() == NKikimrSchemeOp::EIndexState::EIndexStateReady) {
+ checks
+ .IsUnderCreating(NKikimrScheme::StatusNameConflict)
+ .IsUnderTheSameOperation(OperationId.GetTxId()); //allow only as part of creating base table
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent path fail checks"
+ << ", path: " << parentPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ const TString acl = Transaction.GetModifyACL().GetDiffACL();
+
+ NSchemeShard::TPath dstPath = parentPath.Child(name);
+ {
+ NSchemeShard::TPath::TChecker checks = dstPath.Check();
+ if (dstPath.IsResolved()) {
+ checks
+ .IsResolved()
+ .NotUnderDeleting()
+ .FailOnExist(TPathElement::EPathType::EPathTypeTableIndex, acceptExisted);
+ } else {
+ checks
+ .NotEmpty()
+ .NotResolved();
+ }
+
+ if (checks) {
+ checks
+ .PathsLimit()
+ .IsValidLeafName()
+ .IsValidACL(acl);
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "dst path fail checks"
+ << ", path: " << parentPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ if (dstPath.IsResolved()) {
+ result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+ }
+ return result;
+ }
+ }
+
+ TString errMsg;
+
+ if (!context.SS->CheckLocks(parentPath.Base()->PathId, Transaction, errMsg)) {
+ result->SetError(NKikimrScheme::StatusMultipleModifications, errMsg);
+ return result;
+ }
+
+ TTableIndexInfo::TPtr newIndexData = nullptr;
+ {
+ newIndexData = TTableIndexInfo::Create(tableIndexCreation, errMsg);
+ if (!newIndexData) {
+ result->SetError(TEvSchemeShard::EStatus::StatusInvalidParameter, errMsg);
+ return result;
+ }
+ }
+
+ TPathId allocatedPathId = context.SS->AllocatePathId();
+ context.MemChanges.GrabNewPath(context.SS, allocatedPathId);
+ context.MemChanges.GrabPath(context.SS, parentPath.Base()->PathId);
+ context.MemChanges.GrabNewTxState(context.SS, OperationId);
+ context.MemChanges.GrabNewIndex(context.SS, allocatedPathId);
+
+ context.DbChanges.PersistPath(allocatedPathId);
+ context.DbChanges.PersistPath(parentPath.Base()->PathId);
+ context.DbChanges.PersistAlterIndex(allocatedPathId);
+ context.DbChanges.PersistTxState(OperationId);
+
+ dstPath.MaterializeLeaf(owner, allocatedPathId);
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+
+ auto newIndexPath = dstPath.Base();
+
+ // store table index description
+
+ Y_VERIFY(!context.SS->FindTx(OperationId));
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxCreateTableIndex, newIndexPath->PathId);
+ txState.State = TTxState::Propose;
+
+ newIndexPath->PathState = NKikimrSchemeOp::EPathStateCreate;
+ newIndexPath->CreateTxId = OperationId.GetTxId();
+ newIndexPath->LastTxId = OperationId.GetTxId();
+ newIndexPath->PathType = TPathElement::EPathType::EPathTypeTableIndex;
+
+ context.SS->Indexes[newIndexPath->PathId] = newIndexData;
context.SS->IncrementPathDbRefCount(newIndexPath->PathId);
-
- if (!acl.empty()) {
- newIndexPath->ApplyACL(acl);
- }
-
- context.OnComplete.ActivateTx(OperationId);
-
- dstPath.DomainInfo()->IncPathsInside();
- parentPath.Base()->IncAliveChildren();
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
- void AbortPropose(TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateTableIndex AbortPropose"
- << ", opId: " << OperationId
- << ", at schemeshard: " << context.SS->TabletID());
- }
-
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateTableIndex AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
- << ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-ISubOperationBase::TPtr CreateNewTableIndex(TOperationId id, const TTxTransaction& tx) {
- return new TCreateTableIndex(id, tx);
-}
-
-ISubOperationBase::TPtr CreateNewTableIndex(TOperationId id, TTxState::ETxState state) {
- return new TCreateTableIndex(id, state);
-}
-
-}
-}
+
+ if (!acl.empty()) {
+ newIndexPath->ApplyACL(acl);
+ }
+
+ context.OnComplete.ActivateTx(OperationId);
+
+ dstPath.DomainInfo()->IncPathsInside();
+ parentPath.Base()->IncAliveChildren();
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
+ void AbortPropose(TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateTableIndex AbortPropose"
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << context.SS->TabletID());
+ }
+
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateTableIndex AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+ISubOperationBase::TPtr CreateNewTableIndex(TOperationId id, const TTxTransaction& tx) {
+ return new TCreateTableIndex(id, tx);
+}
+
+ISubOperationBase::TPtr CreateNewTableIndex(TOperationId id, TTxState::ETxState state) {
+ return new TCreateTableIndex(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_indexed_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_indexed_table.cpp
index 8b2e3e0f054..5beb0a88488 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_indexed_table.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_indexed_table.cpp
@@ -1,32 +1,32 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_path_element.h"
-#include "schemeshard_utils.h"
-
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_path_element.h"
+#include "schemeshard_utils.h"
+
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/table_index.h>
#include <ydb/core/protos/flat_tx_scheme.pb.h>
#include <ydb/core/protos/flat_scheme_op.pb.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-using namespace NTableIndex;
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-TVector<ISubOperationBase::TPtr> CreateIndexedTable(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context) {
- Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexedTable);
-
- auto indexedTable = tx.GetCreateIndexedTable();
- const NKikimrSchemeOp::TTableDescription& baseTableDescription = indexedTable.GetTableDescription();
-
- ui32 indexesCount = indexedTable.IndexDescriptionSize();
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+using namespace NTableIndex;
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+TVector<ISubOperationBase::TPtr> CreateIndexedTable(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context) {
+ Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexedTable);
+
+ auto indexedTable = tx.GetCreateIndexedTable();
+ const NKikimrSchemeOp::TTableDescription& baseTableDescription = indexedTable.GetTableDescription();
+
+ ui32 indexesCount = indexedTable.IndexDescriptionSize();
ui32 indexedTableShards = 0;
for (const auto& desc : indexedTable.GetIndexDescription()) {
if (desc.HasIndexImplTableDescription()) {
@@ -36,106 +36,106 @@ TVector<ISubOperationBase::TPtr> CreateIndexedTable(TOperationId nextId, const T
}
}
ui32 sequencesCount = indexedTable.SequenceDescriptionSize();
- ui32 baseShards = TTableInfo::ShardsToCreate(baseTableDescription);
+ ui32 baseShards = TTableInfo::ShardsToCreate(baseTableDescription);
ui32 shardsToCreate = baseShards + indexedTableShards;
ui32 pathToCreate = 1 + indexesCount * 2 + sequencesCount;
-
- TPath workingDir = TPath::Resolve(tx.GetWorkingDir(), context.SS);
- if (workingDir.IsEmpty()) {
- TString msg = "parent path hasn't been resolved";
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusPathDoesNotExist, msg)};
- }
-
- TPath baseTablePath = workingDir.Child(baseTableDescription.GetName());
- {
- TString msg = "invalid table name: ";
- if(!baseTablePath.IsValidLeafName(msg)) {
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusSchemeError, msg)};
- }
- }
-
+
+ TPath workingDir = TPath::Resolve(tx.GetWorkingDir(), context.SS);
+ if (workingDir.IsEmpty()) {
+ TString msg = "parent path hasn't been resolved";
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusPathDoesNotExist, msg)};
+ }
+
+ TPath baseTablePath = workingDir.Child(baseTableDescription.GetName());
+ {
+ TString msg = "invalid table name: ";
+ if(!baseTablePath.IsValidLeafName(msg)) {
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusSchemeError, msg)};
+ }
+ }
+
if (baseTableDescription.GetIsBackup()) {
- return {CreateReject(nextId, NKikimrScheme::StatusInvalidParameter, "Cannot create table with explicit 'IsBackup' property")};
+ return {CreateReject(nextId, NKikimrScheme::StatusInvalidParameter, "Cannot create table with explicit 'IsBackup' property")};
}
- TSubDomainInfo::TPtr domainInfo = baseTablePath.DomainInfo();
-
+ TSubDomainInfo::TPtr domainInfo = baseTablePath.DomainInfo();
+
if (sequencesCount > 0 && domainInfo->GetSequenceShards().empty()) {
++shardsToCreate;
}
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateTableIndex construct operation "
- << " table path: " << baseTablePath.PathString()
- << " domain path id: " << baseTablePath.DomainId()
- << " domain path: " << TPath::Init(baseTablePath.DomainId(), context.SS).PathString()
- << " shardsToCreate: " << shardsToCreate
- << " GetShardsInside: " << domainInfo->GetShardsInside()
- << " MaxShards: " << domainInfo->GetSchemeLimits().MaxShards);
-
- if (domainInfo->GetShardsInside() + shardsToCreate > domainInfo->GetSchemeLimits().MaxShards) {
- auto msg = TStringBuilder() << "shards count has reached maximum value in the domain"
- << ", paths limit for domain: " << domainInfo->GetSchemeLimits().MaxShards
- << ", paths count inside domain: " << domainInfo->GetShardsInside()
- << ", intention to create new paths: " << shardsToCreate;
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusResourceExhausted, msg)};
- }
-
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateTableIndex construct operation "
+ << " table path: " << baseTablePath.PathString()
+ << " domain path id: " << baseTablePath.DomainId()
+ << " domain path: " << TPath::Init(baseTablePath.DomainId(), context.SS).PathString()
+ << " shardsToCreate: " << shardsToCreate
+ << " GetShardsInside: " << domainInfo->GetShardsInside()
+ << " MaxShards: " << domainInfo->GetSchemeLimits().MaxShards);
+
+ if (domainInfo->GetShardsInside() + shardsToCreate > domainInfo->GetSchemeLimits().MaxShards) {
+ auto msg = TStringBuilder() << "shards count has reached maximum value in the domain"
+ << ", paths limit for domain: " << domainInfo->GetSchemeLimits().MaxShards
+ << ", paths count inside domain: " << domainInfo->GetShardsInside()
+ << ", intention to create new paths: " << shardsToCreate;
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusResourceExhausted, msg)};
+ }
+
if (indexesCount > domainInfo->GetSchemeLimits().MaxTableIndices) {
- auto msg = TStringBuilder() << "indexes count has reached maximum value in the table"
+ auto msg = TStringBuilder() << "indexes count has reached maximum value in the table"
<< ", children limit for dir in domain: " << domainInfo->GetSchemeLimits().MaxTableIndices
- << ", intention to create new children: " << indexesCount;
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusResourceExhausted, msg)};
- }
-
- if (domainInfo->GetPathsInside() + pathToCreate > domainInfo->GetSchemeLimits().MaxPaths) {
- auto msg = TStringBuilder() << "paths count has reached maximum value in the domain"
- << ", paths limit for domain: " << domainInfo->GetSchemeLimits().MaxPaths
- << ", paths count inside domain: " << domainInfo->GetPathsInside()
- << ", intention to create new paths: " << pathToCreate;
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusResourceExhausted, msg)};
- }
-
- if (baseShards > domainInfo->GetSchemeLimits().MaxShardsInPath) {
- auto msg = TStringBuilder() << "shards count has reached maximum value in the path"
- << ", shards limit for path: " << domainInfo->GetSchemeLimits().MaxShardsInPath
- << ", intention to create new shards: " << baseShards;
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusResourceExhausted, msg)};
- }
-
- THashMap<TString, TTableColumns> indexes;
-
- TTableColumns baseTableColumns = ExtractInfo(baseTableDescription);
- for (auto& indexDescription: indexedTable.GetIndexDescription()) {
- const auto& indexName = indexDescription.GetName();
+ << ", intention to create new children: " << indexesCount;
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusResourceExhausted, msg)};
+ }
+
+ if (domainInfo->GetPathsInside() + pathToCreate > domainInfo->GetSchemeLimits().MaxPaths) {
+ auto msg = TStringBuilder() << "paths count has reached maximum value in the domain"
+ << ", paths limit for domain: " << domainInfo->GetSchemeLimits().MaxPaths
+ << ", paths count inside domain: " << domainInfo->GetPathsInside()
+ << ", intention to create new paths: " << pathToCreate;
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusResourceExhausted, msg)};
+ }
+
+ if (baseShards > domainInfo->GetSchemeLimits().MaxShardsInPath) {
+ auto msg = TStringBuilder() << "shards count has reached maximum value in the path"
+ << ", shards limit for path: " << domainInfo->GetSchemeLimits().MaxShardsInPath
+ << ", intention to create new shards: " << baseShards;
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusResourceExhausted, msg)};
+ }
+
+ THashMap<TString, TTableColumns> indexes;
+
+ TTableColumns baseTableColumns = ExtractInfo(baseTableDescription);
+ for (auto& indexDescription: indexedTable.GetIndexDescription()) {
+ const auto& indexName = indexDescription.GetName();
bool uniformIndexTable = false;
if (indexDescription.HasIndexImplTableDescription()) {
if (indexDescription.GetIndexImplTableDescription().HasUniformPartitionsCount()) {
uniformIndexTable = true;
}
}
-
- TPath indexPath = baseTablePath.Child(indexName);
- {
- TString msg = "invalid table index name: ";
- if (!indexPath.IsValidLeafName(msg)) {
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusSchemeError, msg)};
- }
- }
-
- if (indexes.contains(indexName)) {
- TString msg = TStringBuilder() << "Can't create indexes with not unique names for table, for example: " << indexDescription.GetName();
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
- }
-
+
+ TPath indexPath = baseTablePath.Child(indexName);
+ {
+ TString msg = "invalid table index name: ";
+ if (!indexPath.IsValidLeafName(msg)) {
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusSchemeError, msg)};
+ }
+ }
+
+ if (indexes.contains(indexName)) {
+ TString msg = TStringBuilder() << "Can't create indexes with not unique names for table, for example: " << indexDescription.GetName();
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
+ }
+
switch (indexDescription.GetType()) {
- case NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync:
+ case NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync:
if (!context.SS->EnableAsyncIndexes) {
TString msg = TStringBuilder() << "It is not allowed to create async indexes";
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusPreconditionFailed, msg)};
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusPreconditionFailed, msg)};
} else if (baseTableDescription.HasTTLSettings() && !AppData()->FeatureFlags.GetEnableTtlOnAsyncIndexedTables()) {
TString msg = TStringBuilder() << "TTL is not currently supported on tables with async indices";
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusPreconditionFailed, msg)};
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusPreconditionFailed, msg)};
}
break;
@@ -145,66 +145,66 @@ TVector<ISubOperationBase::TPtr> CreateIndexedTable(TOperationId nextId, const T
TIndexColumns indexKeys = ExtractInfo(indexDescription);
if (indexKeys.KeyColumns.empty()) {
- TString msg = TStringBuilder() << "no key colums in index creation config";
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
- }
-
+ TString msg = TStringBuilder() << "no key colums in index creation config";
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
+ }
+
if (!indexKeys.DataColumns.empty() && !AppData()->FeatureFlags.GetEnableDataColumnForIndexTable()) {
TString msg = TStringBuilder() << "It is not allowed to create index with data column";
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusPreconditionFailed, msg)};
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusPreconditionFailed, msg)};
+ }
+
+ TString explainErr;
+ if (!IsCompatibleIndex(baseTableColumns, indexKeys, explainErr)) {
+ TString msg = TStringBuilder() << "IsCompatibleIndex fail with explain: " << explainErr;
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
+ }
+
+ TTableColumns impTableColumns = CalcTableImplDescription(baseTableColumns, indexKeys);
+
+ TColumnTypes columnsTypes;
+ if (!ExtractTypes(baseTableDescription, columnsTypes, explainErr)) {
+ TString msg = TStringBuilder() << "ExtractTypes fail with explain: " << explainErr;
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
+ }
+
+ if (!IsCompatibleKeyTypes(columnsTypes, impTableColumns, uniformIndexTable, explainErr)) {
+ TString msg = TStringBuilder() << "IsCompatibleKeyTypes fail with explain: " << explainErr;
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
}
- TString explainErr;
- if (!IsCompatibleIndex(baseTableColumns, indexKeys, explainErr)) {
- TString msg = TStringBuilder() << "IsCompatibleIndex fail with explain: " << explainErr;
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
- }
-
- TTableColumns impTableColumns = CalcTableImplDescription(baseTableColumns, indexKeys);
-
- TColumnTypes columnsTypes;
- if (!ExtractTypes(baseTableDescription, columnsTypes, explainErr)) {
- TString msg = TStringBuilder() << "ExtractTypes fail with explain: " << explainErr;
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
- }
-
- if (!IsCompatibleKeyTypes(columnsTypes, impTableColumns, uniformIndexTable, explainErr)) {
- TString msg = TStringBuilder() << "IsCompatibleKeyTypes fail with explain: " << explainErr;
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
- }
-
- if (impTableColumns.Keys.size() > domainInfo->GetSchemeLimits().MaxTableKeyColumns) {
- TString msg = TStringBuilder()
- << "Too many key indexed, index table reaches the limit of the maximum keys colums count"
+ if (impTableColumns.Keys.size() > domainInfo->GetSchemeLimits().MaxTableKeyColumns) {
+ TString msg = TStringBuilder()
+ << "Too many key indexed, index table reaches the limit of the maximum keys colums count"
<< ": indexing colums: " << indexKeys.KeyColumns.size()
- << ": requested keys colums for index table: " << impTableColumns.Keys.size()
- << ". Limit: " << domainInfo->GetSchemeLimits().MaxTableKeyColumns;
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusSchemeError, msg)};
- }
-
- indexes.emplace(indexName, std::move(impTableColumns));
- }
-
+ << ": requested keys colums for index table: " << impTableColumns.Keys.size()
+ << ". Limit: " << domainInfo->GetSchemeLimits().MaxTableKeyColumns;
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusSchemeError, msg)};
+ }
+
+ indexes.emplace(indexName, std::move(impTableColumns));
+ }
+
THashSet<TString> sequences;
for (auto& sequenceDescription : indexedTable.GetSequenceDescription()) {
const auto& sequenceName = sequenceDescription.GetName();
-
+
TPath sequencePath = baseTablePath.Child(sequenceName);
{
TString msg = "invalid sequence name: ";
if (!sequencePath.IsValidLeafName(msg)) {
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusSchemeError, msg)};
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusSchemeError, msg)};
}
}
if (indexes.contains(sequenceName) || sequences.contains(sequenceName)) {
TString msg = TStringBuilder() << "Can't create sequences with non-unique names for table, for example: " << sequenceName;
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
}
TString errStr;
if (!TSequenceInfo::ValidateCreate(sequenceDescription, errStr)) {
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusSchemeError, errStr)};
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusSchemeError, errStr)};
}
sequences.emplace(sequenceName);
@@ -228,75 +228,75 @@ TVector<ISubOperationBase::TPtr> CreateIndexedTable(TOperationId nextId, const T
TString msg = TStringBuilder()
<< "Using non-local sequences in tables not supported, e.g. column '"
<< column.GetName() << "' using sequence '" << sequenceName << "'";
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
}
if (!sequences.contains(sequenceName)) {
TString msg = TStringBuilder()
<< "Cannot specify default from an unknown sequence, e.g. column '"
<< column.GetName() << "' using sequence '" << sequenceName << "'";
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
}
if (!keys.contains(column.GetName())) {
TString msg = TStringBuilder()
<< "Cannot specify default from sequence from non-key columns, e.g. column'"
<< column.GetName() << "' using sequence '" << sequenceName << "'";
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter, msg)};
}
}
}
- TVector<ISubOperationBase::TPtr> result;
-
- {
- auto scheme = TransactionTemplate(tx.GetWorkingDir(), NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
- scheme.SetFailOnExist(tx.GetFailOnExist());
-
- scheme.MutableCreateTable()->CopyFrom(baseTableDescription);
+ TVector<ISubOperationBase::TPtr> result;
+
+ {
+ auto scheme = TransactionTemplate(tx.GetWorkingDir(), NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
+ scheme.SetFailOnExist(tx.GetFailOnExist());
+
+ scheme.MutableCreateTable()->CopyFrom(baseTableDescription);
if (tx.HasAlterUserAttributes()) {
- scheme.MutableAlterUserAttributes()->CopyFrom(tx.GetAlterUserAttributes());
+ scheme.MutableAlterUserAttributes()->CopyFrom(tx.GetAlterUserAttributes());
}
result.push_back(CreateNewTable(NextPartId(nextId, result), scheme, sequences));
- }
-
- for (auto& indexDescription: indexedTable.GetIndexDescription()) {
- {
- auto scheme = TransactionTemplate(
+ }
+
+ for (auto& indexDescription: indexedTable.GetIndexDescription()) {
+ {
+ auto scheme = TransactionTemplate(
tx.GetWorkingDir() + "/" + baseTableDescription.GetName(),
- NKikimrSchemeOp::EOperationType::ESchemeOpCreateTableIndex);
- scheme.SetFailOnExist(tx.GetFailOnExist());
-
- scheme.MutableCreateTableIndex()->CopyFrom(indexDescription);
- if (!indexDescription.HasType()) {
- scheme.MutableCreateTableIndex()->SetType(NKikimrSchemeOp::EIndexTypeGlobal);
- }
-
- result.push_back(CreateNewTableIndex(NextPartId(nextId, result), scheme));
- }
-
- {
- auto scheme = TransactionTemplate(
+ NKikimrSchemeOp::EOperationType::ESchemeOpCreateTableIndex);
+ scheme.SetFailOnExist(tx.GetFailOnExist());
+
+ scheme.MutableCreateTableIndex()->CopyFrom(indexDescription);
+ if (!indexDescription.HasType()) {
+ scheme.MutableCreateTableIndex()->SetType(NKikimrSchemeOp::EIndexTypeGlobal);
+ }
+
+ result.push_back(CreateNewTableIndex(NextPartId(nextId, result), scheme));
+ }
+
+ {
+ auto scheme = TransactionTemplate(
tx.GetWorkingDir() + "/" + baseTableDescription.GetName() + "/" + indexDescription.GetName(),
- NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
- scheme.SetFailOnExist(tx.GetFailOnExist());
-
- TTableColumns impTableColumns = indexes.at(indexDescription.GetName());
-
- auto& indexImplTableDescription = *scheme.MutableCreateTable();
+ NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
+ scheme.SetFailOnExist(tx.GetFailOnExist());
+
+ TTableColumns impTableColumns = indexes.at(indexDescription.GetName());
+
+ auto& indexImplTableDescription = *scheme.MutableCreateTable();
// This description provided by user to override partition policy
const auto& userIndexDesc = indexDescription.GetIndexImplTableDescription();
indexImplTableDescription = CalcImplTableDesc(baseTableDescription, impTableColumns, userIndexDesc);
-
- result.push_back(CreateNewTable(NextPartId(nextId, result), scheme));
- }
- }
-
+
+ result.push_back(CreateNewTable(NextPartId(nextId, result), scheme));
+ }
+ }
+
for (auto& sequenceDescription : indexedTable.GetSequenceDescription()) {
auto scheme = TransactionTemplate(
tx.GetWorkingDir() + "/" + baseTableDescription.GetName(),
- NKikimrSchemeOp::EOperationType::ESchemeOpCreateSequence);
+ NKikimrSchemeOp::EOperationType::ESchemeOpCreateSequence);
scheme.SetFailOnExist(tx.GetFailOnExist());
*scheme.MutableSequence() = sequenceDescription;
@@ -304,8 +304,8 @@ TVector<ISubOperationBase::TPtr> CreateIndexedTable(TOperationId nextId, const T
result.push_back(CreateNewSequence(NextPartId(nextId, result), scheme));
}
- return result;
-}
-
-}
-}
+ return result;
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_kesus.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_kesus.cpp
index 82b7b8350f4..c974b72c318 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_kesus.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_kesus.cpp
@@ -1,475 +1,475 @@
-
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
#include <ydb/core/persqueue/config/config.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-bool ValidateConfig(const Ydb::Coordination::Config& config, TEvSchemeShard::EStatus& status, TString& errStr) {
- if (!config.path().empty()) {
- status = NKikimrScheme::StatusInvalidParameter;
- errStr = "Setting path is not allowed";
- return false;
- }
- return true;
-}
-
-TTxState& PrepareChanges(TOperationId operationId, TPathElement::TPtr parentDir,
- TPathElement::TPtr item, TKesusInfo::TPtr kesus, const TString& acl,
- const TChannelsBindings& tabletChannels,
- TOperationContext& context)
-{
- NIceDb::TNiceDb db(context.Txc.DB);
-
- item->CreateTxId = operationId.GetTxId();
- item->LastTxId = operationId.GetTxId();
- item->PathState = TPathElement::EPathState::EPathStateCreate;
- item->PathType = TPathElement::EPathType::EPathTypeKesus;
- TPathId pathId = item->PathId;
-
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+bool ValidateConfig(const Ydb::Coordination::Config& config, TEvSchemeShard::EStatus& status, TString& errStr) {
+ if (!config.path().empty()) {
+ status = NKikimrScheme::StatusInvalidParameter;
+ errStr = "Setting path is not allowed";
+ return false;
+ }
+ return true;
+}
+
+TTxState& PrepareChanges(TOperationId operationId, TPathElement::TPtr parentDir,
+ TPathElement::TPtr item, TKesusInfo::TPtr kesus, const TString& acl,
+ const TChannelsBindings& tabletChannels,
+ TOperationContext& context)
+{
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ item->CreateTxId = operationId.GetTxId();
+ item->LastTxId = operationId.GetTxId();
+ item->PathState = TPathElement::EPathState::EPathStateCreate;
+ item->PathType = TPathElement::EPathType::EPathTypeKesus;
+ TPathId pathId = item->PathId;
+
TTxState& txState = context.SS->CreateTx(operationId, TTxState::TxCreateKesus, pathId);
-
+
auto shardIdx = context.SS->RegisterShardInfo(
TShardInfo::KesusInfo(operationId.GetTxId(), pathId)
.WithBindedChannels(tabletChannels));
context.SS->TabletCounters->Simple()[COUNTER_KESUS_SHARD_COUNT].Add(1);
- txState.Shards.emplace_back(shardIdx, ETabletType::Kesus, TTxState::CreateParts);
- kesus->KesusShardIdx = shardIdx;
-
- if (parentDir->HasActiveChanges()) {
- TTxId parentTxId = parentDir->PlannedToCreate() ? parentDir->CreateTxId : parentDir->LastTxId;
- context.OnComplete.Dependence(parentTxId, operationId.GetTxId());
- }
-
- context.SS->ChangeTxState(db, operationId, TTxState::CreateParts);
- context.OnComplete.ActivateTx(operationId);
-
- context.SS->PersistPath(db, item->PathId);
- if (!acl.empty()) {
- item->ApplyACL(acl);
- context.SS->PersistACL(db, item);
- }
- context.SS->KesusInfos[pathId] = kesus;
- context.SS->PersistKesusInfo(db, pathId, kesus);
+ txState.Shards.emplace_back(shardIdx, ETabletType::Kesus, TTxState::CreateParts);
+ kesus->KesusShardIdx = shardIdx;
+
+ if (parentDir->HasActiveChanges()) {
+ TTxId parentTxId = parentDir->PlannedToCreate() ? parentDir->CreateTxId : parentDir->LastTxId;
+ context.OnComplete.Dependence(parentTxId, operationId.GetTxId());
+ }
+
+ context.SS->ChangeTxState(db, operationId, TTxState::CreateParts);
+ context.OnComplete.ActivateTx(operationId);
+
+ context.SS->PersistPath(db, item->PathId);
+ if (!acl.empty()) {
+ item->ApplyACL(acl);
+ context.SS->PersistACL(db, item);
+ }
+ context.SS->KesusInfos[pathId] = kesus;
+ context.SS->PersistKesusInfo(db, pathId, kesus);
context.SS->IncrementPathDbRefCount(pathId);
-
- context.SS->PersistTxState(db, operationId);
- context.SS->PersistUpdateNextPathId(db);
- context.SS->PersistUpdateNextShardIdx(db);
- for (auto shard : txState.Shards) {
- Y_VERIFY(shard.Operation == TTxState::CreateParts);
- context.SS->PersistChannelsBinding(db, shard.Idx, context.SS->ShardInfos[shard.Idx].BindedChannels);
- context.SS->PersistShardMapping(db, shard.Idx, InvalidTabletId, pathId, operationId.GetTxId(), shard.TabletType);
- }
-
- return txState;
-}
-
-class TConfigureParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+ context.SS->PersistTxState(db, operationId);
+ context.SS->PersistUpdateNextPathId(db);
+ context.SS->PersistUpdateNextShardIdx(db);
+ for (auto shard : txState.Shards) {
+ Y_VERIFY(shard.Operation == TTxState::CreateParts);
+ context.SS->PersistChannelsBinding(db, shard.Idx, context.SS->ShardInfos[shard.Idx].BindedChannels);
+ context.SS->PersistShardMapping(db, shard.Idx, InvalidTabletId, pathId, operationId.GetTxId(), shard.TabletType);
+ }
+
+ return txState;
+}
+
+class TConfigureParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TCreateKesus TConfigureParts"
- << " operationId#" << OperationId;
- }
-
-public:
- TConfigureParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
- }
-
- bool HandleReply(NKesus::TEvKesus::TEvSetConfigResult::TPtr& ev, TOperationContext& context) override {
- auto ssId = context.SS->SelfTabletId();
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateKesus TConfigureParts HandleReply TEvSetConfigResult"
- << " operationId#" << OperationId
- << " at tablet" << ssId);
-
- auto tabletId = TTabletId(ev->Get()->Record.GetTabletId());
- auto status = ev->Get()->Record.GetError().GetStatus();
-
- // SetConfig may fail if schemeshard tries to downgrade configuration
- // That likely means this is a very outdated version
- Y_VERIFY_S(status == Ydb::StatusIds::SUCCESS,
- "Unexpected error in SetConfigResul:"
- << " status " << Ydb::StatusIds::StatusCode_Name(status) << " Tx " << OperationId << " tablet " << tabletId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreateKesus);
- Y_VERIFY(txState->State == TTxState::ConfigureParts);
-
+ return TStringBuilder()
+ << "TCreateKesus TConfigureParts"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TConfigureParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
+ }
+
+ bool HandleReply(NKesus::TEvKesus::TEvSetConfigResult::TPtr& ev, TOperationContext& context) override {
+ auto ssId = context.SS->SelfTabletId();
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateKesus TConfigureParts HandleReply TEvSetConfigResult"
+ << " operationId#" << OperationId
+ << " at tablet" << ssId);
+
+ auto tabletId = TTabletId(ev->Get()->Record.GetTabletId());
+ auto status = ev->Get()->Record.GetError().GetStatus();
+
+ // SetConfig may fail if schemeshard tries to downgrade configuration
+ // That likely means this is a very outdated version
+ Y_VERIFY_S(status == Ydb::StatusIds::SUCCESS,
+ "Unexpected error in SetConfigResul:"
+ << " status " << Ydb::StatusIds::StatusCode_Name(status) << " Tx " << OperationId << " tablet " << tabletId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateKesus);
+ Y_VERIFY(txState->State == TTxState::ConfigureParts);
+
auto idx = context.SS->MustGetShardIdx(tabletId);
- txState->ShardsInProgress.erase(idx);
-
- context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, idx);
-
- if (txState->ShardsInProgress.empty()) {
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
- context.OnComplete.ActivateTx(OperationId);
- return true;
- }
-
- return false;
- }
-
- bool ProgressState(TOperationContext& context) override {
- auto ssId = context.SS->SelfTabletId();
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateKesus TConfigureParts ProgressState"
- << " operationId#" << OperationId
- << " at tablet" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreateKesus);
- Y_VERIFY(!txState->Shards.empty());
-
- txState->ClearShardsInProgress();
-
- TKesusInfo::TPtr kesus = context.SS->KesusInfos[txState->TargetPathId];
- Y_VERIFY_S(kesus, "kesus is null. PathId: " << txState->TargetPathId);
-
-
- auto kesusPath = TPath::Init(txState->TargetPathId, context.SS);
- Y_VERIFY(kesusPath.IsResolved());
-
- Y_VERIFY(txState->Shards.size() == 1);
- for (auto shard : txState->Shards) {
- auto shardIdx = shard.Idx;
- auto tabletId = context.SS->ShardInfos[shardIdx].TabletID;
- Y_VERIFY(shard.TabletType == ETabletType::Kesus);
-
- kesus->KesusShardIdx = shardIdx;
- kesus->KesusTabletId = tabletId;
-
- auto event = MakeHolder<NKesus::TEvKesus::TEvSetConfig>(ui64(OperationId.GetTxId()), kesus->Config, kesus->Version);
- event->Record.MutableConfig()->set_path(kesusPath.PathString()); // TODO: remove legacy field eventually
- event->Record.SetPath(kesusPath.PathString());
-
- context.OnComplete.BindMsgToPipe(OperationId, tabletId, shardIdx, event.Release());
-
- // Wait for results from this shard
- txState->ShardsInProgress.insert(shardIdx);
- }
-
- return false;
- }
-};
-
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ txState->ShardsInProgress.erase(idx);
+
+ context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, idx);
+
+ if (txState->ShardsInProgress.empty()) {
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
+ context.OnComplete.ActivateTx(OperationId);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ auto ssId = context.SS->SelfTabletId();
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateKesus TConfigureParts ProgressState"
+ << " operationId#" << OperationId
+ << " at tablet" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateKesus);
+ Y_VERIFY(!txState->Shards.empty());
+
+ txState->ClearShardsInProgress();
+
+ TKesusInfo::TPtr kesus = context.SS->KesusInfos[txState->TargetPathId];
+ Y_VERIFY_S(kesus, "kesus is null. PathId: " << txState->TargetPathId);
+
+
+ auto kesusPath = TPath::Init(txState->TargetPathId, context.SS);
+ Y_VERIFY(kesusPath.IsResolved());
+
+ Y_VERIFY(txState->Shards.size() == 1);
+ for (auto shard : txState->Shards) {
+ auto shardIdx = shard.Idx;
+ auto tabletId = context.SS->ShardInfos[shardIdx].TabletID;
+ Y_VERIFY(shard.TabletType == ETabletType::Kesus);
+
+ kesus->KesusShardIdx = shardIdx;
+ kesus->KesusTabletId = tabletId;
+
+ auto event = MakeHolder<NKesus::TEvKesus::TEvSetConfig>(ui64(OperationId.GetTxId()), kesus->Config, kesus->Version);
+ event->Record.MutableConfig()->set_path(kesusPath.PathString()); // TODO: remove legacy field eventually
+ event->Record.SetPath(kesusPath.PathString());
+
+ context.OnComplete.BindMsgToPipe(OperationId, tabletId, shardIdx, event.Release());
+
+ // Wait for results from this shard
+ txState->ShardsInProgress.insert(shardIdx);
+ }
+
+ return false;
+ }
+};
+
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TCreateKesus TPropose"
- << " operationId#" << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- auto step = TStepId(ev->Get()->StepId);
- auto ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- if (!txState) {
- return false;
- }
- Y_VERIFY(txState->TxType == TTxState::TxCreateKesus);
-
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
-
- Y_VERIFY_S(context.SS->KesusInfos.contains(pathId), "kesus has not found. PathId: " << pathId);
- TKesusInfo::TPtr kesus = context.SS->KesusInfos.at(pathId);
- Y_VERIFY_S(kesus, "kesus is null. PathId: " << pathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- path->StepCreated = step;
- context.SS->PersistCreateStep(db, pathId, step);
-
- // https://st.yandex-team.ru/KIKIMR-9036
- // usually we make creation over alter, alter as null -> first version
- // but now kesus allready has been persisted as first version at propose stage
- // so we bump version to be sure that actual description pass over caches correctly
- ++kesus->Version;
- context.SS->PersistKesusVersion(db, pathId, kesus);
-
- auto parentDir = context.SS->PathsById.at(path->ParentPathId);
- ++parentDir->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir);
- context.SS->ClearDescribePathCaches(parentDir);
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
-
- context.SS->ClearDescribePathCaches(path);
+ return TStringBuilder()
+ << "TCreateKesus TPropose"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ auto step = TStepId(ev->Get()->StepId);
+ auto ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ if (!txState) {
+ return false;
+ }
+ Y_VERIFY(txState->TxType == TTxState::TxCreateKesus);
+
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+
+ Y_VERIFY_S(context.SS->KesusInfos.contains(pathId), "kesus has not found. PathId: " << pathId);
+ TKesusInfo::TPtr kesus = context.SS->KesusInfos.at(pathId);
+ Y_VERIFY_S(kesus, "kesus is null. PathId: " << pathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ path->StepCreated = step;
+ context.SS->PersistCreateStep(db, pathId, step);
+
+ // https://st.yandex-team.ru/KIKIMR-9036
+ // usually we make creation over alter, alter as null -> first version
+ // but now kesus allready has been persisted as first version at propose stage
+ // so we bump version to be sure that actual description pass over caches correctly
+ ++kesus->Version;
+ context.SS->PersistKesusVersion(db, pathId, kesus);
+
+ auto parentDir = context.SS->PathsById.at(path->ParentPathId);
+ ++parentDir->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir);
+ context.SS->ClearDescribePathCaches(parentDir);
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
+
+ context.SS->ClearDescribePathCaches(path);
context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
context.SS->ChangeTxState(db, OperationId, TTxState::Done);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreateKesus);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-
-class TCreateKesus: public TSubOperation {
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateKesus);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+
+class TCreateKesus: public TSubOperation {
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::CreateParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
- return TTxState::ConfigureParts;
- case TTxState::ConfigureParts:
- return TTxState::Propose;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::CreateParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
+ return TTxState::ConfigureParts;
+ case TTxState::ConfigureParts:
+ return TTxState::Propose;
case TTxState::Propose:
return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
return THolder(new TCreateParts(OperationId));
- case TTxState::ConfigureParts:
+ case TTxState::ConfigureParts:
return THolder(new TConfigureParts(OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new TPropose(OperationId));
case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TCreateKesus(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TCreateKesus(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
- const auto acceptExisted = !Transaction.GetFailOnExist();
+
+ TCreateKesus(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ const auto acceptExisted = !Transaction.GetFailOnExist();
const auto& config = Transaction.GetKesus().GetConfig();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = Transaction.GetKesus().GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateKesus Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
- auto result = MakeHolder<TProposeResponse>(status, ui64(OperationId.GetTxId()), ui64(ssId));
-
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateKesus Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
+ auto result = MakeHolder<TProposeResponse>(status, ui64(OperationId.GetTxId()), ui64(ssId));
+
TString errStr;
- if (!ValidateConfig(config, status, errStr)) {
- result->SetError(status, errStr);
- return result;
- }
-
- NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
- {
- NSchemeShard::TPath::TChecker checks = parentPath.Check();
- checks
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsCommonSensePath()
- .IsLikeDirectory();
-
- if (!checks) {
- TString explain = TStringBuilder() << "parent path fail checks"
- << ", path: " << parentPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
+ if (!ValidateConfig(config, status, errStr)) {
+ result->SetError(status, errStr);
+ return result;
+ }
+
+ NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
+ {
+ NSchemeShard::TPath::TChecker checks = parentPath.Check();
+ checks
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsCommonSensePath()
+ .IsLikeDirectory();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent path fail checks"
+ << ", path: " << parentPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
const TString acl = Transaction.GetModifyACL().GetDiffACL();
- NSchemeShard::TPath dstPath = parentPath.Child(name);
- {
- NSchemeShard::TPath::TChecker checks = dstPath.Check();
- checks.IsAtLocalSchemeShard();
- if (dstPath.IsResolved()) {
+ NSchemeShard::TPath dstPath = parentPath.Child(name);
+ {
+ NSchemeShard::TPath::TChecker checks = dstPath.Check();
+ checks.IsAtLocalSchemeShard();
+ if (dstPath.IsResolved()) {
checks
.IsResolved()
- .NotUnderDeleting()
- .FailOnExist(TPathElement::EPathType::EPathTypeKesus, acceptExisted);
- } else {
+ .NotUnderDeleting()
+ .FailOnExist(TPathElement::EPathType::EPathTypeKesus, acceptExisted);
+ } else {
checks
.NotEmpty()
- .NotResolved();
- }
-
- if (checks) {
- checks
- .IsValidLeafName()
- .DepthLimit()
- .PathsLimit()
- .DirChildrenLimit()
- .ShardsLimit()
+ .NotResolved();
+ }
+
+ if (checks) {
+ checks
+ .IsValidLeafName()
+ .DepthLimit()
+ .PathsLimit()
+ .DirChildrenLimit()
+ .ShardsLimit()
.PathShardsLimit()
.IsValidACL(acl);
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "dst path fail checks"
- << ", path: " << dstPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- if (dstPath.IsResolved()) {
- result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
- }
- return result;
- }
- }
-
- const ui32 kesusProfileId = 0;
- TChannelsBindings kesusChannelsBindings;
- if (!context.SS->ResolveTabletChannels(kesusProfileId, dstPath.DomainId(), kesusChannelsBindings)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter,
- "Unable to construct channel binding for coordination node with the storage pool");
- return result;
- }
-
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "dst path fail checks"
+ << ", path: " << dstPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ if (dstPath.IsResolved()) {
+ result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+ }
+ return result;
+ }
+ }
+
+ const ui32 kesusProfileId = 0;
+ TChannelsBindings kesusChannelsBindings;
+ if (!context.SS->ResolveTabletChannels(kesusProfileId, dstPath.DomainId(), kesusChannelsBindings)) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter,
+ "Unable to construct channel binding for coordination node with the storage pool");
+ return result;
+ }
+
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- dstPath.MaterializeLeaf(owner);
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
-
- context.SS->TabletCounters->Simple()[COUNTER_KESUS_COUNT].Add(1);
- TKesusInfo::TPtr kesus = new TKesusInfo();
- kesus->Config.CopyFrom(config);
- kesus->Version = 1;
-
- const TTxState& txState = PrepareChanges(OperationId, parentPath.Base(), dstPath.Base(), kesus, acl, kesusChannelsBindings, context);
-
- NIceDb::TNiceDb db(context.Txc.DB);
- ++parentPath.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentPath.Base());
- context.SS->ClearDescribePathCaches(parentPath.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, parentPath.Base()->PathId);
-
- context.SS->ClearDescribePathCaches(dstPath.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, dstPath.Base()->PathId);
-
- dstPath.DomainInfo()->IncPathsInside();
- dstPath.DomainInfo()->AddInternalShards(txState);
-
- dstPath.Base()->IncShardsInside();
- parentPath.Base()->IncAliveChildren();
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ dstPath.MaterializeLeaf(owner);
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+
+ context.SS->TabletCounters->Simple()[COUNTER_KESUS_COUNT].Add(1);
+ TKesusInfo::TPtr kesus = new TKesusInfo();
+ kesus->Config.CopyFrom(config);
+ kesus->Version = 1;
+
+ const TTxState& txState = PrepareChanges(OperationId, parentPath.Base(), dstPath.Base(), kesus, acl, kesusChannelsBindings, context);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ ++parentPath.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentPath.Base());
+ context.SS->ClearDescribePathCaches(parentPath.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentPath.Base()->PathId);
+
+ context.SS->ClearDescribePathCaches(dstPath.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, dstPath.Base()->PathId);
+
+ dstPath.DomainInfo()->IncPathsInside();
+ dstPath.DomainInfo()->AddInternalShards(txState);
+
+ dstPath.Base()->IncShardsInside();
+ parentPath.Base()->IncAliveChildren();
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TCreateKesus");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateKesus AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateKesus AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateNewKesus(TOperationId id, const TTxTransaction& tx) {
return new TCreateKesus(id, tx);
}
-ISubOperationBase::TPtr CreateNewKesus(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateNewKesus(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TCreateKesus(id, state);
-}
-
-}
-}
+ return new TCreateKesus(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_lock.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_lock.cpp
index d7ed797d37b..16ff55eaa66 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_lock.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_lock.cpp
@@ -1,315 +1,315 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-#include "schemeshard_utils.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+#include "schemeshard_utils.h"
+
#include <ydb/core/protos/flat_scheme_op.pb.h>
-
+
#include <ydb/core/base/subdomain.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-
-class TCreateLockForIndexBuild: public TSubOperation {
- const TOperationId OperationId;
- const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::Done;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::Done:
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+
+class TCreateLockForIndexBuild: public TSubOperation {
+ const TOperationId OperationId;
+ const TTxTransaction Transaction;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::Done;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ return TTxState::Done;
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
- TCreateLockForIndexBuild(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
- , Transaction(tx)
- {
- }
-
- TCreateLockForIndexBuild(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
- auto lockSchema = Transaction.GetLockConfig();
-
- const TString& parentPathStr = Transaction.GetWorkingDir();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateLockForIndexBuild Propose"
- << ", path: " << parentPathStr << "/" << lockSchema.GetName()
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- if (!Transaction.HasLockConfig()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "no locking config present");
- return result;
- }
-
- if (!Transaction.HasInitiateIndexBuild()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "no build index config present");
- return result;
- }
-
- NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
- {
- NSchemeShard::TPath::TChecker checks = parentPath.Check();
- checks
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsCommonSensePath()
- .IsLikeDirectory();
-
- if (!checks) {
- TString explain = TStringBuilder() << "parent path fail checks"
- << ", path: " << parentPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- NSchemeShard::TPath tablePath = parentPath.Child(lockSchema.GetName());
- {
- NSchemeShard::TPath::TChecker checks = tablePath.Check();
- checks
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .NotUnderOperation()
- .IsTable()
- .IsCommonSensePath();
-
- if (!checks) {
- TString explain = TStringBuilder() << "table path fail checks"
- << ", path: " << tablePath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- if (tablePath.IsResolved()) {
- result->SetPathCreateTxId(ui64(tablePath.Base()->CreateTxId));
- result->SetPathId(tablePath.Base()->PathId.LocalPathId);
- }
- return result;
- }
- }
-
- auto buildIndexSchema = Transaction.GetInitiateIndexBuild();
-
- if (buildIndexSchema.GetTable() != tablePath.PathString()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "table path in build index mismatch with locking path");
- return result;
- }
-
- auto indexSchema = buildIndexSchema.GetIndex();
-
- NSchemeShard::TPath indexPath = tablePath.Child(indexSchema.GetName());
- {
- NSchemeShard::TPath::TChecker checks = indexPath.Check();
- checks
- .IsAtLocalSchemeShard();
-
- if (indexPath.IsResolved()) {
- checks
- .IsResolved()
- .NotUnderDeleting()
- .FailOnExist(TPathElement::EPathType::EPathTypeTableIndex, false);
- } else {
- checks
- .NotEmpty()
- .NotResolved();
- }
-
- checks
- .IsValidLeafName()
- .PathsLimit(2) // we are creating 2 pathes at next stages: index and table
- .DirChildrenLimit()
- .ShardsLimit(1) // we are creating 1 shard at next stages for index table
- ;
-
- if (!checks) {
- TString explain = TStringBuilder() << "index path fail checks"
- << ", path: " << indexPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- if (indexPath.IsResolved()) {
- result->SetPathCreateTxId(ui64(indexPath.Base()->CreateTxId));
- result->SetPathId(indexPath.Base()->PathId.LocalPathId);
- }
- return result;
- }
- }
-
- TPathElement::TPtr pathEl = tablePath.Base();
- TPathId pathId = pathEl->PathId;
- result->SetPathId(pathId.LocalPathId);
-
- TTableInfo::TPtr tableInfo = context.SS->Tables.at(tablePath.Base()->PathId);
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
+ TCreateLockForIndexBuild(TOperationId id, const TTxTransaction& tx)
+ : OperationId(id)
+ , Transaction(tx)
+ {
+ }
+
+ TCreateLockForIndexBuild(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ auto lockSchema = Transaction.GetLockConfig();
+
+ const TString& parentPathStr = Transaction.GetWorkingDir();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateLockForIndexBuild Propose"
+ << ", path: " << parentPathStr << "/" << lockSchema.GetName()
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ if (!Transaction.HasLockConfig()) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "no locking config present");
+ return result;
+ }
+
+ if (!Transaction.HasInitiateIndexBuild()) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "no build index config present");
+ return result;
+ }
+
+ NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
+ {
+ NSchemeShard::TPath::TChecker checks = parentPath.Check();
+ checks
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsCommonSensePath()
+ .IsLikeDirectory();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent path fail checks"
+ << ", path: " << parentPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ NSchemeShard::TPath tablePath = parentPath.Child(lockSchema.GetName());
+ {
+ NSchemeShard::TPath::TChecker checks = tablePath.Check();
+ checks
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .NotUnderOperation()
+ .IsTable()
+ .IsCommonSensePath();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "table path fail checks"
+ << ", path: " << tablePath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ if (tablePath.IsResolved()) {
+ result->SetPathCreateTxId(ui64(tablePath.Base()->CreateTxId));
+ result->SetPathId(tablePath.Base()->PathId.LocalPathId);
+ }
+ return result;
+ }
+ }
+
+ auto buildIndexSchema = Transaction.GetInitiateIndexBuild();
+
+ if (buildIndexSchema.GetTable() != tablePath.PathString()) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "table path in build index mismatch with locking path");
+ return result;
+ }
+
+ auto indexSchema = buildIndexSchema.GetIndex();
+
+ NSchemeShard::TPath indexPath = tablePath.Child(indexSchema.GetName());
+ {
+ NSchemeShard::TPath::TChecker checks = indexPath.Check();
+ checks
+ .IsAtLocalSchemeShard();
+
+ if (indexPath.IsResolved()) {
+ checks
+ .IsResolved()
+ .NotUnderDeleting()
+ .FailOnExist(TPathElement::EPathType::EPathTypeTableIndex, false);
+ } else {
+ checks
+ .NotEmpty()
+ .NotResolved();
+ }
+
+ checks
+ .IsValidLeafName()
+ .PathsLimit(2) // we are creating 2 pathes at next stages: index and table
+ .DirChildrenLimit()
+ .ShardsLimit(1) // we are creating 1 shard at next stages for index table
+ ;
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "index path fail checks"
+ << ", path: " << indexPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ if (indexPath.IsResolved()) {
+ result->SetPathCreateTxId(ui64(indexPath.Base()->CreateTxId));
+ result->SetPathId(indexPath.Base()->PathId.LocalPathId);
+ }
+ return result;
+ }
+ }
+
+ TPathElement::TPtr pathEl = tablePath.Base();
+ TPathId pathId = pathEl->PathId;
+ result->SetPathId(pathId.LocalPathId);
+
+ TTableInfo::TPtr tableInfo = context.SS->Tables.at(tablePath.Base()->PathId);
if (tableInfo->IsTTLEnabled()) {
if (indexSchema.GetType() == NKikimrSchemeOp::EIndexTypeGlobalAsync && !AppData()->FeatureFlags.GetEnableTtlOnAsyncIndexedTables()) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, "Async indexes are not currently supported on tables with TTL");
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, "Async indexes are not currently supported on tables with TTL");
return result;
}
- }
-
- if (tablePath.Base()->GetAliveChildren() + 1 > tablePath.DomainInfo()->GetSchemeLimits().MaxTableIndices) {
- auto msg = TStringBuilder() << "indexes count has reached maximum value in the table"
- << ", children limit for dir in domain: " << tablePath.DomainInfo()->GetSchemeLimits().MaxTableIndices
- << ", intention to create new children: " << tablePath.Base()->GetAliveChildren() + 1;
- result->SetError(NKikimrScheme::StatusPreconditionFailed, msg);
- return result;
- }
-
- {
+ }
+
+ if (tablePath.Base()->GetAliveChildren() + 1 > tablePath.DomainInfo()->GetSchemeLimits().MaxTableIndices) {
+ auto msg = TStringBuilder() << "indexes count has reached maximum value in the table"
+ << ", children limit for dir in domain: " << tablePath.DomainInfo()->GetSchemeLimits().MaxTableIndices
+ << ", intention to create new children: " << tablePath.Base()->GetAliveChildren() + 1;
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, msg);
+ return result;
+ }
+
+ {
NTableIndex::TIndexColumns indexKeys = NTableIndex::ExtractInfo(indexSchema);
if (indexKeys.KeyColumns.empty()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "no key colums in index creation config");
- return result;
- }
-
- NTableIndex::TTableColumns baseTableColumns = NTableIndex::ExtractInfo(tableInfo);
-
- TString explainErr;
- if (!NTableIndex::IsCompatibleIndex(baseTableColumns, indexKeys, explainErr)) {
- TString msg = TStringBuilder() << "IsCompatibleIndex fail with explain: " << explainErr;
- result->SetError(NKikimrScheme::StatusInvalidParameter, msg);
- return result;
- }
-
- NTableIndex::TTableColumns impTableColumns = NTableIndex::CalcTableImplDescription(baseTableColumns, indexKeys);
-
- if (!NTableIndex::IsCompatibleKeyTypes(NTableIndex::ExtractTypes(tableInfo), impTableColumns, false, explainErr)) {
- TString msg = TStringBuilder() << "IsCompatibleKeyTypes fail with explain: " << explainErr;
- result->SetError(NKikimrScheme::StatusInvalidParameter, msg);
- return result;
- }
-
- if (impTableColumns.Keys.size() > tablePath.DomainInfo()->GetSchemeLimits().MaxTableKeyColumns) {
- TString msg = TStringBuilder()
- << "Too many key indexed, index table reaches the limit of the maximum keys colums count"
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "no key colums in index creation config");
+ return result;
+ }
+
+ NTableIndex::TTableColumns baseTableColumns = NTableIndex::ExtractInfo(tableInfo);
+
+ TString explainErr;
+ if (!NTableIndex::IsCompatibleIndex(baseTableColumns, indexKeys, explainErr)) {
+ TString msg = TStringBuilder() << "IsCompatibleIndex fail with explain: " << explainErr;
+ result->SetError(NKikimrScheme::StatusInvalidParameter, msg);
+ return result;
+ }
+
+ NTableIndex::TTableColumns impTableColumns = NTableIndex::CalcTableImplDescription(baseTableColumns, indexKeys);
+
+ if (!NTableIndex::IsCompatibleKeyTypes(NTableIndex::ExtractTypes(tableInfo), impTableColumns, false, explainErr)) {
+ TString msg = TStringBuilder() << "IsCompatibleKeyTypes fail with explain: " << explainErr;
+ result->SetError(NKikimrScheme::StatusInvalidParameter, msg);
+ return result;
+ }
+
+ if (impTableColumns.Keys.size() > tablePath.DomainInfo()->GetSchemeLimits().MaxTableKeyColumns) {
+ TString msg = TStringBuilder()
+ << "Too many key indexed, index table reaches the limit of the maximum keys colums count"
<< ": indexing colums: " << indexKeys.KeyColumns.size()
- << ": requested keys colums for index table: " << impTableColumns.Keys.size()
- << ". Limit: " << tablePath.DomainInfo()->GetSchemeLimits().MaxTableKeyColumns;
- result->SetError(NKikimrScheme::StatusSchemeError, msg);
- return result;
- }
- }
-
- if (tablePath.LockedBy() == OperationId.GetTxId()) {
- TString explain = TStringBuilder()
- << "dst path fail checks"
- << ", path already locked by this operation"
- << ", path: " << tablePath.PathString();
- result->SetError(TEvSchemeShard::EStatus::StatusAlreadyExists, explain);
- return result;
- }
-
- TString errMsg;
- if (!context.SS->CheckLocks(pathId, Transaction, errMsg)) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, errMsg);
- return result;
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- pathEl->LastTxId = OperationId.GetTxId();
- pathEl->PathState = NKikimrSchemeOp::EPathState::EPathStateAlter;
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxCreateLockForIndexBuild, pathId);
- txState.State = TTxState::Done;
-
- context.SS->PersistTxState(db, OperationId);
-
- if (pathEl->IsTable()) {
- // wait all the splits
- TTableInfo::TPtr table = context.SS->Tables.at(pathId);
- for (auto splitTx: table->GetSplitOpsInFlight()) {
- context.OnComplete.Dependence(splitTx.GetTxId(), OperationId.GetTxId());
- }
- }
-
- context.SS->LockedPaths[pathId] = OperationId.GetTxId();
- context.SS->PersistLongLock(db, OperationId.GetTxId(), pathId);
- context.SS->TabletCounters->Simple()[COUNTER_LOCKS_COUNT].Add(1);
-
- context.OnComplete.ActivateTx(OperationId);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
- void AbortPropose(TOperationContext&) override {
- Y_FAIL("no AbortPropose for TCreateLock");
- }
-
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateLock AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
- << ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-ISubOperationBase::TPtr CreateLockForIndexBuild(TOperationId id, const TTxTransaction& tx) {
- return new TCreateLockForIndexBuild(id, tx);
-}
-
-ISubOperationBase::TPtr CreateLockForIndexBuild(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state != TTxState::Invalid);
- return new TCreateLockForIndexBuild(id, state);
-}
-
-}
-}
+ << ": requested keys colums for index table: " << impTableColumns.Keys.size()
+ << ". Limit: " << tablePath.DomainInfo()->GetSchemeLimits().MaxTableKeyColumns;
+ result->SetError(NKikimrScheme::StatusSchemeError, msg);
+ return result;
+ }
+ }
+
+ if (tablePath.LockedBy() == OperationId.GetTxId()) {
+ TString explain = TStringBuilder()
+ << "dst path fail checks"
+ << ", path already locked by this operation"
+ << ", path: " << tablePath.PathString();
+ result->SetError(TEvSchemeShard::EStatus::StatusAlreadyExists, explain);
+ return result;
+ }
+
+ TString errMsg;
+ if (!context.SS->CheckLocks(pathId, Transaction, errMsg)) {
+ result->SetError(NKikimrScheme::StatusMultipleModifications, errMsg);
+ return result;
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ pathEl->LastTxId = OperationId.GetTxId();
+ pathEl->PathState = NKikimrSchemeOp::EPathState::EPathStateAlter;
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxCreateLockForIndexBuild, pathId);
+ txState.State = TTxState::Done;
+
+ context.SS->PersistTxState(db, OperationId);
+
+ if (pathEl->IsTable()) {
+ // wait all the splits
+ TTableInfo::TPtr table = context.SS->Tables.at(pathId);
+ for (auto splitTx: table->GetSplitOpsInFlight()) {
+ context.OnComplete.Dependence(splitTx.GetTxId(), OperationId.GetTxId());
+ }
+ }
+
+ context.SS->LockedPaths[pathId] = OperationId.GetTxId();
+ context.SS->PersistLongLock(db, OperationId.GetTxId(), pathId);
+ context.SS->TabletCounters->Simple()[COUNTER_LOCKS_COUNT].Add(1);
+
+ context.OnComplete.ActivateTx(OperationId);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
+ void AbortPropose(TOperationContext&) override {
+ Y_FAIL("no AbortPropose for TCreateLock");
+ }
+
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateLock AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+ISubOperationBase::TPtr CreateLockForIndexBuild(TOperationId id, const TTxTransaction& tx) {
+ return new TCreateLockForIndexBuild(id, tx);
+}
+
+ISubOperationBase::TPtr CreateLockForIndexBuild(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state != TTxState::Invalid);
+ return new TCreateLockForIndexBuild(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_store.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_store.cpp
index 7a30f95a087..a3e6896b6f1 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_store.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_store.cpp
@@ -9,7 +9,7 @@
namespace {
using namespace NKikimr;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
bool PrepareTier(const NKikimrSchemeOp::TStorageTierConfig& proto, TString& errStr) {
Y_UNUSED(proto);
@@ -153,10 +153,10 @@ bool PrepareSchemaPreset(NKikimrSchemeOp::TColumnTableSchemaPreset& proto, TOlap
#if 0
bool PrepareTtlSettingsPreset(
NKikimrSchemeOp::TColumnTableTtlSettingsPreset& proto, TOlapStoreInfo& store, size_t protoIndex,
- TEvSchemeShard::EStatus& status, TString& errStr)
+ TEvSchemeShard::EStatus& status, TString& errStr)
{
if (proto.GetName().empty()) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = Sprintf("Ttl settings preset name cannot be empty");
return false;
}
@@ -164,14 +164,14 @@ bool PrepareTtlSettingsPreset(
proto.SetId(store.Description.GetNextTtlSettingsPresetId());
store.Description.SetNextTtlSettingsPresetId(proto.GetId() + 1);
} else if (proto.GetId() <= 0 || proto.GetId() >= store.Description.GetNextTtlSettingsPresetId()) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = Sprintf("Ttl settings preset id is incorrect");
return false;
}
if (store.TtlSettingsPresets.contains(proto.GetId()) ||
store.TtlSettingsPresetByName.contains(proto.GetName()))
{
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = Sprintf("Duplicate ttl settings preset %" PRIu32 " with name '%s'", proto.GetId(), proto.GetName().c_str());
return false;
}
@@ -187,7 +187,7 @@ bool PrepareTtlSettingsPreset(
}
#endif
TOlapStoreInfo::TPtr CreateOlapStore(const NKikimrSchemeOp::TColumnStoreDescription& opSrc,
- TEvSchemeShard::EStatus& status, TString& errStr)
+ TEvSchemeShard::EStatus& status, TString& errStr)
{
TOlapStoreInfo::TPtr storeInfo = new TOlapStoreInfo;
storeInfo->AlterVersion = 1;
@@ -195,13 +195,13 @@ TOlapStoreInfo::TPtr CreateOlapStore(const NKikimrSchemeOp::TColumnStoreDescript
auto& op = storeInfo->Description;
if (op.GetRESERVED_MetaShardCount() != 0) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = Sprintf("trying to create OLAP store with meta shards (not supported yet)");
return nullptr;
}
if (!op.HasColumnShardCount()) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = Sprintf("trying to create OLAP store without shards number specified");
return nullptr;
}
@@ -212,7 +212,7 @@ TOlapStoreInfo::TPtr CreateOlapStore(const NKikimrSchemeOp::TColumnStoreDescript
size_t protoIndex = 0;
for (auto& presetProto : *op.MutableSchemaPresets()) {
if (presetProto.HasId()) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = Sprintf("Schema preset id cannot be specified explicitly");
return nullptr;
}
@@ -231,7 +231,7 @@ TOlapStoreInfo::TPtr CreateOlapStore(const NKikimrSchemeOp::TColumnStoreDescript
return nullptr;
#else
if (presetProto.HasId()) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = "Ttl settings preset id cannot be specified explicitly";
return nullptr;
}
@@ -242,7 +242,7 @@ TOlapStoreInfo::TPtr CreateOlapStore(const NKikimrSchemeOp::TColumnStoreDescript
}
if (!storeInfo->SchemaPresetByName.contains("default") || storeInfo->SchemaPresets.size() > 1) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = "A single schema preset named 'default' is required";
return nullptr;
}
@@ -254,7 +254,7 @@ TOlapStoreInfo::TPtr CreateOlapStore(const NKikimrSchemeOp::TColumnStoreDescript
void ApplySharding(TTxId txId, TPathId pathId, TOlapStoreInfo::TPtr storeInfo,
const TChannelsBindings& metaChannelsBindings,
const TChannelsBindings& channelsBindings,
- TTxState& txState, TSchemeShard* ss)
+ TTxState& txState, TSchemeShard* ss)
{
ui32 numColumnShards = storeInfo->ColumnShards.size();
ui32 numShards = numColumnShards;
@@ -586,10 +586,10 @@ public:
SetState(SelectStateFunc(state));
}
- THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
+ THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
const TTabletId ssId = context.SS->SelfTabletId();
- const auto acceptExisted = !Transaction.GetFailOnExist();
+ const auto acceptExisted = !Transaction.GetFailOnExist();
const TString& parentPathStr = Transaction.GetWorkingDir();
auto& createDescription = Transaction.GetCreateColumnStore();
const TString& name = createDescription.GetName();
@@ -600,12 +600,12 @@ public:
<< ", opId: " << OperationId
<< ", at schemeshard: " << ssId);
- TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
+ TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
auto result = MakeHolder<TProposeResponse>(status, ui64(OperationId.GetTxId()), ui64(ssId));
- NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
+ NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
{
- NSchemeShard::TPath::TChecker checks = parentPath.Check();
+ NSchemeShard::TPath::TChecker checks = parentPath.Check();
checks
.NotUnderDomainUpgrade()
.IsAtLocalSchemeShard()
@@ -627,9 +627,9 @@ public:
const TString acl = Transaction.GetModifyACL().GetDiffACL();
- NSchemeShard::TPath dstPath = parentPath.Child(name);
+ NSchemeShard::TPath dstPath = parentPath.Child(name);
{
- NSchemeShard::TPath::TChecker checks = dstPath.Check();
+ NSchemeShard::TPath::TChecker checks = dstPath.Check();
checks.IsAtLocalSchemeShard();
if (dstPath.IsResolved()) {
checks
@@ -666,12 +666,12 @@ public:
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
return result;
}
if (!AppData()->FeatureFlags.GetEnableOlapSchemaOperations()) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed,
+ result->SetError(NKikimrScheme::StatusPreconditionFailed,
"Olap schema operations are not supported");
return result;
}
@@ -690,7 +690,7 @@ public:
// Construct channels bindings for columnshards
TChannelsBindings channelsBindings;
if (!context.SS->GetOlapChannelsBindings(dstPath.DomainId(), storeInfo->Description.GetStorageConfig(), channelsBindings, errStr)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
return result;
}
@@ -700,7 +700,7 @@ public:
const ui64 shardsToCreate = storeInfo->ColumnShards.size();
{
- NSchemeShard::TPath::TChecker checks = dstPath.Check();
+ NSchemeShard::TPath::TChecker checks = dstPath.Check();
checks
.ShardsLimit(shardsToCreate)
.PathShardsLimit(shardsToCreate);
@@ -771,8 +771,8 @@ public:
context.SS->ChangeTxState(db, OperationId, TTxState::CreateParts);
context.OnComplete.ActivateTx(OperationId);
- context.SS->PersistTxState(db, OperationId);
- context.SS->PersistPath(db, dstPath.Base()->PathId);
+ context.SS->PersistTxState(db, OperationId);
+ context.SS->PersistPath(db, dstPath.Base()->PathId);
if (!acl.empty()) {
dstPath.Base()->ApplyACL(acl);
@@ -818,7 +818,7 @@ public:
}
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
ISubOperationBase::TPtr CreateNewOlapStore(TOperationId id, const TTxTransaction& tx) {
return new TCreateOlapStore(id, tx);
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_table.cpp
index 081a7571a6d..09f556c6558 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_table.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_olap_table.cpp
@@ -9,15 +9,15 @@
#include <util/random/shuffle.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
namespace {
TOlapTableInfo::TPtr CreateOlapTable(
const NKikimrSchemeOp::TColumnTableDescription& opSrc,
TOlapStoreInfo::TPtr storeInfo, const TSubDomainInfo& subDomain,
- TEvSchemeShard::EStatus& status, TString& errStr,
- TSchemeShard* ss)
+ TEvSchemeShard::EStatus& status, TString& errStr,
+ TSchemeShard* ss)
{
Y_UNUSED(subDomain);
@@ -28,7 +28,7 @@ TOlapTableInfo::TPtr CreateOlapTable(
auto& op = tableInfo->Description;
if (op.HasRESERVED_TtlSettingsPresetName() || op.HasRESERVED_TtlSettingsPresetId()) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = "TTL presets are not supported";
return nullptr;
}
@@ -42,7 +42,7 @@ TOlapTableInfo::TPtr CreateOlapTable(
if (op.HasSchemaPresetName()) {
const TString presetName = op.GetSchemaPresetName();
if (!storeInfo->SchemaPresetByName.contains(presetName)) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = Sprintf("Specified schema preset '%s' does not exist in olap store", presetName.c_str());
return nullptr;
}
@@ -51,7 +51,7 @@ TOlapTableInfo::TPtr CreateOlapTable(
op.SetSchemaPresetId(presetId);
}
if (op.GetSchemaPresetId() != presetId) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = Sprintf("Specified schema preset '%s' and id %" PRIu32 " do not match in olap store", presetName.c_str(), presetId);
return nullptr;
}
@@ -59,7 +59,7 @@ TOlapTableInfo::TPtr CreateOlapTable(
} else if (op.HasSchemaPresetId()) {
const ui32 presetId = op.GetSchemaPresetId();
if (!storeInfo->SchemaPresets.contains(presetId)) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = Sprintf("Specified schema preset %" PRIu32 " does not exist in olap store", presetId);
return nullptr;
}
@@ -79,44 +79,44 @@ TOlapTableInfo::TPtr CreateOlapTable(
THashSet<ui32> usedColumns;
for (const auto& colProto : opSchema.GetColumns()) {
if (colProto.GetName().empty()) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = "Columns cannot have an empty name";
return nullptr;
}
const TString& colName = colProto.GetName();
auto* col = pSchema->FindColumnByName(colName);
if (!col) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = TStringBuilder()
<< "Column '" << colName << "' does not match schema preset";
return nullptr;
}
if (colProto.HasId() && colProto.GetId() != col->Id) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = TStringBuilder()
<< "Column '" << colName << "' has id " << colProto.GetId() << " that does not match schema preset";
return nullptr;
}
if (!usedColumns.insert(col->Id).second) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = TStringBuilder() << "Column '" << colName << "' is specified multiple times";
return nullptr;
}
if (col->Id < lastColumnId) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = "Column order does not match schema preset";
return nullptr;
}
lastColumnId = col->Id;
if (colProto.HasTypeId()) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = TStringBuilder() << "Cannot set TypeId for column '" << colName << "', use Type";
return nullptr;
}
if (!colProto.HasType()) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = TStringBuilder() << "Missing Type for column '" << colName << "'";
return nullptr;
}
@@ -124,14 +124,14 @@ TOlapTableInfo::TPtr CreateOlapTable(
auto typeName = NMiniKQL::AdaptLegacyYqlType(colProto.GetType());
const NScheme::IType* type = typeRegistry->GetType(typeName);
if (!type || !NScheme::NTypeIds::IsYqlType(type->GetTypeId())) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = TStringBuilder()
<< "Type '" << colProto.GetType() << "' specified for column '" << colName << "' is not supported";
return nullptr;
}
if (type->GetTypeId() != col->TypeId) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = TStringBuilder()
<< "Type '" << colProto.GetType() << "' specified for column '" << colName
<< "' does not match schema preset";
@@ -141,7 +141,7 @@ TOlapTableInfo::TPtr CreateOlapTable(
for (auto& pr : pSchema->Columns) {
if (!usedColumns.contains(pr.second.Id)) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = "Specified schema is missing some schema preset columns";
return nullptr;
}
@@ -151,20 +151,20 @@ TOlapTableInfo::TPtr CreateOlapTable(
for (const TString& keyName : opSchema.GetKeyColumnNames()) {
auto* col = pSchema->FindColumnByName(keyName);
if (!col) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = TStringBuilder() << "Unknown key column '" << keyName << "'";
return nullptr;
}
keyColumnIds.push_back(col->Id);
}
if (keyColumnIds != pSchema->KeyColumnIds) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = "Specified schema key columns not matching schema preset";
return nullptr;
}
if (opSchema.GetEngine() != pSchema->Engine) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = "Specified schema engine does not match schema preset";
return nullptr;
}
@@ -194,7 +194,7 @@ TOlapTableInfo::TPtr CreateOlapTable(
if (op.HasTtlSettingsPresetName()) {
const TString presetName = op.GetTtlSettingsPresetName();
if (!storeInfo->TtlSettingsPresetByName.contains(presetName)) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = Sprintf("Specified ttl settings preset '%s' does not exist in olap store", presetName.c_str());
return nullptr;
}
@@ -203,14 +203,14 @@ TOlapTableInfo::TPtr CreateOlapTable(
op.SetTtlSettingsPresetId(presetId);
}
if (op.GetTtlSettingsPresetId() != presetId) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = Sprintf("Specified ttl settings preset '%s' and id %" PRIu32 " do not match in olap store", presetName.c_str(), presetId);
return nullptr;
}
} else if (op.HasTtlSettingsPresetId()) {
const ui32 presetId = op.GetTtlSettingsPresetId();
if (!storeInfo->TtlSettingsPresets.contains(presetId)) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = Sprintf("Specified ttl preset %" PRIu32 " does not exist in olap store", presetId);
return nullptr;
}
@@ -225,7 +225,7 @@ TOlapTableInfo::TPtr CreateOlapTable(
// Validate ttl settings and schema compatibility
if (op.HasTtlSettings()) {
if (!ValidateTtlSettings(op.GetTtlSettings(), pSchema->Columns, pSchema->ColumnsByName, storageTiers, errStr)) {
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
return nullptr;
}
}
@@ -247,7 +247,7 @@ TOlapTableInfo::TPtr CreateOlapTable(
case NKikimrSchemeOp::TColumnTableSharding::kHashSharding: {
auto& sharding = *tableInfo->Sharding.MutableHashSharding();
if (sharding.ColumnsSize() == 0) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = Sprintf("Hash sharding requires a non-empty list of columns");
return nullptr;
}
@@ -256,7 +256,7 @@ TOlapTableInfo::TPtr CreateOlapTable(
for (const TString& columnName : sharding.GetColumns()) {
auto* pColumn = pSchema->FindColumnByName(columnName);
if (!pColumn) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = Sprintf("Hash sharding is using an unknown column '%s'", columnName.c_str());
return nullptr;
}
@@ -269,7 +269,7 @@ TOlapTableInfo::TPtr CreateOlapTable(
break;
}
default: {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = "Unsupported sharding method";
return nullptr;
}
@@ -277,7 +277,7 @@ TOlapTableInfo::TPtr CreateOlapTable(
const ui32 columnShardCount = Max(ui32(1), op.GetColumnShardCount());
if (columnShardCount > storeInfo->ColumnShards.size()) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = Sprintf("Cannot create table with %" PRIu32 " column shards, only %" PRIu32 " are available",
columnShardCount, ui32(storeInfo->ColumnShards.size()));
return nullptr;
@@ -652,10 +652,10 @@ public:
SetState(SelectStateFunc(state));
}
- THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
+ THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
const TTabletId ssId = context.SS->SelfTabletId();
- const auto acceptExisted = !Transaction.GetFailOnExist();
+ const auto acceptExisted = !Transaction.GetFailOnExist();
const TString& parentPathStr = Transaction.GetWorkingDir();
auto& createDescription = Transaction.GetCreateColumnTable();
const TString& name = createDescription.GetName();
@@ -666,12 +666,12 @@ public:
<< ", opId: " << OperationId
<< ", at schemeshard: " << ssId);
- TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
+ TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
auto result = MakeHolder<TProposeResponse>(status, ui64(OperationId.GetTxId()), ui64(ssId));
- NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
+ NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
{
- NSchemeShard::TPath::TChecker checks = parentPath.Check();
+ NSchemeShard::TPath::TChecker checks = parentPath.Check();
checks
.NotUnderDomainUpgrade()
.IsAtLocalSchemeShard()
@@ -693,9 +693,9 @@ public:
const TString acl = Transaction.GetModifyACL().GetDiffACL();
- NSchemeShard::TPath dstPath = parentPath.Child(name);
+ NSchemeShard::TPath dstPath = parentPath.Child(name);
{
- NSchemeShard::TPath::TChecker checks = dstPath.Check();
+ NSchemeShard::TPath::TChecker checks = dstPath.Check();
checks.IsAtLocalSchemeShard();
if (dstPath.IsResolved()) {
checks
@@ -733,7 +733,7 @@ public:
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
return result;
}
@@ -741,7 +741,7 @@ public:
Y_VERIFY(olapStorePath, "Unexpected failure to find an olap store");
auto storeInfo = context.SS->OlapStores.at(olapStorePath->PathId);
{
- NSchemeShard::TPath::TChecker checks = olapStorePath.Check();
+ NSchemeShard::TPath::TChecker checks = olapStorePath.Check();
checks
.NotUnderDomainUpgrade()
.IsAtLocalSchemeShard()
@@ -761,7 +761,7 @@ public:
}
if (!AppData()->FeatureFlags.GetEnableOlapSchemaOperations()) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed,
+ result->SetError(NKikimrScheme::StatusPreconditionFailed,
"Olap schema operations are not supported");
return result;
}
@@ -822,8 +822,8 @@ public:
olapStorePath.Base()->LastTxId = OperationId.GetTxId();
context.SS->PersistLastTxId(db, olapStorePath.Base());
- context.SS->PersistTxState(db, OperationId);
- context.SS->PersistPath(db, dstPath.Base()->PathId);
+ context.SS->PersistTxState(db, OperationId);
+ context.SS->PersistPath(db, dstPath.Base()->PathId);
context.OnComplete.ActivateTx(OperationId);
@@ -879,5 +879,5 @@ ISubOperationBase::TPtr CreateNewOlapTable(TOperationId id, TTxState::ETxState s
}
-} // namespace NSchemeShard
+} // namespace NSchemeShard
} // namespace NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_pq.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_pq.cpp
index 811e8a31db3..992fd3175c2 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_pq.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_pq.cpp
@@ -1,52 +1,52 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
#include <ydb/core/engine/mkql_proto.h>
#include <ydb/core/persqueue/config/config.h>
#include <ydb/core/mind/hive/hive.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
TPersQueueGroupInfo::TPtr CreatePersQueueGroup(TOperationContext& context,
const NKikimrSchemeOp::TPersQueueGroupDescription& op,
- TEvSchemeShard::EStatus& status, TString& errStr)
-{
- TPersQueueGroupInfo::TPtr pqGroupInfo = new TPersQueueGroupInfo;
-
- ui32 partitionCount = 0;
- if (op.HasTotalGroupCount()) {
- partitionCount = op.GetTotalGroupCount();
- }
-
- ui32 partsPerTablet = TSchemeShard::DefaultPQTabletPartitionsCount;
- if (op.HasPartitionPerTablet()) {
- partsPerTablet = op.GetPartitionPerTablet();
- }
-
- if (op.PartitionsToDeleteSize() > 0) {
- status = NKikimrScheme::StatusSchemeError;
- errStr = Sprintf("trying to delete partitions from not created PQGroup");
- return nullptr;
- }
-
- if (op.PartitionsToAddSize()) {
- errStr = Sprintf("creating topic with providing of partitions count is forbidden");
- return nullptr;
- }
-
- if (partitionCount == 0 || partitionCount > TSchemeShard::MaxPQGroupPartitionsCount) {
+ TEvSchemeShard::EStatus& status, TString& errStr)
+{
+ TPersQueueGroupInfo::TPtr pqGroupInfo = new TPersQueueGroupInfo;
+
+ ui32 partitionCount = 0;
+ if (op.HasTotalGroupCount()) {
+ partitionCount = op.GetTotalGroupCount();
+ }
+
+ ui32 partsPerTablet = TSchemeShard::DefaultPQTabletPartitionsCount;
+ if (op.HasPartitionPerTablet()) {
+ partsPerTablet = op.GetPartitionPerTablet();
+ }
+
+ if (op.PartitionsToDeleteSize() > 0) {
+ status = NKikimrScheme::StatusSchemeError;
+ errStr = Sprintf("trying to delete partitions from not created PQGroup");
+ return nullptr;
+ }
+
+ if (op.PartitionsToAddSize()) {
+ errStr = Sprintf("creating topic with providing of partitions count is forbidden");
+ return nullptr;
+ }
+
+ if (partitionCount == 0 || partitionCount > TSchemeShard::MaxPQGroupPartitionsCount) {
status = NKikimrScheme::StatusInvalidParameter;
- errStr = Sprintf("Invalid total partition count specified: %u", partitionCount);
- return nullptr;
- }
-
+ errStr = Sprintf("Invalid total partition count specified: %u", partitionCount);
+ return nullptr;
+ }
+
if (!op.HasPQTabletConfig()) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = Sprintf("No PQTabletConfig specified");
return nullptr;
}
@@ -69,7 +69,7 @@ TPersQueueGroupInfo::TPtr CreatePersQueueGroup(TOperationContext& context,
if (op.GetPQTabletConfig().PartitionKeySchemaSize()) {
if (op.PartitionBoundariesSize() != (partitionCount - 1)) {
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
errStr = Sprintf("Partition count and partition boundaries size mismatch: %lu, %u",
op.PartitionBoundariesSize(), partitionCount);
return nullptr;
@@ -77,20 +77,20 @@ TPersQueueGroupInfo::TPtr CreatePersQueueGroup(TOperationContext& context,
TString error;
if (!pqGroupInfo->FillKeySchema(op.GetPQTabletConfig(), error)) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = Sprintf("Invalid key schema: %s", error.data());
return nullptr;
}
} else {
if (op.PartitionBoundariesSize()) {
- status = NKikimrScheme::StatusInvalidParameter;
+ status = NKikimrScheme::StatusInvalidParameter;
errStr = "Missing key schema with specified partition boundaries";
return nullptr;
}
}
TString prevBound;
- for (ui32 i = 0; i < partitionCount; ++i) {
+ for (ui32 i = 0; i < partitionCount; ++i) {
using TKeyRange = TPQShardInfo::TKeyRange;
TMaybe<TKeyRange> keyRange;
@@ -105,7 +105,7 @@ TPersQueueGroupInfo::TPtr CreatePersQueueGroup(TOperationContext& context,
TVector<TCell> cells;
TString error;
if (!NMiniKQL::CellsFromTuple(nullptr, op.GetPartitionBoundaries(i), pqGroupInfo->KeySchema, false, cells, error)) {
- status = NKikimrScheme::StatusSchemeError;
+ status = NKikimrScheme::StatusSchemeError;
errStr = Sprintf("Invalid partition boundary at position: %u, error: %s", i, error.data());
return nullptr;
}
@@ -117,36 +117,36 @@ TPersQueueGroupInfo::TPtr CreatePersQueueGroup(TOperationContext& context,
}
pqGroupInfo->PartitionsToAdd.emplace(i, i + 1, keyRange);
- }
-
- if (partsPerTablet == 0 || partsPerTablet > TSchemeShard::MaxPQTabletPartitionsCount) {
- status = NKikimrScheme::StatusSchemeError;
- errStr = Sprintf("Invalid partition per tablet count specified: %u", partsPerTablet);
- return nullptr;
- }
-
- pqGroupInfo->NextPartitionId = partitionCount;
- pqGroupInfo->MaxPartsPerTablet = partsPerTablet;
-
- pqGroupInfo->TotalGroupCount = partitionCount;
- pqGroupInfo->TotalPartitionCount = partitionCount;
-
- ui32 tabletCount = pqGroupInfo->ExpectedShardCount();
- if (tabletCount > TSchemeShard::MaxPQGroupTabletsCount) {
- status = NKikimrScheme::StatusSchemeError;
- errStr = Sprintf("Invalid tablet count specified: %u", tabletCount);
- return nullptr;
- }
-
- NKikimrPQ::TPQTabletConfig tabletConfig = op.GetPQTabletConfig();
+ }
+
+ if (partsPerTablet == 0 || partsPerTablet > TSchemeShard::MaxPQTabletPartitionsCount) {
+ status = NKikimrScheme::StatusSchemeError;
+ errStr = Sprintf("Invalid partition per tablet count specified: %u", partsPerTablet);
+ return nullptr;
+ }
+
+ pqGroupInfo->NextPartitionId = partitionCount;
+ pqGroupInfo->MaxPartsPerTablet = partsPerTablet;
+
+ pqGroupInfo->TotalGroupCount = partitionCount;
+ pqGroupInfo->TotalPartitionCount = partitionCount;
+
+ ui32 tabletCount = pqGroupInfo->ExpectedShardCount();
+ if (tabletCount > TSchemeShard::MaxPQGroupTabletsCount) {
+ status = NKikimrScheme::StatusSchemeError;
+ errStr = Sprintf("Invalid tablet count specified: %u", tabletCount);
+ return nullptr;
+ }
+
+ NKikimrPQ::TPQTabletConfig tabletConfig = op.GetPQTabletConfig();
tabletConfig.ClearPartitionIds();
- tabletConfig.ClearPartitions();
-
- if (!CheckPersQueueConfig(tabletConfig, false, &errStr)) {
- status = NKikimrScheme::StatusSchemeError;
- return nullptr;
- }
-
+ tabletConfig.ClearPartitions();
+
+ if (!CheckPersQueueConfig(tabletConfig, false, &errStr)) {
+ status = NKikimrScheme::StatusSchemeError;
+ return nullptr;
+ }
+
const TPathElement::TPtr dbRootEl = context.SS->PathsById.at(context.SS->RootPathId());
if (dbRootEl->UserAttrs->Attrs.contains("cloud_id")) {
auto cloudId = dbRootEl->UserAttrs->Attrs.at("cloud_id");
@@ -164,151 +164,151 @@ TPersQueueGroupInfo::TPtr CreatePersQueueGroup(TOperationContext& context,
tabletConfig.SetYdbDatabasePath(databasePath);
Y_PROTOBUF_SUPPRESS_NODISCARD tabletConfig.SerializeToString(&pqGroupInfo->TabletConfig);
-
+
if (op.HasBootstrapConfig()) {
Y_PROTOBUF_SUPPRESS_NODISCARD op.GetBootstrapConfig().SerializeToString(&pqGroupInfo->BootstrapConfig);
}
- return pqGroupInfo;
-}
-
+ return pqGroupInfo;
+}
+
void ApplySharding(TTxId txId,
TPathId pathId,
TPersQueueGroupInfo::TPtr pqGroup,
TTxState& txState,
const TChannelsBindings& rbBindedChannels,
const TChannelsBindings& pqBindedChannels,
- TSchemeShard* ss) {
- pqGroup->AlterVersion = 0;
+ TSchemeShard* ss) {
+ pqGroup->AlterVersion = 0;
TShardInfo shardInfo = TShardInfo::PersQShardInfo(txId, pathId);
shardInfo.BindedChannels = pqBindedChannels;
- Y_VERIFY(pqGroup->TotalGroupCount == pqGroup->PartitionsToAdd.size());
- const ui64 count = pqGroup->ExpectedShardCount();
- txState.Shards.reserve(count + 1);
- const auto startShardIdx = ss->ReserveShardIdxs(count + 1);
- for (ui64 i = 0; i < count; ++i) {
- const auto idx = ss->NextShardIdx(startShardIdx, i);
+ Y_VERIFY(pqGroup->TotalGroupCount == pqGroup->PartitionsToAdd.size());
+ const ui64 count = pqGroup->ExpectedShardCount();
+ txState.Shards.reserve(count + 1);
+ const auto startShardIdx = ss->ReserveShardIdxs(count + 1);
+ for (ui64 i = 0; i < count; ++i) {
+ const auto idx = ss->NextShardIdx(startShardIdx, i);
ss->RegisterShardInfo(idx, shardInfo);
- txState.Shards.emplace_back(idx, ETabletType::PersQueue, TTxState::CreateParts);
-
- TPQShardInfo::TPtr pqShard = new TPQShardInfo();
- pqShard->PQInfos.reserve(pqGroup->MaxPartsPerTablet);
- pqGroup->Shards[idx] = pqShard;
- }
-
- const auto idx = ss->NextShardIdx(startShardIdx, count);
+ txState.Shards.emplace_back(idx, ETabletType::PersQueue, TTxState::CreateParts);
+
+ TPQShardInfo::TPtr pqShard = new TPQShardInfo();
+ pqShard->PQInfos.reserve(pqGroup->MaxPartsPerTablet);
+ pqGroup->Shards[idx] = pqShard;
+ }
+
+ const auto idx = ss->NextShardIdx(startShardIdx, count);
ss->RegisterShardInfo(idx,
TShardInfo::PQBalancerShardInfo(txId, pathId)
.WithBindedChannels(rbBindedChannels));
- txState.Shards.emplace_back(idx, ETabletType::PersQueueReadBalancer, TTxState::CreateParts);
- pqGroup->BalancerShardIdx = idx;
-
- auto it = pqGroup->PartitionsToAdd.begin();
- for (ui32 pqId = 0; pqId < pqGroup->TotalGroupCount; ++pqId, ++it) {
- auto idx = ss->NextShardIdx(startShardIdx, pqId / pqGroup->MaxPartsPerTablet);
- TPQShardInfo::TPtr pqShard = pqGroup->Shards[idx];
-
- TPQShardInfo::TPersQueueInfo pqInfo;
+ txState.Shards.emplace_back(idx, ETabletType::PersQueueReadBalancer, TTxState::CreateParts);
+ pqGroup->BalancerShardIdx = idx;
+
+ auto it = pqGroup->PartitionsToAdd.begin();
+ for (ui32 pqId = 0; pqId < pqGroup->TotalGroupCount; ++pqId, ++it) {
+ auto idx = ss->NextShardIdx(startShardIdx, pqId / pqGroup->MaxPartsPerTablet);
+ TPQShardInfo::TPtr pqShard = pqGroup->Shards[idx];
+
+ TPQShardInfo::TPersQueueInfo pqInfo;
pqInfo.PqId = it->PartitionId;
pqInfo.GroupId = it->GroupId;
pqInfo.KeyRange = it->KeyRange;
- pqInfo.AlterVersion = 1;
- pqShard->PQInfos.push_back(pqInfo);
- }
-}
-
-
-class TCreatePQ: public TSubOperation {
+ pqInfo.AlterVersion = 1;
+ pqShard->PQInfos.push_back(pqInfo);
+ }
+}
+
+
+class TCreatePQ: public TSubOperation {
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::CreateParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
- return TTxState::ConfigureParts;
- case TTxState::ConfigureParts:
- return TTxState::Propose;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::CreateParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
+ return TTxState::ConfigureParts;
+ case TTxState::ConfigureParts:
+ return TTxState::Propose;
case TTxState::Propose:
return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
return THolder(new TCreateParts(OperationId));
- case TTxState::ConfigureParts:
+ case TTxState::ConfigureParts:
return THolder(new NPQState::TConfigureParts(OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new NPQState::TPropose(OperationId));
case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TCreatePQ(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TCreatePQ(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
- const auto acceptExisted = !Transaction.GetFailOnExist();
+
+ TCreatePQ(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ const auto acceptExisted = !Transaction.GetFailOnExist();
const auto& createDEscription = Transaction.GetCreatePersQueueGroup();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
- const TString& name = createDEscription.GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreatePQ Propose"
+ const TString& name = createDEscription.GetName();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreatePQ Propose"
<< ", path: " << parentPathStr << "/" << name
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
- auto result = MakeHolder<TProposeResponse>(status, ui64(OperationId.GetTxId()), ui64(ssId));
-
- NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
- {
- NSchemeShard::TPath::TChecker checks = parentPath.Check();
- checks
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
+ auto result = MakeHolder<TProposeResponse>(status, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
+ {
+ NSchemeShard::TPath::TChecker checks = parentPath.Check();
+ checks
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
.NotUnderDeleting();
-
+
if (checks) {
if (parentPath.Base()->IsCdcStream()) {
checks
@@ -321,70 +321,70 @@ public:
}
}
- if (!checks) {
- TString explain = TStringBuilder() << "parent path fail checks"
- << ", path: " << parentPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent path fail checks"
+ << ", path: " << parentPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
const TString acl = Transaction.GetModifyACL().GetDiffACL();
- NSchemeShard::TPath dstPath = parentPath.Child(name);
- {
- NSchemeShard::TPath::TChecker checks = dstPath.Check();
- checks.IsAtLocalSchemeShard();
- if (dstPath.IsResolved()) {
+ NSchemeShard::TPath dstPath = parentPath.Child(name);
+ {
+ NSchemeShard::TPath::TChecker checks = dstPath.Check();
+ checks.IsAtLocalSchemeShard();
+ if (dstPath.IsResolved()) {
checks
.IsResolved()
- .NotUnderDeleting()
- .FailOnExist(TPathElement::EPathType::EPathTypePersQueueGroup, acceptExisted);
- } else {
+ .NotUnderDeleting()
+ .FailOnExist(TPathElement::EPathType::EPathTypePersQueueGroup, acceptExisted);
+ } else {
checks
.NotEmpty()
- .NotResolved();
- }
-
- if (checks) {
- checks
- .IsValidLeafName()
- .DepthLimit()
- .PathsLimit()
+ .NotResolved();
+ }
+
+ if (checks) {
+ checks
+ .IsValidLeafName()
+ .DepthLimit()
+ .PathsLimit()
.DirChildrenLimit()
.IsValidACL(acl);
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "dst path fail checks"
- << ", path: " << dstPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- if (dstPath.IsResolved()) {
- result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
- }
- return result;
- }
- }
-
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "dst path fail checks"
+ << ", path: " << dstPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ if (dstPath.IsResolved()) {
+ result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+ }
+ return result;
+ }
+ }
+
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- TPersQueueGroupInfo::TPtr pqGroup = CreatePersQueueGroup(
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ TPersQueueGroupInfo::TPtr pqGroup = CreatePersQueueGroup(
context, createDEscription, status, errStr);
-
- if (!pqGroup.Get()) {
- result->SetError(status, errStr);
- return result;
- }
-
- const ui64 shardsToCreate = pqGroup->ExpectedShardCount() + 1;
+
+ if (!pqGroup.Get()) {
+ result->SetError(status, errStr);
+ return result;
+ }
+
+ const ui64 shardsToCreate = pqGroup->ExpectedShardCount() + 1;
const ui64 partitionsToCreate = pqGroup->TotalPartitionCount;
auto tabletConfig = pqGroup->TabletConfig;
@@ -397,34 +397,34 @@ public:
ui64 throughput = ((ui64)partitionsToCreate) * config.GetPartitionConfig().GetWriteSpeedInBytesPerSecond();
ui64 storage = throughput * config.GetPartitionConfig().GetLifetimeSeconds();
ui64 storageToReserve = storage;
- {
- NSchemeShard::TPath::TChecker checks = dstPath.Check();
- checks
- .ShardsLimit(shardsToCreate)
+ {
+ NSchemeShard::TPath::TChecker checks = dstPath.Check();
+ checks
+ .ShardsLimit(shardsToCreate)
.PathShardsLimit(shardsToCreate)
.PQPartitionsLimit(partitionsToCreate)
.PQReservedStorageLimit(storageToReserve);
-
- if (!checks) {
- TString explain = TStringBuilder() << "dst path fail checks"
- << ", path: " << dstPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "dst path fail checks"
+ << ", path: " << dstPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
if (dstPath.IsResolved()) {
result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
result->SetPathId(dstPath.Base()->PathId.LocalPathId);
}
- return result;
- }
- }
-
+ return result;
+ }
+ }
+
// This profile id is only used for pq read balancer tablet when
// explicit channel profiles are specified. Read balancer tablet is
// a tablet with local db which doesn't use extra channels in any way.
const ui32 tabletProfileId = 0;
TChannelsBindings tabletChannelsBinding;
if (!context.SS->ResolvePqChannels(tabletProfileId, dstPath.DomainId(), tabletChannelsBinding)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter,
+ result->SetError(NKikimrScheme::StatusInvalidParameter,
"Unable to construct channel binding for PQ with the storage pool");
return result;
}
@@ -440,7 +440,7 @@ public:
auto errStr = Sprintf("ExplicitChannelProfiles has %u channels, should be [3 .. %lu]",
ecps.size(),
NHive::MAX_TABLET_CHANNELS);
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
return result;
}
@@ -455,7 +455,7 @@ public:
dstPath.DomainId(),
pqChannelsBinding);
if (!resolved) {
- result->SetError(NKikimrScheme::StatusInvalidParameter,
+ result->SetError(NKikimrScheme::StatusInvalidParameter,
"Unable to construct channel binding for PersQueue with the storage pool");
return result;
}
@@ -465,80 +465,80 @@ public:
pqChannelsBinding = tabletChannelsBinding;
}
- dstPath.MaterializeLeaf(owner);
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
-
- context.SS->TabletCounters->Simple()[COUNTER_PQ_GROUP_COUNT].Add(1);
-
- TPathId pathId = dstPath.Base()->PathId;
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxCreatePQGroup, pathId);
-
+ dstPath.MaterializeLeaf(owner);
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+
+ context.SS->TabletCounters->Simple()[COUNTER_PQ_GROUP_COUNT].Add(1);
+
+ TPathId pathId = dstPath.Base()->PathId;
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxCreatePQGroup, pathId);
+
ApplySharding(OperationId.GetTxId(), pathId, pqGroup, txState, tabletChannelsBinding, pqChannelsBinding, context.SS);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- for (auto& shard : pqGroup->Shards) {
- auto shardIdx = shard.first;
- for (const auto& pqInfo : shard.second->PQInfos) {
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ for (auto& shard : pqGroup->Shards) {
+ auto shardIdx = shard.first;
+ for (const auto& pqInfo : shard.second->PQInfos) {
context.SS->PersistPersQueue(db, pathId, shardIdx, pqInfo);
- }
- }
-
- TPersQueueGroupInfo::TPtr emptyGroup = new TPersQueueGroupInfo;
- emptyGroup->Shards.swap(pqGroup->Shards);
-
- context.SS->PersQueueGroups[pathId] = emptyGroup;
- context.SS->PersQueueGroups[pathId]->AlterData = pqGroup;
+ }
+ }
+
+ TPersQueueGroupInfo::TPtr emptyGroup = new TPersQueueGroupInfo;
+ emptyGroup->Shards.swap(pqGroup->Shards);
+
+ context.SS->PersQueueGroups[pathId] = emptyGroup;
+ context.SS->PersQueueGroups[pathId]->AlterData = pqGroup;
context.SS->IncrementPathDbRefCount(pathId);
-
- context.SS->PersistPersQueueGroup(db, pathId, emptyGroup);
- context.SS->PersistAddPersQueueGroupAlter(db, pathId, pqGroup);
-
- for (auto shard : txState.Shards) {
- Y_VERIFY(shard.Operation == TTxState::CreateParts);
- context.SS->PersistShardMapping(db, shard.Idx, InvalidTabletId, pathId, OperationId.GetTxId(), shard.TabletType);
+
+ context.SS->PersistPersQueueGroup(db, pathId, emptyGroup);
+ context.SS->PersistAddPersQueueGroupAlter(db, pathId, pqGroup);
+
+ for (auto shard : txState.Shards) {
+ Y_VERIFY(shard.Operation == TTxState::CreateParts);
+ context.SS->PersistShardMapping(db, shard.Idx, InvalidTabletId, pathId, OperationId.GetTxId(), shard.TabletType);
context.SS->PersistChannelsBinding(db, shard.Idx, tabletChannelsBinding);
- }
- Y_VERIFY(txState.Shards.size() == shardsToCreate);
- context.SS->TabletCounters->Simple()[COUNTER_PQ_SHARD_COUNT].Add(shardsToCreate-1);
- context.SS->TabletCounters->Simple()[COUNTER_PQ_RB_SHARD_COUNT].Add(1);
-
- dstPath.Base()->CreateTxId = OperationId.GetTxId();
- dstPath.Base()->LastTxId = OperationId.GetTxId();
- dstPath.Base()->PathState = TPathElement::EPathState::EPathStateCreate;
- dstPath.Base()->PathType = TPathElement::EPathType::EPathTypePersQueueGroup;
-
- if (parentPath.Base()->HasActiveChanges()) {
- TTxId parentTxId = parentPath.Base()->PlannedToCreate() ? parentPath.Base()->CreateTxId : parentPath.Base()->LastTxId;
- context.OnComplete.Dependence(parentTxId, OperationId.GetTxId());
- }
-
- context.SS->ChangeTxState(db, OperationId, TTxState::CreateParts);
- context.OnComplete.ActivateTx(OperationId);
-
- context.SS->PersistTxState(db, OperationId);
-
- context.SS->PersistPath(db, dstPath.Base()->PathId);
-
- if (!acl.empty()) {
- dstPath.Base()->ApplyACL(acl);
- context.SS->PersistACL(db, dstPath.Base());
- }
-
- context.SS->PersistUpdateNextPathId(db);
- context.SS->PersistUpdateNextShardIdx(db);
-
- ++parentPath.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentPath.Base());
- context.SS->ClearDescribePathCaches(parentPath.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, parentPath.Base()->PathId);
-
- context.SS->ClearDescribePathCaches(dstPath.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, dstPath.Base()->PathId);
-
- dstPath.DomainInfo()->IncPathsInside();
- dstPath.DomainInfo()->AddInternalShards(txState);
+ }
+ Y_VERIFY(txState.Shards.size() == shardsToCreate);
+ context.SS->TabletCounters->Simple()[COUNTER_PQ_SHARD_COUNT].Add(shardsToCreate-1);
+ context.SS->TabletCounters->Simple()[COUNTER_PQ_RB_SHARD_COUNT].Add(1);
+
+ dstPath.Base()->CreateTxId = OperationId.GetTxId();
+ dstPath.Base()->LastTxId = OperationId.GetTxId();
+ dstPath.Base()->PathState = TPathElement::EPathState::EPathStateCreate;
+ dstPath.Base()->PathType = TPathElement::EPathType::EPathTypePersQueueGroup;
+
+ if (parentPath.Base()->HasActiveChanges()) {
+ TTxId parentTxId = parentPath.Base()->PlannedToCreate() ? parentPath.Base()->CreateTxId : parentPath.Base()->LastTxId;
+ context.OnComplete.Dependence(parentTxId, OperationId.GetTxId());
+ }
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::CreateParts);
+ context.OnComplete.ActivateTx(OperationId);
+
+ context.SS->PersistTxState(db, OperationId);
+
+ context.SS->PersistPath(db, dstPath.Base()->PathId);
+
+ if (!acl.empty()) {
+ dstPath.Base()->ApplyACL(acl);
+ context.SS->PersistACL(db, dstPath.Base());
+ }
+
+ context.SS->PersistUpdateNextPathId(db);
+ context.SS->PersistUpdateNextShardIdx(db);
+
+ ++parentPath.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentPath.Base());
+ context.SS->ClearDescribePathCaches(parentPath.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentPath.Base()->PathId);
+
+ context.SS->ClearDescribePathCaches(dstPath.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, dstPath.Base()->PathId);
+
+ dstPath.DomainInfo()->IncPathsInside();
+ dstPath.DomainInfo()->AddInternalShards(txState);
dstPath.DomainInfo()->IncPQPartitionsInside(partitionsToCreate);
dstPath.DomainInfo()->IncPQReservedStorage(storageToReserve);
@@ -547,42 +547,42 @@ public:
context.SS->TabletCounters->Simple()[COUNTER_STREAM_SHARDS_COUNT].Add(partitionsToCreate);
- dstPath.Base()->IncShardsInside(shardsToCreate);
- parentPath.Base()->IncAliveChildren();
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+ dstPath.Base()->IncShardsInside(shardsToCreate);
+ parentPath.Base()->IncAliveChildren();
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TCreatePQ");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreatePQ AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreatePQ AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateNewPQ(TOperationId id, const TTxTransaction& tx) {
return new TCreatePQ(id, tx);
}
-ISubOperationBase::TPtr CreateNewPQ(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateNewPQ(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TCreatePQ(id, state);
-}
-
-}
-}
+ return new TCreatePQ(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_restore.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_restore.cpp
index 8fda6a98a40..44b7a59e702 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_restore.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_restore.cpp
@@ -2,7 +2,7 @@
#include "schemeshard_billing_helpers.h"
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
struct TRestore {
static constexpr TStringBuf Name() {
@@ -124,5 +124,5 @@ ISubOperationBase::TPtr CreateRestore(TOperationId id, TTxState::ETxState state)
);
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_rtmr.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_rtmr.cpp
index a78c53ab128..648fcd3c4d5 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_rtmr.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_rtmr.cpp
@@ -1,441 +1,441 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-bool ValidateConfig(const NKikimrSchemeOp::TRtmrVolumeDescription& op, TString& errStr, TEvSchemeShard::EStatus& status) {
- ui64 count = op.PartitionsSize();
- for (ui64 i = 0; i < count; ++i) {
- const auto& part = op.GetPartitions(i);
-
- if (part.HasTabletId() && TTabletId(part.GetTabletId())) {
- errStr = "Explicit tablet id provided for partition " + ::ToString(i);
-
- status = TEvSchemeShard::EStatus::StatusInvalidParameter;
- return false;
- }
-
- if (part.GetPartitionId().size() != sizeof(TGUID)) {
- errStr = "Invalid guid size for partition " + ::ToString(i);
- status = TEvSchemeShard::EStatus::StatusInvalidParameter;
- return false;
- }
- }
-
- return true;
-}
-
-TRtmrVolumeInfo::TPtr CreateRtmrVolume(const NKikimrSchemeOp::TRtmrVolumeDescription& op, TTxState& state, TSchemeShard* ss) {
- TRtmrVolumeInfo::TPtr rtmrVol = new TRtmrVolumeInfo;
-
- state.Shards.clear();
- rtmrVol->Partitions.clear();
-
- ui64 count = op.PartitionsSize();
- state.Shards.reserve(count);
- const auto startShardIdx = ss->ReserveShardIdxs(count);
- for (ui64 i = 0; i < count; ++i) {
- const auto idx = ss->NextShardIdx(startShardIdx, i);
- const auto& part = op.GetPartitions(i);
- const auto id = part.GetPartitionId();
-
- TGUID guid;
- Copy(id.cbegin(), id.cend(), (char*)guid.dw);
- rtmrVol->Partitions[idx] = new TRtmrPartitionInfo(guid, part.GetBusKey(), idx);
-
- state.Shards.emplace_back(idx, TTabletTypes::RTMRPartition, TTxState::CreateParts);
- }
-
- return rtmrVol;
-}
-
-class TConfigureParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+bool ValidateConfig(const NKikimrSchemeOp::TRtmrVolumeDescription& op, TString& errStr, TEvSchemeShard::EStatus& status) {
+ ui64 count = op.PartitionsSize();
+ for (ui64 i = 0; i < count; ++i) {
+ const auto& part = op.GetPartitions(i);
+
+ if (part.HasTabletId() && TTabletId(part.GetTabletId())) {
+ errStr = "Explicit tablet id provided for partition " + ::ToString(i);
+
+ status = TEvSchemeShard::EStatus::StatusInvalidParameter;
+ return false;
+ }
+
+ if (part.GetPartitionId().size() != sizeof(TGUID)) {
+ errStr = "Invalid guid size for partition " + ::ToString(i);
+ status = TEvSchemeShard::EStatus::StatusInvalidParameter;
+ return false;
+ }
+ }
+
+ return true;
+}
+
+TRtmrVolumeInfo::TPtr CreateRtmrVolume(const NKikimrSchemeOp::TRtmrVolumeDescription& op, TTxState& state, TSchemeShard* ss) {
+ TRtmrVolumeInfo::TPtr rtmrVol = new TRtmrVolumeInfo;
+
+ state.Shards.clear();
+ rtmrVol->Partitions.clear();
+
+ ui64 count = op.PartitionsSize();
+ state.Shards.reserve(count);
+ const auto startShardIdx = ss->ReserveShardIdxs(count);
+ for (ui64 i = 0; i < count; ++i) {
+ const auto idx = ss->NextShardIdx(startShardIdx, i);
+ const auto& part = op.GetPartitions(i);
+ const auto id = part.GetPartitionId();
+
+ TGUID guid;
+ Copy(id.cbegin(), id.cend(), (char*)guid.dw);
+ rtmrVol->Partitions[idx] = new TRtmrPartitionInfo(guid, part.GetBusKey(), idx);
+
+ state.Shards.emplace_back(idx, TTabletTypes::RTMRPartition, TTxState::CreateParts);
+ }
+
+ return rtmrVol;
+}
+
+class TConfigureParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TCreateRTMR TConfigureParts"
- << " operationId#" << OperationId;
- }
-public:
- TConfigureParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateRTMR TConfigureParts ProgressState operationId#" << OperationId
- << " at tablet" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreateRtmrVolume);
-
- auto rtmrVol = context.SS->RtmrVolumes[txState->TargetPathId];
- Y_VERIFY_S(rtmrVol, "rtmr volume is null. PathId: " << txState->TargetPathId);
- Y_VERIFY(rtmrVol->Partitions.size() == txState->Shards.size(),
- "%" PRIu64 "rtmr shards expected, %" PRIu64 " created",
- rtmrVol->Partitions.size(), txState->Shards.size());
-
- for (const auto& shard: txState->Shards) {
- auto rtmrPartition = rtmrVol->Partitions[shard.Idx];
- Y_VERIFY_S(rtmrPartition, "rtmr partitions is null shard idx " << shard.Idx << " Path " << txState->TargetPathId);
-
- auto tabletId = context.SS->ShardInfos[shard.Idx].TabletID;
- rtmrPartition->TabletId = tabletId;
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
- return true;
- }
-};
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ return TStringBuilder()
+ << "TCreateRTMR TConfigureParts"
+ << " operationId#" << OperationId;
+ }
+public:
+ TConfigureParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateRTMR TConfigureParts ProgressState operationId#" << OperationId
+ << " at tablet" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateRtmrVolume);
+
+ auto rtmrVol = context.SS->RtmrVolumes[txState->TargetPathId];
+ Y_VERIFY_S(rtmrVol, "rtmr volume is null. PathId: " << txState->TargetPathId);
+ Y_VERIFY(rtmrVol->Partitions.size() == txState->Shards.size(),
+ "%" PRIu64 "rtmr shards expected, %" PRIu64 " created",
+ rtmrVol->Partitions.size(), txState->Shards.size());
+
+ for (const auto& shard: txState->Shards) {
+ auto rtmrPartition = rtmrVol->Partitions[shard.Idx];
+ Y_VERIFY_S(rtmrPartition, "rtmr partitions is null shard idx " << shard.Idx << " Path " << txState->TargetPathId);
+
+ auto tabletId = context.SS->ShardInfos[shard.Idx].TabletID;
+ rtmrPartition->TabletId = tabletId;
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
+ return true;
+ }
+};
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TCreateRTMR TPropose"
- << ", operationId: " << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- auto step = TStepId(ev->Get()->StepId);
- auto ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreateRtmrVolume);
-
- auto pathId = txState->TargetPathId;
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- path->StepCreated = step;
- context.SS->PersistCreateStep(db, pathId, step);
-
- auto parentDir = context.SS->PathsById.at(path->ParentPathId);
- ++parentDir->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir);
- context.SS->ClearDescribePathCaches(parentDir);
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
-
- context.SS->ClearDescribePathCaches(path);
+ return TStringBuilder()
+ << "TCreateRTMR TPropose"
+ << ", operationId: " << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ auto step = TStepId(ev->Get()->StepId);
+ auto ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateRtmrVolume);
+
+ auto pathId = txState->TargetPathId;
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ path->StepCreated = step;
+ context.SS->PersistCreateStep(db, pathId, step);
+
+ auto parentDir = context.SS->PathsById.at(path->ParentPathId);
+ ++parentDir->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir);
+ context.SS->ClearDescribePathCaches(parentDir);
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
+
+ context.SS->ClearDescribePathCaches(path);
context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
context.SS->ChangeTxState(db, OperationId, TTxState::Done);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- auto ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreateRtmrVolume);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-class TCreateRTMR: public TSubOperation {
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ auto ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateRtmrVolume);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+class TCreateRTMR: public TSubOperation {
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::CreateParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
- return TTxState::ConfigureParts;
- case TTxState::ConfigureParts:
- return TTxState::Propose;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::CreateParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
+ return TTxState::ConfigureParts;
+ case TTxState::ConfigureParts:
+ return TTxState::Propose;
case TTxState::Propose:
return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
return THolder(new TCreateParts(OperationId));
- case TTxState::ConfigureParts:
+ case TTxState::ConfigureParts:
return THolder(new TConfigureParts(OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new TPropose(OperationId));
case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TCreateRTMR(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TCreateRTMR(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
- const auto ssId = context.SS->SelfTabletId();
-
- const auto acceptExisted = !Transaction.GetFailOnExist();
+
+ TCreateRTMR(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
+ const auto ssId = context.SS->SelfTabletId();
+
+ const auto acceptExisted = !Transaction.GetFailOnExist();
const auto& rtmrVolumeDescription = Transaction.GetCreateRtmrVolume();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
- const TString& name = rtmrVolumeDescription.GetName();
-
- const ui64 shardsToCreate = rtmrVolumeDescription.GetPartitionsCount();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateRTMR Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
- auto result = MakeHolder<TProposeResponse>(status, ui64(OperationId.GetTxId()), ui64(ssId));
-
- NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
- {
- NSchemeShard::TPath::TChecker checks = parentPath.Check();
- checks
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsCommonSensePath()
- .IsLikeDirectory();
-
- if (!checks) {
- TString explain = TStringBuilder() << "parent path fail checks"
- << ", path: " << parentPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
+ const TString& name = rtmrVolumeDescription.GetName();
+
+ const ui64 shardsToCreate = rtmrVolumeDescription.GetPartitionsCount();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateRTMR Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
+ auto result = MakeHolder<TProposeResponse>(status, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
+ {
+ NSchemeShard::TPath::TChecker checks = parentPath.Check();
+ checks
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsCommonSensePath()
+ .IsLikeDirectory();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent path fail checks"
+ << ", path: " << parentPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
const TString acl = Transaction.GetModifyACL().GetDiffACL();
- NSchemeShard::TPath dstPath = parentPath.Child(name);
- {
- NSchemeShard::TPath::TChecker checks = dstPath.Check();
- checks.IsAtLocalSchemeShard();
- if (dstPath.IsResolved()) {
+ NSchemeShard::TPath dstPath = parentPath.Child(name);
+ {
+ NSchemeShard::TPath::TChecker checks = dstPath.Check();
+ checks.IsAtLocalSchemeShard();
+ if (dstPath.IsResolved()) {
checks
.IsResolved()
- .NotUnderDeleting()
- .FailOnExist(TPathElement::EPathType::EPathTypeRtmrVolume, acceptExisted);
- } else {
+ .NotUnderDeleting()
+ .FailOnExist(TPathElement::EPathType::EPathTypeRtmrVolume, acceptExisted);
+ } else {
checks
.NotEmpty()
- .NotResolved();
- }
-
- if (checks) {
- checks
- .IsValidLeafName()
- .DepthLimit()
- .PathsLimit()
- .DirChildrenLimit()
- .ShardsLimit(shardsToCreate)
+ .NotResolved();
+ }
+
+ if (checks) {
+ checks
+ .IsValidLeafName()
+ .DepthLimit()
+ .PathsLimit()
+ .DirChildrenLimit()
+ .ShardsLimit(shardsToCreate)
.PathShardsLimit(shardsToCreate)
.IsValidACL(acl);
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "dst path fail checks"
- << ", path: " << dstPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- if (dstPath.IsResolved()) {
- result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
- }
- return result;
- }
- }
-
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "dst path fail checks"
+ << ", path: " << dstPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ if (dstPath.IsResolved()) {
+ result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+ }
+ return result;
+ }
+ }
+
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- if (!ValidateConfig(rtmrVolumeDescription, errStr, status)) {
- result->SetError(status, errStr);
- return result;
- }
-
- TChannelsBindings channelsBinding;
- if (!context.SS->ResolveRtmrChannels(dstPath.DomainId(), channelsBinding)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable to construct channel binding with the storage pool");
- return result;
- }
-
- dstPath.MaterializeLeaf(owner);
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
-
- TPathElement::TPtr newRtmrVolume = dstPath.Base();
- newRtmrVolume->CreateTxId = OperationId.GetTxId();
- newRtmrVolume->LastTxId = OperationId.GetTxId();
- newRtmrVolume->PathState = TPathElement::EPathState::EPathStateCreate;
- newRtmrVolume->PathType = TPathElement::EPathType::EPathTypeRtmrVolume;
-
- // accepted
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxCreateRtmrVolume, newRtmrVolume->PathId);
-
- TRtmrVolumeInfo::TPtr rtmrVolumeInfo = CreateRtmrVolume(rtmrVolumeDescription, txState, context.SS);
- Y_VERIFY(rtmrVolumeInfo);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- if (parentPath.Base()->HasActiveChanges()) {
- TTxId parentTxId = parentPath.Base()->PlannedToCreate() ? parentPath.Base()->CreateTxId : parentPath.Base()->LastTxId;
- context.OnComplete.Dependence(parentTxId, OperationId.GetTxId());
- }
-
- context.SS->ChangeTxState(db, OperationId, TTxState::CreateParts);
- context.OnComplete.ActivateTx(OperationId);
-
- context.SS->RtmrVolumes[newRtmrVolume->PathId] = rtmrVolumeInfo;
- context.SS->TabletCounters->Simple()[COUNTER_RTMR_VOLUME_COUNT].Add(1);
- context.SS->TabletCounters->Simple()[COUNTER_RTMR_PARTITIONS_COUNT].Add(rtmrVolumeInfo->Partitions.size());
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ if (!ValidateConfig(rtmrVolumeDescription, errStr, status)) {
+ result->SetError(status, errStr);
+ return result;
+ }
+
+ TChannelsBindings channelsBinding;
+ if (!context.SS->ResolveRtmrChannels(dstPath.DomainId(), channelsBinding)) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable to construct channel binding with the storage pool");
+ return result;
+ }
+
+ dstPath.MaterializeLeaf(owner);
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+
+ TPathElement::TPtr newRtmrVolume = dstPath.Base();
+ newRtmrVolume->CreateTxId = OperationId.GetTxId();
+ newRtmrVolume->LastTxId = OperationId.GetTxId();
+ newRtmrVolume->PathState = TPathElement::EPathState::EPathStateCreate;
+ newRtmrVolume->PathType = TPathElement::EPathType::EPathTypeRtmrVolume;
+
+ // accepted
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxCreateRtmrVolume, newRtmrVolume->PathId);
+
+ TRtmrVolumeInfo::TPtr rtmrVolumeInfo = CreateRtmrVolume(rtmrVolumeDescription, txState, context.SS);
+ Y_VERIFY(rtmrVolumeInfo);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ if (parentPath.Base()->HasActiveChanges()) {
+ TTxId parentTxId = parentPath.Base()->PlannedToCreate() ? parentPath.Base()->CreateTxId : parentPath.Base()->LastTxId;
+ context.OnComplete.Dependence(parentTxId, OperationId.GetTxId());
+ }
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::CreateParts);
+ context.OnComplete.ActivateTx(OperationId);
+
+ context.SS->RtmrVolumes[newRtmrVolume->PathId] = rtmrVolumeInfo;
+ context.SS->TabletCounters->Simple()[COUNTER_RTMR_VOLUME_COUNT].Add(1);
+ context.SS->TabletCounters->Simple()[COUNTER_RTMR_PARTITIONS_COUNT].Add(rtmrVolumeInfo->Partitions.size());
context.SS->IncrementPathDbRefCount(newRtmrVolume->PathId);
-
- context.SS->PersistPath(db, newRtmrVolume->PathId);
-
- if (!acl.empty()) {
- newRtmrVolume->ApplyACL(acl);
- context.SS->PersistACL(db, newRtmrVolume);
- }
- context.SS->PersistRtmrVolume(db, newRtmrVolume->PathId, rtmrVolumeInfo);
- context.SS->PersistTxState(db, OperationId);
-
- context.SS->PersistUpdateNextPathId(db);
- context.SS->PersistUpdateNextShardIdx(db);
-
- TShardInfo rtmrPartitionInfo = TShardInfo::RtmrPartitionInfo(OperationId.GetTxId(), newRtmrVolume->PathId);
- rtmrPartitionInfo.BindedChannels = channelsBinding;
-
- for (const auto& part: rtmrVolumeInfo->Partitions) {
- auto shardIdx = part.second->ShardIdx;
- auto tabletId = part.second->TabletId;
-
+
+ context.SS->PersistPath(db, newRtmrVolume->PathId);
+
+ if (!acl.empty()) {
+ newRtmrVolume->ApplyACL(acl);
+ context.SS->PersistACL(db, newRtmrVolume);
+ }
+ context.SS->PersistRtmrVolume(db, newRtmrVolume->PathId, rtmrVolumeInfo);
+ context.SS->PersistTxState(db, OperationId);
+
+ context.SS->PersistUpdateNextPathId(db);
+ context.SS->PersistUpdateNextShardIdx(db);
+
+ TShardInfo rtmrPartitionInfo = TShardInfo::RtmrPartitionInfo(OperationId.GetTxId(), newRtmrVolume->PathId);
+ rtmrPartitionInfo.BindedChannels = channelsBinding;
+
+ for (const auto& part: rtmrVolumeInfo->Partitions) {
+ auto shardIdx = part.second->ShardIdx;
+ auto tabletId = part.second->TabletId;
+
context.SS->RegisterShardInfo(shardIdx, rtmrPartitionInfo);
-
- context.SS->PersistShardMapping(db, shardIdx, tabletId, newRtmrVolume->PathId, OperationId.GetTxId(), TTabletTypes::RTMRPartition);
- context.SS->PersistChannelsBinding(db, shardIdx, channelsBinding);
- }
-
- ++parentPath.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentPath.Base());
- context.SS->ClearDescribePathCaches(parentPath.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, parentPath.Base()->PathId);
-
- context.SS->ClearDescribePathCaches(newRtmrVolume);
- context.OnComplete.PublishToSchemeBoard(OperationId, newRtmrVolume->PathId);
-
+
+ context.SS->PersistShardMapping(db, shardIdx, tabletId, newRtmrVolume->PathId, OperationId.GetTxId(), TTabletTypes::RTMRPartition);
+ context.SS->PersistChannelsBinding(db, shardIdx, channelsBinding);
+ }
+
+ ++parentPath.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentPath.Base());
+ context.SS->ClearDescribePathCaches(parentPath.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentPath.Base()->PathId);
+
+ context.SS->ClearDescribePathCaches(newRtmrVolume);
+ context.OnComplete.PublishToSchemeBoard(OperationId, newRtmrVolume->PathId);
+
Y_VERIFY(shardsToCreate == txState.Shards.size(), "shardsToCreate=%ld != txStateShards=%ld",
shardsToCreate, txState.Shards.size());
-
- dstPath.DomainInfo()->IncPathsInside();
- dstPath.DomainInfo()->AddInternalShards(txState);
-
- dstPath.Base()->IncShardsInside(shardsToCreate);
- parentPath.Base()->IncAliveChildren();
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+
+ dstPath.DomainInfo()->IncPathsInside();
+ dstPath.DomainInfo()->AddInternalShards(txState);
+
+ dstPath.Base()->IncShardsInside(shardsToCreate);
+ parentPath.Base()->IncAliveChildren();
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TCreateRTMR");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateRTMR AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateRTMR AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateNewRTMR(TOperationId id, const TTxTransaction& tx) {
return new TCreateRTMR(id, tx);
}
-ISubOperationBase::TPtr CreateNewRTMR(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateNewRTMR(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TCreateRTMR(id, state);
-}
-
-}
-}
+ return new TCreateRTMR(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_sequence.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_sequence.cpp
index 1169b3d6213..3dbeecfb518 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_sequence.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_sequence.cpp
@@ -6,7 +6,7 @@
#include <ydb/core/mind/hive/hive.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
namespace {
@@ -321,12 +321,12 @@ public:
<< ", opId: " << OperationId
<< ", at schemeshard: " << ssId);
- TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
+ TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
auto result = MakeHolder<TProposeResponse>(status, ui64(OperationId.GetTxId()), ui64(ssId));
- NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
+ NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
{
- NSchemeShard::TPath::TChecker checks = parentPath.Check();
+ NSchemeShard::TPath::TChecker checks = parentPath.Check();
checks
.NotUnderDomainUpgrade()
.IsAtLocalSchemeShard()
@@ -370,9 +370,9 @@ public:
const TString acl = Transaction.GetModifyACL().GetDiffACL();
- NSchemeShard::TPath dstPath = parentPath.Child(name);
+ NSchemeShard::TPath dstPath = parentPath.Child(name);
{
- NSchemeShard::TPath::TChecker checks = dstPath.Check();
+ NSchemeShard::TPath::TChecker checks = dstPath.Check();
checks.IsAtLocalSchemeShard();
if (dstPath.IsResolved()) {
checks
@@ -416,12 +416,12 @@ public:
TString errStr;
if (!TSequenceInfo::ValidateCreate(descr, errStr)) {
- result->SetError(NKikimrScheme::StatusSchemeError, errStr);
+ result->SetError(NKikimrScheme::StatusSchemeError, errStr);
return result;
}
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
return result;
}
@@ -429,7 +429,7 @@ public:
TChannelsBindings channelsBindings;
if (shardsToCreate) {
if (!context.SS->ResolveTabletChannels(profileId, dstPath.DomainId(), channelsBindings)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter,
+ result->SetError(NKikimrScheme::StatusInvalidParameter,
"Unable to construct channel binding for sequence shard with the storage pool");
return result;
}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_solomon.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_solomon.cpp
index ed89ecc46ef..a8211698542 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_solomon.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_solomon.cpp
@@ -1,497 +1,497 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
#include <ydb/core/persqueue/config/config.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-bool ValidateConfig(const NKikimrSchemeOp::TCreateSolomonVolume& op,
- TEvSchemeShard::EStatus& status, TString& errStr)
-{
- if (op.GetPartitionCount() && op.AdoptedPartitionsSize()) {
- errStr = "mutable exclusive parametrs PartitionCount and AdoptedPartitions are set";
- status = TEvSchemeShard::EStatus::StatusInvalidParameter;
- return false;
- }
- if (op.GetPartitionCount()) {
- if (!op.HasChannelProfileId()) {
- errStr = "set channel profile id, please";
- status = TEvSchemeShard::EStatus::StatusInvalidParameter;
- }
- return true;
- }
-
- if (op.HasChannelProfileId()) {
- errStr = "don't set channel profile id, please. We are going to adopt already created tablets";
- status = TEvSchemeShard::EStatus::StatusInvalidParameter;
- }
-
- // check unique
- TSet<ui64> tabletIds;
- TSet<std::pair<ui64, ui64>> owners;
- for (auto& portion: op.GetAdoptedPartitions()) {
- if (tabletIds.contains(portion.GetTabletId())) {
- errStr = "Dublicate tabletsId in AdoptedPartitions "
- + ToString(portion.GetTabletId());
- status = TEvSchemeShard::EStatus::StatusInvalidParameter;
- return false;
- }
- tabletIds.insert(portion.GetTabletId());
-
- auto owner = std::make_pair<ui64, ui64>(portion.GetOwnerId(), portion.GetShardIdx());
- if (owners.contains(owner)) {
- errStr = "Dublicate pair owner and shard in AdoptedPartitions "
- + ToString(owner.first) + " " + ToString(owner.second);
- status = TEvSchemeShard::EStatus::StatusInvalidParameter;
- return false;
- }
- owners.insert(owner);
- }
-
- return true;
-}
-
-TSolomonVolumeInfo::TPtr CreateSolomon(const NKikimrSchemeOp::TCreateSolomonVolume& op, TTxState& state, TSchemeShard* ss)
-{
- TSolomonVolumeInfo::TPtr solomonVolume = new TSolomonVolumeInfo(1);
-
- state.Shards.clear();
- solomonVolume->Partitions.clear();
-
- ui64 newParts = op.GetPartitionCount();
- ui64 adoptedParts = op.AdoptedPartitionsSize();
-
- ui64 count = newParts + adoptedParts;
-
- state.Shards.reserve(count);
- auto startShardIdx = ss->ReserveShardIdxs(newParts);
- for (ui64 i = 0; i < newParts; ++i) {
- const auto idx = ss->NextShardIdx(startShardIdx, i);
- solomonVolume->Partitions[idx] = new TSolomonPartitionInfo(i);
- state.Shards.emplace_back(idx, TTabletTypes::KeyValue, TTxState::CreateParts);
- }
-
- startShardIdx = ss->ReserveShardIdxs(adoptedParts);
- for (ui64 i = 0; i < adoptedParts; ++i) {
- const auto idx = ss->NextShardIdx(startShardIdx, i);
- solomonVolume->Partitions[idx] = new TSolomonPartitionInfo(newParts + i, TTabletId(op.GetAdoptedPartitions(i).GetTabletId()));
- state.Shards.emplace_back(idx, TTabletTypes::KeyValue, TTxState::CreateParts);
- }
-
- return solomonVolume;
-}
-
-class TConfigureParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+bool ValidateConfig(const NKikimrSchemeOp::TCreateSolomonVolume& op,
+ TEvSchemeShard::EStatus& status, TString& errStr)
+{
+ if (op.GetPartitionCount() && op.AdoptedPartitionsSize()) {
+ errStr = "mutable exclusive parametrs PartitionCount and AdoptedPartitions are set";
+ status = TEvSchemeShard::EStatus::StatusInvalidParameter;
+ return false;
+ }
+ if (op.GetPartitionCount()) {
+ if (!op.HasChannelProfileId()) {
+ errStr = "set channel profile id, please";
+ status = TEvSchemeShard::EStatus::StatusInvalidParameter;
+ }
+ return true;
+ }
+
+ if (op.HasChannelProfileId()) {
+ errStr = "don't set channel profile id, please. We are going to adopt already created tablets";
+ status = TEvSchemeShard::EStatus::StatusInvalidParameter;
+ }
+
+ // check unique
+ TSet<ui64> tabletIds;
+ TSet<std::pair<ui64, ui64>> owners;
+ for (auto& portion: op.GetAdoptedPartitions()) {
+ if (tabletIds.contains(portion.GetTabletId())) {
+ errStr = "Dublicate tabletsId in AdoptedPartitions "
+ + ToString(portion.GetTabletId());
+ status = TEvSchemeShard::EStatus::StatusInvalidParameter;
+ return false;
+ }
+ tabletIds.insert(portion.GetTabletId());
+
+ auto owner = std::make_pair<ui64, ui64>(portion.GetOwnerId(), portion.GetShardIdx());
+ if (owners.contains(owner)) {
+ errStr = "Dublicate pair owner and shard in AdoptedPartitions "
+ + ToString(owner.first) + " " + ToString(owner.second);
+ status = TEvSchemeShard::EStatus::StatusInvalidParameter;
+ return false;
+ }
+ owners.insert(owner);
+ }
+
+ return true;
+}
+
+TSolomonVolumeInfo::TPtr CreateSolomon(const NKikimrSchemeOp::TCreateSolomonVolume& op, TTxState& state, TSchemeShard* ss)
+{
+ TSolomonVolumeInfo::TPtr solomonVolume = new TSolomonVolumeInfo(1);
+
+ state.Shards.clear();
+ solomonVolume->Partitions.clear();
+
+ ui64 newParts = op.GetPartitionCount();
+ ui64 adoptedParts = op.AdoptedPartitionsSize();
+
+ ui64 count = newParts + adoptedParts;
+
+ state.Shards.reserve(count);
+ auto startShardIdx = ss->ReserveShardIdxs(newParts);
+ for (ui64 i = 0; i < newParts; ++i) {
+ const auto idx = ss->NextShardIdx(startShardIdx, i);
+ solomonVolume->Partitions[idx] = new TSolomonPartitionInfo(i);
+ state.Shards.emplace_back(idx, TTabletTypes::KeyValue, TTxState::CreateParts);
+ }
+
+ startShardIdx = ss->ReserveShardIdxs(adoptedParts);
+ for (ui64 i = 0; i < adoptedParts; ++i) {
+ const auto idx = ss->NextShardIdx(startShardIdx, i);
+ solomonVolume->Partitions[idx] = new TSolomonPartitionInfo(newParts + i, TTabletId(op.GetAdoptedPartitions(i).GetTabletId()));
+ state.Shards.emplace_back(idx, TTabletTypes::KeyValue, TTxState::CreateParts);
+ }
+
+ return solomonVolume;
+}
+
+class TConfigureParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TCreateSolomon TConfigureParts"
- << ", operationId: " << OperationId;
- }
-
-public:
- TConfigureParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(),
- {TEvHive::TEvCreateTabletReply::EventType, TEvHive::TEvAdoptTabletReply::EventType});
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at tablet" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreateSolomonVolume);
-
- auto solomonVol = context.SS->SolomonVolumes[txState->TargetPathId];
- Y_VERIFY_S(solomonVol, "solomon volume is null. PathId: " << txState->TargetPathId);
- Y_VERIFY(solomonVol->Partitions.size() == txState->Shards.size(),
- "%" PRIu64 "solomon shards expected, %" PRIu64 " created",
- solomonVol->Partitions.size(), txState->Shards.size());
-
- for (const auto& shard: txState->Shards) {
- auto solomonPartition = solomonVol->Partitions[shard.Idx];
- Y_VERIFY_S(solomonPartition, "rtmr partitions is null shard idx: " << shard.Idx << " Path: " << txState->TargetPathId);
-
- auto tabletId = context.SS->ShardInfos[shard.Idx].TabletID;
- solomonPartition->TabletId = tabletId;
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
- return true;
- }
-};
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ return TStringBuilder()
+ << "TCreateSolomon TConfigureParts"
+ << ", operationId: " << OperationId;
+ }
+
+public:
+ TConfigureParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(),
+ {TEvHive::TEvCreateTabletReply::EventType, TEvHive::TEvAdoptTabletReply::EventType});
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at tablet" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateSolomonVolume);
+
+ auto solomonVol = context.SS->SolomonVolumes[txState->TargetPathId];
+ Y_VERIFY_S(solomonVol, "solomon volume is null. PathId: " << txState->TargetPathId);
+ Y_VERIFY(solomonVol->Partitions.size() == txState->Shards.size(),
+ "%" PRIu64 "solomon shards expected, %" PRIu64 " created",
+ solomonVol->Partitions.size(), txState->Shards.size());
+
+ for (const auto& shard: txState->Shards) {
+ auto solomonPartition = solomonVol->Partitions[shard.Idx];
+ Y_VERIFY_S(solomonPartition, "rtmr partitions is null shard idx: " << shard.Idx << " Path: " << txState->TargetPathId);
+
+ auto tabletId = context.SS->ShardInfos[shard.Idx].TabletID;
+ solomonPartition->TabletId = tabletId;
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
+ return true;
+ }
+};
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TCreateSolomon TPropose"
- << ", operationId: " << OperationId;
- }
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
+ return TStringBuilder()
+ << "TCreateSolomon TPropose"
+ << ", operationId: " << OperationId;
+ }
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
IgnoreMessages(DebugHint(),
{TEvHive::TEvCreateTabletReply::EventType, TEvHive::TEvAdoptTabletReply::EventType});
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", step: " << step
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- if(!txState) {
- return false;
- }
-
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- path->StepCreated = step;
- context.SS->PersistCreateStep(db, pathId, step);
-
- auto parentDir = context.SS->PathsById.at(path->ParentPathId);
- ++parentDir->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir);
- context.SS->ClearDescribePathCaches(parentDir);
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
-
- context.SS->ClearDescribePathCaches(path);
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", step: " << step
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ if(!txState) {
+ return false;
+ }
+
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ path->StepCreated = step;
+ context.SS->PersistCreateStep(db, pathId, step);
+
+ auto parentDir = context.SS->PathsById.at(path->ParentPathId);
+ ++parentDir->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir);
+ context.SS->ClearDescribePathCaches(parentDir);
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
+
+ context.SS->ClearDescribePathCaches(path);
context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
context.SS->ChangeTxState(db, OperationId, TTxState::Done);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreateSolomonVolume);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-class TCreateSolomon: public TSubOperation {
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateSolomonVolume);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+class TCreateSolomon: public TSubOperation {
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::CreateParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
- return TTxState::ConfigureParts;
- case TTxState::ConfigureParts:
- return TTxState::Propose;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::CreateParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
+ return TTxState::ConfigureParts;
+ case TTxState::ConfigureParts:
+ return TTxState::Propose;
case TTxState::Propose:
return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
return THolder(new TCreateParts(OperationId));
- case TTxState::ConfigureParts:
+ case TTxState::ConfigureParts:
return THolder(new TConfigureParts(OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new TPropose(OperationId));
case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TCreateSolomon(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TCreateSolomon(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
- const auto acceptExisted = !Transaction.GetFailOnExist();
+
+ TCreateSolomon(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ const auto acceptExisted = !Transaction.GetFailOnExist();
const auto& solomonDescription = Transaction.GetCreateSolomonVolume();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
- const TString& name = solomonDescription.GetName();
- const ui32 channelProfileId = solomonDescription.GetChannelProfileId();
-
- const ui64 shardsToCreate = solomonDescription.GetPartitionCount() + solomonDescription.AdoptedPartitionsSize();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateSolomon Propose"
- << ", path: "<< parentPathStr << "/" << name
- << ", opId: " << OperationId
- << ", channelProfileId: " << channelProfileId
- << ", at schemeshard: " << ssId);
-
- THolder<TProposeResponse> result;
- result.Reset(new TEvSchemeShard::TEvModifySchemeTransactionResult(
- NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId)));
-
- TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
- TString errStr;
-
- NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
- {
- NSchemeShard::TPath::TChecker checks = parentPath.Check();
- checks
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsCommonSensePath()
- .IsLikeDirectory();
-
- if (!checks) {
- TString explain = TStringBuilder() << "parent path fail checks"
- << ", path: " << parentPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
+ const TString& name = solomonDescription.GetName();
+ const ui32 channelProfileId = solomonDescription.GetChannelProfileId();
+
+ const ui64 shardsToCreate = solomonDescription.GetPartitionCount() + solomonDescription.AdoptedPartitionsSize();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateSolomon Propose"
+ << ", path: "<< parentPathStr << "/" << name
+ << ", opId: " << OperationId
+ << ", channelProfileId: " << channelProfileId
+ << ", at schemeshard: " << ssId);
+
+ THolder<TProposeResponse> result;
+ result.Reset(new TEvSchemeShard::TEvModifySchemeTransactionResult(
+ NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId)));
+
+ TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
+ TString errStr;
+
+ NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
+ {
+ NSchemeShard::TPath::TChecker checks = parentPath.Check();
+ checks
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsCommonSensePath()
+ .IsLikeDirectory();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent path fail checks"
+ << ", path: " << parentPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
const TString acl = Transaction.GetModifyACL().GetDiffACL();
- NSchemeShard::TPath dstPath = parentPath.Child(name);
- {
- NSchemeShard::TPath::TChecker checks = dstPath.Check();
- checks.IsAtLocalSchemeShard();
- if (dstPath.IsResolved()) {
+ NSchemeShard::TPath dstPath = parentPath.Child(name);
+ {
+ NSchemeShard::TPath::TChecker checks = dstPath.Check();
+ checks.IsAtLocalSchemeShard();
+ if (dstPath.IsResolved()) {
checks
.IsResolved()
- .NotUnderDeleting()
- .FailOnExist(TPathElement::EPathType::EPathTypeSolomonVolume, acceptExisted);
- } else {
+ .NotUnderDeleting()
+ .FailOnExist(TPathElement::EPathType::EPathTypeSolomonVolume, acceptExisted);
+ } else {
checks
.NotEmpty()
- .NotResolved();
- }
-
- if (checks) {
- checks
- .IsValidLeafName()
- .DepthLimit()
- .PathsLimit()
- .DirChildrenLimit()
- .ShardsLimit(shardsToCreate)
+ .NotResolved();
+ }
+
+ if (checks) {
+ checks
+ .IsValidLeafName()
+ .DepthLimit()
+ .PathsLimit()
+ .DirChildrenLimit()
+ .ShardsLimit(shardsToCreate)
.PathShardsLimit(shardsToCreate)
.IsValidACL(acl);
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "dst path fail checks"
- << ", path: " << dstPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- if (dstPath.IsResolved()) {
- result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
- }
- return result;
- }
- }
-
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "dst path fail checks"
+ << ", path: " << dstPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ if (dstPath.IsResolved()) {
+ result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+ }
+ return result;
+ }
+ }
+
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- if (!ValidateConfig(solomonDescription, status, errStr)) {
- result->SetError(status, errStr);
- return result;
- }
-
- const bool adoptingTablets = solomonDescription.AdoptedPartitionsSize() > 0;
-
- TChannelsBindings channelsBinding;
- if (!adoptingTablets && !context.SS->ResolveSolomonChannels(channelProfileId, dstPath.DomainId(), channelsBinding)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable to construct channel binding with the storage pool");
- return result;
- }
-
- dstPath.MaterializeLeaf(owner);
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
-
- TPathElement::TPtr newSolomon = dstPath.Base();
- newSolomon->CreateTxId = OperationId.GetTxId();
- newSolomon->LastTxId = OperationId.GetTxId();
- newSolomon->PathState = TPathElement::EPathState::EPathStateCreate;
- newSolomon->PathType = TPathElement::EPathType::EPathTypeSolomonVolume;
-
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxCreateSolomonVolume, newSolomon->PathId);
-
- auto solomonVolume = CreateSolomon(solomonDescription, txState, context.SS);
- if (!solomonVolume.Get()) {
- result->SetError(status, errStr);
- return result;
- }
-
- context.SS->SolomonVolumes[newSolomon->PathId] = solomonVolume;
- context.SS->TabletCounters->Simple()[COUNTER_SOLOMON_VOLUME_COUNT].Add(1);
- context.SS->TabletCounters->Simple()[COUNTER_SOLOMON_PARTITIONS_COUNT].Add(solomonVolume->Partitions.size());
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ if (!ValidateConfig(solomonDescription, status, errStr)) {
+ result->SetError(status, errStr);
+ return result;
+ }
+
+ const bool adoptingTablets = solomonDescription.AdoptedPartitionsSize() > 0;
+
+ TChannelsBindings channelsBinding;
+ if (!adoptingTablets && !context.SS->ResolveSolomonChannels(channelProfileId, dstPath.DomainId(), channelsBinding)) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable to construct channel binding with the storage pool");
+ return result;
+ }
+
+ dstPath.MaterializeLeaf(owner);
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+
+ TPathElement::TPtr newSolomon = dstPath.Base();
+ newSolomon->CreateTxId = OperationId.GetTxId();
+ newSolomon->LastTxId = OperationId.GetTxId();
+ newSolomon->PathState = TPathElement::EPathState::EPathStateCreate;
+ newSolomon->PathType = TPathElement::EPathType::EPathTypeSolomonVolume;
+
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxCreateSolomonVolume, newSolomon->PathId);
+
+ auto solomonVolume = CreateSolomon(solomonDescription, txState, context.SS);
+ if (!solomonVolume.Get()) {
+ result->SetError(status, errStr);
+ return result;
+ }
+
+ context.SS->SolomonVolumes[newSolomon->PathId] = solomonVolume;
+ context.SS->TabletCounters->Simple()[COUNTER_SOLOMON_VOLUME_COUNT].Add(1);
+ context.SS->TabletCounters->Simple()[COUNTER_SOLOMON_PARTITIONS_COUNT].Add(solomonVolume->Partitions.size());
context.SS->IncrementPathDbRefCount(newSolomon->PathId);
-
- TShardInfo solomonPartitionInfo = TShardInfo::SolomonPartitionInfo(OperationId.GetTxId(), newSolomon->PathId);
- solomonPartitionInfo.BindedChannels = channelsBinding;
-
- TMap<TTabletId, TAdoptedShard> adoptedShards;
- for (auto& portion: solomonDescription.GetAdoptedPartitions()) {
- adoptedShards[TTabletId(portion.GetTabletId())] = TAdoptedShard{portion.GetOwnerId(), TLocalShardIdx(portion.GetShardIdx())};
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- for (const auto& part: solomonVolume->Partitions) {
- TShardIdx shardIdx = part.first;
+
+ TShardInfo solomonPartitionInfo = TShardInfo::SolomonPartitionInfo(OperationId.GetTxId(), newSolomon->PathId);
+ solomonPartitionInfo.BindedChannels = channelsBinding;
+
+ TMap<TTabletId, TAdoptedShard> adoptedShards;
+ for (auto& portion: solomonDescription.GetAdoptedPartitions()) {
+ adoptedShards[TTabletId(portion.GetTabletId())] = TAdoptedShard{portion.GetOwnerId(), TLocalShardIdx(portion.GetShardIdx())};
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ for (const auto& part: solomonVolume->Partitions) {
+ TShardIdx shardIdx = part.first;
context.SS->RegisterShardInfo(shardIdx, solomonPartitionInfo);
-
- if (part.second->TabletId != InvalidTabletId) {
- auto tabletId = part.second->TabletId;
- auto& shard = adoptedShards[tabletId];
- context.SS->AdoptedShards[shardIdx] = shard;
- context.SS->PersistAdoptedShardMapping(db, shardIdx, tabletId, shard.PrevOwner, shard.PrevShardIdx);
- context.SS->ShardInfos[shardIdx].TabletID = tabletId;
- }
-
+
+ if (part.second->TabletId != InvalidTabletId) {
+ auto tabletId = part.second->TabletId;
+ auto& shard = adoptedShards[tabletId];
+ context.SS->AdoptedShards[shardIdx] = shard;
+ context.SS->PersistAdoptedShardMapping(db, shardIdx, tabletId, shard.PrevOwner, shard.PrevShardIdx);
+ context.SS->ShardInfos[shardIdx].TabletID = tabletId;
+ }
+
context.SS->PersistShardMapping(db, shardIdx, part.second->TabletId, newSolomon->PathId, OperationId.GetTxId(), solomonPartitionInfo.TabletType);
- context.SS->PersistChannelsBinding(db, shardIdx, channelsBinding);
- }
- context.SS->PersistSolomonVolume(db, newSolomon->PathId, solomonVolume);
-
- if (parentPath.Base()->HasActiveChanges()) {
- TTxId parentTxId = parentPath.Base()->PlannedToCreate() ? parentPath.Base()->CreateTxId : parentPath.Base()->LastTxId;
- context.OnComplete.Dependence(parentTxId, OperationId.GetTxId());
- }
-
- context.SS->ChangeTxState(db, OperationId, TTxState::CreateParts);
- context.OnComplete.ActivateTx(OperationId);
-
- context.SS->PersistTxState(db, OperationId);
-
- context.SS->PersistPath(db, newSolomon->PathId);
-
- if (!acl.empty()) {
- newSolomon->ApplyACL(acl);
- context.SS->PersistACL(db, newSolomon);
- }
-
- context.SS->PersistUpdateNextPathId(db);
- context.SS->PersistUpdateNextShardIdx(db);
-
- ++parentPath.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentPath.Base());
- context.SS->ClearDescribePathCaches(parentPath.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, parentPath.Base()->PathId);
-
- context.SS->ClearDescribePathCaches(newSolomon);
- context.OnComplete.PublishToSchemeBoard(OperationId, newSolomon->PathId);
-
-
-
- Y_VERIFY(shardsToCreate == txState.Shards.size());
- dstPath.DomainInfo()->IncPathsInside();
- dstPath.DomainInfo()->AddInternalShards(txState);
-
- dstPath.Base()->IncShardsInside(shardsToCreate);
- parentPath.Base()->IncAliveChildren();
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+ context.SS->PersistChannelsBinding(db, shardIdx, channelsBinding);
+ }
+ context.SS->PersistSolomonVolume(db, newSolomon->PathId, solomonVolume);
+
+ if (parentPath.Base()->HasActiveChanges()) {
+ TTxId parentTxId = parentPath.Base()->PlannedToCreate() ? parentPath.Base()->CreateTxId : parentPath.Base()->LastTxId;
+ context.OnComplete.Dependence(parentTxId, OperationId.GetTxId());
+ }
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::CreateParts);
+ context.OnComplete.ActivateTx(OperationId);
+
+ context.SS->PersistTxState(db, OperationId);
+
+ context.SS->PersistPath(db, newSolomon->PathId);
+
+ if (!acl.empty()) {
+ newSolomon->ApplyACL(acl);
+ context.SS->PersistACL(db, newSolomon);
+ }
+
+ context.SS->PersistUpdateNextPathId(db);
+ context.SS->PersistUpdateNextShardIdx(db);
+
+ ++parentPath.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentPath.Base());
+ context.SS->ClearDescribePathCaches(parentPath.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentPath.Base()->PathId);
+
+ context.SS->ClearDescribePathCaches(newSolomon);
+ context.OnComplete.PublishToSchemeBoard(OperationId, newSolomon->PathId);
+
+
+
+ Y_VERIFY(shardsToCreate == txState.Shards.size());
+ dstPath.DomainInfo()->IncPathsInside();
+ dstPath.DomainInfo()->AddInternalShards(txState);
+
+ dstPath.Base()->IncShardsInside(shardsToCreate);
+ parentPath.Base()->IncAliveChildren();
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TCreateSolomon");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateSolomon AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateSolomon AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateNewSolomon(TOperationId id, const TTxTransaction& tx) {
return new TCreateSolomon(id, tx);
}
-ISubOperationBase::TPtr CreateNewSolomon(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateNewSolomon(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TCreateSolomon(id, state);
-}
-
-}
-}
+ return new TCreateSolomon(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_subdomain.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_subdomain.cpp
index f39678fa35c..b46d7015cc8 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_subdomain.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_subdomain.cpp
@@ -1,325 +1,325 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
#include <ydb/core/persqueue/config/config.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-void DeclareShards(TTxState& txState, TTxId txId, TPathId pathId,
- ui32 count, TTabletTypes::EType type,
- const TChannelsBindings& channelsBindings,
- TSchemeShard* ss)
-{
- txState.Shards.reserve(count);
- for (ui64 i = 0; i < count; ++i) {
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+void DeclareShards(TTxState& txState, TTxId txId, TPathId pathId,
+ ui32 count, TTabletTypes::EType type,
+ const TChannelsBindings& channelsBindings,
+ TSchemeShard* ss)
+{
+ txState.Shards.reserve(count);
+ for (ui64 i = 0; i < count; ++i) {
auto shardId = ss->RegisterShardInfo(
TShardInfo(txId, pathId, type)
.WithBindedChannels(channelsBindings));
- txState.Shards.emplace_back(shardId, type, TTxState::CreateParts);
- }
-}
-
-void PersistShards(NIceDb::TNiceDb& db, TTxState& txState, TSchemeShard* ss) {
- for (const auto& shard : txState.Shards) {
- Y_VERIFY(ss->ShardInfos.contains(shard.Idx), "shard info is set before");
- auto& shardInfo = ss->ShardInfos.at(shard.Idx);
- ss->PersistShardMapping(db, shard.Idx, InvalidTabletId, shardInfo.PathId, shardInfo.CurrentTxId, shardInfo.TabletType);
- ss->PersistChannelsBinding(db, shard.Idx, shardInfo.BindedChannels);
- }
-}
-
-
-class TCreateSubDomain: public TSubOperation {
+ txState.Shards.emplace_back(shardId, type, TTxState::CreateParts);
+ }
+}
+
+void PersistShards(NIceDb::TNiceDb& db, TTxState& txState, TSchemeShard* ss) {
+ for (const auto& shard : txState.Shards) {
+ Y_VERIFY(ss->ShardInfos.contains(shard.Idx), "shard info is set before");
+ auto& shardInfo = ss->ShardInfos.at(shard.Idx);
+ ss->PersistShardMapping(db, shard.Idx, InvalidTabletId, shardInfo.PathId, shardInfo.CurrentTxId, shardInfo.TabletType);
+ ss->PersistChannelsBinding(db, shard.Idx, shardInfo.BindedChannels);
+ }
+}
+
+
+class TCreateSubDomain: public TSubOperation {
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::CreateParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
- return TTxState::ConfigureParts;
- case TTxState::ConfigureParts:
- return TTxState::Propose;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::CreateParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
+ return TTxState::ConfigureParts;
+ case TTxState::ConfigureParts:
+ return TTxState::Propose;
case TTxState::Propose:
return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
return THolder(new TCreateParts(OperationId));
- case TTxState::ConfigureParts:
+ case TTxState::ConfigureParts:
return THolder(new NSubDomainState::TConfigureParts(OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new NSubDomainState::TPropose(OperationId));
case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TCreateSubDomain(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TCreateSubDomain(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
- const auto acceptExisted = !Transaction.GetFailOnExist();
+
+ TCreateSubDomain(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ const auto acceptExisted = !Transaction.GetFailOnExist();
const auto& settings = Transaction.GetSubDomain();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = settings.GetName();
-
- ui64 shardsToCreate = settings.GetCoordinators() + settings.GetMediators();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateSubDomain Propose"
- << ", path" << parentPathStr << "/" << name
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
- auto result = MakeHolder<TProposeResponse>(status, ui64(OperationId.GetTxId()), ui64(ssId));
-
- if (!parentPathStr) {
- result->SetError(NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: no working dir");
- return result;
- }
-
- if (!name) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: no name");
- return result;
- }
-
- NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
- {
- NSchemeShard::TPath::TChecker checks = parentPath.Check();
- checks
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsCommonSensePath()
- .IsLikeDirectory();
-
- if (!checks) {
- TString explain = TStringBuilder() << "parent path fail checks"
- << ", path: " << parentPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
+
+ ui64 shardsToCreate = settings.GetCoordinators() + settings.GetMediators();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateSubDomain Propose"
+ << ", path" << parentPathStr << "/" << name
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ TEvSchemeShard::EStatus status = NKikimrScheme::StatusAccepted;
+ auto result = MakeHolder<TProposeResponse>(status, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ if (!parentPathStr) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: no working dir");
+ return result;
+ }
+
+ if (!name) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: no name");
+ return result;
+ }
+
+ NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
+ {
+ NSchemeShard::TPath::TChecker checks = parentPath.Check();
+ checks
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsCommonSensePath()
+ .IsLikeDirectory();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent path fail checks"
+ << ", path: " << parentPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
const TString acl = Transaction.GetModifyACL().GetDiffACL();
- NSchemeShard::TPath dstPath = parentPath.Child(name);
- {
- NSchemeShard::TPath::TChecker checks = dstPath.Check();
- checks.IsAtLocalSchemeShard();
- if (dstPath.IsResolved()) {
+ NSchemeShard::TPath dstPath = parentPath.Child(name);
+ {
+ NSchemeShard::TPath::TChecker checks = dstPath.Check();
+ checks.IsAtLocalSchemeShard();
+ if (dstPath.IsResolved()) {
checks
.IsResolved()
- .NotUnderDeleting()
- .FailOnExist(TPathElement::EPathType::EPathTypeSubDomain, acceptExisted);
- } else {
+ .NotUnderDeleting()
+ .FailOnExist(TPathElement::EPathType::EPathTypeSubDomain, acceptExisted);
+ } else {
checks
.NotEmpty()
- .NotResolved();
- }
-
- if (checks) {
- checks
- .IsValidLeafName()
- .DepthLimit()
- .PathsLimit() //check capacity on root Domain
- .DirChildrenLimit()
- .PathShardsLimit(shardsToCreate)
+ .NotResolved();
+ }
+
+ if (checks) {
+ checks
+ .IsValidLeafName()
+ .DepthLimit()
+ .PathsLimit() //check capacity on root Domain
+ .DirChildrenLimit()
+ .PathShardsLimit(shardsToCreate)
.ShardsLimit(shardsToCreate) //check capacity on root Domain
.IsValidACL(acl);
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "dst path fail checks"
- << ", path: " << dstPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- if (dstPath.IsResolved()) {
- result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
- }
- return result;
- }
- }
-
- const bool onlyDeclaration = settings.GetTimeCastBucketsPerMediator() == 0 &&
- settings.GetPlanResolution() == 0 &&
- settings.GetCoordinators() == 0 &&
- settings.GetMediators() == 0;
-
- if (0 == settings.GetTimeCastBucketsPerMediator() && !onlyDeclaration) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: TimeCastBucketsPerMediator is 0");
- return result;
- }
-
- if (0 == settings.GetPlanResolution() && !onlyDeclaration) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: plan resolution is 0");
- return result;
- }
-
- if (0 == settings.GetCoordinators() && 0 != settings.GetMediators()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: cant create subdomain with mediators, but no coordinators");
- return result;
- }
-
- if (0 != settings.GetCoordinators() && 0 == settings.GetMediators()) {
- result->SetError(
- NKikimrScheme::StatusInvalidParameter,
- "Malformed subdomain request: cant create subdomain with coordinators, but no mediators");
- return result;
- }
-
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "dst path fail checks"
+ << ", path: " << dstPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ if (dstPath.IsResolved()) {
+ result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+ }
+ return result;
+ }
+ }
+
+ const bool onlyDeclaration = settings.GetTimeCastBucketsPerMediator() == 0 &&
+ settings.GetPlanResolution() == 0 &&
+ settings.GetCoordinators() == 0 &&
+ settings.GetMediators() == 0;
+
+ if (0 == settings.GetTimeCastBucketsPerMediator() && !onlyDeclaration) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: TimeCastBucketsPerMediator is 0");
+ return result;
+ }
+
+ if (0 == settings.GetPlanResolution() && !onlyDeclaration) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: plan resolution is 0");
+ return result;
+ }
+
+ if (0 == settings.GetCoordinators() && 0 != settings.GetMediators()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: cant create subdomain with mediators, but no coordinators");
+ return result;
+ }
+
+ if (0 != settings.GetCoordinators() && 0 == settings.GetMediators()) {
+ result->SetError(
+ NKikimrScheme::StatusInvalidParameter,
+ "Malformed subdomain request: cant create subdomain with coordinators, but no mediators");
+ return result;
+ }
+
if (settings.HasResourcesDomainKey()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "Resources domain key unsupported for non-external subdomains");
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "Resources domain key unsupported for non-external subdomains");
return result;
}
- auto domainId = parentPath.DomainId();
- Y_VERIFY(context.SS->PathsById.contains(domainId));
- Y_VERIFY(context.SS->SubDomains.contains(domainId));
- if (domainId != context.SS->RootPathId()) {
- result->SetError(NKikimrScheme::StatusNameConflict, "Nested subdomains is forbidden");
- return result;
- }
-
- auto requestedStoragePools = TStoragePools(settings.GetStoragePools().begin(), settings.GetStoragePools().end());
- std::sort(requestedStoragePools.begin(), requestedStoragePools.end());
- auto uniqEnd = std::unique(requestedStoragePools.begin(), requestedStoragePools.end());
- if (uniqEnd != requestedStoragePools.end()) {
- if (!context.SS->ChannelProfiles || context.SS->ChannelProfiles->Profiles.size() == 0) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "Requested not uniq storage pools, for example, '" + uniqEnd->GetName() + "'");
- return result;
- }
- }
-
- TChannelsBindings channelBindings;
- if (settings.GetCoordinators() || settings.GetMediators()) {
- if (!context.SS->ResolveSubdomainsChannels(requestedStoragePools, channelBindings)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable construct channels binding");
- return result;
- }
- }
-
+ auto domainId = parentPath.DomainId();
+ Y_VERIFY(context.SS->PathsById.contains(domainId));
+ Y_VERIFY(context.SS->SubDomains.contains(domainId));
+ if (domainId != context.SS->RootPathId()) {
+ result->SetError(NKikimrScheme::StatusNameConflict, "Nested subdomains is forbidden");
+ return result;
+ }
+
+ auto requestedStoragePools = TStoragePools(settings.GetStoragePools().begin(), settings.GetStoragePools().end());
+ std::sort(requestedStoragePools.begin(), requestedStoragePools.end());
+ auto uniqEnd = std::unique(requestedStoragePools.begin(), requestedStoragePools.end());
+ if (uniqEnd != requestedStoragePools.end()) {
+ if (!context.SS->ChannelProfiles || context.SS->ChannelProfiles->Profiles.size() == 0) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "Requested not uniq storage pools, for example, '" + uniqEnd->GetName() + "'");
+ return result;
+ }
+ }
+
+ TChannelsBindings channelBindings;
+ if (settings.GetCoordinators() || settings.GetMediators()) {
+ if (!context.SS->ResolveSubdomainsChannels(requestedStoragePools, channelBindings)) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable construct channels binding");
+ return result;
+ }
+ }
+
const auto& userAttrsDetails = Transaction.GetAlterUserAttributes();
- TUserAttributes::TPtr userAttrs = new TUserAttributes(1);
+ TUserAttributes::TPtr userAttrs = new TUserAttributes(1);
TString errStr;
if (!userAttrs->ApplyPatch(EUserAttributesOp::CreateSubDomain, userAttrsDetails, errStr) ||
!userAttrs->CheckLimits(errStr))
{
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- dstPath.MaterializeLeaf(owner);
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
-
- TPathElement::TPtr newNode = dstPath.Base();
- newNode->CreateTxId = OperationId.GetTxId();
- newNode->LastTxId = OperationId.GetTxId();
- newNode->PathState = TPathElement::EPathState::EPathStateCreate;
- newNode->PathType = TPathElement::EPathType::EPathTypeSubDomain;
- newNode->UserAttrs->AlterData = userAttrs;
- newNode->DirAlterVersion = 1;
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- context.SS->PersistPath(db, newNode->PathId);
- context.SS->ApplyAndPersistUserAttrs(db, newNode->PathId);
-
- if (!acl.empty()) {
- newNode->ApplyACL(acl);
- context.SS->PersistACL(db, newNode);
- }
-
- context.SS->PersistUpdateNextPathId(db);
-
- context.SS->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_COUNT].Add(1);
-
- Y_VERIFY(!context.SS->FindTx(OperationId));
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxCreateSubDomain, newNode->PathId);
-
- TSubDomainInfo::TPtr alter = new TSubDomainInfo(
- 1,
- settings.GetPlanResolution(),
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ dstPath.MaterializeLeaf(owner);
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+
+ TPathElement::TPtr newNode = dstPath.Base();
+ newNode->CreateTxId = OperationId.GetTxId();
+ newNode->LastTxId = OperationId.GetTxId();
+ newNode->PathState = TPathElement::EPathState::EPathStateCreate;
+ newNode->PathType = TPathElement::EPathType::EPathTypeSubDomain;
+ newNode->UserAttrs->AlterData = userAttrs;
+ newNode->DirAlterVersion = 1;
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ context.SS->PersistPath(db, newNode->PathId);
+ context.SS->ApplyAndPersistUserAttrs(db, newNode->PathId);
+
+ if (!acl.empty()) {
+ newNode->ApplyACL(acl);
+ context.SS->PersistACL(db, newNode);
+ }
+
+ context.SS->PersistUpdateNextPathId(db);
+
+ context.SS->TabletCounters->Simple()[COUNTER_SUB_DOMAIN_COUNT].Add(1);
+
+ Y_VERIFY(!context.SS->FindTx(OperationId));
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxCreateSubDomain, newNode->PathId);
+
+ TSubDomainInfo::TPtr alter = new TSubDomainInfo(
+ 1,
+ settings.GetPlanResolution(),
settings.GetTimeCastBucketsPerMediator(),
newNode->PathId);
-
- alter->SetSchemeLimits(parentPath.DomainInfo()->GetSchemeLimits()); //inherit from root
-
- for(auto& pool: settings.GetStoragePools()) {
- alter->AddStoragePool(pool);
- }
-
- DeclareShards(txState, OperationId.GetTxId(), newNode->PathId, settings.GetCoordinators(), TTabletTypes::FLAT_TX_COORDINATOR, channelBindings, context.SS);
- DeclareShards(txState, OperationId.GetTxId(), newNode->PathId, settings.GetMediators(), TTabletTypes::TX_MEDIATOR, channelBindings, context.SS);
-
- for (auto& shard: txState.Shards) {
- alter->AddPrivateShard(shard.Idx);
- }
-
+
+ alter->SetSchemeLimits(parentPath.DomainInfo()->GetSchemeLimits()); //inherit from root
+
+ for(auto& pool: settings.GetStoragePools()) {
+ alter->AddStoragePool(pool);
+ }
+
+ DeclareShards(txState, OperationId.GetTxId(), newNode->PathId, settings.GetCoordinators(), TTabletTypes::FLAT_TX_COORDINATOR, channelBindings, context.SS);
+ DeclareShards(txState, OperationId.GetTxId(), newNode->PathId, settings.GetMediators(), TTabletTypes::TX_MEDIATOR, channelBindings, context.SS);
+
+ for (auto& shard: txState.Shards) {
+ alter->AddPrivateShard(shard.Idx);
+ }
+
if (settings.HasDeclaredSchemeQuotas()) {
alter->SetDeclaredSchemeQuotas(settings.GetDeclaredSchemeQuotas());
}
@@ -328,76 +328,76 @@ public:
alter->SetDatabaseQuotas(settings.GetDatabaseQuotas());
}
- Y_VERIFY(!context.SS->SubDomains.contains(newNode->PathId));
- auto& subDomainInfo = context.SS->SubDomains[newNode->PathId];
- subDomainInfo = new TSubDomainInfo();
- subDomainInfo->SetAlter(alter);
-
- PersistShards(db, txState, context.SS);
- context.SS->PersistUpdateNextShardIdx(db);
- context.SS->PersistSubDomain(db, newNode->PathId, *subDomainInfo);
- context.SS->PersistSubDomainAlter(db, newNode->PathId, *alter);
+ Y_VERIFY(!context.SS->SubDomains.contains(newNode->PathId));
+ auto& subDomainInfo = context.SS->SubDomains[newNode->PathId];
+ subDomainInfo = new TSubDomainInfo();
+ subDomainInfo->SetAlter(alter);
+
+ PersistShards(db, txState, context.SS);
+ context.SS->PersistUpdateNextShardIdx(db);
+ context.SS->PersistSubDomain(db, newNode->PathId, *subDomainInfo);
+ context.SS->PersistSubDomainAlter(db, newNode->PathId, *alter);
context.SS->IncrementPathDbRefCount(newNode->PathId);
-
- if (parentPath.Base()->HasActiveChanges()) {
- TTxId parentTxId = parentPath.Base()->PlannedToCreate() ? parentPath.Base()->CreateTxId : parentPath.Base()->LastTxId;
- context.OnComplete.Dependence(parentTxId, OperationId.GetTxId());
- }
-
- txState.State = TTxState::CreateParts;
- context.OnComplete.ActivateTx(OperationId);
-
- context.SS->PersistTxState(db, OperationId);
-
- ++parentPath.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentPath.Base());
- context.SS->ClearDescribePathCaches(parentPath.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, parentPath.Base()->PathId);
-
- context.SS->ClearDescribePathCaches(dstPath.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, dstPath.Base()->PathId);
-
-
- Y_VERIFY(shardsToCreate == txState.Shards.size());
- parentPath.DomainInfo()->IncPathsInside();
- dstPath.DomainInfo()->AddInternalShards(txState);
-
- dstPath.Base()->IncShardsInside(shardsToCreate);
- parentPath.Base()->IncAliveChildren();
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+
+ if (parentPath.Base()->HasActiveChanges()) {
+ TTxId parentTxId = parentPath.Base()->PlannedToCreate() ? parentPath.Base()->CreateTxId : parentPath.Base()->LastTxId;
+ context.OnComplete.Dependence(parentTxId, OperationId.GetTxId());
+ }
+
+ txState.State = TTxState::CreateParts;
+ context.OnComplete.ActivateTx(OperationId);
+
+ context.SS->PersistTxState(db, OperationId);
+
+ ++parentPath.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentPath.Base());
+ context.SS->ClearDescribePathCaches(parentPath.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentPath.Base()->PathId);
+
+ context.SS->ClearDescribePathCaches(dstPath.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, dstPath.Base()->PathId);
+
+
+ Y_VERIFY(shardsToCreate == txState.Shards.size());
+ parentPath.DomainInfo()->IncPathsInside();
+ dstPath.DomainInfo()->AddInternalShards(txState);
+
+ dstPath.Base()->IncShardsInside(shardsToCreate);
+ parentPath.Base()->IncAliveChildren();
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TCreateSubDomain");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateSubDomain AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateSubDomain AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateSubDomain(TOperationId id, const TTxTransaction& tx) {
return new TCreateSubDomain(id, tx);
}
-ISubOperationBase::TPtr CreateSubDomain(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateSubDomain(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TCreateSubDomain(id, state);
-}
-
-}
-}
+ return new TCreateSubDomain(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_create_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_create_table.cpp
index 7c2dee6156a..50045225298 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_create_table.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_create_table.cpp
@@ -1,579 +1,579 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/protos/flat_scheme_op.pb.h>
-
+
#include <ydb/core/base/subdomain.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-void PrepareScheme(NKikimrSchemeOp::TTableDescription& schema) {
- // Ignore column ids if they were passed by user!
- for (auto& col : *schema.MutableColumns()) {
- col.ClearId();
- }
- schema.ClearKeyColumnIds();
-}
-
-bool InitPartitioning(const NKikimrSchemeOp::TTableDescription& op,
- const NScheme::TTypeRegistry* typeRegistry,
- const TVector<ui32>& keyColIds,
- const TVector<NScheme::TTypeId>& keyColTypeIds,
- TString& errStr,
- TVector<TTableShardInfo>& partitions,
- const TSchemeLimits& limits) {
- ui32 partitionCount = 1;
- if (op.HasUniformPartitionsCount()) {
- partitionCount = op.GetUniformPartitionsCount();
- } else {
- partitionCount = op.SplitBoundarySize() + 1;
- }
-
- if (partitionCount == 0 || partitionCount > limits.MaxShardsInPath) {
- errStr = Sprintf("Invalid partition count specified: %u", partitionCount);
- return false;
- }
-
- TVector<TString> rangeEnds;
- if (op.HasUniformPartitionsCount()) {
- Y_VERIFY(!keyColIds.empty());
- NScheme::TTypeId firstKeyColType = keyColTypeIds[0];
- if (!TSchemeShard::FillUniformPartitioning(rangeEnds, keyColIds.size(), firstKeyColType, partitionCount, typeRegistry, errStr)) {
- return false;
- }
- } else {
- if (!TSchemeShard::FillSplitPartitioning(rangeEnds, keyColTypeIds, op.GetSplitBoundary(), errStr)) {
- return false;
- }
- }
-
- for (ui32 i = 0; i < rangeEnds.size(); ++i) {
- partitions.emplace_back(InvalidShardIdx, rangeEnds[i]);
- }
- // Add end of last range
- partitions.emplace_back(InvalidShardIdx, TString());
-
- // Check that range ends are sorted in ascending order
- TVector<TCell> prevKey(keyColTypeIds.size()); // Start from (NULL, NULL, .., NULL)
- for (ui32 i = 0; i < partitions.size(); ++i) {
- TSerializedCellVec key(partitions[i].EndOfRange);
- if (CompareBorders<true, true>(prevKey, key.GetCells(), true, true, keyColTypeIds) >= 0) {
- errStr = Sprintf("Partition ranges are not sorted at index %u", i);
- return false;
- }
- prevKey.assign(key.GetCells().begin(), key.GetCells().end());
- }
-
- return true;
-}
-
-
-bool DoInitPartitioning(TTableInfo::TPtr tableInfo,
- const NKikimrSchemeOp::TTableDescription& op,
- const NScheme::TTypeRegistry* typeRegistry,
- TString& errStr,
- TVector<TTableShardInfo>& partitions,
- const TSchemeLimits& limits) {
- const TVector<ui32>& keyColIds = tableInfo->KeyColumnIds;
- if (keyColIds.size() == 0) {
- errStr = Sprintf("No key columns specified");
- return false;
- }
-
- TVector<NScheme::TTypeId> keyColTypeIds;
- for (ui32 ki : keyColIds) {
- NScheme::TTypeId typeId = tableInfo->Columns[ki].PType;
-
- if (!IsAllowedKeyType(typeId)) {
- errStr = Sprintf("Column %s has wrong key type %s",
- tableInfo->Columns[ki].Name.c_str(), NScheme::GetTypeName(typeId).c_str());
- return false;
- }
-
- keyColTypeIds.push_back(typeId);
- }
-
- if (!InitPartitioning(op, typeRegistry, keyColIds, keyColTypeIds, errStr, partitions, limits)) {
- return false;
- }
-
- return true;
-}
-
-void ApplyPartitioning(TTxId txId,
- const TPathId& pathId,
- TTableInfo::TPtr tableInfo,
- TTxState& txState,
- const TChannelsBindings& bindedChannels,
- TSchemeShard* ss,
- TVector<TTableShardInfo>& partitions) {
- TShardInfo datashardInfo = TShardInfo::DataShardInfo(txId, pathId);
- datashardInfo.BindedChannels = bindedChannels;
-
- ui64 count = partitions.size();
- txState.Shards.reserve(count);
- for (ui64 i = 0; i < count; ++i) {
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+void PrepareScheme(NKikimrSchemeOp::TTableDescription& schema) {
+ // Ignore column ids if they were passed by user!
+ for (auto& col : *schema.MutableColumns()) {
+ col.ClearId();
+ }
+ schema.ClearKeyColumnIds();
+}
+
+bool InitPartitioning(const NKikimrSchemeOp::TTableDescription& op,
+ const NScheme::TTypeRegistry* typeRegistry,
+ const TVector<ui32>& keyColIds,
+ const TVector<NScheme::TTypeId>& keyColTypeIds,
+ TString& errStr,
+ TVector<TTableShardInfo>& partitions,
+ const TSchemeLimits& limits) {
+ ui32 partitionCount = 1;
+ if (op.HasUniformPartitionsCount()) {
+ partitionCount = op.GetUniformPartitionsCount();
+ } else {
+ partitionCount = op.SplitBoundarySize() + 1;
+ }
+
+ if (partitionCount == 0 || partitionCount > limits.MaxShardsInPath) {
+ errStr = Sprintf("Invalid partition count specified: %u", partitionCount);
+ return false;
+ }
+
+ TVector<TString> rangeEnds;
+ if (op.HasUniformPartitionsCount()) {
+ Y_VERIFY(!keyColIds.empty());
+ NScheme::TTypeId firstKeyColType = keyColTypeIds[0];
+ if (!TSchemeShard::FillUniformPartitioning(rangeEnds, keyColIds.size(), firstKeyColType, partitionCount, typeRegistry, errStr)) {
+ return false;
+ }
+ } else {
+ if (!TSchemeShard::FillSplitPartitioning(rangeEnds, keyColTypeIds, op.GetSplitBoundary(), errStr)) {
+ return false;
+ }
+ }
+
+ for (ui32 i = 0; i < rangeEnds.size(); ++i) {
+ partitions.emplace_back(InvalidShardIdx, rangeEnds[i]);
+ }
+ // Add end of last range
+ partitions.emplace_back(InvalidShardIdx, TString());
+
+ // Check that range ends are sorted in ascending order
+ TVector<TCell> prevKey(keyColTypeIds.size()); // Start from (NULL, NULL, .., NULL)
+ for (ui32 i = 0; i < partitions.size(); ++i) {
+ TSerializedCellVec key(partitions[i].EndOfRange);
+ if (CompareBorders<true, true>(prevKey, key.GetCells(), true, true, keyColTypeIds) >= 0) {
+ errStr = Sprintf("Partition ranges are not sorted at index %u", i);
+ return false;
+ }
+ prevKey.assign(key.GetCells().begin(), key.GetCells().end());
+ }
+
+ return true;
+}
+
+
+bool DoInitPartitioning(TTableInfo::TPtr tableInfo,
+ const NKikimrSchemeOp::TTableDescription& op,
+ const NScheme::TTypeRegistry* typeRegistry,
+ TString& errStr,
+ TVector<TTableShardInfo>& partitions,
+ const TSchemeLimits& limits) {
+ const TVector<ui32>& keyColIds = tableInfo->KeyColumnIds;
+ if (keyColIds.size() == 0) {
+ errStr = Sprintf("No key columns specified");
+ return false;
+ }
+
+ TVector<NScheme::TTypeId> keyColTypeIds;
+ for (ui32 ki : keyColIds) {
+ NScheme::TTypeId typeId = tableInfo->Columns[ki].PType;
+
+ if (!IsAllowedKeyType(typeId)) {
+ errStr = Sprintf("Column %s has wrong key type %s",
+ tableInfo->Columns[ki].Name.c_str(), NScheme::GetTypeName(typeId).c_str());
+ return false;
+ }
+
+ keyColTypeIds.push_back(typeId);
+ }
+
+ if (!InitPartitioning(op, typeRegistry, keyColIds, keyColTypeIds, errStr, partitions, limits)) {
+ return false;
+ }
+
+ return true;
+}
+
+void ApplyPartitioning(TTxId txId,
+ const TPathId& pathId,
+ TTableInfo::TPtr tableInfo,
+ TTxState& txState,
+ const TChannelsBindings& bindedChannels,
+ TSchemeShard* ss,
+ TVector<TTableShardInfo>& partitions) {
+ TShardInfo datashardInfo = TShardInfo::DataShardInfo(txId, pathId);
+ datashardInfo.BindedChannels = bindedChannels;
+
+ ui64 count = partitions.size();
+ txState.Shards.reserve(count);
+ for (ui64 i = 0; i < count; ++i) {
auto idx = ss->RegisterShardInfo(datashardInfo);
- txState.Shards.emplace_back(idx, ETabletType::DataShard, TTxState::CreateParts);
- partitions[i].ShardIdx = idx;
- }
-
+ txState.Shards.emplace_back(idx, ETabletType::DataShard, TTxState::CreateParts);
+ partitions[i].ShardIdx = idx;
+ }
+
ss->SetPartitioning(pathId, tableInfo, std::move(partitions));
-}
-
-
-class TConfigureParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+}
+
+
+class TConfigureParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TCreateTable TConfigureParts"
- << " operationId#" << OperationId;
- }
-
-public:
- TConfigureParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvProposeTransactionResult"
- << " at tabletId# " << ssId);
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvProposeTransactionResult"
- << " message: " << ev->Get()->Record.ShortDebugString());
-
- return NTableState::CollectProposeTransactionResults(OperationId, ev, context);
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << " at tabletId# " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState->TxType == TTxState::TxCreateTable);
-
+ return TStringBuilder()
+ << "TCreateTable TConfigureParts"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TConfigureParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvProposeTransactionResult"
+ << " at tabletId# " << ssId);
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvProposeTransactionResult"
+ << " message: " << ev->Get()->Record.ShortDebugString());
+
+ return NTableState::CollectProposeTransactionResults(OperationId, ev, context);
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << " at tabletId# " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateTable);
+
NKikimrTxDataShard::TFlatSchemeTransaction txTemplate;
context.SS->FillAsyncIndexInfo(txState->TargetPathId, txTemplate);
- txState->ClearShardsInProgress();
-
+ txState->ClearShardsInProgress();
+
const ui64 subDomainPathId = context.SS->ResolveDomainId(txState->TargetPathId).LocalPathId;
- for (ui32 i = 0; i < txState->Shards.size(); ++i) {
- TShardIdx shardIdx = txState->Shards[i].Idx;
- TTabletId datashardId = context.SS->ShardInfos[shardIdx].TabletID;
-
- auto seqNo = context.SS->StartRound(*txState);
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << " Propose modify scheme on datashard"
- << " datashardId: " << datashardId
- << " seqNo: " << seqNo);
-
+ for (ui32 i = 0; i < txState->Shards.size(); ++i) {
+ TShardIdx shardIdx = txState->Shards[i].Idx;
+ TTabletId datashardId = context.SS->ShardInfos[shardIdx].TabletID;
+
+ auto seqNo = context.SS->StartRound(*txState);
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << " Propose modify scheme on datashard"
+ << " datashardId: " << datashardId
+ << " seqNo: " << seqNo);
+
NKikimrTxDataShard::TFlatSchemeTransaction tx(txTemplate);
auto tableDesc = tx.MutableCreateTable();
- context.SS->FillSeqNo(tx, seqNo);
+ context.SS->FillSeqNo(tx, seqNo);
context.SS->FillTableDescription(txState->TargetPathId, i, NEW_TABLE_ALTER_VERSION, tableDesc);
- TString txBody;
+ TString txBody;
Y_PROTOBUF_SUPPRESS_NODISCARD tx.SerializeToString(&txBody);
-
- THolder<TEvDataShard::TEvProposeTransaction> event =
+
+ THolder<TEvDataShard::TEvProposeTransaction> event =
THolder(new TEvDataShard::TEvProposeTransaction(NKikimrTxDataShard::TX_KIND_SCHEME,
- context.SS->TabletID(),
+ context.SS->TabletID(),
subDomainPathId,
- context.Ctx.SelfID,
- ui64(OperationId.GetTxId()),
- txBody,
+ context.Ctx.SelfID,
+ ui64(OperationId.GetTxId()),
+ txBody,
context.SS->SelectProcessingPrarams(txState->TargetPathId)));
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << " Propose modify scheme on datashard"
- << " datashardId: " << datashardId
- << " message: " << event->Record.ShortDebugString());
-
- context.OnComplete.BindMsgToPipe(OperationId, datashardId, shardIdx, event.Release());
- }
-
- txState->UpdateShardsInProgress();
- return false;
- }
-};
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << " Propose modify scheme on datashard"
+ << " datashardId: " << datashardId
+ << " message: " << event->Record.ShortDebugString());
+
+ context.OnComplete.BindMsgToPipe(OperationId, datashardId, shardIdx, event.Release());
+ }
+
+ txState->UpdateShardsInProgress();
+ return false;
+ }
+};
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TCreateTable TPropose"
- << " operationId#" << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- const auto& evRecord = ev->Get()->Record;
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvSchemaChanged"
- << " at tablet: " << ssId);
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvSchemaChanged"
- << " triggered early"
- << ", message: " << evRecord.ShortDebugString());
-
- NTableState::CollectSchemaChanged(OperationId, ev, context);
- return false;
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << " at tablet: " << ssId
- << ", stepId: " << step);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState->TxType == TTxState::TxCreateTable);
-
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- path->StepCreated = step;
- context.SS->PersistCreateStep(db, pathId, step);
-
- TTableInfo::TPtr table = context.SS->Tables[pathId];
- Y_VERIFY(table);
+ return TStringBuilder()
+ << "TCreateTable TPropose"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ const auto& evRecord = ev->Get()->Record;
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvSchemaChanged"
+ << " at tablet: " << ssId);
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvSchemaChanged"
+ << " triggered early"
+ << ", message: " << evRecord.ShortDebugString());
+
+ NTableState::CollectSchemaChanged(OperationId, ev, context);
+ return false;
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << " at tablet: " << ssId
+ << ", stepId: " << step);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateTable);
+
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ path->StepCreated = step;
+ context.SS->PersistCreateStep(db, pathId, step);
+
+ TTableInfo::TPtr table = context.SS->Tables[pathId];
+ Y_VERIFY(table);
table->AlterVersion = NEW_TABLE_ALTER_VERSION;
if (table->IsTTLEnabled()) {
context.SS->TTLEnabledTables[pathId] = table;
context.SS->TabletCounters->Simple()[COUNTER_TTL_ENABLED_TABLE_COUNT].Add(1);
}
- context.SS->PersistTableCreated(db, pathId);
-
- auto parentDir = context.SS->PathsById.at(path->ParentPathId);
- if (parentDir->IsDirectory() || parentDir->IsDomainRoot()) {
- ++parentDir->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir);
- }
- context.SS->ClearDescribePathCaches(parentDir);
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
-
- context.SS->ClearDescribePathCaches(path);
- context.OnComplete.PublishToSchemeBoard(OperationId, path->PathId);
-
- context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply ProgressState"
- << " at tablet: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxCreateTable);
-
- TSet<TTabletId> shardSet;
- for (const auto& shard : txState->Shards) {
- TShardIdx idx = shard.Idx;
- TTabletId tablet = context.SS->ShardInfos.at(idx).TabletID;
- shardSet.insert(tablet);
- }
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, txState->MinStep, shardSet);
- return false;
- }
-};
-
-class TCreateTable: public TSubOperation {
- const TOperationId OperationId;
+ context.SS->PersistTableCreated(db, pathId);
+
+ auto parentDir = context.SS->PathsById.at(path->ParentPathId);
+ if (parentDir->IsDirectory() || parentDir->IsDomainRoot()) {
+ ++parentDir->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir);
+ }
+ context.SS->ClearDescribePathCaches(parentDir);
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
+
+ context.SS->ClearDescribePathCaches(path);
+ context.OnComplete.PublishToSchemeBoard(OperationId, path->PathId);
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply ProgressState"
+ << " at tablet: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxCreateTable);
+
+ TSet<TTabletId> shardSet;
+ for (const auto& shard : txState->Shards) {
+ TShardIdx idx = shard.Idx;
+ TTabletId tablet = context.SS->ShardInfos.at(idx).TabletID;
+ shardSet.insert(tablet);
+ }
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, txState->MinStep, shardSet);
+ return false;
+ }
+};
+
+class TCreateTable: public TSubOperation {
+ const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- bool AllowShadowData = false;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ bool AllowShadowData = false;
THashSet<TString> LocalSequences;
-
- TTxState::ETxState NextState() {
- return TTxState::CreateParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
- return TTxState::ConfigureParts;
- case TTxState::ConfigureParts:
- return TTxState::Propose;
- case TTxState::Propose:
- return TTxState::ProposedWaitParts;
- case TTxState::ProposedWaitParts:
- return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
+
+ TTxState::ETxState NextState() {
+ return TTxState::CreateParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
+ return TTxState::ConfigureParts;
+ case TTxState::ConfigureParts:
+ return TTxState::Propose;
+ case TTxState::Propose:
+ return TTxState::ProposedWaitParts;
+ case TTxState::ProposedWaitParts:
+ return TTxState::Done;
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
return THolder(new TCreateParts(OperationId));
- case TTxState::ConfigureParts:
+ case TTxState::ConfigureParts:
return THolder(new TConfigureParts(OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new TPropose(OperationId));
- case TTxState::ProposedWaitParts:
+ case TTxState::ProposedWaitParts:
return THolder(new NTableState::TProposedWaitParts(OperationId));
- case TTxState::Done:
+ case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TCreateTable(TOperationId id, const TTxTransaction& tx)
: OperationId(id)
, Transaction(tx)
{
}
- TCreateTable(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- void SetAllowShadowDataForBuildIndex() {
- AllowShadowData = true;
- }
-
+ TCreateTable(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ void SetAllowShadowDataForBuildIndex() {
+ AllowShadowData = true;
+ }
+
void SetLocalSequences(const THashSet<TString>& localSequences) {
LocalSequences = localSequences;
}
- bool IsShadowDataAllowed() const {
- return AllowShadowData || AppData()->AllowShadowDataInSchemeShardForTests;
- }
-
- THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
- const auto acceptExisted = !Transaction.GetFailOnExist();
+ bool IsShadowDataAllowed() const {
+ return AllowShadowData || AppData()->AllowShadowDataInSchemeShardForTests;
+ }
+
+ THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ const auto acceptExisted = !Transaction.GetFailOnExist();
auto schema = Transaction.GetCreateTable();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
- const TString& name = schema.GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateTable Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateTable Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", opId: " << OperationId
- << ", schema: " << schema.ShortDebugString()
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
- {
- NSchemeShard::TPath::TChecker checks = parentPath.Check();
+ const TString& name = schema.GetName();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateTable Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateTable Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", opId: " << OperationId
+ << ", schema: " << schema.ShortDebugString()
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
+ {
+ NSchemeShard::TPath::TChecker checks = parentPath.Check();
checks
- .NotUnderDomainUpgrade()
+ .NotUnderDomainUpgrade()
.IsAtLocalSchemeShard()
.IsResolved()
.NotDeleted()
.NotUnderDeleting();
-
- if (checks) {
- if (parentPath.Base()->IsTableIndex()) {
- checks.IsInsideTableIndexPath()
- .IsUnderCreating(NKikimrScheme::StatusNameConflict)
- .IsUnderTheSameOperation(OperationId.GetTxId()); //allow only as part of creating base table
- } else {
- checks.IsCommonSensePath()
- .IsLikeDirectory();
- }
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "parent path fail checks"
- << ", path: " << parentPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- ui32 shardsToCreate = TTableInfo::ShardsToCreate(schema);
+
+ if (checks) {
+ if (parentPath.Base()->IsTableIndex()) {
+ checks.IsInsideTableIndexPath()
+ .IsUnderCreating(NKikimrScheme::StatusNameConflict)
+ .IsUnderTheSameOperation(OperationId.GetTxId()); //allow only as part of creating base table
+ } else {
+ checks.IsCommonSensePath()
+ .IsLikeDirectory();
+ }
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent path fail checks"
+ << ", path: " << parentPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ ui32 shardsToCreate = TTableInfo::ShardsToCreate(schema);
const TString acl = Transaction.GetModifyACL().GetDiffACL();
-
- NSchemeShard::TPath dstPath = parentPath.Child(name);
- {
- NSchemeShard::TPath::TChecker checks = dstPath.Check();
- checks.IsAtLocalSchemeShard();
- if (dstPath.IsResolved()) {
+
+ NSchemeShard::TPath dstPath = parentPath.Child(name);
+ {
+ NSchemeShard::TPath::TChecker checks = dstPath.Check();
+ checks.IsAtLocalSchemeShard();
+ if (dstPath.IsResolved()) {
checks
.IsResolved()
- .NotUnderDeleting()
- .FailOnExist(TPathElement::EPathType::EPathTypeTable, acceptExisted);
- } else {
+ .NotUnderDeleting()
+ .FailOnExist(TPathElement::EPathType::EPathTypeTable, acceptExisted);
+ } else {
checks
.NotEmpty()
- .NotResolved();
- }
-
- if (checks) {
- if (!parentPath.Base()->IsTableIndex()) {
- checks.DepthLimit();
- }
-
- checks
- .IsValidLeafName()
- .PathsLimit()
- .DirChildrenLimit()
- .ShardsLimit(shardsToCreate)
+ .NotResolved();
+ }
+
+ if (checks) {
+ if (!parentPath.Base()->IsTableIndex()) {
+ checks.DepthLimit();
+ }
+
+ checks
+ .IsValidLeafName()
+ .PathsLimit()
+ .DirChildrenLimit()
+ .ShardsLimit(shardsToCreate)
.PathShardsLimit(shardsToCreate)
.IsValidACL(acl);
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "dst path fail checks"
- << ", path: " << dstPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- if (dstPath.IsResolved()) {
- result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
- }
- return result;
- }
- }
-
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "dst path fail checks"
+ << ", path: " << dstPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ if (dstPath.IsResolved()) {
+ result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+ }
+ return result;
+ }
+ }
+
if (schema.GetIsBackup()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "Cannot create table with explicit 'IsBackup' property");
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "Cannot create table with explicit 'IsBackup' property");
return result;
}
- if (parentPath.Base()->IsTableIndex()) {
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Creating private table for table index"
- << ", opId: " << OperationId);
+ if (parentPath.Base()->IsTableIndex()) {
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Creating private table for table index"
+ << ", opId: " << OperationId);
if (schema.HasTTLSettings()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "TTL on index table is not supported");
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "TTL on index table is not supported");
return result;
}
- }
-
- auto domainInfo = parentPath.DomainInfo();
- bool transactionSupport = domainInfo->IsSupportTransactions();
- if (domainInfo->GetAlter()) {
- TPathId domainId = dstPath.DomainId();
- Y_VERIFY(context.SS->PathsById.contains(domainId));
- TPathElement::TPtr domain = context.SS->PathsById.at(domainId);
- Y_VERIFY(domain->PlannedToCreate() || domain->HasActiveChanges());
-
- transactionSupport |= domainInfo->GetAlter()->IsSupportTransactions();
- }
- if (!transactionSupport) {
- result->SetError(NKikimrScheme::StatusNameConflict, "Inclusive subDomian do not support shared transactions");
- return result;
- }
-
- PrepareScheme(schema);
-
+ }
+
+ auto domainInfo = parentPath.DomainInfo();
+ bool transactionSupport = domainInfo->IsSupportTransactions();
+ if (domainInfo->GetAlter()) {
+ TPathId domainId = dstPath.DomainId();
+ Y_VERIFY(context.SS->PathsById.contains(domainId));
+ TPathElement::TPtr domain = context.SS->PathsById.at(domainId);
+ Y_VERIFY(domain->PlannedToCreate() || domain->HasActiveChanges());
+
+ transactionSupport |= domainInfo->GetAlter()->IsSupportTransactions();
+ }
+ if (!transactionSupport) {
+ result->SetError(NKikimrScheme::StatusNameConflict, "Inclusive subDomian do not support shared transactions");
+ return result;
+ }
+
+ PrepareScheme(schema);
+
TString errStr;
- NKikimrSchemeOp::TPartitionConfig compilationPartitionConfig;
- if (!TPartitionConfigMerger::ApplyChanges(compilationPartitionConfig, TPartitionConfigMerger::DefaultConfig(AppData()), schema.GetPartitionConfig(), AppData(), errStr)
- || !TPartitionConfigMerger::VerifyCreateParams(compilationPartitionConfig, AppData(), IsShadowDataAllowed(), errStr)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
- schema.MutablePartitionConfig()->CopyFrom(compilationPartitionConfig);
-
- const NScheme::TTypeRegistry* typeRegistry = AppData()->TypeRegistry;
+ NKikimrSchemeOp::TPartitionConfig compilationPartitionConfig;
+ if (!TPartitionConfigMerger::ApplyChanges(compilationPartitionConfig, TPartitionConfigMerger::DefaultConfig(AppData()), schema.GetPartitionConfig(), AppData(), errStr)
+ || !TPartitionConfigMerger::VerifyCreateParams(compilationPartitionConfig, AppData(), IsShadowDataAllowed(), errStr)) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+ schema.MutablePartitionConfig()->CopyFrom(compilationPartitionConfig);
+
+ const NScheme::TTypeRegistry* typeRegistry = AppData()->TypeRegistry;
const TSchemeLimits& limits = domainInfo->GetSchemeLimits();
TTableInfo::TAlterDataPtr alterData = TTableInfo::CreateAlterData(nullptr, schema, *typeRegistry, limits, *domainInfo, errStr, LocalSequences);
- if (!alterData.Get()) {
- result->SetError(NKikimrScheme::StatusSchemeError, errStr);
- return result;
- }
-
- TTableInfo::TPtr tableInfo = new TTableInfo(std::move(*alterData));
- alterData.Reset();
-
- TVector<TTableShardInfo> partitions;
-
- if (!DoInitPartitioning(tableInfo, schema, typeRegistry, errStr, partitions, domainInfo->GetSchemeLimits())) {
- result->SetError(NKikimrScheme::StatusSchemeError, errStr);
- return result;
- }
- Y_VERIFY(shardsToCreate == partitions.size());
-
- TChannelsBindings channelsBinding;
-
+ if (!alterData.Get()) {
+ result->SetError(NKikimrScheme::StatusSchemeError, errStr);
+ return result;
+ }
+
+ TTableInfo::TPtr tableInfo = new TTableInfo(std::move(*alterData));
+ alterData.Reset();
+
+ TVector<TTableShardInfo> partitions;
+
+ if (!DoInitPartitioning(tableInfo, schema, typeRegistry, errStr, partitions, domainInfo->GetSchemeLimits())) {
+ result->SetError(NKikimrScheme::StatusSchemeError, errStr);
+ return result;
+ }
+ Y_VERIFY(shardsToCreate == partitions.size());
+
+ TChannelsBindings channelsBinding;
+
bool storePerShardConfig = false;
- NKikimrSchemeOp::TPartitionConfig perShardConfig;
+ NKikimrSchemeOp::TPartitionConfig perShardConfig;
- if (context.SS->IsStorageConfigLogic(tableInfo)) {
+ if (context.SS->IsStorageConfigLogic(tableInfo)) {
TVector<TStorageRoom> storageRooms;
THashMap<ui32, ui32> familyRooms;
storageRooms.emplace_back(0);
if (!context.SS->GetBindingsRooms(dstPath.DomainId(), tableInfo->PartitionConfig(), storageRooms, familyRooms, channelsBinding, errStr)) {
- errStr = TString("database doesn't have required storage pools to create tablet with storage config, details: ") + errStr;
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
+ errStr = TString("database doesn't have required storage pools to create tablet with storage config, details: ") + errStr;
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
tableInfo->SetRoom(storageRooms[0]);
storePerShardConfig = true;
@@ -585,148 +585,148 @@ public:
protoFamily->SetId(familyRoom.first);
protoFamily->SetRoom(familyRoom.second);
}
- } else if (context.SS->IsCompatibleChannelProfileLogic(dstPath.DomainId(), tableInfo)) {
- if (!context.SS->GetChannelsBindings(dstPath.DomainId(), tableInfo, channelsBinding, errStr)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
- }
-
+ } else if (context.SS->IsCompatibleChannelProfileLogic(dstPath.DomainId(), tableInfo)) {
+ if (!context.SS->GetChannelsBindings(dstPath.DomainId(), tableInfo, channelsBinding, errStr)) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+ }
+
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
TUserAttributes::TPtr userAttrs = new TUserAttributes(1);
const auto& userAttrsDetails = Transaction.GetAlterUserAttributes();
if (!userAttrs->ApplyPatch(EUserAttributesOp::CreateTable, userAttrsDetails, errStr) ||
!userAttrs->CheckLimits(errStr))
{
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
return result;
}
- dstPath.MaterializeLeaf(owner);
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
-
- TPathElement::TPtr newTable = dstPath.Base();
- newTable->CreateTxId = OperationId.GetTxId();
- newTable->LastTxId = OperationId.GetTxId();
- newTable->PathState = TPathElement::EPathState::EPathStateCreate;
- newTable->PathType = TPathElement::EPathType::EPathTypeTable;
+ dstPath.MaterializeLeaf(owner);
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+
+ TPathElement::TPtr newTable = dstPath.Base();
+ newTable->CreateTxId = OperationId.GetTxId();
+ newTable->LastTxId = OperationId.GetTxId();
+ newTable->PathState = TPathElement::EPathState::EPathStateCreate;
+ newTable->PathType = TPathElement::EPathType::EPathTypeTable;
newTable->UserAttrs->AlterData = userAttrs;
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxCreateTable, newTable->PathId);
-
- ApplyPartitioning(OperationId.GetTxId(), newTable->PathId, tableInfo, txState, channelsBinding, context.SS, partitions);
-
- Y_VERIFY(tableInfo->GetPartitions().back().EndOfRange.empty(), "End of last range must be +INF");
-
- context.SS->Tables[newTable->PathId] = tableInfo;
- context.SS->TabletCounters->Simple()[COUNTER_TABLE_COUNT].Add(1);
- context.SS->IncrementPathDbRefCount(newTable->PathId, "new path created");
-
- if ((parentPath.Base()->IsDirectory() || parentPath.Base()->IsDomainRoot()) && parentPath.Base()->HasActiveChanges()) {
- TTxId parentTxId = parentPath.Base()->PlannedToCreate() ? parentPath.Base()->CreateTxId : parentPath.Base()->LastTxId;
- context.OnComplete.Dependence(parentTxId, OperationId.GetTxId());
- }
-
- context.SS->ChangeTxState(db, OperationId, TTxState::CreateParts);
- context.OnComplete.ActivateTx(OperationId);
-
- context.SS->PersistPath(db, newTable->PathId);
- context.SS->ApplyAndPersistUserAttrs(db, newTable->PathId);
-
- if (!acl.empty()) {
- newTable->ApplyACL(acl);
- context.SS->PersistACL(db, newTable);
- }
- context.SS->PersistTable(db, newTable->PathId);
- context.SS->PersistTxState(db, OperationId);
-
- context.SS->PersistUpdateNextPathId(db);
- context.SS->PersistUpdateNextShardIdx(db);
- // Persist new shards info
- for (const auto& shard : tableInfo->GetPartitions()) {
- Y_VERIFY(context.SS->ShardInfos.contains(shard.ShardIdx), "shard info is set before");
- auto tabletType = context.SS->ShardInfos[shard.ShardIdx].TabletType;
- const auto& bindedChannels = context.SS->ShardInfos[shard.ShardIdx].BindedChannels;
- context.SS->PersistShardMapping(db, shard.ShardIdx, InvalidTabletId, newTable->PathId, OperationId.GetTxId(), tabletType);
- context.SS->PersistChannelsBinding(db, shard.ShardIdx, bindedChannels);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxCreateTable, newTable->PathId);
+
+ ApplyPartitioning(OperationId.GetTxId(), newTable->PathId, tableInfo, txState, channelsBinding, context.SS, partitions);
+
+ Y_VERIFY(tableInfo->GetPartitions().back().EndOfRange.empty(), "End of last range must be +INF");
+
+ context.SS->Tables[newTable->PathId] = tableInfo;
+ context.SS->TabletCounters->Simple()[COUNTER_TABLE_COUNT].Add(1);
+ context.SS->IncrementPathDbRefCount(newTable->PathId, "new path created");
+
+ if ((parentPath.Base()->IsDirectory() || parentPath.Base()->IsDomainRoot()) && parentPath.Base()->HasActiveChanges()) {
+ TTxId parentTxId = parentPath.Base()->PlannedToCreate() ? parentPath.Base()->CreateTxId : parentPath.Base()->LastTxId;
+ context.OnComplete.Dependence(parentTxId, OperationId.GetTxId());
+ }
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::CreateParts);
+ context.OnComplete.ActivateTx(OperationId);
+
+ context.SS->PersistPath(db, newTable->PathId);
+ context.SS->ApplyAndPersistUserAttrs(db, newTable->PathId);
+
+ if (!acl.empty()) {
+ newTable->ApplyACL(acl);
+ context.SS->PersistACL(db, newTable);
+ }
+ context.SS->PersistTable(db, newTable->PathId);
+ context.SS->PersistTxState(db, OperationId);
+
+ context.SS->PersistUpdateNextPathId(db);
+ context.SS->PersistUpdateNextShardIdx(db);
+ // Persist new shards info
+ for (const auto& shard : tableInfo->GetPartitions()) {
+ Y_VERIFY(context.SS->ShardInfos.contains(shard.ShardIdx), "shard info is set before");
+ auto tabletType = context.SS->ShardInfos[shard.ShardIdx].TabletType;
+ const auto& bindedChannels = context.SS->ShardInfos[shard.ShardIdx].BindedChannels;
+ context.SS->PersistShardMapping(db, shard.ShardIdx, InvalidTabletId, newTable->PathId, OperationId.GetTxId(), tabletType);
+ context.SS->PersistChannelsBinding(db, shard.ShardIdx, bindedChannels);
if (storePerShardConfig) {
tableInfo->PerShardPartitionConfig[shard.ShardIdx].CopyFrom(perShardConfig);
context.SS->PersistAddTableShardPartitionConfig(db, shard.ShardIdx, perShardConfig);
}
- }
-
- if (parentPath.Base()->IsDirectory() || parentPath.Base()->IsDomainRoot()) {
- ++parentPath.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentPath.Base());
- }
- context.SS->ClearDescribePathCaches(parentPath.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, parentPath.Base()->PathId);
-
- context.SS->ClearDescribePathCaches(dstPath.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, dstPath.Base()->PathId);
-
- Y_VERIFY(shardsToCreate == txState.Shards.size());
- dstPath.DomainInfo()->IncPathsInside();
- dstPath.DomainInfo()->AddInternalShards(txState);
-
- dstPath.Base()->IncShardsInside(shardsToCreate);
- parentPath.Base()->IncAliveChildren();
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+ }
+
+ if (parentPath.Base()->IsDirectory() || parentPath.Base()->IsDomainRoot()) {
+ ++parentPath.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentPath.Base());
+ }
+ context.SS->ClearDescribePathCaches(parentPath.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentPath.Base()->PathId);
+
+ context.SS->ClearDescribePathCaches(dstPath.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, dstPath.Base()->PathId);
+
+ Y_VERIFY(shardsToCreate == txState.Shards.size());
+ dstPath.DomainInfo()->IncPathsInside();
+ dstPath.DomainInfo()->AddInternalShards(txState);
+
+ dstPath.Base()->IncShardsInside(shardsToCreate);
+ parentPath.Base()->IncAliveChildren();
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TCreateTable");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TCreateTable AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TCreateTable AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateNewTable(TOperationId id, const TTxTransaction& tx, const THashSet<TString>& localSequences) {
auto obj = MakeHolder<TCreateTable>(id, tx);
obj->SetLocalSequences(localSequences);
return obj.Release();
}
-ISubOperationBase::TPtr CreateNewTable(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state != TTxState::Invalid);
- return new TCreateTable(id, state);
-}
-
-ISubOperationBase::TPtr CreateInitializeBuildIndexImplTable(TOperationId id, const TTxTransaction& tx) {
- auto obj = MakeHolder<TCreateTable>(id, tx);
- obj->SetAllowShadowDataForBuildIndex();
- return obj.Release();
-}
-
-ISubOperationBase::TPtr CreateInitializeBuildIndexImplTable(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state != TTxState::Invalid);
- auto obj = MakeHolder<TCreateTable>(id, state);
- obj->SetAllowShadowDataForBuildIndex();
- return obj.Release();
-}
-
-}
-}
+ISubOperationBase::TPtr CreateNewTable(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state != TTxState::Invalid);
+ return new TCreateTable(id, state);
+}
+
+ISubOperationBase::TPtr CreateInitializeBuildIndexImplTable(TOperationId id, const TTxTransaction& tx) {
+ auto obj = MakeHolder<TCreateTable>(id, tx);
+ obj->SetAllowShadowDataForBuildIndex();
+ return obj.Release();
+}
+
+ISubOperationBase::TPtr CreateInitializeBuildIndexImplTable(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state != TTxState::Invalid);
+ auto obj = MakeHolder<TCreateTable>(id, state);
+ obj->SetAllowShadowDataForBuildIndex();
+ return obj.Release();
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_db_changes.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_db_changes.cpp
index 73a113e254f..0fd238ee181 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_db_changes.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_db_changes.cpp
@@ -1,35 +1,35 @@
-#include "schemeshard__operation_db_changes.h"
-
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_db_changes.h"
+
+#include "schemeshard_impl.h"
+
#include <ydb/core/tx/tx_processing.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-void TStorageChanges::Apply(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext& txc, const TActorContext&) {
- NIceDb::TNiceDb db(txc.DB);
-
- for (const auto& pId: Pathes) {
- ss->PersistPath(db, pId);
- }
-
- for (const auto& pId: AlterUserAttrs) {
- ss->PersistAlterUserAttributes(db, pId);
- }
-
- for (const auto& pId: ApplyUserAttrs) {
- ss->ApplyAndPersistUserAttrs(db, pId);
- }
-
- for (const auto& pId: AlterIndexes) {
- ss->PersistTableIndexAlterData(db, pId);
- }
-
- for (const auto& pId: ApplyIndexes) {
- ss->PersistTableIndex(db, pId);
- }
-
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+void TStorageChanges::Apply(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext& txc, const TActorContext&) {
+ NIceDb::TNiceDb db(txc.DB);
+
+ for (const auto& pId: Pathes) {
+ ss->PersistPath(db, pId);
+ }
+
+ for (const auto& pId: AlterUserAttrs) {
+ ss->PersistAlterUserAttributes(db, pId);
+ }
+
+ for (const auto& pId: ApplyUserAttrs) {
+ ss->ApplyAndPersistUserAttrs(db, pId);
+ }
+
+ for (const auto& pId: AlterIndexes) {
+ ss->PersistTableIndexAlterData(db, pId);
+ }
+
+ for (const auto& pId: ApplyIndexes) {
+ ss->PersistTableIndex(db, pId);
+ }
+
for (const auto& pId: AlterCdcStreams) {
ss->PersistCdcStreamAlterData(db, pId);
}
@@ -38,31 +38,31 @@ void TStorageChanges::Apply(TSchemeShard* ss, NTabletFlatExecutor::TTransactionC
ss->PersistCdcStream(db, pId);
}
- for (const auto& pId: Tables) {
- ss->PersistTable(db, pId);
- }
-
- for (const auto& shardIdx: Shards) {
- const TShardInfo& shardInfo = ss->ShardInfos.at(shardIdx);
- const TPathId& pId = shardInfo.PathId;
- const TTableInfo::TPtr tableInfo = ss->Tables.at(pId);
-
- ss->PersistShardMapping(db, shardIdx, shardInfo.TabletID, pId, shardInfo.CurrentTxId, shardInfo.TabletType);
- ss->PersistChannelsBinding(db, shardIdx, shardInfo.BindedChannels);
-
- if (tableInfo->PerShardPartitionConfig.contains(shardIdx)) {
- ss->PersistAddTableShardPartitionConfig(db, shardIdx, tableInfo->PerShardPartitionConfig.at(shardIdx));
- }
- }
-
- for (const auto& opId: TxStates) {
- ss->PersistTxState(db, opId);
- }
-
- ss->PersistUpdateNextPathId(db);
- ss->PersistUpdateNextShardIdx(db);
-}
-
-
-}
-}
+ for (const auto& pId: Tables) {
+ ss->PersistTable(db, pId);
+ }
+
+ for (const auto& shardIdx: Shards) {
+ const TShardInfo& shardInfo = ss->ShardInfos.at(shardIdx);
+ const TPathId& pId = shardInfo.PathId;
+ const TTableInfo::TPtr tableInfo = ss->Tables.at(pId);
+
+ ss->PersistShardMapping(db, shardIdx, shardInfo.TabletID, pId, shardInfo.CurrentTxId, shardInfo.TabletType);
+ ss->PersistChannelsBinding(db, shardIdx, shardInfo.BindedChannels);
+
+ if (tableInfo->PerShardPartitionConfig.contains(shardIdx)) {
+ ss->PersistAddTableShardPartitionConfig(db, shardIdx, tableInfo->PerShardPartitionConfig.at(shardIdx));
+ }
+ }
+
+ for (const auto& opId: TxStates) {
+ ss->PersistTxState(db, opId);
+ }
+
+ ss->PersistUpdateNextPathId(db);
+ ss->PersistUpdateNextShardIdx(db);
+}
+
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_db_changes.h b/ydb/core/tx/schemeshard/schemeshard__operation_db_changes.h
index b3a51964294..84a22a34ef0 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_db_changes.h
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_db_changes.h
@@ -1,63 +1,63 @@
-#pragma once
-
-#include "schemeshard_identificators.h"
-#include "schemeshard_path_element.h"
-#include "schemeshard_info_types.h"
-
+#pragma once
+
+#include "schemeshard_identificators.h"
+#include "schemeshard_path_element.h"
+#include "schemeshard_info_types.h"
+
#include <ydb/core/tablet_flat/tablet_flat_executor.h>
-
-#include <util/generic/ptr.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-class TSchemeShard;
-
-class TStorageChanges: public TSimpleRefCount<TStorageChanges> {
- TDeque<TPathId> Pathes;
-
- TDeque<TPathId> Tables;
-
- TDeque<TShardIdx> Shards;
-
- TDeque<TPathId> AlterUserAttrs;
- TDeque<TPathId> ApplyUserAttrs;
-
- TDeque<TPathId> AlterIndexes;
- TDeque<TPathId> ApplyIndexes;
-
+
+#include <util/generic/ptr.h>
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+class TSchemeShard;
+
+class TStorageChanges: public TSimpleRefCount<TStorageChanges> {
+ TDeque<TPathId> Pathes;
+
+ TDeque<TPathId> Tables;
+
+ TDeque<TShardIdx> Shards;
+
+ TDeque<TPathId> AlterUserAttrs;
+ TDeque<TPathId> ApplyUserAttrs;
+
+ TDeque<TPathId> AlterIndexes;
+ TDeque<TPathId> ApplyIndexes;
+
TDeque<TPathId> AlterCdcStreams;
TDeque<TPathId> ApplyCdcStreams;
- TDeque<TOperationId> TxStates;
-
-public:
- ~TStorageChanges() = default;
-
- void PersistPath(const TPathId& pathId) {
- Pathes.push_back(pathId);
- }
-
- void PersistTable(const TPathId& pathId) {
- Tables.push_back(pathId);
- }
-
- void PersistAlterUserAttrs(const TPathId& pathId) {
- AlterUserAttrs.push_back(pathId);
- }
-
- void PersistApplyUserAttrs(const TPathId& pathId) {
- ApplyUserAttrs.push_back(pathId);
- }
-
- void PersistAlterIndex(const TPathId& pathId) {
- AlterIndexes.push_back(pathId);
- }
-
- void PersistApplyIndex(const TPathId& pathId) {
- ApplyIndexes.push_back(pathId);
- }
-
+ TDeque<TOperationId> TxStates;
+
+public:
+ ~TStorageChanges() = default;
+
+ void PersistPath(const TPathId& pathId) {
+ Pathes.push_back(pathId);
+ }
+
+ void PersistTable(const TPathId& pathId) {
+ Tables.push_back(pathId);
+ }
+
+ void PersistAlterUserAttrs(const TPathId& pathId) {
+ AlterUserAttrs.push_back(pathId);
+ }
+
+ void PersistApplyUserAttrs(const TPathId& pathId) {
+ ApplyUserAttrs.push_back(pathId);
+ }
+
+ void PersistAlterIndex(const TPathId& pathId) {
+ AlterIndexes.push_back(pathId);
+ }
+
+ void PersistApplyIndex(const TPathId& pathId) {
+ ApplyIndexes.push_back(pathId);
+ }
+
void PersistAlterCdcStream(const TPathId& pathId) {
AlterCdcStreams.push_back(pathId);
}
@@ -66,16 +66,16 @@ public:
ApplyCdcStreams.push_back(pathId);
}
- void PersistTxState(const TOperationId& opId) {
- TxStates.push_back(opId);
- }
-
- void PersistShard(const TShardIdx& shardIdx) {
- Shards.push_back(shardIdx);
- }
-
- void Apply(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx);
-};
-
-}
-}
+ void PersistTxState(const TOperationId& opId) {
+ TxStates.push_back(opId);
+ }
+
+ void PersistShard(const TShardIdx& shardIdx) {
+ Shards.push_back(shardIdx);
+ }
+
+ void Apply(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx);
+};
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_bsv.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_bsv.cpp
index 331c128886d..e6f0322026a 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_bsv.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_bsv.cpp
@@ -1,104 +1,104 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TDeleteParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TDeleteParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropBlockStoreVolume TDeleteParts"
- << ", operationId: " << OperationId;
- }
-
-public:
- TDeleteParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState->TxType == TTxState::TxDropBlockStoreVolume);
-
- // Initiate asynchonous deletion of all shards
- for (auto shard : txState->Shards) {
- context.OnComplete.DeleteShard(shard.Idx);
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
- return true;
- }
-};
-
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ return TStringBuilder()
+ << "TDropBlockStoreVolume TDeleteParts"
+ << ", operationId: " << OperationId;
+ }
+
+public:
+ TDeleteParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState->TxType == TTxState::TxDropBlockStoreVolume);
+
+ // Initiate asynchonous deletion of all shards
+ for (auto shard : txState->Shards) {
+ context.OnComplete.DeleteShard(shard.Idx);
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
+ return true;
+ }
+};
+
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropBlockStoreVolume TPropose"
- << ", operationId: " << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", step: " << step
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState->TxType == TTxState::TxDropBlockStoreVolume);
-
- TPathId pathId = txState->TargetPathId;
- auto path = context.SS->PathsById.at(pathId);
- auto parentDir = context.SS->PathsById.at(path->ParentPathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- Y_VERIFY(!path->Dropped());
- path->SetDropped(step, OperationId.GetTxId());
- context.SS->PersistDropStep(db, pathId, step, OperationId);
- auto domainInfo = context.SS->ResolveDomainInfo(pathId);
- domainInfo->DecPathsInside();
- parentDir->DecAliveChildren();
-
- // KIKIMR-13173
- // Repeat it here for a waile, delete it from TDeleteParts after
- // Initiate asynchonous deletion of all shards
- for (auto shard : txState->Shards) {
- context.OnComplete.DeleteShard(shard.Idx);
- }
-
- TBlockStoreVolumeInfo::TPtr volume = context.SS->BlockStoreVolumes.at(pathId);
-
+ return TStringBuilder()
+ << "TDropBlockStoreVolume TPropose"
+ << ", operationId: " << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", step: " << step
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState->TxType == TTxState::TxDropBlockStoreVolume);
+
+ TPathId pathId = txState->TargetPathId;
+ auto path = context.SS->PathsById.at(pathId);
+ auto parentDir = context.SS->PathsById.at(path->ParentPathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ Y_VERIFY(!path->Dropped());
+ path->SetDropped(step, OperationId.GetTxId());
+ context.SS->PersistDropStep(db, pathId, step, OperationId);
+ auto domainInfo = context.SS->ResolveDomainInfo(pathId);
+ domainInfo->DecPathsInside();
+ parentDir->DecAliveChildren();
+
+ // KIKIMR-13173
+ // Repeat it here for a waile, delete it from TDeleteParts after
+ // Initiate asynchonous deletion of all shards
+ for (auto shard : txState->Shards) {
+ context.OnComplete.DeleteShard(shard.Idx);
+ }
+
+ TBlockStoreVolumeInfo::TPtr volume = context.SS->BlockStoreVolumes.at(pathId);
+
auto volumeSpace = volume->GetVolumeSpace();
auto domainDir = context.SS->PathsById.at(context.SS->ResolveDomainId(path));
domainDir->ChangeVolumeSpaceCommit({ }, volumeSpace);
@@ -107,237 +107,237 @@ public:
context.SS->PersistRemoveBlockStoreVolume(db, pathId);
}
- context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size());
- context.SS->PersistUserAttributes(db, path->PathId, path->UserAttrs, nullptr);
-
- ++parentDir->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir);
- context.SS->ClearDescribePathCaches(parentDir);
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
-
- context.SS->ClearDescribePathCaches(path);
+ context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size());
+ context.SS->PersistUserAttributes(db, path->PathId, path->UserAttrs, nullptr);
+
+ ++parentDir->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir);
+ context.SS->ClearDescribePathCaches(parentDir);
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
+
+ context.SS->ClearDescribePathCaches(path);
context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
- context.OnComplete.DoneOperation(OperationId);
-
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxDropBlockStoreVolume);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-
-class TDropBlockStoreVolume: public TSubOperation {
+ context.OnComplete.DoneOperation(OperationId);
+
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxDropBlockStoreVolume);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+
+class TDropBlockStoreVolume: public TSubOperation {
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::DeleteParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::DeleteParts:
- return TTxState::Propose;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::DeleteParts:
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::DeleteParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::DeleteParts:
+ return TTxState::Propose;
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::DeleteParts:
return THolder(new TDeleteParts(OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new TPropose(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TDropBlockStoreVolume(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TDropBlockStoreVolume(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+
+ TDropBlockStoreVolume(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const auto& drop = Transaction.GetDrop();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = drop.GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropBlockStoreVolume Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", pathId: " << drop.GetId()
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- TPath path = drop.HasId()
- ? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
- : TPath::Resolve(parentPathStr, context.SS).Dive(name);
-
- {
- TPath::TChecker checks = path.Check();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropBlockStoreVolume Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", pathId: " << drop.GetId()
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ TPath path = drop.HasId()
+ ? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
+ : TPath::Resolve(parentPathStr, context.SS).Dive(name);
+
+ {
+ TPath::TChecker checks = path.Check();
checks
.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .IsBlockStoreVolume()
- .NotUnderDeleting()
- .NotUnderOperation()
- .IsCommonSensePath();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path table fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .IsBlockStoreVolume()
+ .NotUnderDeleting()
+ .NotUnderOperation()
+ .IsCommonSensePath();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path table fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
if (path.IsResolved() && path.Base()->IsBlockStoreVolume() && path.Base()->PlannedToDrop()) {
- result->SetPathDropTxId(ui64(path.Base()->DropTxId));
- result->SetPathId(path.Base()->PathId.LocalPathId);
+ result->SetPathDropTxId(ui64(path.Base()->DropTxId));
+ result->SetPathId(path.Base()->PathId.LocalPathId);
}
- return result;
- }
- }
-
+ return result;
+ }
+ }
+
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxDropBlockStoreVolume, path.Base()->PathId);
- // Dirty hack: drop step must not be zero because 0 is treated as "hasn't been dropped"
- txState.MinStep = TStepId(1);
- txState.State = TTxState::DeleteParts;
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- TBlockStoreVolumeInfo::TPtr volume = context.SS->BlockStoreVolumes.at(path.Base()->PathId);
- Y_VERIFY(volume);
-
- TVector<TShardIdx> shards;
- shards.push_back(volume->VolumeShardIdx);
-
- for (const auto& kv : volume->Shards) {
- shards.push_back(kv.first);
- }
-
- for (const auto& shardIdx : shards) {
- txState.Shards.emplace_back(shardIdx, context.SS->ShardInfos.at(shardIdx).TabletType, txState.State);
-
- context.SS->ShardInfos[shardIdx].CurrentTxId = OperationId.GetTxId();
- context.SS->PersistShardTx(db, shardIdx, OperationId.GetTxId());
- }
-
- // Trying to abort Alter/Create. Wait if can't.
- context.OnComplete.ActivateTx(OperationId);
- context.SS->PersistTxState(db, OperationId);
-
- path.Base()->PathState = TPathElement::EPathState::EPathStateDrop;
- path.Base()->DropTxId = OperationId.GetTxId();
- path.Base()->LastTxId = OperationId.GetTxId();
-
- context.SS->TabletCounters->Simple()[COUNTER_BLOCKSTORE_VOLUME_COUNT].Sub(1);
-
- auto parentDir = path.Parent();
- ++parentDir.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
- context.SS->ClearDescribePathCaches(parentDir.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir.Base()->PathId);
-
- context.SS->ClearDescribePathCaches(path.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxDropBlockStoreVolume, path.Base()->PathId);
+ // Dirty hack: drop step must not be zero because 0 is treated as "hasn't been dropped"
+ txState.MinStep = TStepId(1);
+ txState.State = TTxState::DeleteParts;
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ TBlockStoreVolumeInfo::TPtr volume = context.SS->BlockStoreVolumes.at(path.Base()->PathId);
+ Y_VERIFY(volume);
+
+ TVector<TShardIdx> shards;
+ shards.push_back(volume->VolumeShardIdx);
+
+ for (const auto& kv : volume->Shards) {
+ shards.push_back(kv.first);
+ }
+
+ for (const auto& shardIdx : shards) {
+ txState.Shards.emplace_back(shardIdx, context.SS->ShardInfos.at(shardIdx).TabletType, txState.State);
+
+ context.SS->ShardInfos[shardIdx].CurrentTxId = OperationId.GetTxId();
+ context.SS->PersistShardTx(db, shardIdx, OperationId.GetTxId());
+ }
+
+ // Trying to abort Alter/Create. Wait if can't.
+ context.OnComplete.ActivateTx(OperationId);
+ context.SS->PersistTxState(db, OperationId);
+
+ path.Base()->PathState = TPathElement::EPathState::EPathStateDrop;
+ path.Base()->DropTxId = OperationId.GetTxId();
+ path.Base()->LastTxId = OperationId.GetTxId();
+
+ context.SS->TabletCounters->Simple()[COUNTER_BLOCKSTORE_VOLUME_COUNT].Sub(1);
+
+ auto parentDir = path.Parent();
+ ++parentDir.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
+ context.SS->ClearDescribePathCaches(parentDir.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir.Base()->PathId);
+
+ context.SS->ClearDescribePathCaches(path.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TDropBlockStoreVolume");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropBlockStorageVolume AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropBlockStorageVolume AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- TPathId pathId = txState->TargetPathId;
- Y_VERIFY(context.SS->PathsById.contains(pathId));
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
- Y_VERIFY(path);
-
- if (path->Dropped()) {
- for (auto shard : txState->Shards) {
- context.OnComplete.DeleteShard(shard.Idx);
- }
- }
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ TPathId pathId = txState->TargetPathId;
+ Y_VERIFY(context.SS->PathsById.contains(pathId));
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+ Y_VERIFY(path);
+
+ if (path->Dropped()) {
+ for (auto shard : txState->Shards) {
+ context.OnComplete.DeleteShard(shard.Idx);
+ }
+ }
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateDropBSV(TOperationId id, const TTxTransaction& tx) {
return new TDropBlockStoreVolume(id, tx);
}
-ISubOperationBase::TPtr CreateDropBSV(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateDropBSV(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TDropBlockStoreVolume(id, state);
-}
-
-}
-}
+ return new TDropBlockStoreVolume(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_cdc_stream.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_cdc_stream.cpp
index 44386c0b7e3..9d02b90e0dd 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_cdc_stream.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_cdc_stream.cpp
@@ -7,7 +7,7 @@
#define LOG_N(stream) LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "[" << context.SS->TabletID() << "] " << stream)
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
namespace {
@@ -125,7 +125,7 @@ public:
SetState(SelectStateFunc(state));
}
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
const auto& workingDir = Transaction.GetWorkingDir();
const auto& op = Transaction.GetDrop();
const auto& streamName = op.GetName();
@@ -134,7 +134,7 @@ public:
<< ": opId# " << OperationId
<< ", stream# " << workingDir << "/" << streamName);
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), context.SS->TabletID());
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), context.SS->TabletID());
const auto streamPath = op.HasId()
? TPath::Init(context.SS->MakeLocalId(op.GetId()), context.SS)
@@ -192,7 +192,7 @@ public:
streamPath.Base()->DropTxId = OperationId.GetTxId();
streamPath.Base()->LastTxId = OperationId.GetTxId();
- context.SS->TabletCounters->Simple()[COUNTER_CDC_STREAMS_COUNT].Sub(1);
+ context.SS->TabletCounters->Simple()[COUNTER_CDC_STREAMS_COUNT].Sub(1);
context.SS->ClearDescribePathCaches(streamPath.Base());
context.OnComplete.PublishToSchemeBoard(OperationId, streamPath.Base()->PathId);
context.OnComplete.ActivateTx(OperationId);
@@ -318,7 +318,7 @@ public:
SetState(SelectStateFunc(state));
}
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
const auto& workingDir = Transaction.GetWorkingDir();
const auto& op = Transaction.GetDropCdcStream();
const auto& tableName = op.GetTableName();
@@ -328,7 +328,7 @@ public:
<< ": opId# " << OperationId
<< ", stream# " << workingDir << "/" << tableName << "/" << streamName);
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), context.SS->TabletID());
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), context.SS->TabletID());
const auto tablePath = TPath::Resolve(workingDir, context.SS).Dive(tableName);
{
@@ -375,12 +375,12 @@ public:
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
return result;
}
if (!context.SS->CheckLocks(tablePath.Base()->PathId, Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
+ result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
return result;
}
@@ -402,7 +402,7 @@ public:
auto& txState = context.SS->CreateTx(OperationId, TTxState::TxDropCdcStreamAtTable, tablePath.Base()->PathId);
txState.State = TTxState::ConfigureParts;
- tablePath.Base()->PathState = NKikimrSchemeOp::EPathStateAlter;
+ tablePath.Base()->PathState = NKikimrSchemeOp::EPathStateAlter;
tablePath.Base()->LastTxId = OperationId.GetTxId();
for (const auto& splitOpId : table->GetSplitOpsInFlight()) {
@@ -454,7 +454,7 @@ ISubOperationBase::TPtr CreateDropCdcStreamAtTable(TOperationId id, TTxState::ET
}
TVector<ISubOperationBase::TPtr> CreateDropCdcStream(TOperationId opId, const TTxTransaction& tx, TOperationContext& context) {
- Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpDropCdcStream);
+ Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpDropCdcStream);
LOG_D("CreateDropCdcStream"
<< ": opId# " << opId
@@ -509,24 +509,24 @@ TVector<ISubOperationBase::TPtr> CreateDropCdcStream(TOperationId opId, const TT
TString errStr;
if (!context.SS->CheckApplyIf(tx, errStr)) {
- return {CreateReject(opId, NKikimrScheme::StatusPreconditionFailed, errStr)};
+ return {CreateReject(opId, NKikimrScheme::StatusPreconditionFailed, errStr)};
}
if (!context.SS->CheckLocks(tablePath.Base()->PathId, tx, errStr)) {
- return {CreateReject(opId, NKikimrScheme::StatusMultipleModifications, errStr)};
+ return {CreateReject(opId, NKikimrScheme::StatusMultipleModifications, errStr)};
}
TVector<ISubOperationBase::TPtr> result;
{
- auto outTx = TransactionTemplate(workingDirPath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpDropCdcStreamAtTable);
+ auto outTx = TransactionTemplate(workingDirPath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpDropCdcStreamAtTable);
outTx.MutableDropCdcStream()->CopyFrom(op);
result.push_back(CreateDropCdcStreamAtTable(NextPartId(opId, result), outTx));
}
{
- auto outTx = TransactionTemplate(tablePath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpDropCdcStreamImpl);
+ auto outTx = TransactionTemplate(tablePath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpDropCdcStreamImpl);
outTx.MutableDrop()->SetName(streamPath.Base()->Name);
result.push_back(CreateDropCdcStreamImpl(NextPartId(opId, result), outTx));
@@ -552,5 +552,5 @@ TVector<ISubOperationBase::TPtr> CreateDropCdcStream(TOperationId opId, const TT
return result;
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_extsubdomain.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_extsubdomain.cpp
index 7776995351d..c33f76ca93d 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_extsubdomain.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_extsubdomain.cpp
@@ -1,426 +1,426 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TDeletePrivateShards: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TDeletePrivateShards: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropExtSubdomain TDeletePrivateShards"
- << ", operationId: " << OperationId;
- }
-
-public:
- TDeletePrivateShards(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), AllIncomingEvents());
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
-
- // Initiate asynchonous deletion of all shards
- for (auto shard : txState->Shards) {
- context.OnComplete.DeleteShard(shard.Idx);
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::Done);
- return true;
- }
-};
-
-class TDeleteExternalShards: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ return TStringBuilder()
+ << "TDropExtSubdomain TDeletePrivateShards"
+ << ", operationId: " << OperationId;
+ }
+
+public:
+ TDeletePrivateShards(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), AllIncomingEvents());
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+
+ // Initiate asynchonous deletion of all shards
+ for (auto shard : txState->Shards) {
+ context.OnComplete.DeleteShard(shard.Idx);
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::Done);
+ return true;
+ }
+};
+
+class TDeleteExternalShards: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropExtSubdomain TDeleteExternalShards"
- << ", operationId: " << OperationId;
- }
-
-public:
- TDeleteExternalShards(TOperationId id)
- : OperationId(id)
- {
- TSet<ui32> toIgnore = AllIncomingEvents();
- toIgnore.erase(TEvHive::TEvDeleteOwnerTabletsReply::EventType);
-
- IgnoreMessages(DebugHint(), toIgnore);
- }
-
- bool HandleReply(TEvHive::TEvDeleteOwnerTabletsReply::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- NKikimrHive::TEvDeleteOwnerTabletsReply record = ev->Get()->Record;
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TDeleteExternalShards"
- << ", Status: " << NKikimrProto::EReplyStatus_Name(record.GetStatus())
- << ", from Hive: " << record.GetOrigin()
- << ", Owner: " << record.GetOwner()
- << ", at schemeshard: " << ssId);
-
- if (record.GetStatus() != NKikimrProto::EReplyStatus::OK && record.GetStatus() != NKikimrProto::EReplyStatus::ALREADY) {
- TStringBuilder errMsg;
- errMsg << DebugHint()
- << " Unexpected answer status from hive "
- << ", msg: " << record.ShortDebugString()
- << ", at schemeshard: " << ssId;
- LOG_ERROR_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, errMsg);
- Y_VERIFY_DEBUG_S(false, errMsg);
- return false;
- }
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxForceDropExtSubDomain);
-
- TTabletId hive = TTabletId(record.GetOrigin());
- context.OnComplete.UnbindMsgFromPipe(OperationId, hive, TPipeMessageId(0, 0));
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::DeletePrivateShards);
-
- return true;
- }
-
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxForceDropExtSubDomain);
-
- TSubDomainInfo::TPtr domainInfo = context.SS->SubDomains.at(txState->TargetPathId);
- domainInfo->Initialize(context.SS->ShardInfos);
-
- TTabletId tenantSchemeshard = domainInfo->GetTenantSchemeShardID();
-
- if (!tenantSchemeshard) { // ext_subdomain was't altered at all, and there has't been added tenantSchemeshard
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::DeletePrivateShards);
- return true;
- }
-
- TTabletId hiveToRequest = context.SS->ResolveHive(txState->TargetPathId, context.Ctx);
-
- auto event = MakeHolder<TEvHive::TEvDeleteOwnerTablets>(ui64(tenantSchemeshard), ui64(OperationId.GetTxId()));
- context.OnComplete.BindMsgToPipe(OperationId, hiveToRequest, TPipeMessageId(0, 0), event.Release());
-
- return false;
- }
-};
-
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ return TStringBuilder()
+ << "TDropExtSubdomain TDeleteExternalShards"
+ << ", operationId: " << OperationId;
+ }
+
+public:
+ TDeleteExternalShards(TOperationId id)
+ : OperationId(id)
+ {
+ TSet<ui32> toIgnore = AllIncomingEvents();
+ toIgnore.erase(TEvHive::TEvDeleteOwnerTabletsReply::EventType);
+
+ IgnoreMessages(DebugHint(), toIgnore);
+ }
+
+ bool HandleReply(TEvHive::TEvDeleteOwnerTabletsReply::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ NKikimrHive::TEvDeleteOwnerTabletsReply record = ev->Get()->Record;
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TDeleteExternalShards"
+ << ", Status: " << NKikimrProto::EReplyStatus_Name(record.GetStatus())
+ << ", from Hive: " << record.GetOrigin()
+ << ", Owner: " << record.GetOwner()
+ << ", at schemeshard: " << ssId);
+
+ if (record.GetStatus() != NKikimrProto::EReplyStatus::OK && record.GetStatus() != NKikimrProto::EReplyStatus::ALREADY) {
+ TStringBuilder errMsg;
+ errMsg << DebugHint()
+ << " Unexpected answer status from hive "
+ << ", msg: " << record.ShortDebugString()
+ << ", at schemeshard: " << ssId;
+ LOG_ERROR_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, errMsg);
+ Y_VERIFY_DEBUG_S(false, errMsg);
+ return false;
+ }
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxForceDropExtSubDomain);
+
+ TTabletId hive = TTabletId(record.GetOrigin());
+ context.OnComplete.UnbindMsgFromPipe(OperationId, hive, TPipeMessageId(0, 0));
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::DeletePrivateShards);
+
+ return true;
+ }
+
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxForceDropExtSubDomain);
+
+ TSubDomainInfo::TPtr domainInfo = context.SS->SubDomains.at(txState->TargetPathId);
+ domainInfo->Initialize(context.SS->ShardInfos);
+
+ TTabletId tenantSchemeshard = domainInfo->GetTenantSchemeShardID();
+
+ if (!tenantSchemeshard) { // ext_subdomain was't altered at all, and there has't been added tenantSchemeshard
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::DeletePrivateShards);
+ return true;
+ }
+
+ TTabletId hiveToRequest = context.SS->ResolveHive(txState->TargetPathId, context.Ctx);
+
+ auto event = MakeHolder<TEvHive::TEvDeleteOwnerTablets>(ui64(tenantSchemeshard), ui64(OperationId.GetTxId()));
+ context.OnComplete.BindMsgToPipe(OperationId, hiveToRequest, TPipeMessageId(0, 0), event.Release());
+
+ return false;
+ }
+};
+
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropExtSubdomain TPropose"
- << ", operationId: " << OperationId;
- }
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- TSet<ui32> toIgnore = AllIncomingEvents();
- toIgnore.erase(TEvPrivate::TEvOperationPlan::EventType);
-
- IgnoreMessages(DebugHint(), toIgnore);
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", step: " << step
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState->TxType == TTxState::TxForceDropExtSubDomain);
-
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- auto pathes = context.SS->ListSubThee(pathId, context.Ctx);
- context.SS->DropPathes(pathes, step, OperationId.GetTxId(), db, context.Ctx);
-
- auto parentDir = context.SS->PathsById.at(path->ParentPathId);
- ++parentDir->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir);
- context.SS->ClearDescribePathCaches(parentDir);
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
-
- for (auto id: pathes) {
- context.OnComplete.PublishToSchemeBoard(OperationId, id);
- }
-
- context.SS->ChangeTxState(db, OperationId, TTxState::DeleteExternalShards);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxForceDropExtSubDomain);
-
- auto pathes = context.SS->ListSubThee(txState->TargetPathId, context.Ctx);
- NForceDrop::ValidateNoTrasactionOnPathes(OperationId, pathes, context);
- context.SS->MarkAsDroping({txState->TargetPathId}, OperationId.GetTxId(), context.Ctx);
- NForceDrop::CollectShards(pathes, OperationId, txState, context);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-
-class TDropExtSubdomain: public TSubOperation {
- const TOperationId OperationId;
- const TTxTransaction Transaction;
-
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::Propose;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Propose:
- return TTxState::DeleteExternalShards;
- case TTxState::DeleteExternalShards:
- return TTxState::DeletePrivateShards;
- case TTxState::DeletePrivateShards:
- return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::Propose:
+ return TStringBuilder()
+ << "TDropExtSubdomain TPropose"
+ << ", operationId: " << OperationId;
+ }
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ TSet<ui32> toIgnore = AllIncomingEvents();
+ toIgnore.erase(TEvPrivate::TEvOperationPlan::EventType);
+
+ IgnoreMessages(DebugHint(), toIgnore);
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", step: " << step
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState->TxType == TTxState::TxForceDropExtSubDomain);
+
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ auto pathes = context.SS->ListSubThee(pathId, context.Ctx);
+ context.SS->DropPathes(pathes, step, OperationId.GetTxId(), db, context.Ctx);
+
+ auto parentDir = context.SS->PathsById.at(path->ParentPathId);
+ ++parentDir->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir);
+ context.SS->ClearDescribePathCaches(parentDir);
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
+
+ for (auto id: pathes) {
+ context.OnComplete.PublishToSchemeBoard(OperationId, id);
+ }
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::DeleteExternalShards);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxForceDropExtSubDomain);
+
+ auto pathes = context.SS->ListSubThee(txState->TargetPathId, context.Ctx);
+ NForceDrop::ValidateNoTrasactionOnPathes(OperationId, pathes, context);
+ context.SS->MarkAsDroping({txState->TargetPathId}, OperationId.GetTxId(), context.Ctx);
+ NForceDrop::CollectShards(pathes, OperationId, txState, context);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+
+class TDropExtSubdomain: public TSubOperation {
+ const TOperationId OperationId;
+ const TTxTransaction Transaction;
+
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::Propose;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Propose:
+ return TTxState::DeleteExternalShards;
+ case TTxState::DeleteExternalShards:
+ return TTxState::DeletePrivateShards;
+ case TTxState::DeletePrivateShards:
+ return TTxState::Done;
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::Propose:
return THolder(new TPropose(OperationId));
- case TTxState::DeleteExternalShards:
+ case TTxState::DeleteExternalShards:
return THolder(new TDeleteExternalShards(OperationId));
- case TTxState::DeletePrivateShards:
+ case TTxState::DeletePrivateShards:
return THolder(new TDeletePrivateShards(OperationId));
- case TTxState::Done:
+ case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
- TDropExtSubdomain(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
- , Transaction(tx)
- {}
-
- TDropExtSubdomain(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
- const auto& drop = Transaction.GetDrop();
-
- const TString& parentPathStr = Transaction.GetWorkingDir();
- const TString& name = drop.GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropExtSubdomain Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", pathId: " << drop.GetId()
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- TPath path = drop.HasId()
- ? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
- : TPath::Resolve(parentPathStr, context.SS).Dive(name);
-
- {
- TPath::TChecker checks = path.Check();
- checks
- .NotEmpty()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotRoot()
- .NotDeleted()
- .IsCommonSensePath()
- .IsExternalSubDomain();
-
- if (checks) {
- if (path.IsUnderCreating()) {
- TPath parent = path.Parent();
- if (parent.IsUnderCreating()) {
- checks
- .NotUnderTheSameOperation(parent.ActiveOperation(), NKikimrScheme::StatusMultipleModifications);
- }
- }
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "path table fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- TString errStr;
- if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxForceDropExtSubDomain, path.Base()->PathId);
- txState.State = TTxState::Waiting;
- txState.MinStep = TStepId(1);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- auto relatedTx = context.SS->GetRelatedTransactions({path.Base()->PathId}, context.Ctx);
-
- for (auto otherTxId: relatedTx) {
- if (otherTxId == OperationId.GetTxId()) {
- continue;
- }
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropExtSubdomain Propose dependence has found"
- << ", dependent transaction: " << OperationId.GetTxId()
- << ", parent transaction: " << otherTxId
- << ", at schemeshard: " << ssId);
-
- context.OnComplete.Dependence(otherTxId, OperationId.GetTxId());
-
- Y_VERIFY(context.SS->Operations.contains(otherTxId));
- auto otherOperation = context.SS->Operations.at(otherTxId);
- for (ui32 partId = 0; partId < otherOperation->Parts.size(); ++partId) {
- if (auto part = otherOperation->Parts.at(partId)) {
- part->AbortUnsafe(OperationId.GetTxId(), context);
- }
- }
- }
-
- context.SS->MarkAsDroping({path.Base()->PathId}, OperationId.GetTxId(), context.Ctx);
-
- txState.State = TTxState::Propose;
- context.OnComplete.ActivateTx(OperationId);
-
- context.SS->PersistTxState(db, OperationId);
-
- auto parentDir = path.Parent();
- ++parentDir.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
- context.SS->ClearDescribePathCaches(parentDir.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir.Base()->PathId);
-
- context.SS->ClearDescribePathCaches(path.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
- void AbortPropose(TOperationContext&) override {
- Y_FAIL("no AbortPropose for TDropExtSubdomain");
- }
-
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropExtSubdomain AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
- << ", at schemeshard: " << context.SS->TabletID());
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- TPathId pathId = txState->TargetPathId;
- Y_VERIFY(context.SS->PathsById.contains(pathId));
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
- Y_VERIFY(path);
-
- if (path->Dropped()) {
- for (auto shard : txState->Shards) {
- context.OnComplete.DeleteShard(shard.Idx);
- }
- }
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-ISubOperationBase::TPtr CreateFroceDropExtSubDomain(TOperationId id, const TTxTransaction& tx) {
- return new TDropExtSubdomain(id, tx);
-}
-
-ISubOperationBase::TPtr CreateFroceDropExtSubDomain(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state != TTxState::Invalid);
- return new TDropExtSubdomain(id, state);
-}
-
-}
-}
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
+ TDropExtSubdomain(TOperationId id, const TTxTransaction& tx)
+ : OperationId(id)
+ , Transaction(tx)
+ {}
+
+ TDropExtSubdomain(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ const auto& drop = Transaction.GetDrop();
+
+ const TString& parentPathStr = Transaction.GetWorkingDir();
+ const TString& name = drop.GetName();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropExtSubdomain Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", pathId: " << drop.GetId()
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ TPath path = drop.HasId()
+ ? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
+ : TPath::Resolve(parentPathStr, context.SS).Dive(name);
+
+ {
+ TPath::TChecker checks = path.Check();
+ checks
+ .NotEmpty()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotRoot()
+ .NotDeleted()
+ .IsCommonSensePath()
+ .IsExternalSubDomain();
+
+ if (checks) {
+ if (path.IsUnderCreating()) {
+ TPath parent = path.Parent();
+ if (parent.IsUnderCreating()) {
+ checks
+ .NotUnderTheSameOperation(parent.ActiveOperation(), NKikimrScheme::StatusMultipleModifications);
+ }
+ }
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path table fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ TString errStr;
+ if (!context.SS->CheckApplyIf(Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxForceDropExtSubDomain, path.Base()->PathId);
+ txState.State = TTxState::Waiting;
+ txState.MinStep = TStepId(1);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ auto relatedTx = context.SS->GetRelatedTransactions({path.Base()->PathId}, context.Ctx);
+
+ for (auto otherTxId: relatedTx) {
+ if (otherTxId == OperationId.GetTxId()) {
+ continue;
+ }
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropExtSubdomain Propose dependence has found"
+ << ", dependent transaction: " << OperationId.GetTxId()
+ << ", parent transaction: " << otherTxId
+ << ", at schemeshard: " << ssId);
+
+ context.OnComplete.Dependence(otherTxId, OperationId.GetTxId());
+
+ Y_VERIFY(context.SS->Operations.contains(otherTxId));
+ auto otherOperation = context.SS->Operations.at(otherTxId);
+ for (ui32 partId = 0; partId < otherOperation->Parts.size(); ++partId) {
+ if (auto part = otherOperation->Parts.at(partId)) {
+ part->AbortUnsafe(OperationId.GetTxId(), context);
+ }
+ }
+ }
+
+ context.SS->MarkAsDroping({path.Base()->PathId}, OperationId.GetTxId(), context.Ctx);
+
+ txState.State = TTxState::Propose;
+ context.OnComplete.ActivateTx(OperationId);
+
+ context.SS->PersistTxState(db, OperationId);
+
+ auto parentDir = path.Parent();
+ ++parentDir.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
+ context.SS->ClearDescribePathCaches(parentDir.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir.Base()->PathId);
+
+ context.SS->ClearDescribePathCaches(path.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
+ void AbortPropose(TOperationContext&) override {
+ Y_FAIL("no AbortPropose for TDropExtSubdomain");
+ }
+
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropExtSubdomain AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ TPathId pathId = txState->TargetPathId;
+ Y_VERIFY(context.SS->PathsById.contains(pathId));
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+ Y_VERIFY(path);
+
+ if (path->Dropped()) {
+ for (auto shard : txState->Shards) {
+ context.OnComplete.DeleteShard(shard.Idx);
+ }
+ }
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+ISubOperationBase::TPtr CreateFroceDropExtSubDomain(TOperationId id, const TTxTransaction& tx) {
+ return new TDropExtSubdomain(id, tx);
+}
+
+ISubOperationBase::TPtr CreateFroceDropExtSubDomain(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state != TTxState::Invalid);
+ return new TDropExtSubdomain(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_fs.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_fs.cpp
index b0c1b661acc..4ba51deb849 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_fs.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_fs.cpp
@@ -8,7 +8,7 @@
namespace {
using namespace NKikimr;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
////////////////////////////////////////////////////////////////////////////////
@@ -100,18 +100,18 @@ public:
domainInfo->DecPathsInside();
parentDir->DecAliveChildren();
- // KIKIMR-13173
- // Repeat it here for a waile, delete it from TDeleteParts after
- // Initiate asynchonous deletion of all shards
- for (auto shard : txState->Shards) {
- context.OnComplete.DeleteShard(shard.Idx);
- }
-
+ // KIKIMR-13173
+ // Repeat it here for a waile, delete it from TDeleteParts after
+ // Initiate asynchonous deletion of all shards
+ for (auto shard : txState->Shards) {
+ context.OnComplete.DeleteShard(shard.Idx);
+ }
+
if (!AppData()->DisableSchemeShardCleanupOnDropForTest) {
context.SS->PersistRemoveFileStoreInfo(db, pathId);
}
- context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size());
+ context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size());
context.SS->PersistUserAttributes(db, path->PathId, path->UserAttrs, nullptr);
++parentDir->DirAlterVersion;
@@ -259,7 +259,7 @@ THolder<TProposeResponse> TDropFileStore::Propose(
<< ", at schemeshard: " << ssId);
auto result = MakeHolder<TProposeResponse>(
- NKikimrScheme::StatusAccepted,
+ NKikimrScheme::StatusAccepted,
ui64(OperationId.GetTxId()),
ui64(ssId));
@@ -297,7 +297,7 @@ THolder<TProposeResponse> TDropFileStore::Propose(
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
return result;
}
@@ -323,13 +323,13 @@ THolder<TProposeResponse> TDropFileStore::Propose(
// Trying to abort Alter/Create. Wait if can't.
context.OnComplete.ActivateTx(OperationId);
- context.SS->PersistTxState(db, OperationId);
+ context.SS->PersistTxState(db, OperationId);
path.Base()->PathState = TPathElement::EPathState::EPathStateDrop;
path.Base()->DropTxId = OperationId.GetTxId();
path.Base()->LastTxId = OperationId.GetTxId();
- context.SS->TabletCounters->Simple()[COUNTER_FILESTORE_COUNT].Sub(1);
+ context.SS->TabletCounters->Simple()[COUNTER_FILESTORE_COUNT].Sub(1);
auto parentDir = path.Parent();
++parentDir.Base()->DirAlterVersion;
@@ -348,7 +348,7 @@ THolder<TProposeResponse> TDropFileStore::Propose(
} // namespace
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
////////////////////////////////////////////////////////////////////////////////
@@ -361,5 +361,5 @@ ISubOperationBase::TPtr CreateDropFileStore(TOperationId id, TTxState::ETxState
return new TDropFileStore(id, state);
}
-} // namespace NSchemeShard
+} // namespace NSchemeShard
} // namespace NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_index.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_index.cpp
index eeb7e7fe282..a84868b77bc 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_index.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_index.cpp
@@ -1,92 +1,92 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_path_element.h"
-
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_path_element.h"
+
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/path.h>
#include <ydb/core/protos/flat_tx_scheme.pb.h>
#include <ydb/core/protos/flat_scheme_op.pb.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TConfigureParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TConfigureParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropIndexAtMainTable TConfigureParts"
- << " operationId#" << OperationId;
- }
-
-public:
- TConfigureParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool HandleReply(TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvProposeTransactionResult"
- << " at tabletId# " << ssId);
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvProposeTransactionResult"
- << " message# " << ev->Get()->Record.ShortDebugString());
-
- if (!NTableState::CollectProposeTransactionResults(OperationId, ev, context)) {
- return false;
- }
-
- return true;
- }
-
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxDropTableIndexAtMainTable);
-
- //fill txShards
- if (NTableState::CheckPartitioningChangedForTableModification(*txState, context)) {
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " UpdatePartitioningForTableModification");
- NTableState::UpdatePartitioningForTableModification(OperationId, *txState, context);
- }
-
- txState->ClearShardsInProgress();
-
- TString txBody;
- {
- TPathId pathId = txState->TargetPathId;
- Y_VERIFY(context.SS->PathsById.contains(pathId));
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
- Y_VERIFY(path);
-
- Y_VERIFY(context.SS->Tables.contains(pathId));
- TTableInfo::TPtr table = context.SS->Tables.at(pathId);
- Y_VERIFY(table);
-
- auto seqNo = context.SS->StartRound(*txState);
-
- NKikimrTxDataShard::TFlatSchemeTransaction tx;
- context.SS->FillSeqNo(tx, seqNo);
-
- auto notice = tx.MutableDropIndexNotice();
+ return TStringBuilder()
+ << "TDropIndexAtMainTable TConfigureParts"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TConfigureParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool HandleReply(TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvProposeTransactionResult"
+ << " at tabletId# " << ssId);
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvProposeTransactionResult"
+ << " message# " << ev->Get()->Record.ShortDebugString());
+
+ if (!NTableState::CollectProposeTransactionResults(OperationId, ev, context)) {
+ return false;
+ }
+
+ return true;
+ }
+
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxDropTableIndexAtMainTable);
+
+ //fill txShards
+ if (NTableState::CheckPartitioningChangedForTableModification(*txState, context)) {
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " UpdatePartitioningForTableModification");
+ NTableState::UpdatePartitioningForTableModification(OperationId, *txState, context);
+ }
+
+ txState->ClearShardsInProgress();
+
+ TString txBody;
+ {
+ TPathId pathId = txState->TargetPathId;
+ Y_VERIFY(context.SS->PathsById.contains(pathId));
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+ Y_VERIFY(path);
+
+ Y_VERIFY(context.SS->Tables.contains(pathId));
+ TTableInfo::TPtr table = context.SS->Tables.at(pathId);
+ Y_VERIFY(table);
+
+ auto seqNo = context.SS->StartRound(*txState);
+
+ NKikimrTxDataShard::TFlatSchemeTransaction tx;
+ context.SS->FillSeqNo(tx, seqNo);
+
+ auto notice = tx.MutableDropIndexNotice();
PathIdFromPathId(pathId, notice->MutablePathId());
- notice->SetTableSchemaVersion(table->AlterVersion + 1);
-
+ notice->SetTableSchemaVersion(table->AlterVersion + 1);
+
bool found = false;
for (const auto& [_, childPathId] : path->GetChildren()) {
Y_VERIFY(context.SS->PathsById.contains(childPathId));
@@ -105,442 +105,442 @@ public:
}
Y_PROTOBUF_SUPPRESS_NODISCARD tx.SerializeToString(&txBody);
- }
-
- Y_VERIFY(txState->Shards.size());
- for (ui32 i = 0; i < txState->Shards.size(); ++i) {
- auto idx = txState->Shards[i].Idx;
- auto datashardId = context.SS->ShardInfos[idx].TabletID;
-
- THolder<TEvDataShard::TEvProposeTransaction> event =
+ }
+
+ Y_VERIFY(txState->Shards.size());
+ for (ui32 i = 0; i < txState->Shards.size(); ++i) {
+ auto idx = txState->Shards[i].Idx;
+ auto datashardId = context.SS->ShardInfos[idx].TabletID;
+
+ THolder<TEvDataShard::TEvProposeTransaction> event =
THolder(new TEvDataShard::TEvProposeTransaction(NKikimrTxDataShard::TX_KIND_SCHEME,
- context.SS->TabletID(),
- context.Ctx.SelfID,
- ui64(OperationId.GetTxId()),
- txBody,
+ context.SS->TabletID(),
+ context.Ctx.SelfID,
+ ui64(OperationId.GetTxId()),
+ txBody,
context.SS->SelectProcessingPrarams(txState->TargetPathId)));
-
- context.OnComplete.BindMsgToPipe(OperationId, datashardId, idx, event.Release());
- }
-
- txState->UpdateShardsInProgress(TTxState::ConfigureParts);
- return false;
- }
-};
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+ context.OnComplete.BindMsgToPipe(OperationId, datashardId, idx, event.Release());
+ }
+
+ txState->UpdateShardsInProgress(TTxState::ConfigureParts);
+ return false;
+ }
+};
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropIndexAtMainTable TPropose"
- << " operationId#" << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvDataShard::TEvProposeTransactionResult::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvDataShard::TEvSchemaChanged"
- << " triggers early, save it"
- << ", at schemeshard: " << ssId);
-
- NTableState::CollectSchemaChanged(OperationId, ev, context);
- return false;
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", step: " << step
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState->TxType == TTxState::TxDropTableIndexAtMainTable);
-
- TPathId pathId = txState->TargetPathId;
- Y_VERIFY(context.SS->PathsById.contains(pathId));
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
-
- Y_VERIFY(context.SS->Tables.contains(pathId));
- TTableInfo::TPtr table = context.SS->Tables.at(pathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- table->AlterVersion += 1;
- context.SS->PersistTableAlterVersion(db, pathId, table);
-
- context.SS->ClearDescribePathCaches(path);
- context.OnComplete.PublishToSchemeBoard(OperationId, path->PathId);
-
- context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxDropTableIndexAtMainTable);
-
- TSet<TTabletId> shardSet;
- for (const auto& shard : txState->Shards) {
- TShardIdx idx = shard.Idx;
- Y_VERIFY(context.SS->ShardInfos.contains(idx));
- TTabletId tablet = context.SS->ShardInfos.at(idx).TabletID;
- shardSet.insert(tablet);
- }
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, txState->MinStep, shardSet);
- return false;
- }
-};
-
-
-
-class TDropIndexAtMainTable: public TSubOperation {
-private:
- const TOperationId OperationId;
- const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::ConfigureParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::ConfigureParts:
- return TTxState::Propose;
- case TTxState::Propose:
- return TTxState::ProposedWaitParts;
- case TTxState::ProposedWaitParts:
- return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::ConfigureParts:
+ return TStringBuilder()
+ << "TDropIndexAtMainTable TPropose"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvDataShard::TEvProposeTransactionResult::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvDataShard::TEvSchemaChanged"
+ << " triggers early, save it"
+ << ", at schemeshard: " << ssId);
+
+ NTableState::CollectSchemaChanged(OperationId, ev, context);
+ return false;
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", step: " << step
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState->TxType == TTxState::TxDropTableIndexAtMainTable);
+
+ TPathId pathId = txState->TargetPathId;
+ Y_VERIFY(context.SS->PathsById.contains(pathId));
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+
+ Y_VERIFY(context.SS->Tables.contains(pathId));
+ TTableInfo::TPtr table = context.SS->Tables.at(pathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ table->AlterVersion += 1;
+ context.SS->PersistTableAlterVersion(db, pathId, table);
+
+ context.SS->ClearDescribePathCaches(path);
+ context.OnComplete.PublishToSchemeBoard(OperationId, path->PathId);
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxDropTableIndexAtMainTable);
+
+ TSet<TTabletId> shardSet;
+ for (const auto& shard : txState->Shards) {
+ TShardIdx idx = shard.Idx;
+ Y_VERIFY(context.SS->ShardInfos.contains(idx));
+ TTabletId tablet = context.SS->ShardInfos.at(idx).TabletID;
+ shardSet.insert(tablet);
+ }
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, txState->MinStep, shardSet);
+ return false;
+ }
+};
+
+
+
+class TDropIndexAtMainTable: public TSubOperation {
+private:
+ const TOperationId OperationId;
+ const TTxTransaction Transaction;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::ConfigureParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::ConfigureParts:
+ return TTxState::Propose;
+ case TTxState::Propose:
+ return TTxState::ProposedWaitParts;
+ case TTxState::ProposedWaitParts:
+ return TTxState::Done;
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::ConfigureParts:
return THolder(new TConfigureParts(OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new TPropose(OperationId));
- case TTxState::ProposedWaitParts:
+ case TTxState::ProposedWaitParts:
return THolder(new NTableState::TProposedWaitParts(OperationId));
- case TTxState::Done:
+ case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
- TDropIndexAtMainTable(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
- , Transaction(tx)
- {
- }
-
- TDropIndexAtMainTable(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
- auto dropOperation = Transaction.GetDropIndex();
-
- const TString workingDir = Transaction.GetWorkingDir();
- const TString mainTableName = dropOperation.GetTableName();
- const TString indexName = dropOperation.GetIndexName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropIndexAtMainTable Propose"
- << ", path: " << workingDir << "/" << mainTableName
- << ", index name: " << indexName
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropIndexAtMainTable Propose"
- << ", message: " << Transaction.ShortDebugString()
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
-
- if (!dropOperation.HasIndexName() && !indexName) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "No index name present");
- return result;
- }
-
- TPath tablePath = TPath::Resolve(workingDir, context.SS).Dive(mainTableName);
- {
- TPath::TChecker checks = tablePath.Check();
- checks
- .NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsTable()
- .NotUnderOperation()
- .IsCommonSensePath();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << tablePath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- TString errStr;
-
- if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- if (!context.SS->CheckLocks(tablePath.Base()->PathId, Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
- return result;
- }
-
- TPath indexPath = tablePath.Child(indexName);
- {
- TPath::TChecker checks = indexPath.Check();
- checks
- .NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsTableIndex()
- .NotUnderOperation();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << indexPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
-
- Y_VERIFY(context.SS->Tables.contains(tablePath.Base()->PathId));
- TTableInfo::TPtr table = context.SS->Tables.at(tablePath.Base()->PathId);
-
- Y_VERIFY(table->AlterVersion != 0);
- Y_VERIFY(!table->AlterData);
-
- Y_VERIFY(context.SS->Indexes.contains(indexPath.Base()->PathId));
- TTableIndexInfo::TPtr index = context.SS->Indexes.at(indexPath.Base()->PathId);
-
- Y_VERIFY(index->AlterVersion != 0);
- Y_VERIFY(!index->AlterData);
-
- Y_VERIFY(!context.SS->FindTx(OperationId));
-
- context.MemChanges.GrabPath(context.SS, tablePath.Base()->PathId);
- context.MemChanges.GrabNewTxState(context.SS, OperationId);
-
- context.DbChanges.PersistPath(tablePath.Base()->PathId);
- context.DbChanges.PersistTxState(OperationId);
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxDropTableIndexAtMainTable, tablePath.Base()->PathId);
- txState.State = TTxState::ConfigureParts;
- // do not fill txShards until all splits are done
-
- tablePath.Base()->PathState = NKikimrSchemeOp::EPathStateAlter;
- tablePath.Base()->LastTxId = OperationId.GetTxId();
-
- for (auto splitTx: table->GetSplitOpsInFlight()) {
- context.OnComplete.Dependence(splitTx.GetTxId(), OperationId.GetTxId());
- }
-
- context.OnComplete.ActivateTx(OperationId);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
- void AbortPropose(TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropIndexAtMainTable AbortPropose"
- << ", opId: " << OperationId
- << ", at schemeshard: " << context.SS->TabletID());
- }
-
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropIndexAtMainTable AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
- << ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-ISubOperationBase::TPtr CreateDropTableIndexAtMainTable(TOperationId id, TTxState::ETxState state) {
- return new TDropIndexAtMainTable(id, state);
-}
-
-ISubOperationBase::TPtr CreateDropTableIndexAtMainTable(TOperationId id, const TTxTransaction& tx) {
- return new TDropIndexAtMainTable(id, tx);
-}
-
-TVector<ISubOperationBase::TPtr> CreateDropIndex(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context) {
- Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpDropIndex);
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "CreateDropIndex"
- << ", message: " << tx.ShortDebugString()
- << ", at schemeshard: " << context.SS->TabletID());
-
- auto dropOperation = tx.GetDropIndex();
-
- const TString workingDir = tx.GetWorkingDir();
- const TString mainTableName = dropOperation.GetTableName();
- const TString indexName = dropOperation.GetIndexName();
-
- TPath workingDirPath = TPath::Resolve(workingDir, context.SS);
-
- TPath mainTablePath = workingDirPath.Child(mainTableName);
- {
- TPath::TChecker checks = mainTablePath.Check();
- checks
- .NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .IsTable()
- .NotUnderDeleting()
- .NotUnderOperation()
- .IsCommonSensePath();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << mainTablePath.PathString();
- auto status = checks.GetStatus(&explain);
- return {CreateReject(nextId, status, explain)};
- }
- }
-
- TPath indexPath = mainTablePath.Child(indexName);
- {
- TPath::TChecker checks = indexPath.Check();
- checks
- .NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .IsTableIndex()
- .NotUnderDeleting()
- .NotUnderOperation();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << indexPath.PathString();
- auto status = checks.GetStatus(&explain);
- return {CreateReject(nextId, status, explain)};
- }
- }
-
- TString errStr;
- if (!context.SS->CheckApplyIf(tx, errStr)) {
- return {CreateReject(nextId, NKikimrScheme::StatusPreconditionFailed, errStr)};
- }
-
- if (!context.SS->CheckLocks(mainTablePath.Base()->PathId, tx, errStr)) {
- return {CreateReject(nextId, NKikimrScheme::StatusMultipleModifications, errStr)};
- }
-
- TVector<ISubOperationBase::TPtr> result;
-
- {
- auto mainTableIndexDropping = TransactionTemplate(workingDirPath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpDropTableIndexAtMainTable);
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
+ TDropIndexAtMainTable(TOperationId id, const TTxTransaction& tx)
+ : OperationId(id)
+ , Transaction(tx)
+ {
+ }
+
+ TDropIndexAtMainTable(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ auto dropOperation = Transaction.GetDropIndex();
+
+ const TString workingDir = Transaction.GetWorkingDir();
+ const TString mainTableName = dropOperation.GetTableName();
+ const TString indexName = dropOperation.GetIndexName();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropIndexAtMainTable Propose"
+ << ", path: " << workingDir << "/" << mainTableName
+ << ", index name: " << indexName
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropIndexAtMainTable Propose"
+ << ", message: " << Transaction.ShortDebugString()
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+
+ if (!dropOperation.HasIndexName() && !indexName) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "No index name present");
+ return result;
+ }
+
+ TPath tablePath = TPath::Resolve(workingDir, context.SS).Dive(mainTableName);
+ {
+ TPath::TChecker checks = tablePath.Check();
+ checks
+ .NotEmpty()
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsTable()
+ .NotUnderOperation()
+ .IsCommonSensePath();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << tablePath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ TString errStr;
+
+ if (!context.SS->CheckApplyIf(Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ if (!context.SS->CheckLocks(tablePath.Base()->PathId, Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
+ return result;
+ }
+
+ TPath indexPath = tablePath.Child(indexName);
+ {
+ TPath::TChecker checks = indexPath.Check();
+ checks
+ .NotEmpty()
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsTableIndex()
+ .NotUnderOperation();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << indexPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+
+ Y_VERIFY(context.SS->Tables.contains(tablePath.Base()->PathId));
+ TTableInfo::TPtr table = context.SS->Tables.at(tablePath.Base()->PathId);
+
+ Y_VERIFY(table->AlterVersion != 0);
+ Y_VERIFY(!table->AlterData);
+
+ Y_VERIFY(context.SS->Indexes.contains(indexPath.Base()->PathId));
+ TTableIndexInfo::TPtr index = context.SS->Indexes.at(indexPath.Base()->PathId);
+
+ Y_VERIFY(index->AlterVersion != 0);
+ Y_VERIFY(!index->AlterData);
+
+ Y_VERIFY(!context.SS->FindTx(OperationId));
+
+ context.MemChanges.GrabPath(context.SS, tablePath.Base()->PathId);
+ context.MemChanges.GrabNewTxState(context.SS, OperationId);
+
+ context.DbChanges.PersistPath(tablePath.Base()->PathId);
+ context.DbChanges.PersistTxState(OperationId);
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxDropTableIndexAtMainTable, tablePath.Base()->PathId);
+ txState.State = TTxState::ConfigureParts;
+ // do not fill txShards until all splits are done
+
+ tablePath.Base()->PathState = NKikimrSchemeOp::EPathStateAlter;
+ tablePath.Base()->LastTxId = OperationId.GetTxId();
+
+ for (auto splitTx: table->GetSplitOpsInFlight()) {
+ context.OnComplete.Dependence(splitTx.GetTxId(), OperationId.GetTxId());
+ }
+
+ context.OnComplete.ActivateTx(OperationId);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
+ void AbortPropose(TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropIndexAtMainTable AbortPropose"
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << context.SS->TabletID());
+ }
+
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropIndexAtMainTable AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+ISubOperationBase::TPtr CreateDropTableIndexAtMainTable(TOperationId id, TTxState::ETxState state) {
+ return new TDropIndexAtMainTable(id, state);
+}
+
+ISubOperationBase::TPtr CreateDropTableIndexAtMainTable(TOperationId id, const TTxTransaction& tx) {
+ return new TDropIndexAtMainTable(id, tx);
+}
+
+TVector<ISubOperationBase::TPtr> CreateDropIndex(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context) {
+ Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpDropIndex);
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "CreateDropIndex"
+ << ", message: " << tx.ShortDebugString()
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ auto dropOperation = tx.GetDropIndex();
+
+ const TString workingDir = tx.GetWorkingDir();
+ const TString mainTableName = dropOperation.GetTableName();
+ const TString indexName = dropOperation.GetIndexName();
+
+ TPath workingDirPath = TPath::Resolve(workingDir, context.SS);
+
+ TPath mainTablePath = workingDirPath.Child(mainTableName);
+ {
+ TPath::TChecker checks = mainTablePath.Check();
+ checks
+ .NotEmpty()
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .IsTable()
+ .NotUnderDeleting()
+ .NotUnderOperation()
+ .IsCommonSensePath();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << mainTablePath.PathString();
+ auto status = checks.GetStatus(&explain);
+ return {CreateReject(nextId, status, explain)};
+ }
+ }
+
+ TPath indexPath = mainTablePath.Child(indexName);
+ {
+ TPath::TChecker checks = indexPath.Check();
+ checks
+ .NotEmpty()
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .IsTableIndex()
+ .NotUnderDeleting()
+ .NotUnderOperation();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << indexPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ return {CreateReject(nextId, status, explain)};
+ }
+ }
+
+ TString errStr;
+ if (!context.SS->CheckApplyIf(tx, errStr)) {
+ return {CreateReject(nextId, NKikimrScheme::StatusPreconditionFailed, errStr)};
+ }
+
+ if (!context.SS->CheckLocks(mainTablePath.Base()->PathId, tx, errStr)) {
+ return {CreateReject(nextId, NKikimrScheme::StatusMultipleModifications, errStr)};
+ }
+
+ TVector<ISubOperationBase::TPtr> result;
+
+ {
+ auto mainTableIndexDropping = TransactionTemplate(workingDirPath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpDropTableIndexAtMainTable);
auto operation = mainTableIndexDropping.MutableDropIndex();
- operation->SetTableName(mainTablePath.LeafName());
- operation->SetIndexName(indexPath.LeafName());
-
+ operation->SetTableName(mainTablePath.LeafName());
+ operation->SetIndexName(indexPath.LeafName());
+
result.push_back(CreateDropTableIndexAtMainTable(NextPartId(nextId, result), mainTableIndexDropping));
- }
-
- {
- auto indexDropping = TransactionTemplate(mainTablePath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpDropTableIndex);
- auto operation = indexDropping.MutableDrop();
- operation->SetName(ToString(indexPath.Base()->Name));
+ }
+
+ {
+ auto indexDropping = TransactionTemplate(mainTablePath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpDropTableIndex);
+ auto operation = indexDropping.MutableDrop();
+ operation->SetName(ToString(indexPath.Base()->Name));
result.push_back(CreateDropTableIndex(NextPartId(nextId, result), indexDropping));
- }
-
- for (const auto& items: indexPath.Base()->GetChildren()) {
- Y_VERIFY(context.SS->PathsById.contains(items.second));
- auto implPath = context.SS->PathsById.at(items.second);
- if (implPath->Dropped()) {
- continue;
- }
-
- auto implTable = context.SS->PathsById.at(items.second);
- Y_VERIFY(implTable->IsTable());
-
- auto implTableDropping = TransactionTemplate(indexPath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
- auto operation = implTableDropping.MutableDrop();
- operation->SetName(items.first);
+ }
+
+ for (const auto& items: indexPath.Base()->GetChildren()) {
+ Y_VERIFY(context.SS->PathsById.contains(items.second));
+ auto implPath = context.SS->PathsById.at(items.second);
+ if (implPath->Dropped()) {
+ continue;
+ }
+
+ auto implTable = context.SS->PathsById.at(items.second);
+ Y_VERIFY(implTable->IsTable());
+
+ auto implTableDropping = TransactionTemplate(indexPath.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
+ auto operation = implTableDropping.MutableDrop();
+ operation->SetName(items.first);
result.push_back(CreateDropTable(NextPartId(nextId, result), implTableDropping));
- }
-
- return result;
-}
-
-}
-}
+ }
+
+ return result;
+}
+
+}
+}
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 da72804d3e2..7064fabe1ea 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_indexed_table.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_indexed_table.cpp
@@ -1,495 +1,495 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_path_element.h"
-
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_path_element.h"
+
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/path.h>
#include <ydb/core/protos/flat_tx_scheme.pb.h>
#include <ydb/core/protos/flat_scheme_op.pb.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-void DropPath(NIceDb::TNiceDb& db, TOperationContext& context,
- TOperationId operationId, const TTxState& txState, TPath& path)
-{
- if (path->Dropped()) {
- // it might be dropped
- // when rolling update goes
- // old code drop the path early at TDropParts
- // and new code try do it once more time for sure
- return;
- }
-
- context.SS->TabletCounters->Simple()[COUNTER_TABLE_INDEXES_COUNT].Sub(1);
-
- Y_VERIFY(txState.PlanStep);
- path->SetDropped(txState.PlanStep, operationId.GetTxId());
- context.SS->PersistDropStep(db, path->PathId, txState.PlanStep, operationId);
- context.SS->PersistRemoveTableIndex(db, path->PathId);
-
- context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size());
- context.SS->PersistUserAttributes(db, path->PathId, path->UserAttrs, nullptr);
-
- auto domainInfo = context.SS->ResolveDomainInfo(path->PathId);
- domainInfo->DecPathsInside();
-
- auto parentDir = path.Parent();
- parentDir->DecAliveChildren();
- ++parentDir->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
-
- context.SS->ClearDescribePathCaches(parentDir.Base());
- context.OnComplete.PublishToSchemeBoard(operationId, parentDir->PathId);
-
- context.SS->ClearDescribePathCaches(path.Base());
- context.OnComplete.PublishToSchemeBoard(operationId, path->PathId);
-
-
-}
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
- TTxState::ETxState& NextState;
-
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+void DropPath(NIceDb::TNiceDb& db, TOperationContext& context,
+ TOperationId operationId, const TTxState& txState, TPath& path)
+{
+ if (path->Dropped()) {
+ // it might be dropped
+ // when rolling update goes
+ // old code drop the path early at TDropParts
+ // and new code try do it once more time for sure
+ return;
+ }
+
+ context.SS->TabletCounters->Simple()[COUNTER_TABLE_INDEXES_COUNT].Sub(1);
+
+ Y_VERIFY(txState.PlanStep);
+ path->SetDropped(txState.PlanStep, operationId.GetTxId());
+ context.SS->PersistDropStep(db, path->PathId, txState.PlanStep, operationId);
+ context.SS->PersistRemoveTableIndex(db, path->PathId);
+
+ context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size());
+ context.SS->PersistUserAttributes(db, path->PathId, path->UserAttrs, nullptr);
+
+ auto domainInfo = context.SS->ResolveDomainInfo(path->PathId);
+ domainInfo->DecPathsInside();
+
+ auto parentDir = path.Parent();
+ parentDir->DecAliveChildren();
+ ++parentDir->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
+
+ context.SS->ClearDescribePathCaches(parentDir.Base());
+ context.OnComplete.PublishToSchemeBoard(operationId, parentDir->PathId);
+
+ context.SS->ClearDescribePathCaches(path.Base());
+ context.OnComplete.PublishToSchemeBoard(operationId, path->PathId);
+
+
+}
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+ TTxState::ETxState& NextState;
+
+ TString DebugHint() const override {
+ return TStringBuilder()
+ << "TDropTableIndex TPropose"
+ << ", operationId: " << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id, TTxState::ETxState& nextState)
+ : OperationId(id)
+ , NextState(nextState)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", step: " << step
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxDropTableIndex);
+ Y_VERIFY(txState->State == TTxState::Propose);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ txState->PlanStep = step;
+ context.SS->PersistTxPlanStep(db, OperationId, step);
+
+ Y_VERIFY_S(context.SS->PathsById.contains(txState->TargetPathId), "Unknown pathId: " << txState->TargetPathId);
+ TPath path = TPath::Init(txState->TargetPathId, context.SS);
+ Y_VERIFY(path.IsResolved());
+
+ if (context.SS->EnableSchemeTransactionsAtSchemeShard) {
+ // only persist step, but do not set it for the path
+ NextState = TTxState::WaitShadowPathPublication;
+ context.SS->ChangeTxState(db, OperationId, TTxState::WaitShadowPathPublication);
+ return true;
+ }
+
+ DropPath(db, context, OperationId, *txState, path);
+
+ NextState = TTxState::Done;
+ context.SS->ChangeTxState(db, OperationId, TTxState::Done);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxDropTableIndex);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+class TWaitRenamedPathPublication: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
+ TPathId ActivePathId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropTableIndex TPropose"
- << ", operationId: " << OperationId;
- }
-
-public:
- TPropose(TOperationId id, TTxState::ETxState& nextState)
- : OperationId(id)
- , NextState(nextState)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", step: " << step
- << ", at schemeshard: " << context.SS->TabletID());
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxDropTableIndex);
- Y_VERIFY(txState->State == TTxState::Propose);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- txState->PlanStep = step;
- context.SS->PersistTxPlanStep(db, OperationId, step);
-
- Y_VERIFY_S(context.SS->PathsById.contains(txState->TargetPathId), "Unknown pathId: " << txState->TargetPathId);
- TPath path = TPath::Init(txState->TargetPathId, context.SS);
- Y_VERIFY(path.IsResolved());
-
- if (context.SS->EnableSchemeTransactionsAtSchemeShard) {
- // only persist step, but do not set it for the path
- NextState = TTxState::WaitShadowPathPublication;
- context.SS->ChangeTxState(db, OperationId, TTxState::WaitShadowPathPublication);
- return true;
- }
-
- DropPath(db, context, OperationId, *txState, path);
-
- NextState = TTxState::Done;
- context.SS->ChangeTxState(db, OperationId, TTxState::Done);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << context.SS->TabletID());
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxDropTableIndex);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-class TWaitRenamedPathPublication: public TSubOperationState {
-private:
- TOperationId OperationId;
-
- TPathId ActivePathId;
-
- TString DebugHint() const override {
- return TStringBuilder()
- << "TDropTableIndex TWaitRenamedPathPublication"
- << " operationId: " << OperationId;
- }
-
-public:
- TWaitRenamedPathPublication(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvPrivate::TEvOperationPlan::EventType});
- }
-
- bool HandleReply(TEvPrivate::TEvCompletePublication::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvPrivate::TEvCompletePublication"
- << ", msg: " << ev->Get()->ToString()
- << ", at tablet" << ssId);
-
- Y_VERIFY(ActivePathId == ev->Get()->PathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::DeletePathBarrier);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- context.OnComplete.RouteByTabletsFromOperation(OperationId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- Y_VERIFY(txState->PlanStep);
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", operation type: " << TTxState::TypeName(txState->TxType)
- << ", at tablet" << ssId);
-
- TPath path = TPath::Init(txState->TargetPathId, context.SS);
- if (path.IsActive()) {
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", no renaming has been detected for this operation");
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::DeletePathBarrier);
- return true;
- }
-
- auto activePath = TPath::Resolve(path.PathString(), context.SS);
- Y_VERIFY(activePath.IsResolved());
-
- Y_VERIFY(activePath != path);
-
- ActivePathId = activePath->PathId;
- context.OnComplete.PublishAndWaitPublication(OperationId, activePath->PathId);
-
- return false;
- }
-};
-
-class TDeletePathBarrier: public TSubOperationState {
-private:
- TOperationId OperationId;
-
- TString DebugHint() const override {
- return TStringBuilder()
- << "TDropTableIndex TDeletePathBarrier"
- << " operationId: " << OperationId;
- }
-
-public:
- TDeletePathBarrier(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType, TEvPrivate::TEvOperationPlan::EventType});
- }
-
- bool HandleReply(TEvPrivate::TEvCompleteBarrier::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvPrivate::TEvCompleteBarrier"
- << ", msg: " << ev->Get()->ToString()
- << ", at tablet" << ssId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- TPath path = TPath::Init(txState->TargetPathId, context.SS);
-
- DropPath(db, context, OperationId, *txState, path);
-
- context.SS->ChangeTxState(db, OperationId, TTxState::Done);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- context.OnComplete.RouteByTabletsFromOperation(OperationId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", operation type: " << TTxState::TypeName(txState->TxType)
- << ", at tablet" << ssId);
-
- context.OnComplete.Barrier(OperationId, "RenamePathBarrier");
-
- return false;
- }
-};
-
-
-class TDropTableIndex: public TSubOperation {
- const TOperationId OperationId;
+ return TStringBuilder()
+ << "TDropTableIndex TWaitRenamedPathPublication"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TWaitRenamedPathPublication(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvPrivate::TEvOperationPlan::EventType});
+ }
+
+ bool HandleReply(TEvPrivate::TEvCompletePublication::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvPrivate::TEvCompletePublication"
+ << ", msg: " << ev->Get()->ToString()
+ << ", at tablet" << ssId);
+
+ Y_VERIFY(ActivePathId == ev->Get()->PathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::DeletePathBarrier);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ context.OnComplete.RouteByTabletsFromOperation(OperationId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ Y_VERIFY(txState->PlanStep);
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", operation type: " << TTxState::TypeName(txState->TxType)
+ << ", at tablet" << ssId);
+
+ TPath path = TPath::Init(txState->TargetPathId, context.SS);
+ if (path.IsActive()) {
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", no renaming has been detected for this operation");
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::DeletePathBarrier);
+ return true;
+ }
+
+ auto activePath = TPath::Resolve(path.PathString(), context.SS);
+ Y_VERIFY(activePath.IsResolved());
+
+ Y_VERIFY(activePath != path);
+
+ ActivePathId = activePath->PathId;
+ context.OnComplete.PublishAndWaitPublication(OperationId, activePath->PathId);
+
+ return false;
+ }
+};
+
+class TDeletePathBarrier: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
+ TString DebugHint() const override {
+ return TStringBuilder()
+ << "TDropTableIndex TDeletePathBarrier"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TDeletePathBarrier(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType, TEvPrivate::TEvOperationPlan::EventType});
+ }
+
+ bool HandleReply(TEvPrivate::TEvCompleteBarrier::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvPrivate::TEvCompleteBarrier"
+ << ", msg: " << ev->Get()->ToString()
+ << ", at tablet" << ssId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ TPath path = TPath::Init(txState->TargetPathId, context.SS);
+
+ DropPath(db, context, OperationId, *txState, path);
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::Done);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ context.OnComplete.RouteByTabletsFromOperation(OperationId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", operation type: " << TTxState::TypeName(txState->TxType)
+ << ", at tablet" << ssId);
+
+ context.OnComplete.Barrier(OperationId, "RenamePathBarrier");
+
+ return false;
+ }
+};
+
+
+class TDropTableIndex: public TSubOperation {
+ const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
- TTxState::ETxState AfterPropose = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::Propose;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Propose:
- return AfterPropose;
-
- case TTxState::WaitShadowPathPublication:
- return TTxState::DeletePathBarrier;
- case TTxState::DeletePathBarrier:
- return TTxState::Done;
-
- default:
- return TTxState::Invalid;
- }
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Propose:
- return THolder(new TPropose(OperationId, AfterPropose));
- case TTxState::WaitShadowPathPublication:
- return THolder(new TWaitRenamedPathPublication(OperationId));
- case TTxState::DeletePathBarrier:
- return THolder(new TDeletePathBarrier(OperationId));
- case TTxState::Done:
+ TTxState::ETxState State = TTxState::Invalid;
+ TTxState::ETxState AfterPropose = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::Propose;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Propose:
+ return AfterPropose;
+
+ case TTxState::WaitShadowPathPublication:
+ return TTxState::DeletePathBarrier;
+ case TTxState::DeletePathBarrier:
+ return TTxState::Done;
+
+ default:
+ return TTxState::Invalid;
+ }
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Propose:
+ return THolder(new TPropose(OperationId, AfterPropose));
+ case TTxState::WaitShadowPathPublication:
+ return THolder(new TWaitRenamedPathPublication(OperationId));
+ case TTxState::DeletePathBarrier:
+ return THolder(new TDeletePathBarrier(OperationId));
+ case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TDropTableIndex(TOperationId id, const TTxTransaction& tx)
: OperationId(id)
, Transaction(tx)
{
}
- TDropTableIndex(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+ TDropTableIndex(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = Transaction.GetDrop().GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropTableIndex Propose"
- << ", path: " << parentPathStr << "/" << name
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropTableIndex Propose"
+ << ", path: " << parentPathStr << "/" << name
<< ", pathId: " << Transaction.GetDrop().GetId()
- << ", operationId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
+ << ", operationId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
if (!Transaction.HasDrop()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "Drop is not present");
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "Drop is not present");
+ return result;
+ }
+
TPath index = Transaction.GetDrop().HasId()
- ? TPath::Init(context.SS->MakeLocalId(Transaction.GetDrop().GetId()), context.SS)
- : TPath::Resolve(parentPathStr, context.SS).Dive(name);
-
- {
- TPath::TChecker checks = index.Check();
+ ? TPath::Init(context.SS->MakeLocalId(Transaction.GetDrop().GetId()), context.SS)
+ : TPath::Resolve(parentPathStr, context.SS).Dive(name);
+
+ {
+ TPath::TChecker checks = index.Check();
checks
.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .IsTableIndex()
- .NotUnderDeleting()
- .NotUnderOperation();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path table index fail checks"
- << ", path: " << index.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- TPath parentTable = index.Parent();
- {
- TPath::TChecker checks = parentTable.Check();
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .IsTableIndex()
+ .NotUnderDeleting()
+ .NotUnderOperation();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path table index fail checks"
+ << ", path: " << index.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ TPath parentTable = index.Parent();
+ {
+ TPath::TChecker checks = parentTable.Check();
checks
.NotEmpty()
- .IsResolved()
- .NotDeleted()
- .IsTable()
- .IsUnderOperation()
- .IsUnderTheSameOperation(OperationId.GetTxId()); // allowed only as part of consistent operations
-
- if (!checks) {
- TString explain = TStringBuilder() << "path table index fail checks"
- << ", path: " << parentTable.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- Y_VERIFY(context.SS->Indexes.contains(index.Base()->PathId));
-
- context.MemChanges.GrabPath(context.SS, index.Base()->PathId);
- context.MemChanges.GrabNewTxState(context.SS, OperationId);
-
- context.DbChanges.PersistPath(index.Base()->PathId);
- context.DbChanges.PersistTxState(OperationId);
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxDropTableIndex, index.Base()->PathId);
- txState.MinStep = TStepId(1);
- txState.State = TTxState::Propose;
-
- index.Base()->PathState = TPathElement::EPathState::EPathStateDrop;
- index.Base()->DropTxId = OperationId.GetTxId();
- index.Base()->LastTxId = OperationId.GetTxId();
-
- context.OnComplete.ActivateTx(OperationId);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
- void AbortPropose(TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropTableIndex AbortPropose"
- << ", opId: " << OperationId
- << ", at schemeshard: " << context.SS->TabletID());
+ .IsResolved()
+ .NotDeleted()
+ .IsTable()
+ .IsUnderOperation()
+ .IsUnderTheSameOperation(OperationId.GetTxId()); // allowed only as part of consistent operations
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path table index fail checks"
+ << ", path: " << parentTable.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ Y_VERIFY(context.SS->Indexes.contains(index.Base()->PathId));
+
+ context.MemChanges.GrabPath(context.SS, index.Base()->PathId);
+ context.MemChanges.GrabNewTxState(context.SS, OperationId);
+
+ context.DbChanges.PersistPath(index.Base()->PathId);
+ context.DbChanges.PersistTxState(OperationId);
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxDropTableIndex, index.Base()->PathId);
+ txState.MinStep = TStepId(1);
+ txState.State = TTxState::Propose;
+
+ index.Base()->PathState = TPathElement::EPathState::EPathStateDrop;
+ index.Base()->DropTxId = OperationId.GetTxId();
+ index.Base()->LastTxId = OperationId.GetTxId();
+
+ context.OnComplete.ActivateTx(OperationId);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropTableIndex AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortPropose(TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropTableIndex AbortPropose"
+ << ", opId: " << OperationId
<< ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+ }
+
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropTableIndex AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateDropTableIndex(TOperationId id, const TTxTransaction& tx) {
return new TDropTableIndex(id, tx);
-}
-
-ISubOperationBase::TPtr CreateDropTableIndex(TOperationId id, TTxState::ETxState state) {
- return new TDropTableIndex(id, state);
-}
-
-
-TVector<ISubOperationBase::TPtr> CreateDropIndexedTable(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context) {
- Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
-
- auto dropOperation = tx.GetDrop();
-
- const TString parentPathStr = tx.GetWorkingDir();
- const TString name = dropOperation.GetName();
-
- TPath table = dropOperation.HasId()
- ? TPath::Init(TPathId(context.SS->TabletID(), dropOperation.GetId()), context.SS)
- : TPath::Resolve(parentPathStr, context.SS).Dive(name);
-
- {
- TPath::TChecker checks = table.Check();
+}
+
+ISubOperationBase::TPtr CreateDropTableIndex(TOperationId id, TTxState::ETxState state) {
+ return new TDropTableIndex(id, state);
+}
+
+
+TVector<ISubOperationBase::TPtr> CreateDropIndexedTable(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context) {
+ Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
+
+ auto dropOperation = tx.GetDrop();
+
+ const TString parentPathStr = tx.GetWorkingDir();
+ const TString name = dropOperation.GetName();
+
+ TPath table = dropOperation.HasId()
+ ? TPath::Init(TPathId(context.SS->TabletID(), dropOperation.GetId()), context.SS)
+ : TPath::Resolve(parentPathStr, context.SS).Dive(name);
+
+ {
+ TPath::TChecker checks = table.Check();
checks
.NotEmpty()
- .IsResolved()
- .NotDeleted()
- .IsTable()
- .NotUnderDeleting()
- .NotUnderOperation()
- .IsCommonSensePath();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path table fail checks"
- << ", path: " << table.PathString();
- auto status = checks.GetStatus(&explain);
-
- THolder<TProposeResponse> result = MakeHolder<TEvSchemeShard::TEvModifySchemeTransactionResult>(
- NKikimrScheme::StatusAccepted, 0, 0);
+ .IsResolved()
+ .NotDeleted()
+ .IsTable()
+ .NotUnderDeleting()
+ .NotUnderOperation()
+ .IsCommonSensePath();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path table fail checks"
+ << ", path: " << table.PathString();
+ auto status = checks.GetStatus(&explain);
+
+ THolder<TProposeResponse> result = MakeHolder<TEvSchemeShard::TEvModifySchemeTransactionResult>(
+ NKikimrScheme::StatusAccepted, 0, 0);
result->SetError(status, explain);
if (table.IsResolved() && table.Base()->IsTable() && (table.Base()->PlannedToDrop() || table.Base()->Dropped())) {
- result->SetPathDropTxId(ui64(table.Base()->DropTxId));
- result->SetPathId(table.Base()->PathId.LocalPathId);
+ result->SetPathDropTxId(ui64(table.Base()->DropTxId));
+ result->SetPathId(table.Base()->PathId.LocalPathId);
}
return {CreateReject(nextId, std::move(result))};
- }
- }
-
- TVector<ISubOperationBase::TPtr> result;
+ }
+ }
+
+ TVector<ISubOperationBase::TPtr> result;
result.push_back(CreateDropTable(NextPartId(nextId, result), tx));
-
+
for (const auto& [childName, childPathId] : table.Base()->GetChildren()) {
TPath child = table.Child(childName);
- {
+ {
TPath::TChecker checks = child.Check();
checks
.NotEmpty()
- .IsResolved();
-
- if (checks) {
+ .IsResolved();
+
+ if (checks) {
if (child.IsDeleted()) {
- continue;
- }
- }
-
+ continue;
+ }
+ }
+
if (child.IsTableIndex()) {
checks.IsTableIndex();
} else if (child.IsCdcStream()) {
@@ -498,21 +498,21 @@ TVector<ISubOperationBase::TPtr> CreateDropIndexedTable(TOperationId nextId, con
checks.IsSequence();
}
- checks.NotDeleted()
- .NotUnderDeleting()
- .NotUnderOperation();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path index fail checks"
+ checks.NotDeleted()
+ .NotUnderDeleting()
+ .NotUnderOperation();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path index fail checks"
<< ", index path: " << child.PathString();
- auto status = checks.GetStatus(&explain);
- return {CreateReject(nextId, status, explain)};
- }
- }
+ auto status = checks.GetStatus(&explain);
+ return {CreateReject(nextId, status, explain)};
+ }
+ }
Y_VERIFY(child.Base()->PathId == childPathId);
-
+
if (child.IsSequence()) {
- auto dropSequence = TransactionTemplate(table.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpDropSequence);
+ auto dropSequence = TransactionTemplate(table.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpDropSequence);
dropSequence.MutableDrop()->SetName(ToString(child->Name));
result.push_back(CreateDropSequence(NextPartId(nextId, result), dropSequence));
@@ -527,23 +527,23 @@ TVector<ISubOperationBase::TPtr> CreateDropIndexedTable(TOperationId nextId, con
dropStream.MutableDrop()->SetName(ToString(child.Base()->Name));
result.push_back(CreateDropCdcStreamImpl(NextPartId(nextId, result), dropStream));
- }
-
+ }
+
Y_VERIFY(child.Base()->GetChildren().size() == 1);
for (auto& [implName, implPathId] : child.Base()->GetChildren()) {
Y_VERIFY(implName == "indexImplTable" || implName == "streamImpl",
"unexpected name %s", implName.c_str());
-
+
TPath implPath = child.Child(implName);
- {
+ {
TPath::TChecker checks = implPath.Check();
checks
.NotEmpty()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .NotUnderOperation();
-
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .NotUnderOperation();
+
if (checks) {
if (implPath.Base()->IsTable()) {
checks
@@ -556,15 +556,15 @@ TVector<ISubOperationBase::TPtr> CreateDropIndexedTable(TOperationId nextId, con
}
}
- if (!checks) {
- TString explain = TStringBuilder() << "path impl table fail checks"
+ if (!checks) {
+ TString explain = TStringBuilder() << "path impl table fail checks"
<< ", index path: " << implPath.PathString();
- auto status = checks.GetStatus(&explain);
- return {CreateReject(nextId, status, explain)};
- }
- }
+ auto status = checks.GetStatus(&explain);
+ return {CreateReject(nextId, status, explain)};
+ }
+ }
Y_VERIFY(implPath.Base()->PathId == implPathId);
-
+
if (implPath.Base()->IsTable()) {
auto dropIndexTable = TransactionTemplate(child.PathString(), NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
dropIndexTable.MutableDrop()->SetName(ToString(implPath.Base()->Name));
@@ -575,12 +575,12 @@ TVector<ISubOperationBase::TPtr> CreateDropIndexedTable(TOperationId nextId, con
dropPQGroup.MutableDrop()->SetName(ToString(implPath.Base()->Name));
result.push_back(CreateDropPQ(NextPartId(nextId, result), dropPQGroup));
- }
- }
- }
-
- return result;
-}
-
-}
-}
+ }
+ }
+ }
+
+ return result;
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_kesus.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_kesus.cpp
index 7883cbcee20..ad42e96de59 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_kesus.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_kesus.cpp
@@ -1,331 +1,331 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TDeleteParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TDeleteParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropKesus TDeleteParts"
- << ", operationId: " << OperationId;
- }
-
-public:
- TDeleteParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState->TxType == TTxState::TxDropKesus);
-
- // Initiate asynchonous deletion of all shards
- for (auto shard : txState->Shards) {
- context.OnComplete.DeleteShard(shard.Idx);
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
- return true;
- }
-};
-
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ return TStringBuilder()
+ << "TDropKesus TDeleteParts"
+ << ", operationId: " << OperationId;
+ }
+
+public:
+ TDeleteParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState->TxType == TTxState::TxDropKesus);
+
+ // Initiate asynchonous deletion of all shards
+ for (auto shard : txState->Shards) {
+ context.OnComplete.DeleteShard(shard.Idx);
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
+ return true;
+ }
+};
+
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropKesus TPropose"
- << " operationId#" << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", step: " << step
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState->TxType == TTxState::TxDropKesus);
-
- TPathId pathId = txState->TargetPathId;
- auto path = context.SS->PathsById.at(pathId);
- auto parentDir = context.SS->PathsById.at(path->ParentPathId);
-
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- Y_VERIFY(!path->Dropped());
- path->SetDropped(step, OperationId.GetTxId());
- context.SS->PersistDropStep(db, pathId, step, OperationId);
- auto domainInfo = context.SS->ResolveDomainInfo(pathId);
- domainInfo->DecPathsInside();
- parentDir->DecAliveChildren();
-
- // KIKIMR-13173
- // Repeat it here for a waile, delete it from TDeleteParts after
- // Initiate asynchonous deletion of all shards
- for (auto shard : txState->Shards) {
- context.OnComplete.DeleteShard(shard.Idx);
- }
-
+ return TStringBuilder()
+ << "TDropKesus TPropose"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", step: " << step
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState->TxType == TTxState::TxDropKesus);
+
+ TPathId pathId = txState->TargetPathId;
+ auto path = context.SS->PathsById.at(pathId);
+ auto parentDir = context.SS->PathsById.at(path->ParentPathId);
+
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ Y_VERIFY(!path->Dropped());
+ path->SetDropped(step, OperationId.GetTxId());
+ context.SS->PersistDropStep(db, pathId, step, OperationId);
+ auto domainInfo = context.SS->ResolveDomainInfo(pathId);
+ domainInfo->DecPathsInside();
+ parentDir->DecAliveChildren();
+
+ // KIKIMR-13173
+ // Repeat it here for a waile, delete it from TDeleteParts after
+ // Initiate asynchonous deletion of all shards
+ for (auto shard : txState->Shards) {
+ context.OnComplete.DeleteShard(shard.Idx);
+ }
+
if (!AppData()->DisableSchemeShardCleanupOnDropForTest) {
context.SS->PersistRemoveKesusInfo(db, pathId);
}
- context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size());
- context.SS->PersistUserAttributes(db, path->PathId, path->UserAttrs, nullptr);
-
- ++parentDir->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir);
- context.SS->ClearDescribePathCaches(parentDir);
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
-
- context.SS->ClearDescribePathCaches(path);
+ context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size());
+ context.SS->PersistUserAttributes(db, path->PathId, path->UserAttrs, nullptr);
+
+ ++parentDir->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir);
+ context.SS->ClearDescribePathCaches(parentDir);
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
+
+ context.SS->ClearDescribePathCaches(path);
context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
- context.OnComplete.DoneOperation(OperationId);
-
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxDropKesus);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-
-class TDropKesus: public TSubOperation {
+ context.OnComplete.DoneOperation(OperationId);
+
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxDropKesus);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+
+class TDropKesus: public TSubOperation {
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::DeleteParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::DeleteParts:
- return TTxState::Propose;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::DeleteParts:
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::DeleteParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::DeleteParts:
+ return TTxState::Propose;
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::DeleteParts:
return THolder(new TDeleteParts(OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new TPropose(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TDropKesus(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TDropKesus(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+
+ TDropKesus(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const auto& drop = Transaction.GetDrop();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = drop.GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropKesus Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", pathId: " << drop.GetId()
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- TPath path = drop.HasId()
- ? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
- : TPath::Resolve(parentPathStr, context.SS).Dive(name);
-
- {
- TPath::TChecker checks = path.Check();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropKesus Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", pathId: " << drop.GetId()
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ TPath path = drop.HasId()
+ ? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
+ : TPath::Resolve(parentPathStr, context.SS).Dive(name);
+
+ {
+ TPath::TChecker checks = path.Check();
checks
.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .IsKesus()
- .NotUnderDeleting()
- .NotUnderOperation()
- .IsCommonSensePath();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path table fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .IsKesus()
+ .NotUnderDeleting()
+ .NotUnderOperation()
+ .IsCommonSensePath();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path table fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
if (path.IsResolved() && path.Base()->IsKesus() && path.Base()->PlannedToDrop()) {
- result->SetPathDropTxId(ui64(path.Base()->DropTxId));
- result->SetPathId(path.Base()->PathId.LocalPathId);
+ result->SetPathDropTxId(ui64(path.Base()->DropTxId));
+ result->SetPathId(path.Base()->PathId.LocalPathId);
}
- return result;
- }
- }
-
+ return result;
+ }
+ }
+
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxDropKesus, path.Base()->PathId);
- // Dirty hack: drop step must not be zero because 0 is treated as "hasn't been dropped"
- txState.MinStep = TStepId(1);
- txState.State = TTxState::DeleteParts;
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- TKesusInfo::TPtr kesus = context.SS->KesusInfos.at(path.Base()->PathId);
- Y_VERIFY(kesus);
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxDropKesus, path.Base()->PathId);
+ // Dirty hack: drop step must not be zero because 0 is treated as "hasn't been dropped"
+ txState.MinStep = TStepId(1);
+ txState.State = TTxState::DeleteParts;
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ TKesusInfo::TPtr kesus = context.SS->KesusInfos.at(path.Base()->PathId);
+ Y_VERIFY(kesus);
+
{
- auto shardIdx = kesus->KesusShardIdx;
- txState.Shards.emplace_back(shardIdx, context.SS->ShardInfos.at(shardIdx).TabletType, txState.State);
-
- context.SS->ShardInfos.at(shardIdx).CurrentTxId = OperationId.GetTxId();
- context.SS->PersistShardTx(db, shardIdx, OperationId.GetTxId());
- }
-
- context.OnComplete.ActivateTx(OperationId);
- context.SS->PersistTxState(db, OperationId);
-
- path.Base()->PathState = TPathElement::EPathState::EPathStateDrop;
- path.Base()->DropTxId = OperationId.GetTxId();
- path.Base()->LastTxId = OperationId.GetTxId();
-
- context.SS->TabletCounters->Simple()[COUNTER_KESUS_COUNT].Sub(1);
-
- auto parentDir = path.Parent();
- ++parentDir.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
- context.SS->ClearDescribePathCaches(parentDir.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir.Base()->PathId);
-
- context.SS->ClearDescribePathCaches(path.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+ auto shardIdx = kesus->KesusShardIdx;
+ txState.Shards.emplace_back(shardIdx, context.SS->ShardInfos.at(shardIdx).TabletType, txState.State);
+
+ context.SS->ShardInfos.at(shardIdx).CurrentTxId = OperationId.GetTxId();
+ context.SS->PersistShardTx(db, shardIdx, OperationId.GetTxId());
+ }
+
+ context.OnComplete.ActivateTx(OperationId);
+ context.SS->PersistTxState(db, OperationId);
+
+ path.Base()->PathState = TPathElement::EPathState::EPathStateDrop;
+ path.Base()->DropTxId = OperationId.GetTxId();
+ path.Base()->LastTxId = OperationId.GetTxId();
+
+ context.SS->TabletCounters->Simple()[COUNTER_KESUS_COUNT].Sub(1);
+
+ auto parentDir = path.Parent();
+ ++parentDir.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
+ context.SS->ClearDescribePathCaches(parentDir.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir.Base()->PathId);
+
+ context.SS->ClearDescribePathCaches(path.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TDropKesus");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropKesus AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropKesus AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- TPathId pathId = txState->TargetPathId;
- Y_VERIFY(context.SS->PathsById.contains(pathId));
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
- Y_VERIFY(path);
-
- if (path->Dropped()) {
- for (auto shard : txState->Shards) {
- context.OnComplete.DeleteShard(shard.Idx);
- }
- }
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ TPathId pathId = txState->TargetPathId;
+ Y_VERIFY(context.SS->PathsById.contains(pathId));
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+ Y_VERIFY(path);
+
+ if (path->Dropped()) {
+ for (auto shard : txState->Shards) {
+ context.OnComplete.DeleteShard(shard.Idx);
+ }
+ }
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateDropKesus(TOperationId id, const TTxTransaction& tx) {
return new TDropKesus(id, tx);
}
-ISubOperationBase::TPtr CreateDropKesus(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateDropKesus(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TDropKesus(id, state);
-}
-
-}
-}
+ return new TDropKesus(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_lock.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_lock.cpp
index da3013ec97e..6fc10d04958 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_lock.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_lock.cpp
@@ -1,217 +1,217 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/protos/flat_scheme_op.pb.h>
-
+
#include <ydb/core/base/subdomain.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-
-class TDropLock: public TSubOperation {
- const TOperationId OperationId;
- const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::Done;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::Done:
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+
+class TDropLock: public TSubOperation {
+ const TOperationId OperationId;
+ const TTxTransaction Transaction;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::Done;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ return TTxState::Done;
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::Done:
return MakeHolder<TDone>(OperationId);
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
- TDropLock(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
- , Transaction(tx)
- {
- }
-
- TDropLock(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
- auto schema = Transaction.GetLockConfig();
-
- const TString& parentPathStr = Transaction.GetWorkingDir();
- const TString& name = schema.GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropLock Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
- {
- NSchemeShard::TPath::TChecker checks = parentPath.Check();
- checks
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsCommonSensePath()
- .IsLikeDirectory();
-
- if (!checks) {
- TString explain = TStringBuilder() << "parent path fail checks"
- << ", path: " << parentPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- NSchemeShard::TPath dstPath = parentPath.Child(name);
- {
- NSchemeShard::TPath::TChecker checks = dstPath.Check();
- checks
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotUnderDeleting()
- .NotUnderOperation()
- .IsCommonSensePath();
-
- if (!checks) {
- TString explain = TStringBuilder() << "dst path fail checks"
- << ", path: " << dstPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- if (dstPath.IsResolved()) {
- result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
- }
- return result;
- }
- }
-
- const auto& lockguard = Transaction.GetLockGuard();
- auto lockOwner = TTxId(lockguard.GetOwnerTxId());
- if (!lockguard.HasOwnerTxId() || !lockOwner) {
- TString explain = TStringBuilder()
- << "lock owner tx id unset"
- << " path: " << dstPath.PathString();
- result->SetError(TEvSchemeShard::EStatus::StatusInvalidParameter, explain);
- return result;
- }
-
- TPathElement::TPtr pathEl = dstPath.Base();
- TPathId pathId = pathEl->PathId;
- result->SetPathId(pathId.LocalPathId);
-
- if (!dstPath.LockedBy()) {
- TString explain = TStringBuilder()
- << "dst path fail checks"
- << ", path already unlocked"
- << ", path: " << dstPath.PathString();
- result->SetError(TEvSchemeShard::EStatus::StatusAlreadyExists, explain);
- return result;
- }
-
- TString errMsg;
- if (!context.SS->CheckLocks(pathId, Transaction, errMsg)) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, errMsg);
- return result;
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- pathEl->LastTxId = OperationId.GetTxId();
- pathEl->PathState = NKikimrSchemeOp::EPathState::EPathStateAlter;
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxDropLock, pathId);
- txState.State = TTxState::Done;
- context.SS->PersistTxState(db, OperationId);
-
- if (pathEl->IsTable()) {
- TTableInfo::TPtr table = context.SS->Tables.at(pathId);
- for (auto splitTx: table->GetSplitOpsInFlight()) {
- context.OnComplete.Dependence(splitTx.GetTxId(), OperationId.GetTxId());
- }
- Y_VERIFY_DEBUG(table->GetSplitOpsInFlight().size() == 0);
- }
-
- auto lockedBy = context.SS->LockedPaths[pathId];
- Y_VERIFY(lockedBy == lockOwner);
- context.SS->LockedPaths.erase(pathId);
-
- context.SS->PersistUnLock(db, pathId);
- context.SS->TabletCounters->Simple()[COUNTER_LOCKS_COUNT].Sub(1);
-
- context.OnComplete.ActivateTx(OperationId);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
- void AbortPropose(TOperationContext&) override {
- Y_FAIL("no AbortPropose for TDropLock");
- }
-
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropLock AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
- << ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-ISubOperationBase::TPtr DropLock(TOperationId id, const TTxTransaction& tx) {
- return new TDropLock(id, tx);
-}
-
-ISubOperationBase::TPtr DropLock(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state != TTxState::Invalid);
- return new TDropLock(id, state);
-}
-
-}
-}
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
+ TDropLock(TOperationId id, const TTxTransaction& tx)
+ : OperationId(id)
+ , Transaction(tx)
+ {
+ }
+
+ TDropLock(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ auto schema = Transaction.GetLockConfig();
+
+ const TString& parentPathStr = Transaction.GetWorkingDir();
+ const TString& name = schema.GetName();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropLock Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
+ {
+ NSchemeShard::TPath::TChecker checks = parentPath.Check();
+ checks
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsCommonSensePath()
+ .IsLikeDirectory();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent path fail checks"
+ << ", path: " << parentPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ NSchemeShard::TPath dstPath = parentPath.Child(name);
+ {
+ NSchemeShard::TPath::TChecker checks = dstPath.Check();
+ checks
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotUnderDeleting()
+ .NotUnderOperation()
+ .IsCommonSensePath();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "dst path fail checks"
+ << ", path: " << dstPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ if (dstPath.IsResolved()) {
+ result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+ }
+ return result;
+ }
+ }
+
+ const auto& lockguard = Transaction.GetLockGuard();
+ auto lockOwner = TTxId(lockguard.GetOwnerTxId());
+ if (!lockguard.HasOwnerTxId() || !lockOwner) {
+ TString explain = TStringBuilder()
+ << "lock owner tx id unset"
+ << " path: " << dstPath.PathString();
+ result->SetError(TEvSchemeShard::EStatus::StatusInvalidParameter, explain);
+ return result;
+ }
+
+ TPathElement::TPtr pathEl = dstPath.Base();
+ TPathId pathId = pathEl->PathId;
+ result->SetPathId(pathId.LocalPathId);
+
+ if (!dstPath.LockedBy()) {
+ TString explain = TStringBuilder()
+ << "dst path fail checks"
+ << ", path already unlocked"
+ << ", path: " << dstPath.PathString();
+ result->SetError(TEvSchemeShard::EStatus::StatusAlreadyExists, explain);
+ return result;
+ }
+
+ TString errMsg;
+ if (!context.SS->CheckLocks(pathId, Transaction, errMsg)) {
+ result->SetError(NKikimrScheme::StatusMultipleModifications, errMsg);
+ return result;
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ pathEl->LastTxId = OperationId.GetTxId();
+ pathEl->PathState = NKikimrSchemeOp::EPathState::EPathStateAlter;
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxDropLock, pathId);
+ txState.State = TTxState::Done;
+ context.SS->PersistTxState(db, OperationId);
+
+ if (pathEl->IsTable()) {
+ TTableInfo::TPtr table = context.SS->Tables.at(pathId);
+ for (auto splitTx: table->GetSplitOpsInFlight()) {
+ context.OnComplete.Dependence(splitTx.GetTxId(), OperationId.GetTxId());
+ }
+ Y_VERIFY_DEBUG(table->GetSplitOpsInFlight().size() == 0);
+ }
+
+ auto lockedBy = context.SS->LockedPaths[pathId];
+ Y_VERIFY(lockedBy == lockOwner);
+ context.SS->LockedPaths.erase(pathId);
+
+ context.SS->PersistUnLock(db, pathId);
+ context.SS->TabletCounters->Simple()[COUNTER_LOCKS_COUNT].Sub(1);
+
+ context.OnComplete.ActivateTx(OperationId);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
+ void AbortPropose(TOperationContext&) override {
+ Y_FAIL("no AbortPropose for TDropLock");
+ }
+
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropLock AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+ISubOperationBase::TPtr DropLock(TOperationId id, const TTxTransaction& tx) {
+ return new TDropLock(id, tx);
+}
+
+ISubOperationBase::TPtr DropLock(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state != TTxState::Invalid);
+ return new TDropLock(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_olap_store.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_olap_store.cpp
index a3ccb90dea0..ef1dafb905c 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_olap_store.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_olap_store.cpp
@@ -5,7 +5,7 @@
#include <ydb/core/base/subdomain.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
namespace {
@@ -96,7 +96,7 @@ public:
domainInfo->DecPathsInside();
parentDir->DecAliveChildren();
- context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size());
+ context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size());
context.SS->PersistUserAttributes(db, path->PathId, path->UserAttrs, nullptr);
++parentDir->DirAlterVersion;
@@ -271,7 +271,7 @@ public:
}
public:
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
const TTabletId ssId = context.SS->SelfTabletId();
const auto& drop = Transaction.GetDrop();
@@ -286,7 +286,7 @@ public:
<< ", opId: " << OperationId
<< ", at schemeshard: " << ssId);
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
TPath path = drop.HasId()
? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
@@ -303,7 +303,7 @@ public:
.IsOlapStore()
.NotUnderDeleting()
.NotUnderOperation()
- .NotChildren(NKikimrScheme::StatusNameConflict);
+ .NotChildren(NKikimrScheme::StatusNameConflict);
if (!checks) {
TString explain = TStringBuilder() << "path fail checks"
@@ -340,7 +340,7 @@ public:
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
return result;
}
@@ -349,7 +349,7 @@ public:
if (!storeInfo->OlapTables.empty()) {
errStr = TStringBuilder() << "OlapStore cannot be dropped until all tables are dropped";
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
return result;
}
@@ -382,9 +382,9 @@ public:
path.Base()->LastTxId = OperationId.GetTxId();
context.SS->PersistLastTxId(db, path.Base());
- context.SS->PersistTxState(db, OperationId);
+ context.SS->PersistTxState(db, OperationId);
- context.SS->TabletCounters->Simple()[COUNTER_OLAP_STORE_COUNT].Sub(1);
+ context.SS->TabletCounters->Simple()[COUNTER_OLAP_STORE_COUNT].Sub(1);
Y_VERIFY_S(context.SS->PathsById.contains(path.Base()->ParentPathId),
"no parent with id: " << path.Base()->ParentPathId << " for node with id: " << path.Base()->PathId);
@@ -472,7 +472,7 @@ private:
private:
const TOperationId OperationId;
TTxState::ETxState State = TTxState::Invalid;
- const NKikimrSchemeOp::TModifyScheme Transaction;
+ const NKikimrSchemeOp::TModifyScheme Transaction;
};
} // namespace
@@ -486,5 +486,5 @@ ISubOperationBase::TPtr CreateDropOlapStore(TOperationId id, TTxState::ETxState
return new TDropOlapStore(id, state);
}
-} // namespace NSchemeShard
+} // namespace NSchemeShard
} // namespace NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_olap_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_olap_table.cpp
index 1d21cd6641d..02ca98d2365 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_olap_table.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_olap_table.cpp
@@ -5,7 +5,7 @@
#include <ydb/core/base/subdomain.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
namespace {
@@ -135,7 +135,7 @@ public:
domainInfo->DecPathsInside();
parentDir->DecAliveChildren();
- context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size());
+ context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size());
context.SS->PersistUserAttributes(db, path->PathId, path->UserAttrs, nullptr);
++parentDir->DirAlterVersion;
@@ -310,7 +310,7 @@ public:
}
public:
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
const TTabletId ssId = context.SS->SelfTabletId();
const auto& drop = Transaction.GetDrop();
@@ -325,7 +325,7 @@ public:
<< ", opId: " << OperationId
<< ", at schemeshard: " << ssId);
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
TPath path = drop.HasId()
? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
@@ -402,7 +402,7 @@ public:
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
return result;
}
@@ -442,9 +442,9 @@ public:
path.Base()->LastTxId = OperationId.GetTxId();
context.SS->PersistLastTxId(db, path.Base());
- context.SS->PersistTxState(db, OperationId);
+ context.SS->PersistTxState(db, OperationId);
- context.SS->TabletCounters->Simple()[COUNTER_OLAP_TABLE_COUNT].Sub(1);
+ context.SS->TabletCounters->Simple()[COUNTER_OLAP_TABLE_COUNT].Sub(1);
Y_VERIFY_S(context.SS->PathsById.contains(path.Base()->ParentPathId),
"no parent with id: " << path.Base()->ParentPathId << " for node with id: " << path.Base()->PathId);
@@ -532,7 +532,7 @@ private:
private:
const TOperationId OperationId;
TTxState::ETxState State = TTxState::Invalid;
- const NKikimrSchemeOp::TModifyScheme Transaction;
+ const NKikimrSchemeOp::TModifyScheme Transaction;
};
} // namespace
@@ -546,5 +546,5 @@ ISubOperationBase::TPtr CreateDropOlapTable(TOperationId id, TTxState::ETxState
return new TDropOlapTable(id, state);
}
-} // namespace NSchemeShard
+} // namespace NSchemeShard
} // namespace NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_pq.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_pq.cpp
index 9cd0f56e3e1..c338b4c358b 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_pq.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_pq.cpp
@@ -1,212 +1,212 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TDropParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TDropParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropPQ TDropParts"
- << " operationId#" << OperationId;
- }
-
-public:
- TDropParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool HandleReply(TEvPersQueue::TEvDropTabletReply::TPtr& ev, TOperationContext& context) override {
- auto ssId = context.SS->SelfTabletId();
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropParts HandleReply TEvPersQueue::TEvDropTabletReply"
- << " operationId# " << OperationId
- << " at tabletId# " << ssId
- << " message# " << ev->Get()->Record.ShortDebugString());
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxDropPQGroup);
-
- auto& record = ev->Get()->Record;
-
- Y_VERIFY(record.GetStatus() == NKikimrProto::OK);
- Y_VERIFY(record.GetActualState() == NKikimrPQ::EDropped);
-
- auto tabletId = TTabletId(record.GetTabletId());
+ return TStringBuilder()
+ << "TDropPQ TDropParts"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TDropParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool HandleReply(TEvPersQueue::TEvDropTabletReply::TPtr& ev, TOperationContext& context) override {
+ auto ssId = context.SS->SelfTabletId();
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropParts HandleReply TEvPersQueue::TEvDropTabletReply"
+ << " operationId# " << OperationId
+ << " at tabletId# " << ssId
+ << " message# " << ev->Get()->Record.ShortDebugString());
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxDropPQGroup);
+
+ auto& record = ev->Get()->Record;
+
+ Y_VERIFY(record.GetStatus() == NKikimrProto::OK);
+ Y_VERIFY(record.GetActualState() == NKikimrPQ::EDropped);
+
+ auto tabletId = TTabletId(record.GetTabletId());
auto idx = context.SS->MustGetShardIdx(tabletId);
-
- if (!txState->ShardsInProgress.contains(idx)) {
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Ignored repeated drop tablet reply for txId %" << OperationId.GetTxId() << " tablet " << tabletId);
- return false;
- }
-
- Y_VERIFY(txState->State == TTxState::DropParts);
- txState->ShardsInProgress.erase(idx);
-
- context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, idx);
-
- if (txState->ShardsInProgress.empty()) {
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::DeleteParts);
- context.OnComplete.ActivateTx(OperationId);
- return true;
- }
-
- return false;
- }
-
-
- bool ProgressState(TOperationContext& context) override {
- auto ssId = context.SS->SelfTabletId();
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropParts ProgressState"
- << " operationId# " << OperationId
- << " at tablet " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxDropPQGroup);
-
- txState->ClearShardsInProgress();
-
- TString topicName = context.SS->PathsById.at(txState->TargetPathId)->Name;
- Y_VERIFY_S(topicName.size(), "topicName is empty. PathId: " << txState->TargetPathId);
-
- TPersQueueGroupInfo::TPtr pqGroup = context.SS->PersQueueGroups.at(txState->TargetPathId);
- Y_VERIFY_S(pqGroup, "pqGroup is null. PathId: " << txState->TargetPathId);
-
- bool haveWork = false;
- for (auto shard : txState->Shards) {
- if (shard.Operation != TTxState::DropParts) {
- continue;
- }
- haveWork = true;
-
- auto idx = shard.Idx;
- auto tabletId = context.SS->ShardInfos[idx].TabletID;
-
- TAutoPtr<TEvPersQueue::TEvDropTablet> event(new TEvPersQueue::TEvDropTablet());
- event->Record.SetTxId(ui64(OperationId.GetTxId()));
- event->Record.SetRequestedState(NKikimrPQ::EDropped);
-
- context.OnComplete.BindMsgToPipe(OperationId, tabletId, idx, event.Release());
- }
-
- txState->UpdateShardsInProgress(TTxState::DropParts);
-
- if (!haveWork) {
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::DeleteParts);
- context.OnComplete.ActivateTx(OperationId);
- return true;
- }
-
- return false;
- }
-};
-
-
-class TDeleteParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+ if (!txState->ShardsInProgress.contains(idx)) {
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Ignored repeated drop tablet reply for txId %" << OperationId.GetTxId() << " tablet " << tabletId);
+ return false;
+ }
+
+ Y_VERIFY(txState->State == TTxState::DropParts);
+ txState->ShardsInProgress.erase(idx);
+
+ context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, idx);
+
+ if (txState->ShardsInProgress.empty()) {
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::DeleteParts);
+ context.OnComplete.ActivateTx(OperationId);
+ return true;
+ }
+
+ return false;
+ }
+
+
+ bool ProgressState(TOperationContext& context) override {
+ auto ssId = context.SS->SelfTabletId();
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropParts ProgressState"
+ << " operationId# " << OperationId
+ << " at tablet " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxDropPQGroup);
+
+ txState->ClearShardsInProgress();
+
+ TString topicName = context.SS->PathsById.at(txState->TargetPathId)->Name;
+ Y_VERIFY_S(topicName.size(), "topicName is empty. PathId: " << txState->TargetPathId);
+
+ TPersQueueGroupInfo::TPtr pqGroup = context.SS->PersQueueGroups.at(txState->TargetPathId);
+ Y_VERIFY_S(pqGroup, "pqGroup is null. PathId: " << txState->TargetPathId);
+
+ bool haveWork = false;
+ for (auto shard : txState->Shards) {
+ if (shard.Operation != TTxState::DropParts) {
+ continue;
+ }
+ haveWork = true;
+
+ auto idx = shard.Idx;
+ auto tabletId = context.SS->ShardInfos[idx].TabletID;
+
+ TAutoPtr<TEvPersQueue::TEvDropTablet> event(new TEvPersQueue::TEvDropTablet());
+ event->Record.SetTxId(ui64(OperationId.GetTxId()));
+ event->Record.SetRequestedState(NKikimrPQ::EDropped);
+
+ context.OnComplete.BindMsgToPipe(OperationId, tabletId, idx, event.Release());
+ }
+
+ txState->UpdateShardsInProgress(TTxState::DropParts);
+
+ if (!haveWork) {
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::DeleteParts);
+ context.OnComplete.ActivateTx(OperationId);
+ return true;
+ }
+
+ return false;
+ }
+};
+
+
+class TDeleteParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropPQ TProposedDeletePart"
- << ", operationId: " << OperationId;
- }
-
-public:
- TDeleteParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvPersQueue::TEvDropTabletReply::EventType});
- }
-
- bool ProgressState(TOperationContext& context) override {
- auto ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
-
- // Initiate asynchonous deletion of all shards
- for (auto shard : txState->Shards) {
- context.OnComplete.DeleteShard(shard.Idx);
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
- context.OnComplete.ActivateTx(OperationId);
- return true;
- }
-
-};
-
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ return TStringBuilder()
+ << "TDropPQ TProposedDeletePart"
+ << ", operationId: " << OperationId;
+ }
+
+public:
+ TDeleteParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvPersQueue::TEvDropTabletReply::EventType});
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ auto ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+
+ // Initiate asynchonous deletion of all shards
+ for (auto shard : txState->Shards) {
+ context.OnComplete.DeleteShard(shard.Idx);
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::Propose);
+ context.OnComplete.ActivateTx(OperationId);
+ return true;
+ }
+
+};
+
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropPQ TPropose"
- << ", operationId: " << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvPersQueue::TEvDropTabletReply::EventType});
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- auto step = TStepId(ev->Get()->StepId);
- auto ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", step: " << step
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState->TxType == TTxState::TxDropPQGroup);
-
- TPathId pathId = txState->TargetPathId;
- auto path = context.SS->PathsById.at(pathId);
- auto parentDir = context.SS->PathsById.at(path->ParentPathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- Y_VERIFY(!path->Dropped());
- path->SetDropped(step, OperationId.GetTxId());
- context.SS->PersistDropStep(db, pathId, step, OperationId);
+ return TStringBuilder()
+ << "TDropPQ TPropose"
+ << ", operationId: " << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvPersQueue::TEvDropTabletReply::EventType});
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ auto step = TStepId(ev->Get()->StepId);
+ auto ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", step: " << step
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState->TxType == TTxState::TxDropPQGroup);
+
+ TPathId pathId = txState->TargetPathId;
+ auto path = context.SS->PathsById.at(pathId);
+ auto parentDir = context.SS->PathsById.at(path->ParentPathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ Y_VERIFY(!path->Dropped());
+ path->SetDropped(step, OperationId.GetTxId());
+ context.SS->PersistDropStep(db, pathId, step, OperationId);
TPersQueueGroupInfo::TPtr pqGroup = context.SS->PersQueueGroups.at(pathId);
Y_VERIFY(pqGroup);
- // KIKIMR-13173
- // Repeat it here for a waile, delete it from TDeleteParts after
- // Initiate asynchonous deletion of all shards
- for (auto shard : txState->Shards) {
- context.OnComplete.DeleteShard(shard.Idx);
- }
-
+ // KIKIMR-13173
+ // Repeat it here for a waile, delete it from TDeleteParts after
+ // Initiate asynchonous deletion of all shards
+ for (auto shard : txState->Shards) {
+ context.OnComplete.DeleteShard(shard.Idx);
+ }
+
auto tabletConfig = pqGroup->TabletConfig;
NKikimrPQ::TPQTabletConfig config;
Y_VERIFY(!tabletConfig.empty());
@@ -224,199 +224,199 @@ public:
context.SS->TabletCounters->Simple()[COUNTER_STREAM_RESERVED_THROUGHPUT].Sub(throughput);
context.SS->TabletCounters->Simple()[COUNTER_STREAM_RESERVED_STORAGE].Sub(storage);
- context.SS->TabletCounters->Simple()[COUNTER_STREAM_SHARDS_COUNT].Sub(pqGroup->TotalPartitionCount);
+ context.SS->TabletCounters->Simple()[COUNTER_STREAM_SHARDS_COUNT].Sub(pqGroup->TotalPartitionCount);
+
+ parentDir->DecAliveChildren();
- parentDir->DecAliveChildren();
-
if (!AppData()->DisableSchemeShardCleanupOnDropForTest) {
context.SS->PersistRemovePersQueueGroup(db, pathId);
}
- context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size());
- context.SS->PersistUserAttributes(db, path->PathId, path->UserAttrs, nullptr);
-
- ++parentDir->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir);
- context.SS->ClearDescribePathCaches(parentDir);
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
-
- context.SS->ClearDescribePathCaches(path);
+ context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size());
+ context.SS->PersistUserAttributes(db, path->PathId, path->UserAttrs, nullptr);
+
+ ++parentDir->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir);
+ context.SS->ClearDescribePathCaches(parentDir);
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
+
+ context.SS->ClearDescribePathCaches(path);
context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
context.SS->ChangeTxState(db, OperationId, TTxState::Done);
context.OnComplete.ActivateTx(OperationId);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- auto ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxDropPQGroup);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-
-class TDropPQ: public TSubOperation {
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ auto ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxDropPQGroup);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+
+class TDropPQ: public TSubOperation {
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::DropParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::DropParts:
- return TTxState::DeleteParts;
- case TTxState::DeleteParts:
- return TTxState::Propose;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::DropParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::DropParts:
+ return TTxState::DeleteParts;
+ case TTxState::DeleteParts:
+ return TTxState::Propose;
case TTxState::Propose:
return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::DropParts:
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::DropParts:
return THolder(new TDropParts(OperationId));
- case TTxState::DeleteParts:
+ case TTxState::DeleteParts:
return THolder(new TDeleteParts(OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new TPropose(OperationId));
case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TDropPQ(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TDropPQ(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- void SetPQBalancer(TPersQueueGroupInfo::TPtr pqGroup, TTxState& txState, TOperationContext& context) {
- auto shardId = pqGroup->BalancerShardIdx;
- auto tabletId = pqGroup->BalancerTabletID;
-
- if (pqGroup->AlterData) {
- shardId = pqGroup->AlterData->BalancerShardIdx;
- tabletId = pqGroup->AlterData->BalancerTabletID;
- }
-
- if (shardId && tabletId != InvalidTabletId) {
- Y_VERIFY_S(context.SS->ShardInfos[shardId].TabletID == tabletId,
- "shardId: " << shardId << " tabletId: " << tabletId << " has alter pointer: " << ui64(!!pqGroup->AlterData));
- txState.Shards.emplace_back(shardId, ETabletType::PersQueueReadBalancer, TTxState::DeleteParts);
- }
- }
-
- void SetPQShards(TPersQueueGroupInfo::TPtr pqGroup, TTxState& txState, TOperationContext& context) {
- ui32 drops = 0;
- for (auto shard : pqGroup->Shards) {
- auto shardIdx = shard.first;
- TPQShardInfo::TPtr info = shard.second;
-
- auto tabletId = context.SS->ShardInfos[shardIdx].TabletID;
-
- TTxState::ETxState operation = TTxState::DeleteParts;
- if (tabletId != InvalidTabletId) {
- operation = TTxState::DropParts;
- ++drops;
- }
-
- txState.Shards.emplace_back(shardIdx, ETabletType::PersQueue, operation);
- }
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+
+ TDropPQ(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ void SetPQBalancer(TPersQueueGroupInfo::TPtr pqGroup, TTxState& txState, TOperationContext& context) {
+ auto shardId = pqGroup->BalancerShardIdx;
+ auto tabletId = pqGroup->BalancerTabletID;
+
+ if (pqGroup->AlterData) {
+ shardId = pqGroup->AlterData->BalancerShardIdx;
+ tabletId = pqGroup->AlterData->BalancerTabletID;
+ }
+
+ if (shardId && tabletId != InvalidTabletId) {
+ Y_VERIFY_S(context.SS->ShardInfos[shardId].TabletID == tabletId,
+ "shardId: " << shardId << " tabletId: " << tabletId << " has alter pointer: " << ui64(!!pqGroup->AlterData));
+ txState.Shards.emplace_back(shardId, ETabletType::PersQueueReadBalancer, TTxState::DeleteParts);
+ }
+ }
+
+ void SetPQShards(TPersQueueGroupInfo::TPtr pqGroup, TTxState& txState, TOperationContext& context) {
+ ui32 drops = 0;
+ for (auto shard : pqGroup->Shards) {
+ auto shardIdx = shard.first;
+ TPQShardInfo::TPtr info = shard.second;
+
+ auto tabletId = context.SS->ShardInfos[shardIdx].TabletID;
+
+ TTxState::ETxState operation = TTxState::DeleteParts;
+ if (tabletId != InvalidTabletId) {
+ operation = TTxState::DropParts;
+ ++drops;
+ }
+
+ txState.Shards.emplace_back(shardIdx, ETabletType::PersQueue, operation);
+ }
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const auto& drop = Transaction.GetDrop();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = drop.GetName();
- NKikimrSchemeOp::EDropWaitPolicy dropPolicy = drop.HasWaitPolicy() ? drop.GetWaitPolicy() : NKikimrSchemeOp::EDropFailOnChanges;
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropPQ Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", pathId: " << drop.GetId()
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- TPath path = drop.HasId()
- ? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
- : TPath::Resolve(parentPathStr, context.SS).Dive(name);
-
- {
- TPath::TChecker checks = path.Check();
+ NKikimrSchemeOp::EDropWaitPolicy dropPolicy = drop.HasWaitPolicy() ? drop.GetWaitPolicy() : NKikimrSchemeOp::EDropFailOnChanges;
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropPQ Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", pathId: " << drop.GetId()
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ TPath path = drop.HasId()
+ ? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
+ : TPath::Resolve(parentPathStr, context.SS).Dive(name);
+
+ {
+ TPath::TChecker checks = path.Check();
checks
.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .NotUnderOperation()
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .NotUnderOperation()
.IsPQGroup();
-
- if (checks) {
- if (dropPolicy == NKikimrSchemeOp::EDropFailOnChanges) {
- checks.NotUnderOperation();
- }
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "path table fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
+
+ if (checks) {
+ if (dropPolicy == NKikimrSchemeOp::EDropFailOnChanges) {
+ checks.NotUnderOperation();
+ }
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path table fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
if (path.IsResolved() && path.Base()->IsPQGroup() && path.Base()->PlannedToDrop()) {
- result->SetPathDropTxId(ui64(path.Base()->DropTxId));
- result->SetPathId(path.Base()->PathId.LocalPathId);
+ result->SetPathDropTxId(ui64(path.Base()->DropTxId));
+ result->SetPathId(path.Base()->PathId.LocalPathId);
}
- return result;
- }
- }
-
+ return result;
+ }
+ }
+
TPath parent = path.Parent();
{
TPath::TChecker checks = parent.Check();
@@ -449,100 +449,100 @@ public:
}
}
- if (dropPolicy != NKikimrSchemeOp::EDropFailOnChanges) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "drop policy isn't supported");
- return result;
- }
-
+ if (dropPolicy != NKikimrSchemeOp::EDropFailOnChanges) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "drop policy isn't supported");
+ return result;
+ }
+
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- TPersQueueGroupInfo::TPtr pqGroup = context.SS->PersQueueGroups.at(path.Base()->PathId);
- Y_VERIFY(pqGroup);
-
- if (pqGroup->AlterData) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, "Drop over Create/Alter");
- return result;
- }
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxDropPQGroup, path.Base()->PathId);
- // Dirty hack: drop step must not be zero because 0 is treated as "hasn't been dropped"
- txState.MinStep = TStepId(1);
-
- NIceDb::TNiceDb db(context.Txc.DB);
- SetPQShards(pqGroup, txState, context);
- SetPQBalancer(pqGroup, txState, context);
-
- txState.State = TTxState::DropParts;
- context.OnComplete.ActivateTx(OperationId);
-
- path.Base()->PathState = TPathElement::EPathState::EPathStateDrop;
- path.Base()->DropTxId = OperationId.GetTxId();
- path.Base()->LastTxId = OperationId.GetTxId();
-
- context.SS->PersistTxState(db, OperationId);
-
- context.SS->TabletCounters->Simple()[COUNTER_PQ_GROUP_COUNT].Sub(1);
-
- auto parentDir = path.Parent();
- ++parentDir.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
- context.SS->ClearDescribePathCaches(parentDir.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir.Base()->PathId);
-
- context.SS->ClearDescribePathCaches(path.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ TPersQueueGroupInfo::TPtr pqGroup = context.SS->PersQueueGroups.at(path.Base()->PathId);
+ Y_VERIFY(pqGroup);
+
+ if (pqGroup->AlterData) {
+ result->SetError(NKikimrScheme::StatusMultipleModifications, "Drop over Create/Alter");
+ return result;
+ }
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxDropPQGroup, path.Base()->PathId);
+ // Dirty hack: drop step must not be zero because 0 is treated as "hasn't been dropped"
+ txState.MinStep = TStepId(1);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ SetPQShards(pqGroup, txState, context);
+ SetPQBalancer(pqGroup, txState, context);
+
+ txState.State = TTxState::DropParts;
+ context.OnComplete.ActivateTx(OperationId);
+
+ path.Base()->PathState = TPathElement::EPathState::EPathStateDrop;
+ path.Base()->DropTxId = OperationId.GetTxId();
+ path.Base()->LastTxId = OperationId.GetTxId();
+
+ context.SS->PersistTxState(db, OperationId);
+
+ context.SS->TabletCounters->Simple()[COUNTER_PQ_GROUP_COUNT].Sub(1);
+
+ auto parentDir = path.Parent();
+ ++parentDir.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
+ context.SS->ClearDescribePathCaches(parentDir.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir.Base()->PathId);
+
+ context.SS->ClearDescribePathCaches(path.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TDropPQ");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropPQ AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropPQ AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- TPathId pathId = txState->TargetPathId;
- Y_VERIFY(context.SS->PathsById.contains(pathId));
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
- Y_VERIFY(path);
-
- if (path->Dropped()) {
- for (auto shard : txState->Shards) {
- context.OnComplete.DeleteShard(shard.Idx);
- }
- }
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ TPathId pathId = txState->TargetPathId;
+ Y_VERIFY(context.SS->PathsById.contains(pathId));
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+ Y_VERIFY(path);
+
+ if (path->Dropped()) {
+ for (auto shard : txState->Shards) {
+ context.OnComplete.DeleteShard(shard.Idx);
+ }
+ }
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateDropPQ(TOperationId id, const TTxTransaction& tx) {
return new TDropPQ(id, tx);
}
-ISubOperationBase::TPtr CreateDropPQ(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateDropPQ(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TDropPQ(id, state);
-}
-
-}
-}
+ return new TDropPQ(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_sequence.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_sequence.cpp
index 5c6fdb6fa89..f9c8734073b 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_sequence.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_sequence.cpp
@@ -5,7 +5,7 @@
#include <ydb/core/tx/sequenceshard/public/events.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
namespace {
@@ -277,7 +277,7 @@ public:
<< ", opId: " << OperationId
<< ", at schemeshard: " << ssId);
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
TPath path = drop.HasId()
? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
@@ -352,14 +352,14 @@ public:
TString explain = TStringBuilder() << "cannot delete sequence " << path->Name
<< " used by table " << parent.PathString();
// FIXME: status is consistent with rmdir, but is it correct?
- result->SetError(NKikimrScheme::StatusNameConflict, explain);
+ result->SetError(NKikimrScheme::StatusNameConflict, explain);
return result;
}
}
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
return result;
}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_solomon.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_solomon.cpp
index 0429941d81a..bdd9f953d43 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_solomon.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_solomon.cpp
@@ -1,315 +1,315 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TDeleteParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TDeleteParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropSolomon TDeleteParts"
- << ", operationId: " << OperationId;
- }
-
-public:
- TDeleteParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvPrivate::TEvOperationPlan::EventType});
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
-
- // Initiate asynchonous deletion of all shards
- for (auto shard : txState->Shards) {
- context.OnComplete.DeleteShard(shard.Idx);
- }
-
- context.OnComplete.DoneOperation(OperationId);
- return true;
- }
-};
-
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ return TStringBuilder()
+ << "TDropSolomon TDeleteParts"
+ << ", operationId: " << OperationId;
+ }
+
+public:
+ TDeleteParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvPrivate::TEvOperationPlan::EventType});
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+
+ // Initiate asynchonous deletion of all shards
+ for (auto shard : txState->Shards) {
+ context.OnComplete.DeleteShard(shard.Idx);
+ }
+
+ context.OnComplete.DoneOperation(OperationId);
+ return true;
+ }
+};
+
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropSolomon TPropose"
- << " operationId#" << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", step: " << step
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState->TxType == TTxState::TxDropSolomonVolume);
-
-
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- auto pathes = context.SS->ListSubThee(pathId, context.Ctx);
- Y_VERIFY(pathes.size() == 1);
- context.SS->DropPathes(pathes, step, OperationId.GetTxId(), db, context.Ctx);
-
+ return TStringBuilder()
+ << "TDropSolomon TPropose"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", step: " << step
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState->TxType == TTxState::TxDropSolomonVolume);
+
+
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ auto pathes = context.SS->ListSubThee(pathId, context.Ctx);
+ Y_VERIFY(pathes.size() == 1);
+ context.SS->DropPathes(pathes, step, OperationId.GetTxId(), db, context.Ctx);
+
if (!AppData()->DisableSchemeShardCleanupOnDropForTest) {
context.SS->PersistRemoveSolomonVolume(db, pathId);
}
- auto parentDir = context.SS->PathsById.at(path->ParentPathId);
- ++parentDir->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir);
- context.SS->ClearDescribePathCaches(parentDir);
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
-
- context.SS->ClearDescribePathCaches(path);
+ auto parentDir = context.SS->PathsById.at(path->ParentPathId);
+ ++parentDir->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir);
+ context.SS->ClearDescribePathCaches(parentDir);
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
+
+ context.SS->ClearDescribePathCaches(path);
context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
- context.SS->ChangeTxState(db, OperationId, TTxState::ProposedDeleteParts);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxDropSolomonVolume);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-
-class TDropSolomon: public TSubOperation {
+ context.SS->ChangeTxState(db, OperationId, TTxState::ProposedDeleteParts);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxDropSolomonVolume);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+
+class TDropSolomon: public TSubOperation {
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::Propose;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::Propose:
- return TTxState::ProposedDeleteParts;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::Propose:
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::Propose;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::Propose:
+ return TTxState::ProposedDeleteParts;
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::Propose:
return THolder(new TPropose(OperationId));
- case TTxState::ProposedDeleteParts:
+ case TTxState::ProposedDeleteParts:
return THolder(new TDeleteParts(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TDropSolomon(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TDropSolomon(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+
+ TDropSolomon(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const auto& drop = Transaction.GetDrop();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = drop.GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropSolomon Propose"
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropSolomon Propose"
<< ", path: " << parentPathStr << "/" << name
- << ", pathId: " << drop.GetId()
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- TPath path = drop.HasId()
- ? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
- : TPath::Resolve(parentPathStr, context.SS).Dive(name);
-
- {
- TPath::TChecker checks = path.Check();
+ << ", pathId: " << drop.GetId()
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ TPath path = drop.HasId()
+ ? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
+ : TPath::Resolve(parentPathStr, context.SS).Dive(name);
+
+ {
+ TPath::TChecker checks = path.Check();
checks
.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsSolomon()
- .NotUnderOperation()
- .IsCommonSensePath();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path table fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsSolomon()
+ .NotUnderOperation()
+ .IsCommonSensePath();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path table fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
if (path.IsResolved() && path.Base()->IsSolomon() && path.Base()->PlannedToDrop()) {
- result->SetPathDropTxId(ui64(path.Base()->DropTxId));
- result->SetPathId(path.Base()->PathId.LocalPathId);
+ result->SetPathDropTxId(ui64(path.Base()->DropTxId));
+ result->SetPathId(path.Base()->PathId.LocalPathId);
}
- return result;
- }
- }
-
+ return result;
+ }
+ }
+
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxDropSolomonVolume, path.Base()->PathId);
- // Dirty hack: drop step must not be zero because 0 is treated as "hasn't been dropped"
- txState.MinStep = TStepId(1);
- txState.State = TTxState::Propose;
-
- auto solomon = context.SS->SolomonVolumes.at(path.Base()->PathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- for (auto& part : solomon->Partitions) {
- auto shardIdx = part.first;
-
- txState.Shards.emplace_back(shardIdx, context.SS->ShardInfos.at(shardIdx).TabletType, txState.State);
-
- context.SS->ShardInfos[shardIdx].CurrentTxId = OperationId.GetTxId();
- context.SS->PersistShardTx(db, shardIdx, OperationId.GetTxId());
- }
-
- context.OnComplete.ActivateTx(OperationId);
- context.SS->PersistTxState(db, OperationId);
-
- path.Base()->PathState = TPathElement::EPathState::EPathStateDrop;
- path.Base()->DropTxId = OperationId.GetTxId();
- path.Base()->LastTxId = OperationId.GetTxId();
-
- context.SS->TabletCounters->Simple()[COUNTER_SOLOMON_VOLUME_COUNT].Sub(1);
-
- auto parentDir = path.Parent();
- ++parentDir.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
- context.SS->ClearDescribePathCaches(parentDir.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir.Base()->PathId);
-
- context.SS->ClearDescribePathCaches(path.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxDropSolomonVolume, path.Base()->PathId);
+ // Dirty hack: drop step must not be zero because 0 is treated as "hasn't been dropped"
+ txState.MinStep = TStepId(1);
+ txState.State = TTxState::Propose;
+
+ auto solomon = context.SS->SolomonVolumes.at(path.Base()->PathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ for (auto& part : solomon->Partitions) {
+ auto shardIdx = part.first;
+
+ txState.Shards.emplace_back(shardIdx, context.SS->ShardInfos.at(shardIdx).TabletType, txState.State);
+
+ context.SS->ShardInfos[shardIdx].CurrentTxId = OperationId.GetTxId();
+ context.SS->PersistShardTx(db, shardIdx, OperationId.GetTxId());
+ }
+
+ context.OnComplete.ActivateTx(OperationId);
+ context.SS->PersistTxState(db, OperationId);
+
+ path.Base()->PathState = TPathElement::EPathState::EPathStateDrop;
+ path.Base()->DropTxId = OperationId.GetTxId();
+ path.Base()->LastTxId = OperationId.GetTxId();
+
+ context.SS->TabletCounters->Simple()[COUNTER_SOLOMON_VOLUME_COUNT].Sub(1);
+
+ auto parentDir = path.Parent();
+ ++parentDir.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
+ context.SS->ClearDescribePathCaches(parentDir.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir.Base()->PathId);
+
+ context.SS->ClearDescribePathCaches(path.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TDropSolomon");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropSolomon AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropSolomon AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- TPathId pathId = txState->TargetPathId;
- Y_VERIFY(context.SS->PathsById.contains(pathId));
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
- Y_VERIFY(path);
-
- if (path->Dropped()) {
- for (auto shard : txState->Shards) {
- context.OnComplete.DeleteShard(shard.Idx);
- }
- }
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ TPathId pathId = txState->TargetPathId;
+ Y_VERIFY(context.SS->PathsById.contains(pathId));
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+ Y_VERIFY(path);
+
+ if (path->Dropped()) {
+ for (auto shard : txState->Shards) {
+ context.OnComplete.DeleteShard(shard.Idx);
+ }
+ }
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateDropSolomon(TOperationId id, const TTxTransaction& tx) {
return new TDropSolomon(id, tx);
}
-ISubOperationBase::TPtr CreateDropSolomon(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateDropSolomon(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TDropSolomon(id, state);
-}
-
-}
-}
+ return new TDropSolomon(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_subdomain.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_subdomain.cpp
index cd415a08664..832fd1df70a 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_subdomain.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_subdomain.cpp
@@ -1,314 +1,314 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TDeleteParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TDeleteParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropSubdomain TDeleteParts"
- << " operationId#" << OperationId;
- }
-
-public:
- TDeleteParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvPrivate::TEvOperationPlan::EventType});
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
-
- // Initiate asynchonous deletion of all shards
- for (auto shard : txState->Shards) {
- context.OnComplete.DeleteShard(shard.Idx);
- }
-
- context.OnComplete.DoneOperation(OperationId);
- return true;
- }
-};
-
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ return TStringBuilder()
+ << "TDropSubdomain TDeleteParts"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TDeleteParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvPrivate::TEvOperationPlan::EventType});
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+
+ // Initiate asynchonous deletion of all shards
+ for (auto shard : txState->Shards) {
+ context.OnComplete.DeleteShard(shard.Idx);
+ }
+
+ context.OnComplete.DoneOperation(OperationId);
+ return true;
+ }
+};
+
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropSubdomain TPropose"
- << " operationId#" << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", step: " << step
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState->TxType == TTxState::TxDropSubDomain);
-
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- auto pathes = context.SS->ListSubThee(pathId, context.Ctx);
- Y_VERIFY(pathes.size() == 1);
- context.SS->DropPathes(pathes, step, OperationId.GetTxId(), db, context.Ctx);
-
- auto parentDir = context.SS->PathsById.at(path->ParentPathId);
- ++parentDir->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir);
- context.SS->ClearDescribePathCaches(parentDir);
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
-
- context.SS->ClearDescribePathCaches(path);
+ return TStringBuilder()
+ << "TDropSubdomain TPropose"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", step: " << step
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState->TxType == TTxState::TxDropSubDomain);
+
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ auto pathes = context.SS->ListSubThee(pathId, context.Ctx);
+ Y_VERIFY(pathes.size() == 1);
+ context.SS->DropPathes(pathes, step, OperationId.GetTxId(), db, context.Ctx);
+
+ auto parentDir = context.SS->PathsById.at(path->ParentPathId);
+ ++parentDir->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir);
+ context.SS->ClearDescribePathCaches(parentDir);
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
+
+ context.SS->ClearDescribePathCaches(path);
context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
- context.SS->ChangeTxState(db, OperationId, TTxState::ProposedDeleteParts);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxDropSubDomain);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-
-class TDropSubdomain: public TSubOperation {
+ context.SS->ChangeTxState(db, OperationId, TTxState::ProposedDeleteParts);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxDropSubDomain);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+
+class TDropSubdomain: public TSubOperation {
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::Propose;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::Propose:
- return TTxState::ProposedDeleteParts;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::Propose:
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::Propose;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::Propose:
+ return TTxState::ProposedDeleteParts;
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::Propose:
return THolder(new TPropose(OperationId));
- case TTxState::ProposedDeleteParts:
+ case TTxState::ProposedDeleteParts:
return THolder(new TDeleteParts(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TDropSubdomain(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TDropSubdomain(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+
+ TDropSubdomain(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const auto& drop = Transaction.GetDrop();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = drop.GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropSubdomain Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", pathId: " << drop.GetId()
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- TPath path = drop.HasId()
- ? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
- : TPath::Resolve(parentPathStr, context.SS).Dive(name);
-
- {
- TPath::TChecker checks = path.Check();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropSubdomain Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", pathId: " << drop.GetId()
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ TPath path = drop.HasId()
+ ? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
+ : TPath::Resolve(parentPathStr, context.SS).Dive(name);
+
+ {
+ TPath::TChecker checks = path.Check();
checks
.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsSubDomain()
- .NotUnderOperation()
- .IsCommonSensePath()
- .NotChildren();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path table fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsSubDomain()
+ .NotUnderOperation()
+ .IsCommonSensePath()
+ .NotChildren();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path table fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
if (path.IsResolved() && path.Base()->IsSubDomainRoot() && path.Base()->PlannedToDrop()) {
- result->SetPathDropTxId(ui64(path.Base()->DropTxId));
- result->SetPathId(path.Base()->PathId.LocalPathId);
+ result->SetPathDropTxId(ui64(path.Base()->DropTxId));
+ result->SetPathId(path.Base()->PathId.LocalPathId);
}
- return result;
- }
- }
-
- if (path.Base()->IsRoot()) {
- result->SetError(NKikimrScheme::StatusNameConflict, "Can't remove root");
- return result;
- }
-
+ return result;
+ }
+ }
+
+ if (path.Base()->IsRoot()) {
+ result->SetError(NKikimrScheme::StatusNameConflict, "Can't remove root");
+ return result;
+ }
+
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxDropSubDomain, path.Base()->PathId);
- // Dirty hack: drop step must not be zero because 0 is treated as "hasn't been dropped"
- txState.MinStep = TStepId(1);
- txState.State = TTxState::Propose;
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- Y_VERIFY(context.SS->SubDomains.contains(path.Base()->PathId));
- auto subDomain = context.SS->SubDomains.at(path.Base()->PathId);
- for (auto& shardIdx : subDomain->GetPrivateShards()) {
- txState.Shards.emplace_back(shardIdx, context.SS->ShardInfos.at(shardIdx).TabletType, txState.State);
-
- context.SS->ShardInfos[shardIdx].CurrentTxId = OperationId.GetTxId();
- context.SS->PersistShardTx(db, shardIdx, OperationId.GetTxId());
- }
-
- context.OnComplete.ActivateTx(OperationId);
- context.SS->PersistTxState(db, OperationId);
-
- path.Base()->PathState = TPathElement::EPathState::EPathStateDrop;
- path.Base()->DropTxId = OperationId.GetTxId();
- path.Base()->LastTxId = OperationId.GetTxId();
-
- auto parentDir = path.Parent();
- ++parentDir.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
- context.SS->ClearDescribePathCaches(parentDir.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir.Base()->PathId);
-
- context.SS->ClearDescribePathCaches(path.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
-
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxDropSubDomain, path.Base()->PathId);
+ // Dirty hack: drop step must not be zero because 0 is treated as "hasn't been dropped"
+ txState.MinStep = TStepId(1);
+ txState.State = TTxState::Propose;
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ Y_VERIFY(context.SS->SubDomains.contains(path.Base()->PathId));
+ auto subDomain = context.SS->SubDomains.at(path.Base()->PathId);
+ for (auto& shardIdx : subDomain->GetPrivateShards()) {
+ txState.Shards.emplace_back(shardIdx, context.SS->ShardInfos.at(shardIdx).TabletType, txState.State);
+
+ context.SS->ShardInfos[shardIdx].CurrentTxId = OperationId.GetTxId();
+ context.SS->PersistShardTx(db, shardIdx, OperationId.GetTxId());
+ }
+
+ context.OnComplete.ActivateTx(OperationId);
+ context.SS->PersistTxState(db, OperationId);
+
+ path.Base()->PathState = TPathElement::EPathState::EPathStateDrop;
+ path.Base()->DropTxId = OperationId.GetTxId();
+ path.Base()->LastTxId = OperationId.GetTxId();
+
+ auto parentDir = path.Parent();
+ ++parentDir.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
+ context.SS->ClearDescribePathCaches(parentDir.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir.Base()->PathId);
+
+ context.SS->ClearDescribePathCaches(path.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
+
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TDropSubdomain");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropSubdomain AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropSubdomain AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- TPathId pathId = txState->TargetPathId;
- Y_VERIFY(context.SS->PathsById.contains(pathId));
-
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
- Y_VERIFY(path);
-
- if (path->Dropped()) {
- for (auto shard : txState->Shards) {
- context.OnComplete.DeleteShard(shard.Idx);
- }
- }
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ TPathId pathId = txState->TargetPathId;
+ Y_VERIFY(context.SS->PathsById.contains(pathId));
+
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+ Y_VERIFY(path);
+
+ if (path->Dropped()) {
+ for (auto shard : txState->Shards) {
+ context.OnComplete.DeleteShard(shard.Idx);
+ }
+ }
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateDropSubdomain(TOperationId id, const TTxTransaction& tx) {
return new TDropSubdomain(id, tx);
}
-ISubOperationBase::TPtr CreateDropSubdomain(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateDropSubdomain(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TDropSubdomain(id, state);
-}
-
-}
-}
+ return new TDropSubdomain(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_table.cpp
index 9de0ed0a8b6..45730be4095 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_table.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_table.cpp
@@ -1,700 +1,700 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-void DropPath(NIceDb::TNiceDb& db,
- TOperationContext& context,
- TOperationId operationId,
- const TTxState& txState,
- TPath& path)
-{
- if (path->Dropped()) {
- // it might be dropped
- // when rolling update goes
- // old code drop the path early at TDropParts
- // and new code try do it once more time for sure
- return;
- }
-
- Y_VERIFY(txState.PlanStep);
- path->SetDropped(txState.PlanStep, operationId.GetTxId());
- context.SS->PersistDropStep(db, path->PathId, txState.PlanStep, operationId);
-
- context.SS->TabletCounters->Simple()[COUNTER_TABLE_COUNT].Sub(1);
- const i64 partitionsCount = txState.Shards.size();
- context.SS->TabletCounters->Simple()[COUNTER_TABLE_SHARD_ACTIVE_COUNT].Sub(partitionsCount);
- context.SS->TabletCounters->Simple()[COUNTER_TABLE_SHARD_INACTIVE_COUNT].Add(partitionsCount);
-
- context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size());
- context.SS->PersistUserAttributes(db, path->PathId, path->UserAttrs, nullptr);
-
- auto domainInfo = context.SS->ResolveDomainInfo(path->PathId);
- domainInfo->DecPathsInside();
-
- auto parentDir = path.Parent();
- parentDir->DecAliveChildren();
- ++parentDir->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
-
- context.SS->ClearDescribePathCaches(parentDir.Base());
- context.OnComplete.PublishToSchemeBoard(operationId, parentDir->PathId);
-
- context.SS->ClearDescribePathCaches(path.Base());
- context.OnComplete.PublishToSchemeBoard(operationId, path->PathId);
-}
-
-class TDropParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+void DropPath(NIceDb::TNiceDb& db,
+ TOperationContext& context,
+ TOperationId operationId,
+ const TTxState& txState,
+ TPath& path)
+{
+ if (path->Dropped()) {
+ // it might be dropped
+ // when rolling update goes
+ // old code drop the path early at TDropParts
+ // and new code try do it once more time for sure
+ return;
+ }
+
+ Y_VERIFY(txState.PlanStep);
+ path->SetDropped(txState.PlanStep, operationId.GetTxId());
+ context.SS->PersistDropStep(db, path->PathId, txState.PlanStep, operationId);
+
+ context.SS->TabletCounters->Simple()[COUNTER_TABLE_COUNT].Sub(1);
+ const i64 partitionsCount = txState.Shards.size();
+ context.SS->TabletCounters->Simple()[COUNTER_TABLE_SHARD_ACTIVE_COUNT].Sub(partitionsCount);
+ context.SS->TabletCounters->Simple()[COUNTER_TABLE_SHARD_INACTIVE_COUNT].Add(partitionsCount);
+
+ context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size());
+ context.SS->PersistUserAttributes(db, path->PathId, path->UserAttrs, nullptr);
+
+ auto domainInfo = context.SS->ResolveDomainInfo(path->PathId);
+ domainInfo->DecPathsInside();
+
+ auto parentDir = path.Parent();
+ parentDir->DecAliveChildren();
+ ++parentDir->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
+
+ context.SS->ClearDescribePathCaches(parentDir.Base());
+ context.OnComplete.PublishToSchemeBoard(operationId, parentDir->PathId);
+
+ context.SS->ClearDescribePathCaches(path.Base());
+ context.OnComplete.PublishToSchemeBoard(operationId, path->PathId);
+}
+
+class TDropParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropTable TDropParts"
- << " operationId#" << OperationId;
- }
-
-public:
- TDropParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool HandleReply(TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvProposeTransactionResult"
- << " at tabletId# " << ssId);
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvProposeTransactionResult"
- << " message# " << ev->Get()->Record.ShortDebugString());
-
- if (!NTableState::CollectProposeTransactionResults(OperationId, ev, context)) {
- return false;
- }
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxDropTable);
- Y_VERIFY(txState->MinStep);
-
- return true;
- }
-
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxDropTable);
-
- if (NTableState::CheckPartitioningChangedForTableModification(*txState, context)) {
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " UpdatePartitioningForTableModification");
- NTableState::UpdatePartitioningForTableModification(OperationId, *txState, context);
- }
-
- txState->ClearShardsInProgress();
-
- TString txBody;
- {
- TPathId pathId = txState->TargetPathId;
- Y_VERIFY(context.SS->PathsById.contains(pathId));
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
- Y_VERIFY(path);
-
- auto seqNo = context.SS->StartRound(*txState);
-
- NKikimrTxDataShard::TFlatSchemeTransaction tx;
- context.SS->FillSeqNo(tx, seqNo);
- tx.MutableDropTable()->SetId_Deprecated(pathId.LocalPathId);
+ return TStringBuilder()
+ << "TDropTable TDropParts"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TDropParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool HandleReply(TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvProposeTransactionResult"
+ << " at tabletId# " << ssId);
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvProposeTransactionResult"
+ << " message# " << ev->Get()->Record.ShortDebugString());
+
+ if (!NTableState::CollectProposeTransactionResults(OperationId, ev, context)) {
+ return false;
+ }
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxDropTable);
+ Y_VERIFY(txState->MinStep);
+
+ return true;
+ }
+
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxDropTable);
+
+ if (NTableState::CheckPartitioningChangedForTableModification(*txState, context)) {
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " UpdatePartitioningForTableModification");
+ NTableState::UpdatePartitioningForTableModification(OperationId, *txState, context);
+ }
+
+ txState->ClearShardsInProgress();
+
+ TString txBody;
+ {
+ TPathId pathId = txState->TargetPathId;
+ Y_VERIFY(context.SS->PathsById.contains(pathId));
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+ Y_VERIFY(path);
+
+ auto seqNo = context.SS->StartRound(*txState);
+
+ NKikimrTxDataShard::TFlatSchemeTransaction tx;
+ context.SS->FillSeqNo(tx, seqNo);
+ tx.MutableDropTable()->SetId_Deprecated(pathId.LocalPathId);
PathIdFromPathId(pathId, tx.MutableDropTable()->MutablePathId());
- tx.MutableDropTable()->SetName(path->Name);
+ tx.MutableDropTable()->SetName(path->Name);
Y_PROTOBUF_SUPPRESS_NODISCARD tx.SerializeToString(&txBody);
- }
-
- Y_VERIFY(txState->Shards.size());
- for (ui32 i = 0; i < txState->Shards.size(); ++i) {
- auto idx = txState->Shards[i].Idx;
- auto datashardId = context.SS->ShardInfos[idx].TabletID;
-
- THolder<TEvDataShard::TEvProposeTransaction> event =
+ }
+
+ Y_VERIFY(txState->Shards.size());
+ for (ui32 i = 0; i < txState->Shards.size(); ++i) {
+ auto idx = txState->Shards[i].Idx;
+ auto datashardId = context.SS->ShardInfos[idx].TabletID;
+
+ THolder<TEvDataShard::TEvProposeTransaction> event =
MakeHolder<TEvDataShard::TEvProposeTransaction>(NKikimrTxDataShard::TX_KIND_SCHEME,
- context.SS->TabletID(),
- context.Ctx.SelfID,
- ui64(OperationId.GetTxId()),
- txBody,
- context.SS->SelectProcessingPrarams(txState->TargetPathId));
-
- context.OnComplete.BindMsgToPipe(OperationId, datashardId, idx, event.Release());
- }
-
- txState->UpdateShardsInProgress(TTxState::DropParts);
- return false;
- }
-};
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
- TTxState::ETxState& NextState;
-
+ context.SS->TabletID(),
+ context.Ctx.SelfID,
+ ui64(OperationId.GetTxId()),
+ txBody,
+ context.SS->SelectProcessingPrarams(txState->TargetPathId));
+
+ context.OnComplete.BindMsgToPipe(OperationId, datashardId, idx, event.Release());
+ }
+
+ txState->UpdateShardsInProgress(TTxState::DropParts);
+ return false;
+ }
+};
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+ TTxState::ETxState& NextState;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropTable TPropose"
- << " operationId#" << OperationId;
- }
-
-public:
- TPropose(TOperationId id, TTxState::ETxState& nextState)
- : OperationId(id)
- , NextState(nextState)
- {
- IgnoreMessages(DebugHint(), {TEvDataShard::TEvProposeTransactionResult::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvDataShard::TEvSchemaChanged"
- << " triggers early, save it"
- << ", at schemeshard: " << ssId);
-
- NTableState::CollectSchemaChanged(OperationId, ev, context);
- return false;
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", step: " << step
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState->TxType == TTxState::TxDropTable);
-
- TPath path = TPath::Init(txState->TargetPathId, context.SS);
- Y_VERIFY(path.IsResolved());
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- txState->PlanStep = step;
- context.SS->PersistTxPlanStep(db, OperationId, step);
-
- if (context.SS->EnableSchemeTransactionsAtSchemeShard) {
-
- // only persist step, but do not set drop plan step for the path
- NextState = TTxState::WaitShadowPathPublication;
- context.SS->ChangeTxState(db, OperationId, TTxState::WaitShadowPathPublication);
- return true;
- }
-
- DropPath(db, context, OperationId, *txState, path);
-
- NextState = TTxState::ProposedWaitParts;
- context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxDropTable);
-
- TSet<TTabletId> shardSet;
- for (const auto& shard : txState->Shards) {
- TShardIdx idx = shard.Idx;
- Y_VERIFY(context.SS->ShardInfos.contains(idx));
- TTabletId tablet = context.SS->ShardInfos.at(idx).TabletID;
- shardSet.insert(tablet);
- }
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, txState->MinStep, shardSet);
- return false;
- }
-};
-
-class TWaitRenamedPathPublication: public TSubOperationState {
-private:
- TOperationId OperationId;
-
- TPathId ActivePathId;
-
- TString DebugHint() const override {
- return TStringBuilder()
- << "TDropTable TWaitRenamedPathPublication"
- << " operationId: " << OperationId;
- }
-
-public:
- TWaitRenamedPathPublication(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType, TEvPrivate::TEvOperationPlan::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvDataShard::TEvSchemaChanged"
- << ", save it"
- << ", at schemeshard: " << ssId);
-
- NTableState::CollectSchemaChanged(OperationId, ev, context);
- return false;
- }
-
- bool HandleReply(TEvPrivate::TEvCompletePublication::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvPrivate::TEvCompletePublication"
- << ", msg: " << ev->Get()->ToString()
- << ", at tablet" << ssId);
-
- Y_VERIFY(ActivePathId == ev->Get()->PathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::DeletePathBarrier);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- context.OnComplete.RouteByTabletsFromOperation(OperationId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", operation type: " << TTxState::TypeName(txState->TxType)
- << ", at tablet" << ssId);
-
-
- TPath path = TPath::Init(txState->TargetPathId, context.SS);
- if (path.IsActive()) {
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", no renaming has been detected for this operation");
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::DeletePathBarrier);
- return true;
- }
-
- auto activePath = TPath::Resolve(path.PathString(), context.SS);
- Y_VERIFY(activePath.IsResolved());
-
- Y_VERIFY(activePath != path);
-
- ActivePathId = activePath->PathId;
- context.OnComplete.PublishAndWaitPublication(OperationId, activePath->PathId);
-
- return false;
- }
-};
-
-
-class TDeleteTableBarrier: public TSubOperationState {
-private:
- TOperationId OperationId;
-
- TString DebugHint() const override {
- return TStringBuilder()
- << "TDropTable TDeleteTableBarrier"
- << " operationId: " << OperationId;
- }
-
-public:
- TDeleteTableBarrier(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType, TEvPrivate::TEvOperationPlan::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvDataShard::TEvSchemaChanged"
- << ", save it"
- << ", at schemeshard: " << ssId);
-
- NTableState::CollectSchemaChanged(OperationId, ev, context);
- return false;
- }
-
- bool HandleReply(TEvPrivate::TEvCompleteBarrier::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvPrivate::TEvCompleteBarrier"
- << ", msg: " << ev->Get()->ToString()
- << ", at tablet" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- TPath path = TPath::Init(txState->TargetPathId, context.SS);
- DropPath(db, context, OperationId, *txState, path);
-
- context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- context.OnComplete.RouteByTabletsFromOperation(OperationId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", operation type: " << TTxState::TypeName(txState->TxType)
- << ", at tablet" << ssId);
-
- context.OnComplete.Barrier(OperationId, "RenamePathBarrier");
-
- return false;
- }
-};
-
-
-class TProposedDeletePart: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ return TStringBuilder()
+ << "TDropTable TPropose"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id, TTxState::ETxState& nextState)
+ : OperationId(id)
+ , NextState(nextState)
+ {
+ IgnoreMessages(DebugHint(), {TEvDataShard::TEvProposeTransactionResult::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvDataShard::TEvSchemaChanged"
+ << " triggers early, save it"
+ << ", at schemeshard: " << ssId);
+
+ NTableState::CollectSchemaChanged(OperationId, ev, context);
+ return false;
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", step: " << step
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState->TxType == TTxState::TxDropTable);
+
+ TPath path = TPath::Init(txState->TargetPathId, context.SS);
+ Y_VERIFY(path.IsResolved());
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ txState->PlanStep = step;
+ context.SS->PersistTxPlanStep(db, OperationId, step);
+
+ if (context.SS->EnableSchemeTransactionsAtSchemeShard) {
+
+ // only persist step, but do not set drop plan step for the path
+ NextState = TTxState::WaitShadowPathPublication;
+ context.SS->ChangeTxState(db, OperationId, TTxState::WaitShadowPathPublication);
+ return true;
+ }
+
+ DropPath(db, context, OperationId, *txState, path);
+
+ NextState = TTxState::ProposedWaitParts;
+ context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxDropTable);
+
+ TSet<TTabletId> shardSet;
+ for (const auto& shard : txState->Shards) {
+ TShardIdx idx = shard.Idx;
+ Y_VERIFY(context.SS->ShardInfos.contains(idx));
+ TTabletId tablet = context.SS->ShardInfos.at(idx).TabletID;
+ shardSet.insert(tablet);
+ }
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, txState->MinStep, shardSet);
+ return false;
+ }
+};
+
+class TWaitRenamedPathPublication: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
+ TPathId ActivePathId;
+
+ TString DebugHint() const override {
+ return TStringBuilder()
+ << "TDropTable TWaitRenamedPathPublication"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TWaitRenamedPathPublication(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType, TEvPrivate::TEvOperationPlan::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvDataShard::TEvSchemaChanged"
+ << ", save it"
+ << ", at schemeshard: " << ssId);
+
+ NTableState::CollectSchemaChanged(OperationId, ev, context);
+ return false;
+ }
+
+ bool HandleReply(TEvPrivate::TEvCompletePublication::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvPrivate::TEvCompletePublication"
+ << ", msg: " << ev->Get()->ToString()
+ << ", at tablet" << ssId);
+
+ Y_VERIFY(ActivePathId == ev->Get()->PathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::DeletePathBarrier);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ context.OnComplete.RouteByTabletsFromOperation(OperationId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", operation type: " << TTxState::TypeName(txState->TxType)
+ << ", at tablet" << ssId);
+
+
+ TPath path = TPath::Init(txState->TargetPathId, context.SS);
+ if (path.IsActive()) {
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", no renaming has been detected for this operation");
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::DeletePathBarrier);
+ return true;
+ }
+
+ auto activePath = TPath::Resolve(path.PathString(), context.SS);
+ Y_VERIFY(activePath.IsResolved());
+
+ Y_VERIFY(activePath != path);
+
+ ActivePathId = activePath->PathId;
+ context.OnComplete.PublishAndWaitPublication(OperationId, activePath->PathId);
+
+ return false;
+ }
+};
+
+
+class TDeleteTableBarrier: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropTable TProposedDeletePart"
- << " operationId: " << OperationId;
- }
-
-public:
- TProposedDeletePart(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvDataShard::TEvProposeTransactionResult::EventType, TEvPrivate::TEvOperationPlan::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
+ return TStringBuilder()
+ << "TDropTable TDeleteTableBarrier"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TDeleteTableBarrier(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType, TEvPrivate::TEvOperationPlan::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvDataShard::TEvSchemaChanged"
+ << ", save it"
+ << ", at schemeshard: " << ssId);
+
+ NTableState::CollectSchemaChanged(OperationId, ev, context);
+ return false;
+ }
+
+ bool HandleReply(TEvPrivate::TEvCompleteBarrier::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvPrivate::TEvCompleteBarrier"
+ << ", msg: " << ev->Get()->ToString()
+ << ", at tablet" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ TPath path = TPath::Init(txState->TargetPathId, context.SS);
+ DropPath(db, context, OperationId, *txState, path);
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ context.OnComplete.RouteByTabletsFromOperation(OperationId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", operation type: " << TTxState::TypeName(txState->TxType)
+ << ", at tablet" << ssId);
+
+ context.OnComplete.Barrier(OperationId, "RenamePathBarrier");
+
+ return false;
+ }
+};
+
+
+class TProposedDeletePart: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
+ TString DebugHint() const override {
+ return TStringBuilder()
+ << "TDropTable TProposedDeletePart"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TProposedDeletePart(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvDataShard::TEvProposeTransactionResult::EventType, TEvPrivate::TEvOperationPlan::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
const TActorId& ackTo = ev->Sender;
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TProposedDeletePart"
- << " repeated message, ack it anyway"
- << " at tablet: " << ssId);
-
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TProposedDeletePart"
+ << " repeated message, ack it anyway"
+ << " at tablet: " << ssId);
+
THolder<TEvDataShard::TEvSchemaChangedResult> event = MakeHolder<TEvDataShard::TEvSchemaChangedResult>();
- event->Record.SetTxId(ui64(OperationId.GetTxId()));
-
+ event->Record.SetTxId(ui64(OperationId.GetTxId()));
+
context.OnComplete.Send(ackTo, std::move(event));
- return false;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxDropTable);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
+ return false;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxDropTable);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
context.SS->PersistRemoveTable(db, txState->TargetPathId, context.Ctx);
-
- context.OnComplete.DoneOperation(OperationId);
- return true;
- }
-
-};
-
-class TDropTable: public TSubOperation {
-private:
- const TOperationId OperationId;
- TTxState::ETxState State = TTxState::Invalid;
- TTxState::ETxState AfterPropose = TTxState::Invalid;
-
- const NKikimrSchemeOp::TModifyScheme Transaction;
-
- TTxState::ETxState NextState() {
- return TTxState::DropParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::DropParts:
- return TTxState::Propose;
- case TTxState::Propose:
- return AfterPropose;
-
- case TTxState::WaitShadowPathPublication:
- return TTxState::DeletePathBarrier;
- case TTxState::DeletePathBarrier:
- return TTxState::ProposedWaitParts;
-
- case TTxState::ProposedWaitParts:
- return TTxState::ProposedDeleteParts;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::DropParts:
+
+ context.OnComplete.DoneOperation(OperationId);
+ return true;
+ }
+
+};
+
+class TDropTable: public TSubOperation {
+private:
+ const TOperationId OperationId;
+ TTxState::ETxState State = TTxState::Invalid;
+ TTxState::ETxState AfterPropose = TTxState::Invalid;
+
+ const NKikimrSchemeOp::TModifyScheme Transaction;
+
+ TTxState::ETxState NextState() {
+ return TTxState::DropParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::DropParts:
+ return TTxState::Propose;
+ case TTxState::Propose:
+ return AfterPropose;
+
+ case TTxState::WaitShadowPathPublication:
+ return TTxState::DeletePathBarrier;
+ case TTxState::DeletePathBarrier:
+ return TTxState::ProposedWaitParts;
+
+ case TTxState::ProposedWaitParts:
+ return TTxState::ProposedDeleteParts;
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::DropParts:
return MakeHolder<TDropParts>(OperationId);
- case TTxState::Propose:
- return MakeHolder<TPropose>(OperationId, AfterPropose);
- case TTxState::WaitShadowPathPublication:
- return MakeHolder<TWaitRenamedPathPublication>(OperationId);
- case TTxState::DeletePathBarrier:
- return MakeHolder<TDeleteTableBarrier>(OperationId);
- case TTxState::ProposedWaitParts:
+ case TTxState::Propose:
+ return MakeHolder<TPropose>(OperationId, AfterPropose);
+ case TTxState::WaitShadowPathPublication:
+ return MakeHolder<TWaitRenamedPathPublication>(OperationId);
+ case TTxState::DeletePathBarrier:
+ return MakeHolder<TDeleteTableBarrier>(OperationId);
+ case TTxState::ProposedWaitParts:
return MakeHolder<NTableState::TProposedWaitParts>(OperationId);
- case TTxState::Done:
- case TTxState::ProposedDeleteParts:
+ case TTxState::Done:
+ case TTxState::ProposedDeleteParts:
return MakeHolder<TProposedDeletePart>(OperationId);
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TDropTable(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
- {}
-
- TDropTable(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+ {}
+
+ TDropTable(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const auto& drop = Transaction.GetDrop();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = drop.GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropTable Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", pathId: " << drop.GetId()
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- TPath path = drop.HasId()
- ? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
- : TPath::Resolve(parentPathStr, context.SS).Dive(name);
-
- {
- TPath::TChecker checks = path.Check();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropTable Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", pathId: " << drop.GetId()
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ TPath path = drop.HasId()
+ ? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
+ : TPath::Resolve(parentPathStr, context.SS).Dive(name);
+
+ {
+ TPath::TChecker checks = path.Check();
checks
.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
.IsResolved()
.NotDeleted()
.IsTable()
.NotUnderDeleting()
.NotUnderOperation();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
if (path.IsResolved() && path.Base()->IsTable() && (path.Base()->PlannedToDrop() || path.Base()->Dropped())) {
result->SetPathDropTxId(ui64(path.Base()->DropTxId));
result->SetPathId(path.Base()->PathId.LocalPathId);
}
- return result;
- }
- }
-
- TPath parent = path.Parent();
- {
- TPath::TChecker checks = parent.Check();
+ return result;
+ }
+ }
+
+ TPath parent = path.Parent();
+ {
+ TPath::TChecker checks = parent.Check();
checks
.NotEmpty()
- .IsResolved()
- .NotDeleted();
-
- if (checks) {
- if (parent.Base()->IsTableIndex()) {
+ .IsResolved()
+ .NotDeleted();
+
+ if (checks) {
+ if (parent.Base()->IsTableIndex()) {
checks
.IsTableIndex()
- .IsInsideTableIndexPath()
- .IsUnderDeleting()
- .IsUnderTheSameOperation(OperationId.GetTxId()); //allow only as part of drop base table
- } else {
+ .IsInsideTableIndexPath()
+ .IsUnderDeleting()
+ .IsUnderTheSameOperation(OperationId.GetTxId()); //allow only as part of drop base table
+ } else {
checks
- .IsLikeDirectory()
- .IsCommonSensePath()
- .NotUnderDeleting();
- }
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "parent path fail checks"
- << ", path: " << parent.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
+ .IsLikeDirectory()
+ .IsCommonSensePath()
+ .NotUnderDeleting();
+ }
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent path fail checks"
+ << ", path: " << parent.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- if (!context.SS->CheckLocks(path.Base()->PathId, Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
- return result;
- }
-
- context.MemChanges.GrabNewTxState(context.SS, OperationId);
- context.MemChanges.GrabPath(context.SS, path.Base()->PathId);
- context.MemChanges.GrabPath(context.SS, parent.Base()->PathId);
-
- context.DbChanges.PersistTxState(OperationId);
- context.DbChanges.PersistPath(path.Base()->PathId);
- context.DbChanges.PersistPath(parent.Base()->PathId);
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxDropTable, path.Base()->PathId);
- txState.MinStep = TStepId(1);
- txState.State = TTxState::DropParts;
-
- // Dirty hack: drop step must not be zero because 0 is treated as "hasn't been dropped"
-
- Y_VERIFY(context.SS->Tables.contains(path.Base()->PathId));
- TTableInfo::TPtr table = context.SS->Tables.at(path.Base()->PathId);
- Y_VERIFY(table->GetPartitions().size());
- for (auto& shard : table->GetPartitions()) {
- auto shardIdx = shard.ShardIdx;
- context.MemChanges.GrabShard(context.SS, shardIdx);
- context.DbChanges.PersistShard(shardIdx);
-
- Y_VERIFY_S(context.SS->ShardInfos.contains(shardIdx), "Unknown shardIdx " << shardIdx);
- txState.Shards.emplace_back(shardIdx, context.SS->ShardInfos[shardIdx].TabletType, TTxState::DropParts);
-
- context.SS->ShardInfos[shardIdx].CurrentTxId = OperationId.GetTxId();
- }
-
- path.Base()->PathState = TPathElement::EPathState::EPathStateDrop;
- path.Base()->DropTxId = OperationId.GetTxId();
- path.Base()->LastTxId = OperationId.GetTxId();
-
- IncParentDirAlterVersionWithRepublish(OperationId, path, context);
-
- for (auto splitTx: table->GetSplitOpsInFlight()) {
- context.OnComplete.Dependence(splitTx.GetTxId(), OperationId.GetTxId());
- }
-
- State = NextState();
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- return result;
- }
-
- void AbortPropose(TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropTable AbortPropose"
- << ", opId: " << OperationId
- << ", at schemeshard: " << context.SS->TabletID());
- }
-
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropTable AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ if (!context.SS->CheckLocks(path.Base()->PathId, Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
+ return result;
+ }
+
+ context.MemChanges.GrabNewTxState(context.SS, OperationId);
+ context.MemChanges.GrabPath(context.SS, path.Base()->PathId);
+ context.MemChanges.GrabPath(context.SS, parent.Base()->PathId);
+
+ context.DbChanges.PersistTxState(OperationId);
+ context.DbChanges.PersistPath(path.Base()->PathId);
+ context.DbChanges.PersistPath(parent.Base()->PathId);
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxDropTable, path.Base()->PathId);
+ txState.MinStep = TStepId(1);
+ txState.State = TTxState::DropParts;
+
+ // Dirty hack: drop step must not be zero because 0 is treated as "hasn't been dropped"
+
+ Y_VERIFY(context.SS->Tables.contains(path.Base()->PathId));
+ TTableInfo::TPtr table = context.SS->Tables.at(path.Base()->PathId);
+ Y_VERIFY(table->GetPartitions().size());
+ for (auto& shard : table->GetPartitions()) {
+ auto shardIdx = shard.ShardIdx;
+ context.MemChanges.GrabShard(context.SS, shardIdx);
+ context.DbChanges.PersistShard(shardIdx);
+
+ Y_VERIFY_S(context.SS->ShardInfos.contains(shardIdx), "Unknown shardIdx " << shardIdx);
+ txState.Shards.emplace_back(shardIdx, context.SS->ShardInfos[shardIdx].TabletType, TTxState::DropParts);
+
+ context.SS->ShardInfos[shardIdx].CurrentTxId = OperationId.GetTxId();
+ }
+
+ path.Base()->PathState = TPathElement::EPathState::EPathStateDrop;
+ path.Base()->DropTxId = OperationId.GetTxId();
+ path.Base()->LastTxId = OperationId.GetTxId();
+
+ IncParentDirAlterVersionWithRepublish(OperationId, path, context);
+
+ for (auto splitTx: table->GetSplitOpsInFlight()) {
+ context.OnComplete.Dependence(splitTx.GetTxId(), OperationId.GetTxId());
+ }
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ return result;
+ }
+
+ void AbortPropose(TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropTable AbortPropose"
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << context.SS->TabletID());
+ }
+
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropTable AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- TPathId pathId = txState->TargetPathId;
- Y_VERIFY(context.SS->PathsById.contains(pathId));
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
- Y_VERIFY(path);
-
- if (path->Dropped()) {
- for (auto shard : txState->Shards) {
- context.OnComplete.DeleteShard(shard.Idx);
- }
- }
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ TPathId pathId = txState->TargetPathId;
+ Y_VERIFY(context.SS->PathsById.contains(pathId));
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+ Y_VERIFY(path);
+
+ if (path->Dropped()) {
+ for (auto shard : txState->Shards) {
+ context.OnComplete.DeleteShard(shard.Idx);
+ }
+ }
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateDropTable(TOperationId id, const TTxTransaction& tx) {
return new TDropTable(id, tx);
}
-ISubOperationBase::TPtr CreateDropTable(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state != TTxState::Invalid);
- return new TDropTable(id, state);
-}
-
-}
-}
+ISubOperationBase::TPtr CreateDropTable(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state != TTxState::Invalid);
+ return new TDropTable(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_drop_unsafe.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_drop_unsafe.cpp
index 7160b178224..a1a9f2ccfd0 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_drop_unsafe.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_drop_unsafe.cpp
@@ -1,243 +1,243 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TProposedDeletePart: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TProposedDeletePart: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropForceUnsafe TProposedDeletePart"
- << ", operationId: " << OperationId;
- }
-
-public:
- TProposedDeletePart(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), AllIncomingEvents());
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
-
- // Initiate asynchonous deletion of all shards
- for (auto shard : txState->Shards) {
- context.OnComplete.DeleteShard(shard.Idx);
- }
-
- context.OnComplete.DoneOperation(OperationId);
- return true;
- }
-};
-
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ return TStringBuilder()
+ << "TDropForceUnsafe TProposedDeletePart"
+ << ", operationId: " << OperationId;
+ }
+
+public:
+ TProposedDeletePart(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), AllIncomingEvents());
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+
+ // Initiate asynchonous deletion of all shards
+ for (auto shard : txState->Shards) {
+ context.OnComplete.DeleteShard(shard.Idx);
+ }
+
+ context.OnComplete.DoneOperation(OperationId);
+ return true;
+ }
+};
+
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDropForceUnsafe TPropose"
- << ", operationId: " << OperationId;
- }
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- TSet<ui32> toIgnore = AllIncomingEvents();
- toIgnore.erase(TEvPrivate::TEvOperationPlan::EventType);
-
- IgnoreMessages(DebugHint(), toIgnore);
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", step: " << step
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState->TxType == TTxState::TxForceDropSubDomain);
-
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
- auto pathes = context.SS->ListSubThee(pathId, context.Ctx);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- context.SS->DropPathes(pathes, step, OperationId.GetTxId(), db, context.Ctx);
-
- auto parentDir = context.SS->PathsById.at(path->ParentPathId);
- ++parentDir->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir);
- context.SS->ClearDescribePathCaches(parentDir);
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
-
+ return TStringBuilder()
+ << "TDropForceUnsafe TPropose"
+ << ", operationId: " << OperationId;
+ }
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ TSet<ui32> toIgnore = AllIncomingEvents();
+ toIgnore.erase(TEvPrivate::TEvOperationPlan::EventType);
+
+ IgnoreMessages(DebugHint(), toIgnore);
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", step: " << step
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState->TxType == TTxState::TxForceDropSubDomain);
+
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+ auto pathes = context.SS->ListSubThee(pathId, context.Ctx);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ context.SS->DropPathes(pathes, step, OperationId.GetTxId(), db, context.Ctx);
+
+ auto parentDir = context.SS->PathsById.at(path->ParentPathId);
+ ++parentDir->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir);
+ context.SS->ClearDescribePathCaches(parentDir);
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
+
for (const TPathId pathId : pathes) {
context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
}
- context.SS->ChangeTxState(db, OperationId, TTxState::ProposedDeleteParts);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxForceDropSubDomain);
-
- auto pathes = context.SS->ListSubThee(txState->TargetPathId, context.Ctx);
- NForceDrop::ValidateNoTrasactionOnPathes(OperationId, pathes, context);
- context.SS->MarkAsDroping(pathes, OperationId.GetTxId(), context.Ctx);
- NForceDrop::CollectShards(pathes, OperationId, txState, context);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-
-class TDropForceUnsafe: public TSubOperation {
+ context.SS->ChangeTxState(db, OperationId, TTxState::ProposedDeleteParts);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxForceDropSubDomain);
+
+ auto pathes = context.SS->ListSubThee(txState->TargetPathId, context.Ctx);
+ NForceDrop::ValidateNoTrasactionOnPathes(OperationId, pathes, context);
+ context.SS->MarkAsDroping(pathes, OperationId.GetTxId(), context.Ctx);
+ NForceDrop::CollectShards(pathes, OperationId, txState, context);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+
+class TDropForceUnsafe: public TSubOperation {
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
- TPathElement::EPathType ExpectedType = TPathElement::EPathType::EPathTypeInvalid;
-
- TTxState::ETxState NextState() {
- return TTxState::Propose;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Propose:
- return TTxState::ProposedDeleteParts;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::Propose:
+ TTxState::ETxState State = TTxState::Invalid;
+ TPathElement::EPathType ExpectedType = TPathElement::EPathType::EPathTypeInvalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::Propose;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Propose:
+ return TTxState::ProposedDeleteParts;
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::Propose:
return MakeHolder<TPropose>(OperationId);
- case TTxState::ProposedDeleteParts:
+ case TTxState::ProposedDeleteParts:
return MakeHolder<TProposedDeletePart>(OperationId);
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TDropForceUnsafe(TOperationId id, const TTxTransaction& tx, TPathElement::EPathType expectedType)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
- , ExpectedType(expectedType)
- {}
-
- TDropForceUnsafe(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+ , ExpectedType(expectedType)
+ {}
+
+ TDropForceUnsafe(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const auto& drop = Transaction.GetDrop();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = drop.GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropForceUnsafe Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", pathId: " << drop.GetId()
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- if (ExpectedType == TPathElement::EPathType::EPathTypeInvalid) {
- LOG_WARN_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- " UNSAFE DELETION IS CALLED."
- " TDropForceUnsafe is UNSAFE operation."
- " Nornally it is called for deleting user's DB (tenant)."
- " But it could be triggered by administrator for special emergency cases. And there is that case."
- " I hope you are aware of the problems with it."
- " 1: Shared transactions among the tables could be broken if one of the tables is force dropped. Dependent transactions on other tables could be blocked forever."
- " 2: Loans are going to be lost. Force dropped tablets are never return loans. Some tablets would be waiting for borrowed blocks forever."
- " Details"
- << ": path: " << parentPathStr << "/" << name
- << ", pathId: " << drop.GetId()
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
- }
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- TPath path = drop.HasId()
- ? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
- : TPath::Resolve(parentPathStr, context.SS).Dive(name);
-
- {
- TPath::TChecker checks = path.Check();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropForceUnsafe Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", pathId: " << drop.GetId()
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ if (ExpectedType == TPathElement::EPathType::EPathTypeInvalid) {
+ LOG_WARN_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ " UNSAFE DELETION IS CALLED."
+ " TDropForceUnsafe is UNSAFE operation."
+ " Nornally it is called for deleting user's DB (tenant)."
+ " But it could be triggered by administrator for special emergency cases. And there is that case."
+ " I hope you are aware of the problems with it."
+ " 1: Shared transactions among the tables could be broken if one of the tables is force dropped. Dependent transactions on other tables could be blocked forever."
+ " 2: Loans are going to be lost. Force dropped tablets are never return loans. Some tablets would be waiting for borrowed blocks forever."
+ " Details"
+ << ": path: " << parentPathStr << "/" << name
+ << ", pathId: " << drop.GetId()
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+ }
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ TPath path = drop.HasId()
+ ? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
+ : TPath::Resolve(parentPathStr, context.SS).Dive(name);
+
+ {
+ TPath::TChecker checks = path.Check();
checks
.NotEmpty()
- .IsResolved()
- .NotRoot()
- .NotDeleted()
- .IsCommonSensePath();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path table fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
+ .IsResolved()
+ .NotRoot()
+ .NotDeleted()
+ .IsCommonSensePath();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path table fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
if (path.IsUnderCreating()) {
TPath parent = path.Parent();
if (parent.IsUnderCreating()) {
TPath::TChecker checks = parent.Check();
checks
- .NotUnderTheSameOperation(path.ActiveOperation(), NKikimrScheme::StatusMultipleModifications);
+ .NotUnderTheSameOperation(path.ActiveOperation(), NKikimrScheme::StatusMultipleModifications);
if (!checks) {
TString explain = TStringBuilder() << "parent path fail checks"
@@ -249,122 +249,122 @@ public:
}
}
- if (ExpectedType != TPathElement::EPathType::EPathTypeInvalid) {
- if (path.Base()->PathType != ExpectedType) {
- result->SetError(NKikimrScheme::StatusNameConflict, "Drop on mismatch item");
- return result;
- }
- }
-
+ if (ExpectedType != TPathElement::EPathType::EPathTypeInvalid) {
+ if (path.Base()->PathType != ExpectedType) {
+ result->SetError(NKikimrScheme::StatusNameConflict, "Drop on mismatch item");
+ return result;
+ }
+ }
+
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxForceDropSubDomain, path.Base()->PathId);
- txState.State = TTxState::Waiting;
- txState.MinStep = TStepId(1);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- auto pathes = context.SS->ListSubThee(path.Base()->PathId, context.Ctx);
-
- auto relatedTx = context.SS->GetRelatedTransactions(pathes, context.Ctx);
- for (auto otherTxId: relatedTx) {
- if (otherTxId == OperationId.GetTxId()) {
- continue;
- }
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropForceUnsafe Propose dependence has found"
- << ", dependent transaction: " << OperationId.GetTxId()
- << ", parent transaction: " << otherTxId
- << ", at schemeshard: " << ssId);
-
- context.OnComplete.Dependence(otherTxId, OperationId.GetTxId());
-
- Y_VERIFY(context.SS->Operations.contains(otherTxId));
- auto otherOperation = context.SS->Operations.at(otherTxId);
- for (ui32 partId = 0; partId < otherOperation->Parts.size(); ++partId) {
- if (auto part = otherOperation->Parts.at(partId)) {
- part->AbortUnsafe(OperationId.GetTxId(), context);
- }
- }
- }
-
- context.SS->MarkAsDroping(pathes, OperationId.GetTxId(), context.Ctx);
-
- txState.State = TTxState::Propose;
- context.OnComplete.ActivateTx(OperationId);
-
- context.SS->PersistTxState(db, OperationId);
-
- auto parentDir = path.Parent();
- ++parentDir.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
- context.SS->ClearDescribePathCaches(parentDir.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir.Base()->PathId);
-
- context.SS->ClearDescribePathCaches(path.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxForceDropSubDomain, path.Base()->PathId);
+ txState.State = TTxState::Waiting;
+ txState.MinStep = TStepId(1);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ auto pathes = context.SS->ListSubThee(path.Base()->PathId, context.Ctx);
+
+ auto relatedTx = context.SS->GetRelatedTransactions(pathes, context.Ctx);
+ for (auto otherTxId: relatedTx) {
+ if (otherTxId == OperationId.GetTxId()) {
+ continue;
+ }
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropForceUnsafe Propose dependence has found"
+ << ", dependent transaction: " << OperationId.GetTxId()
+ << ", parent transaction: " << otherTxId
+ << ", at schemeshard: " << ssId);
+
+ context.OnComplete.Dependence(otherTxId, OperationId.GetTxId());
+
+ Y_VERIFY(context.SS->Operations.contains(otherTxId));
+ auto otherOperation = context.SS->Operations.at(otherTxId);
+ for (ui32 partId = 0; partId < otherOperation->Parts.size(); ++partId) {
+ if (auto part = otherOperation->Parts.at(partId)) {
+ part->AbortUnsafe(OperationId.GetTxId(), context);
+ }
+ }
+ }
+
+ context.SS->MarkAsDroping(pathes, OperationId.GetTxId(), context.Ctx);
+
+ txState.State = TTxState::Propose;
+ context.OnComplete.ActivateTx(OperationId);
+
+ context.SS->PersistTxState(db, OperationId);
+
+ auto parentDir = path.Parent();
+ ++parentDir.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
+ context.SS->ClearDescribePathCaches(parentDir.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir.Base()->PathId);
+
+ context.SS->ClearDescribePathCaches(path.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TDropForceUnsafe");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TDropForceUnsafe AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TDropForceUnsafe AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- TPathId pathId = txState->TargetPathId;
- Y_VERIFY(context.SS->PathsById.contains(pathId));
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
- Y_VERIFY(path);
-
- if (path->Dropped()) {
- for (auto shard : txState->Shards) {
- context.OnComplete.DeleteShard(shard.Idx);
- }
- }
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ TPathId pathId = txState->TargetPathId;
+ Y_VERIFY(context.SS->PathsById.contains(pathId));
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+ Y_VERIFY(path);
+
+ if (path->Dropped()) {
+ for (auto shard : txState->Shards) {
+ context.OnComplete.DeleteShard(shard.Idx);
+ }
+ }
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateFroceDropUnsafe(TOperationId id, const TTxTransaction& tx) {
return new TDropForceUnsafe(id, tx, TPathElement::EPathType::EPathTypeInvalid);
}
-ISubOperationBase::TPtr CreateFroceDropUnsafe(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateFroceDropUnsafe(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TDropForceUnsafe(id, state);
-}
-
-ISubOperationBase::TPtr CreateFroceDropSubDomain(TOperationId id, const TTxTransaction& tx) {
- return new TDropForceUnsafe(id, tx, TPathElement::EPathType::EPathTypeSubDomain);
+ return new TDropForceUnsafe(id, state);
}
-ISubOperationBase::TPtr CreateFroceDropSubDomain(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateFroceDropSubDomain(TOperationId id, const TTxTransaction& tx) {
+ return new TDropForceUnsafe(id, tx, TPathElement::EPathType::EPathTypeSubDomain);
+}
+
+ISubOperationBase::TPtr CreateFroceDropSubDomain(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TDropForceUnsafe(id, state);
-}
-
-}
-}
+ return new TDropForceUnsafe(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_finalize_build_index.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_finalize_build_index.cpp
index 31c74042528..fe4d116416f 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_finalize_build_index.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_finalize_build_index.cpp
@@ -1,460 +1,460 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/protos/flat_scheme_op.pb.h>
-
+
#include <ydb/core/base/subdomain.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TConfigureParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TConfigureParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TFinalizeBuildIndex TConfigureParts"
- << " operationId#" << OperationId;
- }
-
-public:
- TConfigureParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvProposeTransactionResult"
- << " at tabletId# " << ssId);
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvProposeTransactionResult"
- << " message: " << ev->Get()->Record.ShortDebugString());
-
- return NTableState::CollectProposeTransactionResults(OperationId, ev, context);
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << " at tabletId# " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState->TxType == TTxState::TxFinalizeBuildIndex);
- Y_VERIFY(txState->BuildIndexId);
-
- TPathId pathId = txState->TargetPathId;
- TTableInfo::TPtr table = context.SS->Tables.at(pathId);
-
- txState->ClearShardsInProgress();
-
- const TTxId snapshotTxId = context.SS->TablesWithSnaphots.at(pathId);
- const TStepId snapshotStepid = context.SS->SnapshotsStepIds.at(snapshotTxId);
-
- for (ui32 i = 0; i < txState->Shards.size(); ++i) {
- TShardIdx shardIdx = txState->Shards[i].Idx;
- TTabletId datashardId = context.SS->ShardInfos[shardIdx].TabletID;
-
- auto seqNo = context.SS->StartRound(*txState);
-
- NKikimrTxDataShard::TFlatSchemeTransaction tx;
- auto* op = tx.MutableFinalizeBuildIndex();
+ return TStringBuilder()
+ << "TFinalizeBuildIndex TConfigureParts"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TConfigureParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvProposeTransactionResult"
+ << " at tabletId# " << ssId);
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvProposeTransactionResult"
+ << " message: " << ev->Get()->Record.ShortDebugString());
+
+ return NTableState::CollectProposeTransactionResults(OperationId, ev, context);
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << " at tabletId# " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState->TxType == TTxState::TxFinalizeBuildIndex);
+ Y_VERIFY(txState->BuildIndexId);
+
+ TPathId pathId = txState->TargetPathId;
+ TTableInfo::TPtr table = context.SS->Tables.at(pathId);
+
+ txState->ClearShardsInProgress();
+
+ const TTxId snapshotTxId = context.SS->TablesWithSnaphots.at(pathId);
+ const TStepId snapshotStepid = context.SS->SnapshotsStepIds.at(snapshotTxId);
+
+ for (ui32 i = 0; i < txState->Shards.size(); ++i) {
+ TShardIdx shardIdx = txState->Shards[i].Idx;
+ TTabletId datashardId = context.SS->ShardInfos[shardIdx].TabletID;
+
+ auto seqNo = context.SS->StartRound(*txState);
+
+ NKikimrTxDataShard::TFlatSchemeTransaction tx;
+ auto* op = tx.MutableFinalizeBuildIndex();
PathIdFromPathId(pathId, op->MutablePathId());
-
- op->SetSnapshotTxId(ui64(snapshotTxId));
- op->SetSnapshotStep(ui64(snapshotStepid));
-
- op->SetTableSchemaVersion(table->AlterVersion+1);
-
- op->SetBuildIndexId(ui64(txState->BuildIndexId));
-
- context.SS->FillSeqNo(tx, seqNo);
-
- TString txBody;
+
+ op->SetSnapshotTxId(ui64(snapshotTxId));
+ op->SetSnapshotStep(ui64(snapshotStepid));
+
+ op->SetTableSchemaVersion(table->AlterVersion+1);
+
+ op->SetBuildIndexId(ui64(txState->BuildIndexId));
+
+ context.SS->FillSeqNo(tx, seqNo);
+
+ TString txBody;
Y_PROTOBUF_SUPPRESS_NODISCARD tx.SerializeToString(&txBody);
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << " SEND TFlatSchemeTransaction to datashard: " << datashardId
- << " with drop snapshot request"
- << " operationId: " << OperationId
- << " seqNo: " << seqNo
- << " at schemeshard: " << ssId);
-
-
- THolder<TEvDataShard::TEvProposeTransaction> event =
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << " SEND TFlatSchemeTransaction to datashard: " << datashardId
+ << " with drop snapshot request"
+ << " operationId: " << OperationId
+ << " seqNo: " << seqNo
+ << " at schemeshard: " << ssId);
+
+
+ THolder<TEvDataShard::TEvProposeTransaction> event =
THolder(new TEvDataShard::TEvProposeTransaction(NKikimrTxDataShard::TX_KIND_SCHEME,
- context.SS->TabletID(),
- context.Ctx.SelfID,
- ui64(OperationId.GetTxId()),
- txBody,
+ context.SS->TabletID(),
+ context.Ctx.SelfID,
+ ui64(OperationId.GetTxId()),
+ txBody,
context.SS->SelectProcessingPrarams(txState->TargetPathId)));
-
- context.OnComplete.BindMsgToPipe(OperationId, datashardId, shardIdx, event.Release());
- }
-
- txState->UpdateShardsInProgress();
- return false;
- }
-};
-
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+ context.OnComplete.BindMsgToPipe(OperationId, datashardId, shardIdx, event.Release());
+ }
+
+ txState->UpdateShardsInProgress();
+ return false;
+ }
+};
+
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TFinalizeBuildIndex TPropose"
- << " operationId#" << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- const auto& evRecord = ev->Get()->Record;
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvSchemaChanged"
- << " at tablet: " << ssId);
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvSchemaChanged"
- << " triggered early"
- << ", message: " << evRecord.ShortDebugString());
-
- NTableState::CollectSchemaChanged(OperationId, ev, context);
- return false;
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << " at tablet: " << ssId
- << ", stepId: " << step);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState->TxType == TTxState::TxFinalizeBuildIndex);
-
- NIceDb::TNiceDb db(context.Txc.DB);
- TPathId tableId = txState->TargetPathId;
- TTxId snapshotTxId = context.SS->TablesWithSnaphots.at(tableId);
- context.SS->SnapshotsStepIds.erase(snapshotTxId);
- context.SS->SnapshotTables.at(snapshotTxId).erase(tableId);
- if (context.SS->SnapshotTables.at(snapshotTxId).empty()) {
- context.SS->SnapshotTables.erase(snapshotTxId);
- }
- context.SS->TablesWithSnaphots.erase(tableId);
-
- context.SS->PersistDropSnapshot(db, snapshotTxId, tableId);
-
- const TTableInfo::TPtr tableInfo = context.SS->Tables.at(txState->TargetPathId);
- tableInfo->AlterVersion += 1;
- context.SS->PersistTableAlterVersion(db, txState->TargetPathId, tableInfo);
-
- context.SS->TabletCounters->Simple()[COUNTER_SNAPSHOTS_COUNT].Sub(1);
-
- auto tablePath = context.SS->PathsById.at(tableId);
- context.SS->ClearDescribePathCaches(tablePath);
- context.OnComplete.PublishToSchemeBoard(OperationId, tableId);
-
- context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply ProgressState"
- << " at tablet: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxFinalizeBuildIndex);
-
- TSet<TTabletId> shardSet;
- for (const auto& shard : txState->Shards) {
- TShardIdx idx = shard.Idx;
- TTabletId tablet = context.SS->ShardInfos.at(idx).TabletID;
- shardSet.insert(tablet);
- }
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, txState->MinStep, shardSet);
- return false;
- }
-};
-
-
-class TCreateTxShards: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ return TStringBuilder()
+ << "TFinalizeBuildIndex TPropose"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ const auto& evRecord = ev->Get()->Record;
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvSchemaChanged"
+ << " at tablet: " << ssId);
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvSchemaChanged"
+ << " triggered early"
+ << ", message: " << evRecord.ShortDebugString());
+
+ NTableState::CollectSchemaChanged(OperationId, ev, context);
+ return false;
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << " at tablet: " << ssId
+ << ", stepId: " << step);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState->TxType == TTxState::TxFinalizeBuildIndex);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ TPathId tableId = txState->TargetPathId;
+ TTxId snapshotTxId = context.SS->TablesWithSnaphots.at(tableId);
+ context.SS->SnapshotsStepIds.erase(snapshotTxId);
+ context.SS->SnapshotTables.at(snapshotTxId).erase(tableId);
+ if (context.SS->SnapshotTables.at(snapshotTxId).empty()) {
+ context.SS->SnapshotTables.erase(snapshotTxId);
+ }
+ context.SS->TablesWithSnaphots.erase(tableId);
+
+ context.SS->PersistDropSnapshot(db, snapshotTxId, tableId);
+
+ const TTableInfo::TPtr tableInfo = context.SS->Tables.at(txState->TargetPathId);
+ tableInfo->AlterVersion += 1;
+ context.SS->PersistTableAlterVersion(db, txState->TargetPathId, tableInfo);
+
+ context.SS->TabletCounters->Simple()[COUNTER_SNAPSHOTS_COUNT].Sub(1);
+
+ auto tablePath = context.SS->PathsById.at(tableId);
+ context.SS->ClearDescribePathCaches(tablePath);
+ context.OnComplete.PublishToSchemeBoard(OperationId, tableId);
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply ProgressState"
+ << " at tablet: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxFinalizeBuildIndex);
+
+ TSet<TTabletId> shardSet;
+ for (const auto& shard : txState->Shards) {
+ TShardIdx idx = shard.Idx;
+ TTabletId tablet = context.SS->ShardInfos.at(idx).TabletID;
+ shardSet.insert(tablet);
+ }
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, txState->MinStep, shardSet);
+ return false;
+ }
+};
+
+
+class TCreateTxShards: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TFinalizeBuildIndex TCreateTxShards"
- << " operationId: " << OperationId;
- }
-
-public:
- TCreateTxShards(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", operation type: " << TTxState::TypeName(txState->TxType)
- << ", at tablet" << ssId);
-
- if (NTableState::CheckPartitioningChangedForTableModification(*txState, context)) {
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << " SourceTablePartitioningChangedForModification"
- << ", tx type: " << TTxState::TypeName(txState->TxType));
- NTableState::UpdatePartitioningForTableModification(OperationId, *txState, context);
- }
-
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- context.SS->ChangeTxState(db, OperationId, TTxState::ConfigureParts);
-
- return true;
- }
-};
-
-
-class TFinalizeBuildIndex: public TSubOperation {
- const TOperationId OperationId;
- const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::CreateParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
- return TTxState::ConfigureParts;
- case TTxState::ConfigureParts:
- return TTxState::Propose;
- case TTxState::Propose:
- return TTxState::ProposedWaitParts;
- case TTxState::ProposedWaitParts:
- return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
+ return TStringBuilder()
+ << "TFinalizeBuildIndex TCreateTxShards"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TCreateTxShards(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", operation type: " << TTxState::TypeName(txState->TxType)
+ << ", at tablet" << ssId);
+
+ if (NTableState::CheckPartitioningChangedForTableModification(*txState, context)) {
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << " SourceTablePartitioningChangedForModification"
+ << ", tx type: " << TTxState::TypeName(txState->TxType));
+ NTableState::UpdatePartitioningForTableModification(OperationId, *txState, context);
+ }
+
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::ConfigureParts);
+
+ return true;
+ }
+};
+
+
+class TFinalizeBuildIndex: public TSubOperation {
+ const TOperationId OperationId;
+ const TTxTransaction Transaction;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::CreateParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
+ return TTxState::ConfigureParts;
+ case TTxState::ConfigureParts:
+ return TTxState::Propose;
+ case TTxState::Propose:
+ return TTxState::ProposedWaitParts;
+ case TTxState::ProposedWaitParts:
+ return TTxState::Done;
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
return THolder(new TCreateTxShards(OperationId));
- case TTxState::ConfigureParts:
+ case TTxState::ConfigureParts:
return THolder(new TConfigureParts(OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new TPropose(OperationId));
- case TTxState::ProposedWaitParts:
+ case TTxState::ProposedWaitParts:
return THolder(new NTableState::TProposedWaitParts(OperationId));
- case TTxState::Done:
+ case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
- TFinalizeBuildIndex(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
- , Transaction(tx)
- {
- }
-
- TFinalizeBuildIndex(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
- auto finalizeMainTable = Transaction.GetFinalizeBuildIndexMainTable();
-
- const TString& parentPathStr = Transaction.GetWorkingDir();
- const TString& tableName = finalizeMainTable.GetTableName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TFinalizeBuildIndex Propose"
- << ", path: " << parentPathStr << "/" << tableName
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- TPath path = TPath::Resolve(parentPathStr, context.SS).Dive(tableName);
-
- {
- TPath::TChecker checks = path.Check();
- checks
- .NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .IsTable()
- .NotUnderDeleting()
- .NotUnderOperation();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- TPath parent = path.Parent();
- {
- TPath::TChecker checks = parent.Check();
- checks
- .NotEmpty()
- .IsResolved()
- .NotDeleted();
-
- if (!checks) {
- TString explain = TStringBuilder() << "parent path fail checks"
- << ", path: " << parent.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
-
- TString errStr;
-
- TPathElement::TPtr pathEl = path.Base();
- TPathId tablePathId = pathEl->PathId;
- result->SetPathId(tablePathId.LocalPathId);
-
- if (!context.SS->CheckLocks(path.Base()->PathId, Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
- return result;
- }
-
- if (!context.SS->TablesWithSnaphots.contains(tablePathId)) {
- errStr = TStringBuilder()
- << "No snapshot presents for table"
- << ", tableId:" << tablePathId
- << ", txId: " << OperationId.GetTxId();
- result->SetError(TEvSchemeShard::EStatus::StatusPathDoesNotExist, errStr);
- return result;
- }
-
- TTxId shapshotTxId = context.SS->TablesWithSnaphots.at(tablePathId);
- if (TTxId(finalizeMainTable.GetSnapshotTxId()) != shapshotTxId) {
- errStr = TStringBuilder()
- << "No snapshot with requested txId presents for table"
- << ", tableId:" << tablePathId
- << ", txId: " << OperationId.GetTxId()
- << ", requested snapshotTxId: " << finalizeMainTable.GetSnapshotTxId()
- << ", snapshotTxId: " << shapshotTxId
- << ", snapshotStepId: " << context.SS->SnapshotsStepIds.at(shapshotTxId);
- result->SetError(TEvSchemeShard::EStatus::StatusPathDoesNotExist, errStr);
- return result;
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- pathEl->LastTxId = OperationId.GetTxId();
- pathEl->PathState = NKikimrSchemeOp::EPathState::EPathStateAlter;
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxFinalizeBuildIndex, tablePathId);
- txState.BuildIndexId = TTxId(finalizeMainTable.GetBuildIndexId());
-
- context.SS->PersistTxState(db, OperationId);
-
- TTableInfo::TPtr table = context.SS->Tables.at(tablePathId);
- Y_VERIFY(table->GetSplitOpsInFlight().empty());
-
- context.SS->ChangeTxState(db, OperationId, TTxState::CreateParts);
- context.OnComplete.ActivateTx(OperationId);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
- void AbortPropose(TOperationContext&) override {
- Y_FAIL("no AbortPropose for TFinalizeBuildIndex");
- }
-
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TFinalizeBuildIndex AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
- << ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-ISubOperationBase::TPtr CreateFinalizeBuildIndexMainTable(TOperationId id, const TTxTransaction& tx) {
- return new TFinalizeBuildIndex(id, tx);
-}
-
-ISubOperationBase::TPtr CreateFinalizeBuildIndexMainTable(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state != TTxState::Invalid);
- return new TFinalizeBuildIndex(id, state);
-}
-
-}
-}
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
+ TFinalizeBuildIndex(TOperationId id, const TTxTransaction& tx)
+ : OperationId(id)
+ , Transaction(tx)
+ {
+ }
+
+ TFinalizeBuildIndex(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ auto finalizeMainTable = Transaction.GetFinalizeBuildIndexMainTable();
+
+ const TString& parentPathStr = Transaction.GetWorkingDir();
+ const TString& tableName = finalizeMainTable.GetTableName();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TFinalizeBuildIndex Propose"
+ << ", path: " << parentPathStr << "/" << tableName
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ TPath path = TPath::Resolve(parentPathStr, context.SS).Dive(tableName);
+
+ {
+ TPath::TChecker checks = path.Check();
+ checks
+ .NotEmpty()
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .IsTable()
+ .NotUnderDeleting()
+ .NotUnderOperation();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ TPath parent = path.Parent();
+ {
+ TPath::TChecker checks = parent.Check();
+ checks
+ .NotEmpty()
+ .IsResolved()
+ .NotDeleted();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent path fail checks"
+ << ", path: " << parent.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+
+ TString errStr;
+
+ TPathElement::TPtr pathEl = path.Base();
+ TPathId tablePathId = pathEl->PathId;
+ result->SetPathId(tablePathId.LocalPathId);
+
+ if (!context.SS->CheckLocks(path.Base()->PathId, Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
+ return result;
+ }
+
+ if (!context.SS->TablesWithSnaphots.contains(tablePathId)) {
+ errStr = TStringBuilder()
+ << "No snapshot presents for table"
+ << ", tableId:" << tablePathId
+ << ", txId: " << OperationId.GetTxId();
+ result->SetError(TEvSchemeShard::EStatus::StatusPathDoesNotExist, errStr);
+ return result;
+ }
+
+ TTxId shapshotTxId = context.SS->TablesWithSnaphots.at(tablePathId);
+ if (TTxId(finalizeMainTable.GetSnapshotTxId()) != shapshotTxId) {
+ errStr = TStringBuilder()
+ << "No snapshot with requested txId presents for table"
+ << ", tableId:" << tablePathId
+ << ", txId: " << OperationId.GetTxId()
+ << ", requested snapshotTxId: " << finalizeMainTable.GetSnapshotTxId()
+ << ", snapshotTxId: " << shapshotTxId
+ << ", snapshotStepId: " << context.SS->SnapshotsStepIds.at(shapshotTxId);
+ result->SetError(TEvSchemeShard::EStatus::StatusPathDoesNotExist, errStr);
+ return result;
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ pathEl->LastTxId = OperationId.GetTxId();
+ pathEl->PathState = NKikimrSchemeOp::EPathState::EPathStateAlter;
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxFinalizeBuildIndex, tablePathId);
+ txState.BuildIndexId = TTxId(finalizeMainTable.GetBuildIndexId());
+
+ context.SS->PersistTxState(db, OperationId);
+
+ TTableInfo::TPtr table = context.SS->Tables.at(tablePathId);
+ Y_VERIFY(table->GetSplitOpsInFlight().empty());
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::CreateParts);
+ context.OnComplete.ActivateTx(OperationId);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
+ void AbortPropose(TOperationContext&) override {
+ Y_FAIL("no AbortPropose for TFinalizeBuildIndex");
+ }
+
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TFinalizeBuildIndex AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+ISubOperationBase::TPtr CreateFinalizeBuildIndexMainTable(TOperationId id, const TTxTransaction& tx) {
+ return new TFinalizeBuildIndex(id, tx);
+}
+
+ISubOperationBase::TPtr CreateFinalizeBuildIndexMainTable(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state != TTxState::Invalid);
+ return new TFinalizeBuildIndex(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_initiate_build_index.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_initiate_build_index.cpp
index 323e61e1a97..f8d5ca96c69 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_initiate_build_index.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_initiate_build_index.cpp
@@ -1,63 +1,63 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/protos/flat_scheme_op.pb.h>
-
+
#include <ydb/core/base/subdomain.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TConfigureParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TConfigureParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TInitializeBuildIndex TConfigureParts"
- << " operationId#" << OperationId;
- }
-
-public:
- TConfigureParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvProposeTransactionResult"
- << " at tabletId# " << ssId);
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvProposeTransactionResult"
- << " message: " << ev->Get()->Record.ShortDebugString());
-
- return NTableState::CollectProposeTransactionResults(OperationId, ev, context);
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << " at tabletId# " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState->TxType == TTxState::TxInitializeBuildIndex);
-
- TPathId pathId = txState->TargetPathId;
+ return TStringBuilder()
+ << "TInitializeBuildIndex TConfigureParts"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TConfigureParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvProposeTransactionResult"
+ << " at tabletId# " << ssId);
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvProposeTransactionResult"
+ << " message: " << ev->Get()->Record.ShortDebugString());
+
+ return NTableState::CollectProposeTransactionResults(OperationId, ev, context);
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << " at tabletId# " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState->TxType == TTxState::TxInitializeBuildIndex);
+
+ TPathId pathId = txState->TargetPathId;
Y_VERIFY(context.SS->PathsById.contains(pathId));
TPathElement::TPtr path = context.SS->PathsById.at(pathId);
Y_VERIFY(context.SS->Tables.contains(pathId));
- const TTableInfo::TPtr tableInfo = context.SS->Tables.at(pathId);
-
+ const TTableInfo::TPtr tableInfo = context.SS->Tables.at(pathId);
+
NKikimrTxDataShard::TFlatSchemeTransaction txTemplate;
auto initiate = txTemplate.MutableInitiateBuildIndex();
PathIdFromPathId(pathId, initiate->MutablePathId());
@@ -91,395 +91,395 @@ public:
context.SS->DescribeTableIndex(childPathId, childName, index->AlterData, *initiate->MutableIndexDescription());
}
- txState->ClearShardsInProgress();
-
- for (ui32 i = 0; i < txState->Shards.size(); ++i) {
- TShardIdx shardIdx = txState->Shards[i].Idx;
- TTabletId datashardId = context.SS->ShardInfos[shardIdx].TabletID;
-
- auto seqNo = context.SS->StartRound(*txState);
-
+ txState->ClearShardsInProgress();
+
+ for (ui32 i = 0; i < txState->Shards.size(); ++i) {
+ TShardIdx shardIdx = txState->Shards[i].Idx;
+ TTabletId datashardId = context.SS->ShardInfos[shardIdx].TabletID;
+
+ auto seqNo = context.SS->StartRound(*txState);
+
NKikimrTxDataShard::TFlatSchemeTransaction tx(txTemplate);
- context.SS->FillSeqNo(tx, seqNo);
-
- TString txBody;
+ context.SS->FillSeqNo(tx, seqNo);
+
+ TString txBody;
Y_PROTOBUF_SUPPRESS_NODISCARD tx.SerializeToString(&txBody);
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << " SEND TFlatSchemeTransaction to datashard: " << datashardId
- << " with create snapshot request"
- << " operationId: " << OperationId
- << " seqNo: " << seqNo
- << " at schemeshard: " << ssId);
-
-
- THolder<TEvDataShard::TEvProposeTransaction> event =
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << " SEND TFlatSchemeTransaction to datashard: " << datashardId
+ << " with create snapshot request"
+ << " operationId: " << OperationId
+ << " seqNo: " << seqNo
+ << " at schemeshard: " << ssId);
+
+
+ THolder<TEvDataShard::TEvProposeTransaction> event =
THolder(new TEvDataShard::TEvProposeTransaction(NKikimrTxDataShard::TX_KIND_SCHEME,
- context.SS->TabletID(),
- context.Ctx.SelfID,
- ui64(OperationId.GetTxId()),
- txBody,
+ context.SS->TabletID(),
+ context.Ctx.SelfID,
+ ui64(OperationId.GetTxId()),
+ txBody,
context.SS->SelectProcessingPrarams(txState->TargetPathId)));
-
- context.OnComplete.BindMsgToPipe(OperationId, datashardId, shardIdx, event.Release());
- }
-
- txState->UpdateShardsInProgress();
- return false;
- }
-};
-
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+ context.OnComplete.BindMsgToPipe(OperationId, datashardId, shardIdx, event.Release());
+ }
+
+ txState->UpdateShardsInProgress();
+ return false;
+ }
+};
+
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TInitializeBuildIndex TPropose"
- << " operationId#" << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- const auto& evRecord = ev->Get()->Record;
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvSchemaChanged"
- << " at tablet: " << ssId);
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvSchemaChanged"
- << " triggered early"
- << ", message: " << evRecord.ShortDebugString());
-
- NTableState::CollectSchemaChanged(OperationId, ev, context);
- return false;
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << " at tablet: " << ssId
- << ", stepId: " << step);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState->TxType == TTxState::TxInitializeBuildIndex);
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->SnapshotsStepIds[OperationId.GetTxId()] = step;
- context.SS->PersistSnapshotStepId(db, OperationId.GetTxId(), step);
-
- const TTableInfo::TPtr tableInfo = context.SS->Tables.at(txState->TargetPathId);
- tableInfo->AlterVersion += 1;
- context.SS->PersistTableAlterVersion(db, txState->TargetPathId, tableInfo);
-
- auto tablePath = context.SS->PathsById.at(txState->TargetPathId);
- context.SS->ClearDescribePathCaches(tablePath);
- context.OnComplete.PublishToSchemeBoard(OperationId, tablePath->PathId);
-
- context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply ProgressState"
- << " at tablet: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxInitializeBuildIndex);
-
- TSet<TTabletId> shardSet;
- for (const auto& shard : txState->Shards) {
- TShardIdx idx = shard.Idx;
- TTabletId tablet = context.SS->ShardInfos.at(idx).TabletID;
- shardSet.insert(tablet);
- }
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, txState->MinStep, shardSet);
- return false;
- }
-};
-
-
-
-class TCreateTxShards: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ return TStringBuilder()
+ << "TInitializeBuildIndex TPropose"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ const auto& evRecord = ev->Get()->Record;
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvSchemaChanged"
+ << " at tablet: " << ssId);
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvSchemaChanged"
+ << " triggered early"
+ << ", message: " << evRecord.ShortDebugString());
+
+ NTableState::CollectSchemaChanged(OperationId, ev, context);
+ return false;
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << " at tablet: " << ssId
+ << ", stepId: " << step);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState->TxType == TTxState::TxInitializeBuildIndex);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->SnapshotsStepIds[OperationId.GetTxId()] = step;
+ context.SS->PersistSnapshotStepId(db, OperationId.GetTxId(), step);
+
+ const TTableInfo::TPtr tableInfo = context.SS->Tables.at(txState->TargetPathId);
+ tableInfo->AlterVersion += 1;
+ context.SS->PersistTableAlterVersion(db, txState->TargetPathId, tableInfo);
+
+ auto tablePath = context.SS->PathsById.at(txState->TargetPathId);
+ context.SS->ClearDescribePathCaches(tablePath);
+ context.OnComplete.PublishToSchemeBoard(OperationId, tablePath->PathId);
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply ProgressState"
+ << " at tablet: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxInitializeBuildIndex);
+
+ TSet<TTabletId> shardSet;
+ for (const auto& shard : txState->Shards) {
+ TShardIdx idx = shard.Idx;
+ TTabletId tablet = context.SS->ShardInfos.at(idx).TabletID;
+ shardSet.insert(tablet);
+ }
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, txState->MinStep, shardSet);
+ return false;
+ }
+};
+
+
+
+class TCreateTxShards: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TInitializeBuildIndex TCreateTxShards"
- << " operationId: " << OperationId;
- }
-
-public:
- TCreateTxShards(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", operation type: " << TTxState::TypeName(txState->TxType)
- << ", at tablet" << ssId);
-
- if (NTableState::CheckPartitioningChangedForTableModification(*txState, context)) {
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << " SourceTablePartitioningChangedForModification"
- << ", tx type: " << TTxState::TypeName(txState->TxType));
- NTableState::UpdatePartitioningForTableModification(OperationId, *txState, context);
- }
-
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- context.SS->ChangeTxState(db, OperationId, TTxState::ConfigureParts);
-
- return true;
- }
-};
-
-
-class TInitializeBuildIndex: public TSubOperation {
- const TOperationId OperationId;
- const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::CreateParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
- return TTxState::ConfigureParts;
- case TTxState::ConfigureParts:
- return TTxState::Propose;
- case TTxState::Propose:
- return TTxState::ProposedWaitParts;
- case TTxState::ProposedWaitParts:
- return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::CreateParts:
+ return TStringBuilder()
+ << "TInitializeBuildIndex TCreateTxShards"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TCreateTxShards(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", operation type: " << TTxState::TypeName(txState->TxType)
+ << ", at tablet" << ssId);
+
+ if (NTableState::CheckPartitioningChangedForTableModification(*txState, context)) {
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << " SourceTablePartitioningChangedForModification"
+ << ", tx type: " << TTxState::TypeName(txState->TxType));
+ NTableState::UpdatePartitioningForTableModification(OperationId, *txState, context);
+ }
+
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::ConfigureParts);
+
+ return true;
+ }
+};
+
+
+class TInitializeBuildIndex: public TSubOperation {
+ const TOperationId OperationId;
+ const TTxTransaction Transaction;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::CreateParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
+ return TTxState::ConfigureParts;
+ case TTxState::ConfigureParts:
+ return TTxState::Propose;
+ case TTxState::Propose:
+ return TTxState::ProposedWaitParts;
+ case TTxState::ProposedWaitParts:
+ return TTxState::Done;
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::CreateParts:
return THolder(new TCreateTxShards(OperationId));
- case TTxState::ConfigureParts:
+ case TTxState::ConfigureParts:
return THolder(new TConfigureParts(OperationId));
- case TTxState::Propose:
+ case TTxState::Propose:
return THolder(new TPropose(OperationId));
- case TTxState::ProposedWaitParts:
+ case TTxState::ProposedWaitParts:
return THolder(new NTableState::TProposedWaitParts(OperationId));
- case TTxState::Done:
+ case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
- TInitializeBuildIndex(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
- , Transaction(tx)
- {
- }
-
- TInitializeBuildIndex(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
- auto schema = Transaction.GetInitiateBuildIndexMainTable();
-
- const TString& parentPathStr = Transaction.GetWorkingDir();
- const TString& tableName = schema.GetTableName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TInitializeBuildIndex Propose"
- << ", path: " << parentPathStr << "/" << tableName
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
- {
- NSchemeShard::TPath::TChecker checks = parentPath.Check();
- checks
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsCommonSensePath()
- .IsLikeDirectory();
-
- if (!checks) {
- TString explain = TStringBuilder() << "parent path fail checks"
- << ", path: " << parentPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- NSchemeShard::TPath dstPath = parentPath.Child(tableName);
- {
- NSchemeShard::TPath::TChecker checks = dstPath.Check();
- checks
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotUnderDeleting()
- .NotUnderOperation()
- .IsCommonSensePath()
- .IsTable();
-
- if (!checks) {
- TString explain = TStringBuilder() << "dst path fail checks"
- << ", path: " << dstPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- if (dstPath.IsResolved()) {
- result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
- }
- return result;
- }
- }
-
- TString errStr;
-
- TPathElement::TPtr pathEl = dstPath.Base();
- TPathId tablePathId = pathEl->PathId;
- result->SetPathId(tablePathId.LocalPathId);
-
- if (!context.SS->CheckLocks(dstPath.Base()->PathId, Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
- return result;
- }
-
- if (context.SS->TablesWithSnaphots.contains(tablePathId)) {
- TTxId shapshotTxId = context.SS->TablesWithSnaphots.at(tablePathId);
- if (OperationId.GetTxId() == shapshotTxId) {
- // already
- errStr = TStringBuilder()
- << "Snapshot with the same txId already presents for table"
- << ", tableId:" << tablePathId
- << ", txId: " << OperationId.GetTxId()
- << ", snapshotTxId: " << shapshotTxId
- << ", snapshotStepId: " << context.SS->SnapshotsStepIds.at(shapshotTxId);
- result->SetError(TEvSchemeShard::EStatus::StatusAlreadyExists, errStr);
- return result;
- }
-
- errStr = TStringBuilder()
- << "Snapshot with another txId already presents for table, only one snapshot is allowed for table for now"
- << ", tableId:" << tablePathId
- << ", txId: " << OperationId.GetTxId()
- << ", snapshotTxId: " << shapshotTxId
- << ", snapshotStepId: " << context.SS->SnapshotsStepIds.at(shapshotTxId);
- result->SetError(TEvSchemeShard::EStatus::StatusSchemeError, errStr);
- return result;
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- pathEl->LastTxId = OperationId.GetTxId();
- pathEl->PathState = NKikimrSchemeOp::EPathState::EPathStateAlter;
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxInitializeBuildIndex, tablePathId);
- txState.State = TTxState::CreateParts;
- context.SS->PersistTxState(db, OperationId);
-
- TTableInfo::TPtr table = context.SS->Tables.at(tablePathId);
- for (auto splitTx: table->GetSplitOpsInFlight()) {
- context.OnComplete.Dependence(splitTx.GetTxId(), OperationId.GetTxId());
- }
-
- context.SS->TablesWithSnaphots.emplace(tablePathId, OperationId.GetTxId());
- context.SS->SnapshotTables[OperationId.GetTxId()].insert(tablePathId);
- context.SS->PersistSnapshotTable(db, OperationId.GetTxId(), tablePathId);
- context.SS->TabletCounters->Simple()[COUNTER_SNAPSHOTS_COUNT].Add(1);
-
- context.OnComplete.ActivateTx(OperationId);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
- void AbortPropose(TOperationContext&) override {
- Y_FAIL("no AbortPropose for TInitializeBuildIndex");
- }
-
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TInitializeBuildIndex AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
- << ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-ISubOperationBase::TPtr CreateInitializeBuildIndexMainTable(TOperationId id, const TTxTransaction& tx) {
- return new TInitializeBuildIndex(id, tx);
-}
-
-ISubOperationBase::TPtr CreateInitializeBuildIndexMainTable(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state != TTxState::Invalid);
- return new TInitializeBuildIndex(id, state);
-}
-
-}
-}
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
+ TInitializeBuildIndex(TOperationId id, const TTxTransaction& tx)
+ : OperationId(id)
+ , Transaction(tx)
+ {
+ }
+
+ TInitializeBuildIndex(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ auto schema = Transaction.GetInitiateBuildIndexMainTable();
+
+ const TString& parentPathStr = Transaction.GetWorkingDir();
+ const TString& tableName = schema.GetTableName();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TInitializeBuildIndex Propose"
+ << ", path: " << parentPathStr << "/" << tableName
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
+ {
+ NSchemeShard::TPath::TChecker checks = parentPath.Check();
+ checks
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsCommonSensePath()
+ .IsLikeDirectory();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent path fail checks"
+ << ", path: " << parentPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ NSchemeShard::TPath dstPath = parentPath.Child(tableName);
+ {
+ NSchemeShard::TPath::TChecker checks = dstPath.Check();
+ checks
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotUnderDeleting()
+ .NotUnderOperation()
+ .IsCommonSensePath()
+ .IsTable();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "dst path fail checks"
+ << ", path: " << dstPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ if (dstPath.IsResolved()) {
+ result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+ }
+ return result;
+ }
+ }
+
+ TString errStr;
+
+ TPathElement::TPtr pathEl = dstPath.Base();
+ TPathId tablePathId = pathEl->PathId;
+ result->SetPathId(tablePathId.LocalPathId);
+
+ if (!context.SS->CheckLocks(dstPath.Base()->PathId, Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
+ return result;
+ }
+
+ if (context.SS->TablesWithSnaphots.contains(tablePathId)) {
+ TTxId shapshotTxId = context.SS->TablesWithSnaphots.at(tablePathId);
+ if (OperationId.GetTxId() == shapshotTxId) {
+ // already
+ errStr = TStringBuilder()
+ << "Snapshot with the same txId already presents for table"
+ << ", tableId:" << tablePathId
+ << ", txId: " << OperationId.GetTxId()
+ << ", snapshotTxId: " << shapshotTxId
+ << ", snapshotStepId: " << context.SS->SnapshotsStepIds.at(shapshotTxId);
+ result->SetError(TEvSchemeShard::EStatus::StatusAlreadyExists, errStr);
+ return result;
+ }
+
+ errStr = TStringBuilder()
+ << "Snapshot with another txId already presents for table, only one snapshot is allowed for table for now"
+ << ", tableId:" << tablePathId
+ << ", txId: " << OperationId.GetTxId()
+ << ", snapshotTxId: " << shapshotTxId
+ << ", snapshotStepId: " << context.SS->SnapshotsStepIds.at(shapshotTxId);
+ result->SetError(TEvSchemeShard::EStatus::StatusSchemeError, errStr);
+ return result;
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ pathEl->LastTxId = OperationId.GetTxId();
+ pathEl->PathState = NKikimrSchemeOp::EPathState::EPathStateAlter;
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxInitializeBuildIndex, tablePathId);
+ txState.State = TTxState::CreateParts;
+ context.SS->PersistTxState(db, OperationId);
+
+ TTableInfo::TPtr table = context.SS->Tables.at(tablePathId);
+ for (auto splitTx: table->GetSplitOpsInFlight()) {
+ context.OnComplete.Dependence(splitTx.GetTxId(), OperationId.GetTxId());
+ }
+
+ context.SS->TablesWithSnaphots.emplace(tablePathId, OperationId.GetTxId());
+ context.SS->SnapshotTables[OperationId.GetTxId()].insert(tablePathId);
+ context.SS->PersistSnapshotTable(db, OperationId.GetTxId(), tablePathId);
+ context.SS->TabletCounters->Simple()[COUNTER_SNAPSHOTS_COUNT].Add(1);
+
+ context.OnComplete.ActivateTx(OperationId);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
+ void AbortPropose(TOperationContext&) override {
+ Y_FAIL("no AbortPropose for TInitializeBuildIndex");
+ }
+
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TInitializeBuildIndex AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+ISubOperationBase::TPtr CreateInitializeBuildIndexMainTable(TOperationId id, const TTxTransaction& tx) {
+ return new TInitializeBuildIndex(id, tx);
+}
+
+ISubOperationBase::TPtr CreateInitializeBuildIndexMainTable(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state != TTxState::Invalid);
+ return new TInitializeBuildIndex(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_just_reject.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_just_reject.cpp
index 253d4b7d499..43bec868a2c 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_just_reject.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_just_reject.cpp
@@ -1,28 +1,28 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TReject: public ISubOperationBase {
-private:
- TOperationId OperationId;
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TReject: public ISubOperationBase {
+private:
+ TOperationId OperationId;
THolder<TProposeResponse> Response;
-
-public:
+
+public:
TReject(TOperationId id, THolder<TProposeResponse> response)
- : OperationId(id)
+ : OperationId(id)
, Response(std::move(response))
- {}
-
- TReject(TOperationId id, NKikimrScheme::EStatus status, const TString& explain)
+ {}
+
+ TReject(TOperationId id, NKikimrScheme::EStatus status, const TString& explain)
: OperationId(id)
, Response(
- new TEvSchemeShard::TEvModifySchemeTransactionResult(
- NKikimrScheme::StatusAccepted, 0, 0))
+ new TEvSchemeShard::TEvModifySchemeTransactionResult(
+ NKikimrScheme::StatusAccepted, 0, 0))
{
Response->SetError(status, explain);
}
@@ -31,43 +31,43 @@ public:
Y_FAIL("no AbortPropose for TReject");
}
- void ProgressState(TOperationContext&) override {
- Y_FAIL("no ProgressState for TReject");
- }
-
- void AbortUnsafe(TTxId, TOperationContext&) override {
- Y_FAIL("no AbortUnsafe for TReject");
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ void ProgressState(TOperationContext&) override {
+ Y_FAIL("no ProgressState for TReject");
+ }
+
+ void AbortUnsafe(TTxId, TOperationContext&) override {
+ Y_FAIL("no AbortUnsafe for TReject");
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
Y_VERIFY(Response);
- const auto ssId = context.SS->SelfTabletId();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TReject Propose"
- << ", opId: " << OperationId
+ const auto ssId = context.SS->SelfTabletId();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TReject Propose"
+ << ", opId: " << OperationId
<< ", explain: " << Response->Record.GetReason()
- << ", at schemeshard: " << ssId);
-
- Response->Record.SetTxId(ui64(OperationId.GetTxId()));
- Response->Record.SetSchemeshardId(ui64(ssId));
+ << ", at schemeshard: " << ssId);
+
+ Response->Record.SetTxId(ui64(OperationId.GetTxId()));
+ Response->Record.SetSchemeshardId(ui64(ssId));
return std::move(Response);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateReject(TOperationId id, THolder<TProposeResponse> response) {
return new TReject(id, std::move(response));
}
-ISubOperationBase::TPtr CreateReject(TOperationId id, NKikimrScheme::EStatus status, const TString& message) {
- return new TReject(id, status, message);
-}
-
-}
-}
+ISubOperationBase::TPtr CreateReject(TOperationId id, NKikimrScheme::EStatus status, const TString& message) {
+ return new TReject(id, status, message);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_memory_changes.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_memory_changes.cpp
index 7412f5ccc54..e4151fd8dfb 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_memory_changes.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_memory_changes.cpp
@@ -1,148 +1,148 @@
-#include "schemeshard__operation_memory_changes.h"
-
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_memory_changes.h"
+
+#include "schemeshard_impl.h"
+
#include <ydb/core/tx/tx_processing.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-void TMemoryChanges::GrabNewTxState(TSchemeShard* ss, const TOperationId& op) {
- Y_VERIFY(!ss->TxInFlight.contains(op));
-
- TxStates.emplace(op, nullptr);
-}
-
-void TMemoryChanges::GrabNewPath(TSchemeShard* ss, const TPathId& pathId) {
- Y_VERIFY(!ss->PathsById.contains(pathId));
-
- Pathes.emplace(pathId, nullptr);
-}
-
-void TMemoryChanges::GrabPath(TSchemeShard* ss, const TPathId& pathId) {
- Y_VERIFY(ss->PathsById.contains(pathId));
-
- TPathElement::TPtr copy = new TPathElement(*ss->PathsById.at(pathId));
- Pathes.emplace(pathId, copy);
-}
-
-void TMemoryChanges::GrabNewTable(TSchemeShard* ss, const TPathId& pathId) {
- Y_VERIFY(!ss->Tables.contains(pathId));
-
- Tables.emplace(pathId, nullptr);
-}
-
-void TMemoryChanges::GrabTable(TSchemeShard* ss, const TPathId& pathId) {
- Y_VERIFY(ss->Tables.contains(pathId));
-
- TTableInfo::TPtr copy = new TTableInfo(*ss->Tables.at(pathId));
- Tables.emplace(pathId, copy);
-}
-
-void TMemoryChanges::GrabNewShard(TSchemeShard*, const TShardIdx& shardId) {
- Shards.emplace(shardId, nullptr);
-}
-
-void TMemoryChanges::GrabShard(TSchemeShard *ss, const TShardIdx &shardId) {
- Y_VERIFY(ss->ShardInfos.contains(shardId));
-
- const auto& shard = ss->ShardInfos.at(shardId);
- Shards.emplace(shardId, MakeHolder<TShardInfo>(shard));
-}
-
-void TMemoryChanges::GrabDomain(TSchemeShard* ss, const TPathId& pathId) {
- Y_VERIFY(ss->SubDomains.contains(pathId));
-
- TSubDomainInfo::TPtr copy = new TSubDomainInfo(*ss->SubDomains.at(pathId));
- SubDomains.emplace(pathId, copy);
-}
-
-void TMemoryChanges::GrabNewIndex(TSchemeShard* ss, const TPathId& pathId) {
- Y_VERIFY(!ss->Indexes.contains(pathId));
-
- Indexes.emplace(pathId, nullptr);
-}
-
-void TMemoryChanges::GrabNewCdcStream(TSchemeShard* ss, const TPathId& pathId) {
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+void TMemoryChanges::GrabNewTxState(TSchemeShard* ss, const TOperationId& op) {
+ Y_VERIFY(!ss->TxInFlight.contains(op));
+
+ TxStates.emplace(op, nullptr);
+}
+
+void TMemoryChanges::GrabNewPath(TSchemeShard* ss, const TPathId& pathId) {
+ Y_VERIFY(!ss->PathsById.contains(pathId));
+
+ Pathes.emplace(pathId, nullptr);
+}
+
+void TMemoryChanges::GrabPath(TSchemeShard* ss, const TPathId& pathId) {
+ Y_VERIFY(ss->PathsById.contains(pathId));
+
+ TPathElement::TPtr copy = new TPathElement(*ss->PathsById.at(pathId));
+ Pathes.emplace(pathId, copy);
+}
+
+void TMemoryChanges::GrabNewTable(TSchemeShard* ss, const TPathId& pathId) {
+ Y_VERIFY(!ss->Tables.contains(pathId));
+
+ Tables.emplace(pathId, nullptr);
+}
+
+void TMemoryChanges::GrabTable(TSchemeShard* ss, const TPathId& pathId) {
+ Y_VERIFY(ss->Tables.contains(pathId));
+
+ TTableInfo::TPtr copy = new TTableInfo(*ss->Tables.at(pathId));
+ Tables.emplace(pathId, copy);
+}
+
+void TMemoryChanges::GrabNewShard(TSchemeShard*, const TShardIdx& shardId) {
+ Shards.emplace(shardId, nullptr);
+}
+
+void TMemoryChanges::GrabShard(TSchemeShard *ss, const TShardIdx &shardId) {
+ Y_VERIFY(ss->ShardInfos.contains(shardId));
+
+ const auto& shard = ss->ShardInfos.at(shardId);
+ Shards.emplace(shardId, MakeHolder<TShardInfo>(shard));
+}
+
+void TMemoryChanges::GrabDomain(TSchemeShard* ss, const TPathId& pathId) {
+ Y_VERIFY(ss->SubDomains.contains(pathId));
+
+ TSubDomainInfo::TPtr copy = new TSubDomainInfo(*ss->SubDomains.at(pathId));
+ SubDomains.emplace(pathId, copy);
+}
+
+void TMemoryChanges::GrabNewIndex(TSchemeShard* ss, const TPathId& pathId) {
+ Y_VERIFY(!ss->Indexes.contains(pathId));
+
+ Indexes.emplace(pathId, nullptr);
+}
+
+void TMemoryChanges::GrabNewCdcStream(TSchemeShard* ss, const TPathId& pathId) {
Y_VERIFY(!ss->CdcStreams.contains(pathId));
- CdcStreams.emplace(pathId, nullptr);
+ CdcStreams.emplace(pathId, nullptr);
}
-void TMemoryChanges::UnDo(TSchemeShard* ss) {
- // be aware of the order of grab & undo ops
- // stack is the best way to manage it right
-
- while (Pathes) {
- const auto& [id, elem] = Pathes.top();
- if (elem) {
- ss->PathsById[id] = elem;
- } else {
- ss->PathsById.erase(id);
- }
- Pathes.pop();
- }
-
- while (Indexes) {
- const auto& [id, elem] = Indexes.top();
- if (elem) {
- ss->Indexes[id] = elem;
- } else {
- ss->Indexes.erase(id);
- }
- Indexes.pop();
- }
-
- while (CdcStreams) {
- const auto& [id, elem] = CdcStreams.top();
+void TMemoryChanges::UnDo(TSchemeShard* ss) {
+ // be aware of the order of grab & undo ops
+ // stack is the best way to manage it right
+
+ while (Pathes) {
+ const auto& [id, elem] = Pathes.top();
+ if (elem) {
+ ss->PathsById[id] = elem;
+ } else {
+ ss->PathsById.erase(id);
+ }
+ Pathes.pop();
+ }
+
+ while (Indexes) {
+ const auto& [id, elem] = Indexes.top();
+ if (elem) {
+ ss->Indexes[id] = elem;
+ } else {
+ ss->Indexes.erase(id);
+ }
+ Indexes.pop();
+ }
+
+ while (CdcStreams) {
+ const auto& [id, elem] = CdcStreams.top();
if (elem) {
ss->CdcStreams[id] = elem;
} else {
ss->CdcStreams.erase(id);
}
- CdcStreams.pop();
+ CdcStreams.pop();
+ }
+
+ while (Tables) {
+ const auto& [id, elem] = Tables.top();
+ if (elem) {
+ ss->Tables[id] = elem;
+ } else {
+ ss->Tables.erase(id);
+ }
+ Tables.pop();
}
- while (Tables) {
- const auto& [id, elem] = Tables.top();
- if (elem) {
- ss->Tables[id] = elem;
- } else {
- ss->Tables.erase(id);
- }
- Tables.pop();
- }
-
- while (Shards) {
- const auto& [id, elem] = Shards.top();
- if (elem) {
- ss->ShardInfos[id] = *elem;
- } else {
- ss->ShardInfos.erase(id);
- }
- Shards.pop();
- }
-
- while (SubDomains) {
- const auto& [id, elem] = SubDomains.top();
- if (elem) {
- ss->SubDomains[id] = elem;
- } else {
- ss->SubDomains.erase(id);
- }
- SubDomains.pop();
- }
-
- while (TxStates) {
- const auto& [id, elem] = TxStates.top();
- if (!elem) {
- ss->TxInFlight.erase(id);
- } else {
- Y_FAIL("No such cases are exist");
- }
- TxStates.pop();
- }
-}
-
-}
-}
+ while (Shards) {
+ const auto& [id, elem] = Shards.top();
+ if (elem) {
+ ss->ShardInfos[id] = *elem;
+ } else {
+ ss->ShardInfos.erase(id);
+ }
+ Shards.pop();
+ }
+
+ while (SubDomains) {
+ const auto& [id, elem] = SubDomains.top();
+ if (elem) {
+ ss->SubDomains[id] = elem;
+ } else {
+ ss->SubDomains.erase(id);
+ }
+ SubDomains.pop();
+ }
+
+ while (TxStates) {
+ const auto& [id, elem] = TxStates.top();
+ if (!elem) {
+ ss->TxInFlight.erase(id);
+ } else {
+ Y_FAIL("No such cases are exist");
+ }
+ TxStates.pop();
+ }
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_memory_changes.h b/ydb/core/tx/schemeshard/schemeshard__operation_memory_changes.h
index de9b35211af..c6ec264ffe7 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_memory_changes.h
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_memory_changes.h
@@ -1,63 +1,63 @@
-#pragma once
-
-#include "schemeshard_identificators.h"
-#include "schemeshard_path_element.h"
-#include "schemeshard_info_types.h"
-
+#pragma once
+
+#include "schemeshard_identificators.h"
+#include "schemeshard_path_element.h"
+#include "schemeshard_info_types.h"
+
#include <ydb/core/tablet_flat/tablet_flat_executor.h>
-
-#include <util/generic/ptr.h>
-#include <util/generic/stack.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-class TSchemeShard;
-
-class TMemoryChanges: public TSimpleRefCount<TMemoryChanges> {
- using TPathState = std::pair<TPathId, TPathElement::TPtr>;
- TStack<TPathState> Pathes;
-
- using TIndexState = std::pair<TPathId, TTableIndexInfo::TPtr>;
- TStack<TIndexState> Indexes;
-
+
+#include <util/generic/ptr.h>
+#include <util/generic/stack.h>
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+class TSchemeShard;
+
+class TMemoryChanges: public TSimpleRefCount<TMemoryChanges> {
+ using TPathState = std::pair<TPathId, TPathElement::TPtr>;
+ TStack<TPathState> Pathes;
+
+ using TIndexState = std::pair<TPathId, TTableIndexInfo::TPtr>;
+ TStack<TIndexState> Indexes;
+
using TCdcStreamState = std::pair<TPathId, TCdcStreamInfo::TPtr>;
- TStack<TCdcStreamState> CdcStreams;
-
- using TTableState = std::pair<TPathId, TTableInfo::TPtr>;
- TStack<TTableState> Tables;
-
- using TShardState = std::pair<TShardIdx, THolder<TShardInfo>>;
- TStack<TShardState> Shards;
-
- using TSubDomainState = std::pair<TPathId, TSubDomainInfo::TPtr>;
- TStack<TSubDomainState> SubDomains;
-
- using TTxState = std::pair<TOperationId, THolder<TTxState>>;
- TStack<TTxState> TxStates;
-
-public:
- ~TMemoryChanges() = default;
-
- void GrabNewTxState(TSchemeShard* ss, const TOperationId& op);
-
- void GrabNewPath(TSchemeShard* ss, const TPathId& pathId);
- void GrabPath(TSchemeShard* ss, const TPathId& pathId);
-
- void GrabNewTable(TSchemeShard* ss, const TPathId& pathId);
- void GrabTable(TSchemeShard* ss, const TPathId& pathId);
-
- void GrabNewShard(TSchemeShard* ss, const TShardIdx& shardId);
- void GrabShard(TSchemeShard* ss, const TShardIdx& shardId);
-
- void GrabDomain(TSchemeShard* ss, const TPathId& pathId);
-
- void GrabNewIndex(TSchemeShard* ss, const TPathId& pathId);
-
- void GrabNewCdcStream(TSchemeShard* ss, const TPathId& pathId);
-
- void UnDo(TSchemeShard* ss);
-};
-
-}
-}
+ TStack<TCdcStreamState> CdcStreams;
+
+ using TTableState = std::pair<TPathId, TTableInfo::TPtr>;
+ TStack<TTableState> Tables;
+
+ using TShardState = std::pair<TShardIdx, THolder<TShardInfo>>;
+ TStack<TShardState> Shards;
+
+ using TSubDomainState = std::pair<TPathId, TSubDomainInfo::TPtr>;
+ TStack<TSubDomainState> SubDomains;
+
+ using TTxState = std::pair<TOperationId, THolder<TTxState>>;
+ TStack<TTxState> TxStates;
+
+public:
+ ~TMemoryChanges() = default;
+
+ void GrabNewTxState(TSchemeShard* ss, const TOperationId& op);
+
+ void GrabNewPath(TSchemeShard* ss, const TPathId& pathId);
+ void GrabPath(TSchemeShard* ss, const TPathId& pathId);
+
+ void GrabNewTable(TSchemeShard* ss, const TPathId& pathId);
+ void GrabTable(TSchemeShard* ss, const TPathId& pathId);
+
+ void GrabNewShard(TSchemeShard* ss, const TShardIdx& shardId);
+ void GrabShard(TSchemeShard* ss, const TShardIdx& shardId);
+
+ void GrabDomain(TSchemeShard* ss, const TPathId& pathId);
+
+ void GrabNewIndex(TSchemeShard* ss, const TPathId& pathId);
+
+ void GrabNewCdcStream(TSchemeShard* ss, const TPathId& pathId);
+
+ void UnDo(TSchemeShard* ss);
+};
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_mkdir.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_mkdir.cpp
index 24b7194332a..a2afe4741af 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_mkdir.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_mkdir.cpp
@@ -1,272 +1,272 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
-
- TString DebugHint() const override {
- return TStringBuilder()
- << "MkDir::TPropose"
- << " operationId#" << OperationId;
- }
-
-public:
- TPropose(TOperationId id)
- : OperationId(id)
- {}
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- const TStepId step = TStepId(ev->Get()->StepId);
- const TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvPrivate::TEvOperationPlan"
- << ", step: " << step
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxMkDir);
-
- auto pathId = txState->TargetPathId;
- auto path = TPath::Init(pathId, context.SS);
-
- context.SS->TabletCounters->Simple()[COUNTER_DIR_COUNT].Add(1);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- path.Base()->DirAlterVersion += 1;
- context.SS->PersistPathDirAlterVersion(db, path.Base());
-
- path.Base()->StepCreated = step;
- context.SS->PersistCreateStep(db, pathId, step);
-
- IncParentDirAlterVersionWithRepublish(OperationId, path, context);
-
- context.SS->ChangeTxState(db, OperationId, TTxState::Done);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- auto ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxMkDir);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-class TMkDir: public TSubOperation {
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
+ TString DebugHint() const override {
+ return TStringBuilder()
+ << "MkDir::TPropose"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TPropose(TOperationId id)
+ : OperationId(id)
+ {}
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ const TStepId step = TStepId(ev->Get()->StepId);
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvPrivate::TEvOperationPlan"
+ << ", step: " << step
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxMkDir);
+
+ auto pathId = txState->TargetPathId;
+ auto path = TPath::Init(pathId, context.SS);
+
+ context.SS->TabletCounters->Simple()[COUNTER_DIR_COUNT].Add(1);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ path.Base()->DirAlterVersion += 1;
+ context.SS->PersistPathDirAlterVersion(db, path.Base());
+
+ path.Base()->StepCreated = step;
+ context.SS->PersistCreateStep(db, pathId, step);
+
+ IncParentDirAlterVersionWithRepublish(OperationId, path, context);
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::Done);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ auto ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxMkDir);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+class TMkDir: public TSubOperation {
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::Propose;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::Propose:
- return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::Propose:
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::Propose;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::Propose:
+ return TTxState::Done;
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::Propose:
return THolder(new TPropose(OperationId));
- case TTxState::Done:
+ case TTxState::Done:
return THolder(new TDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TMkDir(TOperationId id, const TTxTransaction& tx)
: OperationId(id)
, Transaction(tx)
{
}
- TMkDir(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
+ TMkDir(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
{
- SetState(SelectStateFunc(state));
+ SetState(SelectStateFunc(state));
}
-
- THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
- const auto ssId = context.SS->SelfTabletId();
-
- const auto acceptExisted = !Transaction.GetFailOnExist();
+
+ THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) override {
+ const auto ssId = context.SS->SelfTabletId();
+
+ const auto acceptExisted = !Transaction.GetFailOnExist();
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = Transaction.GetMkDir().GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TMkDir Propose"
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TMkDir Propose"
<< ", path: " << parentPathStr << "/" << name
- << ", operationId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
- {
- NSchemeShard::TPath::TChecker checks = parentPath.Check();
- checks
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsCommonSensePath()
- .IsLikeDirectory();
-
- if (!checks) {
- TString explain = TStringBuilder() << "parent path fail checks"
- << ", path: " << parentPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
-
- return result;
- }
- }
-
+ << ", operationId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ NSchemeShard::TPath parentPath = NSchemeShard::TPath::Resolve(parentPathStr, context.SS);
+ {
+ NSchemeShard::TPath::TChecker checks = parentPath.Check();
+ checks
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsCommonSensePath()
+ .IsLikeDirectory();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent path fail checks"
+ << ", path: " << parentPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+
+ return result;
+ }
+ }
+
const TString acl = Transaction.GetModifyACL().GetDiffACL();
- NSchemeShard::TPath dstPath = parentPath.Child(name);
- {
- NSchemeShard::TPath::TChecker checks = dstPath.Check();
- checks.IsAtLocalSchemeShard();
- if (dstPath.IsResolved()) {
+ NSchemeShard::TPath dstPath = parentPath.Child(name);
+ {
+ NSchemeShard::TPath::TChecker checks = dstPath.Check();
+ checks.IsAtLocalSchemeShard();
+ if (dstPath.IsResolved()) {
checks
.IsResolved()
- .NotUnderDeleting()
+ .NotUnderDeleting()
.FailOnExist({
TPathElement::EPathType::EPathTypeDir,
TPathElement::EPathType::EPathTypeSubDomain,
TPathElement::EPathType::EPathTypeExtSubDomain,
TPathElement::EPathType::EPathTypeColumnStore
}, acceptExisted);
- } else {
+ } else {
checks
.NotEmpty()
- .NotResolved();
- }
-
- if (checks) {
- checks
- .IsValidLeafName()
- .DepthLimit()
- .PathsLimit()
+ .NotResolved();
+ }
+
+ if (checks) {
+ checks
+ .IsValidLeafName()
+ .DepthLimit()
+ .PathsLimit()
.DirChildrenLimit()
.IsValidACL(acl);
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "dst path fail checks"
- << ", path: " << dstPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- if (dstPath.IsResolved()) {
- result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
- }
- return result;
- }
- }
-
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "dst path fail checks"
+ << ", path: " << dstPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ if (dstPath.IsResolved()) {
+ result->SetPathCreateTxId(ui64(dstPath.Base()->CreateTxId));
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+ }
+ return result;
+ }
+ }
+
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- TUserAttributes::TPtr userAttrs = new TUserAttributes(1);
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ TUserAttributes::TPtr userAttrs = new TUserAttributes(1);
const auto& userAttrsDetails = Transaction.GetAlterUserAttributes();
if (!userAttrs->ApplyPatch(EUserAttributesOp::MkDir, userAttrsDetails, errStr) ||
!userAttrs->CheckLimits(errStr))
{
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
-
- TPathId allocatedPathId = context.SS->AllocatePathId();
- context.MemChanges.GrabNewPath(context.SS, allocatedPathId);
- context.MemChanges.GrabPath(context.SS, parentPath.Base()->PathId);
- context.MemChanges.GrabNewTxState(context.SS, OperationId);
- context.MemChanges.GrabDomain(context.SS, parentPath.DomainId());
-
- context.DbChanges.PersistPath(allocatedPathId);
- context.DbChanges.PersistPath(parentPath.Base()->PathId);
- context.DbChanges.PersistApplyUserAttrs(allocatedPathId);
- context.DbChanges.PersistTxState(OperationId);
-
- dstPath.MaterializeLeaf(owner, allocatedPathId);
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
-
- TPathElement::TPtr newDir = dstPath.Base();
- newDir->CreateTxId = OperationId.GetTxId();
- newDir->PathState = TPathElement::EPathState::EPathStateCreate;
- newDir->PathType = TPathElement::EPathType::EPathTypeDir;
- newDir->UserAttrs->AlterData = userAttrs;
- newDir->DirAlterVersion = 1;
-
- if (!acl.empty()) {
- newDir->ApplyACL(acl);
- }
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxMkDir, newDir->PathId);
- txState.State = TTxState::Propose;
-
- if (parentPath.Base()->HasActiveChanges()) {
- auto parentTxId = parentPath.Base()->PlannedToCreate() ? parentPath.Base()->CreateTxId : parentPath.Base()->LastTxId;
- context.OnComplete.Dependence(parentTxId, OperationId.GetTxId());
- }
-
- IncParentDirAlterVersionWithRepublish(OperationId, dstPath, context);
-
- dstPath.DomainInfo()->IncPathsInside();
- parentPath.Base()->IncAliveChildren();
-
- context.OnComplete.ActivateTx(OperationId);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+
+ TPathId allocatedPathId = context.SS->AllocatePathId();
+ context.MemChanges.GrabNewPath(context.SS, allocatedPathId);
+ context.MemChanges.GrabPath(context.SS, parentPath.Base()->PathId);
+ context.MemChanges.GrabNewTxState(context.SS, OperationId);
+ context.MemChanges.GrabDomain(context.SS, parentPath.DomainId());
+
+ context.DbChanges.PersistPath(allocatedPathId);
+ context.DbChanges.PersistPath(parentPath.Base()->PathId);
+ context.DbChanges.PersistApplyUserAttrs(allocatedPathId);
+ context.DbChanges.PersistTxState(OperationId);
+
+ dstPath.MaterializeLeaf(owner, allocatedPathId);
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+
+ TPathElement::TPtr newDir = dstPath.Base();
+ newDir->CreateTxId = OperationId.GetTxId();
+ newDir->PathState = TPathElement::EPathState::EPathStateCreate;
+ newDir->PathType = TPathElement::EPathType::EPathTypeDir;
+ newDir->UserAttrs->AlterData = userAttrs;
+ newDir->DirAlterVersion = 1;
+
+ if (!acl.empty()) {
+ newDir->ApplyACL(acl);
+ }
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxMkDir, newDir->PathId);
+ txState.State = TTxState::Propose;
+
+ if (parentPath.Base()->HasActiveChanges()) {
+ auto parentTxId = parentPath.Base()->PlannedToCreate() ? parentPath.Base()->CreateTxId : parentPath.Base()->LastTxId;
+ context.OnComplete.Dependence(parentTxId, OperationId.GetTxId());
+ }
+
+ IncParentDirAlterVersionWithRepublish(OperationId, dstPath, context);
+
+ dstPath.DomainInfo()->IncPathsInside();
+ parentPath.Base()->IncAliveChildren();
+
+ context.OnComplete.ActivateTx(OperationId);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext& context) override {
LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"MkDir AbortPropose"
@@ -274,30 +274,30 @@ public:
<< ", at schemeshard: " << context.SS->TabletID());
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TMkDir AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TMkDir AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateMkDir(TOperationId id, const TTxTransaction& tx) {
return new TMkDir(id, tx);
}
-ISubOperationBase::TPtr CreateMkDir(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state != TTxState::Invalid);
- return new TMkDir(id, state);
-}
-
-}
-}
+ISubOperationBase::TPtr CreateMkDir(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state != TTxState::Invalid);
+ return new TMkDir(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_modify_acl.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_modify_acl.cpp
index 57dbe132518..fac70a77047 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_modify_acl.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_modify_acl.cpp
@@ -1,152 +1,152 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard_impl.h"
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TModifyACL: public ISubOperationBase {
-private:
+#include "schemeshard__operation_part.h"
+#include "schemeshard_impl.h"
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TModifyACL: public ISubOperationBase {
+private:
const TOperationId OperationId;
const TTxTransaction Transaction;
-
-public:
+
+public:
TModifyACL(TOperationId id, const TTxTransaction& tx)
: OperationId(id)
, Transaction(tx)
{
}
- TModifyACL(TOperationId id)
- : OperationId(id)
+ TModifyACL(TOperationId id)
+ : OperationId(id)
{
}
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const TString& parentPathStr = Transaction.GetWorkingDir();
const TString& name = Transaction.GetModifyACL().GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TModifyACL Propose"
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TModifyACL Propose"
<< ", path: " << parentPathStr << "/" << name
- << ", operationId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusSuccess, ui64(OperationId.GetTxId()), ui64(ssId));
-
+ << ", operationId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusSuccess, ui64(OperationId.GetTxId()), ui64(ssId));
+
const TString acl = Transaction.GetModifyACL().GetDiffACL();
- TPath path = TPath::Resolve(parentPathStr, context.SS).Dive(name);
- {
- TPath::TChecker checks = path.Check();
+ TPath path = TPath::Resolve(parentPathStr, context.SS).Dive(name);
+ {
+ TPath::TChecker checks = path.Check();
checks
.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
.IsCommonSensePath()
.IsValidACL(acl);
-
- if (!checks) {
- TString explain = TStringBuilder() << "path table fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path table fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
TString errStr;
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- const TString owner = Transaction.GetModifyACL().GetNewOwner();
-
- if (!acl.empty()) {
- ++path.Base()->ACLVersion;
- path.Base()->ApplyACL(acl);
- context.SS->PersistACL(db, path.Base());
-
- auto subtree = context.SS->ListSubThee(path.Base()->PathId, context.Ctx);
- for (const TPathId pathId : subtree) {
- if (context.SS->PathsById.at(pathId)->IsMigrated()) {
- continue;
- }
- context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
- }
-
- if (!path.Base()->IsPQGroup()) {
- // YDBOPS-1328
- // its better we do not republish parent but
- // it is possible when we do not show ALC for children
- TPath parent = path.Parent();
- ++parent.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parent.Base());
- context.SS->ClearDescribePathCaches(parent.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, parent.Base()->PathId);
- }
-
- context.OnComplete.UpdateTenants(std::move(subtree));
- }
-
- if (!owner.empty()) {
- path.Base()->Owner = owner;
- context.SS->PersistOwner(db, path.Base());
-
- ++path.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, path.Base());
-
- context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
-
- TPath parent = path.Parent(); // we show owner in children listing, so we have to update it
- ++parent.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parent.Base());
- context.SS->ClearDescribePathCaches(parent.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, parent.Base()->PathId);
-
- context.OnComplete.UpdateTenants({path.Base()->PathId});
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ const TString owner = Transaction.GetModifyACL().GetNewOwner();
+
+ if (!acl.empty()) {
+ ++path.Base()->ACLVersion;
+ path.Base()->ApplyACL(acl);
+ context.SS->PersistACL(db, path.Base());
+
+ auto subtree = context.SS->ListSubThee(path.Base()->PathId, context.Ctx);
+ for (const TPathId pathId : subtree) {
+ if (context.SS->PathsById.at(pathId)->IsMigrated()) {
+ continue;
+ }
+ context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
+ }
+
+ if (!path.Base()->IsPQGroup()) {
+ // YDBOPS-1328
+ // its better we do not republish parent but
+ // it is possible when we do not show ALC for children
+ TPath parent = path.Parent();
+ ++parent.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parent.Base());
+ context.SS->ClearDescribePathCaches(parent.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, parent.Base()->PathId);
+ }
+
+ context.OnComplete.UpdateTenants(std::move(subtree));
}
-
- context.OnComplete.DoneOperation(OperationId);
- return result;
- }
-
+
+ if (!owner.empty()) {
+ path.Base()->Owner = owner;
+ context.SS->PersistOwner(db, path.Base());
+
+ ++path.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, path.Base());
+
+ context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
+
+ TPath parent = path.Parent(); // we show owner in children listing, so we have to update it
+ ++parent.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parent.Base());
+ context.SS->ClearDescribePathCaches(parent.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, parent.Base()->PathId);
+
+ context.OnComplete.UpdateTenants({path.Base()->PathId});
+ }
+
+ context.OnComplete.DoneOperation(OperationId);
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TModifyACL");
}
- void ProgressState(TOperationContext&) override {
- Y_FAIL("no progress state for modify acl");
- }
-
- void AbortUnsafe(TTxId, TOperationContext&) override {
- Y_FAIL("no AbortUnsafe for modify acl");
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+ void ProgressState(TOperationContext&) override {
+ Y_FAIL("no progress state for modify acl");
+ }
+
+ void AbortUnsafe(TTxId, TOperationContext&) override {
+ Y_FAIL("no AbortUnsafe for modify acl");
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateModifyACL(TOperationId id, const TTxTransaction& tx) {
return new TModifyACL(id, tx);
}
-ISubOperationBase::TPtr CreateModifyACL(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state == TTxState::Invalid);
- return new TModifyACL(id);
-}
-
-}
-}
+ISubOperationBase::TPtr CreateModifyACL(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state == TTxState::Invalid);
+ return new TModifyACL(id);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_move_table.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_move_table.cpp
index 4c61c67fbc3..fc39ce04ba3 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_move_table.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_move_table.cpp
@@ -1,798 +1,798 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TConfigureParts: public TSubOperationState {
-private:
- TOperationId OperationId;
-
- TString DebugHint() const override {
- return TStringBuilder()
- << "TMoveTable TConfigureParts"
- << ", operationId: " << OperationId;
- }
-
-public:
- TConfigureParts(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool HandleReply(TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvProposeTransactionResult"
- << " at tabletId# " << ssId);
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvProposeTransactionResult"
- << " message# " << ev->Get()->Record.ShortDebugString());
-
- if (!NTableState::CollectProposeTransactionResults(OperationId, ev, context)) {
- return false;
- }
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxMoveTable);
- Y_VERIFY(txState->MinStep); // we have to have right minstep
-
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at tablet" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxMoveTable);
- Y_VERIFY(txState->SourcePathId);
-
- TPath dstPath = TPath::Init(txState->TargetPathId, context.SS);
- Y_VERIFY(dstPath.IsResolved());
- TPath srcPath = TPath::Init(txState->SourcePathId, context.SS);
- Y_VERIFY(srcPath.IsResolved());
- TTableInfo::TPtr srcTable = context.SS->Tables.at(srcPath->PathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- // txState catches table shards
- if (!txState->Shards) {
- txState->Shards.reserve(srcTable->GetPartitions().size());
- for (const auto& shard : srcTable->GetPartitions()) {
- auto shardIdx = shard.ShardIdx;
- TShardInfo& shardInfo = context.SS->ShardInfos[shardIdx];
-
- txState->Shards.emplace_back(shardIdx, ETabletType::DataShard, TTxState::ConfigureParts);
-
- shardInfo.CurrentTxId = OperationId.GetTxId();
- context.SS->PersistShardTx(db, shardIdx, OperationId.GetTxId());
- }
- context.SS->PersistTxState(db, OperationId);
- }
- Y_VERIFY(txState->Shards.size());
-
- TString txBody;
- {
- auto seqNo = context.SS->StartRound(*txState);
-
- NKikimrTxDataShard::TFlatSchemeTransaction tx;
- context.SS->FillSeqNo(tx, seqNo);
- auto move = tx.MutableMoveTable();
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TConfigureParts: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
+ TString DebugHint() const override {
+ return TStringBuilder()
+ << "TMoveTable TConfigureParts"
+ << ", operationId: " << OperationId;
+ }
+
+public:
+ TConfigureParts(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool HandleReply(TEvDataShard::TEvProposeTransactionResult::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvProposeTransactionResult"
+ << " at tabletId# " << ssId);
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvProposeTransactionResult"
+ << " message# " << ev->Get()->Record.ShortDebugString());
+
+ if (!NTableState::CollectProposeTransactionResults(OperationId, ev, context)) {
+ return false;
+ }
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxMoveTable);
+ Y_VERIFY(txState->MinStep); // we have to have right minstep
+
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at tablet" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxMoveTable);
+ Y_VERIFY(txState->SourcePathId);
+
+ TPath dstPath = TPath::Init(txState->TargetPathId, context.SS);
+ Y_VERIFY(dstPath.IsResolved());
+ TPath srcPath = TPath::Init(txState->SourcePathId, context.SS);
+ Y_VERIFY(srcPath.IsResolved());
+ TTableInfo::TPtr srcTable = context.SS->Tables.at(srcPath->PathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ // txState catches table shards
+ if (!txState->Shards) {
+ txState->Shards.reserve(srcTable->GetPartitions().size());
+ for (const auto& shard : srcTable->GetPartitions()) {
+ auto shardIdx = shard.ShardIdx;
+ TShardInfo& shardInfo = context.SS->ShardInfos[shardIdx];
+
+ txState->Shards.emplace_back(shardIdx, ETabletType::DataShard, TTxState::ConfigureParts);
+
+ shardInfo.CurrentTxId = OperationId.GetTxId();
+ context.SS->PersistShardTx(db, shardIdx, OperationId.GetTxId());
+ }
+ context.SS->PersistTxState(db, OperationId);
+ }
+ Y_VERIFY(txState->Shards.size());
+
+ TString txBody;
+ {
+ auto seqNo = context.SS->StartRound(*txState);
+
+ NKikimrTxDataShard::TFlatSchemeTransaction tx;
+ context.SS->FillSeqNo(tx, seqNo);
+ auto move = tx.MutableMoveTable();
PathIdFromPathId(srcPath->PathId, move->MutablePathId());
- move->SetTableSchemaVersion(srcTable->AlterVersion+1);
-
+ move->SetTableSchemaVersion(srcTable->AlterVersion+1);
+
PathIdFromPathId(dstPath->PathId, move->MutableDstPathId());
- move->SetDstPath(TPath::Init(dstPath->PathId, context.SS).PathString());
-
- for (const auto& child: srcPath->GetChildren()) {
- auto name = child.first;
-
- TPath srcIndexPath = srcPath.Child(name);
- Y_VERIFY(srcIndexPath.IsResolved());
-
- if (srcIndexPath.IsDeleted()) {
- continue;
- }
-
- TPath dstIndexPath = dstPath.Child(name);
- Y_VERIFY(dstIndexPath.IsResolved());
-
- auto remap = move->AddReMapIndexes();
+ move->SetDstPath(TPath::Init(dstPath->PathId, context.SS).PathString());
+
+ for (const auto& child: srcPath->GetChildren()) {
+ auto name = child.first;
+
+ TPath srcIndexPath = srcPath.Child(name);
+ Y_VERIFY(srcIndexPath.IsResolved());
+
+ if (srcIndexPath.IsDeleted()) {
+ continue;
+ }
+
+ TPath dstIndexPath = dstPath.Child(name);
+ Y_VERIFY(dstIndexPath.IsResolved());
+
+ auto remap = move->AddReMapIndexes();
PathIdFromPathId(srcIndexPath->PathId, remap->MutablePathId());
PathIdFromPathId(dstIndexPath->PathId, remap->MutableDstPathId());
- }
-
+ }
+
Y_PROTOBUF_SUPPRESS_NODISCARD tx.SerializeToString(&txBody);
- }
-
- // send messages
- txState->ClearShardsInProgress();
- for (ui32 i = 0; i < txState->Shards.size(); ++i) {
- auto idx = txState->Shards[i].Idx;
- auto datashardId = context.SS->ShardInfos[idx].TabletID;
-
- auto event = MakeHolder<TEvDataShard::TEvProposeTransaction>(NKikimrTxDataShard::TX_KIND_SCHEME,
- context.SS->TabletID(),
- context.Ctx.SelfID,
- ui64(OperationId.GetTxId()),
- txBody,
- context.SS->SelectProcessingPrarams(txState->TargetPathId));
-
- context.OnComplete.BindMsgToPipe(OperationId, datashardId, idx, event.Release());
- }
- txState->UpdateShardsInProgress(TTxState::ConfigureParts);
-
- return false;
- }
-};
-
-void MarkSrcDropped(NIceDb::TNiceDb& db,
- TOperationContext& context,
- TOperationId operationId,
- const TTxState& txState,
- TPath& srcPath)
-{
- srcPath->SetDropped(txState.PlanStep, operationId.GetTxId());
- context.SS->PersistDropStep(db, srcPath->PathId, txState.PlanStep, operationId);
- context.SS->Tables.at(srcPath->PathId)->DetachShardsStats();
- context.SS->PersistRemoveTable(db, srcPath->PathId, context.Ctx);
- context.SS->PersistUserAttributes(db, srcPath->PathId, srcPath->UserAttrs, nullptr);
-
- srcPath.Parent()->DecAliveChildren();
- srcPath.DomainInfo()->DecPathsInside();
-
- IncParentDirAlterVersionWithRepublish(operationId, srcPath, context);
-}
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
- TTxState::ETxState& NextState;
-
- TString DebugHint() const override {
- return TStringBuilder()
- << "TMoveTable TPropose"
- << ", operationId: " << OperationId;
- }
-public:
- TPropose(TOperationId id, TTxState::ETxState& nextState)
- : OperationId(id)
- , NextState(nextState)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- const auto& evRecord = ev->Get()->Record;
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvSchemaChanged"
- << " at tablet: " << ssId);
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvSchemaChanged"
- << " triggered early"
- << ", message: " << evRecord.ShortDebugString());
-
- NTableState::CollectSchemaChanged(OperationId, ev, context);
- return false;
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", step: " << step
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxMoveTable);
-
- auto srcPath = TPath::Init(txState->SourcePathId, context.SS);
- auto dstPath = TPath::Init(txState->TargetPathId, context.SS);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- txState->PlanStep = step;
- context.SS->PersistTxPlanStep(db, OperationId, step);
-
- // move shards
- for (const auto& shard : txState->Shards) {
- auto shardIdx = shard.Idx;
- TShardInfo& shardInfo = context.SS->ShardInfos[shardIdx];
-
- shardInfo.PathId = dstPath->PathId;
- context.SS->DecrementPathDbRefCount(srcPath.Base()->PathId, "move shard");
- context.SS->IncrementPathDbRefCount(dstPath.Base()->PathId, "move shard");
- context.SS->PersistShardPathId(db, shardIdx, dstPath.Base()->PathId);
-
- srcPath.Base()->DecShardsInside();
- dstPath.Base()->IncShardsInside();
- }
-
- Y_VERIFY(!context.SS->Tables.contains(dstPath.Base()->PathId));
- Y_VERIFY(context.SS->Tables.contains(srcPath.Base()->PathId));
-
- TTableInfo::TPtr tableInfo = new TTableInfo(*context.SS->Tables.at(srcPath.Base()->PathId));
- tableInfo->AlterVersion += 1;
-
- // copy table info
- context.SS->Tables[dstPath.Base()->PathId] = tableInfo;
- context.SS->PersistTable(db, dstPath.Base()->PathId);
- context.SS->PersistTablePartitioning(db, dstPath.Base()->PathId, tableInfo);
- context.SS->PersistTablePartitionStats(db, dstPath.Base()->PathId, tableInfo);
- context.SS->IncrementPathDbRefCount(dstPath.Base()->PathId, "move table info");
-
- dstPath->StepCreated = step;
- context.SS->PersistCreateStep(db, dstPath.Base()->PathId, step);
- dstPath.DomainInfo()->IncPathsInside();
-
- dstPath.Activate();
- IncParentDirAlterVersionWithRepublish(OperationId, dstPath, context);
-
- if (context.SS->EnableSchemeTransactionsAtSchemeShard) {
- // only persist step, but do not set drop step for the src path, wait for replacement publication first
- NextState = TTxState::WaitShadowPathPublication;
- context.SS->ChangeTxState(db, OperationId, TTxState::WaitShadowPathPublication);
- return true;
- }
-
- MarkSrcDropped(db, context, OperationId, *txState, srcPath);
-
- Y_VERIFY(!context.SS->TablesWithSnaphots.contains(srcPath.Base()->PathId));
-
- NextState = TTxState::ProposedWaitParts;
- context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxMoveTable);
- Y_VERIFY(txState->SourcePathId);
- Y_VERIFY(txState->MinStep);
-
- TSet<TTabletId> shardSet;
- for (const auto& shard : txState->Shards) {
- TShardIdx idx = shard.Idx;
- TTabletId tablet = context.SS->ShardInfos.at(idx).TabletID;
- shardSet.insert(tablet);
- }
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, txState->MinStep, std::move(shardSet));
- return false;
- }
-};
-
-class TWaitRenamedPathPublication: public TSubOperationState {
-private:
- TOperationId OperationId;
-
- TPathId ActivePathId;
-
- TString DebugHint() const override {
- return TStringBuilder()
- << "TMoveTable TWaitRenamedPathPublication"
- << " operationId: " << OperationId;
- }
-
-public:
- TWaitRenamedPathPublication(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType, TEvPrivate::TEvOperationPlan::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvDataShard::TEvSchemaChanged"
- << ", save it"
- << ", at schemeshard: " << ssId);
-
- NTableState::CollectSchemaChanged(OperationId, ev, context);
- return false;
- }
-
- bool HandleReply(TEvPrivate::TEvCompletePublication::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvPrivate::TEvCompletePublication"
- << ", msg: " << ev->Get()->ToString()
- << ", at tablet" << ssId);
-
- Y_VERIFY(ActivePathId == ev->Get()->PathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::DeletePathBarrier);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- context.OnComplete.RouteByTabletsFromOperation(OperationId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", operation type: " << TTxState::TypeName(txState->TxType)
- << ", at tablet" << ssId);
-
- TPath srcPath = TPath::Init(txState->SourcePathId, context.SS);
-
- if (srcPath.IsActive()) {
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", no renaming has been detected for this operation");
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::DeletePathBarrier);
- return true;
- }
-
- auto activePath = TPath::Resolve(srcPath.PathString(), context.SS);
- Y_VERIFY(activePath.IsResolved());
-
- Y_VERIFY(activePath != srcPath);
-
- ActivePathId = activePath->PathId;
- context.OnComplete.PublishAndWaitPublication(OperationId, activePath->PathId);
-
- return false;
- }
-};
-
-
-class TDeleteTableBarrier: public TSubOperationState {
-private:
- TOperationId OperationId;
-
- TString DebugHint() const override {
- return TStringBuilder()
- << "TMoveTable TDeleteTableBarrier"
- << " operationId: " << OperationId;
- }
-
-public:
- TDeleteTableBarrier(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType, TEvPrivate::TEvOperationPlan::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvDataShard::TEvSchemaChanged"
- << ", save it"
- << ", at schemeshard: " << ssId);
-
- NTableState::CollectSchemaChanged(OperationId, ev, context);
- return false;
- }
-
- bool HandleReply(TEvPrivate::TEvCompleteBarrier::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvPrivate:TEvCompleteBarrier"
- << ", msg: " << ev->Get()->ToString()
- << ", at tablet" << ssId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- TPath srcPath = TPath::Init(txState->SourcePathId, context.SS);
-
- Y_VERIFY(txState->PlanStep);
-
- MarkSrcDropped(db, context, OperationId, *txState, srcPath);
-
- context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
- return true;
- }
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- context.OnComplete.RouteByTabletsFromOperation(OperationId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", operation type: " << TTxState::TypeName(txState->TxType)
- << ", at tablet" << ssId);
-
- context.OnComplete.Barrier(OperationId, "RenamePathBarrier");
- return false;
- }
-};
-
-
-class TDone: public TSubOperationState {
-private:
- TOperationId OperationId;
-
- TString DebugHint() const override {
- return TStringBuilder()
- << "TMoveTable TDone"
- << ", operationId: " << OperationId;
- }
-public:
- TDone(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), AllIncomingEvents());
- }
-
- bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- const TActorId& ackTo = ev->Sender;
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TProposedDeletePart"
- << " repeated message, ack it anyway"
- << " at tablet: " << ssId);
-
- THolder<TEvDataShard::TEvSchemaChangedResult> event = MakeHolder<TEvDataShard::TEvSchemaChangedResult>();
- event->Record.SetTxId(ui64(OperationId.GetTxId()));
-
- context.OnComplete.Send(ackTo, std::move(event));
- return false;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxMoveTable);
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", SourcePathId: " << txState->SourcePathId
- << ", TargetPathId: " << txState->TargetPathId
- << ", at schemeshard: " << ssId);
-
- // clear resources on src
- NIceDb::TNiceDb db(context.Txc.DB);
- TPathElement::TPtr srcPath = context.SS->PathsById.at(txState->SourcePathId);
- context.OnComplete.ReleasePathState(OperationId, srcPath->PathId, TPathElement::EPathState::EPathStateNotExist);
-
- TPathElement::TPtr dstPath = context.SS->PathsById.at(txState->TargetPathId);
- context.OnComplete.ReleasePathState(OperationId, dstPath->PathId, TPathElement::EPathState::EPathStateNoChanges);
-
- context.OnComplete.DoneOperation(OperationId);
- return true;
- }
-};
-
-
-class TMoveTable: public TSubOperation {
- const TOperationId OperationId;
- const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
- TTxState::ETxState AfterPropose = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::ConfigureParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::ConfigureParts:
- return TTxState::Propose;
- case TTxState::Propose:
- return AfterPropose;
-
- case TTxState::WaitShadowPathPublication:
- return TTxState::DeletePathBarrier;
- case TTxState::DeletePathBarrier:
- return TTxState::ProposedWaitParts;
-
- case TTxState::ProposedWaitParts:
- return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::ConfigureParts:
- return MakeHolder<TConfigureParts>(OperationId);
- case TTxState::Propose:
- return MakeHolder<TPropose>(OperationId, AfterPropose);
- case TTxState::WaitShadowPathPublication:
- return MakeHolder<TWaitRenamedPathPublication>(OperationId);
- case TTxState::DeletePathBarrier:
- return MakeHolder<TDeleteTableBarrier>(OperationId);
- case TTxState::ProposedWaitParts:
- return MakeHolder<NTableState::TProposedWaitParts>(OperationId);
- case TTxState::Done:
- return MakeHolder<TDone>(OperationId);
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
- TMoveTable(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
- , Transaction(tx)
- {
- }
-
- TMoveTable(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
- const auto acceptExisted = !Transaction.GetFailOnExist();
- const auto& opDescr = Transaction.GetMoveTable();
-
- const TString& srcPathStr = opDescr.GetSrcPath();
- const TString& dstPathStr = opDescr.GetDstPath();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TMoveTable Propose"
- << ", from: "<< srcPathStr
- << ", to: " << dstPathStr
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- THolder<TProposeResponse> result;
- result.Reset(new TEvSchemeShard::TEvModifySchemeTransactionResult(
- NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId)));
-
- TString errStr;
-
- TPath srcPath = TPath::Resolve(srcPathStr, context.SS);
- {
- TPath::TChecker checks = srcPath.Check();
- checks
- .NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .IsTable()
- .NotBackupTable()
- .NotUnderTheSameOperation(OperationId.GetTxId())
- .NotUnderOperation();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << srcPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- TPath dstPath = TPath::Resolve(dstPathStr, context.SS);
- TPath dstParent = dstPath.Parent();
-
- {
- TPath::TChecker checks = dstParent.Check();
- checks
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved();
-
- if (dstParent.IsUnderDeleting()) {
- checks
- .IsUnderDeleting()
- .IsUnderTheSameOperation(OperationId.GetTxId());
- } else if (dstParent.IsUnderMoving()) {
- // it means that dstPath is free enough to be the move destination
- checks
- .IsUnderMoving()
- .IsUnderTheSameOperation(OperationId.GetTxId());
- } else if (dstParent.IsUnderCreating()) {
- checks
- .IsUnderCreating()
- .IsUnderTheSameOperation(OperationId.GetTxId());
- } else {
- checks
- .NotUnderOperation();
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "parent dst path fail checks"
- << ", path: " << dstParent.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- if (dstParent.IsUnderOperation()) {
- dstPath = TPath::ResolveWithInactive(OperationId, dstPathStr, context.SS);
- }
-
- {
- TPath::TChecker checks = dstPath.Check();
- checks.IsAtLocalSchemeShard();
- if (dstPath.IsResolved()) {
- checks
- .IsResolved();
-
- if (dstPath.IsUnderDeleting()) {
- checks
- .IsUnderDeleting()
- .IsUnderTheSameOperation(OperationId.GetTxId());
- } else if (dstPath.IsUnderMoving()) {
- // it means that dstPath is free enough to be the move destination
- checks
- .IsUnderMoving()
- .IsUnderTheSameOperation(OperationId.GetTxId());
- } else {
- checks
- .NotUnderTheSameOperation(OperationId.GetTxId())
- .FailOnExist(TPathElement::EPathType::EPathTypeTable, acceptExisted);
- }
- } else {
- checks
- .NotEmpty()
- .NotResolved();
- }
-
- if (checks) {
- checks
- .DepthLimit()
- .IsValidLeafName();
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "dst path fail checks"
- << ", path: " << dstPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- if (!context.SS->CheckLocks(srcPath.Base()->PathId, Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
- return result;
- }
-
- TPathId allocatedPathId = context.SS->AllocatePathId();
- context.MemChanges.GrabNewPath(context.SS, allocatedPathId);
- context.MemChanges.GrabPath(context.SS, dstParent.Base()->PathId);
- context.MemChanges.GrabPath(context.SS, srcPath.Base()->PathId);
- context.MemChanges.GrabPath(context.SS, srcPath.Base()->ParentPathId);
- context.MemChanges.GrabNewTxState(context.SS, OperationId);
- context.MemChanges.GrabNewIndex(context.SS, allocatedPathId);
-
- context.DbChanges.PersistPath(allocatedPathId);
- context.DbChanges.PersistPath(dstParent.Base()->PathId);
- context.DbChanges.PersistPath(srcPath.Base()->PathId);
- context.DbChanges.PersistPath(srcPath.Base()->ParentPathId);
- context.DbChanges.PersistApplyUserAttrs(allocatedPathId);
- context.DbChanges.PersistTxState(OperationId);
-
- // create new path and inherit properties from src
- dstPath.MaterializeLeaf(srcPath.Base()->Owner, allocatedPathId, /*allowInactivePath*/ true);
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
- dstPath.Base()->CreateTxId = OperationId.GetTxId();
- dstPath.Base()->LastTxId = OperationId.GetTxId();
- dstPath.Base()->PathState = TPathElement::EPathState::EPathStateCreate;
- dstPath.Base()->PathType = TPathElement::EPathType::EPathTypeTable;
- dstPath.Base()->UserAttrs->AlterData = srcPath.Base()->UserAttrs;
- dstPath.Base()->ACL = srcPath.Base()->ACL;
-
- dstParent.Base()->IncAliveChildren();
-
- // create tx state, do not catch shards right now
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxMoveTable, dstPath.Base()->PathId, srcPath.Base()->PathId);
- txState.State = TTxState::ConfigureParts;
-
- srcPath->PathState = TPathElement::EPathState::EPathStateMoving;
- srcPath->LastTxId = OperationId.GetTxId();
-
- IncParentDirAlterVersionWithRepublish(OperationId, dstPath, context);
- IncParentDirAlterVersionWithRepublish(OperationId, srcPath, context);
-
- // wait splits
- TTableInfo::TPtr tableSrc = context.SS->Tables.at(srcPath.Base()->PathId);
- for (auto splitTx: tableSrc->GetSplitOpsInFlight()) {
- context.OnComplete.Dependence(splitTx.GetTxId(), OperationId.GetTxId());
- }
-
- context.OnComplete.ActivateTx(OperationId);
- State = NextState();
- SetState(SelectStateFunc(State));
-
- return result;
- }
-
- void AbortPropose(TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TMoveTable AbortPropose"
- << ", opId: " << OperationId
- << ", at schemeshard: " << context.SS->TabletID());
- }
-
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TMoveTable AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
- << ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-ISubOperationBase::TPtr CreateMoveTable(TOperationId id, const TTxTransaction& tx) {
- return new TMoveTable(id, tx);
-}
-
-ISubOperationBase::TPtr CreateMoveTable(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state != TTxState::Invalid);
- return new TMoveTable(id, state);
-}
-
-}
-}
+ }
+
+ // send messages
+ txState->ClearShardsInProgress();
+ for (ui32 i = 0; i < txState->Shards.size(); ++i) {
+ auto idx = txState->Shards[i].Idx;
+ auto datashardId = context.SS->ShardInfos[idx].TabletID;
+
+ auto event = MakeHolder<TEvDataShard::TEvProposeTransaction>(NKikimrTxDataShard::TX_KIND_SCHEME,
+ context.SS->TabletID(),
+ context.Ctx.SelfID,
+ ui64(OperationId.GetTxId()),
+ txBody,
+ context.SS->SelectProcessingPrarams(txState->TargetPathId));
+
+ context.OnComplete.BindMsgToPipe(OperationId, datashardId, idx, event.Release());
+ }
+ txState->UpdateShardsInProgress(TTxState::ConfigureParts);
+
+ return false;
+ }
+};
+
+void MarkSrcDropped(NIceDb::TNiceDb& db,
+ TOperationContext& context,
+ TOperationId operationId,
+ const TTxState& txState,
+ TPath& srcPath)
+{
+ srcPath->SetDropped(txState.PlanStep, operationId.GetTxId());
+ context.SS->PersistDropStep(db, srcPath->PathId, txState.PlanStep, operationId);
+ context.SS->Tables.at(srcPath->PathId)->DetachShardsStats();
+ context.SS->PersistRemoveTable(db, srcPath->PathId, context.Ctx);
+ context.SS->PersistUserAttributes(db, srcPath->PathId, srcPath->UserAttrs, nullptr);
+
+ srcPath.Parent()->DecAliveChildren();
+ srcPath.DomainInfo()->DecPathsInside();
+
+ IncParentDirAlterVersionWithRepublish(operationId, srcPath, context);
+}
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+ TTxState::ETxState& NextState;
+
+ TString DebugHint() const override {
+ return TStringBuilder()
+ << "TMoveTable TPropose"
+ << ", operationId: " << OperationId;
+ }
+public:
+ TPropose(TOperationId id, TTxState::ETxState& nextState)
+ : OperationId(id)
+ , NextState(nextState)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ const auto& evRecord = ev->Get()->Record;
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvSchemaChanged"
+ << " at tablet: " << ssId);
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvSchemaChanged"
+ << " triggered early"
+ << ", message: " << evRecord.ShortDebugString());
+
+ NTableState::CollectSchemaChanged(OperationId, ev, context);
+ return false;
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", step: " << step
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxMoveTable);
+
+ auto srcPath = TPath::Init(txState->SourcePathId, context.SS);
+ auto dstPath = TPath::Init(txState->TargetPathId, context.SS);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ txState->PlanStep = step;
+ context.SS->PersistTxPlanStep(db, OperationId, step);
+
+ // move shards
+ for (const auto& shard : txState->Shards) {
+ auto shardIdx = shard.Idx;
+ TShardInfo& shardInfo = context.SS->ShardInfos[shardIdx];
+
+ shardInfo.PathId = dstPath->PathId;
+ context.SS->DecrementPathDbRefCount(srcPath.Base()->PathId, "move shard");
+ context.SS->IncrementPathDbRefCount(dstPath.Base()->PathId, "move shard");
+ context.SS->PersistShardPathId(db, shardIdx, dstPath.Base()->PathId);
+
+ srcPath.Base()->DecShardsInside();
+ dstPath.Base()->IncShardsInside();
+ }
+
+ Y_VERIFY(!context.SS->Tables.contains(dstPath.Base()->PathId));
+ Y_VERIFY(context.SS->Tables.contains(srcPath.Base()->PathId));
+
+ TTableInfo::TPtr tableInfo = new TTableInfo(*context.SS->Tables.at(srcPath.Base()->PathId));
+ tableInfo->AlterVersion += 1;
+
+ // copy table info
+ context.SS->Tables[dstPath.Base()->PathId] = tableInfo;
+ context.SS->PersistTable(db, dstPath.Base()->PathId);
+ context.SS->PersistTablePartitioning(db, dstPath.Base()->PathId, tableInfo);
+ context.SS->PersistTablePartitionStats(db, dstPath.Base()->PathId, tableInfo);
+ context.SS->IncrementPathDbRefCount(dstPath.Base()->PathId, "move table info");
+
+ dstPath->StepCreated = step;
+ context.SS->PersistCreateStep(db, dstPath.Base()->PathId, step);
+ dstPath.DomainInfo()->IncPathsInside();
+
+ dstPath.Activate();
+ IncParentDirAlterVersionWithRepublish(OperationId, dstPath, context);
+
+ if (context.SS->EnableSchemeTransactionsAtSchemeShard) {
+ // only persist step, but do not set drop step for the src path, wait for replacement publication first
+ NextState = TTxState::WaitShadowPathPublication;
+ context.SS->ChangeTxState(db, OperationId, TTxState::WaitShadowPathPublication);
+ return true;
+ }
+
+ MarkSrcDropped(db, context, OperationId, *txState, srcPath);
+
+ Y_VERIFY(!context.SS->TablesWithSnaphots.contains(srcPath.Base()->PathId));
+
+ NextState = TTxState::ProposedWaitParts;
+ context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxMoveTable);
+ Y_VERIFY(txState->SourcePathId);
+ Y_VERIFY(txState->MinStep);
+
+ TSet<TTabletId> shardSet;
+ for (const auto& shard : txState->Shards) {
+ TShardIdx idx = shard.Idx;
+ TTabletId tablet = context.SS->ShardInfos.at(idx).TabletID;
+ shardSet.insert(tablet);
+ }
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, txState->MinStep, std::move(shardSet));
+ return false;
+ }
+};
+
+class TWaitRenamedPathPublication: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
+ TPathId ActivePathId;
+
+ TString DebugHint() const override {
+ return TStringBuilder()
+ << "TMoveTable TWaitRenamedPathPublication"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TWaitRenamedPathPublication(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType, TEvPrivate::TEvOperationPlan::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvDataShard::TEvSchemaChanged"
+ << ", save it"
+ << ", at schemeshard: " << ssId);
+
+ NTableState::CollectSchemaChanged(OperationId, ev, context);
+ return false;
+ }
+
+ bool HandleReply(TEvPrivate::TEvCompletePublication::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvPrivate::TEvCompletePublication"
+ << ", msg: " << ev->Get()->ToString()
+ << ", at tablet" << ssId);
+
+ Y_VERIFY(ActivePathId == ev->Get()->PathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::DeletePathBarrier);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ context.OnComplete.RouteByTabletsFromOperation(OperationId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", operation type: " << TTxState::TypeName(txState->TxType)
+ << ", at tablet" << ssId);
+
+ TPath srcPath = TPath::Init(txState->SourcePathId, context.SS);
+
+ if (srcPath.IsActive()) {
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", no renaming has been detected for this operation");
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::DeletePathBarrier);
+ return true;
+ }
+
+ auto activePath = TPath::Resolve(srcPath.PathString(), context.SS);
+ Y_VERIFY(activePath.IsResolved());
+
+ Y_VERIFY(activePath != srcPath);
+
+ ActivePathId = activePath->PathId;
+ context.OnComplete.PublishAndWaitPublication(OperationId, activePath->PathId);
+
+ return false;
+ }
+};
+
+
+class TDeleteTableBarrier: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
+ TString DebugHint() const override {
+ return TStringBuilder()
+ << "TMoveTable TDeleteTableBarrier"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TDeleteTableBarrier(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType, TEvPrivate::TEvOperationPlan::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvDataShard::TEvSchemaChanged"
+ << ", save it"
+ << ", at schemeshard: " << ssId);
+
+ NTableState::CollectSchemaChanged(OperationId, ev, context);
+ return false;
+ }
+
+ bool HandleReply(TEvPrivate::TEvCompleteBarrier::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvPrivate:TEvCompleteBarrier"
+ << ", msg: " << ev->Get()->ToString()
+ << ", at tablet" << ssId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ TPath srcPath = TPath::Init(txState->SourcePathId, context.SS);
+
+ Y_VERIFY(txState->PlanStep);
+
+ MarkSrcDropped(db, context, OperationId, *txState, srcPath);
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::ProposedWaitParts);
+ return true;
+ }
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ context.OnComplete.RouteByTabletsFromOperation(OperationId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", operation type: " << TTxState::TypeName(txState->TxType)
+ << ", at tablet" << ssId);
+
+ context.OnComplete.Barrier(OperationId, "RenamePathBarrier");
+ return false;
+ }
+};
+
+
+class TDone: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
+ TString DebugHint() const override {
+ return TStringBuilder()
+ << "TMoveTable TDone"
+ << ", operationId: " << OperationId;
+ }
+public:
+ TDone(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), AllIncomingEvents());
+ }
+
+ bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ const TActorId& ackTo = ev->Sender;
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TProposedDeletePart"
+ << " repeated message, ack it anyway"
+ << " at tablet: " << ssId);
+
+ THolder<TEvDataShard::TEvSchemaChangedResult> event = MakeHolder<TEvDataShard::TEvSchemaChangedResult>();
+ event->Record.SetTxId(ui64(OperationId.GetTxId()));
+
+ context.OnComplete.Send(ackTo, std::move(event));
+ return false;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxMoveTable);
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", SourcePathId: " << txState->SourcePathId
+ << ", TargetPathId: " << txState->TargetPathId
+ << ", at schemeshard: " << ssId);
+
+ // clear resources on src
+ NIceDb::TNiceDb db(context.Txc.DB);
+ TPathElement::TPtr srcPath = context.SS->PathsById.at(txState->SourcePathId);
+ context.OnComplete.ReleasePathState(OperationId, srcPath->PathId, TPathElement::EPathState::EPathStateNotExist);
+
+ TPathElement::TPtr dstPath = context.SS->PathsById.at(txState->TargetPathId);
+ context.OnComplete.ReleasePathState(OperationId, dstPath->PathId, TPathElement::EPathState::EPathStateNoChanges);
+
+ context.OnComplete.DoneOperation(OperationId);
+ return true;
+ }
+};
+
+
+class TMoveTable: public TSubOperation {
+ const TOperationId OperationId;
+ const TTxTransaction Transaction;
+ TTxState::ETxState State = TTxState::Invalid;
+ TTxState::ETxState AfterPropose = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::ConfigureParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::ConfigureParts:
+ return TTxState::Propose;
+ case TTxState::Propose:
+ return AfterPropose;
+
+ case TTxState::WaitShadowPathPublication:
+ return TTxState::DeletePathBarrier;
+ case TTxState::DeletePathBarrier:
+ return TTxState::ProposedWaitParts;
+
+ case TTxState::ProposedWaitParts:
+ return TTxState::Done;
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::ConfigureParts:
+ return MakeHolder<TConfigureParts>(OperationId);
+ case TTxState::Propose:
+ return MakeHolder<TPropose>(OperationId, AfterPropose);
+ case TTxState::WaitShadowPathPublication:
+ return MakeHolder<TWaitRenamedPathPublication>(OperationId);
+ case TTxState::DeletePathBarrier:
+ return MakeHolder<TDeleteTableBarrier>(OperationId);
+ case TTxState::ProposedWaitParts:
+ return MakeHolder<NTableState::TProposedWaitParts>(OperationId);
+ case TTxState::Done:
+ return MakeHolder<TDone>(OperationId);
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
+ TMoveTable(TOperationId id, const TTxTransaction& tx)
+ : OperationId(id)
+ , Transaction(tx)
+ {
+ }
+
+ TMoveTable(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ const auto acceptExisted = !Transaction.GetFailOnExist();
+ const auto& opDescr = Transaction.GetMoveTable();
+
+ const TString& srcPathStr = opDescr.GetSrcPath();
+ const TString& dstPathStr = opDescr.GetDstPath();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TMoveTable Propose"
+ << ", from: "<< srcPathStr
+ << ", to: " << dstPathStr
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ THolder<TProposeResponse> result;
+ result.Reset(new TEvSchemeShard::TEvModifySchemeTransactionResult(
+ NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId)));
+
+ TString errStr;
+
+ TPath srcPath = TPath::Resolve(srcPathStr, context.SS);
+ {
+ TPath::TChecker checks = srcPath.Check();
+ checks
+ .NotEmpty()
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .IsTable()
+ .NotBackupTable()
+ .NotUnderTheSameOperation(OperationId.GetTxId())
+ .NotUnderOperation();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << srcPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ TPath dstPath = TPath::Resolve(dstPathStr, context.SS);
+ TPath dstParent = dstPath.Parent();
+
+ {
+ TPath::TChecker checks = dstParent.Check();
+ checks
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved();
+
+ if (dstParent.IsUnderDeleting()) {
+ checks
+ .IsUnderDeleting()
+ .IsUnderTheSameOperation(OperationId.GetTxId());
+ } else if (dstParent.IsUnderMoving()) {
+ // it means that dstPath is free enough to be the move destination
+ checks
+ .IsUnderMoving()
+ .IsUnderTheSameOperation(OperationId.GetTxId());
+ } else if (dstParent.IsUnderCreating()) {
+ checks
+ .IsUnderCreating()
+ .IsUnderTheSameOperation(OperationId.GetTxId());
+ } else {
+ checks
+ .NotUnderOperation();
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent dst path fail checks"
+ << ", path: " << dstParent.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ if (dstParent.IsUnderOperation()) {
+ dstPath = TPath::ResolveWithInactive(OperationId, dstPathStr, context.SS);
+ }
+
+ {
+ TPath::TChecker checks = dstPath.Check();
+ checks.IsAtLocalSchemeShard();
+ if (dstPath.IsResolved()) {
+ checks
+ .IsResolved();
+
+ if (dstPath.IsUnderDeleting()) {
+ checks
+ .IsUnderDeleting()
+ .IsUnderTheSameOperation(OperationId.GetTxId());
+ } else if (dstPath.IsUnderMoving()) {
+ // it means that dstPath is free enough to be the move destination
+ checks
+ .IsUnderMoving()
+ .IsUnderTheSameOperation(OperationId.GetTxId());
+ } else {
+ checks
+ .NotUnderTheSameOperation(OperationId.GetTxId())
+ .FailOnExist(TPathElement::EPathType::EPathTypeTable, acceptExisted);
+ }
+ } else {
+ checks
+ .NotEmpty()
+ .NotResolved();
+ }
+
+ if (checks) {
+ checks
+ .DepthLimit()
+ .IsValidLeafName();
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "dst path fail checks"
+ << ", path: " << dstPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ if (!context.SS->CheckApplyIf(Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ if (!context.SS->CheckLocks(srcPath.Base()->PathId, Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
+ return result;
+ }
+
+ TPathId allocatedPathId = context.SS->AllocatePathId();
+ context.MemChanges.GrabNewPath(context.SS, allocatedPathId);
+ context.MemChanges.GrabPath(context.SS, dstParent.Base()->PathId);
+ context.MemChanges.GrabPath(context.SS, srcPath.Base()->PathId);
+ context.MemChanges.GrabPath(context.SS, srcPath.Base()->ParentPathId);
+ context.MemChanges.GrabNewTxState(context.SS, OperationId);
+ context.MemChanges.GrabNewIndex(context.SS, allocatedPathId);
+
+ context.DbChanges.PersistPath(allocatedPathId);
+ context.DbChanges.PersistPath(dstParent.Base()->PathId);
+ context.DbChanges.PersistPath(srcPath.Base()->PathId);
+ context.DbChanges.PersistPath(srcPath.Base()->ParentPathId);
+ context.DbChanges.PersistApplyUserAttrs(allocatedPathId);
+ context.DbChanges.PersistTxState(OperationId);
+
+ // create new path and inherit properties from src
+ dstPath.MaterializeLeaf(srcPath.Base()->Owner, allocatedPathId, /*allowInactivePath*/ true);
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+ dstPath.Base()->CreateTxId = OperationId.GetTxId();
+ dstPath.Base()->LastTxId = OperationId.GetTxId();
+ dstPath.Base()->PathState = TPathElement::EPathState::EPathStateCreate;
+ dstPath.Base()->PathType = TPathElement::EPathType::EPathTypeTable;
+ dstPath.Base()->UserAttrs->AlterData = srcPath.Base()->UserAttrs;
+ dstPath.Base()->ACL = srcPath.Base()->ACL;
+
+ dstParent.Base()->IncAliveChildren();
+
+ // create tx state, do not catch shards right now
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxMoveTable, dstPath.Base()->PathId, srcPath.Base()->PathId);
+ txState.State = TTxState::ConfigureParts;
+
+ srcPath->PathState = TPathElement::EPathState::EPathStateMoving;
+ srcPath->LastTxId = OperationId.GetTxId();
+
+ IncParentDirAlterVersionWithRepublish(OperationId, dstPath, context);
+ IncParentDirAlterVersionWithRepublish(OperationId, srcPath, context);
+
+ // wait splits
+ TTableInfo::TPtr tableSrc = context.SS->Tables.at(srcPath.Base()->PathId);
+ for (auto splitTx: tableSrc->GetSplitOpsInFlight()) {
+ context.OnComplete.Dependence(splitTx.GetTxId(), OperationId.GetTxId());
+ }
+
+ context.OnComplete.ActivateTx(OperationId);
+ State = NextState();
+ SetState(SelectStateFunc(State));
+
+ return result;
+ }
+
+ void AbortPropose(TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TMoveTable AbortPropose"
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << context.SS->TabletID());
+ }
+
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TMoveTable AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+ISubOperationBase::TPtr CreateMoveTable(TOperationId id, const TTxTransaction& tx) {
+ return new TMoveTable(id, tx);
+}
+
+ISubOperationBase::TPtr CreateMoveTable(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state != TTxState::Invalid);
+ return new TMoveTable(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_move_table_index.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_move_table_index.cpp
index 6d7c0e7bef7..9d03d70c7c5 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_move_table_index.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_move_table_index.cpp
@@ -1,623 +1,623 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-void MarkSrcDropped(NIceDb::TNiceDb& db,
- TOperationContext& context,
- TOperationId operationId,
- const TTxState& txState,
- TPath& srcPath)
-{
- Y_VERIFY(txState.PlanStep);
- srcPath->SetDropped(txState.PlanStep, operationId.GetTxId());
- context.SS->PersistDropStep(db, srcPath->PathId, txState.PlanStep, operationId);
- context.SS->PersistRemoveTable(db, srcPath->PathId, context.Ctx);
- context.SS->PersistUserAttributes(db, srcPath->PathId, srcPath->UserAttrs, nullptr);
-
- srcPath.Parent()->DecAliveChildren();
- srcPath.DomainInfo()->DecPathsInside();
-
- IncParentDirAlterVersionWithRepublish(operationId, srcPath, context);
-}
-
-class TPropose: public TSubOperationState {
-private:
- TOperationId OperationId;
- TTxState::ETxState& NextState;
-
- TString DebugHint() const override {
- return TStringBuilder()
- << "TMoveTableIndex TPropose"
- << ", operationId: " << OperationId;
- }
-public:
- TPropose(TOperationId id, TTxState::ETxState& nextState)
- : OperationId(id)
- , NextState(nextState)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- TStepId step = TStepId(ev->Get()->StepId);
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvOperationPlan"
- << ", step: " << step
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxMoveTableIndex);
-
- auto srcPath = TPath::Init(txState->SourcePathId, context.SS);
- auto dstPath = TPath::Init(txState->TargetPathId, context.SS);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- txState->PlanStep = step;
- context.SS->PersistTxPlanStep(db, OperationId, step);
-
- TTableIndexInfo::TPtr indexData = context.SS->Indexes.at(dstPath.Base()->PathId);
- context.SS->PersistTableIndex(db, dstPath.Base()->PathId);
- context.SS->Indexes[dstPath.Base()->PathId] = indexData->AlterData;
-
- dstPath->StepCreated = step;
- context.SS->PersistCreateStep(db, dstPath.Base()->PathId, step);
- dstPath.DomainInfo()->IncPathsInside();
-
- dstPath.Activate();
- IncParentDirAlterVersionWithRepublish(OperationId, dstPath, context);
-
- if (context.SS->EnableSchemeTransactionsAtSchemeShard) {
- // only persist step, but do not set it for the src path
- NextState = TTxState::WaitShadowPathPublication;
- context.SS->ChangeTxState(db, OperationId, TTxState::WaitShadowPathPublication);
- return true;
- }
-
- MarkSrcDropped(db, context, OperationId, *txState, srcPath);
-
- Y_VERIFY(!context.SS->TablesWithSnaphots.contains(srcPath.Base()->PathId));
-
- NextState = TTxState::Done;
- context.SS->ChangeTxState(db, OperationId, TTxState::Done);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxMoveTableIndex);
- Y_VERIFY(txState->SourcePathId);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- return false;
- }
-};
-
-class TWaitRenamedPathPublication: public TSubOperationState {
-private:
- TOperationId OperationId;
-
- TPathId ActivePathId;
-
- TString DebugHint() const override {
- return TStringBuilder()
- << "TMoveTableIndex TWaitRenamedPathPublication"
- << " operationId: " << OperationId;
- }
-
-public:
- TWaitRenamedPathPublication(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType, TEvPrivate::TEvOperationPlan::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvDataShard::TEvSchemaChanged"
- << ", save it"
- << ", at schemeshard: " << ssId);
-
- NTableState::CollectSchemaChanged(OperationId, ev, context);
- return false;
- }
-
- bool HandleReply(TEvPrivate::TEvCompletePublication::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvPrivate::TEvCompletePublication"
- << ", msg: " << ev->Get()->ToString()
- << ", at tablet" << ssId);
-
- Y_VERIFY(ActivePathId == ev->Get()->PathId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::DeletePathBarrier);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- context.OnComplete.RouteByTabletsFromOperation(OperationId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", operation type: " << TTxState::TypeName(txState->TxType)
- << ", at tablet" << ssId);
-
- TPath srcPath = TPath::Init(txState->SourcePathId, context.SS);
-
- if (srcPath.IsActive()) {
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", no renaming has been detected for this operation");
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::DeletePathBarrier);
- return true;
- }
-
- auto activePath = TPath::Resolve(srcPath.PathString(), context.SS);
- Y_VERIFY(activePath.IsResolved());
-
- Y_VERIFY(activePath != srcPath);
-
- ActivePathId = activePath->PathId;
- context.OnComplete.PublishAndWaitPublication(OperationId, activePath->PathId);
-
- return false;
- }
-};
-
-
-class TDeleteTableBarrier: public TSubOperationState {
-private:
- TOperationId OperationId;
-
- TString DebugHint() const override {
- return TStringBuilder()
- << "TMoveTableIndex TDeleteTableBarrier"
- << " operationId: " << OperationId;
- }
-
-public:
- TDeleteTableBarrier(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType, TEvPrivate::TEvOperationPlan::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvDataShard::TEvSchemaChanged"
- << ", save it"
- << ", at schemeshard: " << ssId);
-
- NTableState::CollectSchemaChanged(OperationId, ev, context);
- return false;
- }
-
- bool HandleReply(TEvPrivate::TEvCompleteBarrier::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvPrivate::TEvCompleteBarrier"
- << ", msg: " << ev->Get()->ToString()
- << ", at tablet" << ssId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- TPath srcPath = TPath::Init(txState->SourcePathId, context.SS);
-
- MarkSrcDropped(db, context, OperationId, *txState, srcPath);
-
- context.SS->ChangeTxState(db, OperationId, TTxState::Done);
- return true;
- }
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- context.OnComplete.RouteByTabletsFromOperation(OperationId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- Y_VERIFY(txState->PlanStep);
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", operation type: " << TTxState::TypeName(txState->TxType)
- << ", at tablet" << ssId);
-
- context.OnComplete.Barrier(OperationId, "RenamePathBarrier");
-
- return false;
- }
-};
-
-
-class TDone: public TSubOperationState {
-private:
- TOperationId OperationId;
-
- TString DebugHint() const override {
- return TStringBuilder()
- << "TMoveTableIndex TDone"
- << ", operationId: " << OperationId;
- }
-public:
- TDone(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), AllIncomingEvents());
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxMoveTableIndex);
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", SourcePathId: " << txState->SourcePathId
- << ", TargetPathId: " << txState->TargetPathId
- << ", at schemeshard: " << ssId);
-
- // clear resources on src
- NIceDb::TNiceDb db(context.Txc.DB);
- TPathElement::TPtr srcPath = context.SS->PathsById.at(txState->SourcePathId);
- context.OnComplete.ReleasePathState(OperationId, srcPath->PathId, TPathElement::EPathState::EPathStateNotExist);
-
- TPathElement::TPtr dstPath = context.SS->PathsById.at(txState->TargetPathId);
- context.OnComplete.ReleasePathState(OperationId, dstPath->PathId, TPathElement::EPathState::EPathStateNoChanges);
-
- context.OnComplete.DoneOperation(OperationId);
- return true;
- }
-};
-
-
-class TMoveTableIndex: public TSubOperation {
- const TOperationId OperationId;
- const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
- TTxState::ETxState AfterPropose = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::Propose;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::Propose:
- return AfterPropose;
-
- case TTxState::WaitShadowPathPublication:
- return TTxState::DeletePathBarrier;
- case TTxState::DeletePathBarrier:
- return TTxState::Done;
-
- default:
- return TTxState::Invalid;
- }
- return TTxState::Invalid;
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::Propose:
- return MakeHolder<TPropose>(OperationId, AfterPropose);
- case TTxState::WaitShadowPathPublication:
- return MakeHolder<TWaitRenamedPathPublication>(OperationId);
- case TTxState::DeletePathBarrier:
- return MakeHolder<TDeleteTableBarrier>(OperationId);
- case TTxState::Done:
- return MakeHolder<TDone>(OperationId);
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
- TMoveTableIndex(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
- , Transaction(tx)
- {
- }
-
- TMoveTableIndex(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
- const auto acceptExisted = !Transaction.GetFailOnExist();
- const auto& opDescr = Transaction.GetMoveTableIndex();
-
- const TString& srcPathStr = opDescr.GetSrcPath();
- const TString& dstPathStr = opDescr.GetDstPath();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TMoveTableIndex Propose"
- << ", from: "<< srcPathStr
- << ", to: " << dstPathStr
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- THolder<TProposeResponse> result;
- result.Reset(new TEvSchemeShard::TEvModifySchemeTransactionResult(
- NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId)));
-
- TString errStr;
-
- TPath srcPath = TPath::Resolve(srcPathStr, context.SS);
- {
- TPath::TChecker checks = srcPath.Check();
- checks
- .NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .IsTableIndex();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << srcPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- {
- TPath srcParentPath = srcPath.Parent();
-
- TPath::TChecker checks = srcParentPath.Check();
- checks
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsCommonSensePath()
- .IsTable()
- .IsUnderTheSameOperation(OperationId.GetTxId());
-
- if (!checks) {
- TString explain = TStringBuilder() << "parent src path fail checks"
- << ", path: " << srcParentPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- TPath dstPath = TPath::Resolve(dstPathStr, context.SS);
- TPath dstParentPath = dstPath.Parent();
-
- {
- TPath::TChecker checks = dstParentPath.Check();
- checks
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved();
-
- if (dstParentPath.IsUnderDeleting()) {
- checks
- .IsUnderDeleting()
- .IsUnderTheSameOperation(OperationId.GetTxId());
- } else if (dstParentPath.IsUnderMoving()) {
- // it means that dstPath is free enough to be the move destination
- checks
- .IsUnderMoving()
- .IsUnderTheSameOperation(OperationId.GetTxId());
- } else if (dstParentPath.IsUnderCreating()) {
- checks
- .IsUnderCreating()
- .IsUnderTheSameOperation(OperationId.GetTxId());
- } else {
- checks
- .NotUnderOperation();
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "parent dst path fail checks"
- << ", path: " << dstParentPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- if (dstParentPath.IsUnderOperation()) {
- dstPath = TPath::ResolveWithInactive(OperationId, dstPathStr, context.SS);
- } else {
- Y_FAIL("NONO");
- }
-
- {
- TPath::TChecker checks = dstPath.Check();
- checks.IsAtLocalSchemeShard();
- if (dstPath.IsResolved()) {
- checks
- .IsResolved();
-
- if (dstPath.IsUnderDeleting()) {
- checks
- .IsUnderDeleting()
- .IsUnderTheSameOperation(OperationId.GetTxId());
- } else if (dstPath.IsUnderMoving()) {
- // it means that dstPath is free enough to be the move destination
- checks
- .IsUnderMoving()
- .IsUnderTheSameOperation(OperationId.GetTxId());
- } else {
- checks
- .IsDeleted()
- .NotUnderOperation()
- .FailOnExist(TPathElement::EPathType::EPathTypeTable, acceptExisted);
- }
- } else {
- checks
- .NotEmpty()
- .NotResolved();
- }
-
- if (checks) {
- checks
- .DepthLimit()
- .IsValidLeafName();
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "dst path fail checks"
- << ", path: " << dstPath.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
-
-
- if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- if (!context.SS->CheckLocks(srcPath.Base()->PathId, Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
- return result;
- }
-
- TPathId allocatedPathId = context.SS->AllocatePathId();
- context.MemChanges.GrabNewPath(context.SS, allocatedPathId);
- context.MemChanges.GrabPath(context.SS, dstParentPath.Base()->PathId);
- context.MemChanges.GrabPath(context.SS, srcPath.Base()->PathId);
- context.MemChanges.GrabNewTxState(context.SS, OperationId);
- context.MemChanges.GrabNewIndex(context.SS, allocatedPathId);
-
- context.DbChanges.PersistPath(allocatedPathId);
- context.DbChanges.PersistPath(dstParentPath.Base()->PathId);
- context.DbChanges.PersistPath(srcPath.Base()->PathId);
- context.DbChanges.PersistAlterIndex(allocatedPathId);
- context.DbChanges.PersistApplyUserAttrs(allocatedPathId);
- context.DbChanges.PersistTxState(OperationId);
-
- // create new path and inherit properties from src
- dstPath.MaterializeLeaf(srcPath.Base()->Owner, allocatedPathId, /*allowInactivePath*/ true);
- result->SetPathId(dstPath.Base()->PathId.LocalPathId);
- dstPath.Base()->CreateTxId = OperationId.GetTxId();
- dstPath.Base()->LastTxId = OperationId.GetTxId();
- dstPath.Base()->PathState = TPathElement::EPathState::EPathStateCreate;
- dstPath.Base()->PathType = TPathElement::EPathType::EPathTypeTableIndex;
- dstPath.Base()->UserAttrs->AlterData = srcPath.Base()->UserAttrs;
- dstPath.Base()->ACL = srcPath.Base()->ACL;
-
- dstParentPath.Base()->IncAliveChildren();
-
- // create tx state, do not catch shards right now
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxMoveTableIndex, dstPath.Base()->PathId, srcPath.Base()->PathId);
- txState.State = TTxState::Propose;
-
- srcPath->PathState = TPathElement::EPathState::EPathStateMoving;
- srcPath->LastTxId = OperationId.GetTxId();
-
- const auto srcIndexInfo = context.SS->Indexes.at(srcPath.Base()->PathId);
- auto newIndexData = TTableIndexInfo::NotExistedYet(srcIndexInfo->Type);
- context.SS->Indexes[dstPath.Base()->PathId] = newIndexData;
- newIndexData->AlterData = srcIndexInfo->GetNextVersion();
-
- context.SS->IncrementPathDbRefCount(dstPath.Base()->PathId);
-
- IncParentDirAlterVersionWithRepublish(OperationId, dstPath, context);
- IncParentDirAlterVersionWithRepublish(OperationId, srcPath, context);
-
- context.OnComplete.ActivateTx(OperationId);
- State = NextState();
- SetState(SelectStateFunc(State));
-
- return result;
- }
-
- void AbortPropose(TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TMoveTableIndex AbortPropose"
- << ", opId: " << OperationId
- << ", at schemeshard: " << context.SS->TabletID());
- }
-
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TMoveTableIndex AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
- << ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-ISubOperationBase::TPtr CreateMoveTableIndex(TOperationId id, const TTxTransaction& tx) {
- return new TMoveTableIndex(id, tx);
-}
-
-ISubOperationBase::TPtr CreateMoveTableIndex(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state != TTxState::Invalid);
- return new TMoveTableIndex(id, state);
-}
-
-}
-}
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+void MarkSrcDropped(NIceDb::TNiceDb& db,
+ TOperationContext& context,
+ TOperationId operationId,
+ const TTxState& txState,
+ TPath& srcPath)
+{
+ Y_VERIFY(txState.PlanStep);
+ srcPath->SetDropped(txState.PlanStep, operationId.GetTxId());
+ context.SS->PersistDropStep(db, srcPath->PathId, txState.PlanStep, operationId);
+ context.SS->PersistRemoveTable(db, srcPath->PathId, context.Ctx);
+ context.SS->PersistUserAttributes(db, srcPath->PathId, srcPath->UserAttrs, nullptr);
+
+ srcPath.Parent()->DecAliveChildren();
+ srcPath.DomainInfo()->DecPathsInside();
+
+ IncParentDirAlterVersionWithRepublish(operationId, srcPath, context);
+}
+
+class TPropose: public TSubOperationState {
+private:
+ TOperationId OperationId;
+ TTxState::ETxState& NextState;
+
+ TString DebugHint() const override {
+ return TStringBuilder()
+ << "TMoveTableIndex TPropose"
+ << ", operationId: " << OperationId;
+ }
+public:
+ TPropose(TOperationId id, TTxState::ETxState& nextState)
+ : OperationId(id)
+ , NextState(nextState)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ TStepId step = TStepId(ev->Get()->StepId);
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvOperationPlan"
+ << ", step: " << step
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxMoveTableIndex);
+
+ auto srcPath = TPath::Init(txState->SourcePathId, context.SS);
+ auto dstPath = TPath::Init(txState->TargetPathId, context.SS);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ txState->PlanStep = step;
+ context.SS->PersistTxPlanStep(db, OperationId, step);
+
+ TTableIndexInfo::TPtr indexData = context.SS->Indexes.at(dstPath.Base()->PathId);
+ context.SS->PersistTableIndex(db, dstPath.Base()->PathId);
+ context.SS->Indexes[dstPath.Base()->PathId] = indexData->AlterData;
+
+ dstPath->StepCreated = step;
+ context.SS->PersistCreateStep(db, dstPath.Base()->PathId, step);
+ dstPath.DomainInfo()->IncPathsInside();
+
+ dstPath.Activate();
+ IncParentDirAlterVersionWithRepublish(OperationId, dstPath, context);
+
+ if (context.SS->EnableSchemeTransactionsAtSchemeShard) {
+ // only persist step, but do not set it for the src path
+ NextState = TTxState::WaitShadowPathPublication;
+ context.SS->ChangeTxState(db, OperationId, TTxState::WaitShadowPathPublication);
+ return true;
+ }
+
+ MarkSrcDropped(db, context, OperationId, *txState, srcPath);
+
+ Y_VERIFY(!context.SS->TablesWithSnaphots.contains(srcPath.Base()->PathId));
+
+ NextState = TTxState::Done;
+ context.SS->ChangeTxState(db, OperationId, TTxState::Done);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxMoveTableIndex);
+ Y_VERIFY(txState->SourcePathId);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ return false;
+ }
+};
+
+class TWaitRenamedPathPublication: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
+ TPathId ActivePathId;
+
+ TString DebugHint() const override {
+ return TStringBuilder()
+ << "TMoveTableIndex TWaitRenamedPathPublication"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TWaitRenamedPathPublication(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType, TEvPrivate::TEvOperationPlan::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvDataShard::TEvSchemaChanged"
+ << ", save it"
+ << ", at schemeshard: " << ssId);
+
+ NTableState::CollectSchemaChanged(OperationId, ev, context);
+ return false;
+ }
+
+ bool HandleReply(TEvPrivate::TEvCompletePublication::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvPrivate::TEvCompletePublication"
+ << ", msg: " << ev->Get()->ToString()
+ << ", at tablet" << ssId);
+
+ Y_VERIFY(ActivePathId == ev->Get()->PathId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::DeletePathBarrier);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ context.OnComplete.RouteByTabletsFromOperation(OperationId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", operation type: " << TTxState::TypeName(txState->TxType)
+ << ", at tablet" << ssId);
+
+ TPath srcPath = TPath::Init(txState->SourcePathId, context.SS);
+
+ if (srcPath.IsActive()) {
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", no renaming has been detected for this operation");
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::DeletePathBarrier);
+ return true;
+ }
+
+ auto activePath = TPath::Resolve(srcPath.PathString(), context.SS);
+ Y_VERIFY(activePath.IsResolved());
+
+ Y_VERIFY(activePath != srcPath);
+
+ ActivePathId = activePath->PathId;
+ context.OnComplete.PublishAndWaitPublication(OperationId, activePath->PathId);
+
+ return false;
+ }
+};
+
+
+class TDeleteTableBarrier: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
+ TString DebugHint() const override {
+ return TStringBuilder()
+ << "TMoveTableIndex TDeleteTableBarrier"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TDeleteTableBarrier(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvProposeTransactionResult::EventType, TEvPrivate::TEvOperationPlan::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvSchemaChanged::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvDataShard::TEvSchemaChanged"
+ << ", save it"
+ << ", at schemeshard: " << ssId);
+
+ NTableState::CollectSchemaChanged(OperationId, ev, context);
+ return false;
+ }
+
+ bool HandleReply(TEvPrivate::TEvCompleteBarrier::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvPrivate::TEvCompleteBarrier"
+ << ", msg: " << ev->Get()->ToString()
+ << ", at tablet" << ssId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ TPath srcPath = TPath::Init(txState->SourcePathId, context.SS);
+
+ MarkSrcDropped(db, context, OperationId, *txState, srcPath);
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::Done);
+ return true;
+ }
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ context.OnComplete.RouteByTabletsFromOperation(OperationId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ Y_VERIFY(txState->PlanStep);
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", operation type: " << TTxState::TypeName(txState->TxType)
+ << ", at tablet" << ssId);
+
+ context.OnComplete.Barrier(OperationId, "RenamePathBarrier");
+
+ return false;
+ }
+};
+
+
+class TDone: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
+ TString DebugHint() const override {
+ return TStringBuilder()
+ << "TMoveTableIndex TDone"
+ << ", operationId: " << OperationId;
+ }
+public:
+ TDone(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), AllIncomingEvents());
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxMoveTableIndex);
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", SourcePathId: " << txState->SourcePathId
+ << ", TargetPathId: " << txState->TargetPathId
+ << ", at schemeshard: " << ssId);
+
+ // clear resources on src
+ NIceDb::TNiceDb db(context.Txc.DB);
+ TPathElement::TPtr srcPath = context.SS->PathsById.at(txState->SourcePathId);
+ context.OnComplete.ReleasePathState(OperationId, srcPath->PathId, TPathElement::EPathState::EPathStateNotExist);
+
+ TPathElement::TPtr dstPath = context.SS->PathsById.at(txState->TargetPathId);
+ context.OnComplete.ReleasePathState(OperationId, dstPath->PathId, TPathElement::EPathState::EPathStateNoChanges);
+
+ context.OnComplete.DoneOperation(OperationId);
+ return true;
+ }
+};
+
+
+class TMoveTableIndex: public TSubOperation {
+ const TOperationId OperationId;
+ const TTxTransaction Transaction;
+ TTxState::ETxState State = TTxState::Invalid;
+ TTxState::ETxState AfterPropose = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::Propose;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::Propose:
+ return AfterPropose;
+
+ case TTxState::WaitShadowPathPublication:
+ return TTxState::DeletePathBarrier;
+ case TTxState::DeletePathBarrier:
+ return TTxState::Done;
+
+ default:
+ return TTxState::Invalid;
+ }
+ return TTxState::Invalid;
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::Propose:
+ return MakeHolder<TPropose>(OperationId, AfterPropose);
+ case TTxState::WaitShadowPathPublication:
+ return MakeHolder<TWaitRenamedPathPublication>(OperationId);
+ case TTxState::DeletePathBarrier:
+ return MakeHolder<TDeleteTableBarrier>(OperationId);
+ case TTxState::Done:
+ return MakeHolder<TDone>(OperationId);
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
+ TMoveTableIndex(TOperationId id, const TTxTransaction& tx)
+ : OperationId(id)
+ , Transaction(tx)
+ {
+ }
+
+ TMoveTableIndex(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ const auto acceptExisted = !Transaction.GetFailOnExist();
+ const auto& opDescr = Transaction.GetMoveTableIndex();
+
+ const TString& srcPathStr = opDescr.GetSrcPath();
+ const TString& dstPathStr = opDescr.GetDstPath();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TMoveTableIndex Propose"
+ << ", from: "<< srcPathStr
+ << ", to: " << dstPathStr
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ THolder<TProposeResponse> result;
+ result.Reset(new TEvSchemeShard::TEvModifySchemeTransactionResult(
+ NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId)));
+
+ TString errStr;
+
+ TPath srcPath = TPath::Resolve(srcPathStr, context.SS);
+ {
+ TPath::TChecker checks = srcPath.Check();
+ checks
+ .NotEmpty()
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .IsTableIndex();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << srcPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ {
+ TPath srcParentPath = srcPath.Parent();
+
+ TPath::TChecker checks = srcParentPath.Check();
+ checks
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsCommonSensePath()
+ .IsTable()
+ .IsUnderTheSameOperation(OperationId.GetTxId());
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent src path fail checks"
+ << ", path: " << srcParentPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ TPath dstPath = TPath::Resolve(dstPathStr, context.SS);
+ TPath dstParentPath = dstPath.Parent();
+
+ {
+ TPath::TChecker checks = dstParentPath.Check();
+ checks
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved();
+
+ if (dstParentPath.IsUnderDeleting()) {
+ checks
+ .IsUnderDeleting()
+ .IsUnderTheSameOperation(OperationId.GetTxId());
+ } else if (dstParentPath.IsUnderMoving()) {
+ // it means that dstPath is free enough to be the move destination
+ checks
+ .IsUnderMoving()
+ .IsUnderTheSameOperation(OperationId.GetTxId());
+ } else if (dstParentPath.IsUnderCreating()) {
+ checks
+ .IsUnderCreating()
+ .IsUnderTheSameOperation(OperationId.GetTxId());
+ } else {
+ checks
+ .NotUnderOperation();
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "parent dst path fail checks"
+ << ", path: " << dstParentPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ if (dstParentPath.IsUnderOperation()) {
+ dstPath = TPath::ResolveWithInactive(OperationId, dstPathStr, context.SS);
+ } else {
+ Y_FAIL("NONO");
+ }
+
+ {
+ TPath::TChecker checks = dstPath.Check();
+ checks.IsAtLocalSchemeShard();
+ if (dstPath.IsResolved()) {
+ checks
+ .IsResolved();
+
+ if (dstPath.IsUnderDeleting()) {
+ checks
+ .IsUnderDeleting()
+ .IsUnderTheSameOperation(OperationId.GetTxId());
+ } else if (dstPath.IsUnderMoving()) {
+ // it means that dstPath is free enough to be the move destination
+ checks
+ .IsUnderMoving()
+ .IsUnderTheSameOperation(OperationId.GetTxId());
+ } else {
+ checks
+ .IsDeleted()
+ .NotUnderOperation()
+ .FailOnExist(TPathElement::EPathType::EPathTypeTable, acceptExisted);
+ }
+ } else {
+ checks
+ .NotEmpty()
+ .NotResolved();
+ }
+
+ if (checks) {
+ checks
+ .DepthLimit()
+ .IsValidLeafName();
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "dst path fail checks"
+ << ", path: " << dstPath.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+
+
+ if (!context.SS->CheckApplyIf(Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ if (!context.SS->CheckLocks(srcPath.Base()->PathId, Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
+ return result;
+ }
+
+ TPathId allocatedPathId = context.SS->AllocatePathId();
+ context.MemChanges.GrabNewPath(context.SS, allocatedPathId);
+ context.MemChanges.GrabPath(context.SS, dstParentPath.Base()->PathId);
+ context.MemChanges.GrabPath(context.SS, srcPath.Base()->PathId);
+ context.MemChanges.GrabNewTxState(context.SS, OperationId);
+ context.MemChanges.GrabNewIndex(context.SS, allocatedPathId);
+
+ context.DbChanges.PersistPath(allocatedPathId);
+ context.DbChanges.PersistPath(dstParentPath.Base()->PathId);
+ context.DbChanges.PersistPath(srcPath.Base()->PathId);
+ context.DbChanges.PersistAlterIndex(allocatedPathId);
+ context.DbChanges.PersistApplyUserAttrs(allocatedPathId);
+ context.DbChanges.PersistTxState(OperationId);
+
+ // create new path and inherit properties from src
+ dstPath.MaterializeLeaf(srcPath.Base()->Owner, allocatedPathId, /*allowInactivePath*/ true);
+ result->SetPathId(dstPath.Base()->PathId.LocalPathId);
+ dstPath.Base()->CreateTxId = OperationId.GetTxId();
+ dstPath.Base()->LastTxId = OperationId.GetTxId();
+ dstPath.Base()->PathState = TPathElement::EPathState::EPathStateCreate;
+ dstPath.Base()->PathType = TPathElement::EPathType::EPathTypeTableIndex;
+ dstPath.Base()->UserAttrs->AlterData = srcPath.Base()->UserAttrs;
+ dstPath.Base()->ACL = srcPath.Base()->ACL;
+
+ dstParentPath.Base()->IncAliveChildren();
+
+ // create tx state, do not catch shards right now
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxMoveTableIndex, dstPath.Base()->PathId, srcPath.Base()->PathId);
+ txState.State = TTxState::Propose;
+
+ srcPath->PathState = TPathElement::EPathState::EPathStateMoving;
+ srcPath->LastTxId = OperationId.GetTxId();
+
+ const auto srcIndexInfo = context.SS->Indexes.at(srcPath.Base()->PathId);
+ auto newIndexData = TTableIndexInfo::NotExistedYet(srcIndexInfo->Type);
+ context.SS->Indexes[dstPath.Base()->PathId] = newIndexData;
+ newIndexData->AlterData = srcIndexInfo->GetNextVersion();
+
+ context.SS->IncrementPathDbRefCount(dstPath.Base()->PathId);
+
+ IncParentDirAlterVersionWithRepublish(OperationId, dstPath, context);
+ IncParentDirAlterVersionWithRepublish(OperationId, srcPath, context);
+
+ context.OnComplete.ActivateTx(OperationId);
+ State = NextState();
+ SetState(SelectStateFunc(State));
+
+ return result;
+ }
+
+ void AbortPropose(TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TMoveTableIndex AbortPropose"
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << context.SS->TabletID());
+ }
+
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TMoveTableIndex AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+ISubOperationBase::TPtr CreateMoveTableIndex(TOperationId id, const TTxTransaction& tx) {
+ return new TMoveTableIndex(id, tx);
+}
+
+ISubOperationBase::TPtr CreateMoveTableIndex(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state != TTxState::Invalid);
+ return new TMoveTableIndex(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_move_tables.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_move_tables.cpp
index fea4b208a77..84035116361 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_move_tables.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_move_tables.cpp
@@ -1,133 +1,133 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_path_element.h"
-
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_path_element.h"
+
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/path.h>
#include <ydb/core/protos/flat_tx_scheme.pb.h>
#include <ydb/core/protos/flat_scheme_op.pb.h>
-
-namespace {
-
-
-NKikimrSchemeOp::TModifyScheme MoveTableTask(NKikimr::NSchemeShard::TPath& src, NKikimr::NSchemeShard::TPath& dst) {
- NKikimrSchemeOp::TModifyScheme scheme;
-
- scheme.SetWorkingDir(dst.Parent().PathString());
- scheme.SetFailOnExist(true);
- scheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpMoveTable);
- auto operation = scheme.MutableMoveTable();
- operation->SetSrcPath(src.PathString());
- operation->SetDstPath(dst.PathString());
-
- return scheme;
-}
-
-NKikimrSchemeOp::TModifyScheme MoveTableIndexTask(NKikimr::NSchemeShard::TPath& src, NKikimr::NSchemeShard::TPath& dst) {
- NKikimrSchemeOp::TModifyScheme scheme;
-
- scheme.SetWorkingDir(dst.Parent().PathString());
- scheme.SetFailOnExist(true);
- scheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpMoveTableIndex);
- auto operation = scheme.MutableMoveTableIndex();
- operation->SetSrcPath(src.PathString());
- operation->SetDstPath(dst.PathString());
-
- return scheme;
-}
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-TVector<ISubOperationBase::TPtr> CreateConsistentMoveTable(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context) {
- Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpMoveTable);
-
- TVector<ISubOperationBase::TPtr> result;
-
- if (!context.SS->EnableSchemeTransactionsAtSchemeShard) {
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter,
- "Do not accept move table operation until EnableSchemeTransactionsAtSchemeShard isn't set")};
- }
-
- {
- TString errStr;
- if (!context.SS->CheckApplyIf(tx, errStr)) {
- return {CreateReject(nextId, NKikimrScheme::EStatus::StatusPreconditionFailed, errStr)};
- }
- }
-
- auto moving = tx.GetMoveTable();
-
- auto& srcStr = moving.GetSrcPath();
- auto& dstStr = moving.GetDstPath();
-
- TPath srcPath = TPath::Resolve(srcStr, context.SS);
- {
- TPath::TChecker checks = srcPath.Check();
- checks.IsResolved()
- .NotDeleted()
- .IsTable()
- .IsCommonSensePath();
-
- if (!checks) {
- TStringBuilder explain = TStringBuilder() << "src path fail checks"
- << ", path: " << srcStr;
- auto status = checks.GetStatus(&explain);
- return {CreateReject(nextId, status, explain)};
- }
- }
-
- {
- TStringBuilder explain = TStringBuilder() << "fail checks";
-
- if (!context.SS->CheckLocks(srcPath.Base()->PathId, tx, explain)) {
- return {CreateReject(nextId, NKikimrScheme::StatusMultipleModifications, explain)};
- }
- }
-
- TPath dstPath = TPath::Resolve(dstStr, context.SS);
-
- result.push_back(CreateMoveTable(TOperationId(nextId.GetTxId(),
- nextId.GetSubTxId() + result.size()),
- MoveTableTask(srcPath, dstPath)));
-
- for (auto& child: srcPath.Base()->GetChildren()) {
- auto name = child.first;
-
- TPath srcIndexPath = srcPath.Child(name);
- if (srcIndexPath.IsDeleted()) {
- continue;
- }
-
- TPath dstIndexPath = dstPath.Child(name);
-
- Y_VERIFY(srcIndexPath.Base()->PathId == child.second);
- Y_VERIFY_S(srcIndexPath.Base()->GetChildren().size() == 1,
- srcIndexPath.PathString() << " has children " << srcIndexPath.Base()->GetChildren().size());
-
- result.push_back(CreateMoveTableIndex(TOperationId(nextId.GetTxId(),
- nextId.GetSubTxId() + result.size()),
- MoveTableIndexTask(srcIndexPath, dstIndexPath)));
-
- TString srcImplTableName = srcIndexPath.Base()->GetChildren().begin()->first;
- TPath srcImplTable = srcIndexPath.Child(srcImplTableName);
- if (srcImplTable.IsDeleted()) {
- continue;
- }
- Y_VERIFY(srcImplTable.Base()->PathId == srcIndexPath.Base()->GetChildren().begin()->second);
-
- TPath dstImplTable = dstIndexPath.Child(srcImplTableName);
-
- result.push_back(CreateMoveTable(TOperationId(nextId.GetTxId(),
- nextId.GetSubTxId() + result.size()),
- MoveTableTask(srcImplTable, dstImplTable)));
- }
-
- return result;
-}
-
-}
-}
+
+namespace {
+
+
+NKikimrSchemeOp::TModifyScheme MoveTableTask(NKikimr::NSchemeShard::TPath& src, NKikimr::NSchemeShard::TPath& dst) {
+ NKikimrSchemeOp::TModifyScheme scheme;
+
+ scheme.SetWorkingDir(dst.Parent().PathString());
+ scheme.SetFailOnExist(true);
+ scheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpMoveTable);
+ auto operation = scheme.MutableMoveTable();
+ operation->SetSrcPath(src.PathString());
+ operation->SetDstPath(dst.PathString());
+
+ return scheme;
+}
+
+NKikimrSchemeOp::TModifyScheme MoveTableIndexTask(NKikimr::NSchemeShard::TPath& src, NKikimr::NSchemeShard::TPath& dst) {
+ NKikimrSchemeOp::TModifyScheme scheme;
+
+ scheme.SetWorkingDir(dst.Parent().PathString());
+ scheme.SetFailOnExist(true);
+ scheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpMoveTableIndex);
+ auto operation = scheme.MutableMoveTableIndex();
+ operation->SetSrcPath(src.PathString());
+ operation->SetDstPath(dst.PathString());
+
+ return scheme;
+}
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+TVector<ISubOperationBase::TPtr> CreateConsistentMoveTable(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context) {
+ Y_VERIFY(tx.GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpMoveTable);
+
+ TVector<ISubOperationBase::TPtr> result;
+
+ if (!context.SS->EnableSchemeTransactionsAtSchemeShard) {
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusInvalidParameter,
+ "Do not accept move table operation until EnableSchemeTransactionsAtSchemeShard isn't set")};
+ }
+
+ {
+ TString errStr;
+ if (!context.SS->CheckApplyIf(tx, errStr)) {
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusPreconditionFailed, errStr)};
+ }
+ }
+
+ auto moving = tx.GetMoveTable();
+
+ auto& srcStr = moving.GetSrcPath();
+ auto& dstStr = moving.GetDstPath();
+
+ TPath srcPath = TPath::Resolve(srcStr, context.SS);
+ {
+ TPath::TChecker checks = srcPath.Check();
+ checks.IsResolved()
+ .NotDeleted()
+ .IsTable()
+ .IsCommonSensePath();
+
+ if (!checks) {
+ TStringBuilder explain = TStringBuilder() << "src path fail checks"
+ << ", path: " << srcStr;
+ auto status = checks.GetStatus(&explain);
+ return {CreateReject(nextId, status, explain)};
+ }
+ }
+
+ {
+ TStringBuilder explain = TStringBuilder() << "fail checks";
+
+ if (!context.SS->CheckLocks(srcPath.Base()->PathId, tx, explain)) {
+ return {CreateReject(nextId, NKikimrScheme::StatusMultipleModifications, explain)};
+ }
+ }
+
+ TPath dstPath = TPath::Resolve(dstStr, context.SS);
+
+ result.push_back(CreateMoveTable(TOperationId(nextId.GetTxId(),
+ nextId.GetSubTxId() + result.size()),
+ MoveTableTask(srcPath, dstPath)));
+
+ for (auto& child: srcPath.Base()->GetChildren()) {
+ auto name = child.first;
+
+ TPath srcIndexPath = srcPath.Child(name);
+ if (srcIndexPath.IsDeleted()) {
+ continue;
+ }
+
+ TPath dstIndexPath = dstPath.Child(name);
+
+ Y_VERIFY(srcIndexPath.Base()->PathId == child.second);
+ Y_VERIFY_S(srcIndexPath.Base()->GetChildren().size() == 1,
+ srcIndexPath.PathString() << " has children " << srcIndexPath.Base()->GetChildren().size());
+
+ result.push_back(CreateMoveTableIndex(TOperationId(nextId.GetTxId(),
+ nextId.GetSubTxId() + result.size()),
+ MoveTableIndexTask(srcIndexPath, dstIndexPath)));
+
+ TString srcImplTableName = srcIndexPath.Base()->GetChildren().begin()->first;
+ TPath srcImplTable = srcIndexPath.Child(srcImplTableName);
+ if (srcImplTable.IsDeleted()) {
+ continue;
+ }
+ Y_VERIFY(srcImplTable.Base()->PathId == srcIndexPath.Base()->GetChildren().begin()->second);
+
+ TPath dstImplTable = dstIndexPath.Child(srcImplTableName);
+
+ result.push_back(CreateMoveTable(TOperationId(nextId.GetTxId(),
+ nextId.GetSubTxId() + result.size()),
+ MoveTableTask(srcImplTable, dstImplTable)));
+ }
+
+ return result;
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_part.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_part.cpp
index e541a08e0ee..1e769353310 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_part.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_part.cpp
@@ -1,104 +1,104 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard_impl.h"
+#include "schemeshard__operation_part.h"
+#include "schemeshard_impl.h"
#include "schemeshard_path_describer.h"
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-template<class T>
-struct TDebugEvent {
- static TString ToString (const typename T::TPtr & ev) {
- return ev->Get()->Record.ShortDebugString();
- }
-};
-
-template <>
-struct TDebugEvent<TEvPrivate::TEvOperationPlan> {
- static TString ToString (const TEvPrivate::TEvOperationPlan::TPtr& ev) {
- return TStringBuilder() << "TEvOperationPlan {"
- << " StepId: " << ev->Get()->StepId
- << " TxId: " << ev->Get()->TxId
- << " }";
- }
-};
-
-template <>
-struct TDebugEvent<TEvPrivate::TEvCompletePublication> {
- static TString ToString (const TEvPrivate::TEvCompletePublication::TPtr& ev) {
- return ev->Get()->ToString();
- }
-};
-
-template <>
-struct TDebugEvent<TEvPrivate::TEvCompleteBarrier> {
- static TString ToString (const TEvPrivate::TEvCompleteBarrier::TPtr& ev) {
- return ev->Get()->ToString();
- }
-};
-
-template <>
-struct TDebugEvent<TEvPrivate::TEvCommitTenantUpdate> {
- static TString ToString (const TEvPrivate::TEvCommitTenantUpdate::TPtr& /*ev*/) {
- return TStringBuilder() << "TEvCommitTenantUpdate {" << " }";
- }
-};
-
-template <>
-struct TDebugEvent<TEvPrivate::TEvUndoTenantUpdate> {
- static TString ToString (const TEvPrivate::TEvUndoTenantUpdate::TPtr& /*ev*/) {
- return TStringBuilder() << "TEvUndoTenantUpdate {" << " }";
- }
-};
-
-#define DefaultDebugReply(TEvType, ...) \
- TString IOperationBase::DebugReply(const TEvType::TPtr& ev) { \
- return TDebugEvent<TEvType>::ToString(ev); \
- } \
- TString TSubOperationState::DebugReply(const TEvType::TPtr& ev) { \
- return TDebugEvent<TEvType>::ToString(ev); \
- }
-
- SCHEMESHARD_INCOMING_EVENTS(DefaultDebugReply)
-#undef DefaultDebugReply
-
-
-#define DefaultHandleReply(TEvType, ...) \
- void IOperationBase::HandleReply(TEvType::TPtr& ev, TOperationContext& context) { \
- TStringBuilder msg; \
- msg << "Unexpected message," \
- << " TEvType# " << #TEvType \
- << " debug msg# " << DebugReply(ev) \
- << " at tablet# " << context.SS->SelfTabletId(); \
- LOG_CRIT_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, msg); \
- Y_FAIL_S(msg); \
- } \
- bool TSubOperationState::HandleReply(TEvType::TPtr& ev, TOperationContext& context) { \
- if (!MsgToIgnore.empty() && MsgToIgnore.contains(TEvType::EventType)) { \
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, \
- "Superflous message, " << LogHint \
- << " TEvType# " << #TEvType \
- << " debug msg# " << DebugReply(ev) \
- << " at tablet# " << context.SS->TabletID()); \
- return false; \
- } \
- TStringBuilder msg; \
- msg << "Unexpected message, " \
- << LogHint \
- << " TEvType# " << #TEvType \
- << " debug msg# " << DebugReply(ev) \
- << " at tablet# " << context.SS->SelfTabletId(); \
- LOG_CRIT_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, msg); \
- Y_FAIL_S(msg); \
- return false; \
- }
-
- SCHEMESHARD_INCOMING_EVENTS(DefaultHandleReply)
-#undef DefaultHandleReply
-
-void TSubOperationState::IgnoreMessages(TString debugHint, TSet<ui32> mgsIds) {
- LogHint = debugHint;
- MsgToIgnore.swap(mgsIds);
-}
-
-}
-}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+template<class T>
+struct TDebugEvent {
+ static TString ToString (const typename T::TPtr & ev) {
+ return ev->Get()->Record.ShortDebugString();
+ }
+};
+
+template <>
+struct TDebugEvent<TEvPrivate::TEvOperationPlan> {
+ static TString ToString (const TEvPrivate::TEvOperationPlan::TPtr& ev) {
+ return TStringBuilder() << "TEvOperationPlan {"
+ << " StepId: " << ev->Get()->StepId
+ << " TxId: " << ev->Get()->TxId
+ << " }";
+ }
+};
+
+template <>
+struct TDebugEvent<TEvPrivate::TEvCompletePublication> {
+ static TString ToString (const TEvPrivate::TEvCompletePublication::TPtr& ev) {
+ return ev->Get()->ToString();
+ }
+};
+
+template <>
+struct TDebugEvent<TEvPrivate::TEvCompleteBarrier> {
+ static TString ToString (const TEvPrivate::TEvCompleteBarrier::TPtr& ev) {
+ return ev->Get()->ToString();
+ }
+};
+
+template <>
+struct TDebugEvent<TEvPrivate::TEvCommitTenantUpdate> {
+ static TString ToString (const TEvPrivate::TEvCommitTenantUpdate::TPtr& /*ev*/) {
+ return TStringBuilder() << "TEvCommitTenantUpdate {" << " }";
+ }
+};
+
+template <>
+struct TDebugEvent<TEvPrivate::TEvUndoTenantUpdate> {
+ static TString ToString (const TEvPrivate::TEvUndoTenantUpdate::TPtr& /*ev*/) {
+ return TStringBuilder() << "TEvUndoTenantUpdate {" << " }";
+ }
+};
+
+#define DefaultDebugReply(TEvType, ...) \
+ TString IOperationBase::DebugReply(const TEvType::TPtr& ev) { \
+ return TDebugEvent<TEvType>::ToString(ev); \
+ } \
+ TString TSubOperationState::DebugReply(const TEvType::TPtr& ev) { \
+ return TDebugEvent<TEvType>::ToString(ev); \
+ }
+
+ SCHEMESHARD_INCOMING_EVENTS(DefaultDebugReply)
+#undef DefaultDebugReply
+
+
+#define DefaultHandleReply(TEvType, ...) \
+ void IOperationBase::HandleReply(TEvType::TPtr& ev, TOperationContext& context) { \
+ TStringBuilder msg; \
+ msg << "Unexpected message," \
+ << " TEvType# " << #TEvType \
+ << " debug msg# " << DebugReply(ev) \
+ << " at tablet# " << context.SS->SelfTabletId(); \
+ LOG_CRIT_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, msg); \
+ Y_FAIL_S(msg); \
+ } \
+ bool TSubOperationState::HandleReply(TEvType::TPtr& ev, TOperationContext& context) { \
+ if (!MsgToIgnore.empty() && MsgToIgnore.contains(TEvType::EventType)) { \
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, \
+ "Superflous message, " << LogHint \
+ << " TEvType# " << #TEvType \
+ << " debug msg# " << DebugReply(ev) \
+ << " at tablet# " << context.SS->TabletID()); \
+ return false; \
+ } \
+ TStringBuilder msg; \
+ msg << "Unexpected message, " \
+ << LogHint \
+ << " TEvType# " << #TEvType \
+ << " debug msg# " << DebugReply(ev) \
+ << " at tablet# " << context.SS->SelfTabletId(); \
+ LOG_CRIT_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, msg); \
+ Y_FAIL_S(msg); \
+ return false; \
+ }
+
+ SCHEMESHARD_INCOMING_EVENTS(DefaultHandleReply)
+#undef DefaultHandleReply
+
+void TSubOperationState::IgnoreMessages(TString debugHint, TSet<ui32> mgsIds) {
+ LogHint = debugHint;
+ MsgToIgnore.swap(mgsIds);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_part.h b/ydb/core/tx/schemeshard/schemeshard__operation_part.h
index 7ea7019865c..4a639e63429 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_part.h
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_part.h
@@ -1,13 +1,13 @@
-#pragma once
-
-#include "schemeshard.h"
+#pragma once
+
+#include "schemeshard.h"
#include "schemeshard_private.h"
-#include "schemeshard_tx_infly.h"
-#include "schemeshard_types.h"
-#include "schemeshard__operation_side_effects.h"
-#include "schemeshard__operation_memory_changes.h"
-#include "schemeshard__operation_db_changes.h"
-
+#include "schemeshard_tx_infly.h"
+#include "schemeshard_types.h"
+#include "schemeshard__operation_side_effects.h"
+#include "schemeshard__operation_memory_changes.h"
+#include "schemeshard__operation_db_changes.h"
+
#include <ydb/core/base/hive.h>
#include <ydb/core/kesus/tablet/events.h>
#include <ydb/core/persqueue/events/global.h>
@@ -16,183 +16,183 @@
#include <ydb/core/tx/replication/controller/public_events.h>
#include <ydb/core/tx/sequenceshard/public/events.h>
#include <ydb/core/tx/tx_processing.h>
-
+
#include <ydb/core/blockstore/core/blockstore.h>
#include <ydb/core/filestore/core/filestore.h>
-
-#include <util/generic/ptr.h>
-#include <util/generic/set.h>
-
-#define SCHEMESHARD_INCOMING_EVENTS(action) \
- action(TEvHive::TEvCreateTabletReply, NSchemeShard::TXTYPE_CREATE_TABLET_REPLY) \
- action(TEvHive::TEvAdoptTabletReply, NSchemeShard::TXTYPE_CREATE_TABLET_REPLY) \
- action(TEvHive::TEvDeleteTabletReply, NSchemeShard::TXTYPE_FREE_TABLET_RESULT) \
- action(TEvHive::TEvDeleteOwnerTabletsReply, NSchemeShard::TXTYPE_FREE_OWNER_TABLETS_RESULT)\
-\
- action(TEvDataShard::TEvProposeTransactionResult, NSchemeShard::TXTYPE_DATASHARD_PROPOSE_RESULT) \
- action(TEvDataShard::TEvSchemaChanged, NSchemeShard::TXTYPE_DATASHARD_SCHEMA_CHANGED) \
- action(TEvDataShard::TEvStateChanged, NSchemeShard::TXTYPE_DATASHARD_STATE_RESULT) \
- action(TEvDataShard::TEvInitSplitMergeDestinationAck, NSchemeShard::TXTYPE_INIT_SPLIT_DST_ACK) \
- action(TEvDataShard::TEvSplitAck, NSchemeShard::TXTYPE_SPLIT_ACK) \
- action(TEvDataShard::TEvSplitPartitioningChangedAck, NSchemeShard::TXTYPE_SPLIT_PARTITIONING_CHANGED_DST_ACK) \
-\
- action(TEvColumnShard::TEvProposeTransactionResult, NSchemeShard::TXTYPE_COLUMNSHARD_PROPOSE_RESULT) \
- action(TEvColumnShard::TEvNotifyTxCompletionResult, NSchemeShard::TXTYPE_COLUMNSHARD_NOTIFY_TX_COMPLETION_RESULT) \
+
+#include <util/generic/ptr.h>
+#include <util/generic/set.h>
+
+#define SCHEMESHARD_INCOMING_EVENTS(action) \
+ action(TEvHive::TEvCreateTabletReply, NSchemeShard::TXTYPE_CREATE_TABLET_REPLY) \
+ action(TEvHive::TEvAdoptTabletReply, NSchemeShard::TXTYPE_CREATE_TABLET_REPLY) \
+ action(TEvHive::TEvDeleteTabletReply, NSchemeShard::TXTYPE_FREE_TABLET_RESULT) \
+ action(TEvHive::TEvDeleteOwnerTabletsReply, NSchemeShard::TXTYPE_FREE_OWNER_TABLETS_RESULT)\
\
- action(NSequenceShard::TEvSequenceShard::TEvCreateSequenceResult, NSchemeShard::TXTYPE_SEQUENCESHARD_CREATE_SEQUENCE_RESULT) \
- action(NSequenceShard::TEvSequenceShard::TEvDropSequenceResult, NSchemeShard::TXTYPE_SEQUENCESHARD_DROP_SEQUENCE_RESULT) \
- action(NSequenceShard::TEvSequenceShard::TEvUpdateSequenceResult, NSchemeShard::TXTYPE_SEQUENCESHARD_UPDATE_SEQUENCE_RESULT) \
- action(NSequenceShard::TEvSequenceShard::TEvFreezeSequenceResult, NSchemeShard::TXTYPE_SEQUENCESHARD_FREEZE_SEQUENCE_RESULT) \
- action(NSequenceShard::TEvSequenceShard::TEvRestoreSequenceResult, NSchemeShard::TXTYPE_SEQUENCESHARD_RESTORE_SEQUENCE_RESULT) \
- action(NSequenceShard::TEvSequenceShard::TEvRedirectSequenceResult, NSchemeShard::TXTYPE_SEQUENCESHARD_REDIRECT_SEQUENCE_RESULT) \
+ action(TEvDataShard::TEvProposeTransactionResult, NSchemeShard::TXTYPE_DATASHARD_PROPOSE_RESULT) \
+ action(TEvDataShard::TEvSchemaChanged, NSchemeShard::TXTYPE_DATASHARD_SCHEMA_CHANGED) \
+ action(TEvDataShard::TEvStateChanged, NSchemeShard::TXTYPE_DATASHARD_STATE_RESULT) \
+ action(TEvDataShard::TEvInitSplitMergeDestinationAck, NSchemeShard::TXTYPE_INIT_SPLIT_DST_ACK) \
+ action(TEvDataShard::TEvSplitAck, NSchemeShard::TXTYPE_SPLIT_ACK) \
+ action(TEvDataShard::TEvSplitPartitioningChangedAck, NSchemeShard::TXTYPE_SPLIT_PARTITIONING_CHANGED_DST_ACK) \
+\
+ action(TEvColumnShard::TEvProposeTransactionResult, NSchemeShard::TXTYPE_COLUMNSHARD_PROPOSE_RESULT) \
+ action(TEvColumnShard::TEvNotifyTxCompletionResult, NSchemeShard::TXTYPE_COLUMNSHARD_NOTIFY_TX_COMPLETION_RESULT) \
+\
+ action(NSequenceShard::TEvSequenceShard::TEvCreateSequenceResult, NSchemeShard::TXTYPE_SEQUENCESHARD_CREATE_SEQUENCE_RESULT) \
+ action(NSequenceShard::TEvSequenceShard::TEvDropSequenceResult, NSchemeShard::TXTYPE_SEQUENCESHARD_DROP_SEQUENCE_RESULT) \
+ action(NSequenceShard::TEvSequenceShard::TEvUpdateSequenceResult, NSchemeShard::TXTYPE_SEQUENCESHARD_UPDATE_SEQUENCE_RESULT) \
+ action(NSequenceShard::TEvSequenceShard::TEvFreezeSequenceResult, NSchemeShard::TXTYPE_SEQUENCESHARD_FREEZE_SEQUENCE_RESULT) \
+ action(NSequenceShard::TEvSequenceShard::TEvRestoreSequenceResult, NSchemeShard::TXTYPE_SEQUENCESHARD_RESTORE_SEQUENCE_RESULT) \
+ action(NSequenceShard::TEvSequenceShard::TEvRedirectSequenceResult, NSchemeShard::TXTYPE_SEQUENCESHARD_REDIRECT_SEQUENCE_RESULT) \
\
action(NReplication::TEvController::TEvCreateReplicationResult, NSchemeShard::TXTYPE_CREATE_REPLICATION_RESULT) \
action(NReplication::TEvController::TEvDropReplicationResult, NSchemeShard::TXTYPE_DROP_REPLICATION_RESULT) \
\
- action(TEvSubDomain::TEvConfigureStatus, NSchemeShard::TXTYPE_SUBDOMAIN_CONFIGURE_RESULT) \
-\
- action(TEvSchemeShard::TEvInitTenantSchemeShardResult, NSchemeShard::TXTYPE_SUBDOMAIN_CONFIGURE_RESULT) \
- action(TEvSchemeShard::TEvMigrateSchemeShardResult, NSchemeShard::TXTYPE_SUBDOMAIN_MIGRATE_RESULT) \
- action(TEvSchemeShard::TEvPublishTenantAsReadOnlyResult, NSchemeShard::TXTYPE_SUBDOMAIN_MIGRATE_RESULT) \
- action(TEvPrivate::TEvCommitTenantUpdate, NSchemeShard::TXTYPE_SUBDOMAIN_MIGRATE_RESULT) \
- action(TEvPrivate::TEvUndoTenantUpdate, NSchemeShard::TXTYPE_SUBDOMAIN_MIGRATE_RESULT) \
- action(TEvSchemeShard::TEvPublishTenantResult, NSchemeShard::TXTYPE_SUBDOMAIN_MIGRATE_RESULT) \
- action(TEvSchemeShard::TEvRewriteOwnerResult, NSchemeShard::TXTYPE_SUBDOMAIN_MIGRATE_RESULT) \
- action(TEvDataShard::TEvMigrateSchemeShardResponse, NSchemeShard::TXTYPE_SUBDOMAIN_MIGRATE_RESULT) \
-\
- action(TEvBlockStore::TEvUpdateVolumeConfigResponse, NSchemeShard::TXTYPE_BLOCKSTORE_CONFIG_RESULT) \
- action(TEvFileStore::TEvUpdateConfigResponse, NSchemeShard::TXTYPE_FILESTORE_CONFIG_RESULT) \
- action(NKesus::TEvKesus::TEvSetConfigResult, NSchemeShard::TXTYPE_KESUS_CONFIG_RESULT) \
- action(TEvPersQueue::TEvDropTabletReply, NSchemeShard::TXTYPE_DROP_TABLET_RESULT) \
- action(TEvPersQueue::TEvUpdateConfigResponse, NSchemeShard::TXTYPE_PERSQUEUE_CONFIG_RESULT) \
-\
- action(TEvPrivate::TEvOperationPlan, NSchemeShard::TXTYPE_PLAN_STEP) \
- action(TEvPrivate::TEvPrivate::TEvCompletePublication, NSchemeShard::TXTYPE_NOTIFY_OPERATION_COMPLETE_PUBLICATION) \
- action(TEvPrivate::TEvPrivate::TEvCompleteBarrier, NSchemeShard::TXTYPE_NOTIFY_OPERATION_COMPLETE_BARRIER) \
-
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-class TSchemeShard;
-
-struct TOperationContext {
- TSchemeShard* SS;
- NTabletFlatExecutor::TTransactionContext& Txc;
- const TActorContext& Ctx;
- TSideEffects& OnComplete;
- TMemoryChanges& MemChanges;
- TStorageChanges& DbChanges;
+ action(TEvSubDomain::TEvConfigureStatus, NSchemeShard::TXTYPE_SUBDOMAIN_CONFIGURE_RESULT) \
+\
+ action(TEvSchemeShard::TEvInitTenantSchemeShardResult, NSchemeShard::TXTYPE_SUBDOMAIN_CONFIGURE_RESULT) \
+ action(TEvSchemeShard::TEvMigrateSchemeShardResult, NSchemeShard::TXTYPE_SUBDOMAIN_MIGRATE_RESULT) \
+ action(TEvSchemeShard::TEvPublishTenantAsReadOnlyResult, NSchemeShard::TXTYPE_SUBDOMAIN_MIGRATE_RESULT) \
+ action(TEvPrivate::TEvCommitTenantUpdate, NSchemeShard::TXTYPE_SUBDOMAIN_MIGRATE_RESULT) \
+ action(TEvPrivate::TEvUndoTenantUpdate, NSchemeShard::TXTYPE_SUBDOMAIN_MIGRATE_RESULT) \
+ action(TEvSchemeShard::TEvPublishTenantResult, NSchemeShard::TXTYPE_SUBDOMAIN_MIGRATE_RESULT) \
+ action(TEvSchemeShard::TEvRewriteOwnerResult, NSchemeShard::TXTYPE_SUBDOMAIN_MIGRATE_RESULT) \
+ action(TEvDataShard::TEvMigrateSchemeShardResponse, NSchemeShard::TXTYPE_SUBDOMAIN_MIGRATE_RESULT) \
+\
+ action(TEvBlockStore::TEvUpdateVolumeConfigResponse, NSchemeShard::TXTYPE_BLOCKSTORE_CONFIG_RESULT) \
+ action(TEvFileStore::TEvUpdateConfigResponse, NSchemeShard::TXTYPE_FILESTORE_CONFIG_RESULT) \
+ action(NKesus::TEvKesus::TEvSetConfigResult, NSchemeShard::TXTYPE_KESUS_CONFIG_RESULT) \
+ action(TEvPersQueue::TEvDropTabletReply, NSchemeShard::TXTYPE_DROP_TABLET_RESULT) \
+ action(TEvPersQueue::TEvUpdateConfigResponse, NSchemeShard::TXTYPE_PERSQUEUE_CONFIG_RESULT) \
+\
+ action(TEvPrivate::TEvOperationPlan, NSchemeShard::TXTYPE_PLAN_STEP) \
+ action(TEvPrivate::TEvPrivate::TEvCompletePublication, NSchemeShard::TXTYPE_NOTIFY_OPERATION_COMPLETE_PUBLICATION) \
+ action(TEvPrivate::TEvPrivate::TEvCompleteBarrier, NSchemeShard::TXTYPE_NOTIFY_OPERATION_COMPLETE_BARRIER) \
+
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+class TSchemeShard;
+
+struct TOperationContext {
+ TSchemeShard* SS;
+ NTabletFlatExecutor::TTransactionContext& Txc;
+ const TActorContext& Ctx;
+ TSideEffects& OnComplete;
+ TMemoryChanges& MemChanges;
+ TStorageChanges& DbChanges;
TAutoPtr<NACLib::TUserToken> UserToken = nullptr;
- bool IsAllowedPrivateTables = false;
-};
-
-using TProposeRequest = NKikimr::NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction;
-using TProposeResponse = NKikimr::NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult;
-using TTxTransaction = NKikimrSchemeOp::TModifyScheme;
-
-class IOperationBase {
-public:
- virtual ~IOperationBase() = default;
-
-#define DefaultDebugReply(TEvType, TxType) \
- static TString DebugReply(const TEvType::TPtr&);
-
- SCHEMESHARD_INCOMING_EVENTS(DefaultDebugReply)
-#undef DefaultDebugReply
-
-#define DefaultHandleReply(TEvType, ...) \
- virtual void HandleReply(TEvType::TPtr&, TOperationContext&);
-
- SCHEMESHARD_INCOMING_EVENTS(DefaultHandleReply)
-#undef DefaultHandleReply
-
- virtual void ProgressState(TOperationContext& context) = 0;
-};
-
-class ISubOperationBase: public TSimpleRefCount<ISubOperationBase>, public IOperationBase {
-public:
- using TPtr = TIntrusivePtr<ISubOperationBase>;
-
- virtual THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) = 0;
-
+ bool IsAllowedPrivateTables = false;
+};
+
+using TProposeRequest = NKikimr::NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction;
+using TProposeResponse = NKikimr::NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult;
+using TTxTransaction = NKikimrSchemeOp::TModifyScheme;
+
+class IOperationBase {
+public:
+ virtual ~IOperationBase() = default;
+
+#define DefaultDebugReply(TEvType, TxType) \
+ static TString DebugReply(const TEvType::TPtr&);
+
+ SCHEMESHARD_INCOMING_EVENTS(DefaultDebugReply)
+#undef DefaultDebugReply
+
+#define DefaultHandleReply(TEvType, ...) \
+ virtual void HandleReply(TEvType::TPtr&, TOperationContext&);
+
+ SCHEMESHARD_INCOMING_EVENTS(DefaultHandleReply)
+#undef DefaultHandleReply
+
+ virtual void ProgressState(TOperationContext& context) = 0;
+};
+
+class ISubOperationBase: public TSimpleRefCount<ISubOperationBase>, public IOperationBase {
+public:
+ using TPtr = TIntrusivePtr<ISubOperationBase>;
+
+ virtual THolder<TProposeResponse> Propose(const TString& owner, TOperationContext& context) = 0;
+
// call it inside multipart operations after failed propose
virtual void AbortPropose(TOperationContext& context) = 0;
- //call it only before execute ForceDrop operaion for path
- virtual void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) = 0;
-};
-
-class TSubOperationState {
-private:
- TString LogHint;
- TSet<ui32> MsgToIgnore;
-
- virtual TString DebugHint() const = 0;
-
-public:
-
- using TPtr = THolder<TSubOperationState>;
- virtual ~TSubOperationState() = default;
-
-#define DefaultDebugReply(TEvType, TxType) \
- TString DebugReply(const TEvType::TPtr&);
-
- SCHEMESHARD_INCOMING_EVENTS(DefaultDebugReply)
-#undef DefaultDebugReply
-
-#define DefaultHandleReply(TEvType, ...) \
- virtual bool HandleReply(TEvType::TPtr&, TOperationContext&);
-
- SCHEMESHARD_INCOMING_EVENTS(DefaultHandleReply)
-#undef DefaultHandleReply
-
- void IgnoreMessages(TString debugHint, TSet<ui32> mgsIds);
-
- virtual bool ProgressState(TOperationContext& context) = 0;
-};
-
-class TSubOperation: public ISubOperationBase {
-private:
- TSubOperationState::TPtr Base = nullptr;
-
-public:
- virtual void StateDone(TOperationContext& context) = 0;
-
- void SetState(TSubOperationState::TPtr state) {
- Base = std::move(state);
- }
-
- void ProgressState(TOperationContext& context) override {
- Y_VERIFY(Base);
- bool isDone = Base->ProgressState(context);
- if (isDone) {
- StateDone(context);
- }
- }
-
- #define DefaultHandleReply(TEvType, ...) \
- void HandleReply(TEvType::TPtr& ev, TOperationContext& context) override { \
- Y_VERIFY(Base); \
- bool isDone = Base->HandleReply(ev, context); \
- if (isDone) { \
- StateDone(context); \
- } \
- }
-
- SCHEMESHARD_INCOMING_EVENTS(DefaultHandleReply)
- #undef DefaultHandleReply
-};
-
+ //call it only before execute ForceDrop operaion for path
+ virtual void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) = 0;
+};
+
+class TSubOperationState {
+private:
+ TString LogHint;
+ TSet<ui32> MsgToIgnore;
+
+ virtual TString DebugHint() const = 0;
+
+public:
+
+ using TPtr = THolder<TSubOperationState>;
+ virtual ~TSubOperationState() = default;
+
+#define DefaultDebugReply(TEvType, TxType) \
+ TString DebugReply(const TEvType::TPtr&);
+
+ SCHEMESHARD_INCOMING_EVENTS(DefaultDebugReply)
+#undef DefaultDebugReply
+
+#define DefaultHandleReply(TEvType, ...) \
+ virtual bool HandleReply(TEvType::TPtr&, TOperationContext&);
+
+ SCHEMESHARD_INCOMING_EVENTS(DefaultHandleReply)
+#undef DefaultHandleReply
+
+ void IgnoreMessages(TString debugHint, TSet<ui32> mgsIds);
+
+ virtual bool ProgressState(TOperationContext& context) = 0;
+};
+
+class TSubOperation: public ISubOperationBase {
+private:
+ TSubOperationState::TPtr Base = nullptr;
+
+public:
+ virtual void StateDone(TOperationContext& context) = 0;
+
+ void SetState(TSubOperationState::TPtr state) {
+ Base = std::move(state);
+ }
+
+ void ProgressState(TOperationContext& context) override {
+ Y_VERIFY(Base);
+ bool isDone = Base->ProgressState(context);
+ if (isDone) {
+ StateDone(context);
+ }
+ }
+
+ #define DefaultHandleReply(TEvType, ...) \
+ void HandleReply(TEvType::TPtr& ev, TOperationContext& context) override { \
+ Y_VERIFY(Base); \
+ bool isDone = Base->HandleReply(ev, context); \
+ if (isDone) { \
+ StateDone(context); \
+ } \
+ }
+
+ SCHEMESHARD_INCOMING_EVENTS(DefaultHandleReply)
+ #undef DefaultHandleReply
+};
+
ISubOperationBase::TPtr CreateReject(TOperationId id, THolder<TProposeResponse> response);
-ISubOperationBase::TPtr CreateReject(TOperationId id, NKikimrScheme::EStatus status, const TString& message);
-
+ISubOperationBase::TPtr CreateReject(TOperationId id, NKikimrScheme::EStatus status, const TString& message);
+
ISubOperationBase::TPtr CreateMkDir(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateMkDir(TOperationId id, TTxState::ETxState state);
-
+
ISubOperationBase::TPtr CreateRmDir(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateRmDir(TOperationId id, TTxState::ETxState state);
-
+
ISubOperationBase::TPtr CreateModifyACL(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateModifyACL(TOperationId id, TTxState::ETxState state);
@@ -203,10 +203,10 @@ ISubOperationBase::TPtr CreateFroceDropUnsafe(TOperationId id, const TTxTransact
ISubOperationBase::TPtr CreateFroceDropUnsafe(TOperationId id, TTxState::ETxState state);
ISubOperationBase::TPtr CreateNewTable(TOperationId id, const TTxTransaction& tx, const THashSet<TString>& localSequences = { });
-ISubOperationBase::TPtr CreateNewTable(TOperationId id, TTxState::ETxState state);
+ISubOperationBase::TPtr CreateNewTable(TOperationId id, TTxState::ETxState state);
ISubOperationBase::TPtr CreateCopyTable(TOperationId id, const TTxTransaction& tx);
-ISubOperationBase::TPtr CreateCopyTable(TOperationId id, TTxState::ETxState state);
+ISubOperationBase::TPtr CreateCopyTable(TOperationId id, TTxState::ETxState state);
TVector<ISubOperationBase::TPtr> CreateCopyTable(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context);
ISubOperationBase::TPtr CreateAlterTable(TOperationId id, const TTxTransaction& tx);
@@ -216,16 +216,16 @@ ISubOperationBase::TPtr CreateSplitMerge(TOperationId id, const TTxTransaction&
ISubOperationBase::TPtr CreateSplitMerge(TOperationId id, TTxState::ETxState state);
ISubOperationBase::TPtr CreateDropTable(TOperationId id, const TTxTransaction& tx);
-ISubOperationBase::TPtr CreateDropTable(TOperationId id, TTxState::ETxState state);
-
-TVector<ISubOperationBase::TPtr> CreateBuildIndex(TOperationId id, const TTxTransaction& tx, TOperationContext& context);
-TVector<ISubOperationBase::TPtr> ApplyBuildIndex(TOperationId id, const TTxTransaction& tx, TOperationContext& context);
-TVector<ISubOperationBase::TPtr> CancelBuildIndex(TOperationId id, const TTxTransaction& tx, TOperationContext& context);
-
-TVector<ISubOperationBase::TPtr> CreateDropIndex(TOperationId id, const TTxTransaction& tx, TOperationContext& context);
-ISubOperationBase::TPtr CreateDropTableIndexAtMainTable(TOperationId id, const TTxTransaction& tx);
-ISubOperationBase::TPtr CreateDropTableIndexAtMainTable(TOperationId id, TTxState::ETxState state);
-
+ISubOperationBase::TPtr CreateDropTable(TOperationId id, TTxState::ETxState state);
+
+TVector<ISubOperationBase::TPtr> CreateBuildIndex(TOperationId id, const TTxTransaction& tx, TOperationContext& context);
+TVector<ISubOperationBase::TPtr> ApplyBuildIndex(TOperationId id, const TTxTransaction& tx, TOperationContext& context);
+TVector<ISubOperationBase::TPtr> CancelBuildIndex(TOperationId id, const TTxTransaction& tx, TOperationContext& context);
+
+TVector<ISubOperationBase::TPtr> CreateDropIndex(TOperationId id, const TTxTransaction& tx, TOperationContext& context);
+ISubOperationBase::TPtr CreateDropTableIndexAtMainTable(TOperationId id, const TTxTransaction& tx);
+ISubOperationBase::TPtr CreateDropTableIndexAtMainTable(TOperationId id, TTxState::ETxState state);
+
/// CDC
// Create
TVector<ISubOperationBase::TPtr> CreateNewCdcStream(TOperationId id, const TTxTransaction& tx, TOperationContext& context);
@@ -252,20 +252,20 @@ ISubOperationBase::TPtr CreateBackup(TOperationId id, TTxState::ETxState state);
ISubOperationBase::TPtr CreateRestore(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateRestore(TOperationId id, TTxState::ETxState state);
-ISubOperationBase::TPtr CreateTxCancelTx(TEvSchemeShard::TEvCancelTx::TPtr ev);
+ISubOperationBase::TPtr CreateTxCancelTx(TEvSchemeShard::TEvCancelTx::TPtr ev);
+
+TVector<ISubOperationBase::TPtr> CreateIndexedTable(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context);
+TVector<ISubOperationBase::TPtr> CreateDropIndexedTable(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context);
-TVector<ISubOperationBase::TPtr> CreateIndexedTable(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context);
-TVector<ISubOperationBase::TPtr> CreateDropIndexedTable(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context);
-
ISubOperationBase::TPtr CreateNewTableIndex(TOperationId id, const TTxTransaction& tx);
-ISubOperationBase::TPtr CreateNewTableIndex(TOperationId id, TTxState::ETxState state);
-ISubOperationBase::TPtr CreateDropTableIndex(TOperationId id, const TTxTransaction& tx);
-ISubOperationBase::TPtr CreateDropTableIndex(TOperationId id, TTxState::ETxState state);
-ISubOperationBase::TPtr CreateAlterTableIndex(TOperationId id, const TTxTransaction& tx);
-ISubOperationBase::TPtr CreateAlterTableIndex(TOperationId id, TTxState::ETxState state);
-
-TVector<ISubOperationBase::TPtr> CreateConsistentCopyTables(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context);
-
+ISubOperationBase::TPtr CreateNewTableIndex(TOperationId id, TTxState::ETxState state);
+ISubOperationBase::TPtr CreateDropTableIndex(TOperationId id, const TTxTransaction& tx);
+ISubOperationBase::TPtr CreateDropTableIndex(TOperationId id, TTxState::ETxState state);
+ISubOperationBase::TPtr CreateAlterTableIndex(TOperationId id, const TTxTransaction& tx);
+ISubOperationBase::TPtr CreateAlterTableIndex(TOperationId id, TTxState::ETxState state);
+
+TVector<ISubOperationBase::TPtr> CreateConsistentCopyTables(TOperationId nextId, const TTxTransaction& tx, TOperationContext& context);
+
ISubOperationBase::TPtr CreateNewOlapStore(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateNewOlapStore(TOperationId id, TTxState::ETxState state);
ISubOperationBase::TPtr CreateAlterOlapStore(TOperationId id, const TTxTransaction& tx);
@@ -282,39 +282,39 @@ ISubOperationBase::TPtr CreateDropOlapTable(TOperationId id, TTxState::ETxState
ISubOperationBase::TPtr CreateNewBSV(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateNewBSV(TOperationId id, TTxState::ETxState state);
-
+
ISubOperationBase::TPtr CreateAlterBSV(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateAlterBSV(TOperationId id, TTxState::ETxState state);
-
+
ISubOperationBase::TPtr CreateAssignBSV(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateAssignBSV(TOperationId id, TTxState::ETxState state);
-
+
ISubOperationBase::TPtr CreateDropBSV(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateDropBSV(TOperationId id, TTxState::ETxState state);
-
+
ISubOperationBase::TPtr CreateNewPQ(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateNewPQ(TOperationId id, TTxState::ETxState state);
-
+
ISubOperationBase::TPtr CreateAlterPQ(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateAlterPQ(TOperationId id, TTxState::ETxState state);
-
+
ISubOperationBase::TPtr CreateDropPQ(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateDropPQ(TOperationId id, TTxState::ETxState state);
-
+
ISubOperationBase::TPtr CreateSubDomain(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateSubDomain(TOperationId id, TTxState::ETxState state);
ISubOperationBase::TPtr CreateAlterSubDomain(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateAlterSubDomain(TOperationId id, TTxState::ETxState state);
-ISubOperationBase::TPtr CreateCompatibleSubdomainDrop(TSchemeShard* ss, TOperationId id, const TTxTransaction& tx);
-ISubOperationBase::TPtr CreateCompatibleSubdomainAlter(TSchemeShard* ss, TOperationId id, const TTxTransaction& tx);
-
-ISubOperationBase::TPtr CreateUpgradeSubDomain(TOperationId id, const TTxTransaction& tx);
-ISubOperationBase::TPtr CreateUpgradeSubDomain(TOperationId id, TTxState::ETxState state);
-ISubOperationBase::TPtr CreateUpgradeSubDomainDecision(TOperationId id, const TTxTransaction& tx);
-ISubOperationBase::TPtr CreateUpgradeSubDomainDecision(TOperationId id, TTxState::ETxState state);
-
+ISubOperationBase::TPtr CreateCompatibleSubdomainDrop(TSchemeShard* ss, TOperationId id, const TTxTransaction& tx);
+ISubOperationBase::TPtr CreateCompatibleSubdomainAlter(TSchemeShard* ss, TOperationId id, const TTxTransaction& tx);
+
+ISubOperationBase::TPtr CreateUpgradeSubDomain(TOperationId id, const TTxTransaction& tx);
+ISubOperationBase::TPtr CreateUpgradeSubDomain(TOperationId id, TTxState::ETxState state);
+ISubOperationBase::TPtr CreateUpgradeSubDomainDecision(TOperationId id, const TTxTransaction& tx);
+ISubOperationBase::TPtr CreateUpgradeSubDomainDecision(TOperationId id, TTxState::ETxState state);
+
ISubOperationBase::TPtr CreateDropSubdomain(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateDropSubdomain(TOperationId id, TTxState::ETxState state);
@@ -327,9 +327,9 @@ ISubOperationBase::TPtr CreateExtSubDomain(TOperationId id, TTxState::ETxState s
ISubOperationBase::TPtr CreateAlterExtSubDomain(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateAlterExtSubDomain(TOperationId id, TTxState::ETxState state);
-ISubOperationBase::TPtr CreateFroceDropExtSubDomain(TOperationId id, const TTxTransaction& tx);
-ISubOperationBase::TPtr CreateFroceDropExtSubDomain(TOperationId id, TTxState::ETxState state);
-
+ISubOperationBase::TPtr CreateFroceDropExtSubDomain(TOperationId id, const TTxTransaction& tx);
+ISubOperationBase::TPtr CreateFroceDropExtSubDomain(TOperationId id, TTxState::ETxState state);
+
ISubOperationBase::TPtr CreateNewKesus(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateNewKesus(TOperationId id, TTxState::ETxState state);
@@ -345,30 +345,30 @@ ISubOperationBase::TPtr CreateNewRTMR(TOperationId id, TTxState::ETxState state)
ISubOperationBase::TPtr CreateNewSolomon(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateNewSolomon(TOperationId id, TTxState::ETxState state);
-ISubOperationBase::TPtr CreateAlterSolomon(TOperationId id, const TTxTransaction& tx);
-ISubOperationBase::TPtr CreateAlterSolomon(TOperationId id, TTxState::ETxState state);
-
+ISubOperationBase::TPtr CreateAlterSolomon(TOperationId id, const TTxTransaction& tx);
+ISubOperationBase::TPtr CreateAlterSolomon(TOperationId id, TTxState::ETxState state);
+
ISubOperationBase::TPtr CreateDropSolomon(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateDropSolomon(TOperationId id, TTxState::ETxState state);
-ISubOperationBase::TPtr CreateInitializeBuildIndexMainTable(TOperationId id, const TTxTransaction& tx);
-ISubOperationBase::TPtr CreateInitializeBuildIndexMainTable(TOperationId id, TTxState::ETxState state);
-
-ISubOperationBase::TPtr CreateInitializeBuildIndexImplTable(TOperationId id, const TTxTransaction& tx);
-ISubOperationBase::TPtr CreateInitializeBuildIndexImplTable(TOperationId id, TTxState::ETxState state);
-
-ISubOperationBase::TPtr CreateFinalizeBuildIndexImplTable(TOperationId id, const TTxTransaction& tx);
-ISubOperationBase::TPtr CreateFinalizeBuildIndexImplTable(TOperationId id, TTxState::ETxState state);
-
-ISubOperationBase::TPtr CreateFinalizeBuildIndexMainTable(TOperationId id, const TTxTransaction& tx);
-ISubOperationBase::TPtr CreateFinalizeBuildIndexMainTable(TOperationId id, TTxState::ETxState state);
-
-ISubOperationBase::TPtr CreateLockForIndexBuild(TOperationId id, const TTxTransaction& tx);
-ISubOperationBase::TPtr CreateLockForIndexBuild(TOperationId id, TTxState::ETxState state);
-
-ISubOperationBase::TPtr DropLock(TOperationId id, const TTxTransaction& tx);
-ISubOperationBase::TPtr DropLock(TOperationId id, TTxState::ETxState state);
-
+ISubOperationBase::TPtr CreateInitializeBuildIndexMainTable(TOperationId id, const TTxTransaction& tx);
+ISubOperationBase::TPtr CreateInitializeBuildIndexMainTable(TOperationId id, TTxState::ETxState state);
+
+ISubOperationBase::TPtr CreateInitializeBuildIndexImplTable(TOperationId id, const TTxTransaction& tx);
+ISubOperationBase::TPtr CreateInitializeBuildIndexImplTable(TOperationId id, TTxState::ETxState state);
+
+ISubOperationBase::TPtr CreateFinalizeBuildIndexImplTable(TOperationId id, const TTxTransaction& tx);
+ISubOperationBase::TPtr CreateFinalizeBuildIndexImplTable(TOperationId id, TTxState::ETxState state);
+
+ISubOperationBase::TPtr CreateFinalizeBuildIndexMainTable(TOperationId id, const TTxTransaction& tx);
+ISubOperationBase::TPtr CreateFinalizeBuildIndexMainTable(TOperationId id, TTxState::ETxState state);
+
+ISubOperationBase::TPtr CreateLockForIndexBuild(TOperationId id, const TTxTransaction& tx);
+ISubOperationBase::TPtr CreateLockForIndexBuild(TOperationId id, TTxState::ETxState state);
+
+ISubOperationBase::TPtr DropLock(TOperationId id, const TTxTransaction& tx);
+ISubOperationBase::TPtr DropLock(TOperationId id, TTxState::ETxState state);
+
ISubOperationBase::TPtr CreateNewFileStore(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateNewFileStore(TOperationId id, TTxState::ETxState state);
@@ -381,13 +381,13 @@ ISubOperationBase::TPtr CreateDropFileStore(TOperationId id, TTxState::ETxState
ISubOperationBase::TPtr CreateAlterLogin(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateAlterLogin(TOperationId id, TTxState::ETxState state);
-TVector<ISubOperationBase::TPtr> CreateConsistentMoveTable(TOperationId id, const TTxTransaction& tx, TOperationContext& context);
-
-ISubOperationBase::TPtr CreateMoveTable(TOperationId id, const TTxTransaction& tx);
-ISubOperationBase::TPtr CreateMoveTable(TOperationId id, TTxState::ETxState state);
-
-ISubOperationBase::TPtr CreateMoveTableIndex(TOperationId id, const TTxTransaction& tx);
-ISubOperationBase::TPtr CreateMoveTableIndex(TOperationId id, TTxState::ETxState state);
+TVector<ISubOperationBase::TPtr> CreateConsistentMoveTable(TOperationId id, const TTxTransaction& tx, TOperationContext& context);
+
+ISubOperationBase::TPtr CreateMoveTable(TOperationId id, const TTxTransaction& tx);
+ISubOperationBase::TPtr CreateMoveTable(TOperationId id, TTxState::ETxState state);
+
+ISubOperationBase::TPtr CreateMoveTableIndex(TOperationId id, const TTxTransaction& tx);
+ISubOperationBase::TPtr CreateMoveTableIndex(TOperationId id, TTxState::ETxState state);
ISubOperationBase::TPtr CreateNewSequence(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateNewSequence(TOperationId id, TTxState::ETxState state);
@@ -399,5 +399,5 @@ ISubOperationBase::TPtr CreateNewReplication(TOperationId id, TTxState::ETxState
ISubOperationBase::TPtr CreateDropReplication(TOperationId id, const TTxTransaction& tx);
ISubOperationBase::TPtr CreateDropReplication(TOperationId id, TTxState::ETxState state);
-}
-}
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_rmdir.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_rmdir.cpp
index d949d8397ad..f2dea8f26df 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_rmdir.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_rmdir.cpp
@@ -1,210 +1,210 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard_impl.h"
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TRmDir: public ISubOperationBase {
+#include "schemeshard__operation_part.h"
+#include "schemeshard_impl.h"
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TRmDir: public ISubOperationBase {
const TOperationId OperationId;
const TTxTransaction Transaction;
-
-public:
+
+public:
TRmDir(TOperationId id, const TTxTransaction& tx)
: OperationId(id)
, Transaction(tx)
{
}
- TRmDir(TOperationId id)
- : OperationId(id)
+ TRmDir(TOperationId id)
+ : OperationId(id)
{
}
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const auto& drop = Transaction.GetDrop();
-
+
const TString& parentPathStr = Transaction.GetWorkingDir();
- const TString& name = drop.GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TRmDir Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", pathId: " << drop.GetId()
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
-
- TPath path = drop.HasId()
- ? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
- : TPath::Resolve(parentPathStr, context.SS).Dive(name);
- {
- TPath::TChecker checks = path.Check();
+ const TString& name = drop.GetName();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TRmDir Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", pathId: " << drop.GetId()
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+
+ TPath path = drop.HasId()
+ ? TPath::Init(context.SS->MakeLocalId(drop.GetId()), context.SS)
+ : TPath::Resolve(parentPathStr, context.SS).Dive(name);
+ {
+ TPath::TChecker checks = path.Check();
checks
.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotRoot()
- .NotDeleted()
- .NotUnderDeleting()
- .IsDirectory()
- .NotUnderOperation()
- .IsCommonSensePath()
- .NotChildren(NKikimrScheme::StatusNameConflict);
-
- if (!checks) {
- TString explain = TStringBuilder() << "path table fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotRoot()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsDirectory()
+ .NotUnderOperation()
+ .IsCommonSensePath()
+ .NotChildren(NKikimrScheme::StatusNameConflict);
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path table fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
if (path.IsResolved() && path.Base()->IsDirectory() && (path.Base()->PlannedToDrop() || path.Base()->Dropped())) {
result->SetPathDropTxId(ui64(path.Base()->DropTxId));
result->SetPathId(path.Base()->PathId.LocalPathId);
}
- return result;
- }
- }
-
+ return result;
+ }
+ }
+
TString errStr;
-
+
if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxRmDir, path.Base()->PathId);
- txState.State = TTxState::Propose;
- txState.MinStep = TStepId(1);
-
- context.OnComplete.ActivateTx(OperationId);
-
- path.Base()->PathState = TPathElement::EPathState::EPathStateDrop;
- path.Base()->DropTxId = OperationId.GetTxId();
- path.Base()->LastTxId = OperationId.GetTxId();
-
- context.SS->PersistTxState(db, OperationId);
-
- context.SS->TabletCounters->Simple()[COUNTER_DIR_COUNT].Sub(1);
-
- auto parentDir = path.Parent();
- ++parentDir.Base()->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
- context.SS->ClearDescribePathCaches(parentDir.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir.Base()->PathId);
-
- context.SS->ClearDescribePathCaches(path.Base());
- context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
-
- return result;
- }
-
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxRmDir, path.Base()->PathId);
+ txState.State = TTxState::Propose;
+ txState.MinStep = TStepId(1);
+
+ context.OnComplete.ActivateTx(OperationId);
+
+ path.Base()->PathState = TPathElement::EPathState::EPathStateDrop;
+ path.Base()->DropTxId = OperationId.GetTxId();
+ path.Base()->LastTxId = OperationId.GetTxId();
+
+ context.SS->PersistTxState(db, OperationId);
+
+ context.SS->TabletCounters->Simple()[COUNTER_DIR_COUNT].Sub(1);
+
+ auto parentDir = path.Parent();
+ ++parentDir.Base()->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir.Base());
+ context.SS->ClearDescribePathCaches(parentDir.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir.Base()->PathId);
+
+ context.SS->ClearDescribePathCaches(path.Base());
+ context.OnComplete.PublishToSchemeBoard(OperationId, path.Base()->PathId);
+
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TRmDir");
}
- void ProgressState(TOperationContext& context) override {
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TRmDir ProgressState"
- << ", opId: " << OperationId
- << ", at schemeshard: " << context.SS->TabletID());
-
- TTxState* txState = context.SS->FindTx(OperationId);
-
- context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
- }
-
- void HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
- const TStepId step = TStepId(ev->Get()->StepId);
- const TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TRmDir HandleReply TEvOperationPlan"
- << ", opId: " << OperationId
- << ", step: " << step
- << ", at schemeshard: " << ssId);
-
-
- TTxState* txState = context.SS->FindTx(OperationId);
-
- if (!txState) {
- LOG_WARN_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "txState is nullptr, considered as duplicate PlanStep"
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
- return;
- }
-
- if (txState->State != TTxState::Propose) {
- LOG_WARN_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Duplicate PlanStep"
- << ", opId: " << OperationId
- << ", state: " << TTxState::StateName(txState->State)
- << ", at schemeshard: " << ssId);
- return;
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- TPathId pathId = txState->TargetPathId;
- auto path = context.SS->PathsById.at(pathId);
- auto parentDir = context.SS->PathsById.at(path->ParentPathId);
-
- Y_VERIFY(!path->Dropped());
- path->SetDropped(step, OperationId.GetTxId());
- context.SS->PersistDropStep(db, pathId, step, OperationId);
- auto domainInfo = context.SS->ResolveDomainInfo(pathId);
- domainInfo->DecPathsInside();
- parentDir->DecAliveChildren();
-
- ++parentDir->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentDir);
- context.SS->ClearDescribePathCaches(parentDir);
- context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
-
- context.SS->ClearDescribePathCaches(path);
- context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
-
- context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size());
- context.SS->PersistUserAttributes(db, path->PathId, path->UserAttrs, nullptr);
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "RmDir is done"
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- context.OnComplete.DoneOperation(OperationId);
- }
-
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "RmDir AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void ProgressState(TOperationContext& context) override {
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TRmDir ProgressState"
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+
+ context.OnComplete.ProposeToCoordinator(OperationId, txState->TargetPathId, TStepId(0));
+ }
+
+ void HandleReply(TEvPrivate::TEvOperationPlan::TPtr& ev, TOperationContext& context) override {
+ const TStepId step = TStepId(ev->Get()->StepId);
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TRmDir HandleReply TEvOperationPlan"
+ << ", opId: " << OperationId
+ << ", step: " << step
+ << ", at schemeshard: " << ssId);
+
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+
+ if (!txState) {
+ LOG_WARN_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "txState is nullptr, considered as duplicate PlanStep"
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+ return;
+ }
+
+ if (txState->State != TTxState::Propose) {
+ LOG_WARN_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Duplicate PlanStep"
+ << ", opId: " << OperationId
+ << ", state: " << TTxState::StateName(txState->State)
+ << ", at schemeshard: " << ssId);
+ return;
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ TPathId pathId = txState->TargetPathId;
+ auto path = context.SS->PathsById.at(pathId);
+ auto parentDir = context.SS->PathsById.at(path->ParentPathId);
+
+ Y_VERIFY(!path->Dropped());
+ path->SetDropped(step, OperationId.GetTxId());
+ context.SS->PersistDropStep(db, pathId, step, OperationId);
+ auto domainInfo = context.SS->ResolveDomainInfo(pathId);
+ domainInfo->DecPathsInside();
+ parentDir->DecAliveChildren();
+
+ ++parentDir->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentDir);
+ context.SS->ClearDescribePathCaches(parentDir);
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentDir->PathId);
+
+ context.SS->ClearDescribePathCaches(path);
+ context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
+
+ context.SS->TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(path->UserAttrs->Size());
+ context.SS->PersistUserAttributes(db, path->PathId, path->UserAttrs, nullptr);
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "RmDir is done"
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "RmDir AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateRmDir(TOperationId id, const TTxTransaction& tx) {
return new TRmDir(id, tx);
}
-ISubOperationBase::TPtr CreateRmDir(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state == TTxState::Invalid || state == TTxState::Propose);
- return new TRmDir(id);
-}
-
-}
-}
+ISubOperationBase::TPtr CreateRmDir(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state == TTxState::Invalid || state == TTxState::Propose);
+ return new TRmDir(id);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_side_effects.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_side_effects.cpp
index c3102de7a5b..3b59bcfad04 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_side_effects.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_side_effects.cpp
@@ -1,99 +1,99 @@
-#include "schemeshard__operation_side_effects.h"
-#include "schemeshard__operation_db_changes.h"
-#include "schemeshard__operation_memory_changes.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_side_effects.h"
+#include "schemeshard__operation_db_changes.h"
+#include "schemeshard__operation_memory_changes.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/tx/tx_processing.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-void TSideEffects::ProposeToCoordinator(TOperationId opId, TPathId pathId, TStepId minStep) {
- CoordinatorProposes.push_back(TProposeRec(opId, pathId, minStep));
-}
-
-void TSideEffects::CoordinatorAck(TActorId coordiantor, TStepId stepId, TTxId txId) {
- CoordinatorAcks.push_back(TCoordinatorAck(coordiantor, stepId, txId));
-}
-
-void TSideEffects::MediatorAck(TActorId mediator, TStepId stepId) {
- MediatorAcks.push_back(TMediatorAck(mediator, stepId));
-}
-
-void TSideEffects::UpdateTenant(TPathId pathId) {
- TenantsToUpdate.insert(pathId);
-}
-
-void TSideEffects::UpdateTenants(THashSet<TPathId>&& pathIds) {
- if (TenantsToUpdate.empty()) {
- TenantsToUpdate = std::move(pathIds);
- } else {
- TenantsToUpdate.insert(pathIds.begin(), pathIds.end());
- }
-}
-
-void TSideEffects::Send(TActorId dst, IEventBase* message, ui64 cookie, ui32 flags) {
- Messages.push_back(TSendRec(dst, message, cookie, flags));
-}
-
-void TSideEffects::BindMsgToPipe(TOperationId opId, TTabletId dst, TPipeMessageId cookie, TAutoPtr<IEventBase> message) {
- BindedMessages.push_back(TBindMsgRec(opId, dst, cookie, message));
- AttachOperationToPipe(opId, dst);
-}
-
-void TSideEffects::BindMsgToPipe(TOperationId opId, TTabletId dst, TShardIdx shardIdx, TAutoPtr<IEventBase> message) {
- BindMsgToPipe(opId, dst, TPipeMessageId(shardIdx.GetOwnerId(), shardIdx.GetLocalId()), message);
-}
-
-void TSideEffects::BindMsgToPipe(TOperationId opId, TTabletId dst, TPathId pathId, TAutoPtr<IEventBase> message) {
- BindMsgToPipe(opId, dst, TPipeMessageId(pathId.OwnerId, pathId.LocalPathId), message);
-}
-
-void TSideEffects::UnbindMsgFromPipe(TOperationId opId, TTabletId dst, TPipeMessageId cookie) {
- BindedMessageAcks.push_back(TBindMsgAck(opId, dst, cookie));
-}
-
-void TSideEffects::RouteByTabletsFromOperation(TOperationId opId) {
- RelationsByTabletsFromOperation.push_back(opId);
-}
-
-void TSideEffects::UnbindMsgFromPipe(TOperationId opId, TTabletId dst, TPathId pathId) {
- UnbindMsgFromPipe(opId, dst, TPipeMessageId(pathId.OwnerId, pathId.LocalPathId));
-}
-
-void TSideEffects::UnbindMsgFromPipe(TOperationId opId, TTabletId dst, TShardIdx shardIdx) {
- UnbindMsgFromPipe(opId, dst, TPipeMessageId(shardIdx.GetOwnerId(), shardIdx.GetLocalId()));
-}
-
-void TSideEffects::AttachOperationToPipe(TOperationId opId, TTabletId dst) {
- PendingPipeTrackerCommands.AttachTablet(ui64(opId.GetTxId()), ui64(dst), opId.GetSubTxId());
- RouteByTablet(opId, dst);
-}
-
-void TSideEffects::RouteByShardIdx(TOperationId opId, TShardIdx shardIdx) {
- RelationsByShardIdx.push_back(TRelationByShardIdx(opId, shardIdx));
-}
-
-void TSideEffects::ReleasePathState(TOperationId opId, TPathId pathId, NKikimrSchemeOp::EPathState state) {
- ReleasePathStateRecs.push_back(TPathStateRec(opId, pathId, state));
-}
-
-void TSideEffects::RouteByTablet(TOperationId opId, TTabletId tabletId) {
- RelationsByTabletId.push_back(TRelationByTabletId(opId, tabletId));
-}
-
-void TSideEffects::DetachOperationFromPipe(TOperationId opId, TTabletId dst) {
- PendingPipeTrackerCommands.DetachTablet(ui64(opId.GetTxId()), ui64(dst), opId.GetSubTxId());
-}
-
-void TSideEffects::ActivateTx(TOperationId opId) {
- ActivationParts.insert(opId);
-}
-
-void TSideEffects::ActivateOperation(TTxId txId) {
- ActivationOps.insert(txId);
-}
-
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+void TSideEffects::ProposeToCoordinator(TOperationId opId, TPathId pathId, TStepId minStep) {
+ CoordinatorProposes.push_back(TProposeRec(opId, pathId, minStep));
+}
+
+void TSideEffects::CoordinatorAck(TActorId coordiantor, TStepId stepId, TTxId txId) {
+ CoordinatorAcks.push_back(TCoordinatorAck(coordiantor, stepId, txId));
+}
+
+void TSideEffects::MediatorAck(TActorId mediator, TStepId stepId) {
+ MediatorAcks.push_back(TMediatorAck(mediator, stepId));
+}
+
+void TSideEffects::UpdateTenant(TPathId pathId) {
+ TenantsToUpdate.insert(pathId);
+}
+
+void TSideEffects::UpdateTenants(THashSet<TPathId>&& pathIds) {
+ if (TenantsToUpdate.empty()) {
+ TenantsToUpdate = std::move(pathIds);
+ } else {
+ TenantsToUpdate.insert(pathIds.begin(), pathIds.end());
+ }
+}
+
+void TSideEffects::Send(TActorId dst, IEventBase* message, ui64 cookie, ui32 flags) {
+ Messages.push_back(TSendRec(dst, message, cookie, flags));
+}
+
+void TSideEffects::BindMsgToPipe(TOperationId opId, TTabletId dst, TPipeMessageId cookie, TAutoPtr<IEventBase> message) {
+ BindedMessages.push_back(TBindMsgRec(opId, dst, cookie, message));
+ AttachOperationToPipe(opId, dst);
+}
+
+void TSideEffects::BindMsgToPipe(TOperationId opId, TTabletId dst, TShardIdx shardIdx, TAutoPtr<IEventBase> message) {
+ BindMsgToPipe(opId, dst, TPipeMessageId(shardIdx.GetOwnerId(), shardIdx.GetLocalId()), message);
+}
+
+void TSideEffects::BindMsgToPipe(TOperationId opId, TTabletId dst, TPathId pathId, TAutoPtr<IEventBase> message) {
+ BindMsgToPipe(opId, dst, TPipeMessageId(pathId.OwnerId, pathId.LocalPathId), message);
+}
+
+void TSideEffects::UnbindMsgFromPipe(TOperationId opId, TTabletId dst, TPipeMessageId cookie) {
+ BindedMessageAcks.push_back(TBindMsgAck(opId, dst, cookie));
+}
+
+void TSideEffects::RouteByTabletsFromOperation(TOperationId opId) {
+ RelationsByTabletsFromOperation.push_back(opId);
+}
+
+void TSideEffects::UnbindMsgFromPipe(TOperationId opId, TTabletId dst, TPathId pathId) {
+ UnbindMsgFromPipe(opId, dst, TPipeMessageId(pathId.OwnerId, pathId.LocalPathId));
+}
+
+void TSideEffects::UnbindMsgFromPipe(TOperationId opId, TTabletId dst, TShardIdx shardIdx) {
+ UnbindMsgFromPipe(opId, dst, TPipeMessageId(shardIdx.GetOwnerId(), shardIdx.GetLocalId()));
+}
+
+void TSideEffects::AttachOperationToPipe(TOperationId opId, TTabletId dst) {
+ PendingPipeTrackerCommands.AttachTablet(ui64(opId.GetTxId()), ui64(dst), opId.GetSubTxId());
+ RouteByTablet(opId, dst);
+}
+
+void TSideEffects::RouteByShardIdx(TOperationId opId, TShardIdx shardIdx) {
+ RelationsByShardIdx.push_back(TRelationByShardIdx(opId, shardIdx));
+}
+
+void TSideEffects::ReleasePathState(TOperationId opId, TPathId pathId, NKikimrSchemeOp::EPathState state) {
+ ReleasePathStateRecs.push_back(TPathStateRec(opId, pathId, state));
+}
+
+void TSideEffects::RouteByTablet(TOperationId opId, TTabletId tabletId) {
+ RelationsByTabletId.push_back(TRelationByTabletId(opId, tabletId));
+}
+
+void TSideEffects::DetachOperationFromPipe(TOperationId opId, TTabletId dst) {
+ PendingPipeTrackerCommands.DetachTablet(ui64(opId.GetTxId()), ui64(dst), opId.GetSubTxId());
+}
+
+void TSideEffects::ActivateTx(TOperationId opId) {
+ ActivationParts.insert(opId);
+}
+
+void TSideEffects::ActivateOperation(TTxId txId) {
+ ActivationOps.insert(txId);
+}
+
void TSideEffects::WaitShardCreated(TShardIdx idx, TOperationId opId) {
PendingWaitShardCreated.emplace_back(idx, opId);
}
@@ -102,763 +102,763 @@ void TSideEffects::ActivateShardCreated(TShardIdx idx, TTxId txId) {
PendingActivateShardCreated.emplace_back(idx, txId);
}
-void TSideEffects::PublishAndWaitPublication(TOperationId opId, TPathId pathId) {
- PublishToSchemeBoard(opId, pathId);
- WaitPublications.emplace_back(opId, pathId);
-}
-
-void TSideEffects::DoneOperation(TOperationId opId) {
- DoneOperations.insert(opId);
- ReadyToNotify(opId);
-}
-
-void TSideEffects::DeleteShard(TShardIdx idx) {
- if (!idx) {
- return; //KIKIMR-8507
- }
- ToDeleteShards.insert(idx);
-}
-
-void TSideEffects::ToProgress(TIndexBuildId id) {
- IndexToProgress.push_back(id);
-}
-
-void TSideEffects::PublishToSchemeBoard(TOperationId opId, TPathId pathId) {
- PublishPaths[opId.GetTxId()].push_back(pathId);
-}
-
-void TSideEffects::RePublishToSchemeBoard(TOperationId opId, TPathId pathId) {
- RePublishPaths[opId.GetTxId()].push_back(pathId);
-}
-
-void TSideEffects::ReadyToNotify(TOperationId opId) {
- ReadyToNotifyOperations.insert(opId);
-}
-
-void TSideEffects::Dependence(TTxId parend, TTxId child) {
- Dependencies.push_back(TDependence(parend, child));
-}
-
-void TSideEffects::ApplyOnExecute(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx) {
- LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TSideEffects ApplyOnExecute"
- << " at tablet# " << ss->TabletID());
-
- DoDoneParts(ss, ctx);
- DoSetBarriers(ss, ctx);
- DoCheckBarriers(ss, txc, ctx);
-
+void TSideEffects::PublishAndWaitPublication(TOperationId opId, TPathId pathId) {
+ PublishToSchemeBoard(opId, pathId);
+ WaitPublications.emplace_back(opId, pathId);
+}
+
+void TSideEffects::DoneOperation(TOperationId opId) {
+ DoneOperations.insert(opId);
+ ReadyToNotify(opId);
+}
+
+void TSideEffects::DeleteShard(TShardIdx idx) {
+ if (!idx) {
+ return; //KIKIMR-8507
+ }
+ ToDeleteShards.insert(idx);
+}
+
+void TSideEffects::ToProgress(TIndexBuildId id) {
+ IndexToProgress.push_back(id);
+}
+
+void TSideEffects::PublishToSchemeBoard(TOperationId opId, TPathId pathId) {
+ PublishPaths[opId.GetTxId()].push_back(pathId);
+}
+
+void TSideEffects::RePublishToSchemeBoard(TOperationId opId, TPathId pathId) {
+ RePublishPaths[opId.GetTxId()].push_back(pathId);
+}
+
+void TSideEffects::ReadyToNotify(TOperationId opId) {
+ ReadyToNotifyOperations.insert(opId);
+}
+
+void TSideEffects::Dependence(TTxId parend, TTxId child) {
+ Dependencies.push_back(TDependence(parend, child));
+}
+
+void TSideEffects::ApplyOnExecute(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx) {
+ LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TSideEffects ApplyOnExecute"
+ << " at tablet# " << ss->TabletID());
+
+ DoDoneParts(ss, ctx);
+ DoSetBarriers(ss, ctx);
+ DoCheckBarriers(ss, txc, ctx);
+
DoWaitShardCreated(ss, ctx);
DoActivateShardCreated(ss, ctx);
- DoPersistPublishPaths(ss, txc, ctx); // before DoReadyToNotify
-
- DoReadyToNotify(ss, ctx);
- ExpandCoordinatorProposes(ss, ctx);
- DoReleasePathState(ss, ctx);
- DoBindMsgAcks(ss, ctx);
-
- DoUpdateTenant(ss, txc, ctx);
-
- DoDoneTransactions(ss, txc, ctx);
-
- DoPersistDependencies(ss,txc, ctx);
-
- DoPersistDeleteShards(ss, txc, ctx);
-
- SetupRoutingLongOps(ss, ctx);
-}
-
-TSideEffects::TPublications TSideEffects::ExtractPublicationsToSchemeBoard() {
- TPublications tmp;
- tmp.swap(PublishPaths);
- return tmp;
-}
-
-void TSideEffects::Barrier(TOperationId opId, TString barrierName) {
- Barriers.emplace_back(opId, barrierName);
-}
-
-
-void TSideEffects::ApplyOnComplete(TSchemeShard* ss, const TActorContext& ctx) {
- LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TSideEffects ApplyOnComplete"
- << " at tablet# " << ss->TabletID());
-
- DoCoordinatorAck(ss, ctx);
- DoMediatorsAck(ss, ctx);
-
- DoActivateOps(ss, ctx);
-
- DoWaitPublication(ss, ctx);
- DoPublishToSchemeBoard(ss, ctx);
-
- DoSend(ss, ctx);
- DoBindMsg(ss, ctx);
-
- //attach/detach tablets
- PendingPipeTrackerCommands.Apply(ss->PipeTracker, ctx); //it's better to decomposite attach and detach, detach shoud be applied at ApplyOnExecute
- DoRegisterRelations(ss, ctx);
-
- DoTriggerDeleteShards(ss, ctx);
-
- ResumeLongOps(ss, ctx);
-}
-
-void TSideEffects::DoActivateOps(TSchemeShard* ss, const TActorContext& ctx) {
- for (auto txId: ActivationOps) {
- if (!ss->Operations.contains(txId)) {
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Unable to activate " << txId);
- continue;
- }
-
- auto operation = ss->Operations.at(txId);
-
- if (operation->WaitOperations.size()) {
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Delay activating"
- << ", operation: " << txId
- << ", there is await operations num " << operation->WaitOperations.size());
- continue;
- }
-
- for (ui32 partIdx = 0; partIdx < operation->Parts.size(); ++partIdx) {
- LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Activate send for " << TOperationId(txId, partIdx));
- ctx.Send(ctx.SelfID, new TEvPrivate::TEvProgressOperation(ui64(txId), partIdx));
- }
- }
-
- for (auto& opPart: ActivationParts) {
- if (!ss->Operations.contains(opPart.GetTxId())) {
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Unable to activate " << opPart);
- continue;
- }
-
- auto operation = ss->Operations.at(opPart.GetTxId());
-
- if (operation->WaitOperations.size()) {
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Delay activating"
- << ", operation part: " << opPart
- << ", there is await operations num " << operation->WaitOperations.size());
- continue;
- }
-
- LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Activate send for " << opPart);
- ctx.Send(ctx.SelfID, new TEvPrivate::TEvProgressOperation(ui64(opPart.GetTxId()), opPart.GetSubTxId()));
- }
-}
-
-bool TSideEffects::CheckDecouplingProposes(TString& errExpl) const {
- THashMap<TTabletId, TOperationId> checkDecoupling;
- for (auto& rec: CoordinatorProposesShards) {
- TOperationId opId;
- TTabletId shard;
- std::tie(opId, shard) = rec;
-
- bool inserted = false;
- auto position = checkDecoupling.end();
- std::tie(position, inserted) = checkDecoupling.emplace(shard, opId);
- if (!inserted && position->second != opId) {
- errExpl = TStringBuilder()
- << "can't propose more then one operation to the shard with the same txId"
- << ", here shardId is " << shard
- << " has coolision with operations " << opId
- << " and " << position->second;
- return false;
- }
- }
- return true;
-}
-
-
-void TSideEffects::ExpandCoordinatorProposes(TSchemeShard* ss, const TActorContext& ctx) {
- TString errExpl;
- Y_VERIFY(CheckDecouplingProposes(errExpl), "check decoupling: %s", errExpl.c_str());
-
- TSet<TTxId> touchedTxIds;
- for (auto& rec: CoordinatorProposes) {
- TOperationId opId;
- TPathId pathId;
- TStepId minStep;
- std::tie(opId, pathId, minStep) = rec;
-
- ss->Operations.at(opId.GetTxId())->ProposePart(opId.GetSubTxId(), pathId, minStep);
- touchedTxIds.insert(opId.GetTxId());
- }
-
- for (auto& rec: CoordinatorProposesShards) {
- TOperationId opId;
- TTabletId shard;
- std::tie(opId, shard) = rec;
-
- ss->Operations.at(opId.GetTxId())->ProposePart(opId.GetSubTxId(), shard);
- touchedTxIds.insert(opId.GetTxId());
- }
-
- for (TTxId txId: touchedTxIds) {
- TOperation::TPtr operation = ss->Operations.at(txId);
- if (operation->IsReadyToPropose(ctx)) {
- operation->DoPropose(ss, *this, ctx);
- }
- }
-}
-
-void TSideEffects::DoReadyToNotify(TSchemeShard* ss, const TActorContext& ctx) {
- for (auto& opId: ReadyToNotifyOperations) {
- TOperation::TPtr operation = ss->Operations.at(opId.GetTxId());
- operation->ReadyToNotifyPart(opId.GetSubTxId());
-
- if (operation->IsReadyToNotify(ctx)) {
- operation->DoNotify(ss, *this, ctx);
- }
- }
-}
-
-void TSideEffects::DoMediatorsAck(TSchemeShard* ss, const TActorContext& ctx) {
- for (auto& rec: MediatorAcks) {
- TActorId mediator;
- TStepId step;
- std::tie(mediator, step) = rec;
-
- LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Ack mediator"
- << " stepId#" << step);
-
- ctx.Send(mediator, new TEvTxProcessing::TEvPlanStepAccepted(
- ss->TabletID(),
- ui64(step)));
- }
-}
-
-void TSideEffects::DoCoordinatorAck(TSchemeShard* ss, const TActorContext& ctx) {
- //agregate
- TMap<TActorId, TMap<TStepId, TSet<TTxId>>> toCoordinatorAck;
- for (auto& rec: CoordinatorAcks) {
- TActorId coordinator;
- TStepId step;
- TTxId txId;
- std::tie(coordinator, step, txId) = rec;
-
- toCoordinatorAck[coordinator][step].insert(txId);
- }
- //and send coordinator acks
- for (auto& byCoordinator: toCoordinatorAck) {
- TActorId coordinator = byCoordinator.first;
- for (auto& byStep: byCoordinator.second) {
- auto step = byStep.first;
- TSet<TTxId>& txIds = byStep.second;
-
- LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Ack coordinator"
- << " stepId#" << step
- << " first txId#" << *txIds.begin()
- << " countTxs#" << txIds.size());
-
- ctx.Send(coordinator, new TEvTxProcessing::TEvPlanStepAck(
- ss->TabletID(),
- ui64(step),
- txIds.begin(), txIds.end()));
- }
- }
-}
-
-void TSideEffects::DoUpdateTenant(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext& ctx) {
- for (const TPathId pathId : TenantsToUpdate) {
- Y_VERIFY(ss->PathsById.contains(pathId));
-
- if (!ss->PathsById.at(pathId)->IsExternalSubDomainRoot()) {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "DoUpdateTenant no IsExternalSubDomainRoot"
- << ", pathId: : " << pathId
- << ", at schemeshard: " << ss->TabletID());
- continue;
- }
-
- TPath tenantRoot = TPath::Init(pathId, ss);
- Y_VERIFY(tenantRoot.Base()->IsExternalSubDomainRoot());
-
- TSubDomainInfo::TPtr& subDomain = ss->SubDomains.at(pathId);
-
- if (!ss->SubDomainsLinks.IsActive(pathId)) {
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "DoUpdateTenant no IsActiveChild"
- << ", pathId: : " << pathId
- << ", at schemeshard: " << ss->TabletID());
- continue;
- }
-
- auto& tenantLink = ss->SubDomainsLinks.GetLink(pathId);
- Y_VERIFY(tenantLink.DomainKey == pathId);
-
- auto message = MakeHolder<TEvSchemeShard::TEvUpdateTenantSchemeShard>(ss->TabletID(), ss->Generation());
-
- bool hasChanges = false;
-
- if (tenantLink.TenantRootACL && tenantRoot.Base()->ACL) {
- // KIKIMR-10699: transfer tenants root ACL from GSS to the TSS
- // here GSS sees the ACL from TSS
- // so GSS just removes what alresy has been transfered form GSS to TSS
-
- NACLib::TACL tenantRootACL(tenantLink.TenantRootACL);
-
- // we transform ACL to the TDiffACL
- NACLib::TDiffACL diffACL;
- for (auto ace: tenantRootACL.GetACE()) {
- diffACL.RemoveAccess(ace);
- }
-
- TString prevACL = tenantRoot.Base()->ACL;
- // and apply that diff to the GSS tenants ACL
- tenantRoot.Base()->ApplyACL(diffACL.SerializeAsString());
-
- if (prevACL != tenantRoot.Base()->ACL) {
- ++tenantRoot.Base()->ACLVersion;
-
- NIceDb::TNiceDb db(txc.DB);
- ss->PersistACL(db, tenantRoot.Base());
-
- PublishToSchemeBoard(InvalidOperationId, pathId);
- {
- TPath parent = tenantRoot.Parent();
- ++parent.Base()->DirAlterVersion;
- ss->PersistPathDirAlterVersion(db, parent.Base());
- ss->ClearDescribePathCaches(parent.Base());
- PublishToSchemeBoard(InvalidOperationId, parent.Base()->PathId);
- }
- }
- }
-
- if (tenantRoot.Base()->ACL) {
- // send ACL untill all rights are transfered
- message->SetUpdateTenantRootACL(tenantRoot.Base()->ACL);
- hasChanges = true;
- }
-
- ui32 actualEffectiveACLVersion = tenantRoot.GetEffectiveACLVersion();
- if (tenantLink.EffectiveACLVersion < actualEffectiveACLVersion) {
- message->SetEffectiveACL(tenantRoot.Base()->Owner, tenantRoot.GetEffectiveACL(), actualEffectiveACLVersion);
- hasChanges = true;
- }
-
- if (tenantLink.SubdomainVersion < subDomain->GetVersion()) {
- message->SetStoragePools(subDomain->GetStoragePools(), subDomain->GetVersion());
- if (subDomain->GetDeclaredSchemeQuotas()) {
- message->Record.MutableDeclaredSchemeQuotas()->CopyFrom(*subDomain->GetDeclaredSchemeQuotas());
- }
- if (subDomain->GetDatabaseQuotas()) {
- message->Record.MutableDatabaseQuotas()->CopyFrom(*subDomain->GetDatabaseQuotas());
- }
- hasChanges = true;
- }
-
- ui32 actualUserAttrsVersion = tenantRoot.Base()->UserAttrs->AlterVersion;
- if (tenantLink.UserAttributesVersion < actualUserAttrsVersion) {
- message->SetUserAttrs(tenantRoot.Base()->UserAttrs->Attrs, actualUserAttrsVersion);
- hasChanges = true;
- }
-
- if (!tenantLink.TenantHive && subDomain->GetTenantHiveID()) {
- message->SetTenantHive(ui64(subDomain->GetTenantHiveID()));
- hasChanges = true;
- }
-
- if (tenantLink.TenantHive) {
- if (subDomain->GetAlter()) {
- Y_VERIFY_S(tenantLink.TenantHive == subDomain->GetAlter()->GetTenantHiveID(),
- "tenant hive is inconsistent"
- << " on tss: " << tenantLink.TenantHive
- << " on gss: " << subDomain->GetAlter()->GetTenantHiveID());
- } else {
- Y_VERIFY_S(tenantLink.TenantHive == subDomain->GetTenantHiveID(),
- "tenant hive is inconsistent"
- << " on tss: " << tenantLink.TenantHive
- << " on gss: " << subDomain->GetTenantHiveID());
- }
- }
-
- if (!tenantLink.TenantSysViewProcessor && subDomain->GetTenantSysViewProcessorID()) {
- message->SetTenantSysViewProcessor(ui64(subDomain->GetTenantSysViewProcessorID()));
- hasChanges = true;
- }
-
- if (tenantLink.TenantSysViewProcessor) {
- if (subDomain->GetAlter()) {
- Y_VERIFY_S(tenantLink.TenantSysViewProcessor == subDomain->GetAlter()->GetTenantSysViewProcessorID(),
- "tenant SVP is inconsistent"
- << " on tss: " << tenantLink.TenantSysViewProcessor
- << " on gss: " << subDomain->GetAlter()->GetTenantSysViewProcessorID());
- } else {
- Y_VERIFY_S(tenantLink.TenantSysViewProcessor == subDomain->GetTenantSysViewProcessorID(),
- "tenant SVP is inconsistent"
- << " on tss: " << tenantLink.TenantSysViewProcessor
- << " on gss: " << subDomain->GetTenantSysViewProcessorID());
- }
- }
-
- if (!hasChanges) {
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "DoUpdateTenant no hasChanges"
- << ", pathId: " << pathId
- << ", tenantLink: " << tenantLink
- << ", subDomain->GetVersion(): " << subDomain->GetVersion()
- << ", actualEffectiveACLVersion: " << actualEffectiveACLVersion
- << ", actualUserAttrsVersion: " << actualUserAttrsVersion
- << ", tenantHive: " << subDomain->GetTenantHiveID()
- << ", tenantSysViewProcessor: " << subDomain->GetTenantSysViewProcessorID()
- << ", at schemeshard: " << ss->TabletID());
- continue;
- }
-
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Send TEvUpdateTenantSchemeShard"
- << ", to actor: " << tenantLink.ActorId
- << ", msg: " << message->Record.ShortDebugString()
- << ", at schemeshard: " << ss->TabletID());
-
- Send(tenantLink.ActorId, message.Release());
- }
-}
-
-void TSideEffects::DoPersistPublishPaths(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx) {
- NIceDb::TNiceDb db(txc.DB);
-
- for (const auto& kv : PublishPaths) {
- const TTxId txId = kv.first;
- if (!ss->Operations.contains(txId)) {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Cannot publish paths for unknown operation id#" << txId);
- continue;
- }
-
- TOperation::TPtr operation = ss->Operations.at(txId);
-
- const auto& paths = kv.second;
- for (TPathId pathId : paths) {
- Y_VERIFY(ss->PathsById.contains(pathId));
-
- const ui64 version = ss->GetPathVersion(TPath::Init(pathId, ss)).GetGeneralVersion();
- if (operation->AddPublishingPath(pathId, version)) {
- ss->PersistPublishingPath(db, txId, pathId, version);
- }
- }
- }
-}
-
-
-void TSideEffects::DoPublishToSchemeBoard(TSchemeShard* ss, const TActorContext& ctx) {
- for (auto& kv : PublishPaths) {
- ss->PublishToSchemeBoard(kv.first, std::move(kv.second), ctx);
- }
-
- for (auto& kv : RePublishPaths) {
- ss->PublishToSchemeBoard(kv.first, std::move(kv.second), ctx);
- }
-}
-
-void TSideEffects::DoSend(TSchemeShard* ss, const TActorContext& ctx) {
- for (auto& rec: Messages) {
- TActorId actor;
- THolder<::NActors::IEventBase> message;
- ui64 cookie;
- ui32 flags;
- std::tie(actor, message, cookie, flags) = rec;
-
- LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Send "
- << " to actor: " << actor
- << " msg type: " << message->Type()
- << " msg: " << message->ToString().substr(0, 1000)
- << " at schemeshard: " << ss->TabletID());
-
- ctx.Send(actor, message.Release(), flags, cookie);
- }
-}
-
-void TSideEffects::DoBindMsg(TSchemeShard *ss, const TActorContext &ctx) {
- for (auto& rec: BindedMessages) {
- TOperationId opId;
- TTabletId tablet;
- TPipeMessageId cookie;
- THolder<::NActors::IEventBase> message;
- std::tie(opId, tablet, cookie, message) = rec;
-
- const ui32 msgType = message->Type();
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Send tablet strongly msg "
- << " operationId: " << opId
- << " from tablet: " << ss->TabletID()
- << " to tablet: " << tablet
- << " cookie: " << cookie
- << " msg type: " << msgType);
-
- Y_VERIFY(message->IsSerializable());
-
- if (!ss->Operations.contains(opId.GetTxId())) {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Send tablet strongly msg "
- << ", operation already done"
- << ", operationId: " << opId
- << " from tablet: " << ss->TabletID()
- << " to tablet: " << tablet
- << " cookie: " << cookie
- << " msg type: " << msgType);
- return;
- }
-
- Y_VERIFY(ss->Operations.contains(opId.GetTxId()));
- TOperation::TPtr operation = ss->Operations.at(opId.GetTxId());
-
- TAllocChunkSerializer serializer;
- const bool success = message->SerializeToArcadiaStream(&serializer);
- Y_VERIFY(success);
- TIntrusivePtr<TEventSerializedData> data = serializer.Release(message->IsExtendedFormat());
- operation->PipeBindedMessages[tablet][cookie] = TOperation::TPreSerialisedMessage(msgType, data);
-
- ss->PipeClientCache->Send(ctx, ui64(tablet), msgType, data, cookie.second);
- }
-}
-
-void TSideEffects::DoBindMsgAcks(TSchemeShard *ss, const TActorContext &ctx) {
- for (auto& ack: BindedMessageAcks) {
- TOperationId opId;
- TTabletId tablet;
- TPipeMessageId cookie;
- std::tie(opId, tablet, cookie) = ack;
-
- LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Ack tablet strongly msg"
- << " opId: " << opId
- << " from tablet: " << ss->TabletID()
- << " to tablet: " << tablet
- << " cookie: " << cookie);
-
- if (!ss->Operations.contains(opId.GetTxId())) {
- continue;
- }
-
- TOperation::TPtr operation = ss->Operations.at(opId.GetTxId());
-
- if (operation->PipeBindedMessages.contains(tablet)) {
- if (operation->PipeBindedMessages[tablet].contains(cookie)) {
- operation->PipeBindedMessages[tablet].erase(cookie);
- }
-
- if (operation->PipeBindedMessages[tablet].size() == 0) {
- operation->PipeBindedMessages.erase(tablet);
- //Dettach(opId, tablet);
- }
- }
- }
-}
-
-void TSideEffects::DoRegisterRelations(TSchemeShard *ss, const TActorContext &ctx) {
- for (auto& opId: RelationsByTabletsFromOperation) {
- TTxState* txState = ss->FindTx(opId);
- if (!txState) {
- continue;
- }
-
- for (TTxState::TShardOperation& shard : txState->Shards) {
- if (!ss->ShardInfos.contains(shard.Idx)) {
- continue;
- }
-
- auto tabletId = ss->ShardInfos.at(shard.Idx).TabletID;
- RouteByTablet(opId, tabletId);
- }
- }
-
- for (auto& rec: RelationsByTabletId) {
- TOperationId opId = InvalidOperationId;
- TTabletId tablet = InvalidTabletId;
- std::tie(opId, tablet) = rec;
-
- if (auto opPPtr = ss->Operations.FindPtr(opId.GetTxId())) {
- (*opPPtr)->RegisterRelationByTabletId(opId.GetSubTxId(), tablet, ctx);
- }
- }
-
- for (auto& rec: RelationsByShardIdx) {
- TOperationId opId = InvalidOperationId;
- TShardIdx shardIdx = InvalidShardIdx;
- std::tie(opId, shardIdx) = rec;
-
- if (auto opPPtr = ss->Operations.FindPtr(opId.GetTxId())) {
- (*opPPtr)->RegisterRelationByShardIdx(opId.GetSubTxId(), shardIdx, ctx);
- }
- }
-}
-
-void TSideEffects::DoTriggerDeleteShards(TSchemeShard *ss, const TActorContext &ctx) {
- ss->DoShardsDeletion(ToDeleteShards, ctx);
-}
-
-void TSideEffects::DoReleasePathState(TSchemeShard *ss, const TActorContext &) {
- for (auto& rec: ReleasePathStateRecs) {
- TOperationId opId = InvalidOperationId;
- TPathId pathId = InvalidPathId;
- NKikimrSchemeOp::EPathState state = NKikimrSchemeOp::EPathStateNotExist;
- std::tie(opId, pathId, state) = rec;
-
- if (!ss->Operations.contains(opId.GetTxId())) {
- continue;
- }
-
- TOperation::TPtr operation = ss->Operations.at(opId.GetTxId());
- if (operation->ReleasePathAtDone.contains(pathId)) {
- Y_VERIFY(operation->ReleasePathAtDone.at(pathId) == state);
- continue;
- }
-
- operation->ReleasePathAtDone[pathId] = state;
- }
-}
-
-void TSideEffects::DoPersistDeleteShards(TSchemeShard *ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &) {
- NIceDb::TNiceDb db(txc.DB);
- ss->PersistShardsToDelete(db, ToDeleteShards);
-}
-
-void TSideEffects::ResumeLongOps(TSchemeShard *ss, const TActorContext &ctx) {
- ss->Resume(IndexToProgress, ctx);
-}
-
-void TSideEffects::SetupRoutingLongOps(TSchemeShard *ss, const TActorContext &ctx) {
- ss->SetupRouting(IndexToProgress, ctx);
-}
-
-void TSideEffects::DoPersistDependencies(TSchemeShard *ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &) {
- NIceDb::TNiceDb db(txc.DB);
- for (auto& item: Dependencies) {
- TTxId parent = InvalidTxId;
- TTxId child = InvalidTxId;
- std::tie(parent, child) = item;
- if (parent != child) {
- if (ss->Operations.contains(parent) && ss->Operations.contains(child)) {
- Y_VERIFY_S(ss->Operations.contains(parent), "parent operation not exist"
- << ", parent tx " << parent
- << ", dependent tx " << child);
- ss->Operations.at(parent)->DependentOperations.insert(child);
-
- Y_VERIFY(ss->Operations.contains(child));
- ss->Operations.at(child)->WaitOperations.insert(parent);
-
- ss->PersistAddTxDependency(db, parent, child);
- }
- }
- }
-}
-
-void TSideEffects::DoDoneParts(TSchemeShard *ss, const TActorContext &ctx) {
- for (auto& opId: DoneOperations) {
- TTxId txId = opId.GetTxId();
-
- if (!ss->Operations.contains(txId)) {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Part operation has been done before id#" << opId);
- continue;
- }
-
- TOperation::TPtr operation = ss->Operations.at(txId);
- operation->DoneParts.insert(opId.GetSubTxId());
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Part operation is done"
- << " id#" << opId
- << " progress is " << operation->DoneParts.size() << "/" << operation->Parts.size());
-
- if (!operation->IsReadyToDone(ctx)) {
- continue;
- }
-
- DoneTransactions.insert(opId.GetTxId());
- }
-}
-
-void TSideEffects::DoDoneTransactions(TSchemeShard *ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx) {
- for (auto& txId: DoneTransactions) {
-
- if (!ss->Operations.contains(txId)) {
- continue;
- }
-
- TOperation::TPtr operation = ss->Operations.at(txId);
- if (!operation->IsReadyToDone(ctx)) {
- continue;
- }
-
- NIceDb::TNiceDb db(txc.DB);
-
- for (auto& item: operation->ReleasePathAtDone) {
- TPathId pathId = item.first;
- NKikimrSchemeOp::EPathState state = item.second;
-
- Y_VERIFY(ss->PathsById.contains(pathId));
- TPathElement::TPtr path = ss->PathsById.at(pathId);
- path->PathState = state;
- }
-
- for (auto& dependent: operation->DependentOperations) {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Remove dependency"
- << ", parent tx: " << txId
- << ", depnedent tx: " << dependent);
-
- ss->PersistRemoveTxDependency(db, txId, dependent);
-
- if (!ss->Operations.contains(dependent)) {
- continue;
- }
-
- auto dependentOp = ss->Operations.at(dependent);
- Y_VERIFY_S(dependentOp->WaitOperations.contains(txId),
- "self consistency check, dependentOp must have parent operation in WaitOperations"
- << ", dependet " << dependent
- << ", parent " << txId);
-
- dependentOp->WaitOperations.erase(txId);
-
- if (dependentOp->WaitOperations.empty()) {
- ActivateOperation(dependent);
- }
- }
-
- for (auto item: ss->PipeTracker.FindTablets(ui64(txId))) {
- ui64 pipeCookie = item.first;
- auto tabletId = TTabletId(item.second);
- DetachOperationFromPipe(TOperationId(txId, pipeCookie), tabletId);
- }
-
- for (ui32 partId = 0; partId < operation->Parts.size(); ++partId) {
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Operation and all the parts is done"
- << ", operation id: " << TOperationId(txId, partId));
- ss->RemoveTx(ctx, db, TOperationId(txId, partId), nullptr);
- }
-
- if (!operation->IsPublished()) {
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Publication still in progress"
- << ", tx: " << txId
- << ", publications: " << operation->Publications.size()
- << ", subscribers: " << operation->Subscribers.size());
-
- ss->Publications[txId] = {
- std::move(operation->Publications),
- std::move(operation->Subscribers)
- };
- }
-
- ss->Operations.erase(txId);
- }
-}
-
-void TSideEffects::DoWaitShardCreated(TSchemeShard* ss, const TActorContext&) {
+ DoPersistPublishPaths(ss, txc, ctx); // before DoReadyToNotify
+
+ DoReadyToNotify(ss, ctx);
+ ExpandCoordinatorProposes(ss, ctx);
+ DoReleasePathState(ss, ctx);
+ DoBindMsgAcks(ss, ctx);
+
+ DoUpdateTenant(ss, txc, ctx);
+
+ DoDoneTransactions(ss, txc, ctx);
+
+ DoPersistDependencies(ss,txc, ctx);
+
+ DoPersistDeleteShards(ss, txc, ctx);
+
+ SetupRoutingLongOps(ss, ctx);
+}
+
+TSideEffects::TPublications TSideEffects::ExtractPublicationsToSchemeBoard() {
+ TPublications tmp;
+ tmp.swap(PublishPaths);
+ return tmp;
+}
+
+void TSideEffects::Barrier(TOperationId opId, TString barrierName) {
+ Barriers.emplace_back(opId, barrierName);
+}
+
+
+void TSideEffects::ApplyOnComplete(TSchemeShard* ss, const TActorContext& ctx) {
+ LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TSideEffects ApplyOnComplete"
+ << " at tablet# " << ss->TabletID());
+
+ DoCoordinatorAck(ss, ctx);
+ DoMediatorsAck(ss, ctx);
+
+ DoActivateOps(ss, ctx);
+
+ DoWaitPublication(ss, ctx);
+ DoPublishToSchemeBoard(ss, ctx);
+
+ DoSend(ss, ctx);
+ DoBindMsg(ss, ctx);
+
+ //attach/detach tablets
+ PendingPipeTrackerCommands.Apply(ss->PipeTracker, ctx); //it's better to decomposite attach and detach, detach shoud be applied at ApplyOnExecute
+ DoRegisterRelations(ss, ctx);
+
+ DoTriggerDeleteShards(ss, ctx);
+
+ ResumeLongOps(ss, ctx);
+}
+
+void TSideEffects::DoActivateOps(TSchemeShard* ss, const TActorContext& ctx) {
+ for (auto txId: ActivationOps) {
+ if (!ss->Operations.contains(txId)) {
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Unable to activate " << txId);
+ continue;
+ }
+
+ auto operation = ss->Operations.at(txId);
+
+ if (operation->WaitOperations.size()) {
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Delay activating"
+ << ", operation: " << txId
+ << ", there is await operations num " << operation->WaitOperations.size());
+ continue;
+ }
+
+ for (ui32 partIdx = 0; partIdx < operation->Parts.size(); ++partIdx) {
+ LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Activate send for " << TOperationId(txId, partIdx));
+ ctx.Send(ctx.SelfID, new TEvPrivate::TEvProgressOperation(ui64(txId), partIdx));
+ }
+ }
+
+ for (auto& opPart: ActivationParts) {
+ if (!ss->Operations.contains(opPart.GetTxId())) {
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Unable to activate " << opPart);
+ continue;
+ }
+
+ auto operation = ss->Operations.at(opPart.GetTxId());
+
+ if (operation->WaitOperations.size()) {
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Delay activating"
+ << ", operation part: " << opPart
+ << ", there is await operations num " << operation->WaitOperations.size());
+ continue;
+ }
+
+ LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Activate send for " << opPart);
+ ctx.Send(ctx.SelfID, new TEvPrivate::TEvProgressOperation(ui64(opPart.GetTxId()), opPart.GetSubTxId()));
+ }
+}
+
+bool TSideEffects::CheckDecouplingProposes(TString& errExpl) const {
+ THashMap<TTabletId, TOperationId> checkDecoupling;
+ for (auto& rec: CoordinatorProposesShards) {
+ TOperationId opId;
+ TTabletId shard;
+ std::tie(opId, shard) = rec;
+
+ bool inserted = false;
+ auto position = checkDecoupling.end();
+ std::tie(position, inserted) = checkDecoupling.emplace(shard, opId);
+ if (!inserted && position->second != opId) {
+ errExpl = TStringBuilder()
+ << "can't propose more then one operation to the shard with the same txId"
+ << ", here shardId is " << shard
+ << " has coolision with operations " << opId
+ << " and " << position->second;
+ return false;
+ }
+ }
+ return true;
+}
+
+
+void TSideEffects::ExpandCoordinatorProposes(TSchemeShard* ss, const TActorContext& ctx) {
+ TString errExpl;
+ Y_VERIFY(CheckDecouplingProposes(errExpl), "check decoupling: %s", errExpl.c_str());
+
+ TSet<TTxId> touchedTxIds;
+ for (auto& rec: CoordinatorProposes) {
+ TOperationId opId;
+ TPathId pathId;
+ TStepId minStep;
+ std::tie(opId, pathId, minStep) = rec;
+
+ ss->Operations.at(opId.GetTxId())->ProposePart(opId.GetSubTxId(), pathId, minStep);
+ touchedTxIds.insert(opId.GetTxId());
+ }
+
+ for (auto& rec: CoordinatorProposesShards) {
+ TOperationId opId;
+ TTabletId shard;
+ std::tie(opId, shard) = rec;
+
+ ss->Operations.at(opId.GetTxId())->ProposePart(opId.GetSubTxId(), shard);
+ touchedTxIds.insert(opId.GetTxId());
+ }
+
+ for (TTxId txId: touchedTxIds) {
+ TOperation::TPtr operation = ss->Operations.at(txId);
+ if (operation->IsReadyToPropose(ctx)) {
+ operation->DoPropose(ss, *this, ctx);
+ }
+ }
+}
+
+void TSideEffects::DoReadyToNotify(TSchemeShard* ss, const TActorContext& ctx) {
+ for (auto& opId: ReadyToNotifyOperations) {
+ TOperation::TPtr operation = ss->Operations.at(opId.GetTxId());
+ operation->ReadyToNotifyPart(opId.GetSubTxId());
+
+ if (operation->IsReadyToNotify(ctx)) {
+ operation->DoNotify(ss, *this, ctx);
+ }
+ }
+}
+
+void TSideEffects::DoMediatorsAck(TSchemeShard* ss, const TActorContext& ctx) {
+ for (auto& rec: MediatorAcks) {
+ TActorId mediator;
+ TStepId step;
+ std::tie(mediator, step) = rec;
+
+ LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Ack mediator"
+ << " stepId#" << step);
+
+ ctx.Send(mediator, new TEvTxProcessing::TEvPlanStepAccepted(
+ ss->TabletID(),
+ ui64(step)));
+ }
+}
+
+void TSideEffects::DoCoordinatorAck(TSchemeShard* ss, const TActorContext& ctx) {
+ //agregate
+ TMap<TActorId, TMap<TStepId, TSet<TTxId>>> toCoordinatorAck;
+ for (auto& rec: CoordinatorAcks) {
+ TActorId coordinator;
+ TStepId step;
+ TTxId txId;
+ std::tie(coordinator, step, txId) = rec;
+
+ toCoordinatorAck[coordinator][step].insert(txId);
+ }
+ //and send coordinator acks
+ for (auto& byCoordinator: toCoordinatorAck) {
+ TActorId coordinator = byCoordinator.first;
+ for (auto& byStep: byCoordinator.second) {
+ auto step = byStep.first;
+ TSet<TTxId>& txIds = byStep.second;
+
+ LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Ack coordinator"
+ << " stepId#" << step
+ << " first txId#" << *txIds.begin()
+ << " countTxs#" << txIds.size());
+
+ ctx.Send(coordinator, new TEvTxProcessing::TEvPlanStepAck(
+ ss->TabletID(),
+ ui64(step),
+ txIds.begin(), txIds.end()));
+ }
+ }
+}
+
+void TSideEffects::DoUpdateTenant(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext& ctx) {
+ for (const TPathId pathId : TenantsToUpdate) {
+ Y_VERIFY(ss->PathsById.contains(pathId));
+
+ if (!ss->PathsById.at(pathId)->IsExternalSubDomainRoot()) {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "DoUpdateTenant no IsExternalSubDomainRoot"
+ << ", pathId: : " << pathId
+ << ", at schemeshard: " << ss->TabletID());
+ continue;
+ }
+
+ TPath tenantRoot = TPath::Init(pathId, ss);
+ Y_VERIFY(tenantRoot.Base()->IsExternalSubDomainRoot());
+
+ TSubDomainInfo::TPtr& subDomain = ss->SubDomains.at(pathId);
+
+ if (!ss->SubDomainsLinks.IsActive(pathId)) {
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "DoUpdateTenant no IsActiveChild"
+ << ", pathId: : " << pathId
+ << ", at schemeshard: " << ss->TabletID());
+ continue;
+ }
+
+ auto& tenantLink = ss->SubDomainsLinks.GetLink(pathId);
+ Y_VERIFY(tenantLink.DomainKey == pathId);
+
+ auto message = MakeHolder<TEvSchemeShard::TEvUpdateTenantSchemeShard>(ss->TabletID(), ss->Generation());
+
+ bool hasChanges = false;
+
+ if (tenantLink.TenantRootACL && tenantRoot.Base()->ACL) {
+ // KIKIMR-10699: transfer tenants root ACL from GSS to the TSS
+ // here GSS sees the ACL from TSS
+ // so GSS just removes what alresy has been transfered form GSS to TSS
+
+ NACLib::TACL tenantRootACL(tenantLink.TenantRootACL);
+
+ // we transform ACL to the TDiffACL
+ NACLib::TDiffACL diffACL;
+ for (auto ace: tenantRootACL.GetACE()) {
+ diffACL.RemoveAccess(ace);
+ }
+
+ TString prevACL = tenantRoot.Base()->ACL;
+ // and apply that diff to the GSS tenants ACL
+ tenantRoot.Base()->ApplyACL(diffACL.SerializeAsString());
+
+ if (prevACL != tenantRoot.Base()->ACL) {
+ ++tenantRoot.Base()->ACLVersion;
+
+ NIceDb::TNiceDb db(txc.DB);
+ ss->PersistACL(db, tenantRoot.Base());
+
+ PublishToSchemeBoard(InvalidOperationId, pathId);
+ {
+ TPath parent = tenantRoot.Parent();
+ ++parent.Base()->DirAlterVersion;
+ ss->PersistPathDirAlterVersion(db, parent.Base());
+ ss->ClearDescribePathCaches(parent.Base());
+ PublishToSchemeBoard(InvalidOperationId, parent.Base()->PathId);
+ }
+ }
+ }
+
+ if (tenantRoot.Base()->ACL) {
+ // send ACL untill all rights are transfered
+ message->SetUpdateTenantRootACL(tenantRoot.Base()->ACL);
+ hasChanges = true;
+ }
+
+ ui32 actualEffectiveACLVersion = tenantRoot.GetEffectiveACLVersion();
+ if (tenantLink.EffectiveACLVersion < actualEffectiveACLVersion) {
+ message->SetEffectiveACL(tenantRoot.Base()->Owner, tenantRoot.GetEffectiveACL(), actualEffectiveACLVersion);
+ hasChanges = true;
+ }
+
+ if (tenantLink.SubdomainVersion < subDomain->GetVersion()) {
+ message->SetStoragePools(subDomain->GetStoragePools(), subDomain->GetVersion());
+ if (subDomain->GetDeclaredSchemeQuotas()) {
+ message->Record.MutableDeclaredSchemeQuotas()->CopyFrom(*subDomain->GetDeclaredSchemeQuotas());
+ }
+ if (subDomain->GetDatabaseQuotas()) {
+ message->Record.MutableDatabaseQuotas()->CopyFrom(*subDomain->GetDatabaseQuotas());
+ }
+ hasChanges = true;
+ }
+
+ ui32 actualUserAttrsVersion = tenantRoot.Base()->UserAttrs->AlterVersion;
+ if (tenantLink.UserAttributesVersion < actualUserAttrsVersion) {
+ message->SetUserAttrs(tenantRoot.Base()->UserAttrs->Attrs, actualUserAttrsVersion);
+ hasChanges = true;
+ }
+
+ if (!tenantLink.TenantHive && subDomain->GetTenantHiveID()) {
+ message->SetTenantHive(ui64(subDomain->GetTenantHiveID()));
+ hasChanges = true;
+ }
+
+ if (tenantLink.TenantHive) {
+ if (subDomain->GetAlter()) {
+ Y_VERIFY_S(tenantLink.TenantHive == subDomain->GetAlter()->GetTenantHiveID(),
+ "tenant hive is inconsistent"
+ << " on tss: " << tenantLink.TenantHive
+ << " on gss: " << subDomain->GetAlter()->GetTenantHiveID());
+ } else {
+ Y_VERIFY_S(tenantLink.TenantHive == subDomain->GetTenantHiveID(),
+ "tenant hive is inconsistent"
+ << " on tss: " << tenantLink.TenantHive
+ << " on gss: " << subDomain->GetTenantHiveID());
+ }
+ }
+
+ if (!tenantLink.TenantSysViewProcessor && subDomain->GetTenantSysViewProcessorID()) {
+ message->SetTenantSysViewProcessor(ui64(subDomain->GetTenantSysViewProcessorID()));
+ hasChanges = true;
+ }
+
+ if (tenantLink.TenantSysViewProcessor) {
+ if (subDomain->GetAlter()) {
+ Y_VERIFY_S(tenantLink.TenantSysViewProcessor == subDomain->GetAlter()->GetTenantSysViewProcessorID(),
+ "tenant SVP is inconsistent"
+ << " on tss: " << tenantLink.TenantSysViewProcessor
+ << " on gss: " << subDomain->GetAlter()->GetTenantSysViewProcessorID());
+ } else {
+ Y_VERIFY_S(tenantLink.TenantSysViewProcessor == subDomain->GetTenantSysViewProcessorID(),
+ "tenant SVP is inconsistent"
+ << " on tss: " << tenantLink.TenantSysViewProcessor
+ << " on gss: " << subDomain->GetTenantSysViewProcessorID());
+ }
+ }
+
+ if (!hasChanges) {
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "DoUpdateTenant no hasChanges"
+ << ", pathId: " << pathId
+ << ", tenantLink: " << tenantLink
+ << ", subDomain->GetVersion(): " << subDomain->GetVersion()
+ << ", actualEffectiveACLVersion: " << actualEffectiveACLVersion
+ << ", actualUserAttrsVersion: " << actualUserAttrsVersion
+ << ", tenantHive: " << subDomain->GetTenantHiveID()
+ << ", tenantSysViewProcessor: " << subDomain->GetTenantSysViewProcessorID()
+ << ", at schemeshard: " << ss->TabletID());
+ continue;
+ }
+
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Send TEvUpdateTenantSchemeShard"
+ << ", to actor: " << tenantLink.ActorId
+ << ", msg: " << message->Record.ShortDebugString()
+ << ", at schemeshard: " << ss->TabletID());
+
+ Send(tenantLink.ActorId, message.Release());
+ }
+}
+
+void TSideEffects::DoPersistPublishPaths(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx) {
+ NIceDb::TNiceDb db(txc.DB);
+
+ for (const auto& kv : PublishPaths) {
+ const TTxId txId = kv.first;
+ if (!ss->Operations.contains(txId)) {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Cannot publish paths for unknown operation id#" << txId);
+ continue;
+ }
+
+ TOperation::TPtr operation = ss->Operations.at(txId);
+
+ const auto& paths = kv.second;
+ for (TPathId pathId : paths) {
+ Y_VERIFY(ss->PathsById.contains(pathId));
+
+ const ui64 version = ss->GetPathVersion(TPath::Init(pathId, ss)).GetGeneralVersion();
+ if (operation->AddPublishingPath(pathId, version)) {
+ ss->PersistPublishingPath(db, txId, pathId, version);
+ }
+ }
+ }
+}
+
+
+void TSideEffects::DoPublishToSchemeBoard(TSchemeShard* ss, const TActorContext& ctx) {
+ for (auto& kv : PublishPaths) {
+ ss->PublishToSchemeBoard(kv.first, std::move(kv.second), ctx);
+ }
+
+ for (auto& kv : RePublishPaths) {
+ ss->PublishToSchemeBoard(kv.first, std::move(kv.second), ctx);
+ }
+}
+
+void TSideEffects::DoSend(TSchemeShard* ss, const TActorContext& ctx) {
+ for (auto& rec: Messages) {
+ TActorId actor;
+ THolder<::NActors::IEventBase> message;
+ ui64 cookie;
+ ui32 flags;
+ std::tie(actor, message, cookie, flags) = rec;
+
+ LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Send "
+ << " to actor: " << actor
+ << " msg type: " << message->Type()
+ << " msg: " << message->ToString().substr(0, 1000)
+ << " at schemeshard: " << ss->TabletID());
+
+ ctx.Send(actor, message.Release(), flags, cookie);
+ }
+}
+
+void TSideEffects::DoBindMsg(TSchemeShard *ss, const TActorContext &ctx) {
+ for (auto& rec: BindedMessages) {
+ TOperationId opId;
+ TTabletId tablet;
+ TPipeMessageId cookie;
+ THolder<::NActors::IEventBase> message;
+ std::tie(opId, tablet, cookie, message) = rec;
+
+ const ui32 msgType = message->Type();
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Send tablet strongly msg "
+ << " operationId: " << opId
+ << " from tablet: " << ss->TabletID()
+ << " to tablet: " << tablet
+ << " cookie: " << cookie
+ << " msg type: " << msgType);
+
+ Y_VERIFY(message->IsSerializable());
+
+ if (!ss->Operations.contains(opId.GetTxId())) {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Send tablet strongly msg "
+ << ", operation already done"
+ << ", operationId: " << opId
+ << " from tablet: " << ss->TabletID()
+ << " to tablet: " << tablet
+ << " cookie: " << cookie
+ << " msg type: " << msgType);
+ return;
+ }
+
+ Y_VERIFY(ss->Operations.contains(opId.GetTxId()));
+ TOperation::TPtr operation = ss->Operations.at(opId.GetTxId());
+
+ TAllocChunkSerializer serializer;
+ const bool success = message->SerializeToArcadiaStream(&serializer);
+ Y_VERIFY(success);
+ TIntrusivePtr<TEventSerializedData> data = serializer.Release(message->IsExtendedFormat());
+ operation->PipeBindedMessages[tablet][cookie] = TOperation::TPreSerialisedMessage(msgType, data);
+
+ ss->PipeClientCache->Send(ctx, ui64(tablet), msgType, data, cookie.second);
+ }
+}
+
+void TSideEffects::DoBindMsgAcks(TSchemeShard *ss, const TActorContext &ctx) {
+ for (auto& ack: BindedMessageAcks) {
+ TOperationId opId;
+ TTabletId tablet;
+ TPipeMessageId cookie;
+ std::tie(opId, tablet, cookie) = ack;
+
+ LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Ack tablet strongly msg"
+ << " opId: " << opId
+ << " from tablet: " << ss->TabletID()
+ << " to tablet: " << tablet
+ << " cookie: " << cookie);
+
+ if (!ss->Operations.contains(opId.GetTxId())) {
+ continue;
+ }
+
+ TOperation::TPtr operation = ss->Operations.at(opId.GetTxId());
+
+ if (operation->PipeBindedMessages.contains(tablet)) {
+ if (operation->PipeBindedMessages[tablet].contains(cookie)) {
+ operation->PipeBindedMessages[tablet].erase(cookie);
+ }
+
+ if (operation->PipeBindedMessages[tablet].size() == 0) {
+ operation->PipeBindedMessages.erase(tablet);
+ //Dettach(opId, tablet);
+ }
+ }
+ }
+}
+
+void TSideEffects::DoRegisterRelations(TSchemeShard *ss, const TActorContext &ctx) {
+ for (auto& opId: RelationsByTabletsFromOperation) {
+ TTxState* txState = ss->FindTx(opId);
+ if (!txState) {
+ continue;
+ }
+
+ for (TTxState::TShardOperation& shard : txState->Shards) {
+ if (!ss->ShardInfos.contains(shard.Idx)) {
+ continue;
+ }
+
+ auto tabletId = ss->ShardInfos.at(shard.Idx).TabletID;
+ RouteByTablet(opId, tabletId);
+ }
+ }
+
+ for (auto& rec: RelationsByTabletId) {
+ TOperationId opId = InvalidOperationId;
+ TTabletId tablet = InvalidTabletId;
+ std::tie(opId, tablet) = rec;
+
+ if (auto opPPtr = ss->Operations.FindPtr(opId.GetTxId())) {
+ (*opPPtr)->RegisterRelationByTabletId(opId.GetSubTxId(), tablet, ctx);
+ }
+ }
+
+ for (auto& rec: RelationsByShardIdx) {
+ TOperationId opId = InvalidOperationId;
+ TShardIdx shardIdx = InvalidShardIdx;
+ std::tie(opId, shardIdx) = rec;
+
+ if (auto opPPtr = ss->Operations.FindPtr(opId.GetTxId())) {
+ (*opPPtr)->RegisterRelationByShardIdx(opId.GetSubTxId(), shardIdx, ctx);
+ }
+ }
+}
+
+void TSideEffects::DoTriggerDeleteShards(TSchemeShard *ss, const TActorContext &ctx) {
+ ss->DoShardsDeletion(ToDeleteShards, ctx);
+}
+
+void TSideEffects::DoReleasePathState(TSchemeShard *ss, const TActorContext &) {
+ for (auto& rec: ReleasePathStateRecs) {
+ TOperationId opId = InvalidOperationId;
+ TPathId pathId = InvalidPathId;
+ NKikimrSchemeOp::EPathState state = NKikimrSchemeOp::EPathStateNotExist;
+ std::tie(opId, pathId, state) = rec;
+
+ if (!ss->Operations.contains(opId.GetTxId())) {
+ continue;
+ }
+
+ TOperation::TPtr operation = ss->Operations.at(opId.GetTxId());
+ if (operation->ReleasePathAtDone.contains(pathId)) {
+ Y_VERIFY(operation->ReleasePathAtDone.at(pathId) == state);
+ continue;
+ }
+
+ operation->ReleasePathAtDone[pathId] = state;
+ }
+}
+
+void TSideEffects::DoPersistDeleteShards(TSchemeShard *ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &) {
+ NIceDb::TNiceDb db(txc.DB);
+ ss->PersistShardsToDelete(db, ToDeleteShards);
+}
+
+void TSideEffects::ResumeLongOps(TSchemeShard *ss, const TActorContext &ctx) {
+ ss->Resume(IndexToProgress, ctx);
+}
+
+void TSideEffects::SetupRoutingLongOps(TSchemeShard *ss, const TActorContext &ctx) {
+ ss->SetupRouting(IndexToProgress, ctx);
+}
+
+void TSideEffects::DoPersistDependencies(TSchemeShard *ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &) {
+ NIceDb::TNiceDb db(txc.DB);
+ for (auto& item: Dependencies) {
+ TTxId parent = InvalidTxId;
+ TTxId child = InvalidTxId;
+ std::tie(parent, child) = item;
+ if (parent != child) {
+ if (ss->Operations.contains(parent) && ss->Operations.contains(child)) {
+ Y_VERIFY_S(ss->Operations.contains(parent), "parent operation not exist"
+ << ", parent tx " << parent
+ << ", dependent tx " << child);
+ ss->Operations.at(parent)->DependentOperations.insert(child);
+
+ Y_VERIFY(ss->Operations.contains(child));
+ ss->Operations.at(child)->WaitOperations.insert(parent);
+
+ ss->PersistAddTxDependency(db, parent, child);
+ }
+ }
+ }
+}
+
+void TSideEffects::DoDoneParts(TSchemeShard *ss, const TActorContext &ctx) {
+ for (auto& opId: DoneOperations) {
+ TTxId txId = opId.GetTxId();
+
+ if (!ss->Operations.contains(txId)) {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Part operation has been done before id#" << opId);
+ continue;
+ }
+
+ TOperation::TPtr operation = ss->Operations.at(txId);
+ operation->DoneParts.insert(opId.GetSubTxId());
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Part operation is done"
+ << " id#" << opId
+ << " progress is " << operation->DoneParts.size() << "/" << operation->Parts.size());
+
+ if (!operation->IsReadyToDone(ctx)) {
+ continue;
+ }
+
+ DoneTransactions.insert(opId.GetTxId());
+ }
+}
+
+void TSideEffects::DoDoneTransactions(TSchemeShard *ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx) {
+ for (auto& txId: DoneTransactions) {
+
+ if (!ss->Operations.contains(txId)) {
+ continue;
+ }
+
+ TOperation::TPtr operation = ss->Operations.at(txId);
+ if (!operation->IsReadyToDone(ctx)) {
+ continue;
+ }
+
+ NIceDb::TNiceDb db(txc.DB);
+
+ for (auto& item: operation->ReleasePathAtDone) {
+ TPathId pathId = item.first;
+ NKikimrSchemeOp::EPathState state = item.second;
+
+ Y_VERIFY(ss->PathsById.contains(pathId));
+ TPathElement::TPtr path = ss->PathsById.at(pathId);
+ path->PathState = state;
+ }
+
+ for (auto& dependent: operation->DependentOperations) {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Remove dependency"
+ << ", parent tx: " << txId
+ << ", depnedent tx: " << dependent);
+
+ ss->PersistRemoveTxDependency(db, txId, dependent);
+
+ if (!ss->Operations.contains(dependent)) {
+ continue;
+ }
+
+ auto dependentOp = ss->Operations.at(dependent);
+ Y_VERIFY_S(dependentOp->WaitOperations.contains(txId),
+ "self consistency check, dependentOp must have parent operation in WaitOperations"
+ << ", dependet " << dependent
+ << ", parent " << txId);
+
+ dependentOp->WaitOperations.erase(txId);
+
+ if (dependentOp->WaitOperations.empty()) {
+ ActivateOperation(dependent);
+ }
+ }
+
+ for (auto item: ss->PipeTracker.FindTablets(ui64(txId))) {
+ ui64 pipeCookie = item.first;
+ auto tabletId = TTabletId(item.second);
+ DetachOperationFromPipe(TOperationId(txId, pipeCookie), tabletId);
+ }
+
+ for (ui32 partId = 0; partId < operation->Parts.size(); ++partId) {
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Operation and all the parts is done"
+ << ", operation id: " << TOperationId(txId, partId));
+ ss->RemoveTx(ctx, db, TOperationId(txId, partId), nullptr);
+ }
+
+ if (!operation->IsPublished()) {
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Publication still in progress"
+ << ", tx: " << txId
+ << ", publications: " << operation->Publications.size()
+ << ", subscribers: " << operation->Subscribers.size());
+
+ ss->Publications[txId] = {
+ std::move(operation->Publications),
+ std::move(operation->Subscribers)
+ };
+ }
+
+ ss->Operations.erase(txId);
+ }
+}
+
+void TSideEffects::DoWaitShardCreated(TSchemeShard* ss, const TActorContext&) {
for (auto& entry : PendingWaitShardCreated) {
TShardIdx shardIdx;
TOperationId opId;
@@ -868,9 +868,9 @@ void TSideEffects::DoWaitShardCreated(TSchemeShard* ss, const TActorContext&) {
it->second->WaitShardCreated(shardIdx, opId.GetSubTxId());
}
}
-}
+}
-void TSideEffects::DoActivateShardCreated(TSchemeShard* ss, const TActorContext&) {
+void TSideEffects::DoActivateShardCreated(TSchemeShard* ss, const TActorContext&) {
for (auto& entry : PendingActivateShardCreated) {
TShardIdx shardIdx;
TTxId txId;
@@ -882,100 +882,100 @@ void TSideEffects::DoActivateShardCreated(TSchemeShard* ss, const TActorContext&
}
}
}
-}
-
-void TSideEffects::DoWaitPublication(TSchemeShard *ss, const TActorContext &/*ctx*/) {
- for (auto& entry : WaitPublications) {
- TOperationId opId;
- TPathId pathId;
- std::tie(opId, pathId) = entry;
-
- auto it = ss->Operations.find(opId.GetTxId());
- if (it != ss->Operations.end()) {
- const ui64 version = ss->GetPathVersion(TPath::Init(pathId, ss)).GetGeneralVersion();
- it->second->RegisterWaitPublication(opId.GetSubTxId(), pathId, version);
- }
- }
-}
-
-void TSideEffects::DoSetBarriers(TSchemeShard *ss, const TActorContext &ctx) {
- for (auto& entry : Barriers) {
- TOperationId opId;
- TString name;
- std::tie(opId, name) = entry;
-
- auto it = ss->Operations.find(opId.GetTxId());
- if (it != ss->Operations.end()) {
- auto& operation = it->second;
- operation->RegisterBarrier(opId.GetSubTxId(), name);
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Set barrier"
- << ", OperationId: " << opId
- << ", name: " << name
- << ", done: " << operation->DoneParts.size()
- << ", blocked: " << operation->Barriers.at(name).size()
- << ", parts count: " << operation->Parts.size());
- }
- }
-}
-
-void TSideEffects::DoCheckBarriers(TSchemeShard *ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx) {
- TSet<TTxId> touchedOperations;
-
- for (auto& entry : Barriers) {
- TOperationId opId;
- TString name;
- std::tie(opId, name) = entry;
-
- touchedOperations.insert(opId.GetTxId());
- }
-
- for (auto& opId : DoneOperations) {
- touchedOperations.insert(opId.GetTxId());
- }
-
- for (auto& txId : touchedOperations) {
- auto it = ss->Operations.find(txId);
-
- if (it == ss->Operations.end()) {
- continue;
- }
-
- auto& operation = it->second;
-
- if (!operation->HasBarrier()) {
- continue;
- }
-
- if (!operation->IsDoneBarrier()) {
- continue;
- }
-
- auto name = operation->Barriers.begin()->first;
- const auto& blockedParts = operation->Barriers.begin()->second;
-
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "All parts have reached barrier"
- << ", tx: " << txId
- << ", done: " << operation->DoneParts.size()
- << ", blocked: " << blockedParts.size());
-
- TMemoryChanges memChanges;
- TStorageChanges dbChanges;
- TOperationContext context{ss, txc, ctx, *this, memChanges, dbChanges};
-
- THolder<TEvPrivate::TEvCompleteBarrier> msg = MakeHolder<TEvPrivate::TEvCompleteBarrier>(txId, name);
- TEvPrivate::TEvCompleteBarrier::TPtr personalEv = (TEventHandle<TEvPrivate::TEvCompleteBarrier>*) new IEventHandle(
+}
+
+void TSideEffects::DoWaitPublication(TSchemeShard *ss, const TActorContext &/*ctx*/) {
+ for (auto& entry : WaitPublications) {
+ TOperationId opId;
+ TPathId pathId;
+ std::tie(opId, pathId) = entry;
+
+ auto it = ss->Operations.find(opId.GetTxId());
+ if (it != ss->Operations.end()) {
+ const ui64 version = ss->GetPathVersion(TPath::Init(pathId, ss)).GetGeneralVersion();
+ it->second->RegisterWaitPublication(opId.GetSubTxId(), pathId, version);
+ }
+ }
+}
+
+void TSideEffects::DoSetBarriers(TSchemeShard *ss, const TActorContext &ctx) {
+ for (auto& entry : Barriers) {
+ TOperationId opId;
+ TString name;
+ std::tie(opId, name) = entry;
+
+ auto it = ss->Operations.find(opId.GetTxId());
+ if (it != ss->Operations.end()) {
+ auto& operation = it->second;
+ operation->RegisterBarrier(opId.GetSubTxId(), name);
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Set barrier"
+ << ", OperationId: " << opId
+ << ", name: " << name
+ << ", done: " << operation->DoneParts.size()
+ << ", blocked: " << operation->Barriers.at(name).size()
+ << ", parts count: " << operation->Parts.size());
+ }
+ }
+}
+
+void TSideEffects::DoCheckBarriers(TSchemeShard *ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx) {
+ TSet<TTxId> touchedOperations;
+
+ for (auto& entry : Barriers) {
+ TOperationId opId;
+ TString name;
+ std::tie(opId, name) = entry;
+
+ touchedOperations.insert(opId.GetTxId());
+ }
+
+ for (auto& opId : DoneOperations) {
+ touchedOperations.insert(opId.GetTxId());
+ }
+
+ for (auto& txId : touchedOperations) {
+ auto it = ss->Operations.find(txId);
+
+ if (it == ss->Operations.end()) {
+ continue;
+ }
+
+ auto& operation = it->second;
+
+ if (!operation->HasBarrier()) {
+ continue;
+ }
+
+ if (!operation->IsDoneBarrier()) {
+ continue;
+ }
+
+ auto name = operation->Barriers.begin()->first;
+ const auto& blockedParts = operation->Barriers.begin()->second;
+
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "All parts have reached barrier"
+ << ", tx: " << txId
+ << ", done: " << operation->DoneParts.size()
+ << ", blocked: " << blockedParts.size());
+
+ TMemoryChanges memChanges;
+ TStorageChanges dbChanges;
+ TOperationContext context{ss, txc, ctx, *this, memChanges, dbChanges};
+
+ THolder<TEvPrivate::TEvCompleteBarrier> msg = MakeHolder<TEvPrivate::TEvCompleteBarrier>(txId, name);
+ TEvPrivate::TEvCompleteBarrier::TPtr personalEv = (TEventHandle<TEvPrivate::TEvCompleteBarrier>*) new IEventHandle(
context.SS->SelfId(), context.SS->SelfId(), msg.Release());
-
- for (auto& partId: blockedParts) {
- operation->Parts.at(partId)->HandleReply(personalEv, context);
- }
-
- operation->DropBarrier(name);
- }
-}
-
-}
-}
+
+ for (auto& partId: blockedParts) {
+ operation->Parts.at(partId)->HandleReply(personalEv, context);
+ }
+
+ operation->DropBarrier(name);
+ }
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_side_effects.h b/ydb/core/tx/schemeshard/schemeshard__operation_side_effects.h
index 1649bce510f..b5c75b35a68 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_side_effects.h
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_side_effects.h
@@ -1,174 +1,174 @@
-#pragma once
-
-#include "schemeshard_identificators.h"
-
+#pragma once
+
+#include "schemeshard_identificators.h"
+
#include <ydb/core/tablet/pipe_tracker.h>
#include <ydb/core/tablet_flat/tablet_flat_executor.h>
-
-#include <util/generic/ptr.h>
-#include <util/generic/map.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-class TSchemeShard;
-
-class TSideEffects: public TSimpleRefCount<TSideEffects> {
-public:
- using TPublications = THashMap<TTxId, TDeque<TPathId>>;
-
-private:
- using TCoordinatorAck = std::tuple<TActorId, TStepId, TTxId>;
- using TMediatorAck = std::tuple<TActorId, TStepId>;
- using TSendRec = std::tuple<TActorId, TAutoPtr<::NActors::IEventBase>, ui64, ui32>;
- using TBindMsgRec = std::tuple<TOperationId, TTabletId, TPipeMessageId, TAutoPtr<::NActors::IEventBase>>;
- using TBindMsgAck = std::tuple<TOperationId, TTabletId, TPipeMessageId>;
- using TNotifyRec = std::tuple<TActorId, TTxId>;
- using TProposeRec = std::tuple<TOperationId, TPathId, TStepId>;
- using TProposeShards = std::tuple<TOperationId, TTabletId>;
- using TRelationByTabletId = std::tuple<TOperationId, TTabletId>;
- using TRelationByShardIdx = std::tuple<TOperationId, TShardIdx>;
- using TDependence = std::tuple<TTxId, TTxId>;
- using TPathStateRec = std::tuple<TOperationId, TPathId, NKikimrSchemeOp::EPathState>;
+
+#include <util/generic/ptr.h>
+#include <util/generic/map.h>
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+class TSchemeShard;
+
+class TSideEffects: public TSimpleRefCount<TSideEffects> {
+public:
+ using TPublications = THashMap<TTxId, TDeque<TPathId>>;
+
+private:
+ using TCoordinatorAck = std::tuple<TActorId, TStepId, TTxId>;
+ using TMediatorAck = std::tuple<TActorId, TStepId>;
+ using TSendRec = std::tuple<TActorId, TAutoPtr<::NActors::IEventBase>, ui64, ui32>;
+ using TBindMsgRec = std::tuple<TOperationId, TTabletId, TPipeMessageId, TAutoPtr<::NActors::IEventBase>>;
+ using TBindMsgAck = std::tuple<TOperationId, TTabletId, TPipeMessageId>;
+ using TNotifyRec = std::tuple<TActorId, TTxId>;
+ using TProposeRec = std::tuple<TOperationId, TPathId, TStepId>;
+ using TProposeShards = std::tuple<TOperationId, TTabletId>;
+ using TRelationByTabletId = std::tuple<TOperationId, TTabletId>;
+ using TRelationByShardIdx = std::tuple<TOperationId, TShardIdx>;
+ using TDependence = std::tuple<TTxId, TTxId>;
+ using TPathStateRec = std::tuple<TOperationId, TPathId, NKikimrSchemeOp::EPathState>;
using TWaitShardCreated = std::tuple<TShardIdx, TOperationId>;
using TActivateShardCreated = std::tuple<TShardIdx, TTxId>;
- using TWaitPublication = std::tuple<TOperationId, TPathId>;
- using TBarrierRec = std::tuple<TOperationId, TString>;
-
- THashSet<TTxId> ActivationOps;
- THashSet<TOperationId> ActivationParts;
-
- TDeque<TCoordinatorAck> CoordinatorAcks;
- TDeque<TMediatorAck> MediatorAcks;
- TDeque<TSendRec> Messages;
- TDeque<TBindMsgRec> BindedMessages;
- TDeque<TBindMsgAck> BindedMessageAcks;
- TPublications PublishPaths;
- TPublications RePublishPaths; // only for UpgradeSubDomain
- TDeque<TProposeRec> CoordinatorProposes;
- TDeque<TProposeShards> CoordinatorProposesShards;
- TPendingPipeTrackerCommands PendingPipeTrackerCommands;
- TDeque<TOperationId> RelationsByTabletsFromOperation;
- TDeque<TRelationByTabletId> RelationsByTabletId;
- TDeque<TRelationByShardIdx> RelationsByShardIdx;
- THashSet<TOperationId> ReadyToNotifyOperations;
- THashSet<TOperationId> DoneOperations;
- THashSet<TTxId> DoneTransactions;
- THashSet<TShardIdx> ToDeleteShards;
- TDeque<TDependence> Dependencies;
- TDeque<TPathStateRec> ReleasePathStateRecs;
- THashSet<TPathId> TenantsToUpdate;
- TDeque<TIndexBuildId> IndexToProgress;
+ using TWaitPublication = std::tuple<TOperationId, TPathId>;
+ using TBarrierRec = std::tuple<TOperationId, TString>;
+
+ THashSet<TTxId> ActivationOps;
+ THashSet<TOperationId> ActivationParts;
+
+ TDeque<TCoordinatorAck> CoordinatorAcks;
+ TDeque<TMediatorAck> MediatorAcks;
+ TDeque<TSendRec> Messages;
+ TDeque<TBindMsgRec> BindedMessages;
+ TDeque<TBindMsgAck> BindedMessageAcks;
+ TPublications PublishPaths;
+ TPublications RePublishPaths; // only for UpgradeSubDomain
+ TDeque<TProposeRec> CoordinatorProposes;
+ TDeque<TProposeShards> CoordinatorProposesShards;
+ TPendingPipeTrackerCommands PendingPipeTrackerCommands;
+ TDeque<TOperationId> RelationsByTabletsFromOperation;
+ TDeque<TRelationByTabletId> RelationsByTabletId;
+ TDeque<TRelationByShardIdx> RelationsByShardIdx;
+ THashSet<TOperationId> ReadyToNotifyOperations;
+ THashSet<TOperationId> DoneOperations;
+ THashSet<TTxId> DoneTransactions;
+ THashSet<TShardIdx> ToDeleteShards;
+ TDeque<TDependence> Dependencies;
+ TDeque<TPathStateRec> ReleasePathStateRecs;
+ THashSet<TPathId> TenantsToUpdate;
+ TDeque<TIndexBuildId> IndexToProgress;
TVector<TWaitShardCreated> PendingWaitShardCreated;
TVector<TActivateShardCreated> PendingActivateShardCreated;
- TDeque<TWaitPublication> WaitPublications;
- TDeque<TBarrierRec> Barriers;
-
-public:
- using TPtr = TIntrusivePtr<TSideEffects>;
- ~TSideEffects() = default;
-
- void ProposeToCoordinator(TOperationId opId, TPathId pathId, TStepId minStep);
- template <class TContainer>
- void ProposeToCoordinator(TOperationId opId, TPathId pathId, TStepId minStep, TContainer txShards) {
- ProposeToCoordinator(opId, pathId, minStep);
-
- for(auto& shard: txShards) {
- CoordinatorProposesShards.push_back(TProposeShards(opId, shard));
- }
- }
- void CoordinatorAck(TActorId coordiantor, TStepId stepId, TTxId txId);
- void MediatorAck(TActorId mediator, TStepId stepId);
-
- void UpdateTenant(TPathId pathIds);
- void UpdateTenants(THashSet<TPathId>&& pathIds);
-
- void PublishToSchemeBoard(TOperationId opId, TPathId pathId);
- void RePublishToSchemeBoard(TOperationId opId, TPathId pathId);
-
- void Send(TActorId dst, ::NActors::IEventBase* message, ui64 cookie = 0, ui32 flags = 0);
- template <typename TEvent>
- void Send(TActorId dst, THolder<TEvent> message, ui64 cookie = 0, ui32 flags = 0) {
- Send(dst, static_cast<::NActors::IEventBase*>(message.Release()), cookie, flags);
- }
- void BindMsgToPipe(TOperationId opId, TTabletId dst, TPathId pathId, TAutoPtr<::NActors::IEventBase> message);
- void BindMsgToPipe(TOperationId opId, TTabletId dst, TShardIdx shardIdx, TAutoPtr<::NActors::IEventBase> message);
- void BindMsgToPipe(TOperationId opId, TTabletId dst, TPipeMessageId cookie, TAutoPtr<::NActors::IEventBase> message);
-
- void UnbindMsgFromPipe(TOperationId opId, TTabletId dst, TPathId pathId);
- void UnbindMsgFromPipe(TOperationId opId, TTabletId dst, TShardIdx shardIdx);
- void UnbindMsgFromPipe(TOperationId opId, TTabletId dst, TPipeMessageId cookie);
-
- void RouteByTabletsFromOperation(TOperationId opId);
- void RouteByTablet(TOperationId opId, TTabletId dst);
- void RouteByShardIdx(TOperationId opId, TShardIdx shardIdx);
-
- void ReleasePathState(TOperationId opId, TPathId pathId, NKikimrSchemeOp::EPathState state);
-
- void DoneOperation(TOperationId opId);
- void ReadyToNotify(TOperationId opId);
-
- void Dependence(TTxId parend, TTxId child);
- void ActivateTx(TOperationId opId);
- void ActivateOperation(TTxId txId);
-
+ TDeque<TWaitPublication> WaitPublications;
+ TDeque<TBarrierRec> Barriers;
+
+public:
+ using TPtr = TIntrusivePtr<TSideEffects>;
+ ~TSideEffects() = default;
+
+ void ProposeToCoordinator(TOperationId opId, TPathId pathId, TStepId minStep);
+ template <class TContainer>
+ void ProposeToCoordinator(TOperationId opId, TPathId pathId, TStepId minStep, TContainer txShards) {
+ ProposeToCoordinator(opId, pathId, minStep);
+
+ for(auto& shard: txShards) {
+ CoordinatorProposesShards.push_back(TProposeShards(opId, shard));
+ }
+ }
+ void CoordinatorAck(TActorId coordiantor, TStepId stepId, TTxId txId);
+ void MediatorAck(TActorId mediator, TStepId stepId);
+
+ void UpdateTenant(TPathId pathIds);
+ void UpdateTenants(THashSet<TPathId>&& pathIds);
+
+ void PublishToSchemeBoard(TOperationId opId, TPathId pathId);
+ void RePublishToSchemeBoard(TOperationId opId, TPathId pathId);
+
+ void Send(TActorId dst, ::NActors::IEventBase* message, ui64 cookie = 0, ui32 flags = 0);
+ template <typename TEvent>
+ void Send(TActorId dst, THolder<TEvent> message, ui64 cookie = 0, ui32 flags = 0) {
+ Send(dst, static_cast<::NActors::IEventBase*>(message.Release()), cookie, flags);
+ }
+ void BindMsgToPipe(TOperationId opId, TTabletId dst, TPathId pathId, TAutoPtr<::NActors::IEventBase> message);
+ void BindMsgToPipe(TOperationId opId, TTabletId dst, TShardIdx shardIdx, TAutoPtr<::NActors::IEventBase> message);
+ void BindMsgToPipe(TOperationId opId, TTabletId dst, TPipeMessageId cookie, TAutoPtr<::NActors::IEventBase> message);
+
+ void UnbindMsgFromPipe(TOperationId opId, TTabletId dst, TPathId pathId);
+ void UnbindMsgFromPipe(TOperationId opId, TTabletId dst, TShardIdx shardIdx);
+ void UnbindMsgFromPipe(TOperationId opId, TTabletId dst, TPipeMessageId cookie);
+
+ void RouteByTabletsFromOperation(TOperationId opId);
+ void RouteByTablet(TOperationId opId, TTabletId dst);
+ void RouteByShardIdx(TOperationId opId, TShardIdx shardIdx);
+
+ void ReleasePathState(TOperationId opId, TPathId pathId, NKikimrSchemeOp::EPathState state);
+
+ void DoneOperation(TOperationId opId);
+ void ReadyToNotify(TOperationId opId);
+
+ void Dependence(TTxId parend, TTxId child);
+ void ActivateTx(TOperationId opId);
+ void ActivateOperation(TTxId txId);
+
void WaitShardCreated(TShardIdx idx, TOperationId opId);
void ActivateShardCreated(TShardIdx idx, TTxId txId);
- void PublishAndWaitPublication(TOperationId opId, TPathId pathId);
-
- void DeleteShard(TShardIdx idx);
-
- void ToProgress(TIndexBuildId id);
-
- void ApplyOnExecute(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx);
- void ApplyOnComplete(TSchemeShard* ss, const TActorContext &ctx);
- TPublications ExtractPublicationsToSchemeBoard();
-
- void Barrier(TOperationId opId, TString barrierName);
-
-private:
- bool CheckDecouplingProposes(TString& errExpl) const;
- void ExpandCoordinatorProposes(TSchemeShard* ss, const TActorContext& ctx);
- void DoCoordinatorAck(TSchemeShard* ss, const TActorContext& ctx);
- void DoMediatorsAck(TSchemeShard* ss, const TActorContext& ctx);
-
- void DoUpdateTenant(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext& ctx);
-
- void DoPersistPublishPaths(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx);
- void DoPublishToSchemeBoard(TSchemeShard* ss, const TActorContext& ctx);
-
- void DoSend(TSchemeShard* ss, const TActorContext& ctx);
- void DoBindMsg(TSchemeShard* ss, const TActorContext& ctx);
- void DoBindMsgAcks(TSchemeShard* ss, const TActorContext& ctx);
-
- void AttachOperationToPipe(TOperationId opId, TTabletId dst);
- void DetachOperationFromPipe(TOperationId opId, TTabletId dst);
-
- void DoRegisterRelations(TSchemeShard* ss, const TActorContext& ctx);
- void DoTriggerDeleteShards(TSchemeShard* ss, const TActorContext &ctx);
-
- void DoReleasePathState(TSchemeShard* ss, const TActorContext &ctx);
- void DoDoneParts(TSchemeShard* ss, const TActorContext& ctx);
- void DoDoneTransactions(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext& ctx);
- void DoReadyToNotify(TSchemeShard* ss, const TActorContext& ctx);
-
- void DoPersistDependencies(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx);
- void DoActivateOps(TSchemeShard* ss, const TActorContext& ctx);
-
- void DoPersistDeleteShards(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx);
-
- void ResumeLongOps(TSchemeShard* ss, const TActorContext& ctx);
- void SetupRoutingLongOps(TSchemeShard* ss, const TActorContext& ctx);
-
- void DoWaitShardCreated(TSchemeShard* ss, const TActorContext& ctx);
- void DoActivateShardCreated(TSchemeShard* ss, const TActorContext& ctx);
-
- void DoWaitPublication(TSchemeShard* ss, const TActorContext& ctx);
-
- void DoSetBarriers(TSchemeShard* ss, const TActorContext& ctx);
- void DoCheckBarriers(TSchemeShard *ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx);
-};
-
-}
-}
+ void PublishAndWaitPublication(TOperationId opId, TPathId pathId);
+
+ void DeleteShard(TShardIdx idx);
+
+ void ToProgress(TIndexBuildId id);
+
+ void ApplyOnExecute(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx);
+ void ApplyOnComplete(TSchemeShard* ss, const TActorContext &ctx);
+ TPublications ExtractPublicationsToSchemeBoard();
+
+ void Barrier(TOperationId opId, TString barrierName);
+
+private:
+ bool CheckDecouplingProposes(TString& errExpl) const;
+ void ExpandCoordinatorProposes(TSchemeShard* ss, const TActorContext& ctx);
+ void DoCoordinatorAck(TSchemeShard* ss, const TActorContext& ctx);
+ void DoMediatorsAck(TSchemeShard* ss, const TActorContext& ctx);
+
+ void DoUpdateTenant(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext& ctx);
+
+ void DoPersistPublishPaths(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx);
+ void DoPublishToSchemeBoard(TSchemeShard* ss, const TActorContext& ctx);
+
+ void DoSend(TSchemeShard* ss, const TActorContext& ctx);
+ void DoBindMsg(TSchemeShard* ss, const TActorContext& ctx);
+ void DoBindMsgAcks(TSchemeShard* ss, const TActorContext& ctx);
+
+ void AttachOperationToPipe(TOperationId opId, TTabletId dst);
+ void DetachOperationFromPipe(TOperationId opId, TTabletId dst);
+
+ void DoRegisterRelations(TSchemeShard* ss, const TActorContext& ctx);
+ void DoTriggerDeleteShards(TSchemeShard* ss, const TActorContext &ctx);
+
+ void DoReleasePathState(TSchemeShard* ss, const TActorContext &ctx);
+ void DoDoneParts(TSchemeShard* ss, const TActorContext& ctx);
+ void DoDoneTransactions(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext& ctx);
+ void DoReadyToNotify(TSchemeShard* ss, const TActorContext& ctx);
+
+ void DoPersistDependencies(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx);
+ void DoActivateOps(TSchemeShard* ss, const TActorContext& ctx);
+
+ void DoPersistDeleteShards(TSchemeShard* ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx);
+
+ void ResumeLongOps(TSchemeShard* ss, const TActorContext& ctx);
+ void SetupRoutingLongOps(TSchemeShard* ss, const TActorContext& ctx);
+
+ void DoWaitShardCreated(TSchemeShard* ss, const TActorContext& ctx);
+ void DoActivateShardCreated(TSchemeShard* ss, const TActorContext& ctx);
+
+ void DoWaitPublication(TSchemeShard* ss, const TActorContext& ctx);
+
+ void DoSetBarriers(TSchemeShard* ss, const TActorContext& ctx);
+ void DoCheckBarriers(TSchemeShard *ss, NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx);
+};
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_split_merge.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_split_merge.cpp
index dba58b3ae6d..645d7f37e19 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_split_merge.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_split_merge.cpp
@@ -1,121 +1,121 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TConfigureDestination: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TConfigureDestination: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TSplitMerge TConfigureDestination"
- << " operationId#" << OperationId;
- }
-
-public:
- TConfigureDestination(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvInitSplitMergeDestinationAck::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvInitSplitMergeDestinationAck"
- << ", operationId: " << OperationId
- << ", at schemeshard: " << ssId
- << " message# " << ev->Get()->Record.ShortDebugString());
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxSplitTablePartition || txState->TxType == TTxState::TxMergeTablePartition);
- Y_VERIFY(txState->State == TTxState::ConfigureParts);
-
- TTabletId tabletId = TTabletId(ev->Get()->Record.GetTabletId());
+ return TStringBuilder()
+ << "TSplitMerge TConfigureDestination"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TConfigureDestination(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvInitSplitMergeDestinationAck::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvInitSplitMergeDestinationAck"
+ << ", operationId: " << OperationId
+ << ", at schemeshard: " << ssId
+ << " message# " << ev->Get()->Record.ShortDebugString());
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxSplitTablePartition || txState->TxType == TTxState::TxMergeTablePartition);
+ Y_VERIFY(txState->State == TTxState::ConfigureParts);
+
+ TTabletId tabletId = TTabletId(ev->Get()->Record.GetTabletId());
TShardIdx idx = context.SS->MustGetShardIdx(tabletId);
if (!idx) {
- LOG_ERROR(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ LOG_ERROR(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Tablet %" PRIu64 " is not known in TxId %" PRIu64,
- tabletId, OperationId.GetTxId());
- return false;
- }
-
- if (!context.SS->ShardInfos.contains(idx)) {
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " Got InitSplitMergeDestinationAck"
- << " for unknown shard idx " << idx
- << " tabletId " << tabletId);
- return false;
- }
-
- txState->ShardsInProgress.erase(idx);
-
- context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, idx);
-
- // If all dst datashards have been initialized
- if (txState->ShardsInProgress.empty()) {
- context.SS->ChangeTxState(db, OperationId, TTxState::TransferData);
- context.OnComplete.ActivateTx(OperationId);
- return true;
- }
-
- return false;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TSplitMerge TConfigureDestination ProgressState"
- << ", operationId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->TxInFlight.FindPtr(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxSplitTablePartition || txState->TxType == TTxState::TxMergeTablePartition);
- Y_VERIFY(txState->State == TTxState::ConfigureParts);
-
- txState->ClearShardsInProgress();
-
+ tabletId, OperationId.GetTxId());
+ return false;
+ }
+
+ if (!context.SS->ShardInfos.contains(idx)) {
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " Got InitSplitMergeDestinationAck"
+ << " for unknown shard idx " << idx
+ << " tabletId " << tabletId);
+ return false;
+ }
+
+ txState->ShardsInProgress.erase(idx);
+
+ context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, idx);
+
+ // If all dst datashards have been initialized
+ if (txState->ShardsInProgress.empty()) {
+ context.SS->ChangeTxState(db, OperationId, TTxState::TransferData);
+ context.OnComplete.ActivateTx(OperationId);
+ return true;
+ }
+
+ return false;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TSplitMerge TConfigureDestination ProgressState"
+ << ", operationId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->TxInFlight.FindPtr(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxSplitTablePartition || txState->TxType == TTxState::TxMergeTablePartition);
+ Y_VERIFY(txState->State == TTxState::ConfigureParts);
+
+ txState->ClearShardsInProgress();
+
// A helper hash map translating tablet id to destination range index
- THashMap<TTabletId, ui32> dstTabletToRangeIdx;
+ THashMap<TTabletId, ui32> dstTabletToRangeIdx;
- auto getDstRangeIdx = [&dstTabletToRangeIdx] (TTabletId tabletId) -> ui32 {
+ auto getDstRangeIdx = [&dstTabletToRangeIdx] (TTabletId tabletId) -> ui32 {
auto it = dstTabletToRangeIdx.find(tabletId);
- Y_VERIFY_S(it != dstTabletToRangeIdx.end(),
- "Cannot find range info for destination tablet " << tabletId);
+ Y_VERIFY_S(it != dstTabletToRangeIdx.end(),
+ "Cannot find range info for destination tablet " << tabletId);
return it->second;
};
- // Fill tablet ids in split description
- NKikimrTxDataShard::TSplitMergeDescription& splitDescr = *txState->SplitDescription;
- for (ui32 i = 0; i < splitDescr.DestinationRangesSize(); ++i) {
- auto* rangeDescr = splitDescr.MutableDestinationRanges()->Mutable(i);
- auto shardIdx = context.SS->MakeLocalId(TLocalShardIdx(rangeDescr->GetShardIdx()));
- auto datashardId = context.SS->ShardInfos[shardIdx].TabletID;
- rangeDescr->SetTabletID(ui64(datashardId));
+ // Fill tablet ids in split description
+ NKikimrTxDataShard::TSplitMergeDescription& splitDescr = *txState->SplitDescription;
+ for (ui32 i = 0; i < splitDescr.DestinationRangesSize(); ++i) {
+ auto* rangeDescr = splitDescr.MutableDestinationRanges()->Mutable(i);
+ auto shardIdx = context.SS->MakeLocalId(TLocalShardIdx(rangeDescr->GetShardIdx()));
+ auto datashardId = context.SS->ShardInfos[shardIdx].TabletID;
+ rangeDescr->SetTabletID(ui64(datashardId));
dstTabletToRangeIdx[datashardId] = i;
- }
-
- // Save updated split description
- TString extraData;
- bool serializeRes = txState->SplitDescription->SerializeToString(&extraData);
- Y_VERIFY(serializeRes);
- NIceDb::TNiceDb db(context.Txc.DB);
- db.Table<Schema::TxInFlightV2>().Key(OperationId.GetTxId(), OperationId.GetSubTxId()).Update(
- NIceDb::TUpdate<Schema::TxInFlightV2::ExtraBytes>(extraData));
-
+ }
+
+ // Save updated split description
+ TString extraData;
+ bool serializeRes = txState->SplitDescription->SerializeToString(&extraData);
+ Y_VERIFY(serializeRes);
+ NIceDb::TNiceDb db(context.Txc.DB);
+ db.Table<Schema::TxInFlightV2>().Key(OperationId.GetTxId(), OperationId.GetSubTxId()).Update(
+ NIceDb::TUpdate<Schema::TxInFlightV2::ExtraBytes>(extraData));
+
const auto tableInfo = context.SS->Tables.FindPtr(txState->TargetPathId);
Y_VERIFY(tableInfo);
@@ -123,21 +123,21 @@ public:
const ui64 subDomainPathId = context.SS->ResolveDomainId(txState->TargetPathId).LocalPathId;
- for (const auto& shard: txState->Shards) {
- // Skip src shard
- if (shard.Operation != TTxState::CreateParts) {
- continue;
- }
-
- TTabletId datashardId = context.SS->ShardInfos[shard.Idx].TabletID;
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Initializing scheme "
- << "on dst datashard: " << datashardId
- << " splitOp: " << OperationId
- << " alterVersion: " << alterVersion
- << " at tablet: " << context.SS->TabletID());
-
+ for (const auto& shard: txState->Shards) {
+ // Skip src shard
+ if (shard.Operation != TTxState::CreateParts) {
+ continue;
+ }
+
+ TTabletId datashardId = context.SS->ShardInfos[shard.Idx].TabletID;
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Initializing scheme "
+ << "on dst datashard: " << datashardId
+ << " splitOp: " << OperationId
+ << " alterVersion: " << alterVersion
+ << " at tablet: " << context.SS->TabletID());
+
const ui32 rangeIdx = getDstRangeIdx(datashardId);
const auto& rangeDescr = splitDescr.GetDestinationRanges(rangeIdx);
@@ -147,13 +147,13 @@ public:
splitDescForShard.MutableSourceRanges()->CopyFrom(txState->SplitDescription->GetSourceRanges());
splitDescForShard.AddDestinationRanges()->CopyFrom(rangeDescr);
- Y_VERIFY(txState->SplitDescription);
- THolder<TEvDataShard::TEvInitSplitMergeDestination> event =
+ Y_VERIFY(txState->SplitDescription);
+ THolder<TEvDataShard::TEvInitSplitMergeDestination> event =
THolder(new TEvDataShard::TEvInitSplitMergeDestination(ui64(OperationId.GetTxId()), context.SS->TabletID(),
subDomainPathId,
splitDescForShard,
context.SS->SelectProcessingPrarams(txState->TargetPathId)));
-
+
// Add a new-style CreateTable with correct per-shard settings
// WARNING: legacy datashard will ignore this and use the schema
// received from some source datashard instead, so schemas must not
@@ -170,115 +170,115 @@ public:
true, false);
context.SS->FillTableSchemaVersion(alterVersion, tableDesc);
- context.OnComplete.BindMsgToPipe(OperationId, datashardId, shard.Idx, event.Release());
- }
-
- txState->UpdateShardsInProgress(TTxState::CreateParts);
- return false;
- }
-};
-
-
-class TTranserData: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ context.OnComplete.BindMsgToPipe(OperationId, datashardId, shard.Idx, event.Release());
+ }
+
+ txState->UpdateShardsInProgress(TTxState::CreateParts);
+ return false;
+ }
+};
+
+
+class TTranserData: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TSplitMerge TTranserData"
- << " operationId#" << OperationId;
- }
-
-public:
- TTranserData(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvInitSplitMergeDestinationAck::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvSplitAck::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvSplitAck"
- << ", at schemeshard: " << ssId
- << ", message: " << ev->Get()->Record.ShortDebugString());
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxSplitTablePartition || txState->TxType == TTxState::TxMergeTablePartition);
- Y_VERIFY(txState->State == TTxState::TransferData);
-
- auto tabletId = TTabletId(ev->Get()->Record.GetTabletId());
+ return TStringBuilder()
+ << "TSplitMerge TTranserData"
+ << " operationId#" << OperationId;
+ }
+
+public:
+ TTranserData(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvInitSplitMergeDestinationAck::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvSplitAck::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvSplitAck"
+ << ", at schemeshard: " << ssId
+ << ", message: " << ev->Get()->Record.ShortDebugString());
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxSplitTablePartition || txState->TxType == TTxState::TxMergeTablePartition);
+ Y_VERIFY(txState->State == TTxState::TransferData);
+
+ auto tabletId = TTabletId(ev->Get()->Record.GetTabletId());
auto srcShardIdx = context.SS->GetShardIdx(tabletId);
if (!srcShardIdx) {
- LOG_ERROR(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ LOG_ERROR(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Tablet %" PRIu64 " is not known in TxId %" PRIu64,
- tabletId, OperationId.GetTxId());
- return false;
- }
-
- if (!context.SS->ShardInfos.contains(srcShardIdx)) {
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " Got SplitAck for unknown shard"
- << " idx " << srcShardIdx
- << " tabletId " << tabletId);
- return false;
- }
-
- txState->ShardsInProgress.erase(srcShardIdx);
- context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, srcShardIdx);
-
- if (!txState->ShardsInProgress.empty()) {
- // TODO: verify that we only wait for Src shards
- return false;
- }
-
- // Switch table partitioning: exclude src shard and include all dst shards
- TPathId tableId = txState->TargetPathId;
- TTableInfo::TPtr tableInfo = *context.SS->Tables.FindPtr(tableId);
- Y_VERIFY(tableInfo);
-
- // Replace all Src datashard(s) with Dst datashard(s)
- TVector<TTableShardInfo> newPartitioning;
- THashSet<TShardIdx> allSrcShardIdxs;
- for (const auto& txShard : txState->Shards) {
- if (txShard.Operation == TTxState::TransferData)
- allSrcShardIdxs.insert(txShard.Idx);
- }
- bool dstAdded = false;
- for (const auto& shard : tableInfo->GetPartitions()) {
- if (allSrcShardIdxs.contains(shard.ShardIdx)) {
- if (dstAdded)
- continue;
- for (const auto& txShard : txState->Shards) {
- if (txShard.Operation != TTxState::CreateParts)
- continue;
-
- // TODO: make sure dst are sorted by range end
- Y_VERIFY(context.SS->ShardInfos.contains(txShard.Idx));
- TTableShardInfo dst(txShard.Idx, txShard.RangeEnd);
- newPartitioning.push_back(dst);
- }
- dstAdded = true;
- } else {
- newPartitioning.push_back(shard);
- }
- }
-
+ tabletId, OperationId.GetTxId());
+ return false;
+ }
+
+ if (!context.SS->ShardInfos.contains(srcShardIdx)) {
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " Got SplitAck for unknown shard"
+ << " idx " << srcShardIdx
+ << " tabletId " << tabletId);
+ return false;
+ }
+
+ txState->ShardsInProgress.erase(srcShardIdx);
+ context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, srcShardIdx);
+
+ if (!txState->ShardsInProgress.empty()) {
+ // TODO: verify that we only wait for Src shards
+ return false;
+ }
+
+ // Switch table partitioning: exclude src shard and include all dst shards
+ TPathId tableId = txState->TargetPathId;
+ TTableInfo::TPtr tableInfo = *context.SS->Tables.FindPtr(tableId);
+ Y_VERIFY(tableInfo);
+
+ // Replace all Src datashard(s) with Dst datashard(s)
+ TVector<TTableShardInfo> newPartitioning;
+ THashSet<TShardIdx> allSrcShardIdxs;
+ for (const auto& txShard : txState->Shards) {
+ if (txShard.Operation == TTxState::TransferData)
+ allSrcShardIdxs.insert(txShard.Idx);
+ }
+ bool dstAdded = false;
+ for (const auto& shard : tableInfo->GetPartitions()) {
+ if (allSrcShardIdxs.contains(shard.ShardIdx)) {
+ if (dstAdded)
+ continue;
+ for (const auto& txShard : txState->Shards) {
+ if (txShard.Operation != TTxState::CreateParts)
+ continue;
+
+ // TODO: make sure dst are sorted by range end
+ Y_VERIFY(context.SS->ShardInfos.contains(txShard.Idx));
+ TTableShardInfo dst(txShard.Idx, txShard.RangeEnd);
+ newPartitioning.push_back(dst);
+ }
+ dstAdded = true;
+ } else {
+ newPartitioning.push_back(shard);
+ }
+ }
+
auto oldAggrStats = tableInfo->GetStats().Aggregated;
- // Delete the whole old partitioning and persist the whole new partitionig as the indexes have changed
- context.SS->DeleteTablePartitioning(db, tableId, tableInfo);
+ // Delete the whole old partitioning and persist the whole new partitionig as the indexes have changed
+ context.SS->DeleteTablePartitioning(db, tableId, tableInfo);
context.SS->SetPartitioning(tableId, tableInfo, std::move(newPartitioning));
- context.SS->PersistTablePartitioning(db, tableId, tableInfo);
+ context.SS->PersistTablePartitioning(db, tableId, tableInfo);
context.SS->PersistTablePartitionStats(db, tableId, tableInfo);
- context.SS->TabletCounters->Simple()[COUNTER_TABLE_SHARD_ACTIVE_COUNT].Sub(allSrcShardIdxs.size());
- context.SS->TabletCounters->Simple()[COUNTER_TABLE_SHARD_INACTIVE_COUNT].Add(allSrcShardIdxs.size());
-
- if (!tableInfo->IsBackup && !tableInfo->IsShardsStatsDetached()) {
+ context.SS->TabletCounters->Simple()[COUNTER_TABLE_SHARD_ACTIVE_COUNT].Sub(allSrcShardIdxs.size());
+ context.SS->TabletCounters->Simple()[COUNTER_TABLE_SHARD_INACTIVE_COUNT].Add(allSrcShardIdxs.size());
+
+ if (!tableInfo->IsBackup && !tableInfo->IsShardsStatsDetached()) {
auto newAggrStats = tableInfo->GetStats().Aggregated;
auto subDomainId = context.SS->ResolveDomainId(tableId);
auto subDomainInfo = context.SS->ResolveDomainInfo(tableId);
@@ -289,602 +289,602 @@ public:
}
}
- Y_VERIFY(txState->ShardsInProgress.empty(), "All shards should have already completed their steps");
-
- context.SS->ChangeTxState(db, OperationId, TTxState::NotifyPartitioningChanged);
- context.OnComplete.ActivateTx(OperationId);
-
+ Y_VERIFY(txState->ShardsInProgress.empty(), "All shards should have already completed their steps");
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::NotifyPartitioningChanged);
+ context.OnComplete.ActivateTx(OperationId);
+
context.OnComplete.PublishToSchemeBoard(OperationId, tableId);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->TxInFlight.FindPtr(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxSplitTablePartition || txState->TxType == TTxState::TxMergeTablePartition);
- Y_VERIFY(txState->State == TTxState::TransferData);
-
- txState->ClearShardsInProgress();
-
- for (const auto& shard : txState->Shards) {
- // Skip Dst shards
- if (shard.Operation != TTxState::TransferData)
- continue;
-
- auto datashardId = context.SS->ShardInfos[shard.Idx].TabletID;
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " Starting split on src datashard " << datashardId
- << " splitOpId# " << OperationId
- << " at tablet " << context.SS->TabletID());
-
- THolder<TEvDataShard::TEvSplit> event =
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->TxInFlight.FindPtr(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxSplitTablePartition || txState->TxType == TTxState::TxMergeTablePartition);
+ Y_VERIFY(txState->State == TTxState::TransferData);
+
+ txState->ClearShardsInProgress();
+
+ for (const auto& shard : txState->Shards) {
+ // Skip Dst shards
+ if (shard.Operation != TTxState::TransferData)
+ continue;
+
+ auto datashardId = context.SS->ShardInfos[shard.Idx].TabletID;
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " Starting split on src datashard " << datashardId
+ << " splitOpId# " << OperationId
+ << " at tablet " << context.SS->TabletID());
+
+ THolder<TEvDataShard::TEvSplit> event =
THolder(new TEvDataShard::TEvSplit(ui64(OperationId.GetTxId())));
-
- Y_VERIFY(txState->SplitDescription);
- event->Record.MutableSplitDescription()->CopyFrom(*txState->SplitDescription);
-
- context.OnComplete.BindMsgToPipe(OperationId, datashardId, shard.Idx, event.Release());
- }
-
- txState->UpdateShardsInProgress(TTxState::TransferData);
- return false;
- }
-};
-
-class TNotifySrc: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+ Y_VERIFY(txState->SplitDescription);
+ event->Record.MutableSplitDescription()->CopyFrom(*txState->SplitDescription);
+
+ context.OnComplete.BindMsgToPipe(OperationId, datashardId, shard.Idx, event.Release());
+ }
+
+ txState->UpdateShardsInProgress(TTxState::TransferData);
+ return false;
+ }
+};
+
+class TNotifySrc: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TSplitMerge TNotifySrc"
- << ", operationId: " << OperationId;
- }
-public:
- TNotifySrc(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvInitSplitMergeDestinationAck::EventType, TEvDataShard::TEvSplitAck::EventType});
- }
-
-
- bool HandleReply(TEvDataShard::TEvSplitPartitioningChangedAck::TPtr& ev, TOperationContext& context) override {
- auto ssId = context.SS->SelfTabletId();
- auto tabletId = TTabletId(ev->Get()->Record.GetTabletId());
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvSplitPartitioningChangedAck"
- << ", from datashard: " << tabletId
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxSplitTablePartition || txState->TxType == TTxState::TxMergeTablePartition);
- Y_VERIFY(txState->State == TTxState::NotifyPartitioningChanged);
-
-
+ return TStringBuilder()
+ << "TSplitMerge TNotifySrc"
+ << ", operationId: " << OperationId;
+ }
+public:
+ TNotifySrc(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType, TEvDataShard::TEvInitSplitMergeDestinationAck::EventType, TEvDataShard::TEvSplitAck::EventType});
+ }
+
+
+ bool HandleReply(TEvDataShard::TEvSplitPartitioningChangedAck::TPtr& ev, TOperationContext& context) override {
+ auto ssId = context.SS->SelfTabletId();
+ auto tabletId = TTabletId(ev->Get()->Record.GetTabletId());
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvSplitPartitioningChangedAck"
+ << ", from datashard: " << tabletId
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxSplitTablePartition || txState->TxType == TTxState::TxMergeTablePartition);
+ Y_VERIFY(txState->State == TTxState::NotifyPartitioningChanged);
+
+
auto idx = context.SS->GetShardIdx(tabletId);
if (!idx) {
- LOG_ERROR_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ LOG_ERROR_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Datashard is not listed in tablet to shard map"
- << ", datashard: " << tabletId
- << ", opId: " << OperationId);
- return false;
- }
-
- if (!txState->ShardsInProgress.contains(idx)) {
- // TODO: verify that this is a repeated event from known Src shard, not a random one
- LOG_INFO(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got SplitPartitioningChangedAck from shard %" PRIu64 " that is not a part ot Tx %" PRIu64, tabletId, OperationId.GetTxId());
- return false;
- }
-
- txState->ShardsInProgress.erase(idx);
- context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, idx);
-
- if (!txState->ShardsInProgress.empty()) {
- // TODO: verify that we only wait for Src shards
- return false;
- }
-
- context.SS->DeleteSplitOp(OperationId, *txState);
-
- context.OnComplete.DoneOperation(OperationId);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- //By this moment the partitioning scheme of the table has been switched and is visible to the users
- //We just want notify Src shard that it should reject all new transactions and return SchemeChanged error
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->TxInFlight.FindPtr(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxSplitTablePartition || txState->TxType == TTxState::TxMergeTablePartition);
- Y_VERIFY(txState->State == TTxState::NotifyPartitioningChanged);
-
-// Y_VERIFY(txState->Notify.Empty(), "All notifications for split op shouldn't have been sent before switching to NotifyPartitioningChanged state");
-
- txState->ClearShardsInProgress();
-
- bool needToNotifySrc = false;
-
- for (const auto& shard : txState->Shards) {
- // Skip Dst shards
- if (shard.Operation != TTxState::TransferData) {
- continue;
- }
-
- if (!context.SS->ShardInfos.contains(shard.Idx) || context.SS->ShardDeleter.Has(shard.Idx)) {
- LOG_DEBUG(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Src datashard idx %" PRIu64 " for splitOp# %" PRIu64 " is already deleted or is intended to at tablet %" PRIu64,
- shard.Idx, OperationId.GetTxId(), context.SS->TabletID());
- continue;
- }
-
- auto datashardId = context.SS->ShardInfos[shard.Idx].TabletID;
-
- needToNotifySrc = true;
- LOG_DEBUG(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Notify src datashard %" PRIu64 " on partitioning changed splitOp# %" PRIu64 " at tablet %" PRIu64,
- datashardId, OperationId.GetTxId(), context.SS->TabletID());
-
+ << ", datashard: " << tabletId
+ << ", opId: " << OperationId);
+ return false;
+ }
+
+ if (!txState->ShardsInProgress.contains(idx)) {
+ // TODO: verify that this is a repeated event from known Src shard, not a random one
+ LOG_INFO(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got SplitPartitioningChangedAck from shard %" PRIu64 " that is not a part ot Tx %" PRIu64, tabletId, OperationId.GetTxId());
+ return false;
+ }
+
+ txState->ShardsInProgress.erase(idx);
+ context.OnComplete.UnbindMsgFromPipe(OperationId, tabletId, idx);
+
+ if (!txState->ShardsInProgress.empty()) {
+ // TODO: verify that we only wait for Src shards
+ return false;
+ }
+
+ context.SS->DeleteSplitOp(OperationId, *txState);
+
+ context.OnComplete.DoneOperation(OperationId);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ //By this moment the partitioning scheme of the table has been switched and is visible to the users
+ //We just want notify Src shard that it should reject all new transactions and return SchemeChanged error
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->TxInFlight.FindPtr(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxSplitTablePartition || txState->TxType == TTxState::TxMergeTablePartition);
+ Y_VERIFY(txState->State == TTxState::NotifyPartitioningChanged);
+
+// Y_VERIFY(txState->Notify.Empty(), "All notifications for split op shouldn't have been sent before switching to NotifyPartitioningChanged state");
+
+ txState->ClearShardsInProgress();
+
+ bool needToNotifySrc = false;
+
+ for (const auto& shard : txState->Shards) {
+ // Skip Dst shards
+ if (shard.Operation != TTxState::TransferData) {
+ continue;
+ }
+
+ if (!context.SS->ShardInfos.contains(shard.Idx) || context.SS->ShardDeleter.Has(shard.Idx)) {
+ LOG_DEBUG(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Src datashard idx %" PRIu64 " for splitOp# %" PRIu64 " is already deleted or is intended to at tablet %" PRIu64,
+ shard.Idx, OperationId.GetTxId(), context.SS->TabletID());
+ continue;
+ }
+
+ auto datashardId = context.SS->ShardInfos[shard.Idx].TabletID;
+
+ needToNotifySrc = true;
+ LOG_DEBUG(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Notify src datashard %" PRIu64 " on partitioning changed splitOp# %" PRIu64 " at tablet %" PRIu64,
+ datashardId, OperationId.GetTxId(), context.SS->TabletID());
+
THolder<TEvDataShard::TEvSplitPartitioningChanged> event = MakeHolder<TEvDataShard::TEvSplitPartitioningChanged>(ui64(OperationId.GetTxId()));
-
- context.OnComplete.BindMsgToPipe(OperationId, datashardId, shard.Idx, event.Release());
-
- txState->ShardsInProgress.insert(shard.Idx);
- }
-
- if (!needToNotifySrc) {
- // The Src datashard could have already completed all its work, reported Offline state and got deleted
- // In this case the transaction is finished because this was the last step
- context.SS->DeleteSplitOp(OperationId, *txState);
-
- context.OnComplete.DoneOperation(OperationId);
- return true;
- }
-
- return false;
- }
-};
-
-class TSplitMerge: public TSubOperation {
-private:
+
+ context.OnComplete.BindMsgToPipe(OperationId, datashardId, shard.Idx, event.Release());
+
+ txState->ShardsInProgress.insert(shard.Idx);
+ }
+
+ if (!needToNotifySrc) {
+ // The Src datashard could have already completed all its work, reported Offline state and got deleted
+ // In this case the transaction is finished because this was the last step
+ context.SS->DeleteSplitOp(OperationId, *txState);
+
+ context.OnComplete.DoneOperation(OperationId);
+ return true;
+ }
+
+ return false;
+ }
+};
+
+class TSplitMerge: public TSubOperation {
+private:
const TOperationId OperationId;
const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::CreateParts;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::CreateParts:
- return TTxState::ConfigureParts;
- case TTxState::ConfigureParts:
- return TTxState::TransferData;
- case TTxState::TransferData:
- return TTxState::NotifyPartitioningChanged;
- case TTxState::NotifyPartitioningChanged:
- return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::CreateParts:
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::CreateParts;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::CreateParts:
+ return TTxState::ConfigureParts;
+ case TTxState::ConfigureParts:
+ return TTxState::TransferData;
+ case TTxState::TransferData:
+ return TTxState::NotifyPartitioningChanged;
+ case TTxState::NotifyPartitioningChanged:
+ return TTxState::Done;
+ default:
+ return TTxState::Invalid;
+ }
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::CreateParts:
return THolder(new TCreateParts(OperationId));
- case TTxState::ConfigureParts:
+ case TTxState::ConfigureParts:
return THolder(new TConfigureDestination(OperationId));
- case TTxState::TransferData:
+ case TTxState::TransferData:
return THolder(new TTranserData(OperationId));
- case TTxState::NotifyPartitioningChanged:
+ case TTxState::NotifyPartitioningChanged:
return THolder(new TNotifySrc(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
TSplitMerge(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
+ : OperationId(id)
, Transaction(tx)
{
}
-
- TSplitMerge(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- bool AllocateDstForMerge(
- const NKikimrSchemeOp::TSplitMergeTablePartitions& info,
- TTxId txId,
- const TPathId& pathId,
- const TVector<ui64>& srcPartitionIdxs,
- const TTableInfo::TCPtr tableInfo,
- TTxState& op,
- const TChannelsBindings& channels,
- TString& errStr,
- TOperationContext& context)
- {
- // N source shards are merged into 1
- Y_VERIFY(srcPartitionIdxs.size() > 1);
- Y_VERIFY(info.SplitBoundarySize() == 0);
-
- if (tableInfo->GetExpectedPartitionCount() + 1 - srcPartitionIdxs.size() < tableInfo->GetMinPartitionsCount()) {
- errStr = "Reached MinPartitionsCount limit: " + ToString(tableInfo->GetMinPartitionsCount());
- return false;
- }
-
- // Check that partitions for merge are consecutive in tableInfo->Partitions (e.g. don't allow to merge #1 with #3 tree and leave #2)
- for (ui32 i = 1; i < srcPartitionIdxs.size(); ++i) {
- ui64 pi = srcPartitionIdxs[i];
- ui64 piPrev = srcPartitionIdxs[i-1];
-
- if (pi != piPrev + 1) {
- auto shardIdx = tableInfo->GetPartitions()[pi].ShardIdx;
- auto shardIdxPrev = tableInfo->GetPartitions()[piPrev].ShardIdx;
-
- errStr = TStringBuilder()
- << "Partitions are not consecutive at index " << i << " : #" << piPrev << "(" << context.SS->ShardInfos[shardIdxPrev].TabletID << ")"
- << " then #" << pi << "(" << context.SS->ShardInfos[shardIdx].TabletID << ")";
- return false;
- }
- }
-
- TString firstRangeBegin;
- if (srcPartitionIdxs[0] != 0) {
- // Take the end of previous shard
- firstRangeBegin = tableInfo->GetPartitions()[srcPartitionIdxs[0]-1].EndOfRange;
- } else {
- TVector<TCell> firstKey;
- ui32 keyColCount = 0;
- for (const auto& col : tableInfo->Columns) {
- if (col.second.IsKey()) {
- ++keyColCount;
- }
- }
- // Or start from (NULL, NULL, .., NULL)
- firstKey.resize(keyColCount);
- firstRangeBegin = TSerializedCellVec::Serialize(firstKey);
- }
-
+
+ TSplitMerge(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ bool AllocateDstForMerge(
+ const NKikimrSchemeOp::TSplitMergeTablePartitions& info,
+ TTxId txId,
+ const TPathId& pathId,
+ const TVector<ui64>& srcPartitionIdxs,
+ const TTableInfo::TCPtr tableInfo,
+ TTxState& op,
+ const TChannelsBindings& channels,
+ TString& errStr,
+ TOperationContext& context)
+ {
+ // N source shards are merged into 1
+ Y_VERIFY(srcPartitionIdxs.size() > 1);
+ Y_VERIFY(info.SplitBoundarySize() == 0);
+
+ if (tableInfo->GetExpectedPartitionCount() + 1 - srcPartitionIdxs.size() < tableInfo->GetMinPartitionsCount()) {
+ errStr = "Reached MinPartitionsCount limit: " + ToString(tableInfo->GetMinPartitionsCount());
+ return false;
+ }
+
+ // Check that partitions for merge are consecutive in tableInfo->Partitions (e.g. don't allow to merge #1 with #3 tree and leave #2)
+ for (ui32 i = 1; i < srcPartitionIdxs.size(); ++i) {
+ ui64 pi = srcPartitionIdxs[i];
+ ui64 piPrev = srcPartitionIdxs[i-1];
+
+ if (pi != piPrev + 1) {
+ auto shardIdx = tableInfo->GetPartitions()[pi].ShardIdx;
+ auto shardIdxPrev = tableInfo->GetPartitions()[piPrev].ShardIdx;
+
+ errStr = TStringBuilder()
+ << "Partitions are not consecutive at index " << i << " : #" << piPrev << "(" << context.SS->ShardInfos[shardIdxPrev].TabletID << ")"
+ << " then #" << pi << "(" << context.SS->ShardInfos[shardIdx].TabletID << ")";
+ return false;
+ }
+ }
+
+ TString firstRangeBegin;
+ if (srcPartitionIdxs[0] != 0) {
+ // Take the end of previous shard
+ firstRangeBegin = tableInfo->GetPartitions()[srcPartitionIdxs[0]-1].EndOfRange;
+ } else {
+ TVector<TCell> firstKey;
+ ui32 keyColCount = 0;
+ for (const auto& col : tableInfo->Columns) {
+ if (col.second.IsKey()) {
+ ++keyColCount;
+ }
+ }
+ // Or start from (NULL, NULL, .., NULL)
+ firstKey.resize(keyColCount);
+ firstRangeBegin = TSerializedCellVec::Serialize(firstKey);
+ }
+
op.SplitDescription = std::make_shared<NKikimrTxDataShard::TSplitMergeDescription>();
- // Fill src shards
- TString prevRangeEnd = firstRangeBegin;
- for (ui64 pi : srcPartitionIdxs) {
- auto* srcRange = op.SplitDescription->AddSourceRanges();
- auto shardIdx = tableInfo->GetPartitions()[pi].ShardIdx;
- srcRange->SetShardIdx(ui64(shardIdx.GetLocalId()));
- srcRange->SetTabletID(ui64(context.SS->ShardInfos[shardIdx].TabletID));
- srcRange->SetKeyRangeBegin(prevRangeEnd);
- TString rangeEnd = tableInfo->GetPartitions()[pi].EndOfRange;
- srcRange->SetKeyRangeEnd(rangeEnd);
- prevRangeEnd = rangeEnd;
- }
-
- // Fill dst shard
- TShardInfo datashardInfo = TShardInfo::DataShardInfo(txId, pathId);
- datashardInfo.BindedChannels = channels;
-
+ // Fill src shards
+ TString prevRangeEnd = firstRangeBegin;
+ for (ui64 pi : srcPartitionIdxs) {
+ auto* srcRange = op.SplitDescription->AddSourceRanges();
+ auto shardIdx = tableInfo->GetPartitions()[pi].ShardIdx;
+ srcRange->SetShardIdx(ui64(shardIdx.GetLocalId()));
+ srcRange->SetTabletID(ui64(context.SS->ShardInfos[shardIdx].TabletID));
+ srcRange->SetKeyRangeBegin(prevRangeEnd);
+ TString rangeEnd = tableInfo->GetPartitions()[pi].EndOfRange;
+ srcRange->SetKeyRangeEnd(rangeEnd);
+ prevRangeEnd = rangeEnd;
+ }
+
+ // Fill dst shard
+ TShardInfo datashardInfo = TShardInfo::DataShardInfo(txId, pathId);
+ datashardInfo.BindedChannels = channels;
+
auto idx = context.SS->RegisterShardInfo(datashardInfo);
-
- ui64 lastSrcPartition = srcPartitionIdxs.back();
- TString lastRangeEnd = tableInfo->GetPartitions()[lastSrcPartition].EndOfRange;
-
- TTxState::TShardOperation dstShardOp(idx, ETabletType::DataShard, TTxState::CreateParts);
- dstShardOp.RangeEnd = lastRangeEnd;
- op.Shards.push_back(dstShardOp);
-
- auto* dstRange = op.SplitDescription->AddDestinationRanges();
- dstRange->SetShardIdx(ui64(idx.GetLocalId()));
- dstRange->SetKeyRangeBegin(firstRangeBegin);
- dstRange->SetKeyRangeEnd(lastRangeEnd);
-
- return true;
- }
-
- bool AllocateDstForSplit(
- const NKikimrSchemeOp::TSplitMergeTablePartitions& info,
- TTxId txId,
- const TPathId& pathId,
- ui64 srcPartitionIdx,
- const TTableInfo::TCPtr tableInfo,
- TTxState& op,
- const TChannelsBindings& channels,
- TString& errStr,
- TOperationContext& context)
- {
- // n split points produce n+1 parts
- ui64 count = info.SplitBoundarySize() + 1;
- if (count == 1) {
- errStr = "No split boundaries specified";
- return false;
- }
-
- if (tableInfo->GetExpectedPartitionCount() + count - 1 > tableInfo->GetMaxPartitionsCount()) {
- errStr = "Reached MaxPartitionsCount limit: " + ToString(tableInfo->GetMaxPartitionsCount());
- return false;
- }
-
- TShardInfo datashardInfo = TShardInfo::DataShardInfo(txId, pathId);
- datashardInfo.BindedChannels = channels;
-
- // Build vector of key column types
- TVector<NScheme::TTypeId> keyColTypeIds;
- for (const auto& col : tableInfo->Columns) {
- if (!col.second.IsKey())
- continue;
- size_t keyIdx = col.second.KeyOrder;
- keyColTypeIds.resize(Max(keyColTypeIds.size(), keyIdx+1));
- keyColTypeIds[keyIdx] = col.second.PType;
- }
-
- TVector<TString> rangeEnds;
- if (!TSchemeShard::FillSplitPartitioning(rangeEnds, keyColTypeIds, info.GetSplitBoundary(), errStr)) {
- return false;
- }
-
- // Last dst shard ends where src shard used to end
- rangeEnds.push_back(tableInfo->GetPartitions()[srcPartitionIdx].EndOfRange);
-
+
+ ui64 lastSrcPartition = srcPartitionIdxs.back();
+ TString lastRangeEnd = tableInfo->GetPartitions()[lastSrcPartition].EndOfRange;
+
+ TTxState::TShardOperation dstShardOp(idx, ETabletType::DataShard, TTxState::CreateParts);
+ dstShardOp.RangeEnd = lastRangeEnd;
+ op.Shards.push_back(dstShardOp);
+
+ auto* dstRange = op.SplitDescription->AddDestinationRanges();
+ dstRange->SetShardIdx(ui64(idx.GetLocalId()));
+ dstRange->SetKeyRangeBegin(firstRangeBegin);
+ dstRange->SetKeyRangeEnd(lastRangeEnd);
+
+ return true;
+ }
+
+ bool AllocateDstForSplit(
+ const NKikimrSchemeOp::TSplitMergeTablePartitions& info,
+ TTxId txId,
+ const TPathId& pathId,
+ ui64 srcPartitionIdx,
+ const TTableInfo::TCPtr tableInfo,
+ TTxState& op,
+ const TChannelsBindings& channels,
+ TString& errStr,
+ TOperationContext& context)
+ {
+ // n split points produce n+1 parts
+ ui64 count = info.SplitBoundarySize() + 1;
+ if (count == 1) {
+ errStr = "No split boundaries specified";
+ return false;
+ }
+
+ if (tableInfo->GetExpectedPartitionCount() + count - 1 > tableInfo->GetMaxPartitionsCount()) {
+ errStr = "Reached MaxPartitionsCount limit: " + ToString(tableInfo->GetMaxPartitionsCount());
+ return false;
+ }
+
+ TShardInfo datashardInfo = TShardInfo::DataShardInfo(txId, pathId);
+ datashardInfo.BindedChannels = channels;
+
+ // Build vector of key column types
+ TVector<NScheme::TTypeId> keyColTypeIds;
+ for (const auto& col : tableInfo->Columns) {
+ if (!col.second.IsKey())
+ continue;
+ size_t keyIdx = col.second.KeyOrder;
+ keyColTypeIds.resize(Max(keyColTypeIds.size(), keyIdx+1));
+ keyColTypeIds[keyIdx] = col.second.PType;
+ }
+
+ TVector<TString> rangeEnds;
+ if (!TSchemeShard::FillSplitPartitioning(rangeEnds, keyColTypeIds, info.GetSplitBoundary(), errStr)) {
+ return false;
+ }
+
+ // Last dst shard ends where src shard used to end
+ rangeEnds.push_back(tableInfo->GetPartitions()[srcPartitionIdx].EndOfRange);
+
op.SplitDescription = std::make_shared<NKikimrTxDataShard::TSplitMergeDescription>();
- auto* srcRange = op.SplitDescription->AddSourceRanges();
- auto srcShardIdx = tableInfo->GetPartitions()[srcPartitionIdx].ShardIdx;
- srcRange->SetShardIdx(ui64(srcShardIdx.GetLocalId()));
- srcRange->SetTabletID(ui64(context.SS->ShardInfos[srcShardIdx].TabletID));
- srcRange->SetKeyRangeEnd(tableInfo->GetPartitions()[srcPartitionIdx].EndOfRange);
-
- // Check that ranges are sorted in ascending order
- TVector<TCell> prevKey;
- if (srcPartitionIdx != 0) {
- // Take the end of previous shard
- TSerializedCellVec key(tableInfo->GetPartitions()[srcPartitionIdx-1].EndOfRange);
- prevKey.assign(key.GetCells().begin(), key.GetCells().end());
- } else {
- // Or start from (NULL, NULL, .., NULL)
- prevKey.resize(keyColTypeIds.size());
- }
- TString firstRangeBegin = TSerializedCellVec::Serialize(prevKey);
- srcRange->SetKeyRangeBegin(firstRangeBegin);
-
- for (ui32 i = 0; i < rangeEnds.size(); ++i) {
- TSerializedCellVec key(rangeEnds[i]);
- if (CompareBorders<true, true>(prevKey, key.GetCells(), true, true, keyColTypeIds) >= 0) {
- errStr = Sprintf("Partition ranges are not sorted at index %u", i);
- return false;
- }
- prevKey.assign(key.GetCells().begin(), key.GetCells().end());
- }
-
- // Allocate new datashard ids
- TString rangeBegin = firstRangeBegin;
- for (ui64 i = 0; i < count; ++i) {
+ auto* srcRange = op.SplitDescription->AddSourceRanges();
+ auto srcShardIdx = tableInfo->GetPartitions()[srcPartitionIdx].ShardIdx;
+ srcRange->SetShardIdx(ui64(srcShardIdx.GetLocalId()));
+ srcRange->SetTabletID(ui64(context.SS->ShardInfos[srcShardIdx].TabletID));
+ srcRange->SetKeyRangeEnd(tableInfo->GetPartitions()[srcPartitionIdx].EndOfRange);
+
+ // Check that ranges are sorted in ascending order
+ TVector<TCell> prevKey;
+ if (srcPartitionIdx != 0) {
+ // Take the end of previous shard
+ TSerializedCellVec key(tableInfo->GetPartitions()[srcPartitionIdx-1].EndOfRange);
+ prevKey.assign(key.GetCells().begin(), key.GetCells().end());
+ } else {
+ // Or start from (NULL, NULL, .., NULL)
+ prevKey.resize(keyColTypeIds.size());
+ }
+ TString firstRangeBegin = TSerializedCellVec::Serialize(prevKey);
+ srcRange->SetKeyRangeBegin(firstRangeBegin);
+
+ for (ui32 i = 0; i < rangeEnds.size(); ++i) {
+ TSerializedCellVec key(rangeEnds[i]);
+ if (CompareBorders<true, true>(prevKey, key.GetCells(), true, true, keyColTypeIds) >= 0) {
+ errStr = Sprintf("Partition ranges are not sorted at index %u", i);
+ return false;
+ }
+ prevKey.assign(key.GetCells().begin(), key.GetCells().end());
+ }
+
+ // Allocate new datashard ids
+ TString rangeBegin = firstRangeBegin;
+ for (ui64 i = 0; i < count; ++i) {
const auto idx = context.SS->RegisterShardInfo(datashardInfo);
-
- TString rangeEnd = rangeEnds[i];
- TTxState::TShardOperation dstShardOp(idx, ETabletType::DataShard, TTxState::CreateParts);
- dstShardOp.RangeEnd = rangeEnd;
- op.Shards.push_back(dstShardOp);
-
- auto* dstRange = op.SplitDescription->AddDestinationRanges();
- dstRange->SetShardIdx(ui64(idx.GetLocalId()));
- dstRange->SetKeyRangeBegin(rangeBegin);
- dstRange->SetKeyRangeEnd(rangeEnd);
-
- rangeBegin = rangeEnd;
- }
-
- return true;
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
+
+ TString rangeEnd = rangeEnds[i];
+ TTxState::TShardOperation dstShardOp(idx, ETabletType::DataShard, TTxState::CreateParts);
+ dstShardOp.RangeEnd = rangeEnd;
+ op.Shards.push_back(dstShardOp);
+
+ auto* dstRange = op.SplitDescription->AddDestinationRanges();
+ dstRange->SetShardIdx(ui64(idx.GetLocalId()));
+ dstRange->SetKeyRangeBegin(rangeBegin);
+ dstRange->SetKeyRangeEnd(rangeEnd);
+
+ rangeBegin = rangeEnd;
+ }
+
+ return true;
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
const auto& info = Transaction.GetSplitMergeTablePartitions();
- const ui64 dstCount = info.SplitBoundarySize() + 1;
- const ui64 srcCount = info.SourceTabletIdSize();
-
- TPathId pathId = InvalidPathId;
- if (info.HasTableOwnerId()) {
- pathId = TPathId(TOwnerId(info.GetTableOwnerId()),
- TLocalPathId(info.GetTableLocalId()));
- } else if (info.HasTableLocalId()) {
- pathId = context.SS->MakeLocalId(TLocalPathId(info.GetTableLocalId()));
- }
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TSplitMerge Propose"
- << ", tableStr: " << info.GetTablePath()
- << ", tableId: " << pathId
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
- TString errStr;
-
- if (!info.HasTablePath() && !info.HasTableLocalId()) {
- errStr = "Neither table name nor pathId in SplitMergeInfo";
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
-
- TPath path = pathId
- ? TPath::Init(pathId, context.SS)
- : TPath::Resolve(info.GetTablePath(), context.SS);
- {
- TPath::TChecker checks = path.Check();
+ const ui64 dstCount = info.SplitBoundarySize() + 1;
+ const ui64 srcCount = info.SourceTabletIdSize();
+
+ TPathId pathId = InvalidPathId;
+ if (info.HasTableOwnerId()) {
+ pathId = TPathId(TOwnerId(info.GetTableOwnerId()),
+ TLocalPathId(info.GetTableLocalId()));
+ } else if (info.HasTableLocalId()) {
+ pathId = context.SS->MakeLocalId(TLocalPathId(info.GetTableLocalId()));
+ }
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TSplitMerge Propose"
+ << ", tableStr: " << info.GetTablePath()
+ << ", tableId: " << pathId
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+ TString errStr;
+
+ if (!info.HasTablePath() && !info.HasTableLocalId()) {
+ errStr = "Neither table name nor pathId in SplitMergeInfo";
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+
+ TPath path = pathId
+ ? TPath::Init(pathId, context.SS)
+ : TPath::Resolve(info.GetTablePath(), context.SS);
+ {
+ TPath::TChecker checks = path.Check();
checks
.NotEmpty()
- .NotUnderDomainUpgrade()
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .IsTable()
- .NotUnderOperation();
-
- if (checks) {
- if (dstCount >= srcCount) { //allow over commit for merge
- checks
- .ShardsLimit(dstCount)
- .PathShardsLimit(dstCount);
- }
- }
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- if (!context.SS->CheckLocks(path.Base()->PathId, Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
- return result;
- }
-
- Y_VERIFY(context.SS->Tables.contains(path.Base()->PathId));
- TTableInfo::TCPtr tableInfo = context.SS->Tables.at(path.Base()->PathId);
- Y_VERIFY(tableInfo);
-
+ .NotUnderDomainUpgrade()
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .IsTable()
+ .NotUnderOperation();
+
+ if (checks) {
+ if (dstCount >= srcCount) { //allow over commit for merge
+ checks
+ .ShardsLimit(dstCount)
+ .PathShardsLimit(dstCount);
+ }
+ }
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ if (!context.SS->CheckApplyIf(Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ if (!context.SS->CheckLocks(path.Base()->PathId, Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusMultipleModifications, errStr);
+ return result;
+ }
+
+ Y_VERIFY(context.SS->Tables.contains(path.Base()->PathId));
+ TTableInfo::TCPtr tableInfo = context.SS->Tables.at(path.Base()->PathId);
+ Y_VERIFY(tableInfo);
+
if (tableInfo->IsBackup) {
TString errMsg = TStringBuilder()
<< "cannot split/merge backup table " << info.GetTablePath();
- result->SetError(NKikimrScheme::StatusInvalidParameter, errMsg);
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errMsg);
return result;
}
const THashMap<TShardIdx, ui64>& shardIdx2partition = tableInfo->GetShard2PartitionIdx();
-
- TVector<ui64> srcPartitionIdxs;
- i64 totalSrcPartCount = 0;
- for (ui32 si = 0; si < info.SourceTabletIdSize(); ++si) {
- auto srcTabletId = TTabletId(info.GetSourceTabletId(si));
- auto srcShardIdx = context.SS->GetShardIdx(srcTabletId);
- if (!srcShardIdx) {
- TString errMsg = TStringBuilder() << "Unknown SourceTabletId: " << srcTabletId;
- result->SetError(NKikimrScheme::StatusInvalidParameter, errMsg);
- return result;
- }
-
- if (!context.SS->ShardInfos.contains(srcShardIdx)) {
- TString errMsg = TStringBuilder()
- << "shard doesn't present at schemesahrd at all"
- << ", tablet: " << srcTabletId
- << ", srcShardIdx: " << srcShardIdx
- << ", pathId: " << path.Base()->PathId;
- result->SetError(NKikimrScheme::StatusInvalidParameter, errMsg);
- return result;
- }
-
- if (!shardIdx2partition.contains(srcShardIdx)) {
- TString errMsg = TStringBuilder()
- << "shard doesn't present at schemesahrd at table"
- << ", tablet: " << srcTabletId
- << ", srcShardIdx: " << srcShardIdx
- << ", pathId: " << path.Base()->PathId;
- result->SetError(NKikimrScheme::StatusInvalidParameter, errMsg);
- return result;
- }
-
- if (context.SS->ShardInfos.FindPtr(srcShardIdx)->PathId != path.Base()->PathId || !shardIdx2partition.contains(srcShardIdx)) {
- TString errMsg = TStringBuilder() << "TabletId " << srcTabletId << " is not a partition of table " << info.GetTablePath();
- result->SetError(NKikimrScheme::StatusInvalidParameter, errMsg);
- return result;
- }
-
-
- if (context.SS->ShardIsUnderSplitMergeOp(srcShardIdx)) {
- TString errMsg = TStringBuilder() << "TabletId " << srcTabletId << " is already in process of split";
- result->SetError(NKikimrScheme::StatusMultipleModifications, errMsg);
- return result;
- }
-
+
+ TVector<ui64> srcPartitionIdxs;
+ i64 totalSrcPartCount = 0;
+ for (ui32 si = 0; si < info.SourceTabletIdSize(); ++si) {
+ auto srcTabletId = TTabletId(info.GetSourceTabletId(si));
+ auto srcShardIdx = context.SS->GetShardIdx(srcTabletId);
+ if (!srcShardIdx) {
+ TString errMsg = TStringBuilder() << "Unknown SourceTabletId: " << srcTabletId;
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errMsg);
+ return result;
+ }
+
+ if (!context.SS->ShardInfos.contains(srcShardIdx)) {
+ TString errMsg = TStringBuilder()
+ << "shard doesn't present at schemesahrd at all"
+ << ", tablet: " << srcTabletId
+ << ", srcShardIdx: " << srcShardIdx
+ << ", pathId: " << path.Base()->PathId;
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errMsg);
+ return result;
+ }
+
+ if (!shardIdx2partition.contains(srcShardIdx)) {
+ TString errMsg = TStringBuilder()
+ << "shard doesn't present at schemesahrd at table"
+ << ", tablet: " << srcTabletId
+ << ", srcShardIdx: " << srcShardIdx
+ << ", pathId: " << path.Base()->PathId;
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errMsg);
+ return result;
+ }
+
+ if (context.SS->ShardInfos.FindPtr(srcShardIdx)->PathId != path.Base()->PathId || !shardIdx2partition.contains(srcShardIdx)) {
+ TString errMsg = TStringBuilder() << "TabletId " << srcTabletId << " is not a partition of table " << info.GetTablePath();
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errMsg);
+ return result;
+ }
+
+
+ if (context.SS->ShardIsUnderSplitMergeOp(srcShardIdx)) {
+ TString errMsg = TStringBuilder() << "TabletId " << srcTabletId << " is already in process of split";
+ result->SetError(NKikimrScheme::StatusMultipleModifications, errMsg);
+ return result;
+ }
+
if (context.SS->SplitSettings.SplitMergePartCountLimit != -1) {
- const auto* stats = tableInfo->GetStats().PartitionStats.FindPtr(srcShardIdx);
- if (!stats || stats->ShardState != NKikimrTxDataShard::Ready) {
- TString errMsg = TStringBuilder() << "Src TabletId " << srcTabletId << " is not in Ready state";
- result->SetError(NKikimrScheme::StatusNotAvailable, errMsg);
- return result;
- }
-
- totalSrcPartCount += stats->PartCount;
- }
-
- auto pi = shardIdx2partition.at(srcShardIdx);
- Y_VERIFY_S(pi < tableInfo->GetPartitions().size(), "pi: " << pi << " partitions.size: " << tableInfo->GetPartitions().size());
- srcPartitionIdxs.push_back(pi);
- }
-
+ const auto* stats = tableInfo->GetStats().PartitionStats.FindPtr(srcShardIdx);
+ if (!stats || stats->ShardState != NKikimrTxDataShard::Ready) {
+ TString errMsg = TStringBuilder() << "Src TabletId " << srcTabletId << " is not in Ready state";
+ result->SetError(NKikimrScheme::StatusNotAvailable, errMsg);
+ return result;
+ }
+
+ totalSrcPartCount += stats->PartCount;
+ }
+
+ auto pi = shardIdx2partition.at(srcShardIdx);
+ Y_VERIFY_S(pi < tableInfo->GetPartitions().size(), "pi: " << pi << " partitions.size: " << tableInfo->GetPartitions().size());
+ srcPartitionIdxs.push_back(pi);
+ }
+
if (context.SS->SplitSettings.SplitMergePartCountLimit != -1 &&
totalSrcPartCount >= context.SS->SplitSettings.SplitMergePartCountLimit)
{
- result->SetError(NKikimrScheme::StatusNotAvailable,
- Sprintf("Split/Merge operation involves too many parts: %" PRIu64, totalSrcPartCount));
-
- LOG_CRIT_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Cannot start split/merge operation"
- << " for table \"" << info.GetTablePath() << "\" (id " << path.Base()->PathId << ")"
- << " at tablet " << context.SS->TabletID()
- << " because the operation involves too many parts: " << totalSrcPartCount);
- return result;
- }
-
- if (srcPartitionIdxs.empty()) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, TStringBuilder() << "No source partitions specified for split/merge TxId " << OperationId.GetTxId());
- return result;
- }
-
- TChannelsBindings channelsBinding;
-
+ result->SetError(NKikimrScheme::StatusNotAvailable,
+ Sprintf("Split/Merge operation involves too many parts: %" PRIu64, totalSrcPartCount));
+
+ LOG_CRIT_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Cannot start split/merge operation"
+ << " for table \"" << info.GetTablePath() << "\" (id " << path.Base()->PathId << ")"
+ << " at tablet " << context.SS->TabletID()
+ << " because the operation involves too many parts: " << totalSrcPartCount);
+ return result;
+ }
+
+ if (srcPartitionIdxs.empty()) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, TStringBuilder() << "No source partitions specified for split/merge TxId " << OperationId.GetTxId());
+ return result;
+ }
+
+ TChannelsBindings channelsBinding;
+
bool storePerShardConfig = false;
- NKikimrSchemeOp::TPartitionConfig perShardConfig;
+ NKikimrSchemeOp::TPartitionConfig perShardConfig;
- if (context.SS->IsStorageConfigLogic(tableInfo)) {
+ if (context.SS->IsStorageConfigLogic(tableInfo)) {
TVector<TStorageRoom> storageRooms;
THashMap<ui32, ui32> familyRooms;
storageRooms.emplace_back(0);
if (!context.SS->GetBindingsRooms(path.DomainId(), tableInfo->PartitionConfig(), storageRooms, familyRooms, channelsBinding, errStr)) {
- errStr = TString("database doesn't have required storage pools to create tablet with storage config, details: ") + errStr;
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
+ errStr = TString("database doesn't have required storage pools to create tablet with storage config, details: ") + errStr;
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
storePerShardConfig = true;
for (const auto& room : storageRooms) {
@@ -895,130 +895,130 @@ public:
protoFamily->SetId(familyRoom.first);
protoFamily->SetRoom(familyRoom.second);
}
- } else if (context.SS->IsCompatibleChannelProfileLogic(path.DomainId(), tableInfo)) {
- if (!context.SS->GetChannelsBindings(path.DomainId(), tableInfo, channelsBinding, errStr)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
- }
-
- TTxState op;
-
- op.TxType = TTxState::TxSplitTablePartition;
- op.TargetPathId = path.Base()->PathId;
- op.State = TTxState::CreateParts;
-
- // Fill Src shards for tx
- for (ui64 pi : srcPartitionIdxs) {
- auto srcShardIdx = tableInfo->GetPartitions()[pi].ShardIdx;
- op.Shards.emplace_back(srcShardIdx, ETabletType::DataShard, TTxState::TransferData);
- }
-
- if (srcPartitionIdxs.size() == 1 && dstCount > 1) {
- // This is Split operation, allocate new shards for split Dsts
- if (!AllocateDstForSplit(info, OperationId.GetTxId(), path.Base()->PathId, srcPartitionIdxs[0], tableInfo, op, channelsBinding, errStr, context)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
- } else if (dstCount == 1 && srcPartitionIdxs.size() > 1) {
- // This is merge, allocate 1 Dst shard
- if (!AllocateDstForMerge(info, OperationId.GetTxId(), path.Base()->PathId, srcPartitionIdxs, tableInfo, op, channelsBinding, errStr, context)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- }
- } else {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "Invalid request: only 1->N or N->1 are supported");
- return result;
- }
-
- ///////////
- /// Accept operation
- ///
-
- context.MemChanges.GrabNewTxState(context.SS, OperationId);
- context.MemChanges.GrabDomain(context.SS, path.DomainId());
- context.MemChanges.GrabPath(context.SS, path->PathId);
- context.MemChanges.GrabTable(context.SS, path->PathId);
-
- context.DbChanges.PersistTxState(OperationId);
- for (const auto& shard : op.Shards) {
- if (shard.Operation == TTxState::CreateParts) {
- context.MemChanges.GrabNewShard(context.SS, shard.Idx);
- } else {
- context.MemChanges.GrabShard(context.SS, shard.Idx);
- }
- context.DbChanges.PersistShard(shard.Idx);
- }
-
- TTableInfo::TPtr mutableTableInfo = context.SS->Tables.at(path->PathId);
-
- mutableTableInfo->RegisterSplitMegreOp(OperationId, op);
- context.SS->CreateTx(OperationId, TTxState::TxSplitTablePartition, path->PathId) = op;
- context.OnComplete.ActivateTx(OperationId);
-
- for (const auto& shard : op.Shards) {
- Y_VERIFY(shard.Operation == TTxState::TransferData || shard.Operation == TTxState::CreateParts);
- // Add new (DST) shards to the list of all shards and update LastTxId for the old (SRC) shards
- Y_VERIFY(context.SS->ShardInfos.contains(shard.Idx));
- TShardInfo& shardInfo = context.SS->ShardInfos[shard.Idx];
- shardInfo.CurrentTxId = OperationId.GetTxId();
-
+ } else if (context.SS->IsCompatibleChannelProfileLogic(path.DomainId(), tableInfo)) {
+ if (!context.SS->GetChannelsBindings(path.DomainId(), tableInfo, channelsBinding, errStr)) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+ }
+
+ TTxState op;
+
+ op.TxType = TTxState::TxSplitTablePartition;
+ op.TargetPathId = path.Base()->PathId;
+ op.State = TTxState::CreateParts;
+
+ // Fill Src shards for tx
+ for (ui64 pi : srcPartitionIdxs) {
+ auto srcShardIdx = tableInfo->GetPartitions()[pi].ShardIdx;
+ op.Shards.emplace_back(srcShardIdx, ETabletType::DataShard, TTxState::TransferData);
+ }
+
+ if (srcPartitionIdxs.size() == 1 && dstCount > 1) {
+ // This is Split operation, allocate new shards for split Dsts
+ if (!AllocateDstForSplit(info, OperationId.GetTxId(), path.Base()->PathId, srcPartitionIdxs[0], tableInfo, op, channelsBinding, errStr, context)) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+ } else if (dstCount == 1 && srcPartitionIdxs.size() > 1) {
+ // This is merge, allocate 1 Dst shard
+ if (!AllocateDstForMerge(info, OperationId.GetTxId(), path.Base()->PathId, srcPartitionIdxs, tableInfo, op, channelsBinding, errStr, context)) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ }
+ } else {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "Invalid request: only 1->N or N->1 are supported");
+ return result;
+ }
+
+ ///////////
+ /// Accept operation
+ ///
+
+ context.MemChanges.GrabNewTxState(context.SS, OperationId);
+ context.MemChanges.GrabDomain(context.SS, path.DomainId());
+ context.MemChanges.GrabPath(context.SS, path->PathId);
+ context.MemChanges.GrabTable(context.SS, path->PathId);
+
+ context.DbChanges.PersistTxState(OperationId);
+ for (const auto& shard : op.Shards) {
+ if (shard.Operation == TTxState::CreateParts) {
+ context.MemChanges.GrabNewShard(context.SS, shard.Idx);
+ } else {
+ context.MemChanges.GrabShard(context.SS, shard.Idx);
+ }
+ context.DbChanges.PersistShard(shard.Idx);
+ }
+
+ TTableInfo::TPtr mutableTableInfo = context.SS->Tables.at(path->PathId);
+
+ mutableTableInfo->RegisterSplitMegreOp(OperationId, op);
+ context.SS->CreateTx(OperationId, TTxState::TxSplitTablePartition, path->PathId) = op;
+ context.OnComplete.ActivateTx(OperationId);
+
+ for (const auto& shard : op.Shards) {
+ Y_VERIFY(shard.Operation == TTxState::TransferData || shard.Operation == TTxState::CreateParts);
+ // Add new (DST) shards to the list of all shards and update LastTxId for the old (SRC) shards
+ Y_VERIFY(context.SS->ShardInfos.contains(shard.Idx));
+ TShardInfo& shardInfo = context.SS->ShardInfos[shard.Idx];
+ shardInfo.CurrentTxId = OperationId.GetTxId();
+
if (shard.Operation == TTxState::CreateParts) {
if (storePerShardConfig) {
- mutableTableInfo->PerShardPartitionConfig[shard.Idx].CopyFrom(perShardConfig);
+ mutableTableInfo->PerShardPartitionConfig[shard.Idx].CopyFrom(perShardConfig);
}
}
- }
-
- path.DomainInfo()->AddInternalShards(op); //allow over commit for merge
- path->IncShardsInside(dstCount);
-
- State = NextState();
- SetState(SelectStateFunc(State));
- return result;
- }
-
+ }
+
+ path.DomainInfo()->AddInternalShards(op); //allow over commit for merge
+ path->IncShardsInside(dstCount);
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ return result;
+ }
+
void AbortPropose(TOperationContext&) override {
Y_FAIL("no AbortPropose for TSplitMerge");
}
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TSplitMerge AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TSplitMerge AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
<< ", at schemeshard: " << context.SS->TabletID());
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- TPathId pathId = txState->TargetPathId;
- Y_VERIFY(context.SS->PathsById.contains(pathId));
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
- Y_VERIFY(path);
-
- Y_VERIFY(context.SS->Tables.contains(pathId));
- TTableInfo::TPtr tableInfo = context.SS->Tables.at(pathId);
- Y_VERIFY(tableInfo);
- tableInfo->AbortSplitMergeOp(OperationId);
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ TPathId pathId = txState->TargetPathId;
+ Y_VERIFY(context.SS->PathsById.contains(pathId));
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+ Y_VERIFY(path);
+
+ Y_VERIFY(context.SS->Tables.contains(pathId));
+ TTableInfo::TPtr tableInfo = context.SS->Tables.at(pathId);
+ Y_VERIFY(tableInfo);
+ tableInfo->AbortSplitMergeOp(OperationId);
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
ISubOperationBase::TPtr CreateSplitMerge(TOperationId id, const TTxTransaction& tx) {
return new TSplitMerge(id, tx);
}
-ISubOperationBase::TPtr CreateSplitMerge(TOperationId id, TTxState::ETxState state) {
+ISubOperationBase::TPtr CreateSplitMerge(TOperationId id, TTxState::ETxState state) {
Y_VERIFY(state != TTxState::Invalid);
- return new TSplitMerge(id, state);
-}
-
-}
-}
+ return new TSplitMerge(id, state);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_upgrade_subdomain.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_upgrade_subdomain.cpp
index 7bb8729ff2a..ad9c6808fca 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_upgrade_subdomain.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_upgrade_subdomain.cpp
@@ -1,1617 +1,1617 @@
-#include "schemeshard__operation_part.h"
-#include "schemeshard__operation_common.h"
-#include "schemeshard_path_describer.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard__operation_part.h"
+#include "schemeshard__operation_common.h"
+#include "schemeshard_path_describer.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/subdomain.h>
-
-namespace {
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-class TWait: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+namespace {
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+class TWait: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TWaiting"
- << " operationId: " << OperationId;
- }
-
-public:
- TWait(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {});
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", operation type: " << TTxState::TypeName(txState->TxType)
- << ", at tablet" << ssId);
-
- bool isDone = true;
-
- // wait all transaction inside
- auto pathes = context.SS->ListSubThee(txState->TargetPathId, context.Ctx);
- auto relatedTx = context.SS->GetRelatedTransactions(pathes, context.Ctx);
- for (auto otherTxId: relatedTx) {
- if (otherTxId == OperationId.GetTxId()) {
- continue;
- }
- TStringBuilder errMsg;
- errMsg << "TWait ProgressState, dependence has found, but actually it is unexepcted"
- << ", dependent transaction: " << OperationId.GetTxId()
- << ", parent transaction: " << otherTxId
- << ", at schemeshard: " << ssId;
-
- LOG_ERROR_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, errMsg);
- Y_FAIL_S(errMsg);
-
- Y_VERIFY(context.SS->Operations.contains(otherTxId));
- context.OnComplete.Dependence(otherTxId, OperationId.GetTxId());
-
- isDone = false;
- }
-
- if (isDone) {
- NIceDb::TNiceDb db(context.Txc.DB);
-
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr elem = context.SS->PathsById.at(pathId);
- elem->LastTxId = OperationId.GetTxId();
- context.SS->PersistLastTxId(db, elem);
-
- context.SS->ChangeTxState(db, OperationId, TTxState::CreateParts);
- return true;
- }
-
- return false;
- }
-};
-
-class TConfigure: public TSubOperationState {
-private:
- TOperationId OperationId;
-
- TTabletId TenantSchemeShardId = InvalidTabletId;
- THashSet<TPathId> PathesInside;
-
+ return TStringBuilder()
+ << "TWaiting"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TWait(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {});
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", operation type: " << TTxState::TypeName(txState->TxType)
+ << ", at tablet" << ssId);
+
+ bool isDone = true;
+
+ // wait all transaction inside
+ auto pathes = context.SS->ListSubThee(txState->TargetPathId, context.Ctx);
+ auto relatedTx = context.SS->GetRelatedTransactions(pathes, context.Ctx);
+ for (auto otherTxId: relatedTx) {
+ if (otherTxId == OperationId.GetTxId()) {
+ continue;
+ }
+ TStringBuilder errMsg;
+ errMsg << "TWait ProgressState, dependence has found, but actually it is unexepcted"
+ << ", dependent transaction: " << OperationId.GetTxId()
+ << ", parent transaction: " << otherTxId
+ << ", at schemeshard: " << ssId;
+
+ LOG_ERROR_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, errMsg);
+ Y_FAIL_S(errMsg);
+
+ Y_VERIFY(context.SS->Operations.contains(otherTxId));
+ context.OnComplete.Dependence(otherTxId, OperationId.GetTxId());
+
+ isDone = false;
+ }
+
+ if (isDone) {
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr elem = context.SS->PathsById.at(pathId);
+ elem->LastTxId = OperationId.GetTxId();
+ context.SS->PersistLastTxId(db, elem);
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::CreateParts);
+ return true;
+ }
+
+ return false;
+ }
+};
+
+class TConfigure: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
+ TTabletId TenantSchemeShardId = InvalidTabletId;
+ THashSet<TPathId> PathesInside;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TConfigure"
- << " operationId: " << OperationId;
- }
-
-public:
- TConfigure(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
- }
-
- bool HandleReply(TEvSchemeShard::TEvInitTenantSchemeShardResult::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint()
- << " HandleReply TEvInitTenantSchemeShardResult"
- << " operationId: " << OperationId
- << " at schemeshard: " << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxUpgradeSubDomain);
- TPathId pathId = txState->TargetPathId;
-
- const auto& record = ev->Get()->Record;
-
- auto tabletId = TTabletId(record.GetTenantSchemeShard());
- auto status = record.GetStatus();
-
+ return TStringBuilder()
+ << "TConfigure"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TConfigure(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType});
+ }
+
+ bool HandleReply(TEvSchemeShard::TEvInitTenantSchemeShardResult::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint()
+ << " HandleReply TEvInitTenantSchemeShardResult"
+ << " operationId: " << OperationId
+ << " at schemeshard: " << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxUpgradeSubDomain);
+ TPathId pathId = txState->TargetPathId;
+
+ const auto& record = ev->Get()->Record;
+
+ auto tabletId = TTabletId(record.GetTenantSchemeShard());
+ auto status = record.GetStatus();
+
auto shardIdx = context.SS->MustGetShardIdx(tabletId);
- Y_VERIFY(context.SS->ShardInfos.contains(shardIdx));
-
- if (status != NKikimrScheme::EStatus::StatusSuccess && status != NKikimrScheme::EStatus::StatusAlreadyExists) {
- LOG_CRIT_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint()
- << " Got error status on SubDomain Configure"
- << " from tenant schemeshard tablet: " << tabletId
- << " shard: " << shardIdx
- << " status: " << NKikimrScheme::EStatus_Name(status)
- << " opId: " << OperationId
- << " schemeshard: " << ssId);
- return false;
- }
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint()
- << " Got OK TEvInitTenantSchemeShardResult from schemeshard"
- << " tablet: " << tabletId
- << " shardIdx: " << shardIdx
- << " at schemeshard: " << ssId);
-
- context.OnComplete.UnbindMsgFromPipe(OperationId, TenantSchemeShardId, pathId);
- PathesInside.erase(pathId);
-
- auto next = NextMessage(context);
- if (!next) {
- // All tablets have replied so we can done this transaction
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::PublishTenantReadOnly);
- context.OnComplete.ActivateTx(OperationId);
- return true;
- }
-
- auto nextPathId = next->GetPathId(); //specify pathId lifetime
- context.OnComplete.BindMsgToPipe(OperationId, TenantSchemeShardId, nextPathId, next.Release());
-
- return false;
- }
-
- NKikimrScheme::TMigrateShard DescribeShard(TOperationContext& context, const TShardIdx& shardIdx) {
- NKikimrScheme::TMigrateShard descr;
- descr.MutableShardIdx()->SetOwnerId(shardIdx.GetOwnerId());
- descr.MutableShardIdx()->SetLocalId(ui64(shardIdx.GetLocalId()));
-
- const TShardInfo& info = context.SS->ShardInfos.at(shardIdx);
- descr.SetType(info.TabletType);
- descr.SetTabletId(ui64(info.TabletID));
-
- for (auto& binding: info.BindedChannels) {
- descr.MutableBindedStoragePool()->Add()->CopyFrom(binding);
- }
-
- return descr;
- }
-
- NKikimrScheme::TMigratePath DescribePath(TOperationContext& context, TPathId pathId) {
- NKikimrScheme::TMigratePath descr;
- descr.MutablePathId()->SetOwnerId(pathId.OwnerId);
- descr.MutablePathId()->SetLocalId(pathId.LocalPathId);
-
- TPathElement::TPtr elem = context.SS->PathsById.at(pathId);
- descr.MutableParentPathId()->SetOwnerId(elem->ParentPathId.OwnerId);
- descr.MutableParentPathId()->SetLocalId(elem->ParentPathId.LocalPathId);
- descr.SetName(elem->Name);
- descr.SetPathType(elem->PathType);
- descr.SetStepCreated(ui64(elem->StepCreated));
- descr.SetCreateTxId(ui64(elem->CreateTxId));
- descr.SetOwner(elem->Owner);
- descr.SetACL(elem->ACL);
- descr.SetDirAlterVersion(elem->DirAlterVersion);
- descr.SetUserAttrsAlterVersion(elem->UserAttrs->AlterVersion);
- descr.SetACLVersion(elem->ACLVersion);
-
- for (auto& item: elem->UserAttrs->Attrs) {
- auto add = descr.AddUserAttributes();
- add->SetKey(item.first);
- add->SetValue(item.second);
- }
-
- return descr;
- }
-
- NKikimrScheme::TMigrateTable DescribeTable(TOperationContext& context, TPathId pathId) {
- NKikimrScheme::TMigrateTable descr;
-
- TTableInfo::TPtr tableInfo = context.SS->Tables.at(pathId);
- descr.SetNextColId(tableInfo->NextColumnId);
-
- TString partitionConfig;
+ Y_VERIFY(context.SS->ShardInfos.contains(shardIdx));
+
+ if (status != NKikimrScheme::EStatus::StatusSuccess && status != NKikimrScheme::EStatus::StatusAlreadyExists) {
+ LOG_CRIT_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint()
+ << " Got error status on SubDomain Configure"
+ << " from tenant schemeshard tablet: " << tabletId
+ << " shard: " << shardIdx
+ << " status: " << NKikimrScheme::EStatus_Name(status)
+ << " opId: " << OperationId
+ << " schemeshard: " << ssId);
+ return false;
+ }
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint()
+ << " Got OK TEvInitTenantSchemeShardResult from schemeshard"
+ << " tablet: " << tabletId
+ << " shardIdx: " << shardIdx
+ << " at schemeshard: " << ssId);
+
+ context.OnComplete.UnbindMsgFromPipe(OperationId, TenantSchemeShardId, pathId);
+ PathesInside.erase(pathId);
+
+ auto next = NextMessage(context);
+ if (!next) {
+ // All tablets have replied so we can done this transaction
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::PublishTenantReadOnly);
+ context.OnComplete.ActivateTx(OperationId);
+ return true;
+ }
+
+ auto nextPathId = next->GetPathId(); //specify pathId lifetime
+ context.OnComplete.BindMsgToPipe(OperationId, TenantSchemeShardId, nextPathId, next.Release());
+
+ return false;
+ }
+
+ NKikimrScheme::TMigrateShard DescribeShard(TOperationContext& context, const TShardIdx& shardIdx) {
+ NKikimrScheme::TMigrateShard descr;
+ descr.MutableShardIdx()->SetOwnerId(shardIdx.GetOwnerId());
+ descr.MutableShardIdx()->SetLocalId(ui64(shardIdx.GetLocalId()));
+
+ const TShardInfo& info = context.SS->ShardInfos.at(shardIdx);
+ descr.SetType(info.TabletType);
+ descr.SetTabletId(ui64(info.TabletID));
+
+ for (auto& binding: info.BindedChannels) {
+ descr.MutableBindedStoragePool()->Add()->CopyFrom(binding);
+ }
+
+ return descr;
+ }
+
+ NKikimrScheme::TMigratePath DescribePath(TOperationContext& context, TPathId pathId) {
+ NKikimrScheme::TMigratePath descr;
+ descr.MutablePathId()->SetOwnerId(pathId.OwnerId);
+ descr.MutablePathId()->SetLocalId(pathId.LocalPathId);
+
+ TPathElement::TPtr elem = context.SS->PathsById.at(pathId);
+ descr.MutableParentPathId()->SetOwnerId(elem->ParentPathId.OwnerId);
+ descr.MutableParentPathId()->SetLocalId(elem->ParentPathId.LocalPathId);
+ descr.SetName(elem->Name);
+ descr.SetPathType(elem->PathType);
+ descr.SetStepCreated(ui64(elem->StepCreated));
+ descr.SetCreateTxId(ui64(elem->CreateTxId));
+ descr.SetOwner(elem->Owner);
+ descr.SetACL(elem->ACL);
+ descr.SetDirAlterVersion(elem->DirAlterVersion);
+ descr.SetUserAttrsAlterVersion(elem->UserAttrs->AlterVersion);
+ descr.SetACLVersion(elem->ACLVersion);
+
+ for (auto& item: elem->UserAttrs->Attrs) {
+ auto add = descr.AddUserAttributes();
+ add->SetKey(item.first);
+ add->SetValue(item.second);
+ }
+
+ return descr;
+ }
+
+ NKikimrScheme::TMigrateTable DescribeTable(TOperationContext& context, TPathId pathId) {
+ NKikimrScheme::TMigrateTable descr;
+
+ TTableInfo::TPtr tableInfo = context.SS->Tables.at(pathId);
+ descr.SetNextColId(tableInfo->NextColumnId);
+
+ TString partitionConfig;
Y_PROTOBUF_SUPPRESS_NODISCARD tableInfo->PartitionConfig().SerializeToString(&partitionConfig);
- descr.SetPartitionConfig(partitionConfig);
-
- descr.SetAlterVersion(tableInfo->AlterVersion);
- descr.SetPartitioningVersion(tableInfo->PartitioningVersion);
-
- for (auto& item: tableInfo->Columns) {
- ui32 columnId = item.first;
- const TTableInfo::TColumn& column = item.second;
-
- auto colDescr = descr.AddColumns();
- colDescr->SetId(columnId);
- colDescr->SetName(column.Name);
- colDescr->SetColType(column.PType);
- colDescr->SetColKeyOrder(column.KeyOrder);
- colDescr->SetCreateVersion(column.CreateVersion);
- colDescr->SetDeleteVersion(column.DeleteVersion);
- colDescr->SetFamily(column.Family);
+ descr.SetPartitionConfig(partitionConfig);
+
+ descr.SetAlterVersion(tableInfo->AlterVersion);
+ descr.SetPartitioningVersion(tableInfo->PartitioningVersion);
+
+ for (auto& item: tableInfo->Columns) {
+ ui32 columnId = item.first;
+ const TTableInfo::TColumn& column = item.second;
+
+ auto colDescr = descr.AddColumns();
+ colDescr->SetId(columnId);
+ colDescr->SetName(column.Name);
+ colDescr->SetColType(column.PType);
+ colDescr->SetColKeyOrder(column.KeyOrder);
+ colDescr->SetCreateVersion(column.CreateVersion);
+ colDescr->SetDeleteVersion(column.DeleteVersion);
+ colDescr->SetFamily(column.Family);
colDescr->SetNotNull(column.NotNull);
if (column.DefaultKind != ETableColumnDefaultKind::None) {
colDescr->SetDefaultKind(ui32(column.DefaultKind));
colDescr->SetDefaultValue(column.DefaultValue);
}
- }
-
- for (ui32 partNum = 0; partNum < tableInfo->GetPartitions().size(); ++partNum) {
- const TTableShardInfo& partition = tableInfo->GetPartitions().at(partNum);
-
- auto partDescr = descr.AddPartitions();
- partDescr->SetId(partNum);
- partDescr->SetRangeEnd(partition.EndOfRange);
- partDescr->MutableShardIdx()->SetOwnerId(partition.ShardIdx.GetOwnerId());
- partDescr->MutableShardIdx()->SetLocalId(ui64(partition.ShardIdx.GetLocalId()));
- if (tableInfo->PerShardPartitionConfig.contains(partition.ShardIdx)) {
- TString partitionConfig;
+ }
+
+ for (ui32 partNum = 0; partNum < tableInfo->GetPartitions().size(); ++partNum) {
+ const TTableShardInfo& partition = tableInfo->GetPartitions().at(partNum);
+
+ auto partDescr = descr.AddPartitions();
+ partDescr->SetId(partNum);
+ partDescr->SetRangeEnd(partition.EndOfRange);
+ partDescr->MutableShardIdx()->SetOwnerId(partition.ShardIdx.GetOwnerId());
+ partDescr->MutableShardIdx()->SetLocalId(ui64(partition.ShardIdx.GetLocalId()));
+ if (tableInfo->PerShardPartitionConfig.contains(partition.ShardIdx)) {
+ TString partitionConfig;
Y_PROTOBUF_SUPPRESS_NODISCARD tableInfo->PerShardPartitionConfig.at(partition.ShardIdx).SerializeToString(&partitionConfig);
- partDescr->SetPartitionConfig(partitionConfig);
- }
- }
-
- return descr;
- }
-
- NKikimrScheme::TMigrateTableIndex DescribeTableIndex(TOperationContext& context, TPathId pathId) {
- NKikimrScheme::TMigrateTableIndex descr;
-
- TTableIndexInfo::TPtr indexInfo = context.SS->Indexes.at(pathId);
- descr.SetAlterVersion(indexInfo->AlterVersion);
- descr.SetType(indexInfo->Type);
- descr.SetState(indexInfo->State);
-
- for (auto& keyName: indexInfo->IndexKeys) {
- descr.AddKeys(keyName);
- }
-
- return descr;
- }
-
- NKikimrScheme::TMigrateKesus DescribeKesus(TOperationContext& context, TPathId pathId) {
- NKikimrScheme::TMigrateKesus descr;
-
- TKesusInfo::TPtr kesusInfo = context.SS->KesusInfos.at(pathId);
-
- descr.MutablePathId()->SetOwnerId(pathId.OwnerId);
- descr.MutablePathId()->SetLocalId(pathId.LocalPathId);
- descr.SetVersion(kesusInfo->Version);
-
- TString config;
+ partDescr->SetPartitionConfig(partitionConfig);
+ }
+ }
+
+ return descr;
+ }
+
+ NKikimrScheme::TMigrateTableIndex DescribeTableIndex(TOperationContext& context, TPathId pathId) {
+ NKikimrScheme::TMigrateTableIndex descr;
+
+ TTableIndexInfo::TPtr indexInfo = context.SS->Indexes.at(pathId);
+ descr.SetAlterVersion(indexInfo->AlterVersion);
+ descr.SetType(indexInfo->Type);
+ descr.SetState(indexInfo->State);
+
+ for (auto& keyName: indexInfo->IndexKeys) {
+ descr.AddKeys(keyName);
+ }
+
+ return descr;
+ }
+
+ NKikimrScheme::TMigrateKesus DescribeKesus(TOperationContext& context, TPathId pathId) {
+ NKikimrScheme::TMigrateKesus descr;
+
+ TKesusInfo::TPtr kesusInfo = context.SS->KesusInfos.at(pathId);
+
+ descr.MutablePathId()->SetOwnerId(pathId.OwnerId);
+ descr.MutablePathId()->SetLocalId(pathId.LocalPathId);
+ descr.SetVersion(kesusInfo->Version);
+
+ TString config;
Y_PROTOBUF_SUPPRESS_NODISCARD kesusInfo->Config.SerializeToString(&config);
- descr.SetConfig(config);
-
- return descr;
- }
-
- THolder<TEvSchemeShard::TEvMigrateSchemeShard> NextMessage(TOperationContext& context) {
- if (!PathesInside) {
- return nullptr;
- }
-
- TPathId pathId = *PathesInside.begin();
- TPath path = TPath::Init(pathId, context.SS);
-
-
- auto event = MakeHolder<TEvSchemeShard::TEvMigrateSchemeShard>();
- event->Record.SetSchemeShardGeneration(context.SS->Generation());
-
- *event->Record.MutablePath() = DescribePath(context, pathId);
- *event->Record.MutablePathVersion() = context.SS->GetPathVersion(path);
-
- auto migrateShards = event->Record.MutableShards();
- switch (path.Base()->PathType) {
- case NKikimrSchemeOp::EPathType::EPathTypeDir:
- Y_VERIFY(!path.Base()->IsRoot());
- //no shards
- break;
- case NKikimrSchemeOp::EPathType::EPathTypeSubDomain:
- case NKikimrSchemeOp::EPathType::EPathTypeExtSubDomain:
- Y_FAIL("imposible to migrate subDomain or extSubDomain as part of the other subDomain");
- break;
- case NKikimrSchemeOp::EPathType::EPathTypeTable:
- {
- Y_VERIFY(context.SS->Tables.contains(pathId));
-
- *event->Record.MutableTable() = DescribeTable(context, pathId);
-
- TTableInfo::TPtr tableInfo = context.SS->Tables.at(pathId);
- for (auto part: tableInfo->GetPartitions()) {
- TShardIdx shardIdx = part.ShardIdx;
- *migrateShards->Add() = DescribeShard(context, shardIdx);
- }
-
- //tinfo->PerShardPartitionConfig add that data
- break;
- }
- case NKikimrSchemeOp::EPathType::EPathTypeTableIndex:
- {
- Y_VERIFY(context.SS->Indexes.contains(pathId));
- *event->Record.MutableTableIndex() = DescribeTableIndex(context, pathId);
-
- //no shards
-
- break;
- }
- case NKikimrSchemeOp::EPathType::EPathTypeKesus:
- {
- Y_VERIFY(context.SS->KesusInfos.contains(pathId));
- *event->Record.MutableKesus() = DescribeKesus(context, pathId);
-
- TKesusInfo::TPtr kesusInfo = context.SS->KesusInfos.at(pathId);
- Y_VERIFY(kesusInfo->KesusShardIdx);
- Y_VERIFY(context.SS->ShardInfos.contains(kesusInfo->KesusShardIdx));
- *migrateShards->Add() = DescribeShard(context, kesusInfo->KesusShardIdx);
-
- break;
- }
- case NKikimrSchemeOp::EPathType::EPathTypePersQueueGroup:
- case NKikimrSchemeOp::EPathType::EPathTypeBlockStoreVolume:
- case NKikimrSchemeOp::EPathType::EPathTypeFileStore:
- case NKikimrSchemeOp::EPathType::EPathTypeRtmrVolume:
- case NKikimrSchemeOp::EPathType::EPathTypeSolomonVolume:
+ descr.SetConfig(config);
+
+ return descr;
+ }
+
+ THolder<TEvSchemeShard::TEvMigrateSchemeShard> NextMessage(TOperationContext& context) {
+ if (!PathesInside) {
+ return nullptr;
+ }
+
+ TPathId pathId = *PathesInside.begin();
+ TPath path = TPath::Init(pathId, context.SS);
+
+
+ auto event = MakeHolder<TEvSchemeShard::TEvMigrateSchemeShard>();
+ event->Record.SetSchemeShardGeneration(context.SS->Generation());
+
+ *event->Record.MutablePath() = DescribePath(context, pathId);
+ *event->Record.MutablePathVersion() = context.SS->GetPathVersion(path);
+
+ auto migrateShards = event->Record.MutableShards();
+ switch (path.Base()->PathType) {
+ case NKikimrSchemeOp::EPathType::EPathTypeDir:
+ Y_VERIFY(!path.Base()->IsRoot());
+ //no shards
+ break;
+ case NKikimrSchemeOp::EPathType::EPathTypeSubDomain:
+ case NKikimrSchemeOp::EPathType::EPathTypeExtSubDomain:
+ Y_FAIL("imposible to migrate subDomain or extSubDomain as part of the other subDomain");
+ break;
+ case NKikimrSchemeOp::EPathType::EPathTypeTable:
+ {
+ Y_VERIFY(context.SS->Tables.contains(pathId));
+
+ *event->Record.MutableTable() = DescribeTable(context, pathId);
+
+ TTableInfo::TPtr tableInfo = context.SS->Tables.at(pathId);
+ for (auto part: tableInfo->GetPartitions()) {
+ TShardIdx shardIdx = part.ShardIdx;
+ *migrateShards->Add() = DescribeShard(context, shardIdx);
+ }
+
+ //tinfo->PerShardPartitionConfig add that data
+ break;
+ }
+ case NKikimrSchemeOp::EPathType::EPathTypeTableIndex:
+ {
+ Y_VERIFY(context.SS->Indexes.contains(pathId));
+ *event->Record.MutableTableIndex() = DescribeTableIndex(context, pathId);
+
+ //no shards
+
+ break;
+ }
+ case NKikimrSchemeOp::EPathType::EPathTypeKesus:
+ {
+ Y_VERIFY(context.SS->KesusInfos.contains(pathId));
+ *event->Record.MutableKesus() = DescribeKesus(context, pathId);
+
+ TKesusInfo::TPtr kesusInfo = context.SS->KesusInfos.at(pathId);
+ Y_VERIFY(kesusInfo->KesusShardIdx);
+ Y_VERIFY(context.SS->ShardInfos.contains(kesusInfo->KesusShardIdx));
+ *migrateShards->Add() = DescribeShard(context, kesusInfo->KesusShardIdx);
+
+ break;
+ }
+ case NKikimrSchemeOp::EPathType::EPathTypePersQueueGroup:
+ case NKikimrSchemeOp::EPathType::EPathTypeBlockStoreVolume:
+ case NKikimrSchemeOp::EPathType::EPathTypeFileStore:
+ case NKikimrSchemeOp::EPathType::EPathTypeRtmrVolume:
+ case NKikimrSchemeOp::EPathType::EPathTypeSolomonVolume:
case NKikimrSchemeOp::EPathType::EPathTypeColumnStore:
case NKikimrSchemeOp::EPathType::EPathTypeColumnTable:
- case NKikimrSchemeOp::EPathType::EPathTypeCdcStream:
- case NKikimrSchemeOp::EPathType::EPathTypeSequence:
+ case NKikimrSchemeOp::EPathType::EPathTypeCdcStream:
+ case NKikimrSchemeOp::EPathType::EPathTypeSequence:
case NKikimrSchemeOp::EPathType::EPathTypeReplication:
- Y_FAIL("UNIMPLEMENTED");
- case NKikimrSchemeOp::EPathType::EPathTypeInvalid:
- Y_UNREACHABLE();
- }
-
- return event;
- }
-
- bool HandleReply(TEvSchemeShard::TEvMigrateSchemeShardResult::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvSchemeShard::TEvMigrateSchemeShardResult"
- << ", at tablet" << ssId);
-
- Y_VERIFY(ev->Get()->GetPathId().OwnerId == context.SS->TabletID());
-
- TPathId pathId = ev->Get()->GetPathId();
- context.OnComplete.UnbindMsgFromPipe(OperationId, TenantSchemeShardId, pathId);
- PathesInside.erase(pathId);
-
- auto next = NextMessage(context);
- if (!next) {
- // All tablets have replied so we can done this transaction
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::PublishTenantReadOnly);
- context.OnComplete.ActivateTx(OperationId);
- return true;
- }
-
- auto nexPathId = next->GetPathId(); //specify pathId lifetime
- context.OnComplete.BindMsgToPipe(OperationId, TenantSchemeShardId, nexPathId, next.Release());
-
- return false;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at tablet" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- Y_VERIFY(txState->TxType == TTxState::TxUpgradeSubDomain);
-
- TPathId pathId = txState->TargetPathId;
- TPath path = TPath::Init(pathId, context.SS);
-
- auto subDomain = context.SS->SubDomains.at(pathId);
- auto alterData = subDomain->GetAlter();
- Y_VERIFY(alterData);
- alterData->Initialize(context.SS->ShardInfos);
-
- auto processing = alterData->GetProcessingParams();
- auto storagePools = alterData->GetStoragePools();
- auto& schemeLimits = subDomain->GetSchemeLimits();
-
- auto event = new TEvSchemeShard::TEvInitTenantSchemeShard(
- ui64(ssId),
- pathId.LocalPathId, path.PathString(),
- path.Base()->Owner, path.GetEffectiveACL(), path.GetEffectiveACLVersion(),
- processing, storagePools,
- path.Base()->UserAttrs->Attrs, path.Base()->UserAttrs->AlterVersion,
+ Y_FAIL("UNIMPLEMENTED");
+ case NKikimrSchemeOp::EPathType::EPathTypeInvalid:
+ Y_UNREACHABLE();
+ }
+
+ return event;
+ }
+
+ bool HandleReply(TEvSchemeShard::TEvMigrateSchemeShardResult::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvSchemeShard::TEvMigrateSchemeShardResult"
+ << ", at tablet" << ssId);
+
+ Y_VERIFY(ev->Get()->GetPathId().OwnerId == context.SS->TabletID());
+
+ TPathId pathId = ev->Get()->GetPathId();
+ context.OnComplete.UnbindMsgFromPipe(OperationId, TenantSchemeShardId, pathId);
+ PathesInside.erase(pathId);
+
+ auto next = NextMessage(context);
+ if (!next) {
+ // All tablets have replied so we can done this transaction
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::PublishTenantReadOnly);
+ context.OnComplete.ActivateTx(OperationId);
+ return true;
+ }
+
+ auto nexPathId = next->GetPathId(); //specify pathId lifetime
+ context.OnComplete.BindMsgToPipe(OperationId, TenantSchemeShardId, nexPathId, next.Release());
+
+ return false;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at tablet" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ Y_VERIFY(txState->TxType == TTxState::TxUpgradeSubDomain);
+
+ TPathId pathId = txState->TargetPathId;
+ TPath path = TPath::Init(pathId, context.SS);
+
+ auto subDomain = context.SS->SubDomains.at(pathId);
+ auto alterData = subDomain->GetAlter();
+ Y_VERIFY(alterData);
+ alterData->Initialize(context.SS->ShardInfos);
+
+ auto processing = alterData->GetProcessingParams();
+ auto storagePools = alterData->GetStoragePools();
+ auto& schemeLimits = subDomain->GetSchemeLimits();
+
+ auto event = new TEvSchemeShard::TEvInitTenantSchemeShard(
+ ui64(ssId),
+ pathId.LocalPathId, path.PathString(),
+ path.Base()->Owner, path.GetEffectiveACL(), path.GetEffectiveACLVersion(),
+ processing, storagePools,
+ path.Base()->UserAttrs->Attrs, path.Base()->UserAttrs->AlterVersion,
schemeLimits, ui64(InvalidTabletId));
- event->Record.SetInitiateMigration(true);
-
- Y_VERIFY(1 == txState->Shards.size());
- auto &shard = *txState->Shards.begin();
- shard.Operation = TTxState::ConfigureParts;
-
- TenantSchemeShardId = TTabletId(processing.GetSchemeShard());
- PathesInside = context.SS->ListSubThee(path.Base()->PathId, context.Ctx);
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint()
- << "Send configure request to schemeshard: " << TenantSchemeShardId
- << " schemeshard: " << ssId
- << " msg: " << event->Record.ShortDebugString());
- context.OnComplete.BindMsgToPipe(OperationId, TenantSchemeShardId, pathId, event);
-
-
- return false;
- }
-};
-
-class TPublishTenantReadOnly: public TSubOperationState {
-private:
- TOperationId OperationId;
- TTabletId TenantSchemeShardId = InvalidTabletId;
-
+ event->Record.SetInitiateMigration(true);
+
+ Y_VERIFY(1 == txState->Shards.size());
+ auto &shard = *txState->Shards.begin();
+ shard.Operation = TTxState::ConfigureParts;
+
+ TenantSchemeShardId = TTabletId(processing.GetSchemeShard());
+ PathesInside = context.SS->ListSubThee(path.Base()->PathId, context.Ctx);
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint()
+ << "Send configure request to schemeshard: " << TenantSchemeShardId
+ << " schemeshard: " << ssId
+ << " msg: " << event->Record.ShortDebugString());
+ context.OnComplete.BindMsgToPipe(OperationId, TenantSchemeShardId, pathId, event);
+
+
+ return false;
+ }
+};
+
+class TPublishTenantReadOnly: public TSubOperationState {
+private:
+ TOperationId OperationId;
+ TTabletId TenantSchemeShardId = InvalidTabletId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TPublishTenantReadOnly"
- << " operationId: " << OperationId;
- }
-
-public:
- TPublishTenantReadOnly(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType,
- TEvSchemeShard::TEvMigrateSchemeShardResult::EventType,
- TEvSchemeShard::TEvInitTenantSchemeShardResult::EventType});
- }
-
- bool HandleReply(TEvSchemeShard::TEvPublishTenantAsReadOnlyResult::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvSchemeShard::TEvPublishTenantAsReadOnlyResult"
- << ", at tablet" << ssId);
-
- Y_VERIFY(TTabletId(ev->Get()->Record.GetTenantSchemeShard()) == TenantSchemeShardId);
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::PublishGlobal);
- context.OnComplete.ActivateTx(OperationId);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at tablet" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- Y_VERIFY(1 == txState->Shards.size());
- auto &shard = *txState->Shards.begin();
- shard.Operation = TTxState::ConfigureParts;
- txState->UpdateShardsInProgress();
-
- TPathId pathId = txState->TargetPathId;
- auto subDomain = context.SS->SubDomains.at(pathId);
- auto alterData = subDomain->GetAlter();
- Y_VERIFY(alterData);
- alterData->Initialize(context.SS->ShardInfos);
- auto processing = alterData->GetProcessingParams();
- TenantSchemeShardId = TTabletId(processing.GetSchemeShard());
-
- auto event = new TEvSchemeShard::TEvPublishTenantAsReadOnly(ui64(ssId));
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint()
- << " Send publish as RO request to schemeshard: " << TenantSchemeShardId
- << " schemeshard: " << ssId
- << " msg: " << event->Record.ShortDebugString());
- context.OnComplete.BindMsgToPipe(OperationId, TenantSchemeShardId, pathId, event);
-
- return false;
- }
-};
-
-class TPublishGlobal: public TSubOperationState {
-private:
- TOperationId OperationId;
- TTxState::ETxState& UpgradeDecision;
-
- TPathElement::TChildrenCont HidenChildren;
-
+ return TStringBuilder()
+ << "TPublishTenantReadOnly"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TPublishTenantReadOnly(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType,
+ TEvSchemeShard::TEvMigrateSchemeShardResult::EventType,
+ TEvSchemeShard::TEvInitTenantSchemeShardResult::EventType});
+ }
+
+ bool HandleReply(TEvSchemeShard::TEvPublishTenantAsReadOnlyResult::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvSchemeShard::TEvPublishTenantAsReadOnlyResult"
+ << ", at tablet" << ssId);
+
+ Y_VERIFY(TTabletId(ev->Get()->Record.GetTenantSchemeShard()) == TenantSchemeShardId);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::PublishGlobal);
+ context.OnComplete.ActivateTx(OperationId);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at tablet" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ Y_VERIFY(1 == txState->Shards.size());
+ auto &shard = *txState->Shards.begin();
+ shard.Operation = TTxState::ConfigureParts;
+ txState->UpdateShardsInProgress();
+
+ TPathId pathId = txState->TargetPathId;
+ auto subDomain = context.SS->SubDomains.at(pathId);
+ auto alterData = subDomain->GetAlter();
+ Y_VERIFY(alterData);
+ alterData->Initialize(context.SS->ShardInfos);
+ auto processing = alterData->GetProcessingParams();
+ TenantSchemeShardId = TTabletId(processing.GetSchemeShard());
+
+ auto event = new TEvSchemeShard::TEvPublishTenantAsReadOnly(ui64(ssId));
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint()
+ << " Send publish as RO request to schemeshard: " << TenantSchemeShardId
+ << " schemeshard: " << ssId
+ << " msg: " << event->Record.ShortDebugString());
+ context.OnComplete.BindMsgToPipe(OperationId, TenantSchemeShardId, pathId, event);
+
+ return false;
+ }
+};
+
+class TPublishGlobal: public TSubOperationState {
+private:
+ TOperationId OperationId;
+ TTxState::ETxState& UpgradeDecision;
+
+ TPathElement::TChildrenCont HidenChildren;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TPublishGlobal"
- << " operationId: " << OperationId;
- }
-
-public:
- TPublishGlobal(TOperationId id, TTxState::ETxState& nextState)
- : OperationId(id)
- , UpgradeDecision(nextState)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType,
- TEvSchemeShard::TEvMigrateSchemeShardResult::EventType,
- TEvSchemeShard::TEvInitTenantSchemeShardResult::EventType,
- TEvSchemeShard::TEvPublishTenantAsReadOnlyResult::EventType});
- }
-
- bool HandleReply(TEvPrivate::TEvCommitTenantUpdate::TPtr& /*ev*/, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvPrivate::TEvCommitTenantUpdate"
- << ", at tablet" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
- TPathId pathId = txState->TargetPathId;
- auto path = context.SS->PathsById.at(pathId);
-
- path->SwapChildren(HidenChildren); //return back children, now we do not pretend that there no children, we define them as Migrated
- auto pathsInside = context.SS->ListSubThee(pathId, context.Ctx);
- pathsInside.erase(pathId);
- for (auto pId: pathsInside) {
- auto item = context.SS->PathsById.at(pId);
-
- context.SS->MarkAsMigrated(item, context.Ctx);
- context.SS->ClearDescribePathCaches(item); //something has changed let's show it
- }
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- Y_VERIFY(path->PathType == TPathElement::EPathType::EPathTypeExtSubDomain);
- context.SS->PersistPath(db, path->PathId);
- context.SS->ClearDescribePathCaches(path);
-
- auto subDomain = context.SS->SubDomains.at(pathId);
- subDomain->SetAlterPrivate(nullptr);
- context.SS->PersistSubDomain(db, pathId, *subDomain);
+ return TStringBuilder()
+ << "TPublishGlobal"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TPublishGlobal(TOperationId id, TTxState::ETxState& nextState)
+ : OperationId(id)
+ , UpgradeDecision(nextState)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType,
+ TEvSchemeShard::TEvMigrateSchemeShardResult::EventType,
+ TEvSchemeShard::TEvInitTenantSchemeShardResult::EventType,
+ TEvSchemeShard::TEvPublishTenantAsReadOnlyResult::EventType});
+ }
+
+ bool HandleReply(TEvPrivate::TEvCommitTenantUpdate::TPtr& /*ev*/, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvPrivate::TEvCommitTenantUpdate"
+ << ", at tablet" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+ TPathId pathId = txState->TargetPathId;
+ auto path = context.SS->PathsById.at(pathId);
+
+ path->SwapChildren(HidenChildren); //return back children, now we do not pretend that there no children, we define them as Migrated
+ auto pathsInside = context.SS->ListSubThee(pathId, context.Ctx);
+ pathsInside.erase(pathId);
+ for (auto pId: pathsInside) {
+ auto item = context.SS->PathsById.at(pId);
+
+ context.SS->MarkAsMigrated(item, context.Ctx);
+ context.SS->ClearDescribePathCaches(item); //something has changed let's show it
+ }
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ Y_VERIFY(path->PathType == TPathElement::EPathType::EPathTypeExtSubDomain);
+ context.SS->PersistPath(db, path->PathId);
+ context.SS->ClearDescribePathCaches(path);
+
+ auto subDomain = context.SS->SubDomains.at(pathId);
+ subDomain->SetAlterPrivate(nullptr);
+ context.SS->PersistSubDomain(db, pathId, *subDomain);
context.SS->PersistSubDomainSchemeQuotas(db, pathId, *subDomain);
-
- context.SS->ChangeTxState(db, OperationId, TTxState::RewriteOwners);
- context.OnComplete.ActivateTx(OperationId);
- UpgradeDecision = TTxState::RewriteOwners;
-
- return true;
- }
-
- bool HandleReply(TEvPrivate::TEvUndoTenantUpdate::TPtr& /*ev*/, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvPrivate::TEvUndoTenantUpdate"
- << ", at tablet" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- NIceDb::TNiceDb db(context.Txc.DB);
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr item = context.SS->PathsById.at(pathId);
-
- Y_VERIFY(item->PathType == TPathElement::EPathType::EPathTypeExtSubDomain);
- item->PathType = TPathElement::EPathType::EPathTypeSubDomain;
-
- item->SwapChildren(HidenChildren); //return back children
- item->PreSerializedChildrenListing.clear();
-
- auto subDomain = context.SS->SubDomains.at(pathId);
- Y_VERIFY(subDomain);
- auto alterData = subDomain->GetAlter();
- Y_VERIFY(alterData);
- alterData->Initialize(context.SS->ShardInfos);
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::RewriteOwners);
+ context.OnComplete.ActivateTx(OperationId);
+ UpgradeDecision = TTxState::RewriteOwners;
+
+ return true;
+ }
+
+ bool HandleReply(TEvPrivate::TEvUndoTenantUpdate::TPtr& /*ev*/, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvPrivate::TEvUndoTenantUpdate"
+ << ", at tablet" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr item = context.SS->PathsById.at(pathId);
+
+ Y_VERIFY(item->PathType == TPathElement::EPathType::EPathTypeExtSubDomain);
+ item->PathType = TPathElement::EPathType::EPathTypeSubDomain;
+
+ item->SwapChildren(HidenChildren); //return back children
+ item->PreSerializedChildrenListing.clear();
+
+ auto subDomain = context.SS->SubDomains.at(pathId);
+ Y_VERIFY(subDomain);
+ auto alterData = subDomain->GetAlter();
+ Y_VERIFY(alterData);
+ alterData->Initialize(context.SS->ShardInfos);
subDomain->ActualizeAlterData(context.SS->ShardInfos, context.Ctx.Now(), /* isExternal */ false, context.SS);
-
- context.SS->RevertedMigrations[pathId].push_back(subDomain->GetTenantSchemeShardID());
- context.SS->PersistRevertedMirgration(db, pathId, subDomain->GetTenantSchemeShardID());
-
- alterData->SetAlterPrivate(nullptr);
- subDomain->SetAlterPrivate(nullptr);
-
- alterData->SetVersion(alterData->GetVersion() + 1);
- context.SS->SubDomains[pathId] = alterData;
-
- context.SS->PersistSubDomainVersion(db, pathId, *alterData);
+
+ context.SS->RevertedMigrations[pathId].push_back(subDomain->GetTenantSchemeShardID());
+ context.SS->PersistRevertedMirgration(db, pathId, subDomain->GetTenantSchemeShardID());
+
+ alterData->SetAlterPrivate(nullptr);
+ subDomain->SetAlterPrivate(nullptr);
+
+ alterData->SetVersion(alterData->GetVersion() + 1);
+ context.SS->SubDomains[pathId] = alterData;
+
+ context.SS->PersistSubDomainVersion(db, pathId, *alterData);
context.SS->PersistSubDomainSchemeQuotas(db, pathId, *alterData);
- context.SS->PersistDeleteSubDomainAlter(db, pathId, *subDomain);
-
- item->ACLVersion += 100;
- context.SS->PersistACL(db, item);
- context.SS->ClearDescribePathCaches(item);
-
- auto subtree = context.SS->ListSubThee(pathId, context.Ctx);
- for (const TPathId pathId : subtree) {
- context.OnComplete.RePublishToSchemeBoard(OperationId, pathId);
- }
-
- TPathElement::TPtr parentItem = context.SS->PathsById.at(item->ParentPathId);
- ++parentItem->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentItem);
- context.SS->ClearDescribePathCaches(parentItem);
- context.OnComplete.RePublishToSchemeBoard(OperationId, item->ParentPathId);
-
- context.SS->ChangeTxState(db, OperationId, TTxState::DeleteTenantSS);
- context.OnComplete.ActivateTx(OperationId);
-
- UpgradeDecision = TTxState::DeleteTenantSS;
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at tablet" << ssId);
-
- TPathId pathId = txState->TargetPathId;
- TPathElement::TPtr item = context.SS->PathsById.at(pathId);
-
- item->PathType = TPathElement::EPathType::EPathTypeExtSubDomain;
-
- auto subDomain = context.SS->SubDomains.at(pathId);
- auto alterData = subDomain->GetAlter();
- Y_VERIFY(alterData);
- Y_VERIFY(subDomain->GetVersion() < alterData->GetVersion());
-
- alterData->Initialize(context.SS->ShardInfos);
+ context.SS->PersistDeleteSubDomainAlter(db, pathId, *subDomain);
+
+ item->ACLVersion += 100;
+ context.SS->PersistACL(db, item);
+ context.SS->ClearDescribePathCaches(item);
+
+ auto subtree = context.SS->ListSubThee(pathId, context.Ctx);
+ for (const TPathId pathId : subtree) {
+ context.OnComplete.RePublishToSchemeBoard(OperationId, pathId);
+ }
+
+ TPathElement::TPtr parentItem = context.SS->PathsById.at(item->ParentPathId);
+ ++parentItem->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentItem);
+ context.SS->ClearDescribePathCaches(parentItem);
+ context.OnComplete.RePublishToSchemeBoard(OperationId, item->ParentPathId);
+
+ context.SS->ChangeTxState(db, OperationId, TTxState::DeleteTenantSS);
+ context.OnComplete.ActivateTx(OperationId);
+
+ UpgradeDecision = TTxState::DeleteTenantSS;
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at tablet" << ssId);
+
+ TPathId pathId = txState->TargetPathId;
+ TPathElement::TPtr item = context.SS->PathsById.at(pathId);
+
+ item->PathType = TPathElement::EPathType::EPathTypeExtSubDomain;
+
+ auto subDomain = context.SS->SubDomains.at(pathId);
+ auto alterData = subDomain->GetAlter();
+ Y_VERIFY(alterData);
+ Y_VERIFY(subDomain->GetVersion() < alterData->GetVersion());
+
+ alterData->Initialize(context.SS->ShardInfos);
subDomain->ActualizeAlterData(context.SS->ShardInfos, context.Ctx.Now(), /* isExternal */ true, context.SS);
-
- alterData->SetAlterPrivate(subDomain);
- subDomain->SetAlterPrivate(nullptr);
- context.SS->SubDomains[pathId] = alterData;
-
- item->SwapChildren(HidenChildren);
- item->PreSerializedChildrenListing.clear();
-
- TPathElement::TPtr parentItem = context.SS->PathsById.at(item->ParentPathId);
- ++parentItem->DirAlterVersion;
- context.SS->ClearDescribePathCaches(parentItem);
- context.OnComplete.PublishToSchemeBoard(OperationId, parentItem->PathId);
-
- context.SS->ClearDescribePathCaches(item);
- context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
-
- context.OnComplete.ReadyToNotify(OperationId);
-
- return false;
- }
-};
-
-class TDeleteTenantSS: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+
+ alterData->SetAlterPrivate(subDomain);
+ subDomain->SetAlterPrivate(nullptr);
+ context.SS->SubDomains[pathId] = alterData;
+
+ item->SwapChildren(HidenChildren);
+ item->PreSerializedChildrenListing.clear();
+
+ TPathElement::TPtr parentItem = context.SS->PathsById.at(item->ParentPathId);
+ ++parentItem->DirAlterVersion;
+ context.SS->ClearDescribePathCaches(parentItem);
+ context.OnComplete.PublishToSchemeBoard(OperationId, parentItem->PathId);
+
+ context.SS->ClearDescribePathCaches(item);
+ context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
+
+ context.OnComplete.ReadyToNotify(OperationId);
+
+ return false;
+ }
+};
+
+class TDeleteTenantSS: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDeleteTenantSS"
- << " operationId: " << OperationId;
- }
-
-public:
- TDeleteTenantSS(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType,
- TEvSchemeShard::TEvMigrateSchemeShardResult::EventType,
- TEvSchemeShard::TEvInitTenantSchemeShardResult::EventType,
- TEvSchemeShard::TEvPublishTenantAsReadOnlyResult::EventType,
- TEvSchemeShard::TEvRewriteOwnerResult::EventType,
- TEvSchemeShard::TEvPublishTenantResult::EventType});
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- NIceDb::TNiceDb db(context.Txc.DB);
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at tablet" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- Y_VERIFY(txState->Shards.size() == 1);
- TShardIdx tenantShemeShardIdx = txState->Shards.front().Idx;
-
- context.OnComplete.DeleteShard(tenantShemeShardIdx);
-
- TPathId pathId = txState->TargetPathId;
- auto subDomain = context.SS->SubDomains.at(pathId);
- Y_VERIFY(subDomain);
- auto alterData = subDomain->GetAlter();
- Y_VERIFY(!alterData);
-
- context.OnComplete.ReleasePathState(OperationId, pathId, TPathElement::EPathState::EPathStateAlter);
- context.OnComplete.DoneOperation(OperationId);
- return true;
- }
-};
-
-class TRewriteOwner: public TSubOperationState {
-private:
- TOperationId OperationId;
-
- TTabletId TenantSchemeShardId = InvalidTabletId;
- TSet<TTabletId> DatashardsInside;
-
+ return TStringBuilder()
+ << "TDeleteTenantSS"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TDeleteTenantSS(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType,
+ TEvSchemeShard::TEvMigrateSchemeShardResult::EventType,
+ TEvSchemeShard::TEvInitTenantSchemeShardResult::EventType,
+ TEvSchemeShard::TEvPublishTenantAsReadOnlyResult::EventType,
+ TEvSchemeShard::TEvRewriteOwnerResult::EventType,
+ TEvSchemeShard::TEvPublishTenantResult::EventType});
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at tablet" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ Y_VERIFY(txState->Shards.size() == 1);
+ TShardIdx tenantShemeShardIdx = txState->Shards.front().Idx;
+
+ context.OnComplete.DeleteShard(tenantShemeShardIdx);
+
+ TPathId pathId = txState->TargetPathId;
+ auto subDomain = context.SS->SubDomains.at(pathId);
+ Y_VERIFY(subDomain);
+ auto alterData = subDomain->GetAlter();
+ Y_VERIFY(!alterData);
+
+ context.OnComplete.ReleasePathState(OperationId, pathId, TPathElement::EPathState::EPathStateAlter);
+ context.OnComplete.DoneOperation(OperationId);
+ return true;
+ }
+};
+
+class TRewriteOwner: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
+ TTabletId TenantSchemeShardId = InvalidTabletId;
+ TSet<TTabletId> DatashardsInside;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TRewriteOwner"
- << " operationId: " << OperationId;
- }
-
-public:
- TRewriteOwner(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType,
- TEvSchemeShard::TEvMigrateSchemeShardResult::EventType,
- TEvSchemeShard::TEvInitTenantSchemeShardResult::EventType,
- TEvSchemeShard::TEvPublishTenantAsReadOnlyResult::EventType});
- }
-
- bool HandleReply(TEvDataShard::TEvMigrateSchemeShardResponse::TPtr& ev, TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
- const NKikimrTxDataShard::TEvMigrateSchemeShardResponse& record = ev->Get()->Record;
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " HandleReply TEvDataShard::TEvMigrateSchemeShardResponse"
- << ", at tablet" << ssId);
-
- auto dataShardId = TTabletId(record.GetTabletId());
- auto status = record.GetStatus();
-
- if (!DatashardsInside.contains(dataShardId)) {
- return false;
- }
-
- Y_VERIFY(status == NKikimrTxDataShard::TEvMigrateSchemeShardResponse::Success
- || status == NKikimrTxDataShard::TEvMigrateSchemeShardResponse::Already);
-
- DatashardsInside.erase(dataShardId);
- context.OnComplete.UnbindMsgFromPipe(OperationId, dataShardId, TPipeMessageId(0, 0));
-
- auto nextEvent = NextRequest(context);
-
- if (!nextEvent) {
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::PublishTenant);
- context.OnComplete.ActivateTx(OperationId);
- return true;
- }
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint()
- << " Send next migrate schemeshard event to datashard"
- << " at schemeshard: " << ssId
- << " msg: " << nextEvent->Record.ShortDebugString());
-
- auto nextDataShardId = TTabletId(nextEvent->GetDatashardId());
- context.OnComplete.BindMsgToPipe(OperationId, nextDataShardId, TPipeMessageId(0, 0), nextEvent.Release());
-
- return false;
- }
-
-
- THolder<TEvDataShard::TEvMigrateSchemeShardRequest> NextRequest(TOperationContext& context) {
- if (!DatashardsInside) {
- return nullptr;
- }
-
- TTabletId tabletId = *DatashardsInside.begin();
-
- auto ev = MakeHolder<TEvDataShard::TEvMigrateSchemeShardRequest>();
- ev->Record.SetCurrentSchemeShardId(ui64(context.SS->SelfTabletId()));
- ev->Record.SetNewSchemeShardId(ui64(TenantSchemeShardId));
- ev->Record.SetTabletId(ui64(tabletId));
-
- return ev;
- }
-
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at tablet" << ssId);
-
- TPathId targetPathId = txState->TargetPathId;
-
- auto subDomain = context.SS->SubDomains.at(targetPathId);
- TenantSchemeShardId = subDomain->GetTenantSchemeShardID();
- Y_VERIFY(TenantSchemeShardId);
-
- auto pathesInside = context.SS->ListSubThee(targetPathId, context.Ctx);
- pathesInside.erase(targetPathId);
- for (auto pId: pathesInside) {
- TPathElement::TPtr item = context.SS->PathsById.at(pId);
-
- switch (item->PathType) {
- case NKikimrSchemeOp::EPathType::EPathTypeDir:
- // no shards
- break;
- case NKikimrSchemeOp::EPathType::EPathTypeTable:
- {
- Y_VERIFY(context.SS->Tables.contains(pId));
- TTableInfo::TPtr table = context.SS->Tables.at(pId);
- for (auto item: table->GetPartitions()) {
- auto shardIdx = item.ShardIdx;
- const auto& shardInfo = context.SS->ShardInfos.at(shardIdx);
-
- bool inserted = false;
- std::tie(std::ignore, inserted) = DatashardsInside.insert(shardInfo.TabletID);
- Y_VERIFY(inserted);
- }
- break;
- }
- case NKikimrSchemeOp::EPathType::EPathTypeTableIndex:
- // no shards
- break;
- case NKikimrSchemeOp::EPathType::EPathTypeKesus:
- // the is one shard, but it's owner shuldn't be rewritten
- break;
- default:
- Y_FAIL_S("Not implemented for " << NKikimrSchemeOp::EPathType_Name(item->PathType));
- };
- }
-
- auto event = NextRequest(context);
-
- if (!event) {
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::PublishTenant);
- context.OnComplete.ActivateTx(OperationId);
- return true;
- }
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint()
- << " Send migrate schemeshard event to datashard"
- << " at schemeshard: " << ssId
- << " msg: " << event->Record.ShortDebugString());
-
- auto dataShardId = TTabletId(event->GetDatashardId());
- context.OnComplete.BindMsgToPipe(OperationId, dataShardId, TPipeMessageId(0, 0), event.Release());
-
- return false;
- }
-};
-
-
-class TPublishTenant: public TSubOperationState {
-private:
- TOperationId OperationId;
-
+ return TStringBuilder()
+ << "TRewriteOwner"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TRewriteOwner(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType,
+ TEvSchemeShard::TEvMigrateSchemeShardResult::EventType,
+ TEvSchemeShard::TEvInitTenantSchemeShardResult::EventType,
+ TEvSchemeShard::TEvPublishTenantAsReadOnlyResult::EventType});
+ }
+
+ bool HandleReply(TEvDataShard::TEvMigrateSchemeShardResponse::TPtr& ev, TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+ const NKikimrTxDataShard::TEvMigrateSchemeShardResponse& record = ev->Get()->Record;
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " HandleReply TEvDataShard::TEvMigrateSchemeShardResponse"
+ << ", at tablet" << ssId);
+
+ auto dataShardId = TTabletId(record.GetTabletId());
+ auto status = record.GetStatus();
+
+ if (!DatashardsInside.contains(dataShardId)) {
+ return false;
+ }
+
+ Y_VERIFY(status == NKikimrTxDataShard::TEvMigrateSchemeShardResponse::Success
+ || status == NKikimrTxDataShard::TEvMigrateSchemeShardResponse::Already);
+
+ DatashardsInside.erase(dataShardId);
+ context.OnComplete.UnbindMsgFromPipe(OperationId, dataShardId, TPipeMessageId(0, 0));
+
+ auto nextEvent = NextRequest(context);
+
+ if (!nextEvent) {
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::PublishTenant);
+ context.OnComplete.ActivateTx(OperationId);
+ return true;
+ }
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint()
+ << " Send next migrate schemeshard event to datashard"
+ << " at schemeshard: " << ssId
+ << " msg: " << nextEvent->Record.ShortDebugString());
+
+ auto nextDataShardId = TTabletId(nextEvent->GetDatashardId());
+ context.OnComplete.BindMsgToPipe(OperationId, nextDataShardId, TPipeMessageId(0, 0), nextEvent.Release());
+
+ return false;
+ }
+
+
+ THolder<TEvDataShard::TEvMigrateSchemeShardRequest> NextRequest(TOperationContext& context) {
+ if (!DatashardsInside) {
+ return nullptr;
+ }
+
+ TTabletId tabletId = *DatashardsInside.begin();
+
+ auto ev = MakeHolder<TEvDataShard::TEvMigrateSchemeShardRequest>();
+ ev->Record.SetCurrentSchemeShardId(ui64(context.SS->SelfTabletId()));
+ ev->Record.SetNewSchemeShardId(ui64(TenantSchemeShardId));
+ ev->Record.SetTabletId(ui64(tabletId));
+
+ return ev;
+ }
+
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at tablet" << ssId);
+
+ TPathId targetPathId = txState->TargetPathId;
+
+ auto subDomain = context.SS->SubDomains.at(targetPathId);
+ TenantSchemeShardId = subDomain->GetTenantSchemeShardID();
+ Y_VERIFY(TenantSchemeShardId);
+
+ auto pathesInside = context.SS->ListSubThee(targetPathId, context.Ctx);
+ pathesInside.erase(targetPathId);
+ for (auto pId: pathesInside) {
+ TPathElement::TPtr item = context.SS->PathsById.at(pId);
+
+ switch (item->PathType) {
+ case NKikimrSchemeOp::EPathType::EPathTypeDir:
+ // no shards
+ break;
+ case NKikimrSchemeOp::EPathType::EPathTypeTable:
+ {
+ Y_VERIFY(context.SS->Tables.contains(pId));
+ TTableInfo::TPtr table = context.SS->Tables.at(pId);
+ for (auto item: table->GetPartitions()) {
+ auto shardIdx = item.ShardIdx;
+ const auto& shardInfo = context.SS->ShardInfos.at(shardIdx);
+
+ bool inserted = false;
+ std::tie(std::ignore, inserted) = DatashardsInside.insert(shardInfo.TabletID);
+ Y_VERIFY(inserted);
+ }
+ break;
+ }
+ case NKikimrSchemeOp::EPathType::EPathTypeTableIndex:
+ // no shards
+ break;
+ case NKikimrSchemeOp::EPathType::EPathTypeKesus:
+ // the is one shard, but it's owner shuldn't be rewritten
+ break;
+ default:
+ Y_FAIL_S("Not implemented for " << NKikimrSchemeOp::EPathType_Name(item->PathType));
+ };
+ }
+
+ auto event = NextRequest(context);
+
+ if (!event) {
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::PublishTenant);
+ context.OnComplete.ActivateTx(OperationId);
+ return true;
+ }
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint()
+ << " Send migrate schemeshard event to datashard"
+ << " at schemeshard: " << ssId
+ << " msg: " << event->Record.ShortDebugString());
+
+ auto dataShardId = TTabletId(event->GetDatashardId());
+ context.OnComplete.BindMsgToPipe(OperationId, dataShardId, TPipeMessageId(0, 0), event.Release());
+
+ return false;
+ }
+};
+
+
+class TPublishTenant: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TPublishTenant"
- << " operationId: " << OperationId;
- }
-
-public:
- TPublishTenant(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType,
- TEvSchemeShard::TEvMigrateSchemeShardResult::EventType,
- TEvSchemeShard::TEvInitTenantSchemeShardResult::EventType,
- TEvSchemeShard::TEvPublishTenantAsReadOnlyResult::EventType,
- TEvSchemeShard::TEvRewriteOwnerResult::EventType});
- }
-
- bool HandleReply(TEvSchemeShard::TEvPublishTenantResult::TPtr& /*ev*/, TOperationContext& context) override {
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->ChangeTxState(db, OperationId, TTxState::DoneMigrateTree);
- context.OnComplete.ActivateTx(OperationId);
- return true;
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at tablet" << ssId);
-
- TPathId pathId = txState->TargetPathId;
-
- auto event = new TEvSchemeShard::TEvPublishTenant(ui64(ssId));
-
- auto subDomain = context.SS->SubDomains.at(pathId);
- auto tenantSchemeShardId = TTabletId(subDomain->GetProcessingParams().GetSchemeShard());
-
- LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint()
- << "Send publish request to schemeshard: " << tenantSchemeShardId
- << " schemeshard: " << ssId
- << " msg: " << event->Record.ShortDebugString());
- context.OnComplete.BindMsgToPipe(OperationId, tenantSchemeShardId, pathId, event);
-
- return false;
- }
-};
-
-class TDoneMigrateTree: public TSubOperationState {
-private:
- TOperationId OperationId;
-
- //we do not forget any shards. We leave them until database life. And we ensure it deleted at the removing databse
- //but hang up them to the domain path
- TDeque<TShardIdx> ShardsToRememder;
-
- bool IsInited = false;
-
+ return TStringBuilder()
+ << "TPublishTenant"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TPublishTenant(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType,
+ TEvSchemeShard::TEvMigrateSchemeShardResult::EventType,
+ TEvSchemeShard::TEvInitTenantSchemeShardResult::EventType,
+ TEvSchemeShard::TEvPublishTenantAsReadOnlyResult::EventType,
+ TEvSchemeShard::TEvRewriteOwnerResult::EventType});
+ }
+
+ bool HandleReply(TEvSchemeShard::TEvPublishTenantResult::TPtr& /*ev*/, TOperationContext& context) override {
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->ChangeTxState(db, OperationId, TTxState::DoneMigrateTree);
+ context.OnComplete.ActivateTx(OperationId);
+ return true;
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at tablet" << ssId);
+
+ TPathId pathId = txState->TargetPathId;
+
+ auto event = new TEvSchemeShard::TEvPublishTenant(ui64(ssId));
+
+ auto subDomain = context.SS->SubDomains.at(pathId);
+ auto tenantSchemeShardId = TTabletId(subDomain->GetProcessingParams().GetSchemeShard());
+
+ LOG_DEBUG_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint()
+ << "Send publish request to schemeshard: " << tenantSchemeShardId
+ << " schemeshard: " << ssId
+ << " msg: " << event->Record.ShortDebugString());
+ context.OnComplete.BindMsgToPipe(OperationId, tenantSchemeShardId, pathId, event);
+
+ return false;
+ }
+};
+
+class TDoneMigrateTree: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
+ //we do not forget any shards. We leave them until database life. And we ensure it deleted at the removing databse
+ //but hang up them to the domain path
+ TDeque<TShardIdx> ShardsToRememder;
+
+ bool IsInited = false;
+
TString DebugHint() const override {
- return TStringBuilder()
- << "TDoneMigrateTree"
- << " operationId: " << OperationId;
- }
-
-public:
- TDoneMigrateTree(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType,
- TEvSchemeShard::TEvMigrateSchemeShardResult::EventType,
- TEvSchemeShard::TEvInitTenantSchemeShardResult::EventType,
- TEvSchemeShard::TEvPublishTenantAsReadOnlyResult::EventType,
- TEvSchemeShard::TEvRewriteOwnerResult::EventType,
- TEvSchemeShard::TEvPublishTenantResult::EventType});
- }
-
- void Init(TPathId pathId, TOperationContext& context) {
- if (IsInited) {
- return;
- }
- IsInited = true;
-
- auto pathes = context.SS->ListSubThee(pathId, context.Ctx);
- pathes.erase(pathId);
-
- auto shards = context.SS->CollectAllShards(pathes);
- ShardsToRememder.assign(shards.begin(), shards.end());
- }
-
- bool ProgressState(TOperationContext& context) override {
- auto ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at tablet" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
- Y_VERIFY(txState);
-
- Init(txState->TargetPathId, context);
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- if (!ShardsToRememder.empty()) {
- const auto shardIdx = ShardsToRememder.back();
- TShardInfo& shardInfo = context.SS->ShardInfos.at(shardIdx);
-
+ return TStringBuilder()
+ << "TDoneMigrateTree"
+ << " operationId: " << OperationId;
+ }
+
+public:
+ TDoneMigrateTree(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), {TEvHive::TEvCreateTabletReply::EventType,
+ TEvSchemeShard::TEvMigrateSchemeShardResult::EventType,
+ TEvSchemeShard::TEvInitTenantSchemeShardResult::EventType,
+ TEvSchemeShard::TEvPublishTenantAsReadOnlyResult::EventType,
+ TEvSchemeShard::TEvRewriteOwnerResult::EventType,
+ TEvSchemeShard::TEvPublishTenantResult::EventType});
+ }
+
+ void Init(TPathId pathId, TOperationContext& context) {
+ if (IsInited) {
+ return;
+ }
+ IsInited = true;
+
+ auto pathes = context.SS->ListSubThee(pathId, context.Ctx);
+ pathes.erase(pathId);
+
+ auto shards = context.SS->CollectAllShards(pathes);
+ ShardsToRememder.assign(shards.begin(), shards.end());
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ auto ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at tablet" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+ Y_VERIFY(txState);
+
+ Init(txState->TargetPathId, context);
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ if (!ShardsToRememder.empty()) {
+ const auto shardIdx = ShardsToRememder.back();
+ TShardInfo& shardInfo = context.SS->ShardInfos.at(shardIdx);
+
context.SS->IncrementPathDbRefCount(txState->TargetPathId);
context.SS->DecrementPathDbRefCount(shardInfo.PathId);
- shardInfo.PathId = txState->TargetPathId;
- db.Table<Schema::SubDomainShards>().Key(txState->TargetPathId.LocalPathId, shardIdx.GetLocalId()).Update();
- db.Table<Schema::Shards>().Key(shardIdx.GetLocalId()).Update(
- NIceDb::TUpdate<Schema::Shards::PathId>(txState->TargetPathId.LocalPathId));
-
- shardInfo.CurrentTxId = OperationId.GetTxId();
- context.SS->PersistShardTx(db, shardIdx, OperationId.GetTxId());
-
- TPathElement::TPtr domainPath = context.SS->PathsById.at(txState->TargetPathId);
- domainPath->IncShardsInside();
- TSubDomainInfo::TPtr domainInfo = context.SS->ResolveDomainInfo(txState->TargetPathId);
- domainInfo->AddPrivateShard(shardIdx);
-
-
- ShardsToRememder.pop_back();
- context.OnComplete.ActivateTx(OperationId);
-
- return false;
- }
-
- TPathId pathId = txState->TargetPathId;
-
- auto path = context.SS->PathsById.at(pathId);
- ++path->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, path);
- context.SS->ClearDescribePathCaches(path);
- context.OnComplete.RePublishToSchemeBoard(OperationId, pathId);
-
- auto parentPath = context.SS->PathsById.at(path->ParentPathId);
- ++parentPath->DirAlterVersion;
- context.SS->PersistPathDirAlterVersion(db, parentPath);
- context.SS->ClearDescribePathCaches(parentPath);
- context.OnComplete.RePublishToSchemeBoard(OperationId, parentPath->PathId);
-
- context.OnComplete.ReleasePathState(OperationId, pathId, TPathElement::EPathState::EPathStateAlter);
- context.OnComplete.DoneOperation(OperationId);
-
- context.OnComplete.UpdateTenant(txState->TargetPathId);
-
- return true;
- }
-};
-
-class TUpgradeSubDomain: public TSubOperation {
-private:
- const TOperationId OperationId;
- const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState UpgradeSubDomainDecision = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::Waiting;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- return TTxState::CreateParts;
- case TTxState::CreateParts:
- return TTxState::ConfigureParts;
- case TTxState::ConfigureParts:
- return TTxState::PublishTenantReadOnly;
- case TTxState::PublishTenantReadOnly:
- return TTxState::PublishGlobal;
- case TTxState::PublishGlobal:
- return UpgradeSubDomainDecision;
-
- case TTxState::RewriteOwners:
- return TTxState::PublishTenant;
- case TTxState::PublishTenant:
- return TTxState::DoneMigrateTree;
-
- case TTxState::DeleteTenantSS:
- return TTxState::Invalid;
-
- default:
- return TTxState::Invalid;
- }
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
+ shardInfo.PathId = txState->TargetPathId;
+ db.Table<Schema::SubDomainShards>().Key(txState->TargetPathId.LocalPathId, shardIdx.GetLocalId()).Update();
+ db.Table<Schema::Shards>().Key(shardIdx.GetLocalId()).Update(
+ NIceDb::TUpdate<Schema::Shards::PathId>(txState->TargetPathId.LocalPathId));
+
+ shardInfo.CurrentTxId = OperationId.GetTxId();
+ context.SS->PersistShardTx(db, shardIdx, OperationId.GetTxId());
+
+ TPathElement::TPtr domainPath = context.SS->PathsById.at(txState->TargetPathId);
+ domainPath->IncShardsInside();
+ TSubDomainInfo::TPtr domainInfo = context.SS->ResolveDomainInfo(txState->TargetPathId);
+ domainInfo->AddPrivateShard(shardIdx);
+
+
+ ShardsToRememder.pop_back();
+ context.OnComplete.ActivateTx(OperationId);
+
+ return false;
+ }
+
+ TPathId pathId = txState->TargetPathId;
+
+ auto path = context.SS->PathsById.at(pathId);
+ ++path->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, path);
+ context.SS->ClearDescribePathCaches(path);
+ context.OnComplete.RePublishToSchemeBoard(OperationId, pathId);
+
+ auto parentPath = context.SS->PathsById.at(path->ParentPathId);
+ ++parentPath->DirAlterVersion;
+ context.SS->PersistPathDirAlterVersion(db, parentPath);
+ context.SS->ClearDescribePathCaches(parentPath);
+ context.OnComplete.RePublishToSchemeBoard(OperationId, parentPath->PathId);
+
+ context.OnComplete.ReleasePathState(OperationId, pathId, TPathElement::EPathState::EPathStateAlter);
+ context.OnComplete.DoneOperation(OperationId);
+
+ context.OnComplete.UpdateTenant(txState->TargetPathId);
+
+ return true;
+ }
+};
+
+class TUpgradeSubDomain: public TSubOperation {
+private:
+ const TOperationId OperationId;
+ const TTxTransaction Transaction;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState UpgradeSubDomainDecision = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::Waiting;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ return TTxState::CreateParts;
+ case TTxState::CreateParts:
+ return TTxState::ConfigureParts;
+ case TTxState::ConfigureParts:
+ return TTxState::PublishTenantReadOnly;
+ case TTxState::PublishTenantReadOnly:
+ return TTxState::PublishGlobal;
+ case TTxState::PublishGlobal:
+ return UpgradeSubDomainDecision;
+
+ case TTxState::RewriteOwners:
+ return TTxState::PublishTenant;
+ case TTxState::PublishTenant:
+ return TTxState::DoneMigrateTree;
+
+ case TTxState::DeleteTenantSS:
+ return TTxState::Invalid;
+
+ default:
+ return TTxState::Invalid;
+ }
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
return THolder(new TWait(OperationId));
- case TTxState::CreateParts:
+ case TTxState::CreateParts:
return THolder(new TCreateParts(OperationId));
- case TTxState::ConfigureParts:
+ case TTxState::ConfigureParts:
return THolder(new TConfigure(OperationId));
- case TTxState::PublishTenantReadOnly:
+ case TTxState::PublishTenantReadOnly:
return THolder(new TPublishTenantReadOnly(OperationId));
- case TTxState::PublishGlobal:
+ case TTxState::PublishGlobal:
return THolder(new TPublishGlobal(OperationId, UpgradeSubDomainDecision));
-
- case TTxState::RewriteOwners:
+
+ case TTxState::RewriteOwners:
return THolder(new TRewriteOwner(OperationId));
- case TTxState::PublishTenant:
+ case TTxState::PublishTenant:
return THolder(new TPublishTenant(OperationId));
- case TTxState::DoneMigrateTree:
+ case TTxState::DoneMigrateTree:
return THolder(new TDoneMigrateTree(OperationId));
-
- case TTxState::DeleteTenantSS:
+
+ case TTxState::DeleteTenantSS:
return THolder(new TDeleteTenantSS(OperationId));
-
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
- TUpgradeSubDomain(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
- , Transaction(tx)
- {
- }
-
- TUpgradeSubDomain(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
- const auto& info = Transaction.GetUpgradeSubDomain();
-
- const TString& parentPathStr = Transaction.GetWorkingDir();
- const TString& name = info.GetName();
-
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TUpgradeSubDomain Propose"
- << ", path: " << parentPathStr << "/" << name
- << ", opId: " << OperationId
- << ", at schemeshard: " << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
- TString errStr;
-
- TPath parentPath = TPath::Resolve(parentPathStr, context.SS);
- TPath path = parentPath.Child(name);
- {
- TPath::TChecker checks = path.Check();
- checks
- .NotEmpty()
- .IsResolved()
- .NotDeleted()
- .IsSubDomain()
- .NotUnderOperation()
- .ShardsLimit(1);
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- auto pathId = path.Base()->PathId;
-
- Y_VERIFY(context.SS->SubDomains.contains(pathId));
- TSubDomainInfo::TPtr subDomain = context.SS->SubDomains.at(pathId);
- if (!subDomain->IsSupportTransactions()) {
- result->SetError(NKikimrScheme::StatusSchemeError, "There are no sence to upgrade subdomain with out transactions support (NBS?).");
- return result;
- }
-
- TChannelsBindings channelBindings;
- if (!context.SS->ResolveSubdomainsChannels(subDomain->GetStoragePools(), channelBindings)) {
- result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable construct channels binding");
- return result;
- }
-
- const THashSet<TPathElement::EPathType> allowedPathesToUpgrade = {
- TPathElement::EPathType::EPathTypeDir,
- TPathElement::EPathType::EPathTypeTable,
- TPathElement::EPathType::EPathTypeTableIndex,
- TPathElement::EPathType::EPathTypeKesus
- };
-
- auto pathesInside = context.SS->ListSubThee(pathId, context.Ctx);
- for (auto pId: pathesInside) {
- if (pId == pathId) {
- continue;
- }
-
- auto pElem = context.SS->PathsById.at(pId);
- if (allowedPathesToUpgrade.contains(pElem->PathType)) {
- continue;
- }
-
- TString msg = TStringBuilder() << "Unable to upgrade subdomain"
- << ", path type " << NKikimrSchemeOp::EPathType_Name(pElem->PathType) << " is forbiden to migrate"
- << ", pathId: " << pId;
- result->SetError(NKikimrScheme::StatusPreconditionFailed, msg);
- return result;
- }
-
- for (auto pId: pathesInside) {
- if (!context.SS->LockedPaths.contains(pId)) {
- continue;
- }
-
- auto pElem = context.SS->PathsById.at(pId);
- TString msg = TStringBuilder() << "Unable to upgrade subdomain"
- << "path under lock has been found"
- << ", path id: " << pId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(pElem->PathType)
- << ", path state: " << NKikimrSchemeOp::EPathState_Name(pElem->PathState)
- << ", locked by: " << context.SS->LockedPaths.at(pId);
- result->SetError(NKikimrScheme::StatusMultipleModifications, msg);
- return result;
- }
-
- TSubDomainInfo::TPtr alterData = new TSubDomainInfo(*subDomain,
- subDomain->GetPlanResolution(),
- subDomain->GetTCB());
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxUpgradeSubDomain, pathId);
- txState.State = TTxState::Waiting;
- path.Base()->PathState = TPathElement::EPathState::EPathStateUpgrade;
-
- // add tenant schemeshard into tx shards
+
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
+ TUpgradeSubDomain(TOperationId id, const TTxTransaction& tx)
+ : OperationId(id)
+ , Transaction(tx)
+ {
+ }
+
+ TUpgradeSubDomain(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ const auto& info = Transaction.GetUpgradeSubDomain();
+
+ const TString& parentPathStr = Transaction.GetWorkingDir();
+ const TString& name = info.GetName();
+
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TUpgradeSubDomain Propose"
+ << ", path: " << parentPathStr << "/" << name
+ << ", opId: " << OperationId
+ << ", at schemeshard: " << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+ TString errStr;
+
+ TPath parentPath = TPath::Resolve(parentPathStr, context.SS);
+ TPath path = parentPath.Child(name);
+ {
+ TPath::TChecker checks = path.Check();
+ checks
+ .NotEmpty()
+ .IsResolved()
+ .NotDeleted()
+ .IsSubDomain()
+ .NotUnderOperation()
+ .ShardsLimit(1);
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ if (!context.SS->CheckApplyIf(Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ auto pathId = path.Base()->PathId;
+
+ Y_VERIFY(context.SS->SubDomains.contains(pathId));
+ TSubDomainInfo::TPtr subDomain = context.SS->SubDomains.at(pathId);
+ if (!subDomain->IsSupportTransactions()) {
+ result->SetError(NKikimrScheme::StatusSchemeError, "There are no sence to upgrade subdomain with out transactions support (NBS?).");
+ return result;
+ }
+
+ TChannelsBindings channelBindings;
+ if (!context.SS->ResolveSubdomainsChannels(subDomain->GetStoragePools(), channelBindings)) {
+ result->SetError(NKikimrScheme::StatusInvalidParameter, "Unable construct channels binding");
+ return result;
+ }
+
+ const THashSet<TPathElement::EPathType> allowedPathesToUpgrade = {
+ TPathElement::EPathType::EPathTypeDir,
+ TPathElement::EPathType::EPathTypeTable,
+ TPathElement::EPathType::EPathTypeTableIndex,
+ TPathElement::EPathType::EPathTypeKesus
+ };
+
+ auto pathesInside = context.SS->ListSubThee(pathId, context.Ctx);
+ for (auto pId: pathesInside) {
+ if (pId == pathId) {
+ continue;
+ }
+
+ auto pElem = context.SS->PathsById.at(pId);
+ if (allowedPathesToUpgrade.contains(pElem->PathType)) {
+ continue;
+ }
+
+ TString msg = TStringBuilder() << "Unable to upgrade subdomain"
+ << ", path type " << NKikimrSchemeOp::EPathType_Name(pElem->PathType) << " is forbiden to migrate"
+ << ", pathId: " << pId;
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, msg);
+ return result;
+ }
+
+ for (auto pId: pathesInside) {
+ if (!context.SS->LockedPaths.contains(pId)) {
+ continue;
+ }
+
+ auto pElem = context.SS->PathsById.at(pId);
+ TString msg = TStringBuilder() << "Unable to upgrade subdomain"
+ << "path under lock has been found"
+ << ", path id: " << pId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(pElem->PathType)
+ << ", path state: " << NKikimrSchemeOp::EPathState_Name(pElem->PathState)
+ << ", locked by: " << context.SS->LockedPaths.at(pId);
+ result->SetError(NKikimrScheme::StatusMultipleModifications, msg);
+ return result;
+ }
+
+ TSubDomainInfo::TPtr alterData = new TSubDomainInfo(*subDomain,
+ subDomain->GetPlanResolution(),
+ subDomain->GetTCB());
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxUpgradeSubDomain, pathId);
+ txState.State = TTxState::Waiting;
+ path.Base()->PathState = TPathElement::EPathState::EPathStateUpgrade;
+
+ // add tenant schemeshard into tx shards
const TShardIdx shardIdx = context.SS->RegisterShardInfo(
TShardInfo(OperationId.GetTxId(), pathId, TTabletTypes::SchemeShard)
.WithBindedChannels(channelBindings));
const TShardInfo& shardInfo = context.SS->ShardInfos.at(shardIdx);
- txState.Shards.emplace_back(shardIdx, TTabletTypes::SchemeShard, TTxState::CreateParts);
- alterData->AddPrivateShard(shardIdx);
- subDomain->SetAlter(alterData);
-
-
- NIceDb::TNiceDb db(context.Txc.DB);
- context.SS->PersistUpdateNextShardIdx(db);
-
- context.SS->PersistTxState(db, OperationId);
- context.SS->PersistShardTx(db, shardIdx, OperationId.GetTxId());
-
- context.SS->PersistShardMapping(db, shardIdx, InvalidTabletId, shardInfo.PathId, shardInfo.CurrentTxId, shardInfo.TabletType);
- context.SS->PersistChannelsBinding(db, shardIdx, shardInfo.BindedChannels);
-
- context.SS->PersistSubDomainAlter(db, pathId, *alterData);
-
- // wait all transaction inside
- auto relatedTx = context.SS->GetRelatedTransactions(pathesInside, context.Ctx);
- for (auto otherTxId: relatedTx) {
- if (otherTxId == OperationId.GetTxId()) {
- continue;
- }
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TUpgradeSubDomain Propose, dependence has found"
- << ", dependent transaction: " << OperationId.GetTxId()
- << ", parent transaction: " << otherTxId
- << ", at schemeshard: " << ssId);
-
- Y_VERIFY(context.SS->Operations.contains(otherTxId));
- context.OnComplete.Dependence(otherTxId, OperationId.GetTxId());
- }
-
- path.DomainInfo()->AddInternalShards(txState);
- path.Base()->IncShardsInside();
-
- State = NextState();
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- return result;
- }
-
- void AbortPropose(TOperationContext&) override {
- Y_FAIL("no AbortPropose for TUpgradeSubDomain");
- }
-
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TUpgradeSubDomain AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
- << ", at schemeshard: " << context.SS->TabletID());
-
- TTxState* upgradeState = context.SS->FindTx(OperationId);
- Y_VERIFY(upgradeState);
- Y_VERIFY(upgradeState->TxType == TTxState::TxUpgradeSubDomain);
-
- if (upgradeState->State == TTxState::PublishGlobal) {
- Y_VERIFY(context.SS->Operations.contains(OperationId.GetTxId()));
- TOperation::TPtr operation = context.SS->Operations.at(OperationId.GetTxId());
- Y_VERIFY(operation->Parts.size());
-
+ txState.Shards.emplace_back(shardIdx, TTabletTypes::SchemeShard, TTxState::CreateParts);
+ alterData->AddPrivateShard(shardIdx);
+ subDomain->SetAlter(alterData);
+
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+ context.SS->PersistUpdateNextShardIdx(db);
+
+ context.SS->PersistTxState(db, OperationId);
+ context.SS->PersistShardTx(db, shardIdx, OperationId.GetTxId());
+
+ context.SS->PersistShardMapping(db, shardIdx, InvalidTabletId, shardInfo.PathId, shardInfo.CurrentTxId, shardInfo.TabletType);
+ context.SS->PersistChannelsBinding(db, shardIdx, shardInfo.BindedChannels);
+
+ context.SS->PersistSubDomainAlter(db, pathId, *alterData);
+
+ // wait all transaction inside
+ auto relatedTx = context.SS->GetRelatedTransactions(pathesInside, context.Ctx);
+ for (auto otherTxId: relatedTx) {
+ if (otherTxId == OperationId.GetTxId()) {
+ continue;
+ }
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TUpgradeSubDomain Propose, dependence has found"
+ << ", dependent transaction: " << OperationId.GetTxId()
+ << ", parent transaction: " << otherTxId
+ << ", at schemeshard: " << ssId);
+
+ Y_VERIFY(context.SS->Operations.contains(otherTxId));
+ context.OnComplete.Dependence(otherTxId, OperationId.GetTxId());
+ }
+
+ path.DomainInfo()->AddInternalShards(txState);
+ path.Base()->IncShardsInside();
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ return result;
+ }
+
+ void AbortPropose(TOperationContext&) override {
+ Y_FAIL("no AbortPropose for TUpgradeSubDomain");
+ }
+
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TUpgradeSubDomain AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ TTxState* upgradeState = context.SS->FindTx(OperationId);
+ Y_VERIFY(upgradeState);
+ Y_VERIFY(upgradeState->TxType == TTxState::TxUpgradeSubDomain);
+
+ if (upgradeState->State == TTxState::PublishGlobal) {
+ Y_VERIFY(context.SS->Operations.contains(OperationId.GetTxId()));
+ TOperation::TPtr operation = context.SS->Operations.at(OperationId.GetTxId());
+ Y_VERIFY(operation->Parts.size());
+
THolder<TEvPrivate::TEvUndoTenantUpdate> msg = MakeHolder<TEvPrivate::TEvUndoTenantUpdate>();
- TEvPrivate::TEvUndoTenantUpdate::TPtr personalEv = (TEventHandle<TEvPrivate::TEvUndoTenantUpdate>*) new IEventHandle(
+ TEvPrivate::TEvUndoTenantUpdate::TPtr personalEv = (TEventHandle<TEvPrivate::TEvUndoTenantUpdate>*) new IEventHandle(
context.SS->SelfId(), context.SS->SelfId(), msg.Release());
- operation->Parts.front()->HandleReply(personalEv, context);
- }
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-class TDecisionDone: public TSubOperationState {
-private:
- TOperationId OperationId;
-
- TString DebugHint() const override {
- return TStringBuilder()
- << "TDecisionDone operationId#" << OperationId;
- }
-
-public:
- TDecisionDone(TOperationId id)
- : OperationId(id)
- {
- IgnoreMessages(DebugHint(), AllIncomingEvents());
- }
-
- bool ProgressState(TOperationContext& context) override {
- TTabletId ssId = context.SS->SelfTabletId();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- DebugHint() << " ProgressState"
- << ", at schemeshard" << ssId);
-
- TTxState* txState = context.SS->FindTx(OperationId);
-
- TPathId pathId = txState->TargetPathId;
- Y_VERIFY(context.SS->PathsById.contains(pathId));
- TPathElement::TPtr path = context.SS->PathsById.at(pathId);
-
- Y_VERIFY_S(path->PathState == TPathElement::EPathState::EPathStateAlter,
- "with context"
- << ", PathState: " << NKikimrSchemeOp::EPathState_Name(path->PathState)
- << ", PathId: " << path->PathId
- << ", PathName: " << path->Name);
-
- context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
- context.OnComplete.ReleasePathState(OperationId, pathId, TPathElement::EPathState::EPathStateNoChanges);
-
- context.OnComplete.DoneOperation(OperationId);
- return true;
- }
-};
-
-class TUpgradeSubDomainDecision: public TSubOperation {
-private:
- const TOperationId OperationId;
- const TTxTransaction Transaction;
- TTxState::ETxState State = TTxState::Invalid;
-
- TTxState::ETxState NextState() {
- return TTxState::Done;
- }
-
- TTxState::ETxState NextState(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- return TTxState::Done;
- default:
- return TTxState::Invalid;
- }
- }
-
- TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
- switch(state) {
- case TTxState::Waiting:
- case TTxState::Done:
+ operation->Parts.front()->HandleReply(personalEv, context);
+ }
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+class TDecisionDone: public TSubOperationState {
+private:
+ TOperationId OperationId;
+
+ TString DebugHint() const override {
+ return TStringBuilder()
+ << "TDecisionDone operationId#" << OperationId;
+ }
+
+public:
+ TDecisionDone(TOperationId id)
+ : OperationId(id)
+ {
+ IgnoreMessages(DebugHint(), AllIncomingEvents());
+ }
+
+ bool ProgressState(TOperationContext& context) override {
+ TTabletId ssId = context.SS->SelfTabletId();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ DebugHint() << " ProgressState"
+ << ", at schemeshard" << ssId);
+
+ TTxState* txState = context.SS->FindTx(OperationId);
+
+ TPathId pathId = txState->TargetPathId;
+ Y_VERIFY(context.SS->PathsById.contains(pathId));
+ TPathElement::TPtr path = context.SS->PathsById.at(pathId);
+
+ Y_VERIFY_S(path->PathState == TPathElement::EPathState::EPathStateAlter,
+ "with context"
+ << ", PathState: " << NKikimrSchemeOp::EPathState_Name(path->PathState)
+ << ", PathId: " << path->PathId
+ << ", PathName: " << path->Name);
+
+ context.OnComplete.PublishToSchemeBoard(OperationId, pathId);
+ context.OnComplete.ReleasePathState(OperationId, pathId, TPathElement::EPathState::EPathStateNoChanges);
+
+ context.OnComplete.DoneOperation(OperationId);
+ return true;
+ }
+};
+
+class TUpgradeSubDomainDecision: public TSubOperation {
+private:
+ const TOperationId OperationId;
+ const TTxTransaction Transaction;
+ TTxState::ETxState State = TTxState::Invalid;
+
+ TTxState::ETxState NextState() {
+ return TTxState::Done;
+ }
+
+ TTxState::ETxState NextState(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ return TTxState::Done;
+ default:
+ return TTxState::Invalid;
+ }
+ }
+
+ TSubOperationState::TPtr SelectStateFunc(TTxState::ETxState state) {
+ switch(state) {
+ case TTxState::Waiting:
+ case TTxState::Done:
return THolder(new TDecisionDone(OperationId));
- default:
- return nullptr;
- }
- }
-
- void StateDone(TOperationContext& context) override {
- State = NextState(State);
-
- if (State != TTxState::Invalid) {
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
- }
- }
-
-public:
- TUpgradeSubDomainDecision(TOperationId id, const TTxTransaction& tx)
- : OperationId(id)
- , Transaction(tx)
- {
- }
-
- TUpgradeSubDomainDecision(TOperationId id, TTxState::ETxState state)
- : OperationId(id)
- , State(state)
- {
- SetState(SelectStateFunc(state));
- }
-
- THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
- const TTabletId ssId = context.SS->SelfTabletId();
-
- const auto& info = Transaction.GetUpgradeSubDomain();
- auto decision = info.GetDecision();
-
- const TString& parentPathStr = Transaction.GetWorkingDir();
- const TString& name = info.GetName();
-
- LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TUpgradeSubDomainDecision Propose "
- << " path: " << parentPathStr << "/" << name
- << " decision: " << NKikimrSchemeOp::TUpgradeSubDomain::EDecision_Name(decision)
- << ", at tablet" << ssId);
-
- auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
- TString errStr;
-
- TPath path = TPath::Resolve(parentPathStr, context.SS).Dive(name);
- {
- TPath::TChecker checks = path.Check();
- checks
- .NotEmpty()
- .IsResolved()
- .NotDeleted()
- .IsExternalSubDomain()
- .IsUnderOperation();
-
- if (!checks) {
- TString explain = TStringBuilder() << "path fail checks"
- << ", path: " << path.PathString();
- auto status = checks.GetStatus(&explain);
- result->SetError(status, explain);
- return result;
- }
- }
-
- if (!context.SS->CheckApplyIf(Transaction, errStr)) {
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- TTxId txId = path.Base()->LastTxId;
- if (!context.SS->Operations.contains(txId)) {
- errStr = "no transaction has been found at path";
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
- TOperation::TPtr operation = context.SS->Operations.at(txId);
- Y_VERIFY(operation->Parts.size());
-
- TTxState* upgradeState = context.SS->FindTx(TOperationId(txId, 0));
- Y_VERIFY(upgradeState);
- if (upgradeState->TxType != TTxState::TxUpgradeSubDomain) {
- errStr = "no update subdomain transaction has been found at path";
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- if (upgradeState->State != TTxState::PublishGlobal) {
- errStr = "no update subdomain transaction has been found at path";
- result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
- return result;
- }
-
- switch (decision) {
- case NKikimrSchemeOp::TUpgradeSubDomain::Commit: {
+ default:
+ return nullptr;
+ }
+ }
+
+ void StateDone(TOperationContext& context) override {
+ State = NextState(State);
+
+ if (State != TTxState::Invalid) {
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+ }
+ }
+
+public:
+ TUpgradeSubDomainDecision(TOperationId id, const TTxTransaction& tx)
+ : OperationId(id)
+ , Transaction(tx)
+ {
+ }
+
+ TUpgradeSubDomainDecision(TOperationId id, TTxState::ETxState state)
+ : OperationId(id)
+ , State(state)
+ {
+ SetState(SelectStateFunc(state));
+ }
+
+ THolder<TProposeResponse> Propose(const TString&, TOperationContext& context) override {
+ const TTabletId ssId = context.SS->SelfTabletId();
+
+ const auto& info = Transaction.GetUpgradeSubDomain();
+ auto decision = info.GetDecision();
+
+ const TString& parentPathStr = Transaction.GetWorkingDir();
+ const TString& name = info.GetName();
+
+ LOG_INFO_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TUpgradeSubDomainDecision Propose "
+ << " path: " << parentPathStr << "/" << name
+ << " decision: " << NKikimrSchemeOp::TUpgradeSubDomain::EDecision_Name(decision)
+ << ", at tablet" << ssId);
+
+ auto result = MakeHolder<TProposeResponse>(NKikimrScheme::StatusAccepted, ui64(OperationId.GetTxId()), ui64(ssId));
+ TString errStr;
+
+ TPath path = TPath::Resolve(parentPathStr, context.SS).Dive(name);
+ {
+ TPath::TChecker checks = path.Check();
+ checks
+ .NotEmpty()
+ .IsResolved()
+ .NotDeleted()
+ .IsExternalSubDomain()
+ .IsUnderOperation();
+
+ if (!checks) {
+ TString explain = TStringBuilder() << "path fail checks"
+ << ", path: " << path.PathString();
+ auto status = checks.GetStatus(&explain);
+ result->SetError(status, explain);
+ return result;
+ }
+ }
+
+ if (!context.SS->CheckApplyIf(Transaction, errStr)) {
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ TTxId txId = path.Base()->LastTxId;
+ if (!context.SS->Operations.contains(txId)) {
+ errStr = "no transaction has been found at path";
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+ TOperation::TPtr operation = context.SS->Operations.at(txId);
+ Y_VERIFY(operation->Parts.size());
+
+ TTxState* upgradeState = context.SS->FindTx(TOperationId(txId, 0));
+ Y_VERIFY(upgradeState);
+ if (upgradeState->TxType != TTxState::TxUpgradeSubDomain) {
+ errStr = "no update subdomain transaction has been found at path";
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ if (upgradeState->State != TTxState::PublishGlobal) {
+ errStr = "no update subdomain transaction has been found at path";
+ result->SetError(NKikimrScheme::StatusPreconditionFailed, errStr);
+ return result;
+ }
+
+ switch (decision) {
+ case NKikimrSchemeOp::TUpgradeSubDomain::Commit: {
THolder<TEvPrivate::TEvCommitTenantUpdate> msg = MakeHolder<TEvPrivate::TEvCommitTenantUpdate>();
- TEvPrivate::TEvCommitTenantUpdate::TPtr personalEv = (TEventHandle<TEvPrivate::TEvCommitTenantUpdate>*) new IEventHandle(
+ TEvPrivate::TEvCommitTenantUpdate::TPtr personalEv = (TEventHandle<TEvPrivate::TEvCommitTenantUpdate>*) new IEventHandle(
context.SS->SelfId(), context.SS->SelfId(), msg.Release());
- operation->Parts.front()->HandleReply(personalEv, context);
- break;
- }
- case NKikimrSchemeOp::TUpgradeSubDomain::Undo: {
+ operation->Parts.front()->HandleReply(personalEv, context);
+ break;
+ }
+ case NKikimrSchemeOp::TUpgradeSubDomain::Undo: {
THolder<TEvPrivate::TEvUndoTenantUpdate> msg = MakeHolder<TEvPrivate::TEvUndoTenantUpdate>();
- TEvPrivate::TEvUndoTenantUpdate::TPtr personalEv = (TEventHandle<TEvPrivate::TEvUndoTenantUpdate>*) new IEventHandle(
+ TEvPrivate::TEvUndoTenantUpdate::TPtr personalEv = (TEventHandle<TEvPrivate::TEvUndoTenantUpdate>*) new IEventHandle(
context.SS->SelfId(), context.SS->SelfId(), msg.Release());
- operation->Parts.front()->HandleReply(personalEv, context);
- break;
- }
- case NKikimrSchemeOp::TUpgradeSubDomain::Invalid:
- errStr = "Invalid task param";
- result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
- return result;
- };
-
- TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxUpgradeSubDomainDecision, path.Base()->PathId);
- txState.State = TTxState::Waiting;
-
- NIceDb::TNiceDb db(context.Txc.DB);
-
- context.SS->PersistTxState(db, OperationId);
-
- TStringBuilder errMsg;
- errMsg << "TWait ProgressState"
- << ", dependent transaction: " << OperationId.GetTxId()
- << ", parent transaction: " << txId
- << ", at schemeshard: " << ssId;
-
- LOG_ERROR_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, errMsg);
-
- context.OnComplete.Dependence(txId, OperationId.GetTxId());
-
- State = NextState();
- SetState(SelectStateFunc(State));
- context.OnComplete.ActivateTx(OperationId);
-
- return result;
- }
-
- void AbortPropose(TOperationContext&) override {
- Y_FAIL("no AbortPropose for TUpgradeSubDomainDecision");
- }
-
- void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
- LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TUpgradeSubDomainDecision AbortUnsafe"
- << ", opId: " << OperationId
- << ", forceDropId: " << forceDropTxId
- << ", at schemeshard: " << context.SS->TabletID());
-
- context.OnComplete.DoneOperation(OperationId);
- }
-};
-
-}
-
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-ISubOperationBase::TPtr CreateUpgradeSubDomain(TOperationId id, const TTxTransaction& tx) {
- return new TUpgradeSubDomain(id, tx);
-}
-
-ISubOperationBase::TPtr CreateUpgradeSubDomain(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state != TTxState::Invalid);
- return new TUpgradeSubDomain(id, state);
-}
-
-ISubOperationBase::TPtr CreateUpgradeSubDomainDecision(TOperationId id, const TTxTransaction& tx) {
- return new TUpgradeSubDomainDecision(id, tx);
-}
-
-ISubOperationBase::TPtr CreateUpgradeSubDomainDecision(TOperationId id, TTxState::ETxState state) {
- Y_VERIFY(state != TTxState::Invalid);
- return new TUpgradeSubDomainDecision(id, state);
-}
-
-ISubOperationBase::TPtr CreateCompatibleSubdomainDrop(TSchemeShard* ss, TOperationId id, const TTxTransaction& tx) {
- const auto& info = tx.GetDrop();
-
- const TString& parentPathStr = tx.GetWorkingDir();
- const TString& name = info.GetName();
-
- TPath path = TPath::Resolve(parentPathStr, ss).Dive(name);
-
- {
- TPath::TChecker checks = path.Check();
- checks
- .NotEmpty()
- .IsResolved()
- .NotDeleted();
-
- if (!checks) {
- return CreateFroceDropSubDomain(id, tx);
- }
- }
-
- if (path.Base()->IsExternalSubDomainRoot()) {
- return CreateFroceDropExtSubDomain(id, tx);
- }
-
- return CreateFroceDropSubDomain(id, tx);
-}
-
-ISubOperationBase::TPtr CreateCompatibleSubdomainAlter(TSchemeShard* ss, TOperationId id, const TTxTransaction& tx) {
- const auto& info = tx.GetSubDomain();
-
- const TString& parentPathStr = tx.GetWorkingDir();
- const TString& name = info.GetName();
-
- TPath path = TPath::Resolve(parentPathStr, ss).Dive(name);
-
- {
- TPath::TChecker checks = path.Check();
- checks
- .NotEmpty()
- .IsResolved()
- .NotDeleted();
-
- if (!checks) {
- return CreateAlterSubDomain(id, tx);
- }
- }
-
- if (path.Base()->IsExternalSubDomainRoot()) {
- return CreateAlterExtSubDomain(id, tx);
- }
-
- return CreateAlterSubDomain(id, tx);
-}
-
-}
-}
+ operation->Parts.front()->HandleReply(personalEv, context);
+ break;
+ }
+ case NKikimrSchemeOp::TUpgradeSubDomain::Invalid:
+ errStr = "Invalid task param";
+ result->SetError(NKikimrScheme::StatusInvalidParameter, errStr);
+ return result;
+ };
+
+ TTxState& txState = context.SS->CreateTx(OperationId, TTxState::TxUpgradeSubDomainDecision, path.Base()->PathId);
+ txState.State = TTxState::Waiting;
+
+ NIceDb::TNiceDb db(context.Txc.DB);
+
+ context.SS->PersistTxState(db, OperationId);
+
+ TStringBuilder errMsg;
+ errMsg << "TWait ProgressState"
+ << ", dependent transaction: " << OperationId.GetTxId()
+ << ", parent transaction: " << txId
+ << ", at schemeshard: " << ssId;
+
+ LOG_ERROR_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, errMsg);
+
+ context.OnComplete.Dependence(txId, OperationId.GetTxId());
+
+ State = NextState();
+ SetState(SelectStateFunc(State));
+ context.OnComplete.ActivateTx(OperationId);
+
+ return result;
+ }
+
+ void AbortPropose(TOperationContext&) override {
+ Y_FAIL("no AbortPropose for TUpgradeSubDomainDecision");
+ }
+
+ void AbortUnsafe(TTxId forceDropTxId, TOperationContext& context) override {
+ LOG_NOTICE_S(context.Ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TUpgradeSubDomainDecision AbortUnsafe"
+ << ", opId: " << OperationId
+ << ", forceDropId: " << forceDropTxId
+ << ", at schemeshard: " << context.SS->TabletID());
+
+ context.OnComplete.DoneOperation(OperationId);
+ }
+};
+
+}
+
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+ISubOperationBase::TPtr CreateUpgradeSubDomain(TOperationId id, const TTxTransaction& tx) {
+ return new TUpgradeSubDomain(id, tx);
+}
+
+ISubOperationBase::TPtr CreateUpgradeSubDomain(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state != TTxState::Invalid);
+ return new TUpgradeSubDomain(id, state);
+}
+
+ISubOperationBase::TPtr CreateUpgradeSubDomainDecision(TOperationId id, const TTxTransaction& tx) {
+ return new TUpgradeSubDomainDecision(id, tx);
+}
+
+ISubOperationBase::TPtr CreateUpgradeSubDomainDecision(TOperationId id, TTxState::ETxState state) {
+ Y_VERIFY(state != TTxState::Invalid);
+ return new TUpgradeSubDomainDecision(id, state);
+}
+
+ISubOperationBase::TPtr CreateCompatibleSubdomainDrop(TSchemeShard* ss, TOperationId id, const TTxTransaction& tx) {
+ const auto& info = tx.GetDrop();
+
+ const TString& parentPathStr = tx.GetWorkingDir();
+ const TString& name = info.GetName();
+
+ TPath path = TPath::Resolve(parentPathStr, ss).Dive(name);
+
+ {
+ TPath::TChecker checks = path.Check();
+ checks
+ .NotEmpty()
+ .IsResolved()
+ .NotDeleted();
+
+ if (!checks) {
+ return CreateFroceDropSubDomain(id, tx);
+ }
+ }
+
+ if (path.Base()->IsExternalSubDomainRoot()) {
+ return CreateFroceDropExtSubDomain(id, tx);
+ }
+
+ return CreateFroceDropSubDomain(id, tx);
+}
+
+ISubOperationBase::TPtr CreateCompatibleSubdomainAlter(TSchemeShard* ss, TOperationId id, const TTxTransaction& tx) {
+ const auto& info = tx.GetSubDomain();
+
+ const TString& parentPathStr = tx.GetWorkingDir();
+ const TString& name = info.GetName();
+
+ TPath path = TPath::Resolve(parentPathStr, ss).Dive(name);
+
+ {
+ TPath::TChecker checks = path.Check();
+ checks
+ .NotEmpty()
+ .IsResolved()
+ .NotDeleted();
+
+ if (!checks) {
+ return CreateAlterSubDomain(id, tx);
+ }
+ }
+
+ if (path.Base()->IsExternalSubDomainRoot()) {
+ return CreateAlterExtSubDomain(id, tx);
+ }
+
+ return CreateAlterSubDomain(id, tx);
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard__publish_to_scheme_board.cpp b/ydb/core/tx/schemeshard/schemeshard__publish_to_scheme_board.cpp
index 42d91aadf3f..cb9a270d256 100644
--- a/ydb/core/tx/schemeshard/schemeshard__publish_to_scheme_board.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__publish_to_scheme_board.cpp
@@ -2,13 +2,13 @@
#include "schemeshard_path_describer.h"
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TTxPublishToSchemeBoard: public TSchemeShard::TRwTxBase {
+struct TSchemeShard::TTxPublishToSchemeBoard: public TSchemeShard::TRwTxBase {
THashMap<TTxId, TDeque<TPathId>> Paths;
- THashMap<TTxId, TVector<THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder>>> Descriptions;
+ THashMap<TTxId, TVector<THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder>>> Descriptions;
TTxPublishToSchemeBoard(TSelf *self, THashMap<TTxId, TDeque<TPathId>>&& paths)
: TRwTxBase(self)
@@ -74,7 +74,7 @@ struct TSchemeShard::TTxPublishToSchemeBoard: public TSchemeShard::TRwTxBase {
}; // TTxPublishToSchemeBoard
-struct TSchemeShard::TTxAckPublishToSchemeBoard: public TTransactionBase<TSchemeShard> {
+struct TSchemeShard::TTxAckPublishToSchemeBoard: public TTransactionBase<TSchemeShard> {
TSchemeBoardEvents::TEvUpdateAck::TPtr Ev;
TSideEffects SideEffects;
@@ -93,8 +93,8 @@ struct TSchemeShard::TTxAckPublishToSchemeBoard: public TTransactionBase<TScheme
<< ", msg: " << record.ShortDebugString()
<< ", cookie: " << Ev->Cookie);
- const auto txId = TTxId(Ev->Cookie);
- const auto pathId = TPathId(record.GetPathOwnerId(), record.GetLocalPathId());
+ const auto txId = TTxId(Ev->Cookie);
+ const auto pathId = TPathId(record.GetPathOwnerId(), record.GetLocalPathId());
const ui64 version = record.GetVersion();
NIceDb::TNiceDb db(txc.DB);
@@ -116,31 +116,31 @@ struct TSchemeShard::TTxAckPublishToSchemeBoard: public TTransactionBase<TScheme
operation->DoNotify(Self, SideEffects, ctx);
}
-
- auto toActivateWaitPublication = operation->ActivatePartsWaitPublication(pathId, version);
- for (auto opId: toActivateWaitPublication) {
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxAckPublishToSchemeBoard"
- << ", operation is ready to ack that some awaited pathed is published"
- << ", opId: " << opId
- << ", left await publications: " << operation->CountWaitPublication(opId)
- << ", at schemeshard: " << Self->TabletID()
- << ", txId: " << txId);
-
- THolder<TEvPrivate::TEvCompletePublication> msg = MakeHolder<TEvPrivate::TEvCompletePublication>(opId, pathId, version);
- TEvPrivate::TEvCompletePublication::TPtr personalEv = (TEventHandle<TEvPrivate::TEvCompletePublication>*) new IEventHandle(
+
+ auto toActivateWaitPublication = operation->ActivatePartsWaitPublication(pathId, version);
+ for (auto opId: toActivateWaitPublication) {
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxAckPublishToSchemeBoard"
+ << ", operation is ready to ack that some awaited pathed is published"
+ << ", opId: " << opId
+ << ", left await publications: " << operation->CountWaitPublication(opId)
+ << ", at schemeshard: " << Self->TabletID()
+ << ", txId: " << txId);
+
+ THolder<TEvPrivate::TEvCompletePublication> msg = MakeHolder<TEvPrivate::TEvCompletePublication>(opId, pathId, version);
+ TEvPrivate::TEvCompletePublication::TPtr personalEv = (TEventHandle<TEvPrivate::TEvCompletePublication>*) new IEventHandle(
Self->SelfId(), Self->SelfId(), msg.Release());
-
- TMemoryChanges memChanges;
- TStorageChanges dbChanges;
- TOperationContext context{Self, txc, ctx, SideEffects, memChanges, dbChanges};
-
- operation->Parts[opId.GetSubTxId()]->HandleReply(personalEv, context);
- }
+
+ TMemoryChanges memChanges;
+ TStorageChanges dbChanges;
+ TOperationContext context{Self, txc, ctx, SideEffects, memChanges, dbChanges};
+
+ operation->Parts[opId.GetSubTxId()]->HandleReply(personalEv, context);
+ }
} else if (Self->Publications.contains(txId)) {
LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Publication in-flight"
- << ", count: " << Self->Publications.at(txId).Paths.size()
+ << ", count: " << Self->Publications.at(txId).Paths.size()
<< ", at schemeshard: " << Self->TabletID()
<< ", txId: " << txId);
@@ -209,27 +209,27 @@ private:
<< ", at schemeshard: " << Self->TabletID()
<< ", to actorId: " << subscriber);
- SideEffects.Send(subscriber, new TEvSchemeShard::TEvNotifyTxCompletionResult(ui64(txId)), ui64(txId));
+ SideEffects.Send(subscriber, new TEvSchemeShard::TEvNotifyTxCompletionResult(ui64(txId)), ui64(txId));
}
}
}; // TTxAckPublishToSchemeBoard
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxPublishToSchemeBoard(THashMap<TTxId, TDeque<TPathId>>&& paths) {
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxPublishToSchemeBoard(THashMap<TTxId, TDeque<TPathId>>&& paths) {
return new TTxPublishToSchemeBoard(this, std::move(paths));
}
-void TSchemeShard::PublishToSchemeBoard(THashMap<TTxId, TDeque<TPathId>>&& paths, const TActorContext& ctx) {
+void TSchemeShard::PublishToSchemeBoard(THashMap<TTxId, TDeque<TPathId>>&& paths, const TActorContext& ctx) {
Execute(CreateTxPublishToSchemeBoard(std::move(paths)), ctx);
}
-void TSchemeShard::PublishToSchemeBoard(TTxId txId, TDeque<TPathId>&& paths, const TActorContext& ctx) {
+void TSchemeShard::PublishToSchemeBoard(TTxId txId, TDeque<TPathId>&& paths, const TActorContext& ctx) {
PublishToSchemeBoard({{txId, std::move(paths)}}, ctx);
}
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxAckPublishToSchemeBoard(TSchemeBoardEvents::TEvUpdateAck::TPtr& ev) {
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxAckPublishToSchemeBoard(TSchemeBoardEvents::TEvUpdateAck::TPtr& ev) {
return new TTxAckPublishToSchemeBoard(this, ev);
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__serverless_storage_billing.cpp b/ydb/core/tx/schemeshard/schemeshard__serverless_storage_billing.cpp
index 16d6a865bba..fdb4593a73e 100644
--- a/ydb/core/tx/schemeshard/schemeshard__serverless_storage_billing.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__serverless_storage_billing.cpp
@@ -1,210 +1,210 @@
-#include "schemeshard_impl.h"
-
+#include "schemeshard_impl.h"
+
#include <ydb/core/metering/metering.h>
#include <ydb/core/metering/time_grid.h>
-
-#include <library/cpp/json/json_writer.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-using namespace NTabletFlatExecutor;
-
-struct TSchemeShard::TTxServerlessStorageBilling : public TTransactionBase<TSchemeShard> {
- TSideEffects SideEffects;
- const TTimeGrid TimeGrid = TTimeGrid(TDuration::Minutes(1));
-
- TInstant TimeToNextBill;
-
- TTxServerlessStorageBilling(TSelf* self)
- : TTransactionBase<TSchemeShard>(self)
- {}
-
- TTxType GetTxType() const override {
- return TXTYPE_SERVERLESS_STORAGE_BILLING;
- }
-
- bool Execute(TTransactionContext &txc, const TActorContext &ctx) override {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TTxServerlessStorageBilling.Execute");
-
- const TPathElement::TPtr dbRootEl = Self->PathsById.at(Self->RootPathId());
- const TSubDomainInfo::TPtr domainDescr = Self->SubDomains.at(Self->RootPathId());
- const TSubDomainInfo::TDiskSpaceUsage& spaceUsage = domainDescr->GetDiskSpaceUsage();
-
+
+#include <library/cpp/json/json_writer.h>
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+using namespace NTabletFlatExecutor;
+
+struct TSchemeShard::TTxServerlessStorageBilling : public TTransactionBase<TSchemeShard> {
+ TSideEffects SideEffects;
+ const TTimeGrid TimeGrid = TTimeGrid(TDuration::Minutes(1));
+
+ TInstant TimeToNextBill;
+
+ TTxServerlessStorageBilling(TSelf* self)
+ : TTransactionBase<TSchemeShard>(self)
+ {}
+
+ TTxType GetTxType() const override {
+ return TXTYPE_SERVERLESS_STORAGE_BILLING;
+ }
+
+ bool Execute(TTransactionContext &txc, const TActorContext &ctx) override {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TTxServerlessStorageBilling.Execute");
+
+ const TPathElement::TPtr dbRootEl = Self->PathsById.at(Self->RootPathId());
+ const TSubDomainInfo::TPtr domainDescr = Self->SubDomains.at(Self->RootPathId());
+ const TSubDomainInfo::TDiskSpaceUsage& spaceUsage = domainDescr->GetDiskSpaceUsage();
+
if (!Self->IsServerlessDomain(TPath::Init(Self->RootPathId(), Self))) {
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxServerlessStorageBilling: unable to make a bill, domain is not a serverless db"
- << ", schemeshardId: " << Self->SelfTabletId()
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxServerlessStorageBilling: unable to make a bill, domain is not a serverless db"
+ << ", schemeshardId: " << Self->SelfTabletId()
<< ", domainId: " << Self->ParentDomainId);
- return true;
- }
-
- auto now = ctx.Now();
- auto cur = TimeGrid.Get(now);
-
- //whatever happens after, we want to repeat this transaction at TimeToNextBill
- TimeToNextBill = TimeGrid.GetNext(cur).Start;
-
- if (!Self->AllowServerlessStorageBilling) {
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxServerlessStorageBilling: unable to make a bill, AllowServerlessStorageBilling is false"
- << ", schemeshardId: " << Self->SelfTabletId()
- << ", domainId: " << Self->ParentDomainId
- << ", next retry at: " << TimeToNextBill);
- return true;
- }
-
- TString cloud_id;
- if (dbRootEl->UserAttrs->Attrs.contains("cloud_id")) {
- cloud_id = dbRootEl->UserAttrs->Attrs.at("cloud_id");
- }
- TString folder_id;
- if (dbRootEl->UserAttrs->Attrs.contains("folder_id")) {
- folder_id = dbRootEl->UserAttrs->Attrs.at("folder_id");
- }
- TString database_id;
- if (dbRootEl->UserAttrs->Attrs.contains("database_id")) {
- database_id = dbRootEl->UserAttrs->Attrs.at("database_id");
- }
-
- if (!cloud_id || !folder_id || !database_id) {
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxServerlessStorageBilling: unable to make a bill, neither cloud_id and nor folder_id nor database_id have found in user attrubutes at the domain"
- << ", schemeshardId: " << Self->SelfTabletId()
- << ", domainId: " << Self->ParentDomainId
- << ", next retry at: " << TimeToNextBill);
- return true;
- }
-
- NIceDb::TNiceDb db(txc.DB);
-
- if (!Self->ServerlessStorageLastBillTime) {
- // this is the first run
- // let's make bill time periods according to the grid
- // for that we just skip current grid period
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TTxServerlessStorageBilling: initiate at first time"
- << ", schemeshardId: " << Self->SelfTabletId()
- << ", domainId: " << Self->ParentDomainId
- << ", now: " << now
- << ", set LastBillTime: " << cur.Start
- << ", next retry at: " << TimeToNextBill);
-
- Self->ServerlessStorageLastBillTime = cur.Start;
- Self->PersistStorageBillingTime(db);
-
- return true;
- }
-
- auto last = Self->ServerlessStorageLastBillTime;
-
- if (now < last) {
+ return true;
+ }
+
+ auto now = ctx.Now();
+ auto cur = TimeGrid.Get(now);
+
+ //whatever happens after, we want to repeat this transaction at TimeToNextBill
+ TimeToNextBill = TimeGrid.GetNext(cur).Start;
+
+ if (!Self->AllowServerlessStorageBilling) {
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxServerlessStorageBilling: unable to make a bill, AllowServerlessStorageBilling is false"
+ << ", schemeshardId: " << Self->SelfTabletId()
+ << ", domainId: " << Self->ParentDomainId
+ << ", next retry at: " << TimeToNextBill);
+ return true;
+ }
+
+ TString cloud_id;
+ if (dbRootEl->UserAttrs->Attrs.contains("cloud_id")) {
+ cloud_id = dbRootEl->UserAttrs->Attrs.at("cloud_id");
+ }
+ TString folder_id;
+ if (dbRootEl->UserAttrs->Attrs.contains("folder_id")) {
+ folder_id = dbRootEl->UserAttrs->Attrs.at("folder_id");
+ }
+ TString database_id;
+ if (dbRootEl->UserAttrs->Attrs.contains("database_id")) {
+ database_id = dbRootEl->UserAttrs->Attrs.at("database_id");
+ }
+
+ if (!cloud_id || !folder_id || !database_id) {
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxServerlessStorageBilling: unable to make a bill, neither cloud_id and nor folder_id nor database_id have found in user attrubutes at the domain"
+ << ", schemeshardId: " << Self->SelfTabletId()
+ << ", domainId: " << Self->ParentDomainId
+ << ", next retry at: " << TimeToNextBill);
+ return true;
+ }
+
+ NIceDb::TNiceDb db(txc.DB);
+
+ if (!Self->ServerlessStorageLastBillTime) {
+ // this is the first run
+ // let's make bill time periods according to the grid
+ // for that we just skip current grid period
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TTxServerlessStorageBilling: initiate at first time"
+ << ", schemeshardId: " << Self->SelfTabletId()
+ << ", domainId: " << Self->ParentDomainId
+ << ", now: " << now
+ << ", set LastBillTime: " << cur.Start
+ << ", next retry at: " << TimeToNextBill);
+
+ Self->ServerlessStorageLastBillTime = cur.Start;
+ Self->PersistStorageBillingTime(db);
+
+ return true;
+ }
+
+ auto last = Self->ServerlessStorageLastBillTime;
+
+ if (now < last) {
LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TTxServerlessStorageBilling: unable do anything from the past"
- << ", schemeshardId: " << Self->SelfTabletId()
- << ", domainId: " << Self->ParentDomainId
- << ", now: " << now
- << ", LastBillTime: " << last
- << ", next retry at: " << TimeToNextBill);
- return true;
- }
-
- auto lastBilled = TimeGrid.Get(last);
- auto toBill = TimeGrid.GetPrev(cur);
-
- if (now <= lastBilled.End || toBill.Start <= lastBilled.End) {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TTxServerlessStorageBilling: too soon call, wait until current period ends"
- << ", schemeshardId: " << Self->SelfTabletId()
- << ", domainId: " << Self->ParentDomainId
- << ", now: " << now
- << ", LastBillTime: " << last
- << ", lastBilled: " << lastBilled.Start << "--" << lastBilled.End
- << ", toBill: " << toBill.Start << "--" << toBill.End
- << ", next retry at: " << TimeToNextBill);
- return true;
- }
-
- if (now > TimeGrid.GetNext(TimeGrid.GetNext(lastBilled)).End) {
- // it seems like there is a gap in our billing
- // may be SS were offline
- // skip that gap, just bill the last grid period
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TTxServerlessStorageBilling: too late call, there are could be gaps in the metric"
- << ", schemeshardId: " << Self->SelfTabletId()
- << ", domainId: " << Self->ParentDomainId
- << ", now: " << now
- << ", LastBillTime: " << last
- << ", lastBilled: " << lastBilled.Start << "--" << lastBilled.End
- << ", toBill: " << toBill.Start << "--" << toBill.End
- << ", next retry at: " << TimeToNextBill);
- }
-
- Self->ServerlessStorageLastBillTime = toBill.Start;
- Self->PersistStorageBillingTime(db);
-
- TString id = TStringBuilder()
- << Self->ParentDomainId.OwnerId
- << "-" << Self->ParentDomainId.LocalPathId
- << "-" << toBill.Start.Seconds()
- << "-" << toBill.End.Seconds()
- << "-" << spaceUsage.Tables.TotalSize;
-
- auto json = NJson::TJsonMap{
- {"version", "1.0.0"},
- {"id", id},
- {"schema", "ydb.serverless.v1"},
- {"cloud_id", cloud_id},
- {"folder_id", folder_id},
- {"resource_id", database_id},
- {"source_id", "sless-docapi-ydb-storage"},
- {"source_wt", ctx.Now().Seconds()},
- {"tags", NJson::TJsonMap {
- {"ydb_size", spaceUsage.Tables.TotalSize}
- }},
- {"usage", NJson::TJsonMap {
- {"quantity", toBill.End.Seconds() - toBill.Start.Seconds()},
- {"unit", "byte*second"},
- {"type", "delta"},
- {"start", toBill.Start.Seconds()},
- {"finish", toBill.End.Seconds()}
- }},
- };
-
- TStringBuilder billRecord;
- NJson::WriteJson(&billRecord.Out, &json, /*formatOutput=*/false, /*sortkeys=*/false);
- billRecord << Endl;
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxServerlessStorageBilling: make a bill, record: '" << billRecord << "'"
- << ", schemeshardId: " << Self->SelfTabletId()
- << ", domainId: " << Self->ParentDomainId
- << ", now: " << now
- << ", LastBillTime: " << last
- << ", lastBilled: " << lastBilled.Start << "--" << lastBilled.End
- << ", toBill: " << toBill.Start << "--" << toBill.End
- << ", next retry at: " << TimeToNextBill);
-
- auto request = MakeHolder<NMetering::TEvMetering::TEvWriteMeteringJson>(billRecord);
- // send message at Complete stage
- SideEffects.Send(NMetering::MakeMeteringServiceID(), std::move(request));
-
- SideEffects.ApplyOnExecute(Self, txc, ctx);
- return true;
- }
-
- void Complete(const TActorContext &ctx) override {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TTxServerlessStorageBilling.Complete");
-
- if (TimeToNextBill) {
- ctx.Schedule(
- TimeToNextBill,
- new TEvPrivate::TEvServerlessStorageBilling());
- }
-
- SideEffects.ApplyOnComplete(Self, ctx);
- }
-};
-
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxServerlessStorageBilling() {
- return new TTxServerlessStorageBilling(this);
-}
-
-} // NSchemeShard
-} // NKikimr
+ << ", schemeshardId: " << Self->SelfTabletId()
+ << ", domainId: " << Self->ParentDomainId
+ << ", now: " << now
+ << ", LastBillTime: " << last
+ << ", next retry at: " << TimeToNextBill);
+ return true;
+ }
+
+ auto lastBilled = TimeGrid.Get(last);
+ auto toBill = TimeGrid.GetPrev(cur);
+
+ if (now <= lastBilled.End || toBill.Start <= lastBilled.End) {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TTxServerlessStorageBilling: too soon call, wait until current period ends"
+ << ", schemeshardId: " << Self->SelfTabletId()
+ << ", domainId: " << Self->ParentDomainId
+ << ", now: " << now
+ << ", LastBillTime: " << last
+ << ", lastBilled: " << lastBilled.Start << "--" << lastBilled.End
+ << ", toBill: " << toBill.Start << "--" << toBill.End
+ << ", next retry at: " << TimeToNextBill);
+ return true;
+ }
+
+ if (now > TimeGrid.GetNext(TimeGrid.GetNext(lastBilled)).End) {
+ // it seems like there is a gap in our billing
+ // may be SS were offline
+ // skip that gap, just bill the last grid period
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TTxServerlessStorageBilling: too late call, there are could be gaps in the metric"
+ << ", schemeshardId: " << Self->SelfTabletId()
+ << ", domainId: " << Self->ParentDomainId
+ << ", now: " << now
+ << ", LastBillTime: " << last
+ << ", lastBilled: " << lastBilled.Start << "--" << lastBilled.End
+ << ", toBill: " << toBill.Start << "--" << toBill.End
+ << ", next retry at: " << TimeToNextBill);
+ }
+
+ Self->ServerlessStorageLastBillTime = toBill.Start;
+ Self->PersistStorageBillingTime(db);
+
+ TString id = TStringBuilder()
+ << Self->ParentDomainId.OwnerId
+ << "-" << Self->ParentDomainId.LocalPathId
+ << "-" << toBill.Start.Seconds()
+ << "-" << toBill.End.Seconds()
+ << "-" << spaceUsage.Tables.TotalSize;
+
+ auto json = NJson::TJsonMap{
+ {"version", "1.0.0"},
+ {"id", id},
+ {"schema", "ydb.serverless.v1"},
+ {"cloud_id", cloud_id},
+ {"folder_id", folder_id},
+ {"resource_id", database_id},
+ {"source_id", "sless-docapi-ydb-storage"},
+ {"source_wt", ctx.Now().Seconds()},
+ {"tags", NJson::TJsonMap {
+ {"ydb_size", spaceUsage.Tables.TotalSize}
+ }},
+ {"usage", NJson::TJsonMap {
+ {"quantity", toBill.End.Seconds() - toBill.Start.Seconds()},
+ {"unit", "byte*second"},
+ {"type", "delta"},
+ {"start", toBill.Start.Seconds()},
+ {"finish", toBill.End.Seconds()}
+ }},
+ };
+
+ TStringBuilder billRecord;
+ NJson::WriteJson(&billRecord.Out, &json, /*formatOutput=*/false, /*sortkeys=*/false);
+ billRecord << Endl;
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxServerlessStorageBilling: make a bill, record: '" << billRecord << "'"
+ << ", schemeshardId: " << Self->SelfTabletId()
+ << ", domainId: " << Self->ParentDomainId
+ << ", now: " << now
+ << ", LastBillTime: " << last
+ << ", lastBilled: " << lastBilled.Start << "--" << lastBilled.End
+ << ", toBill: " << toBill.Start << "--" << toBill.End
+ << ", next retry at: " << TimeToNextBill);
+
+ auto request = MakeHolder<NMetering::TEvMetering::TEvWriteMeteringJson>(billRecord);
+ // send message at Complete stage
+ SideEffects.Send(NMetering::MakeMeteringServiceID(), std::move(request));
+
+ SideEffects.ApplyOnExecute(Self, txc, ctx);
+ return true;
+ }
+
+ void Complete(const TActorContext &ctx) override {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TTxServerlessStorageBilling.Complete");
+
+ if (TimeToNextBill) {
+ ctx.Schedule(
+ TimeToNextBill,
+ new TEvPrivate::TEvServerlessStorageBilling());
+ }
+
+ SideEffects.ApplyOnComplete(Self, ctx);
+ }
+};
+
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxServerlessStorageBilling() {
+ return new TTxServerlessStorageBilling(this);
+}
+
+} // NSchemeShard
+} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__state_changed_reply.cpp b/ydb/core/tx/schemeshard/schemeshard__state_changed_reply.cpp
index 0f8cbfe9769..ffa6e34d509 100644
--- a/ydb/core/tx/schemeshard/schemeshard__state_changed_reply.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__state_changed_reply.cpp
@@ -5,106 +5,106 @@
#include <ydb/core/base/appdata.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TTxShardStateChanged : public TSchemeShard::TRwTxBase {
+struct TSchemeShard::TTxShardStateChanged : public TSchemeShard::TRwTxBase {
TEvDataShard::TEvStateChanged::TPtr Ev;
- TSideEffects SideEffects;
+ TSideEffects SideEffects;
TTxShardStateChanged(TSelf *self, TEvDataShard::TEvStateChanged::TPtr& ev)
- : TRwTxBase(self)
+ : TRwTxBase(self)
, Ev(ev)
{}
TTxType GetTxType() const override { return TXTYPE_DATASHARD_STATE_RESULT; }
- void DeleteShard(TTabletId tabletId, const TActorContext &ctx) {
- auto shardIdx = Self->GetShardIdx(tabletId);
- if (shardIdx == InvalidShardIdx) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxShardStateChanged DoExecute"
- << "Unknown shardIdx for tabletId,"
- << ", tabletId: " << tabletId
+ void DeleteShard(TTabletId tabletId, const TActorContext &ctx) {
+ auto shardIdx = Self->GetShardIdx(tabletId);
+ if (shardIdx == InvalidShardIdx) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxShardStateChanged DoExecute"
+ << "Unknown shardIdx for tabletId,"
+ << ", tabletId: " << tabletId
<< ", state: " << DatashardStateName(NDataShard::TShardState::Offline));
- return;
- }
-
- SideEffects.DeleteShard(shardIdx);
- }
-
- void ProgressDependentOperation(TTabletId tabletId, const TActorContext &ctx) {
- for(auto txIdNum: Self->PipeTracker.FindTx(ui64(tabletId))) {
- auto txId = TTxId(txIdNum);
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxShardStateChanged DoExecute"
- << "Operation should be restarted in case missing one of shard"
- << ", txId: " << txId
- << ", tabletId: " << tabletId);
-
- if (!Self->Operations.contains(txId)) {
- continue;
- }
-
- TOperation::TPtr operation = Self->Operations.at(txId);
-
- for (auto& related: Self->PipeTracker.FindTablets(ui64(txId))) {
- ui64 pipeTrackerCookie = related.first;
- auto relatedTabletId = TTabletId(related.second);
-
- if (tabletId != relatedTabletId) {
- continue;
- }
-
- auto opId = TOperationId(txId, pipeTrackerCookie);
- SideEffects.ActivateTx(opId);
-
- if (!operation->PipeBindedMessages.contains(tabletId)) {
- continue;
- }
-
- for (auto& items: operation->PipeBindedMessages.at(tabletId)) {
- auto msgCookie = items.first;
- SideEffects.UnbindMsgFromPipe(opId, tabletId, msgCookie);
- }
- }
- }
- }
-
+ return;
+ }
+
+ SideEffects.DeleteShard(shardIdx);
+ }
+
+ void ProgressDependentOperation(TTabletId tabletId, const TActorContext &ctx) {
+ for(auto txIdNum: Self->PipeTracker.FindTx(ui64(tabletId))) {
+ auto txId = TTxId(txIdNum);
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxShardStateChanged DoExecute"
+ << "Operation should be restarted in case missing one of shard"
+ << ", txId: " << txId
+ << ", tabletId: " << tabletId);
+
+ if (!Self->Operations.contains(txId)) {
+ continue;
+ }
+
+ TOperation::TPtr operation = Self->Operations.at(txId);
+
+ for (auto& related: Self->PipeTracker.FindTablets(ui64(txId))) {
+ ui64 pipeTrackerCookie = related.first;
+ auto relatedTabletId = TTabletId(related.second);
+
+ if (tabletId != relatedTabletId) {
+ continue;
+ }
+
+ auto opId = TOperationId(txId, pipeTrackerCookie);
+ SideEffects.ActivateTx(opId);
+
+ if (!operation->PipeBindedMessages.contains(tabletId)) {
+ continue;
+ }
+
+ for (auto& items: operation->PipeBindedMessages.at(tabletId)) {
+ auto msgCookie = items.first;
+ SideEffects.UnbindMsgFromPipe(opId, tabletId, msgCookie);
+ }
+ }
+ }
+ }
+
void DoExecute(TTransactionContext &txc, const TActorContext &ctx) override {
- auto tabletId = TTabletId(Ev->Get()->Record.GetTabletId());
+ auto tabletId = TTabletId(Ev->Get()->Record.GetTabletId());
auto state = Ev->Get()->Record.GetState();
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxShardStateChanged DoExecute"
- << ", datashard informs about state changing"
- << ", datashardId: " << tabletId
- << ", state: " << DatashardStateName(state)
- << ", at schemeshard: " << Self->TabletID());
-
- // Ack state change notification
- THolder<TEvDataShard::TEvStateChangedResult> event =
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxShardStateChanged DoExecute"
+ << ", datashard informs about state changing"
+ << ", datashardId: " << tabletId
+ << ", state: " << DatashardStateName(state)
+ << ", at schemeshard: " << Self->TabletID());
+
+ // Ack state change notification
+ THolder<TEvDataShard::TEvStateChangedResult> event =
THolder(new TEvDataShard::TEvStateChangedResult(Self->TabletID(), state));
SideEffects.Send(Ev->Get()->GetSource(), std::move(event));
-
+
if (state == NDataShard::TShardState::Offline) {
- DeleteShard(tabletId, ctx);
- ProgressDependentOperation(tabletId, ctx);
+ DeleteShard(tabletId, ctx);
+ ProgressDependentOperation(tabletId, ctx);
}
-
- SideEffects.ApplyOnExecute(Self, txc, ctx);
+
+ SideEffects.ApplyOnExecute(Self, txc, ctx);
}
void DoComplete(const TActorContext &ctx) override {
- SideEffects.ApplyOnComplete(Self, ctx);
+ SideEffects.ApplyOnComplete(Self, ctx);
}
};
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxShardStateChanged(
- TEvDataShard::TEvStateChanged::TPtr& ev)
-{
- return new TTxShardStateChanged(this, ev);
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxShardStateChanged(
+ TEvDataShard::TEvStateChanged::TPtr& ev)
+{
+ return new TTxShardStateChanged(this, ev);
}
}}
diff --git a/ydb/core/tx/schemeshard/schemeshard__sync_update_tenants.cpp b/ydb/core/tx/schemeshard/schemeshard__sync_update_tenants.cpp
index 977ff8eeb41..d04be460803 100644
--- a/ydb/core/tx/schemeshard/schemeshard__sync_update_tenants.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__sync_update_tenants.cpp
@@ -1,106 +1,106 @@
-#include "schemeshard_impl.h"
-
+#include "schemeshard_impl.h"
+
#include <ydb/core/tablet/tablet_exception.h>
#include <ydb/core/tablet_flat/flat_cxx_database.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-using namespace NTabletFlatExecutor;
-
-
-struct TSchemeShard::TTxSyncTenant : public TSchemeShard::TRwTxBase {
- TPathId PathId;
- TSideEffects SideEffects;
-
- TTxSyncTenant(TSelf *self, TPathId pathId)
- : TRwTxBase(self)
- , PathId(pathId)
- {}
-
- TTxType GetTxType() const override { return TXTYPE_SYNC_TENANT; }
-
- void DoExecute(TTransactionContext &txc, const TActorContext &ctx) override {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxSyncTenant DoExecute"
- << ", pathId: " << PathId
- << ", at schemeshard: " << Self->TabletID());
- Y_VERIFY(Self->IsDomainSchemeShard);
-
- SideEffects.UpdateTenants({PathId});
- SideEffects.ApplyOnExecute(Self, txc, ctx);
- }
- void DoComplete(const TActorContext &ctx) override {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxSyncTenant DoComplete"
- << ", pathId: " << PathId
- << ", at schemeshard: " << Self->TabletID());
- SideEffects.ApplyOnComplete(Self, ctx);
- }
-};
-
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxSyncTenant(TPathId pathId) {
- return new TTxSyncTenant(this, pathId);
-}
-
-struct TSchemeShard::TTxUpdateTenant : public TSchemeShard::TRwTxBase {
- TEvSchemeShard::TEvUpdateTenantSchemeShard::TPtr Ev;
- THolder<TEvSchemeShard::TEvSyncTenantSchemeShard> SyncEv;
- TSideEffects SideEffects;
-
- TTxUpdateTenant(TSelf *self, TEvSchemeShard::TEvUpdateTenantSchemeShard::TPtr &ev)
- : TRwTxBase(self)
- , Ev(ev)
- {}
-
- TTxType GetTxType() const override { return TXTYPE_UPDATE_TENANT; }
-
- bool HasSync() {
- return bool(SyncEv);
- }
-
- void MakeSync() {
- if (!SyncEv) {
- SyncEv = Self->ParentDomainLink.MakeSyncMsg();
- }
- }
-
- TEvSchemeShard::TEvSyncTenantSchemeShard* ReleaseSync() {
- Y_VERIFY(HasSync());
- return SyncEv.Release();
- }
-
- void DoExecute(TTransactionContext &txc, const TActorContext &ctx) override {
- NIceDb::TNiceDb db(txc.DB);
- const auto& record = Ev->Get()->Record;
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxUpdateTenant DoExecute"
- << ", msg: " << record.ShortDebugString()
- << ", at schemeshard: " << Self->TabletID());
-
- Y_VERIFY(!Self->IsDomainSchemeShard);
- Y_VERIFY(record.GetTabletId() == Self->ParentDomainId.OwnerId);
-
- if (record.GetEffectiveACLVersion() > Self->ParentDomainEffectiveACLVersion) {
- Self->ParentDomainOwner = record.GetOwner();
- Self->ParentDomainEffectiveACL = record.GetEffectiveACL();
- Self->ParentDomainEffectiveACLVersion = record.GetEffectiveACLVersion();
- Self->ParentDomainCachedEffectiveACL.Init(Self->ParentDomainEffectiveACL);
-
- Self->PersistParentDomainEffectiveACL(db, record.GetOwner(), record.GetEffectiveACL(), record.GetEffectiveACLVersion());
- for (const TPathId pathId : Self->ListSubThee(Self->RootPathId(), ctx)) {
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+using namespace NTabletFlatExecutor;
+
+
+struct TSchemeShard::TTxSyncTenant : public TSchemeShard::TRwTxBase {
+ TPathId PathId;
+ TSideEffects SideEffects;
+
+ TTxSyncTenant(TSelf *self, TPathId pathId)
+ : TRwTxBase(self)
+ , PathId(pathId)
+ {}
+
+ TTxType GetTxType() const override { return TXTYPE_SYNC_TENANT; }
+
+ void DoExecute(TTransactionContext &txc, const TActorContext &ctx) override {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxSyncTenant DoExecute"
+ << ", pathId: " << PathId
+ << ", at schemeshard: " << Self->TabletID());
+ Y_VERIFY(Self->IsDomainSchemeShard);
+
+ SideEffects.UpdateTenants({PathId});
+ SideEffects.ApplyOnExecute(Self, txc, ctx);
+ }
+ void DoComplete(const TActorContext &ctx) override {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxSyncTenant DoComplete"
+ << ", pathId: " << PathId
+ << ", at schemeshard: " << Self->TabletID());
+ SideEffects.ApplyOnComplete(Self, ctx);
+ }
+};
+
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxSyncTenant(TPathId pathId) {
+ return new TTxSyncTenant(this, pathId);
+}
+
+struct TSchemeShard::TTxUpdateTenant : public TSchemeShard::TRwTxBase {
+ TEvSchemeShard::TEvUpdateTenantSchemeShard::TPtr Ev;
+ THolder<TEvSchemeShard::TEvSyncTenantSchemeShard> SyncEv;
+ TSideEffects SideEffects;
+
+ TTxUpdateTenant(TSelf *self, TEvSchemeShard::TEvUpdateTenantSchemeShard::TPtr &ev)
+ : TRwTxBase(self)
+ , Ev(ev)
+ {}
+
+ TTxType GetTxType() const override { return TXTYPE_UPDATE_TENANT; }
+
+ bool HasSync() {
+ return bool(SyncEv);
+ }
+
+ void MakeSync() {
+ if (!SyncEv) {
+ SyncEv = Self->ParentDomainLink.MakeSyncMsg();
+ }
+ }
+
+ TEvSchemeShard::TEvSyncTenantSchemeShard* ReleaseSync() {
+ Y_VERIFY(HasSync());
+ return SyncEv.Release();
+ }
+
+ void DoExecute(TTransactionContext &txc, const TActorContext &ctx) override {
+ NIceDb::TNiceDb db(txc.DB);
+ const auto& record = Ev->Get()->Record;
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TTxUpdateTenant DoExecute"
+ << ", msg: " << record.ShortDebugString()
+ << ", at schemeshard: " << Self->TabletID());
+
+ Y_VERIFY(!Self->IsDomainSchemeShard);
+ Y_VERIFY(record.GetTabletId() == Self->ParentDomainId.OwnerId);
+
+ if (record.GetEffectiveACLVersion() > Self->ParentDomainEffectiveACLVersion) {
+ Self->ParentDomainOwner = record.GetOwner();
+ Self->ParentDomainEffectiveACL = record.GetEffectiveACL();
+ Self->ParentDomainEffectiveACLVersion = record.GetEffectiveACLVersion();
+ Self->ParentDomainCachedEffectiveACL.Init(Self->ParentDomainEffectiveACL);
+
+ Self->PersistParentDomainEffectiveACL(db, record.GetOwner(), record.GetEffectiveACL(), record.GetEffectiveACLVersion());
+ for (const TPathId pathId : Self->ListSubThee(Self->RootPathId(), ctx)) {
SideEffects.PublishToSchemeBoard(InvalidOperationId, pathId);
}
- MakeSync();
- }
-
- TSubDomainInfo::TPtr subdomain = Self->SubDomains.at(Self->RootPathId());
- if (record.GetSubdomainVersion() > subdomain->GetVersion()) {
- TStoragePools storagePools(record.GetStoragePools().begin(), record.GetStoragePools().end());
- subdomain->SetStoragePools(storagePools, record.GetSubdomainVersion());
-
+ MakeSync();
+ }
+
+ TSubDomainInfo::TPtr subdomain = Self->SubDomains.at(Self->RootPathId());
+ if (record.GetSubdomainVersion() > subdomain->GetVersion()) {
+ TStoragePools storagePools(record.GetStoragePools().begin(), record.GetStoragePools().end());
+ subdomain->SetStoragePools(storagePools, record.GetSubdomainVersion());
+
if (record.HasDeclaredSchemeQuotas()) {
subdomain->ApplyDeclaredSchemeQuotas(record.GetDeclaredSchemeQuotas(), ctx.Now());
// Note: subdomain version is persisted in PersistStoragePools below
@@ -114,34 +114,34 @@ struct TSchemeShard::TTxUpdateTenant : public TSchemeShard::TRwTxBase {
Self->PersistSubDomainDatabaseQuotas(db, Self->RootPathId(), *subdomain);
}
- Self->PersistStoragePools(db, Self->RootPathId(), *subdomain);
- SideEffects.PublishToSchemeBoard(InvalidOperationId, Self->RootPathId());
- MakeSync();
- }
-
- TPathElement::TPtr path = Self->PathsById.at(Self->RootPathId());
- if (record.GetUserAttributesVersion() > path->UserAttrs->AlterVersion) {
- {
- TString errStr;
- TUserAttributes::TPtr userAttrs = new TUserAttributes(record.GetUserAttributesVersion());
+ Self->PersistStoragePools(db, Self->RootPathId(), *subdomain);
+ SideEffects.PublishToSchemeBoard(InvalidOperationId, Self->RootPathId());
+ MakeSync();
+ }
+
+ TPathElement::TPtr path = Self->PathsById.at(Self->RootPathId());
+ if (record.GetUserAttributesVersion() > path->UserAttrs->AlterVersion) {
+ {
+ TString errStr;
+ TUserAttributes::TPtr userAttrs = new TUserAttributes(record.GetUserAttributesVersion());
bool isOk = userAttrs->ApplyPatch(EUserAttributesOp::SyncUpdateTenants, record.GetUserAttributes(), errStr);
- Y_VERIFY_S(isOk, errStr);
- path->UserAttrs->AlterData = userAttrs;
- }
-
- Self->ApplyAndPersistUserAttrs(db, path->PathId);
- SideEffects.PublishToSchemeBoard(InvalidOperationId, Self->RootPathId());
- MakeSync();
- }
-
+ Y_VERIFY_S(isOk, errStr);
+ path->UserAttrs->AlterData = userAttrs;
+ }
+
+ Self->ApplyAndPersistUserAttrs(db, path->PathId);
+ SideEffects.PublishToSchemeBoard(InvalidOperationId, Self->RootPathId());
+ MakeSync();
+ }
+
auto addPrivateShard = [&] (TTabletId tabletId, TTabletTypes::EType tabletType) {
const auto shardIdx = Self->RegisterShardInfo(
TShardInfo(InvalidTxId, Self->RootPathId(), tabletType)
.WithTabletID(tabletId));
Self->PersistUpdateNextShardIdx(db);
-
+
Self->PersistShardMapping(db, shardIdx, tabletId, Self->RootPathId(), InvalidTxId, tabletType);
-
+
Y_VERIFY(record.GetSubdomainVersion() >= subdomain->GetVersion());
if (record.GetSubdomainVersion() > subdomain->GetVersion()) {
subdomain->SetVersion(record.GetSubdomainVersion());
@@ -149,12 +149,12 @@ struct TSchemeShard::TTxUpdateTenant : public TSchemeShard::TRwTxBase {
subdomain->AddPrivateShard(shardIdx);
subdomain->AddInternalShard(shardIdx);
-
+
subdomain->Initialize(Self->ShardInfos);
Self->PersistSubDomain(db, Self->RootPathId(), *subdomain);
-
- path->IncShardsInside(1);
-
+
+ path->IncShardsInside(1);
+
SideEffects.PublishToSchemeBoard(InvalidOperationId, Self->RootPathId());
MakeSync();
};
@@ -163,10 +163,10 @@ struct TSchemeShard::TTxUpdateTenant : public TSchemeShard::TRwTxBase {
TTabletId tenantHive = TTabletId(record.GetTenantHive());
if (!subdomain->GetTenantHiveID()) {
addPrivateShard(tenantHive, ETabletType::Hive);
- }
+ }
Y_VERIFY(tenantHive == subdomain->GetTenantHiveID());
- }
-
+ }
+
if (record.HasTenantSysViewProcessor()) {
TTabletId tenantSVP = TTabletId(record.GetTenantSysViewProcessor());
if (!subdomain->GetTenantSysViewProcessorID()) {
@@ -175,48 +175,48 @@ struct TSchemeShard::TTxUpdateTenant : public TSchemeShard::TRwTxBase {
Y_VERIFY(tenantSVP == subdomain->GetTenantSysViewProcessorID());
}
- if (record.HasUpdateTenantRootACL()) {
- // KIKIMR-10699: transfer tenants root ACL from GSS to the TSS
- // here TSS sees the ACL from GSS
- // TSS add all the ACL from GSS to self tenant root
- NACLib::TACL tenantRootACL(record.GetUpdateTenantRootACL());
-
- // this is just a transformation ACL to TDiffACL
- NACLib::TDiffACL diffACL;
- for (auto ace: tenantRootACL.GetACE()) {
- diffACL.AddAccess(ace);
- }
-
- TString prevACL = path->ACL;
- // and this is the applying them to self tenant root ACL
- path->ApplyACL(diffACL.SerializeAsString());
-
- if (prevACL != path->ACL) {
- ++path->ACLVersion;
- Self->PersistACL(db, path);
-
- for (const TPathId pathId : Self->ListSubThee(Self->RootPathId(), ctx)) {
- SideEffects.PublishToSchemeBoard(InvalidOperationId, pathId);
- }
-
- MakeSync();
- }
- }
-
- if (HasSync()) {
- SideEffects.Send(Ev->Sender, ReleaseSync());
- }
-
- SideEffects.ApplyOnExecute(Self, txc, ctx);
- }
-
- void DoComplete(const TActorContext &ctx) override {
- SideEffects.ApplyOnComplete(Self, ctx);
- }
-};
-
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxUpdateTenant(TEvSchemeShard::TEvUpdateTenantSchemeShard::TPtr& ev) {
- return new TTxUpdateTenant(this, ev);
-}
-
-}}
+ if (record.HasUpdateTenantRootACL()) {
+ // KIKIMR-10699: transfer tenants root ACL from GSS to the TSS
+ // here TSS sees the ACL from GSS
+ // TSS add all the ACL from GSS to self tenant root
+ NACLib::TACL tenantRootACL(record.GetUpdateTenantRootACL());
+
+ // this is just a transformation ACL to TDiffACL
+ NACLib::TDiffACL diffACL;
+ for (auto ace: tenantRootACL.GetACE()) {
+ diffACL.AddAccess(ace);
+ }
+
+ TString prevACL = path->ACL;
+ // and this is the applying them to self tenant root ACL
+ path->ApplyACL(diffACL.SerializeAsString());
+
+ if (prevACL != path->ACL) {
+ ++path->ACLVersion;
+ Self->PersistACL(db, path);
+
+ for (const TPathId pathId : Self->ListSubThee(Self->RootPathId(), ctx)) {
+ SideEffects.PublishToSchemeBoard(InvalidOperationId, pathId);
+ }
+
+ MakeSync();
+ }
+ }
+
+ if (HasSync()) {
+ SideEffects.Send(Ev->Sender, ReleaseSync());
+ }
+
+ SideEffects.ApplyOnExecute(Self, txc, ctx);
+ }
+
+ void DoComplete(const TActorContext &ctx) override {
+ SideEffects.ApplyOnComplete(Self, ctx);
+ }
+};
+
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxUpdateTenant(TEvSchemeShard::TEvUpdateTenantSchemeShard::TPtr& ev) {
+ return new TTxUpdateTenant(this, ev);
+}
+
+}}
diff --git a/ydb/core/tx/schemeshard/schemeshard__table_stats.cpp b/ydb/core/tx/schemeshard/schemeshard__table_stats.cpp
index 7fd54b6b80f..b2e7db88b79 100644
--- a/ydb/core/tx/schemeshard/schemeshard__table_stats.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__table_stats.cpp
@@ -3,7 +3,7 @@
#include <ydb/core/protos/sys_view.pb.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
template <typename T>
static ui64 GetThroughput(const T& c) {
@@ -21,11 +21,11 @@ static ui64 GetIops(const T& c) {
return acc;
}
-void TSchemeShard::Handle(NSysView::TEvSysView::TEvGetPartitionStats::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(NSysView::TEvSysView::TEvGetPartitionStats::TPtr& ev, const TActorContext& ctx) {
ctx.Send(ev->Forward(SysPartitionStatsCollector));
}
-auto TSchemeShard::BuildStatsForCollector(TPathId pathId, TShardIdx shardIdx, TTabletId datashardId,
+auto TSchemeShard::BuildStatsForCollector(TPathId pathId, TShardIdx shardIdx, TTabletId datashardId,
TMaybe<ui32> nodeId, TMaybe<ui64> startTime, const TTableInfo::TPartitionStats& stats)
{
auto ev = MakeHolder<NSysView::TEvSysView::TEvSendPartitionStats>(
@@ -36,7 +36,7 @@ auto TSchemeShard::BuildStatsForCollector(TPathId pathId, TShardIdx shardIdx, TT
sysStats.SetRowCount(stats.RowCount);
sysStats.SetIndexSize(stats.IndexSize);
sysStats.SetCPUCores(std::min(stats.GetCurrentRawCpuUsage() / 1000000., 1.0));
- sysStats.SetTabletId(ui64(datashardId));
+ sysStats.SetTabletId(ui64(datashardId));
sysStats.SetAccessTime(stats.LastAccessTime.MilliSeconds());
sysStats.SetUpdateTime(stats.LastUpdateTime.MilliSeconds());
sysStats.SetInFlightTxCount(stats.InFlightTxCount);
@@ -60,15 +60,15 @@ auto TSchemeShard::BuildStatsForCollector(TPathId pathId, TShardIdx shardIdx, TT
return ev;
}
-class TTxStorePartitionStats: public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
+class TTxStorePartitionStats: public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
TEvDataShard::TEvPeriodicTableStats::TPtr Ev;
THolder<NSysView::TEvSysView::TEvSendPartitionStats> StatsCollectorEv;
THolder<TEvDataShard::TEvGetTableStats> GetStatsEv;
THolder<TEvDataShard::TEvCompactBorrowed> CompactEv;
- TSideEffects MergeOpSideEffects;
-
+ TSideEffects MergeOpSideEffects;
+
public:
explicit TTxStorePartitionStats(TSelf* self, TEvDataShard::TEvPeriodicTableStats::TPtr& ev)
: TBase(self)
@@ -87,44 +87,44 @@ public:
}; // TTxStorePartitionStats
-THolder<TProposeRequest> MergeRequest(
- TSchemeShard* ss, TTxId& txId, TPathId& pathId, const TVector<TShardIdx>& shardsToMerge)
-{
- auto request = MakeHolder<TProposeRequest>(ui64(txId), ui64(ss->SelfTabletId()));
- auto& record = request->Record;
-
- TPath tablePath = TPath::Init(pathId, ss);
-
- auto& propose = *record.AddTransaction();
- propose.SetFailOnExist(false);
- propose.SetOperationType(NKikimrSchemeOp::ESchemeOpSplitMergeTablePartitions);
- propose.SetInternal(true);
-
- propose.SetWorkingDir(tablePath.Parent().PathString());
-
- auto& merge = *propose.MutableSplitMergeTablePartitions();
- merge.SetTablePath(tablePath.PathString());
- merge.SetSchemeshardId(ss->TabletID());
-
- for (auto shardIdx : shardsToMerge) {
- auto tabletId = ss->ShardInfos.at(shardIdx).TabletID;
- merge.AddSourceTabletId(ui64(tabletId));
- }
-
- return std::move(request);
-}
-
+THolder<TProposeRequest> MergeRequest(
+ TSchemeShard* ss, TTxId& txId, TPathId& pathId, const TVector<TShardIdx>& shardsToMerge)
+{
+ auto request = MakeHolder<TProposeRequest>(ui64(txId), ui64(ss->SelfTabletId()));
+ auto& record = request->Record;
+
+ TPath tablePath = TPath::Init(pathId, ss);
+
+ auto& propose = *record.AddTransaction();
+ propose.SetFailOnExist(false);
+ propose.SetOperationType(NKikimrSchemeOp::ESchemeOpSplitMergeTablePartitions);
+ propose.SetInternal(true);
+
+ propose.SetWorkingDir(tablePath.Parent().PathString());
+
+ auto& merge = *propose.MutableSplitMergeTablePartitions();
+ merge.SetTablePath(tablePath.PathString());
+ merge.SetSchemeshardId(ss->TabletID());
+
+ for (auto shardIdx : shardsToMerge) {
+ auto tabletId = ss->ShardInfos.at(shardIdx).TabletID;
+ merge.AddSourceTabletId(ui64(tabletId));
+ }
+
+ return std::move(request);
+}
+
bool TTxStorePartitionStats::Execute(TTransactionContext& txc, const TActorContext& ctx) {
const auto& rec = Ev->Get()->Record;
- auto datashardId = TTabletId(rec.GetDatashardId());
- TPathId tableId = InvalidPathId;
- if (rec.HasTableOwnerId()) {
- tableId = TPathId(TOwnerId(rec.GetTableOwnerId()),
- TLocalPathId(rec.GetTableLocalId()));
- } else {
+ auto datashardId = TTabletId(rec.GetDatashardId());
+ TPathId tableId = InvalidPathId;
+ if (rec.HasTableOwnerId()) {
+ tableId = TPathId(TOwnerId(rec.GetTableOwnerId()),
+ TLocalPathId(rec.GetTableLocalId()));
+ } else {
tableId = Self->MakeLocalId(TLocalPathId(rec.GetTableLocalId()));
- }
-
+ }
+
const auto& tableStats = rec.GetTableStats();
const auto& tabletMetrics = rec.GetTabletMetrics();
ui64 dataSize = tableStats.GetDataSize();
@@ -177,13 +177,13 @@ bool TTxStorePartitionStats::Execute(TTransactionContext& txc, const TActorConte
newStats.SearchHeight = tableStats.GetSearchHeight();
newStats.StartTime = TInstant::MilliSeconds(rec.GetStartTime());
for (ui64 tabletId : rec.GetUserTablePartOwners()) {
- newStats.PartOwners.insert(TTabletId(tabletId));
+ newStats.PartOwners.insert(TTabletId(tabletId));
if (tabletId != rec.GetDatashardId()) {
newStats.HasBorrowed = true;
}
}
for (ui64 tabletId : rec.GetSysTablesPartOwners()) {
- newStats.PartOwners.insert(TTabletId(tabletId));
+ newStats.PartOwners.insert(TTabletId(tabletId));
}
newStats.ShardState = rec.GetShardState();
@@ -202,7 +202,7 @@ bool TTxStorePartitionStats::Execute(TTransactionContext& txc, const TActorConte
NIceDb::TNiceDb db(txc.DB);
- if (!table->IsBackup && !table->IsShardsStatsDetached()) {
+ if (!table->IsBackup && !table->IsShardsStatsDetached()) {
auto newAggrStats = table->GetStats().Aggregated;
auto subDomainId = Self->ResolveDomainId(tableId);
auto subDomainInfo = Self->ResolveDomainInfo(tableId);
@@ -255,30 +255,30 @@ bool TTxStorePartitionStats::Execute(TTransactionContext& txc, const TActorConte
}
}
- TVector<TShardIdx> shardsToMerge;
+ TVector<TShardIdx> shardsToMerge;
if (table->CheckCanMergePartitions(Self->SplitSettings, shardIdx, shardsToMerge)) {
- TTxId txId = Self->GetCachedTxId(ctx);
-
- if (!txId) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Do not request merge op"
- << ", reason: no cached tx ids for internal operation"
- << ", shardIdx: " << shardIdx
- << ", size of merge: " << shardsToMerge.size());
- return true;
+ TTxId txId = Self->GetCachedTxId(ctx);
+
+ if (!txId) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Do not request merge op"
+ << ", reason: no cached tx ids for internal operation"
+ << ", shardIdx: " << shardIdx
+ << ", size of merge: " << shardsToMerge.size());
+ return true;
}
- auto request = MergeRequest(Self, txId, Self->ShardInfos[shardIdx].PathId, shardsToMerge);
-
- TMemoryChanges memChanges;
- TStorageChanges dbChanges;
- TOperationContext context{Self, txc, ctx, MergeOpSideEffects, memChanges, dbChanges};
-
- auto response = Self->IgniteOperation(*request, context);
-
- dbChanges.Apply(Self, txc, ctx);
- MergeOpSideEffects.ApplyOnExecute(Self, txc, ctx);
-
+ auto request = MergeRequest(Self, txId, Self->ShardInfos[shardIdx].PathId, shardsToMerge);
+
+ TMemoryChanges memChanges;
+ TStorageChanges dbChanges;
+ TOperationContext context{Self, txc, ctx, MergeOpSideEffects, memChanges, dbChanges};
+
+ auto response = Self->IgniteOperation(*request, context);
+
+ dbChanges.Apply(Self, txc, ctx);
+ MergeOpSideEffects.ApplyOnExecute(Self, txc, ctx);
+
return true;
}
@@ -297,40 +297,40 @@ bool TTxStorePartitionStats::Execute(TTransactionContext& txc, const TActorConte
collectKeySample = true;
} else if (dataSize < table->GetShardSizeToSplit()) {
return true;
- }
-
+ }
+
if (table->GetPartitions().size() >= table->GetMaxPartitionsCount()) {
return true;
}
- {
- constexpr ui64 deltaShards = 2;
+ {
+ constexpr ui64 deltaShards = 2;
TPathElement::TPtr path = Self->PathsById.at(tableId);
TSubDomainInfo::TPtr domainInfo = Self->ResolveDomainInfo(tableId);
-
- if (domainInfo->GetShardsInside() + deltaShards > domainInfo->GetSchemeLimits().MaxShards) {
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Do not request full stats from datashard"
- << ", datashard: " << datashardId
- << ", reason: shards count has reached maximum value in the domain"
- << ", shards limit for domain: " << domainInfo->GetSchemeLimits().MaxShards
- << ", shards count inside domain: " << domainInfo->GetShardsInside()
- << ", intention to create new shards: " << deltaShards);
+
+ if (domainInfo->GetShardsInside() + deltaShards > domainInfo->GetSchemeLimits().MaxShards) {
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Do not request full stats from datashard"
+ << ", datashard: " << datashardId
+ << ", reason: shards count has reached maximum value in the domain"
+ << ", shards limit for domain: " << domainInfo->GetSchemeLimits().MaxShards
+ << ", shards count inside domain: " << domainInfo->GetShardsInside()
+ << ", intention to create new shards: " << deltaShards);
return true;
- }
-
- if (path->GetShardsInside() + deltaShards > domainInfo->GetSchemeLimits().MaxShardsInPath) {
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Do not request full stats from datashard"
- << ", datashard: " << datashardId
- << ", reason: shards count has reached maximum value in the path"
- << ", shards limit for path: " << domainInfo->GetSchemeLimits().MaxShardsInPath
- << ", shards count inside path: " << path->GetShardsInside()
- << ", intention to create new shards: " << deltaShards);
+ }
+
+ if (path->GetShardsInside() + deltaShards > domainInfo->GetSchemeLimits().MaxShardsInPath) {
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Do not request full stats from datashard"
+ << ", datashard: " << datashardId
+ << ", reason: shards count has reached maximum value in the path"
+ << ", shards limit for path: " << domainInfo->GetSchemeLimits().MaxShardsInPath
+ << ", shards count inside path: " << path->GetShardsInside()
+ << ", intention to create new shards: " << deltaShards);
return true;
- }
- }
-
+ }
+ }
+
if (newStats.HasBorrowed) {
// We don't want to split shards that have borrow parts
// We must ask them to compact first
@@ -345,8 +345,8 @@ bool TTxStorePartitionStats::Execute(TTransactionContext& txc, const TActorConte
}
void TTxStorePartitionStats::Complete(const TActorContext& ctx) {
- MergeOpSideEffects.ApplyOnComplete(Self, ctx);
-
+ MergeOpSideEffects.ApplyOnComplete(Self, ctx);
+
if (StatsCollectorEv) {
ctx.Send(Self->SysPartitionStatsCollector, StatsCollectorEv.Release());
}
@@ -364,7 +364,7 @@ void TTxStorePartitionStats::Complete(const TActorContext& ctx) {
}
}
-void TSchemeShard::Handle(TEvDataShard::TEvPeriodicTableStats::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvDataShard::TEvPeriodicTableStats::TPtr& ev, const TActorContext& ctx) {
const auto& rec = ev->Get()->Record;
auto datashardId = TTabletId(rec.GetDatashardId());
@@ -373,14 +373,14 @@ void TSchemeShard::Handle(TEvDataShard::TEvPeriodicTableStats::TPtr& ev, const T
ui64 dataSize = tableStats.GetDataSize();
ui64 rowCount = tableStats.GetRowCount();
- TPathId pathId = rec.HasTableOwnerId()
- ? TPathId(TOwnerId(rec.GetTableOwnerId()), TLocalPathId(rec.GetTableLocalId()))
- : MakeLocalId(TLocalPathId(rec.GetTableLocalId()));
-
+ TPathId pathId = rec.HasTableOwnerId()
+ ? TPathId(TOwnerId(rec.GetTableOwnerId()), TLocalPathId(rec.GetTableLocalId()))
+ : MakeLocalId(TLocalPathId(rec.GetTableLocalId()));
+
LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Got periodic table stats at tablet " << TabletID()
- << " from datashard " << datashardId
- << " pathId " << pathId
+ << " from datashard " << datashardId
+ << " pathId " << pathId
<< " state '" << DatashardStateName(rec.GetShardState()) << "'"
<< " dataSize " << dataSize
<< " rowCount " << rowCount
diff --git a/ydb/core/tx/schemeshard/schemeshard__table_stats_histogram.cpp b/ydb/core/tx/schemeshard/schemeshard__table_stats_histogram.cpp
index 959f1f87486..a5fb3bdac4b 100644
--- a/ydb/core/tx/schemeshard/schemeshard__table_stats_histogram.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__table_stats_histogram.cpp
@@ -3,7 +3,7 @@
#include <ydb/core/tx/tx_proxy/proxy.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
static bool IsIntegerType(NScheme::TTypeId typeId) {
switch (typeId) {
@@ -202,116 +202,116 @@ const char* ToString(ESplitReason splitReason) {
}
}
-class TTxPartitionHistogram: public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
- TEvDataShard::TEvGetTableStatsResult::TPtr Ev;
-
- TSideEffects SplitOpSideEffects;
-
-public:
- explicit TTxPartitionHistogram(TSelf* self, TEvDataShard::TEvGetTableStatsResult::TPtr& ev)
- : TBase(self)
- , Ev(ev)
- {
- }
-
- virtual ~TTxPartitionHistogram() = default;
-
- TTxType GetTxType() const override {
- return TXTYPE_PARTITION_HISTOGRAM;
- }
-
- bool Execute(TTransactionContext& txc, const TActorContext& ctx) override;
- void Complete(const TActorContext& ctx) override;
-
-}; // TTxStorePartitionStats
-
-
-void TSchemeShard::Handle(TEvDataShard::TEvGetTableStatsResult::TPtr& ev, const TActorContext& ctx) {
+class TTxPartitionHistogram: public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
+ TEvDataShard::TEvGetTableStatsResult::TPtr Ev;
+
+ TSideEffects SplitOpSideEffects;
+
+public:
+ explicit TTxPartitionHistogram(TSelf* self, TEvDataShard::TEvGetTableStatsResult::TPtr& ev)
+ : TBase(self)
+ , Ev(ev)
+ {
+ }
+
+ virtual ~TTxPartitionHistogram() = default;
+
+ TTxType GetTxType() const override {
+ return TXTYPE_PARTITION_HISTOGRAM;
+ }
+
+ bool Execute(TTransactionContext& txc, const TActorContext& ctx) override;
+ void Complete(const TActorContext& ctx) override;
+
+}; // TTxStorePartitionStats
+
+
+void TSchemeShard::Handle(TEvDataShard::TEvGetTableStatsResult::TPtr& ev, const TActorContext& ctx) {
const auto& rec = ev->Get()->Record;
- auto datashardId = TTabletId(rec.GetDatashardId());
- ui64 dataSize = rec.GetTableStats().GetDataSize();
- ui64 rowCount = rec.GetTableStats().GetRowCount();
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got partition histogran at tablet " << TabletID()
- <<" from datashard " << datashardId
- << " state: '" << DatashardStateName(rec.GetShardState()) << "'"
- << " data size: " << dataSize
- << " row count: " << rowCount
- );
-
- Execute(new TTxPartitionHistogram(this, ev), ctx);
-}
-
-THolder<TProposeRequest> SplitRequest(
- TSchemeShard* ss, TTxId& txId, TPathId& pathId, TTabletId datashardId, const TString& keyBuff)
-{
- auto request = MakeHolder<TProposeRequest>(ui64(txId), ui64(ss->SelfTabletId()));
- auto& record = request->Record;
-
- TPath tablePath = TPath::Init(pathId, ss);
-
- auto& propose = *record.AddTransaction();
- propose.SetFailOnExist(false);
- propose.SetOperationType(NKikimrSchemeOp::ESchemeOpSplitMergeTablePartitions);
- propose.SetInternal(true);
-
- propose.SetWorkingDir(tablePath.Parent().PathString());
-
- auto& split = *propose.MutableSplitMergeTablePartitions();
- split.SetTablePath(tablePath.PathString());
- split.SetSchemeshardId(ss->TabletID());
-
- split.AddSourceTabletId(ui64(datashardId));
- split.AddSplitBoundary()->SetSerializedKeyPrefix(keyBuff);
-
- return request;
-}
-
-bool TTxPartitionHistogram::Execute(TTransactionContext& txc, const TActorContext& ctx) {
- const auto& rec = Ev->Get()->Record;
-
+ auto datashardId = TTabletId(rec.GetDatashardId());
+ ui64 dataSize = rec.GetTableStats().GetDataSize();
+ ui64 rowCount = rec.GetTableStats().GetRowCount();
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got partition histogran at tablet " << TabletID()
+ <<" from datashard " << datashardId
+ << " state: '" << DatashardStateName(rec.GetShardState()) << "'"
+ << " data size: " << dataSize
+ << " row count: " << rowCount
+ );
+
+ Execute(new TTxPartitionHistogram(this, ev), ctx);
+}
+
+THolder<TProposeRequest> SplitRequest(
+ TSchemeShard* ss, TTxId& txId, TPathId& pathId, TTabletId datashardId, const TString& keyBuff)
+{
+ auto request = MakeHolder<TProposeRequest>(ui64(txId), ui64(ss->SelfTabletId()));
+ auto& record = request->Record;
+
+ TPath tablePath = TPath::Init(pathId, ss);
+
+ auto& propose = *record.AddTransaction();
+ propose.SetFailOnExist(false);
+ propose.SetOperationType(NKikimrSchemeOp::ESchemeOpSplitMergeTablePartitions);
+ propose.SetInternal(true);
+
+ propose.SetWorkingDir(tablePath.Parent().PathString());
+
+ auto& split = *propose.MutableSplitMergeTablePartitions();
+ split.SetTablePath(tablePath.PathString());
+ split.SetSchemeshardId(ss->TabletID());
+
+ split.AddSourceTabletId(ui64(datashardId));
+ split.AddSplitBoundary()->SetSerializedKeyPrefix(keyBuff);
+
+ return request;
+}
+
+bool TTxPartitionHistogram::Execute(TTransactionContext& txc, const TActorContext& ctx) {
+ const auto& rec = Ev->Get()->Record;
+
if (!rec.GetFullStatsReady())
- return true;
-
- auto datashardId = TTabletId(rec.GetDatashardId());
- TPathId tableId = InvalidPathId;
- if (rec.HasTableOwnerId()) {
- tableId = TPathId(TOwnerId(rec.GetTableOwnerId()),
- TLocalPathId(rec.GetTableLocalId()));
- } else {
- tableId = Self->MakeLocalId(TLocalPathId(rec.GetTableLocalId()));
- }
+ return true;
+
+ auto datashardId = TTabletId(rec.GetDatashardId());
+ TPathId tableId = InvalidPathId;
+ if (rec.HasTableOwnerId()) {
+ tableId = TPathId(TOwnerId(rec.GetTableOwnerId()),
+ TLocalPathId(rec.GetTableLocalId()));
+ } else {
+ tableId = Self->MakeLocalId(TLocalPathId(rec.GetTableLocalId()));
+ }
ui64 dataSize = rec.GetTableStats().GetDataSize();
ui64 rowCount = rec.GetTableStats().GetRowCount();
LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TTxPartitionHistogram::Execute partition histogran"
- << " at tablet " << Self->SelfTabletId()
- << " from datashard " << datashardId
- << " for pathId " << tableId
- << " state '" << DatashardStateName(rec.GetShardState()).data() << "'"
- << " dataSize " << dataSize
- << " rowCount " << rowCount);
-
- if (!Self->Tables.contains(tableId))
- return true;
+ "TTxPartitionHistogram::Execute partition histogran"
+ << " at tablet " << Self->SelfTabletId()
+ << " from datashard " << datashardId
+ << " for pathId " << tableId
+ << " state '" << DatashardStateName(rec.GetShardState()).data() << "'"
+ << " dataSize " << dataSize
+ << " rowCount " << rowCount);
+
+ if (!Self->Tables.contains(tableId))
+ return true;
- TTableInfo::TPtr table = Self->Tables[tableId];
+ TTableInfo::TPtr table = Self->Tables[tableId];
- if (!Self->TabletIdToShardIdx.contains(datashardId))
- return true;
+ if (!Self->TabletIdToShardIdx.contains(datashardId))
+ return true;
// Don't split/merge backup tables
if (table->IsBackup)
- return true;
+ return true;
- auto shardIdx = Self->TabletIdToShardIdx[datashardId];
+ auto shardIdx = Self->TabletIdToShardIdx[datashardId];
ESplitReason splitReason = ESplitReason::NO_SPLIT;
- if (table->CheckFastSplitForPartition(Self->SplitSettings, shardIdx, dataSize, rowCount)) {
- const TTableInfo* parentTable = Self->GetMainTableForIndex(tableId);
+ if (table->CheckFastSplitForPartition(Self->SplitSettings, shardIdx, dataSize, rowCount)) {
+ const TTableInfo* parentTable = Self->GetMainTableForIndex(tableId);
if (parentTable && table->GetPartitions().size() < parentTable->GetPartitions().size()) {
splitReason = ESplitReason::FAST_SPLIT_INDEX;
}
@@ -321,19 +321,19 @@ bool TTxPartitionHistogram::Execute(TTransactionContext& txc, const TActorContex
splitReason = ESplitReason::SPLIT_BY_SIZE;
}
- if (splitReason == ESplitReason::NO_SPLIT && table->CheckSplitByLoad(Self->SplitSettings, shardIdx, dataSize, rowCount)) {
+ if (splitReason == ESplitReason::NO_SPLIT && table->CheckSplitByLoad(Self->SplitSettings, shardIdx, dataSize, rowCount)) {
splitReason = ESplitReason::SPLIT_BY_LOAD;
}
- if (splitReason == ESplitReason::NO_SPLIT) {
- return true;
- }
+ if (splitReason == ESplitReason::NO_SPLIT) {
+ return true;
+ }
+
+ if (table->GetPartitions().size() >= table->GetMaxPartitionsCount()) {
+ return true;
+ }
- if (table->GetPartitions().size() >= table->GetMaxPartitionsCount()) {
- return true;
- }
-
TSmallVec<NScheme::TTypeId> keyColumnTypes(table->KeyColumnIds.size());
for (size_t ki = 0; ki < table->KeyColumnIds.size(); ++ki) {
keyColumnTypes[ki] = table->Columns.FindPtr(table->KeyColumnIds[ki])->PType;
@@ -349,9 +349,9 @@ bool TTxPartitionHistogram::Execute(TTransactionContext& txc, const TActorContex
} else {
// Choose number of parts and split boundaries
const auto& histogram = rec.GetTableStats().GetDataSizeHistogram();
- if (histogram.BucketsSize() < 2) {
- return true;
- }
+ if (histogram.BucketsSize() < 2) {
+ return true;
+ }
splitKey = ChooseSplitKeyByHistogram(histogram, keyColumnTypes);
@@ -364,7 +364,7 @@ bool TTxPartitionHistogram::Execute(TTransactionContext& txc, const TActorContex
LOG_WARN(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Failed to find proper split key for '%s' of datashard %" PRIu64,
ToString(splitReason), datashardId);
- return true;
+ return true;
}
}
@@ -372,36 +372,36 @@ bool TTxPartitionHistogram::Execute(TTransactionContext& txc, const TActorContex
LOG_WARN(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Failed to find proper split key for '%s' of datashard %" PRIu64,
ToString(splitReason), datashardId);
- return true;
+ return true;
}
- TTxId txId = Self->GetCachedTxId(ctx);
-
- if (!txId) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Do not request split op"
- << ", reason: no cached tx ids for internal operation"
- << ", shardIdx: " << shardIdx);
- return true;
- }
-
- auto request = SplitRequest(Self, txId, tableId, datashardId, splitKey.GetBuffer());
-
- TMemoryChanges memChanges;
- TStorageChanges dbChanges;
- TOperationContext context{Self, txc, ctx, SplitOpSideEffects, memChanges, dbChanges};
-
- auto response = Self->IgniteOperation(*request, context);
-
- dbChanges.Apply(Self, txc, ctx);
- SplitOpSideEffects.ApplyOnExecute(Self, txc, ctx);
-
- return true;
+ TTxId txId = Self->GetCachedTxId(ctx);
+
+ if (!txId) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Do not request split op"
+ << ", reason: no cached tx ids for internal operation"
+ << ", shardIdx: " << shardIdx);
+ return true;
+ }
+
+ auto request = SplitRequest(Self, txId, tableId, datashardId, splitKey.GetBuffer());
+
+ TMemoryChanges memChanges;
+ TStorageChanges dbChanges;
+ TOperationContext context{Self, txc, ctx, SplitOpSideEffects, memChanges, dbChanges};
+
+ auto response = Self->IgniteOperation(*request, context);
+
+ dbChanges.Apply(Self, txc, ctx);
+ SplitOpSideEffects.ApplyOnExecute(Self, txc, ctx);
+
+ return true;
+}
+
+
+void TTxPartitionHistogram::Complete(const TActorContext& ctx) {
+ SplitOpSideEffects.ApplyOnComplete(Self, ctx);
}
-
-void TTxPartitionHistogram::Complete(const TActorContext& ctx) {
- SplitOpSideEffects.ApplyOnComplete(Self, ctx);
-}
-
}}
diff --git a/ydb/core/tx/schemeshard/schemeshard__upgrade_access_database.cpp b/ydb/core/tx/schemeshard/schemeshard__upgrade_access_database.cpp
index 6f8e34e6828..4864dc9db36 100644
--- a/ydb/core/tx/schemeshard/schemeshard__upgrade_access_database.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__upgrade_access_database.cpp
@@ -1,153 +1,153 @@
-#include "schemeshard_impl.h"
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-using namespace NTabletFlatExecutor;
-
-struct TSchemeShard::TTxUpgradeAccessDatabaseRights : public TTransactionBase<TSchemeShard> {
- bool IsDryRun;
+#include "schemeshard_impl.h"
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+using namespace NTabletFlatExecutor;
+
+struct TSchemeShard::TTxUpgradeAccessDatabaseRights : public TTransactionBase<TSchemeShard> {
+ bool IsDryRun;
TActorId AnswerTo;
- std::function< NActors::IEventBase* (const TMap<TPathId, TSet<TString>>&) > AnswerFunc;
- TSideEffects SideEffects;
-
- TTxUpgradeAccessDatabaseRights(TSelf* self,
- const bool isDryRun,
+ std::function< NActors::IEventBase* (const TMap<TPathId, TSet<TString>>&) > AnswerFunc;
+ TSideEffects SideEffects;
+
+ TTxUpgradeAccessDatabaseRights(TSelf* self,
+ const bool isDryRun,
const TActorId& answerTo,
- std::function< NActors::IEventBase* (const TMap<TPathId, TSet<TString>>&) > answerFunc)
- : TTransactionBase<TSchemeShard>(self)
- , IsDryRun(isDryRun)
- , AnswerTo(answerTo)
- , AnswerFunc(answerFunc)
- {}
-
- TTxType GetTxType() const override {
- return TXTYPE_UPGRADE_SCHEME;
- }
-
- TVector<TString> GetSids(const TString& owner, const TString& aclData) {
- TVector<TString> result;
-
- NACLib::TACL acl(aclData);
-
- result.push_back(owner);
-
- for (const NACLibProto::TACE& ace : acl.GetACE()) {
- if (ace.GetAccessType() == static_cast<ui32>(NACLib::EAccessType::Allow)) {
- result.push_back(ace.GetSID());
- }
- }
-
- return result;
- }
-
- TVector<TString> GetSidsWithConnect(const TString& owner, const TString& aclData) {
- TVector<TString> result;
-
- NACLib::TACL acl(aclData);
-
- result.push_back(owner);
-
- for (const NACLibProto::TACE& ace : acl.GetACE()) {
- if (ace.GetAccessType() == static_cast<ui32>(NACLib::EAccessType::Allow)) {
- if (ace.GetAccessRight() & NACLib::EAccessRights::ConnectDatabase) {
- result.push_back(ace.GetSID());
- }
- }
- }
-
- return result;
- }
-
- TString UpgradeAccess(const TString& aclData, const TSet<TString>& sids) {
- NACLib::TACL acl(aclData);
-
- for (const auto& x: sids) {
- acl.AddAccess(NACLib::EAccessType::Allow, NACLib::EAccessRights::ConnectDatabase, x, NACLib::InheritNone);
- }
-
- TString proto;
+ std::function< NActors::IEventBase* (const TMap<TPathId, TSet<TString>>&) > answerFunc)
+ : TTransactionBase<TSchemeShard>(self)
+ , IsDryRun(isDryRun)
+ , AnswerTo(answerTo)
+ , AnswerFunc(answerFunc)
+ {}
+
+ TTxType GetTxType() const override {
+ return TXTYPE_UPGRADE_SCHEME;
+ }
+
+ TVector<TString> GetSids(const TString& owner, const TString& aclData) {
+ TVector<TString> result;
+
+ NACLib::TACL acl(aclData);
+
+ result.push_back(owner);
+
+ for (const NACLibProto::TACE& ace : acl.GetACE()) {
+ if (ace.GetAccessType() == static_cast<ui32>(NACLib::EAccessType::Allow)) {
+ result.push_back(ace.GetSID());
+ }
+ }
+
+ return result;
+ }
+
+ TVector<TString> GetSidsWithConnect(const TString& owner, const TString& aclData) {
+ TVector<TString> result;
+
+ NACLib::TACL acl(aclData);
+
+ result.push_back(owner);
+
+ for (const NACLibProto::TACE& ace : acl.GetACE()) {
+ if (ace.GetAccessType() == static_cast<ui32>(NACLib::EAccessType::Allow)) {
+ if (ace.GetAccessRight() & NACLib::EAccessRights::ConnectDatabase) {
+ result.push_back(ace.GetSID());
+ }
+ }
+ }
+
+ return result;
+ }
+
+ TString UpgradeAccess(const TString& aclData, const TSet<TString>& sids) {
+ NACLib::TACL acl(aclData);
+
+ for (const auto& x: sids) {
+ acl.AddAccess(NACLib::EAccessType::Allow, NACLib::EAccessRights::ConnectDatabase, x, NACLib::InheritNone);
+ }
+
+ TString proto;
Y_PROTOBUF_SUPPRESS_NODISCARD acl.SerializeToString(&proto);
-
- return proto;
- }
-
- bool Execute(TTransactionContext &txc, const TActorContext &ctx) override {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TTxUpgradeSchema.Execute");
-
- if (!Self->IsShemeShardConfigured()) {
- return true;
- }
-
- TMap<TPathId, TSet<TString>> sidsByDomain;
-
- for (const auto& item: Self->PathsById) {
- const TPathElement::TPtr pathElem = item.second;
-
- if (pathElem->Dropped() || pathElem->IsMigrated()) {
- continue;
- }
-
- TPathId domainId = pathElem->IsDomainRoot()
- ? pathElem->PathId
- : pathElem->DomainPathId;
-
- sidsByDomain[domainId].insert(pathElem->Owner);
-
- if (!pathElem->ACL) {
- continue;
- }
-
- for (const auto& x: GetSids(pathElem->Owner, pathElem->ACL)) {
- sidsByDomain[domainId].insert(x);
- }
- }
-
- for (auto& item: sidsByDomain) {
- TPathId domainId = item.first;
- const TPathElement::TPtr domainElem = Self->PathsById.at(domainId);
- Y_VERIFY(domainElem->IsDomainRoot());
-
- TVector<TString> alreadyUpgraded = GetSidsWithConnect(domainElem->Owner, domainElem->ACL);
-
- for (const auto& sid: alreadyUpgraded) {
- item.second.erase(sid);
- }
- }
-
- if (!IsDryRun) {
- NIceDb::TNiceDb db(txc.DB);
-
- for (const auto& item: sidsByDomain) {
- TPathId domainId = item.first;
- const TPathElement::TPtr domainElem = Self->PathsById.at(domainId);
- Y_VERIFY(domainElem->IsDomainRoot());
-
- domainElem->ACL = UpgradeAccess(domainElem->ACL, item.second);
- domainElem->ACLVersion += 1;
-
- Self->PersistACL(db, domainElem);
-
- SideEffects.PublishToSchemeBoard(InvalidOperationId, domainId);
- SideEffects.UpdateTenant(domainId);
- }
- }
-
- SideEffects.Send(AnswerTo, AnswerFunc(sidsByDomain));
-
- SideEffects.ApplyOnExecute(Self, txc, ctx);
- return true;
- }
-
- void Complete(const TActorContext &ctx) override {
- SideEffects.ApplyOnComplete(Self, ctx);
- }
-};
-
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxUpgradeAccessDatabaseRights(
+
+ return proto;
+ }
+
+ bool Execute(TTransactionContext &txc, const TActorContext &ctx) override {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TTxUpgradeSchema.Execute");
+
+ if (!Self->IsShemeShardConfigured()) {
+ return true;
+ }
+
+ TMap<TPathId, TSet<TString>> sidsByDomain;
+
+ for (const auto& item: Self->PathsById) {
+ const TPathElement::TPtr pathElem = item.second;
+
+ if (pathElem->Dropped() || pathElem->IsMigrated()) {
+ continue;
+ }
+
+ TPathId domainId = pathElem->IsDomainRoot()
+ ? pathElem->PathId
+ : pathElem->DomainPathId;
+
+ sidsByDomain[domainId].insert(pathElem->Owner);
+
+ if (!pathElem->ACL) {
+ continue;
+ }
+
+ for (const auto& x: GetSids(pathElem->Owner, pathElem->ACL)) {
+ sidsByDomain[domainId].insert(x);
+ }
+ }
+
+ for (auto& item: sidsByDomain) {
+ TPathId domainId = item.first;
+ const TPathElement::TPtr domainElem = Self->PathsById.at(domainId);
+ Y_VERIFY(domainElem->IsDomainRoot());
+
+ TVector<TString> alreadyUpgraded = GetSidsWithConnect(domainElem->Owner, domainElem->ACL);
+
+ for (const auto& sid: alreadyUpgraded) {
+ item.second.erase(sid);
+ }
+ }
+
+ if (!IsDryRun) {
+ NIceDb::TNiceDb db(txc.DB);
+
+ for (const auto& item: sidsByDomain) {
+ TPathId domainId = item.first;
+ const TPathElement::TPtr domainElem = Self->PathsById.at(domainId);
+ Y_VERIFY(domainElem->IsDomainRoot());
+
+ domainElem->ACL = UpgradeAccess(domainElem->ACL, item.second);
+ domainElem->ACLVersion += 1;
+
+ Self->PersistACL(db, domainElem);
+
+ SideEffects.PublishToSchemeBoard(InvalidOperationId, domainId);
+ SideEffects.UpdateTenant(domainId);
+ }
+ }
+
+ SideEffects.Send(AnswerTo, AnswerFunc(sidsByDomain));
+
+ SideEffects.ApplyOnExecute(Self, txc, ctx);
+ return true;
+ }
+
+ void Complete(const TActorContext &ctx) override {
+ SideEffects.ApplyOnComplete(Self, ctx);
+ }
+};
+
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxUpgradeAccessDatabaseRights(
const TActorId& answerTo, bool isDryRun, std::function< NActors::IEventBase*(const TMap<TPathId, TSet<TString>>&) > func) {
- return new TTxUpgradeAccessDatabaseRights(this, isDryRun, answerTo, func);
-}
-
-} // NSchemeShard
-} // NKikimr
+ return new TTxUpgradeAccessDatabaseRights(this, isDryRun, answerTo, func);
+}
+
+} // NSchemeShard
+} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard__upgrade_schema.cpp b/ydb/core/tx/schemeshard/schemeshard__upgrade_schema.cpp
index 10ecdf0162c..bcc7e7509ea 100644
--- a/ydb/core/tx/schemeshard/schemeshard__upgrade_schema.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__upgrade_schema.cpp
@@ -1,129 +1,129 @@
-#include "schemeshard_impl.h"
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-using namespace NTabletFlatExecutor;
-
-struct TSchemeShard::TTxUpgradeSchema : public TTransactionBase<TSchemeShard> {
- bool IsOk = true;
-
- TTxUpgradeSchema(TSelf* self)
- : TTransactionBase<TSchemeShard>(self)
- {}
-
- bool UpgradeInitState(NIceDb::TNiceDb& db, const TActorContext& ctx) {
- ui64 initStateVal = (ui64)TTenantInitState::InvalidState;
- if (!Self->ReadSysValue(db, Schema::SysParam_TenantInitState, initStateVal, (ui64)TTenantInitState::InvalidState)) {
- return false;
- }
-
- auto state = TTenantInitState::EInitState(initStateVal);
- if (state != TTenantInitState::InvalidState) {
- // tenant SS with migrated path manage state from the start
- return true;
- }
-
- // tenant SS without migrated path or global SS relay on RootId record at Path table
- {
- // probe root path
- auto rootRow = db.Table<Schema::Paths>().Key(NSchemeShard::RootPathId).Select();
- if (!rootRow.IsReady()) {
- return false;
- }
-
- if (rootRow.IsValid()) {
- // has root row
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "UpgradeInitState as Done, schemeshardId: " << Self->TabletID());
- Self->InitState = TTenantInitState::Done;
- Self->PersistInitState(db);
- } else {
- // no root row
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "UpgradeInitState as Uninitialized, schemeshardId: " << Self->TabletID());
- Self->InitState = TTenantInitState::Uninitialized;
- Self->PersistInitState(db);
- }
- // and no matter what is the value of root row
- }
-
- return true;
- }
-
- bool ReplaceExtraPathSymbolsAllowed(NIceDb::TNiceDb& db, const TActorContext &) {
- auto srcRow = db.Table<Schema::UserAttributes>().Key(Self->RootPathId().LocalPathId, TString(ATTR_EXTRA_PATH_SYMBOLS_ALLOWED)).Select();
- if (!srcRow.IsReady()) {
- return false;
- }
-
- TString srcVal;
- if (srcRow.IsValid()) {
- srcVal = srcRow.GetValueOrDefault<Schema::UserAttributes::AttrValue>();
- }
-
- if (!srcVal) {
- // nothing to do
- return true;
- }
-
- auto dstRow = db.Table<Schema::SubDomains>().Key(Self->RootPathId().LocalPathId).Select();
- if (!dstRow.IsReady()) {
- return false;
- }
-
- TString dstVal;
- if (dstRow.IsValid()) {
- dstVal = dstRow.GetValueOrDefault<Schema::SubDomains::ExtraPathSymbolsAllowed>();
- }
-
- // we can delete src value after stable 19-6, 19-6 must contain this data for compatibility
- // db.Table<Schema::UserAttributes>().Key(Self->RootPathId().LocalPathId, ATTR_EXTRA_PATH_SYMBOLS_ALLOWED).Delete();
-
- if (!dstVal) {
- db.Table<Schema::SubDomains>().Key(Self->RootPathId().LocalPathId).Update(
- NIceDb::TUpdate<Schema::SubDomains::ExtraPathSymbolsAllowed>(srcVal));
- }
-
- return true;
- }
-
- TTxType GetTxType() const override {
- return TXTYPE_UPGRADE_SCHEME;
- }
-
- bool Execute(TTransactionContext &txc, const TActorContext &ctx) override {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TTxUpgradeSchema.Execute");
-
- NIceDb::TNiceDb db(txc.DB);
-
- bool precharged = db.Table<Schema::Paths>().Precharge()
- & db.Table<Schema::SubDomains>().Precharge()
- & db.Table<Schema::UserAttributes>().Precharge();
-
- if (!precharged) {
- return false;
- }
-
- return UpgradeInitState(db, ctx) & ReplaceExtraPathSymbolsAllowed(db, ctx);
- }
-
- void Complete(const TActorContext &ctx) override {
- if (!IsOk) {
- LOG_CRIT_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "send TEvPoisonPill to self " << Self->TabletID());
+#include "schemeshard_impl.h"
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+using namespace NTabletFlatExecutor;
+
+struct TSchemeShard::TTxUpgradeSchema : public TTransactionBase<TSchemeShard> {
+ bool IsOk = true;
+
+ TTxUpgradeSchema(TSelf* self)
+ : TTransactionBase<TSchemeShard>(self)
+ {}
+
+ bool UpgradeInitState(NIceDb::TNiceDb& db, const TActorContext& ctx) {
+ ui64 initStateVal = (ui64)TTenantInitState::InvalidState;
+ if (!Self->ReadSysValue(db, Schema::SysParam_TenantInitState, initStateVal, (ui64)TTenantInitState::InvalidState)) {
+ return false;
+ }
+
+ auto state = TTenantInitState::EInitState(initStateVal);
+ if (state != TTenantInitState::InvalidState) {
+ // tenant SS with migrated path manage state from the start
+ return true;
+ }
+
+ // tenant SS without migrated path or global SS relay on RootId record at Path table
+ {
+ // probe root path
+ auto rootRow = db.Table<Schema::Paths>().Key(NSchemeShard::RootPathId).Select();
+ if (!rootRow.IsReady()) {
+ return false;
+ }
+
+ if (rootRow.IsValid()) {
+ // has root row
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "UpgradeInitState as Done, schemeshardId: " << Self->TabletID());
+ Self->InitState = TTenantInitState::Done;
+ Self->PersistInitState(db);
+ } else {
+ // no root row
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "UpgradeInitState as Uninitialized, schemeshardId: " << Self->TabletID());
+ Self->InitState = TTenantInitState::Uninitialized;
+ Self->PersistInitState(db);
+ }
+ // and no matter what is the value of root row
+ }
+
+ return true;
+ }
+
+ bool ReplaceExtraPathSymbolsAllowed(NIceDb::TNiceDb& db, const TActorContext &) {
+ auto srcRow = db.Table<Schema::UserAttributes>().Key(Self->RootPathId().LocalPathId, TString(ATTR_EXTRA_PATH_SYMBOLS_ALLOWED)).Select();
+ if (!srcRow.IsReady()) {
+ return false;
+ }
+
+ TString srcVal;
+ if (srcRow.IsValid()) {
+ srcVal = srcRow.GetValueOrDefault<Schema::UserAttributes::AttrValue>();
+ }
+
+ if (!srcVal) {
+ // nothing to do
+ return true;
+ }
+
+ auto dstRow = db.Table<Schema::SubDomains>().Key(Self->RootPathId().LocalPathId).Select();
+ if (!dstRow.IsReady()) {
+ return false;
+ }
+
+ TString dstVal;
+ if (dstRow.IsValid()) {
+ dstVal = dstRow.GetValueOrDefault<Schema::SubDomains::ExtraPathSymbolsAllowed>();
+ }
+
+ // we can delete src value after stable 19-6, 19-6 must contain this data for compatibility
+ // db.Table<Schema::UserAttributes>().Key(Self->RootPathId().LocalPathId, ATTR_EXTRA_PATH_SYMBOLS_ALLOWED).Delete();
+
+ if (!dstVal) {
+ db.Table<Schema::SubDomains>().Key(Self->RootPathId().LocalPathId).Update(
+ NIceDb::TUpdate<Schema::SubDomains::ExtraPathSymbolsAllowed>(srcVal));
+ }
+
+ return true;
+ }
+
+ TTxType GetTxType() const override {
+ return TXTYPE_UPGRADE_SCHEME;
+ }
+
+ bool Execute(TTransactionContext &txc, const TActorContext &ctx) override {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TTxUpgradeSchema.Execute");
+
+ NIceDb::TNiceDb db(txc.DB);
+
+ bool precharged = db.Table<Schema::Paths>().Precharge()
+ & db.Table<Schema::SubDomains>().Precharge()
+ & db.Table<Schema::UserAttributes>().Precharge();
+
+ if (!precharged) {
+ return false;
+ }
+
+ return UpgradeInitState(db, ctx) & ReplaceExtraPathSymbolsAllowed(db, ctx);
+ }
+
+ void Complete(const TActorContext &ctx) override {
+ if (!IsOk) {
+ LOG_CRIT_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "send TEvPoisonPill to self " << Self->TabletID());
ctx.Send(Self->SelfId(), new TEvents::TEvPoisonPill());
- return;
- }
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TTxUpgradeSchema.Complete");
- Self->Execute(Self->CreateTxInit(), ctx);
- }
-};
-
-NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxUpgradeSchema() {
- return new TTxUpgradeSchema(this);
-}
-
-} // NSchemeShard
-} // NKikimr
+ return;
+ }
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "TTxUpgradeSchema.Complete");
+ Self->Execute(Self->CreateTxInit(), ctx);
+ }
+};
+
+NTabletFlatExecutor::ITransaction* TSchemeShard::CreateTxUpgradeSchema() {
+ return new TTxUpgradeSchema(this);
+}
+
+} // NSchemeShard
+} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_billing_helpers.cpp b/ydb/core/tx/schemeshard/schemeshard_billing_helpers.cpp
index 216fcccab8f..17049a628f2 100644
--- a/ydb/core/tx/schemeshard/schemeshard_billing_helpers.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_billing_helpers.cpp
@@ -6,7 +6,7 @@
#include <util/string/cast.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
ui64 TRUCalculator::ReadTable(ui64 bytes) {
return 128 * ((bytes + 1_MB - 1) / 1_MB);
@@ -16,5 +16,5 @@ ui64 TRUCalculator::BulkUpsert(ui64 bytes, ui64 rows) {
return (Max(rows, (bytes + 1_KB - 1) / 1_KB) + 1) / 2;
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_billing_helpers.h b/ydb/core/tx/schemeshard/schemeshard_billing_helpers.h
index 1a2110123d3..5892f1e2b7a 100644
--- a/ydb/core/tx/schemeshard/schemeshard_billing_helpers.h
+++ b/ydb/core/tx/schemeshard/schemeshard_billing_helpers.h
@@ -3,7 +3,7 @@
#include <ydb/core/metering/bill_record.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
struct TRUCalculator {
// https://a.yandex-team.ru/arc/trunk/arcadia/kikimr/docs/ru/pricing/serverless.md
@@ -12,5 +12,5 @@ struct TRUCalculator {
}; // TRUCalculator
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_build_index.cpp b/ydb/core/tx/schemeshard/schemeshard_build_index.cpp
index 1b06bb934ea..6d8cdc38dcc 100644
--- a/ydb/core/tx/schemeshard/schemeshard_build_index.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_build_index.cpp
@@ -1,200 +1,200 @@
-#include "schemeshard_build_index.h"
-#include "schemeshard_impl.h"
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-void TSchemeShard::Handle(TEvIndexBuilder::TEvCreateRequest::TPtr& ev, const TActorContext& ctx) {
- Execute(CreateTxCreate(ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvIndexBuilder::TEvGetRequest::TPtr& ev, const TActorContext& ctx) {
- Execute(CreateTxGet(ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvIndexBuilder::TEvCancelRequest::TPtr& ev, const TActorContext& ctx) {
- Execute(CreateTxCancel(ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvIndexBuilder::TEvForgetRequest::TPtr& ev, const TActorContext& ctx) {
- Execute(CreateTxForget(ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvIndexBuilder::TEvListRequest::TPtr& ev, const TActorContext& ctx) {
- Execute(CreateTxList(ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvDataShard::TEvBuildIndexProgressResponse::TPtr& ev, const TActorContext& ctx) {
- Execute(CreateTxReply(ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvPrivate::TEvIndexBuildingMakeABill::TPtr& ev, const TActorContext& ctx) {
- Execute(CreateTxBilling(ev), ctx);
-}
-
-void TSchemeShard::PersistCreateBuildIndex(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
- db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
- NIceDb::TUpdate<Schema::IndexBuild::Uid>(indexInfo->Uid),
- NIceDb::TUpdate<Schema::IndexBuild::DomainOwnerId>(indexInfo->DomainPathId.OwnerId),
- NIceDb::TUpdate<Schema::IndexBuild::DomainLocalId>(indexInfo->DomainPathId.LocalPathId),
- NIceDb::TUpdate<Schema::IndexBuild::TableOwnerId>(indexInfo->TablePathId.OwnerId),
- NIceDb::TUpdate<Schema::IndexBuild::TableLocalId>(indexInfo->TablePathId.LocalPathId),
- NIceDb::TUpdate<Schema::IndexBuild::IndexName>(indexInfo->IndexName),
- NIceDb::TUpdate<Schema::IndexBuild::IndexType>(indexInfo->IndexType),
- NIceDb::TUpdate<Schema::IndexBuild::MaxBatchRows>(indexInfo->Limits.MaxBatchRows),
- NIceDb::TUpdate<Schema::IndexBuild::MaxBatchBytes>(indexInfo->Limits.MaxBatchBytes),
- NIceDb::TUpdate<Schema::IndexBuild::MaxShards>(indexInfo->Limits.MaxShards),
- NIceDb::TUpdate<Schema::IndexBuild::MaxRetries>(indexInfo->Limits.MaxRetries)
- );
-
+#include "schemeshard_build_index.h"
+#include "schemeshard_impl.h"
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+void TSchemeShard::Handle(TEvIndexBuilder::TEvCreateRequest::TPtr& ev, const TActorContext& ctx) {
+ Execute(CreateTxCreate(ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvIndexBuilder::TEvGetRequest::TPtr& ev, const TActorContext& ctx) {
+ Execute(CreateTxGet(ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvIndexBuilder::TEvCancelRequest::TPtr& ev, const TActorContext& ctx) {
+ Execute(CreateTxCancel(ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvIndexBuilder::TEvForgetRequest::TPtr& ev, const TActorContext& ctx) {
+ Execute(CreateTxForget(ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvIndexBuilder::TEvListRequest::TPtr& ev, const TActorContext& ctx) {
+ Execute(CreateTxList(ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvDataShard::TEvBuildIndexProgressResponse::TPtr& ev, const TActorContext& ctx) {
+ Execute(CreateTxReply(ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvPrivate::TEvIndexBuildingMakeABill::TPtr& ev, const TActorContext& ctx) {
+ Execute(CreateTxBilling(ev), ctx);
+}
+
+void TSchemeShard::PersistCreateBuildIndex(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
+ db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
+ NIceDb::TUpdate<Schema::IndexBuild::Uid>(indexInfo->Uid),
+ NIceDb::TUpdate<Schema::IndexBuild::DomainOwnerId>(indexInfo->DomainPathId.OwnerId),
+ NIceDb::TUpdate<Schema::IndexBuild::DomainLocalId>(indexInfo->DomainPathId.LocalPathId),
+ NIceDb::TUpdate<Schema::IndexBuild::TableOwnerId>(indexInfo->TablePathId.OwnerId),
+ NIceDb::TUpdate<Schema::IndexBuild::TableLocalId>(indexInfo->TablePathId.LocalPathId),
+ NIceDb::TUpdate<Schema::IndexBuild::IndexName>(indexInfo->IndexName),
+ NIceDb::TUpdate<Schema::IndexBuild::IndexType>(indexInfo->IndexType),
+ NIceDb::TUpdate<Schema::IndexBuild::MaxBatchRows>(indexInfo->Limits.MaxBatchRows),
+ NIceDb::TUpdate<Schema::IndexBuild::MaxBatchBytes>(indexInfo->Limits.MaxBatchBytes),
+ NIceDb::TUpdate<Schema::IndexBuild::MaxShards>(indexInfo->Limits.MaxShards),
+ NIceDb::TUpdate<Schema::IndexBuild::MaxRetries>(indexInfo->Limits.MaxRetries)
+ );
+
ui32 columnNo = 0;
for (ui32 i = 0; i < indexInfo->IndexColumns.size(); ++i, ++columnNo) {
- db.Table<Schema::IndexBuildColumns>().Key(indexInfo->Id, columnNo).Update(
+ db.Table<Schema::IndexBuildColumns>().Key(indexInfo->Id, columnNo).Update(
NIceDb::TUpdate<Schema::IndexBuildColumns::ColumnName>(indexInfo->IndexColumns[i]),
NIceDb::TUpdate<Schema::IndexBuildColumns::ColumnKind>(EIndexColumnKind::KeyColumn)
);
- }
-
+ }
+
for (ui32 i = 0; i < indexInfo->DataColumns.size(); ++i, ++columnNo) {
db.Table<Schema::IndexBuildColumns>().Key(indexInfo->Id, columnNo).Update(
NIceDb::TUpdate<Schema::IndexBuildColumns::ColumnName>(indexInfo->DataColumns[i]),
NIceDb::TUpdate<Schema::IndexBuildColumns::ColumnKind>(EIndexColumnKind::DataColumn)
);
}
-}
-
-void TSchemeShard::PersistBuildIndexState(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
- db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
- NIceDb::TUpdate<Schema::IndexBuild::State>(ui32(indexInfo->State)));
-}
-
-void TSchemeShard::PersistBuildIndexCancelRequest(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
- db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
- NIceDb::TUpdate<Schema::IndexBuild::CancelRequest>(indexInfo->CancelRequested));
-}
-
-void TSchemeShard::PersistBuildIndexIssue(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
- db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
- NIceDb::TUpdate<Schema::IndexBuild::Issue>(indexInfo->Issue));
-}
-
-void TSchemeShard::PersistBuildIndexInitiateTxId(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
- db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
- NIceDb::TUpdate<Schema::IndexBuild::InitiateTxId>(indexInfo->InitiateTxId));
-}
-
-void TSchemeShard::PersistBuildIndexInitiateTxStatus(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
- db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
- NIceDb::TUpdate<Schema::IndexBuild::InitiateTxStatus>(indexInfo->InitiateTxStatus));
-}
-
-void TSchemeShard::PersistBuildIndexInitiateTxDone(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
- db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
- NIceDb::TUpdate<Schema::IndexBuild::InitiateTxDone>(indexInfo->InitiateTxDone));
-}
-
-void TSchemeShard::PersistBuildIndexApplyTxId(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
- db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
- NIceDb::TUpdate<Schema::IndexBuild::ApplyTxId>(indexInfo->ApplyTxId));
-}
-
-void TSchemeShard::PersistBuildIndexApplyTxStatus(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
- db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
- NIceDb::TUpdate<Schema::IndexBuild::ApplyTxStatus>(indexInfo->ApplyTxStatus));
-}
-
-void TSchemeShard::PersistBuildIndexApplyTxDone(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
- db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
- NIceDb::TUpdate<Schema::IndexBuild::ApplyTxDone>(indexInfo->ApplyTxDone));
-}
-
-void TSchemeShard::PersistBuildIndexLockTxId(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
- db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
- NIceDb::TUpdate<Schema::IndexBuild::LockTxId>(indexInfo->LockTxId));
-}
-
-void TSchemeShard::PersistBuildIndexLockTxStatus(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
- db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
- NIceDb::TUpdate<Schema::IndexBuild::LockTxStatus>(indexInfo->LockTxStatus));
-}
-
-void TSchemeShard::PersistBuildIndexLockTxDone(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
- db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
- NIceDb::TUpdate<Schema::IndexBuild::LockTxDone>(indexInfo->LockTxDone));
-}
-
-void TSchemeShard::PersistBuildIndexUnlockTxDone(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
- db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
- NIceDb::TUpdate<Schema::IndexBuild::UnlockTxDone>(indexInfo->UnlockTxDone));
-}
-
-void TSchemeShard::PersistBuildIndexUnlockTxStatus(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
- db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
- NIceDb::TUpdate<Schema::IndexBuild::UnlockTxStatus>(indexInfo->UnlockTxStatus));
-}
-
-void TSchemeShard::PersistBuildIndexUnlockTxId(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
- db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
- NIceDb::TUpdate<Schema::IndexBuild::UnlockTxId>(indexInfo->UnlockTxId));
-}
-
-void TSchemeShard::PersistBuildIndexBilling(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
- db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
- NIceDb::TUpdate<Schema::IndexBuild::RowsBilled>(indexInfo->Billed.GetRows()),
- NIceDb::TUpdate<Schema::IndexBuild::BytesBilled>(indexInfo->Billed.GetBytes())
- );
-}
-
-void TSchemeShard::PersistBuildIndexUploadProgress(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo, const TShardIdx& shardIdx) {
- const TIndexBuildInfo::TShardStatus& shardStatus = indexInfo->Shards.at(shardIdx);
- db.Table<Schema::IndexBuildShardStatus>().Key(indexInfo->Id, shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
- NIceDb::TUpdate<Schema::IndexBuildShardStatus::LastKeyAck>(shardStatus.LastKeyAck),
- NIceDb::TUpdate<Schema::IndexBuildShardStatus::Status>(shardStatus.Status),
- NIceDb::TUpdate<Schema::IndexBuildShardStatus::Message>(shardStatus.DebugMessage),
- NIceDb::TUpdate<Schema::IndexBuildShardStatus::UploadStatus>(shardStatus.UploadStatus),
- NIceDb::TUpdate<Schema::IndexBuildShardStatus::RowsProcessed>(shardStatus.Processed.GetRows()),
- NIceDb::TUpdate<Schema::IndexBuildShardStatus::BytesProcessed>(shardStatus.Processed.GetBytes())
- );
-}
-
-void TSchemeShard::PersistBuildIndexUploadInitiate(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo, const TShardIdx& shardIdx) {
- const TIndexBuildInfo::TShardStatus& shardStatus = indexInfo->Shards.at(shardIdx);
- NKikimrTx::TKeyRange range;
- shardStatus.Range.Serialize(range);
- db.Table<Schema::IndexBuildShardStatus>().Key(indexInfo->Id, shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
- NIceDb::TUpdate<Schema::IndexBuildShardStatus::Range>(range),
- NIceDb::TUpdate<Schema::IndexBuildShardStatus::LastKeyAck>(shardStatus.LastKeyAck),
- NIceDb::TUpdate<Schema::IndexBuildShardStatus::Status>(shardStatus.Status),
- NIceDb::TUpdate<Schema::IndexBuildShardStatus::UploadStatus>(shardStatus.UploadStatus));
-}
-
-void TSchemeShard::PersistBuildIndexForget(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
- db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Delete();
-
+}
+
+void TSchemeShard::PersistBuildIndexState(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
+ db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
+ NIceDb::TUpdate<Schema::IndexBuild::State>(ui32(indexInfo->State)));
+}
+
+void TSchemeShard::PersistBuildIndexCancelRequest(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
+ db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
+ NIceDb::TUpdate<Schema::IndexBuild::CancelRequest>(indexInfo->CancelRequested));
+}
+
+void TSchemeShard::PersistBuildIndexIssue(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
+ db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
+ NIceDb::TUpdate<Schema::IndexBuild::Issue>(indexInfo->Issue));
+}
+
+void TSchemeShard::PersistBuildIndexInitiateTxId(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
+ db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
+ NIceDb::TUpdate<Schema::IndexBuild::InitiateTxId>(indexInfo->InitiateTxId));
+}
+
+void TSchemeShard::PersistBuildIndexInitiateTxStatus(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
+ db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
+ NIceDb::TUpdate<Schema::IndexBuild::InitiateTxStatus>(indexInfo->InitiateTxStatus));
+}
+
+void TSchemeShard::PersistBuildIndexInitiateTxDone(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
+ db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
+ NIceDb::TUpdate<Schema::IndexBuild::InitiateTxDone>(indexInfo->InitiateTxDone));
+}
+
+void TSchemeShard::PersistBuildIndexApplyTxId(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
+ db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
+ NIceDb::TUpdate<Schema::IndexBuild::ApplyTxId>(indexInfo->ApplyTxId));
+}
+
+void TSchemeShard::PersistBuildIndexApplyTxStatus(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
+ db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
+ NIceDb::TUpdate<Schema::IndexBuild::ApplyTxStatus>(indexInfo->ApplyTxStatus));
+}
+
+void TSchemeShard::PersistBuildIndexApplyTxDone(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
+ db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
+ NIceDb::TUpdate<Schema::IndexBuild::ApplyTxDone>(indexInfo->ApplyTxDone));
+}
+
+void TSchemeShard::PersistBuildIndexLockTxId(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
+ db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
+ NIceDb::TUpdate<Schema::IndexBuild::LockTxId>(indexInfo->LockTxId));
+}
+
+void TSchemeShard::PersistBuildIndexLockTxStatus(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
+ db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
+ NIceDb::TUpdate<Schema::IndexBuild::LockTxStatus>(indexInfo->LockTxStatus));
+}
+
+void TSchemeShard::PersistBuildIndexLockTxDone(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
+ db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
+ NIceDb::TUpdate<Schema::IndexBuild::LockTxDone>(indexInfo->LockTxDone));
+}
+
+void TSchemeShard::PersistBuildIndexUnlockTxDone(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
+ db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
+ NIceDb::TUpdate<Schema::IndexBuild::UnlockTxDone>(indexInfo->UnlockTxDone));
+}
+
+void TSchemeShard::PersistBuildIndexUnlockTxStatus(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
+ db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
+ NIceDb::TUpdate<Schema::IndexBuild::UnlockTxStatus>(indexInfo->UnlockTxStatus));
+}
+
+void TSchemeShard::PersistBuildIndexUnlockTxId(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
+ db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
+ NIceDb::TUpdate<Schema::IndexBuild::UnlockTxId>(indexInfo->UnlockTxId));
+}
+
+void TSchemeShard::PersistBuildIndexBilling(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
+ db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Update(
+ NIceDb::TUpdate<Schema::IndexBuild::RowsBilled>(indexInfo->Billed.GetRows()),
+ NIceDb::TUpdate<Schema::IndexBuild::BytesBilled>(indexInfo->Billed.GetBytes())
+ );
+}
+
+void TSchemeShard::PersistBuildIndexUploadProgress(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo, const TShardIdx& shardIdx) {
+ const TIndexBuildInfo::TShardStatus& shardStatus = indexInfo->Shards.at(shardIdx);
+ db.Table<Schema::IndexBuildShardStatus>().Key(indexInfo->Id, shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
+ NIceDb::TUpdate<Schema::IndexBuildShardStatus::LastKeyAck>(shardStatus.LastKeyAck),
+ NIceDb::TUpdate<Schema::IndexBuildShardStatus::Status>(shardStatus.Status),
+ NIceDb::TUpdate<Schema::IndexBuildShardStatus::Message>(shardStatus.DebugMessage),
+ NIceDb::TUpdate<Schema::IndexBuildShardStatus::UploadStatus>(shardStatus.UploadStatus),
+ NIceDb::TUpdate<Schema::IndexBuildShardStatus::RowsProcessed>(shardStatus.Processed.GetRows()),
+ NIceDb::TUpdate<Schema::IndexBuildShardStatus::BytesProcessed>(shardStatus.Processed.GetBytes())
+ );
+}
+
+void TSchemeShard::PersistBuildIndexUploadInitiate(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo, const TShardIdx& shardIdx) {
+ const TIndexBuildInfo::TShardStatus& shardStatus = indexInfo->Shards.at(shardIdx);
+ NKikimrTx::TKeyRange range;
+ shardStatus.Range.Serialize(range);
+ db.Table<Schema::IndexBuildShardStatus>().Key(indexInfo->Id, shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
+ NIceDb::TUpdate<Schema::IndexBuildShardStatus::Range>(range),
+ NIceDb::TUpdate<Schema::IndexBuildShardStatus::LastKeyAck>(shardStatus.LastKeyAck),
+ NIceDb::TUpdate<Schema::IndexBuildShardStatus::Status>(shardStatus.Status),
+ NIceDb::TUpdate<Schema::IndexBuildShardStatus::UploadStatus>(shardStatus.UploadStatus));
+}
+
+void TSchemeShard::PersistBuildIndexForget(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo) {
+ db.Table<Schema::IndexBuild>().Key(indexInfo->Id).Delete();
+
ui32 columnNo = 0;
for (ui32 i = 0; i < indexInfo->IndexColumns.size(); ++i, ++columnNo) {
- db.Table<Schema::IndexBuildColumns>().Key(indexInfo->Id, columnNo).Delete();
- }
-
+ db.Table<Schema::IndexBuildColumns>().Key(indexInfo->Id, columnNo).Delete();
+ }
+
for (ui32 i = 0; i < indexInfo->DataColumns.size(); ++i, ++columnNo) {
db.Table<Schema::IndexBuildColumns>().Key(indexInfo->Id, columnNo).Delete();
}
- for (const auto& item: indexInfo->Shards) {
- auto shardIdx = item.first;
- db.Table<Schema::IndexBuildShardStatus>().Key(indexInfo->Id, shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Delete();
- }
-}
-
-void TSchemeShard::Resume(const TDeque<TIndexBuildId>& indexIds, const TActorContext& ctx) {
+ for (const auto& item: indexInfo->Shards) {
+ auto shardIdx = item.first;
+ db.Table<Schema::IndexBuildShardStatus>().Key(indexInfo->Id, shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Delete();
+ }
+}
+
+void TSchemeShard::Resume(const TDeque<TIndexBuildId>& indexIds, const TActorContext& ctx) {
for (const auto& id : indexIds) {
if (IndexBuilds.contains(id)) {
Execute(CreateTxProgress(id), ctx);
}
}
-}
+}
-void TSchemeShard::SetupRouting(const TDeque<TIndexBuildId>& indexIds, const TActorContext &) {
+void TSchemeShard::SetupRouting(const TDeque<TIndexBuildId>& indexIds, const TActorContext &) {
for (const auto& id : indexIds) {
if (!IndexBuilds.contains(id)) {
continue;
@@ -226,7 +226,7 @@ void TSchemeShard::SetupRouting(const TDeque<TIndexBuildId>& indexIds, const TAc
TxIdToIndexBuilds[buildInfo->UnlockTxId] = buildInfo->Id;
}
}
-}
+}
}
}
diff --git a/ydb/core/tx/schemeshard/schemeshard_build_index.h b/ydb/core/tx/schemeshard/schemeshard_build_index.h
index e320ebb61f3..5ca64eb4591 100644
--- a/ydb/core/tx/schemeshard/schemeshard_build_index.h
+++ b/ydb/core/tx/schemeshard/schemeshard_build_index.h
@@ -1,127 +1,127 @@
-#pragma once
-
-#include "defs.h"
-
+#pragma once
+
+#include "defs.h"
+
#include <ydb/core/protos/index_builder.pb.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-struct TEvIndexBuilder {
- enum EEv {
- EvCreateRequest = EventSpaceBegin(TKikimrEvents::ES_INDEX_BUILD),
- EvCreateResponse,
- EvGetRequest,
- EvGetResponse,
- EvCancelRequest,
- EvCancelResponse,
- EvForgetRequest,
- EvForgetResponse,
- EvListRequest,
- EvListResponse,
-
- EvEnd
- };
-
- static_assert(
- EvEnd < EventSpaceEnd(TKikimrEvents::ES_INDEX_BUILD),
- "expect EvEnd < EventSpaceEnd(TKikimrEvents::ES_INDEX_BUILD)"
- );
-
- struct TEvCreateRequest: public TEventPB<TEvCreateRequest, NKikimrIndexBuilder::TEvCreateRequest, EvCreateRequest> {
- TEvCreateRequest() = default;
-
- explicit TEvCreateRequest(
- const ui64 txId,
- const TString& dbName,
- NKikimrIndexBuilder::TIndexBuildSettings settings
- ) {
- Record.SetTxId(txId);
- Record.SetDatabaseName(dbName);
- *Record.MutableSettings() = std::move(settings);
- }
- };
-
- struct TEvCreateResponse: public TEventPB<TEvCreateResponse, NKikimrIndexBuilder::TEvCreateResponse, EvCreateResponse> {
- TEvCreateResponse() = default;
-
- explicit TEvCreateResponse(const ui64 txId) {
- Record.SetTxId(txId);
- }
- };
-
- struct TEvGetRequest: public TEventPB<TEvGetRequest, NKikimrIndexBuilder::TEvGetRequest, EvGetRequest> {
-
- TEvGetRequest() = default;
-
- explicit TEvGetRequest(const TString& dbName, ui64 buildIndexId) {
- Record.SetDatabaseName(dbName);
- Record.SetIndexBuildId(buildIndexId);
- }
- };
-
- struct TEvGetResponse: public TEventPB<TEvGetResponse, NKikimrIndexBuilder::TEvGetResponse, EvGetResponse> {
- };
-
- struct TEvCancelRequest: public TEventPB<TEvCancelRequest, NKikimrIndexBuilder::TEvCancelRequest, EvCancelRequest> {
- TEvCancelRequest() = default;
-
- explicit TEvCancelRequest(
- const ui64 txId,
- const TString& dbName,
- ui64 buildIndexId
- )
- {
- Record.SetTxId(txId);
- Record.SetDatabaseName(dbName);
- Record.SetIndexBuildId(buildIndexId);
- }
- };
-
- struct TEvCancelResponse: public TEventPB<TEvCancelResponse, NKikimrIndexBuilder::TEvCancelResponse, EvCancelResponse> {
- TEvCancelResponse() = default;
-
- explicit TEvCancelResponse(const ui64 txId) {
- Record.SetTxId(txId);
- }
- };
-
- struct TEvForgetRequest: public TEventPB<TEvForgetRequest, NKikimrIndexBuilder::TEvForgetRequest, EvForgetRequest> {
- TEvForgetRequest() = default;
-
- explicit TEvForgetRequest(
- const ui64 txId,
- const TString& dbName,
- ui64 buildIndexId
- ) {
- Record.SetTxId(txId);
- Record.SetDatabaseName(dbName);
- Record.SetIndexBuildId(buildIndexId);
- }
- };
-
- struct TEvForgetResponse: public TEventPB<TEvForgetResponse, NKikimrIndexBuilder::TEvForgetResponse, EvForgetResponse> {
- TEvForgetResponse() = default;
-
- explicit TEvForgetResponse(const ui64 txId) {
- Record.SetTxId(txId);
- }
- };
-
- struct TEvListRequest: public TEventPB<TEvListRequest, NKikimrIndexBuilder::TEvListRequest, EvListRequest> {
- TEvListRequest() = default;
-
- explicit TEvListRequest(const TString& dbName, ui64 pageSize, TString pageToken) {
- Record.SetDatabaseName(dbName);
- Record.SetPageSize(pageSize);
- Record.SetPageToken(pageToken);
- }
- };
-
- struct TEvListResponse: public TEventPB<TEvListResponse, NKikimrIndexBuilder::TEvListResponse, EvListResponse> {
- };
-
-}; // TEvIndexBuilder
-
-} // NSchemeShard
-} // NKikimr
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+struct TEvIndexBuilder {
+ enum EEv {
+ EvCreateRequest = EventSpaceBegin(TKikimrEvents::ES_INDEX_BUILD),
+ EvCreateResponse,
+ EvGetRequest,
+ EvGetResponse,
+ EvCancelRequest,
+ EvCancelResponse,
+ EvForgetRequest,
+ EvForgetResponse,
+ EvListRequest,
+ EvListResponse,
+
+ EvEnd
+ };
+
+ static_assert(
+ EvEnd < EventSpaceEnd(TKikimrEvents::ES_INDEX_BUILD),
+ "expect EvEnd < EventSpaceEnd(TKikimrEvents::ES_INDEX_BUILD)"
+ );
+
+ struct TEvCreateRequest: public TEventPB<TEvCreateRequest, NKikimrIndexBuilder::TEvCreateRequest, EvCreateRequest> {
+ TEvCreateRequest() = default;
+
+ explicit TEvCreateRequest(
+ const ui64 txId,
+ const TString& dbName,
+ NKikimrIndexBuilder::TIndexBuildSettings settings
+ ) {
+ Record.SetTxId(txId);
+ Record.SetDatabaseName(dbName);
+ *Record.MutableSettings() = std::move(settings);
+ }
+ };
+
+ struct TEvCreateResponse: public TEventPB<TEvCreateResponse, NKikimrIndexBuilder::TEvCreateResponse, EvCreateResponse> {
+ TEvCreateResponse() = default;
+
+ explicit TEvCreateResponse(const ui64 txId) {
+ Record.SetTxId(txId);
+ }
+ };
+
+ struct TEvGetRequest: public TEventPB<TEvGetRequest, NKikimrIndexBuilder::TEvGetRequest, EvGetRequest> {
+
+ TEvGetRequest() = default;
+
+ explicit TEvGetRequest(const TString& dbName, ui64 buildIndexId) {
+ Record.SetDatabaseName(dbName);
+ Record.SetIndexBuildId(buildIndexId);
+ }
+ };
+
+ struct TEvGetResponse: public TEventPB<TEvGetResponse, NKikimrIndexBuilder::TEvGetResponse, EvGetResponse> {
+ };
+
+ struct TEvCancelRequest: public TEventPB<TEvCancelRequest, NKikimrIndexBuilder::TEvCancelRequest, EvCancelRequest> {
+ TEvCancelRequest() = default;
+
+ explicit TEvCancelRequest(
+ const ui64 txId,
+ const TString& dbName,
+ ui64 buildIndexId
+ )
+ {
+ Record.SetTxId(txId);
+ Record.SetDatabaseName(dbName);
+ Record.SetIndexBuildId(buildIndexId);
+ }
+ };
+
+ struct TEvCancelResponse: public TEventPB<TEvCancelResponse, NKikimrIndexBuilder::TEvCancelResponse, EvCancelResponse> {
+ TEvCancelResponse() = default;
+
+ explicit TEvCancelResponse(const ui64 txId) {
+ Record.SetTxId(txId);
+ }
+ };
+
+ struct TEvForgetRequest: public TEventPB<TEvForgetRequest, NKikimrIndexBuilder::TEvForgetRequest, EvForgetRequest> {
+ TEvForgetRequest() = default;
+
+ explicit TEvForgetRequest(
+ const ui64 txId,
+ const TString& dbName,
+ ui64 buildIndexId
+ ) {
+ Record.SetTxId(txId);
+ Record.SetDatabaseName(dbName);
+ Record.SetIndexBuildId(buildIndexId);
+ }
+ };
+
+ struct TEvForgetResponse: public TEventPB<TEvForgetResponse, NKikimrIndexBuilder::TEvForgetResponse, EvForgetResponse> {
+ TEvForgetResponse() = default;
+
+ explicit TEvForgetResponse(const ui64 txId) {
+ Record.SetTxId(txId);
+ }
+ };
+
+ struct TEvListRequest: public TEventPB<TEvListRequest, NKikimrIndexBuilder::TEvListRequest, EvListRequest> {
+ TEvListRequest() = default;
+
+ explicit TEvListRequest(const TString& dbName, ui64 pageSize, TString pageToken) {
+ Record.SetDatabaseName(dbName);
+ Record.SetPageSize(pageSize);
+ Record.SetPageToken(pageToken);
+ }
+ };
+
+ struct TEvListResponse: public TEventPB<TEvListResponse, NKikimrIndexBuilder::TEvListResponse, EvListResponse> {
+ };
+
+}; // TEvIndexBuilder
+
+} // NSchemeShard
+} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_build_index__cancel.cpp b/ydb/core/tx/schemeshard/schemeshard_build_index__cancel.cpp
index 67fa733de67..f68e76634a0 100644
--- a/ydb/core/tx/schemeshard/schemeshard_build_index__cancel.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_build_index__cancel.cpp
@@ -1,137 +1,137 @@
-#include "schemeshard_build_index.h"
-#include "schemeshard_impl.h"
-#include "schemeshard_build_index_helpers.h"
-#include "schemeshard_build_index_tx_base.h"
-
+#include "schemeshard_build_index.h"
+#include "schemeshard_impl.h"
+#include "schemeshard_build_index_helpers.h"
+#include "schemeshard_build_index_tx_base.h"
+
#include <ydb/public/api/protos/ydb_issue_message.pb.h>
#include <ydb/public/api/protos/ydb_status_codes.pb.h>
-
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-using namespace NTabletFlatExecutor;
-
-struct TSchemeShard::TIndexBuilder::TTxCancel: public TSchemeShard::TIndexBuilder::TTxBase {
-private:
- TEvIndexBuilder::TEvCancelRequest::TPtr Request;
-
-public:
- explicit TTxCancel(TSelf* self, TEvIndexBuilder::TEvCancelRequest::TPtr& ev)
- : TTxBase(self)
- , Request(ev)
- {
- }
-
- TTxType GetTxType() const override {
- return TXTYPE_CANCEL_INDEX_BUILD;
- }
-
- bool DoExecute(TTransactionContext& txc, const TActorContext&) override {
- const auto& record = Request->Get()->Record;
-
- LOG_N("TIndexBuilder::TTxCancel: DoExecute"
- << ", Database: " << record.GetDatabaseName()
- << ", BuildIndexId: " << record.GetIndexBuildId());
- LOG_D("Message: " << record.ShortDebugString());
-
-
- auto response = MakeHolder<TEvIndexBuilder::TEvCancelResponse>(record.GetTxId());
- TPath database = TPath::Resolve(record.GetDatabaseName(), Self);
- if (!database.IsResolved()) {
- return Reply(
- std::move(response),
- Ydb::StatusIds::NOT_FOUND,
- TStringBuilder() << "Database <" << record.GetDatabaseName() << "> not found"
- );
- }
- const TPathId domainId = database.DomainId();
-
- TIndexBuildId indexBuildId = TIndexBuildId(record.GetIndexBuildId());
-
- if (!Self->IndexBuilds.contains(indexBuildId)) {
- return Reply(
- std::move(response),
- Ydb::StatusIds::NOT_FOUND,
- TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> not found"
- );
- }
-
- TIndexBuildInfo::TPtr indexBuildInfo = Self->IndexBuilds.at(indexBuildId);
- if (indexBuildInfo->DomainPathId != domainId) {
- return Reply(
- std::move(response),
- Ydb::StatusIds::NOT_FOUND,
- TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> not found in database <" << record.GetDatabaseName() << ">"
- );
- }
-
- if (indexBuildInfo->IsFinished()) {
- return Reply(
- std::move(response),
+
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+using namespace NTabletFlatExecutor;
+
+struct TSchemeShard::TIndexBuilder::TTxCancel: public TSchemeShard::TIndexBuilder::TTxBase {
+private:
+ TEvIndexBuilder::TEvCancelRequest::TPtr Request;
+
+public:
+ explicit TTxCancel(TSelf* self, TEvIndexBuilder::TEvCancelRequest::TPtr& ev)
+ : TTxBase(self)
+ , Request(ev)
+ {
+ }
+
+ TTxType GetTxType() const override {
+ return TXTYPE_CANCEL_INDEX_BUILD;
+ }
+
+ bool DoExecute(TTransactionContext& txc, const TActorContext&) override {
+ const auto& record = Request->Get()->Record;
+
+ LOG_N("TIndexBuilder::TTxCancel: DoExecute"
+ << ", Database: " << record.GetDatabaseName()
+ << ", BuildIndexId: " << record.GetIndexBuildId());
+ LOG_D("Message: " << record.ShortDebugString());
+
+
+ auto response = MakeHolder<TEvIndexBuilder::TEvCancelResponse>(record.GetTxId());
+ TPath database = TPath::Resolve(record.GetDatabaseName(), Self);
+ if (!database.IsResolved()) {
+ return Reply(
+ std::move(response),
+ Ydb::StatusIds::NOT_FOUND,
+ TStringBuilder() << "Database <" << record.GetDatabaseName() << "> not found"
+ );
+ }
+ const TPathId domainId = database.DomainId();
+
+ TIndexBuildId indexBuildId = TIndexBuildId(record.GetIndexBuildId());
+
+ if (!Self->IndexBuilds.contains(indexBuildId)) {
+ return Reply(
+ std::move(response),
+ Ydb::StatusIds::NOT_FOUND,
+ TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> not found"
+ );
+ }
+
+ TIndexBuildInfo::TPtr indexBuildInfo = Self->IndexBuilds.at(indexBuildId);
+ if (indexBuildInfo->DomainPathId != domainId) {
+ return Reply(
+ std::move(response),
+ Ydb::StatusIds::NOT_FOUND,
+ TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> not found in database <" << record.GetDatabaseName() << ">"
+ );
+ }
+
+ if (indexBuildInfo->IsFinished()) {
+ return Reply(
+ std::move(response),
Ydb::StatusIds::PRECONDITION_FAILED,
- TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> has been finished already"
- );
- }
-
- if (indexBuildInfo->IsCancellationRequested()) {
- return Reply(
- std::move(response),
+ TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> has been finished already"
+ );
+ }
+
+ if (indexBuildInfo->IsCancellationRequested()) {
+ return Reply(
+ std::move(response),
Ydb::StatusIds::PRECONDITION_FAILED,
- TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> canceling already"
- );
- }
-
- if (indexBuildInfo->State > TIndexBuildInfo::EState::Filling) {
- return Reply(
- std::move(response),
+ TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> canceling already"
+ );
+ }
+
+ if (indexBuildInfo->State > TIndexBuildInfo::EState::Filling) {
+ return Reply(
+ std::move(response),
Ydb::StatusIds::PRECONDITION_FAILED,
- TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> are almost done, cancellation has no sense"
- );
- }
-
- NIceDb::TNiceDb db(txc.DB);
- indexBuildInfo->CancelRequested = true;
- Self->PersistBuildIndexCancelRequest(db, indexBuildInfo);
-
- Progress(indexBuildInfo->Id);
-
- return Reply(std::move(response));
- }
-
- bool Reply(THolder<TEvIndexBuilder::TEvCancelResponse> response,
- const Ydb::StatusIds::StatusCode status = Ydb::StatusIds::SUCCESS,
- const TString& errorMessage = TString())
- {
-
- LOG_N("TIndexBuilder::TTxCancel: Reply"
- << ", BuildIndexId: " << response->Record.GetTxId()
- << ", status: " << status
- << ", error: " << errorMessage);
- LOG_D("Message: " << response->Record.ShortDebugString());
-
- auto& record = response->Record;
- record.SetStatus(status);
- if (errorMessage) {
- AddIssue(record.MutableIssues(), errorMessage);
- }
-
- Send(Request->Sender, std::move(response), 0, Request->Cookie);
-
- return true;
- }
-
- void DoComplete(const TActorContext&) override {
- }
-
-private:
-
-
-};
-
-ITransaction* TSchemeShard::CreateTxCancel(TEvIndexBuilder::TEvCancelRequest::TPtr& ev) {
- return new TIndexBuilder::TTxCancel(this, ev);
-}
-
-} // NSchemeShard
-} // NKikimr
+ TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> are almost done, cancellation has no sense"
+ );
+ }
+
+ NIceDb::TNiceDb db(txc.DB);
+ indexBuildInfo->CancelRequested = true;
+ Self->PersistBuildIndexCancelRequest(db, indexBuildInfo);
+
+ Progress(indexBuildInfo->Id);
+
+ return Reply(std::move(response));
+ }
+
+ bool Reply(THolder<TEvIndexBuilder::TEvCancelResponse> response,
+ const Ydb::StatusIds::StatusCode status = Ydb::StatusIds::SUCCESS,
+ const TString& errorMessage = TString())
+ {
+
+ LOG_N("TIndexBuilder::TTxCancel: Reply"
+ << ", BuildIndexId: " << response->Record.GetTxId()
+ << ", status: " << status
+ << ", error: " << errorMessage);
+ LOG_D("Message: " << response->Record.ShortDebugString());
+
+ auto& record = response->Record;
+ record.SetStatus(status);
+ if (errorMessage) {
+ AddIssue(record.MutableIssues(), errorMessage);
+ }
+
+ Send(Request->Sender, std::move(response), 0, Request->Cookie);
+
+ return true;
+ }
+
+ void DoComplete(const TActorContext&) override {
+ }
+
+private:
+
+
+};
+
+ITransaction* TSchemeShard::CreateTxCancel(TEvIndexBuilder::TEvCancelRequest::TPtr& ev) {
+ return new TIndexBuilder::TTxCancel(this, ev);
+}
+
+} // NSchemeShard
+} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_build_index__create.cpp b/ydb/core/tx/schemeshard/schemeshard_build_index__create.cpp
index 0a436b49516..8a94bce2981 100644
--- a/ydb/core/tx/schemeshard/schemeshard_build_index__create.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_build_index__create.cpp
@@ -1,44 +1,44 @@
-#include "schemeshard_build_index.h"
-#include "schemeshard_impl.h"
-#include "schemeshard_build_index_helpers.h"
-#include "schemeshard_build_index_tx_base.h"
-
+#include "schemeshard_build_index.h"
+#include "schemeshard_impl.h"
+#include "schemeshard_build_index_helpers.h"
+#include "schemeshard_build_index_tx_base.h"
+
#include <ydb/public/api/protos/ydb_issue_message.pb.h>
#include <ydb/public/api/protos/ydb_status_codes.pb.h>
-
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-using namespace NTabletFlatExecutor;
-
-class TSchemeShard::TIndexBuilder::TTxCreate: public TSchemeShard::TIndexBuilder::TTxBase {
-private:
- TEvIndexBuilder::TEvCreateRequest::TPtr Request;
-
-public:
- explicit TTxCreate(TSelf* self, TEvIndexBuilder::TEvCreateRequest::TPtr& ev)
- : TSchemeShard::TIndexBuilder::TTxBase(self)
- , Request(ev)
- {
- }
-
- TTxType GetTxType() const override {
- return TXTYPE_CREATE_INDEX_BUILD;
- }
-
+
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+using namespace NTabletFlatExecutor;
+
+class TSchemeShard::TIndexBuilder::TTxCreate: public TSchemeShard::TIndexBuilder::TTxBase {
+private:
+ TEvIndexBuilder::TEvCreateRequest::TPtr Request;
+
+public:
+ explicit TTxCreate(TSelf* self, TEvIndexBuilder::TEvCreateRequest::TPtr& ev)
+ : TSchemeShard::TIndexBuilder::TTxBase(self)
+ , Request(ev)
+ {
+ }
+
+ TTxType GetTxType() const override {
+ return TXTYPE_CREATE_INDEX_BUILD;
+ }
+
bool DoExecute(TTransactionContext& txc, const TActorContext& ctx) override {
- const NKikimrIndexBuilder::TEvCreateRequest& request = Request->Get()->Record;
-
- LOG_N("TIndexBuilder::TTxCreate: DoExecute"
- << ", Database: " << request.GetDatabaseName()
- << ", BuildIndexId: " << request.GetTxId()
- << ", Table: " << request.GetSettings().source_path()
- << ", IndexName: " << request.GetSettings().index().name());
- LOG_D("Message: " << request.ShortDebugString());
-
- auto response = MakeHolder<TEvIndexBuilder::TEvCreateResponse>(request.GetTxId());
-
+ const NKikimrIndexBuilder::TEvCreateRequest& request = Request->Get()->Record;
+
+ LOG_N("TIndexBuilder::TTxCreate: DoExecute"
+ << ", Database: " << request.GetDatabaseName()
+ << ", BuildIndexId: " << request.GetTxId()
+ << ", Table: " << request.GetSettings().source_path()
+ << ", IndexName: " << request.GetSettings().index().name());
+ LOG_D("Message: " << request.ShortDebugString());
+
+ auto response = MakeHolder<TEvIndexBuilder::TEvCreateResponse>(request.GetTxId());
+
switch (request.GetSettings().index().type_case()) {
case Ydb::Table::TableIndex::kGlobalIndex:
break;
@@ -65,47 +65,47 @@ public:
);
}
- const auto id = TIndexBuildId(request.GetTxId());
- if (Self->IndexBuilds.contains(id)) {
- return Reply(
- std::move(response),
- Ydb::StatusIds::ALREADY_EXISTS,
- TStringBuilder() << "Index build with id '" << id << "' already exists"
- );
- }
-
- const TString& uid = GetUid(request.GetOperationParams().labels());
- if (uid && Self->IndexBuildsByUid.contains(uid)) {
- return Reply(
- std::move(response),
- Ydb::StatusIds::ALREADY_EXISTS,
- TStringBuilder() << "Index build with uid '" << uid << "' already exists"
- );
- }
-
- const TPath domainPath = TPath::Resolve(request.GetDatabaseName(), Self);
- {
- TPath::TChecker checks = domainPath.Check();
- checks
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsSubDomain()
- .NotUnderDomainUpgrade();
-
- if (!checks) {
- TString explain;
- auto status = checks.GetStatus(&explain);
-
- return Reply(
- std::move(response),
- TranslateStatusCode(status),
- TStringBuilder() << "Failed database check: " << explain
- );
- }
- }
-
+ const auto id = TIndexBuildId(request.GetTxId());
+ if (Self->IndexBuilds.contains(id)) {
+ return Reply(
+ std::move(response),
+ Ydb::StatusIds::ALREADY_EXISTS,
+ TStringBuilder() << "Index build with id '" << id << "' already exists"
+ );
+ }
+
+ const TString& uid = GetUid(request.GetOperationParams().labels());
+ if (uid && Self->IndexBuildsByUid.contains(uid)) {
+ return Reply(
+ std::move(response),
+ Ydb::StatusIds::ALREADY_EXISTS,
+ TStringBuilder() << "Index build with uid '" << uid << "' already exists"
+ );
+ }
+
+ const TPath domainPath = TPath::Resolve(request.GetDatabaseName(), Self);
+ {
+ TPath::TChecker checks = domainPath.Check();
+ checks
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsSubDomain()
+ .NotUnderDomainUpgrade();
+
+ if (!checks) {
+ TString explain;
+ auto status = checks.GetStatus(&explain);
+
+ return Reply(
+ std::move(response),
+ TranslateStatusCode(status),
+ TStringBuilder() << "Failed database check: " << explain
+ );
+ }
+ }
+
NIceDb::TNiceDb db(txc.DB);
auto subDomainId = domainPath.DomainId();
@@ -122,130 +122,130 @@ public:
"Request exceeded a limit on the number of schema operations, try again later.");
}
- const auto& settings = request.GetSettings();
-
- const TPath path = TPath::Resolve(settings.source_path(), Self);
- {
- TPath::TChecker checks = path.Check();
- checks
- .IsAtLocalSchemeShard()
- .IsResolved()
- .NotDeleted()
- .NotUnderDeleting()
- .IsTable()
- .IsCommonSensePath()
- .IsTheSameDomain(domainPath);
-
- if (!checks) {
- TString explain;
- auto status = checks.GetStatus(&explain);
-
- return Reply(
- std::move(response),
- TranslateStatusCode(status),
- TStringBuilder() << "Failed table check: " << explain
- );
- }
- }
-
- TIndexBuildInfo::TPtr buildInfo = new TIndexBuildInfo(id, uid);
-
- TString explain;
- if (!Prepare(buildInfo, domainPath, path, settings, explain)) {
- return Reply(
- std::move(response),
- Ydb::StatusIds::BAD_REQUEST,
- TStringBuilder() << "Failed item check: " << explain
- );
- }
-
- Y_VERIFY(buildInfo != nullptr);
-
- buildInfo->CreateSender = Request->Sender;
- buildInfo->SenderCookie = Request->Cookie;
-
- Self->PersistCreateBuildIndex(db, buildInfo);
-
- buildInfo->State = TIndexBuildInfo::EState::Locking;
- Self->PersistBuildIndexState(db, buildInfo);
-
- Self->IndexBuilds[id] = buildInfo;
- if (uid) {
- Self->IndexBuildsByUid[uid] = buildInfo;
- }
-
- Progress(id);
-
- return true;
- }
-
- void DoComplete(const TActorContext&) override {
- LOG_D("TIndexBuilder::TTxCreate: DoComplete");
- }
-
-private:
- bool Prepare(TIndexBuildInfo::TPtr buildInfo, const TPath& database, const TPath& path, const NKikimrIndexBuilder::TIndexBuildSettings& settings, TString& explain) {
- buildInfo->DomainPathId = database.Base()->PathId;
- buildInfo->TablePathId = path.Base()->PathId;
-
- switch (settings.index().type_case()) {
- case Ydb::Table::TableIndex::TypeCase::kGlobalIndex:
- buildInfo->IndexType = NKikimrSchemeOp::EIndexType::EIndexTypeGlobal;
- break;
+ const auto& settings = request.GetSettings();
+
+ const TPath path = TPath::Resolve(settings.source_path(), Self);
+ {
+ TPath::TChecker checks = path.Check();
+ checks
+ .IsAtLocalSchemeShard()
+ .IsResolved()
+ .NotDeleted()
+ .NotUnderDeleting()
+ .IsTable()
+ .IsCommonSensePath()
+ .IsTheSameDomain(domainPath);
+
+ if (!checks) {
+ TString explain;
+ auto status = checks.GetStatus(&explain);
+
+ return Reply(
+ std::move(response),
+ TranslateStatusCode(status),
+ TStringBuilder() << "Failed table check: " << explain
+ );
+ }
+ }
+
+ TIndexBuildInfo::TPtr buildInfo = new TIndexBuildInfo(id, uid);
+
+ TString explain;
+ if (!Prepare(buildInfo, domainPath, path, settings, explain)) {
+ return Reply(
+ std::move(response),
+ Ydb::StatusIds::BAD_REQUEST,
+ TStringBuilder() << "Failed item check: " << explain
+ );
+ }
+
+ Y_VERIFY(buildInfo != nullptr);
+
+ buildInfo->CreateSender = Request->Sender;
+ buildInfo->SenderCookie = Request->Cookie;
+
+ Self->PersistCreateBuildIndex(db, buildInfo);
+
+ buildInfo->State = TIndexBuildInfo::EState::Locking;
+ Self->PersistBuildIndexState(db, buildInfo);
+
+ Self->IndexBuilds[id] = buildInfo;
+ if (uid) {
+ Self->IndexBuildsByUid[uid] = buildInfo;
+ }
+
+ Progress(id);
+
+ return true;
+ }
+
+ void DoComplete(const TActorContext&) override {
+ LOG_D("TIndexBuilder::TTxCreate: DoComplete");
+ }
+
+private:
+ bool Prepare(TIndexBuildInfo::TPtr buildInfo, const TPath& database, const TPath& path, const NKikimrIndexBuilder::TIndexBuildSettings& settings, TString& explain) {
+ buildInfo->DomainPathId = database.Base()->PathId;
+ buildInfo->TablePathId = path.Base()->PathId;
+
+ switch (settings.index().type_case()) {
+ case Ydb::Table::TableIndex::TypeCase::kGlobalIndex:
+ buildInfo->IndexType = NKikimrSchemeOp::EIndexType::EIndexTypeGlobal;
+ break;
case Ydb::Table::TableIndex::TypeCase::kGlobalAsyncIndex:
- buildInfo->IndexType = NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync;
+ buildInfo->IndexType = NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync;
break;
- case Ydb::Table::TableIndex::TypeCase::TYPE_NOT_SET:
- explain = "invalid or unset index type";
- return false;
- };
-
- buildInfo->IndexName = settings.index().name();
- buildInfo->IndexColumns.assign(settings.index().index_columns().begin(), settings.index().index_columns().end());
+ case Ydb::Table::TableIndex::TypeCase::TYPE_NOT_SET:
+ explain = "invalid or unset index type";
+ return false;
+ };
+
+ buildInfo->IndexName = settings.index().name();
+ buildInfo->IndexColumns.assign(settings.index().index_columns().begin(), settings.index().index_columns().end());
buildInfo->DataColumns.assign(settings.index().data_columns().begin(), settings.index().data_columns().end());
-
- buildInfo->Limits.MaxBatchRows = settings.max_batch_rows();
- buildInfo->Limits.MaxBatchBytes = settings.max_batch_bytes();
- buildInfo->Limits.MaxShards = settings.max_shards_in_flight();
- buildInfo->Limits.MaxRetries = settings.max_retries_upload_batch();
-
- return true;
- }
-
- static TString GetUid(const google::protobuf::Map<TString, TString>& labels) {
- auto it = labels.find("uid");
- if (it == labels.end()) {
- return TString();
- }
-
- return it->second;
- }
-
- bool Reply(THolder<TEvIndexBuilder::TEvCreateResponse> responseEv,
- const Ydb::StatusIds::StatusCode status = Ydb::StatusIds::SUCCESS,
- const TString& errorMessage = TString())
- {
- LOG_N("TIndexBuilder::TTxCreate: Reply"
- << ", BuildIndexId: " << responseEv->Record.GetTxId()
- << ", status: " << status
- << ", error: " << errorMessage);
- LOG_D("Message: " << responseEv->Record.ShortDebugString());
-
- auto& record = responseEv->Record;
- record.SetStatus(status);
- if (errorMessage) {
- AddIssue(record.MutableIssues(), errorMessage);
- }
-
+
+ buildInfo->Limits.MaxBatchRows = settings.max_batch_rows();
+ buildInfo->Limits.MaxBatchBytes = settings.max_batch_bytes();
+ buildInfo->Limits.MaxShards = settings.max_shards_in_flight();
+ buildInfo->Limits.MaxRetries = settings.max_retries_upload_batch();
+
+ return true;
+ }
+
+ static TString GetUid(const google::protobuf::Map<TString, TString>& labels) {
+ auto it = labels.find("uid");
+ if (it == labels.end()) {
+ return TString();
+ }
+
+ return it->second;
+ }
+
+ bool Reply(THolder<TEvIndexBuilder::TEvCreateResponse> responseEv,
+ const Ydb::StatusIds::StatusCode status = Ydb::StatusIds::SUCCESS,
+ const TString& errorMessage = TString())
+ {
+ LOG_N("TIndexBuilder::TTxCreate: Reply"
+ << ", BuildIndexId: " << responseEv->Record.GetTxId()
+ << ", status: " << status
+ << ", error: " << errorMessage);
+ LOG_D("Message: " << responseEv->Record.ShortDebugString());
+
+ auto& record = responseEv->Record;
+ record.SetStatus(status);
+ if (errorMessage) {
+ AddIssue(record.MutableIssues(), errorMessage);
+ }
+
Send(Request->Sender, std::move(responseEv), 0, Request->Cookie);
-
- return true;
- }
-};
-
-ITransaction* TSchemeShard::CreateTxCreate(TEvIndexBuilder::TEvCreateRequest::TPtr& ev) {
- return new TIndexBuilder::TTxCreate(this, ev);
-}
-
-} // NSchemeShard
-} // NKikimr
+
+ return true;
+ }
+};
+
+ITransaction* TSchemeShard::CreateTxCreate(TEvIndexBuilder::TEvCreateRequest::TPtr& ev) {
+ return new TIndexBuilder::TTxCreate(this, ev);
+}
+
+} // NSchemeShard
+} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_build_index__forget.cpp b/ydb/core/tx/schemeshard/schemeshard_build_index__forget.cpp
index 5fb6e8acb1c..10ac85c8a01 100644
--- a/ydb/core/tx/schemeshard/schemeshard_build_index__forget.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_build_index__forget.cpp
@@ -1,118 +1,118 @@
-#include "schemeshard_build_index.h"
-#include "schemeshard_impl.h"
-#include "schemeshard_build_index_helpers.h"
-#include "schemeshard_build_index_tx_base.h"
-
+#include "schemeshard_build_index.h"
+#include "schemeshard_impl.h"
+#include "schemeshard_build_index_helpers.h"
+#include "schemeshard_build_index_tx_base.h"
+
#include <ydb/public/api/protos/ydb_issue_message.pb.h>
#include <ydb/public/api/protos/ydb_status_codes.pb.h>
-
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-using namespace NTabletFlatExecutor;
-
-struct TSchemeShard::TIndexBuilder::TTxForget: public TSchemeShard::TIndexBuilder::TTxBase {
-private:
- TEvIndexBuilder::TEvForgetRequest::TPtr Request;
-
-public:
- explicit TTxForget(TSelf* self, TEvIndexBuilder::TEvForgetRequest::TPtr& ev)
- : TTxBase(self)
- , Request(ev)
- {
- }
-
- TTxType GetTxType() const override {
- return TXTYPE_FORGET_INDEX_BUILD;
- }
-
- bool DoExecute(TTransactionContext& txc, const TActorContext&) override {
- const auto& record = Request->Get()->Record;
-
- LOG_N("TIndexBuilder::TTxForget: DoExecute"
- << ", Database: " << record.GetDatabaseName()
- << ", BuildIndexId: " << record.GetIndexBuildId());
- LOG_D("Message: " << record.ShortDebugString());
-
- auto response = MakeHolder<TEvIndexBuilder::TEvForgetResponse>(record.GetTxId());
- TPath database = TPath::Resolve(record.GetDatabaseName(), Self);
- if (!database.IsResolved()) {
- return Reply(
- std::move(response),
- Ydb::StatusIds::NOT_FOUND,
- TStringBuilder() << "Database <" << record.GetDatabaseName() << "> not found"
- );
- }
- const TPathId domainId = database.DomainId();
-
- TIndexBuildId indexBuildId = TIndexBuildId(record.GetIndexBuildId());
-
- if (!Self->IndexBuilds.contains(indexBuildId)) {
- return Reply(
- std::move(response),
- Ydb::StatusIds::NOT_FOUND,
- TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> not found"
- );
- }
-
- TIndexBuildInfo::TPtr indexBuildInfo = Self->IndexBuilds.at(indexBuildId);
- if (indexBuildInfo->DomainPathId != domainId) {
- return Reply(
- std::move(response),
- Ydb::StatusIds::NOT_FOUND,
- TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> not found in database <" << record.GetDatabaseName() << ">"
- );
- }
-
- if (!indexBuildInfo->IsFinished()) {
- return Reply(
- std::move(response),
- Ydb::StatusIds::PRECONDITION_FAILED,
- TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> hasn't been finished yet"
- );
- }
-
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexForget(db, indexBuildInfo);
-
- EraseBuildInfo(indexBuildInfo);
-
- return Reply(std::move(response));
- }
-
- bool Reply(THolder<TEvIndexBuilder::TEvForgetResponse> response,
- const Ydb::StatusIds::StatusCode status = Ydb::StatusIds::SUCCESS,
- const TString& errorMessage = TString())
- {
- LOG_N("TIndexBuilder::TTxForget: Reply"
- << ", BuildIndexId: " << response->Record.GetTxId()
- << ", status: " << status
- << ", error: " << errorMessage);
- LOG_D("Message: " << response->Record.ShortDebugString());
-
- auto& respRecord = response->Record;
- respRecord.SetStatus(status);
- if (errorMessage) {
- AddIssue(respRecord.MutableIssues(), errorMessage);
- }
-
- Send(Request->Sender, std::move(response), 0, Request->Cookie);
-
- return true;
- }
-
- void DoComplete(const TActorContext&) override {
- }
-
-private:
-
-
-};
-
-ITransaction* TSchemeShard::CreateTxForget(TEvIndexBuilder::TEvForgetRequest::TPtr& ev) {
- return new TIndexBuilder::TTxForget(this, ev);
-}
-
-} // NSchemeShard
-} // NKikimr
+
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+using namespace NTabletFlatExecutor;
+
+struct TSchemeShard::TIndexBuilder::TTxForget: public TSchemeShard::TIndexBuilder::TTxBase {
+private:
+ TEvIndexBuilder::TEvForgetRequest::TPtr Request;
+
+public:
+ explicit TTxForget(TSelf* self, TEvIndexBuilder::TEvForgetRequest::TPtr& ev)
+ : TTxBase(self)
+ , Request(ev)
+ {
+ }
+
+ TTxType GetTxType() const override {
+ return TXTYPE_FORGET_INDEX_BUILD;
+ }
+
+ bool DoExecute(TTransactionContext& txc, const TActorContext&) override {
+ const auto& record = Request->Get()->Record;
+
+ LOG_N("TIndexBuilder::TTxForget: DoExecute"
+ << ", Database: " << record.GetDatabaseName()
+ << ", BuildIndexId: " << record.GetIndexBuildId());
+ LOG_D("Message: " << record.ShortDebugString());
+
+ auto response = MakeHolder<TEvIndexBuilder::TEvForgetResponse>(record.GetTxId());
+ TPath database = TPath::Resolve(record.GetDatabaseName(), Self);
+ if (!database.IsResolved()) {
+ return Reply(
+ std::move(response),
+ Ydb::StatusIds::NOT_FOUND,
+ TStringBuilder() << "Database <" << record.GetDatabaseName() << "> not found"
+ );
+ }
+ const TPathId domainId = database.DomainId();
+
+ TIndexBuildId indexBuildId = TIndexBuildId(record.GetIndexBuildId());
+
+ if (!Self->IndexBuilds.contains(indexBuildId)) {
+ return Reply(
+ std::move(response),
+ Ydb::StatusIds::NOT_FOUND,
+ TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> not found"
+ );
+ }
+
+ TIndexBuildInfo::TPtr indexBuildInfo = Self->IndexBuilds.at(indexBuildId);
+ if (indexBuildInfo->DomainPathId != domainId) {
+ return Reply(
+ std::move(response),
+ Ydb::StatusIds::NOT_FOUND,
+ TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> not found in database <" << record.GetDatabaseName() << ">"
+ );
+ }
+
+ if (!indexBuildInfo->IsFinished()) {
+ return Reply(
+ std::move(response),
+ Ydb::StatusIds::PRECONDITION_FAILED,
+ TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> hasn't been finished yet"
+ );
+ }
+
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexForget(db, indexBuildInfo);
+
+ EraseBuildInfo(indexBuildInfo);
+
+ return Reply(std::move(response));
+ }
+
+ bool Reply(THolder<TEvIndexBuilder::TEvForgetResponse> response,
+ const Ydb::StatusIds::StatusCode status = Ydb::StatusIds::SUCCESS,
+ const TString& errorMessage = TString())
+ {
+ LOG_N("TIndexBuilder::TTxForget: Reply"
+ << ", BuildIndexId: " << response->Record.GetTxId()
+ << ", status: " << status
+ << ", error: " << errorMessage);
+ LOG_D("Message: " << response->Record.ShortDebugString());
+
+ auto& respRecord = response->Record;
+ respRecord.SetStatus(status);
+ if (errorMessage) {
+ AddIssue(respRecord.MutableIssues(), errorMessage);
+ }
+
+ Send(Request->Sender, std::move(response), 0, Request->Cookie);
+
+ return true;
+ }
+
+ void DoComplete(const TActorContext&) override {
+ }
+
+private:
+
+
+};
+
+ITransaction* TSchemeShard::CreateTxForget(TEvIndexBuilder::TEvForgetRequest::TPtr& ev) {
+ return new TIndexBuilder::TTxForget(this, ev);
+}
+
+} // NSchemeShard
+} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_build_index__get.cpp b/ydb/core/tx/schemeshard/schemeshard_build_index__get.cpp
index cb653dd217f..ad6f5d01a48 100644
--- a/ydb/core/tx/schemeshard/schemeshard_build_index__get.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_build_index__get.cpp
@@ -1,109 +1,109 @@
-#include "schemeshard_build_index.h"
-#include "schemeshard_impl.h"
-#include "schemeshard_build_index_helpers.h"
-#include "schemeshard_build_index_tx_base.h"
-
+#include "schemeshard_build_index.h"
+#include "schemeshard_impl.h"
+#include "schemeshard_build_index_helpers.h"
+#include "schemeshard_build_index_tx_base.h"
+
#include <ydb/public/api/protos/ydb_issue_message.pb.h>
#include <ydb/public/api/protos/ydb_status_codes.pb.h>
-
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-using namespace NTabletFlatExecutor;
-
-struct TSchemeShard::TIndexBuilder::TTxGet: public TSchemeShard::TIndexBuilder::TTxBase {
-private:
- TEvIndexBuilder::TEvGetRequest::TPtr Request;
-
-public:
- explicit TTxGet(TSelf* self, TEvIndexBuilder::TEvGetRequest::TPtr& ev)
- : TSchemeShard::TIndexBuilder::TTxBase(self)
- , Request(ev)
- {
- }
-
- TTxType GetTxType() const override {
- return TXTYPE_GET_INDEX_BUILD;
- }
-
- bool DoExecute(TTransactionContext&, const TActorContext&) override {
- const auto& record = Request->Get()->Record;
-
- LOG_D("TIndexBuilder::TTxGet: DoExecute"
- << ", Database: " << record.GetDatabaseName()
- << ", BuildIndexId: " << record.GetIndexBuildId());
- LOG_T("Message: " << record.ShortDebugString());
-
- auto response = MakeHolder<TEvIndexBuilder::TEvGetResponse>();
- TPath database = TPath::Resolve(record.GetDatabaseName(), Self);
- if (!database.IsResolved()) {
- return Reply(
- std::move(response),
+
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+using namespace NTabletFlatExecutor;
+
+struct TSchemeShard::TIndexBuilder::TTxGet: public TSchemeShard::TIndexBuilder::TTxBase {
+private:
+ TEvIndexBuilder::TEvGetRequest::TPtr Request;
+
+public:
+ explicit TTxGet(TSelf* self, TEvIndexBuilder::TEvGetRequest::TPtr& ev)
+ : TSchemeShard::TIndexBuilder::TTxBase(self)
+ , Request(ev)
+ {
+ }
+
+ TTxType GetTxType() const override {
+ return TXTYPE_GET_INDEX_BUILD;
+ }
+
+ bool DoExecute(TTransactionContext&, const TActorContext&) override {
+ const auto& record = Request->Get()->Record;
+
+ LOG_D("TIndexBuilder::TTxGet: DoExecute"
+ << ", Database: " << record.GetDatabaseName()
+ << ", BuildIndexId: " << record.GetIndexBuildId());
+ LOG_T("Message: " << record.ShortDebugString());
+
+ auto response = MakeHolder<TEvIndexBuilder::TEvGetResponse>();
+ TPath database = TPath::Resolve(record.GetDatabaseName(), Self);
+ if (!database.IsResolved()) {
+ return Reply(
+ std::move(response),
Ydb::StatusIds::BAD_REQUEST,
- TStringBuilder() << "Database <" << record.GetDatabaseName() << "> not found"
- );
- }
- const TPathId domainId = database.DomainId();
-
- TIndexBuildId indexBuildId = TIndexBuildId(record.GetIndexBuildId());
-
- if (!Self->IndexBuilds.contains(indexBuildId)) {
- return Reply(
- std::move(response),
+ TStringBuilder() << "Database <" << record.GetDatabaseName() << "> not found"
+ );
+ }
+ const TPathId domainId = database.DomainId();
+
+ TIndexBuildId indexBuildId = TIndexBuildId(record.GetIndexBuildId());
+
+ if (!Self->IndexBuilds.contains(indexBuildId)) {
+ return Reply(
+ std::move(response),
Ydb::StatusIds::PRECONDITION_FAILED,
- TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> not found"
- );
- }
-
- TIndexBuildInfo::TPtr indexBuildInfo = Self->IndexBuilds.at(indexBuildId);
- if (indexBuildInfo->DomainPathId != domainId) {
- return Reply(
- std::move(response),
+ TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> not found"
+ );
+ }
+
+ TIndexBuildInfo::TPtr indexBuildInfo = Self->IndexBuilds.at(indexBuildId);
+ if (indexBuildInfo->DomainPathId != domainId) {
+ return Reply(
+ std::move(response),
Ydb::StatusIds::BAD_REQUEST,
- TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> not found in database <" << record.GetDatabaseName() << ">"
- );
- }
-
- auto& respRecord = response->Record;
- respRecord.SetStatus(Ydb::StatusIds::SUCCESS);
- Fill(*respRecord.MutableIndexBuild(), indexBuildInfo);
-
- return Reply(std::move(response));
- }
-
- bool Reply(THolder<TEvIndexBuilder::TEvGetResponse> response,
- const Ydb::StatusIds::StatusCode status = Ydb::StatusIds::SUCCESS,
- const TString& errorMessage = TString())
- {
- LOG_D("TIndexBuilder::TTxForget: Reply"
- << ", BuildIndexId: " << response->Record.GetIndexBuild().GetId()
- << ", status: " << status
- << ", error: " << errorMessage);
- LOG_T("Message: " << response->Record.ShortDebugString());
-
- auto& respRecord = response->Record;
- respRecord.SetStatus(status);
- if (errorMessage) {
- AddIssue(respRecord.MutableIssues(), errorMessage);
- }
-
- Send(Request->Sender, std::move(response), 0, Request->Cookie);
-
- return true;
- }
-
- void DoComplete(const TActorContext&) override {
- }
-
-private:
-
-
-};
-
-ITransaction* TSchemeShard::CreateTxGet(TEvIndexBuilder::TEvGetRequest::TPtr& ev) {
- return new TIndexBuilder::TTxGet(this, ev);
-}
-
-} // NSchemeShard
-} // NKikimr
+ TStringBuilder() << "Index build prcess with id <" << indexBuildId << "> not found in database <" << record.GetDatabaseName() << ">"
+ );
+ }
+
+ auto& respRecord = response->Record;
+ respRecord.SetStatus(Ydb::StatusIds::SUCCESS);
+ Fill(*respRecord.MutableIndexBuild(), indexBuildInfo);
+
+ return Reply(std::move(response));
+ }
+
+ bool Reply(THolder<TEvIndexBuilder::TEvGetResponse> response,
+ const Ydb::StatusIds::StatusCode status = Ydb::StatusIds::SUCCESS,
+ const TString& errorMessage = TString())
+ {
+ LOG_D("TIndexBuilder::TTxForget: Reply"
+ << ", BuildIndexId: " << response->Record.GetIndexBuild().GetId()
+ << ", status: " << status
+ << ", error: " << errorMessage);
+ LOG_T("Message: " << response->Record.ShortDebugString());
+
+ auto& respRecord = response->Record;
+ respRecord.SetStatus(status);
+ if (errorMessage) {
+ AddIssue(respRecord.MutableIssues(), errorMessage);
+ }
+
+ Send(Request->Sender, std::move(response), 0, Request->Cookie);
+
+ return true;
+ }
+
+ void DoComplete(const TActorContext&) override {
+ }
+
+private:
+
+
+};
+
+ITransaction* TSchemeShard::CreateTxGet(TEvIndexBuilder::TEvGetRequest::TPtr& ev) {
+ return new TIndexBuilder::TTxGet(this, ev);
+}
+
+} // NSchemeShard
+} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_build_index__list.cpp b/ydb/core/tx/schemeshard/schemeshard_build_index__list.cpp
index 98c09a20453..f42e8542a79 100644
--- a/ydb/core/tx/schemeshard/schemeshard_build_index__list.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_build_index__list.cpp
@@ -1,130 +1,130 @@
-#include "schemeshard_build_index.h"
-#include "schemeshard_impl.h"
-#include "schemeshard_build_index_helpers.h"
-#include "schemeshard_build_index_tx_base.h"
-
+#include "schemeshard_build_index.h"
+#include "schemeshard_impl.h"
+#include "schemeshard_build_index_helpers.h"
+#include "schemeshard_build_index_tx_base.h"
+
#include <ydb/public/api/protos/ydb_issue_message.pb.h>
#include <ydb/public/api/protos/ydb_status_codes.pb.h>
-
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-using namespace NTabletFlatExecutor;
-
-struct TSchemeShard::TIndexBuilder::TTxList: public TSchemeShard::TIndexBuilder::TTxBase {
-private:
- static constexpr ui64 DefaultPageSize = 10;
- static constexpr ui64 MinPageSize = 1;
- static constexpr ui64 MaxPageSize = 100;
- static constexpr ui64 DefaultPage = 1;
-
-
- TEvIndexBuilder::TEvListRequest::TPtr Request;
-
-public:
- explicit TTxList(TSelf* self, TEvIndexBuilder::TEvListRequest::TPtr& ev)
- : TSchemeShard::TIndexBuilder::TTxBase(self)
- , Request(ev)
- {
- }
-
- TTxType GetTxType() const override {
- return TXTYPE_LIST_INDEX_BUILD;
- }
-
- bool DoExecute(TTransactionContext&, const TActorContext&) override {
- const auto& record = Request->Get()->Record;
-
- LOG_D("TIndexBuilder::TTxList: DoExecute"
- << ", Database: " << record.GetDatabaseName());
- LOG_T("Message: " << record.ShortDebugString());
-
- auto response = MakeHolder<TEvIndexBuilder::TEvListResponse>();
- TPath database = TPath::Resolve(record.GetDatabaseName(), Self);
- if (!database.IsResolved()) {
- return Reply(
- std::move(response),
- Ydb::StatusIds::NOT_FOUND,
- TStringBuilder() << "Database <" << record.GetDatabaseName() << "> not found"
- );
- }
- const TPathId domainId = database.DomainId();
-
- ui64 page = DefaultPage;
- if (record.GetPageToken() && !TryFromString(record.GetPageToken(), page)) {
- return Reply(
- std::move(response),
- Ydb::StatusIds::BAD_REQUEST,
- TStringBuilder() << "Unable to parse page token"
- );
- }
- page = Max(page, DefaultPage);
- const ui64 pageSize = Min(record.GetPageSize() ? Max(record.GetPageSize(), MinPageSize) : DefaultPageSize, MaxPageSize);
-
-
- auto it = Self->IndexBuilds.begin();
- ui64 skip = (page - 1) * pageSize;
- while ((it != Self->IndexBuilds.end()) && skip) {
- if (it->second->DomainPathId == domainId) {
- --skip;
- }
- ++it;
- }
-
- auto& respRecord = response->Record;
- respRecord.SetStatus(Ydb::StatusIds::SUCCESS);
-
- ui64 size = 0;
- while ((it != Self->IndexBuilds.end()) && size < pageSize) {
- if (it->second->DomainPathId == domainId) {
- Fill(*respRecord.MutableEntries()->Add(), it->second);
- ++size;
- }
- ++it;
- }
-
- if (it == Self->IndexBuilds.end()) {
- respRecord.SetNextPageToken("0");
- } else {
- respRecord.SetNextPageToken(ToString(page + 1));
- }
-
- return Reply(std::move(response));
- }
-
- bool Reply(THolder<TEvIndexBuilder::TEvListResponse> response,
- const Ydb::StatusIds::StatusCode status = Ydb::StatusIds::SUCCESS,
- const TString& errorMessage = TString())
- {
- LOG_D("TIndexBuilder::TTxForget: Reply"
- << ", BuildIndexCount: " << response->Record.EntriesSize()
- << ", status: " << status
- << ", error: " << errorMessage);
- LOG_T("Message: " << response->Record.ShortDebugString());
-
- auto& resp = response->Record;
- resp.SetStatus(status);
- if (errorMessage) {
- AddIssue(resp.MutableIssues(), errorMessage);
- }
-
- Send(Request->Sender, std::move(response), 0, Request->Cookie);
-
- return true;
- }
-
- void DoComplete(const TActorContext&) override {
- }
-
-private:
-
-};
-
-ITransaction* TSchemeShard::CreateTxList(TEvIndexBuilder::TEvListRequest::TPtr& ev) {
- return new TIndexBuilder::TTxList(this, ev);
-}
-
-} // NSchemeShard
-} // NKikimr
-
+
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+using namespace NTabletFlatExecutor;
+
+struct TSchemeShard::TIndexBuilder::TTxList: public TSchemeShard::TIndexBuilder::TTxBase {
+private:
+ static constexpr ui64 DefaultPageSize = 10;
+ static constexpr ui64 MinPageSize = 1;
+ static constexpr ui64 MaxPageSize = 100;
+ static constexpr ui64 DefaultPage = 1;
+
+
+ TEvIndexBuilder::TEvListRequest::TPtr Request;
+
+public:
+ explicit TTxList(TSelf* self, TEvIndexBuilder::TEvListRequest::TPtr& ev)
+ : TSchemeShard::TIndexBuilder::TTxBase(self)
+ , Request(ev)
+ {
+ }
+
+ TTxType GetTxType() const override {
+ return TXTYPE_LIST_INDEX_BUILD;
+ }
+
+ bool DoExecute(TTransactionContext&, const TActorContext&) override {
+ const auto& record = Request->Get()->Record;
+
+ LOG_D("TIndexBuilder::TTxList: DoExecute"
+ << ", Database: " << record.GetDatabaseName());
+ LOG_T("Message: " << record.ShortDebugString());
+
+ auto response = MakeHolder<TEvIndexBuilder::TEvListResponse>();
+ TPath database = TPath::Resolve(record.GetDatabaseName(), Self);
+ if (!database.IsResolved()) {
+ return Reply(
+ std::move(response),
+ Ydb::StatusIds::NOT_FOUND,
+ TStringBuilder() << "Database <" << record.GetDatabaseName() << "> not found"
+ );
+ }
+ const TPathId domainId = database.DomainId();
+
+ ui64 page = DefaultPage;
+ if (record.GetPageToken() && !TryFromString(record.GetPageToken(), page)) {
+ return Reply(
+ std::move(response),
+ Ydb::StatusIds::BAD_REQUEST,
+ TStringBuilder() << "Unable to parse page token"
+ );
+ }
+ page = Max(page, DefaultPage);
+ const ui64 pageSize = Min(record.GetPageSize() ? Max(record.GetPageSize(), MinPageSize) : DefaultPageSize, MaxPageSize);
+
+
+ auto it = Self->IndexBuilds.begin();
+ ui64 skip = (page - 1) * pageSize;
+ while ((it != Self->IndexBuilds.end()) && skip) {
+ if (it->second->DomainPathId == domainId) {
+ --skip;
+ }
+ ++it;
+ }
+
+ auto& respRecord = response->Record;
+ respRecord.SetStatus(Ydb::StatusIds::SUCCESS);
+
+ ui64 size = 0;
+ while ((it != Self->IndexBuilds.end()) && size < pageSize) {
+ if (it->second->DomainPathId == domainId) {
+ Fill(*respRecord.MutableEntries()->Add(), it->second);
+ ++size;
+ }
+ ++it;
+ }
+
+ if (it == Self->IndexBuilds.end()) {
+ respRecord.SetNextPageToken("0");
+ } else {
+ respRecord.SetNextPageToken(ToString(page + 1));
+ }
+
+ return Reply(std::move(response));
+ }
+
+ bool Reply(THolder<TEvIndexBuilder::TEvListResponse> response,
+ const Ydb::StatusIds::StatusCode status = Ydb::StatusIds::SUCCESS,
+ const TString& errorMessage = TString())
+ {
+ LOG_D("TIndexBuilder::TTxForget: Reply"
+ << ", BuildIndexCount: " << response->Record.EntriesSize()
+ << ", status: " << status
+ << ", error: " << errorMessage);
+ LOG_T("Message: " << response->Record.ShortDebugString());
+
+ auto& resp = response->Record;
+ resp.SetStatus(status);
+ if (errorMessage) {
+ AddIssue(resp.MutableIssues(), errorMessage);
+ }
+
+ Send(Request->Sender, std::move(response), 0, Request->Cookie);
+
+ return true;
+ }
+
+ void DoComplete(const TActorContext&) override {
+ }
+
+private:
+
+};
+
+ITransaction* TSchemeShard::CreateTxList(TEvIndexBuilder::TEvListRequest::TPtr& ev) {
+ return new TIndexBuilder::TTxList(this, ev);
+}
+
+} // NSchemeShard
+} // NKikimr
+
diff --git a/ydb/core/tx/schemeshard/schemeshard_build_index__progress.cpp b/ydb/core/tx/schemeshard/schemeshard_build_index__progress.cpp
index c4b942b929b..a5fbbae7037 100644
--- a/ydb/core/tx/schemeshard/schemeshard_build_index__progress.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_build_index__progress.cpp
@@ -1,1308 +1,1308 @@
-#include "schemeshard_build_index.h"
-#include "schemeshard_impl.h"
-#include "schemeshard_build_index_helpers.h"
-#include "schemeshard_build_index_tx_base.h"
-
+#include "schemeshard_build_index.h"
+#include "schemeshard_impl.h"
+#include "schemeshard_build_index_helpers.h"
+#include "schemeshard_build_index_tx_base.h"
+
#include <ydb/core/tx/datashard/range_ops.h>
-
+
#include <ydb/public/api/protos/ydb_issue_message.pb.h>
#include <ydb/public/api/protos/ydb_status_codes.pb.h>
-
+
#include <ydb/library/yql/public/issue/yql_issue_message.h>
-
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-NKikimrSchemeOp::TIndexBuildConfig GetInitiateIndexBuildMessage(TSchemeShard* ss, const TIndexBuildInfo::TPtr buildInfo) {
- NKikimrSchemeOp::TIndexBuildConfig message;
-
- message.SetTable(TPath::Init(buildInfo->TablePathId, ss).PathString());
- auto& index = *message.MutableIndex();
- index.SetName(buildInfo->IndexName);
- for (const auto& x: buildInfo->IndexColumns) {
- *index.AddKeyColumnNames() = x;
- }
+
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+NKikimrSchemeOp::TIndexBuildConfig GetInitiateIndexBuildMessage(TSchemeShard* ss, const TIndexBuildInfo::TPtr buildInfo) {
+ NKikimrSchemeOp::TIndexBuildConfig message;
+
+ message.SetTable(TPath::Init(buildInfo->TablePathId, ss).PathString());
+ auto& index = *message.MutableIndex();
+ index.SetName(buildInfo->IndexName);
+ for (const auto& x: buildInfo->IndexColumns) {
+ *index.AddKeyColumnNames() = x;
+ }
for (const auto& x: buildInfo->DataColumns) {
*index.AddDataColumnNames() = x;
}
- index.SetType(buildInfo->IndexType);
-
- return message;
-}
-
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> LockPropose(
- TSchemeShard* ss, const TIndexBuildInfo::TPtr buildInfo)
-{
- auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(buildInfo->LockTxId), ss->TabletID());
- propose->Record.SetFailOnExist(false);
-
- NKikimrSchemeOp::TModifyScheme& modifyScheme = *propose->Record.AddTransaction();
- modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateLockForIndexBuild);
+ index.SetType(buildInfo->IndexType);
+
+ return message;
+}
+
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> LockPropose(
+ TSchemeShard* ss, const TIndexBuildInfo::TPtr buildInfo)
+{
+ auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(buildInfo->LockTxId), ss->TabletID());
+ propose->Record.SetFailOnExist(false);
+
+ NKikimrSchemeOp::TModifyScheme& modifyScheme = *propose->Record.AddTransaction();
+ modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateLockForIndexBuild);
modifyScheme.SetInternal(true);
-
- TPath path = TPath::Init(buildInfo->TablePathId, ss);
- modifyScheme.SetWorkingDir(path.Parent().PathString());
-
- auto& lockConfig = *modifyScheme.MutableLockConfig();
- lockConfig.SetName(path.LeafName());
-
- *modifyScheme.MutableInitiateIndexBuild() = GetInitiateIndexBuildMessage(ss, buildInfo);
-
- return propose;
-}
-
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> InitiatePropose(
- TSchemeShard* ss, const TIndexBuildInfo::TPtr buildInfo)
-{
- auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(buildInfo->InitiateTxId), ss->TabletID());
- propose->Record.SetFailOnExist(true);
-
- NKikimrSchemeOp::TModifyScheme& modifyScheme = *propose->Record.AddTransaction();
- modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateIndexBuild);
+
+ TPath path = TPath::Init(buildInfo->TablePathId, ss);
+ modifyScheme.SetWorkingDir(path.Parent().PathString());
+
+ auto& lockConfig = *modifyScheme.MutableLockConfig();
+ lockConfig.SetName(path.LeafName());
+
+ *modifyScheme.MutableInitiateIndexBuild() = GetInitiateIndexBuildMessage(ss, buildInfo);
+
+ return propose;
+}
+
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> InitiatePropose(
+ TSchemeShard* ss, const TIndexBuildInfo::TPtr buildInfo)
+{
+ auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(buildInfo->InitiateTxId), ss->TabletID());
+ propose->Record.SetFailOnExist(true);
+
+ NKikimrSchemeOp::TModifyScheme& modifyScheme = *propose->Record.AddTransaction();
+ modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateIndexBuild);
modifyScheme.SetInternal(true);
-
- modifyScheme.SetWorkingDir(TPath::Init(buildInfo->DomainPathId, ss).PathString());
-
- modifyScheme.MutableLockGuard()->SetOwnerTxId(ui64(buildInfo->LockTxId));
-
- *modifyScheme.MutableInitiateIndexBuild() = GetInitiateIndexBuildMessage(ss, buildInfo);
-
- return propose;
-}
-
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> ApplyPropose(
- TSchemeShard* ss, const TIndexBuildInfo::TPtr buildInfo)
-{
- auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(buildInfo->ApplyTxId), ss->TabletID());
- propose->Record.SetFailOnExist(true);
-
- NKikimrSchemeOp::TModifyScheme& modifyScheme = *propose->Record.AddTransaction();
- modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpApplyIndexBuild);
+
+ modifyScheme.SetWorkingDir(TPath::Init(buildInfo->DomainPathId, ss).PathString());
+
+ modifyScheme.MutableLockGuard()->SetOwnerTxId(ui64(buildInfo->LockTxId));
+
+ *modifyScheme.MutableInitiateIndexBuild() = GetInitiateIndexBuildMessage(ss, buildInfo);
+
+ return propose;
+}
+
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> ApplyPropose(
+ TSchemeShard* ss, const TIndexBuildInfo::TPtr buildInfo)
+{
+ auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(buildInfo->ApplyTxId), ss->TabletID());
+ propose->Record.SetFailOnExist(true);
+
+ NKikimrSchemeOp::TModifyScheme& modifyScheme = *propose->Record.AddTransaction();
+ modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpApplyIndexBuild);
modifyScheme.SetInternal(true);
-
- modifyScheme.SetWorkingDir(TPath::Init(buildInfo->DomainPathId, ss).PathString());
-
- modifyScheme.MutableLockGuard()->SetOwnerTxId(ui64(buildInfo->LockTxId));
-
- auto& indexBuild = *modifyScheme.MutableApplyIndexBuild();
- indexBuild.SetTablePath(TPath::Init(buildInfo->TablePathId, ss).PathString());
- indexBuild.SetIndexName(buildInfo->IndexName);
- indexBuild.SetSnaphotTxId(ui64(buildInfo->InitiateTxId));
- indexBuild.SetBuildIndexId(ui64(buildInfo->Id));
-
- return propose;
-}
-
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> UnlockPropose(
- TSchemeShard* ss, const TIndexBuildInfo::TPtr buildInfo)
-{
- auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(buildInfo->UnlockTxId), ss->TabletID());
- propose->Record.SetFailOnExist(true);
-
- NKikimrSchemeOp::TModifyScheme& modifyScheme = *propose->Record.AddTransaction();
- modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpDropLock);
+
+ modifyScheme.SetWorkingDir(TPath::Init(buildInfo->DomainPathId, ss).PathString());
+
+ modifyScheme.MutableLockGuard()->SetOwnerTxId(ui64(buildInfo->LockTxId));
+
+ auto& indexBuild = *modifyScheme.MutableApplyIndexBuild();
+ indexBuild.SetTablePath(TPath::Init(buildInfo->TablePathId, ss).PathString());
+ indexBuild.SetIndexName(buildInfo->IndexName);
+ indexBuild.SetSnaphotTxId(ui64(buildInfo->InitiateTxId));
+ indexBuild.SetBuildIndexId(ui64(buildInfo->Id));
+
+ return propose;
+}
+
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> UnlockPropose(
+ TSchemeShard* ss, const TIndexBuildInfo::TPtr buildInfo)
+{
+ auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(buildInfo->UnlockTxId), ss->TabletID());
+ propose->Record.SetFailOnExist(true);
+
+ NKikimrSchemeOp::TModifyScheme& modifyScheme = *propose->Record.AddTransaction();
+ modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpDropLock);
modifyScheme.SetInternal(true);
-
- modifyScheme.MutableLockGuard()->SetOwnerTxId(ui64(buildInfo->LockTxId));
-
- TPath path = TPath::Init(buildInfo->TablePathId, ss);
- modifyScheme.SetWorkingDir(path.Parent().PathString());
-
- auto& lockConfig = *modifyScheme.MutableLockConfig();
- lockConfig.SetName(path.LeafName());
-
- return propose;
-}
-
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> CancelPropose(
- TSchemeShard* ss, const TIndexBuildInfo::TPtr buildInfo)
-{
- auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(buildInfo->ApplyTxId), ss->TabletID());
- propose->Record.SetFailOnExist(true);
-
- NKikimrSchemeOp::TModifyScheme& modifyScheme = *propose->Record.AddTransaction();
- modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpCancelIndexBuild);
+
+ modifyScheme.MutableLockGuard()->SetOwnerTxId(ui64(buildInfo->LockTxId));
+
+ TPath path = TPath::Init(buildInfo->TablePathId, ss);
+ modifyScheme.SetWorkingDir(path.Parent().PathString());
+
+ auto& lockConfig = *modifyScheme.MutableLockConfig();
+ lockConfig.SetName(path.LeafName());
+
+ return propose;
+}
+
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> CancelPropose(
+ TSchemeShard* ss, const TIndexBuildInfo::TPtr buildInfo)
+{
+ auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(buildInfo->ApplyTxId), ss->TabletID());
+ propose->Record.SetFailOnExist(true);
+
+ NKikimrSchemeOp::TModifyScheme& modifyScheme = *propose->Record.AddTransaction();
+ modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpCancelIndexBuild);
modifyScheme.SetInternal(true);
-
- modifyScheme.SetWorkingDir(TPath::Init(buildInfo->DomainPathId, ss).PathString());
-
- modifyScheme.MutableLockGuard()->SetOwnerTxId(ui64(buildInfo->LockTxId));
-
- auto& indexBuild = *modifyScheme.MutableCancelIndexBuild();
- indexBuild.SetTablePath(TPath::Init(buildInfo->TablePathId, ss).PathString());
- indexBuild.SetIndexName(buildInfo->IndexName);
- indexBuild.SetSnaphotTxId(ui64(buildInfo->InitiateTxId));
- indexBuild.SetBuildIndexId(ui64(buildInfo->Id));
-
- return propose;
-}
-
-using namespace NTabletFlatExecutor;
-
-struct TSchemeShard::TIndexBuilder::TTxProgress: public TSchemeShard::TIndexBuilder::TTxBase {
-private:
- TIndexBuildId BuildId;
-
- TDeque<std::tuple<TTabletId, ui64, THolder<IEventBase>>> ToTabletSend;
-
-public:
- explicit TTxProgress(TSelf* self, TIndexBuildId id)
- : TSchemeShard::TIndexBuilder::TTxBase(self)
- , BuildId(id)
- {
- }
-
- TTxType GetTxType() const override {
- return TXTYPE_PROGRESS_INDEX_BUILD;
- }
-
- bool DoExecute(TTransactionContext& txc, const TActorContext& ctx) override {
- Y_VERIFY(Self->IndexBuilds.contains(BuildId));
- TIndexBuildInfo::TPtr buildInfo = Self->IndexBuilds.at(BuildId);
-
- LOG_I("TTxBuildProgress: Resume"
- << ": id# " << BuildId);
- LOG_D("TTxBuildProgress: Resume"
- << ": " << *buildInfo);
-
- switch (buildInfo->State) {
- case TIndexBuildInfo::EState::Invalid:
- Y_FAIL("Unreachable");
-
- case TIndexBuildInfo::EState::Locking:
- if (buildInfo->LockTxId == InvalidTxId) {
+
+ modifyScheme.SetWorkingDir(TPath::Init(buildInfo->DomainPathId, ss).PathString());
+
+ modifyScheme.MutableLockGuard()->SetOwnerTxId(ui64(buildInfo->LockTxId));
+
+ auto& indexBuild = *modifyScheme.MutableCancelIndexBuild();
+ indexBuild.SetTablePath(TPath::Init(buildInfo->TablePathId, ss).PathString());
+ indexBuild.SetIndexName(buildInfo->IndexName);
+ indexBuild.SetSnaphotTxId(ui64(buildInfo->InitiateTxId));
+ indexBuild.SetBuildIndexId(ui64(buildInfo->Id));
+
+ return propose;
+}
+
+using namespace NTabletFlatExecutor;
+
+struct TSchemeShard::TIndexBuilder::TTxProgress: public TSchemeShard::TIndexBuilder::TTxBase {
+private:
+ TIndexBuildId BuildId;
+
+ TDeque<std::tuple<TTabletId, ui64, THolder<IEventBase>>> ToTabletSend;
+
+public:
+ explicit TTxProgress(TSelf* self, TIndexBuildId id)
+ : TSchemeShard::TIndexBuilder::TTxBase(self)
+ , BuildId(id)
+ {
+ }
+
+ TTxType GetTxType() const override {
+ return TXTYPE_PROGRESS_INDEX_BUILD;
+ }
+
+ bool DoExecute(TTransactionContext& txc, const TActorContext& ctx) override {
+ Y_VERIFY(Self->IndexBuilds.contains(BuildId));
+ TIndexBuildInfo::TPtr buildInfo = Self->IndexBuilds.at(BuildId);
+
+ LOG_I("TTxBuildProgress: Resume"
+ << ": id# " << BuildId);
+ LOG_D("TTxBuildProgress: Resume"
+ << ": " << *buildInfo);
+
+ switch (buildInfo->State) {
+ case TIndexBuildInfo::EState::Invalid:
+ Y_FAIL("Unreachable");
+
+ case TIndexBuildInfo::EState::Locking:
+ if (buildInfo->LockTxId == InvalidTxId) {
Send(Self->TxAllocatorClient, MakeHolder<TEvTxAllocatorClient::TEvAllocate>(), 0, ui64(BuildId));
- } else if (buildInfo->LockTxStatus == NKikimrScheme::StatusSuccess) {
- Send(Self->SelfId(), LockPropose(Self, buildInfo), 0, ui64(BuildId));
- } else if (!buildInfo->LockTxDone) {
- Send(Self->SelfId(), MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(ui64(buildInfo->LockTxId)));
- } else {
- ChangeState(BuildId, TIndexBuildInfo::EState::GatheringStatistics);
- Progress(BuildId);
- }
-
- break;
- case TIndexBuildInfo::EState::GatheringStatistics:
- ChangeState(BuildId, TIndexBuildInfo::EState::Initiating);
- Progress(BuildId);
- break;
- case TIndexBuildInfo::EState::Initiating:
- if (buildInfo->InitiateTxId == InvalidTxId) {
+ } else if (buildInfo->LockTxStatus == NKikimrScheme::StatusSuccess) {
+ Send(Self->SelfId(), LockPropose(Self, buildInfo), 0, ui64(BuildId));
+ } else if (!buildInfo->LockTxDone) {
+ Send(Self->SelfId(), MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(ui64(buildInfo->LockTxId)));
+ } else {
+ ChangeState(BuildId, TIndexBuildInfo::EState::GatheringStatistics);
+ Progress(BuildId);
+ }
+
+ break;
+ case TIndexBuildInfo::EState::GatheringStatistics:
+ ChangeState(BuildId, TIndexBuildInfo::EState::Initiating);
+ Progress(BuildId);
+ break;
+ case TIndexBuildInfo::EState::Initiating:
+ if (buildInfo->InitiateTxId == InvalidTxId) {
Send(Self->TxAllocatorClient, MakeHolder<TEvTxAllocatorClient::TEvAllocate>(), 0, ui64(BuildId));
- } else if (buildInfo->InitiateTxStatus == NKikimrScheme::StatusSuccess) {
- Send(Self->SelfId(), InitiatePropose(Self, buildInfo), 0, ui64(BuildId));
- } else if (!buildInfo->InitiateTxDone) {
- Send(Self->SelfId(), MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(ui64(buildInfo->InitiateTxId)));
- } else {
- ChangeState(BuildId, TIndexBuildInfo::EState::Filling);
- Progress(BuildId);
- }
-
- break;
- case TIndexBuildInfo::EState::Filling:
- if (buildInfo->IsCancellationRequested()) {
- buildInfo->DoneShards.clear();
- buildInfo->InProgressShards.clear();
-
- Self->IndexBuildPipes.CloseAll(BuildId, ctx);
-
- ChangeState(BuildId, TIndexBuildInfo::EState::Cancellation_Applying);
- Progress(BuildId);
-
- // make final bill
- Bill(buildInfo);
-
- break;
- }
-
- if (buildInfo->Shards.empty()) {
- NIceDb::TNiceDb db(txc.DB);
- InitiateShards(db, buildInfo);
- }
-
- if (buildInfo->ToUploadShards.empty()
- && buildInfo->DoneShards.empty()
- && buildInfo->InProgressShards.empty())
- {
- for (const auto& item: buildInfo->Shards) {
- const TIndexBuildInfo::TShardStatus& shardStatus = item.second;
- switch (shardStatus.Status) {
- case NKikimrTxDataShard::TEvBuildIndexProgressResponse::INVALID:
- case NKikimrTxDataShard::TEvBuildIndexProgressResponse::ACCEPTED:
- case NKikimrTxDataShard::TEvBuildIndexProgressResponse::INPROGRESS:
- case NKikimrTxDataShard::TEvBuildIndexProgressResponse::ABORTED:
- buildInfo->ToUploadShards.push_back(item.first);
- break;
- case NKikimrTxDataShard::TEvBuildIndexProgressResponse::DONE:
- buildInfo->DoneShards.insert(item.first);
- break;
- case NKikimrTxDataShard::TEvBuildIndexProgressResponse::BUILD_ERROR:
- case NKikimrTxDataShard::TEvBuildIndexProgressResponse::BAD_REQUEST:
- Y_FAIL("Unreachable");
- break;
- }
- }
- }
-
- if (!buildInfo->SnapshotTxId || !buildInfo->SnapshotStep) {
- Y_VERIFY(Self->TablesWithSnaphots.contains(buildInfo->TablePathId));
- Y_VERIFY(Self->TablesWithSnaphots.at(buildInfo->TablePathId) == buildInfo->InitiateTxId);
-
- buildInfo->SnapshotTxId = buildInfo->InitiateTxId;
- Y_VERIFY(buildInfo->SnapshotTxId);
- buildInfo->SnapshotStep = Self->SnapshotsStepIds.at(buildInfo->SnapshotTxId);
- Y_VERIFY(buildInfo->SnapshotStep);
- }
-
- if (buildInfo->ImplTablePath.Empty()) {
- TPath implTable = TPath::Init(buildInfo->TablePathId, Self).Dive(buildInfo->IndexName).Dive("indexImplTable");
- buildInfo->ImplTablePath = implTable.PathString();
-
- TTableInfo::TPtr imptTableInfo = Self->Tables.at(implTable.Base()->PathId);
- buildInfo->ImplTableColumns = NTableIndex::ExtractInfo(imptTableInfo);
- }
-
- while (!buildInfo->ToUploadShards.empty()
- && buildInfo->InProgressShards.size() < buildInfo->Limits.MaxShards)
- {
- TShardIdx shardIdx = buildInfo->ToUploadShards.front();
- buildInfo->ToUploadShards.pop_front();
- buildInfo->InProgressShards.insert(shardIdx);
-
- auto ev = MakeHolder<TEvDataShard::TEvBuildIndexCreateRequest>();
- ev->Record.SetBuildIndexId(ui64(BuildId));
-
- TTabletId shardId = Self->ShardInfos.at(shardIdx).TabletID;
- ev->Record.SetTabletId(ui64(shardId));
-
- ev->Record.SetOwnerId(buildInfo->TablePathId.OwnerId);
- ev->Record.SetPathId(buildInfo->TablePathId.LocalPathId);
-
- ev->Record.SetTargetName(buildInfo->ImplTablePath);
+ } else if (buildInfo->InitiateTxStatus == NKikimrScheme::StatusSuccess) {
+ Send(Self->SelfId(), InitiatePropose(Self, buildInfo), 0, ui64(BuildId));
+ } else if (!buildInfo->InitiateTxDone) {
+ Send(Self->SelfId(), MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(ui64(buildInfo->InitiateTxId)));
+ } else {
+ ChangeState(BuildId, TIndexBuildInfo::EState::Filling);
+ Progress(BuildId);
+ }
+
+ break;
+ case TIndexBuildInfo::EState::Filling:
+ if (buildInfo->IsCancellationRequested()) {
+ buildInfo->DoneShards.clear();
+ buildInfo->InProgressShards.clear();
+
+ Self->IndexBuildPipes.CloseAll(BuildId, ctx);
+
+ ChangeState(BuildId, TIndexBuildInfo::EState::Cancellation_Applying);
+ Progress(BuildId);
+
+ // make final bill
+ Bill(buildInfo);
+
+ break;
+ }
+
+ if (buildInfo->Shards.empty()) {
+ NIceDb::TNiceDb db(txc.DB);
+ InitiateShards(db, buildInfo);
+ }
+
+ if (buildInfo->ToUploadShards.empty()
+ && buildInfo->DoneShards.empty()
+ && buildInfo->InProgressShards.empty())
+ {
+ for (const auto& item: buildInfo->Shards) {
+ const TIndexBuildInfo::TShardStatus& shardStatus = item.second;
+ switch (shardStatus.Status) {
+ case NKikimrTxDataShard::TEvBuildIndexProgressResponse::INVALID:
+ case NKikimrTxDataShard::TEvBuildIndexProgressResponse::ACCEPTED:
+ case NKikimrTxDataShard::TEvBuildIndexProgressResponse::INPROGRESS:
+ case NKikimrTxDataShard::TEvBuildIndexProgressResponse::ABORTED:
+ buildInfo->ToUploadShards.push_back(item.first);
+ break;
+ case NKikimrTxDataShard::TEvBuildIndexProgressResponse::DONE:
+ buildInfo->DoneShards.insert(item.first);
+ break;
+ case NKikimrTxDataShard::TEvBuildIndexProgressResponse::BUILD_ERROR:
+ case NKikimrTxDataShard::TEvBuildIndexProgressResponse::BAD_REQUEST:
+ Y_FAIL("Unreachable");
+ break;
+ }
+ }
+ }
+
+ if (!buildInfo->SnapshotTxId || !buildInfo->SnapshotStep) {
+ Y_VERIFY(Self->TablesWithSnaphots.contains(buildInfo->TablePathId));
+ Y_VERIFY(Self->TablesWithSnaphots.at(buildInfo->TablePathId) == buildInfo->InitiateTxId);
+
+ buildInfo->SnapshotTxId = buildInfo->InitiateTxId;
+ Y_VERIFY(buildInfo->SnapshotTxId);
+ buildInfo->SnapshotStep = Self->SnapshotsStepIds.at(buildInfo->SnapshotTxId);
+ Y_VERIFY(buildInfo->SnapshotStep);
+ }
+
+ if (buildInfo->ImplTablePath.Empty()) {
+ TPath implTable = TPath::Init(buildInfo->TablePathId, Self).Dive(buildInfo->IndexName).Dive("indexImplTable");
+ buildInfo->ImplTablePath = implTable.PathString();
+
+ TTableInfo::TPtr imptTableInfo = Self->Tables.at(implTable.Base()->PathId);
+ buildInfo->ImplTableColumns = NTableIndex::ExtractInfo(imptTableInfo);
+ }
+
+ while (!buildInfo->ToUploadShards.empty()
+ && buildInfo->InProgressShards.size() < buildInfo->Limits.MaxShards)
+ {
+ TShardIdx shardIdx = buildInfo->ToUploadShards.front();
+ buildInfo->ToUploadShards.pop_front();
+ buildInfo->InProgressShards.insert(shardIdx);
+
+ auto ev = MakeHolder<TEvDataShard::TEvBuildIndexCreateRequest>();
+ ev->Record.SetBuildIndexId(ui64(BuildId));
+
+ TTabletId shardId = Self->ShardInfos.at(shardIdx).TabletID;
+ ev->Record.SetTabletId(ui64(shardId));
+
+ ev->Record.SetOwnerId(buildInfo->TablePathId.OwnerId);
+ ev->Record.SetPathId(buildInfo->TablePathId.LocalPathId);
+
+ ev->Record.SetTargetName(buildInfo->ImplTablePath);
THashSet<TString> columns = buildInfo->ImplTableColumns.Columns;
- for (const auto& x: buildInfo->ImplTableColumns.Keys) {
- *ev->Record.AddIndexColumns() = x;
+ for (const auto& x: buildInfo->ImplTableColumns.Keys) {
+ *ev->Record.AddIndexColumns() = x;
columns.erase(x);
- }
+ }
for (const auto& x: columns) {
*ev->Record.AddDataColumns() = x;
}
-
- TIndexBuildInfo::TShardStatus& shardStatus = buildInfo->Shards.at(shardIdx);
- if (shardStatus.LastKeyAck) {
- TSerializedTableRange range = TSerializedTableRange(shardStatus.LastKeyAck, "", false, false);
- range.Serialize(*ev->Record.MutableKeyRange());
- } else {
- shardStatus.Range.Serialize(*ev->Record.MutableKeyRange());
- }
-
- ev->Record.SetMaxBatchRows(buildInfo->Limits.MaxBatchRows);
- ev->Record.SetMaxBatchBytes(buildInfo->Limits.MaxBatchBytes);
- ev->Record.SetMaxRetries(buildInfo->Limits.MaxRetries);
-
- ev->Record.SetSnapshotTxId(ui64(buildInfo->SnapshotTxId));
- ev->Record.SetSnapshotStep(ui64(buildInfo->SnapshotStep));
-
- ev->Record.SetSeqNoGeneration(Self->Generation());
- ev->Record.SetSeqNoRound(++shardStatus.SeqNoRound);
-
- LOG_D("TTxBuildProgress: TEvBuildIndexCreateRequest"
- << ": " << ev->Record.ShortDebugString());
-
- ToTabletSend.emplace_back(shardId, ui64(BuildId), std::move(ev));
- }
-
- if (buildInfo->InProgressShards.empty() && buildInfo->ToUploadShards.empty()
- && buildInfo->DoneShards.size() == buildInfo->Shards.size()) {
- // all done
- Y_VERIFY(0 == Self->IndexBuildPipes.CloseAll(BuildId, ctx));
-
- ChangeState(BuildId, TIndexBuildInfo::EState::Applying);
- Progress(BuildId);
-
- // make final bill
- Bill(buildInfo);
- } else {
- AskToScheduleBilling(buildInfo);
- }
-
- break;
- case TIndexBuildInfo::EState::Applying:
- if (buildInfo->ApplyTxId == InvalidTxId) {
+
+ TIndexBuildInfo::TShardStatus& shardStatus = buildInfo->Shards.at(shardIdx);
+ if (shardStatus.LastKeyAck) {
+ TSerializedTableRange range = TSerializedTableRange(shardStatus.LastKeyAck, "", false, false);
+ range.Serialize(*ev->Record.MutableKeyRange());
+ } else {
+ shardStatus.Range.Serialize(*ev->Record.MutableKeyRange());
+ }
+
+ ev->Record.SetMaxBatchRows(buildInfo->Limits.MaxBatchRows);
+ ev->Record.SetMaxBatchBytes(buildInfo->Limits.MaxBatchBytes);
+ ev->Record.SetMaxRetries(buildInfo->Limits.MaxRetries);
+
+ ev->Record.SetSnapshotTxId(ui64(buildInfo->SnapshotTxId));
+ ev->Record.SetSnapshotStep(ui64(buildInfo->SnapshotStep));
+
+ ev->Record.SetSeqNoGeneration(Self->Generation());
+ ev->Record.SetSeqNoRound(++shardStatus.SeqNoRound);
+
+ LOG_D("TTxBuildProgress: TEvBuildIndexCreateRequest"
+ << ": " << ev->Record.ShortDebugString());
+
+ ToTabletSend.emplace_back(shardId, ui64(BuildId), std::move(ev));
+ }
+
+ if (buildInfo->InProgressShards.empty() && buildInfo->ToUploadShards.empty()
+ && buildInfo->DoneShards.size() == buildInfo->Shards.size()) {
+ // all done
+ Y_VERIFY(0 == Self->IndexBuildPipes.CloseAll(BuildId, ctx));
+
+ ChangeState(BuildId, TIndexBuildInfo::EState::Applying);
+ Progress(BuildId);
+
+ // make final bill
+ Bill(buildInfo);
+ } else {
+ AskToScheduleBilling(buildInfo);
+ }
+
+ break;
+ case TIndexBuildInfo::EState::Applying:
+ if (buildInfo->ApplyTxId == InvalidTxId) {
Send(Self->TxAllocatorClient, MakeHolder<TEvTxAllocatorClient::TEvAllocate>(), 0, ui64(BuildId));
- } else if (buildInfo->ApplyTxStatus == NKikimrScheme::StatusSuccess) {
- Send(Self->SelfId(), ApplyPropose(Self, buildInfo), 0, ui64(BuildId));
- } else if (!buildInfo->ApplyTxDone) {
- Send(Self->SelfId(), MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(ui64(buildInfo->ApplyTxId)));
- } else {
- ChangeState(BuildId, TIndexBuildInfo::EState::Unlocking);
- Progress(BuildId);
- }
- break;
- case TIndexBuildInfo::EState::Unlocking:
- if (buildInfo->UnlockTxId == InvalidTxId) {
+ } else if (buildInfo->ApplyTxStatus == NKikimrScheme::StatusSuccess) {
+ Send(Self->SelfId(), ApplyPropose(Self, buildInfo), 0, ui64(BuildId));
+ } else if (!buildInfo->ApplyTxDone) {
+ Send(Self->SelfId(), MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(ui64(buildInfo->ApplyTxId)));
+ } else {
+ ChangeState(BuildId, TIndexBuildInfo::EState::Unlocking);
+ Progress(BuildId);
+ }
+ break;
+ case TIndexBuildInfo::EState::Unlocking:
+ if (buildInfo->UnlockTxId == InvalidTxId) {
Send(Self->TxAllocatorClient, MakeHolder<TEvTxAllocatorClient::TEvAllocate>(), 0, ui64(BuildId));
- } else if (buildInfo->UnlockTxStatus == NKikimrScheme::StatusSuccess) {
- Send(Self->SelfId(), UnlockPropose(Self, buildInfo), 0, ui64(BuildId));
- } else if (!buildInfo->UnlockTxDone) {
- Send(Self->SelfId(), MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(ui64(buildInfo->UnlockTxId)));
- } else {
- ChangeState(BuildId, TIndexBuildInfo::EState::Done);
- Progress(BuildId);
- }
- break;
- case TIndexBuildInfo::EState::Done:
- SendNotificationsIfFinished(buildInfo);
- // stay calm keep status/issues
- break;
-
- case TIndexBuildInfo::EState::Cancellation_Applying:
- if (buildInfo->ApplyTxId == InvalidTxId) {
+ } else if (buildInfo->UnlockTxStatus == NKikimrScheme::StatusSuccess) {
+ Send(Self->SelfId(), UnlockPropose(Self, buildInfo), 0, ui64(BuildId));
+ } else if (!buildInfo->UnlockTxDone) {
+ Send(Self->SelfId(), MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(ui64(buildInfo->UnlockTxId)));
+ } else {
+ ChangeState(BuildId, TIndexBuildInfo::EState::Done);
+ Progress(BuildId);
+ }
+ break;
+ case TIndexBuildInfo::EState::Done:
+ SendNotificationsIfFinished(buildInfo);
+ // stay calm keep status/issues
+ break;
+
+ case TIndexBuildInfo::EState::Cancellation_Applying:
+ if (buildInfo->ApplyTxId == InvalidTxId) {
Send(Self->TxAllocatorClient, MakeHolder<TEvTxAllocatorClient::TEvAllocate>(), 0, ui64(BuildId));
- } else if (buildInfo->ApplyTxStatus == NKikimrScheme::StatusSuccess) {
- Send(Self->SelfId(), CancelPropose(Self, buildInfo), 0, ui64(BuildId));
- } else if (!buildInfo->ApplyTxDone) {
- Send(Self->SelfId(), MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(ui64(buildInfo->ApplyTxId)));
- } else {
- ChangeState(BuildId, TIndexBuildInfo::EState::Cancellation_Unlocking);
- Progress(BuildId);
- }
- break;
- case TIndexBuildInfo::EState::Cancellation_Unlocking:
- if (buildInfo->UnlockTxId == InvalidTxId) {
+ } else if (buildInfo->ApplyTxStatus == NKikimrScheme::StatusSuccess) {
+ Send(Self->SelfId(), CancelPropose(Self, buildInfo), 0, ui64(BuildId));
+ } else if (!buildInfo->ApplyTxDone) {
+ Send(Self->SelfId(), MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(ui64(buildInfo->ApplyTxId)));
+ } else {
+ ChangeState(BuildId, TIndexBuildInfo::EState::Cancellation_Unlocking);
+ Progress(BuildId);
+ }
+ break;
+ case TIndexBuildInfo::EState::Cancellation_Unlocking:
+ if (buildInfo->UnlockTxId == InvalidTxId) {
Send(Self->TxAllocatorClient, MakeHolder<TEvTxAllocatorClient::TEvAllocate>(), 0, ui64(BuildId));
- } else if (buildInfo->UnlockTxStatus == NKikimrScheme::StatusSuccess) {
- Send(Self->SelfId(), UnlockPropose(Self, buildInfo), 0, ui64(BuildId));
- } else if (!buildInfo->UnlockTxDone) {
- Send(Self->SelfId(), MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(ui64(buildInfo->UnlockTxId)));
- } else {
- ChangeState(BuildId, TIndexBuildInfo::EState::Cancelled);
- Progress(BuildId);
- }
- break;
- case TIndexBuildInfo::EState::Cancelled:
- SendNotificationsIfFinished(buildInfo);
- // stay calm keep status/issues
- break;
-
- case TIndexBuildInfo::EState::Rejection_Applying:
- if (buildInfo->ApplyTxId == InvalidTxId) {
+ } else if (buildInfo->UnlockTxStatus == NKikimrScheme::StatusSuccess) {
+ Send(Self->SelfId(), UnlockPropose(Self, buildInfo), 0, ui64(BuildId));
+ } else if (!buildInfo->UnlockTxDone) {
+ Send(Self->SelfId(), MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(ui64(buildInfo->UnlockTxId)));
+ } else {
+ ChangeState(BuildId, TIndexBuildInfo::EState::Cancelled);
+ Progress(BuildId);
+ }
+ break;
+ case TIndexBuildInfo::EState::Cancelled:
+ SendNotificationsIfFinished(buildInfo);
+ // stay calm keep status/issues
+ break;
+
+ case TIndexBuildInfo::EState::Rejection_Applying:
+ if (buildInfo->ApplyTxId == InvalidTxId) {
Send(Self->TxAllocatorClient, MakeHolder<TEvTxAllocatorClient::TEvAllocate>(), 0, ui64(BuildId));
- } else if (buildInfo->ApplyTxStatus == NKikimrScheme::StatusSuccess) {
- Send(Self->SelfId(), CancelPropose(Self, buildInfo), 0, ui64(BuildId));
- } else if (!buildInfo->ApplyTxDone) {
- Send(Self->SelfId(), MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(ui64(buildInfo->ApplyTxId)));
- } else {
- ChangeState(BuildId, TIndexBuildInfo::EState::Rejection_Unlocking);
- Progress(BuildId);
- }
- break;
- case TIndexBuildInfo::EState::Rejection_Unlocking:
- if (buildInfo->UnlockTxId == InvalidTxId) {
+ } else if (buildInfo->ApplyTxStatus == NKikimrScheme::StatusSuccess) {
+ Send(Self->SelfId(), CancelPropose(Self, buildInfo), 0, ui64(BuildId));
+ } else if (!buildInfo->ApplyTxDone) {
+ Send(Self->SelfId(), MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(ui64(buildInfo->ApplyTxId)));
+ } else {
+ ChangeState(BuildId, TIndexBuildInfo::EState::Rejection_Unlocking);
+ Progress(BuildId);
+ }
+ break;
+ case TIndexBuildInfo::EState::Rejection_Unlocking:
+ if (buildInfo->UnlockTxId == InvalidTxId) {
Send(Self->TxAllocatorClient, MakeHolder<TEvTxAllocatorClient::TEvAllocate>(), 0, ui64(BuildId));
- } else if (buildInfo->UnlockTxStatus == NKikimrScheme::StatusSuccess) {
- Send(Self->SelfId(), UnlockPropose(Self, buildInfo), 0, ui64(BuildId));
- } else if (!buildInfo->UnlockTxDone) {
- Send(Self->SelfId(), MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(ui64(buildInfo->UnlockTxId)));
- } else {
- ChangeState(BuildId, TIndexBuildInfo::EState::Rejected);
- Progress(BuildId);
- }
- break;
- case TIndexBuildInfo::EState::Rejected:
- SendNotificationsIfFinished(buildInfo);
- // stay calm keep status/issues
- break;
- }
-
- return true;
- }
-
- void InitiateShards(NIceDb::TNiceDb& db, TIndexBuildInfo::TPtr& buildInfo) {
- TTableInfo::TPtr table = Self->Tables.at(buildInfo->TablePathId);
- for (const auto& x: table->GetPartitions()) {
- Y_VERIFY(Self->ShardInfos.contains(x.ShardIdx));
-
- buildInfo->Shards.emplace(x.ShardIdx, TIndexBuildInfo::TShardStatus());
- Self->PersistBuildIndexUploadInitiate(db, buildInfo, x.ShardIdx);
- }
- }
-
- void DoComplete(const TActorContext& ctx) override {
- for (auto& x: ToTabletSend) {
- Self->IndexBuildPipes.Create(BuildId, std::get<0>(x), std::move(std::get<2>(x)), ctx);
- }
- ToTabletSend.clear();
- }
-};
-
-ITransaction* TSchemeShard::CreateTxProgress(TIndexBuildId id) {
- return new TIndexBuilder::TTxProgress(this, id);
-}
-
-struct TSchemeShard::TIndexBuilder::TTxBilling: public TSchemeShard::TIndexBuilder::TTxBase {
-private:
- TIndexBuildId BuildIndexId;
- TInstant ScheduledAt;
-
-public:
- explicit TTxBilling(TSelf* self, TEvPrivate::TEvIndexBuildingMakeABill::TPtr& ev)
- : TSchemeShard::TIndexBuilder::TTxBase(self)
- , BuildIndexId(ev->Get()->BuildId)
- , ScheduledAt(ev->Get()->SendAt)
- {
- }
-
- TTxType GetTxType() const override {
- return TXTYPE_MAKEBILL_INDEX_BUILD;
- }
-
- bool DoExecute(TTransactionContext& , const TActorContext& ctx) override {
- LOG_I("TTxReply : TTxBilling"
- << ", buildIndexId# " << BuildIndexId);
-
- if (!Self->IndexBuilds.contains(BuildIndexId)) {
- return true;
- }
-
- TIndexBuildInfo::TPtr buildInfo = Self->IndexBuilds.at(BuildIndexId);
-
- if (!GotScheduledBilling(buildInfo)) {
- return true;
- }
-
- Bill(buildInfo, ScheduledAt, ctx.Now());
-
- AskToScheduleBilling(buildInfo);
-
- return true;
- }
-
- void DoComplete(const TActorContext&) override {
- }
-};
-
-struct TSchemeShard::TIndexBuilder::TTxReply: public TSchemeShard::TIndexBuilder::TTxBase {
-private:
- TEvTxAllocatorClient::TEvAllocateResult::TPtr AllocateResult;
- TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr ModifyResult;
- TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr Notification;
- TEvDataShard::TEvBuildIndexProgressResponse::TPtr ShardProgress;
- struct {
- TIndexBuildId BuildIndexId;
- TTabletId TabletId;
- explicit operator bool() const { return BuildIndexId && TabletId; }
- } PipeRetry;
-
-public:
- explicit TTxReply(TSelf* self, TEvTxAllocatorClient::TEvAllocateResult::TPtr& allocateResult)
- : TSchemeShard::TIndexBuilder::TTxBase(self)
- , AllocateResult(allocateResult)
- {
- }
-
- explicit TTxReply(TSelf* self, TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& modifyResult)
- : TSchemeShard::TIndexBuilder::TTxBase(self)
- , ModifyResult(modifyResult)
- {
- }
-
- explicit TTxReply(TSelf* self, TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& notification)
- : TSchemeShard::TIndexBuilder::TTxBase(self)
- , Notification(notification)
- {
- }
-
- explicit TTxReply(TSelf* self, TEvDataShard::TEvBuildIndexProgressResponse::TPtr& shardProgress)
- : TSchemeShard::TIndexBuilder::TTxBase(self)
- , ShardProgress(shardProgress)
- {
- }
-
- explicit TTxReply(TSelf* self, TIndexBuildId buildId, TTabletId tabletId)
- : TSchemeShard::TIndexBuilder::TTxBase(self)
- , PipeRetry({buildId, tabletId})
- {
- }
-
-
- TTxType GetTxType() const override {
- return TXTYPE_PROGRESS_INDEX_BUILD;
- }
-
- bool DoExecute(TTransactionContext& txc, const TActorContext& ctx) override {
- if (AllocateResult) {
- return OnAllocation(txc, ctx);
- } else if (ModifyResult) {
- return OnModifyResult(txc, ctx);
- } else if (Notification) {
- return OnNotification(txc, ctx);
- } else if (ShardProgress) {
- return OnProgress(txc, ctx);
- } else if (PipeRetry) {
- return OnPipeRetry(txc, ctx);
- }
-
- return true;
- }
-
- bool OnPipeRetry(TTransactionContext&, const TActorContext& ctx) {
- const auto& buildId = PipeRetry.BuildIndexId;
- const auto& tabletId = PipeRetry.TabletId;
- const auto& shardIdx = Self->GetShardIdx(tabletId);
-
- LOG_I("TTxReply : PipeRetry"
- << ", buildIndexId# " << buildId
- << ", tabletId# " << tabletId
- << ", shardIdx# " << shardIdx);
-
- if (!Self->IndexBuilds.contains(buildId)) {
- return true;
- }
-
- TIndexBuildInfo::TPtr buildInfo = Self->IndexBuilds.at(buildId);
-
- if (!buildInfo->Shards.contains(shardIdx)) {
- return true;
- }
-
- LOG_D("TTxReply : PipeRetry"
- << ", TIndexBuildInfo: " << *buildInfo);
-
- switch (buildInfo->State) {
- case TIndexBuildInfo::EState::Invalid:
- case TIndexBuildInfo::EState::Locking:
- case TIndexBuildInfo::EState::GatheringStatistics:
- case TIndexBuildInfo::EState::Initiating:
- Y_FAIL("Unreachable");
- case TIndexBuildInfo::EState::Filling:
- {
- // reschedule shard
- if (buildInfo->InProgressShards.contains(shardIdx)) {
- buildInfo->ToUploadShards.push_front(shardIdx);
- buildInfo->InProgressShards.erase(shardIdx);
-
- Self->IndexBuildPipes.Close(buildId, tabletId, ctx);
-
- // generate new message with actual LastKeyAck to continue scan
- Progress(buildId);
- }
- break;
- }
- case TIndexBuildInfo::EState::Applying:
- case TIndexBuildInfo::EState::Unlocking:
- case TIndexBuildInfo::EState::Done:
- Y_FAIL("Unreachable");
- case TIndexBuildInfo::EState::Cancellation_Applying:
- case TIndexBuildInfo::EState::Cancellation_Unlocking:
- case TIndexBuildInfo::EState::Cancelled:
- case TIndexBuildInfo::EState::Rejection_Applying:
- case TIndexBuildInfo::EState::Rejection_Unlocking:
- case TIndexBuildInfo::EState::Rejected:
- LOG_D("TTxReply : PipeRetry"
- << " superflous event"
- << ", buildIndexId# " << buildId
- << ", tabletId# " << tabletId
- << ", shardIdx# " << shardIdx);
- break;
- }
-
- return true;
- }
-
- bool OnProgress(TTransactionContext& txc, const TActorContext& ctx) {
- const NKikimrTxDataShard::TEvBuildIndexProgressResponse& record = ShardProgress->Get()->Record;
-
- LOG_I("TTxReply : TEvBuildIndexProgressResponse"
- << ", buildIndexId# " << record.GetBuildIndexId());
-
- const auto buildId = TIndexBuildId(record.GetBuildIndexId());
- if (!Self->IndexBuilds.contains(buildId)) {
- return true;
- }
-
- TIndexBuildInfo::TPtr buildInfo = Self->IndexBuilds.at(buildId);
- LOG_D("TTxReply : TEvBuildIndexProgressResponse"
- << ", TIndexBuildInfo: " << *buildInfo
- << ", record: " << record.ShortDebugString());
-
- TTabletId shardId = TTabletId(record.GetTabletId());
- if (!Self->TabletIdToShardIdx.contains(shardId)) {
- return true;
- }
-
- TShardIdx shardIdx = Self->TabletIdToShardIdx.at(shardId);
- if (!buildInfo->Shards.contains(shardIdx)) {
- return true;
- }
-
- switch (buildInfo->State) {
- case TIndexBuildInfo::EState::Invalid:
- case TIndexBuildInfo::EState::Locking:
- case TIndexBuildInfo::EState::GatheringStatistics:
- case TIndexBuildInfo::EState::Initiating:
- Y_FAIL("Unreachable");
- case TIndexBuildInfo::EState::Filling:
- {
- TIndexBuildInfo::TShardStatus& shardStatus = buildInfo->Shards.at(shardIdx);
-
- auto actualSeqNo = std::pair<ui64, ui64>(Self->Generation(), shardStatus.SeqNoRound);
- auto recordSeqNo = std::pair<ui64, ui64>(record.GetRequestSeqNoGeneration(), record.GetRequestSeqNoRound());
-
- if (actualSeqNo != recordSeqNo) {
- LOG_D("TTxReply : TEvBuildIndexProgressResponse"
- << " ignore progress message by seqNo"
- << ", TIndexBuildInfo: " << *buildInfo
- << ", actual seqNo for the shard " << shardId << " (" << shardIdx << ") is: " << Self->Generation() << ":" << shardStatus.SeqNoRound
- << ", record: " << record.ShortDebugString());
- Y_VERIFY(actualSeqNo > recordSeqNo);
- return true;
- }
-
- if (record.HasLastKeyAck()) {
- {
- //check that all LastKeyAcks are monotonously increase
- TTableInfo::TPtr tableInfo = Self->Tables.at(buildInfo->TablePathId);
- TVector<ui16> keyTypes;
- for (ui32 keyPos: tableInfo->KeyColumnIds) {
- keyTypes.push_back(tableInfo->Columns.at(keyPos).PType);
- }
-
- TSerializedCellVec last;
- last.Parse(shardStatus.LastKeyAck);
-
- TSerializedCellVec update;
- update.Parse(record.GetLastKeyAck());
-
- int cmp = CompareBorders<true, true>(last.GetCells(),
- update.GetCells(),
- true,
- true,
- keyTypes);
- Y_VERIFY_S(cmp < 0,
- "check that all LastKeyAcks are monotonously increase"
- << ", last: " << DebugPrintPoint(keyTypes, last.GetCells(), *AppData()->TypeRegistry)
- << ", update: " << DebugPrintPoint(keyTypes, update.GetCells(), *AppData()->TypeRegistry));
- }
-
- shardStatus.LastKeyAck = record.GetLastKeyAck();
- }
-
- if (record.HasRowsDelta() || record.HasBytesDelta()) {
- TBillingStats delta(record.GetRowsDelta(), record.GetBytesDelta());
- shardStatus.Processed += delta;
- buildInfo->Processed += delta;
- }
-
- shardStatus.Status = record.GetStatus();
- shardStatus.UploadStatus = record.GetUploadStatus();
- NYql::TIssues issues;
- NYql::IssuesFromMessage(record.GetIssues(), issues);
- shardStatus.DebugMessage = issues.ToString();
-
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexUploadProgress(db, buildInfo, shardIdx);
-
- switch (shardStatus.Status) {
- case NKikimrTxDataShard::TEvBuildIndexProgressResponse::INVALID:
- Y_FAIL("Unreachable");
-
- case NKikimrTxDataShard::TEvBuildIndexProgressResponse::ACCEPTED:
- case NKikimrTxDataShard::TEvBuildIndexProgressResponse::INPROGRESS:
- // no oop, wait resolution. Progress key are persisted
- break;
-
- case NKikimrTxDataShard::TEvBuildIndexProgressResponse::DONE:
- if (buildInfo->InProgressShards.contains(shardIdx)) {
- buildInfo->InProgressShards.erase(shardIdx);
- buildInfo->DoneShards.emplace(shardIdx);
-
- Self->IndexBuildPipes.Close(buildId, shardId, ctx);
-
- Progress(buildId);
- }
- break;
-
- case NKikimrTxDataShard::TEvBuildIndexProgressResponse::ABORTED:
- // datashard gracefully rebooted, reschedule shard
- if (buildInfo->InProgressShards.contains(shardIdx)) {
- buildInfo->ToUploadShards.push_front(shardIdx);
- buildInfo->InProgressShards.erase(shardIdx);
-
- Self->IndexBuildPipes.Close(buildId, shardId, ctx);
-
- Progress(buildId);
- }
- break;
-
- case NKikimrTxDataShard::TEvBuildIndexProgressResponse::BUILD_ERROR:
- buildInfo->Issue += TStringBuilder()
- << "One of the shards report BUILD_ERROR at Filling stage, procces has to be canceled"
- << ", shardId: " << shardId
- << ", shardIdx: " << shardIdx;
- Self->PersistBuildIndexIssue(db, buildInfo);
- ChangeState(buildInfo->Id, TIndexBuildInfo::EState::Rejection_Applying);
-
- Progress(buildId);
- break;
- case NKikimrTxDataShard::TEvBuildIndexProgressResponse::BAD_REQUEST:
- buildInfo->Issue += TStringBuilder()
- << "One of the shards report BAD_REQUEST at Filling stage, procces has to be canceled"
- << ", shardId: " << shardId
- << ", shardIdx: " << shardIdx;
- Self->PersistBuildIndexIssue(db, buildInfo);
- ChangeState(buildInfo->Id, TIndexBuildInfo::EState::Rejection_Applying);
-
- Progress(buildId);
- break;
- }
-
- break;
- }
- case TIndexBuildInfo::EState::Applying:
- case TIndexBuildInfo::EState::Unlocking:
- case TIndexBuildInfo::EState::Done:
- Y_FAIL("Unreachable");
- case TIndexBuildInfo::EState::Cancellation_Applying:
- case TIndexBuildInfo::EState::Cancellation_Unlocking:
- case TIndexBuildInfo::EState::Cancelled:
- case TIndexBuildInfo::EState::Rejection_Applying:
- case TIndexBuildInfo::EState::Rejection_Unlocking:
- case TIndexBuildInfo::EState::Rejected:
- LOG_D("TTxReply : TEvBuildIndexProgressResponse"
- << " superflous message " << record.ShortDebugString());
- break;
- }
-
- return true;
- }
-
- bool OnNotification(TTransactionContext& txc, const TActorContext&) {
- const auto& record = Notification->Get()->Record;
-
- const auto txId = TTxId(record.GetTxId());
- if (!Self->TxIdToIndexBuilds.contains(txId)) {
- LOG_I("TTxReply : TEvNotifyTxCompletionResult superflous message"
- << ", txId: " << record.GetTxId()
- << ", buildInfoId not found");
- return true;
- }
-
- const auto buildId = Self->TxIdToIndexBuilds.at(txId);
- Y_VERIFY(Self->IndexBuilds.contains(buildId));
-
- TIndexBuildInfo::TPtr buildInfo = Self->IndexBuilds.at(buildId);
- LOG_I("TTxReply : TEvNotifyTxCompletionResult"
- << ", txId# " << record.GetTxId()
- << ", buildInfoId: " << buildInfo->Id);
- LOG_D("TTxReply : TEvNotifyTxCompletionResult"
- << ", txId# " << record.GetTxId()
- << ", buildInfo: " << *buildInfo);
-
- switch (buildInfo->State) {
- case TIndexBuildInfo::EState::Invalid:
- Y_FAIL("Unreachable");
-
- case TIndexBuildInfo::EState::Locking:
- {
- Y_VERIFY(txId == buildInfo->LockTxId);
-
- buildInfo->LockTxDone = true;
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexLockTxDone(db, buildInfo);
-
- break;
- }
- case TIndexBuildInfo::EState::GatheringStatistics:
- Y_FAIL("Unreachable");
-
- case TIndexBuildInfo::EState::Initiating:
- {
- Y_VERIFY(txId == buildInfo->InitiateTxId);
-
- buildInfo->InitiateTxDone = true;
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexInitiateTxDone(db, buildInfo);
-
- break;
- }
- case TIndexBuildInfo::EState::Filling:
- Y_FAIL("Unreachable");
- case TIndexBuildInfo::EState::Applying:
- {
- Y_VERIFY(txId == buildInfo->ApplyTxId);
-
- buildInfo->ApplyTxDone = true;
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexApplyTxDone(db, buildInfo);
-
- break;
- }
- case TIndexBuildInfo::EState::Unlocking:
- {
- Y_VERIFY(txId == buildInfo->UnlockTxId);
-
- buildInfo->UnlockTxDone = true;
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexUnlockTxDone(db, buildInfo);
-
- break;
- }
- case TIndexBuildInfo::EState::Done:
- Y_FAIL("Unreachable");
- case TIndexBuildInfo::EState::Cancellation_Applying:
- {
- Y_VERIFY(txId == buildInfo->ApplyTxId);
-
- buildInfo->ApplyTxDone = true;
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexApplyTxDone(db, buildInfo);
-
- break;
- }
- case TIndexBuildInfo::EState::Cancellation_Unlocking:
- {
- Y_VERIFY(txId == buildInfo->UnlockTxId);
-
- buildInfo->UnlockTxDone = true;
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexUnlockTxDone(db, buildInfo);
-
- break;
- }
- case TIndexBuildInfo::EState::Cancelled:
- Y_FAIL("Unreachable");
-
- case TIndexBuildInfo::EState::Rejection_Applying:
- {
- Y_VERIFY(txId == buildInfo->ApplyTxId);
-
- buildInfo->ApplyTxDone = true;
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexApplyTxDone(db, buildInfo);
-
- break;
- }
- case TIndexBuildInfo::EState::Rejection_Unlocking:
- {
- Y_VERIFY(txId == buildInfo->UnlockTxId);
-
- buildInfo->UnlockTxDone = true;
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexUnlockTxDone(db, buildInfo);
-
- break;
- }
- case TIndexBuildInfo::EState::Rejected:
- Y_FAIL("Unreachable");
- }
-
- Progress(buildId);
-
- return true;
- }
-
- void ReplyOnCreation(const TIndexBuildInfo::TPtr buildInfo,
- const Ydb::StatusIds::StatusCode status = Ydb::StatusIds::SUCCESS)
- {
- auto responseEv = MakeHolder<TEvIndexBuilder::TEvCreateResponse>(ui64(buildInfo->Id));
-
- Fill(*responseEv->Record.MutableIndexBuild(), buildInfo);
-
- auto& response = responseEv->Record;
- response.SetStatus(status);
-
- if (buildInfo->Issue) {
- AddIssue(response.MutableIssues(), buildInfo->Issue);
- }
-
- LOG_N("TIndexBuilder::TTxReply: ReplyOnCreation"
- << ", BuildIndexId: " << buildInfo->Id
- << ", status: " << Ydb::StatusIds::StatusCode_Name(status)
- << ", error: " << buildInfo->Issue
- << ", replyTo: " << buildInfo->CreateSender.ToString());
- LOG_D("Message:\n" << responseEv->Record.ShortDebugString());
-
+ } else if (buildInfo->UnlockTxStatus == NKikimrScheme::StatusSuccess) {
+ Send(Self->SelfId(), UnlockPropose(Self, buildInfo), 0, ui64(BuildId));
+ } else if (!buildInfo->UnlockTxDone) {
+ Send(Self->SelfId(), MakeHolder<TEvSchemeShard::TEvNotifyTxCompletion>(ui64(buildInfo->UnlockTxId)));
+ } else {
+ ChangeState(BuildId, TIndexBuildInfo::EState::Rejected);
+ Progress(BuildId);
+ }
+ break;
+ case TIndexBuildInfo::EState::Rejected:
+ SendNotificationsIfFinished(buildInfo);
+ // stay calm keep status/issues
+ break;
+ }
+
+ return true;
+ }
+
+ void InitiateShards(NIceDb::TNiceDb& db, TIndexBuildInfo::TPtr& buildInfo) {
+ TTableInfo::TPtr table = Self->Tables.at(buildInfo->TablePathId);
+ for (const auto& x: table->GetPartitions()) {
+ Y_VERIFY(Self->ShardInfos.contains(x.ShardIdx));
+
+ buildInfo->Shards.emplace(x.ShardIdx, TIndexBuildInfo::TShardStatus());
+ Self->PersistBuildIndexUploadInitiate(db, buildInfo, x.ShardIdx);
+ }
+ }
+
+ void DoComplete(const TActorContext& ctx) override {
+ for (auto& x: ToTabletSend) {
+ Self->IndexBuildPipes.Create(BuildId, std::get<0>(x), std::move(std::get<2>(x)), ctx);
+ }
+ ToTabletSend.clear();
+ }
+};
+
+ITransaction* TSchemeShard::CreateTxProgress(TIndexBuildId id) {
+ return new TIndexBuilder::TTxProgress(this, id);
+}
+
+struct TSchemeShard::TIndexBuilder::TTxBilling: public TSchemeShard::TIndexBuilder::TTxBase {
+private:
+ TIndexBuildId BuildIndexId;
+ TInstant ScheduledAt;
+
+public:
+ explicit TTxBilling(TSelf* self, TEvPrivate::TEvIndexBuildingMakeABill::TPtr& ev)
+ : TSchemeShard::TIndexBuilder::TTxBase(self)
+ , BuildIndexId(ev->Get()->BuildId)
+ , ScheduledAt(ev->Get()->SendAt)
+ {
+ }
+
+ TTxType GetTxType() const override {
+ return TXTYPE_MAKEBILL_INDEX_BUILD;
+ }
+
+ bool DoExecute(TTransactionContext& , const TActorContext& ctx) override {
+ LOG_I("TTxReply : TTxBilling"
+ << ", buildIndexId# " << BuildIndexId);
+
+ if (!Self->IndexBuilds.contains(BuildIndexId)) {
+ return true;
+ }
+
+ TIndexBuildInfo::TPtr buildInfo = Self->IndexBuilds.at(BuildIndexId);
+
+ if (!GotScheduledBilling(buildInfo)) {
+ return true;
+ }
+
+ Bill(buildInfo, ScheduledAt, ctx.Now());
+
+ AskToScheduleBilling(buildInfo);
+
+ return true;
+ }
+
+ void DoComplete(const TActorContext&) override {
+ }
+};
+
+struct TSchemeShard::TIndexBuilder::TTxReply: public TSchemeShard::TIndexBuilder::TTxBase {
+private:
+ TEvTxAllocatorClient::TEvAllocateResult::TPtr AllocateResult;
+ TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr ModifyResult;
+ TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr Notification;
+ TEvDataShard::TEvBuildIndexProgressResponse::TPtr ShardProgress;
+ struct {
+ TIndexBuildId BuildIndexId;
+ TTabletId TabletId;
+ explicit operator bool() const { return BuildIndexId && TabletId; }
+ } PipeRetry;
+
+public:
+ explicit TTxReply(TSelf* self, TEvTxAllocatorClient::TEvAllocateResult::TPtr& allocateResult)
+ : TSchemeShard::TIndexBuilder::TTxBase(self)
+ , AllocateResult(allocateResult)
+ {
+ }
+
+ explicit TTxReply(TSelf* self, TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& modifyResult)
+ : TSchemeShard::TIndexBuilder::TTxBase(self)
+ , ModifyResult(modifyResult)
+ {
+ }
+
+ explicit TTxReply(TSelf* self, TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& notification)
+ : TSchemeShard::TIndexBuilder::TTxBase(self)
+ , Notification(notification)
+ {
+ }
+
+ explicit TTxReply(TSelf* self, TEvDataShard::TEvBuildIndexProgressResponse::TPtr& shardProgress)
+ : TSchemeShard::TIndexBuilder::TTxBase(self)
+ , ShardProgress(shardProgress)
+ {
+ }
+
+ explicit TTxReply(TSelf* self, TIndexBuildId buildId, TTabletId tabletId)
+ : TSchemeShard::TIndexBuilder::TTxBase(self)
+ , PipeRetry({buildId, tabletId})
+ {
+ }
+
+
+ TTxType GetTxType() const override {
+ return TXTYPE_PROGRESS_INDEX_BUILD;
+ }
+
+ bool DoExecute(TTransactionContext& txc, const TActorContext& ctx) override {
+ if (AllocateResult) {
+ return OnAllocation(txc, ctx);
+ } else if (ModifyResult) {
+ return OnModifyResult(txc, ctx);
+ } else if (Notification) {
+ return OnNotification(txc, ctx);
+ } else if (ShardProgress) {
+ return OnProgress(txc, ctx);
+ } else if (PipeRetry) {
+ return OnPipeRetry(txc, ctx);
+ }
+
+ return true;
+ }
+
+ bool OnPipeRetry(TTransactionContext&, const TActorContext& ctx) {
+ const auto& buildId = PipeRetry.BuildIndexId;
+ const auto& tabletId = PipeRetry.TabletId;
+ const auto& shardIdx = Self->GetShardIdx(tabletId);
+
+ LOG_I("TTxReply : PipeRetry"
+ << ", buildIndexId# " << buildId
+ << ", tabletId# " << tabletId
+ << ", shardIdx# " << shardIdx);
+
+ if (!Self->IndexBuilds.contains(buildId)) {
+ return true;
+ }
+
+ TIndexBuildInfo::TPtr buildInfo = Self->IndexBuilds.at(buildId);
+
+ if (!buildInfo->Shards.contains(shardIdx)) {
+ return true;
+ }
+
+ LOG_D("TTxReply : PipeRetry"
+ << ", TIndexBuildInfo: " << *buildInfo);
+
+ switch (buildInfo->State) {
+ case TIndexBuildInfo::EState::Invalid:
+ case TIndexBuildInfo::EState::Locking:
+ case TIndexBuildInfo::EState::GatheringStatistics:
+ case TIndexBuildInfo::EState::Initiating:
+ Y_FAIL("Unreachable");
+ case TIndexBuildInfo::EState::Filling:
+ {
+ // reschedule shard
+ if (buildInfo->InProgressShards.contains(shardIdx)) {
+ buildInfo->ToUploadShards.push_front(shardIdx);
+ buildInfo->InProgressShards.erase(shardIdx);
+
+ Self->IndexBuildPipes.Close(buildId, tabletId, ctx);
+
+ // generate new message with actual LastKeyAck to continue scan
+ Progress(buildId);
+ }
+ break;
+ }
+ case TIndexBuildInfo::EState::Applying:
+ case TIndexBuildInfo::EState::Unlocking:
+ case TIndexBuildInfo::EState::Done:
+ Y_FAIL("Unreachable");
+ case TIndexBuildInfo::EState::Cancellation_Applying:
+ case TIndexBuildInfo::EState::Cancellation_Unlocking:
+ case TIndexBuildInfo::EState::Cancelled:
+ case TIndexBuildInfo::EState::Rejection_Applying:
+ case TIndexBuildInfo::EState::Rejection_Unlocking:
+ case TIndexBuildInfo::EState::Rejected:
+ LOG_D("TTxReply : PipeRetry"
+ << " superflous event"
+ << ", buildIndexId# " << buildId
+ << ", tabletId# " << tabletId
+ << ", shardIdx# " << shardIdx);
+ break;
+ }
+
+ return true;
+ }
+
+ bool OnProgress(TTransactionContext& txc, const TActorContext& ctx) {
+ const NKikimrTxDataShard::TEvBuildIndexProgressResponse& record = ShardProgress->Get()->Record;
+
+ LOG_I("TTxReply : TEvBuildIndexProgressResponse"
+ << ", buildIndexId# " << record.GetBuildIndexId());
+
+ const auto buildId = TIndexBuildId(record.GetBuildIndexId());
+ if (!Self->IndexBuilds.contains(buildId)) {
+ return true;
+ }
+
+ TIndexBuildInfo::TPtr buildInfo = Self->IndexBuilds.at(buildId);
+ LOG_D("TTxReply : TEvBuildIndexProgressResponse"
+ << ", TIndexBuildInfo: " << *buildInfo
+ << ", record: " << record.ShortDebugString());
+
+ TTabletId shardId = TTabletId(record.GetTabletId());
+ if (!Self->TabletIdToShardIdx.contains(shardId)) {
+ return true;
+ }
+
+ TShardIdx shardIdx = Self->TabletIdToShardIdx.at(shardId);
+ if (!buildInfo->Shards.contains(shardIdx)) {
+ return true;
+ }
+
+ switch (buildInfo->State) {
+ case TIndexBuildInfo::EState::Invalid:
+ case TIndexBuildInfo::EState::Locking:
+ case TIndexBuildInfo::EState::GatheringStatistics:
+ case TIndexBuildInfo::EState::Initiating:
+ Y_FAIL("Unreachable");
+ case TIndexBuildInfo::EState::Filling:
+ {
+ TIndexBuildInfo::TShardStatus& shardStatus = buildInfo->Shards.at(shardIdx);
+
+ auto actualSeqNo = std::pair<ui64, ui64>(Self->Generation(), shardStatus.SeqNoRound);
+ auto recordSeqNo = std::pair<ui64, ui64>(record.GetRequestSeqNoGeneration(), record.GetRequestSeqNoRound());
+
+ if (actualSeqNo != recordSeqNo) {
+ LOG_D("TTxReply : TEvBuildIndexProgressResponse"
+ << " ignore progress message by seqNo"
+ << ", TIndexBuildInfo: " << *buildInfo
+ << ", actual seqNo for the shard " << shardId << " (" << shardIdx << ") is: " << Self->Generation() << ":" << shardStatus.SeqNoRound
+ << ", record: " << record.ShortDebugString());
+ Y_VERIFY(actualSeqNo > recordSeqNo);
+ return true;
+ }
+
+ if (record.HasLastKeyAck()) {
+ {
+ //check that all LastKeyAcks are monotonously increase
+ TTableInfo::TPtr tableInfo = Self->Tables.at(buildInfo->TablePathId);
+ TVector<ui16> keyTypes;
+ for (ui32 keyPos: tableInfo->KeyColumnIds) {
+ keyTypes.push_back(tableInfo->Columns.at(keyPos).PType);
+ }
+
+ TSerializedCellVec last;
+ last.Parse(shardStatus.LastKeyAck);
+
+ TSerializedCellVec update;
+ update.Parse(record.GetLastKeyAck());
+
+ int cmp = CompareBorders<true, true>(last.GetCells(),
+ update.GetCells(),
+ true,
+ true,
+ keyTypes);
+ Y_VERIFY_S(cmp < 0,
+ "check that all LastKeyAcks are monotonously increase"
+ << ", last: " << DebugPrintPoint(keyTypes, last.GetCells(), *AppData()->TypeRegistry)
+ << ", update: " << DebugPrintPoint(keyTypes, update.GetCells(), *AppData()->TypeRegistry));
+ }
+
+ shardStatus.LastKeyAck = record.GetLastKeyAck();
+ }
+
+ if (record.HasRowsDelta() || record.HasBytesDelta()) {
+ TBillingStats delta(record.GetRowsDelta(), record.GetBytesDelta());
+ shardStatus.Processed += delta;
+ buildInfo->Processed += delta;
+ }
+
+ shardStatus.Status = record.GetStatus();
+ shardStatus.UploadStatus = record.GetUploadStatus();
+ NYql::TIssues issues;
+ NYql::IssuesFromMessage(record.GetIssues(), issues);
+ shardStatus.DebugMessage = issues.ToString();
+
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexUploadProgress(db, buildInfo, shardIdx);
+
+ switch (shardStatus.Status) {
+ case NKikimrTxDataShard::TEvBuildIndexProgressResponse::INVALID:
+ Y_FAIL("Unreachable");
+
+ case NKikimrTxDataShard::TEvBuildIndexProgressResponse::ACCEPTED:
+ case NKikimrTxDataShard::TEvBuildIndexProgressResponse::INPROGRESS:
+ // no oop, wait resolution. Progress key are persisted
+ break;
+
+ case NKikimrTxDataShard::TEvBuildIndexProgressResponse::DONE:
+ if (buildInfo->InProgressShards.contains(shardIdx)) {
+ buildInfo->InProgressShards.erase(shardIdx);
+ buildInfo->DoneShards.emplace(shardIdx);
+
+ Self->IndexBuildPipes.Close(buildId, shardId, ctx);
+
+ Progress(buildId);
+ }
+ break;
+
+ case NKikimrTxDataShard::TEvBuildIndexProgressResponse::ABORTED:
+ // datashard gracefully rebooted, reschedule shard
+ if (buildInfo->InProgressShards.contains(shardIdx)) {
+ buildInfo->ToUploadShards.push_front(shardIdx);
+ buildInfo->InProgressShards.erase(shardIdx);
+
+ Self->IndexBuildPipes.Close(buildId, shardId, ctx);
+
+ Progress(buildId);
+ }
+ break;
+
+ case NKikimrTxDataShard::TEvBuildIndexProgressResponse::BUILD_ERROR:
+ buildInfo->Issue += TStringBuilder()
+ << "One of the shards report BUILD_ERROR at Filling stage, procces has to be canceled"
+ << ", shardId: " << shardId
+ << ", shardIdx: " << shardIdx;
+ Self->PersistBuildIndexIssue(db, buildInfo);
+ ChangeState(buildInfo->Id, TIndexBuildInfo::EState::Rejection_Applying);
+
+ Progress(buildId);
+ break;
+ case NKikimrTxDataShard::TEvBuildIndexProgressResponse::BAD_REQUEST:
+ buildInfo->Issue += TStringBuilder()
+ << "One of the shards report BAD_REQUEST at Filling stage, procces has to be canceled"
+ << ", shardId: " << shardId
+ << ", shardIdx: " << shardIdx;
+ Self->PersistBuildIndexIssue(db, buildInfo);
+ ChangeState(buildInfo->Id, TIndexBuildInfo::EState::Rejection_Applying);
+
+ Progress(buildId);
+ break;
+ }
+
+ break;
+ }
+ case TIndexBuildInfo::EState::Applying:
+ case TIndexBuildInfo::EState::Unlocking:
+ case TIndexBuildInfo::EState::Done:
+ Y_FAIL("Unreachable");
+ case TIndexBuildInfo::EState::Cancellation_Applying:
+ case TIndexBuildInfo::EState::Cancellation_Unlocking:
+ case TIndexBuildInfo::EState::Cancelled:
+ case TIndexBuildInfo::EState::Rejection_Applying:
+ case TIndexBuildInfo::EState::Rejection_Unlocking:
+ case TIndexBuildInfo::EState::Rejected:
+ LOG_D("TTxReply : TEvBuildIndexProgressResponse"
+ << " superflous message " << record.ShortDebugString());
+ break;
+ }
+
+ return true;
+ }
+
+ bool OnNotification(TTransactionContext& txc, const TActorContext&) {
+ const auto& record = Notification->Get()->Record;
+
+ const auto txId = TTxId(record.GetTxId());
+ if (!Self->TxIdToIndexBuilds.contains(txId)) {
+ LOG_I("TTxReply : TEvNotifyTxCompletionResult superflous message"
+ << ", txId: " << record.GetTxId()
+ << ", buildInfoId not found");
+ return true;
+ }
+
+ const auto buildId = Self->TxIdToIndexBuilds.at(txId);
+ Y_VERIFY(Self->IndexBuilds.contains(buildId));
+
+ TIndexBuildInfo::TPtr buildInfo = Self->IndexBuilds.at(buildId);
+ LOG_I("TTxReply : TEvNotifyTxCompletionResult"
+ << ", txId# " << record.GetTxId()
+ << ", buildInfoId: " << buildInfo->Id);
+ LOG_D("TTxReply : TEvNotifyTxCompletionResult"
+ << ", txId# " << record.GetTxId()
+ << ", buildInfo: " << *buildInfo);
+
+ switch (buildInfo->State) {
+ case TIndexBuildInfo::EState::Invalid:
+ Y_FAIL("Unreachable");
+
+ case TIndexBuildInfo::EState::Locking:
+ {
+ Y_VERIFY(txId == buildInfo->LockTxId);
+
+ buildInfo->LockTxDone = true;
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexLockTxDone(db, buildInfo);
+
+ break;
+ }
+ case TIndexBuildInfo::EState::GatheringStatistics:
+ Y_FAIL("Unreachable");
+
+ case TIndexBuildInfo::EState::Initiating:
+ {
+ Y_VERIFY(txId == buildInfo->InitiateTxId);
+
+ buildInfo->InitiateTxDone = true;
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexInitiateTxDone(db, buildInfo);
+
+ break;
+ }
+ case TIndexBuildInfo::EState::Filling:
+ Y_FAIL("Unreachable");
+ case TIndexBuildInfo::EState::Applying:
+ {
+ Y_VERIFY(txId == buildInfo->ApplyTxId);
+
+ buildInfo->ApplyTxDone = true;
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexApplyTxDone(db, buildInfo);
+
+ break;
+ }
+ case TIndexBuildInfo::EState::Unlocking:
+ {
+ Y_VERIFY(txId == buildInfo->UnlockTxId);
+
+ buildInfo->UnlockTxDone = true;
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexUnlockTxDone(db, buildInfo);
+
+ break;
+ }
+ case TIndexBuildInfo::EState::Done:
+ Y_FAIL("Unreachable");
+ case TIndexBuildInfo::EState::Cancellation_Applying:
+ {
+ Y_VERIFY(txId == buildInfo->ApplyTxId);
+
+ buildInfo->ApplyTxDone = true;
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexApplyTxDone(db, buildInfo);
+
+ break;
+ }
+ case TIndexBuildInfo::EState::Cancellation_Unlocking:
+ {
+ Y_VERIFY(txId == buildInfo->UnlockTxId);
+
+ buildInfo->UnlockTxDone = true;
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexUnlockTxDone(db, buildInfo);
+
+ break;
+ }
+ case TIndexBuildInfo::EState::Cancelled:
+ Y_FAIL("Unreachable");
+
+ case TIndexBuildInfo::EState::Rejection_Applying:
+ {
+ Y_VERIFY(txId == buildInfo->ApplyTxId);
+
+ buildInfo->ApplyTxDone = true;
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexApplyTxDone(db, buildInfo);
+
+ break;
+ }
+ case TIndexBuildInfo::EState::Rejection_Unlocking:
+ {
+ Y_VERIFY(txId == buildInfo->UnlockTxId);
+
+ buildInfo->UnlockTxDone = true;
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexUnlockTxDone(db, buildInfo);
+
+ break;
+ }
+ case TIndexBuildInfo::EState::Rejected:
+ Y_FAIL("Unreachable");
+ }
+
+ Progress(buildId);
+
+ return true;
+ }
+
+ void ReplyOnCreation(const TIndexBuildInfo::TPtr buildInfo,
+ const Ydb::StatusIds::StatusCode status = Ydb::StatusIds::SUCCESS)
+ {
+ auto responseEv = MakeHolder<TEvIndexBuilder::TEvCreateResponse>(ui64(buildInfo->Id));
+
+ Fill(*responseEv->Record.MutableIndexBuild(), buildInfo);
+
+ auto& response = responseEv->Record;
+ response.SetStatus(status);
+
+ if (buildInfo->Issue) {
+ AddIssue(response.MutableIssues(), buildInfo->Issue);
+ }
+
+ LOG_N("TIndexBuilder::TTxReply: ReplyOnCreation"
+ << ", BuildIndexId: " << buildInfo->Id
+ << ", status: " << Ydb::StatusIds::StatusCode_Name(status)
+ << ", error: " << buildInfo->Issue
+ << ", replyTo: " << buildInfo->CreateSender.ToString());
+ LOG_D("Message:\n" << responseEv->Record.ShortDebugString());
+
Send(buildInfo->CreateSender, std::move(responseEv), 0, buildInfo->SenderCookie);
- }
-
- bool OnModifyResult(TTransactionContext& txc, const TActorContext&) {
- const auto& record = ModifyResult->Get()->Record;
-
- const auto txId = TTxId(record.GetTxId());
- if (!Self->TxIdToIndexBuilds.contains(txId)) {
- LOG_I("TTxReply : TEvModifySchemeTransactionResult superflous message"
- << ", cookie: " << ModifyResult->Cookie
- << ", txId: " << record.GetTxId()
- << ", status: " << NKikimrScheme::EStatus_Name(record.GetStatus())
- << ", BuildIndexId not found");
- return true;
- }
-
- const auto buildId = Self->TxIdToIndexBuilds.at(txId);
- Y_VERIFY(Self->IndexBuilds.contains(buildId));
-
- LOG_I("TTxReply : TEvModifySchemeTransactionResult"
- << ", BuildIndexId: " << buildId
- << ", cookie: " << ModifyResult->Cookie
- << ", txId: " << record.GetTxId()
- << ", status: " << NKikimrScheme::EStatus_Name(record.GetStatus()));
-
- TIndexBuildInfo::TPtr buildInfo = Self->IndexBuilds.at(buildId);
- LOG_D("TTxReply : TEvModifySchemeTransactionResult"
- << ", buildInfo: " << *buildInfo
- << ", record: " << record.ShortDebugString());
-
- switch (buildInfo->State) {
- case TIndexBuildInfo::EState::Invalid:
- Y_FAIL("Unreachable");
-
- case TIndexBuildInfo::EState::Locking:
- {
- Y_VERIFY(txId == buildInfo->LockTxId);
-
- buildInfo->LockTxStatus = record.GetStatus();
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexLockTxStatus(db, buildInfo);
-
- auto statusCode = TranslateStatusCode(record.GetStatus());
-
- if (statusCode != Ydb::StatusIds::SUCCESS) {
- buildInfo->Issue += TStringBuilder()
- << "At locking state got unsuccess propose result"
- << ", status: " << NKikimrScheme::EStatus_Name(buildInfo->LockTxStatus)
- << ", reason: " << record.GetReason();
- Self->PersistBuildIndexIssue(db, buildInfo);
-
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexForget(db, buildInfo);
-
- EraseBuildInfo(buildInfo);
- }
-
- ReplyOnCreation(buildInfo, statusCode);
-
- break;
- }
- case TIndexBuildInfo::EState::GatheringStatistics:
- Y_FAIL("Unreachable");
-
- case TIndexBuildInfo::EState::Initiating:
- {
- Y_VERIFY(txId == buildInfo->InitiateTxId);
-
- buildInfo->InitiateTxStatus = record.GetStatus();
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexInitiateTxStatus(db, buildInfo);
-
- if (record.GetStatus() == NKikimrScheme::StatusAccepted) {
- // no op
- } else if (record.GetStatus() == NKikimrScheme::StatusAlreadyExists) {
- Y_FAIL("NEED MORE TESTING");
- // no op
- } else {
- buildInfo->Issue += TStringBuilder()
- << "At initiating state got unsuccess propose result"
- << ", status: " << NKikimrScheme::EStatus_Name(buildInfo->InitiateTxStatus)
- << ", reason: " << record.GetReason();
- Self->PersistBuildIndexIssue(db, buildInfo);
- ChangeState(buildInfo->Id, TIndexBuildInfo::EState::Rejection_Unlocking);
- }
-
- break;
- }
- case TIndexBuildInfo::EState::Filling:
- Y_FAIL("Unreachable");
-
- case TIndexBuildInfo::EState::Applying:
- {
- Y_VERIFY(txId == buildInfo->ApplyTxId);
-
- buildInfo->ApplyTxStatus = record.GetStatus();
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexApplyTxStatus(db, buildInfo);
-
- if (record.GetStatus() == NKikimrScheme::StatusAccepted) {
- // no op
- } else if (record.GetStatus() == NKikimrScheme::StatusAlreadyExists) {
- Y_FAIL("NEED MORE TESTING");
- // no op
- } else {
- buildInfo->Issue += TStringBuilder()
- << "At applying state got unsuccess propose result"
- << ", status: " << NKikimrScheme::EStatus_Name(buildInfo->InitiateTxStatus)
- << ", reason: " << record.GetReason();
- Self->PersistBuildIndexIssue(db, buildInfo);
- ChangeState(buildInfo->Id, TIndexBuildInfo::EState::Rejection_Unlocking);
- }
-
- break;
- }
- case TIndexBuildInfo::EState::Unlocking:
- {
- Y_VERIFY(txId == buildInfo->UnlockTxId);
-
- buildInfo->UnlockTxStatus = record.GetStatus();
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexUnlockTxStatus(db, buildInfo);
-
- if (record.GetStatus() == NKikimrScheme::StatusAccepted) {
- // no op
- } else if (record.GetStatus() == NKikimrScheme::StatusAlreadyExists) {
- // no op
- } else {
- buildInfo->Issue += TStringBuilder()
- << "At unlocking state got unsuccess propose result"
- << ", status: " << NKikimrScheme::EStatus_Name(buildInfo->InitiateTxStatus)
- << ", reason: " << record.GetReason();
- Self->PersistBuildIndexIssue(db, buildInfo);
- ChangeState(buildInfo->Id, TIndexBuildInfo::EState::Rejection_Unlocking);
- }
-
- break;
- }
- case TIndexBuildInfo::EState::Done:
- Y_FAIL("Unreachable");
-
- case TIndexBuildInfo::EState::Cancellation_Applying:
- {
- Y_VERIFY(txId == buildInfo->ApplyTxId);
-
- buildInfo->ApplyTxStatus = record.GetStatus();
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexApplyTxStatus(db, buildInfo);
-
- if (record.GetStatus() == NKikimrScheme::StatusAccepted) {
- // no op
- } else if (record.GetStatus() == NKikimrScheme::StatusAlreadyExists) {
- Y_FAIL("NEED MORE TESTING");
- // no op
- } else {
- buildInfo->Issue += TStringBuilder()
- << "At cancelation applying state got unsuccess propose result"
- << ", status: " << NKikimrScheme::EStatus_Name(buildInfo->InitiateTxStatus)
- << ", reason: " << record.GetReason();
- Self->PersistBuildIndexIssue(db, buildInfo);
- ChangeState(buildInfo->Id, TIndexBuildInfo::EState::Cancellation_Unlocking);
- }
-
- break;
- }
- case TIndexBuildInfo::EState::Cancellation_Unlocking:
- {
- Y_VERIFY(txId == buildInfo->UnlockTxId);
-
- buildInfo->UnlockTxStatus = record.GetStatus();
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexUnlockTxStatus(db, buildInfo);
-
- if (record.GetStatus() == NKikimrScheme::StatusAccepted) {
- // no op
- } else if (record.GetStatus() == NKikimrScheme::StatusAlreadyExists) {
- // no op
- } else {
- buildInfo->Issue += TStringBuilder()
- << "At cancelation unlocking state got unsuccess propose result"
- << ", status: " << NKikimrScheme::EStatus_Name(buildInfo->InitiateTxStatus)
- << ", reason: " << record.GetReason();
- Self->PersistBuildIndexIssue(db, buildInfo);
- ChangeState(buildInfo->Id, TIndexBuildInfo::EState::Cancelled);
- }
-
- break;
- }
- case TIndexBuildInfo::EState::Cancelled:
- Y_FAIL("Unreachable");
-
- case TIndexBuildInfo::EState::Rejection_Applying:
- {
- Y_VERIFY(txId == buildInfo->ApplyTxId);
-
- buildInfo->ApplyTxStatus = record.GetStatus();
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexApplyTxStatus(db, buildInfo);
-
- if (record.GetStatus() == NKikimrScheme::StatusAccepted) {
- // no op
- } else if (record.GetStatus() == NKikimrScheme::StatusAlreadyExists) {
- Y_FAIL("NEED MORE TESTING");
- // no op
- } else {
- buildInfo->Issue += TStringBuilder()
- << "At rejection_applying state got unsuccess propose result"
- << ", status: " << NKikimrScheme::EStatus_Name(buildInfo->InitiateTxStatus)
- << ", reason: " << record.GetReason();
- Self->PersistBuildIndexIssue(db, buildInfo);
- ChangeState(buildInfo->Id, TIndexBuildInfo::EState::Rejection_Unlocking);
- }
-
- break;
- }
- case TIndexBuildInfo::EState::Rejection_Unlocking:
- {
- Y_VERIFY(txId == buildInfo->UnlockTxId);
-
- buildInfo->UnlockTxStatus = record.GetStatus();
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexUnlockTxStatus(db, buildInfo);
-
- if (record.GetStatus() == NKikimrScheme::StatusAccepted) {
- // no op
- } else if (record.GetStatus() == NKikimrScheme::StatusAlreadyExists) {
- // no op
- } else {
- buildInfo->Issue += TStringBuilder()
- << "At rejection_unlockiing state got unsuccess propose result"
- << ", status: " << NKikimrScheme::EStatus_Name(buildInfo->InitiateTxStatus)
- << ", reason: " << record.GetReason();
- Self->PersistBuildIndexIssue(db, buildInfo);
- ChangeState(buildInfo->Id, TIndexBuildInfo::EState::Rejected);
- }
-
- break;
- }
- case TIndexBuildInfo::EState::Rejected:
- Y_FAIL("Unreachable");
- }
-
- Progress(buildId);
-
- return true;
- }
-
- bool OnAllocation(TTransactionContext& txc, const TActorContext&) {
- TIndexBuildId buildId = TIndexBuildId(AllocateResult->Cookie);
- const auto txId = TTxId(AllocateResult->Get()->TxIds.front());
-
- LOG_I("TTxReply : TEvAllocateResult"
- << ", BuildIndexId: " << buildId
- << ", txId# " << txId);
-
- Y_VERIFY(Self->IndexBuilds.contains(buildId));
- TIndexBuildInfo::TPtr buildInfo = Self->IndexBuilds.at(buildId);
-
- LOG_D("TTxReply : TEvAllocateResult"
- << ", buildInfo: " << *buildInfo);
-
- switch (buildInfo->State) {
- case TIndexBuildInfo::EState::Invalid:
- Y_FAIL("Unreachable");
-
- case TIndexBuildInfo::EState::Locking:
- if (!buildInfo->LockTxId) {
- buildInfo->LockTxId = txId;
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexLockTxId(db, buildInfo);
- }
- break;
-
- case TIndexBuildInfo::EState::GatheringStatistics:
- Y_FAIL("Unreachable");
-
- case TIndexBuildInfo::EState::Initiating:
- if (!buildInfo->InitiateTxId) {
- buildInfo->InitiateTxId = txId;
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexInitiateTxId(db, buildInfo);
- }
- break;
-
- case TIndexBuildInfo::EState::Filling:
- Y_FAIL("Unreachable");
-
- case TIndexBuildInfo::EState::Applying:
- if (!buildInfo->ApplyTxId) {
- buildInfo->ApplyTxId = txId;
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexApplyTxId(db, buildInfo);
- }
- break;
-
- case TIndexBuildInfo::EState::Unlocking:
- if (!buildInfo->UnlockTxId) {
- buildInfo->UnlockTxId = txId;
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexUnlockTxId(db, buildInfo);
- }
- break;
-
- case TIndexBuildInfo::EState::Done:
- Y_FAIL("Unreachable");
-
- case TIndexBuildInfo::EState::Cancellation_Applying:
- if (!buildInfo->ApplyTxId) {
- buildInfo->ApplyTxId = txId;
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexApplyTxId(db, buildInfo);
- }
- break;
-
- case TIndexBuildInfo::EState::Cancellation_Unlocking:
- if (!buildInfo->UnlockTxId) {
- buildInfo->UnlockTxId = txId;
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexUnlockTxId(db, buildInfo);
- }
- break;
-
- case TIndexBuildInfo::EState::Cancelled:
- Y_FAIL("Unreachable");
-
- case TIndexBuildInfo::EState::Rejection_Applying:
- if (!buildInfo->ApplyTxId) {
- buildInfo->ApplyTxId = txId;
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexApplyTxId(db, buildInfo);
- }
- break;
- case TIndexBuildInfo::EState::Rejection_Unlocking:
- if (!buildInfo->UnlockTxId) {
- buildInfo->UnlockTxId = txId;
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexUnlockTxId(db, buildInfo);
- }
- break;
-
- case TIndexBuildInfo::EState::Rejected:
- Y_FAIL("Unreachable");
- }
-
- Progress(buildId);
-
- return true;
- }
-
- void DoComplete(const TActorContext&) override {
- }
-};
-
-
-ITransaction* TSchemeShard::CreateTxReply(TEvTxAllocatorClient::TEvAllocateResult::TPtr& allocateResult) {
- return new TIndexBuilder::TTxReply(this, allocateResult);
-}
-
-ITransaction* TSchemeShard::CreateTxReply(TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& modifyResult) {
- return new TIndexBuilder::TTxReply(this, modifyResult);
-}
-
-ITransaction* TSchemeShard::CreateTxReply(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& notification) {
- return new TIndexBuilder::TTxReply(this, notification);
-}
-
-ITransaction* TSchemeShard::CreateTxReply(TEvDataShard::TEvBuildIndexProgressResponse::TPtr& progress) {
- return new TIndexBuilder::TTxReply(this, progress);
-}
-
-ITransaction* TSchemeShard::CreatePipeRetry(TIndexBuildId indexBuildId, TTabletId tabletId) {
- return new TIndexBuilder::TTxReply(this, indexBuildId, tabletId);
-}
-
-ITransaction* TSchemeShard::CreateTxBilling(TEvPrivate::TEvIndexBuildingMakeABill::TPtr& ev) {
- return new TIndexBuilder::TTxBilling(this, ev);
-}
-
-
-} // NSchemeShard
-} // NKikimr
+ }
+
+ bool OnModifyResult(TTransactionContext& txc, const TActorContext&) {
+ const auto& record = ModifyResult->Get()->Record;
+
+ const auto txId = TTxId(record.GetTxId());
+ if (!Self->TxIdToIndexBuilds.contains(txId)) {
+ LOG_I("TTxReply : TEvModifySchemeTransactionResult superflous message"
+ << ", cookie: " << ModifyResult->Cookie
+ << ", txId: " << record.GetTxId()
+ << ", status: " << NKikimrScheme::EStatus_Name(record.GetStatus())
+ << ", BuildIndexId not found");
+ return true;
+ }
+
+ const auto buildId = Self->TxIdToIndexBuilds.at(txId);
+ Y_VERIFY(Self->IndexBuilds.contains(buildId));
+
+ LOG_I("TTxReply : TEvModifySchemeTransactionResult"
+ << ", BuildIndexId: " << buildId
+ << ", cookie: " << ModifyResult->Cookie
+ << ", txId: " << record.GetTxId()
+ << ", status: " << NKikimrScheme::EStatus_Name(record.GetStatus()));
+
+ TIndexBuildInfo::TPtr buildInfo = Self->IndexBuilds.at(buildId);
+ LOG_D("TTxReply : TEvModifySchemeTransactionResult"
+ << ", buildInfo: " << *buildInfo
+ << ", record: " << record.ShortDebugString());
+
+ switch (buildInfo->State) {
+ case TIndexBuildInfo::EState::Invalid:
+ Y_FAIL("Unreachable");
+
+ case TIndexBuildInfo::EState::Locking:
+ {
+ Y_VERIFY(txId == buildInfo->LockTxId);
+
+ buildInfo->LockTxStatus = record.GetStatus();
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexLockTxStatus(db, buildInfo);
+
+ auto statusCode = TranslateStatusCode(record.GetStatus());
+
+ if (statusCode != Ydb::StatusIds::SUCCESS) {
+ buildInfo->Issue += TStringBuilder()
+ << "At locking state got unsuccess propose result"
+ << ", status: " << NKikimrScheme::EStatus_Name(buildInfo->LockTxStatus)
+ << ", reason: " << record.GetReason();
+ Self->PersistBuildIndexIssue(db, buildInfo);
+
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexForget(db, buildInfo);
+
+ EraseBuildInfo(buildInfo);
+ }
+
+ ReplyOnCreation(buildInfo, statusCode);
+
+ break;
+ }
+ case TIndexBuildInfo::EState::GatheringStatistics:
+ Y_FAIL("Unreachable");
+
+ case TIndexBuildInfo::EState::Initiating:
+ {
+ Y_VERIFY(txId == buildInfo->InitiateTxId);
+
+ buildInfo->InitiateTxStatus = record.GetStatus();
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexInitiateTxStatus(db, buildInfo);
+
+ if (record.GetStatus() == NKikimrScheme::StatusAccepted) {
+ // no op
+ } else if (record.GetStatus() == NKikimrScheme::StatusAlreadyExists) {
+ Y_FAIL("NEED MORE TESTING");
+ // no op
+ } else {
+ buildInfo->Issue += TStringBuilder()
+ << "At initiating state got unsuccess propose result"
+ << ", status: " << NKikimrScheme::EStatus_Name(buildInfo->InitiateTxStatus)
+ << ", reason: " << record.GetReason();
+ Self->PersistBuildIndexIssue(db, buildInfo);
+ ChangeState(buildInfo->Id, TIndexBuildInfo::EState::Rejection_Unlocking);
+ }
+
+ break;
+ }
+ case TIndexBuildInfo::EState::Filling:
+ Y_FAIL("Unreachable");
+
+ case TIndexBuildInfo::EState::Applying:
+ {
+ Y_VERIFY(txId == buildInfo->ApplyTxId);
+
+ buildInfo->ApplyTxStatus = record.GetStatus();
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexApplyTxStatus(db, buildInfo);
+
+ if (record.GetStatus() == NKikimrScheme::StatusAccepted) {
+ // no op
+ } else if (record.GetStatus() == NKikimrScheme::StatusAlreadyExists) {
+ Y_FAIL("NEED MORE TESTING");
+ // no op
+ } else {
+ buildInfo->Issue += TStringBuilder()
+ << "At applying state got unsuccess propose result"
+ << ", status: " << NKikimrScheme::EStatus_Name(buildInfo->InitiateTxStatus)
+ << ", reason: " << record.GetReason();
+ Self->PersistBuildIndexIssue(db, buildInfo);
+ ChangeState(buildInfo->Id, TIndexBuildInfo::EState::Rejection_Unlocking);
+ }
+
+ break;
+ }
+ case TIndexBuildInfo::EState::Unlocking:
+ {
+ Y_VERIFY(txId == buildInfo->UnlockTxId);
+
+ buildInfo->UnlockTxStatus = record.GetStatus();
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexUnlockTxStatus(db, buildInfo);
+
+ if (record.GetStatus() == NKikimrScheme::StatusAccepted) {
+ // no op
+ } else if (record.GetStatus() == NKikimrScheme::StatusAlreadyExists) {
+ // no op
+ } else {
+ buildInfo->Issue += TStringBuilder()
+ << "At unlocking state got unsuccess propose result"
+ << ", status: " << NKikimrScheme::EStatus_Name(buildInfo->InitiateTxStatus)
+ << ", reason: " << record.GetReason();
+ Self->PersistBuildIndexIssue(db, buildInfo);
+ ChangeState(buildInfo->Id, TIndexBuildInfo::EState::Rejection_Unlocking);
+ }
+
+ break;
+ }
+ case TIndexBuildInfo::EState::Done:
+ Y_FAIL("Unreachable");
+
+ case TIndexBuildInfo::EState::Cancellation_Applying:
+ {
+ Y_VERIFY(txId == buildInfo->ApplyTxId);
+
+ buildInfo->ApplyTxStatus = record.GetStatus();
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexApplyTxStatus(db, buildInfo);
+
+ if (record.GetStatus() == NKikimrScheme::StatusAccepted) {
+ // no op
+ } else if (record.GetStatus() == NKikimrScheme::StatusAlreadyExists) {
+ Y_FAIL("NEED MORE TESTING");
+ // no op
+ } else {
+ buildInfo->Issue += TStringBuilder()
+ << "At cancelation applying state got unsuccess propose result"
+ << ", status: " << NKikimrScheme::EStatus_Name(buildInfo->InitiateTxStatus)
+ << ", reason: " << record.GetReason();
+ Self->PersistBuildIndexIssue(db, buildInfo);
+ ChangeState(buildInfo->Id, TIndexBuildInfo::EState::Cancellation_Unlocking);
+ }
+
+ break;
+ }
+ case TIndexBuildInfo::EState::Cancellation_Unlocking:
+ {
+ Y_VERIFY(txId == buildInfo->UnlockTxId);
+
+ buildInfo->UnlockTxStatus = record.GetStatus();
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexUnlockTxStatus(db, buildInfo);
+
+ if (record.GetStatus() == NKikimrScheme::StatusAccepted) {
+ // no op
+ } else if (record.GetStatus() == NKikimrScheme::StatusAlreadyExists) {
+ // no op
+ } else {
+ buildInfo->Issue += TStringBuilder()
+ << "At cancelation unlocking state got unsuccess propose result"
+ << ", status: " << NKikimrScheme::EStatus_Name(buildInfo->InitiateTxStatus)
+ << ", reason: " << record.GetReason();
+ Self->PersistBuildIndexIssue(db, buildInfo);
+ ChangeState(buildInfo->Id, TIndexBuildInfo::EState::Cancelled);
+ }
+
+ break;
+ }
+ case TIndexBuildInfo::EState::Cancelled:
+ Y_FAIL("Unreachable");
+
+ case TIndexBuildInfo::EState::Rejection_Applying:
+ {
+ Y_VERIFY(txId == buildInfo->ApplyTxId);
+
+ buildInfo->ApplyTxStatus = record.GetStatus();
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexApplyTxStatus(db, buildInfo);
+
+ if (record.GetStatus() == NKikimrScheme::StatusAccepted) {
+ // no op
+ } else if (record.GetStatus() == NKikimrScheme::StatusAlreadyExists) {
+ Y_FAIL("NEED MORE TESTING");
+ // no op
+ } else {
+ buildInfo->Issue += TStringBuilder()
+ << "At rejection_applying state got unsuccess propose result"
+ << ", status: " << NKikimrScheme::EStatus_Name(buildInfo->InitiateTxStatus)
+ << ", reason: " << record.GetReason();
+ Self->PersistBuildIndexIssue(db, buildInfo);
+ ChangeState(buildInfo->Id, TIndexBuildInfo::EState::Rejection_Unlocking);
+ }
+
+ break;
+ }
+ case TIndexBuildInfo::EState::Rejection_Unlocking:
+ {
+ Y_VERIFY(txId == buildInfo->UnlockTxId);
+
+ buildInfo->UnlockTxStatus = record.GetStatus();
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexUnlockTxStatus(db, buildInfo);
+
+ if (record.GetStatus() == NKikimrScheme::StatusAccepted) {
+ // no op
+ } else if (record.GetStatus() == NKikimrScheme::StatusAlreadyExists) {
+ // no op
+ } else {
+ buildInfo->Issue += TStringBuilder()
+ << "At rejection_unlockiing state got unsuccess propose result"
+ << ", status: " << NKikimrScheme::EStatus_Name(buildInfo->InitiateTxStatus)
+ << ", reason: " << record.GetReason();
+ Self->PersistBuildIndexIssue(db, buildInfo);
+ ChangeState(buildInfo->Id, TIndexBuildInfo::EState::Rejected);
+ }
+
+ break;
+ }
+ case TIndexBuildInfo::EState::Rejected:
+ Y_FAIL("Unreachable");
+ }
+
+ Progress(buildId);
+
+ return true;
+ }
+
+ bool OnAllocation(TTransactionContext& txc, const TActorContext&) {
+ TIndexBuildId buildId = TIndexBuildId(AllocateResult->Cookie);
+ const auto txId = TTxId(AllocateResult->Get()->TxIds.front());
+
+ LOG_I("TTxReply : TEvAllocateResult"
+ << ", BuildIndexId: " << buildId
+ << ", txId# " << txId);
+
+ Y_VERIFY(Self->IndexBuilds.contains(buildId));
+ TIndexBuildInfo::TPtr buildInfo = Self->IndexBuilds.at(buildId);
+
+ LOG_D("TTxReply : TEvAllocateResult"
+ << ", buildInfo: " << *buildInfo);
+
+ switch (buildInfo->State) {
+ case TIndexBuildInfo::EState::Invalid:
+ Y_FAIL("Unreachable");
+
+ case TIndexBuildInfo::EState::Locking:
+ if (!buildInfo->LockTxId) {
+ buildInfo->LockTxId = txId;
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexLockTxId(db, buildInfo);
+ }
+ break;
+
+ case TIndexBuildInfo::EState::GatheringStatistics:
+ Y_FAIL("Unreachable");
+
+ case TIndexBuildInfo::EState::Initiating:
+ if (!buildInfo->InitiateTxId) {
+ buildInfo->InitiateTxId = txId;
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexInitiateTxId(db, buildInfo);
+ }
+ break;
+
+ case TIndexBuildInfo::EState::Filling:
+ Y_FAIL("Unreachable");
+
+ case TIndexBuildInfo::EState::Applying:
+ if (!buildInfo->ApplyTxId) {
+ buildInfo->ApplyTxId = txId;
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexApplyTxId(db, buildInfo);
+ }
+ break;
+
+ case TIndexBuildInfo::EState::Unlocking:
+ if (!buildInfo->UnlockTxId) {
+ buildInfo->UnlockTxId = txId;
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexUnlockTxId(db, buildInfo);
+ }
+ break;
+
+ case TIndexBuildInfo::EState::Done:
+ Y_FAIL("Unreachable");
+
+ case TIndexBuildInfo::EState::Cancellation_Applying:
+ if (!buildInfo->ApplyTxId) {
+ buildInfo->ApplyTxId = txId;
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexApplyTxId(db, buildInfo);
+ }
+ break;
+
+ case TIndexBuildInfo::EState::Cancellation_Unlocking:
+ if (!buildInfo->UnlockTxId) {
+ buildInfo->UnlockTxId = txId;
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexUnlockTxId(db, buildInfo);
+ }
+ break;
+
+ case TIndexBuildInfo::EState::Cancelled:
+ Y_FAIL("Unreachable");
+
+ case TIndexBuildInfo::EState::Rejection_Applying:
+ if (!buildInfo->ApplyTxId) {
+ buildInfo->ApplyTxId = txId;
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexApplyTxId(db, buildInfo);
+ }
+ break;
+ case TIndexBuildInfo::EState::Rejection_Unlocking:
+ if (!buildInfo->UnlockTxId) {
+ buildInfo->UnlockTxId = txId;
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexUnlockTxId(db, buildInfo);
+ }
+ break;
+
+ case TIndexBuildInfo::EState::Rejected:
+ Y_FAIL("Unreachable");
+ }
+
+ Progress(buildId);
+
+ return true;
+ }
+
+ void DoComplete(const TActorContext&) override {
+ }
+};
+
+
+ITransaction* TSchemeShard::CreateTxReply(TEvTxAllocatorClient::TEvAllocateResult::TPtr& allocateResult) {
+ return new TIndexBuilder::TTxReply(this, allocateResult);
+}
+
+ITransaction* TSchemeShard::CreateTxReply(TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& modifyResult) {
+ return new TIndexBuilder::TTxReply(this, modifyResult);
+}
+
+ITransaction* TSchemeShard::CreateTxReply(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& notification) {
+ return new TIndexBuilder::TTxReply(this, notification);
+}
+
+ITransaction* TSchemeShard::CreateTxReply(TEvDataShard::TEvBuildIndexProgressResponse::TPtr& progress) {
+ return new TIndexBuilder::TTxReply(this, progress);
+}
+
+ITransaction* TSchemeShard::CreatePipeRetry(TIndexBuildId indexBuildId, TTabletId tabletId) {
+ return new TIndexBuilder::TTxReply(this, indexBuildId, tabletId);
+}
+
+ITransaction* TSchemeShard::CreateTxBilling(TEvPrivate::TEvIndexBuildingMakeABill::TPtr& ev) {
+ return new TIndexBuilder::TTxBilling(this, ev);
+}
+
+
+} // NSchemeShard
+} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_build_index_helpers.h b/ydb/core/tx/schemeshard/schemeshard_build_index_helpers.h
index 87ee55ddf43..4d8fea7309a 100644
--- a/ydb/core/tx/schemeshard/schemeshard_build_index_helpers.h
+++ b/ydb/core/tx/schemeshard/schemeshard_build_index_helpers.h
@@ -1,20 +1,20 @@
-#pragma once
-
+#pragma once
+
#include <ydb/library/yql/public/issue/protos/issue_severity.pb.h>
-
-#if defined LOG_T || \
- defined LOG_D || \
- defined LOG_I || \
- defined LOG_N || \
- defined LOG_W || \
- defined LOG_E
-# error log macro redefinition
-#endif
-
-#define LOG_T(stream) LOG_TRACE_S((TlsActivationContext->AsActorContext()), NKikimrServices::BUILD_INDEX, stream)
-#define LOG_D(stream) LOG_DEBUG_S((TlsActivationContext->AsActorContext()), NKikimrServices::BUILD_INDEX, stream)
-#define LOG_I(stream) LOG_INFO_S((TlsActivationContext->AsActorContext()), NKikimrServices::BUILD_INDEX, stream)
-#define LOG_N(stream) LOG_NOTICE_S((TlsActivationContext->AsActorContext()), NKikimrServices::BUILD_INDEX, stream)
-#define LOG_W(stream) LOG_WARN_S((TlsActivationContext->AsActorContext()), NKikimrServices::BUILD_INDEX, stream)
-#define LOG_E(stream) LOG_ERROR_S((TlsActivationContext->AsActorContext()), NKikimrServices::BUILD_INDEX, stream)
-
+
+#if defined LOG_T || \
+ defined LOG_D || \
+ defined LOG_I || \
+ defined LOG_N || \
+ defined LOG_W || \
+ defined LOG_E
+# error log macro redefinition
+#endif
+
+#define LOG_T(stream) LOG_TRACE_S((TlsActivationContext->AsActorContext()), NKikimrServices::BUILD_INDEX, stream)
+#define LOG_D(stream) LOG_DEBUG_S((TlsActivationContext->AsActorContext()), NKikimrServices::BUILD_INDEX, stream)
+#define LOG_I(stream) LOG_INFO_S((TlsActivationContext->AsActorContext()), NKikimrServices::BUILD_INDEX, stream)
+#define LOG_N(stream) LOG_NOTICE_S((TlsActivationContext->AsActorContext()), NKikimrServices::BUILD_INDEX, stream)
+#define LOG_W(stream) LOG_WARN_S((TlsActivationContext->AsActorContext()), NKikimrServices::BUILD_INDEX, stream)
+#define LOG_E(stream) LOG_ERROR_S((TlsActivationContext->AsActorContext()), NKikimrServices::BUILD_INDEX, stream)
+
diff --git a/ydb/core/tx/schemeshard/schemeshard_build_index_tx_base.h b/ydb/core/tx/schemeshard/schemeshard_build_index_tx_base.h
index 7d8097018ad..f2e4d9e56bd 100644
--- a/ydb/core/tx/schemeshard/schemeshard_build_index_tx_base.h
+++ b/ydb/core/tx/schemeshard/schemeshard_build_index_tx_base.h
@@ -1,164 +1,164 @@
-#pragma once
-
-#include "schemeshard_impl.h"
-#include "schemeshard_identificators.h"
+#pragma once
+
+#include "schemeshard_impl.h"
+#include "schemeshard_identificators.h"
#include "schemeshard_billing_helpers.h"
-#include "schemeshard_build_index_helpers.h"
-
-#include "schemeshard__operation_part.h" // TSideEffects, make separate file
-
+#include "schemeshard_build_index_helpers.h"
+
+#include "schemeshard__operation_part.h" // TSideEffects, make separate file
+
#include <ydb/core/metering/metering.h>
#include <ydb/core/tablet_flat/tablet_flat_executor.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-class TSchemeShard::TIndexBuilder::TTxBase: public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
-private:
- TSideEffects SideEffects;
-
- using TChangeStateRec = std::tuple<TIndexBuildId, TIndexBuildInfo::EState>;
- TDeque<TChangeStateRec> StateChanges;
- using TBillingEventSchedule = std::tuple<TIndexBuildId, TDuration>;
- TDeque<TBillingEventSchedule> ToScheduleBilling;
- using TToBill = std::tuple<TIndexBuildId, TInstant, TInstant>;
- TDeque<TToBill> ToBill;
-
- void ApplyState(NTabletFlatExecutor::TTransactionContext& txc) {
- for (auto& rec: StateChanges) {
- TIndexBuildId buildId;
- TIndexBuildInfo::EState state;
- std::tie(buildId, state) = rec;
-
- Y_VERIFY_S(Self->IndexBuilds.contains(buildId), "IndexBuilds has no " << buildId);
- auto buildInfo = Self->IndexBuilds.at(buildId);
- LOG_I("Change state from " << buildInfo->State << " to " << state);
- buildInfo->State = state;
-
- NIceDb::TNiceDb db(txc.DB);
- Self->PersistBuildIndexState(db, buildInfo);
- }
- }
-
- void ApplyOnExecute(NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx) {
- SideEffects.ApplyOnExecute(Self, txc, ctx);
- ApplyState(txc);
- ApplyBill(txc, ctx);
- }
-
- void ApplyOnComlete(const TActorContext& ctx) {
- SideEffects.ApplyOnComplete(Self, ctx);
- ApplySchedule(ctx);
- }
-
- void ApplySchedule(const TActorContext& ctx) {
- for (const auto& rec: ToScheduleBilling) {
- ctx.Schedule(
- std::get<1>(rec),
- new TEvPrivate::TEvIndexBuildingMakeABill(
- ui64(std::get<0>(rec)),
- ctx.Now()));
- }
- }
-
- ui64 RequestUnits(const TBillingStats& stats) {
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+class TSchemeShard::TIndexBuilder::TTxBase: public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
+private:
+ TSideEffects SideEffects;
+
+ using TChangeStateRec = std::tuple<TIndexBuildId, TIndexBuildInfo::EState>;
+ TDeque<TChangeStateRec> StateChanges;
+ using TBillingEventSchedule = std::tuple<TIndexBuildId, TDuration>;
+ TDeque<TBillingEventSchedule> ToScheduleBilling;
+ using TToBill = std::tuple<TIndexBuildId, TInstant, TInstant>;
+ TDeque<TToBill> ToBill;
+
+ void ApplyState(NTabletFlatExecutor::TTransactionContext& txc) {
+ for (auto& rec: StateChanges) {
+ TIndexBuildId buildId;
+ TIndexBuildInfo::EState state;
+ std::tie(buildId, state) = rec;
+
+ Y_VERIFY_S(Self->IndexBuilds.contains(buildId), "IndexBuilds has no " << buildId);
+ auto buildInfo = Self->IndexBuilds.at(buildId);
+ LOG_I("Change state from " << buildInfo->State << " to " << state);
+ buildInfo->State = state;
+
+ NIceDb::TNiceDb db(txc.DB);
+ Self->PersistBuildIndexState(db, buildInfo);
+ }
+ }
+
+ void ApplyOnExecute(NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx) {
+ SideEffects.ApplyOnExecute(Self, txc, ctx);
+ ApplyState(txc);
+ ApplyBill(txc, ctx);
+ }
+
+ void ApplyOnComlete(const TActorContext& ctx) {
+ SideEffects.ApplyOnComplete(Self, ctx);
+ ApplySchedule(ctx);
+ }
+
+ void ApplySchedule(const TActorContext& ctx) {
+ for (const auto& rec: ToScheduleBilling) {
+ ctx.Schedule(
+ std::get<1>(rec),
+ new TEvPrivate::TEvIndexBuildingMakeABill(
+ ui64(std::get<0>(rec)),
+ ctx.Now()));
+ }
+ }
+
+ ui64 RequestUnits(const TBillingStats& stats) {
return TRUCalculator::ReadTable(stats.GetBytes())
+ TRUCalculator::BulkUpsert(stats.GetBytes(), stats.GetRows());
- }
-
- void RoundPeriod(TInstant& start, TInstant& end) {
- if (start.Hours() == end.Hours()) {
- return; // that is OK
- }
-
- TInstant hourEnd = TInstant::Hours(end.Hours());
-
- if (end - hourEnd >= TDuration::Seconds(1)) {
- start = hourEnd;
- return;
- }
-
- if (hourEnd - start >= TDuration::Seconds(2)) {
- end = hourEnd - TDuration::Seconds(1);
- return;
- }
-
- start = hourEnd - TDuration::Seconds(2);
- end = hourEnd - TDuration::Seconds(1);
- }
-
- void ApplyBill(NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx)
- {
- for (const auto& rec: ToBill) {
- const auto& buildId = std::get<0>(rec);
- auto startPeriod = std::get<1>(rec);
- auto endPeriod = std::get<2>(rec);
-
- if (!startPeriod && !endPeriod) {
- startPeriod = endPeriod = ctx.Now();
- }
-
- RoundPeriod(startPeriod, endPeriod);
-
- Y_VERIFY_S(Self->IndexBuilds.contains(buildId), "IndexBuilds has no " << buildId);
- auto buildInfo = Self->IndexBuilds.at(buildId);
-
- TBillingStats toBill = buildInfo->Processed - buildInfo->Billed;
- if (!toBill) {
- continue;
- }
-
- TPath domain = TPath::Init(buildInfo->DomainPathId, Self);
- TPathElement::TPtr pathEl = domain.Base();
-
- TString cloud_id;
- if (pathEl->UserAttrs->Attrs.contains("cloud_id")) {
- cloud_id = pathEl->UserAttrs->Attrs.at("cloud_id");
- }
- TString folder_id;
- if (pathEl->UserAttrs->Attrs.contains("folder_id")) {
- folder_id = pathEl->UserAttrs->Attrs.at("folder_id");
- }
- TString database_id;
- if (pathEl->UserAttrs->Attrs.contains("database_id")) {
- database_id = pathEl->UserAttrs->Attrs.at("database_id");
- }
-
- if (!cloud_id || !folder_id || !database_id) {
- LOG_N("ApplyBill: unable to make a bill, neither cloud_id and nor folder_id nor database_id have found in user attrubutes at the domain"
- << ", build index operation: " << buildId
- << ", domain: " << domain.PathString()
- << ", domainId: " << buildInfo->DomainPathId
- << ", tableId: " << buildInfo->TablePathId
- << ", not billed usage: " << toBill);
- continue;
- }
-
+ }
+
+ void RoundPeriod(TInstant& start, TInstant& end) {
+ if (start.Hours() == end.Hours()) {
+ return; // that is OK
+ }
+
+ TInstant hourEnd = TInstant::Hours(end.Hours());
+
+ if (end - hourEnd >= TDuration::Seconds(1)) {
+ start = hourEnd;
+ return;
+ }
+
+ if (hourEnd - start >= TDuration::Seconds(2)) {
+ end = hourEnd - TDuration::Seconds(1);
+ return;
+ }
+
+ start = hourEnd - TDuration::Seconds(2);
+ end = hourEnd - TDuration::Seconds(1);
+ }
+
+ void ApplyBill(NTabletFlatExecutor::TTransactionContext& txc, const TActorContext& ctx)
+ {
+ for (const auto& rec: ToBill) {
+ const auto& buildId = std::get<0>(rec);
+ auto startPeriod = std::get<1>(rec);
+ auto endPeriod = std::get<2>(rec);
+
+ if (!startPeriod && !endPeriod) {
+ startPeriod = endPeriod = ctx.Now();
+ }
+
+ RoundPeriod(startPeriod, endPeriod);
+
+ Y_VERIFY_S(Self->IndexBuilds.contains(buildId), "IndexBuilds has no " << buildId);
+ auto buildInfo = Self->IndexBuilds.at(buildId);
+
+ TBillingStats toBill = buildInfo->Processed - buildInfo->Billed;
+ if (!toBill) {
+ continue;
+ }
+
+ TPath domain = TPath::Init(buildInfo->DomainPathId, Self);
+ TPathElement::TPtr pathEl = domain.Base();
+
+ TString cloud_id;
+ if (pathEl->UserAttrs->Attrs.contains("cloud_id")) {
+ cloud_id = pathEl->UserAttrs->Attrs.at("cloud_id");
+ }
+ TString folder_id;
+ if (pathEl->UserAttrs->Attrs.contains("folder_id")) {
+ folder_id = pathEl->UserAttrs->Attrs.at("folder_id");
+ }
+ TString database_id;
+ if (pathEl->UserAttrs->Attrs.contains("database_id")) {
+ database_id = pathEl->UserAttrs->Attrs.at("database_id");
+ }
+
+ if (!cloud_id || !folder_id || !database_id) {
+ LOG_N("ApplyBill: unable to make a bill, neither cloud_id and nor folder_id nor database_id have found in user attrubutes at the domain"
+ << ", build index operation: " << buildId
+ << ", domain: " << domain.PathString()
+ << ", domainId: " << buildInfo->DomainPathId
+ << ", tableId: " << buildInfo->TablePathId
+ << ", not billed usage: " << toBill);
+ continue;
+ }
+
if (!Self->IsServerlessDomain(domain)) {
- LOG_N("ApplyBill: unable to make a bill, domain is not a serverless db"
- << ", build index operation: " << buildId
- << ", domain: " << domain.PathString()
- << ", domainId: " << buildInfo->DomainPathId
+ LOG_N("ApplyBill: unable to make a bill, domain is not a serverless db"
+ << ", build index operation: " << buildId
+ << ", domain: " << domain.PathString()
+ << ", domainId: " << buildInfo->DomainPathId
<< ", IsDomainSchemeShard: " << Self->IsDomainSchemeShard
<< ", ParentDomainId: " << Self->ParentDomainId
<< ", ResourcesDomainId: " << domain.DomainInfo()->GetResourcesDomainId()
- << ", not billed usage: " << toBill);
- continue;
- }
-
- NIceDb::TNiceDb db(txc.DB);
-
- buildInfo->Billed += toBill;
- Self->PersistBuildIndexBilling(db, buildInfo);
-
- ui64 requestUnits = RequestUnits(toBill);
-
- TString id = TStringBuilder()
- << buildId << "-"
- << buildInfo->TablePathId.OwnerId << "-" << buildInfo->TablePathId.LocalPathId << "-"
- << buildInfo->Billed.GetRows() << "-" << buildInfo->Billed.GetBytes() << "-"
- << buildInfo->Processed.GetRows() << "-" << buildInfo->Processed.GetBytes();
-
+ << ", not billed usage: " << toBill);
+ continue;
+ }
+
+ NIceDb::TNiceDb db(txc.DB);
+
+ buildInfo->Billed += toBill;
+ Self->PersistBuildIndexBilling(db, buildInfo);
+
+ ui64 requestUnits = RequestUnits(toBill);
+
+ TString id = TStringBuilder()
+ << buildId << "-"
+ << buildInfo->TablePathId.OwnerId << "-" << buildInfo->TablePathId.LocalPathId << "-"
+ << buildInfo->Billed.GetRows() << "-" << buildInfo->Billed.GetBytes() << "-"
+ << buildInfo->Processed.GetRows() << "-" << buildInfo->Processed.GetBytes();
+
const TString billRecord = TBillRecord()
.Id(id)
.CloudId(cloud_id)
@@ -167,105 +167,105 @@ private:
.SourceWt(ctx.Now())
.Usage(TBillRecord::RequestUnits(requestUnits, startPeriod, endPeriod))
.ToString();
-
- LOG_D("ApplyBill: made a bill"
- << ", buildInfo: " << *buildInfo
- << ", record: '" << billRecord << "'");
-
- auto request = MakeHolder<NMetering::TEvMetering::TEvWriteMeteringJson>(std::move(billRecord));
- // send message at Complete stage
- Send(NMetering::MakeMeteringServiceID(), std::move(request));
- }
- }
-
-protected:
+
+ LOG_D("ApplyBill: made a bill"
+ << ", buildInfo: " << *buildInfo
+ << ", record: '" << billRecord << "'");
+
+ auto request = MakeHolder<NMetering::TEvMetering::TEvWriteMeteringJson>(std::move(billRecord));
+ // send message at Complete stage
+ Send(NMetering::MakeMeteringServiceID(), std::move(request));
+ }
+ }
+
+protected:
void Send(TActorId dst, THolder<IEventBase> message, ui32 flags = 0, ui64 cookie = 0) {
- SideEffects.Send(dst, message.Release(), cookie, flags);
- }
-
- void ChangeState(TIndexBuildId id, TIndexBuildInfo::EState state) {
- StateChanges.push_back(TChangeStateRec(id, state));
- }
-
- void Progress(TIndexBuildId id) {
- SideEffects.ToProgress(id);
- }
-
- void Fill(NKikimrIndexBuilder::TIndexBuild& index, const TIndexBuildInfo::TPtr indexInfo) {
- index.SetId(ui64(indexInfo->Id));
- if (indexInfo->Issue) {
- AddIssue(index.MutableIssues(), indexInfo->Issue);
- }
-
- for (const auto& item: indexInfo->Shards) {
- const TShardIdx& shardIdx = item.first;
- const TIndexBuildInfo::TShardStatus& status = item.second;
-
+ SideEffects.Send(dst, message.Release(), cookie, flags);
+ }
+
+ void ChangeState(TIndexBuildId id, TIndexBuildInfo::EState state) {
+ StateChanges.push_back(TChangeStateRec(id, state));
+ }
+
+ void Progress(TIndexBuildId id) {
+ SideEffects.ToProgress(id);
+ }
+
+ void Fill(NKikimrIndexBuilder::TIndexBuild& index, const TIndexBuildInfo::TPtr indexInfo) {
+ index.SetId(ui64(indexInfo->Id));
+ if (indexInfo->Issue) {
+ AddIssue(index.MutableIssues(), indexInfo->Issue);
+ }
+
+ for (const auto& item: indexInfo->Shards) {
+ const TShardIdx& shardIdx = item.first;
+ const TIndexBuildInfo::TShardStatus& status = item.second;
+
if (status.Status != NKikimrTxDataShard::TEvBuildIndexProgressResponse::INPROGRESS) {
if (status.UploadStatus != Ydb::StatusIds::SUCCESS) {
if (status.DebugMessage) {
AddIssue(index.MutableIssues(), status.ToString(shardIdx));
}
}
- }
- }
-
- switch (indexInfo->State) {
- case TIndexBuildInfo::EState::Locking:
- case TIndexBuildInfo::EState::GatheringStatistics:
- case TIndexBuildInfo::EState::Initiating:
+ }
+ }
+
+ switch (indexInfo->State) {
+ case TIndexBuildInfo::EState::Locking:
+ case TIndexBuildInfo::EState::GatheringStatistics:
+ case TIndexBuildInfo::EState::Initiating:
index.SetState(Ydb::Table::IndexBuildState::STATE_PREPARING);
index.SetProgress(0.0);
- break;
- case TIndexBuildInfo::EState::Filling:
+ break;
+ case TIndexBuildInfo::EState::Filling:
index.SetState(Ydb::Table::IndexBuildState::STATE_TRANSFERING_DATA);
index.SetProgress(indexInfo->CalcProgressPercent());
- break;
- case TIndexBuildInfo::EState::Applying:
- case TIndexBuildInfo::EState::Unlocking:
+ break;
+ case TIndexBuildInfo::EState::Applying:
+ case TIndexBuildInfo::EState::Unlocking:
index.SetState(Ydb::Table::IndexBuildState::STATE_APPLYING);
index.SetProgress(100.0);
- break;
- case TIndexBuildInfo::EState::Done:
+ break;
+ case TIndexBuildInfo::EState::Done:
index.SetState(Ydb::Table::IndexBuildState::STATE_DONE);
index.SetProgress(100.0);
- break;
- case TIndexBuildInfo::EState::Cancellation_Applying:
- case TIndexBuildInfo::EState::Cancellation_Unlocking:
+ break;
+ case TIndexBuildInfo::EState::Cancellation_Applying:
+ case TIndexBuildInfo::EState::Cancellation_Unlocking:
index.SetState(Ydb::Table::IndexBuildState::STATE_CANCELLATION);
index.SetProgress(0.0);
- break;
- case TIndexBuildInfo::EState::Cancelled:
+ break;
+ case TIndexBuildInfo::EState::Cancelled:
index.SetState(Ydb::Table::IndexBuildState::STATE_CANCELLED);
index.SetProgress(0.0);
- break;
- case TIndexBuildInfo::EState::Rejection_Applying:
- index.SetState(Ydb::Table::IndexBuildState::STATE_REJECTION);
- index.SetProgress(0.0);
- break;
- case TIndexBuildInfo::EState::Rejection_Unlocking:
- index.SetState(Ydb::Table::IndexBuildState::STATE_REJECTION);
+ break;
+ case TIndexBuildInfo::EState::Rejection_Applying:
+ index.SetState(Ydb::Table::IndexBuildState::STATE_REJECTION);
+ index.SetProgress(0.0);
+ break;
+ case TIndexBuildInfo::EState::Rejection_Unlocking:
+ index.SetState(Ydb::Table::IndexBuildState::STATE_REJECTION);
index.SetProgress(0.0);
- break;
- case TIndexBuildInfo::EState::Rejected:
- index.SetState(Ydb::Table::IndexBuildState::STATE_REJECTED);
+ break;
+ case TIndexBuildInfo::EState::Rejected:
+ index.SetState(Ydb::Table::IndexBuildState::STATE_REJECTED);
index.SetProgress(0.0);
- break;
- case TIndexBuildInfo::EState::Invalid:
+ break;
+ case TIndexBuildInfo::EState::Invalid:
index.SetState(Ydb::Table::IndexBuildState::STATE_UNSPECIFIED);
- break;
- }
-
- Fill(*index.MutableSettings(), indexInfo);
- }
-
- void Fill(NKikimrIndexBuilder::TIndexBuildSettings& settings, const TIndexBuildInfo::TPtr indexInfo) {
- TPath table = TPath::Init(indexInfo->TablePathId, Self);
- settings.set_source_path(table.PathString());
-
- Ydb::Table::TableIndex& index = *settings.mutable_index();
- index.set_name(indexInfo->IndexName);
-
+ break;
+ }
+
+ Fill(*index.MutableSettings(), indexInfo);
+ }
+
+ void Fill(NKikimrIndexBuilder::TIndexBuildSettings& settings, const TIndexBuildInfo::TPtr indexInfo) {
+ TPath table = TPath::Init(indexInfo->TablePathId, Self);
+ settings.set_source_path(table.PathString());
+
+ Ydb::Table::TableIndex& index = *settings.mutable_index();
+ index.set_name(indexInfo->IndexName);
+
*index.mutable_index_columns() = {
indexInfo->IndexColumns.begin(),
indexInfo->IndexColumns.end()
@@ -276,154 +276,154 @@ protected:
indexInfo->DataColumns.end()
};
- switch (indexInfo->IndexType) {
- case NKikimrSchemeOp::EIndexType::EIndexTypeGlobal:
+ switch (indexInfo->IndexType) {
+ case NKikimrSchemeOp::EIndexType::EIndexTypeGlobal:
*index.mutable_global_index() = Ydb::Table::GlobalIndex();
- break;
- case NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync:
+ break;
+ case NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync:
*index.mutable_global_async_index() = Ydb::Table::GlobalAsyncIndex();
break;
- case NKikimrSchemeOp::EIndexType::EIndexTypeInvalid:
- Y_FAIL("Unreachable");
- };
-
- settings.set_max_batch_bytes(indexInfo->Limits.MaxBatchBytes);
- settings.set_max_batch_rows(indexInfo->Limits.MaxBatchRows);
- settings.set_max_shards_in_flight(indexInfo->Limits.MaxShards);
- settings.set_max_retries_upload_batch(indexInfo->Limits.MaxRetries);
- }
-
- void AddIssue(::google::protobuf::RepeatedPtrField< ::Ydb::Issue::IssueMessage>* issues,
- const TString& message,
- NYql::TSeverityIds::ESeverityId severity = NYql::TSeverityIds::S_ERROR)
- {
- auto& issue = *issues->Add();
- issue.set_severity(severity);
- issue.set_message(message);
- }
-
- void SendNotificationsIfFinished(TIndexBuildInfo::TPtr indexInfo) {
- if (!indexInfo->IsFinished()) {
- return;
- }
-
- LOG_T("TIndexBuildInfo SendNotifications: "
- << ": id# " << indexInfo->Id
- << ", subscribers count# " << indexInfo->Subscribers.size());
-
+ case NKikimrSchemeOp::EIndexType::EIndexTypeInvalid:
+ Y_FAIL("Unreachable");
+ };
+
+ settings.set_max_batch_bytes(indexInfo->Limits.MaxBatchBytes);
+ settings.set_max_batch_rows(indexInfo->Limits.MaxBatchRows);
+ settings.set_max_shards_in_flight(indexInfo->Limits.MaxShards);
+ settings.set_max_retries_upload_batch(indexInfo->Limits.MaxRetries);
+ }
+
+ void AddIssue(::google::protobuf::RepeatedPtrField< ::Ydb::Issue::IssueMessage>* issues,
+ const TString& message,
+ NYql::TSeverityIds::ESeverityId severity = NYql::TSeverityIds::S_ERROR)
+ {
+ auto& issue = *issues->Add();
+ issue.set_severity(severity);
+ issue.set_message(message);
+ }
+
+ void SendNotificationsIfFinished(TIndexBuildInfo::TPtr indexInfo) {
+ if (!indexInfo->IsFinished()) {
+ return;
+ }
+
+ LOG_T("TIndexBuildInfo SendNotifications: "
+ << ": id# " << indexInfo->Id
+ << ", subscribers count# " << indexInfo->Subscribers.size());
+
TSet<TActorId> toAnswer;
- toAnswer.swap(indexInfo->Subscribers);
- for (auto& actorId: toAnswer) {
- Send(actorId, MakeHolder<TEvSchemeShard::TEvNotifyTxCompletionResult>(ui64(indexInfo->Id)));
- }
- }
-
- void EraseBuildInfo(const TIndexBuildInfo::TPtr indexBuildInfo) {
- Self->IndexBuilds.erase(indexBuildInfo->Id);
- Self->IndexBuildsByUid.erase(indexBuildInfo->Uid);
-
- Self->TxIdToIndexBuilds.erase(indexBuildInfo->LockTxId);
- Self->TxIdToIndexBuilds.erase(indexBuildInfo->InitiateTxId);
- Self->TxIdToIndexBuilds.erase(indexBuildInfo->ApplyTxId);
- Self->TxIdToIndexBuilds.erase(indexBuildInfo->UnlockTxId);
- }
-
- Ydb::StatusIds::StatusCode TranslateStatusCode(NKikimrScheme::EStatus status) {
- switch (status) {
- case NKikimrScheme::StatusSuccess:
- case NKikimrScheme::StatusAccepted:
- case NKikimrScheme::StatusAlreadyExists:
- return Ydb::StatusIds::SUCCESS;
-
- case NKikimrScheme::StatusPathDoesNotExist:
- case NKikimrScheme::StatusPathIsNotDirectory:
- case NKikimrScheme::StatusSchemeError:
- case NKikimrScheme::StatusNameConflict:
- case NKikimrScheme::StatusInvalidParameter:
- case NKikimrScheme::StatusRedirectDomain:
- return Ydb::StatusIds::BAD_REQUEST;
-
- case NKikimrScheme::StatusMultipleModifications:
- case NKikimrScheme::StatusQuotaExceeded:
- return Ydb::StatusIds::OVERLOADED;
-
- case NKikimrScheme::StatusReadOnly:
- case NKikimrScheme::StatusPreconditionFailed:
- case NKikimrScheme::StatusResourceExhausted: //TODO: find better YDB status for it
- return Ydb::StatusIds::PRECONDITION_FAILED;
-
- case NKikimrScheme::StatusAccessDenied:
- return Ydb::StatusIds::UNAUTHORIZED;
- case NKikimrScheme::StatusNotAvailable:
- case NKikimrScheme::StatusTxIdNotExists:
- case NKikimrScheme::StatusTxIsNotCancellable:
- case NKikimrScheme::StatusReserved18:
- case NKikimrScheme::StatusReserved19:
- Y_FAIL("unreadchable");
- }
-
- return Ydb::StatusIds::STATUS_CODE_UNSPECIFIED;
- }
-
- void Bill(const TIndexBuildInfo::TPtr& indexBuildInfo, TInstant startPeriod = TInstant::Zero(), TInstant endPeriod = TInstant::Zero()) {
-
- ToBill.push_back(TToBill(indexBuildInfo->Id, std::move(startPeriod), std::move(endPeriod)));
- }
-
- void AskToScheduleBilling(const TIndexBuildInfo::TPtr& indexBuildInfo) {
- if (indexBuildInfo->BillingEventIsScheduled) {
- return;
- }
-
- if (indexBuildInfo->State != TIndexBuildInfo::EState::Filling) {
- return;
- }
-
- indexBuildInfo->BillingEventIsScheduled = true;
-
- ToScheduleBilling.push_back(TBillingEventSchedule(indexBuildInfo->Id, indexBuildInfo->ReBillPeriod));
- }
-
- bool GotScheduledBilling(const TIndexBuildInfo::TPtr& indexBuildInfo) {
- if (!indexBuildInfo->BillingEventIsScheduled) {
- return false;
- }
-
- if (indexBuildInfo->State != TIndexBuildInfo::EState::Filling) {
- return false;
- }
-
- indexBuildInfo->BillingEventIsScheduled = false;
-
- return true;
- }
-
-public:
- explicit TTxBase(TSelf* self)
- : TBase(self)
- { }
-
- virtual ~TTxBase() = default;
-
- virtual bool DoExecute(TTransactionContext& txc, const TActorContext& ctx) = 0;
- virtual void DoComplete(const TActorContext& ctx) = 0;
-
- bool Execute(TTransactionContext& txc, const TActorContext& ctx) override {
- if (!DoExecute(txc, ctx)) {
- return false;
- }
-
- ApplyOnExecute(txc, ctx);
- return true;
- }
-
- void Complete(const TActorContext& ctx) override {
- DoComplete(ctx);
-
- ApplyOnComlete(ctx);
- }
-
-};
-
-} // NSchemeShard
-} // NKikimr
+ toAnswer.swap(indexInfo->Subscribers);
+ for (auto& actorId: toAnswer) {
+ Send(actorId, MakeHolder<TEvSchemeShard::TEvNotifyTxCompletionResult>(ui64(indexInfo->Id)));
+ }
+ }
+
+ void EraseBuildInfo(const TIndexBuildInfo::TPtr indexBuildInfo) {
+ Self->IndexBuilds.erase(indexBuildInfo->Id);
+ Self->IndexBuildsByUid.erase(indexBuildInfo->Uid);
+
+ Self->TxIdToIndexBuilds.erase(indexBuildInfo->LockTxId);
+ Self->TxIdToIndexBuilds.erase(indexBuildInfo->InitiateTxId);
+ Self->TxIdToIndexBuilds.erase(indexBuildInfo->ApplyTxId);
+ Self->TxIdToIndexBuilds.erase(indexBuildInfo->UnlockTxId);
+ }
+
+ Ydb::StatusIds::StatusCode TranslateStatusCode(NKikimrScheme::EStatus status) {
+ switch (status) {
+ case NKikimrScheme::StatusSuccess:
+ case NKikimrScheme::StatusAccepted:
+ case NKikimrScheme::StatusAlreadyExists:
+ return Ydb::StatusIds::SUCCESS;
+
+ case NKikimrScheme::StatusPathDoesNotExist:
+ case NKikimrScheme::StatusPathIsNotDirectory:
+ case NKikimrScheme::StatusSchemeError:
+ case NKikimrScheme::StatusNameConflict:
+ case NKikimrScheme::StatusInvalidParameter:
+ case NKikimrScheme::StatusRedirectDomain:
+ return Ydb::StatusIds::BAD_REQUEST;
+
+ case NKikimrScheme::StatusMultipleModifications:
+ case NKikimrScheme::StatusQuotaExceeded:
+ return Ydb::StatusIds::OVERLOADED;
+
+ case NKikimrScheme::StatusReadOnly:
+ case NKikimrScheme::StatusPreconditionFailed:
+ case NKikimrScheme::StatusResourceExhausted: //TODO: find better YDB status for it
+ return Ydb::StatusIds::PRECONDITION_FAILED;
+
+ case NKikimrScheme::StatusAccessDenied:
+ return Ydb::StatusIds::UNAUTHORIZED;
+ case NKikimrScheme::StatusNotAvailable:
+ case NKikimrScheme::StatusTxIdNotExists:
+ case NKikimrScheme::StatusTxIsNotCancellable:
+ case NKikimrScheme::StatusReserved18:
+ case NKikimrScheme::StatusReserved19:
+ Y_FAIL("unreadchable");
+ }
+
+ return Ydb::StatusIds::STATUS_CODE_UNSPECIFIED;
+ }
+
+ void Bill(const TIndexBuildInfo::TPtr& indexBuildInfo, TInstant startPeriod = TInstant::Zero(), TInstant endPeriod = TInstant::Zero()) {
+
+ ToBill.push_back(TToBill(indexBuildInfo->Id, std::move(startPeriod), std::move(endPeriod)));
+ }
+
+ void AskToScheduleBilling(const TIndexBuildInfo::TPtr& indexBuildInfo) {
+ if (indexBuildInfo->BillingEventIsScheduled) {
+ return;
+ }
+
+ if (indexBuildInfo->State != TIndexBuildInfo::EState::Filling) {
+ return;
+ }
+
+ indexBuildInfo->BillingEventIsScheduled = true;
+
+ ToScheduleBilling.push_back(TBillingEventSchedule(indexBuildInfo->Id, indexBuildInfo->ReBillPeriod));
+ }
+
+ bool GotScheduledBilling(const TIndexBuildInfo::TPtr& indexBuildInfo) {
+ if (!indexBuildInfo->BillingEventIsScheduled) {
+ return false;
+ }
+
+ if (indexBuildInfo->State != TIndexBuildInfo::EState::Filling) {
+ return false;
+ }
+
+ indexBuildInfo->BillingEventIsScheduled = false;
+
+ return true;
+ }
+
+public:
+ explicit TTxBase(TSelf* self)
+ : TBase(self)
+ { }
+
+ virtual ~TTxBase() = default;
+
+ virtual bool DoExecute(TTransactionContext& txc, const TActorContext& ctx) = 0;
+ virtual void DoComplete(const TActorContext& ctx) = 0;
+
+ bool Execute(TTransactionContext& txc, const TActorContext& ctx) override {
+ if (!DoExecute(txc, ctx)) {
+ return false;
+ }
+
+ ApplyOnExecute(txc, ctx);
+ return true;
+ }
+
+ void Complete(const TActorContext& ctx) override {
+ DoComplete(ctx);
+
+ ApplyOnComlete(ctx);
+ }
+
+};
+
+} // NSchemeShard
+} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_domain_links.cpp b/ydb/core/tx/schemeshard/schemeshard_domain_links.cpp
index 76bfb92c1fd..b50aaa509a3 100644
--- a/ydb/core/tx/schemeshard/schemeshard_domain_links.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_domain_links.cpp
@@ -1,127 +1,127 @@
-#include "schemeshard_domain_links.h"
-#include "schemeshard_impl.h"
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-TParentDomainLink::TParentDomainLink(NKikimr::NSchemeShard::TSchemeShard *self)
- : Self(self)
-{
+#include "schemeshard_domain_links.h"
+#include "schemeshard_impl.h"
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+TParentDomainLink::TParentDomainLink(NKikimr::NSchemeShard::TSchemeShard *self)
+ : Self(self)
+{
PipeClientConfig.RetryPolicy = {
.MinRetryTime = TDuration::MilliSeconds(10),
.MaxRetryTime = TDuration::Minutes(5),
};
-}
-
-THolder<TEvSchemeShard::TEvSyncTenantSchemeShard> TParentDomainLink::MakeSyncMsg() const {
- Y_VERIFY(Self->SubDomains.contains(Self->RootPathId()));
- auto& rootPath = Self->PathsById.at(Self->RootPathId());
-
- Y_VERIFY(Self->PathsById.contains(Self->RootPathId()));
- auto& rootSubdomain = Self->SubDomains.at(Self->RootPathId());
-
- return MakeHolder<TEvSchemeShard::TEvSyncTenantSchemeShard>(Self->ParentDomainId,
- Self->TabletID(),
- Self->Generation(),
- Self->ParentDomainEffectiveACLVersion,
- rootSubdomain->GetVersion(),
- rootPath->UserAttrs->AlterVersion,
+}
+
+THolder<TEvSchemeShard::TEvSyncTenantSchemeShard> TParentDomainLink::MakeSyncMsg() const {
+ Y_VERIFY(Self->SubDomains.contains(Self->RootPathId()));
+ auto& rootPath = Self->PathsById.at(Self->RootPathId());
+
+ Y_VERIFY(Self->PathsById.contains(Self->RootPathId()));
+ auto& rootSubdomain = Self->SubDomains.at(Self->RootPathId());
+
+ return MakeHolder<TEvSchemeShard::TEvSyncTenantSchemeShard>(Self->ParentDomainId,
+ Self->TabletID(),
+ Self->Generation(),
+ Self->ParentDomainEffectiveACLVersion,
+ rootSubdomain->GetVersion(),
+ rootPath->UserAttrs->AlterVersion,
ui64(rootSubdomain->GetTenantHiveID()),
- ui64(rootSubdomain->GetTenantSysViewProcessorID()),
- rootPath->ACL);
-}
-
-void TParentDomainLink::SendSync(const TActorContext &ctx) {
- if (Self->IsDomainSchemeShard) {
- return;
- }
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Send TEvSyncTenantSchemeShard"
- << ", to parent: " << Self->ParentDomainId
- << ", from: " << Self->TabletID());
-
- if (!Pipe) {
- Pipe = ctx.Register(NTabletPipe::CreateClient(ctx.SelfID, Self->ParentDomainId.OwnerId, PipeClientConfig));
- }
-
- auto ev = MakeSyncMsg();
-
- NTabletPipe::SendData(ctx, Pipe, ev.Release(), 0);
-}
-
-void TParentDomainLink::AtPipeError(const TActorContext &ctx) {
- if (Pipe) {
- NTabletPipe::CloseClient(ctx, Pipe);
+ ui64(rootSubdomain->GetTenantSysViewProcessorID()),
+ rootPath->ACL);
+}
+
+void TParentDomainLink::SendSync(const TActorContext &ctx) {
+ if (Self->IsDomainSchemeShard) {
+ return;
+ }
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Send TEvSyncTenantSchemeShard"
+ << ", to parent: " << Self->ParentDomainId
+ << ", from: " << Self->TabletID());
+
+ if (!Pipe) {
+ Pipe = ctx.Register(NTabletPipe::CreateClient(ctx.SelfID, Self->ParentDomainId.OwnerId, PipeClientConfig));
+ }
+
+ auto ev = MakeSyncMsg();
+
+ NTabletPipe::SendData(ctx, Pipe, ev.Release(), 0);
+}
+
+void TParentDomainLink::AtPipeError(const TActorContext &ctx) {
+ if (Pipe) {
+ NTabletPipe::CloseClient(ctx, Pipe);
Pipe = TActorId();
- }
-
- SendSync(ctx);
-}
-
+ }
+
+ SendSync(ctx);
+}
+
bool TParentDomainLink::HasPipeTo(TTabletId tabletId, TActorId clientId) {
- return TTabletId(Self->ParentDomainId.OwnerId) == tabletId && Pipe == clientId;
-}
-
-void TParentDomainLink::Shutdown(const NActors::TActorContext &ctx) {
- if (Pipe) {
- NTabletPipe::CloseClient(ctx, Pipe);
+ return TTabletId(Self->ParentDomainId.OwnerId) == tabletId && Pipe == clientId;
+}
+
+void TParentDomainLink::Shutdown(const NActors::TActorContext &ctx) {
+ if (Pipe) {
+ NTabletPipe::CloseClient(ctx, Pipe);
Pipe = TActorId();
- }
-}
-
-bool TSubDomainsLinks::Sync(TEvSchemeShard::TEvSyncTenantSchemeShard::TPtr &ev, const TActorContext &ctx) {
- Y_VERIFY(Self->IsDomainSchemeShard);
-
- const auto& record = ev->Get()->Record;
+ }
+}
+
+bool TSubDomainsLinks::Sync(TEvSchemeShard::TEvSyncTenantSchemeShard::TPtr &ev, const TActorContext &ctx) {
+ Y_VERIFY(Self->IsDomainSchemeShard);
+
+ const auto& record = ev->Get()->Record;
const TActorId actorId = ev->Sender;
-
- const TPathId pathId = Self->MakeLocalId(record.GetDomainPathId());
- const ui64 generation = record.GetGeneration();
-
- Y_VERIFY(record.GetDomainSchemeShard() == Self->TabletID());
-
- if (ActiveLink.contains(pathId)) {
- TLink& link = ActiveLink.at(pathId);
-
- if (link.Generation > generation) {
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Ignore TEvSyncTenantSchemeShard with obsolete generation"
- << ", msg: " << record.ShortDebugString()
- << ", at schemeshard: " << Self->TabletID());
- return false;
- }
- }
-
- ActiveLink[pathId] = TLink(record, actorId);
- return true;
-}
-
-void TSubDomainsLinks::TLink::Out(IOutputStream& stream) const {
- stream << "TSubDomainsLinks::TLink {"
- << " DomainKey: " << DomainKey
- << ", Generation: " << Generation
- << ", ActorId:" << ActorId
- << ", EffectiveACLVersion: " << EffectiveACLVersion
- << ", SubdomainVersion: " << SubdomainVersion
- << ", UserAttributesVersion: " << UserAttributesVersion
- << ", TenantHive: " << TenantHive
+
+ const TPathId pathId = Self->MakeLocalId(record.GetDomainPathId());
+ const ui64 generation = record.GetGeneration();
+
+ Y_VERIFY(record.GetDomainSchemeShard() == Self->TabletID());
+
+ if (ActiveLink.contains(pathId)) {
+ TLink& link = ActiveLink.at(pathId);
+
+ if (link.Generation > generation) {
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Ignore TEvSyncTenantSchemeShard with obsolete generation"
+ << ", msg: " << record.ShortDebugString()
+ << ", at schemeshard: " << Self->TabletID());
+ return false;
+ }
+ }
+
+ ActiveLink[pathId] = TLink(record, actorId);
+ return true;
+}
+
+void TSubDomainsLinks::TLink::Out(IOutputStream& stream) const {
+ stream << "TSubDomainsLinks::TLink {"
+ << " DomainKey: " << DomainKey
+ << ", Generation: " << Generation
+ << ", ActorId:" << ActorId
+ << ", EffectiveACLVersion: " << EffectiveACLVersion
+ << ", SubdomainVersion: " << SubdomainVersion
+ << ", UserAttributesVersion: " << UserAttributesVersion
+ << ", TenantHive: " << TenantHive
<< ", TenantSysViewProcessor: " << TenantSysViewProcessor
- << ", TenantRootACL: " << TenantRootACL
- << "}";
-}
-
-TSubDomainsLinks::TLink::TLink(const NKikimrScheme::TEvSyncTenantSchemeShard &record, const TActorId &actorId)
- : DomainKey(record.GetDomainSchemeShard(), record.GetDomainPathId())
- , Generation(record.GetGeneration())
- , ActorId(actorId)
- , EffectiveACLVersion(record.GetEffectiveACLVersion())
- , SubdomainVersion(record.GetSubdomainVersion())
- , UserAttributesVersion(record.GetUserAttributesVersion())
- , TenantHive(record.HasTenantHive() ? TTabletId(record.GetTenantHive()) : InvalidTabletId)
+ << ", TenantRootACL: " << TenantRootACL
+ << "}";
+}
+
+TSubDomainsLinks::TLink::TLink(const NKikimrScheme::TEvSyncTenantSchemeShard &record, const TActorId &actorId)
+ : DomainKey(record.GetDomainSchemeShard(), record.GetDomainPathId())
+ , Generation(record.GetGeneration())
+ , ActorId(actorId)
+ , EffectiveACLVersion(record.GetEffectiveACLVersion())
+ , SubdomainVersion(record.GetSubdomainVersion())
+ , UserAttributesVersion(record.GetUserAttributesVersion())
+ , TenantHive(record.HasTenantHive() ? TTabletId(record.GetTenantHive()) : InvalidTabletId)
, TenantSysViewProcessor(record.HasTenantSysViewProcessor() ?
TTabletId(record.GetTenantSysViewProcessor()) : InvalidTabletId)
- , TenantRootACL(record.GetTenantRootACL())
-{}
-
-}}
+ , TenantRootACL(record.GetTenantRootACL())
+{}
+
+}}
diff --git a/ydb/core/tx/schemeshard/schemeshard_domain_links.h b/ydb/core/tx/schemeshard/schemeshard_domain_links.h
index f2eacdc305c..d9cb6133c42 100644
--- a/ydb/core/tx/schemeshard/schemeshard_domain_links.h
+++ b/ydb/core/tx/schemeshard/schemeshard_domain_links.h
@@ -1,79 +1,79 @@
-#pragma once
-
-#include "schemeshard.h"
-#include "schemeshard_types.h"
-
+#pragma once
+
+#include "schemeshard.h"
+#include "schemeshard_types.h"
+
#include <ydb/core/base/subdomain.h>
#include <ydb/core/base/tablet_pipe.h>
#include <ydb/core/protos/flat_tx_scheme.pb.h>
-
+
#include <library/cpp/actors/core/actorid.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-class TSchemeShard;
-
-class TParentDomainLink {
- TSchemeShard* Self;
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+class TSchemeShard;
+
+class TParentDomainLink {
+ TSchemeShard* Self;
TActorId Pipe;
- NTabletPipe::TClientConfig PipeClientConfig;
-
-public:
- TParentDomainLink(TSchemeShard* self);
- void Shutdown(const TActorContext& ctx);
- THolder<TEvSchemeShard::TEvSyncTenantSchemeShard> MakeSyncMsg() const;
- void SendSync(const TActorContext& ctx);
- void AtPipeError(const TActorContext& ctx);
+ NTabletPipe::TClientConfig PipeClientConfig;
+
+public:
+ TParentDomainLink(TSchemeShard* self);
+ void Shutdown(const TActorContext& ctx);
+ THolder<TEvSchemeShard::TEvSyncTenantSchemeShard> MakeSyncMsg() const;
+ void SendSync(const TActorContext& ctx);
+ void AtPipeError(const TActorContext& ctx);
bool HasPipeTo(TTabletId tabletId, TActorId clientId);
-};
-
-
-class TSubDomainsLinks {
-public:
- struct TLink {
- TPathId DomainKey = InvalidPathId;
- ui64 Generation = 0;
+};
+
+
+class TSubDomainsLinks {
+public:
+ struct TLink {
+ TPathId DomainKey = InvalidPathId;
+ ui64 Generation = 0;
TActorId ActorId;
-
- ui64 EffectiveACLVersion = 0;
- ui64 SubdomainVersion = 0;
- ui64 UserAttributesVersion = 0;
- TTabletId TenantHive = InvalidTabletId;
+
+ ui64 EffectiveACLVersion = 0;
+ ui64 SubdomainVersion = 0;
+ ui64 UserAttributesVersion = 0;
+ TTabletId TenantHive = InvalidTabletId;
TTabletId TenantSysViewProcessor = InvalidTabletId;
- TString TenantRootACL;
-
- TLink() = default;
- TLink& operator = (TLink&&) = default;
- TLink(const NKikimrScheme::TEvSyncTenantSchemeShard& record, const TActorId& actorId);
- void Out(IOutputStream& stream) const;
- };
-
-private:
- TSchemeShard* Self;
- THashMap<TPathId, TLink> ActiveLink;
-
-public:
- TSubDomainsLinks(TSchemeShard* self)
- : Self(self)
- {}
-
- bool IsActive(TPathId pathId) const {
- return ActiveLink.contains(pathId);
- }
-
- const TLink& GetLink(TPathId pathId) const {
- return ActiveLink.at(pathId);
- }
-
- bool Sync(TEvSchemeShard::TEvSyncTenantSchemeShard::TPtr& ev, const TActorContext& ctx);
-};
-
-}}
-
-
-template<>
-inline void Out<NKikimr::NSchemeShard::TSubDomainsLinks::TLink>(IOutputStream& o, const NKikimr::NSchemeShard::TSubDomainsLinks::TLink& x) {
- return x.Out(o);
-}
-
+ TString TenantRootACL;
+
+ TLink() = default;
+ TLink& operator = (TLink&&) = default;
+ TLink(const NKikimrScheme::TEvSyncTenantSchemeShard& record, const TActorId& actorId);
+ void Out(IOutputStream& stream) const;
+ };
+
+private:
+ TSchemeShard* Self;
+ THashMap<TPathId, TLink> ActiveLink;
+
+public:
+ TSubDomainsLinks(TSchemeShard* self)
+ : Self(self)
+ {}
+
+ bool IsActive(TPathId pathId) const {
+ return ActiveLink.contains(pathId);
+ }
+
+ const TLink& GetLink(TPathId pathId) const {
+ return ActiveLink.at(pathId);
+ }
+
+ bool Sync(TEvSchemeShard::TEvSyncTenantSchemeShard::TPtr& ev, const TActorContext& ctx);
+};
+
+}}
+
+
+template<>
+inline void Out<NKikimr::NSchemeShard::TSubDomainsLinks::TLink>(IOutputStream& o, const NKikimr::NSchemeShard::TSubDomainsLinks::TLink& x) {
+ return x.Out(o);
+}
+
diff --git a/ydb/core/tx/schemeshard/schemeshard_effective_acl.cpp b/ydb/core/tx/schemeshard/schemeshard_effective_acl.cpp
index aa3d1fff1d6..40f06183d9c 100644
--- a/ydb/core/tx/schemeshard/schemeshard_effective_acl.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_effective_acl.cpp
@@ -1,87 +1,87 @@
-#include "schemeshard_effective_acl.h"
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-void TEffectiveACL::Init(const TString &effectiveACL)
-{
- NACLibProto::TSecurityObject object;
- Y_VERIFY(object.MutableACL()->ParseFromString(effectiveACL));
-
- Inited = true;
- Split(object);
-
- // InheritOnly is not filtered from self effective.
- // Record with InheritOnly doesn't counted at CheckAccess
- // InheritOnly flag is eliminated on inheriting
- // so here is enough to copy acl withount filtering InheritOnly flags
- ForSelf = effectiveACL;
-}
-
-void TEffectiveACL::Update(const TEffectiveACL &parent, const TString &selfACL, bool isContainer)
-{
- Y_VERIFY_DEBUG(parent);
-
- if (!selfACL) {
- InheritFrom(parent, isContainer);
- return;
- }
-
- const TString noMatterOwner;
-
- NACLib::TSecurityObject parentObj(noMatterOwner, true);
- Y_VERIFY(parentObj.MutableACL()->ParseFromString(parent.GetForChildren(isContainer)));
-
- NACLib::TSecurityObject selfObj(noMatterOwner, isContainer);
- Y_VERIFY(selfObj.MutableACL()->ParseFromString(selfACL));
-
- NACLib::TSecurityObject effectiveObj = selfObj.MergeWithParent(parentObj); // merge is needed due to Deny records
-
- Inited = true;
- Split(effectiveObj);
- ForSelf = effectiveObj.GetACL().SerializeAsString();
-}
-
-void TEffectiveACL::InheritFrom(const TEffectiveACL &parent, bool isContainer) {
- Inited = parent.Inited;
-
- ForContainers = parent.ForContainers;
- ForObjects = parent.ForObjects;
-
- ForSelf = isContainer ? ForContainers : ForObjects;
-}
-
-void TEffectiveACL::Split(const NACLibProto::TSecurityObject &obj) {
- auto equalResult = Filter(obj, NACLib::EInheritanceType::InheritContainer, ForContainers);
-
- if (equalResult) {
- ForObjects = ForContainers;
- } else {
- Filter(obj, NACLib::EInheritanceType::InheritObject, ForObjects);
- }
-}
-
-bool TEffectiveACL::Filter(const NACLibProto::TSecurityObject &obj, NACLib::EInheritanceType byType, TString &result) {
- bool resultsIsEqualForAllInheritTypes = true;
-
- NACLibProto::TSecurityObject filtered;
-
- for (const auto& ace: obj.GetACL().GetACE()) {
- resultsIsEqualForAllInheritTypes = resultsIsEqualForAllInheritTypes &&
- !((ace.GetInheritanceType() & NACLib::EInheritanceType::InheritContainer) ^ (ace.GetInheritanceType() & NACLib::EInheritanceType::InheritObject));
-
- if (ace.GetInheritanceType() & byType) {
- NACLibProto::TACE& addition = *filtered.MutableACL()->AddACE();
- addition.CopyFrom(ace);
- addition.SetInherited(true);
- addition.SetInheritanceType(addition.GetInheritanceType() & ~NACLib::EInheritanceType::InheritOnly);
- }
- }
-
- result = filtered.GetACL().SerializeAsString();
-
- return resultsIsEqualForAllInheritTypes;
-}
-
-}
-}
+#include "schemeshard_effective_acl.h"
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+void TEffectiveACL::Init(const TString &effectiveACL)
+{
+ NACLibProto::TSecurityObject object;
+ Y_VERIFY(object.MutableACL()->ParseFromString(effectiveACL));
+
+ Inited = true;
+ Split(object);
+
+ // InheritOnly is not filtered from self effective.
+ // Record with InheritOnly doesn't counted at CheckAccess
+ // InheritOnly flag is eliminated on inheriting
+ // so here is enough to copy acl withount filtering InheritOnly flags
+ ForSelf = effectiveACL;
+}
+
+void TEffectiveACL::Update(const TEffectiveACL &parent, const TString &selfACL, bool isContainer)
+{
+ Y_VERIFY_DEBUG(parent);
+
+ if (!selfACL) {
+ InheritFrom(parent, isContainer);
+ return;
+ }
+
+ const TString noMatterOwner;
+
+ NACLib::TSecurityObject parentObj(noMatterOwner, true);
+ Y_VERIFY(parentObj.MutableACL()->ParseFromString(parent.GetForChildren(isContainer)));
+
+ NACLib::TSecurityObject selfObj(noMatterOwner, isContainer);
+ Y_VERIFY(selfObj.MutableACL()->ParseFromString(selfACL));
+
+ NACLib::TSecurityObject effectiveObj = selfObj.MergeWithParent(parentObj); // merge is needed due to Deny records
+
+ Inited = true;
+ Split(effectiveObj);
+ ForSelf = effectiveObj.GetACL().SerializeAsString();
+}
+
+void TEffectiveACL::InheritFrom(const TEffectiveACL &parent, bool isContainer) {
+ Inited = parent.Inited;
+
+ ForContainers = parent.ForContainers;
+ ForObjects = parent.ForObjects;
+
+ ForSelf = isContainer ? ForContainers : ForObjects;
+}
+
+void TEffectiveACL::Split(const NACLibProto::TSecurityObject &obj) {
+ auto equalResult = Filter(obj, NACLib::EInheritanceType::InheritContainer, ForContainers);
+
+ if (equalResult) {
+ ForObjects = ForContainers;
+ } else {
+ Filter(obj, NACLib::EInheritanceType::InheritObject, ForObjects);
+ }
+}
+
+bool TEffectiveACL::Filter(const NACLibProto::TSecurityObject &obj, NACLib::EInheritanceType byType, TString &result) {
+ bool resultsIsEqualForAllInheritTypes = true;
+
+ NACLibProto::TSecurityObject filtered;
+
+ for (const auto& ace: obj.GetACL().GetACE()) {
+ resultsIsEqualForAllInheritTypes = resultsIsEqualForAllInheritTypes &&
+ !((ace.GetInheritanceType() & NACLib::EInheritanceType::InheritContainer) ^ (ace.GetInheritanceType() & NACLib::EInheritanceType::InheritObject));
+
+ if (ace.GetInheritanceType() & byType) {
+ NACLibProto::TACE& addition = *filtered.MutableACL()->AddACE();
+ addition.CopyFrom(ace);
+ addition.SetInherited(true);
+ addition.SetInheritanceType(addition.GetInheritanceType() & ~NACLib::EInheritanceType::InheritOnly);
+ }
+ }
+
+ result = filtered.GetACL().SerializeAsString();
+
+ return resultsIsEqualForAllInheritTypes;
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard_effective_acl.h b/ydb/core/tx/schemeshard/schemeshard_effective_acl.h
index 9ae5a4c894b..eca4c649aab 100644
--- a/ydb/core/tx/schemeshard/schemeshard_effective_acl.h
+++ b/ydb/core/tx/schemeshard/schemeshard_effective_acl.h
@@ -1,32 +1,32 @@
-#pragma once
-
+#pragma once
+
#include <ydb/library/aclib/protos/aclib.pb.h>
#include <ydb/library/aclib/aclib.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-class TEffectiveACL {
- bool Inited = false;
- TString ForContainers;
- TString ForObjects;
- TString ForSelf;
-
-public:
- TEffectiveACL() = default;
-
- void Init(const TString& effectiveACL);
- void Update(const TEffectiveACL& parent, const TString& selfACL, bool isContainer);
-
- operator bool () const { return Inited; }
- const TString& GetForChildren(bool isContainer) const { return isContainer ? ForContainers : ForObjects; }
- const TString& GetForSelf() const { return ForSelf; }
-
-private:
- void InheritFrom(const TEffectiveACL& parent, bool isContainer);
- void Split(const NACLibProto::TSecurityObject& obj);
- bool Filter(const NACLibProto::TSecurityObject& obj, NACLib::EInheritanceType byType, TString& result);
-};
-
-}
-}
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+class TEffectiveACL {
+ bool Inited = false;
+ TString ForContainers;
+ TString ForObjects;
+ TString ForSelf;
+
+public:
+ TEffectiveACL() = default;
+
+ void Init(const TString& effectiveACL);
+ void Update(const TEffectiveACL& parent, const TString& selfACL, bool isContainer);
+
+ operator bool () const { return Inited; }
+ const TString& GetForChildren(bool isContainer) const { return isContainer ? ForContainers : ForObjects; }
+ const TString& GetForSelf() const { return ForSelf; }
+
+private:
+ void InheritFrom(const TEffectiveACL& parent, bool isContainer);
+ void Split(const NACLibProto::TSecurityObject& obj);
+ bool Filter(const NACLibProto::TSecurityObject& obj, NACLib::EInheritanceType byType, TString& result);
+};
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard_export.cpp b/ydb/core/tx/schemeshard/schemeshard_export.cpp
index 71e7c34c815..00eef5a0dbc 100644
--- a/ydb/core/tx/schemeshard/schemeshard_export.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_export.cpp
@@ -5,7 +5,7 @@
#include <util/generic/xrange.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
namespace {
@@ -34,7 +34,7 @@ namespace {
return timestamp;
}
- void FillItemProgress(TSchemeShard* ss, const TExportInfo::TPtr exportInfo, ui32 itemIdx,
+ void FillItemProgress(TSchemeShard* ss, const TExportInfo::TPtr exportInfo, ui32 itemIdx,
Ydb::Export::ExportItemProgress& itemProgress) {
Y_VERIFY(itemIdx < exportInfo->Items.size());
@@ -76,7 +76,7 @@ namespace {
} // anonymous
-void TSchemeShard::FromXxportInfo(NKikimrExport::TExport& exprt, const TExportInfo::TPtr exportInfo) {
+void TSchemeShard::FromXxportInfo(NKikimrExport::TExport& exprt, const TExportInfo::TPtr exportInfo) {
exprt.SetId(exportInfo->Id);
exprt.SetStatus(Ydb::StatusIds::SUCCESS);
@@ -131,13 +131,13 @@ void TSchemeShard::FromXxportInfo(NKikimrExport::TExport& exprt, const TExportIn
}
}
-void TSchemeShard::PersistCreateExport(NIceDb::TNiceDb& db, const TExportInfo::TPtr exportInfo) {
+void TSchemeShard::PersistCreateExport(NIceDb::TNiceDb& db, const TExportInfo::TPtr exportInfo) {
db.Table<Schema::Exports>().Key(exportInfo->Id).Update(
NIceDb::TUpdate<Schema::Exports::Uid>(exportInfo->Uid),
NIceDb::TUpdate<Schema::Exports::Kind>(static_cast<ui8>(exportInfo->Kind)),
NIceDb::TUpdate<Schema::Exports::Settings>(exportInfo->Settings),
- NIceDb::TUpdate<Schema::Exports::DomainPathOwnerId>(exportInfo->DomainPathId.OwnerId),
- NIceDb::TUpdate<Schema::Exports::DomainPathId>(exportInfo->DomainPathId.LocalPathId),
+ NIceDb::TUpdate<Schema::Exports::DomainPathOwnerId>(exportInfo->DomainPathId.OwnerId),
+ NIceDb::TUpdate<Schema::Exports::DomainPathId>(exportInfo->DomainPathId.LocalPathId),
NIceDb::TUpdate<Schema::Exports::Items>(exportInfo->Items.size())
);
@@ -152,14 +152,14 @@ void TSchemeShard::PersistCreateExport(NIceDb::TNiceDb& db, const TExportInfo::T
db.Table<Schema::ExportItems>().Key(exportInfo->Id, itemIdx).Update(
NIceDb::TUpdate<Schema::ExportItems::SourcePathName>(item.SourcePathName),
- NIceDb::TUpdate<Schema::ExportItems::SourceOwnerPathId>(item.SourcePathId.OwnerId),
- NIceDb::TUpdate<Schema::ExportItems::SourcePathId>(item.SourcePathId.LocalPathId),
+ NIceDb::TUpdate<Schema::ExportItems::SourceOwnerPathId>(item.SourcePathId.OwnerId),
+ NIceDb::TUpdate<Schema::ExportItems::SourcePathId>(item.SourcePathId.LocalPathId),
NIceDb::TUpdate<Schema::ExportItems::State>(static_cast<ui8>(item.State))
);
}
}
-void TSchemeShard::PersistRemoveExport(NIceDb::TNiceDb& db, const TExportInfo::TPtr exportInfo) {
+void TSchemeShard::PersistRemoveExport(NIceDb::TNiceDb& db, const TExportInfo::TPtr exportInfo) {
for (ui32 itemIdx : xrange(exportInfo->Items.size())) {
db.Table<Schema::ExportItems>().Key(exportInfo->Id, itemIdx).Delete();
}
@@ -167,14 +167,14 @@ void TSchemeShard::PersistRemoveExport(NIceDb::TNiceDb& db, const TExportInfo::T
db.Table<Schema::Exports>().Key(exportInfo->Id).Delete();
}
-void TSchemeShard::PersistExportPathId(NIceDb::TNiceDb& db, const TExportInfo::TPtr exportInfo) {
+void TSchemeShard::PersistExportPathId(NIceDb::TNiceDb& db, const TExportInfo::TPtr exportInfo) {
db.Table<Schema::Exports>().Key(exportInfo->Id).Update(
- NIceDb::TUpdate<Schema::Exports::ExportOwnerPathId>(exportInfo->ExportPathId.OwnerId),
- NIceDb::TUpdate<Schema::Exports::ExportPathId>(exportInfo->ExportPathId.LocalPathId)
+ NIceDb::TUpdate<Schema::Exports::ExportOwnerPathId>(exportInfo->ExportPathId.OwnerId),
+ NIceDb::TUpdate<Schema::Exports::ExportPathId>(exportInfo->ExportPathId.LocalPathId)
);
}
-void TSchemeShard::PersistExportState(NIceDb::TNiceDb& db, const TExportInfo::TPtr exportInfo) {
+void TSchemeShard::PersistExportState(NIceDb::TNiceDb& db, const TExportInfo::TPtr exportInfo) {
db.Table<Schema::Exports>().Key(exportInfo->Id).Update(
NIceDb::TUpdate<Schema::Exports::State>(static_cast<ui8>(exportInfo->State)),
NIceDb::TUpdate<Schema::Exports::WaitTxId>(exportInfo->WaitTxId),
@@ -182,7 +182,7 @@ void TSchemeShard::PersistExportState(NIceDb::TNiceDb& db, const TExportInfo::TP
);
}
-void TSchemeShard::PersistExportItemState(NIceDb::TNiceDb& db, const TExportInfo::TPtr exportInfo, ui32 itemIdx) {
+void TSchemeShard::PersistExportItemState(NIceDb::TNiceDb& db, const TExportInfo::TPtr exportInfo, ui32 itemIdx) {
Y_VERIFY(itemIdx < exportInfo->Items.size());
const auto& item = exportInfo->Items.at(itemIdx);
@@ -193,31 +193,31 @@ void TSchemeShard::PersistExportItemState(NIceDb::TNiceDb& db, const TExportInfo
);
}
-void TSchemeShard::Handle(TEvExport::TEvCreateExportRequest::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvExport::TEvCreateExportRequest::TPtr& ev, const TActorContext& ctx) {
Execute(CreateTxCreateExport(ev), ctx);
}
-void TSchemeShard::Handle(TEvExport::TEvGetExportRequest::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvExport::TEvGetExportRequest::TPtr& ev, const TActorContext& ctx) {
Execute(CreateTxGetExport(ev), ctx);
}
-void TSchemeShard::Handle(TEvExport::TEvCancelExportRequest::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvExport::TEvCancelExportRequest::TPtr& ev, const TActorContext& ctx) {
Execute(CreateTxCancelExport(ev), ctx);
}
-void TSchemeShard::Handle(TEvExport::TEvForgetExportRequest::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvExport::TEvForgetExportRequest::TPtr& ev, const TActorContext& ctx) {
Execute(CreateTxForgetExport(ev), ctx);
}
-void TSchemeShard::Handle(TEvExport::TEvListExportsRequest::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvExport::TEvListExportsRequest::TPtr& ev, const TActorContext& ctx) {
Execute(CreateTxListExports(ev), ctx);
}
-void TSchemeShard::ResumeExports(const TVector<ui64>& exportIds, const TActorContext& ctx) {
+void TSchemeShard::ResumeExports(const TVector<ui64>& exportIds, const TActorContext& ctx) {
for (const ui64 id : exportIds) {
Execute(CreateTxProgressExport(id), ctx);
}
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_export.h b/ydb/core/tx/schemeshard/schemeshard_export.h
index 63835c9fc7b..b4c39a2128f 100644
--- a/ydb/core/tx/schemeshard/schemeshard_export.h
+++ b/ydb/core/tx/schemeshard/schemeshard_export.h
@@ -5,7 +5,7 @@
#include <ydb/core/protos/export.pb.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
struct TEvExport {
enum EEv {
@@ -167,5 +167,5 @@ struct TEvExport {
}; // TEvExport
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_export__cancel.cpp b/ydb/core/tx/schemeshard/schemeshard_export__cancel.cpp
index 94c601becd4..2282dd42bbb 100644
--- a/ydb/core/tx/schemeshard/schemeshard_export__cancel.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_export__cancel.cpp
@@ -10,11 +10,11 @@
#include <util/generic/xrange.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TExport::TTxCancel: public TSchemeShard::TXxport::TTxBase {
+struct TSchemeShard::TExport::TTxCancel: public TSchemeShard::TXxport::TTxBase {
TEvExport::TEvCancelExportRequest::TPtr Request;
explicit TTxCancel(TSelf *self, TEvExport::TEvCancelExportRequest::TPtr& ev)
@@ -83,7 +83,7 @@ struct TSchemeShard::TExport::TTxCancel: public TSchemeShard::TXxport::TTxBase {
Self->PersistExportState(db, exportInfo);
Send(Request->Sender, std::move(response), 0, Request->Cookie);
- SendNotificationsIfFinished(exportInfo);
+ SendNotificationsIfFinished(exportInfo);
return true;
}
@@ -92,10 +92,10 @@ struct TSchemeShard::TExport::TTxCancel: public TSchemeShard::TXxport::TTxBase {
}; // TTxCancel
-struct TSchemeShard::TExport::TTxCancelAck: public TSchemeShard::TXxport::TTxBase {
- TEvSchemeShard::TEvCancelTxResult::TPtr CancelResult;
+struct TSchemeShard::TExport::TTxCancelAck: public TSchemeShard::TXxport::TTxBase {
+ TEvSchemeShard::TEvCancelTxResult::TPtr CancelResult;
- explicit TTxCancelAck(TSelf *self, TEvSchemeShard::TEvCancelTxResult::TPtr& ev)
+ explicit TTxCancelAck(TSelf *self, TEvSchemeShard::TEvCancelTxResult::TPtr& ev)
: TXxport::TTxBase(self)
, CancelResult(ev)
{
@@ -161,7 +161,7 @@ struct TSchemeShard::TExport::TTxCancelAck: public TSchemeShard::TXxport::TTxBas
Self->PersistExportState(db, exportInfo);
}
- SendNotificationsIfFinished(exportInfo);
+ SendNotificationsIfFinished(exportInfo);
return true;
}
@@ -170,13 +170,13 @@ struct TSchemeShard::TExport::TTxCancelAck: public TSchemeShard::TXxport::TTxBas
}; // TTxCancelAck
-ITransaction* TSchemeShard::CreateTxCancelExport(TEvExport::TEvCancelExportRequest::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxCancelExport(TEvExport::TEvCancelExportRequest::TPtr& ev) {
return new TExport::TTxCancel(this, ev);
}
-ITransaction* TSchemeShard::CreateTxCancelExportAck(TEvSchemeShard::TEvCancelTxResult::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxCancelExportAck(TEvSchemeShard::TEvCancelTxResult::TPtr& ev) {
return new TExport::TTxCancelAck(this, ev);
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_export__create.cpp b/ydb/core/tx/schemeshard/schemeshard_export__create.cpp
index 47ccc7fb35e..c297a9ea0b4 100644
--- a/ydb/core/tx/schemeshard/schemeshard_export__create.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_export__create.cpp
@@ -14,11 +14,11 @@
#include <util/string/builder.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TExport::TTxCreate: public TSchemeShard::TXxport::TTxBase {
+struct TSchemeShard::TExport::TTxCreate: public TSchemeShard::TXxport::TTxBase {
TEvExport::TEvCreateExportRequest::TPtr Request;
bool Progress;
@@ -67,7 +67,7 @@ struct TSchemeShard::TExport::TTxCreate: public TSchemeShard::TXxport::TTxBase {
.NotDeleted()
.NotUnderDeleting()
.IsCommonSensePath()
- .IsLikeDirectory();
+ .IsLikeDirectory();
if (!checks) {
TString explain;
@@ -216,7 +216,7 @@ private:
}; // TTxCreate
-struct TSchemeShard::TExport::TTxProgress: public TSchemeShard::TXxport::TTxBase {
+struct TSchemeShard::TExport::TTxProgress: public TSchemeShard::TXxport::TTxBase {
using EState = TExportInfo::EState;
using ESubState = TExportInfo::TItem::ESubState;
@@ -224,8 +224,8 @@ struct TSchemeShard::TExport::TTxProgress: public TSchemeShard::TXxport::TTxBase
ui64 Id;
TEvTxAllocatorClient::TEvAllocateResult::TPtr AllocateResult = nullptr;
- TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr ModifyResult = nullptr;
- TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr NotifyResult = nullptr;
+ TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr ModifyResult = nullptr;
+ TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr NotifyResult = nullptr;
explicit TTxProgress(TSelf* self, ui64 id)
: TXxport::TTxBase(self)
@@ -239,13 +239,13 @@ struct TSchemeShard::TExport::TTxProgress: public TSchemeShard::TXxport::TTxBase
{
}
- explicit TTxProgress(TSelf* self, TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& ev)
+ explicit TTxProgress(TSelf* self, TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& ev)
: TXxport::TTxBase(self)
, ModifyResult(ev)
{
}
- explicit TTxProgress(TSelf* self, TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev)
+ explicit TTxProgress(TSelf* self, TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev)
: TXxport::TTxBase(self)
, NotifyResult(ev)
{
@@ -376,7 +376,7 @@ private:
}
void SubscribeTx(TTxId txId) {
- Send(Self->SelfId(), new TEvSchemeShard::TEvNotifyTxCompletion(ui64(txId)));
+ Send(Self->SelfId(), new TEvSchemeShard::TEvNotifyTxCompletion(ui64(txId)));
}
void SubscribeTx(TExportInfo::TPtr exportInfo) {
@@ -401,7 +401,7 @@ private:
SubscribeTx(item.WaitTxId);
}
- static TPathId ItemPathId(TSchemeShard* ss, TExportInfo::TPtr exportInfo, ui32 itemIdx) {
+ static TPathId ItemPathId(TSchemeShard* ss, TExportInfo::TPtr exportInfo, ui32 itemIdx) {
const TPath itemPath = TPath::Resolve(ExportItemPathName(ss, exportInfo, itemIdx), ss);
if (!itemPath.IsResolved()) {
@@ -422,7 +422,7 @@ private:
}
auto path = Self->PathsById.at(item.SourcePathId);
- if (path->PathState != NKikimrSchemeOp::EPathStateCopying) {
+ if (path->PathState != NKikimrSchemeOp::EPathStateCopying) {
return InvalidTxId;
}
@@ -445,7 +445,7 @@ private:
}
auto path = Self->PathsById.at(itemPathId);
- if (path->PathState != NKikimrSchemeOp::EPathStateBackup) {
+ if (path->PathState != NKikimrSchemeOp::EPathStateBackup) {
return InvalidTxId;
}
@@ -606,7 +606,7 @@ private:
void OnAllocateResult(TTransactionContext&, const TActorContext&) {
Y_VERIFY(AllocateResult);
- const auto txId = TTxId(AllocateResult->Get()->TxIds.front());
+ const auto txId = TTxId(AllocateResult->Get()->TxIds.front());
const ui64 id = AllocateResult->Cookie;
LOG_D("TExport::TTxProgress: OnAllocateResult"
@@ -691,14 +691,14 @@ private:
TExportInfo::TPtr exportInfo = Self->Exports.at(id);
NIceDb::TNiceDb db(txc.DB);
- if (record.GetStatus() != NKikimrScheme::StatusAccepted) {
+ if (record.GetStatus() != NKikimrScheme::StatusAccepted) {
Self->TxIdToExport.erase(txId);
txId = InvalidTxId;
const auto status = record.GetStatus();
- const bool isMultipleMods = status == NKikimrScheme::StatusMultipleModifications;
- const bool isAlreadyExists = status == NKikimrScheme::StatusAlreadyExists;
- const bool isNotExist = status == NKikimrScheme::StatusPathDoesNotExist;
+ const bool isMultipleMods = status == NKikimrScheme::StatusMultipleModifications;
+ const bool isAlreadyExists = status == NKikimrScheme::StatusAlreadyExists;
+ const bool isNotExist = status == NKikimrScheme::StatusPathDoesNotExist;
switch (exportInfo->State) {
case EState::CreateExportDir:
@@ -781,7 +781,7 @@ private:
switch (exportInfo->State) {
case EState::CreateExportDir:
- exportInfo->ExportPathId = Self->MakeLocalId(TLocalPathId(record.GetPathId()));
+ exportInfo->ExportPathId = Self->MakeLocalId(TLocalPathId(record.GetPathId()));
Self->PersistExportPathId(db, exportInfo);
exportInfo->WaitTxId = txId;
@@ -837,7 +837,7 @@ private:
LOG_D("TExport::TTxProgress: OnNotifyResult"
<< ": txId# " << record.GetTxId());
- const auto txId = TTxId(record.GetTxId());
+ const auto txId = TTxId(record.GetTxId());
if (!Self->TxIdToExport.contains(txId)) {
LOG_E("TExport::TTxProgress: OnNotifyResult received unknown txId"
<< ": txId# " << txId);
@@ -921,7 +921,7 @@ private:
return;
default:
- return SendNotificationsIfFinished(exportInfo);
+ return SendNotificationsIfFinished(exportInfo);
}
Self->PersistExportState(db, exportInfo);
@@ -930,25 +930,25 @@ private:
}; // TTxProgress
-ITransaction* TSchemeShard::CreateTxCreateExport(TEvExport::TEvCreateExportRequest::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxCreateExport(TEvExport::TEvCreateExportRequest::TPtr& ev) {
return new TExport::TTxCreate(this, ev);
}
-ITransaction* TSchemeShard::CreateTxProgressExport(ui64 id) {
+ITransaction* TSchemeShard::CreateTxProgressExport(ui64 id) {
return new TExport::TTxProgress(this, id);
}
-ITransaction* TSchemeShard::CreateTxProgressExport(TEvTxAllocatorClient::TEvAllocateResult::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxProgressExport(TEvTxAllocatorClient::TEvAllocateResult::TPtr& ev) {
return new TExport::TTxProgress(this, ev);
}
-ITransaction* TSchemeShard::CreateTxProgressExport(TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxProgressExport(TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& ev) {
return new TExport::TTxProgress(this, ev);
}
-ITransaction* TSchemeShard::CreateTxProgressExport(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxProgressExport(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev) {
return new TExport::TTxProgress(this, ev);
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_export__forget.cpp b/ydb/core/tx/schemeshard/schemeshard_export__forget.cpp
index e66b2e739f4..cef8f9f300d 100644
--- a/ydb/core/tx/schemeshard/schemeshard_export__forget.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_export__forget.cpp
@@ -10,11 +10,11 @@
#include <util/generic/ptr.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TExport::TTxForget: public TSchemeShard::TXxport::TTxBase {
+struct TSchemeShard::TExport::TTxForget: public TSchemeShard::TXxport::TTxBase {
TEvExport::TEvForgetExportRequest::TPtr Request;
bool Progress;
@@ -110,9 +110,9 @@ struct TSchemeShard::TExport::TTxForget: public TSchemeShard::TXxport::TTxBase {
}; // TTxForget
-ITransaction* TSchemeShard::CreateTxForgetExport(TEvExport::TEvForgetExportRequest::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxForgetExport(TEvExport::TEvForgetExportRequest::TPtr& ev) {
return new TExport::TTxForget(this, ev);
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_export__get.cpp b/ydb/core/tx/schemeshard/schemeshard_export__get.cpp
index c5f380085f6..c90249bb174 100644
--- a/ydb/core/tx/schemeshard/schemeshard_export__get.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_export__get.cpp
@@ -2,11 +2,11 @@
#include "schemeshard_export.h"
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TExport::TTxGet: public TSchemeShard::TXxport::TTxGet<
+struct TSchemeShard::TExport::TTxGet: public TSchemeShard::TXxport::TTxGet<
TExportInfo,
TEvExport::TEvGetExportRequest,
TEvExport::TEvGetExportResponse
@@ -23,9 +23,9 @@ struct TSchemeShard::TExport::TTxGet: public TSchemeShard::TXxport::TTxGet<
}; // TTxGet
-ITransaction* TSchemeShard::CreateTxGetExport(TEvExport::TEvGetExportRequest::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxGetExport(TEvExport::TEvGetExportRequest::TPtr& ev) {
return new TExport::TTxGet(this, ev);
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_export__list.cpp b/ydb/core/tx/schemeshard/schemeshard_export__list.cpp
index 8f490528d63..595f7d7090f 100644
--- a/ydb/core/tx/schemeshard/schemeshard_export__list.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_export__list.cpp
@@ -2,15 +2,15 @@
#include "schemeshard_export.h"
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TExport::TTxList: public TSchemeShard::TXxport::TTxList<
+struct TSchemeShard::TExport::TTxList: public TSchemeShard::TXxport::TTxList<
TExportInfo,
TEvExport::TEvListExportsRequest,
TEvExport::TEvListExportsResponse,
- TSchemeShard::TExport::TTxList
+ TSchemeShard::TExport::TTxList
> {
using TTxListBase::TTxListBase;
@@ -34,9 +34,9 @@ struct TSchemeShard::TExport::TTxList: public TSchemeShard::TXxport::TTxList<
}; // TTxList
-ITransaction* TSchemeShard::CreateTxListExports(TEvExport::TEvListExportsRequest::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxListExports(TEvExport::TEvListExportsRequest::TPtr& ev) {
return new TExport::TTxList(this, ev);
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_export_flow_proposals.cpp b/ydb/core/tx/schemeshard/schemeshard_export_flow_proposals.cpp
index 025c58f472b..17223ef5a59 100644
--- a/ydb/core/tx/schemeshard/schemeshard_export_flow_proposals.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_export_flow_proposals.cpp
@@ -5,22 +5,22 @@
#include <util/string/cast.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> MkDirPropose(
- TSchemeShard* ss,
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> MkDirPropose(
+ TSchemeShard* ss,
TTxId txId,
const TExportInfo::TPtr exportInfo
) {
- auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(txId), ss->TabletID());
+ auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(txId), ss->TabletID());
auto& record = propose->Record;
if (exportInfo->UserSID) {
record.SetOwner(*exportInfo->UserSID);
}
- auto& modifyScheme = *record.AddTransaction();
- modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpMkDir);
+ auto& modifyScheme = *record.AddTransaction();
+ modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpMkDir);
modifyScheme.SetInternal(true);
const TPath domainPath = TPath::Init(exportInfo->DomainPathId, ss);
@@ -32,20 +32,20 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> MkDirPropose(
return propose;
}
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> CopyTablesPropose(
- TSchemeShard* ss,
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> CopyTablesPropose(
+ TSchemeShard* ss,
TTxId txId,
const TExportInfo::TPtr exportInfo
) {
- auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(txId), ss->TabletID());
+ auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(txId), ss->TabletID());
auto& record = propose->Record;
if (exportInfo->UserSID) {
record.SetOwner(*exportInfo->UserSID);
}
- auto& modifyScheme = *record.AddTransaction();
- modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateConsistentCopyTables);
+ auto& modifyScheme = *record.AddTransaction();
+ modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateConsistentCopyTables);
modifyScheme.SetInternal(true);
auto& copyTables = *modifyScheme.MutableCreateConsistentCopyTables()->MutableCopyTableDescriptions();
@@ -68,8 +68,8 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> CopyTablesPropose(
return propose;
}
-static NKikimrSchemeOp::TPathDescription GetTableDescription(TSchemeShard* ss, const TPathId& pathId) {
- NKikimrSchemeOp::TDescribeOptions opts;
+static NKikimrSchemeOp::TPathDescription GetTableDescription(TSchemeShard* ss, const TPathId& pathId) {
+ NKikimrSchemeOp::TDescribeOptions opts;
opts.SetReturnPartitioningInfo(false);
opts.SetReturnPartitionConfig(true);
opts.SetReturnBoundaries(true);
@@ -80,18 +80,18 @@ static NKikimrSchemeOp::TPathDescription GetTableDescription(TSchemeShard* ss, c
return record.GetPathDescription();
}
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> BackupPropose(
- TSchemeShard* ss,
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> BackupPropose(
+ TSchemeShard* ss,
TTxId txId,
const TExportInfo::TPtr exportInfo,
ui32 itemIdx
) {
Y_VERIFY(itemIdx < exportInfo->Items.size());
- auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(txId), ss->TabletID());
+ auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(txId), ss->TabletID());
- auto& modifyScheme = *propose->Record.AddTransaction();
- modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpBackup);
+ auto& modifyScheme = *propose->Record.AddTransaction();
+ modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpBackup);
modifyScheme.SetInternal(true);
const TPath exportPath = TPath::Init(exportInfo->ExportPathId, ss);
@@ -139,10 +139,10 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> BackupPropose(
switch (exportSettings.scheme()) {
case Ydb::Export::ExportToS3Settings::HTTP:
- backupSettings.SetScheme(NKikimrSchemeOp::TS3Settings::HTTP);
+ backupSettings.SetScheme(NKikimrSchemeOp::TS3Settings::HTTP);
break;
case Ydb::Export::ExportToS3Settings::HTTPS:
- backupSettings.SetScheme(NKikimrSchemeOp::TS3Settings::HTTPS);
+ backupSettings.SetScheme(NKikimrSchemeOp::TS3Settings::HTTPS);
break;
default:
Y_FAIL("Unknown scheme");
@@ -154,16 +154,16 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> BackupPropose(
return propose;
}
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> DropPropose(
- TSchemeShard* ss,
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> DropPropose(
+ TSchemeShard* ss,
TTxId txId,
const TExportInfo::TPtr exportInfo,
ui32 itemIdx
) {
- auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(txId), ss->TabletID());
+ auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(txId), ss->TabletID());
- auto& modifyScheme = *propose->Record.AddTransaction();
- modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpDropTable);
+ auto& modifyScheme = *propose->Record.AddTransaction();
+ modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpDropTable);
modifyScheme.SetInternal(true);
const TPath exportPath = TPath::Init(exportInfo->ExportPathId, ss);
@@ -175,15 +175,15 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> DropPropose(
return propose;
}
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> DropPropose(
- TSchemeShard* ss,
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> DropPropose(
+ TSchemeShard* ss,
TTxId txId,
const TExportInfo::TPtr exportInfo
) {
- auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(txId), ss->TabletID());
+ auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(txId), ss->TabletID());
- auto& modifyScheme = *propose->Record.AddTransaction();
- modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpRmDir);
+ auto& modifyScheme = *propose->Record.AddTransaction();
+ modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpRmDir);
modifyScheme.SetInternal(true);
const TPath domainPath = TPath::Init(exportInfo->DomainPathId, ss);
@@ -195,11 +195,11 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> DropPropose(
return propose;
}
-THolder<TEvSchemeShard::TEvCancelTx> CancelPropose(
+THolder<TEvSchemeShard::TEvCancelTx> CancelPropose(
const TExportInfo::TPtr exportInfo,
TTxId backupTxId
) {
- auto propose = MakeHolder<TEvSchemeShard::TEvCancelTx>();
+ auto propose = MakeHolder<TEvSchemeShard::TEvCancelTx>();
auto& record = propose->Record;
record.SetTxId(exportInfo->Id);
@@ -208,7 +208,7 @@ THolder<TEvSchemeShard::TEvCancelTx> CancelPropose(
return propose;
}
-TString ExportItemPathName(TSchemeShard* ss, const TExportInfo::TPtr exportInfo, ui32 itemIdx) {
+TString ExportItemPathName(TSchemeShard* ss, const TExportInfo::TPtr exportInfo, ui32 itemIdx) {
const TPath exportPath = TPath::Init(exportInfo->ExportPathId, ss);
return ExportItemPathName(exportPath.PathString(), itemIdx);
}
@@ -217,5 +217,5 @@ TString ExportItemPathName(const TString& exportPathName, ui32 itemIdx) {
return TStringBuilder() << exportPathName << "/" << itemIdx;
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_export_flow_proposals.h b/ydb/core/tx/schemeshard/schemeshard_export_flow_proposals.h
index fee10ea7192..a84cb925ea0 100644
--- a/ydb/core/tx/schemeshard/schemeshard_export_flow_proposals.h
+++ b/ydb/core/tx/schemeshard/schemeshard_export_flow_proposals.h
@@ -5,47 +5,47 @@
#include <util/generic/ptr.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> MkDirPropose(
- TSchemeShard* ss,
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> MkDirPropose(
+ TSchemeShard* ss,
TTxId txId,
const TExportInfo::TPtr exportInfo
);
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> CopyTablesPropose(
- TSchemeShard* ss,
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> CopyTablesPropose(
+ TSchemeShard* ss,
TTxId txId,
const TExportInfo::TPtr exportInfo
);
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> BackupPropose(
- TSchemeShard* ss,
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> BackupPropose(
+ TSchemeShard* ss,
TTxId txId,
const TExportInfo::TPtr exportInfo,
ui32 itemIdx
);
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> DropPropose(
- TSchemeShard* ss,
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> DropPropose(
+ TSchemeShard* ss,
TTxId txId,
const TExportInfo::TPtr exportInfo,
ui32 itemIdx
);
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> DropPropose(
- TSchemeShard* ss,
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> DropPropose(
+ TSchemeShard* ss,
TTxId txId,
const TExportInfo::TPtr exportInfo
);
-THolder<TEvSchemeShard::TEvCancelTx> CancelPropose(
+THolder<TEvSchemeShard::TEvCancelTx> CancelPropose(
const TExportInfo::TPtr exportInfo,
TTxId backupTxId
);
-TString ExportItemPathName(TSchemeShard* ss, const TExportInfo::TPtr exportInfo, ui32 itemIdx);
+TString ExportItemPathName(TSchemeShard* ss, const TExportInfo::TPtr exportInfo, ui32 itemIdx);
TString ExportItemPathName(const TString& exportPathName, ui32 itemIdx);
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_identificators.cpp b/ydb/core/tx/schemeshard/schemeshard_identificators.cpp
index 4c2270306ab..2296c8a574b 100644
--- a/ydb/core/tx/schemeshard/schemeshard_identificators.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_identificators.cpp
@@ -1,12 +1,12 @@
-#include "schemeshard_identificators.h"
-
-NKikimrSchemeOp::TShardIdx NKikimr::NSchemeShard::AsProto(const NKikimr::NSchemeShard::TShardIdx &shardIdx) {
- NKikimrSchemeOp::TShardIdx proto;
+#include "schemeshard_identificators.h"
+
+NKikimrSchemeOp::TShardIdx NKikimr::NSchemeShard::AsProto(const NKikimr::NSchemeShard::TShardIdx &shardIdx) {
+ NKikimrSchemeOp::TShardIdx proto;
proto.SetOwnerId(ui64(shardIdx.GetOwnerId()));
proto.SetLocalId(ui64(shardIdx.GetLocalId()));
return proto;
}
-NKikimr::NSchemeShard::TShardIdx NKikimr::NSchemeShard::FromProto(const NKikimrSchemeOp::TShardIdx &shardIdx) {
+NKikimr::NSchemeShard::TShardIdx NKikimr::NSchemeShard::FromProto(const NKikimrSchemeOp::TShardIdx &shardIdx) {
return TShardIdx(TOwnerId(shardIdx.GetOwnerId()), TLocalShardIdx(shardIdx.GetLocalId()));
}
diff --git a/ydb/core/tx/schemeshard/schemeshard_identificators.h b/ydb/core/tx/schemeshard/schemeshard_identificators.h
index 63e962472e3..83472071526 100644
--- a/ydb/core/tx/schemeshard/schemeshard_identificators.h
+++ b/ydb/core/tx/schemeshard/schemeshard_identificators.h
@@ -1,129 +1,129 @@
-#pragma once
-
-#include "schemeshard_ui64id.h"
-
+#pragma once
+
+#include "schemeshard_ui64id.h"
+
#include <ydb/core/base/pathid.h>
-
-#include <util/generic/utility.h>
-#include <util/stream/output.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-constexpr TPathId InvalidPathId = TPathId();
-
-class TTabletIdTag {};
-using TTabletId = TUi64Id<TTabletIdTag, Max<ui64>()>;
-constexpr TTabletId InvalidTabletId = TTabletId();
-
-class TLocalShardIdxTag {};
-using TLocalShardIdx = TUi64Id<TLocalShardIdxTag, Max<ui64>()>;
-constexpr TLocalShardIdx InvalidLocalShardIdx = TLocalShardIdx();
-
-class TShardIdx: public std::pair<TOwnerId, TLocalShardIdx> {
- using TBase = std::pair<TOwnerId, TLocalShardIdx>;
-public:
- using TBase::TBase;
-
- TOwnerId GetOwnerId() const {
- return first;
- }
-
- TLocalShardIdx GetLocalId() const {
- return second;
- }
-
- ui64 Hash() const noexcept {
- return Hash128to32(first, ui64(second));
- }
-
- explicit operator bool() const {
- return GetOwnerId() != InvalidOwnerId && GetLocalId() != InvalidLocalShardIdx;
- }
-};
-constexpr TShardIdx InvalidShardIdx = TShardIdx(InvalidOwnerId, InvalidLocalShardIdx);
-
-class TStepIdTag {};
-using TStepId = TUi64Id<TStepIdTag, 0>;
-constexpr TStepId InvalidStepId = TStepId();
-
-class TTxIdTag {};
-using TTxId = TUi64Id<TTxIdTag, 0>;
-constexpr TTxId InvalidTxId = TTxId();
-
-using TSubTxId = ui32;
-constexpr TSubTxId InvalidSubTxId = Max<ui32>();
-constexpr TSubTxId FirstSubTxId = TSubTxId(0);
-
-class TOperationId: public std::pair<TTxId, TSubTxId> {
- using TBase = std::pair<TTxId, TSubTxId>;
-public:
- using TBase::TBase;
-
- TTxId GetTxId() const {
- return first;
- }
-
- TSubTxId GetSubTxId() const {
- return second;
- }
-
- ui64 Hash() const noexcept {
- return Hash128to32(ui64(first), ui64(second));
- }
-
- explicit operator bool() const {
- return GetTxId() != InvalidTxId && GetSubTxId() != InvalidSubTxId;
- }
-};
-constexpr TOperationId InvalidOperationId = TOperationId(InvalidTxId, InvalidSubTxId);
-
-NKikimrSchemeOp::TShardIdx AsProto(const TShardIdx& shardIdx);
-TShardIdx FromProto(const NKikimrSchemeOp::TShardIdx& shardIdx);
-
-class TIndexBuildIdTag {};
-using TIndexBuildId = TUi64Id<TIndexBuildIdTag, Max<ui64>()>;
-constexpr TIndexBuildId InvalidIndexBuildId = TIndexBuildId();
-
+
+#include <util/generic/utility.h>
+#include <util/stream/output.h>
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+constexpr TPathId InvalidPathId = TPathId();
+
+class TTabletIdTag {};
+using TTabletId = TUi64Id<TTabletIdTag, Max<ui64>()>;
+constexpr TTabletId InvalidTabletId = TTabletId();
+
+class TLocalShardIdxTag {};
+using TLocalShardIdx = TUi64Id<TLocalShardIdxTag, Max<ui64>()>;
+constexpr TLocalShardIdx InvalidLocalShardIdx = TLocalShardIdx();
+
+class TShardIdx: public std::pair<TOwnerId, TLocalShardIdx> {
+ using TBase = std::pair<TOwnerId, TLocalShardIdx>;
+public:
+ using TBase::TBase;
+
+ TOwnerId GetOwnerId() const {
+ return first;
+ }
+
+ TLocalShardIdx GetLocalId() const {
+ return second;
+ }
+
+ ui64 Hash() const noexcept {
+ return Hash128to32(first, ui64(second));
+ }
+
+ explicit operator bool() const {
+ return GetOwnerId() != InvalidOwnerId && GetLocalId() != InvalidLocalShardIdx;
+ }
+};
+constexpr TShardIdx InvalidShardIdx = TShardIdx(InvalidOwnerId, InvalidLocalShardIdx);
+
+class TStepIdTag {};
+using TStepId = TUi64Id<TStepIdTag, 0>;
+constexpr TStepId InvalidStepId = TStepId();
+
+class TTxIdTag {};
+using TTxId = TUi64Id<TTxIdTag, 0>;
+constexpr TTxId InvalidTxId = TTxId();
+
+using TSubTxId = ui32;
+constexpr TSubTxId InvalidSubTxId = Max<ui32>();
+constexpr TSubTxId FirstSubTxId = TSubTxId(0);
+
+class TOperationId: public std::pair<TTxId, TSubTxId> {
+ using TBase = std::pair<TTxId, TSubTxId>;
+public:
+ using TBase::TBase;
+
+ TTxId GetTxId() const {
+ return first;
+ }
+
+ TSubTxId GetSubTxId() const {
+ return second;
+ }
+
+ ui64 Hash() const noexcept {
+ return Hash128to32(ui64(first), ui64(second));
+ }
+
+ explicit operator bool() const {
+ return GetTxId() != InvalidTxId && GetSubTxId() != InvalidSubTxId;
+ }
+};
+constexpr TOperationId InvalidOperationId = TOperationId(InvalidTxId, InvalidSubTxId);
+
+NKikimrSchemeOp::TShardIdx AsProto(const TShardIdx& shardIdx);
+TShardIdx FromProto(const NKikimrSchemeOp::TShardIdx& shardIdx);
+
+class TIndexBuildIdTag {};
+using TIndexBuildId = TUi64Id<TIndexBuildIdTag, Max<ui64>()>;
+constexpr TIndexBuildId InvalidIndexBuildId = TIndexBuildId();
+
enum class EIndexColumnKind : ui8 {
KeyColumn = 0,
DataColumn = 1
};
-class TPipeMessageId: public std::pair<ui64, ui64> {
- using TBase = std::pair<ui64, ui64>;
-public:
- using TBase::TBase;
-};
-
-}
-}
-
-template<>
-struct THash<NKikimr::NSchemeShard::TOperationId> {
- inline ui64 operator()(const NKikimr::NSchemeShard::TOperationId &x) const noexcept {
- return x.Hash();
- }
-};
-
-template<>
-inline void Out<NKikimr::NSchemeShard::TOperationId>(IOutputStream &o, const NKikimr::NSchemeShard::TOperationId &x) {
- o << x.GetTxId() << ":" << x.GetSubTxId();
-}
-
-template<>
-inline void Out<NKikimr::NSchemeShard::TPipeMessageId>(IOutputStream &o, const NKikimr::NSchemeShard::TPipeMessageId &x) {
- o << x.first << ":" << x.second;
-}
-
-template<>
-struct THash<NKikimr::NSchemeShard::TShardIdx> {
- inline ui64 operator()(const NKikimr::NSchemeShard::TShardIdx &x) const noexcept {
- return x.Hash();
- }
-};
-
-template<>
-inline void Out<NKikimr::NSchemeShard::TShardIdx>(IOutputStream &o, const NKikimr::NSchemeShard::TShardIdx &x) {
- o << x.GetOwnerId() << ":" << x.GetLocalId();
-}
+class TPipeMessageId: public std::pair<ui64, ui64> {
+ using TBase = std::pair<ui64, ui64>;
+public:
+ using TBase::TBase;
+};
+
+}
+}
+
+template<>
+struct THash<NKikimr::NSchemeShard::TOperationId> {
+ inline ui64 operator()(const NKikimr::NSchemeShard::TOperationId &x) const noexcept {
+ return x.Hash();
+ }
+};
+
+template<>
+inline void Out<NKikimr::NSchemeShard::TOperationId>(IOutputStream &o, const NKikimr::NSchemeShard::TOperationId &x) {
+ o << x.GetTxId() << ":" << x.GetSubTxId();
+}
+
+template<>
+inline void Out<NKikimr::NSchemeShard::TPipeMessageId>(IOutputStream &o, const NKikimr::NSchemeShard::TPipeMessageId &x) {
+ o << x.first << ":" << x.second;
+}
+
+template<>
+struct THash<NKikimr::NSchemeShard::TShardIdx> {
+ inline ui64 operator()(const NKikimr::NSchemeShard::TShardIdx &x) const noexcept {
+ return x.Hash();
+ }
+};
+
+template<>
+inline void Out<NKikimr::NSchemeShard::TShardIdx>(IOutputStream &o, const NKikimr::NSchemeShard::TShardIdx &x) {
+ o << x.GetOwnerId() << ":" << x.GetLocalId();
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.cpp b/ydb/core/tx/schemeshard/schemeshard_impl.cpp
index 1d7087111a2..0715543a229 100644
--- a/ydb/core/tx/schemeshard/schemeshard_impl.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_impl.cpp
@@ -12,7 +12,7 @@
#include <ydb/library/yql/minikql/mkql_type_ops.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
const ui64 NEW_TABLE_ALTER_VERSION = 1;
@@ -52,276 +52,276 @@ bool ResolvePoolNames(
} // namespace
-const TSchemeLimits TSchemeShard::DefaultLimits = {};
-
-void TSchemeShard::ActivateAfterInitialization(const TActorContext& ctx,
- TSideEffects::TPublications&& delayPublications,
- const TVector<ui64>& exportIds,
- const TVector<ui64>& importsIds,
- TVector<TPathId>&& tablesToClean,
- TDeque<TPathId>&& blockStoreVolumesToClean
- )
-{
+const TSchemeLimits TSchemeShard::DefaultLimits = {};
+
+void TSchemeShard::ActivateAfterInitialization(const TActorContext& ctx,
+ TSideEffects::TPublications&& delayPublications,
+ const TVector<ui64>& exportIds,
+ const TVector<ui64>& importsIds,
+ TVector<TPathId>&& tablesToClean,
+ TDeque<TPathId>&& blockStoreVolumesToClean
+ )
+{
TPathId subDomainPathId = GetCurrentSubDomainPathId();
TSubDomainInfo::TPtr domainPtr = ResolveDomainInfo(subDomainPathId);
LoginProvider.Audience = TPath::Init(subDomainPathId, this).PathString();
- domainPtr->UpdateSecurityState(LoginProvider.GetSecurityState());
-
- Execute(CreateTxInitPopulator(std::move(delayPublications)), ctx);
-
- if (tablesToClean) {
- Execute(CreateTxCleanTables(std::move(tablesToClean)), ctx);
- }
-
- if (blockStoreVolumesToClean) {
- Execute(CreateTxCleanBlockStoreVolumes(std::move(blockStoreVolumesToClean)), ctx);
- }
-
- ResumeExports(exportIds, ctx);
- ResumeImports(importsIds, ctx);
-
- ParentDomainLink.SendSync(ctx);
-
- ScheduleConditionalEraseRun(ctx);
- ScheduleServerlessStorageBilling(ctx);
-
- Y_VERIFY(CleanDroppedPathsDisabled);
- CleanDroppedPathsDisabled = false;
- ScheduleCleanDroppedPaths();
- ScheduleCleanDroppedSubDomains();
-
+ domainPtr->UpdateSecurityState(LoginProvider.GetSecurityState());
+
+ Execute(CreateTxInitPopulator(std::move(delayPublications)), ctx);
+
+ if (tablesToClean) {
+ Execute(CreateTxCleanTables(std::move(tablesToClean)), ctx);
+ }
+
+ if (blockStoreVolumesToClean) {
+ Execute(CreateTxCleanBlockStoreVolumes(std::move(blockStoreVolumesToClean)), ctx);
+ }
+
+ ResumeExports(exportIds, ctx);
+ ResumeImports(importsIds, ctx);
+
+ ParentDomainLink.SendSync(ctx);
+
+ ScheduleConditionalEraseRun(ctx);
+ ScheduleServerlessStorageBilling(ctx);
+
+ Y_VERIFY(CleanDroppedPathsDisabled);
+ CleanDroppedPathsDisabled = false;
+ ScheduleCleanDroppedPaths();
+ ScheduleCleanDroppedSubDomains();
+
StartStopCompactionQueue();
- ctx.Send(TxAllocatorClient, MakeHolder<TEvTxAllocatorClient::TEvAllocate>(InitiateCachedTxIdsCount));
-
- Become(&TThis::StateWork);
-}
-
-ui64 TSchemeShard::Generation() const {
- return Executor()->Generation();
-}
-
-struct TAttachOrder {
- TGlobalTimestamp DropAt;
- TGlobalTimestamp CreateAt;
- TPathId PathId;
-
- explicit TAttachOrder(TPathElement::TPtr path)
- : DropAt(path->GetDropTS())
- , CreateAt(path->GetCreateTS())
- , PathId(path->PathId)
- {}
-
- bool Less (const TAttachOrder& other, EAttachChildResult& decision) const {
- if (DropAt && other.DropAt) {
- // both dropped
-
- if (DropAt < other.DropAt) {
- decision = EAttachChildResult::AttachedAsNewerDeleted;
- return true;
- } else {
- decision = EAttachChildResult::RejectAsOlderDeleted;
- return false;
- }
- } else if (DropAt || other.DropAt){
- // some one is dropped
- if (DropAt) {
- decision = EAttachChildResult::AttachedAsActual;
- return true;
- } else {
- decision = EAttachChildResult::RejectAsDeleted;
- return false;
- }
- } else {
- // no one is dropped
-
- if (CreateAt && other.CreateAt) {
- // both created
- if (CreateAt < other.CreateAt) {
- decision = EAttachChildResult::AttachedAsNewerActual;
- return true;
- } else {
- decision = EAttachChildResult::RejectAsOlderActual;
- return false;
- }
- } else if (CreateAt || other.CreateAt) {
- // some one is created
- if (CreateAt.Empty()) {
- decision = EAttachChildResult::AttachedAsCreatedActual;
- return true;
- } else {
- decision = EAttachChildResult::RejectAsInactve;
- return false;
- }
- } else {
- // no one is created
- if (PathId > other.PathId) {
- decision = EAttachChildResult::AttachedAsOlderUnCreated;
- return true;
- } else {
- decision = EAttachChildResult::RejectAsNewerUnCreated;
- return false;
- }
- }
- }
-
- Y_UNREACHABLE();
- }
-
- TString ToString() const {
- return TStringBuilder()
- << "DropAt: " << DropAt.ToString()
- << " CreateAt: " << CreateAt.ToString()
- << " PathId: " << PathId;
-
- }
-};
-
-TTxId TSchemeShard::GetCachedTxId(const TActorContext &ctx) {
- TTxId txId = InvalidTxId;
- if (CachedTxIds) {
- txId = CachedTxIds.front();
- CachedTxIds.pop_front();
- }
-
- if (CachedTxIds.size() == InitiateCachedTxIdsCount / 3) {
- ctx.Send(TxAllocatorClient, MakeHolder<TEvTxAllocatorClient::TEvAllocate>(InitiateCachedTxIdsCount));
- }
-
- return txId;
-}
-
-EAttachChildResult TSchemeShard::AttachChild(TPathElement::TPtr child) {
- Y_VERIFY(PathsById.contains(child->ParentPathId));
- TPathElement::TPtr parent = PathsById.at(child->ParentPathId);
-
- if (!parent->GetChildren().contains(child->Name)) {
- parent->AddChild(child->Name, child->PathId, true);
-
- LOG_DEBUG_S(TlsActivationContext->AsActorContext(), NKikimrServices::FLAT_TX_SCHEMESHARD,
- "AttachChild: child attached as only one child to the parent"
- << ", parent id: " << parent->PathId
- << ", parent name: " << parent->Name
- << ", child name: " << child->Name
- << ", child id: " << child->PathId
- << ", at schemeshard: " << TabletID());
-
- return EAttachChildResult::AttachedAsOnlyOne;
- }
-
- Y_VERIFY_S(parent->GetChildren().contains(child->Name),
- "child id:" << child->PathId << " child name: " << child->Name <<
- " parent id: " << parent->PathId << " parent name: " << parent->Name);
- Y_VERIFY_S(PathsById.contains(parent->GetChildren().at(child->Name)),
- "child id:" << child->PathId << " child name: " << child->Name <<
- " parent id: " << parent->PathId << " parent name: " << parent->Name);
-
- TPathElement::TPtr prevChild = PathsById.at(parent->GetChildren().at(child->Name));
-
- auto decision = EAttachChildResult::Undefined;
-
- TAttachOrder prevChildOrder = TAttachOrder(prevChild);
- TAttachOrder childOrder = TAttachOrder(child);
-
- if (prevChildOrder.Less(childOrder, decision)) {
- parent->AddChild(child->Name, child->PathId, true);
- }
-
- LOG_DEBUG_S(TlsActivationContext->AsActorContext(), NKikimrServices::FLAT_TX_SCHEMESHARD,
- "AttachChild: decision is: " << decision
- << ", parent id: " << parent->PathId
- << ", parent name: " << parent->Name
- << ", child name: " << child->Name
- << ", prev child id: " << prevChild->PathId
- << ", child id: " << child->PathId
- << ", prev order: " << prevChildOrder.ToString()
- << ", child order: " << childOrder.ToString()
- << ", at schemeshard: " << TabletID());
-
- return decision;
-}
-
-bool TSchemeShard::PathIsActive(TPathId pathId) const {
- Y_VERIFY(PathsById.contains(pathId));
- TPathElement::TPtr path = PathsById.at(pathId);
-
- if (path->PathId == path->ParentPathId) {
- return true;
- }
-
- Y_VERIFY(PathsById.contains(path->ParentPathId));
- TPathElement::TPtr parent = PathsById.at(path->ParentPathId);
-
- if (parent->IsExternalSubDomainRoot() && parent->PathState == NKikimrSchemeOp::EPathState::EPathStateUpgrade) {
- // Children list is empty during TPublishGlobal stage as part of upgrage subdomain
- return true;
- }
-
- if (path->Dropped()) {
- return true;
- }
-
- Y_VERIFY_S(parent->GetChildren().contains(path->Name),
- " pathId: " << pathId
- << " path name: " << path->Name
- << " parentId: " << parent->PathId
- << " parent Name: " << parent->Name);
- return parent->GetChildren().at(path->Name) == pathId;
-}
-
-TMessageSeqNo TSchemeShard::StartRound(TTxState &state) {
- if (!state.SchemeOpSeqNo) {
- state.SchemeOpSeqNo = NextRound();
- }
- return state.SchemeOpSeqNo;
-}
-
-TMessageSeqNo TSchemeShard::NextRound() {
- TMessageSeqNo s(Generation(), SchemeOpRound);
- ++SchemeOpRound;
- return s;
-}
-
-void TSchemeShard::Clear() {
- PathsById.clear();
- Tables.clear();
+ ctx.Send(TxAllocatorClient, MakeHolder<TEvTxAllocatorClient::TEvAllocate>(InitiateCachedTxIdsCount));
+
+ Become(&TThis::StateWork);
+}
+
+ui64 TSchemeShard::Generation() const {
+ return Executor()->Generation();
+}
+
+struct TAttachOrder {
+ TGlobalTimestamp DropAt;
+ TGlobalTimestamp CreateAt;
+ TPathId PathId;
+
+ explicit TAttachOrder(TPathElement::TPtr path)
+ : DropAt(path->GetDropTS())
+ , CreateAt(path->GetCreateTS())
+ , PathId(path->PathId)
+ {}
+
+ bool Less (const TAttachOrder& other, EAttachChildResult& decision) const {
+ if (DropAt && other.DropAt) {
+ // both dropped
+
+ if (DropAt < other.DropAt) {
+ decision = EAttachChildResult::AttachedAsNewerDeleted;
+ return true;
+ } else {
+ decision = EAttachChildResult::RejectAsOlderDeleted;
+ return false;
+ }
+ } else if (DropAt || other.DropAt){
+ // some one is dropped
+ if (DropAt) {
+ decision = EAttachChildResult::AttachedAsActual;
+ return true;
+ } else {
+ decision = EAttachChildResult::RejectAsDeleted;
+ return false;
+ }
+ } else {
+ // no one is dropped
+
+ if (CreateAt && other.CreateAt) {
+ // both created
+ if (CreateAt < other.CreateAt) {
+ decision = EAttachChildResult::AttachedAsNewerActual;
+ return true;
+ } else {
+ decision = EAttachChildResult::RejectAsOlderActual;
+ return false;
+ }
+ } else if (CreateAt || other.CreateAt) {
+ // some one is created
+ if (CreateAt.Empty()) {
+ decision = EAttachChildResult::AttachedAsCreatedActual;
+ return true;
+ } else {
+ decision = EAttachChildResult::RejectAsInactve;
+ return false;
+ }
+ } else {
+ // no one is created
+ if (PathId > other.PathId) {
+ decision = EAttachChildResult::AttachedAsOlderUnCreated;
+ return true;
+ } else {
+ decision = EAttachChildResult::RejectAsNewerUnCreated;
+ return false;
+ }
+ }
+ }
+
+ Y_UNREACHABLE();
+ }
+
+ TString ToString() const {
+ return TStringBuilder()
+ << "DropAt: " << DropAt.ToString()
+ << " CreateAt: " << CreateAt.ToString()
+ << " PathId: " << PathId;
+
+ }
+};
+
+TTxId TSchemeShard::GetCachedTxId(const TActorContext &ctx) {
+ TTxId txId = InvalidTxId;
+ if (CachedTxIds) {
+ txId = CachedTxIds.front();
+ CachedTxIds.pop_front();
+ }
+
+ if (CachedTxIds.size() == InitiateCachedTxIdsCount / 3) {
+ ctx.Send(TxAllocatorClient, MakeHolder<TEvTxAllocatorClient::TEvAllocate>(InitiateCachedTxIdsCount));
+ }
+
+ return txId;
+}
+
+EAttachChildResult TSchemeShard::AttachChild(TPathElement::TPtr child) {
+ Y_VERIFY(PathsById.contains(child->ParentPathId));
+ TPathElement::TPtr parent = PathsById.at(child->ParentPathId);
+
+ if (!parent->GetChildren().contains(child->Name)) {
+ parent->AddChild(child->Name, child->PathId, true);
+
+ LOG_DEBUG_S(TlsActivationContext->AsActorContext(), NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "AttachChild: child attached as only one child to the parent"
+ << ", parent id: " << parent->PathId
+ << ", parent name: " << parent->Name
+ << ", child name: " << child->Name
+ << ", child id: " << child->PathId
+ << ", at schemeshard: " << TabletID());
+
+ return EAttachChildResult::AttachedAsOnlyOne;
+ }
+
+ Y_VERIFY_S(parent->GetChildren().contains(child->Name),
+ "child id:" << child->PathId << " child name: " << child->Name <<
+ " parent id: " << parent->PathId << " parent name: " << parent->Name);
+ Y_VERIFY_S(PathsById.contains(parent->GetChildren().at(child->Name)),
+ "child id:" << child->PathId << " child name: " << child->Name <<
+ " parent id: " << parent->PathId << " parent name: " << parent->Name);
+
+ TPathElement::TPtr prevChild = PathsById.at(parent->GetChildren().at(child->Name));
+
+ auto decision = EAttachChildResult::Undefined;
+
+ TAttachOrder prevChildOrder = TAttachOrder(prevChild);
+ TAttachOrder childOrder = TAttachOrder(child);
+
+ if (prevChildOrder.Less(childOrder, decision)) {
+ parent->AddChild(child->Name, child->PathId, true);
+ }
+
+ LOG_DEBUG_S(TlsActivationContext->AsActorContext(), NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "AttachChild: decision is: " << decision
+ << ", parent id: " << parent->PathId
+ << ", parent name: " << parent->Name
+ << ", child name: " << child->Name
+ << ", prev child id: " << prevChild->PathId
+ << ", child id: " << child->PathId
+ << ", prev order: " << prevChildOrder.ToString()
+ << ", child order: " << childOrder.ToString()
+ << ", at schemeshard: " << TabletID());
+
+ return decision;
+}
+
+bool TSchemeShard::PathIsActive(TPathId pathId) const {
+ Y_VERIFY(PathsById.contains(pathId));
+ TPathElement::TPtr path = PathsById.at(pathId);
+
+ if (path->PathId == path->ParentPathId) {
+ return true;
+ }
+
+ Y_VERIFY(PathsById.contains(path->ParentPathId));
+ TPathElement::TPtr parent = PathsById.at(path->ParentPathId);
+
+ if (parent->IsExternalSubDomainRoot() && parent->PathState == NKikimrSchemeOp::EPathState::EPathStateUpgrade) {
+ // Children list is empty during TPublishGlobal stage as part of upgrage subdomain
+ return true;
+ }
+
+ if (path->Dropped()) {
+ return true;
+ }
+
+ Y_VERIFY_S(parent->GetChildren().contains(path->Name),
+ " pathId: " << pathId
+ << " path name: " << path->Name
+ << " parentId: " << parent->PathId
+ << " parent Name: " << parent->Name);
+ return parent->GetChildren().at(path->Name) == pathId;
+}
+
+TMessageSeqNo TSchemeShard::StartRound(TTxState &state) {
+ if (!state.SchemeOpSeqNo) {
+ state.SchemeOpSeqNo = NextRound();
+ }
+ return state.SchemeOpSeqNo;
+}
+
+TMessageSeqNo TSchemeShard::NextRound() {
+ TMessageSeqNo s(Generation(), SchemeOpRound);
+ ++SchemeOpRound;
+ return s;
+}
+
+void TSchemeShard::Clear() {
+ PathsById.clear();
+ Tables.clear();
if (CompactionQueue)
CompactionQueue->Clear();
- PersQueueGroups.clear();
- RtmrVolumes.clear();
- SubDomains.clear();
- BlockStoreVolumes.clear();
- KesusInfos.clear();
- TxInFlight.clear();
- ShardInfos.clear();
- Indexes.clear();
+ PersQueueGroups.clear();
+ RtmrVolumes.clear();
+ SubDomains.clear();
+ BlockStoreVolumes.clear();
+ KesusInfos.clear();
+ TxInFlight.clear();
+ ShardInfos.clear();
+ Indexes.clear();
CdcStreams.clear();
- RevertedMigrations.clear();
+ RevertedMigrations.clear();
Sequences.clear();
Replications.clear();
-
- for(ui32 idx = 0; idx < TabletCounters->Simple().Size(); ++idx) {
- TabletCounters->Simple()[idx].Set(0);
- }
+
+ for(ui32 idx = 0; idx < TabletCounters->Simple().Size(); ++idx) {
+ TabletCounters->Simple()[idx].Set(0);
+ }
TabletCounters->Percentile()[COUNTER_NUM_SHARDS_BY_TTL_LAG].Clear();
-}
-
-void TSchemeShard::IncrementPathDbRefCount(const TPathId& pathId, const TStringBuf& debug) {
+}
+
+void TSchemeShard::IncrementPathDbRefCount(const TPathId& pathId, const TStringBuf& debug) {
auto it = PathsById.find(pathId);
- Y_VERIFY_DEBUG_S(it != PathsById.end(), "pathId: " << pathId << " debug: " << debug);
+ Y_VERIFY_DEBUG_S(it != PathsById.end(), "pathId: " << pathId << " debug: " << debug);
if (it != PathsById.end()) {
- LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::FLAT_TX_SCHEMESHARD, "IncrementPathDbRefCount reason " << debug << " for pathId " << pathId << " was " << it->second->DbRefCount);
+ LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::FLAT_TX_SCHEMESHARD, "IncrementPathDbRefCount reason " << debug << " for pathId " << pathId << " was " << it->second->DbRefCount);
size_t newRefCount = ++it->second->DbRefCount;
Y_VERIFY_DEBUG(newRefCount > 0);
}
}
-void TSchemeShard::DecrementPathDbRefCount(const TPathId& pathId, const TStringBuf& debug) {
+void TSchemeShard::DecrementPathDbRefCount(const TPathId& pathId, const TStringBuf& debug) {
auto it = PathsById.find(pathId);
- Y_VERIFY_DEBUG_S(it != PathsById.end(), "pathId " << pathId << " " << debug);
+ Y_VERIFY_DEBUG_S(it != PathsById.end(), "pathId " << pathId << " " << debug);
if (it != PathsById.end()) {
// FIXME: not all references are accounted right now
- LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::FLAT_TX_SCHEMESHARD, "DecrementPathDbRefCount reason " << debug << " for pathId " << pathId << " was " << it->second->DbRefCount);
+ LOG_DEBUG_S(*TlsActivationContext, NKikimrServices::FLAT_TX_SCHEMESHARD, "DecrementPathDbRefCount reason " << debug << " for pathId " << pathId << " was " << it->second->DbRefCount);
Y_VERIFY_DEBUG(it->second->DbRefCount > 0);
if (it->second->DbRefCount > 0) {
size_t newRefCount = --it->second->DbRefCount;
@@ -340,13 +340,13 @@ void TSchemeShard::DecrementPathDbRefCount(const TPathId& pathId, const TStringB
}
}
-bool TSchemeShard::ApplyStorageConfig(
+bool TSchemeShard::ApplyStorageConfig(
const TStoragePools &storagePools,
- const NKikimrSchemeOp::TStorageConfig &storageConfig,
+ const NKikimrSchemeOp::TStorageConfig &storageConfig,
TChannelsBindings &channelsBinding,
THashMap<TString, ui32> &reverseBinding,
TStorageRoom &room, TString &errorMsg)
-{
+{
if (channelsBinding && !reverseBinding) {
// Build a hash map from storage pool name to an existing channel number
for (ui32 channel = 1; channel < channelsBinding.size(); ++channel) {
@@ -354,25 +354,25 @@ bool TSchemeShard::ApplyStorageConfig(
}
}
- auto resolve = [] (const TStoragePools& pools,
- const NKikimrSchemeOp::TStorageSettings& settings)
- -> TStoragePools::const_iterator
- {
- const TString& kind = settings.GetPreferredPoolKind();
- auto it = std::find_if(pools.cbegin(), pools.cend(),
- [&kind] (const TStoragePools::value_type& pool)
- { return kind == pool.GetKind(); });
- if (it != pools.cend()) {
- return it;
- }
-
- if (settings.GetAllowOtherKinds()) {
- return pools.cbegin();
- }
-
- return pools.cend();
- };
-
+ auto resolve = [] (const TStoragePools& pools,
+ const NKikimrSchemeOp::TStorageSettings& settings)
+ -> TStoragePools::const_iterator
+ {
+ const TString& kind = settings.GetPreferredPoolKind();
+ auto it = std::find_if(pools.cbegin(), pools.cend(),
+ [&kind] (const TStoragePools::value_type& pool)
+ { return kind == pool.GetKind(); });
+ if (it != pools.cend()) {
+ return it;
+ }
+
+ if (settings.GetAllowOtherKinds()) {
+ return pools.cbegin();
+ }
+
+ return pools.cend();
+ };
+
auto allocateChannel = [&] (const TString& poolName) -> ui32 {
auto it = reverseBinding.find(poolName);
if (it != reverseBinding.end()) {
@@ -386,17 +386,17 @@ bool TSchemeShard::ApplyStorageConfig(
return channel;
};
-#define LOCAL_CHECK(expr, explanation) \
- if (Y_UNLIKELY(!(expr))) { \
- errorMsg = explanation; \
- return false; \
-}
-
+#define LOCAL_CHECK(expr, explanation) \
+ if (Y_UNLIKELY(!(expr))) { \
+ errorMsg = explanation; \
+ return false; \
+}
+
if (channelsBinding.size() < 1) {
LOCAL_CHECK(storageConfig.HasSysLog(), "no syslog storage setting");
auto sysLogPool = resolve(storagePools, storageConfig.GetSysLog());
LOCAL_CHECK(sysLogPool != storagePools.end(), "unable determine pool for syslog storage");
-
+
channelsBinding.emplace_back();
channelsBinding.back().SetStoragePoolName(sysLogPool->GetName());
}
@@ -405,7 +405,7 @@ bool TSchemeShard::ApplyStorageConfig(
LOCAL_CHECK(storageConfig.HasLog(), "no log storage setting");
auto logPool = resolve(storagePools, storageConfig.GetLog());
LOCAL_CHECK(logPool != storagePools.end(), "unable determine pool for log storage");
-
+
ui32 channel = allocateChannel(logPool->GetName());
Y_VERIFY(channel == 1, "Expected to allocate log channel, not %" PRIu32, channel);
}
@@ -416,63 +416,63 @@ bool TSchemeShard::ApplyStorageConfig(
room.AssignChannel(NKikimrStorageSettings::TChannelPurpose::Log, 1);
}
- if (storageConfig.HasData()) {
+ if (storageConfig.HasData()) {
auto dataPool = resolve(storagePools, storageConfig.GetData());
LOCAL_CHECK(dataPool != storagePools.end(), "definition of data storage present but unable determine pool for it");
ui32 channel = allocateChannel(dataPool->GetName());
room.AssignChannel(NKikimrStorageSettings::TChannelPurpose::Data, channel);
- }
-
- if (storageConfig.HasExternal()) {
+ }
+
+ if (storageConfig.HasExternal()) {
auto externalPool = resolve(storagePools, storageConfig.GetExternal());
LOCAL_CHECK(externalPool != storagePools.end(), "definition of externalPool storage present but unable determine pool for it");
ui32 channel = allocateChannel(externalPool->GetName());
room.AssignChannel(NKikimrStorageSettings::TChannelPurpose::External, channel);
- }
-
-#undef LOCAL_CHECK
-
- return true;
+ }
+
+#undef LOCAL_CHECK
+
return true;
-}
-
-void TSchemeShard::ClearDescribePathCaches(const TPathElement::TPtr node) {
- Y_VERIFY(node);
-
- if (node->Dropped() || !node->IsCreateFinished()) {
- return;
- }
-
- node->PreSerializedChildrenListing.clear();
-
- if (node->PathType == NKikimrSchemeOp::EPathType::EPathTypePersQueueGroup) {
- Y_VERIFY(PersQueueGroups.contains(node->PathId));
- TPersQueueGroupInfo::TPtr pqGroup = PersQueueGroups.at(node->PathId);
- pqGroup->PreSerializedPathDescription.clear();
- pqGroup->PreSerializedPartitionsDescription.clear();
- } else if (node->PathType == NKikimrSchemeOp::EPathType::EPathTypeTable) {
- Y_VERIFY(Tables.contains(node->PathId));
- TTableInfo::TPtr tabletInfo = Tables.at(node->PathId);
- tabletInfo->PreSerializedPathDescription.clear();
- }
-}
-
-bool TSchemeShard::IsStorageConfigLogic(const TTableInfo::TCPtr tableInfo) const {
- const NKikimrSchemeOp::TPartitionConfig& partitionConfig = tableInfo->PartitionConfig();
- const NKikimrSchemeOp::TFamilyDescription* pFamily = nullptr;
+ return true;
+}
+
+void TSchemeShard::ClearDescribePathCaches(const TPathElement::TPtr node) {
+ Y_VERIFY(node);
+
+ if (node->Dropped() || !node->IsCreateFinished()) {
+ return;
+ }
+
+ node->PreSerializedChildrenListing.clear();
+
+ if (node->PathType == NKikimrSchemeOp::EPathType::EPathTypePersQueueGroup) {
+ Y_VERIFY(PersQueueGroups.contains(node->PathId));
+ TPersQueueGroupInfo::TPtr pqGroup = PersQueueGroups.at(node->PathId);
+ pqGroup->PreSerializedPathDescription.clear();
+ pqGroup->PreSerializedPartitionsDescription.clear();
+ } else if (node->PathType == NKikimrSchemeOp::EPathType::EPathTypeTable) {
+ Y_VERIFY(Tables.contains(node->PathId));
+ TTableInfo::TPtr tabletInfo = Tables.at(node->PathId);
+ tabletInfo->PreSerializedPathDescription.clear();
+ }
+}
+
+bool TSchemeShard::IsStorageConfigLogic(const TTableInfo::TCPtr tableInfo) const {
+ const NKikimrSchemeOp::TPartitionConfig& partitionConfig = tableInfo->PartitionConfig();
+ const NKikimrSchemeOp::TFamilyDescription* pFamily = nullptr;
for (const auto& family : partitionConfig.GetColumnFamilies()) {
if (family.GetId() == 0) {
pFamily = &family;
}
- }
+ }
return pFamily && pFamily->HasStorageConfig();
-}
-
-bool TSchemeShard::GetBindingsRooms(
+}
+
+bool TSchemeShard::GetBindingsRooms(
const TPathId domainId,
- const NKikimrSchemeOp::TPartitionConfig& partitionConfig,
+ const NKikimrSchemeOp::TPartitionConfig& partitionConfig,
TVector<TStorageRoom> &rooms,
THashMap<ui32, ui32> &familyRooms,
TChannelsBindings &channelsBinding,
@@ -482,14 +482,14 @@ bool TSchemeShard::GetBindingsRooms(
Y_VERIFY(rooms[0].GetId() == 0);
// Find the primary column family
- const NKikimrSchemeOp::TFamilyDescription* pFamily = nullptr;
+ const NKikimrSchemeOp::TFamilyDescription* pFamily = nullptr;
for (const auto& family : partitionConfig.GetColumnFamilies()) {
if (family.GetId() == 0) {
pFamily = &family;
}
}
Y_VERIFY(pFamily && pFamily->HasStorageConfig());
-
+
TSubDomainInfo::TPtr domainInfo = SubDomains.at(domainId);
auto& storagePools = domainInfo->EffectiveStoragePools();
@@ -563,12 +563,12 @@ bool TSchemeShard::GetBindingsRooms(
}
return true;
-}
-
-bool TSchemeShard::GetBindingsRoomsChanges(
+}
+
+bool TSchemeShard::GetBindingsRoomsChanges(
const TPathId domainId,
const TVector<TTableShardInfo>& partitions,
- const NKikimrSchemeOp::TPartitionConfig& partitionConfig,
+ const NKikimrSchemeOp::TPartitionConfig& partitionConfig,
TBindingsRoomsChanges& changes,
TString& errStr)
{
@@ -610,7 +610,7 @@ bool TSchemeShard::GetBindingsRoomsChanges(
return true;
}
-bool TSchemeShard::GetOlapChannelsBindings(
+bool TSchemeShard::GetOlapChannelsBindings(
const TPathId domainId,
const NKikimrSchemeOp::TColumnStorageConfig& channelsConfig,
TChannelsBindings& channelsBindings,
@@ -638,7 +638,7 @@ bool TSchemeShard::GetOlapChannelsBindings(
return false;
}
- auto resolveChannel = [&](const NKikimrSchemeOp::TStorageSettings& settings) {
+ auto resolveChannel = [&](const NKikimrSchemeOp::TStorageSettings& settings) {
const TString& preferredKind = settings.GetPreferredPoolKind();
auto poolIt = std::find_if(
storagePools.begin(), storagePools.end(),
@@ -714,73 +714,73 @@ bool TSchemeShard::GetOlapChannelsBindings(
return true;
}
-bool TSchemeShard::IsCompatibleChannelProfileLogic(const TPathId domainId, const TTableInfo::TCPtr tableInfo) const {
- Y_UNUSED(domainId);
-
- Y_VERIFY(!IsStorageConfigLogic(tableInfo));
- if (!ChannelProfiles || !ChannelProfiles->Profiles.size()) {
- return false;
- }
-
- const NKikimrSchemeOp::TPartitionConfig& partitionConfig = tableInfo->PartitionConfig();
- ui32 profileId = partitionConfig.GetChannelProfileId();
- if (profileId >= ChannelProfiles->Profiles.size()) {
- return false;
- }
-
- return true;
-}
-
-bool TSchemeShard::GetChannelsBindings(const TPathId domainId, const TTableInfo::TCPtr tableInfo, TChannelsBindings &binding, TString &errStr) const {
- Y_VERIFY(!IsStorageConfigLogic(tableInfo));
- Y_VERIFY(IsCompatibleChannelProfileLogic(domainId, tableInfo));
-
- const NKikimrSchemeOp::TPartitionConfig& partitionConfig = tableInfo->PartitionConfig();
- ui32 profileId = partitionConfig.GetChannelProfileId();
-
- TChannelProfiles::TProfile& profile = ChannelProfiles->Profiles.at(profileId);
-
- TSubDomainInfo::TPtr domainInfo = SubDomains.at(domainId);
- const TStoragePools& storagePools = domainInfo->EffectiveStoragePools();
-
- if (storagePools.empty()) {
- errStr = "database doesn't have storage pools at all to create tablet channels to storage pool binding by profile id";
- return false;
- }
-
- if (!TabletResolveChannelsDetails(profileId, profile, storagePools, binding)) {
- errStr = "database doesn't have required storage pools to create tablet channels to storage pool binding by profile id";
- return false;
- }
- return true;
-}
-
-bool TSchemeShard::ResolveTabletChannels(ui32 profileId, const TPathId domainId, TChannelsBindings &channelsBinding) const
-{
- return ResolveChannelCommon(profileId, domainId, channelsBinding, &TabletResolveChannelsDetails);
-}
-
-bool TSchemeShard::ResolveRtmrChannels(const TPathId domainId, TChannelsBindings &channelsBinding) const
-{
- const ui32 profileId = 0;
- return ResolveChannelCommon(profileId, domainId, channelsBinding, &ResolveChannelsDetailsAsIs);
-}
-
-bool TSchemeShard::ResolveSolomonChannels(ui32 profileId, const TPathId domainId, TChannelsBindings &channelsBinding) const
-{
- return ResolveChannelCommon(profileId, domainId, channelsBinding, &ResolveChannelsDetailsAsIs);
-}
-
-bool TSchemeShard::ResolvePqChannels(ui32 profileId, const TPathId domainId, TChannelsBindings &channelsBinding) const
+bool TSchemeShard::IsCompatibleChannelProfileLogic(const TPathId domainId, const TTableInfo::TCPtr tableInfo) const {
+ Y_UNUSED(domainId);
+
+ Y_VERIFY(!IsStorageConfigLogic(tableInfo));
+ if (!ChannelProfiles || !ChannelProfiles->Profiles.size()) {
+ return false;
+ }
+
+ const NKikimrSchemeOp::TPartitionConfig& partitionConfig = tableInfo->PartitionConfig();
+ ui32 profileId = partitionConfig.GetChannelProfileId();
+ if (profileId >= ChannelProfiles->Profiles.size()) {
+ return false;
+ }
+
+ return true;
+}
+
+bool TSchemeShard::GetChannelsBindings(const TPathId domainId, const TTableInfo::TCPtr tableInfo, TChannelsBindings &binding, TString &errStr) const {
+ Y_VERIFY(!IsStorageConfigLogic(tableInfo));
+ Y_VERIFY(IsCompatibleChannelProfileLogic(domainId, tableInfo));
+
+ const NKikimrSchemeOp::TPartitionConfig& partitionConfig = tableInfo->PartitionConfig();
+ ui32 profileId = partitionConfig.GetChannelProfileId();
+
+ TChannelProfiles::TProfile& profile = ChannelProfiles->Profiles.at(profileId);
+
+ TSubDomainInfo::TPtr domainInfo = SubDomains.at(domainId);
+ const TStoragePools& storagePools = domainInfo->EffectiveStoragePools();
+
+ if (storagePools.empty()) {
+ errStr = "database doesn't have storage pools at all to create tablet channels to storage pool binding by profile id";
+ return false;
+ }
+
+ if (!TabletResolveChannelsDetails(profileId, profile, storagePools, binding)) {
+ errStr = "database doesn't have required storage pools to create tablet channels to storage pool binding by profile id";
+ return false;
+ }
+ return true;
+}
+
+bool TSchemeShard::ResolveTabletChannels(ui32 profileId, const TPathId domainId, TChannelsBindings &channelsBinding) const
+{
+ return ResolveChannelCommon(profileId, domainId, channelsBinding, &TabletResolveChannelsDetails);
+}
+
+bool TSchemeShard::ResolveRtmrChannels(const TPathId domainId, TChannelsBindings &channelsBinding) const
+{
+ const ui32 profileId = 0;
+ return ResolveChannelCommon(profileId, domainId, channelsBinding, &ResolveChannelsDetailsAsIs);
+}
+
+bool TSchemeShard::ResolveSolomonChannels(ui32 profileId, const TPathId domainId, TChannelsBindings &channelsBinding) const
+{
+ return ResolveChannelCommon(profileId, domainId, channelsBinding, &ResolveChannelsDetailsAsIs);
+}
+
+bool TSchemeShard::ResolvePqChannels(ui32 profileId, const TPathId domainId, TChannelsBindings &channelsBinding) const
{
return ResolveChannelCommon(profileId, domainId, channelsBinding, &ResolveChannelsDetailsAsIs);
}
-bool TSchemeShard::ResolveChannelsByPoolKinds(
+bool TSchemeShard::ResolveChannelsByPoolKinds(
const TVector<TStringBuf> &channelPoolKinds,
const TPathId domainId,
TChannelsBindings &channelsBinding) const
-{
+{
TSubDomainInfo::TPtr domainInfo = SubDomains.at(domainId);
auto& storagePools = domainInfo->EffectiveStoragePools();
@@ -802,9 +802,9 @@ bool TSchemeShard::ResolveChannelsByPoolKinds(
Y_VERIFY_DEBUG(!channelsBinding.empty());
return !channelsBinding.empty();
-}
-
-void TSchemeShard::SetNbsChannelsParams(
+}
+
+void TSchemeShard::SetNbsChannelsParams(
const google::protobuf::RepeatedPtrField<NKikimrBlockStore::TChannelProfile>& ecps,
TChannelsBindings& channelsBinding)
{
@@ -823,7 +823,7 @@ void TSchemeShard::SetNbsChannelsParams(
}
}
-void TSchemeShard::SetNfsChannelsParams(
+void TSchemeShard::SetNfsChannelsParams(
const google::protobuf::RepeatedPtrField<NKikimrFileStore::TChannelProfile>& ecps,
TChannelsBindings& channelsBinding)
{
@@ -842,7 +842,7 @@ void TSchemeShard::SetNfsChannelsParams(
}
}
-void TSchemeShard::SetPqChannelsParams(
+void TSchemeShard::SetPqChannelsParams(
const google::protobuf::RepeatedPtrField<NKikimrPQ::TChannelProfile>& ecps,
TChannelsBindings& channelsBinding)
{
@@ -861,52 +861,52 @@ void TSchemeShard::SetPqChannelsParams(
}
}
-bool TSchemeShard::ResolveSubdomainsChannels(const TStoragePools &storagePools, TChannelsBindings &channelsBinding) {
- if (!ChannelProfiles) {
- channelsBinding.clear();
- return false;
- }
+bool TSchemeShard::ResolveSubdomainsChannels(const TStoragePools &storagePools, TChannelsBindings &channelsBinding) {
+ if (!ChannelProfiles) {
+ channelsBinding.clear();
+ return false;
+ }
if (ChannelProfiles->Profiles.empty()) {
- channelsBinding.clear();
- return false;
- }
- if (!storagePools) {
- channelsBinding.clear();
- return false;
- }
- return TabletResolveChannelsDetails(0, ChannelProfiles->Profiles[0], storagePools, channelsBinding);
-}
-
-bool TSchemeShard::ResolveChannelCommon(ui32 profileId, const TPathId domainId, TChannelsBindings &channelsBinding, std::function<bool (ui32, const TChannelProfiles::TProfile &, const TStoragePools &, TChannelsBindings &)> resolveDetails) const
-{
- Y_VERIFY(ChannelProfiles);
- if (ChannelProfiles->Profiles.size() == 0) {
- return false; //there is some tests without channels.txt still
- }
- if(profileId >= ChannelProfiles->Profiles.size()) {
- return false;
- }
- const auto& profile = ChannelProfiles->Profiles[profileId];
- Y_VERIFY(profile.Channels.size() > 0);
-
- TSubDomainInfo::TPtr domainInfo = SubDomains.at(domainId);
- auto& storagePools = domainInfo->EffectiveStoragePools();
-
- if (!storagePools) {
- // no storage pool no binding it's Ok
- channelsBinding.clear();
- return false;
- }
-
- return resolveDetails(profileId, profile, storagePools, channelsBinding);
-}
-
-bool TSchemeShard::ResolveChannelsDetailsAsIs(
+ channelsBinding.clear();
+ return false;
+ }
+ if (!storagePools) {
+ channelsBinding.clear();
+ return false;
+ }
+ return TabletResolveChannelsDetails(0, ChannelProfiles->Profiles[0], storagePools, channelsBinding);
+}
+
+bool TSchemeShard::ResolveChannelCommon(ui32 profileId, const TPathId domainId, TChannelsBindings &channelsBinding, std::function<bool (ui32, const TChannelProfiles::TProfile &, const TStoragePools &, TChannelsBindings &)> resolveDetails) const
+{
+ Y_VERIFY(ChannelProfiles);
+ if (ChannelProfiles->Profiles.size() == 0) {
+ return false; //there is some tests without channels.txt still
+ }
+ if(profileId >= ChannelProfiles->Profiles.size()) {
+ return false;
+ }
+ const auto& profile = ChannelProfiles->Profiles[profileId];
+ Y_VERIFY(profile.Channels.size() > 0);
+
+ TSubDomainInfo::TPtr domainInfo = SubDomains.at(domainId);
+ auto& storagePools = domainInfo->EffectiveStoragePools();
+
+ if (!storagePools) {
+ // no storage pool no binding it's Ok
+ channelsBinding.clear();
+ return false;
+ }
+
+ return resolveDetails(profileId, profile, storagePools, channelsBinding);
+}
+
+bool TSchemeShard::ResolveChannelsDetailsAsIs(
ui32,
const TChannelProfiles::TProfile &profile,
const TStoragePools &storagePools,
TChannelsBindings &channelsBinding)
-{
+{
return ResolvePoolNames(
profile.Channels.size(),
[&] (ui32 channel) {
@@ -915,277 +915,277 @@ bool TSchemeShard::ResolveChannelsDetailsAsIs(
storagePools,
channelsBinding
);
-}
-
-bool TSchemeShard::TabletResolveChannelsDetails(ui32 profileId, const TChannelProfiles::TProfile &profile, const TStoragePools &storagePools, TChannelsBindings &channelsBinding)
-{
- const bool substituteMissedForDafaultProfile = 0 == profileId;
-
- TChannelsBindings result;
- std::set<TString> uniqPoolsNames;
-
- for (ui32 channelId = 0; channelId < profile.Channels.size(); ++channelId) {
- const TChannelProfiles::TProfile::TChannel& channel = profile.Channels[channelId];
-
- auto poolIt = std::find_if(storagePools.begin(), storagePools.end(),
- [&channel] (const TStoragePools::value_type& pool)
- { return channel.PoolKind == pool.GetKind(); });
-
- if (poolIt == storagePools.end()) {
- if (substituteMissedForDafaultProfile) {
- poolIt = storagePools.begin();
- } else {
- //unable to construct channel binding with the storage pool
- return false;
- }
- }
-
- // sys log channel is 0
- // log channel is 1 always
- if (0 == channelId || 1 == channelId) {
+}
+
+bool TSchemeShard::TabletResolveChannelsDetails(ui32 profileId, const TChannelProfiles::TProfile &profile, const TStoragePools &storagePools, TChannelsBindings &channelsBinding)
+{
+ const bool substituteMissedForDafaultProfile = 0 == profileId;
+
+ TChannelsBindings result;
+ std::set<TString> uniqPoolsNames;
+
+ for (ui32 channelId = 0; channelId < profile.Channels.size(); ++channelId) {
+ const TChannelProfiles::TProfile::TChannel& channel = profile.Channels[channelId];
+
+ auto poolIt = std::find_if(storagePools.begin(), storagePools.end(),
+ [&channel] (const TStoragePools::value_type& pool)
+ { return channel.PoolKind == pool.GetKind(); });
+
+ if (poolIt == storagePools.end()) {
+ if (substituteMissedForDafaultProfile) {
+ poolIt = storagePools.begin();
+ } else {
+ //unable to construct channel binding with the storage pool
+ return false;
+ }
+ }
+
+ // sys log channel is 0
+ // log channel is 1 always
+ if (0 == channelId || 1 == channelId) {
result.emplace_back();
result.back().SetStoragePoolName(poolIt->GetName());
- continue;
- }
-
- // bytheway, channel 1 maight be shared with data and ext in new interafeca with StorageConfig
- // but we already already provide for clients variable like ColumnStorage1Ext2
- // so we do not want to break them and we should always make at least 3 channe until StorageConfig is mainstream
- if (uniqPoolsNames.insert(poolIt->GetName()).second) {
+ continue;
+ }
+
+ // bytheway, channel 1 maight be shared with data and ext in new interafeca with StorageConfig
+ // but we already already provide for clients variable like ColumnStorage1Ext2
+ // so we do not want to break them and we should always make at least 3 channe until StorageConfig is mainstream
+ if (uniqPoolsNames.insert(poolIt->GetName()).second) {
result.emplace_back();
result.back().SetStoragePoolName(poolIt->GetName());
- }
- }
-
- channelsBinding.swap(result);
- return true;
-}
-
-TPathId TSchemeShard::ResolveDomainId(TPathId pathId) const {
- Y_VERIFY(pathId != InvalidPathId);
- Y_VERIFY(PathsById.contains(pathId));
- return ResolveDomainId(PathsById.at(pathId));
-}
-
-TPathId TSchemeShard::ResolveDomainId(TPathElement::TPtr pathEl) const {
- TPathId domainId = pathEl->IsDomainRoot()
- ? pathEl->PathId
- : pathEl->DomainPathId;
- Y_VERIFY(PathsById.contains(domainId));
- return domainId;
-}
-
-TSubDomainInfo::TPtr TSchemeShard::ResolveDomainInfo(TPathId pathId) const {
- Y_VERIFY(pathId != InvalidPathId);
- Y_VERIFY(PathsById.contains(pathId));
- return ResolveDomainInfo(PathsById.at(pathId));
-}
-
-TSubDomainInfo::TPtr TSchemeShard::ResolveDomainInfo(TPathElement::TPtr pathEl) const {
- TPathId domainId = ResolveDomainId(pathEl);
- Y_VERIFY(SubDomains.contains(domainId));
- auto info = SubDomains.at(domainId);
- Y_VERIFY(info);
- return info;
-}
-
-TPathId TSchemeShard::GetDomainKey(TPathId pathId) const {
+ }
+ }
+
+ channelsBinding.swap(result);
+ return true;
+}
+
+TPathId TSchemeShard::ResolveDomainId(TPathId pathId) const {
+ Y_VERIFY(pathId != InvalidPathId);
+ Y_VERIFY(PathsById.contains(pathId));
+ return ResolveDomainId(PathsById.at(pathId));
+}
+
+TPathId TSchemeShard::ResolveDomainId(TPathElement::TPtr pathEl) const {
+ TPathId domainId = pathEl->IsDomainRoot()
+ ? pathEl->PathId
+ : pathEl->DomainPathId;
+ Y_VERIFY(PathsById.contains(domainId));
+ return domainId;
+}
+
+TSubDomainInfo::TPtr TSchemeShard::ResolveDomainInfo(TPathId pathId) const {
+ Y_VERIFY(pathId != InvalidPathId);
+ Y_VERIFY(PathsById.contains(pathId));
+ return ResolveDomainInfo(PathsById.at(pathId));
+}
+
+TSubDomainInfo::TPtr TSchemeShard::ResolveDomainInfo(TPathElement::TPtr pathEl) const {
+ TPathId domainId = ResolveDomainId(pathEl);
+ Y_VERIFY(SubDomains.contains(domainId));
+ auto info = SubDomains.at(domainId);
+ Y_VERIFY(info);
+ return info;
+}
+
+TPathId TSchemeShard::GetDomainKey(TPathId pathId) const {
auto domainId = ResolveDomainId(pathId);
TPathElement::TPtr domainElement = PathsById.at(domainId);
Y_VERIFY(domainElement);
return domainElement->IsRoot() ? ParentDomainId : domainId;
}
-const NKikimrSubDomains::TProcessingParams &TSchemeShard::SelectProcessingPrarams(TPathId id) const {
- TPathElement::TPtr item = PathsById.at(id);
- return SelectProcessingPrarams(item);
-}
-
-const NKikimrSubDomains::TProcessingParams &TSchemeShard::SelectProcessingPrarams(TPathElement::TPtr pathEl) const {
- Y_VERIFY(pathEl.Get());
-
- auto subDomainInfo = ResolveDomainInfo(pathEl);
- if (subDomainInfo->IsSupportTransactions()) {
- return subDomainInfo->GetProcessingParams();
- }
-
- auto rootDomain = SubDomains.at(RootPathId());
- Y_VERIFY(rootDomain->IsSupportTransactions());
- return rootDomain->GetProcessingParams();
-}
-
-TTabletId TSchemeShard::SelectCoordinator(TTxId txId, TPathId pathId) const {
- Y_VERIFY(pathId != InvalidPathId);
- return SelectCoordinator(txId, PathsById.at(pathId));
-}
-
-TTabletId TSchemeShard::SelectCoordinator(TTxId txId, TPathElement::TPtr pathEl) const {
- Y_VERIFY(pathEl.Get());
-
- auto subDomainInfo = ResolveDomainInfo(pathEl->ParentPathId); //for subdomain node we must use parent domain
- if (subDomainInfo->IsSupportTransactions()) {
- return subDomainInfo->GetCoordinator(txId);
- }
-
- auto rootDomain = SubDomains.at(RootPathId());
- Y_VERIFY(rootDomain->IsSupportTransactions());
- return rootDomain->GetCoordinator(txId);
-}
-
-TString TSchemeShard::PathToString(TPathElement::TPtr item) {
- Y_VERIFY(item);
- TPath path = TPath::Init(item->PathId, this);
- return path.PathString();
-}
-
-bool TSchemeShard::CheckApplyIf(const NKikimrSchemeOp::TModifyScheme &scheme, TString &errStr) {
- const auto& conditions = scheme.GetApplyIf();
-
- for(const auto& item: conditions) {
- if (!item.HasPathId()) {
- continue;
- }
- TLocalPathId localPathId = item.GetPathId();
- const auto pathId = TPathId(TabletID(), localPathId);
-
- if (!PathsById.contains(pathId)) {
- errStr = TStringBuilder()
- << "fail user constraint: ApplyIf section:"
- << " no path with id " << pathId;
- return false;
- }
- const TPathElement::TPtr pathEl = PathsById.at(pathId);
-
- if (pathEl->Dropped()) {
- errStr = TStringBuilder()
- << "fail user constraint: ApplyIf section:"
- << " path with id " << pathId << " has been dropped";
- return false;
- }
-
- if (item.HasPathVersion()) {
- const auto requiredVersion = item.GetPathVersion();
- const auto actualVersion = GetPathVersion(TPath::Init(pathId, this)).GetGeneralVersion();
- if (requiredVersion != actualVersion) {
- errStr = TStringBuilder()
- << "fail user constraint in ApplyIf section:"
- << " path version mistmach, path with id " << pathEl->PathId
- << " has actual version " << actualVersion
- << " but version " << requiredVersion << " was required";
- return false;
- }
- }
-
- if (item.HasLockedTxId()) {
- const auto lockOwnerTxId = TTxId(item.GetLockedTxId());
-
- TString lockErr = "fail user constraint in ApplyIf section:";
- if (!CheckLocks(pathId, lockOwnerTxId, lockErr)) {
- errStr = lockErr;
- return false;
- }
- }
- }
-
- return true;
-}
-
-bool TSchemeShard::CheckLocks(const TPathId pathId, const NKikimrSchemeOp::TModifyScheme &scheme, TString &errStr) {
- if (scheme.HasLockGuard() && scheme.GetLockGuard().HasOwnerTxId()) {
- return CheckLocks(pathId, TTxId(scheme.GetLockGuard().GetOwnerTxId()), errStr);
- }
-
- return CheckLocks(pathId, InvalidTxId, errStr);
-}
-
-bool TSchemeShard::CheckLocks(const TPathId pathId, const TTxId lockTxId, TString& errStr) {
- if (lockTxId == InvalidTxId) {
- // check lock is free
- if (LockedPaths.contains(pathId)) {
- auto explain = TStringBuilder()
- << "fail user constraint in CheckLocks section:"
- << " checking path locks fails, path with id " << pathId
- << " has been locked by txId: " << LockedPaths.at(pathId)
- << " but ApplyIf declare that it should be free";
- errStr.append(explain);
- return false;
- }
-
- return true;
- }
-
- // check lock is correct
-
- if (!LockedPaths.contains(pathId)) {
- auto explain = TStringBuilder()
- << "fail user constraint in CheckLocks section:"
- << " checking path locks fails, path with id " << pathId
- << " hasn't been locked at all"
- << " but ApplyIf declare that it should be locked by: " << lockTxId;
- errStr.append(explain);
- return false;
- }
-
- if (LockedPaths.at(pathId) != lockTxId) {
- auto explain = TStringBuilder()
- << "fail user constraint in CheckLocks section:"
- << " checking path locks fails, path with id " << pathId
- << " has been locked by txId: " << LockedPaths.at(pathId)
- << " but ApplyIf declare that it should be locked by: " << lockTxId;
- errStr.append(explain);
- return false;
- }
-
- return true;
-
-}
-
-TShardIdx TSchemeShard::ReserveShardIdxs(ui64 count) {
- auto idx = TLocalShardIdx(NextLocalShardIdx);
- NextLocalShardIdx += count;
- return MakeLocalId(idx);
-}
-
-TShardIdx TSchemeShard::NextShardIdx(const TShardIdx& shardIdx, ui64 inc) const {
- Y_VERIFY(shardIdx.GetOwnerId() == TabletID());
-
- ui64 nextLocalId = ui64(shardIdx.GetLocalId()) + inc;
- Y_VERIFY_S(nextLocalId < NextLocalShardIdx, "what: nextLocalId: " << nextLocalId << " NextLocalShardIdx: " << NextLocalShardIdx);
-
- return MakeLocalId(TLocalShardIdx(nextLocalId));
-}
-
-TShardIdx TSchemeShard::RegisterShardInfo(TShardInfo&& shardInfo) {
+const NKikimrSubDomains::TProcessingParams &TSchemeShard::SelectProcessingPrarams(TPathId id) const {
+ TPathElement::TPtr item = PathsById.at(id);
+ return SelectProcessingPrarams(item);
+}
+
+const NKikimrSubDomains::TProcessingParams &TSchemeShard::SelectProcessingPrarams(TPathElement::TPtr pathEl) const {
+ Y_VERIFY(pathEl.Get());
+
+ auto subDomainInfo = ResolveDomainInfo(pathEl);
+ if (subDomainInfo->IsSupportTransactions()) {
+ return subDomainInfo->GetProcessingParams();
+ }
+
+ auto rootDomain = SubDomains.at(RootPathId());
+ Y_VERIFY(rootDomain->IsSupportTransactions());
+ return rootDomain->GetProcessingParams();
+}
+
+TTabletId TSchemeShard::SelectCoordinator(TTxId txId, TPathId pathId) const {
+ Y_VERIFY(pathId != InvalidPathId);
+ return SelectCoordinator(txId, PathsById.at(pathId));
+}
+
+TTabletId TSchemeShard::SelectCoordinator(TTxId txId, TPathElement::TPtr pathEl) const {
+ Y_VERIFY(pathEl.Get());
+
+ auto subDomainInfo = ResolveDomainInfo(pathEl->ParentPathId); //for subdomain node we must use parent domain
+ if (subDomainInfo->IsSupportTransactions()) {
+ return subDomainInfo->GetCoordinator(txId);
+ }
+
+ auto rootDomain = SubDomains.at(RootPathId());
+ Y_VERIFY(rootDomain->IsSupportTransactions());
+ return rootDomain->GetCoordinator(txId);
+}
+
+TString TSchemeShard::PathToString(TPathElement::TPtr item) {
+ Y_VERIFY(item);
+ TPath path = TPath::Init(item->PathId, this);
+ return path.PathString();
+}
+
+bool TSchemeShard::CheckApplyIf(const NKikimrSchemeOp::TModifyScheme &scheme, TString &errStr) {
+ const auto& conditions = scheme.GetApplyIf();
+
+ for(const auto& item: conditions) {
+ if (!item.HasPathId()) {
+ continue;
+ }
+ TLocalPathId localPathId = item.GetPathId();
+ const auto pathId = TPathId(TabletID(), localPathId);
+
+ if (!PathsById.contains(pathId)) {
+ errStr = TStringBuilder()
+ << "fail user constraint: ApplyIf section:"
+ << " no path with id " << pathId;
+ return false;
+ }
+ const TPathElement::TPtr pathEl = PathsById.at(pathId);
+
+ if (pathEl->Dropped()) {
+ errStr = TStringBuilder()
+ << "fail user constraint: ApplyIf section:"
+ << " path with id " << pathId << " has been dropped";
+ return false;
+ }
+
+ if (item.HasPathVersion()) {
+ const auto requiredVersion = item.GetPathVersion();
+ const auto actualVersion = GetPathVersion(TPath::Init(pathId, this)).GetGeneralVersion();
+ if (requiredVersion != actualVersion) {
+ errStr = TStringBuilder()
+ << "fail user constraint in ApplyIf section:"
+ << " path version mistmach, path with id " << pathEl->PathId
+ << " has actual version " << actualVersion
+ << " but version " << requiredVersion << " was required";
+ return false;
+ }
+ }
+
+ if (item.HasLockedTxId()) {
+ const auto lockOwnerTxId = TTxId(item.GetLockedTxId());
+
+ TString lockErr = "fail user constraint in ApplyIf section:";
+ if (!CheckLocks(pathId, lockOwnerTxId, lockErr)) {
+ errStr = lockErr;
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+bool TSchemeShard::CheckLocks(const TPathId pathId, const NKikimrSchemeOp::TModifyScheme &scheme, TString &errStr) {
+ if (scheme.HasLockGuard() && scheme.GetLockGuard().HasOwnerTxId()) {
+ return CheckLocks(pathId, TTxId(scheme.GetLockGuard().GetOwnerTxId()), errStr);
+ }
+
+ return CheckLocks(pathId, InvalidTxId, errStr);
+}
+
+bool TSchemeShard::CheckLocks(const TPathId pathId, const TTxId lockTxId, TString& errStr) {
+ if (lockTxId == InvalidTxId) {
+ // check lock is free
+ if (LockedPaths.contains(pathId)) {
+ auto explain = TStringBuilder()
+ << "fail user constraint in CheckLocks section:"
+ << " checking path locks fails, path with id " << pathId
+ << " has been locked by txId: " << LockedPaths.at(pathId)
+ << " but ApplyIf declare that it should be free";
+ errStr.append(explain);
+ return false;
+ }
+
+ return true;
+ }
+
+ // check lock is correct
+
+ if (!LockedPaths.contains(pathId)) {
+ auto explain = TStringBuilder()
+ << "fail user constraint in CheckLocks section:"
+ << " checking path locks fails, path with id " << pathId
+ << " hasn't been locked at all"
+ << " but ApplyIf declare that it should be locked by: " << lockTxId;
+ errStr.append(explain);
+ return false;
+ }
+
+ if (LockedPaths.at(pathId) != lockTxId) {
+ auto explain = TStringBuilder()
+ << "fail user constraint in CheckLocks section:"
+ << " checking path locks fails, path with id " << pathId
+ << " has been locked by txId: " << LockedPaths.at(pathId)
+ << " but ApplyIf declare that it should be locked by: " << lockTxId;
+ errStr.append(explain);
+ return false;
+ }
+
+ return true;
+
+}
+
+TShardIdx TSchemeShard::ReserveShardIdxs(ui64 count) {
+ auto idx = TLocalShardIdx(NextLocalShardIdx);
+ NextLocalShardIdx += count;
+ return MakeLocalId(idx);
+}
+
+TShardIdx TSchemeShard::NextShardIdx(const TShardIdx& shardIdx, ui64 inc) const {
+ Y_VERIFY(shardIdx.GetOwnerId() == TabletID());
+
+ ui64 nextLocalId = ui64(shardIdx.GetLocalId()) + inc;
+ Y_VERIFY_S(nextLocalId < NextLocalShardIdx, "what: nextLocalId: " << nextLocalId << " NextLocalShardIdx: " << NextLocalShardIdx);
+
+ return MakeLocalId(TLocalShardIdx(nextLocalId));
+}
+
+TShardIdx TSchemeShard::RegisterShardInfo(TShardInfo&& shardInfo) {
TShardIdx shardIdx = ReserveShardIdxs(1);
return RegisterShardInfo(shardIdx, std::move(shardInfo));
}
-TShardIdx TSchemeShard::RegisterShardInfo(const TShardInfo& shardInfo) {
+TShardIdx TSchemeShard::RegisterShardInfo(const TShardInfo& shardInfo) {
TShardIdx shardIdx = ReserveShardIdxs(1);
return RegisterShardInfo(shardIdx, shardInfo);
}
-TShardIdx TSchemeShard::RegisterShardInfo(const TShardIdx& shardIdx, TShardInfo&& shardInfo) {
+TShardIdx TSchemeShard::RegisterShardInfo(const TShardIdx& shardIdx, TShardInfo&& shardInfo) {
Y_VERIFY(shardIdx.GetOwnerId() == TabletID());
ui64 localId = ui64(shardIdx.GetLocalId());
Y_VERIFY_S(localId < NextLocalShardIdx, "shardIdx: " << shardIdx << " NextLocalShardIdx: " << NextLocalShardIdx);
Y_VERIFY_S(!ShardInfos.contains(shardIdx), "shardIdx: " << shardIdx << " already registered");
- IncrementPathDbRefCount(shardInfo.PathId, "new shard created");
+ IncrementPathDbRefCount(shardInfo.PathId, "new shard created");
ShardInfos.emplace(shardIdx, std::move(shardInfo));
return shardIdx;
}
-TShardIdx TSchemeShard::RegisterShardInfo(const TShardIdx& shardIdx, const TShardInfo& shardInfo) {
+TShardIdx TSchemeShard::RegisterShardInfo(const TShardIdx& shardIdx, const TShardInfo& shardInfo) {
Y_VERIFY(shardIdx.GetOwnerId() == TabletID());
ui64 localId = ui64(shardIdx.GetLocalId());
Y_VERIFY_S(localId < NextLocalShardIdx, "shardIdx: " << shardIdx << " NextLocalShardIdx: " << NextLocalShardIdx);
Y_VERIFY_S(!ShardInfos.contains(shardIdx), "shardIdx: " << shardIdx << " already registered");
- IncrementPathDbRefCount(shardInfo.PathId, "new shard created");
+ IncrementPathDbRefCount(shardInfo.PathId, "new shard created");
ShardInfos.emplace(shardIdx, shardInfo);
return shardIdx;
}
-const TTableInfo* TSchemeShard::GetMainTableForIndex(TPathId indexTableId) const {
+const TTableInfo* TSchemeShard::GetMainTableForIndex(TPathId indexTableId) const {
if (!Tables.contains(indexTableId))
return nullptr;
@@ -1207,52 +1207,52 @@ const TTableInfo* TSchemeShard::GetMainTableForIndex(TPathId indexTableId) const
return Tables.FindPtr(grandParentId)->Get();
}
-TPathElement::EPathState TSchemeShard::CalcPathState(TTxState::ETxType txType, TPathElement::EPathState oldState) {
- // Do not change state if PathId is dropped. It can't become alive.
- switch (oldState) {
- case TPathElement::EPathState::EPathStateNotExist:
- case TPathElement::EPathState::EPathStateDrop: // there could be multiple TXs, preserve StateDrop
- return oldState;
- case TPathElement::EPathState::EPathStateUpgrade:
- return oldState;
- default:
- break;
- }
-
- switch (txType) {
- case TTxState::TxMkDir:
- case TTxState::TxCreateTable:
- case TTxState::TxCopyTable:
- case TTxState::TxCreatePQGroup:
- case TTxState::TxCreateSubDomain:
- case TTxState::TxCreateExtSubDomain:
- case TTxState::TxCreateBlockStoreVolume:
+TPathElement::EPathState TSchemeShard::CalcPathState(TTxState::ETxType txType, TPathElement::EPathState oldState) {
+ // Do not change state if PathId is dropped. It can't become alive.
+ switch (oldState) {
+ case TPathElement::EPathState::EPathStateNotExist:
+ case TPathElement::EPathState::EPathStateDrop: // there could be multiple TXs, preserve StateDrop
+ return oldState;
+ case TPathElement::EPathState::EPathStateUpgrade:
+ return oldState;
+ default:
+ break;
+ }
+
+ switch (txType) {
+ case TTxState::TxMkDir:
+ case TTxState::TxCreateTable:
+ case TTxState::TxCopyTable:
+ case TTxState::TxCreatePQGroup:
+ case TTxState::TxCreateSubDomain:
+ case TTxState::TxCreateExtSubDomain:
+ case TTxState::TxCreateBlockStoreVolume:
case TTxState::TxCreateFileStore:
- case TTxState::TxCreateKesus:
- case TTxState::TxCreateSolomonVolume:
- case TTxState::TxCreateRtmrVolume:
- case TTxState::TxCreateTableIndex:
+ case TTxState::TxCreateKesus:
+ case TTxState::TxCreateSolomonVolume:
+ case TTxState::TxCreateRtmrVolume:
+ case TTxState::TxCreateTableIndex:
case TTxState::TxCreateOlapStore:
case TTxState::TxCreateOlapTable:
case TTxState::TxCreateCdcStream:
case TTxState::TxCreateSequence:
case TTxState::TxCreateReplication:
- return TPathElement::EPathState::EPathStateCreate;
- case TTxState::TxAlterPQGroup:
- case TTxState::TxAlterTable:
- case TTxState::TxAlterBlockStoreVolume:
+ return TPathElement::EPathState::EPathStateCreate;
+ case TTxState::TxAlterPQGroup:
+ case TTxState::TxAlterTable:
+ case TTxState::TxAlterBlockStoreVolume:
case TTxState::TxAlterFileStore:
- case TTxState::TxAlterKesus:
- case TTxState::TxAlterSubDomain:
- case TTxState::TxAlterExtSubDomain:
- case TTxState::TxAlterUserAttributes:
- case TTxState::TxInitializeBuildIndex:
- case TTxState::TxFinalizeBuildIndex:
- case TTxState::TxCreateLockForIndexBuild:
- case TTxState::TxDropLock:
- case TTxState::TxAlterTableIndex:
- case TTxState::TxAlterSolomonVolume:
- case TTxState::TxDropTableIndexAtMainTable:
+ case TTxState::TxAlterKesus:
+ case TTxState::TxAlterSubDomain:
+ case TTxState::TxAlterExtSubDomain:
+ case TTxState::TxAlterUserAttributes:
+ case TTxState::TxInitializeBuildIndex:
+ case TTxState::TxFinalizeBuildIndex:
+ case TTxState::TxCreateLockForIndexBuild:
+ case TTxState::TxDropLock:
+ case TTxState::TxAlterTableIndex:
+ case TTxState::TxAlterSolomonVolume:
+ case TTxState::TxDropTableIndexAtMainTable:
case TTxState::TxAlterOlapStore:
case TTxState::TxAlterOlapTable:
case TTxState::TxAlterCdcStream:
@@ -1261,49 +1261,49 @@ TPathElement::EPathState TSchemeShard::CalcPathState(TTxState::ETxType txType, T
case TTxState::TxDropCdcStreamAtTable:
case TTxState::TxAlterSequence:
case TTxState::TxAlterReplication:
- return TPathElement::EPathState::EPathStateAlter;
- case TTxState::TxDropTable:
- case TTxState::TxDropPQGroup:
- case TTxState::TxRmDir:
- case TTxState::TxDropSubDomain:
- case TTxState::TxForceDropSubDomain:
- case TTxState::TxForceDropExtSubDomain:
- case TTxState::TxDropBlockStoreVolume:
+ return TPathElement::EPathState::EPathStateAlter;
+ case TTxState::TxDropTable:
+ case TTxState::TxDropPQGroup:
+ case TTxState::TxRmDir:
+ case TTxState::TxDropSubDomain:
+ case TTxState::TxForceDropSubDomain:
+ case TTxState::TxForceDropExtSubDomain:
+ case TTxState::TxDropBlockStoreVolume:
case TTxState::TxDropFileStore:
- case TTxState::TxDropKesus:
- case TTxState::TxDropSolomonVolume:
- case TTxState::TxDropTableIndex:
+ case TTxState::TxDropKesus:
+ case TTxState::TxDropSolomonVolume:
+ case TTxState::TxDropTableIndex:
case TTxState::TxDropOlapStore:
case TTxState::TxDropOlapTable:
case TTxState::TxDropCdcStream:
case TTxState::TxDropSequence:
case TTxState::TxDropReplication:
- return TPathElement::EPathState::EPathStateDrop;
- case TTxState::TxBackup:
- return TPathElement::EPathState::EPathStateBackup;
+ return TPathElement::EPathState::EPathStateDrop;
+ case TTxState::TxBackup:
+ return TPathElement::EPathState::EPathStateBackup;
case TTxState::TxRestore:
return TPathElement::EPathState::EPathStateRestore;
- case TTxState::TxUpgradeSubDomain:
- return TPathElement::EPathState::EPathStateUpgrade;
- case TTxState::TxUpgradeSubDomainDecision:
- return TPathElement::EPathState::EPathStateAlter; // if only TxUpgradeSubDomainDecision hangs under path it is considered just as Alter
- case TTxState::TxSplitTablePartition:
- case TTxState::TxMergeTablePartition:
- break;
- case TTxState::TxFillIndex:
- Y_FAIL("deprecated");
- case TTxState::TxModifyACL:
- case TTxState::TxInvalid:
- case TTxState::TxAssignBlockStoreVolume:
- Y_UNREACHABLE();
- case TTxState::TxMoveTable:
- case TTxState::TxMoveTableIndex:
- return TPathElement::EPathState::EPathStateCreate;
- }
- return oldState;
-}
-
-bool TSchemeShard::TRwTxBase::Execute(NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx) {
+ case TTxState::TxUpgradeSubDomain:
+ return TPathElement::EPathState::EPathStateUpgrade;
+ case TTxState::TxUpgradeSubDomainDecision:
+ return TPathElement::EPathState::EPathStateAlter; // if only TxUpgradeSubDomainDecision hangs under path it is considered just as Alter
+ case TTxState::TxSplitTablePartition:
+ case TTxState::TxMergeTablePartition:
+ break;
+ case TTxState::TxFillIndex:
+ Y_FAIL("deprecated");
+ case TTxState::TxModifyACL:
+ case TTxState::TxInvalid:
+ case TTxState::TxAssignBlockStoreVolume:
+ Y_UNREACHABLE();
+ case TTxState::TxMoveTable:
+ case TTxState::TxMoveTableIndex:
+ return TPathElement::EPathState::EPathStateCreate;
+ }
+ return oldState;
+}
+
+bool TSchemeShard::TRwTxBase::Execute(NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx) {
THPTimer cpuTimer;
// Transactions don't read anything from the DB, they all use in-mem structures and do writes to the DB
@@ -1312,86 +1312,86 @@ bool TSchemeShard::TRwTxBase::Execute(NTabletFlatExecutor::TTransactionContext &
try {
DoExecute(txc, ctx);
- } catch (const std::exception& ex) {
- Y_FAIL_S("there must be no leaked exceptions: " << ex.what() << ", at schemeshard: " << Self->TabletID());
+ } catch (const std::exception& ex) {
+ Y_FAIL_S("there must be no leaked exceptions: " << ex.what() << ", at schemeshard: " << Self->TabletID());
} catch (...) {
- Y_FAIL_S("there must be no leaked exceptions, at schemeshard: " << Self->TabletID());
+ Y_FAIL_S("there must be no leaked exceptions, at schemeshard: " << Self->TabletID());
}
ExecuteDuration = TDuration::Seconds(cpuTimer.Passed());
return true;
}
-void TSchemeShard::TRwTxBase::Complete(const TActorContext &ctx) {
+void TSchemeShard::TRwTxBase::Complete(const TActorContext &ctx) {
DoComplete(ctx);
}
-void TSchemeShard::PersistTableIndex(NIceDb::TNiceDb& db, const TPathId& pathId) {
- Y_VERIFY(PathsById.contains(pathId));
- TPathElement::TPtr elemnt = PathsById.at(pathId);
-
- Y_VERIFY(Indexes.contains(pathId));
- TTableIndexInfo::TPtr index = Indexes.at(pathId);
+void TSchemeShard::PersistTableIndex(NIceDb::TNiceDb& db, const TPathId& pathId) {
+ Y_VERIFY(PathsById.contains(pathId));
+ TPathElement::TPtr elemnt = PathsById.at(pathId);
- Y_VERIFY(IsLocalId(elemnt->PathId));
- Y_VERIFY(elemnt->IsTableIndex());
-
- TTableIndexInfo::TPtr alterData = index->AlterData;
- Y_VERIFY(alterData);
- Y_VERIFY(index->AlterVersion < alterData->AlterVersion);
+ Y_VERIFY(Indexes.contains(pathId));
+ TTableIndexInfo::TPtr index = Indexes.at(pathId);
- db.Table<Schema::TableIndex>().Key(elemnt->PathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::TableIndex::AlterVersion>(alterData->AlterVersion),
- NIceDb::TUpdate<Schema::TableIndex::IndexType>(alterData->Type),
- NIceDb::TUpdate<Schema::TableIndex::State>(alterData->State));
+ Y_VERIFY(IsLocalId(elemnt->PathId));
+ Y_VERIFY(elemnt->IsTableIndex());
- db.Table<Schema::TableIndexAlterData>().Key(elemnt->PathId.LocalPathId).Delete();
+ TTableIndexInfo::TPtr alterData = index->AlterData;
+ Y_VERIFY(alterData);
+ Y_VERIFY(index->AlterVersion < alterData->AlterVersion);
+
+ db.Table<Schema::TableIndex>().Key(elemnt->PathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::TableIndex::AlterVersion>(alterData->AlterVersion),
+ NIceDb::TUpdate<Schema::TableIndex::IndexType>(alterData->Type),
+ NIceDb::TUpdate<Schema::TableIndex::State>(alterData->State));
+
+ db.Table<Schema::TableIndexAlterData>().Key(elemnt->PathId.LocalPathId).Delete();
- for (ui32 keyIdx = 0; keyIdx < alterData->IndexKeys.size(); ++keyIdx) {
- db.Table<Schema::TableIndexKeys>().Key(elemnt->PathId.LocalPathId, keyIdx).Update(
- NIceDb::TUpdate<Schema::TableIndexKeys::KeyName>(alterData->IndexKeys[keyIdx]));
+ for (ui32 keyIdx = 0; keyIdx < alterData->IndexKeys.size(); ++keyIdx) {
+ db.Table<Schema::TableIndexKeys>().Key(elemnt->PathId.LocalPathId, keyIdx).Update(
+ NIceDb::TUpdate<Schema::TableIndexKeys::KeyName>(alterData->IndexKeys[keyIdx]));
- db.Table<Schema::TableIndexKeysAlterData>().Key(elemnt->PathId.LocalPathId, keyIdx).Delete();
+ db.Table<Schema::TableIndexKeysAlterData>().Key(elemnt->PathId.LocalPathId, keyIdx).Delete();
}
for (ui32 dataColIdx = 0; dataColIdx < alterData->IndexDataColumns.size(); ++dataColIdx) {
- db.Table<Schema::TableIndexDataColumns>().Key(elemnt->PathId.OwnerId, elemnt->PathId.LocalPathId, dataColIdx).Update(
+ db.Table<Schema::TableIndexDataColumns>().Key(elemnt->PathId.OwnerId, elemnt->PathId.LocalPathId, dataColIdx).Update(
NIceDb::TUpdate<Schema::TableIndexDataColumns::DataColumnName>(alterData->IndexDataColumns[dataColIdx]));
- db.Table<Schema::TableIndexDataColumnsAlterData>().Key(elemnt->PathId.OwnerId, elemnt->PathId.LocalPathId, dataColIdx).Delete();
+ db.Table<Schema::TableIndexDataColumnsAlterData>().Key(elemnt->PathId.OwnerId, elemnt->PathId.LocalPathId, dataColIdx).Delete();
}
}
-void TSchemeShard::PersistTableIndexAlterData(NIceDb::TNiceDb& db, const TPathId& pathId) {
- Y_VERIFY(PathsById.contains(pathId));
- TPathElement::TPtr elemnt = PathsById.at(pathId);
-
- Y_VERIFY(Indexes.contains(pathId));
- TTableIndexInfo::TPtr index = Indexes.at(pathId);
+void TSchemeShard::PersistTableIndexAlterData(NIceDb::TNiceDb& db, const TPathId& pathId) {
+ Y_VERIFY(PathsById.contains(pathId));
+ TPathElement::TPtr elemnt = PathsById.at(pathId);
- Y_VERIFY(IsLocalId(pathId));
- Y_VERIFY(elemnt->IsTableIndex());
-
- TTableIndexInfo::TPtr alterData = index->AlterData;
- Y_VERIFY(alterData);
+ Y_VERIFY(Indexes.contains(pathId));
+ TTableIndexInfo::TPtr index = Indexes.at(pathId);
- db.Table<Schema::TableIndexAlterData>().Key(elemnt->PathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::TableIndexAlterData::AlterVersion>(alterData->AlterVersion),
- NIceDb::TUpdate<Schema::TableIndexAlterData::IndexType>(alterData->Type),
- NIceDb::TUpdate<Schema::TableIndexAlterData::State>(alterData->State));
+ Y_VERIFY(IsLocalId(pathId));
+ Y_VERIFY(elemnt->IsTableIndex());
- for (ui32 keyIdx = 0; keyIdx < alterData->IndexKeys.size(); ++keyIdx) {
- db.Table<Schema::TableIndexKeysAlterData>().Key(elemnt->PathId.LocalPathId, keyIdx).Update(
- NIceDb::TUpdate<Schema::TableIndexKeysAlterData::KeyName>(alterData->IndexKeys[keyIdx]));
+ TTableIndexInfo::TPtr alterData = index->AlterData;
+ Y_VERIFY(alterData);
+
+ db.Table<Schema::TableIndexAlterData>().Key(elemnt->PathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::TableIndexAlterData::AlterVersion>(alterData->AlterVersion),
+ NIceDb::TUpdate<Schema::TableIndexAlterData::IndexType>(alterData->Type),
+ NIceDb::TUpdate<Schema::TableIndexAlterData::State>(alterData->State));
+
+ for (ui32 keyIdx = 0; keyIdx < alterData->IndexKeys.size(); ++keyIdx) {
+ db.Table<Schema::TableIndexKeysAlterData>().Key(elemnt->PathId.LocalPathId, keyIdx).Update(
+ NIceDb::TUpdate<Schema::TableIndexKeysAlterData::KeyName>(alterData->IndexKeys[keyIdx]));
}
for (ui32 dataColIdx = 0; dataColIdx < alterData->IndexDataColumns.size(); ++dataColIdx) {
- db.Table<Schema::TableIndexDataColumnsAlterData>().Key(elemnt->PathId.OwnerId, elemnt->PathId.LocalPathId, dataColIdx).Update(
+ db.Table<Schema::TableIndexDataColumnsAlterData>().Key(elemnt->PathId.OwnerId, elemnt->PathId.LocalPathId, dataColIdx).Update(
NIceDb::TUpdate<Schema::TableIndexDataColumnsAlterData::DataColumnName>(alterData->IndexDataColumns[dataColIdx]));
}
}
-void TSchemeShard::PersistCdcStream(NIceDb::TNiceDb& db, const TPathId& pathId) {
+void TSchemeShard::PersistCdcStream(NIceDb::TNiceDb& db, const TPathId& pathId) {
Y_VERIFY(PathsById.contains(pathId));
auto path = PathsById.at(pathId);
@@ -1414,7 +1414,7 @@ void TSchemeShard::PersistCdcStream(NIceDb::TNiceDb& db, const TPathId& pathId)
db.Table<Schema::CdcStreamAlterData>().Key(pathId.OwnerId, pathId.LocalPathId).Delete();
}
-void TSchemeShard::PersistCdcStreamAlterData(NIceDb::TNiceDb& db, const TPathId& pathId) {
+void TSchemeShard::PersistCdcStreamAlterData(NIceDb::TNiceDb& db, const TPathId& pathId) {
Y_VERIFY(PathsById.contains(pathId));
auto path = PathsById.at(pathId);
@@ -1434,7 +1434,7 @@ void TSchemeShard::PersistCdcStreamAlterData(NIceDb::TNiceDb& db, const TPathId&
);
}
-void TSchemeShard::PersistRemoveCdcStream(NIceDb::TNiceDb &db, const TPathId& pathId) {
+void TSchemeShard::PersistRemoveCdcStream(NIceDb::TNiceDb &db, const TPathId& pathId) {
Y_VERIFY(PathsById.contains(pathId));
auto path = PathsById.at(pathId);
@@ -1453,142 +1453,142 @@ void TSchemeShard::PersistRemoveCdcStream(NIceDb::TNiceDb &db, const TPathId& pa
DecrementPathDbRefCount(pathId);
}
-void TSchemeShard::PersistAlterUserAttributes(NIceDb::TNiceDb& db, TPathId pathId) {
- Y_VERIFY(PathsById.contains(pathId));
- TPathElement::TPtr element = PathsById.at(pathId);
-
- if (!element->UserAttrs->AlterData) {
- return;
- }
-
- for (auto& item: element->UserAttrs->AlterData->Attrs) {
- const auto& name = item.first;
- const auto& value = item.second;
- if (pathId.OwnerId == TabletID()) {
- db.Table<Schema::UserAttributesAlterData>().Key(pathId.LocalPathId, name).Update(
- NIceDb::TUpdate<Schema::UserAttributesAlterData::AttrValue>(value));
- } else {
- db.Table<Schema::MigratedUserAttributesAlterData>().Key(pathId.OwnerId, pathId.LocalPathId, name).Update(
- NIceDb::TUpdate<Schema::MigratedUserAttributesAlterData::AttrValue>(value));
- }
- }
-}
-
-void TSchemeShard::ApplyAndPersistUserAttrs(NIceDb::TNiceDb& db, const TPathId& pathId) {
- Y_VERIFY(PathsById.contains(pathId));
- TPathElement::TPtr element = PathsById.at(pathId);
- Y_VERIFY(element->UserAttrs);
-
- if (!element->UserAttrs->AlterData) {
- return;
- }
-
- TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Add(element->UserAttrs->AlterData->Size());
- TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(element->UserAttrs->Size());
-
- PersistUserAttributes(db, pathId, element->UserAttrs, element->UserAttrs->AlterData);
-
- element->UserAttrs = element->UserAttrs->AlterData;
- element->UserAttrs->AlterData.Reset();
- element->ApplySpecialAttributes();
-}
-
-
-void TSchemeShard::PersistUserAttributes(NIceDb::TNiceDb& db, TPathId pathId,
- TUserAttributes::TPtr oldAttrs, TUserAttributes::TPtr alterAttrs) {
- //remove old version
- if (oldAttrs) {
- for (auto& item: oldAttrs->Attrs) {
- const auto& name = item.first;
- if (pathId.OwnerId == TabletID()) {
- db.Table<Schema::UserAttributes>().Key(pathId.LocalPathId, name).Delete();
- }
-
- db.Table<Schema::MigratedUserAttributes>().Key(pathId.OwnerId, pathId.LocalPathId, name).Delete();
- }
- }
- //aply new version and clear UserAttributesAlterData
- if (!alterAttrs) {
- return;
- }
- for (auto& item: alterAttrs->Attrs) {
- const auto& name = item.first;
- const auto& value = item.second;
- if (pathId.OwnerId == TabletID()) {
- db.Table<Schema::UserAttributes>().Key(pathId.LocalPathId, name).Update(
- NIceDb::TUpdate<Schema::UserAttributes::AttrValue>(value));
-
- db.Table<Schema::UserAttributesAlterData>().Key(pathId.LocalPathId, name).Delete();
- } else {
- db.Table<Schema::MigratedUserAttributes>().Key(pathId.OwnerId, pathId.LocalPathId, name).Update(
- NIceDb::TUpdate<Schema::MigratedUserAttributes::AttrValue>(value));
- }
-
- db.Table<Schema::MigratedUserAttributesAlterData>().Key(pathId.OwnerId, pathId.LocalPathId, name).Delete();
- }
-
- if (pathId.OwnerId == TabletID()) {
- //update UserAttrs's AlterVersion in Paths table
- db.Table<Schema::Paths>().Key(pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::Paths::UserAttrsAlterVersion>(alterAttrs->AlterVersion));
- } else {
- db.Table<Schema::MigratedPaths>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::MigratedPaths::UserAttrsAlterVersion>(alterAttrs->AlterVersion));
- }
-}
-
-
-void TSchemeShard::PersistLastTxId(NIceDb::TNiceDb& db, const TPathElement::TPtr path) {
- if (path->PathId.OwnerId == TabletID()) {
- db.Table<Schema::Paths>().Key(path->PathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::Paths::LastTxId>(path->LastTxId));
- } else {
- db.Table<Schema::MigratedPaths>().Key(path->PathId.OwnerId, path->PathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::MigratedPaths::LastTxId>(path->LastTxId));
- }
-}
-
-void TSchemeShard::PersistPath(NIceDb::TNiceDb& db, const TPathId& pathId) {
- Y_VERIFY(PathsById.contains(pathId));
- TPathElement::TPtr elemnt = PathsById.at(pathId);
- if (IsLocalId(pathId)) {
- db.Table<Schema::Paths>().Key(pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::Paths::ParentOwnerId>(elemnt->ParentPathId.OwnerId),
- NIceDb::TUpdate<Schema::Paths::ParentId>(elemnt->ParentPathId.LocalPathId),
- NIceDb::TUpdate<Schema::Paths::Name>(elemnt->Name),
- NIceDb::TUpdate<Schema::Paths::PathType>(elemnt->PathType),
- NIceDb::TUpdate<Schema::Paths::StepCreated>(elemnt->StepCreated),
- NIceDb::TUpdate<Schema::Paths::CreateTxId>(elemnt->CreateTxId),
- NIceDb::TUpdate<Schema::Paths::StepDropped>(elemnt->StepDropped),
- NIceDb::TUpdate<Schema::Paths::DropTxId>(elemnt->DropTxId),
- NIceDb::TUpdate<Schema::Paths::Owner>(elemnt->Owner),
- NIceDb::TUpdate<Schema::Paths::ACL>(elemnt->ACL),
- NIceDb::TUpdate<Schema::Paths::LastTxId>(elemnt->LastTxId),
- NIceDb::TUpdate<Schema::Paths::DirAlterVersion>(elemnt->DirAlterVersion),
- NIceDb::TUpdate<Schema::Paths::UserAttrsAlterVersion>(elemnt->UserAttrs->AlterVersion),
- NIceDb::TUpdate<Schema::Paths::ACLVersion>(elemnt->ACLVersion)
- );
- } else {
- db.Table<Schema::MigratedPaths>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::MigratedPaths::ParentOwnerId>(elemnt->ParentPathId.OwnerId),
- NIceDb::TUpdate<Schema::MigratedPaths::ParentLocalId>(elemnt->ParentPathId.LocalPathId),
- NIceDb::TUpdate<Schema::MigratedPaths::Name>(elemnt->Name),
- NIceDb::TUpdate<Schema::MigratedPaths::PathType>(elemnt->PathType),
- NIceDb::TUpdate<Schema::MigratedPaths::StepCreated>(elemnt->StepCreated),
- NIceDb::TUpdate<Schema::MigratedPaths::CreateTxId>(elemnt->CreateTxId),
- NIceDb::TUpdate<Schema::MigratedPaths::StepDropped>(elemnt->StepDropped),
- NIceDb::TUpdate<Schema::MigratedPaths::DropTxId>(elemnt->DropTxId),
- NIceDb::TUpdate<Schema::MigratedPaths::Owner>(elemnt->Owner),
- NIceDb::TUpdate<Schema::MigratedPaths::ACL>(elemnt->ACL),
- NIceDb::TUpdate<Schema::MigratedPaths::LastTxId>(elemnt->LastTxId),
- NIceDb::TUpdate<Schema::MigratedPaths::DirAlterVersion>(elemnt->DirAlterVersion),
- NIceDb::TUpdate<Schema::MigratedPaths::UserAttrsAlterVersion>(elemnt->UserAttrs->AlterVersion),
- NIceDb::TUpdate<Schema::MigratedPaths::ACLVersion>(elemnt->ACLVersion)
- );
- }
-}
-
-void TSchemeShard::PersistRemovePath(NIceDb::TNiceDb& db, const TPathElement::TPtr path) {
+void TSchemeShard::PersistAlterUserAttributes(NIceDb::TNiceDb& db, TPathId pathId) {
+ Y_VERIFY(PathsById.contains(pathId));
+ TPathElement::TPtr element = PathsById.at(pathId);
+
+ if (!element->UserAttrs->AlterData) {
+ return;
+ }
+
+ for (auto& item: element->UserAttrs->AlterData->Attrs) {
+ const auto& name = item.first;
+ const auto& value = item.second;
+ if (pathId.OwnerId == TabletID()) {
+ db.Table<Schema::UserAttributesAlterData>().Key(pathId.LocalPathId, name).Update(
+ NIceDb::TUpdate<Schema::UserAttributesAlterData::AttrValue>(value));
+ } else {
+ db.Table<Schema::MigratedUserAttributesAlterData>().Key(pathId.OwnerId, pathId.LocalPathId, name).Update(
+ NIceDb::TUpdate<Schema::MigratedUserAttributesAlterData::AttrValue>(value));
+ }
+ }
+}
+
+void TSchemeShard::ApplyAndPersistUserAttrs(NIceDb::TNiceDb& db, const TPathId& pathId) {
+ Y_VERIFY(PathsById.contains(pathId));
+ TPathElement::TPtr element = PathsById.at(pathId);
+ Y_VERIFY(element->UserAttrs);
+
+ if (!element->UserAttrs->AlterData) {
+ return;
+ }
+
+ TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Add(element->UserAttrs->AlterData->Size());
+ TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(element->UserAttrs->Size());
+
+ PersistUserAttributes(db, pathId, element->UserAttrs, element->UserAttrs->AlterData);
+
+ element->UserAttrs = element->UserAttrs->AlterData;
+ element->UserAttrs->AlterData.Reset();
+ element->ApplySpecialAttributes();
+}
+
+
+void TSchemeShard::PersistUserAttributes(NIceDb::TNiceDb& db, TPathId pathId,
+ TUserAttributes::TPtr oldAttrs, TUserAttributes::TPtr alterAttrs) {
+ //remove old version
+ if (oldAttrs) {
+ for (auto& item: oldAttrs->Attrs) {
+ const auto& name = item.first;
+ if (pathId.OwnerId == TabletID()) {
+ db.Table<Schema::UserAttributes>().Key(pathId.LocalPathId, name).Delete();
+ }
+
+ db.Table<Schema::MigratedUserAttributes>().Key(pathId.OwnerId, pathId.LocalPathId, name).Delete();
+ }
+ }
+ //aply new version and clear UserAttributesAlterData
+ if (!alterAttrs) {
+ return;
+ }
+ for (auto& item: alterAttrs->Attrs) {
+ const auto& name = item.first;
+ const auto& value = item.second;
+ if (pathId.OwnerId == TabletID()) {
+ db.Table<Schema::UserAttributes>().Key(pathId.LocalPathId, name).Update(
+ NIceDb::TUpdate<Schema::UserAttributes::AttrValue>(value));
+
+ db.Table<Schema::UserAttributesAlterData>().Key(pathId.LocalPathId, name).Delete();
+ } else {
+ db.Table<Schema::MigratedUserAttributes>().Key(pathId.OwnerId, pathId.LocalPathId, name).Update(
+ NIceDb::TUpdate<Schema::MigratedUserAttributes::AttrValue>(value));
+ }
+
+ db.Table<Schema::MigratedUserAttributesAlterData>().Key(pathId.OwnerId, pathId.LocalPathId, name).Delete();
+ }
+
+ if (pathId.OwnerId == TabletID()) {
+ //update UserAttrs's AlterVersion in Paths table
+ db.Table<Schema::Paths>().Key(pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::Paths::UserAttrsAlterVersion>(alterAttrs->AlterVersion));
+ } else {
+ db.Table<Schema::MigratedPaths>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::MigratedPaths::UserAttrsAlterVersion>(alterAttrs->AlterVersion));
+ }
+}
+
+
+void TSchemeShard::PersistLastTxId(NIceDb::TNiceDb& db, const TPathElement::TPtr path) {
+ if (path->PathId.OwnerId == TabletID()) {
+ db.Table<Schema::Paths>().Key(path->PathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::Paths::LastTxId>(path->LastTxId));
+ } else {
+ db.Table<Schema::MigratedPaths>().Key(path->PathId.OwnerId, path->PathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::MigratedPaths::LastTxId>(path->LastTxId));
+ }
+}
+
+void TSchemeShard::PersistPath(NIceDb::TNiceDb& db, const TPathId& pathId) {
+ Y_VERIFY(PathsById.contains(pathId));
+ TPathElement::TPtr elemnt = PathsById.at(pathId);
+ if (IsLocalId(pathId)) {
+ db.Table<Schema::Paths>().Key(pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::Paths::ParentOwnerId>(elemnt->ParentPathId.OwnerId),
+ NIceDb::TUpdate<Schema::Paths::ParentId>(elemnt->ParentPathId.LocalPathId),
+ NIceDb::TUpdate<Schema::Paths::Name>(elemnt->Name),
+ NIceDb::TUpdate<Schema::Paths::PathType>(elemnt->PathType),
+ NIceDb::TUpdate<Schema::Paths::StepCreated>(elemnt->StepCreated),
+ NIceDb::TUpdate<Schema::Paths::CreateTxId>(elemnt->CreateTxId),
+ NIceDb::TUpdate<Schema::Paths::StepDropped>(elemnt->StepDropped),
+ NIceDb::TUpdate<Schema::Paths::DropTxId>(elemnt->DropTxId),
+ NIceDb::TUpdate<Schema::Paths::Owner>(elemnt->Owner),
+ NIceDb::TUpdate<Schema::Paths::ACL>(elemnt->ACL),
+ NIceDb::TUpdate<Schema::Paths::LastTxId>(elemnt->LastTxId),
+ NIceDb::TUpdate<Schema::Paths::DirAlterVersion>(elemnt->DirAlterVersion),
+ NIceDb::TUpdate<Schema::Paths::UserAttrsAlterVersion>(elemnt->UserAttrs->AlterVersion),
+ NIceDb::TUpdate<Schema::Paths::ACLVersion>(elemnt->ACLVersion)
+ );
+ } else {
+ db.Table<Schema::MigratedPaths>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::MigratedPaths::ParentOwnerId>(elemnt->ParentPathId.OwnerId),
+ NIceDb::TUpdate<Schema::MigratedPaths::ParentLocalId>(elemnt->ParentPathId.LocalPathId),
+ NIceDb::TUpdate<Schema::MigratedPaths::Name>(elemnt->Name),
+ NIceDb::TUpdate<Schema::MigratedPaths::PathType>(elemnt->PathType),
+ NIceDb::TUpdate<Schema::MigratedPaths::StepCreated>(elemnt->StepCreated),
+ NIceDb::TUpdate<Schema::MigratedPaths::CreateTxId>(elemnt->CreateTxId),
+ NIceDb::TUpdate<Schema::MigratedPaths::StepDropped>(elemnt->StepDropped),
+ NIceDb::TUpdate<Schema::MigratedPaths::DropTxId>(elemnt->DropTxId),
+ NIceDb::TUpdate<Schema::MigratedPaths::Owner>(elemnt->Owner),
+ NIceDb::TUpdate<Schema::MigratedPaths::ACL>(elemnt->ACL),
+ NIceDb::TUpdate<Schema::MigratedPaths::LastTxId>(elemnt->LastTxId),
+ NIceDb::TUpdate<Schema::MigratedPaths::DirAlterVersion>(elemnt->DirAlterVersion),
+ NIceDb::TUpdate<Schema::MigratedPaths::UserAttrsAlterVersion>(elemnt->UserAttrs->AlterVersion),
+ NIceDb::TUpdate<Schema::MigratedPaths::ACLVersion>(elemnt->ACLVersion)
+ );
+ }
+}
+
+void TSchemeShard::PersistRemovePath(NIceDb::TNiceDb& db, const TPathElement::TPtr path) {
Y_VERIFY(path->Dropped() && path->DbRefCount == 0);
// Make sure to cleanup any leftover user attributes for this path
@@ -1614,73 +1614,73 @@ void TSchemeShard::PersistRemovePath(NIceDb::TNiceDb& db, const TPathElement::TP
itParent->second->RemoveChild(path->Name, path->PathId);
Y_VERIFY(itParent->second->AllChildrenCount > 0);
--itParent->second->AllChildrenCount;
- DecrementPathDbRefCount(path->ParentPathId, "remove path");
- }
-}
-
-void TSchemeShard::PersistPathDirAlterVersion(NIceDb::TNiceDb& db, const TPathElement::TPtr path) {
- if (path->PathId.OwnerId == TabletID()) {
- db.Table<Schema::Paths>().Key(path->PathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::Paths::DirAlterVersion>(path->DirAlterVersion));
- } else {
- db.Table<Schema::MigratedPaths>().Key(path->PathId.OwnerId, path->PathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::MigratedPaths::DirAlterVersion>(path->DirAlterVersion));
- }
-}
-
-void TSchemeShard::PersistSchemeLimit(NIceDb::TNiceDb &db, const TPathId &pathId, const TSubDomainInfo &subDomain) {
- Y_VERIFY(IsLocalId(pathId));
-
- db.Table<Schema::SubDomains>().Key(pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::SubDomains::DepthLimit> (subDomain.GetSchemeLimits().MaxDepth),
- NIceDb::TUpdate<Schema::SubDomains::PathsLimit> (subDomain.GetSchemeLimits().MaxPaths),
- NIceDb::TUpdate<Schema::SubDomains::ChildrenLimit> (subDomain.GetSchemeLimits().MaxChildrenInDir),
- NIceDb::TUpdate<Schema::SubDomains::ShardsLimit> (subDomain.GetSchemeLimits().MaxShards),
- NIceDb::TUpdate<Schema::SubDomains::PathShardsLimit> (subDomain.GetSchemeLimits().MaxShardsInPath),
- NIceDb::TUpdate<Schema::SubDomains::TableColumnsLimit> (subDomain.GetSchemeLimits().MaxTableColumns),
- NIceDb::TUpdate<Schema::SubDomains::TableColumnNameLengthLimit> (subDomain.GetSchemeLimits().MaxTableColumnNameLength),
- NIceDb::TUpdate<Schema::SubDomains::TableKeyColumnsLimit> (subDomain.GetSchemeLimits().MaxTableKeyColumns),
- NIceDb::TUpdate<Schema::SubDomains::TableIndicesLimit> (subDomain.GetSchemeLimits().MaxTableIndices),
- NIceDb::TUpdate<Schema::SubDomains::AclByteSizeLimit> (subDomain.GetSchemeLimits().MaxAclBytesSize),
- NIceDb::TUpdate<Schema::SubDomains::ConsistentCopyingTargetsLimit> (subDomain.GetSchemeLimits().MaxConsistentCopyTargets),
- NIceDb::TUpdate<Schema::SubDomains::PathElementLength> (subDomain.GetSchemeLimits().MaxPathElementLength),
+ DecrementPathDbRefCount(path->ParentPathId, "remove path");
+ }
+}
+
+void TSchemeShard::PersistPathDirAlterVersion(NIceDb::TNiceDb& db, const TPathElement::TPtr path) {
+ if (path->PathId.OwnerId == TabletID()) {
+ db.Table<Schema::Paths>().Key(path->PathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::Paths::DirAlterVersion>(path->DirAlterVersion));
+ } else {
+ db.Table<Schema::MigratedPaths>().Key(path->PathId.OwnerId, path->PathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::MigratedPaths::DirAlterVersion>(path->DirAlterVersion));
+ }
+}
+
+void TSchemeShard::PersistSchemeLimit(NIceDb::TNiceDb &db, const TPathId &pathId, const TSubDomainInfo &subDomain) {
+ Y_VERIFY(IsLocalId(pathId));
+
+ db.Table<Schema::SubDomains>().Key(pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::SubDomains::DepthLimit> (subDomain.GetSchemeLimits().MaxDepth),
+ NIceDb::TUpdate<Schema::SubDomains::PathsLimit> (subDomain.GetSchemeLimits().MaxPaths),
+ NIceDb::TUpdate<Schema::SubDomains::ChildrenLimit> (subDomain.GetSchemeLimits().MaxChildrenInDir),
+ NIceDb::TUpdate<Schema::SubDomains::ShardsLimit> (subDomain.GetSchemeLimits().MaxShards),
+ NIceDb::TUpdate<Schema::SubDomains::PathShardsLimit> (subDomain.GetSchemeLimits().MaxShardsInPath),
+ NIceDb::TUpdate<Schema::SubDomains::TableColumnsLimit> (subDomain.GetSchemeLimits().MaxTableColumns),
+ NIceDb::TUpdate<Schema::SubDomains::TableColumnNameLengthLimit> (subDomain.GetSchemeLimits().MaxTableColumnNameLength),
+ NIceDb::TUpdate<Schema::SubDomains::TableKeyColumnsLimit> (subDomain.GetSchemeLimits().MaxTableKeyColumns),
+ NIceDb::TUpdate<Schema::SubDomains::TableIndicesLimit> (subDomain.GetSchemeLimits().MaxTableIndices),
+ NIceDb::TUpdate<Schema::SubDomains::AclByteSizeLimit> (subDomain.GetSchemeLimits().MaxAclBytesSize),
+ NIceDb::TUpdate<Schema::SubDomains::ConsistentCopyingTargetsLimit> (subDomain.GetSchemeLimits().MaxConsistentCopyTargets),
+ NIceDb::TUpdate<Schema::SubDomains::PathElementLength> (subDomain.GetSchemeLimits().MaxPathElementLength),
NIceDb::TUpdate<Schema::SubDomains::ExtraPathSymbolsAllowed> (subDomain.GetSchemeLimits().ExtraPathSymbolsAllowed),
NIceDb::TUpdate<Schema::SubDomains::PQPartitionsLimit> (subDomain.GetSchemeLimits().MaxPQPartitions)
);
-}
-
-void TSchemeShard::PersistStoragePools(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain) {
- Y_VERIFY(IsLocalId(pathId));
-
- for (auto pool: subDomain.GetStoragePools()) {
- db.Table<Schema::StoragePools>().Key(pathId.LocalPathId, pool.GetName(), pool.GetKind()).Update();
- db.Table<Schema::StoragePoolsAlterData>().Key(pathId.LocalPathId, pool.GetName(), pool.GetKind()).Delete();
- }
- db.Table<Schema::SubDomains>().Key(pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::SubDomains::AlterVersion>(subDomain.GetVersion()));
-}
-
-void TSchemeShard::PersistInitState(NIceDb::TNiceDb& db) {
- db.Table<Schema::SysParams>().Key(Schema::SysParam_TenantInitState).Update(
- NIceDb::TUpdate<Schema::SysParams::Value>(ToString((ui64)InitState)));
-}
-
-void TSchemeShard::PersistStorageBillingTime(NIceDb::TNiceDb &db) {
- db.Table<Schema::SysParams>().Key(Schema::SysParam_ServerlessStorageLastBillTime).Update(
- NIceDb::TUpdate<Schema::SysParams::Value>(ToString(this->ServerlessStorageLastBillTime.Seconds())));
-}
-
-void TSchemeShard::PersistSubDomainAlter(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain) {
- Y_VERIFY(IsLocalId(pathId));
-
- db.Table<Schema::SubDomainsAlterData>().Key(pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::SubDomainsAlterData::AlterVersion>(subDomain.GetVersion()),
- NIceDb::TUpdate<Schema::SubDomainsAlterData::PlanResolution>(subDomain.GetPlanResolution()),
+}
+
+void TSchemeShard::PersistStoragePools(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain) {
+ Y_VERIFY(IsLocalId(pathId));
+
+ for (auto pool: subDomain.GetStoragePools()) {
+ db.Table<Schema::StoragePools>().Key(pathId.LocalPathId, pool.GetName(), pool.GetKind()).Update();
+ db.Table<Schema::StoragePoolsAlterData>().Key(pathId.LocalPathId, pool.GetName(), pool.GetKind()).Delete();
+ }
+ db.Table<Schema::SubDomains>().Key(pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::SubDomains::AlterVersion>(subDomain.GetVersion()));
+}
+
+void TSchemeShard::PersistInitState(NIceDb::TNiceDb& db) {
+ db.Table<Schema::SysParams>().Key(Schema::SysParam_TenantInitState).Update(
+ NIceDb::TUpdate<Schema::SysParams::Value>(ToString((ui64)InitState)));
+}
+
+void TSchemeShard::PersistStorageBillingTime(NIceDb::TNiceDb &db) {
+ db.Table<Schema::SysParams>().Key(Schema::SysParam_ServerlessStorageLastBillTime).Update(
+ NIceDb::TUpdate<Schema::SysParams::Value>(ToString(this->ServerlessStorageLastBillTime.Seconds())));
+}
+
+void TSchemeShard::PersistSubDomainAlter(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain) {
+ Y_VERIFY(IsLocalId(pathId));
+
+ db.Table<Schema::SubDomainsAlterData>().Key(pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::SubDomainsAlterData::AlterVersion>(subDomain.GetVersion()),
+ NIceDb::TUpdate<Schema::SubDomainsAlterData::PlanResolution>(subDomain.GetPlanResolution()),
NIceDb::TUpdate<Schema::SubDomainsAlterData::TimeCastBuckets>(subDomain.GetTCB()),
NIceDb::TUpdate<Schema::SubDomainsAlterData::ResourcesDomainOwnerPathId>(subDomain.GetResourcesDomainId().OwnerId),
NIceDb::TUpdate<Schema::SubDomainsAlterData::ResourcesDomainLocalPathId>(subDomain.GetResourcesDomainId().LocalPathId),
NIceDb::TUpdate<Schema::SubDomainsAlterData::SharedHiveId>(subDomain.GetSharedHive()));
-
+
if (subDomain.GetDeclaredSchemeQuotas()) {
TString declaredSchemeQuotas;
Y_VERIFY(subDomain.GetDeclaredSchemeQuotas()->SerializeToString(&declaredSchemeQuotas));
@@ -1701,37 +1701,37 @@ void TSchemeShard::PersistSubDomainAlter(NIceDb::TNiceDb& db, const TPathId& pat
NIceDb::TNull<Schema::SubDomainsAlterData::DatabaseQuotas>());
}
- for (auto shardIdx: subDomain.GetPrivateShards()) {
- db.Table<Schema::SubDomainShardsAlterData>().Key(pathId.LocalPathId, shardIdx.GetLocalId()).Update();
- }
-
- for (auto pool: subDomain.GetStoragePools()) {
- db.Table<Schema::StoragePoolsAlterData>().Key(pathId.LocalPathId, pool.GetName(), pool.GetKind()).Update();
- }
-}
-
-void TSchemeShard::PersistDeleteSubDomainAlter(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& alterDomain) {
- Y_VERIFY(IsLocalId(pathId));
-
- db.Table<Schema::SubDomainsAlterData>().Key(pathId.LocalPathId).Delete();
-
- for (auto shardIdx: alterDomain.GetPrivateShards()) {
- db.Table<Schema::SubDomainShardsAlterData>().Key(pathId.LocalPathId, shardIdx.GetLocalId()).Delete();
- }
-
- for (auto pool: alterDomain.GetStoragePools()) {
- db.Table<Schema::StoragePoolsAlterData>().Key(pathId.LocalPathId, pool.GetName(), pool.GetKind()).Delete();
- }
-}
-
-void TSchemeShard::PersistSubDomainVersion(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain) {
- Y_VERIFY(IsLocalId(pathId));
-
- db.Table<Schema::SubDomains>().Key(pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::SubDomains::AlterVersion>(subDomain.GetVersion()));
-}
-
-void TSchemeShard::PersistSubDomainSecurityStateVersion(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain) {
+ for (auto shardIdx: subDomain.GetPrivateShards()) {
+ db.Table<Schema::SubDomainShardsAlterData>().Key(pathId.LocalPathId, shardIdx.GetLocalId()).Update();
+ }
+
+ for (auto pool: subDomain.GetStoragePools()) {
+ db.Table<Schema::StoragePoolsAlterData>().Key(pathId.LocalPathId, pool.GetName(), pool.GetKind()).Update();
+ }
+}
+
+void TSchemeShard::PersistDeleteSubDomainAlter(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& alterDomain) {
+ Y_VERIFY(IsLocalId(pathId));
+
+ db.Table<Schema::SubDomainsAlterData>().Key(pathId.LocalPathId).Delete();
+
+ for (auto shardIdx: alterDomain.GetPrivateShards()) {
+ db.Table<Schema::SubDomainShardsAlterData>().Key(pathId.LocalPathId, shardIdx.GetLocalId()).Delete();
+ }
+
+ for (auto pool: alterDomain.GetStoragePools()) {
+ db.Table<Schema::StoragePoolsAlterData>().Key(pathId.LocalPathId, pool.GetName(), pool.GetKind()).Delete();
+ }
+}
+
+void TSchemeShard::PersistSubDomainVersion(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain) {
+ Y_VERIFY(IsLocalId(pathId));
+
+ db.Table<Schema::SubDomains>().Key(pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::SubDomains::AlterVersion>(subDomain.GetVersion()));
+}
+
+void TSchemeShard::PersistSubDomainSecurityStateVersion(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain) {
Y_VERIFY(IsLocalId(pathId));
db.Table<Schema::SubDomains>()
@@ -1739,12 +1739,12 @@ void TSchemeShard::PersistSubDomainSecurityStateVersion(NIceDb::TNiceDb& db, con
.Update<Schema::SubDomains::SecurityStateVersion>(subDomain.GetSecurityStateVersion());
}
-void TSchemeShard::PersistSubDomain(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain) {
- Y_VERIFY(IsLocalId(pathId));
-
- db.Table<Schema::SubDomains>().Key(pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::SubDomains::AlterVersion>(subDomain.GetVersion()),
- NIceDb::TUpdate<Schema::SubDomains::PlanResolution>(subDomain.GetPlanResolution()),
+void TSchemeShard::PersistSubDomain(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain) {
+ Y_VERIFY(IsLocalId(pathId));
+
+ db.Table<Schema::SubDomains>().Key(pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::SubDomains::AlterVersion>(subDomain.GetVersion()),
+ NIceDb::TUpdate<Schema::SubDomains::PlanResolution>(subDomain.GetPlanResolution()),
NIceDb::TUpdate<Schema::SubDomains::TimeCastBuckets>(subDomain.GetTCB()),
NIceDb::TUpdate<Schema::SubDomains::ResourcesDomainOwnerPathId>(subDomain.GetResourcesDomainId().OwnerId),
NIceDb::TUpdate<Schema::SubDomains::ResourcesDomainLocalPathId>(subDomain.GetResourcesDomainId().LocalPathId),
@@ -1754,17 +1754,17 @@ void TSchemeShard::PersistSubDomain(NIceDb::TNiceDb& db, const TPathId& pathId,
PersistSubDomainDatabaseQuotas(db, pathId, subDomain);
PersistSubDomainState(db, pathId, subDomain);
- db.Table<Schema::SubDomainsAlterData>().Key(pathId.LocalPathId).Delete();
-
- for (auto shardIdx: subDomain.GetPrivateShards()) {
- db.Table<Schema::SubDomainShards>().Key(pathId.LocalPathId, shardIdx.GetLocalId()).Update();
- db.Table<Schema::SubDomainShardsAlterData>().Key(pathId.LocalPathId, shardIdx.GetLocalId()).Delete();
- }
-
- PersistStoragePools(db, pathId, subDomain);
-}
-
-void TSchemeShard::PersistSubDomainDeclaredSchemeQuotas(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain) {
+ db.Table<Schema::SubDomainsAlterData>().Key(pathId.LocalPathId).Delete();
+
+ for (auto shardIdx: subDomain.GetPrivateShards()) {
+ db.Table<Schema::SubDomainShards>().Key(pathId.LocalPathId, shardIdx.GetLocalId()).Update();
+ db.Table<Schema::SubDomainShardsAlterData>().Key(pathId.LocalPathId, shardIdx.GetLocalId()).Delete();
+ }
+
+ PersistStoragePools(db, pathId, subDomain);
+}
+
+void TSchemeShard::PersistSubDomainDeclaredSchemeQuotas(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain) {
Y_VERIFY(IsLocalId(pathId));
if (subDomain.GetDeclaredSchemeQuotas()) {
@@ -1778,7 +1778,7 @@ void TSchemeShard::PersistSubDomainDeclaredSchemeQuotas(NIceDb::TNiceDb& db, con
}
}
-void TSchemeShard::PersistSubDomainDatabaseQuotas(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain) {
+void TSchemeShard::PersistSubDomainDatabaseQuotas(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain) {
Y_VERIFY(IsLocalId(pathId));
if (const auto& databaseQuotas = subDomain.GetDatabaseQuotas()) {
@@ -1792,7 +1792,7 @@ void TSchemeShard::PersistSubDomainDatabaseQuotas(NIceDb::TNiceDb& db, const TPa
}
}
-void TSchemeShard::PersistSubDomainState(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain) {
+void TSchemeShard::PersistSubDomainState(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain) {
Y_VERIFY(IsLocalId(pathId));
db.Table<Schema::SubDomains>().Key(pathId.LocalPathId).Update(
@@ -1800,7 +1800,7 @@ void TSchemeShard::PersistSubDomainState(NIceDb::TNiceDb& db, const TPathId& pat
NIceDb::TUpdate<Schema::SubDomains::DiskQuotaExceeded>(subDomain.GetDiskQuotaExceeded()));
}
-void TSchemeShard::PersistSubDomainSchemeQuotas(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain) {
+void TSchemeShard::PersistSubDomainSchemeQuotas(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain) {
Y_VERIFY(IsLocalId(pathId));
const auto& quotas = subDomain.GetSchemeQuotas();
@@ -1825,7 +1825,7 @@ void TSchemeShard::PersistSubDomainSchemeQuotas(NIceDb::TNiceDb& db, const TPath
quotas.LastKnownSize = quotas.size();
}
-void TSchemeShard::PersistRemoveSubDomain(NIceDb::TNiceDb& db, const TPathId& pathId) {
+void TSchemeShard::PersistRemoveSubDomain(NIceDb::TNiceDb& db, const TPathId& pathId) {
Y_VERIFY(IsLocalId(pathId));
auto it = SubDomains.find(pathId);
@@ -1855,226 +1855,226 @@ void TSchemeShard::PersistRemoveSubDomain(NIceDb::TNiceDb& db, const TPathId& pa
}
}
-void TSchemeShard::PersistACL(NIceDb::TNiceDb& db, const TPathElement::TPtr path) {
- if (path->PathId.OwnerId == TabletID()) {
- db.Table<Schema::Paths>().Key(path->PathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::Paths::ACL>(path->ACL),
- NIceDb::TUpdate<Schema::Paths::ACLVersion>(path->ACLVersion));
- } else {
- db.Table<Schema::MigratedPaths>().Key(path->PathId.OwnerId, path->PathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::MigratedPaths::ACL>(path->ACL),
- NIceDb::TUpdate<Schema::MigratedPaths::ACLVersion>(path->ACLVersion));
- }
-}
-
-
-void TSchemeShard::PersistOwner(NIceDb::TNiceDb& db, const TPathElement::TPtr path) {
- if (path->PathId.OwnerId == TabletID()) {
- db.Table<Schema::Paths>().Key(path->PathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::Paths::Owner>(path->Owner));
- } else {
- db.Table<Schema::MigratedPaths>().Key(path->PathId.OwnerId, path->PathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::MigratedPaths::Owner>(path->Owner));
- }
-}
-
-void TSchemeShard::PersistCreateTxId(NIceDb::TNiceDb& db, const TPathId pathId, TTxId txId) {
- Y_VERIFY(IsLocalId(pathId));
-
- db.Table<Schema::Paths>().Key(pathId.LocalPathId).Update(
+void TSchemeShard::PersistACL(NIceDb::TNiceDb& db, const TPathElement::TPtr path) {
+ if (path->PathId.OwnerId == TabletID()) {
+ db.Table<Schema::Paths>().Key(path->PathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::Paths::ACL>(path->ACL),
+ NIceDb::TUpdate<Schema::Paths::ACLVersion>(path->ACLVersion));
+ } else {
+ db.Table<Schema::MigratedPaths>().Key(path->PathId.OwnerId, path->PathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::MigratedPaths::ACL>(path->ACL),
+ NIceDb::TUpdate<Schema::MigratedPaths::ACLVersion>(path->ACLVersion));
+ }
+}
+
+
+void TSchemeShard::PersistOwner(NIceDb::TNiceDb& db, const TPathElement::TPtr path) {
+ if (path->PathId.OwnerId == TabletID()) {
+ db.Table<Schema::Paths>().Key(path->PathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::Paths::Owner>(path->Owner));
+ } else {
+ db.Table<Schema::MigratedPaths>().Key(path->PathId.OwnerId, path->PathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::MigratedPaths::Owner>(path->Owner));
+ }
+}
+
+void TSchemeShard::PersistCreateTxId(NIceDb::TNiceDb& db, const TPathId pathId, TTxId txId) {
+ Y_VERIFY(IsLocalId(pathId));
+
+ db.Table<Schema::Paths>().Key(pathId.LocalPathId).Update(
NIceDb::TUpdate<Schema::Paths::CreateTxId>(txId));
}
-void TSchemeShard::PersistCreateStep(NIceDb::TNiceDb& db, const TPathId pathId, TStepId step) {
- Y_VERIFY(IsLocalId(pathId));
-
- // CreateTxId is saved in PersistPath
- db.Table<Schema::Paths>().Key(pathId.LocalPathId).Update(
+void TSchemeShard::PersistCreateStep(NIceDb::TNiceDb& db, const TPathId pathId, TStepId step) {
+ Y_VERIFY(IsLocalId(pathId));
+
+ // CreateTxId is saved in PersistPath
+ db.Table<Schema::Paths>().Key(pathId.LocalPathId).Update(
NIceDb::TUpdate<Schema::Paths::StepCreated>(step));
}
-void TSchemeShard::PersistSnapshotTable(NIceDb::TNiceDb& db, const TTxId snapshotId, const TPathId tableId) {
- db.Table<Schema::SnapshotTables>().Key(snapshotId, tableId.OwnerId, tableId.LocalPathId).Update();
-}
-
-void TSchemeShard::PersistSnapshotStepId(NIceDb::TNiceDb& db, const TTxId snapshotId, const TStepId stepId) {
- db.Table<Schema::SnapshotSteps>().Key(snapshotId).Update(
- NIceDb::TUpdate<Schema::SnapshotSteps::StepId>(stepId));
-}
-
-void TSchemeShard::PersistDropSnapshot(NIceDb::TNiceDb& db, const TTxId snapshotId, const TPathId tableId) {
- db.Table<Schema::SnapshotTables>().Key(snapshotId, tableId.OwnerId, tableId.LocalPathId).Delete();
-
- db.Table<Schema::SnapshotSteps>().Key(snapshotId).Delete();
-}
-
-void TSchemeShard::PersistLongLock(NIceDb::TNiceDb &db, const TTxId lockId, const TPathId pathId) {
- db.Table<Schema::LongLocks>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::LongLocks::LockId>(lockId));
-}
-
-void TSchemeShard::PersistUnLock(NIceDb::TNiceDb& db, const TPathId pathId) {
- db.Table<Schema::LongLocks>().Key(pathId.OwnerId, pathId.LocalPathId).Delete();
-}
-
-void TSchemeShard::PersistDropStep(NIceDb::TNiceDb& db, const TPathId pathId, TStepId step, TOperationId opId) {
- Y_VERIFY(step, "Drop step must be valid (not 0)");
- if (pathId.OwnerId == TabletID()) {
- db.Table<Schema::Paths>().Key(pathId.LocalPathId).Update(
+void TSchemeShard::PersistSnapshotTable(NIceDb::TNiceDb& db, const TTxId snapshotId, const TPathId tableId) {
+ db.Table<Schema::SnapshotTables>().Key(snapshotId, tableId.OwnerId, tableId.LocalPathId).Update();
+}
+
+void TSchemeShard::PersistSnapshotStepId(NIceDb::TNiceDb& db, const TTxId snapshotId, const TStepId stepId) {
+ db.Table<Schema::SnapshotSteps>().Key(snapshotId).Update(
+ NIceDb::TUpdate<Schema::SnapshotSteps::StepId>(stepId));
+}
+
+void TSchemeShard::PersistDropSnapshot(NIceDb::TNiceDb& db, const TTxId snapshotId, const TPathId tableId) {
+ db.Table<Schema::SnapshotTables>().Key(snapshotId, tableId.OwnerId, tableId.LocalPathId).Delete();
+
+ db.Table<Schema::SnapshotSteps>().Key(snapshotId).Delete();
+}
+
+void TSchemeShard::PersistLongLock(NIceDb::TNiceDb &db, const TTxId lockId, const TPathId pathId) {
+ db.Table<Schema::LongLocks>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::LongLocks::LockId>(lockId));
+}
+
+void TSchemeShard::PersistUnLock(NIceDb::TNiceDb& db, const TPathId pathId) {
+ db.Table<Schema::LongLocks>().Key(pathId.OwnerId, pathId.LocalPathId).Delete();
+}
+
+void TSchemeShard::PersistDropStep(NIceDb::TNiceDb& db, const TPathId pathId, TStepId step, TOperationId opId) {
+ Y_VERIFY(step, "Drop step must be valid (not 0)");
+ if (pathId.OwnerId == TabletID()) {
+ db.Table<Schema::Paths>().Key(pathId.LocalPathId).Update(
NIceDb::TUpdate<Schema::Paths::StepDropped>(step),
- NIceDb::TUpdate<Schema::Paths::DropTxId>(opId.GetTxId()));
- } else {
- db.Table<Schema::MigratedPaths>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::MigratedPaths::StepDropped>(step),
- NIceDb::TUpdate<Schema::MigratedPaths::DropTxId>(opId.GetTxId()));
- }
-}
-
-void TSchemeShard::PersistTxState(NIceDb::TNiceDb& db, const TOperationId opId) {
- Y_VERIFY(TxInFlight.contains(opId));
- TTxState& txState = TxInFlight.at(opId);
-
+ NIceDb::TUpdate<Schema::Paths::DropTxId>(opId.GetTxId()));
+ } else {
+ db.Table<Schema::MigratedPaths>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::MigratedPaths::StepDropped>(step),
+ NIceDb::TUpdate<Schema::MigratedPaths::DropTxId>(opId.GetTxId()));
+ }
+}
+
+void TSchemeShard::PersistTxState(NIceDb::TNiceDb& db, const TOperationId opId) {
+ Y_VERIFY(TxInFlight.contains(opId));
+ TTxState& txState = TxInFlight.at(opId);
+
Y_VERIFY(txState.TxType != TTxState::TxInvalid);
Y_VERIFY(txState.State != TTxState::Invalid);
TString extraData;
- if (txState.TxType == TTxState::TxSplitTablePartition || txState.TxType == TTxState::TxMergeTablePartition) {
+ if (txState.TxType == TTxState::TxSplitTablePartition || txState.TxType == TTxState::TxMergeTablePartition) {
Y_VERIFY(txState.SplitDescription, "Split Tx must have non-empty split description");
bool serializeRes = txState.SplitDescription->SerializeToString(&extraData);
Y_VERIFY(serializeRes);
} else if (txState.TxType == TTxState::TxAlterTable) {
- TPathId pathId = txState.TargetPathId;
+ TPathId pathId = txState.TargetPathId;
- Y_VERIFY_S(PathsById.contains(pathId), "Path id " << pathId << " doesn't exist");
- Y_VERIFY_S(PathsById.at(pathId)->IsTable(), "Path id " << pathId << " is not a table");
- Y_VERIFY_S(Tables.FindPtr(pathId), "Table " << pathId << " doen't exist");
+ Y_VERIFY_S(PathsById.contains(pathId), "Path id " << pathId << " doesn't exist");
+ Y_VERIFY_S(PathsById.at(pathId)->IsTable(), "Path id " << pathId << " is not a table");
+ Y_VERIFY_S(Tables.FindPtr(pathId), "Table " << pathId << " doen't exist");
- TTableInfo::TPtr tableInfo = Tables.at(pathId);
+ TTableInfo::TPtr tableInfo = Tables.at(pathId);
extraData = tableInfo->SerializeAlterExtraData();
}
- db.Table<Schema::TxInFlightV2>().Key(opId.GetTxId(), opId.GetSubTxId()).Update(
- NIceDb::TUpdate<Schema::TxInFlightV2::TxType>((ui8)txState.TxType),
- NIceDb::TUpdate<Schema::TxInFlightV2::TargetPathId>(txState.TargetPathId.LocalPathId),
- NIceDb::TUpdate<Schema::TxInFlightV2::State>(txState.State),
- NIceDb::TUpdate<Schema::TxInFlightV2::MinStep>(txState.MinStep),
- NIceDb::TUpdate<Schema::TxInFlightV2::ExtraBytes>(extraData),
- NIceDb::TUpdate<Schema::TxInFlightV2::StartTime>(txState.StartTime.GetValue()),
- NIceDb::TUpdate<Schema::TxInFlightV2::TargetOwnerPathId>(txState.TargetPathId.OwnerId),
- NIceDb::TUpdate<Schema::TxInFlightV2::BuildIndexId>(txState.BuildIndexId),
- NIceDb::TUpdate<Schema::TxInFlightV2::SourceLocalPathId>(txState.SourcePathId.LocalPathId),
- NIceDb::TUpdate<Schema::TxInFlightV2::SourceOwnerId>(txState.SourcePathId.OwnerId)
+ db.Table<Schema::TxInFlightV2>().Key(opId.GetTxId(), opId.GetSubTxId()).Update(
+ NIceDb::TUpdate<Schema::TxInFlightV2::TxType>((ui8)txState.TxType),
+ NIceDb::TUpdate<Schema::TxInFlightV2::TargetPathId>(txState.TargetPathId.LocalPathId),
+ NIceDb::TUpdate<Schema::TxInFlightV2::State>(txState.State),
+ NIceDb::TUpdate<Schema::TxInFlightV2::MinStep>(txState.MinStep),
+ NIceDb::TUpdate<Schema::TxInFlightV2::ExtraBytes>(extraData),
+ NIceDb::TUpdate<Schema::TxInFlightV2::StartTime>(txState.StartTime.GetValue()),
+ NIceDb::TUpdate<Schema::TxInFlightV2::TargetOwnerPathId>(txState.TargetPathId.OwnerId),
+ NIceDb::TUpdate<Schema::TxInFlightV2::BuildIndexId>(txState.BuildIndexId),
+ NIceDb::TUpdate<Schema::TxInFlightV2::SourceLocalPathId>(txState.SourcePathId.LocalPathId),
+ NIceDb::TUpdate<Schema::TxInFlightV2::SourceOwnerId>(txState.SourcePathId.OwnerId)
);
-
+
for (const auto& shardOp : txState.Shards) {
- PersistUpdateTxShard(db, opId, shardOp.Idx, shardOp.Operation);
+ PersistUpdateTxShard(db, opId, shardOp.Idx, shardOp.Operation);
}
}
-void TSchemeShard::PersistTxMinStep(NIceDb::TNiceDb& db, const TOperationId opId, TStepId minStep) {
- db.Table<Schema::TxInFlightV2>().Key(opId.GetTxId(), opId.GetSubTxId()).Update(
- NIceDb::TUpdate<Schema::TxInFlightV2::MinStep>(minStep)
+void TSchemeShard::PersistTxMinStep(NIceDb::TNiceDb& db, const TOperationId opId, TStepId minStep) {
+ db.Table<Schema::TxInFlightV2>().Key(opId.GetTxId(), opId.GetSubTxId()).Update(
+ NIceDb::TUpdate<Schema::TxInFlightV2::MinStep>(minStep)
);
}
-void TSchemeShard::ChangeTxState(NIceDb::TNiceDb& db, const TOperationId opId, TTxState::ETxState newState) {
- Y_VERIFY_S(FindTx(opId),
- "Unknown TxId " << opId.GetTxId()
- << " PartId " << opId.GetSubTxId());
- Y_VERIFY(FindTx(opId)->State != TTxState::Invalid);
-
- const auto& ctx = TActivationContext::AsActorContext();
-
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "Change state for txid " << opId << " "
- << (int)TxInFlight[opId].State << " -> " << (int)newState);
-
- FindTx(opId)->State = newState;
- db.Table<Schema::TxInFlightV2>().Key(opId.GetTxId(), opId.GetSubTxId()).Update(
- NIceDb::TUpdate<Schema::TxInFlightV2::State>(newState));
+void TSchemeShard::ChangeTxState(NIceDb::TNiceDb& db, const TOperationId opId, TTxState::ETxState newState) {
+ Y_VERIFY_S(FindTx(opId),
+ "Unknown TxId " << opId.GetTxId()
+ << " PartId " << opId.GetSubTxId());
+ Y_VERIFY(FindTx(opId)->State != TTxState::Invalid);
+
+ const auto& ctx = TActivationContext::AsActorContext();
+
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "Change state for txid " << opId << " "
+ << (int)TxInFlight[opId].State << " -> " << (int)newState);
+
+ FindTx(opId)->State = newState;
+ db.Table<Schema::TxInFlightV2>().Key(opId.GetTxId(), opId.GetSubTxId()).Update(
+ NIceDb::TUpdate<Schema::TxInFlightV2::State>(newState));
}
-void TSchemeShard::PersistCancelTx(NIceDb::TNiceDb &db, const TOperationId opId, const TTxState &txState) {
+void TSchemeShard::PersistCancelTx(NIceDb::TNiceDb &db, const TOperationId opId, const TTxState &txState) {
Y_VERIFY(txState.TxType == TTxState::TxBackup || txState.TxType == TTxState::TxRestore);
-
- db.Table<Schema::TxInFlightV2>().Key(opId.GetTxId(), opId.GetSubTxId()).Update(
+
+ db.Table<Schema::TxInFlightV2>().Key(opId.GetTxId(), opId.GetSubTxId()).Update(
NIceDb::TUpdate<Schema::TxInFlightV2::CancelBackup>(txState.Cancel));
-}
-
-void TSchemeShard::PersistTxPlanStep(NIceDb::TNiceDb &db, TOperationId opId, TStepId step) {
- db.Table<Schema::TxInFlightV2>().Key(opId.GetTxId(), opId.GetSubTxId()).Update(
- NIceDb::TUpdate<Schema::TxInFlightV2::PlanStep>(step));
-}
-
-void TSchemeShard::PersistRemoveTx(NIceDb::TNiceDb& db, const TOperationId opId, const TTxState& txState) {
- db.Table<Schema::TxInFlightV2>().Key(opId.GetTxId(), opId.GetSubTxId()).Delete();
+}
+
+void TSchemeShard::PersistTxPlanStep(NIceDb::TNiceDb &db, TOperationId opId, TStepId step) {
+ db.Table<Schema::TxInFlightV2>().Key(opId.GetTxId(), opId.GetSubTxId()).Update(
+ NIceDb::TUpdate<Schema::TxInFlightV2::PlanStep>(step));
+}
+
+void TSchemeShard::PersistRemoveTx(NIceDb::TNiceDb& db, const TOperationId opId, const TTxState& txState) {
+ db.Table<Schema::TxInFlightV2>().Key(opId.GetTxId(), opId.GetSubTxId()).Delete();
for (const auto& shardOp : txState.Shards) {
- PersistRemoveTxShard(db, opId, shardOp.Idx);
+ PersistRemoveTxShard(db, opId, shardOp.Idx);
}
}
-void TSchemeShard::PersistTable(NIceDb::TNiceDb& db, const TPathId tableId) {
- Y_VERIFY(Tables.contains(tableId));
- const TTableInfo::TPtr tableInfo = Tables.at(tableId);
-
+void TSchemeShard::PersistTable(NIceDb::TNiceDb& db, const TPathId tableId) {
+ Y_VERIFY(Tables.contains(tableId));
+ const TTableInfo::TPtr tableInfo = Tables.at(tableId);
+
PersistTableAltered(db, tableId, tableInfo);
PersistTablePartitioning(db, tableId, tableInfo);
}
-void TSchemeShard::PersistChannelsBinding(NIceDb::TNiceDb& db, const TShardIdx shardId, const TChannelsBindings& bindedChannels) {
+void TSchemeShard::PersistChannelsBinding(NIceDb::TNiceDb& db, const TShardIdx shardId, const TChannelsBindings& bindedChannels) {
for (ui32 channelId = 0; channelId < bindedChannels.size(); ++channelId) {
const auto& bind = bindedChannels[channelId];
- if (IsLocalId(shardId)) {
- db.Table<Schema::ChannelsBinding>().Key(shardId.GetLocalId(), channelId).Update(
+ if (IsLocalId(shardId)) {
+ db.Table<Schema::ChannelsBinding>().Key(shardId.GetLocalId(), channelId).Update(
NIceDb::TUpdate<Schema::ChannelsBinding::PoolName>(bind.GetStoragePoolName()),
- NIceDb::TUpdate<Schema::ChannelsBinding::Binding>(bind.SerializeAsString()));
- } else {
- db.Table<Schema::MigratedChannelsBinding>().Key(shardId.GetOwnerId(), shardId.GetLocalId(), channelId).Update(
- NIceDb::TUpdate<Schema::MigratedChannelsBinding::PoolName>(bind.GetStoragePoolName()),
- NIceDb::TUpdate<Schema::MigratedChannelsBinding::Binding>(bind.SerializeAsString()));
- }
- }
-}
-
-void TSchemeShard::PersistTablePartitioning(NIceDb::TNiceDb& db, const TPathId pathId, const TTableInfo::TPtr tableInfo) {
+ NIceDb::TUpdate<Schema::ChannelsBinding::Binding>(bind.SerializeAsString()));
+ } else {
+ db.Table<Schema::MigratedChannelsBinding>().Key(shardId.GetOwnerId(), shardId.GetLocalId(), channelId).Update(
+ NIceDb::TUpdate<Schema::MigratedChannelsBinding::PoolName>(bind.GetStoragePoolName()),
+ NIceDb::TUpdate<Schema::MigratedChannelsBinding::Binding>(bind.SerializeAsString()));
+ }
+ }
+}
+
+void TSchemeShard::PersistTablePartitioning(NIceDb::TNiceDb& db, const TPathId pathId, const TTableInfo::TPtr tableInfo) {
for (ui64 pi = 0; pi < tableInfo->GetPartitions().size(); ++pi) {
const auto& partition = tableInfo->GetPartitions()[pi];
- if (IsLocalId(pathId)) {
- Y_VERIFY(IsLocalId(partition.ShardIdx));
- db.Table<Schema::TablePartitions>().Key(pathId.LocalPathId, pi).Update(
- NIceDb::TUpdate<Schema::TablePartitions::RangeEnd>(partition.EndOfRange),
+ if (IsLocalId(pathId)) {
+ Y_VERIFY(IsLocalId(partition.ShardIdx));
+ db.Table<Schema::TablePartitions>().Key(pathId.LocalPathId, pi).Update(
+ NIceDb::TUpdate<Schema::TablePartitions::RangeEnd>(partition.EndOfRange),
NIceDb::TUpdate<Schema::TablePartitions::DatashardIdx>(partition.ShardIdx.GetLocalId()),
NIceDb::TUpdate<Schema::TablePartitions::LastCondErase>(partition.LastCondErase.GetValue()),
NIceDb::TUpdate<Schema::TablePartitions::NextCondErase>(partition.NextCondErase.GetValue()));
- } else {
- db.Table<Schema::MigratedTablePartitions>().Key(pathId.OwnerId, pathId.LocalPathId, pi).Update(
- NIceDb::TUpdate<Schema::MigratedTablePartitions::RangeEnd>(partition.EndOfRange),
- NIceDb::TUpdate<Schema::MigratedTablePartitions::OwnerShardIdx>(partition.ShardIdx.GetOwnerId()),
+ } else {
+ db.Table<Schema::MigratedTablePartitions>().Key(pathId.OwnerId, pathId.LocalPathId, pi).Update(
+ NIceDb::TUpdate<Schema::MigratedTablePartitions::RangeEnd>(partition.EndOfRange),
+ NIceDb::TUpdate<Schema::MigratedTablePartitions::OwnerShardIdx>(partition.ShardIdx.GetOwnerId()),
NIceDb::TUpdate<Schema::MigratedTablePartitions::LocalShardIdx>(partition.ShardIdx.GetLocalId()),
NIceDb::TUpdate<Schema::MigratedTablePartitions::LastCondErase>(partition.LastCondErase.GetValue()),
NIceDb::TUpdate<Schema::MigratedTablePartitions::NextCondErase>(partition.NextCondErase.GetValue()));
- }
+ }
+ }
+ if (IsLocalId(pathId)) {
+ db.Table<Schema::Tables>().Key(pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::Tables::PartitioningVersion>(++tableInfo->PartitioningVersion));
+ } else {
+ db.Table<Schema::MigratedTables>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::MigratedTables::PartitioningVersion>(++tableInfo->PartitioningVersion));
}
- if (IsLocalId(pathId)) {
- db.Table<Schema::Tables>().Key(pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::Tables::PartitioningVersion>(++tableInfo->PartitioningVersion));
- } else {
- db.Table<Schema::MigratedTables>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::MigratedTables::PartitioningVersion>(++tableInfo->PartitioningVersion));
- }
}
-void TSchemeShard::DeleteTablePartitioning(NIceDb::TNiceDb& db, const TPathId pathId, const TTableInfo::TPtr tableInfo) {
+void TSchemeShard::DeleteTablePartitioning(NIceDb::TNiceDb& db, const TPathId pathId, const TTableInfo::TPtr tableInfo) {
const auto& partitions = tableInfo->GetPartitions();
for (ui64 pi = 0; pi < partitions.size(); ++pi) {
- if (IsLocalId(pathId)) {
- db.Table<Schema::TablePartitions>().Key(pathId.LocalPathId, pi).Delete();
- }
- db.Table<Schema::MigratedTablePartitions>().Key(pathId.OwnerId, pathId.LocalPathId, pi).Delete();
+ if (IsLocalId(pathId)) {
+ db.Table<Schema::TablePartitions>().Key(pathId.LocalPathId, pi).Delete();
+ }
+ db.Table<Schema::MigratedTablePartitions>().Key(pathId.OwnerId, pathId.LocalPathId, pi).Delete();
db.Table<Schema::TablePartitionStats>().Key(pathId.OwnerId, pathId.LocalPathId, pi).Delete();
CompactionQueue->Remove(TShardCompactionInfo(partitions[pi].ShardIdx));
}
}
-void TSchemeShard::PersistTablePartitionCondErase(NIceDb::TNiceDb& db, const TPathId& pathId, ui64 id, const TTableInfo::TPtr tableInfo) {
+void TSchemeShard::PersistTablePartitionCondErase(NIceDb::TNiceDb& db, const TPathId& pathId, ui64 id, const TTableInfo::TPtr tableInfo) {
const auto& partition = tableInfo->GetPartitions()[id];
if (IsLocalId(pathId)) {
@@ -2089,7 +2089,7 @@ void TSchemeShard::PersistTablePartitionCondErase(NIceDb::TNiceDb& db, const TPa
}
}
-void TSchemeShard::PersistTablePartitionStats(NIceDb::TNiceDb& db, const TPathId& tableId, ui64 partitionId, const TTableInfo::TPartitionStats& stats) {
+void TSchemeShard::PersistTablePartitionStats(NIceDb::TNiceDb& db, const TPathId& tableId, ui64 partitionId, const TTableInfo::TPartitionStats& stats) {
if (!AppData()->FeatureFlags.GetEnablePersistentPartitionStats()) {
return;
}
@@ -2129,7 +2129,7 @@ void TSchemeShard::PersistTablePartitionStats(NIceDb::TNiceDb& db, const TPathId
);
}
-void TSchemeShard::PersistTablePartitionStats(NIceDb::TNiceDb& db, const TPathId& tableId, const TShardIdx& shardIdx, const TTableInfo::TPtr tableInfo) {
+void TSchemeShard::PersistTablePartitionStats(NIceDb::TNiceDb& db, const TPathId& tableId, const TShardIdx& shardIdx, const TTableInfo::TPtr tableInfo) {
const auto& shardToPartition = tableInfo->GetShard2PartitionIdx();
if (!shardToPartition.contains(shardIdx)) {
return;
@@ -2145,7 +2145,7 @@ void TSchemeShard::PersistTablePartitionStats(NIceDb::TNiceDb& db, const TPathId
PersistTablePartitionStats(db, tableId, partitionId, stats);
}
-void TSchemeShard::PersistTablePartitionStats(NIceDb::TNiceDb& db, const TPathId& tableId, const TTableInfo::TPtr tableInfo) {
+void TSchemeShard::PersistTablePartitionStats(NIceDb::TNiceDb& db, const TPathId& tableId, const TTableInfo::TPtr tableInfo) {
const auto& tableStats = tableInfo->GetStats();
for (const auto& [shardIdx, pi] : tableInfo->GetShard2PartitionIdx()) {
@@ -2157,17 +2157,17 @@ void TSchemeShard::PersistTablePartitionStats(NIceDb::TNiceDb& db, const TPathId
}
}
-void TSchemeShard::PersistTableAlterVersion(NIceDb::TNiceDb& db, const TPathId pathId, const TTableInfo::TPtr tableInfo) {
- if (pathId.OwnerId == TabletID()) {
- db.Table<Schema::Tables>().Key(pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::Tables::AlterVersion>(tableInfo->AlterVersion));
- } else {
- db.Table<Schema::MigratedTables>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::MigratedTables::AlterVersion>(tableInfo->AlterVersion));
- }
-}
-
-void TSchemeShard::PersistTableAltered(NIceDb::TNiceDb& db, const TPathId pathId, const TTableInfo::TPtr tableInfo) {
+void TSchemeShard::PersistTableAlterVersion(NIceDb::TNiceDb& db, const TPathId pathId, const TTableInfo::TPtr tableInfo) {
+ if (pathId.OwnerId == TabletID()) {
+ db.Table<Schema::Tables>().Key(pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::Tables::AlterVersion>(tableInfo->AlterVersion));
+ } else {
+ db.Table<Schema::MigratedTables>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::MigratedTables::AlterVersion>(tableInfo->AlterVersion));
+ }
+}
+
+void TSchemeShard::PersistTableAltered(NIceDb::TNiceDb& db, const TPathId pathId, const TTableInfo::TPtr tableInfo) {
TString partitionConfig;
Y_PROTOBUF_SUPPRESS_NODISCARD tableInfo->PartitionConfig().SerializeToString(&partitionConfig);
@@ -2176,110 +2176,110 @@ void TSchemeShard::PersistTableAltered(NIceDb::TNiceDb& db, const TPathId pathId
Y_PROTOBUF_SUPPRESS_NODISCARD tableInfo->TTLSettings().SerializeToString(&ttlSettings);
}
- if (pathId.OwnerId == TabletID()) {
- db.Table<Schema::Tables>().Key(pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::Tables::NextColId>(tableInfo->NextColumnId),
- NIceDb::TUpdate<Schema::Tables::PartitionConfig>(partitionConfig),
- NIceDb::TUpdate<Schema::Tables::AlterVersion>(tableInfo->AlterVersion),
- NIceDb::TUpdate<Schema::Tables::AlterTable>(TString()),
+ if (pathId.OwnerId == TabletID()) {
+ db.Table<Schema::Tables>().Key(pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::Tables::NextColId>(tableInfo->NextColumnId),
+ NIceDb::TUpdate<Schema::Tables::PartitionConfig>(partitionConfig),
+ NIceDb::TUpdate<Schema::Tables::AlterVersion>(tableInfo->AlterVersion),
+ NIceDb::TUpdate<Schema::Tables::AlterTable>(TString()),
NIceDb::TUpdate<Schema::Tables::AlterTableFull>(TString()),
NIceDb::TUpdate<Schema::Tables::TTLSettings>(ttlSettings),
NIceDb::TUpdate<Schema::Tables::IsBackup>(tableInfo->IsBackup));
- } else {
- db.Table<Schema::MigratedTables>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::MigratedTables::NextColId>(tableInfo->NextColumnId),
- NIceDb::TUpdate<Schema::MigratedTables::PartitionConfig>(partitionConfig),
- NIceDb::TUpdate<Schema::MigratedTables::AlterVersion>(tableInfo->AlterVersion),
- NIceDb::TUpdate<Schema::MigratedTables::AlterTable>(TString()),
+ } else {
+ db.Table<Schema::MigratedTables>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::MigratedTables::NextColId>(tableInfo->NextColumnId),
+ NIceDb::TUpdate<Schema::MigratedTables::PartitionConfig>(partitionConfig),
+ NIceDb::TUpdate<Schema::MigratedTables::AlterVersion>(tableInfo->AlterVersion),
+ NIceDb::TUpdate<Schema::MigratedTables::AlterTable>(TString()),
NIceDb::TUpdate<Schema::MigratedTables::AlterTableFull>(TString()),
NIceDb::TUpdate<Schema::MigratedTables::TTLSettings>(ttlSettings),
NIceDb::TUpdate<Schema::MigratedTables::IsBackup>(tableInfo->IsBackup));
- }
+ }
for (auto col : tableInfo->Columns) {
ui32 colId = col.first;
const TTableInfo::TColumn& cinfo = col.second;
- if (pathId.OwnerId == TabletID()) {
- db.Table<Schema::Columns>().Key(pathId.LocalPathId, colId).Update(
- NIceDb::TUpdate<Schema::Columns::ColName>(cinfo.Name),
- NIceDb::TUpdate<Schema::Columns::ColType>((ui32)cinfo.PType),
- NIceDb::TUpdate<Schema::Columns::ColKeyOrder>(cinfo.KeyOrder),
- NIceDb::TUpdate<Schema::Columns::CreateVersion>(cinfo.CreateVersion),
- NIceDb::TUpdate<Schema::Columns::DeleteVersion>(cinfo.DeleteVersion),
+ if (pathId.OwnerId == TabletID()) {
+ db.Table<Schema::Columns>().Key(pathId.LocalPathId, colId).Update(
+ NIceDb::TUpdate<Schema::Columns::ColName>(cinfo.Name),
+ NIceDb::TUpdate<Schema::Columns::ColType>((ui32)cinfo.PType),
+ NIceDb::TUpdate<Schema::Columns::ColKeyOrder>(cinfo.KeyOrder),
+ NIceDb::TUpdate<Schema::Columns::CreateVersion>(cinfo.CreateVersion),
+ NIceDb::TUpdate<Schema::Columns::DeleteVersion>(cinfo.DeleteVersion),
NIceDb::TUpdate<Schema::Columns::Family>(cinfo.Family),
NIceDb::TUpdate<Schema::Columns::DefaultKind>(cinfo.DefaultKind),
NIceDb::TUpdate<Schema::Columns::DefaultValue>(cinfo.DefaultValue),
NIceDb::TUpdate<Schema::Columns::NotNull>(cinfo.NotNull));
-
- db.Table<Schema::ColumnAlters>().Key(pathId.LocalPathId, colId).Delete();
- } else {
- db.Table<Schema::MigratedColumns>().Key(pathId.OwnerId, pathId.LocalPathId, colId).Update(
- NIceDb::TUpdate<Schema::MigratedColumns::ColName>(cinfo.Name),
- NIceDb::TUpdate<Schema::MigratedColumns::ColType>((ui32)cinfo.PType),
- NIceDb::TUpdate<Schema::MigratedColumns::ColKeyOrder>(cinfo.KeyOrder),
- NIceDb::TUpdate<Schema::MigratedColumns::CreateVersion>(cinfo.CreateVersion),
- NIceDb::TUpdate<Schema::MigratedColumns::DeleteVersion>(cinfo.DeleteVersion),
+
+ db.Table<Schema::ColumnAlters>().Key(pathId.LocalPathId, colId).Delete();
+ } else {
+ db.Table<Schema::MigratedColumns>().Key(pathId.OwnerId, pathId.LocalPathId, colId).Update(
+ NIceDb::TUpdate<Schema::MigratedColumns::ColName>(cinfo.Name),
+ NIceDb::TUpdate<Schema::MigratedColumns::ColType>((ui32)cinfo.PType),
+ NIceDb::TUpdate<Schema::MigratedColumns::ColKeyOrder>(cinfo.KeyOrder),
+ NIceDb::TUpdate<Schema::MigratedColumns::CreateVersion>(cinfo.CreateVersion),
+ NIceDb::TUpdate<Schema::MigratedColumns::DeleteVersion>(cinfo.DeleteVersion),
NIceDb::TUpdate<Schema::MigratedColumns::Family>(cinfo.Family),
NIceDb::TUpdate<Schema::MigratedColumns::DefaultKind>(cinfo.DefaultKind),
NIceDb::TUpdate<Schema::MigratedColumns::DefaultValue>(cinfo.DefaultValue),
NIceDb::TUpdate<Schema::MigratedColumns::NotNull>(cinfo.NotNull));
- }
- db.Table<Schema::MigratedColumnAlters>().Key(pathId.OwnerId, pathId.LocalPathId, colId).Delete();
+ }
+ db.Table<Schema::MigratedColumnAlters>().Key(pathId.OwnerId, pathId.LocalPathId, colId).Delete();
}
}
/// @note Legacy. It's better to use Alter logic here: save new data in AlterData and swap it on complete.
-void TSchemeShard::PersistTableCreated(NIceDb::TNiceDb& db, const TPathId pathId) {
- Y_VERIFY(IsLocalId(pathId));
-
- db.Table<Schema::Tables>().Key(pathId.LocalPathId).Update(
+void TSchemeShard::PersistTableCreated(NIceDb::TNiceDb& db, const TPathId pathId) {
+ Y_VERIFY(IsLocalId(pathId));
+
+ db.Table<Schema::Tables>().Key(pathId.LocalPathId).Update(
NIceDb::TUpdate<Schema::Tables::AlterVersion>(1));
}
-void TSchemeShard::PersistAddAlterTable(NIceDb::TNiceDb& db, TPathId pathId, const TTableInfo::TAlterDataPtr alter) {
+void TSchemeShard::PersistAddAlterTable(NIceDb::TNiceDb& db, TPathId pathId, const TTableInfo::TAlterDataPtr alter) {
TString proto;
Y_PROTOBUF_SUPPRESS_NODISCARD alter->TableDescriptionFull->SerializeToString(&proto);
- if (pathId.OwnerId == TabletID()) {
- db.Table<Schema::Tables>().Key(pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::Tables::AlterTableFull>(proto));
- } else {
- db.Table<Schema::MigratedTables>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::MigratedTables::AlterTableFull>(proto));
- }
+ if (pathId.OwnerId == TabletID()) {
+ db.Table<Schema::Tables>().Key(pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::Tables::AlterTableFull>(proto));
+ } else {
+ db.Table<Schema::MigratedTables>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::MigratedTables::AlterTableFull>(proto));
+ }
for (auto col : alter->Columns) {
ui32 colId = col.first;
const TTableInfo::TColumn& cinfo = col.second;
- if (pathId.OwnerId == TabletID()) {
- db.Table<Schema::ColumnAlters>().Key(pathId.LocalPathId, colId).Update(
- NIceDb::TUpdate<Schema::ColumnAlters::ColName>(cinfo.Name),
- NIceDb::TUpdate<Schema::ColumnAlters::ColType>((ui32)cinfo.PType),
- NIceDb::TUpdate<Schema::ColumnAlters::ColKeyOrder>(cinfo.KeyOrder),
- NIceDb::TUpdate<Schema::ColumnAlters::CreateVersion>(cinfo.CreateVersion),
- NIceDb::TUpdate<Schema::ColumnAlters::DeleteVersion>(cinfo.DeleteVersion),
+ if (pathId.OwnerId == TabletID()) {
+ db.Table<Schema::ColumnAlters>().Key(pathId.LocalPathId, colId).Update(
+ NIceDb::TUpdate<Schema::ColumnAlters::ColName>(cinfo.Name),
+ NIceDb::TUpdate<Schema::ColumnAlters::ColType>((ui32)cinfo.PType),
+ NIceDb::TUpdate<Schema::ColumnAlters::ColKeyOrder>(cinfo.KeyOrder),
+ NIceDb::TUpdate<Schema::ColumnAlters::CreateVersion>(cinfo.CreateVersion),
+ NIceDb::TUpdate<Schema::ColumnAlters::DeleteVersion>(cinfo.DeleteVersion),
NIceDb::TUpdate<Schema::ColumnAlters::Family>(cinfo.Family),
NIceDb::TUpdate<Schema::ColumnAlters::DefaultKind>(cinfo.DefaultKind),
NIceDb::TUpdate<Schema::ColumnAlters::DefaultValue>(cinfo.DefaultValue),
NIceDb::TUpdate<Schema::ColumnAlters::NotNull>(cinfo.NotNull));
- } else {
- db.Table<Schema::MigratedColumnAlters>().Key(pathId.OwnerId, pathId.LocalPathId, colId).Update(
- NIceDb::TUpdate<Schema::MigratedColumnAlters::ColName>(cinfo.Name),
- NIceDb::TUpdate<Schema::MigratedColumnAlters::ColType>((ui32)cinfo.PType),
- NIceDb::TUpdate<Schema::MigratedColumnAlters::ColKeyOrder>(cinfo.KeyOrder),
- NIceDb::TUpdate<Schema::MigratedColumnAlters::CreateVersion>(cinfo.CreateVersion),
- NIceDb::TUpdate<Schema::MigratedColumnAlters::DeleteVersion>(cinfo.DeleteVersion),
+ } else {
+ db.Table<Schema::MigratedColumnAlters>().Key(pathId.OwnerId, pathId.LocalPathId, colId).Update(
+ NIceDb::TUpdate<Schema::MigratedColumnAlters::ColName>(cinfo.Name),
+ NIceDb::TUpdate<Schema::MigratedColumnAlters::ColType>((ui32)cinfo.PType),
+ NIceDb::TUpdate<Schema::MigratedColumnAlters::ColKeyOrder>(cinfo.KeyOrder),
+ NIceDb::TUpdate<Schema::MigratedColumnAlters::CreateVersion>(cinfo.CreateVersion),
+ NIceDb::TUpdate<Schema::MigratedColumnAlters::DeleteVersion>(cinfo.DeleteVersion),
NIceDb::TUpdate<Schema::MigratedColumnAlters::Family>(cinfo.Family),
NIceDb::TUpdate<Schema::MigratedColumnAlters::DefaultKind>(cinfo.DefaultKind),
NIceDb::TUpdate<Schema::MigratedColumnAlters::DefaultValue>(cinfo.DefaultValue),
NIceDb::TUpdate<Schema::MigratedColumnAlters::NotNull>(cinfo.NotNull));
- }
+ }
}
}
-void TSchemeShard::PersistPersQueueGroup(NIceDb::TNiceDb& db, TPathId pathId, const TPersQueueGroupInfo::TPtr pqGroup) {
- Y_VERIFY(IsLocalId(pathId));
-
- db.Table<Schema::PersQueueGroups>().Key(pathId.LocalPathId).Update(
+void TSchemeShard::PersistPersQueueGroup(NIceDb::TNiceDb& db, TPathId pathId, const TPersQueueGroupInfo::TPtr pqGroup) {
+ Y_VERIFY(IsLocalId(pathId));
+
+ db.Table<Schema::PersQueueGroups>().Key(pathId.LocalPathId).Update(
NIceDb::TUpdate<Schema::PersQueueGroups::TabletConfig>(pqGroup->TabletConfig),
NIceDb::TUpdate<Schema::PersQueueGroups::MaxPQPerShard>(pqGroup->MaxPartsPerTablet),
NIceDb::TUpdate<Schema::PersQueueGroups::AlterVersion>(pqGroup->AlterVersion),
@@ -2287,7 +2287,7 @@ void TSchemeShard::PersistPersQueueGroup(NIceDb::TNiceDb& db, TPathId pathId, co
NIceDb::TUpdate<Schema::PersQueueGroups::NextPartitionId>(pqGroup->NextPartitionId));
}
-void TSchemeShard::PersistRemovePersQueueGroup(NIceDb::TNiceDb& db, TPathId pathId) {
+void TSchemeShard::PersistRemovePersQueueGroup(NIceDb::TNiceDb& db, TPathId pathId) {
Y_VERIFY(IsLocalId(pathId));
auto it = PersQueueGroups.find(pathId);
@@ -2311,10 +2311,10 @@ void TSchemeShard::PersistRemovePersQueueGroup(NIceDb::TNiceDb& db, TPathId path
db.Table<Schema::PersQueueGroups>().Key(pathId.LocalPathId).Delete();
}
-void TSchemeShard::PersistAddPersQueueGroupAlter(NIceDb::TNiceDb& db, TPathId pathId, const TPersQueueGroupInfo::TPtr alterData) {
- Y_VERIFY(IsLocalId(pathId));
-
- db.Table<Schema::PersQueueGroupAlters>().Key(pathId.LocalPathId).Update(
+void TSchemeShard::PersistAddPersQueueGroupAlter(NIceDb::TNiceDb& db, TPathId pathId, const TPersQueueGroupInfo::TPtr alterData) {
+ Y_VERIFY(IsLocalId(pathId));
+
+ db.Table<Schema::PersQueueGroupAlters>().Key(pathId.LocalPathId).Update(
NIceDb::TUpdate<Schema::PersQueueGroupAlters::TabletConfig>(alterData->TabletConfig),
NIceDb::TUpdate<Schema::PersQueueGroupAlters::MaxPQPerShard>(alterData->MaxPartsPerTablet),
NIceDb::TUpdate<Schema::PersQueueGroupAlters::AlterVersion>(alterData->AlterVersion),
@@ -2323,17 +2323,17 @@ void TSchemeShard::PersistAddPersQueueGroupAlter(NIceDb::TNiceDb& db, TPathId pa
NIceDb::TUpdate<Schema::PersQueueGroupAlters::BootstrapConfig>(alterData->BootstrapConfig));
}
-void TSchemeShard::PersistRemovePersQueueGroupAlter(NIceDb::TNiceDb& db, TPathId pathId) {
- Y_VERIFY(IsLocalId(pathId));
-
- db.Table<Schema::PersQueueGroupAlters>().Key(pathId.LocalPathId).Delete();
+void TSchemeShard::PersistRemovePersQueueGroupAlter(NIceDb::TNiceDb& db, TPathId pathId) {
+ Y_VERIFY(IsLocalId(pathId));
+
+ db.Table<Schema::PersQueueGroupAlters>().Key(pathId.LocalPathId).Delete();
}
-void TSchemeShard::PersistPersQueue(NIceDb::TNiceDb &db, TPathId pathId, TShardIdx shardIdx, const TPQShardInfo::TPersQueueInfo& pqInfo) {
- Y_VERIFY(IsLocalId(pathId));
-
+void TSchemeShard::PersistPersQueue(NIceDb::TNiceDb &db, TPathId pathId, TShardIdx shardIdx, const TPQShardInfo::TPersQueueInfo& pqInfo) {
+ Y_VERIFY(IsLocalId(pathId));
+
db.Table<Schema::PersQueues>().Key(pathId.LocalPathId, pqInfo.PqId).Update(
- NIceDb::TUpdate<Schema::PersQueues::ShardIdx>(shardIdx.GetLocalId()),
+ NIceDb::TUpdate<Schema::PersQueues::ShardIdx>(shardIdx.GetLocalId()),
NIceDb::TUpdate<Schema::PersQueues::GroupId>(pqInfo.GroupId),
NIceDb::TUpdate<Schema::PersQueues::AlterVersion>(pqInfo.AlterVersion));
@@ -2350,28 +2350,28 @@ void TSchemeShard::PersistPersQueue(NIceDb::TNiceDb &db, TPathId pathId, TShardI
}
}
-void TSchemeShard::PersistRemovePersQueue(NIceDb::TNiceDb &db, TPathId pathId, ui32 pqId) {
+void TSchemeShard::PersistRemovePersQueue(NIceDb::TNiceDb &db, TPathId pathId, ui32 pqId) {
Y_VERIFY(IsLocalId(pathId));
db.Table<Schema::PersQueues>().Key(pathId.LocalPathId, pqId).Delete();
}
-void TSchemeShard::PersistRtmrVolume(NIceDb::TNiceDb &db, TPathId pathId, const TRtmrVolumeInfo::TPtr rtmrVol) {
- Y_VERIFY(IsLocalId(pathId));
-
- db.Table<Schema::RtmrVolumes>().Key(pathId.LocalPathId).Update(
+void TSchemeShard::PersistRtmrVolume(NIceDb::TNiceDb &db, TPathId pathId, const TRtmrVolumeInfo::TPtr rtmrVol) {
+ Y_VERIFY(IsLocalId(pathId));
+
+ db.Table<Schema::RtmrVolumes>().Key(pathId.LocalPathId).Update(
NIceDb::TUpdate<Schema::RtmrVolumes::PartitionsCount>(rtmrVol->Partitions.size()));
for (const auto& partition: rtmrVol->Partitions) {
TString partitionId = TString((const char*)partition.second->Id.dw, sizeof(TGUID));
- db.Table<Schema::RTMRPartitions>().Key(pathId.LocalPathId, partition.second->ShardIdx.GetLocalId()).Update(
+ db.Table<Schema::RTMRPartitions>().Key(pathId.LocalPathId, partition.second->ShardIdx.GetLocalId()).Update(
NIceDb::TUpdate<Schema::RTMRPartitions::PartitionId>(partitionId),
NIceDb::TUpdate<Schema::RTMRPartitions::BusKey>(partition.second->BusKey));
}
}
-void TSchemeShard::PersistRemoveRtmrVolume(NIceDb::TNiceDb &db, TPathId pathId) {
+void TSchemeShard::PersistRemoveRtmrVolume(NIceDb::TNiceDb &db, TPathId pathId) {
Y_VERIFY(IsLocalId(pathId));
auto it = RtmrVolumes.find(pathId);
@@ -2389,27 +2389,27 @@ void TSchemeShard::PersistRemoveRtmrVolume(NIceDb::TNiceDb &db, TPathId pathId)
db.Table<Schema::RtmrVolumes>().Key(pathId.LocalPathId).Delete();
}
-void TSchemeShard::PersistSolomonVolume(NIceDb::TNiceDb &db, TPathId pathId, const TSolomonVolumeInfo::TPtr solomonVol) {
- Y_VERIFY(IsLocalId(pathId));
-
- db.Table<Schema::SolomonVolumes>().Key(pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::SolomonVolumes::Version>(solomonVol->Version));
-
- db.Table<Schema::AlterSolomonVolumes>().Key(pathId.OwnerId, pathId.LocalPathId).Delete();
-
- for (const auto& part: solomonVol->Partitions) {
- db.Table<Schema::SolomonPartitions>().Key(pathId.LocalPathId, part.first.GetLocalId()).Update(
- NIceDb::TUpdate<Schema::SolomonPartitions::PartitionId>(part.second->PartitionId));
-
- db.Table<Schema::AlterSolomonPartitions>()
- .Key(
- pathId.OwnerId, pathId.LocalPathId,
- part.first.GetOwnerId(), part.first.GetLocalId())
- .Delete();
- }
-}
-
-void TSchemeShard::PersistRemoveSolomonVolume(NIceDb::TNiceDb &db, TPathId pathId) {
+void TSchemeShard::PersistSolomonVolume(NIceDb::TNiceDb &db, TPathId pathId, const TSolomonVolumeInfo::TPtr solomonVol) {
+ Y_VERIFY(IsLocalId(pathId));
+
+ db.Table<Schema::SolomonVolumes>().Key(pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::SolomonVolumes::Version>(solomonVol->Version));
+
+ db.Table<Schema::AlterSolomonVolumes>().Key(pathId.OwnerId, pathId.LocalPathId).Delete();
+
+ for (const auto& part: solomonVol->Partitions) {
+ db.Table<Schema::SolomonPartitions>().Key(pathId.LocalPathId, part.first.GetLocalId()).Update(
+ NIceDb::TUpdate<Schema::SolomonPartitions::PartitionId>(part.second->PartitionId));
+
+ db.Table<Schema::AlterSolomonPartitions>()
+ .Key(
+ pathId.OwnerId, pathId.LocalPathId,
+ part.first.GetOwnerId(), part.first.GetLocalId())
+ .Delete();
+ }
+}
+
+void TSchemeShard::PersistRemoveSolomonVolume(NIceDb::TNiceDb &db, TPathId pathId) {
Y_VERIFY(IsLocalId(pathId));
auto it = SolomonVolumes.find(pathId);
@@ -2438,162 +2438,162 @@ void TSchemeShard::PersistRemoveSolomonVolume(NIceDb::TNiceDb &db, TPathId pathI
db.Table<Schema::SolomonVolumes>().Key(pathId.LocalPathId).Delete();
}
-void TSchemeShard::PersistAlterSolomonVolume(NIceDb::TNiceDb &db, TPathId pathId, const TSolomonVolumeInfo::TPtr solomonVol) {
- Y_VERIFY(IsLocalId(pathId));
- Y_VERIFY(solomonVol->AlterData);
-
-
- db.Table<Schema::AlterSolomonVolumes>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::AlterSolomonVolumes::Version>(solomonVol->AlterData->Version));
-
- for (const auto& part: solomonVol->AlterData->Partitions) {
- db.Table<Schema::AlterSolomonPartitions>()
- .Key(
- pathId.OwnerId, pathId.LocalPathId,
- part.first.GetOwnerId(), part.first.GetLocalId())
- .Update(
- NIceDb::TUpdate<Schema::AlterSolomonPartitions::PartitionId>(part.second->PartitionId));
- }
-}
-
-void TSchemeShard::PersistAddTxDependency(NIceDb::TNiceDb& db, const TTxId parentOpId, const TTxId opId) {
- db.Table<Schema::TxDependencies>().Key(parentOpId, opId).Update();
-}
-
-void TSchemeShard::PersistRemoveTxDependency(NIceDb::TNiceDb& db, TTxId opId, TTxId dependentOpId) {
- db.Table<Schema::TxDependencies>().Key(opId, dependentOpId).Delete();
-}
-
-void TSchemeShard::PersistUpdateTxShard(NIceDb::TNiceDb& db, TOperationId opId, TShardIdx shardIdx, ui32 operation) {
- if (shardIdx.GetOwnerId() == TabletID()) {
- db.Table<Schema::TxShardsV2>().Key(opId.GetTxId(), opId.GetSubTxId(), shardIdx.GetLocalId()).Update(
- NIceDb::TUpdate<Schema::TxShardsV2::Operation>(operation));
- } else {
- db.Table<Schema::MigratedTxShards>().Key(opId.GetTxId(), opId.GetSubTxId(), shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
- NIceDb::TUpdate<Schema::MigratedTxShards::Operation>(operation));
- }
-}
-
-void TSchemeShard::PersistRemoveTxShard(NIceDb::TNiceDb& db, TOperationId opId, TShardIdx shardIdx) {
- if (FirstSubTxId == opId.GetSubTxId()) {
- db.Table<Schema::TxShards>().Key(opId.GetTxId(), shardIdx.GetLocalId()).Delete();
- }
-
- if (shardIdx.GetOwnerId() == TabletID()) {
- db.Table<Schema::TxShardsV2>().Key(opId.GetTxId(), opId.GetSubTxId(), shardIdx.GetLocalId()).Delete();
- }
-
- db.Table<Schema::MigratedTxShards>().Key(opId.GetTxId(), opId.GetSubTxId(), shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Delete();
-}
-
-void TSchemeShard::PersistUpdateNextPathId(NIceDb::TNiceDb& db) const {
+void TSchemeShard::PersistAlterSolomonVolume(NIceDb::TNiceDb &db, TPathId pathId, const TSolomonVolumeInfo::TPtr solomonVol) {
+ Y_VERIFY(IsLocalId(pathId));
+ Y_VERIFY(solomonVol->AlterData);
+
+
+ db.Table<Schema::AlterSolomonVolumes>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::AlterSolomonVolumes::Version>(solomonVol->AlterData->Version));
+
+ for (const auto& part: solomonVol->AlterData->Partitions) {
+ db.Table<Schema::AlterSolomonPartitions>()
+ .Key(
+ pathId.OwnerId, pathId.LocalPathId,
+ part.first.GetOwnerId(), part.first.GetLocalId())
+ .Update(
+ NIceDb::TUpdate<Schema::AlterSolomonPartitions::PartitionId>(part.second->PartitionId));
+ }
+}
+
+void TSchemeShard::PersistAddTxDependency(NIceDb::TNiceDb& db, const TTxId parentOpId, const TTxId opId) {
+ db.Table<Schema::TxDependencies>().Key(parentOpId, opId).Update();
+}
+
+void TSchemeShard::PersistRemoveTxDependency(NIceDb::TNiceDb& db, TTxId opId, TTxId dependentOpId) {
+ db.Table<Schema::TxDependencies>().Key(opId, dependentOpId).Delete();
+}
+
+void TSchemeShard::PersistUpdateTxShard(NIceDb::TNiceDb& db, TOperationId opId, TShardIdx shardIdx, ui32 operation) {
+ if (shardIdx.GetOwnerId() == TabletID()) {
+ db.Table<Schema::TxShardsV2>().Key(opId.GetTxId(), opId.GetSubTxId(), shardIdx.GetLocalId()).Update(
+ NIceDb::TUpdate<Schema::TxShardsV2::Operation>(operation));
+ } else {
+ db.Table<Schema::MigratedTxShards>().Key(opId.GetTxId(), opId.GetSubTxId(), shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
+ NIceDb::TUpdate<Schema::MigratedTxShards::Operation>(operation));
+ }
+}
+
+void TSchemeShard::PersistRemoveTxShard(NIceDb::TNiceDb& db, TOperationId opId, TShardIdx shardIdx) {
+ if (FirstSubTxId == opId.GetSubTxId()) {
+ db.Table<Schema::TxShards>().Key(opId.GetTxId(), shardIdx.GetLocalId()).Delete();
+ }
+
+ if (shardIdx.GetOwnerId() == TabletID()) {
+ db.Table<Schema::TxShardsV2>().Key(opId.GetTxId(), opId.GetSubTxId(), shardIdx.GetLocalId()).Delete();
+ }
+
+ db.Table<Schema::MigratedTxShards>().Key(opId.GetTxId(), opId.GetSubTxId(), shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Delete();
+}
+
+void TSchemeShard::PersistUpdateNextPathId(NIceDb::TNiceDb& db) const {
db.Table<Schema::SysParams>().Key(Schema::SysParam_NextPathId).Update(
- NIceDb::TUpdate<Schema::SysParams::Value>(ToString(NextLocalPathId)));
+ NIceDb::TUpdate<Schema::SysParams::Value>(ToString(NextLocalPathId)));
}
-void TSchemeShard::PersistUpdateNextShardIdx(NIceDb::TNiceDb& db) const {
+void TSchemeShard::PersistUpdateNextShardIdx(NIceDb::TNiceDb& db) const {
db.Table<Schema::SysParams>().Key(Schema::SysParam_NextShardIdx).Update(
- NIceDb::TUpdate<Schema::SysParams::Value>(ToString(NextLocalShardIdx)));
-}
-
-void TSchemeShard::PersistParentDomain(NIceDb::TNiceDb& db, TPathId parentDomain) const {
- db.Table<Schema::SysParams>().Key(Schema::SysParam_ParentDomainSchemeShard).Update(
- NIceDb::TUpdate<Schema::SysParams::Value>(ToString(parentDomain.OwnerId)));
-
- db.Table<Schema::SysParams>().Key(Schema::SysParam_ParentDomainPathId).Update(
- NIceDb::TUpdate<Schema::SysParams::Value>(ToString(parentDomain.LocalPathId)));
-}
-
-void TSchemeShard::PersistParentDomainEffectiveACL(NIceDb::TNiceDb& db, const TString& owner, const TString& effectiveACL, ui64 effectiveACLVersion) const {
- db.Table<Schema::SysParams>().Key(Schema::SysParam_ParentDomainOwner).Update(
- NIceDb::TUpdate<Schema::SysParams::Value>(owner));
-
- db.Table<Schema::SysParams>().Key(Schema::SysParam_ParentDomainEffectiveACL).Update(
- NIceDb::TUpdate<Schema::SysParams::Value>(effectiveACL));
-
- db.Table<Schema::SysParams>().Key(Schema::SysParam_ParentDomainEffectiveACLVersion).Update(
- NIceDb::TUpdate<Schema::SysParams::Value>(ToString(effectiveACLVersion)));
-}
-
-void TSchemeShard::PersistShardMapping(NIceDb::TNiceDb& db, TShardIdx shardIdx, TTabletId tabletId, TPathId pathId, TTxId txId, TTabletTypes::EType type) {
- if (IsLocalId(shardIdx)) {
- db.Table<Schema::Shards>().Key(shardIdx.GetLocalId()).Update(
- NIceDb::TUpdate<Schema::Shards::TabletId>(tabletId),
- NIceDb::TUpdate<Schema::Shards::OwnerPathId>(pathId.OwnerId),
- NIceDb::TUpdate<Schema::Shards::PathId>(pathId.LocalPathId),
- NIceDb::TUpdate<Schema::Shards::LastTxId>(txId),
- NIceDb::TUpdate<Schema::Shards::TabletType>(type));
- } else {
- db.Table<Schema::MigratedShards>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
- NIceDb::TUpdate<Schema::MigratedShards::TabletId>(tabletId),
- NIceDb::TUpdate<Schema::MigratedShards::OwnerPathId>(pathId.OwnerId),
- NIceDb::TUpdate<Schema::MigratedShards::LocalPathId>(pathId.LocalPathId),
- NIceDb::TUpdate<Schema::MigratedShards::LastTxId>(txId),
- NIceDb::TUpdate<Schema::MigratedShards::TabletType>(type));
- }
-}
-
-void TSchemeShard::PersistAdoptedShardMapping(NIceDb::TNiceDb& db, TShardIdx shardIdx, TTabletId tabletId, ui64 prevOwner, TLocalShardIdx prevShardIdx) {
- Y_VERIFY(IsLocalId(shardIdx));
- db.Table<Schema::AdoptedShards>().Key(shardIdx.GetLocalId()).Update(
- NIceDb::TUpdate<Schema::AdoptedShards::PrevOwner>(prevOwner),
- NIceDb::TUpdate<Schema::AdoptedShards::PrevShardIdx>(prevShardIdx),
- NIceDb::TUpdate<Schema::AdoptedShards::TabletId>(tabletId));
-}
-
-void TSchemeShard::PersistShardPathId(NIceDb::TNiceDb& db, TShardIdx shardIdx, TPathId pathId) {
- if (IsLocalId(shardIdx)) {
- db.Table<Schema::Shards>().Key(shardIdx.GetLocalId()).Update(
- NIceDb::TUpdate<Schema::Shards::OwnerPathId>(pathId.OwnerId),
- NIceDb::TUpdate<Schema::Shards::PathId>(pathId.LocalPathId));
- } else {
- db.Table<Schema::MigratedShards>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
- NIceDb::TUpdate<Schema::MigratedShards::OwnerPathId>(pathId.OwnerId),
- NIceDb::TUpdate<Schema::MigratedShards::LocalPathId>(pathId.LocalPathId));
- }
-}
-
-void TSchemeShard::PersistDeleteAdopted(NIceDb::TNiceDb& db, TShardIdx shardIdx) {
- Y_VERIFY(IsLocalId(shardIdx));
- db.Table<Schema::AdoptedShards>().Key(shardIdx.GetLocalId()).Delete();
-}
-
-void TSchemeShard::PersistShardTx(NIceDb::TNiceDb& db, TShardIdx shardIdx, TTxId txId) {
- if (shardIdx.GetOwnerId() == TabletID()) {
- db.Table<Schema::Shards>().Key(shardIdx.GetLocalId()).Update(
- NIceDb::TUpdate<Schema::Shards::LastTxId>(txId));
- } else {
- db.Table<Schema::MigratedShards>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
- NIceDb::TUpdate<Schema::MigratedShards::LastTxId>(txId));
- }
-}
-
-void TSchemeShard::PersistShardsToDelete(NIceDb::TNiceDb& db, const THashSet<TShardIdx>& shardsIdxs) {
- for (auto& shardIdx : shardsIdxs) {
- if (shardIdx.GetOwnerId() == TabletID()) {
- db.Table<Schema::ShardsToDelete>().Key(shardIdx.GetLocalId()).Update();
- } else {
- db.Table<Schema::MigratedShardsToDelete>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update();
- }
- }
-}
-
-void TSchemeShard::PersistShardDeleted(NIceDb::TNiceDb& db, TShardIdx shardIdx, const TChannelsBindings& bindedChannels) {
- if (shardIdx.GetOwnerId() == TabletID()) {
- db.Table<Schema::ShardsToDelete>().Key(shardIdx.GetLocalId()).Delete();
- db.Table<Schema::Shards>().Key(shardIdx.GetLocalId()).Delete();
- for (ui32 channelId = 0; channelId < bindedChannels.size(); ++channelId) {
- db.Table<Schema::ChannelsBinding>().Key(shardIdx.GetLocalId(), channelId).Delete();
- }
- db.Table<Schema::TableShardPartitionConfigs>().Key(shardIdx.GetLocalId()).Delete();
- }
-
- db.Table<Schema::MigratedShardsToDelete>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Delete();
- db.Table<Schema::MigratedShards>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Delete();
+ NIceDb::TUpdate<Schema::SysParams::Value>(ToString(NextLocalShardIdx)));
+}
+
+void TSchemeShard::PersistParentDomain(NIceDb::TNiceDb& db, TPathId parentDomain) const {
+ db.Table<Schema::SysParams>().Key(Schema::SysParam_ParentDomainSchemeShard).Update(
+ NIceDb::TUpdate<Schema::SysParams::Value>(ToString(parentDomain.OwnerId)));
+
+ db.Table<Schema::SysParams>().Key(Schema::SysParam_ParentDomainPathId).Update(
+ NIceDb::TUpdate<Schema::SysParams::Value>(ToString(parentDomain.LocalPathId)));
+}
+
+void TSchemeShard::PersistParentDomainEffectiveACL(NIceDb::TNiceDb& db, const TString& owner, const TString& effectiveACL, ui64 effectiveACLVersion) const {
+ db.Table<Schema::SysParams>().Key(Schema::SysParam_ParentDomainOwner).Update(
+ NIceDb::TUpdate<Schema::SysParams::Value>(owner));
+
+ db.Table<Schema::SysParams>().Key(Schema::SysParam_ParentDomainEffectiveACL).Update(
+ NIceDb::TUpdate<Schema::SysParams::Value>(effectiveACL));
+
+ db.Table<Schema::SysParams>().Key(Schema::SysParam_ParentDomainEffectiveACLVersion).Update(
+ NIceDb::TUpdate<Schema::SysParams::Value>(ToString(effectiveACLVersion)));
+}
+
+void TSchemeShard::PersistShardMapping(NIceDb::TNiceDb& db, TShardIdx shardIdx, TTabletId tabletId, TPathId pathId, TTxId txId, TTabletTypes::EType type) {
+ if (IsLocalId(shardIdx)) {
+ db.Table<Schema::Shards>().Key(shardIdx.GetLocalId()).Update(
+ NIceDb::TUpdate<Schema::Shards::TabletId>(tabletId),
+ NIceDb::TUpdate<Schema::Shards::OwnerPathId>(pathId.OwnerId),
+ NIceDb::TUpdate<Schema::Shards::PathId>(pathId.LocalPathId),
+ NIceDb::TUpdate<Schema::Shards::LastTxId>(txId),
+ NIceDb::TUpdate<Schema::Shards::TabletType>(type));
+ } else {
+ db.Table<Schema::MigratedShards>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
+ NIceDb::TUpdate<Schema::MigratedShards::TabletId>(tabletId),
+ NIceDb::TUpdate<Schema::MigratedShards::OwnerPathId>(pathId.OwnerId),
+ NIceDb::TUpdate<Schema::MigratedShards::LocalPathId>(pathId.LocalPathId),
+ NIceDb::TUpdate<Schema::MigratedShards::LastTxId>(txId),
+ NIceDb::TUpdate<Schema::MigratedShards::TabletType>(type));
+ }
+}
+
+void TSchemeShard::PersistAdoptedShardMapping(NIceDb::TNiceDb& db, TShardIdx shardIdx, TTabletId tabletId, ui64 prevOwner, TLocalShardIdx prevShardIdx) {
+ Y_VERIFY(IsLocalId(shardIdx));
+ db.Table<Schema::AdoptedShards>().Key(shardIdx.GetLocalId()).Update(
+ NIceDb::TUpdate<Schema::AdoptedShards::PrevOwner>(prevOwner),
+ NIceDb::TUpdate<Schema::AdoptedShards::PrevShardIdx>(prevShardIdx),
+ NIceDb::TUpdate<Schema::AdoptedShards::TabletId>(tabletId));
+}
+
+void TSchemeShard::PersistShardPathId(NIceDb::TNiceDb& db, TShardIdx shardIdx, TPathId pathId) {
+ if (IsLocalId(shardIdx)) {
+ db.Table<Schema::Shards>().Key(shardIdx.GetLocalId()).Update(
+ NIceDb::TUpdate<Schema::Shards::OwnerPathId>(pathId.OwnerId),
+ NIceDb::TUpdate<Schema::Shards::PathId>(pathId.LocalPathId));
+ } else {
+ db.Table<Schema::MigratedShards>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
+ NIceDb::TUpdate<Schema::MigratedShards::OwnerPathId>(pathId.OwnerId),
+ NIceDb::TUpdate<Schema::MigratedShards::LocalPathId>(pathId.LocalPathId));
+ }
+}
+
+void TSchemeShard::PersistDeleteAdopted(NIceDb::TNiceDb& db, TShardIdx shardIdx) {
+ Y_VERIFY(IsLocalId(shardIdx));
+ db.Table<Schema::AdoptedShards>().Key(shardIdx.GetLocalId()).Delete();
+}
+
+void TSchemeShard::PersistShardTx(NIceDb::TNiceDb& db, TShardIdx shardIdx, TTxId txId) {
+ if (shardIdx.GetOwnerId() == TabletID()) {
+ db.Table<Schema::Shards>().Key(shardIdx.GetLocalId()).Update(
+ NIceDb::TUpdate<Schema::Shards::LastTxId>(txId));
+ } else {
+ db.Table<Schema::MigratedShards>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
+ NIceDb::TUpdate<Schema::MigratedShards::LastTxId>(txId));
+ }
+}
+
+void TSchemeShard::PersistShardsToDelete(NIceDb::TNiceDb& db, const THashSet<TShardIdx>& shardsIdxs) {
+ for (auto& shardIdx : shardsIdxs) {
+ if (shardIdx.GetOwnerId() == TabletID()) {
+ db.Table<Schema::ShardsToDelete>().Key(shardIdx.GetLocalId()).Update();
+ } else {
+ db.Table<Schema::MigratedShardsToDelete>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update();
+ }
+ }
+}
+
+void TSchemeShard::PersistShardDeleted(NIceDb::TNiceDb& db, TShardIdx shardIdx, const TChannelsBindings& bindedChannels) {
+ if (shardIdx.GetOwnerId() == TabletID()) {
+ db.Table<Schema::ShardsToDelete>().Key(shardIdx.GetLocalId()).Delete();
+ db.Table<Schema::Shards>().Key(shardIdx.GetLocalId()).Delete();
+ for (ui32 channelId = 0; channelId < bindedChannels.size(); ++channelId) {
+ db.Table<Schema::ChannelsBinding>().Key(shardIdx.GetLocalId(), channelId).Delete();
+ }
+ db.Table<Schema::TableShardPartitionConfigs>().Key(shardIdx.GetLocalId()).Delete();
+ }
+
+ db.Table<Schema::MigratedShardsToDelete>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Delete();
+ db.Table<Schema::MigratedShards>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Delete();
for (ui32 channelId = 0; channelId < bindedChannels.size(); ++channelId) {
- db.Table<Schema::MigratedChannelsBinding>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId(), channelId).Delete();
- }
- db.Table<Schema::MigratedTableShardPartitionConfigs>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Delete();
+ db.Table<Schema::MigratedChannelsBinding>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId(), channelId).Delete();
+ }
+ db.Table<Schema::MigratedTableShardPartitionConfigs>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Delete();
}
void TSchemeShard::PersistUnknownShardDeleted(NIceDb::TNiceDb& db, TShardIdx shardIdx) {
@@ -2604,7 +2604,7 @@ void TSchemeShard::PersistUnknownShardDeleted(NIceDb::TNiceDb& db, TShardIdx sha
db.Table<Schema::MigratedShardsToDelete>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Delete();
}
-void TSchemeShard::PersistTxShardStatus(NIceDb::TNiceDb& db, TOperationId opId, TShardIdx shardIdx, const TTxState::TShardStatus& status) {
+void TSchemeShard::PersistTxShardStatus(NIceDb::TNiceDb& db, TOperationId opId, TShardIdx shardIdx, const TTxState::TShardStatus& status) {
db.Table<Schema::TxShardStatus>()
.Key(opId.GetTxId(), shardIdx.GetOwnerId(), shardIdx.GetLocalId())
.Update(
@@ -2615,10 +2615,10 @@ void TSchemeShard::PersistTxShardStatus(NIceDb::TNiceDb& db, TOperationId opId,
);
}
-void TSchemeShard::PersistBackupSettings(
+void TSchemeShard::PersistBackupSettings(
NIceDb::TNiceDb& db,
TPathId pathId,
- const NKikimrSchemeOp::TBackupTask& settings)
+ const NKikimrSchemeOp::TBackupTask& settings)
{
#define PERSIST_BACKUP_SETTINGS(Kind) \
if (settings.Has##Kind()) { \
@@ -2643,102 +2643,102 @@ void TSchemeShard::PersistBackupSettings(
PERSIST_BACKUP_SETTINGS(YTSettings)
PERSIST_BACKUP_SETTINGS(S3Settings)
-
+
#undef PERSIST_BACKUP_SETTINGS
}
-void TSchemeShard::PersistCompletedBackupRestore(NIceDb::TNiceDb& db, TTxId txId, const TTxState& txState, const TTableInfo::TBackupRestoreResult& info, TTableInfo::TBackupRestoreResult::EKind kind) {
- TPathId pathId = txState.TargetPathId;
-
- if (IsLocalId(pathId)) {
+void TSchemeShard::PersistCompletedBackupRestore(NIceDb::TNiceDb& db, TTxId txId, const TTxState& txState, const TTableInfo::TBackupRestoreResult& info, TTableInfo::TBackupRestoreResult::EKind kind) {
+ TPathId pathId = txState.TargetPathId;
+
+ if (IsLocalId(pathId)) {
db.Table<Schema::CompletedBackups>().Key(pathId.LocalPathId, txId, info.CompletionDateTime).Update(
NIceDb::TUpdate<Schema::CompletedBackups::TotalShardCount>(info.TotalShardCount),
NIceDb::TUpdate<Schema::CompletedBackups::SuccessShardCount>(info.SuccessShardCount),
NIceDb::TUpdate<Schema::CompletedBackups::StartTime>(info.StartDateTime),
NIceDb::TUpdate<Schema::CompletedBackups::DataTotalSize>(txState.DataTotalSize),
NIceDb::TUpdate<Schema::CompletedBackups::Kind>(static_cast<ui8>(kind)));
- } else {
- db.Table<Schema::MigratedCompletedBackups>()
- .Key(pathId.OwnerId, pathId.LocalPathId,
- txId,
+ } else {
+ db.Table<Schema::MigratedCompletedBackups>()
+ .Key(pathId.OwnerId, pathId.LocalPathId,
+ txId,
info.CompletionDateTime)
.Update(NIceDb::TUpdate<Schema::MigratedCompletedBackups::TotalShardCount>(info.TotalShardCount),
NIceDb::TUpdate<Schema::MigratedCompletedBackups::SuccessShardCount>(info.SuccessShardCount),
NIceDb::TUpdate<Schema::MigratedCompletedBackups::StartTime>(info.StartDateTime),
NIceDb::TUpdate<Schema::MigratedCompletedBackups::DataTotalSize>(txState.DataTotalSize),
NIceDb::TUpdate<Schema::MigratedCompletedBackups::Kind>(static_cast<ui8>(kind)));
- }
-}
-
-void TSchemeShard::PersistCompletedBackup(NIceDb::TNiceDb& db, TTxId txId, const TTxState& txState, const TTableInfo::TBackupRestoreResult& backupInfo) {
+ }
+}
+
+void TSchemeShard::PersistCompletedBackup(NIceDb::TNiceDb& db, TTxId txId, const TTxState& txState, const TTableInfo::TBackupRestoreResult& backupInfo) {
PersistCompletedBackupRestore(db, txId, txState, backupInfo, TTableInfo::TBackupRestoreResult::EKind::Backup);
}
-void TSchemeShard::PersistCompletedRestore(NIceDb::TNiceDb& db, TTxId txId, const TTxState& txState, const TTableInfo::TBackupRestoreResult& restoreInfo) {
+void TSchemeShard::PersistCompletedRestore(NIceDb::TNiceDb& db, TTxId txId, const TTxState& txState, const TTableInfo::TBackupRestoreResult& restoreInfo) {
PersistCompletedBackupRestore(db, txId, txState, restoreInfo, TTableInfo::TBackupRestoreResult::EKind::Restore);
}
-void TSchemeShard::PersistBackupDone(NIceDb::TNiceDb& db, TPathId pathId) {
- if (IsLocalId(pathId)) {
- db.Table<Schema::BackupSettings>().Key(pathId.LocalPathId).Delete();
- }
-
- db.Table<Schema::MigratedBackupSettings>().Key(pathId.OwnerId, pathId.LocalPathId).Delete();
+void TSchemeShard::PersistBackupDone(NIceDb::TNiceDb& db, TPathId pathId) {
+ if (IsLocalId(pathId)) {
+ db.Table<Schema::BackupSettings>().Key(pathId.LocalPathId).Delete();
+ }
+
+ db.Table<Schema::MigratedBackupSettings>().Key(pathId.OwnerId, pathId.LocalPathId).Delete();
}
-void TSchemeShard::PersistBlockStorePartition(NIceDb::TNiceDb& db, TPathId pathId, ui32 partitionId, TShardIdx shardIdx, ui64 version)
+void TSchemeShard::PersistBlockStorePartition(NIceDb::TNiceDb& db, TPathId pathId, ui32 partitionId, TShardIdx shardIdx, ui64 version)
{
- Y_VERIFY(IsLocalId(pathId));
- db.Table<Schema::BlockStorePartitions>().Key(pathId.LocalPathId, partitionId).Update(
- NIceDb::TUpdate<Schema::BlockStorePartitions::ShardIdx>(shardIdx.GetLocalId()),
+ Y_VERIFY(IsLocalId(pathId));
+ db.Table<Schema::BlockStorePartitions>().Key(pathId.LocalPathId, partitionId).Update(
+ NIceDb::TUpdate<Schema::BlockStorePartitions::ShardIdx>(shardIdx.GetLocalId()),
NIceDb::TUpdate<Schema::BlockStorePartitions::AlterVersion>(version));
}
-void TSchemeShard::PersistBlockStoreVolume(NIceDb::TNiceDb& db, TPathId pathId, const TBlockStoreVolumeInfo::TPtr volume)
+void TSchemeShard::PersistBlockStoreVolume(NIceDb::TNiceDb& db, TPathId pathId, const TBlockStoreVolumeInfo::TPtr volume)
{
- Y_VERIFY(IsLocalId(pathId));
-
+ Y_VERIFY(IsLocalId(pathId));
+
TString volumeConfig;
Y_PROTOBUF_SUPPRESS_NODISCARD volume->VolumeConfig.SerializeToString(&volumeConfig);
- db.Table<Schema::BlockStoreVolumes>().Key(pathId.LocalPathId).Update(
+ db.Table<Schema::BlockStoreVolumes>().Key(pathId.LocalPathId).Update(
NIceDb::TUpdate<Schema::BlockStoreVolumes::VolumeConfig>(volumeConfig),
NIceDb::TUpdate<Schema::BlockStoreVolumes::AlterVersion>(volume->AlterVersion),
NIceDb::TUpdate<Schema::BlockStoreVolumes::MountToken>(volume->MountToken));
}
-void TSchemeShard::PersistBlockStoreVolumeMountToken(NIceDb::TNiceDb& db, TPathId pathId, const TBlockStoreVolumeInfo::TPtr volume)
+void TSchemeShard::PersistBlockStoreVolumeMountToken(NIceDb::TNiceDb& db, TPathId pathId, const TBlockStoreVolumeInfo::TPtr volume)
{
- Y_VERIFY(IsLocalId(pathId));
- db.Table<Schema::BlockStoreVolumes>().Key(pathId.LocalPathId).Update(
+ Y_VERIFY(IsLocalId(pathId));
+ db.Table<Schema::BlockStoreVolumes>().Key(pathId.LocalPathId).Update(
NIceDb::TUpdate<Schema::BlockStoreVolumes::MountToken>(volume->MountToken),
NIceDb::TUpdate<Schema::BlockStoreVolumes::TokenVersion>(volume->TokenVersion));
}
-void TSchemeShard::PersistAddBlockStoreVolumeAlter(NIceDb::TNiceDb& db, TPathId pathId, const TBlockStoreVolumeInfo::TPtr volume)
+void TSchemeShard::PersistAddBlockStoreVolumeAlter(NIceDb::TNiceDb& db, TPathId pathId, const TBlockStoreVolumeInfo::TPtr volume)
{
- Y_VERIFY(IsLocalId(pathId));
-
+ Y_VERIFY(IsLocalId(pathId));
+
TString volumeConfig;
Y_PROTOBUF_SUPPRESS_NODISCARD volume->VolumeConfig.SerializeToString(&volumeConfig);
- db.Table<Schema::BlockStoreVolumeAlters>().Key(pathId.LocalPathId).Update(
+ db.Table<Schema::BlockStoreVolumeAlters>().Key(pathId.LocalPathId).Update(
NIceDb::TUpdate<Schema::BlockStoreVolumeAlters::VolumeConfig>(volumeConfig),
NIceDb::TUpdate<Schema::BlockStoreVolumeAlters::AlterVersion>(volume->AlterVersion),
NIceDb::TUpdate<Schema::BlockStoreVolumeAlters::PartitionCount>(volume->DefaultPartitionCount));
}
-void TSchemeShard::PersistRemoveBlockStoreVolumeAlter(NIceDb::TNiceDb& db, TPathId pathId)
+void TSchemeShard::PersistRemoveBlockStoreVolumeAlter(NIceDb::TNiceDb& db, TPathId pathId)
{
- Y_VERIFY(IsLocalId(pathId));
- db.Table<Schema::BlockStoreVolumeAlters>().Key(pathId.LocalPathId).Delete();
+ Y_VERIFY(IsLocalId(pathId));
+ db.Table<Schema::BlockStoreVolumeAlters>().Key(pathId.LocalPathId).Delete();
}
-void TSchemeShard::PersistRemoveBlockStorePartition(NIceDb::TNiceDb& db, TPathId pathId, ui32 partitionId)
+void TSchemeShard::PersistRemoveBlockStorePartition(NIceDb::TNiceDb& db, TPathId pathId, ui32 partitionId)
{
Y_VERIFY(IsLocalId(pathId));
db.Table<Schema::BlockStorePartitions>().Key(pathId.LocalPathId, partitionId).Delete();
}
-void TSchemeShard::PersistRemoveBlockStoreVolume(NIceDb::TNiceDb& db, TPathId pathId)
+void TSchemeShard::PersistRemoveBlockStoreVolume(NIceDb::TNiceDb& db, TPathId pathId)
{
Y_VERIFY(IsLocalId(pathId));
@@ -2762,7 +2762,7 @@ void TSchemeShard::PersistRemoveBlockStoreVolume(NIceDb::TNiceDb& db, TPathId pa
db.Table<Schema::BlockStoreVolumes>().Key(pathId.LocalPathId).Delete();
}
-void TSchemeShard::PersistFileStoreInfo(NIceDb::TNiceDb& db, TPathId pathId, const TFileStoreInfo::TPtr fs)
+void TSchemeShard::PersistFileStoreInfo(NIceDb::TNiceDb& db, TPathId pathId, const TFileStoreInfo::TPtr fs)
{
Y_VERIFY(IsLocalId(pathId));
@@ -2776,7 +2776,7 @@ void TSchemeShard::PersistFileStoreInfo(NIceDb::TNiceDb& db, TPathId pathId, con
NIceDb::TUpdate<Schema::FileStoreInfos::Version>(fs->Version));
}
-void TSchemeShard::PersistAddFileStoreAlter(NIceDb::TNiceDb& db, TPathId pathId, const TFileStoreInfo::TPtr fs)
+void TSchemeShard::PersistAddFileStoreAlter(NIceDb::TNiceDb& db, TPathId pathId, const TFileStoreInfo::TPtr fs)
{
Y_VERIFY(IsLocalId(pathId));
@@ -2790,7 +2790,7 @@ void TSchemeShard::PersistAddFileStoreAlter(NIceDb::TNiceDb& db, TPathId pathId,
NIceDb::TUpdate<Schema::FileStoreAlters::Version>(fs->AlterVersion));
}
-void TSchemeShard::PersistRemoveFileStoreAlter(NIceDb::TNiceDb& db, TPathId pathId)
+void TSchemeShard::PersistRemoveFileStoreAlter(NIceDb::TNiceDb& db, TPathId pathId)
{
Y_VERIFY(IsLocalId(pathId));
@@ -2799,7 +2799,7 @@ void TSchemeShard::PersistRemoveFileStoreAlter(NIceDb::TNiceDb& db, TPathId path
.Delete();
}
-void TSchemeShard::PersistRemoveFileStoreInfo(NIceDb::TNiceDb& db, TPathId pathId)
+void TSchemeShard::PersistRemoveFileStoreInfo(NIceDb::TNiceDb& db, TPathId pathId)
{
Y_VERIFY(IsLocalId(pathId));
@@ -2819,7 +2819,7 @@ void TSchemeShard::PersistRemoveFileStoreInfo(NIceDb::TNiceDb& db, TPathId pathI
.Delete();
}
-void TSchemeShard::PersistOlapStore(NIceDb::TNiceDb& db, TPathId pathId, const TOlapStoreInfo& storeInfo, bool isAlter)
+void TSchemeShard::PersistOlapStore(NIceDb::TNiceDb& db, TPathId pathId, const TOlapStoreInfo& storeInfo, bool isAlter)
{
Y_VERIFY(IsLocalId(pathId));
@@ -2847,7 +2847,7 @@ void TSchemeShard::PersistOlapStore(NIceDb::TNiceDb& db, TPathId pathId, const T
}
}
-void TSchemeShard::PersistOlapStoreRemove(NIceDb::TNiceDb& db, TPathId pathId, bool isAlter)
+void TSchemeShard::PersistOlapStoreRemove(NIceDb::TNiceDb& db, TPathId pathId, bool isAlter)
{
Y_VERIFY(IsLocalId(pathId));
@@ -2870,17 +2870,17 @@ void TSchemeShard::PersistOlapStoreRemove(NIceDb::TNiceDb& db, TPathId pathId, b
DecrementPathDbRefCount(pathId);
}
-void TSchemeShard::PersistOlapStoreAlter(NIceDb::TNiceDb& db, TPathId pathId, const TOlapStoreInfo& storeInfo)
+void TSchemeShard::PersistOlapStoreAlter(NIceDb::TNiceDb& db, TPathId pathId, const TOlapStoreInfo& storeInfo)
{
PersistOlapStore(db, pathId, storeInfo, true);
}
-void TSchemeShard::PersistOlapStoreAlterRemove(NIceDb::TNiceDb& db, TPathId pathId)
+void TSchemeShard::PersistOlapStoreAlterRemove(NIceDb::TNiceDb& db, TPathId pathId)
{
PersistOlapStoreRemove(db, pathId, true);
}
-void TSchemeShard::PersistOlapTable(NIceDb::TNiceDb& db, TPathId pathId, const TOlapTableInfo& tableInfo, bool isAlter)
+void TSchemeShard::PersistOlapTable(NIceDb::TNiceDb& db, TPathId pathId, const TOlapTableInfo& tableInfo, bool isAlter)
{
Y_VERIFY(IsLocalId(pathId));
@@ -2908,7 +2908,7 @@ void TSchemeShard::PersistOlapTable(NIceDb::TNiceDb& db, TPathId pathId, const T
}
}
-void TSchemeShard::PersistOlapTableRemove(NIceDb::TNiceDb& db, TPathId pathId, bool isAlter)
+void TSchemeShard::PersistOlapTableRemove(NIceDb::TNiceDb& db, TPathId pathId, bool isAlter)
{
Y_VERIFY(IsLocalId(pathId));
@@ -2938,17 +2938,17 @@ void TSchemeShard::PersistOlapTableRemove(NIceDb::TNiceDb& db, TPathId pathId, b
DecrementPathDbRefCount(pathId);
}
-void TSchemeShard::PersistOlapTableAlter(NIceDb::TNiceDb& db, TPathId pathId, const TOlapTableInfo& tableInfo)
+void TSchemeShard::PersistOlapTableAlter(NIceDb::TNiceDb& db, TPathId pathId, const TOlapTableInfo& tableInfo)
{
PersistOlapTable(db, pathId, tableInfo, true);
}
-void TSchemeShard::PersistOlapTableAlterRemove(NIceDb::TNiceDb& db, TPathId pathId)
+void TSchemeShard::PersistOlapTableAlterRemove(NIceDb::TNiceDb& db, TPathId pathId)
{
PersistOlapTableRemove(db, pathId, true);
}
-void TSchemeShard::PersistSequence(NIceDb::TNiceDb& db, TPathId pathId, const TSequenceInfo& sequenceInfo)
+void TSchemeShard::PersistSequence(NIceDb::TNiceDb& db, TPathId pathId, const TSequenceInfo& sequenceInfo)
{
Y_VERIFY(IsLocalId(pathId));
@@ -2963,7 +2963,7 @@ void TSchemeShard::PersistSequence(NIceDb::TNiceDb& db, TPathId pathId, const TS
NIceDb::TUpdate<Schema::Sequences::Sharding>(serializedSharding));
}
-void TSchemeShard::PersistSequenceRemove(NIceDb::TNiceDb& db, TPathId pathId)
+void TSchemeShard::PersistSequenceRemove(NIceDb::TNiceDb& db, TPathId pathId)
{
Y_VERIFY(IsLocalId(pathId));
@@ -2982,7 +2982,7 @@ void TSchemeShard::PersistSequenceRemove(NIceDb::TNiceDb& db, TPathId pathId)
DecrementPathDbRefCount(pathId);
}
-void TSchemeShard::PersistSequenceAlter(NIceDb::TNiceDb& db, TPathId pathId, const TSequenceInfo& sequenceInfo)
+void TSchemeShard::PersistSequenceAlter(NIceDb::TNiceDb& db, TPathId pathId, const TSequenceInfo& sequenceInfo)
{
Y_VERIFY(IsLocalId(pathId));
@@ -2997,7 +2997,7 @@ void TSchemeShard::PersistSequenceAlter(NIceDb::TNiceDb& db, TPathId pathId, con
NIceDb::TUpdate<Schema::SequencesAlters::Sharding>(serializedSharding));
}
-void TSchemeShard::PersistSequenceAlterRemove(NIceDb::TNiceDb& db, TPathId pathId)
+void TSchemeShard::PersistSequenceAlterRemove(NIceDb::TNiceDb& db, TPathId pathId)
{
Y_VERIFY(IsLocalId(pathId));
@@ -3050,59 +3050,59 @@ void TSchemeShard::PersistReplicationAlterRemove(NIceDb::TNiceDb& db, TPathId pa
db.Table<Schema::ReplicationsAlterData>().Key(pathId.LocalPathId).Delete();
}
-void TSchemeShard::PersistKesusInfo(NIceDb::TNiceDb& db, TPathId pathId, const TKesusInfo::TPtr kesus)
+void TSchemeShard::PersistKesusInfo(NIceDb::TNiceDb& db, TPathId pathId, const TKesusInfo::TPtr kesus)
{
TString config;
Y_PROTOBUF_SUPPRESS_NODISCARD kesus->Config.SerializeToString(&config);
-
- if (IsLocalId((pathId))) {
- db.Table<Schema::KesusInfos>().Key(pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::KesusInfos::Config>(config),
- NIceDb::TUpdate<Schema::KesusInfos::Version>(kesus->Version));
- } else {
- db.Table<Schema::MigratedKesusInfos>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::MigratedKesusInfos::Config>(config),
- NIceDb::TUpdate<Schema::MigratedKesusInfos::Version>(kesus->Version));
- }
-}
-
-void TSchemeShard::PersistKesusVersion(NIceDb::TNiceDb &db, TPathId pathId, const TKesusInfo::TPtr kesus) {
- if (IsLocalId((pathId))) {
- db.Table<Schema::KesusInfos>().Key(pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::KesusInfos::Version>(kesus->Version));
- } else {
- db.Table<Schema::MigratedKesusInfos>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::MigratedKesusInfos::Version>(kesus->Version));
- }
-}
-
-void TSchemeShard::PersistAddKesusAlter(NIceDb::TNiceDb& db, TPathId pathId, const TKesusInfo::TPtr kesus)
+
+ if (IsLocalId((pathId))) {
+ db.Table<Schema::KesusInfos>().Key(pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::KesusInfos::Config>(config),
+ NIceDb::TUpdate<Schema::KesusInfos::Version>(kesus->Version));
+ } else {
+ db.Table<Schema::MigratedKesusInfos>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::MigratedKesusInfos::Config>(config),
+ NIceDb::TUpdate<Schema::MigratedKesusInfos::Version>(kesus->Version));
+ }
+}
+
+void TSchemeShard::PersistKesusVersion(NIceDb::TNiceDb &db, TPathId pathId, const TKesusInfo::TPtr kesus) {
+ if (IsLocalId((pathId))) {
+ db.Table<Schema::KesusInfos>().Key(pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::KesusInfos::Version>(kesus->Version));
+ } else {
+ db.Table<Schema::MigratedKesusInfos>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::MigratedKesusInfos::Version>(kesus->Version));
+ }
+}
+
+void TSchemeShard::PersistAddKesusAlter(NIceDb::TNiceDb& db, TPathId pathId, const TKesusInfo::TPtr kesus)
{
Y_VERIFY(kesus->AlterConfig);
Y_VERIFY(kesus->AlterVersion);
TString config;
Y_PROTOBUF_SUPPRESS_NODISCARD kesus->AlterConfig->SerializeToString(&config);
-
- if (IsLocalId((pathId))) {
- db.Table<Schema::KesusAlters>().Key(pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::KesusAlters::Config>(config),
- NIceDb::TUpdate<Schema::KesusAlters::Version>(kesus->AlterVersion));
- } else {
- db.Table<Schema::MigratedKesusAlters>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
- NIceDb::TUpdate<Schema::MigratedKesusAlters::Config>(config),
- NIceDb::TUpdate<Schema::MigratedKesusAlters::Version>(kesus->AlterVersion));
- }
-}
-
-void TSchemeShard::PersistRemoveKesusAlter(NIceDb::TNiceDb& db, TPathId pathId)
+
+ if (IsLocalId((pathId))) {
+ db.Table<Schema::KesusAlters>().Key(pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::KesusAlters::Config>(config),
+ NIceDb::TUpdate<Schema::KesusAlters::Version>(kesus->AlterVersion));
+ } else {
+ db.Table<Schema::MigratedKesusAlters>().Key(pathId.OwnerId, pathId.LocalPathId).Update(
+ NIceDb::TUpdate<Schema::MigratedKesusAlters::Config>(config),
+ NIceDb::TUpdate<Schema::MigratedKesusAlters::Version>(kesus->AlterVersion));
+ }
+}
+
+void TSchemeShard::PersistRemoveKesusAlter(NIceDb::TNiceDb& db, TPathId pathId)
{
- if (IsLocalId((pathId))) {
- db.Table<Schema::KesusAlters>().Key(pathId.LocalPathId).Delete();
- }
- db.Table<Schema::MigratedKesusAlters>().Key(pathId.OwnerId, pathId.LocalPathId).Delete();
+ if (IsLocalId((pathId))) {
+ db.Table<Schema::KesusAlters>().Key(pathId.LocalPathId).Delete();
+ }
+ db.Table<Schema::MigratedKesusAlters>().Key(pathId.OwnerId, pathId.LocalPathId).Delete();
}
-void TSchemeShard::PersistRemoveKesusInfo(NIceDb::TNiceDb& db, TPathId pathId)
+void TSchemeShard::PersistRemoveKesusInfo(NIceDb::TNiceDb& db, TPathId pathId)
{
if (KesusInfos.contains(pathId)) {
auto kesus = KesusInfos.at(pathId);
@@ -3122,26 +3122,26 @@ void TSchemeShard::PersistRemoveKesusInfo(NIceDb::TNiceDb& db, TPathId pathId)
}
}
-void TSchemeShard::PersistRevertedMirgration(NIceDb::TNiceDb& db, TPathId pathId, TTabletId abandonedSchemeShardId) {
- Y_VERIFY(IsLocalId(pathId));
- db.Table<Schema::RevertedMigrations>().Key(pathId.LocalPathId, abandonedSchemeShardId).Update();
-}
-
-void TSchemeShard::PersistRemoveTable(NIceDb::TNiceDb& db, TPathId pathId, const TActorContext& ctx)
-{
- Y_VERIFY(PathsById.contains(pathId));
- const TPathElement::TPtr path = PathsById.at(pathId);
+void TSchemeShard::PersistRevertedMirgration(NIceDb::TNiceDb& db, TPathId pathId, TTabletId abandonedSchemeShardId) {
+ Y_VERIFY(IsLocalId(pathId));
+ db.Table<Schema::RevertedMigrations>().Key(pathId.LocalPathId, abandonedSchemeShardId).Update();
+}
+
+void TSchemeShard::PersistRemoveTable(NIceDb::TNiceDb& db, TPathId pathId, const TActorContext& ctx)
+{
+ Y_VERIFY(PathsById.contains(pathId));
+ const TPathElement::TPtr path = PathsById.at(pathId);
+
+ if (!Tables.contains(pathId)) {
+ return;
+ }
+ const TTableInfo::TPtr tableInfo = Tables.at(pathId);
- if (!Tables.contains(pathId)) {
- return;
- }
- const TTableInfo::TPtr tableInfo = Tables.at(pathId);
-
auto clearHistory = [&](const TMap<TTxId, TTableInfo::TBackupRestoreResult>& history) {
for (auto& bItem: history) {
TTxId txId = bItem.first;
const auto& result = bItem.second;
-
+
for (auto& sItem: result.ShardStatuses) {
auto shard = sItem.first;
if (IsLocalId(shard)) {
@@ -3149,55 +3149,55 @@ void TSchemeShard::PersistRemoveTable(NIceDb::TNiceDb& db, TPathId pathId, const
}
db.Table<Schema::MigratedShardBackupStatus>().Key(txId, shard.GetOwnerId(), shard.GetLocalId()).Delete();
db.Table<Schema::TxShardStatus>().Key(txId, shard.GetOwnerId(), shard.GetLocalId()).Delete();
- }
-
+ }
+
if (IsLocalId(pathId)) {
db.Table<Schema::CompletedBackups>().Key(pathId.LocalPathId, txId, result.CompletionDateTime).Delete();
}
db.Table<Schema::MigratedCompletedBackups>().Key(pathId.OwnerId, pathId.LocalPathId, txId, result.CompletionDateTime).Delete();
- }
+ }
};
-
+
clearHistory(tableInfo->BackupHistory);
clearHistory(tableInfo->RestoreHistory);
- if (IsLocalId(pathId)) {
- db.Table<Schema::BackupSettings>().Key(pathId.LocalPathId).Delete();
- }
- db.Table<Schema::MigratedBackupSettings>().Key(pathId.OwnerId, pathId.LocalPathId).Delete();
-
+ if (IsLocalId(pathId)) {
+ db.Table<Schema::BackupSettings>().Key(pathId.LocalPathId).Delete();
+ }
+ db.Table<Schema::MigratedBackupSettings>().Key(pathId.OwnerId, pathId.LocalPathId).Delete();
+
db.Table<Schema::RestoreTasks>().Key(pathId.OwnerId, pathId.LocalPathId).Delete();
-
- if (tableInfo->AlterData) {
- auto& alterData = tableInfo->AlterData;
- for (auto& cItem: alterData->Columns) {
- if (pathId.OwnerId == TabletID()) {
- db.Table<Schema::ColumnAlters>().Key(pathId.LocalPathId, cItem.first).Delete();
- }
- db.Table<Schema::MigratedColumns>().Key(pathId.OwnerId, pathId.LocalPathId, cItem.first).Delete();
- }
- }
-
- for (auto& cItem: tableInfo->Columns) {
- if (pathId.OwnerId == TabletID()) {
- db.Table<Schema::Columns>().Key(pathId.LocalPathId, cItem.first).Delete();
- }
- db.Table<Schema::MigratedColumns>().Key(pathId.OwnerId, pathId.LocalPathId, cItem.first).Delete();
- }
-
- for (ui32 pNo = 0; pNo < tableInfo->GetPartitions().size(); ++pNo) {
- if (pathId.OwnerId == TabletID()) {
- db.Table<Schema::TablePartitions>().Key(pathId.LocalPathId, pNo).Delete();
- }
- db.Table<Schema::MigratedTablePartitions>().Key(pathId.OwnerId, pathId.LocalPathId, pNo).Delete();
+
+ if (tableInfo->AlterData) {
+ auto& alterData = tableInfo->AlterData;
+ for (auto& cItem: alterData->Columns) {
+ if (pathId.OwnerId == TabletID()) {
+ db.Table<Schema::ColumnAlters>().Key(pathId.LocalPathId, cItem.first).Delete();
+ }
+ db.Table<Schema::MigratedColumns>().Key(pathId.OwnerId, pathId.LocalPathId, cItem.first).Delete();
+ }
+ }
+
+ for (auto& cItem: tableInfo->Columns) {
+ if (pathId.OwnerId == TabletID()) {
+ db.Table<Schema::Columns>().Key(pathId.LocalPathId, cItem.first).Delete();
+ }
+ db.Table<Schema::MigratedColumns>().Key(pathId.OwnerId, pathId.LocalPathId, cItem.first).Delete();
+ }
+
+ for (ui32 pNo = 0; pNo < tableInfo->GetPartitions().size(); ++pNo) {
+ if (pathId.OwnerId == TabletID()) {
+ db.Table<Schema::TablePartitions>().Key(pathId.LocalPathId, pNo).Delete();
+ }
+ db.Table<Schema::MigratedTablePartitions>().Key(pathId.OwnerId, pathId.LocalPathId, pNo).Delete();
db.Table<Schema::TablePartitionStats>().Key(pathId.OwnerId, pathId.LocalPathId, pNo).Delete();
const auto& shardInfo = tableInfo->GetPartitions().at(pNo);
if (const auto& lag = shardInfo.LastCondEraseLag) {
TabletCounters->Percentile()[COUNTER_NUM_SHARDS_BY_TTL_LAG].DecrementFor(lag->Seconds());
}
- }
-
+ }
+
for (const auto& [_, childPathId]: path->GetChildren()) {
Y_VERIFY(PathsById.contains(childPathId));
auto childPath = PathsById.at(childPathId);
@@ -3205,31 +3205,31 @@ void TSchemeShard::PersistRemoveTable(NIceDb::TNiceDb& db, TPathId pathId, const
if (childPath->IsTableIndex()) {
PersistRemoveTableIndex(db, childPathId);
}
- }
-
- if (pathId.OwnerId == TabletID()) {
- db.Table<Schema::Tables>().Key(pathId.LocalPathId).Delete();
- }
- db.Table<Schema::MigratedTables>().Key(pathId.OwnerId, pathId.LocalPathId).Delete();
+ }
+
+ if (pathId.OwnerId == TabletID()) {
+ db.Table<Schema::Tables>().Key(pathId.LocalPathId).Delete();
+ }
+ db.Table<Schema::MigratedTables>().Key(pathId.OwnerId, pathId.LocalPathId).Delete();
if (tableInfo->IsTTLEnabled()) {
TTLEnabledTables.erase(pathId);
- TabletCounters->Simple()[COUNTER_TTL_ENABLED_TABLE_COUNT].Sub(1);
- }
-
- if (TablesWithSnaphots.contains(pathId)) {
- const TTxId snapshotId = TablesWithSnaphots.at(pathId);
- PersistDropSnapshot(db, snapshotId, pathId);
-
- TablesWithSnaphots.erase(pathId);
- SnapshotTables.at(snapshotId).erase(pathId);
- if (SnapshotTables.at(snapshotId).empty()) {
- SnapshotTables.erase(snapshotId);
- }
- SnapshotsStepIds.erase(snapshotId);
- }
-
- if (!tableInfo->IsBackup && !tableInfo->IsShardsStatsDetached()) {
+ TabletCounters->Simple()[COUNTER_TTL_ENABLED_TABLE_COUNT].Sub(1);
+ }
+
+ if (TablesWithSnaphots.contains(pathId)) {
+ const TTxId snapshotId = TablesWithSnaphots.at(pathId);
+ PersistDropSnapshot(db, snapshotId, pathId);
+
+ TablesWithSnaphots.erase(pathId);
+ SnapshotTables.at(snapshotId).erase(pathId);
+ if (SnapshotTables.at(snapshotId).empty()) {
+ SnapshotTables.erase(snapshotId);
+ }
+ SnapshotsStepIds.erase(snapshotId);
+ }
+
+ if (!tableInfo->IsBackup && !tableInfo->IsShardsStatsDetached()) {
auto subDomainId = ResolveDomainId(pathId);
auto subDomainInfo = ResolveDomainInfo(pathId);
subDomainInfo->AggrDiskSpaceUsage(this, TTableInfo::TPartitionStats(), tableInfo->GetStats().Aggregated);
@@ -3246,128 +3246,128 @@ void TSchemeShard::PersistRemoveTable(NIceDb::TNiceDb& db, TPathId pathId, const
CompactionQueue->Remove(TShardCompactionInfo(p.ShardIdx));
}
- Tables.erase(pathId);
- DecrementPathDbRefCount(pathId, "remove table");
+ Tables.erase(pathId);
+ DecrementPathDbRefCount(pathId, "remove table");
if (AppData()->FeatureFlags.GetEnableSystemViews()) {
auto ev = MakeHolder<NSysView::TEvSysView::TEvRemoveTable>(GetDomainKey(pathId), pathId);
Send(SysPartitionStatsCollector, ev.Release());
}
-}
-
-void TSchemeShard::PersistRemoveTableIndex(NIceDb::TNiceDb &db, TPathId pathId)
-{
- Y_VERIFY(PathsById.contains(pathId));
+}
+
+void TSchemeShard::PersistRemoveTableIndex(NIceDb::TNiceDb &db, TPathId pathId)
+{
+ Y_VERIFY(PathsById.contains(pathId));
const TPathElement::TPtr path = PathsById.at(pathId);
- if (!Indexes.contains(pathId)) {
- return;
- }
-
- const TTableIndexInfo::TPtr index = Indexes.at(pathId);
- for (ui32 kNo = 0; kNo < index->IndexKeys.size(); ++kNo) {
- if (IsLocalId(pathId)) {
- db.Table<Schema::TableIndexKeys>().Key(pathId.LocalPathId, kNo).Delete();
- }
- db.Table<Schema::MigratedTableIndexKeys>().Key(pathId.OwnerId, pathId.LocalPathId, kNo).Delete();
- }
-
+ if (!Indexes.contains(pathId)) {
+ return;
+ }
+
+ const TTableIndexInfo::TPtr index = Indexes.at(pathId);
+ for (ui32 kNo = 0; kNo < index->IndexKeys.size(); ++kNo) {
+ if (IsLocalId(pathId)) {
+ db.Table<Schema::TableIndexKeys>().Key(pathId.LocalPathId, kNo).Delete();
+ }
+ db.Table<Schema::MigratedTableIndexKeys>().Key(pathId.OwnerId, pathId.LocalPathId, kNo).Delete();
+ }
+
for (ui32 dNo = 0; dNo < index->IndexDataColumns.size(); ++dNo) {
db.Table<Schema::TableIndexDataColumns>().Key(pathId.OwnerId, pathId.LocalPathId, dNo).Delete();
}
- if (index->AlterData) {
- auto alterData = index->AlterData;
- for (ui32 kNo = 0; kNo < alterData->IndexKeys.size(); ++kNo) {
- db.Table<Schema::TableIndexKeysAlterData>().Key(pathId.LocalPathId, kNo).Delete();
- }
-
+ if (index->AlterData) {
+ auto alterData = index->AlterData;
+ for (ui32 kNo = 0; kNo < alterData->IndexKeys.size(); ++kNo) {
+ db.Table<Schema::TableIndexKeysAlterData>().Key(pathId.LocalPathId, kNo).Delete();
+ }
+
for (ui32 dNo = 0; dNo < alterData->IndexDataColumns.size(); ++dNo) {
db.Table<Schema::TableIndexDataColumnsAlterData>().Key(pathId.OwnerId, pathId.LocalPathId, dNo).Delete();
}
- db.Table<Schema::TableIndexAlterData>().Key(pathId.LocalPathId).Delete();
- }
-
- if (IsLocalId(pathId)) {
- db.Table<Schema::TableIndex>().Key(pathId.LocalPathId).Delete();
- }
- db.Table<Schema::MigratedTableIndex>().Key(pathId.OwnerId, pathId.LocalPathId).Delete();
- Indexes.erase(pathId);
+ db.Table<Schema::TableIndexAlterData>().Key(pathId.LocalPathId).Delete();
+ }
+
+ if (IsLocalId(pathId)) {
+ db.Table<Schema::TableIndex>().Key(pathId.LocalPathId).Delete();
+ }
+ db.Table<Schema::MigratedTableIndex>().Key(pathId.OwnerId, pathId.LocalPathId).Delete();
+ Indexes.erase(pathId);
DecrementPathDbRefCount(pathId);
-}
-
-void TSchemeShard::PersistAddTableShardPartitionConfig(NIceDb::TNiceDb& db, TShardIdx shardIdx, const NKikimrSchemeOp::TPartitionConfig& config)
+}
+
+void TSchemeShard::PersistAddTableShardPartitionConfig(NIceDb::TNiceDb& db, TShardIdx shardIdx, const NKikimrSchemeOp::TPartitionConfig& config)
{
TString data;
Y_PROTOBUF_SUPPRESS_NODISCARD config.SerializeToString(&data);
- if (IsLocalId(shardIdx)) {
- db.Table<Schema::TableShardPartitionConfigs>().Key(shardIdx.GetLocalId()).Update(
- NIceDb::TUpdate<Schema::TableShardPartitionConfigs::PartitionConfig>(data));
- } else {
- db.Table<Schema::MigratedTableShardPartitionConfigs>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
- NIceDb::TUpdate<Schema::MigratedTableShardPartitionConfigs::PartitionConfig>(data));
- }
-}
-
-void TSchemeShard::PersistPublishingPath(NIceDb::TNiceDb& db, TTxId txId, TPathId pathId, ui64 version) {
- IncrementPathDbRefCount(pathId, "publish path");
-
- if (pathId.OwnerId == TabletID()) {
- db.Table<Schema::PublishingPaths>()
- .Key(txId, pathId.LocalPathId, version)
- .Update();
- } else {
- db.Table<Schema::MigratedPublishingPaths>()
- .Key(txId, pathId.OwnerId, pathId.LocalPathId, version)
- .Update();
- }
-}
-
-void TSchemeShard::PersistRemovePublishingPath(NIceDb::TNiceDb& db, TTxId txId, TPathId pathId, ui64 version) {
- DecrementPathDbRefCount(pathId, "remove publishing");
-
- if (pathId.OwnerId == TabletID()) {
- db.Table<Schema::PublishingPaths>()
- .Key(txId, pathId.LocalPathId, version)
- .Delete();
- }
-
- db.Table<Schema::MigratedPublishingPaths>()
- .Key(txId, pathId.OwnerId, pathId.LocalPathId, version)
+ if (IsLocalId(shardIdx)) {
+ db.Table<Schema::TableShardPartitionConfigs>().Key(shardIdx.GetLocalId()).Update(
+ NIceDb::TUpdate<Schema::TableShardPartitionConfigs::PartitionConfig>(data));
+ } else {
+ db.Table<Schema::MigratedTableShardPartitionConfigs>().Key(shardIdx.GetOwnerId(), shardIdx.GetLocalId()).Update(
+ NIceDb::TUpdate<Schema::MigratedTableShardPartitionConfigs::PartitionConfig>(data));
+ }
+}
+
+void TSchemeShard::PersistPublishingPath(NIceDb::TNiceDb& db, TTxId txId, TPathId pathId, ui64 version) {
+ IncrementPathDbRefCount(pathId, "publish path");
+
+ if (pathId.OwnerId == TabletID()) {
+ db.Table<Schema::PublishingPaths>()
+ .Key(txId, pathId.LocalPathId, version)
+ .Update();
+ } else {
+ db.Table<Schema::MigratedPublishingPaths>()
+ .Key(txId, pathId.OwnerId, pathId.LocalPathId, version)
+ .Update();
+ }
+}
+
+void TSchemeShard::PersistRemovePublishingPath(NIceDb::TNiceDb& db, TTxId txId, TPathId pathId, ui64 version) {
+ DecrementPathDbRefCount(pathId, "remove publishing");
+
+ if (pathId.OwnerId == TabletID()) {
+ db.Table<Schema::PublishingPaths>()
+ .Key(txId, pathId.LocalPathId, version)
+ .Delete();
+ }
+
+ db.Table<Schema::MigratedPublishingPaths>()
+ .Key(txId, pathId.OwnerId, pathId.LocalPathId, version)
.Delete();
}
-TTabletId TSchemeShard::GetGlobalHive(const TActorContext& ctx) const {
+TTabletId TSchemeShard::GetGlobalHive(const TActorContext& ctx) const {
auto domainsInfo = AppData(ctx)->DomainsInfo;
ui32 domainUid = domainsInfo->GetDomainUidByTabletId(TabletID());
auto domain = domainsInfo->GetDomain(domainUid);
-
- const ui32 hiveIdx = Max<ui32>();
+
+ const ui32 hiveIdx = Max<ui32>();
ui32 hiveUid = domain.GetHiveUidByIdx(hiveIdx);
-
- return TTabletId(domainsInfo->GetHive(hiveUid));
+
+ return TTabletId(domainsInfo->GetHive(hiveUid));
}
-TShardIdx TSchemeShard::GetShardIdx(TTabletId tabletId) const {
+TShardIdx TSchemeShard::GetShardIdx(TTabletId tabletId) const {
const auto* pIdx = TabletIdToShardIdx.FindPtr(tabletId);
- if (!pIdx) {
- return InvalidShardIdx;
- }
+ if (!pIdx) {
+ return InvalidShardIdx;
+ }
- Y_VERIFY(*pIdx != InvalidShardIdx);
+ Y_VERIFY(*pIdx != InvalidShardIdx);
return *pIdx;
}
-TShardIdx TSchemeShard::MustGetShardIdx(TTabletId tabletId) const {
+TShardIdx TSchemeShard::MustGetShardIdx(TTabletId tabletId) const {
auto shardIdx = GetShardIdx(tabletId);
Y_VERIFY_S(shardIdx != InvalidShardIdx, "Cannot find shard idx for tablet " << tabletId);
return shardIdx;
}
-TTabletTypes::EType TSchemeShard::GetTabletType(TTabletId tabletId) const {
+TTabletTypes::EType TSchemeShard::GetTabletType(TTabletId tabletId) const {
const auto* pIdx = TabletIdToShardIdx.FindPtr(tabletId);
if (!pIdx) {
return TTabletTypes::Unknown;
@@ -3382,150 +3382,150 @@ TTabletTypes::EType TSchemeShard::GetTabletType(TTabletId tabletId) const {
return pShardInfo->TabletType;
}
-TTabletId TSchemeShard::ResolveHive(TPathId pathId, const TActorContext& ctx) const {
- if (!PathsById.contains(pathId)) {
- return GetGlobalHive(ctx);
- }
-
- TSubDomainInfo::TPtr subdomain = ResolveDomainInfo(pathId);
- TPathElement::TPtr path = PathsById.at(pathId);
-
- if (path->IsExternalSubDomainRoot()) {
- // we use either shared or global hive for private subdomain's shards. Like TenantSS, CC, MM
- // and don't use tenant Hive for privat subdomain;s shards
- return subdomain->GetSharedHive() ? subdomain->GetSharedHive() : GetGlobalHive(ctx);
- }
-
- // for pathes inside subdomain and their shards we choise Hive according that order: tanant, shared, global
- if (subdomain->GetTenantHiveID()) {
- return subdomain->GetTenantHiveID();
- }
-
- if (subdomain->GetSharedHive()) {
- return subdomain->GetSharedHive();
- }
-
- return GetGlobalHive(ctx);
-}
-
-TTabletId TSchemeShard::ResolveHive(TShardIdx shardIdx, const TActorContext& ctx) const {
- if (!ShardInfos.contains(shardIdx)) {
- return GetGlobalHive(ctx);
- }
-
- return ResolveHive(ShardInfos.at(shardIdx).PathId, ctx);
-}
-
-void TSchemeShard::DoShardsDeletion(const THashSet<TShardIdx>& shardIdxs, const TActorContext& ctx) {
+TTabletId TSchemeShard::ResolveHive(TPathId pathId, const TActorContext& ctx) const {
+ if (!PathsById.contains(pathId)) {
+ return GetGlobalHive(ctx);
+ }
+
+ TSubDomainInfo::TPtr subdomain = ResolveDomainInfo(pathId);
+ TPathElement::TPtr path = PathsById.at(pathId);
+
+ if (path->IsExternalSubDomainRoot()) {
+ // we use either shared or global hive for private subdomain's shards. Like TenantSS, CC, MM
+ // and don't use tenant Hive for privat subdomain;s shards
+ return subdomain->GetSharedHive() ? subdomain->GetSharedHive() : GetGlobalHive(ctx);
+ }
+
+ // for pathes inside subdomain and their shards we choise Hive according that order: tanant, shared, global
+ if (subdomain->GetTenantHiveID()) {
+ return subdomain->GetTenantHiveID();
+ }
+
+ if (subdomain->GetSharedHive()) {
+ return subdomain->GetSharedHive();
+ }
+
+ return GetGlobalHive(ctx);
+}
+
+TTabletId TSchemeShard::ResolveHive(TShardIdx shardIdx, const TActorContext& ctx) const {
+ if (!ShardInfos.contains(shardIdx)) {
+ return GetGlobalHive(ctx);
+ }
+
+ return ResolveHive(ShardInfos.at(shardIdx).PathId, ctx);
+}
+
+void TSchemeShard::DoShardsDeletion(const THashSet<TShardIdx>& shardIdxs, const TActorContext& ctx) {
TMap<TTabletId, THashSet<TShardIdx>> shardsPerHive;
for (TShardIdx shardIdx : shardIdxs) {
- TTabletId hiveToRequest = ResolveHive(shardIdx, ctx);
-
- shardsPerHive[hiveToRequest].emplace(shardIdx);
- }
-
- for (const auto& item: shardsPerHive) {
- const auto& hive = item.first;
- const auto& shards = item.second;
+ TTabletId hiveToRequest = ResolveHive(shardIdx, ctx);
+
+ shardsPerHive[hiveToRequest].emplace(shardIdx);
+ }
+
+ for (const auto& item: shardsPerHive) {
+ const auto& hive = item.first;
+ const auto& shards = item.second;
ShardDeleter.SendDeleteRequests(hive, shards, ShardInfos, ctx);
}
}
-NKikimrSchemeOp::TPathVersion TSchemeShard::GetPathVersion(const TPath& path) const {
- NKikimrSchemeOp::TPathVersion result;
-
- const auto pathEl = path.Base();
- const auto pathId = pathEl->PathId;
+NKikimrSchemeOp::TPathVersion TSchemeShard::GetPathVersion(const TPath& path) const {
+ NKikimrSchemeOp::TPathVersion result;
+
+ const auto pathEl = path.Base();
+ const auto pathId = pathEl->PathId;
if (pathEl->Dropped()) {
- result.SetGeneralVersion(Max<ui64>());
- return result;
+ result.SetGeneralVersion(Max<ui64>());
+ return result;
}
- ui64 generalVersion = 0;
-
- if (pathEl->IsCreateFinished()) {
- switch(pathEl->PathType) {
- case NKikimrSchemeOp::EPathType::EPathTypeDir:
- if (pathEl->IsRoot() && IsDomainSchemeShard) {
+ ui64 generalVersion = 0;
+
+ if (pathEl->IsCreateFinished()) {
+ switch(pathEl->PathType) {
+ case NKikimrSchemeOp::EPathType::EPathTypeDir:
+ if (pathEl->IsRoot() && IsDomainSchemeShard) {
TSubDomainInfo::TPtr subDomain = SubDomains.at(pathId);
- Y_VERIFY(SubDomains.contains(pathId));
+ Y_VERIFY(SubDomains.contains(pathId));
result.SetSubDomainVersion(subDomain->GetVersion());
result.SetSecurityStateVersion(subDomain->GetSecurityStateVersion());
- generalVersion += result.GetSubDomainVersion();
+ generalVersion += result.GetSubDomainVersion();
generalVersion += result.GetSecurityStateVersion();
- }
- break;
- case NKikimrSchemeOp::EPathType::EPathTypeSubDomain:
- case NKikimrSchemeOp::EPathType::EPathTypeExtSubDomain: {
- Y_VERIFY(!(pathEl->IsRoot() && IsDomainSchemeShard));
-
- Y_VERIFY(SubDomains.contains(pathId));
+ }
+ break;
+ case NKikimrSchemeOp::EPathType::EPathTypeSubDomain:
+ case NKikimrSchemeOp::EPathType::EPathTypeExtSubDomain: {
+ Y_VERIFY(!(pathEl->IsRoot() && IsDomainSchemeShard));
+
+ Y_VERIFY(SubDomains.contains(pathId));
TSubDomainInfo::TPtr subDomain = SubDomains.at(pathId);
result.SetSubDomainVersion(subDomain->GetVersion());
result.SetSecurityStateVersion(subDomain->GetSecurityStateVersion());
- generalVersion += result.GetSubDomainVersion();
+ generalVersion += result.GetSubDomainVersion();
generalVersion += result.GetSecurityStateVersion();
if (ui64 version = subDomain->GetDomainStateVersion()) {
- result.SetSubDomainStateVersion(version);
- generalVersion += version;
- }
- break;
+ result.SetSubDomainStateVersion(version);
+ generalVersion += version;
+ }
+ break;
}
- case NKikimrSchemeOp::EPathType::EPathTypeTable:
- Y_VERIFY_S(Tables.contains(pathId),
- "no table with id: " << pathId << ", at schemeshard: " << SelfTabletId());
- result.SetTableSchemaVersion(Tables.at(pathId)->AlterVersion);
- generalVersion += result.GetTableSchemaVersion();
-
- result.SetTablePartitionVersion(Tables.at(pathId)->PartitioningVersion);
- generalVersion += result.GetTablePartitionVersion();
- break;
- case NKikimrSchemeOp::EPathType::EPathTypePersQueueGroup:
- Y_VERIFY(PersQueueGroups.contains(pathId));
- result.SetPQVersion(PersQueueGroups.at(pathId)->AlterVersion);
- generalVersion += result.GetPQVersion();
- break;
- case NKikimrSchemeOp::EPathType::EPathTypeBlockStoreVolume:
- Y_VERIFY(BlockStoreVolumes.contains(pathId));
- result.SetBSVVersion(BlockStoreVolumes.at(pathId)->AlterVersion);
- generalVersion += result.GetBSVVersion();
- break;
- case NKikimrSchemeOp::EPathType::EPathTypeFileStore:
- Y_VERIFY(FileStoreInfos.contains(pathId));
- result.SetFileStoreVersion(FileStoreInfos.at(pathId)->Version);
- generalVersion += result.GetFileStoreVersion();
- break;
- case NKikimrSchemeOp::EPathType::EPathTypeKesus:
- Y_VERIFY(KesusInfos.contains(pathId));
- result.SetKesusVersion(KesusInfos.at(pathId)->Version);
- generalVersion += result.GetKesusVersion();
- break;
- case NKikimrSchemeOp::EPathType::EPathTypeRtmrVolume:
- result.SetRTMRVersion(1);
- generalVersion += result.GetRTMRVersion();
- break;
- case NKikimrSchemeOp::EPathType::EPathTypeSolomonVolume:
- Y_VERIFY(SolomonVolumes.contains(pathId));
- result.SetSolomonVersion(SolomonVolumes.at(pathId)->Version);
- generalVersion += result.GetSolomonVersion();
- break;
- case NKikimrSchemeOp::EPathType::EPathTypeTableIndex:
- Y_VERIFY(Indexes.contains(pathId));
- result.SetTableIndexVersion(Indexes.at(pathId)->AlterVersion);
- generalVersion += result.GetTableIndexVersion();
- break;
+ case NKikimrSchemeOp::EPathType::EPathTypeTable:
+ Y_VERIFY_S(Tables.contains(pathId),
+ "no table with id: " << pathId << ", at schemeshard: " << SelfTabletId());
+ result.SetTableSchemaVersion(Tables.at(pathId)->AlterVersion);
+ generalVersion += result.GetTableSchemaVersion();
+
+ result.SetTablePartitionVersion(Tables.at(pathId)->PartitioningVersion);
+ generalVersion += result.GetTablePartitionVersion();
+ break;
+ case NKikimrSchemeOp::EPathType::EPathTypePersQueueGroup:
+ Y_VERIFY(PersQueueGroups.contains(pathId));
+ result.SetPQVersion(PersQueueGroups.at(pathId)->AlterVersion);
+ generalVersion += result.GetPQVersion();
+ break;
+ case NKikimrSchemeOp::EPathType::EPathTypeBlockStoreVolume:
+ Y_VERIFY(BlockStoreVolumes.contains(pathId));
+ result.SetBSVVersion(BlockStoreVolumes.at(pathId)->AlterVersion);
+ generalVersion += result.GetBSVVersion();
+ break;
+ case NKikimrSchemeOp::EPathType::EPathTypeFileStore:
+ Y_VERIFY(FileStoreInfos.contains(pathId));
+ result.SetFileStoreVersion(FileStoreInfos.at(pathId)->Version);
+ generalVersion += result.GetFileStoreVersion();
+ break;
+ case NKikimrSchemeOp::EPathType::EPathTypeKesus:
+ Y_VERIFY(KesusInfos.contains(pathId));
+ result.SetKesusVersion(KesusInfos.at(pathId)->Version);
+ generalVersion += result.GetKesusVersion();
+ break;
+ case NKikimrSchemeOp::EPathType::EPathTypeRtmrVolume:
+ result.SetRTMRVersion(1);
+ generalVersion += result.GetRTMRVersion();
+ break;
+ case NKikimrSchemeOp::EPathType::EPathTypeSolomonVolume:
+ Y_VERIFY(SolomonVolumes.contains(pathId));
+ result.SetSolomonVersion(SolomonVolumes.at(pathId)->Version);
+ generalVersion += result.GetSolomonVersion();
+ break;
+ case NKikimrSchemeOp::EPathType::EPathTypeTableIndex:
+ Y_VERIFY(Indexes.contains(pathId));
+ result.SetTableIndexVersion(Indexes.at(pathId)->AlterVersion);
+ generalVersion += result.GetTableIndexVersion();
+ break;
case NKikimrSchemeOp::EPathType::EPathTypeColumnStore:
- Y_VERIFY_S(OlapStores.contains(pathId),
- "no olap store with id: " << pathId << ", at schemeshard: " << SelfTabletId());
+ Y_VERIFY_S(OlapStores.contains(pathId),
+ "no olap store with id: " << pathId << ", at schemeshard: " << SelfTabletId());
result.SetColumnStoreVersion(OlapStores.at(pathId)->AlterVersion);
generalVersion += result.GetColumnStoreVersion();
- break;
+ break;
case NKikimrSchemeOp::EPathType::EPathTypeColumnTable: {
- Y_VERIFY_S(OlapTables.contains(pathId),
- "no olap table with id: " << pathId << ", at schemeshard: " << SelfTabletId());
- auto tableInfo = OlapTables.at(pathId);
+ Y_VERIFY_S(OlapTables.contains(pathId),
+ "no olap table with id: " << pathId << ", at schemeshard: " << SelfTabletId());
+ auto tableInfo = OlapTables.at(pathId);
result.SetColumnTableVersion(tableInfo->AlterVersion);
generalVersion += result.GetColumnTableVersion();
@@ -3533,40 +3533,40 @@ NKikimrSchemeOp::TPathVersion TSchemeShard::GetPathVersion(const TPath& path) co
result.SetColumnTableShardingVersion(tableInfo->Sharding.GetVersion());
generalVersion += result.GetColumnTableShardingVersion();
- if (tableInfo->Description.HasSchema()) {
+ if (tableInfo->Description.HasSchema()) {
result.SetColumnTableSchemaVersion(tableInfo->Description.GetSchema().GetVersion());
- } else if (tableInfo->Description.HasSchemaPresetId() && tableInfo->OlapStorePathId) {
- auto storeInfo = OlapStores.at(tableInfo->OlapStorePathId);
- auto& preset = storeInfo->SchemaPresets.at(tableInfo->Description.GetSchemaPresetId());
+ } else if (tableInfo->Description.HasSchemaPresetId() && tableInfo->OlapStorePathId) {
+ auto storeInfo = OlapStores.at(tableInfo->OlapStorePathId);
+ auto& preset = storeInfo->SchemaPresets.at(tableInfo->Description.GetSchemaPresetId());
result.SetColumnTableSchemaVersion(tableInfo->Description.GetSchemaPresetVersionAdj() + preset.Version);
- } else {
+ } else {
result.SetColumnTableSchemaVersion(tableInfo->Description.GetSchemaPresetVersionAdj());
- }
+ }
generalVersion += result.GetColumnTableSchemaVersion();
- if (tableInfo->Description.HasTtlSettings()) {
+ if (tableInfo->Description.HasTtlSettings()) {
result.SetColumnTableTtlSettingsVersion(tableInfo->Description.GetTtlSettings().GetVersion());
}
#if 0
else if (tableInfo->Description.HasTtlSettingsPresetId() && tableInfo->OlapStorePathId) {
- auto storeInfo = OlapStores.at(tableInfo->OlapStorePathId);
- auto& preset = storeInfo->TtlSettingsPresets.at(tableInfo->Description.GetTtlSettingsPresetId());
+ auto storeInfo = OlapStores.at(tableInfo->OlapStorePathId);
+ auto& preset = storeInfo->TtlSettingsPresets.at(tableInfo->Description.GetTtlSettingsPresetId());
result.SetColumnTableTtlSettingsVersion(tableInfo->Description.GetTtlSettingsPresetVersionAdj() + preset.Version);
- } else {
+ } else {
result.SetColumnTableTtlSettingsVersion(tableInfo->Description.GetTtlSettingsPresetVersionAdj());
- }
+ }
#endif
generalVersion += result.GetColumnTableTtlSettingsVersion();
-
- break;
- }
- case NKikimrSchemeOp::EPathType::EPathTypeCdcStream: {
- Y_VERIFY(CdcStreams.contains(pathId));
- result.SetCdcStreamVersion(CdcStreams.at(pathId)->AlterVersion);
- generalVersion += result.GetCdcStreamVersion();
- break;
- }
- case NKikimrSchemeOp::EPathType::EPathTypeSequence: {
+
+ break;
+ }
+ case NKikimrSchemeOp::EPathType::EPathTypeCdcStream: {
+ Y_VERIFY(CdcStreams.contains(pathId));
+ result.SetCdcStreamVersion(CdcStreams.at(pathId)->AlterVersion);
+ generalVersion += result.GetCdcStreamVersion();
+ break;
+ }
+ case NKikimrSchemeOp::EPathType::EPathTypeSequence: {
auto it = Sequences.find(pathId);
Y_VERIFY(it != Sequences.end());
result.SetSequenceVersion(it->second->AlterVersion);
@@ -3580,29 +3580,29 @@ NKikimrSchemeOp::TPathVersion TSchemeShard::GetPathVersion(const TPath& path) co
generalVersion += result.GetReplicationVersion();
break;
}
- case NKikimrSchemeOp::EPathType::EPathTypeInvalid: {
- Y_UNREACHABLE();
- }
+ case NKikimrSchemeOp::EPathType::EPathTypeInvalid: {
+ Y_UNREACHABLE();
+ }
}
}
-
-
- result.SetChildrenVersion(pathEl->DirAlterVersion); //not only childrens but also acl children's version increases it
- generalVersion += result.GetChildrenVersion();
-
- result.SetUserAttrsVersion(pathEl->UserAttrs->AlterVersion);
- generalVersion += result.GetUserAttrsVersion();
-
- result.SetACLVersion(pathEl->ACLVersion); // do not add ACL version to the generalVersion here
- result.SetEffectiveACLVersion(path.GetEffectiveACLVersion()); // ACL version is added to generalVersion here
- generalVersion += result.GetEffectiveACLVersion();
-
- result.SetGeneralVersion(generalVersion);
-
- return result;
-}
-
-TActorId TSchemeShard::TPipeClientFactory::CreateClient(const TActorContext& ctx, ui64 tabletId, const NTabletPipe::TClientConfig& pipeConfig){
+
+
+ result.SetChildrenVersion(pathEl->DirAlterVersion); //not only childrens but also acl children's version increases it
+ generalVersion += result.GetChildrenVersion();
+
+ result.SetUserAttrsVersion(pathEl->UserAttrs->AlterVersion);
+ generalVersion += result.GetUserAttrsVersion();
+
+ result.SetACLVersion(pathEl->ACLVersion); // do not add ACL version to the generalVersion here
+ result.SetEffectiveACLVersion(path.GetEffectiveACLVersion()); // ACL version is added to generalVersion here
+ generalVersion += result.GetEffectiveACLVersion();
+
+ result.SetGeneralVersion(generalVersion);
+
+ return result;
+}
+
+TActorId TSchemeShard::TPipeClientFactory::CreateClient(const TActorContext& ctx, ui64 tabletId, const NTabletPipe::TClientConfig& pipeConfig){
auto clientId = Self->Register(NTabletPipe::CreateClient(ctx.SelfID, tabletId, pipeConfig));
switch (Self->GetTabletType(TTabletId(tabletId))) {
case ETabletType::SequenceShard: {
@@ -3624,15 +3624,15 @@ TActorId TSchemeShard::TPipeClientFactory::CreateClient(const TActorContext& ctx
return clientId;
}
-TSchemeShard::TSchemeShard(const TActorId &tablet, TTabletStorageInfo *info)
+TSchemeShard::TSchemeShard(const TActorId &tablet, TTabletStorageInfo *info)
: TActor(&TThis::StateInit)
, TTabletExecutedFlat(info, tablet, new NMiniKQL::TMiniKQLFactory)
, AllowConditionalEraseOperations(1, 0, 1)
- , AllowServerlessStorageBilling(0, 0, 1)
+ , AllowServerlessStorageBilling(0, 0, 1)
, SplitSettings()
, IsReadOnlyMode(false)
- , ParentDomainLink(this)
- , SubDomainsLinks(this)
+ , ParentDomainLink(this)
+ , SubDomainsLinks(this)
, PipeClientCache(NTabletPipe::CreateBoundedClientCache(
new NTabletPipe::TBoundedClientCacheConfig(),
GetPipeClientConfig(),
@@ -3642,81 +3642,81 @@ TSchemeShard::TSchemeShard(const TActorId &tablet, TTabletStorageInfo *info)
, ShardDeleter(info->TabletID)
, AllowDataColumnForIndexTable(0, 0, 1)
, EnableAsyncIndexes(0, 0, 1)
- , EnableSchemeTransactionsAtSchemeShard(0, 0, 1)
+ , EnableSchemeTransactionsAtSchemeShard(0, 0, 1)
{
TabletCountersPtr.Reset(new TProtobufTabletCounters<
- ESimpleCounters_descriptor,
- ECumulativeCounters_descriptor,
- EPercentileCounters_descriptor,
- ETxTypes_descriptor
- >());
+ ESimpleCounters_descriptor,
+ ECumulativeCounters_descriptor,
+ EPercentileCounters_descriptor,
+ ETxTypes_descriptor
+ >());
TabletCounters = TabletCountersPtr.Get();
- SelfPinger = new TSelfPinger(SelfTabletId(), TabletCounters);
-}
-
-const TDomainsInfo::TDomain& TSchemeShard::GetDomainDescription(const TActorContext &ctx) const {
- auto appdata = AppData(ctx);
- Y_VERIFY(appdata);
-
- const ui32 selfDomain = appdata->DomainsInfo->GetDomainUidByTabletId(TabletID());
- Y_VERIFY(selfDomain != appdata->DomainsInfo->BadDomainId);
- const auto& domain = appdata->DomainsInfo->GetDomain(selfDomain);
-
- return domain;
-}
-
-NKikimrSubDomains::TProcessingParams TSchemeShard::CreateRootProcessingParams(const TActorContext &ctx) {
- const auto& domain = GetDomainDescription(ctx);
-
- Y_VERIFY(domain.Coordinators.size());
- return ExtractProcessingParams(domain);
-}
-
-NTabletPipe::TClientConfig TSchemeShard::GetPipeClientConfig() {
- NTabletPipe::TClientConfig config;
+ SelfPinger = new TSelfPinger(SelfTabletId(), TabletCounters);
+}
+
+const TDomainsInfo::TDomain& TSchemeShard::GetDomainDescription(const TActorContext &ctx) const {
+ auto appdata = AppData(ctx);
+ Y_VERIFY(appdata);
+
+ const ui32 selfDomain = appdata->DomainsInfo->GetDomainUidByTabletId(TabletID());
+ Y_VERIFY(selfDomain != appdata->DomainsInfo->BadDomainId);
+ const auto& domain = appdata->DomainsInfo->GetDomain(selfDomain);
+
+ return domain;
+}
+
+NKikimrSubDomains::TProcessingParams TSchemeShard::CreateRootProcessingParams(const TActorContext &ctx) {
+ const auto& domain = GetDomainDescription(ctx);
+
+ Y_VERIFY(domain.Coordinators.size());
+ return ExtractProcessingParams(domain);
+}
+
+NTabletPipe::TClientConfig TSchemeShard::GetPipeClientConfig() {
+ NTabletPipe::TClientConfig config;
config.RetryPolicy = {
.MinRetryTime = TDuration::MilliSeconds(50),
.MaxRetryTime = TDuration::Seconds(2),
};
- return config;
-}
-
-void TSchemeShard::FillTableSchemaVersion(ui64 tableSchemaVersion, NKikimrSchemeOp::TTableDescription* tableDescr) const {
+ return config;
+}
+
+void TSchemeShard::FillTableSchemaVersion(ui64 tableSchemaVersion, NKikimrSchemeOp::TTableDescription* tableDescr) const {
tableDescr->SetTableSchemaVersion(tableSchemaVersion);
}
-void TSchemeShard::BreakTabletAndRestart(const TActorContext &ctx) {
- Become(&TThis::BrokenState);
- ctx.Send(Tablet(), new TEvents::TEvPoisonPill);
-}
-
-bool TSchemeShard::IsShemeShardConfigured() const {
- Y_VERIFY(InitState != TTenantInitState::InvalidState);
- return InitState == TTenantInitState::Done || InitState == TTenantInitState::ReadOnlyPreview;
-}
-
-void TSchemeShard::Die(const TActorContext &ctx) {
+void TSchemeShard::BreakTabletAndRestart(const TActorContext &ctx) {
+ Become(&TThis::BrokenState);
+ ctx.Send(Tablet(), new TEvents::TEvPoisonPill);
+}
+
+bool TSchemeShard::IsShemeShardConfigured() const {
+ Y_VERIFY(InitState != TTenantInitState::InvalidState);
+ return InitState == TTenantInitState::Done || InitState == TTenantInitState::ReadOnlyPreview;
+}
+
+void TSchemeShard::Die(const TActorContext &ctx) {
ctx.Send(SchemeBoardPopulator, new TEvents::TEvPoisonPill());
ctx.Send(TxAllocatorClient, new TEvents::TEvPoisonPill());
ctx.Send(SysPartitionStatsCollector, new TEvents::TEvPoisonPill());
ShardDeleter.Shutdown(ctx);
- ParentDomainLink.Shutdown(ctx);
-
- PipeClientCache->Detach(ctx);
-
+ ParentDomainLink.Shutdown(ctx);
+
+ PipeClientCache->Detach(ctx);
+
if (CompactionQueue)
CompactionQueue->Shutdown(ctx);
return IActor::Die(ctx);
}
-void TSchemeShard::OnDetach(const TActorContext &ctx) {
+void TSchemeShard::OnDetach(const TActorContext &ctx) {
Die(ctx);
}
-void TSchemeShard::OnTabletDead(TEvTablet::TEvTabletDead::TPtr &ev, const TActorContext &ctx) {
+void TSchemeShard::OnTabletDead(TEvTablet::TEvTabletDead::TPtr &ev, const TActorContext &ctx) {
Y_UNUSED(ev);
Die(ctx);
}
@@ -3732,16 +3732,16 @@ static TVector<ui64> CollectTxAllocators(const TAppData *appData) {
return allocators;
}
-void TSchemeShard::OnActivateExecutor(const TActorContext &ctx) {
- const TTabletId selfTabletId = SelfTabletId();
-
- const auto& selfDomain = GetDomainDescription(ctx);
- IsDomainSchemeShard = selfTabletId == TTabletId(selfDomain.SchemeRoot);
- InitState = TTenantInitState::Uninitialized;
-
- auto appData = AppData(ctx);
- Y_VERIFY(appData);
-
+void TSchemeShard::OnActivateExecutor(const TActorContext &ctx) {
+ const TTabletId selfTabletId = SelfTabletId();
+
+ const auto& selfDomain = GetDomainDescription(ctx);
+ IsDomainSchemeShard = selfTabletId == TTabletId(selfDomain.SchemeRoot);
+ InitState = TTenantInitState::Uninitialized;
+
+ auto appData = AppData(ctx);
+ Y_VERIFY(appData);
+
EnableBackgroundCompaction = appData->FeatureFlags.GetEnableBackgroundCompaction();
EnableBackgroundCompactionServerless = appData->FeatureFlags.GetEnableBackgroundCompactionServerless();
if (!CompactionQueue)
@@ -3749,10 +3749,10 @@ void TSchemeShard::OnActivateExecutor(const TActorContext &ctx) {
ctx.RegisterWithSameMailbox(CompactionQueue);
- if (appData->ChannelProfiles) {
- ChannelProfiles = appData->ChannelProfiles;
- }
-
+ if (appData->ChannelProfiles) {
+ ChannelProfiles = appData->ChannelProfiles;
+ }
+
appData->Icb->RegisterSharedControl(AllowConditionalEraseOperations, "SchemeShard_AllowConditionalEraseOperations");
AllowDataColumnForIndexTable = appData->FeatureFlags.GetEnableDataColumnForIndexTable();
@@ -3761,16 +3761,16 @@ void TSchemeShard::OnActivateExecutor(const TActorContext &ctx) {
EnableAsyncIndexes = appData->FeatureFlags.GetEnableAsyncIndexes();
appData->Icb->RegisterSharedControl(EnableAsyncIndexes, "SchemeShard_EnableAsyncIndexes");
- EnableSchemeTransactionsAtSchemeShard = appData->FeatureFlags.GetEnableSchemeTransactionsAtSchemeShard();
- appData->Icb->RegisterSharedControl(EnableSchemeTransactionsAtSchemeShard, "SchemeShard_EnableSchemeTransactionsAtSchemeShard");
-
+ EnableSchemeTransactionsAtSchemeShard = appData->FeatureFlags.GetEnableSchemeTransactionsAtSchemeShard();
+ appData->Icb->RegisterSharedControl(EnableSchemeTransactionsAtSchemeShard, "SchemeShard_EnableSchemeTransactionsAtSchemeShard");
+
for (const auto& sid : appData->MeteringConfig.GetSystemBackupSIDs()) {
SystemBackupSIDs.insert(sid);
}
- AllowServerlessStorageBilling = appData->FeatureFlags.GetAllowServerlessStorageBillingForSchemeShard();
- appData->Icb->RegisterSharedControl(AllowServerlessStorageBilling, "SchemeShard_AllowServerlessStorageBilling");
-
+ AllowServerlessStorageBilling = appData->FeatureFlags.GetAllowServerlessStorageBillingForSchemeShard();
+ appData->Icb->RegisterSharedControl(AllowServerlessStorageBilling, "SchemeShard_AllowServerlessStorageBilling");
+
TxAllocatorClient = RegisterWithSameMailbox(CreateTxAllocatorClient(CollectTxAllocators(appData)));
SysPartitionStatsCollector = Register(NSysView::CreatePartitionStatsCollector().Release());
@@ -3779,120 +3779,120 @@ void TSchemeShard::OnActivateExecutor(const TActorContext &ctx) {
Executor()->RegisterExternalTabletCounters(TabletCountersPtr);
Execute(CreateTxInitSchema(), ctx);
-
- SubscribeConsoleConfigs(ctx);
+
+ SubscribeConsoleConfigs(ctx);
}
// This is overriden as noop in order to activate the table only at the end of Init transaction
// when all the in-mem state has been populated
-void TSchemeShard::DefaultSignalTabletActive(const TActorContext &ctx) {
+void TSchemeShard::DefaultSignalTabletActive(const TActorContext &ctx) {
Y_UNUSED(ctx);
}
-void TSchemeShard::Cleanup(const TActorContext &ctx) {
+void TSchemeShard::Cleanup(const TActorContext &ctx) {
Y_UNUSED(ctx);
}
-void TSchemeShard::Enqueue(STFUNC_SIG) {
+void TSchemeShard::Enqueue(STFUNC_SIG) {
Y_UNUSED(ctx);
- Y_FAIL_S("No enqueue method emplemented."
- << " unhandled event type: " << ev->GetTypeRewrite()
- << " event: " << (ev->HasEvent() ? ev->GetBase()->ToString().data() : "serialized?"));
-
+ Y_FAIL_S("No enqueue method emplemented."
+ << " unhandled event type: " << ev->GetTypeRewrite()
+ << " event: " << (ev->HasEvent() ? ev->GetBase()->ToString().data() : "serialized?"));
+
}
-void TSchemeShard::StateInit(STFUNC_SIG) {
+void TSchemeShard::StateInit(STFUNC_SIG) {
TRACE_EVENT(NKikimrServices::FLAT_TX_SCHEMESHARD);
switch (ev->GetTypeRewrite()) {
- HFuncTraced(TEvents::TEvPoisonPill, Handle);
-
- //console configs
- HFuncTraced(NConsole::TEvConfigsDispatcher::TEvSetConfigSubscriptionResponse, Handle);
- HFunc(NConsole::TEvConsole::TEvConfigNotificationRequest, Handle);
+ HFuncTraced(TEvents::TEvPoisonPill, Handle);
+
+ //console configs
+ HFuncTraced(NConsole::TEvConfigsDispatcher::TEvSetConfigSubscriptionResponse, Handle);
+ HFunc(NConsole::TEvConsole::TEvConfigNotificationRequest, Handle);
default:
StateInitImpl(ev, ctx);
}
}
-void TSchemeShard::StateConfigure(STFUNC_SIG) {
+void TSchemeShard::StateConfigure(STFUNC_SIG) {
+ SelfPinger->OnAnyEvent(ctx);
+
+ TRACE_EVENT(NKikimrServices::FLAT_TX_SCHEMESHARD);
+ switch (ev->GetTypeRewrite()) {
+ HFuncTraced(TEvents::TEvPoisonPill, Handle);
+
+ HFuncTraced(TEvSchemeShard::TEvInitRootShard, Handle);
+ HFuncTraced(TEvSchemeShard::TEvInitTenantSchemeShard, Handle);
+ HFuncTraced(TEvSchemeShard::TEvMigrateSchemeShard, Handle);
+ HFuncTraced(TEvSchemeShard::TEvPublishTenantAsReadOnly, Handle);
+
+ HFuncTraced(TEvSchemeShard::TEvMeasureSelfResponseTime, SelfPinger->Handle);
+ HFuncTraced(TEvSchemeShard::TEvWakeupToMeasureSelfResponseTime, SelfPinger->Handle);
+
+ //operation initiate msg, must return error
+ HFuncTraced(TEvSchemeShard::TEvModifySchemeTransaction, Handle);
+ HFuncTraced(TEvSchemeShard::TEvDescribeScheme, Handle);
+ HFuncTraced(TEvSchemeShard::TEvNotifyTxCompletion, Handle);
+ HFuncTraced(TEvSchemeShard::TEvCancelTx, Handle);
+
+ //pipes mgs
+ HFuncTraced(TEvTabletPipe::TEvClientConnected, Handle);
+ HFuncTraced(TEvTabletPipe::TEvClientDestroyed, Handle);
+ HFuncTraced(TEvTabletPipe::TEvServerConnected, Handle);
+ HFuncTraced(TEvTabletPipe::TEvServerDisconnected, Handle);
+
+ //console configs
+ HFuncTraced(NConsole::TEvConfigsDispatcher::TEvSetConfigSubscriptionResponse, Handle);
+ HFunc(NConsole::TEvConsole::TEvConfigNotificationRequest, Handle);
+ default:
+ if (!HandleDefaultEvents(ev, ctx)) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "StateConfigure:"
+ << " unhandled event type: " << ev->GetTypeRewrite()
+ << " event: " << (ev->HasEvent() ? ev->GetBase()->ToString().data() : "serialized?"));
+ }
+ }
+}
+
+void TSchemeShard::StateWork(STFUNC_SIG) {
SelfPinger->OnAnyEvent(ctx);
TRACE_EVENT(NKikimrServices::FLAT_TX_SCHEMESHARD);
switch (ev->GetTypeRewrite()) {
- HFuncTraced(TEvents::TEvPoisonPill, Handle);
-
- HFuncTraced(TEvSchemeShard::TEvInitRootShard, Handle);
- HFuncTraced(TEvSchemeShard::TEvInitTenantSchemeShard, Handle);
- HFuncTraced(TEvSchemeShard::TEvMigrateSchemeShard, Handle);
- HFuncTraced(TEvSchemeShard::TEvPublishTenantAsReadOnly, Handle);
-
- HFuncTraced(TEvSchemeShard::TEvMeasureSelfResponseTime, SelfPinger->Handle);
- HFuncTraced(TEvSchemeShard::TEvWakeupToMeasureSelfResponseTime, SelfPinger->Handle);
-
- //operation initiate msg, must return error
- HFuncTraced(TEvSchemeShard::TEvModifySchemeTransaction, Handle);
- HFuncTraced(TEvSchemeShard::TEvDescribeScheme, Handle);
- HFuncTraced(TEvSchemeShard::TEvNotifyTxCompletion, Handle);
- HFuncTraced(TEvSchemeShard::TEvCancelTx, Handle);
-
- //pipes mgs
- HFuncTraced(TEvTabletPipe::TEvClientConnected, Handle);
- HFuncTraced(TEvTabletPipe::TEvClientDestroyed, Handle);
- HFuncTraced(TEvTabletPipe::TEvServerConnected, Handle);
- HFuncTraced(TEvTabletPipe::TEvServerDisconnected, Handle);
-
- //console configs
- HFuncTraced(NConsole::TEvConfigsDispatcher::TEvSetConfigSubscriptionResponse, Handle);
- HFunc(NConsole::TEvConsole::TEvConfigNotificationRequest, Handle);
- default:
- if (!HandleDefaultEvents(ev, ctx)) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "StateConfigure:"
- << " unhandled event type: " << ev->GetTypeRewrite()
- << " event: " << (ev->HasEvent() ? ev->GetBase()->ToString().data() : "serialized?"));
- }
- }
-}
-
-void TSchemeShard::StateWork(STFUNC_SIG) {
- SelfPinger->OnAnyEvent(ctx);
-
- TRACE_EVENT(NKikimrServices::FLAT_TX_SCHEMESHARD);
- switch (ev->GetTypeRewrite()) {
HFuncTraced(TEvents::TEvPoisonPill, Handle);
- HFuncTraced(TEvSchemeShard::TEvInitRootShard, Handle);
-
- HFuncTraced(TEvSchemeShard::TEvMeasureSelfResponseTime, SelfPinger->Handle);
- HFuncTraced(TEvSchemeShard::TEvWakeupToMeasureSelfResponseTime, SelfPinger->Handle);
-
- //operation initiate msg
- HFuncTraced(TEvSchemeShard::TEvModifySchemeTransaction, Handle);
- HFuncTraced(TEvSchemeShard::TEvDescribeScheme, Handle);
- HFuncTraced(TEvSchemeShard::TEvNotifyTxCompletion, Handle);
- HFuncTraced(TEvSchemeShard::TEvCancelTx, Handle);
-
- //operation schedule msg
+ HFuncTraced(TEvSchemeShard::TEvInitRootShard, Handle);
+
+ HFuncTraced(TEvSchemeShard::TEvMeasureSelfResponseTime, SelfPinger->Handle);
+ HFuncTraced(TEvSchemeShard::TEvWakeupToMeasureSelfResponseTime, SelfPinger->Handle);
+
+ //operation initiate msg
+ HFuncTraced(TEvSchemeShard::TEvModifySchemeTransaction, Handle);
+ HFuncTraced(TEvSchemeShard::TEvDescribeScheme, Handle);
+ HFuncTraced(TEvSchemeShard::TEvNotifyTxCompletion, Handle);
+ HFuncTraced(TEvSchemeShard::TEvCancelTx, Handle);
+
+ //operation schedule msg
HFuncTraced(TEvPrivate::TEvProgressOperation, Handle);
-
- //coordination distributed transactions msg
+
+ //coordination distributed transactions msg
HFuncTraced(TEvTxProcessing::TEvPlanStep, Handle);
-
- //operations managed msg
+
+ //operations managed msg
HFuncTraced(TEvHive::TEvCreateTabletReply, Handle);
- IgnoreFunc(TEvHive::TEvTabletCreationResult);
- HFuncTraced(TEvHive::TEvAdoptTabletReply, Handle);
+ IgnoreFunc(TEvHive::TEvTabletCreationResult);
+ HFuncTraced(TEvHive::TEvAdoptTabletReply, Handle);
HFuncTraced(TEvHive::TEvDeleteTabletReply, Handle);
- HFuncTraced(TEvHive::TEvDeleteOwnerTabletsReply, Handle);
-
- HFuncTraced(TEvDataShard::TEvProposeTransactionResult, Handle);
- HFuncTraced(TEvDataShard::TEvSchemaChanged, Handle);
- HFuncTraced(TEvDataShard::TEvStateChanged, Handle);
+ HFuncTraced(TEvHive::TEvDeleteOwnerTabletsReply, Handle);
+
+ HFuncTraced(TEvDataShard::TEvProposeTransactionResult, Handle);
+ HFuncTraced(TEvDataShard::TEvSchemaChanged, Handle);
+ HFuncTraced(TEvDataShard::TEvStateChanged, Handle);
HFuncTraced(TEvDataShard::TEvInitSplitMergeDestinationAck, Handle);
HFuncTraced(TEvDataShard::TEvSplitAck, Handle);
HFuncTraced(TEvDataShard::TEvSplitPartitioningChangedAck, Handle);
HFuncTraced(TEvDataShard::TEvPeriodicTableStats, Handle);
HFuncTraced(TEvDataShard::TEvGetTableStatsResult, Handle);
-
+
//
HFuncTraced(TEvColumnShard::TEvProposeTransactionResult, Handle);
HFuncTraced(TEvColumnShard::TEvNotifyTxCompletionResult, Handle);
@@ -3913,37 +3913,37 @@ void TSchemeShard::StateWork(STFUNC_SIG) {
HFuncTraced(TEvPrivate::TEvRunConditionalErase, Handle);
HFuncTraced(TEvDataShard::TEvConditionalEraseRowsResponse, Handle);
- HFuncTraced(TEvPrivate::TEvServerlessStorageBilling, Handle);
-
+ HFuncTraced(TEvPrivate::TEvServerlessStorageBilling, Handle);
+
HFuncTraced(NSysView::TEvSysView::TEvGetPartitionStats, Handle);
- HFuncTraced(TEvSubDomain::TEvConfigureStatus, Handle);
- HFuncTraced(TEvSchemeShard::TEvInitTenantSchemeShard, Handle);
- HFuncTraced(TEvSchemeShard::TEvInitTenantSchemeShardResult, Handle);
- HFuncTraced(TEvSchemeShard::TEvPublishTenantAsReadOnly, Handle);
- HFuncTraced(TEvSchemeShard::TEvPublishTenantAsReadOnlyResult, Handle);
- HFuncTraced(TEvSchemeShard::TEvPublishTenant, Handle);
- HFuncTraced(TEvSchemeShard::TEvPublishTenantResult, Handle);
- HFuncTraced(TEvSchemeShard::TEvMigrateSchemeShardResult, Handle);
- HFuncTraced(TEvDataShard::TEvMigrateSchemeShardResponse, Handle);
+ HFuncTraced(TEvSubDomain::TEvConfigureStatus, Handle);
+ HFuncTraced(TEvSchemeShard::TEvInitTenantSchemeShard, Handle);
+ HFuncTraced(TEvSchemeShard::TEvInitTenantSchemeShardResult, Handle);
+ HFuncTraced(TEvSchemeShard::TEvPublishTenantAsReadOnly, Handle);
+ HFuncTraced(TEvSchemeShard::TEvPublishTenantAsReadOnlyResult, Handle);
+ HFuncTraced(TEvSchemeShard::TEvPublishTenant, Handle);
+ HFuncTraced(TEvSchemeShard::TEvPublishTenantResult, Handle);
+ HFuncTraced(TEvSchemeShard::TEvMigrateSchemeShardResult, Handle);
+ HFuncTraced(TEvDataShard::TEvMigrateSchemeShardResponse, Handle);
HFuncTraced(TEvDataShard::TEvCompactTableResult, Handle);
-
- HFuncTraced(TEvSchemeShard::TEvSyncTenantSchemeShard, Handle);
- HFuncTraced(TEvSchemeShard::TEvUpdateTenantSchemeShard, Handle);
-
+
+ HFuncTraced(TEvSchemeShard::TEvSyncTenantSchemeShard, Handle);
+ HFuncTraced(TEvSchemeShard::TEvUpdateTenantSchemeShard, Handle);
+
HFuncTraced(TSchemeBoardEvents::TEvUpdateAck, Handle);
-
+
HFuncTraced(TEvBlockStore::TEvUpdateVolumeConfigResponse, Handle);
HFuncTraced(TEvFileStore::TEvUpdateConfigResponse, Handle);
HFuncTraced(NKesus::TEvKesus::TEvSetConfigResult, Handle);
- HFuncTraced(TEvPersQueue::TEvDropTabletReply, Handle);
- HFuncTraced(TEvPersQueue::TEvUpdateConfigResponse, Handle);
-
- //pipes mgs
- HFuncTraced(TEvTabletPipe::TEvClientConnected, Handle);
- HFuncTraced(TEvTabletPipe::TEvClientDestroyed, Handle);
- HFuncTraced(TEvTabletPipe::TEvServerConnected, Handle);
- HFuncTraced(TEvTabletPipe::TEvServerDisconnected, Handle);
+ HFuncTraced(TEvPersQueue::TEvDropTabletReply, Handle);
+ HFuncTraced(TEvPersQueue::TEvUpdateConfigResponse, Handle);
+
+ //pipes mgs
+ HFuncTraced(TEvTabletPipe::TEvClientConnected, Handle);
+ HFuncTraced(TEvTabletPipe::TEvClientDestroyed, Handle);
+ HFuncTraced(TEvTabletPipe::TEvServerConnected, Handle);
+ HFuncTraced(TEvTabletPipe::TEvServerDisconnected, Handle);
// namespace NExport {
HFuncTraced(TEvExport::TEvCreateExportRequest, Handle);
@@ -3951,7 +3951,7 @@ void TSchemeShard::StateWork(STFUNC_SIG) {
HFuncTraced(TEvExport::TEvCancelExportRequest, Handle);
HFuncTraced(TEvExport::TEvForgetExportRequest, Handle);
HFuncTraced(TEvExport::TEvListExportsRequest, Handle);
- // } // NExport
+ // } // NExport
// namespace NImport {
HFuncTraced(TEvImport::TEvCreateImportRequest, Handle);
@@ -3962,371 +3962,371 @@ void TSchemeShard::StateWork(STFUNC_SIG) {
HFuncTraced(TEvPrivate::TEvImportSchemeReady, Handle);
// } // NImport
- //namespace NIndexBuilder {
- HFuncTraced(TEvIndexBuilder::TEvCreateRequest, Handle);
- HFuncTraced(TEvIndexBuilder::TEvGetRequest, Handle);
- HFuncTraced(TEvIndexBuilder::TEvCancelRequest, Handle);
- HFuncTraced(TEvIndexBuilder::TEvForgetRequest, Handle);
- HFuncTraced(TEvIndexBuilder::TEvListRequest, Handle);
- HFuncTraced(TEvDataShard::TEvBuildIndexProgressResponse, Handle);
- HFuncTraced(TEvPrivate::TEvIndexBuildingMakeABill, Handle);
+ //namespace NIndexBuilder {
+ HFuncTraced(TEvIndexBuilder::TEvCreateRequest, Handle);
+ HFuncTraced(TEvIndexBuilder::TEvGetRequest, Handle);
+ HFuncTraced(TEvIndexBuilder::TEvCancelRequest, Handle);
+ HFuncTraced(TEvIndexBuilder::TEvForgetRequest, Handle);
+ HFuncTraced(TEvIndexBuilder::TEvListRequest, Handle);
+ HFuncTraced(TEvDataShard::TEvBuildIndexProgressResponse, Handle);
+ HFuncTraced(TEvPrivate::TEvIndexBuildingMakeABill, Handle);
// } // NIndexBuilder
-
+
// namespace NLongRunningCommon {
HFuncTraced(TEvTxAllocatorClient::TEvAllocateResult, Handle);
- HFuncTraced(TEvSchemeShard::TEvModifySchemeTransactionResult, Handle);
+ HFuncTraced(TEvSchemeShard::TEvModifySchemeTransactionResult, Handle);
HFuncTraced(TEvIndexBuilder::TEvCreateResponse, Handle);
- HFuncTraced(TEvSchemeShard::TEvNotifyTxCompletionRegistered, Handle);
- HFuncTraced(TEvSchemeShard::TEvNotifyTxCompletionResult, Handle);
- HFuncTraced(TEvSchemeShard::TEvCancelTxResult, Handle);
+ HFuncTraced(TEvSchemeShard::TEvNotifyTxCompletionRegistered, Handle);
+ HFuncTraced(TEvSchemeShard::TEvNotifyTxCompletionResult, Handle);
+ HFuncTraced(TEvSchemeShard::TEvCancelTxResult, Handle);
HFuncTraced(TEvIndexBuilder::TEvCancelResponse, Handle);
// } // NLongRunningCommon
-
- //console configs
- HFuncTraced(NConsole::TEvConfigsDispatcher::TEvSetConfigSubscriptionResponse, Handle);
- HFunc(NConsole::TEvConsole::TEvConfigNotificationRequest, Handle);
-
- HFuncTraced(TEvSchemeShard::TEvFindTabletSubDomainPathId, Handle);
- IgnoreFunc(TEvTxProxy::TEvProposeTransactionStatus);
+ //console configs
+ HFuncTraced(NConsole::TEvConfigsDispatcher::TEvSetConfigSubscriptionResponse, Handle);
+ HFunc(NConsole::TEvConsole::TEvConfigNotificationRequest, Handle);
+
+ HFuncTraced(TEvSchemeShard::TEvFindTabletSubDomainPathId, Handle);
+
+ IgnoreFunc(TEvTxProxy::TEvProposeTransactionStatus);
HFuncTraced(TEvPrivate::TEvCleanDroppedPaths, Handle);
HFuncTraced(TEvPrivate::TEvCleanDroppedSubDomains, Handle);
HFuncTraced(TEvPrivate::TEvSubscribeToShardDeletion, Handle);
- HFuncTraced(TEvSchemeShard::TEvLogin, Handle);
+ HFuncTraced(TEvSchemeShard::TEvLogin, Handle);
default:
- if (!HandleDefaultEvents(ev, ctx)) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "StateWork:"
- << " unhandled event type: " << ev->GetTypeRewrite()
- << " event: " << (ev->HasEvent() ? ev->GetBase()->ToString().data() : "serialized?"));
- }
+ if (!HandleDefaultEvents(ev, ctx)) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "StateWork:"
+ << " unhandled event type: " << ev->GetTypeRewrite()
+ << " event: " << (ev->HasEvent() ? ev->GetBase()->ToString().data() : "serialized?"));
+ }
break;
}
}
-void TSchemeShard::BrokenState(STFUNC_SIG) {
+void TSchemeShard::BrokenState(STFUNC_SIG) {
TRACE_EVENT(NKikimrServices::FLAT_TX_SCHEMESHARD);
switch (ev->GetTypeRewrite()) {
HFuncTraced(TEvTablet::TEvTabletDead, HandleTabletDead);
- default:
- if (!HandleDefaultEvents(ev, ctx)) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "BrokenState:"
- << " unhandled event type: " << ev->GetTypeRewrite()
- << " event: " << (ev->HasEvent() ? ev->GetBase()->ToString().data() : "serialized?"));
- }
- break;
- }
-}
-
-void TSchemeShard::DeleteSplitOp(TOperationId operationId, TTxState& txState) {
- Y_VERIFY(txState.ShardsInProgress.empty(), "All shards should have already completed their steps");
-
- TTableInfo::TPtr tableInfo = *Tables.FindPtr(txState.TargetPathId);
- Y_VERIFY(tableInfo);
- tableInfo->FinishSplitMergeOp(operationId);
-}
-
-bool TSchemeShard::ShardIsUnderSplitMergeOp(const TShardIdx& idx) const {
- const TShardInfo* shardInfo = ShardInfos.FindPtr(idx);
- if (!shardInfo) {
- return false;
- }
-
- TTxId lastTxId = shardInfo->CurrentTxId;
- if (!lastTxId) {
- return false;
- }
-
- TTableInfo::TCPtr table = Tables.at(shardInfo->PathId);
-
- TOperationId lastOpId = TOperationId(lastTxId, 0);
- if (!TxInFlight.contains(lastOpId)) {
- Y_VERIFY_S(!table->IsShardInSplitMergeOp(idx),
- "shardIdx: " << idx
- << " pathId: " << shardInfo->PathId);
- return false;
- }
-
- Y_VERIFY_S(table->IsShardInSplitMergeOp(idx),
- "shardIdx: " << idx
- << " pathId: " << shardInfo->PathId
- << " lastOpId: " << lastOpId);
- return true;
-}
-
-TTxState &TSchemeShard::CreateTx(TOperationId opId, TTxState::ETxType txType, TPathId targetPath, TPathId sourcePath) {
- Y_VERIFY_S(!TxInFlight.contains(opId),
- "Trying to create duplicate Tx " << opId);
- TTxState& txState = TxInFlight[opId];
- txState = TTxState(txType, targetPath, sourcePath);
- TabletCounters->Simple()[TTxState::TxTypeInFlightCounter(txType)].Add(1);
- IncrementPathDbRefCount(targetPath, "transaction target path");
- if (sourcePath) {
- IncrementPathDbRefCount(sourcePath, "transaction source path");
- }
- return txState;
-}
-
-TTxState *TSchemeShard::FindTx(TOperationId opId) {
- TTxState* txState = TxInFlight.FindPtr(opId);
- return txState;
-}
-
-void TSchemeShard::RemoveTx(const TActorContext &ctx, NIceDb::TNiceDb &db, TOperationId opId, TTxState *txState) {
- if (!txState) {
- txState = TxInFlight.FindPtr(opId);
- }
- if (!txState) {
- return;
- }
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "RemoveTx for txid " << opId);
+ default:
+ if (!HandleDefaultEvents(ev, ctx)) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "BrokenState:"
+ << " unhandled event type: " << ev->GetTypeRewrite()
+ << " event: " << (ev->HasEvent() ? ev->GetBase()->ToString().data() : "serialized?"));
+ }
+ break;
+ }
+}
+
+void TSchemeShard::DeleteSplitOp(TOperationId operationId, TTxState& txState) {
+ Y_VERIFY(txState.ShardsInProgress.empty(), "All shards should have already completed their steps");
+
+ TTableInfo::TPtr tableInfo = *Tables.FindPtr(txState.TargetPathId);
+ Y_VERIFY(tableInfo);
+ tableInfo->FinishSplitMergeOp(operationId);
+}
+
+bool TSchemeShard::ShardIsUnderSplitMergeOp(const TShardIdx& idx) const {
+ const TShardInfo* shardInfo = ShardInfos.FindPtr(idx);
+ if (!shardInfo) {
+ return false;
+ }
+
+ TTxId lastTxId = shardInfo->CurrentTxId;
+ if (!lastTxId) {
+ return false;
+ }
+
+ TTableInfo::TCPtr table = Tables.at(shardInfo->PathId);
+
+ TOperationId lastOpId = TOperationId(lastTxId, 0);
+ if (!TxInFlight.contains(lastOpId)) {
+ Y_VERIFY_S(!table->IsShardInSplitMergeOp(idx),
+ "shardIdx: " << idx
+ << " pathId: " << shardInfo->PathId);
+ return false;
+ }
+
+ Y_VERIFY_S(table->IsShardInSplitMergeOp(idx),
+ "shardIdx: " << idx
+ << " pathId: " << shardInfo->PathId
+ << " lastOpId: " << lastOpId);
+ return true;
+}
+
+TTxState &TSchemeShard::CreateTx(TOperationId opId, TTxState::ETxType txType, TPathId targetPath, TPathId sourcePath) {
+ Y_VERIFY_S(!TxInFlight.contains(opId),
+ "Trying to create duplicate Tx " << opId);
+ TTxState& txState = TxInFlight[opId];
+ txState = TTxState(txType, targetPath, sourcePath);
+ TabletCounters->Simple()[TTxState::TxTypeInFlightCounter(txType)].Add(1);
+ IncrementPathDbRefCount(targetPath, "transaction target path");
+ if (sourcePath) {
+ IncrementPathDbRefCount(sourcePath, "transaction source path");
+ }
+ return txState;
+}
+
+TTxState *TSchemeShard::FindTx(TOperationId opId) {
+ TTxState* txState = TxInFlight.FindPtr(opId);
+ return txState;
+}
+
+void TSchemeShard::RemoveTx(const TActorContext &ctx, NIceDb::TNiceDb &db, TOperationId opId, TTxState *txState) {
+ if (!txState) {
+ txState = TxInFlight.FindPtr(opId);
+ }
+ if (!txState) {
+ return;
+ }
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "RemoveTx for txid " << opId);
auto pathId = txState->TargetPathId;
-
- PersistRemoveTx(db, opId, *txState);
- TabletCounters->Simple()[TTxState::TxTypeInFlightCounter(txState->TxType)].Sub(1);
-
- if (txState->IsItActuallyMerge()) {
- TabletCounters->Cumulative()[TTxState::TxTypeFinishedCounter(TTxState::TxMergeTablePartition)].Increment(1);
- } else {
- TabletCounters->Cumulative()[TTxState::TxTypeFinishedCounter(txState->TxType)].Increment(1);
- }
-
- DecrementPathDbRefCount(pathId, "remove txstate target path");
- if (txState->SourcePathId) {
- DecrementPathDbRefCount(txState->SourcePathId, "remove txstate source path");
- }
-
- TxInFlight.erase(opId); // must be called last, erases txState invalidating txState ptr
-}
-
-TMaybe<NKikimrSchemeOp::TPartitionConfig> TSchemeShard::GetTablePartitionConfigWithAlterData(TPathId pathId) const {
- Y_VERIFY_S(PathsById.contains(pathId), "Unknown pathId " << pathId);
- auto pTable = Tables.FindPtr(pathId);
- if (pTable) {
- TTableInfo::TPtr table = *pTable;
- if (table->AlterData) {
- return table->AlterData->PartitionConfigCompatible();
- }
- return table->PartitionConfig();
- }
- return Nothing();
-}
-
-void TSchemeShard::ExamineTreeVFS(TPathId nodeId, std::function<void (TPathElement::TPtr)> func, const TActorContext &ctx) {
- TPathElement::TPtr node = PathsById.at(nodeId);
- Y_VERIFY(node);
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "ExamineTreeVFS visit path id " << nodeId <<
- " name: " << node->Name <<
- " type: " << NKikimrSchemeOp::EPathType_Name(node->PathType) <<
- " state: " << NKikimrSchemeOp::EPathState_Name(node->PathState) <<
- " stepDropped: " << node->StepDropped <<
- " droppedTxId: " << node->DropTxId <<
- " parent: " << node->ParentPathId);
-
- // node droped and no hidden tx is in fly
- if (node->Dropped() && !Operations.contains(node->DropTxId)) {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "ExamineTreeVFS skip path id " << nodeId);
-
- if (node->IsTable()) { //lets check indexes
- for (auto chihldrenIt: node->GetChildren()) {
- ExamineTreeVFS(chihldrenIt.second, func, ctx);
- }
- }
- return;
- }
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "ExamineTreeVFS run path id: " << nodeId);
-
- func(node);
-
- for (auto chihldrenIt: node->GetChildren()) {
- ExamineTreeVFS(chihldrenIt.second, func, ctx);
- }
-}
-
-THashSet<TPathId> TSchemeShard::ListSubThee(TPathId subdomain_root, const TActorContext &ctx) {
- THashSet<TPathId> pathes;
-
- auto savePath = [&] (TPathElement::TPtr node) {
- pathes.insert(node->PathId);
- };
-
- ExamineTreeVFS(subdomain_root, savePath, ctx);
-
- return pathes;
-}
-
-THashSet<TTxId> TSchemeShard::GetRelatedTransactions(const THashSet<TPathId> &pathes, const TActorContext &ctx) {
- Y_UNUSED(ctx);
- THashSet<TTxId> transactions;
-
- for (const auto& txInFly: TxInFlight) {
- TOperationId opId = txInFly.first;
- const TTxState& state = txInFly.second;
-
- if (!pathes.contains(state.TargetPathId)) {
- continue;
- }
-
- transactions.insert(opId.GetTxId());
- }
-
- return transactions;
-}
-
-THashSet<TShardIdx> TSchemeShard::CollectAllShards(const THashSet<TPathId> &pathes) const {
- THashSet<TShardIdx> shards;
-
- for (const auto& shardItem: ShardInfos) {
- auto idx = shardItem.first;
- const TShardInfo& info = shardItem.second;
-
- if (!pathes.contains(info.PathId)) {
- continue;
- }
-
- shards.insert(idx);
- }
-
- for (const auto& pathId: pathes) {
- Y_VERIFY(PathsById.contains(pathId));
- TPathElement::TPtr path = PathsById.at(pathId);
- if (!path->IsSubDomainRoot()) {
- continue;
- }
- TSubDomainInfo::TPtr domainInfo = SubDomains.at(pathId);
- const auto& domainShards = domainInfo->GetInternalShards();
- shards.insert(domainShards.begin(), domainShards.end());
- }
-
- return shards;
-}
-
-void TSchemeShard::MarkAsDroping(TPathElement::TPtr node, TTxId txId, const TActorContext &ctx) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Mark as Dropping path id " << node->PathId <<
- " by tx: " << txId);
- if (!node->Dropped()) {
- node->PathState = TPathElement::EPathState::EPathStateDrop;
- node->DropTxId = txId;
- }
-}
-
-void TSchemeShard::UncountNode(TPathElement::TPtr node) {
- if (node->IsDomainRoot()) {
- ResolveDomainInfo(node->ParentPathId)->DecPathsInside();
- } else {
- ResolveDomainInfo(node)->DecPathsInside();
- }
- PathsById.at(node->ParentPathId)->DecAliveChildren();
-
- TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(node->UserAttrs->Size());
-
- switch (node->PathType) {
- case TPathElement::EPathType::EPathTypeDir:
- TabletCounters->Simple()[COUNTER_DIR_COUNT].Sub(1);
- break;
- case TPathElement::EPathType::EPathTypeRtmrVolume:
- TabletCounters->Simple()[COUNTER_RTMR_VOLUME_COUNT].Sub(1);
- break;
- case TPathElement::EPathType::EPathTypeTable:
- TabletCounters->Simple()[COUNTER_TABLE_COUNT].Sub(1);
- break;
- case TPathElement::EPathType::EPathTypePersQueueGroup:
- TabletCounters->Simple()[COUNTER_PQ_GROUP_COUNT].Sub(1);
- break;
- case TPathElement::EPathType::EPathTypeSubDomain:
- TabletCounters->Simple()[COUNTER_SUB_DOMAIN_COUNT].Sub(1);
- break;
- case TPathElement::EPathType::EPathTypeExtSubDomain:
- TabletCounters->Simple()[COUNTER_EXTSUB_DOMAIN_COUNT].Sub(1);
- break;
- case TPathElement::EPathType::EPathTypeBlockStoreVolume:
- TabletCounters->Simple()[COUNTER_BLOCKSTORE_VOLUME_COUNT].Sub(1);
- break;
+
+ PersistRemoveTx(db, opId, *txState);
+ TabletCounters->Simple()[TTxState::TxTypeInFlightCounter(txState->TxType)].Sub(1);
+
+ if (txState->IsItActuallyMerge()) {
+ TabletCounters->Cumulative()[TTxState::TxTypeFinishedCounter(TTxState::TxMergeTablePartition)].Increment(1);
+ } else {
+ TabletCounters->Cumulative()[TTxState::TxTypeFinishedCounter(txState->TxType)].Increment(1);
+ }
+
+ DecrementPathDbRefCount(pathId, "remove txstate target path");
+ if (txState->SourcePathId) {
+ DecrementPathDbRefCount(txState->SourcePathId, "remove txstate source path");
+ }
+
+ TxInFlight.erase(opId); // must be called last, erases txState invalidating txState ptr
+}
+
+TMaybe<NKikimrSchemeOp::TPartitionConfig> TSchemeShard::GetTablePartitionConfigWithAlterData(TPathId pathId) const {
+ Y_VERIFY_S(PathsById.contains(pathId), "Unknown pathId " << pathId);
+ auto pTable = Tables.FindPtr(pathId);
+ if (pTable) {
+ TTableInfo::TPtr table = *pTable;
+ if (table->AlterData) {
+ return table->AlterData->PartitionConfigCompatible();
+ }
+ return table->PartitionConfig();
+ }
+ return Nothing();
+}
+
+void TSchemeShard::ExamineTreeVFS(TPathId nodeId, std::function<void (TPathElement::TPtr)> func, const TActorContext &ctx) {
+ TPathElement::TPtr node = PathsById.at(nodeId);
+ Y_VERIFY(node);
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "ExamineTreeVFS visit path id " << nodeId <<
+ " name: " << node->Name <<
+ " type: " << NKikimrSchemeOp::EPathType_Name(node->PathType) <<
+ " state: " << NKikimrSchemeOp::EPathState_Name(node->PathState) <<
+ " stepDropped: " << node->StepDropped <<
+ " droppedTxId: " << node->DropTxId <<
+ " parent: " << node->ParentPathId);
+
+ // node droped and no hidden tx is in fly
+ if (node->Dropped() && !Operations.contains(node->DropTxId)) {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "ExamineTreeVFS skip path id " << nodeId);
+
+ if (node->IsTable()) { //lets check indexes
+ for (auto chihldrenIt: node->GetChildren()) {
+ ExamineTreeVFS(chihldrenIt.second, func, ctx);
+ }
+ }
+ return;
+ }
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "ExamineTreeVFS run path id: " << nodeId);
+
+ func(node);
+
+ for (auto chihldrenIt: node->GetChildren()) {
+ ExamineTreeVFS(chihldrenIt.second, func, ctx);
+ }
+}
+
+THashSet<TPathId> TSchemeShard::ListSubThee(TPathId subdomain_root, const TActorContext &ctx) {
+ THashSet<TPathId> pathes;
+
+ auto savePath = [&] (TPathElement::TPtr node) {
+ pathes.insert(node->PathId);
+ };
+
+ ExamineTreeVFS(subdomain_root, savePath, ctx);
+
+ return pathes;
+}
+
+THashSet<TTxId> TSchemeShard::GetRelatedTransactions(const THashSet<TPathId> &pathes, const TActorContext &ctx) {
+ Y_UNUSED(ctx);
+ THashSet<TTxId> transactions;
+
+ for (const auto& txInFly: TxInFlight) {
+ TOperationId opId = txInFly.first;
+ const TTxState& state = txInFly.second;
+
+ if (!pathes.contains(state.TargetPathId)) {
+ continue;
+ }
+
+ transactions.insert(opId.GetTxId());
+ }
+
+ return transactions;
+}
+
+THashSet<TShardIdx> TSchemeShard::CollectAllShards(const THashSet<TPathId> &pathes) const {
+ THashSet<TShardIdx> shards;
+
+ for (const auto& shardItem: ShardInfos) {
+ auto idx = shardItem.first;
+ const TShardInfo& info = shardItem.second;
+
+ if (!pathes.contains(info.PathId)) {
+ continue;
+ }
+
+ shards.insert(idx);
+ }
+
+ for (const auto& pathId: pathes) {
+ Y_VERIFY(PathsById.contains(pathId));
+ TPathElement::TPtr path = PathsById.at(pathId);
+ if (!path->IsSubDomainRoot()) {
+ continue;
+ }
+ TSubDomainInfo::TPtr domainInfo = SubDomains.at(pathId);
+ const auto& domainShards = domainInfo->GetInternalShards();
+ shards.insert(domainShards.begin(), domainShards.end());
+ }
+
+ return shards;
+}
+
+void TSchemeShard::MarkAsDroping(TPathElement::TPtr node, TTxId txId, const TActorContext &ctx) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Mark as Dropping path id " << node->PathId <<
+ " by tx: " << txId);
+ if (!node->Dropped()) {
+ node->PathState = TPathElement::EPathState::EPathStateDrop;
+ node->DropTxId = txId;
+ }
+}
+
+void TSchemeShard::UncountNode(TPathElement::TPtr node) {
+ if (node->IsDomainRoot()) {
+ ResolveDomainInfo(node->ParentPathId)->DecPathsInside();
+ } else {
+ ResolveDomainInfo(node)->DecPathsInside();
+ }
+ PathsById.at(node->ParentPathId)->DecAliveChildren();
+
+ TabletCounters->Simple()[COUNTER_USER_ATTRIBUTES_COUNT].Sub(node->UserAttrs->Size());
+
+ switch (node->PathType) {
+ case TPathElement::EPathType::EPathTypeDir:
+ TabletCounters->Simple()[COUNTER_DIR_COUNT].Sub(1);
+ break;
+ case TPathElement::EPathType::EPathTypeRtmrVolume:
+ TabletCounters->Simple()[COUNTER_RTMR_VOLUME_COUNT].Sub(1);
+ break;
+ case TPathElement::EPathType::EPathTypeTable:
+ TabletCounters->Simple()[COUNTER_TABLE_COUNT].Sub(1);
+ break;
+ case TPathElement::EPathType::EPathTypePersQueueGroup:
+ TabletCounters->Simple()[COUNTER_PQ_GROUP_COUNT].Sub(1);
+ break;
+ case TPathElement::EPathType::EPathTypeSubDomain:
+ TabletCounters->Simple()[COUNTER_SUB_DOMAIN_COUNT].Sub(1);
+ break;
+ case TPathElement::EPathType::EPathTypeExtSubDomain:
+ TabletCounters->Simple()[COUNTER_EXTSUB_DOMAIN_COUNT].Sub(1);
+ break;
+ case TPathElement::EPathType::EPathTypeBlockStoreVolume:
+ TabletCounters->Simple()[COUNTER_BLOCKSTORE_VOLUME_COUNT].Sub(1);
+ break;
case TPathElement::EPathType::EPathTypeFileStore:
- TabletCounters->Simple()[COUNTER_FILESTORE_COUNT].Sub(1);
+ TabletCounters->Simple()[COUNTER_FILESTORE_COUNT].Sub(1);
+ break;
+ case TPathElement::EPathType::EPathTypeKesus:
+ TabletCounters->Simple()[COUNTER_KESUS_COUNT].Sub(1);
+ break;
+ case TPathElement::EPathType::EPathTypeSolomonVolume:
+ TabletCounters->Simple()[COUNTER_SOLOMON_VOLUME_COUNT].Sub(1);
+ break;
+ case TPathElement::EPathType::EPathTypeTableIndex:
+ TabletCounters->Simple()[COUNTER_TABLE_INDEXES_COUNT].Sub(1);
break;
- case TPathElement::EPathType::EPathTypeKesus:
- TabletCounters->Simple()[COUNTER_KESUS_COUNT].Sub(1);
- break;
- case TPathElement::EPathType::EPathTypeSolomonVolume:
- TabletCounters->Simple()[COUNTER_SOLOMON_VOLUME_COUNT].Sub(1);
- break;
- case TPathElement::EPathType::EPathTypeTableIndex:
- TabletCounters->Simple()[COUNTER_TABLE_INDEXES_COUNT].Sub(1);
- break;
case TPathElement::EPathType::EPathTypeColumnStore:
case TPathElement::EPathType::EPathTypeColumnTable:
// TODO
break;
case TPathElement::EPathType::EPathTypeCdcStream:
- TabletCounters->Simple()[COUNTER_CDC_STREAMS_COUNT].Sub(1);
+ TabletCounters->Simple()[COUNTER_CDC_STREAMS_COUNT].Sub(1);
break;
case TPathElement::EPathType::EPathTypeSequence:
- TabletCounters->Simple()[COUNTER_SEQUENCE_COUNT].Sub(1);
+ TabletCounters->Simple()[COUNTER_SEQUENCE_COUNT].Sub(1);
break;
case TPathElement::EPathType::EPathTypeReplication:
TabletCounters->Simple()[COUNTER_REPLICATION_COUNT].Sub(1);
break;
- case TPathElement::EPathType::EPathTypeInvalid:
- Y_FAIL("imposible path type");
- }
-}
-
-void TSchemeShard::MarkAsDroping(const THashSet<TPathId> &pathes, TTxId txId, const TActorContext &ctx) {
- for (auto id: pathes) {
- MarkAsDroping(PathsById.at(id), txId, ctx);
- }
-}
-
-void TSchemeShard::MarkAsMigrated(TPathElement::TPtr node, const TActorContext &ctx) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Mark as Migrated path id " << node->PathId);
-
- Y_VERIFY(!node->Dropped());
- Y_VERIFY_S(PathsById.contains(ResolveDomainId(node)),
- "details:"
- << " node->PathId: " << node->PathId
- << ", node->DomainPathId: " << node->DomainPathId);
-
- Y_VERIFY_S(PathsById.at(ResolveDomainId(node))->IsExternalSubDomainRoot(),
- "details:"
- << " pathId: " << ResolveDomainId(node)
- << ", pathType: " << NKikimrSchemeOp::EPathType_Name(PathsById.at(ResolveDomainId(node))->PathType));
-
- node->PathState = TPathElement::EPathState::EPathStateMigrated;
-
- UncountNode(node);
-}
-
-
-void TSchemeShard::DropNode(TPathElement::TPtr node, TStepId step, TTxId txId, NIceDb::TNiceDb &db, const TActorContext &ctx) {
- Y_VERIFY_S(node->PathState == TPathElement::EPathState::EPathStateDrop
- || node->IsMigrated(),
- "path id: " << node->PathId <<
- " type: " << NKikimrSchemeOp::EPathType_Name(node->PathType) <<
- " state: " << NKikimrSchemeOp::EPathState_Name(node->PathState) <<
- " txid: " << txId);
-
- Y_VERIFY(node->DropTxId == txId || node->IsMigrated());
-
- if (!node->IsMigrated()) {
- UncountNode(node);
- }
-
- node->SetDropped(step, txId);
- PersistDropStep(db, node->PathId, node->StepDropped, TOperationId(node->DropTxId, 0));
-
+ case TPathElement::EPathType::EPathTypeInvalid:
+ Y_FAIL("imposible path type");
+ }
+}
+
+void TSchemeShard::MarkAsDroping(const THashSet<TPathId> &pathes, TTxId txId, const TActorContext &ctx) {
+ for (auto id: pathes) {
+ MarkAsDroping(PathsById.at(id), txId, ctx);
+ }
+}
+
+void TSchemeShard::MarkAsMigrated(TPathElement::TPtr node, const TActorContext &ctx) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Mark as Migrated path id " << node->PathId);
+
+ Y_VERIFY(!node->Dropped());
+ Y_VERIFY_S(PathsById.contains(ResolveDomainId(node)),
+ "details:"
+ << " node->PathId: " << node->PathId
+ << ", node->DomainPathId: " << node->DomainPathId);
+
+ Y_VERIFY_S(PathsById.at(ResolveDomainId(node))->IsExternalSubDomainRoot(),
+ "details:"
+ << " pathId: " << ResolveDomainId(node)
+ << ", pathType: " << NKikimrSchemeOp::EPathType_Name(PathsById.at(ResolveDomainId(node))->PathType));
+
+ node->PathState = TPathElement::EPathState::EPathStateMigrated;
+
+ UncountNode(node);
+}
+
+
+void TSchemeShard::DropNode(TPathElement::TPtr node, TStepId step, TTxId txId, NIceDb::TNiceDb &db, const TActorContext &ctx) {
+ Y_VERIFY_S(node->PathState == TPathElement::EPathState::EPathStateDrop
+ || node->IsMigrated(),
+ "path id: " << node->PathId <<
+ " type: " << NKikimrSchemeOp::EPathType_Name(node->PathType) <<
+ " state: " << NKikimrSchemeOp::EPathState_Name(node->PathState) <<
+ " txid: " << txId);
+
+ Y_VERIFY(node->DropTxId == txId || node->IsMigrated());
+
+ if (!node->IsMigrated()) {
+ UncountNode(node);
+ }
+
+ node->SetDropped(step, txId);
+ PersistDropStep(db, node->PathId, node->StepDropped, TOperationId(node->DropTxId, 0));
+
switch (node->PathType) {
case TPathElement::EPathType::EPathTypeTable:
PersistRemoveTable(db, node->PathId, ctx);
@@ -4365,280 +4365,280 @@ void TSchemeShard::DropNode(TPathElement::TPtr node, TStepId step, TTxId txId, N
default:
// not all path types support removal
break;
- }
-
- PersistUserAttributes(db, node->PathId, node->UserAttrs, nullptr);
-}
-
-void TSchemeShard::DropPathes(const THashSet<TPathId> &pathes, TStepId step, TTxId txId, NIceDb::TNiceDb &db, const TActorContext &ctx) {
- for (auto id: pathes) {
+ }
+
+ PersistUserAttributes(db, node->PathId, node->UserAttrs, nullptr);
+}
+
+void TSchemeShard::DropPathes(const THashSet<TPathId> &pathes, TStepId step, TTxId txId, NIceDb::TNiceDb &db, const TActorContext &ctx) {
+ for (auto id: pathes) {
DropNode(PathsById.at(id), step, txId, db, ctx);
- }
-}
-
-TString TSchemeShard::FillBackupTxBody(TPathId pathId, const NKikimrSchemeOp::TBackupTask& task, ui32 shardNum, TMessageSeqNo seqNo) const
-{
- NKikimrTxDataShard::TFlatSchemeTransaction tx;
- FillSeqNo(tx, seqNo);
- auto backup = tx.MutableBackup();
+ }
+}
+
+TString TSchemeShard::FillBackupTxBody(TPathId pathId, const NKikimrSchemeOp::TBackupTask& task, ui32 shardNum, TMessageSeqNo seqNo) const
+{
+ NKikimrTxDataShard::TFlatSchemeTransaction tx;
+ FillSeqNo(tx, seqNo);
+ auto backup = tx.MutableBackup();
backup->CopyFrom(task);
- backup->SetTableId(pathId.LocalPathId);
- backup->SetShardNum(shardNum);
-
- TString txBody;
+ backup->SetTableId(pathId.LocalPathId);
+ backup->SetShardNum(shardNum);
+
+ TString txBody;
Y_PROTOBUF_SUPPRESS_NODISCARD tx.SerializeToString(&txBody);
- return txBody;
-}
-
-void TSchemeShard::Handle(TEvDataShard::TEvSchemaChanged::TPtr& ev, const TActorContext &ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Handle TEvSchemaChanged"
- << ", tabletId: " << TabletID()
- << ", at schemeshard: " << TabletID()
- << ", message: " << ev->Get()->Record.ShortDebugString());
-
- const auto txId = TTxId(ev->Get()->Record.GetTxId());
- const auto tableId = TTabletId(ev->Get()->Record.GetOrigin());
-
+ return txBody;
+}
+
+void TSchemeShard::Handle(TEvDataShard::TEvSchemaChanged::TPtr& ev, const TActorContext &ctx) {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Handle TEvSchemaChanged"
+ << ", tabletId: " << TabletID()
+ << ", at schemeshard: " << TabletID()
+ << ", message: " << ev->Get()->Record.ShortDebugString());
+
+ const auto txId = TTxId(ev->Get()->Record.GetTxId());
+ const auto tableId = TTabletId(ev->Get()->Record.GetOrigin());
+
TActorId ackTo = ev->Get()->GetSource();
-
- if (!Operations.contains(txId)) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvDataShard::TEvSchemaChanged"
- << " for unknown txId " << txId
- << " message# " << ev->Get()->Record.DebugString());
-
- THolder<TEvDataShard::TEvSchemaChangedResult> event =
+
+ if (!Operations.contains(txId)) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvDataShard::TEvSchemaChanged"
+ << " for unknown txId " << txId
+ << " message# " << ev->Get()->Record.DebugString());
+
+ THolder<TEvDataShard::TEvSchemaChangedResult> event =
THolder(new TEvDataShard::TEvSchemaChangedResult(ui64(txId)));
- ctx.Send(ackTo, event.Release());
- return;
- }
-
- auto partId = Operations.at(txId)->FindRelatedPartByTabletId(tableId, ctx);
- if (partId == InvalidSubTxId) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvDataShard::TEvSchemaChanged"
- << " for unknown part in txId: " << txId
- << " message# " << ev->Get()->Record.DebugString());
-
- THolder<TEvDataShard::TEvSchemaChangedResult> event =
+ ctx.Send(ackTo, event.Release());
+ return;
+ }
+
+ auto partId = Operations.at(txId)->FindRelatedPartByTabletId(tableId, ctx);
+ if (partId == InvalidSubTxId) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvDataShard::TEvSchemaChanged"
+ << " for unknown part in txId: " << txId
+ << " message# " << ev->Get()->Record.DebugString());
+
+ THolder<TEvDataShard::TEvSchemaChangedResult> event =
THolder(new TEvDataShard::TEvSchemaChangedResult(ui64(txId)));
- ctx.Send(ackTo, event.Release());
- return;
- }
-
- Execute(CreateTxOperationReply(TOperationId(txId, partId), ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvDataShard::TEvStateChanged::TPtr &ev, const TActorContext &ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Handle TEvStateChanged"
- << ", at schemeshard: " << TabletID()
- << ", message: " << ev->Get()->Record.ShortDebugString());
-
- Execute(CreateTxShardStateChanged(ev), ctx);
-}
-
-
-void TSchemeShard::Handle(TEvDataShard::TEvInitSplitMergeDestinationAck::TPtr& ev, const TActorContext& ctx) {
- const auto txId = TTxId(ev->Get()->Record.GetOperationCookie());
- const auto tabletId = TTabletId(ev->Get()->Record.GetTabletId());
- if (!Operations.contains(txId)) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got InitSplitMergeDestinationAck"
- << " for unknown txId " << txId
- << " datashard " << tabletId);
- return;
- }
-
- Execute(CreateTxOperationReply(TOperationId(txId, 0), ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvDataShard::TEvSplitAck::TPtr& ev, const TActorContext& ctx) {
- const auto txId = TTxId(ev->Get()->Record.GetOperationCookie());
- const auto tabletId = TTabletId(ev->Get()->Record.GetTabletId());
- if (!Operations.contains(txId)) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got SplitAck"
- << " for unknown txId " << txId
- << " datashard " << tabletId);
- return;
- }
-
- Execute(CreateTxOperationReply(TOperationId(txId, 0), ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvDataShard::TEvSplitPartitioningChangedAck::TPtr& ev, const TActorContext& ctx) {
- const auto txId = TTxId(ev->Get()->Record.GetOperationCookie());
- const auto tabletId = TTabletId(ev->Get()->Record.GetTabletId());
- if (!Operations.contains(txId)) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvSplitPartitioningChangedAck"
- << " for unknown txId " << txId
- << " datashard " << tabletId);
- return;
- }
-
- Execute(CreateTxOperationReply(TOperationId(txId, 0), ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvSchemeShard::TEvDescribeScheme::TPtr &ev, const TActorContext &ctx) {
+ ctx.Send(ackTo, event.Release());
+ return;
+ }
+
+ Execute(CreateTxOperationReply(TOperationId(txId, partId), ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvDataShard::TEvStateChanged::TPtr &ev, const TActorContext &ctx) {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Handle TEvStateChanged"
+ << ", at schemeshard: " << TabletID()
+ << ", message: " << ev->Get()->Record.ShortDebugString());
+
+ Execute(CreateTxShardStateChanged(ev), ctx);
+}
+
+
+void TSchemeShard::Handle(TEvDataShard::TEvInitSplitMergeDestinationAck::TPtr& ev, const TActorContext& ctx) {
+ const auto txId = TTxId(ev->Get()->Record.GetOperationCookie());
+ const auto tabletId = TTabletId(ev->Get()->Record.GetTabletId());
+ if (!Operations.contains(txId)) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got InitSplitMergeDestinationAck"
+ << " for unknown txId " << txId
+ << " datashard " << tabletId);
+ return;
+ }
+
+ Execute(CreateTxOperationReply(TOperationId(txId, 0), ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvDataShard::TEvSplitAck::TPtr& ev, const TActorContext& ctx) {
+ const auto txId = TTxId(ev->Get()->Record.GetOperationCookie());
+ const auto tabletId = TTabletId(ev->Get()->Record.GetTabletId());
+ if (!Operations.contains(txId)) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got SplitAck"
+ << " for unknown txId " << txId
+ << " datashard " << tabletId);
+ return;
+ }
+
+ Execute(CreateTxOperationReply(TOperationId(txId, 0), ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvDataShard::TEvSplitPartitioningChangedAck::TPtr& ev, const TActorContext& ctx) {
+ const auto txId = TTxId(ev->Get()->Record.GetOperationCookie());
+ const auto tabletId = TTabletId(ev->Get()->Record.GetTabletId());
+ if (!Operations.contains(txId)) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvSplitPartitioningChangedAck"
+ << " for unknown txId " << txId
+ << " datashard " << tabletId);
+ return;
+ }
+
+ Execute(CreateTxOperationReply(TOperationId(txId, 0), ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvSchemeShard::TEvDescribeScheme::TPtr &ev, const TActorContext &ctx) {
Execute(CreateTxDescribeScheme(ev), ctx);
}
-void TSchemeShard::Handle(TEvSchemeShard::TEvNotifyTxCompletion::TPtr &ev, const TActorContext &ctx) {
+void TSchemeShard::Handle(TEvSchemeShard::TEvNotifyTxCompletion::TPtr &ev, const TActorContext &ctx) {
Execute(CreateTxNotifyTxCompletion(ev), ctx);
}
-void TSchemeShard::Handle(TEvSchemeShard::TEvInitRootShard::TPtr &ev, const TActorContext &ctx) {
+void TSchemeShard::Handle(TEvSchemeShard::TEvInitRootShard::TPtr &ev, const TActorContext &ctx) {
Execute(CreateTxInitRootCompatibility(ev), ctx);
}
-void TSchemeShard::Handle(TEvSchemeShard::TEvInitTenantSchemeShard::TPtr &ev, const TActorContext &ctx) {
- Execute(CreateTxInitTenantSchemeShard(ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvSchemeShard::TEvModifySchemeTransaction::TPtr &ev, const TActorContext &ctx) {
+void TSchemeShard::Handle(TEvSchemeShard::TEvInitTenantSchemeShard::TPtr &ev, const TActorContext &ctx) {
+ Execute(CreateTxInitTenantSchemeShard(ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvSchemeShard::TEvModifySchemeTransaction::TPtr &ev, const TActorContext &ctx) {
if (IsReadOnlyMode) {
ui64 txId = ev->Get()->Record.GetTxId();
ui64 selfId = TabletID();
- THolder<TEvSchemeShard::TEvModifySchemeTransactionResult> result =
- THolder(new TEvSchemeShard::TEvModifySchemeTransactionResult(
- NKikimrScheme::StatusReadOnly, txId, selfId, "Schema is in ReadOnly mode"));
+ THolder<TEvSchemeShard::TEvModifySchemeTransactionResult> result =
+ THolder(new TEvSchemeShard::TEvModifySchemeTransactionResult(
+ NKikimrScheme::StatusReadOnly, txId, selfId, "Schema is in ReadOnly mode"));
ctx.Send(ev->Sender, result.Release());
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Schema modification rejected because of ReadOnly mode"
- << ", at tablet: " << selfId
- << " txid: " << txId);
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Schema modification rejected because of ReadOnly mode"
+ << ", at tablet: " << selfId
+ << " txid: " << txId);
return;
}
- Execute(CreateTxOperationPropose(ev), ctx);
+ Execute(CreateTxOperationPropose(ev), ctx);
}
-void TSchemeShard::Handle(TEvPrivate::TEvProgressOperation::TPtr &ev, const TActorContext &ctx) {
- const auto txId = TTxId(ev->Get()->TxId);
- if (!Operations.contains(txId)) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvPrivate::TEvProgressOperation"
- << " for unknown txId " << txId);
- return;
- }
-
- Y_VERIFY(ev->Get()->TxPartId != InvalidSubTxId);
- Execute(CreateTxOperationProgress(TOperationId(txId, ev->Get()->TxPartId)), ctx);
+void TSchemeShard::Handle(TEvPrivate::TEvProgressOperation::TPtr &ev, const TActorContext &ctx) {
+ const auto txId = TTxId(ev->Get()->TxId);
+ if (!Operations.contains(txId)) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvPrivate::TEvProgressOperation"
+ << " for unknown txId " << txId);
+ return;
+ }
+
+ Y_VERIFY(ev->Get()->TxPartId != InvalidSubTxId);
+ Execute(CreateTxOperationProgress(TOperationId(txId, ev->Get()->TxPartId)), ctx);
}
-void TSchemeShard::Handle(TEvTabletPipe::TEvClientConnected::TPtr &ev, const TActorContext &ctx) {
- const auto tabletId = TTabletId(ev->Get()->TabletId);
+void TSchemeShard::Handle(TEvTabletPipe::TEvClientConnected::TPtr &ev, const TActorContext &ctx) {
+ const auto tabletId = TTabletId(ev->Get()->TabletId);
const TActorId clientId = ev->Get()->ClientId;
-
- LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Handle TEvClientConnected"
- << ", tabletId: " << tabletId
- << ", status: " << NKikimrProto::EReplyStatus_Name(ev->Get()->Status)
- << ", at schemeshard: " << TabletID());
-
+
+ LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Handle TEvClientConnected"
+ << ", tabletId: " << tabletId
+ << ", status: " << NKikimrProto::EReplyStatus_Name(ev->Get()->Status)
+ << ", at schemeshard: " << TabletID());
+
Y_VERIFY(ev->Get()->Leader);
-
- if (PipeClientCache->OnConnect(ev)) {
- return; //all Ok
+
+ if (PipeClientCache->OnConnect(ev)) {
+ return; //all Ok
+ }
+
+ if (IndexBuildPipes.Has(clientId)) {
+ Execute(CreatePipeRetry(IndexBuildPipes.GetOwnerId(clientId), IndexBuildPipes.GetTabletId(clientId)), ctx);
+ return;
}
- if (IndexBuildPipes.Has(clientId)) {
- Execute(CreatePipeRetry(IndexBuildPipes.GetOwnerId(clientId), IndexBuildPipes.GetTabletId(clientId)), ctx);
- return;
- }
-
- if (ShardDeleter.Has(tabletId, clientId)) {
+ if (ShardDeleter.Has(tabletId, clientId)) {
ShardDeleter.ResendDeleteRequests(TTabletId(ev->Get()->TabletId), ShardInfos, ctx);
- return;
- }
-
- if (ParentDomainLink.HasPipeTo(tabletId, clientId)) {
- ParentDomainLink.AtPipeError(ctx);
- return;
- }
-
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Failed to connect"
- << ", to tablet: " << tabletId
- << ", at schemeshard: " << TabletID());
-
- RestartPipeTx(tabletId, ctx);
-}
-
-void TSchemeShard::Handle(TEvTabletPipe::TEvServerConnected::TPtr &ev, const TActorContext &ctx) {
+ return;
+ }
+
+ if (ParentDomainLink.HasPipeTo(tabletId, clientId)) {
+ ParentDomainLink.AtPipeError(ctx);
+ return;
+ }
+
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Failed to connect"
+ << ", to tablet: " << tabletId
+ << ", at schemeshard: " << TabletID());
+
+ RestartPipeTx(tabletId, ctx);
+}
+
+void TSchemeShard::Handle(TEvTabletPipe::TEvServerConnected::TPtr &ev, const TActorContext &ctx) {
Y_UNUSED(ev);
Y_UNUSED(ctx);
- LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Pipe server connected"
- << ", at tablet: " << ev->Get()->TabletId);
+ LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Pipe server connected"
+ << ", at tablet: " << ev->Get()->TabletId);
}
-void TSchemeShard::Handle(TEvTabletPipe::TEvClientDestroyed::TPtr &ev, const TActorContext &ctx) {
- const auto tabletId = TTabletId(ev->Get()->TabletId);
+void TSchemeShard::Handle(TEvTabletPipe::TEvClientDestroyed::TPtr &ev, const TActorContext &ctx) {
+ const auto tabletId = TTabletId(ev->Get()->TabletId);
const TActorId clientId = ev->Get()->ClientId;
-
- LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Client pipe"
- << ", to tablet: " << tabletId
- << ", from:" << TabletID() << " is reset");
-
+
+ LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Client pipe"
+ << ", to tablet: " << tabletId
+ << ", from:" << TabletID() << " is reset");
+
PipeClientCache->OnDisconnect(ev);
-
- if (IndexBuildPipes.Has(clientId)) {
- Execute(CreatePipeRetry(IndexBuildPipes.GetOwnerId(clientId), IndexBuildPipes.GetTabletId(clientId)), ctx);
- return;
- }
-
- if (ShardDeleter.Has(tabletId, clientId)) {
+
+ if (IndexBuildPipes.Has(clientId)) {
+ Execute(CreatePipeRetry(IndexBuildPipes.GetOwnerId(clientId), IndexBuildPipes.GetTabletId(clientId)), ctx);
+ return;
+ }
+
+ if (ShardDeleter.Has(tabletId, clientId)) {
ShardDeleter.ResendDeleteRequests(tabletId, ShardInfos, ctx);
- return;
+ return;
}
-
- if (ParentDomainLink.HasPipeTo(tabletId, clientId)) {
- ParentDomainLink.AtPipeError(ctx);
- return;
- }
-
- RestartPipeTx(tabletId, ctx);
+
+ if (ParentDomainLink.HasPipeTo(tabletId, clientId)) {
+ ParentDomainLink.AtPipeError(ctx);
+ return;
+ }
+
+ RestartPipeTx(tabletId, ctx);
}
-void TSchemeShard::Handle(TEvTabletPipe::TEvServerDisconnected::TPtr &ev, const TActorContext &ctx) {
+void TSchemeShard::Handle(TEvTabletPipe::TEvServerDisconnected::TPtr &ev, const TActorContext &ctx) {
Y_UNUSED(ev);
- LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Server pipe is reset"
- << ", at schemeshard: " << TabletID());
-}
-
-void TSchemeShard::Handle(TEvSchemeShard::TEvSyncTenantSchemeShard::TPtr& ev, const TActorContext& ctx) {
- const auto& record = ev->Get()->Record;
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Handle TEvSyncTenantSchemeShard"
- << ", at schemeshard: " << TabletID()
- << ", msg: " << record.DebugString());
- Y_VERIFY_S(IsDomainSchemeShard, "unexpected message: schemeshard: " << TabletID() << " mgs: " << record.DebugString());
-
- if (SubDomainsLinks.Sync(ev, ctx)) {
- Execute(CreateTxSyncTenant(TPathId(record.GetDomainSchemeShard(), record.GetDomainPathId())), ctx);
- }
-}
-
-void TSchemeShard::Handle(TEvSchemeShard::TEvUpdateTenantSchemeShard::TPtr& ev, const TActorContext& ctx) {
- const auto& record = ev->Get()->Record;
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Handle TEvUpdateTenantSchemeShard"
- << ", at schemeshard: " << TabletID()
- << ", msg: " << record.ShortDebugString());
- Y_VERIFY_S(!IsDomainSchemeShard, "unexpected message: schemeshard: " << TabletID() << " mgs: " << record.DebugString());
-
- Execute(CreateTxUpdateTenant(ev), ctx);
-}
-
-void TSchemeShard::Handle(TSchemeBoardEvents::TEvUpdateAck::TPtr& ev, const TActorContext& ctx) {
+ LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Server pipe is reset"
+ << ", at schemeshard: " << TabletID());
+}
+
+void TSchemeShard::Handle(TEvSchemeShard::TEvSyncTenantSchemeShard::TPtr& ev, const TActorContext& ctx) {
+ const auto& record = ev->Get()->Record;
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Handle TEvSyncTenantSchemeShard"
+ << ", at schemeshard: " << TabletID()
+ << ", msg: " << record.DebugString());
+ Y_VERIFY_S(IsDomainSchemeShard, "unexpected message: schemeshard: " << TabletID() << " mgs: " << record.DebugString());
+
+ if (SubDomainsLinks.Sync(ev, ctx)) {
+ Execute(CreateTxSyncTenant(TPathId(record.GetDomainSchemeShard(), record.GetDomainPathId())), ctx);
+ }
+}
+
+void TSchemeShard::Handle(TEvSchemeShard::TEvUpdateTenantSchemeShard::TPtr& ev, const TActorContext& ctx) {
+ const auto& record = ev->Get()->Record;
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Handle TEvUpdateTenantSchemeShard"
+ << ", at schemeshard: " << TabletID()
+ << ", msg: " << record.ShortDebugString());
+ Y_VERIFY_S(!IsDomainSchemeShard, "unexpected message: schemeshard: " << TabletID() << " mgs: " << record.DebugString());
+
+ Execute(CreateTxUpdateTenant(ev), ctx);
+}
+
+void TSchemeShard::Handle(TSchemeBoardEvents::TEvUpdateAck::TPtr& ev, const TActorContext& ctx) {
const auto& record = ev->Get()->Record;
LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Handle TEvUpdateAck"
@@ -4646,13 +4646,13 @@ void TSchemeShard::Handle(TSchemeBoardEvents::TEvUpdateAck::TPtr& ev, const TAct
<< ", msg: " << record.ShortDebugString()
<< ", cookie: " << ev->Cookie);
- const auto pathId = TPathId(ev->Get()->Record.GetPathOwnerId(), ev->Get()->Record.GetLocalPathId());
- if (DelayedInitTenantReply && DelayedInitTenantDestination && pathId == RootPathId()) {
- ctx.Send(DelayedInitTenantDestination, DelayedInitTenantReply.Release());
- DelayedInitTenantDestination = {};
- }
-
- const auto txId = TTxId(ev->Cookie);
+ const auto pathId = TPathId(ev->Get()->Record.GetPathOwnerId(), ev->Get()->Record.GetLocalPathId());
+ if (DelayedInitTenantReply && DelayedInitTenantDestination && pathId == RootPathId()) {
+ ctx.Send(DelayedInitTenantDestination, DelayedInitTenantReply.Release());
+ DelayedInitTenantDestination = {};
+ }
+
+ const auto txId = TTxId(ev->Cookie);
if (!txId) {
// There was no txId, so we are not waiting for an ack
return;
@@ -4669,124 +4669,124 @@ void TSchemeShard::Handle(TSchemeBoardEvents::TEvUpdateAck::TPtr& ev, const TAct
Execute(CreateTxAckPublishToSchemeBoard(ev), ctx);
}
-void TSchemeShard::Handle(TEvTxProcessing::TEvPlanStep::TPtr &ev, const TActorContext &ctx) {
- Execute(CreateTxOperationPlanStep(ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvHive::TEvCreateTabletReply::TPtr &ev, const TActorContext &ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Handle TEvCreateTabletReply"
- << " at schemeshard: " << TabletID()
- << " message: " << ev->Get()->Record.ShortDebugString());
-
- auto shardIdx = TShardIdx(ev->Get()->Record.GetOwner(),
- TLocalShardIdx(ev->Get()->Record.GetOwnerIdx()));
-
- if (!ShardInfos.contains(shardIdx)) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvCreateTabletReply"
- << " for unknown shard idx " << shardIdx
- << " tabletId " << ev->Get()->Record.GetTabletID());
- return;
- }
-
- TShardInfo& shardInfo = ShardInfos[shardIdx];
- const auto txId = shardInfo.CurrentTxId;
-
- if (!Operations.contains(txId)) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvCreateTabletReply"
- << " for unknown txId: " << txId
- << ", stardIdx: " << shardIdx
- << ", tabletId: " << ev->Get()->Record.GetTabletID()
- << ", at schemeshard: " << TabletID());
- return;
- }
-
- TSubTxId partId = Operations.at(txId)->FindRelatedPartByShardIdx(shardIdx, ctx);
- if (partId == InvalidSubTxId) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvCreateTabletReply but partId in unknown"
- << ", for txId: " << txId
- << ", stardIdx: " << shardIdx
- << ", tabletId: " << ev->Get()->Record.GetTabletID()
- << ", at schemeshard: " << TabletID());
- return;
- }
-
- Execute(CreateTxOperationReply(TOperationId(txId, partId), ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvHive::TEvAdoptTabletReply::TPtr &ev, const TActorContext &ctx) {
- auto shardIdx = MakeLocalId(TLocalShardIdx(ev->Get()->Record.GetOwnerIdx())); // internal id
-
- if (!ShardInfos.contains(shardIdx)) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvAdoptTabletReply"
- << " for unknown shard idx " << shardIdx
- << " tabletId " << ev->Get()->Record.GetTabletID());
- return;
- }
-
- TShardInfo& shardInfo = ShardInfos[shardIdx];
- const auto txId = shardInfo.CurrentTxId;
-
- if (!Operations.contains(txId)) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvAdoptTabletReply"
- << " for unknown txId " << txId
- << " stardIdx " << shardIdx
- << " tabletId " << ev->Get()->Record.GetTabletID());
-
- return;
- }
-
- Execute(CreateTxOperationReply(TOperationId(txId, 0), ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvHive::TEvDeleteTabletReply::TPtr &ev, const TActorContext &ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Free tablet reply"
- << ", message: " << ev->Get()->Record.ShortDebugString()
- << ", at schemeshard: " << TabletID());
-
+void TSchemeShard::Handle(TEvTxProcessing::TEvPlanStep::TPtr &ev, const TActorContext &ctx) {
+ Execute(CreateTxOperationPlanStep(ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvHive::TEvCreateTabletReply::TPtr &ev, const TActorContext &ctx) {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Handle TEvCreateTabletReply"
+ << " at schemeshard: " << TabletID()
+ << " message: " << ev->Get()->Record.ShortDebugString());
+
+ auto shardIdx = TShardIdx(ev->Get()->Record.GetOwner(),
+ TLocalShardIdx(ev->Get()->Record.GetOwnerIdx()));
+
+ if (!ShardInfos.contains(shardIdx)) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvCreateTabletReply"
+ << " for unknown shard idx " << shardIdx
+ << " tabletId " << ev->Get()->Record.GetTabletID());
+ return;
+ }
+
+ TShardInfo& shardInfo = ShardInfos[shardIdx];
+ const auto txId = shardInfo.CurrentTxId;
+
+ if (!Operations.contains(txId)) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvCreateTabletReply"
+ << " for unknown txId: " << txId
+ << ", stardIdx: " << shardIdx
+ << ", tabletId: " << ev->Get()->Record.GetTabletID()
+ << ", at schemeshard: " << TabletID());
+ return;
+ }
+
+ TSubTxId partId = Operations.at(txId)->FindRelatedPartByShardIdx(shardIdx, ctx);
+ if (partId == InvalidSubTxId) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvCreateTabletReply but partId in unknown"
+ << ", for txId: " << txId
+ << ", stardIdx: " << shardIdx
+ << ", tabletId: " << ev->Get()->Record.GetTabletID()
+ << ", at schemeshard: " << TabletID());
+ return;
+ }
+
+ Execute(CreateTxOperationReply(TOperationId(txId, partId), ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvHive::TEvAdoptTabletReply::TPtr &ev, const TActorContext &ctx) {
+ auto shardIdx = MakeLocalId(TLocalShardIdx(ev->Get()->Record.GetOwnerIdx())); // internal id
+
+ if (!ShardInfos.contains(shardIdx)) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvAdoptTabletReply"
+ << " for unknown shard idx " << shardIdx
+ << " tabletId " << ev->Get()->Record.GetTabletID());
+ return;
+ }
+
+ TShardInfo& shardInfo = ShardInfos[shardIdx];
+ const auto txId = shardInfo.CurrentTxId;
+
+ if (!Operations.contains(txId)) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvAdoptTabletReply"
+ << " for unknown txId " << txId
+ << " stardIdx " << shardIdx
+ << " tabletId " << ev->Get()->Record.GetTabletID());
+
+ return;
+ }
+
+ Execute(CreateTxOperationReply(TOperationId(txId, 0), ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvHive::TEvDeleteTabletReply::TPtr &ev, const TActorContext &ctx) {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Free tablet reply"
+ << ", message: " << ev->Get()->Record.ShortDebugString()
+ << ", at schemeshard: " << TabletID());
+
Execute(CreateTxDeleteTabletReply(ev), ctx);
}
-void TSchemeShard::Handle(TEvHive::TEvDeleteOwnerTabletsReply::TPtr &ev, const TActorContext &ctx) {
- auto& record = ev->Get()->Record;
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Free owner tablets reply"
- << ", message: " << record.ShortDebugString()
- << ", at schemeshard: " << TabletID());
-
- const auto txId = TTxId(record.GetTxId());
-
- if (!Operations.contains(txId)) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvDeleteOwnerTabletsReply"
- << " for unknown txId " << txId
- << " ownerID " << record.GetOwner()
- << " form hive " << record.GetOrigin()
- << " at schemeshard " << TabletID());
- return;
- }
-
- Execute(CreateTxOperationReply(TOperationId(txId, 0), ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvPersQueue::TEvDropTabletReply::TPtr &ev, const TActorContext &ctx) {
-
- const auto txId = TTxId(ev->Get()->Record.GetTxId());
- if (!Operations.contains(txId)) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvPersQueue::TEvDropTabletReply"
- << " for unknown txId " << txId
- << ", message: " << ev->Get()->Record.ShortDebugString());
- return;
- }
-
+void TSchemeShard::Handle(TEvHive::TEvDeleteOwnerTabletsReply::TPtr &ev, const TActorContext &ctx) {
+ auto& record = ev->Get()->Record;
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Free owner tablets reply"
+ << ", message: " << record.ShortDebugString()
+ << ", at schemeshard: " << TabletID());
+
+ const auto txId = TTxId(record.GetTxId());
+
+ if (!Operations.contains(txId)) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvDeleteOwnerTabletsReply"
+ << " for unknown txId " << txId
+ << " ownerID " << record.GetOwner()
+ << " form hive " << record.GetOrigin()
+ << " at schemeshard " << TabletID());
+ return;
+ }
+
+ Execute(CreateTxOperationReply(TOperationId(txId, 0), ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvPersQueue::TEvDropTabletReply::TPtr &ev, const TActorContext &ctx) {
+
+ const auto txId = TTxId(ev->Get()->Record.GetTxId());
+ if (!Operations.contains(txId)) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvPersQueue::TEvDropTabletReply"
+ << " for unknown txId " << txId
+ << ", message: " << ev->Get()->Record.ShortDebugString());
+ return;
+ }
+
auto tabletId = TTabletId(ev->Get()->Record.GetTabletId());
TSubTxId partId = Operations.at(txId)->FindRelatedPartByTabletId(tabletId, ctx);
if (partId == InvalidSubTxId) {
@@ -4801,31 +4801,31 @@ void TSchemeShard::Handle(TEvPersQueue::TEvDropTabletReply::TPtr &ev, const TAct
Execute(CreateTxOperationReply(TOperationId(txId, partId), ev), ctx);
}
-void TSchemeShard::Handle(TEvPersQueue::TEvUpdateConfigResponse::TPtr &ev, const TActorContext &ctx) {
- const auto txId = TTxId(ev->Get()->Record.GetTxId());
- if (!Operations.contains(txId)) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvPersQueue::TEvUpdateConfigResponse"
- << " for unknown txId " << txId
- << " message " << ev->Get()->Record.ShortDebugString());
- return;
- }
-
- auto tabletId = TTabletId(ev->Get()->Record.GetOrigin());
- TSubTxId partId = Operations.at(txId)->FindRelatedPartByTabletId(tabletId, ctx);
- if (partId == InvalidSubTxId) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+void TSchemeShard::Handle(TEvPersQueue::TEvUpdateConfigResponse::TPtr &ev, const TActorContext &ctx) {
+ const auto txId = TTxId(ev->Get()->Record.GetTxId());
+ if (!Operations.contains(txId)) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvPersQueue::TEvUpdateConfigResponse"
+ << " for unknown txId " << txId
+ << " message " << ev->Get()->Record.ShortDebugString());
+ return;
+ }
+
+ auto tabletId = TTabletId(ev->Get()->Record.GetOrigin());
+ TSubTxId partId = Operations.at(txId)->FindRelatedPartByTabletId(tabletId, ctx);
+ if (partId == InvalidSubTxId) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Got TEvUpdateConfigResponse but partId is unknown"
- << ", for txId: " << txId
- << ", tabletId: " << tabletId
- << ", at schemeshard: " << TabletID());
- return;
- }
-
- Execute(CreateTxOperationReply(TOperationId(txId, partId), ev), ctx);
+ << ", for txId: " << txId
+ << ", tabletId: " << tabletId
+ << ", at schemeshard: " << TabletID());
+ return;
+ }
+
+ Execute(CreateTxOperationReply(TOperationId(txId, partId), ev), ctx);
}
-void TSchemeShard::Handle(TEvColumnShard::TEvProposeTransactionResult::TPtr &ev, const TActorContext &ctx) {
+void TSchemeShard::Handle(TEvColumnShard::TEvProposeTransactionResult::TPtr &ev, const TActorContext &ctx) {
LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Handle TEvProposeTransactionResult"
<< ", at schemeshard: " << TabletID()
@@ -4854,7 +4854,7 @@ void TSchemeShard::Handle(TEvColumnShard::TEvProposeTransactionResult::TPtr &ev,
Execute(CreateTxOperationReply(TOperationId(txId, partId), ev), ctx);
}
-void TSchemeShard::Handle(TEvColumnShard::TEvNotifyTxCompletionResult::TPtr &ev, const TActorContext &ctx) {
+void TSchemeShard::Handle(TEvColumnShard::TEvNotifyTxCompletionResult::TPtr &ev, const TActorContext &ctx) {
LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Handle TEvNotifyTxCompletionResult"
<< ", at schemeshard: " << TabletID()
@@ -4883,7 +4883,7 @@ void TSchemeShard::Handle(TEvColumnShard::TEvNotifyTxCompletionResult::TPtr &ev,
Execute(CreateTxOperationReply(TOperationId(txId, partId), ev), ctx);
}
-void TSchemeShard::Handle(NSequenceShard::TEvSequenceShard::TEvCreateSequenceResult::TPtr &ev, const TActorContext &ctx) {
+void TSchemeShard::Handle(NSequenceShard::TEvSequenceShard::TEvCreateSequenceResult::TPtr &ev, const TActorContext &ctx) {
LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Handle TEvCreateSequenceResult"
<< ", at schemeshard: " << TabletID()
@@ -4894,7 +4894,7 @@ void TSchemeShard::Handle(NSequenceShard::TEvSequenceShard::TEvCreateSequenceRes
Execute(CreateTxOperationReply(TOperationId(txId, partId), ev), ctx);
}
-void TSchemeShard::Handle(NSequenceShard::TEvSequenceShard::TEvDropSequenceResult::TPtr &ev, const TActorContext &ctx) {
+void TSchemeShard::Handle(NSequenceShard::TEvSequenceShard::TEvDropSequenceResult::TPtr &ev, const TActorContext &ctx) {
LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Handle TEvDropSequenceResult"
<< ", at schemeshard: " << TabletID()
@@ -4905,7 +4905,7 @@ void TSchemeShard::Handle(NSequenceShard::TEvSequenceShard::TEvDropSequenceResul
Execute(CreateTxOperationReply(TOperationId(txId, partId), ev), ctx);
}
-void TSchemeShard::Handle(NSequenceShard::TEvSequenceShard::TEvUpdateSequenceResult::TPtr &ev, const TActorContext &ctx) {
+void TSchemeShard::Handle(NSequenceShard::TEvSequenceShard::TEvUpdateSequenceResult::TPtr &ev, const TActorContext &ctx) {
LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Handle TEvUpdateSequenceResult"
<< ", at schemeshard: " << TabletID()
@@ -4916,7 +4916,7 @@ void TSchemeShard::Handle(NSequenceShard::TEvSequenceShard::TEvUpdateSequenceRes
Execute(CreateTxOperationReply(TOperationId(txId, partId), ev), ctx);
}
-void TSchemeShard::Handle(NSequenceShard::TEvSequenceShard::TEvFreezeSequenceResult::TPtr &ev, const TActorContext &ctx) {
+void TSchemeShard::Handle(NSequenceShard::TEvSequenceShard::TEvFreezeSequenceResult::TPtr &ev, const TActorContext &ctx) {
LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Handle TEvFreezeSequenceResult"
<< ", at schemeshard: " << TabletID()
@@ -4927,7 +4927,7 @@ void TSchemeShard::Handle(NSequenceShard::TEvSequenceShard::TEvFreezeSequenceRes
Execute(CreateTxOperationReply(TOperationId(txId, partId), ev), ctx);
}
-void TSchemeShard::Handle(NSequenceShard::TEvSequenceShard::TEvRestoreSequenceResult::TPtr &ev, const TActorContext &ctx) {
+void TSchemeShard::Handle(NSequenceShard::TEvSequenceShard::TEvRestoreSequenceResult::TPtr &ev, const TActorContext &ctx) {
LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Handle TEvRestoreSequenceResult"
<< ", at schemeshard: " << TabletID()
@@ -4938,7 +4938,7 @@ void TSchemeShard::Handle(NSequenceShard::TEvSequenceShard::TEvRestoreSequenceRe
Execute(CreateTxOperationReply(TOperationId(txId, partId), ev), ctx);
}
-void TSchemeShard::Handle(NSequenceShard::TEvSequenceShard::TEvRedirectSequenceResult::TPtr &ev, const TActorContext &ctx) {
+void TSchemeShard::Handle(NSequenceShard::TEvSequenceShard::TEvRedirectSequenceResult::TPtr &ev, const TActorContext &ctx) {
LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Handle TEvRedirectSequenceResult"
<< ", at schemeshard: " << TabletID()
@@ -4971,73 +4971,73 @@ void TSchemeShard::Handle(NReplication::TEvController::TEvDropReplicationResult:
Execute(CreateTxOperationReply(TOperationId(txId, partId), ev), ctx);
}
-void TSchemeShard::Handle(TEvDataShard::TEvProposeTransactionResult::TPtr &ev, const TActorContext &ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Handle TEvProposeTransactionResult"
- << ", at schemeshard: " << TabletID()
- << ", message: " << ev->Get()->Record.ShortDebugString());
-
- const auto txId = TTxId(ev->Get()->Record.GetTxId());
- if (!Operations.contains(txId)) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvDataShard::TEvProposeTransactionResult for unknown txId, ignore it"
- << ", txId: " << txId
- << ", message: " << ev->Get()->Record.ShortDebugString()
- << ", at schemeshard: " << TabletID());
- return;
- }
-
- auto tabletId = TTabletId(ev->Get()->Record.GetOrigin());
- TSubTxId partId = Operations.at(txId)->FindRelatedPartByTabletId(tabletId, ctx);
- if (partId == InvalidSubTxId) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvProposeTransactionResult but partId in unknown"
- << ", for txId: " << txId
- << ", tabletId: " << tabletId
- << ", at schemeshard: " << TabletID());
- return;
- }
- Execute(CreateTxOperationReply(TOperationId(txId, partId), ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvSubDomain::TEvConfigureStatus::TPtr &ev, const TActorContext &ctx) {
- const auto& record = ev->Get()->Record;
- auto tabletId = TTabletId(record.GetOnTabletId());
-
- TOperationId opId = RouteIncomming(tabletId, ctx);
- if (!opId) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvSubDomain::TEvConfigureStatus,"
- << " no route has found by tabletId " << tabletId
- << " message " << ev->Get()->Record.ShortDebugString());
- return;
- }
- Y_VERIFY(opId.GetTxId());
-
- if (opId.GetSubTxId() == InvalidSubTxId) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+void TSchemeShard::Handle(TEvDataShard::TEvProposeTransactionResult::TPtr &ev, const TActorContext &ctx) {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Handle TEvProposeTransactionResult"
+ << ", at schemeshard: " << TabletID()
+ << ", message: " << ev->Get()->Record.ShortDebugString());
+
+ const auto txId = TTxId(ev->Get()->Record.GetTxId());
+ if (!Operations.contains(txId)) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvDataShard::TEvProposeTransactionResult for unknown txId, ignore it"
+ << ", txId: " << txId
+ << ", message: " << ev->Get()->Record.ShortDebugString()
+ << ", at schemeshard: " << TabletID());
+ return;
+ }
+
+ auto tabletId = TTabletId(ev->Get()->Record.GetOrigin());
+ TSubTxId partId = Operations.at(txId)->FindRelatedPartByTabletId(tabletId, ctx);
+ if (partId == InvalidSubTxId) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvProposeTransactionResult but partId in unknown"
+ << ", for txId: " << txId
+ << ", tabletId: " << tabletId
+ << ", at schemeshard: " << TabletID());
+ return;
+ }
+ Execute(CreateTxOperationReply(TOperationId(txId, partId), ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvSubDomain::TEvConfigureStatus::TPtr &ev, const TActorContext &ctx) {
+ const auto& record = ev->Get()->Record;
+ auto tabletId = TTabletId(record.GetOnTabletId());
+
+ TOperationId opId = RouteIncomming(tabletId, ctx);
+ if (!opId) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvSubDomain::TEvConfigureStatus,"
+ << " no route has found by tabletId " << tabletId
+ << " message " << ev->Get()->Record.ShortDebugString());
+ return;
+ }
+ Y_VERIFY(opId.GetTxId());
+
+ if (opId.GetSubTxId() == InvalidSubTxId) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Got TEvSubDomain::TEvConfigureStatus but partId in unknown"
- << ", for txId: " << opId.GetTxId()
+ << ", for txId: " << opId.GetTxId()
<< ", tabletId: " << tabletId
<< ", at schemeshard: " << TabletID());
return;
}
- Execute(CreateTxOperationReply(opId, ev), ctx);
-}
+ Execute(CreateTxOperationReply(opId, ev), ctx);
+}
-void TSchemeShard::Handle(TEvBlockStore::TEvUpdateVolumeConfigResponse::TPtr& ev, const TActorContext& ctx) {
- const auto txId = TTxId(ev->Get()->Record.GetTxId());
- if (!Operations.contains(txId)) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvBlockStore::TEvUpdateVolumeConfigResponse"
- << " for unknown txId " << txId
- << " tabletId " << ev->Get()->Record.GetOrigin());
- return;
+void TSchemeShard::Handle(TEvBlockStore::TEvUpdateVolumeConfigResponse::TPtr& ev, const TActorContext& ctx) {
+ const auto txId = TTxId(ev->Get()->Record.GetTxId());
+ if (!Operations.contains(txId)) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvBlockStore::TEvUpdateVolumeConfigResponse"
+ << " for unknown txId " << txId
+ << " tabletId " << ev->Get()->Record.GetOrigin());
+ return;
}
- auto tabletId = TTabletId(ev->Get()->Record.GetOrigin());
- auto partId = Operations.at(txId)->FindRelatedPartByTabletId(tabletId, ctx);
+ auto tabletId = TTabletId(ev->Get()->Record.GetOrigin());
+ auto partId = Operations.at(txId)->FindRelatedPartByTabletId(tabletId, ctx);
if (partId == InvalidSubTxId) {
LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Got TEvUpdateVolumeConfigResponse but partId in unknown"
@@ -5050,7 +5050,7 @@ void TSchemeShard::Handle(TEvBlockStore::TEvUpdateVolumeConfigResponse::TPtr& ev
Execute(CreateTxOperationReply(TOperationId(txId, partId), ev), ctx);
}
-void TSchemeShard::Handle(TEvFileStore::TEvUpdateConfigResponse::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvFileStore::TEvUpdateConfigResponse::TPtr& ev, const TActorContext& ctx) {
const auto txId = TTxId(ev->Get()->Record.GetTxId());
if (!Operations.contains(txId)) {
LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
@@ -5074,287 +5074,287 @@ void TSchemeShard::Handle(TEvFileStore::TEvUpdateConfigResponse::TPtr& ev, const
Execute(CreateTxOperationReply(TOperationId(txId, partId), ev), ctx);
}
-void TSchemeShard::Handle(TEvSchemeShard::TEvInitTenantSchemeShardResult::TPtr& ev, const TActorContext& ctx) {
- const auto& record = ev->Get()->Record;
- auto tabletId = TTabletId(record.GetTenantSchemeShard());
-
- TOperationId opId = RouteIncomming(tabletId, ctx);
- if (!opId) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvSchemeShard::TEvInitTenantSchemeShardResult"
- << " no route has found by tabletId " << tabletId
- << " message " << ev->Get()->Record.ShortDebugString());
- return;
- }
- Y_VERIFY(opId.GetTxId());
-
- if (opId.GetSubTxId() == InvalidSubTxId) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvSubDomain::TEvConfigureStatus but partId in unknown"
- << ", for txId: " << opId.GetTxId()
- << ", tabletId: " << tabletId
- << ", at schemeshard: " << TabletID());
- return;
- }
-
- Y_VERIFY(opId.GetSubTxId() == FirstSubTxId);
-
- Execute(CreateTxOperationReply(opId, ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvSchemeShard::TEvPublishTenantAsReadOnlyResult::TPtr& ev, const TActorContext& ctx) {
- const auto& record = ev->Get()->Record;
- auto tabletId = TTabletId(record.GetTenantSchemeShard());
-
- TOperationId opId = RouteIncomming(tabletId, ctx);
- if (!opId) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvSchemeShard::TEvPublishTenantAsReadOnlyResult"
- << " no route has found by tabletId " << tabletId
- << " message " << ev->Get()->Record.ShortDebugString());
- return;
- }
- Y_VERIFY(opId.GetTxId());
-
- if (opId.GetSubTxId() == InvalidSubTxId) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvSchemeShard::TEvPublishTenantAsReadOnlyResult but partId in unknown"
- << ", for txId: " << opId.GetTxId()
- << ", tabletId: " << tabletId
- << ", at schemeshard: " << TabletID());
- return;
- }
-
- Y_VERIFY(opId.GetSubTxId() == FirstSubTxId);
-
- Execute(CreateTxOperationReply(opId, ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvSchemeShard::TEvPublishTenantResult::TPtr& ev, const TActorContext& ctx) {
- const auto& record = ev->Get()->Record;
- auto tabletId = TTabletId(record.GetTenantSchemeShard());
-
- TOperationId opId = RouteIncomming(tabletId, ctx);
- if (!opId) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvSchemeShard::TEvPublishTenantResult"
- << " no route has found by tabletId " << tabletId
- << " message " << ev->Get()->Record.ShortDebugString());
- return;
- }
- Y_VERIFY(opId.GetTxId());
-
- if (opId.GetSubTxId() == InvalidSubTxId) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got TEvSchemeShard::TEvPublishTenantResult but partId in unknown"
- << ", for txId: " << opId.GetTxId()
- << ", tabletId: " << tabletId
- << ", at schemeshard: " << TabletID());
- return;
- }
-
- Y_VERIFY(opId.GetSubTxId() == FirstSubTxId);
-
- Execute(CreateTxOperationReply(opId, ev), ctx);
-}
-
-
-void TSchemeShard::Handle(NKesus::TEvKesus::TEvSetConfigResult::TPtr& ev, const TActorContext& ctx) {
- const auto& record = ev->Get()->Record;
- auto tabletId = TTabletId(record.GetTabletId());
-
-
- TOperationId opId = RouteIncomming(tabletId, ctx);
- if (!opId) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got NKesus::TEvKesus::TEvSetConfigResult"
- << " no route has found by tabletId " << tabletId
- << " message " << ev->Get()->Record.ShortDebugString());
+void TSchemeShard::Handle(TEvSchemeShard::TEvInitTenantSchemeShardResult::TPtr& ev, const TActorContext& ctx) {
+ const auto& record = ev->Get()->Record;
+ auto tabletId = TTabletId(record.GetTenantSchemeShard());
+
+ TOperationId opId = RouteIncomming(tabletId, ctx);
+ if (!opId) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvSchemeShard::TEvInitTenantSchemeShardResult"
+ << " no route has found by tabletId " << tabletId
+ << " message " << ev->Get()->Record.ShortDebugString());
return;
- }
- Y_VERIFY(opId.GetTxId());
+ }
+ Y_VERIFY(opId.GetTxId());
- if (opId.GetSubTxId() == InvalidSubTxId) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ if (opId.GetSubTxId() == InvalidSubTxId) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvSubDomain::TEvConfigureStatus but partId in unknown"
+ << ", for txId: " << opId.GetTxId()
+ << ", tabletId: " << tabletId
+ << ", at schemeshard: " << TabletID());
+ return;
+ }
+
+ Y_VERIFY(opId.GetSubTxId() == FirstSubTxId);
+
+ Execute(CreateTxOperationReply(opId, ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvSchemeShard::TEvPublishTenantAsReadOnlyResult::TPtr& ev, const TActorContext& ctx) {
+ const auto& record = ev->Get()->Record;
+ auto tabletId = TTabletId(record.GetTenantSchemeShard());
+
+ TOperationId opId = RouteIncomming(tabletId, ctx);
+ if (!opId) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvSchemeShard::TEvPublishTenantAsReadOnlyResult"
+ << " no route has found by tabletId " << tabletId
+ << " message " << ev->Get()->Record.ShortDebugString());
+ return;
+ }
+ Y_VERIFY(opId.GetTxId());
+
+ if (opId.GetSubTxId() == InvalidSubTxId) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvSchemeShard::TEvPublishTenantAsReadOnlyResult but partId in unknown"
+ << ", for txId: " << opId.GetTxId()
+ << ", tabletId: " << tabletId
+ << ", at schemeshard: " << TabletID());
+ return;
+ }
+
+ Y_VERIFY(opId.GetSubTxId() == FirstSubTxId);
+
+ Execute(CreateTxOperationReply(opId, ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvSchemeShard::TEvPublishTenantResult::TPtr& ev, const TActorContext& ctx) {
+ const auto& record = ev->Get()->Record;
+ auto tabletId = TTabletId(record.GetTenantSchemeShard());
+
+ TOperationId opId = RouteIncomming(tabletId, ctx);
+ if (!opId) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvSchemeShard::TEvPublishTenantResult"
+ << " no route has found by tabletId " << tabletId
+ << " message " << ev->Get()->Record.ShortDebugString());
+ return;
+ }
+ Y_VERIFY(opId.GetTxId());
+
+ if (opId.GetSubTxId() == InvalidSubTxId) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got TEvSchemeShard::TEvPublishTenantResult but partId in unknown"
+ << ", for txId: " << opId.GetTxId()
+ << ", tabletId: " << tabletId
+ << ", at schemeshard: " << TabletID());
+ return;
+ }
+
+ Y_VERIFY(opId.GetSubTxId() == FirstSubTxId);
+
+ Execute(CreateTxOperationReply(opId, ev), ctx);
+}
+
+
+void TSchemeShard::Handle(NKesus::TEvKesus::TEvSetConfigResult::TPtr& ev, const TActorContext& ctx) {
+ const auto& record = ev->Get()->Record;
+ auto tabletId = TTabletId(record.GetTabletId());
+
+
+ TOperationId opId = RouteIncomming(tabletId, ctx);
+ if (!opId) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got NKesus::TEvKesus::TEvSetConfigResult"
+ << " no route has found by tabletId " << tabletId
+ << " message " << ev->Get()->Record.ShortDebugString());
+ return;
+ }
+ Y_VERIFY(opId.GetTxId());
+
+ if (opId.GetSubTxId() == InvalidSubTxId) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Got NKesus::TEvKesus::TEvSetConfigResult but partId in unknown"
- << ", for txId: " << opId.GetTxId()
+ << ", for txId: " << opId.GetTxId()
<< ", tabletId: " << tabletId
<< ", at schemeshard: " << TabletID());
return;
}
- Execute(CreateTxOperationReply(opId, ev), ctx);
-}
-
-TOperationId TSchemeShard::RouteIncomming(TTabletId tabletId, const TActorContext& ctx) {
- auto transactionIds = PipeTracker.FindTx(ui64(tabletId));
-
- Y_VERIFY(transactionIds.size() <= 1);
-
- if (transactionIds.empty()) {
- return InvalidOperationId;
- }
-
- auto txId = TTxId(*transactionIds.begin());
- Y_VERIFY(txId);
-
- if (!Operations.contains(txId)) {
- return InvalidOperationId;
- }
-
- TOperation::TPtr operation = Operations.at(txId);
- auto subTxId = operation->FindRelatedPartByTabletId(tabletId, ctx);
- return TOperationId(txId, subTxId);
-}
-
-void TSchemeShard::RestartPipeTx(TTabletId tabletId, const TActorContext& ctx) {
- for (auto item : PipeTracker.FindTx(ui64(tabletId))) {
- auto txId = TTxId(item);
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Transaction " << txId
- << " reset current state at schemeshard " << TabletID()
- << " because pipe to tablet " << tabletId
- << " disconnected");
-
- if (!Operations.contains(txId)) {
- continue;
- }
-
- TOperation::TPtr operation = Operations.at(txId);
- TSubTxId subTxId = operation->FindRelatedPartByTabletId(tabletId, ctx);
-
- for (auto related: PipeTracker.FindTablets(item)) {
- ui64 pipeTrackerCookie = related.first;
- auto relatedTabletId = TTabletId(related.second);
-
- if (tabletId != relatedTabletId) {
- continue;
- }
-
- if (!operation->PipeBindedMessages.contains(tabletId)) {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Pipe attached message is not found, ignore event"
- << ", opId:" << TOperationId(txId, pipeTrackerCookie)
- << ", tableId: " << tabletId
- << ", at schemeshardId: " << TabletID());
- continue;
- }
-
- for (auto& items: operation->PipeBindedMessages.at(tabletId)) {
- TPipeMessageId msgCookie = items.first;
- TOperation::TPreSerialisedMessage& preSerialisedMessages = items.second;
-
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Pipe attached message is found and resent into the new pipe"
- << ", opId:" << TOperationId(txId, subTxId)
- << ", dst tableId: " << tabletId
- << ", msg type: " << preSerialisedMessages.first
- << ", msg cookie: " << msgCookie
- << ", at schemeshardId: " << TabletID());
-
- PipeClientCache->Send(ctx, ui64(tabletId), preSerialisedMessages.first, preSerialisedMessages.second, msgCookie.second);
- }
+ Execute(CreateTxOperationReply(opId, ev), ctx);
+}
+
+TOperationId TSchemeShard::RouteIncomming(TTabletId tabletId, const TActorContext& ctx) {
+ auto transactionIds = PipeTracker.FindTx(ui64(tabletId));
+
+ Y_VERIFY(transactionIds.size() <= 1);
+
+ if (transactionIds.empty()) {
+ return InvalidOperationId;
+ }
+
+ auto txId = TTxId(*transactionIds.begin());
+ Y_VERIFY(txId);
+
+ if (!Operations.contains(txId)) {
+ return InvalidOperationId;
+ }
+
+ TOperation::TPtr operation = Operations.at(txId);
+ auto subTxId = operation->FindRelatedPartByTabletId(tabletId, ctx);
+ return TOperationId(txId, subTxId);
+}
+
+void TSchemeShard::RestartPipeTx(TTabletId tabletId, const TActorContext& ctx) {
+ for (auto item : PipeTracker.FindTx(ui64(tabletId))) {
+ auto txId = TTxId(item);
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Transaction " << txId
+ << " reset current state at schemeshard " << TabletID()
+ << " because pipe to tablet " << tabletId
+ << " disconnected");
+
+ if (!Operations.contains(txId)) {
+ continue;
+ }
+
+ TOperation::TPtr operation = Operations.at(txId);
+ TSubTxId subTxId = operation->FindRelatedPartByTabletId(tabletId, ctx);
+
+ for (auto related: PipeTracker.FindTablets(item)) {
+ ui64 pipeTrackerCookie = related.first;
+ auto relatedTabletId = TTabletId(related.second);
+
+ if (tabletId != relatedTabletId) {
+ continue;
+ }
+
+ if (!operation->PipeBindedMessages.contains(tabletId)) {
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Pipe attached message is not found, ignore event"
+ << ", opId:" << TOperationId(txId, pipeTrackerCookie)
+ << ", tableId: " << tabletId
+ << ", at schemeshardId: " << TabletID());
+ continue;
+ }
+
+ for (auto& items: operation->PipeBindedMessages.at(tabletId)) {
+ TPipeMessageId msgCookie = items.first;
+ TOperation::TPreSerialisedMessage& preSerialisedMessages = items.second;
+
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Pipe attached message is found and resent into the new pipe"
+ << ", opId:" << TOperationId(txId, subTxId)
+ << ", dst tableId: " << tabletId
+ << ", msg type: " << preSerialisedMessages.first
+ << ", msg cookie: " << msgCookie
+ << ", at schemeshardId: " << TabletID());
+
+ PipeClientCache->Send(ctx, ui64(tabletId), preSerialisedMessages.first, preSerialisedMessages.second, msgCookie.second);
+ }
}
}
}
-void TSchemeShard::Handle(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx) {
+void TSchemeShard::Handle(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx) {
Y_UNUSED(ev);
- BreakTabletAndRestart(ctx);
+ BreakTabletAndRestart(ctx);
}
-void TSchemeShard::Handle(NMon::TEvRemoteHttpInfo::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(NMon::TEvRemoteHttpInfo::TPtr& ev, const TActorContext& ctx) {
RenderHtmlPage(ev, ctx);
}
-void TSchemeShard::Handle(TEvSchemeShard::TEvCancelTx::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvSchemeShard::TEvCancelTx::TPtr& ev, const TActorContext& ctx) {
if (IsReadOnlyMode) {
- LOG_ERROR_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Ignoring messgage TEvSchemeShard::TEvCancelTx" <<
- " reason# schemeshard in readonly" <<
- " schemeshard# " << TabletID());
+ LOG_ERROR_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Ignoring messgage TEvSchemeShard::TEvCancelTx" <<
+ " reason# schemeshard in readonly" <<
+ " schemeshard# " << TabletID());
+ return;
+ }
+
+ Execute(CreateTxOperationPropose(ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvSchemeShard::TEvPublishTenantAsReadOnly::TPtr &ev, const TActorContext &ctx) {
+ Execute(CreateTxPublishTenantAsReadOnly(ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvSchemeShard::TEvPublishTenant::TPtr &ev, const TActorContext &ctx) {
+ Execute(CreateTxPublishTenant(ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvSchemeShard::TEvMigrateSchemeShard::TPtr &ev, const TActorContext &ctx) {
+ if (InitState != TTenantInitState::Inprogress) {
+ LOG_ERROR_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Ignoring messgage TEvSchemeShard::TEvMigrateSchemeShard:" <<
+ " reason# schemeshard not in TTenantInitState::Inprogress state" <<
+ " state is " << (ui64) InitState <<
+ " schemeshard# " << TabletID());
+ return;
+ }
+ Execute(CreateTxMigrate(ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvSchemeShard::TEvMigrateSchemeShardResult::TPtr &ev, const TActorContext &ctx) {
+ const auto& record = ev->Get()->Record;
+ auto tabletId = TTabletId(record.GetTenantSchemeShard());
+
+ auto opId = RouteIncomming(tabletId, ctx);
+ if (!opId) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "unable to resolve operation by tabletID: " << tabletId <<
+ " ignore TEvSubDomain::TEvMigrateSchemeShardResult " <<
+ ", at schemeshard: " << TabletID());
return;
}
- Execute(CreateTxOperationPropose(ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvSchemeShard::TEvPublishTenantAsReadOnly::TPtr &ev, const TActorContext &ctx) {
- Execute(CreateTxPublishTenantAsReadOnly(ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvSchemeShard::TEvPublishTenant::TPtr &ev, const TActorContext &ctx) {
- Execute(CreateTxPublishTenant(ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvSchemeShard::TEvMigrateSchemeShard::TPtr &ev, const TActorContext &ctx) {
- if (InitState != TTenantInitState::Inprogress) {
- LOG_ERROR_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Ignoring messgage TEvSchemeShard::TEvMigrateSchemeShard:" <<
- " reason# schemeshard not in TTenantInitState::Inprogress state" <<
- " state is " << (ui64) InitState <<
- " schemeshard# " << TabletID());
- return;
- }
- Execute(CreateTxMigrate(ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvSchemeShard::TEvMigrateSchemeShardResult::TPtr &ev, const TActorContext &ctx) {
- const auto& record = ev->Get()->Record;
- auto tabletId = TTabletId(record.GetTenantSchemeShard());
-
- auto opId = RouteIncomming(tabletId, ctx);
- if (!opId) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "unable to resolve operation by tabletID: " << tabletId <<
- " ignore TEvSubDomain::TEvMigrateSchemeShardResult " <<
- ", at schemeshard: " << TabletID());
- return;
- }
-
- Y_VERIFY(opId.GetSubTxId() == FirstSubTxId);
-
- Execute(CreateTxOperationReply(opId, ev), ctx);
-}
-
-void TSchemeShard::Handle(TEvDataShard::TEvMigrateSchemeShardResponse::TPtr &ev, const TActorContext &ctx) {
- const auto& record = ev->Get()->Record;
- auto tabletId = TTabletId(record.GetTabletId());
-
- auto opId = RouteIncomming(tabletId, ctx);
- if (!opId) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "unable to resolve operation by tabletID: " << tabletId <<
- " ignore TEvDataShard::TEvMigrateSchemeShardResponse " <<
- ", at schemeshard: " << TabletID());
- return;
- }
-
- Y_VERIFY(opId.GetSubTxId() == FirstSubTxId);
-
- Execute(CreateTxOperationReply(opId, ev), ctx);
-}
-
-void TSchemeShard::ScheduleConditionalEraseRun(const TActorContext& ctx) {
+ Y_VERIFY(opId.GetSubTxId() == FirstSubTxId);
+
+ Execute(CreateTxOperationReply(opId, ev), ctx);
+}
+
+void TSchemeShard::Handle(TEvDataShard::TEvMigrateSchemeShardResponse::TPtr &ev, const TActorContext &ctx) {
+ const auto& record = ev->Get()->Record;
+ auto tabletId = TTabletId(record.GetTabletId());
+
+ auto opId = RouteIncomming(tabletId, ctx);
+ if (!opId) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "unable to resolve operation by tabletID: " << tabletId <<
+ " ignore TEvDataShard::TEvMigrateSchemeShardResponse " <<
+ ", at schemeshard: " << TabletID());
+ return;
+ }
+
+ Y_VERIFY(opId.GetSubTxId() == FirstSubTxId);
+
+ Execute(CreateTxOperationReply(opId, ev), ctx);
+}
+
+void TSchemeShard::ScheduleConditionalEraseRun(const TActorContext& ctx) {
ctx.Schedule(TDuration::Minutes(1), new TEvPrivate::TEvRunConditionalErase());
}
-void TSchemeShard::Handle(TEvPrivate::TEvRunConditionalErase::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvPrivate::TEvRunConditionalErase::TPtr& ev, const TActorContext& ctx) {
LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD, "Handle: TEvRunConditionalErase"
<< ", at schemeshard: " << TabletID());
Execute(CreateTxRunConditionalErase(ev), ctx);
}
-void TSchemeShard::ScheduleServerlessStorageBilling(const TActorContext &ctx) {
+void TSchemeShard::ScheduleServerlessStorageBilling(const TActorContext &ctx) {
ctx.Send(SelfId(), new TEvPrivate::TEvServerlessStorageBilling());
-}
-
-void TSchemeShard::Handle(TEvPrivate::TEvServerlessStorageBilling::TPtr &, const TActorContext &ctx) {
- Execute(CreateTxServerlessStorageBilling(), ctx);
-}
-
-void TSchemeShard::Handle(TEvDataShard::TEvConditionalEraseRowsResponse::TPtr& ev, const TActorContext& ctx) {
+}
+
+void TSchemeShard::Handle(TEvPrivate::TEvServerlessStorageBilling::TPtr &, const TActorContext &ctx) {
+ Execute(CreateTxServerlessStorageBilling(), ctx);
+}
+
+void TSchemeShard::Handle(TEvDataShard::TEvConditionalEraseRowsResponse::TPtr& ev, const TActorContext& ctx) {
const auto& record = ev->Get()->Record;
const TTabletId tabletId(record.GetTabletID());
const TShardIdx shardIdx = GetShardIdx(tabletId);
@@ -5376,57 +5376,57 @@ void TSchemeShard::Handle(TEvDataShard::TEvConditionalEraseRowsResponse::TPtr& e
Execute(CreateTxScheduleConditionalErase(ev), ctx);
}
-void TSchemeShard::Handle(TEvTxAllocatorClient::TEvAllocateResult::TPtr& ev, const TActorContext& ctx) {
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Handle: TEvAllocateResult"
- << ": Cookie# " << ev->Cookie
- << ", at schemeshard: " << TabletID());
-
- const ui64 id = ev->Cookie;
- if (0 == id) {
- for (auto txId: ev->Get()->TxIds) {
- CachedTxIds.push_back(TTxId(txId));
- }
- return;
- } else if (Exports.contains(id)) {
+void TSchemeShard::Handle(TEvTxAllocatorClient::TEvAllocateResult::TPtr& ev, const TActorContext& ctx) {
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Handle: TEvAllocateResult"
+ << ": Cookie# " << ev->Cookie
+ << ", at schemeshard: " << TabletID());
+
+ const ui64 id = ev->Cookie;
+ if (0 == id) {
+ for (auto txId: ev->Get()->TxIds) {
+ CachedTxIds.push_back(TTxId(txId));
+ }
+ return;
+ } else if (Exports.contains(id)) {
return Execute(CreateTxProgressExport(ev), ctx);
} else if (Imports.contains(id)) {
return Execute(CreateTxProgressImport(ev), ctx);
- } else if (IndexBuilds.contains(TIndexBuildId(id))) {
- return Execute(CreateTxReply(ev), ctx);
- }
-
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "no able to determine destination for message TEvAllocateResult: "
- << " Cookie: " << id
- << ", at schemeshard: " << TabletID());
-}
-
-void TSchemeShard::Handle(TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& ev, const TActorContext& ctx) {
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Handle: TEvModifySchemeTransactionResult"
- << ": txId# " << ev->Get()->Record.GetTxId()
- << ", status# " << ev->Get()->Record.GetStatus());
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Message:\n" << ev->Get()->Record.ShortDebugString());
-
- const auto txId = TTxId(ev->Get()->Record.GetTxId());
-
- if (TxIdToExport.contains(txId)) {
+ } else if (IndexBuilds.contains(TIndexBuildId(id))) {
+ return Execute(CreateTxReply(ev), ctx);
+ }
+
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "no able to determine destination for message TEvAllocateResult: "
+ << " Cookie: " << id
+ << ", at schemeshard: " << TabletID());
+}
+
+void TSchemeShard::Handle(TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& ev, const TActorContext& ctx) {
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Handle: TEvModifySchemeTransactionResult"
+ << ": txId# " << ev->Get()->Record.GetTxId()
+ << ", status# " << ev->Get()->Record.GetStatus());
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Message:\n" << ev->Get()->Record.ShortDebugString());
+
+ const auto txId = TTxId(ev->Get()->Record.GetTxId());
+
+ if (TxIdToExport.contains(txId)) {
return Execute(CreateTxProgressExport(ev), ctx);
} else if (TxIdToImport.contains(txId)) {
return Execute(CreateTxProgressImport(ev), ctx);
- } else if (TxIdToIndexBuilds.contains(txId)) {
- return Execute(CreateTxReply(ev), ctx);
- }
-
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "no able to determine destination for message TEvModifySchemeTransactionResult: "
- << " txId: " << txId
- << ", at schemeshard: " << TabletID());
-}
-
-void TSchemeShard::Handle(TEvIndexBuilder::TEvCreateResponse::TPtr& ev, const TActorContext& ctx) {
+ } else if (TxIdToIndexBuilds.contains(txId)) {
+ return Execute(CreateTxReply(ev), ctx);
+ }
+
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "no able to determine destination for message TEvModifySchemeTransactionResult: "
+ << " txId: " << txId
+ << ", at schemeshard: " << TabletID());
+}
+
+void TSchemeShard::Handle(TEvIndexBuilder::TEvCreateResponse::TPtr& ev, const TActorContext& ctx) {
LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Handle: TEvIndexBuilder::TEvCreateResponse"
<< ": txId# " << ev->Get()->Record.GetTxId()
@@ -5446,41 +5446,41 @@ void TSchemeShard::Handle(TEvIndexBuilder::TEvCreateResponse::TPtr& ev, const TA
<< ", at schemeshard: " << TabletID());
}
-void TSchemeShard::Handle(TEvSchemeShard::TEvNotifyTxCompletionRegistered::TPtr&, const TActorContext&) {
+void TSchemeShard::Handle(TEvSchemeShard::TEvNotifyTxCompletionRegistered::TPtr&, const TActorContext&) {
// just ignore
}
-void TSchemeShard::Handle(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev, const TActorContext& ctx) {
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Handle: TEvNotifyTxCompletionResult"
- << ": txId# " << ev->Get()->Record.GetTxId());
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Message:\n" << ev->Get()->Record.ShortDebugString());
-
- const auto txId = TTxId(ev->Get()->Record.GetTxId());
-
- if (TxIdToExport.contains(txId)) {
+void TSchemeShard::Handle(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev, const TActorContext& ctx) {
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Handle: TEvNotifyTxCompletionResult"
+ << ": txId# " << ev->Get()->Record.GetTxId());
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Message:\n" << ev->Get()->Record.ShortDebugString());
+
+ const auto txId = TTxId(ev->Get()->Record.GetTxId());
+
+ if (TxIdToExport.contains(txId)) {
return Execute(CreateTxProgressExport(ev), ctx);
} else if (TxIdToImport.contains(txId)) {
return Execute(CreateTxProgressImport(ev), ctx);
- } else if (TxIdToIndexBuilds.contains(txId)) {
- return Execute(CreateTxReply(ev), ctx);
- }
-
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "no able to determine destination for message TEvNotifyTxCompletionResult: "
- << " txId: " << txId
- << ", at schemeshard: " << TabletID());
-}
-
-void TSchemeShard::Handle(TEvSchemeShard::TEvCancelTxResult::TPtr& ev, const TActorContext& ctx) {
+ } else if (TxIdToIndexBuilds.contains(txId)) {
+ return Execute(CreateTxReply(ev), ctx);
+ }
+
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "no able to determine destination for message TEvNotifyTxCompletionResult: "
+ << " txId: " << txId
+ << ", at schemeshard: " << TabletID());
+}
+
+void TSchemeShard::Handle(TEvSchemeShard::TEvCancelTxResult::TPtr& ev, const TActorContext& ctx) {
LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Handle: TEvCancelTxResult"
<< ": Cookie: " << ev->Cookie
<< ", at schemeshard: " << TabletID());
LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Message:\n" << ev->Get()->Record.ShortDebugString());
-
+
const ui64 id = ev->Cookie;
if (Exports.contains(id)) {
return Execute(CreateTxCancelExportAck(ev), ctx);
@@ -5494,7 +5494,7 @@ void TSchemeShard::Handle(TEvSchemeShard::TEvCancelTxResult::TPtr& ev, const TAc
<< ", at schemeshard: " << TabletID());
}
-void TSchemeShard::Handle(TEvIndexBuilder::TEvCancelResponse::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvIndexBuilder::TEvCancelResponse::TPtr& ev, const TActorContext& ctx) {
LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Handle: TEvIndexBuilder::TEvCancelResponse"
<< ": Cookie: " << ev->Cookie
@@ -5513,92 +5513,92 @@ void TSchemeShard::Handle(TEvIndexBuilder::TEvCancelResponse::TPtr& ev, const TA
<< ", at schemeshard: " << TabletID());
}
-void TSchemeShard::FillSeqNo(NKikimrTxDataShard::TFlatSchemeTransaction& tx, TMessageSeqNo seqNo) {
+void TSchemeShard::FillSeqNo(NKikimrTxDataShard::TFlatSchemeTransaction& tx, TMessageSeqNo seqNo) {
tx.MutableSeqNo()->SetGeneration(seqNo.Generation);
tx.MutableSeqNo()->SetRound(seqNo.Round);
}
-void TSchemeShard::FillSeqNo(NKikimrTxColumnShard::TSchemaTxBody& tx, TMessageSeqNo seqNo) {
+void TSchemeShard::FillSeqNo(NKikimrTxColumnShard::TSchemaTxBody& tx, TMessageSeqNo seqNo) {
tx.MutableSeqNo()->SetGeneration(seqNo.Generation);
tx.MutableSeqNo()->SetRound(seqNo.Round);
}
-TString TSchemeShard::FillAlterTableTxBody(TPathId pathId, TShardIdx shardIdx, TMessageSeqNo seqNo) const {
- Y_VERIFY_S(Tables.contains(pathId), "Unknown table " << pathId);
- Y_VERIFY_S(PathsById.contains(pathId), "Unknown path " << pathId);
-
- TPathElement::TPtr path = PathsById.at(pathId);
+TString TSchemeShard::FillAlterTableTxBody(TPathId pathId, TShardIdx shardIdx, TMessageSeqNo seqNo) const {
+ Y_VERIFY_S(Tables.contains(pathId), "Unknown table " << pathId);
+ Y_VERIFY_S(PathsById.contains(pathId), "Unknown path " << pathId);
+
+ TPathElement::TPtr path = PathsById.at(pathId);
TTableInfo::TPtr tableInfo = Tables.at(pathId);
TTableInfo::TAlterDataPtr alterData = tableInfo->AlterData;
-
- Y_VERIFY_S(alterData, "No alter data for table " << pathId);
-
- NKikimrTxDataShard::TFlatSchemeTransaction tx;
- FillSeqNo(tx, seqNo);
- auto proto = tx.MutableAlterTable();
+
+ Y_VERIFY_S(alterData, "No alter data for table " << pathId);
+
+ NKikimrTxDataShard::TFlatSchemeTransaction tx;
+ FillSeqNo(tx, seqNo);
+ auto proto = tx.MutableAlterTable();
FillTableSchemaVersion(alterData->AlterVersion, proto);
- proto->SetName(path->Name);
-
- proto->SetId_Deprecated(pathId.LocalPathId);
+ proto->SetName(path->Name);
+
+ proto->SetId_Deprecated(pathId.LocalPathId);
PathIdFromPathId(pathId, proto->MutablePathId());
-
- for (const auto& col : alterData->Columns) {
- const TTableInfo::TColumn& colInfo = col.second;
- if (colInfo.IsDropped()) {
- auto descr = proto->AddDropColumns();
- descr->SetName(colInfo.Name);
- descr->SetId(colInfo.Id);
- descr->SetTypeId(colInfo.PType);
- } else {
- auto descr = proto->AddColumns();
- descr->SetName(colInfo.Name);
- descr->SetId(colInfo.Id);
- descr->SetTypeId(colInfo.PType);
- descr->SetFamily(colInfo.Family);
- }
- }
-
- for (ui32 keyId : alterData->KeyColumnIds) {
- proto->AddKeyColumnIds(keyId);
- }
-
- proto->MutablePartitionConfig()->CopyFrom(alterData->PartitionConfigCompatible());
-
+
+ for (const auto& col : alterData->Columns) {
+ const TTableInfo::TColumn& colInfo = col.second;
+ if (colInfo.IsDropped()) {
+ auto descr = proto->AddDropColumns();
+ descr->SetName(colInfo.Name);
+ descr->SetId(colInfo.Id);
+ descr->SetTypeId(colInfo.PType);
+ } else {
+ auto descr = proto->AddColumns();
+ descr->SetName(colInfo.Name);
+ descr->SetId(colInfo.Id);
+ descr->SetTypeId(colInfo.PType);
+ descr->SetFamily(colInfo.Family);
+ }
+ }
+
+ for (ui32 keyId : alterData->KeyColumnIds) {
+ proto->AddKeyColumnIds(keyId);
+ }
+
+ proto->MutablePartitionConfig()->CopyFrom(alterData->PartitionConfigCompatible());
+
if (auto* patch = tableInfo->PerShardPartitionConfig.FindPtr(shardIdx)) {
ApplyPartitionConfigStoragePatch(
*proto->MutablePartitionConfig(),
*patch);
}
- TString txBody;
+ TString txBody;
Y_PROTOBUF_SUPPRESS_NODISCARD tx.SerializeToString(&txBody);
- return txBody;
-}
-
-bool TSchemeShard::FillSplitPartitioning(TVector<TString>& rangeEnds, const TConstArrayRef<NScheme::TTypeId>& keyColTypes,
- const::google::protobuf::RepeatedPtrField<NKikimrSchemeOp::TSplitBoundary> &boundaries,
- TString& errStr) {
- for (int i = 0; i < boundaries.size(); ++i) {
- // Convert split boundary to serialized range end
- auto& boundary = boundaries.Get(i);
- TVector<TCell> rangeEnd;
- TSerializedCellVec prefix;
- if (boundary.HasSerializedKeyPrefix()) {
- prefix.Parse(boundary.GetSerializedKeyPrefix());
- rangeEnd = TVector<TCell>(prefix.GetCells().begin(), prefix.GetCells().end());
- } else if (!NMiniKQL::CellsFromTuple(nullptr, boundary.GetKeyPrefix(), keyColTypes, false, rangeEnd, errStr)) {
- errStr = Sprintf("Error at split boundary %d: %s", i, errStr.data());
- return false;
- }
- rangeEnd.resize(keyColTypes.size()); // Extend with NULLs
- rangeEnds.push_back(TSerializedCellVec::Serialize(rangeEnd));
- }
- return true;
-}
-
-void TSchemeShard::ApplyPartitionConfigStoragePatch(
- NKikimrSchemeOp::TPartitionConfig& config,
- const NKikimrSchemeOp::TPartitionConfig& patch) const
+ return txBody;
+}
+
+bool TSchemeShard::FillSplitPartitioning(TVector<TString>& rangeEnds, const TConstArrayRef<NScheme::TTypeId>& keyColTypes,
+ const::google::protobuf::RepeatedPtrField<NKikimrSchemeOp::TSplitBoundary> &boundaries,
+ TString& errStr) {
+ for (int i = 0; i < boundaries.size(); ++i) {
+ // Convert split boundary to serialized range end
+ auto& boundary = boundaries.Get(i);
+ TVector<TCell> rangeEnd;
+ TSerializedCellVec prefix;
+ if (boundary.HasSerializedKeyPrefix()) {
+ prefix.Parse(boundary.GetSerializedKeyPrefix());
+ rangeEnd = TVector<TCell>(prefix.GetCells().begin(), prefix.GetCells().end());
+ } else if (!NMiniKQL::CellsFromTuple(nullptr, boundary.GetKeyPrefix(), keyColTypes, false, rangeEnd, errStr)) {
+ errStr = Sprintf("Error at split boundary %d: %s", i, errStr.data());
+ return false;
+ }
+ rangeEnd.resize(keyColTypes.size()); // Extend with NULLs
+ rangeEnds.push_back(TSerializedCellVec::Serialize(rangeEnd));
+ }
+ return true;
+}
+
+void TSchemeShard::ApplyPartitionConfigStoragePatch(
+ NKikimrSchemeOp::TPartitionConfig& config,
+ const NKikimrSchemeOp::TPartitionConfig& patch) const
{
THashMap<ui32, ui32> familyRooms;
for (const auto& family : patch.GetColumnFamilies()) {
@@ -5624,26 +5624,26 @@ void TSchemeShard::ApplyPartitionConfigStoragePatch(
}
// Fills CreateTable transaction for datashard with the specified range
-void TSchemeShard::FillTableDescriptionForShardIdx(
- TPathId tableId, TShardIdx shardIdx, NKikimrSchemeOp::TTableDescription* tableDescr,
+void TSchemeShard::FillTableDescriptionForShardIdx(
+ TPathId tableId, TShardIdx shardIdx, NKikimrSchemeOp::TTableDescription* tableDescr,
TString rangeBegin, TString rangeEnd,
bool rangeBeginInclusive, bool rangeEndInclusive, bool newTable)
{
- Y_VERIFY_S(Tables.contains(tableId), "Unknown table id " << tableId);
- const TTableInfo::TPtr tinfo = Tables.at(tableId);
- TPathElement::TPtr pinfo = *PathsById.FindPtr(tableId);
-
- TVector<ui32> keyColumnIds = tinfo->FillDescription(pinfo);
+ Y_VERIFY_S(Tables.contains(tableId), "Unknown table id " << tableId);
+ const TTableInfo::TPtr tinfo = Tables.at(tableId);
+ TPathElement::TPtr pinfo = *PathsById.FindPtr(tableId);
+
+ TVector<ui32> keyColumnIds = tinfo->FillDescription(pinfo);
if (!tinfo->TableDescription.HasPath()) {
tinfo->TableDescription.SetPath(PathToString(pinfo));
}
- tableDescr->CopyFrom(tinfo->TableDescription);
-
+ tableDescr->CopyFrom(tinfo->TableDescription);
+
if (rangeBegin.empty()) {
// First partition starts with <NULL, NULL, ..., NULL> key
- TVector<TCell> nullKey(keyColumnIds.size());
- rangeBegin = TSerializedCellVec::Serialize(nullKey);
- }
+ TVector<TCell> nullKey(keyColumnIds.size());
+ rangeBegin = TSerializedCellVec::Serialize(nullKey);
+ }
tableDescr->SetPartitionRangeBegin(std::move(rangeBegin));
tableDescr->SetPartitionRangeEnd(std::move(rangeEnd));
@@ -5674,14 +5674,14 @@ void TSchemeShard::FillTableDescriptionForShardIdx(
}
switch (childPath->PathType) {
- case NKikimrSchemeOp::EPathTypeTableIndex: {
+ case NKikimrSchemeOp::EPathTypeTableIndex: {
Y_VERIFY(Indexes.contains(childPathId));
auto info = Indexes.at(childPathId);
DescribeTableIndex(childPathId, childName, newTable ? info->AlterData : info, *tableDescr->MutableTableIndexes()->Add());
break;
}
- case NKikimrSchemeOp::EPathTypeCdcStream: {
+ case NKikimrSchemeOp::EPathTypeCdcStream: {
Y_VERIFY_S(CdcStreams.contains(childPathId), "Cdc stream not found"
<< ": pathId# " << childPathId
<< ", name# " << childName);
@@ -5690,7 +5690,7 @@ void TSchemeShard::FillTableDescriptionForShardIdx(
break;
}
- case NKikimrSchemeOp::EPathTypeSequence: {
+ case NKikimrSchemeOp::EPathTypeSequence: {
Y_VERIFY_S(Sequences.contains(childPathId), "Sequence not found"
<< ": path#d# " << childPathId
<< ", name# " << childName);
@@ -5710,10 +5710,10 @@ void TSchemeShard::FillTableDescriptionForShardIdx(
}
// Fills CreateTable transaction that is sent to datashards
-void TSchemeShard::FillTableDescription(TPathId tableId, ui32 partitionIdx, ui64 schemaVersion,
- NKikimrSchemeOp::TTableDescription* tableDescr)
+void TSchemeShard::FillTableDescription(TPathId tableId, ui32 partitionIdx, ui64 schemaVersion,
+ NKikimrSchemeOp::TTableDescription* tableDescr)
{
- Y_VERIFY_S(Tables.contains(tableId), "Unknown table id " << tableId);
+ Y_VERIFY_S(Tables.contains(tableId), "Unknown table id " << tableId);
const TTableInfo::TPtr tinfo = Tables.at(tableId);
TString rangeBegin = (partitionIdx != 0)
@@ -5721,7 +5721,7 @@ void TSchemeShard::FillTableDescription(TPathId tableId, ui32 partitionIdx, ui64
: TString();
TString rangeEnd = tinfo->GetPartitions()[partitionIdx].EndOfRange;
- // For uniform partitioning we include range start and exclude range end
+ // For uniform partitioning we include range start and exclude range end
FillTableDescriptionForShardIdx(
tableId,
tinfo->GetPartitions()[partitionIdx].ShardIdx,
@@ -5730,41 +5730,41 @@ void TSchemeShard::FillTableDescription(TPathId tableId, ui32 partitionIdx, ui64
std::move(rangeEnd),
true /* rangeBeginInclusive */, false /* rangeEndInclusive */, true /* newTable */);
FillTableSchemaVersion(schemaVersion, tableDescr);
-}
-
-bool TSchemeShard::FillUniformPartitioning(TVector<TString>& rangeEnds, ui32 keySize, NScheme::TTypeId firstKeyColType, ui32 partitionCount, const NScheme::TTypeRegistry* typeRegistry, TString& errStr) {
- if (partitionCount > 1) {
- // RangeEnd key will have first cell with non-NULL value and rest of the cells with NULLs
- TVector<TCell> rangeEnd(keySize);
- ui64 maxVal = 0;
- ui32 valSz = 0;
-
- // Check that first key column has integer type
- switch(firstKeyColType) {
- case NScheme::NTypeIds::Uint32:
+}
+
+bool TSchemeShard::FillUniformPartitioning(TVector<TString>& rangeEnds, ui32 keySize, NScheme::TTypeId firstKeyColType, ui32 partitionCount, const NScheme::TTypeRegistry* typeRegistry, TString& errStr) {
+ if (partitionCount > 1) {
+ // RangeEnd key will have first cell with non-NULL value and rest of the cells with NULLs
+ TVector<TCell> rangeEnd(keySize);
+ ui64 maxVal = 0;
+ ui32 valSz = 0;
+
+ // Check that first key column has integer type
+ switch(firstKeyColType) {
+ case NScheme::NTypeIds::Uint32:
maxVal = Max<ui32>();
- valSz = 4;
- break;
- case NScheme::NTypeIds::Uint64:
+ valSz = 4;
+ break;
+ case NScheme::NTypeIds::Uint64:
maxVal = Max<ui64>();
- valSz = 8;
- break;
- default:
- errStr = TStringBuilder() << "Unsupported first key column type " << typeRegistry->GetTypeName(firstKeyColType) << ", only Uint32 and Uint64 are supported";
- return false;
- }
-
- // Generate range boundaries
- for (ui32 i = 1; i < partitionCount; ++i) {
- ui64 val = maxVal * (double(i)/partitionCount);
- rangeEnd[0] = TCell((const char*)&val, valSz);
- rangeEnds.push_back(TSerializedCellVec::Serialize(rangeEnd));
- }
- }
- return true;
-}
-
-void TSchemeShard::SetPartitioning(TPathId pathId, TTableInfo::TPtr tableInfo, TVector<TTableShardInfo>&& newPartitioning) {
+ valSz = 8;
+ break;
+ default:
+ errStr = TStringBuilder() << "Unsupported first key column type " << typeRegistry->GetTypeName(firstKeyColType) << ", only Uint32 and Uint64 are supported";
+ return false;
+ }
+
+ // Generate range boundaries
+ for (ui32 i = 1; i < partitionCount; ++i) {
+ ui64 val = maxVal * (double(i)/partitionCount);
+ rangeEnd[0] = TCell((const char*)&val, valSz);
+ rangeEnds.push_back(TSerializedCellVec::Serialize(rangeEnd));
+ }
+ }
+ return true;
+}
+
+void TSchemeShard::SetPartitioning(TPathId pathId, TTableInfo::TPtr tableInfo, TVector<TTableShardInfo>&& newPartitioning) {
if (AppData()->FeatureFlags.GetEnableSystemViews()) {
TVector<std::pair<ui64, ui64>> shardIndices;
shardIndices.reserve(newPartitioning.size());
@@ -5796,7 +5796,7 @@ void TSchemeShard::SetPartitioning(TPathId pathId, TTableInfo::TPtr tableInfo, T
tableInfo->SetPartitioning(std::move(newPartitioning));
}
-void TSchemeShard::FillAsyncIndexInfo(const TPathId& tableId, NKikimrTxDataShard::TFlatSchemeTransaction& tx) {
+void TSchemeShard::FillAsyncIndexInfo(const TPathId& tableId, NKikimrTxDataShard::TFlatSchemeTransaction& tx) {
Y_VERIFY(PathsById.contains(tableId));
auto parent = TPath::Init(tableId, this).Parent();
@@ -5814,130 +5814,130 @@ void TSchemeShard::FillAsyncIndexInfo(const TPathId& tableId, NKikimrTxDataShard
}
}
-bool TSchemeShard::ReadSysValue(NIceDb::TNiceDb &db, ui64 sysTag, TString &value, TString defValue) {
- auto sysParamsRowset = db.Table<Schema::SysParams>().Key(sysTag).Select<Schema::SysParams::Value>();
- if (!sysParamsRowset.IsReady()) {
- return false;
- }
-
- if (!sysParamsRowset.IsValid()) {
- value = defValue;
- return true;
- }
-
- value = sysParamsRowset.GetValue<Schema::SysParams::Value>();
- return true;
-}
-
-bool TSchemeShard::ReadSysValue(NIceDb::TNiceDb &db, ui64 sysTag, ui64 &value, ui64 defVal) {
- auto sysParamsRowset = db.Table<Schema::SysParams>().Key(sysTag).Select<Schema::SysParams::Value>();
- if (!sysParamsRowset.IsReady()) {
- return false;
- }
-
- if (!sysParamsRowset.IsValid()) {
- value = defVal;
- return true;
- }
-
- TString rawValue = sysParamsRowset.GetValue<Schema::SysParams::Value>(); \
- value = FromString<ui64>(rawValue);
-
- return true;
-}
-
-TSchemeShard::TDedicatedPipePool::TDedicatedPipePool() {
+bool TSchemeShard::ReadSysValue(NIceDb::TNiceDb &db, ui64 sysTag, TString &value, TString defValue) {
+ auto sysParamsRowset = db.Table<Schema::SysParams>().Key(sysTag).Select<Schema::SysParams::Value>();
+ if (!sysParamsRowset.IsReady()) {
+ return false;
+ }
+
+ if (!sysParamsRowset.IsValid()) {
+ value = defValue;
+ return true;
+ }
+
+ value = sysParamsRowset.GetValue<Schema::SysParams::Value>();
+ return true;
+}
+
+bool TSchemeShard::ReadSysValue(NIceDb::TNiceDb &db, ui64 sysTag, ui64 &value, ui64 defVal) {
+ auto sysParamsRowset = db.Table<Schema::SysParams>().Key(sysTag).Select<Schema::SysParams::Value>();
+ if (!sysParamsRowset.IsReady()) {
+ return false;
+ }
+
+ if (!sysParamsRowset.IsValid()) {
+ value = defVal;
+ return true;
+ }
+
+ TString rawValue = sysParamsRowset.GetValue<Schema::SysParams::Value>(); \
+ value = FromString<ui64>(rawValue);
+
+ return true;
+}
+
+TSchemeShard::TDedicatedPipePool::TDedicatedPipePool() {
PipeCfg.RetryPolicy = {
.MinRetryTime = TDuration::MilliSeconds(100),
.MaxRetryTime = TDuration::Seconds(30),
};
-}
-
-void TSchemeShard::TDedicatedPipePool::Create(TIndexBuildId ownerTxId, TTabletId dst, THolder<IEventBase> message, const TActorContext &ctx) {
- Y_VERIFY(!Pipes[ownerTxId].contains(dst));
-
+}
+
+void TSchemeShard::TDedicatedPipePool::Create(TIndexBuildId ownerTxId, TTabletId dst, THolder<IEventBase> message, const TActorContext &ctx) {
+ Y_VERIFY(!Pipes[ownerTxId].contains(dst));
+
TActorId clientId = ctx.ExecutorThread.RegisterActor(NTabletPipe::CreateClient(ctx.SelfID, ui64(dst), PipeCfg));
-
- Pipes[ownerTxId][dst] = clientId;
- Owners[clientId] = TOwnerRec(ownerTxId, dst);
-
- NTabletPipe::SendData(ctx.SelfID, clientId, message.Release(), 0);
-}
-
-void TSchemeShard::TDedicatedPipePool::Close(TIndexBuildId ownerTxId, TTabletId dst, const TActorContext &ctx) {
- if (!Pipes.contains(ownerTxId)) {
- return;
- }
-
- if (!Pipes.at(ownerTxId).contains(dst)) {
- return;
- }
-
+
+ Pipes[ownerTxId][dst] = clientId;
+ Owners[clientId] = TOwnerRec(ownerTxId, dst);
+
+ NTabletPipe::SendData(ctx.SelfID, clientId, message.Release(), 0);
+}
+
+void TSchemeShard::TDedicatedPipePool::Close(TIndexBuildId ownerTxId, TTabletId dst, const TActorContext &ctx) {
+ if (!Pipes.contains(ownerTxId)) {
+ return;
+ }
+
+ if (!Pipes.at(ownerTxId).contains(dst)) {
+ return;
+ }
+
TActorId actorId = Pipes.at(ownerTxId).at(dst);
- NTabletPipe::CloseClient(ctx, actorId);
-
- Owners.erase(actorId);
-
- Pipes[ownerTxId].erase(dst);
- if (Pipes[ownerTxId].empty()) {
- Pipes.erase(ownerTxId);
- }
-}
-
-ui64 TSchemeShard::TDedicatedPipePool::CloseAll(TIndexBuildId ownerTxId, const TActorContext &ctx) {
- if (!Pipes.contains(ownerTxId)) {
- return 0;
- }
-
- TVector<TTabletId> tables;
- tables.reserve(Pipes[ownerTxId].size());
-
- for (const auto& x: Pipes) {
- for (const auto& y: x.second) {
- tables.push_back(y.first);
- }
- }
-
- for (const auto& x: tables) {
- Close(ownerTxId, x, ctx);
- }
-
- return tables.size();
-}
-
-TIndexBuildId TSchemeShard::TDedicatedPipePool::GetOwnerId(TActorId actorId) const {
- if (!Has(actorId)) {
- return InvalidIndexBuildId;
- }
-
- return Owners.at(actorId).first;
-}
-
-TTabletId TSchemeShard::TDedicatedPipePool::GetTabletId(TActorId actorId) const {
- if (!Has(actorId)) {
- return InvalidTabletId;
- }
-
- return Owners.at(actorId).second;
-}
-
-bool TSchemeShard::TDedicatedPipePool::Has(TActorId actorId) const {
- return Owners.contains(actorId);
-}
-
-void TSchemeShard::SubscribeConsoleConfigs(const TActorContext &ctx) {
+ NTabletPipe::CloseClient(ctx, actorId);
+
+ Owners.erase(actorId);
+
+ Pipes[ownerTxId].erase(dst);
+ if (Pipes[ownerTxId].empty()) {
+ Pipes.erase(ownerTxId);
+ }
+}
+
+ui64 TSchemeShard::TDedicatedPipePool::CloseAll(TIndexBuildId ownerTxId, const TActorContext &ctx) {
+ if (!Pipes.contains(ownerTxId)) {
+ return 0;
+ }
+
+ TVector<TTabletId> tables;
+ tables.reserve(Pipes[ownerTxId].size());
+
+ for (const auto& x: Pipes) {
+ for (const auto& y: x.second) {
+ tables.push_back(y.first);
+ }
+ }
+
+ for (const auto& x: tables) {
+ Close(ownerTxId, x, ctx);
+ }
+
+ return tables.size();
+}
+
+TIndexBuildId TSchemeShard::TDedicatedPipePool::GetOwnerId(TActorId actorId) const {
+ if (!Has(actorId)) {
+ return InvalidIndexBuildId;
+ }
+
+ return Owners.at(actorId).first;
+}
+
+TTabletId TSchemeShard::TDedicatedPipePool::GetTabletId(TActorId actorId) const {
+ if (!Has(actorId)) {
+ return InvalidTabletId;
+ }
+
+ return Owners.at(actorId).second;
+}
+
+bool TSchemeShard::TDedicatedPipePool::Has(TActorId actorId) const {
+ return Owners.contains(actorId);
+}
+
+void TSchemeShard::SubscribeConsoleConfigs(const TActorContext &ctx) {
ctx.Send(
NConsole::MakeConfigsDispatcherID(ctx.SelfID.NodeId()),
new NConsole::TEvConfigsDispatcher::TEvSetConfigSubscriptionRequest({
(ui32)NKikimrConsole::TConfigItem::FeatureFlagsItem,
(ui32)NKikimrConsole::TConfigItem::CompactionConfigItem,
}));
-}
-
-void TSchemeShard::ApplyConsoleConfigs(const NKikimrConfig::TAppConfig& appConfig, const TActorContext& ctx) {
- if (appConfig.HasFeatureFlags()) {
- ApplyConsoleConfigs(appConfig.GetFeatureFlags(), ctx);
- }
+}
+
+void TSchemeShard::ApplyConsoleConfigs(const NKikimrConfig::TAppConfig& appConfig, const TActorContext& ctx) {
+ if (appConfig.HasFeatureFlags()) {
+ ApplyConsoleConfigs(appConfig.GetFeatureFlags(), ctx);
+ }
if (appConfig.HasCompactionConfig()) {
const auto& compactionConfig = appConfig.GetCompactionConfig();
@@ -5949,32 +5949,32 @@ void TSchemeShard::ApplyConsoleConfigs(const NKikimrConfig::TAppConfig& appConfi
if (IsShemeShardConfigured()) {
StartStopCompactionQueue();
}
-}
-
-void TSchemeShard::ApplyConsoleConfigs(const NKikimrConfig::TFeatureFlags& featureFlags, const TActorContext& ctx) {
- if (featureFlags.GetAllowServerlessStorageBillingForSchemeShard() != (bool)AllowServerlessStorageBilling) {
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "ApplyConsoleConfigs: AllowServerlessStorageBillingForSchemeShard has been changed"
- << ", schemeshardId: " << SelfTabletId()
- << ", old: " << (bool)AllowServerlessStorageBilling
- << ", new: " << (bool)featureFlags.GetAllowServerlessStorageBillingForSchemeShard());
- AllowServerlessStorageBilling = (i64)featureFlags.GetAllowServerlessStorageBillingForSchemeShard();
- }
-
- if (featureFlags.GetEnableSchemeTransactionsAtSchemeShard() != (bool)EnableSchemeTransactionsAtSchemeShard) {
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "ApplyConsoleConfigs: EnableSchemeTransactionsAtSchemeShard has been changed"
- << ", schemeshardId: " << SelfTabletId()
- << ", old: " << (bool)EnableSchemeTransactionsAtSchemeShard
- << ", new: " << (bool)featureFlags.GetEnableSchemeTransactionsAtSchemeShard());
- EnableSchemeTransactionsAtSchemeShard = (i64)featureFlags.GetEnableSchemeTransactionsAtSchemeShard();
- }
+}
+
+void TSchemeShard::ApplyConsoleConfigs(const NKikimrConfig::TFeatureFlags& featureFlags, const TActorContext& ctx) {
+ if (featureFlags.GetAllowServerlessStorageBillingForSchemeShard() != (bool)AllowServerlessStorageBilling) {
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "ApplyConsoleConfigs: AllowServerlessStorageBillingForSchemeShard has been changed"
+ << ", schemeshardId: " << SelfTabletId()
+ << ", old: " << (bool)AllowServerlessStorageBilling
+ << ", new: " << (bool)featureFlags.GetAllowServerlessStorageBillingForSchemeShard());
+ AllowServerlessStorageBilling = (i64)featureFlags.GetAllowServerlessStorageBillingForSchemeShard();
+ }
+
+ if (featureFlags.GetEnableSchemeTransactionsAtSchemeShard() != (bool)EnableSchemeTransactionsAtSchemeShard) {
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "ApplyConsoleConfigs: EnableSchemeTransactionsAtSchemeShard has been changed"
+ << ", schemeshardId: " << SelfTabletId()
+ << ", old: " << (bool)EnableSchemeTransactionsAtSchemeShard
+ << ", new: " << (bool)featureFlags.GetEnableSchemeTransactionsAtSchemeShard());
+ EnableSchemeTransactionsAtSchemeShard = (i64)featureFlags.GetEnableSchemeTransactionsAtSchemeShard();
+ }
EnableBackgroundCompaction = featureFlags.GetEnableBackgroundCompaction();
EnableBackgroundCompactionServerless = featureFlags.GetEnableBackgroundCompactionServerless();
-}
-
-void TSchemeShard::ConfigureCompactionQueue(
+}
+
+void TSchemeShard::ConfigureCompactionQueue(
const NKikimrConfig::TCompactionConfig::TBackgroundCompactionConfig& config,
const TActorContext &ctx)
{
@@ -6006,7 +6006,7 @@ void TSchemeShard::ConfigureCompactionQueue(
}
}
-void TSchemeShard::StartStopCompactionQueue() {
+void TSchemeShard::StartStopCompactionQueue() {
// note, that we don't need to check current state of compaction queue
if (IsServerlessDomain(TPath::Init(RootPathId(), this))) {
if (EnableBackgroundCompactionServerless) {
@@ -6023,33 +6023,33 @@ void TSchemeShard::StartStopCompactionQueue() {
}
}
-void TSchemeShard::Handle(NConsole::TEvConfigsDispatcher::TEvSetConfigSubscriptionResponse::TPtr &, const TActorContext &ctx) {
- LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Subscribtion to Console has been set up"
- << ", schemeshardId: " << SelfTabletId());
-}
-
-void TSchemeShard::Handle(NConsole::TEvConsole::TEvConfigNotificationRequest::TPtr &ev, const TActorContext &ctx) {
- auto &rec = ev->Get()->Record;
-
- LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Got new config: " << rec.GetConfig().ShortDebugString());
-
- ApplyConsoleConfigs(rec.GetConfig(), ctx);
-
- auto resp = MakeHolder<NConsole::TEvConsole::TEvConfigNotificationResponse>(rec);
-
- LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Send TEvConfigNotificationResponse: " << resp->Record.ShortDebugString());
-
- ctx.Send(ev->Sender, resp.Release(), 0, ev->Cookie);
-}
-
-void TSchemeShard::ChangeStreamShardsCount(i64 delta) {
+void TSchemeShard::Handle(NConsole::TEvConfigsDispatcher::TEvSetConfigSubscriptionResponse::TPtr &, const TActorContext &ctx) {
+ LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Subscribtion to Console has been set up"
+ << ", schemeshardId: " << SelfTabletId());
+}
+
+void TSchemeShard::Handle(NConsole::TEvConsole::TEvConfigNotificationRequest::TPtr &ev, const TActorContext &ctx) {
+ auto &rec = ev->Get()->Record;
+
+ LOG_INFO_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Got new config: " << rec.GetConfig().ShortDebugString());
+
+ ApplyConsoleConfigs(rec.GetConfig(), ctx);
+
+ auto resp = MakeHolder<NConsole::TEvConsole::TEvConfigNotificationResponse>(rec);
+
+ LOG_TRACE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Send TEvConfigNotificationResponse: " << resp->Record.ShortDebugString());
+
+ ctx.Send(ev->Sender, resp.Release(), 0, ev->Cookie);
+}
+
+void TSchemeShard::ChangeStreamShardsCount(i64 delta) {
TabletCounters->Simple()[COUNTER_STREAM_SHARDS_COUNT].Add(delta);
}
-void TSchemeShard::ChangeStreamShardsQuota(i64 delta) {
+void TSchemeShard::ChangeStreamShardsQuota(i64 delta) {
TabletCounters->Simple()[COUNTER_STREAM_SHARDS_QUOTA].Add(delta);
}
@@ -6061,33 +6061,33 @@ void TSchemeShard::ChangeStreamReservedStorageQuota(i64 delta) {
TabletCounters->Simple()[COUNTER_STREAM_RESERVED_STORAGE_QUOTA].Add(delta);
}
-void TSchemeShard::ChangeDiskSpaceTablesDataBytes(i64 delta) {
+void TSchemeShard::ChangeDiskSpaceTablesDataBytes(i64 delta) {
TabletCounters->Simple()[COUNTER_DISK_SPACE_TABLES_DATA_BYTES].Add(delta);
}
-void TSchemeShard::ChangeDiskSpaceTablesIndexBytes(i64 delta) {
+void TSchemeShard::ChangeDiskSpaceTablesIndexBytes(i64 delta) {
TabletCounters->Simple()[COUNTER_DISK_SPACE_TABLES_INDEX_BYTES].Add(delta);
}
-void TSchemeShard::ChangeDiskSpaceTablesTotalBytes(i64 delta) {
+void TSchemeShard::ChangeDiskSpaceTablesTotalBytes(i64 delta) {
TabletCounters->Simple()[COUNTER_DISK_SPACE_TABLES_TOTAL_BYTES].Add(delta);
}
-void TSchemeShard::ChangeDiskSpaceQuotaExceeded(i64 delta) {
+void TSchemeShard::ChangeDiskSpaceQuotaExceeded(i64 delta) {
TabletCounters->Simple()[COUNTER_DISK_SPACE_QUOTA_EXCEEDED].Add(delta);
}
-void TSchemeShard::ChangeDiskSpaceHardQuotaBytes(i64 delta) {
+void TSchemeShard::ChangeDiskSpaceHardQuotaBytes(i64 delta) {
TabletCounters->Simple()[COUNTER_DISK_SPACE_HARD_QUOTA_BYTES].Add(delta);
}
-void TSchemeShard::ChangeDiskSpaceSoftQuotaBytes(i64 delta) {
+void TSchemeShard::ChangeDiskSpaceSoftQuotaBytes(i64 delta) {
TabletCounters->Simple()[COUNTER_DISK_SPACE_SOFT_QUOTA_BYTES].Add(delta);
}
-void TSchemeShard::Handle(TEvSchemeShard::TEvLogin::TPtr &ev, const TActorContext &ctx) {
+void TSchemeShard::Handle(TEvSchemeShard::TEvLogin::TPtr &ev, const TActorContext &ctx) {
Execute(CreateTxLogin(ev), ctx);
}
-} // namespace NSchemeShard
+} // namespace NSchemeShard
} // namespace NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.h b/ydb/core/tx/schemeshard/schemeshard_impl.h
index db605ccaa05..e1a1d08b9a6 100644
--- a/ydb/core/tx/schemeshard/schemeshard_impl.h
+++ b/ydb/core/tx/schemeshard/schemeshard_impl.h
@@ -3,19 +3,19 @@
#include "schemeshard.h"
#include "schemeshard_export.h"
#include "schemeshard_import.h"
-#include "schemeshard_build_index.h"
+#include "schemeshard_build_index.h"
#include "schemeshard_private.h"
-#include "schemeshard_types.h"
-#include "schemeshard_path_element.h"
-#include "schemeshard_path.h"
-#include "schemeshard_domain_links.h"
-#include "schemeshard_info_types.h"
-#include "schemeshard_tx_infly.h"
-#include "schemeshard_utils.h"
-#include "schemeshard_schema.h"
-
-#include "schemeshard__operation.h"
-
+#include "schemeshard_types.h"
+#include "schemeshard_path_element.h"
+#include "schemeshard_path.h"
+#include "schemeshard_domain_links.h"
+#include "schemeshard_info_types.h"
+#include "schemeshard_tx_infly.h"
+#include "schemeshard_utils.h"
+#include "schemeshard_schema.h"
+
+#include "schemeshard__operation.h"
+
#include "operation_queue_timer.h"
#include <ydb/core/base/hive.h>
@@ -53,26 +53,26 @@
#include <util/generic/ptr.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
extern const ui64 NEW_TABLE_ALTER_VERSION;
-class TSchemeShard
- : public TActor<TSchemeShard>
+class TSchemeShard
+ : public TActor<TSchemeShard>
, public NTabletFlatExecutor::TTabletExecutedFlat
, public IQuotaCounters
{
private:
class TPipeClientFactory : public NTabletPipe::IClientFactory {
public:
- TPipeClientFactory(TSchemeShard* self)
+ TPipeClientFactory(TSchemeShard* self)
: Self(self)
{ }
TActorId CreateClient(const TActorContext& ctx, ui64 tabletId, const NTabletPipe::TClientConfig& pipeConfig) override;
private:
- TSchemeShard* Self;
+ TSchemeShard* Self;
};
using TCompactionBackendQueue = NOperationQueue::TQueueWithPriority<
@@ -86,7 +86,7 @@ private:
class TCompactionStarter : public TCompactionQueue::IStarter {
public:
- TCompactionStarter(TSchemeShard* self)
+ TCompactionStarter(TSchemeShard* self)
: Self(self)
{ }
@@ -95,101 +95,101 @@ private:
}
private:
- TSchemeShard* Self;
+ TSchemeShard* Self;
};
-public:
- static constexpr ui32 DefaultPQTabletPartitionsCount = 1;
- static constexpr ui32 MaxPQTabletPartitionsCount = 1000;
- static constexpr ui32 MaxPQGroupTabletsCount = 10*1000;
+public:
+ static constexpr ui32 DefaultPQTabletPartitionsCount = 1;
+ static constexpr ui32 MaxPQTabletPartitionsCount = 1000;
+ static constexpr ui32 MaxPQGroupTabletsCount = 10*1000;
static constexpr ui32 MaxPQGroupPartitionsCount = 20*1000;
static constexpr ui32 MaxPQWriteSpeedPerPartition = 50*1024*1024;
static constexpr ui32 MaxPQLifetimeSeconds = 31 * 86400;
static constexpr ui32 PublishChunkSize = 1000;
- static const TSchemeLimits DefaultLimits;
-
- TIntrusivePtr<TChannelProfiles> ChannelProfiles;
+ static const TSchemeLimits DefaultLimits;
+
+ TIntrusivePtr<TChannelProfiles> ChannelProfiles;
TControlWrapper AllowConditionalEraseOperations;
- TControlWrapper AllowServerlessStorageBilling;
+ TControlWrapper AllowServerlessStorageBilling;
TSplitSettings SplitSettings;
- struct TTenantInitState {
- enum EInitState {
- InvalidState = 0,
- Uninitialized = 1,
- Inprogress = 2,
- ReadOnlyPreview = 50,
- Done = 100,
- };
- };
- TTenantInitState::EInitState InitState = TTenantInitState::InvalidState;
-
- // In RO mode we don't accept any modifications from users but process all in-flight operations in normal way
+ struct TTenantInitState {
+ enum EInitState {
+ InvalidState = 0,
+ Uninitialized = 1,
+ Inprogress = 2,
+ ReadOnlyPreview = 50,
+ Done = 100,
+ };
+ };
+ TTenantInitState::EInitState InitState = TTenantInitState::InvalidState;
+
+ // In RO mode we don't accept any modifications from users but process all in-flight operations in normal way
bool IsReadOnlyMode = false;
-
+
bool IsDomainSchemeShard = false;
-
- TPathId ParentDomainId = InvalidPathId;
- TString ParentDomainEffectiveACL;
- ui64 ParentDomainEffectiveACLVersion = 0;
- TEffectiveACL ParentDomainCachedEffectiveACL;
- TString ParentDomainOwner;
-
+
+ TPathId ParentDomainId = InvalidPathId;
+ TString ParentDomainEffectiveACL;
+ ui64 ParentDomainEffectiveACLVersion = 0;
+ TEffectiveACL ParentDomainCachedEffectiveACL;
+ TString ParentDomainOwner;
+
THashSet<TString> SystemBackupSIDs;
- TInstant ServerlessStorageLastBillTime;
-
- TParentDomainLink ParentDomainLink;
- TSubDomainsLinks SubDomainsLinks;
-
- TVector<TString> RootPathElemets;
-
+ TInstant ServerlessStorageLastBillTime;
+
+ TParentDomainLink ParentDomainLink;
+ TSubDomainsLinks SubDomainsLinks;
+
+ TVector<TString> RootPathElemets;
+
THashMap<TPathId, TPathElement::TPtr> PathsById;
- TLocalPathId NextLocalPathId = 0;
-
+ TLocalPathId NextLocalPathId = 0;
+
THashMap<TPathId, TTableInfo::TPtr> Tables;
THashMap<TPathId, TTableInfo::TPtr> TTLEnabledTables;
-
+
THashMap<TPathId, TTableIndexInfo::TPtr> Indexes;
THashMap<TPathId, TCdcStreamInfo::TPtr> CdcStreams;
THashMap<TPathId, TSequenceInfo::TPtr> Sequences;
THashMap<TPathId, TReplicationInfo::TPtr> Replications;
- THashMap<TPathId, TTxId> TablesWithSnaphots;
- THashMap<TTxId, TSet<TPathId>> SnapshotTables;
- THashMap<TTxId, TStepId> SnapshotsStepIds;
-
- THashMap<TPathId, TTxId> LockedPaths;
-
+ THashMap<TPathId, TTxId> TablesWithSnaphots;
+ THashMap<TTxId, TSet<TPathId>> SnapshotTables;
+ THashMap<TTxId, TStepId> SnapshotsStepIds;
+
+ THashMap<TPathId, TTxId> LockedPaths;
+
THashMap<TPathId, TPersQueueGroupInfo::TPtr> PersQueueGroups;
THashMap<TPathId, TRtmrVolumeInfo::TPtr> RtmrVolumes;
- THashMap<TPathId, TSolomonVolumeInfo::TPtr> SolomonVolumes;
- THashMap<TPathId, TSubDomainInfo::TPtr> SubDomains;
+ THashMap<TPathId, TSolomonVolumeInfo::TPtr> SolomonVolumes;
+ THashMap<TPathId, TSubDomainInfo::TPtr> SubDomains;
THashMap<TPathId, TBlockStoreVolumeInfo::TPtr> BlockStoreVolumes;
THashMap<TPathId, TFileStoreInfo::TPtr> FileStoreInfos;
THashMap<TPathId, TKesusInfo::TPtr> KesusInfos;
THashMap<TPathId, TOlapStoreInfo::TPtr> OlapStores;
THashMap<TPathId, TOlapTableInfo::TPtr> OlapTables;
-
- // it is only because we need to manage undo of upgrade subdomain, finally remove it
- THashMap<TPathId, TVector<TTabletId>> RevertedMigrations;
-
- THashMap<TTxId, TOperation::TPtr> Operations;
+
+ // it is only because we need to manage undo of upgrade subdomain, finally remove it
+ THashMap<TPathId, TVector<TTabletId>> RevertedMigrations;
+
+ THashMap<TTxId, TOperation::TPtr> Operations;
THashMap<TTxId, TPublicationInfo> Publications;
- THashMap<TOperationId, TTxState> TxInFlight;
-
- ui64 NextLocalShardIdx = 0;
- THashMap<TShardIdx, TShardInfo> ShardInfos;
- THashMap<TShardIdx, TAdoptedShard> AdoptedShards;
- THashMap<TTabletId, TShardIdx> TabletIdToShardIdx;
+ THashMap<TOperationId, TTxState> TxInFlight;
+
+ ui64 NextLocalShardIdx = 0;
+ THashMap<TShardIdx, TShardInfo> ShardInfos;
+ THashMap<TShardIdx, TAdoptedShard> AdoptedShards;
+ THashMap<TTabletId, TShardIdx> TabletIdToShardIdx;
THashMap<TShardIdx, TVector<TActorId>> ShardDeletionSubscribers; // for tests
TActorId SchemeBoardPopulator;
- static constexpr ui32 InitiateCachedTxIdsCount = 100;
- TDeque<TTxId> CachedTxIds;
+ static constexpr ui32 InitiateCachedTxIdsCount = 100;
+ TDeque<TTxId> CachedTxIds;
TActorId TxAllocatorClient;
TAutoPtr<NTabletPipe::IClientCache> PipeClientCache;
@@ -217,94 +217,94 @@ public:
bool CleanDroppedPathsDisabled = true;
bool CleanDroppedSubDomainsInFly = false;
- TActorId DelayedInitTenantDestination;
- TAutoPtr<TEvSchemeShard::TEvInitTenantSchemeShardResult> DelayedInitTenantReply;
-
- THolder<TProposeResponse> IgniteOperation(TProposeRequest& request, TOperationContext& context);
-
- TPathId RootPathId() const {
- return MakeLocalId(TPathElement::RootPathId);
- }
-
- bool IsRootPathId(const TPathId& pId) const {
- return pId == RootPathId();
- }
-
+ TActorId DelayedInitTenantDestination;
+ TAutoPtr<TEvSchemeShard::TEvInitTenantSchemeShardResult> DelayedInitTenantReply;
+
+ THolder<TProposeResponse> IgniteOperation(TProposeRequest& request, TOperationContext& context);
+
+ TPathId RootPathId() const {
+ return MakeLocalId(TPathElement::RootPathId);
+ }
+
+ bool IsRootPathId(const TPathId& pId) const {
+ return pId == RootPathId();
+ }
+
bool IsServerlessDomain(const TPath& domain) const {
const auto& resourcesDomainId = domain.DomainInfo()->GetResourcesDomainId();
return !IsDomainSchemeShard && resourcesDomainId && resourcesDomainId != ParentDomainId;
}
- TPathId MakeLocalId(const TLocalPathId& localPathId) const {
- return TPathId(TabletID(), localPathId);
- }
-
- TShardIdx MakeLocalId(const TLocalShardIdx& localShardIdx) const {
- return TShardIdx(TabletID(), localShardIdx);
- }
-
- bool IsLocalId(const TPathId& pathId) const {
- return pathId.OwnerId == TabletID();
- }
-
- bool IsLocalId(const TShardIdx& shardIdx) const {
- return shardIdx.GetOwnerId() == TabletID();
- }
-
+ TPathId MakeLocalId(const TLocalPathId& localPathId) const {
+ return TPathId(TabletID(), localPathId);
+ }
+
+ TShardIdx MakeLocalId(const TLocalShardIdx& localShardIdx) const {
+ return TShardIdx(TabletID(), localShardIdx);
+ }
+
+ bool IsLocalId(const TPathId& pathId) const {
+ return pathId.OwnerId == TabletID();
+ }
+
+ bool IsLocalId(const TShardIdx& shardIdx) const {
+ return shardIdx.GetOwnerId() == TabletID();
+ }
+
TPathId GetCurrentSubDomainPathId() const {
return RootPathId();
}
- TPathId PeekNextPathId() const {
- return MakeLocalId(NextLocalPathId);
- }
-
- TPathId AllocatePathId () {
- TPathId next = PeekNextPathId();
- ++NextLocalPathId;
- return next;
- }
-
- TTxId GetCachedTxId(const TActorContext& ctx);
-
- EAttachChildResult AttachChild(TPathElement::TPtr child);
- bool PathIsActive(TPathId pathId) const;
-
- // Transient sequence number that monotonically increases within SS tablet generation. It is included in events
- // sent from SS to DS and is used for deduplication.
- ui64 SchemeOpRound = 1;
- TMessageSeqNo StartRound(TTxState& state);// For SS -> DS propose events
- TMessageSeqNo NextRound();
-
- void Clear();
- void BreakTabletAndRestart(const TActorContext& ctx);
-
- bool IsShemeShardConfigured() const;
-
- ui64 Generation() const;
-
- void SubscribeConsoleConfigs(const TActorContext& ctx);
- void ApplyConsoleConfigs(const NKikimrConfig::TAppConfig& appConfig, const TActorContext& ctx);
- void ApplyConsoleConfigs(const NKikimrConfig::TFeatureFlags& featureFlags, const TActorContext& ctx);
-
+ TPathId PeekNextPathId() const {
+ return MakeLocalId(NextLocalPathId);
+ }
+
+ TPathId AllocatePathId () {
+ TPathId next = PeekNextPathId();
+ ++NextLocalPathId;
+ return next;
+ }
+
+ TTxId GetCachedTxId(const TActorContext& ctx);
+
+ EAttachChildResult AttachChild(TPathElement::TPtr child);
+ bool PathIsActive(TPathId pathId) const;
+
+ // Transient sequence number that monotonically increases within SS tablet generation. It is included in events
+ // sent from SS to DS and is used for deduplication.
+ ui64 SchemeOpRound = 1;
+ TMessageSeqNo StartRound(TTxState& state);// For SS -> DS propose events
+ TMessageSeqNo NextRound();
+
+ void Clear();
+ void BreakTabletAndRestart(const TActorContext& ctx);
+
+ bool IsShemeShardConfigured() const;
+
+ ui64 Generation() const;
+
+ void SubscribeConsoleConfigs(const TActorContext& ctx);
+ void ApplyConsoleConfigs(const NKikimrConfig::TAppConfig& appConfig, const TActorContext& ctx);
+ void ApplyConsoleConfigs(const NKikimrConfig::TFeatureFlags& featureFlags, const TActorContext& ctx);
+
void ConfigureCompactionQueue(
const NKikimrConfig::TCompactionConfig::TBackgroundCompactionConfig& config,
const TActorContext &ctx);
void StartStopCompactionQueue();
- bool ApplyStorageConfig(const TStoragePools& storagePools,
- const NKikimrSchemeOp::TStorageConfig& storageConfig,
- TChannelsBindings& channelsBinding,
+ bool ApplyStorageConfig(const TStoragePools& storagePools,
+ const NKikimrSchemeOp::TStorageConfig& storageConfig,
+ TChannelsBindings& channelsBinding,
THashMap<TString, ui32>& reverseBinding,
- TStorageRoom& room,
- TString& errorMsg);
- bool GetBindingsRooms(const TPathId domainId,
- const NKikimrSchemeOp::TPartitionConfig& partitionConfig,
+ TStorageRoom& room,
+ TString& errorMsg);
+ bool GetBindingsRooms(const TPathId domainId,
+ const NKikimrSchemeOp::TPartitionConfig& partitionConfig,
TVector<TStorageRoom>& rooms,
THashMap<ui32, ui32>& familyRooms,
- TChannelsBindings& binding,
- TString& errStr);
-
+ TChannelsBindings& binding,
+ TString& errStr);
+
/**
* For each existing partition generates possible changes to channels
* cand per-shard partition config based on an updated partitionConfig
@@ -313,7 +313,7 @@ public:
bool GetBindingsRoomsChanges(
const TPathId domainId,
const TVector<TTableShardInfo>& partitions,
- const NKikimrSchemeOp::TPartitionConfig& partitionConfig,
+ const NKikimrSchemeOp::TPartitionConfig& partitionConfig,
TBindingsRoomsChanges& changes,
TString& errStr);
@@ -325,13 +325,13 @@ public:
TChannelsBindings& channelsBindings,
TString& errStr);
- bool IsStorageConfigLogic(const TTableInfo::TCPtr tableInfo) const;
- bool IsCompatibleChannelProfileLogic(const TPathId domainId, const TTableInfo::TCPtr tableInfo) const;
- bool GetChannelsBindings(const TPathId domainId, const TTableInfo::TCPtr tableInfo, TChannelsBindings& binding, TString& errStr) const;
-
- bool ResolveTabletChannels(ui32 profileId, const TPathId domainId, TChannelsBindings& channelsBinding) const;
- bool ResolveRtmrChannels(const TPathId domainId, TChannelsBindings& channelsBinding) const;
- bool ResolveSolomonChannels(ui32 profileId, const TPathId domainId, TChannelsBindings& channelsBinding) const;
+ bool IsStorageConfigLogic(const TTableInfo::TCPtr tableInfo) const;
+ bool IsCompatibleChannelProfileLogic(const TPathId domainId, const TTableInfo::TCPtr tableInfo) const;
+ bool GetChannelsBindings(const TPathId domainId, const TTableInfo::TCPtr tableInfo, TChannelsBindings& binding, TString& errStr) const;
+
+ bool ResolveTabletChannels(ui32 profileId, const TPathId domainId, TChannelsBindings& channelsBinding) const;
+ bool ResolveRtmrChannels(const TPathId domainId, TChannelsBindings& channelsBinding) const;
+ bool ResolveSolomonChannels(ui32 profileId, const TPathId domainId, TChannelsBindings& channelsBinding) const;
bool ResolvePqChannels(ui32 profileId, const TPathId domainId, TChannelsBindings& channelsBinding) const;
bool ResolveChannelsByPoolKinds(
const TVector<TStringBuf>& channelPoolKinds,
@@ -346,187 +346,187 @@ public:
static void SetPqChannelsParams(
const google::protobuf::RepeatedPtrField<NKikimrPQ::TChannelProfile>& ecps,
TChannelsBindings& channelsBinding);
-
- bool ResolveSubdomainsChannels(const TStoragePools& storagePools, TChannelsBindings& channelsBinding);
-
- using TChannelResolveDetails = std::function<bool (ui32 profileId,
- const TChannelProfiles::TProfile& profile,
- const TStoragePools& storagePools,
- TChannelsBindings& channelsBinding)>;
- bool ResolveChannelCommon(ui32 profileId, const TPathId domainId, TChannelsBindings& channelsBinding, TChannelResolveDetails resolveDetails) const;
- static bool ResolveChannelsDetailsAsIs(ui32 /*profileId*/, const TChannelProfiles::TProfile& profile, const TStoragePools& storagePools, TChannelsBindings& channelsBinding);
- static bool TabletResolveChannelsDetails(ui32 profileId, const TChannelProfiles::TProfile& profile, const TStoragePools& storagePools, TChannelsBindings& channelsBinding);
-
- void ClearDescribePathCaches(const TPathElement::TPtr node);
- TString PathToString(TPathElement::TPtr item);
- NKikimrSchemeOp::TPathVersion GetPathVersion(const TPath& pathEl) const;
+
+ bool ResolveSubdomainsChannels(const TStoragePools& storagePools, TChannelsBindings& channelsBinding);
+
+ using TChannelResolveDetails = std::function<bool (ui32 profileId,
+ const TChannelProfiles::TProfile& profile,
+ const TStoragePools& storagePools,
+ TChannelsBindings& channelsBinding)>;
+ bool ResolveChannelCommon(ui32 profileId, const TPathId domainId, TChannelsBindings& channelsBinding, TChannelResolveDetails resolveDetails) const;
+ static bool ResolveChannelsDetailsAsIs(ui32 /*profileId*/, const TChannelProfiles::TProfile& profile, const TStoragePools& storagePools, TChannelsBindings& channelsBinding);
+ static bool TabletResolveChannelsDetails(ui32 profileId, const TChannelProfiles::TProfile& profile, const TStoragePools& storagePools, TChannelsBindings& channelsBinding);
+
+ void ClearDescribePathCaches(const TPathElement::TPtr node);
+ TString PathToString(TPathElement::TPtr item);
+ NKikimrSchemeOp::TPathVersion GetPathVersion(const TPath& pathEl) const;
const TTableInfo* GetMainTableForIndex(TPathId indexTableId) const;
-
- TPathId ResolveDomainId(TPathId pathId) const;
- TPathId ResolveDomainId(TPathElement::TPtr pathEl) const;
- TSubDomainInfo::TPtr ResolveDomainInfo(TPathId pathId) const;
- TSubDomainInfo::TPtr ResolveDomainInfo(TPathElement::TPtr pathEl) const;
-
+
+ TPathId ResolveDomainId(TPathId pathId) const;
+ TPathId ResolveDomainId(TPathElement::TPtr pathEl) const;
+ TSubDomainInfo::TPtr ResolveDomainInfo(TPathId pathId) const;
+ TSubDomainInfo::TPtr ResolveDomainInfo(TPathElement::TPtr pathEl) const;
+
TPathId GetDomainKey(TPathId pathId) const;
- const NKikimrSubDomains::TProcessingParams& SelectProcessingPrarams(TPathId id) const;
- const NKikimrSubDomains::TProcessingParams& SelectProcessingPrarams(TPathElement::TPtr pathEl) const;
-
- TTabletId SelectCoordinator(TTxId txId, TPathId pathId) const;
- TTabletId SelectCoordinator(TTxId txId, TPathElement::TPtr pathEl) const;
-
- bool CheckApplyIf(const NKikimrSchemeOp::TModifyScheme& scheme, TString& errStr);
- bool CheckLocks(const TPathId pathId, const TTxId lockTxId, TString& errStr);
- bool CheckLocks(const TPathId pathId, const NKikimrSchemeOp::TModifyScheme &scheme, TString &errStr);
-
- TShardIdx ReserveShardIdxs(ui64 count);
- TShardIdx NextShardIdx(const TShardIdx& shardIdx, ui64 inc) const;
+ const NKikimrSubDomains::TProcessingParams& SelectProcessingPrarams(TPathId id) const;
+ const NKikimrSubDomains::TProcessingParams& SelectProcessingPrarams(TPathElement::TPtr pathEl) const;
+
+ TTabletId SelectCoordinator(TTxId txId, TPathId pathId) const;
+ TTabletId SelectCoordinator(TTxId txId, TPathElement::TPtr pathEl) const;
+
+ bool CheckApplyIf(const NKikimrSchemeOp::TModifyScheme& scheme, TString& errStr);
+ bool CheckLocks(const TPathId pathId, const TTxId lockTxId, TString& errStr);
+ bool CheckLocks(const TPathId pathId, const NKikimrSchemeOp::TModifyScheme &scheme, TString &errStr);
+
+ TShardIdx ReserveShardIdxs(ui64 count);
+ TShardIdx NextShardIdx(const TShardIdx& shardIdx, ui64 inc) const;
TShardIdx RegisterShardInfo(TShardInfo&& shardInfo);
TShardIdx RegisterShardInfo(const TShardInfo& shardInfo);
TShardIdx RegisterShardInfo(const TShardIdx& shardIdx, TShardInfo&& shardInfo);
TShardIdx RegisterShardInfo(const TShardIdx& shardIdx, const TShardInfo& shardInfo);
-
- TTxState& CreateTx(TOperationId opId, TTxState::ETxType txType, TPathId targetPath, TPathId sourcePath = InvalidPathId);
- TTxState* FindTx(TOperationId opId);
- void RemoveTx(const TActorContext &ctx, NIceDb::TNiceDb& db, TOperationId opId, TTxState* txState);
- static TPathElement::EPathState CalcPathState(TTxState::ETxType txType, TPathElement::EPathState oldState);
-
- TMaybe<NKikimrSchemeOp::TPartitionConfig> GetTablePartitionConfigWithAlterData(TPathId pathId) const;
- void DeleteSplitOp(TOperationId txId, TTxState& txState);
- bool ShardIsUnderSplitMergeOp(const TShardIdx& idx) const;
-
- THashSet<TShardIdx> CollectAllShards(const THashSet<TPathId>& pathes) const;
- void ExamineTreeVFS(TPathId nodeId, std::function<void(TPathElement::TPtr)> func, const TActorContext& ctx);
- THashSet<TPathId> ListSubThee(TPathId subdomain_root, const TActorContext& ctx);
- THashSet<TTxId> GetRelatedTransactions(const THashSet<TPathId>& pathes, const TActorContext &ctx);
-
- void MarkAsDroping(TPathElement::TPtr node, TTxId txId, const TActorContext& ctx);
- void MarkAsDroping(const THashSet<TPathId>& pathes, TTxId txId, const TActorContext& ctx);
-
- void UncountNode(TPathElement::TPtr node);
- void MarkAsMigrated(TPathElement::TPtr node, const TActorContext& ctx);
-
+
+ TTxState& CreateTx(TOperationId opId, TTxState::ETxType txType, TPathId targetPath, TPathId sourcePath = InvalidPathId);
+ TTxState* FindTx(TOperationId opId);
+ void RemoveTx(const TActorContext &ctx, NIceDb::TNiceDb& db, TOperationId opId, TTxState* txState);
+ static TPathElement::EPathState CalcPathState(TTxState::ETxType txType, TPathElement::EPathState oldState);
+
+ TMaybe<NKikimrSchemeOp::TPartitionConfig> GetTablePartitionConfigWithAlterData(TPathId pathId) const;
+ void DeleteSplitOp(TOperationId txId, TTxState& txState);
+ bool ShardIsUnderSplitMergeOp(const TShardIdx& idx) const;
+
+ THashSet<TShardIdx> CollectAllShards(const THashSet<TPathId>& pathes) const;
+ void ExamineTreeVFS(TPathId nodeId, std::function<void(TPathElement::TPtr)> func, const TActorContext& ctx);
+ THashSet<TPathId> ListSubThee(TPathId subdomain_root, const TActorContext& ctx);
+ THashSet<TTxId> GetRelatedTransactions(const THashSet<TPathId>& pathes, const TActorContext &ctx);
+
+ void MarkAsDroping(TPathElement::TPtr node, TTxId txId, const TActorContext& ctx);
+ void MarkAsDroping(const THashSet<TPathId>& pathes, TTxId txId, const TActorContext& ctx);
+
+ void UncountNode(TPathElement::TPtr node);
+ void MarkAsMigrated(TPathElement::TPtr node, const TActorContext& ctx);
+
void DropNode(TPathElement::TPtr node, TStepId step, TTxId txId, NIceDb::TNiceDb& db, const TActorContext& ctx);
- void DropPathes(const THashSet<TPathId>& pathes, TStepId step, TTxId txId, NIceDb::TNiceDb& db, const TActorContext& ctx);
+ void DropPathes(const THashSet<TPathId>& pathes, TStepId step, TTxId txId, NIceDb::TNiceDb& db, const TActorContext& ctx);
- void DoShardsDeletion(const THashSet<TShardIdx>& shardIdx, const TActorContext& ctx);
+ void DoShardsDeletion(const THashSet<TShardIdx>& shardIdx, const TActorContext& ctx);
void SetPartitioning(TPathId pathId, TTableInfo::TPtr tableInfo, TVector<TTableShardInfo>&& newPartitioning);
auto BuildStatsForCollector(TPathId tableId, TShardIdx shardIdx, TTabletId datashardId,
TMaybe<ui32> nodeId, TMaybe<ui64> startTime, const TTableInfo::TPartitionStats& stats);
-
- bool ReadSysValue(NIceDb::TNiceDb& db, ui64 sysTag, TString& value, TString defValue = TString());
- bool ReadSysValue(NIceDb::TNiceDb& db, ui64 sysTag, ui64& value, ui64 defVal = 0);
-
- void IncrementPathDbRefCount(const TPathId& pathId, const TStringBuf& debug = TStringBuf());
- void DecrementPathDbRefCount(const TPathId& pathId, const TStringBuf& debug = TStringBuf());
-
- // path
- void PersistPath(NIceDb::TNiceDb& db, const TPathId& pathId);
+
+ bool ReadSysValue(NIceDb::TNiceDb& db, ui64 sysTag, TString& value, TString defValue = TString());
+ bool ReadSysValue(NIceDb::TNiceDb& db, ui64 sysTag, ui64& value, ui64 defVal = 0);
+
+ void IncrementPathDbRefCount(const TPathId& pathId, const TStringBuf& debug = TStringBuf());
+ void DecrementPathDbRefCount(const TPathId& pathId, const TStringBuf& debug = TStringBuf());
+
+ // path
+ void PersistPath(NIceDb::TNiceDb& db, const TPathId& pathId);
void PersistRemovePath(NIceDb::TNiceDb& db, const TPathElement::TPtr path);
- void PersistLastTxId(NIceDb::TNiceDb& db, const TPathElement::TPtr path);
- void PersistPathDirAlterVersion(NIceDb::TNiceDb& db, const TPathElement::TPtr path);
- void PersistACL(NIceDb::TNiceDb& db, const TPathElement::TPtr path);
- void PersistOwner(NIceDb::TNiceDb& db, const TPathElement::TPtr path);
- void PersistCreateTxId(NIceDb::TNiceDb& db, const TPathId pathId, TTxId txId);
- void PersistCreateStep(NIceDb::TNiceDb& db, const TPathId pathId, TStepId step);
- void PersistDropStep(NIceDb::TNiceDb& db, const TPathId pathId, TStepId step, TOperationId opId);
-
- // user attrs
- void ApplyAndPersistUserAttrs(NIceDb::TNiceDb& db, const TPathId& pathId);
- void PersistUserAttributes(NIceDb::TNiceDb& db, TPathId pathId, TUserAttributes::TPtr oldAttrs, TUserAttributes::TPtr alterAttrs);
- void PersistAlterUserAttributes(NIceDb::TNiceDb& db, TPathId pathId);
-
- // table index
- void PersistTableIndex(NIceDb::TNiceDb& db, const TPathId& pathId);
- void PersistTableIndexAlterData(NIceDb::TNiceDb& db, const TPathId& pathId);
-
+ void PersistLastTxId(NIceDb::TNiceDb& db, const TPathElement::TPtr path);
+ void PersistPathDirAlterVersion(NIceDb::TNiceDb& db, const TPathElement::TPtr path);
+ void PersistACL(NIceDb::TNiceDb& db, const TPathElement::TPtr path);
+ void PersistOwner(NIceDb::TNiceDb& db, const TPathElement::TPtr path);
+ void PersistCreateTxId(NIceDb::TNiceDb& db, const TPathId pathId, TTxId txId);
+ void PersistCreateStep(NIceDb::TNiceDb& db, const TPathId pathId, TStepId step);
+ void PersistDropStep(NIceDb::TNiceDb& db, const TPathId pathId, TStepId step, TOperationId opId);
+
+ // user attrs
+ void ApplyAndPersistUserAttrs(NIceDb::TNiceDb& db, const TPathId& pathId);
+ void PersistUserAttributes(NIceDb::TNiceDb& db, TPathId pathId, TUserAttributes::TPtr oldAttrs, TUserAttributes::TPtr alterAttrs);
+ void PersistAlterUserAttributes(NIceDb::TNiceDb& db, TPathId pathId);
+
+ // table index
+ void PersistTableIndex(NIceDb::TNiceDb& db, const TPathId& pathId);
+ void PersistTableIndexAlterData(NIceDb::TNiceDb& db, const TPathId& pathId);
+
// cdc stream
void PersistCdcStream(NIceDb::TNiceDb& db, const TPathId& pathId);
void PersistCdcStreamAlterData(NIceDb::TNiceDb& db, const TPathId& pathId);
void PersistRemoveCdcStream(NIceDb::TNiceDb& db, const TPathId& tableId);
- static void PersistTxMinStep(NIceDb::TNiceDb& db, const TOperationId opId, TStepId minStep);
- void PersistRemoveTx(NIceDb::TNiceDb& db, const TOperationId opId, const TTxState& txState);
- void PersistTable(NIceDb::TNiceDb &db, const TPathId pathId);
- void PersistChannelsBinding(NIceDb::TNiceDb& db, const TShardIdx shardId, const TChannelsBindings& bindedChannels);
- void PersistTablePartitioning(NIceDb::TNiceDb &db, const TPathId pathId, const TTableInfo::TPtr tableInfo);
- void DeleteTablePartitioning(NIceDb::TNiceDb& db, const TPathId tableId, const TTableInfo::TPtr tableInfo);
+ static void PersistTxMinStep(NIceDb::TNiceDb& db, const TOperationId opId, TStepId minStep);
+ void PersistRemoveTx(NIceDb::TNiceDb& db, const TOperationId opId, const TTxState& txState);
+ void PersistTable(NIceDb::TNiceDb &db, const TPathId pathId);
+ void PersistChannelsBinding(NIceDb::TNiceDb& db, const TShardIdx shardId, const TChannelsBindings& bindedChannels);
+ void PersistTablePartitioning(NIceDb::TNiceDb &db, const TPathId pathId, const TTableInfo::TPtr tableInfo);
+ void DeleteTablePartitioning(NIceDb::TNiceDb& db, const TPathId tableId, const TTableInfo::TPtr tableInfo);
void PersistTablePartitionCondErase(NIceDb::TNiceDb& db, const TPathId& pathId, ui64 id, const TTableInfo::TPtr tableInfo);
void PersistTablePartitionStats(NIceDb::TNiceDb& db, const TPathId& tableId, ui64 partitionId, const TTableInfo::TPartitionStats& stats);
void PersistTablePartitionStats(NIceDb::TNiceDb& db, const TPathId& tableId, const TShardIdx& shardIdx, const TTableInfo::TPtr tableInfo);
void PersistTablePartitionStats(NIceDb::TNiceDb& db, const TPathId& tableId, const TTableInfo::TPtr tableInfo);
- void PersistTableCreated(NIceDb::TNiceDb& db, const TPathId tableId);
- void PersistTableAlterVersion(NIceDb::TNiceDb &db, const TPathId pathId, const TTableInfo::TPtr tableInfo);
- void PersistTableAltered(NIceDb::TNiceDb &db, const TPathId pathId, const TTableInfo::TPtr tableInfo);
- void PersistAddAlterTable(NIceDb::TNiceDb& db, TPathId pathId, const TTableInfo::TAlterDataPtr alter);
- void PersistPersQueueGroup(NIceDb::TNiceDb &db, TPathId pathId, const TPersQueueGroupInfo::TPtr);
+ void PersistTableCreated(NIceDb::TNiceDb& db, const TPathId tableId);
+ void PersistTableAlterVersion(NIceDb::TNiceDb &db, const TPathId pathId, const TTableInfo::TPtr tableInfo);
+ void PersistTableAltered(NIceDb::TNiceDb &db, const TPathId pathId, const TTableInfo::TPtr tableInfo);
+ void PersistAddAlterTable(NIceDb::TNiceDb& db, TPathId pathId, const TTableInfo::TAlterDataPtr alter);
+ void PersistPersQueueGroup(NIceDb::TNiceDb &db, TPathId pathId, const TPersQueueGroupInfo::TPtr);
void PersistRemovePersQueueGroup(NIceDb::TNiceDb &db, TPathId pathId);
- void PersistAddPersQueueGroupAlter(NIceDb::TNiceDb &db, TPathId pathId, const TPersQueueGroupInfo::TPtr);
- void PersistRemovePersQueueGroupAlter(NIceDb::TNiceDb &db, TPathId pathId);
+ void PersistAddPersQueueGroupAlter(NIceDb::TNiceDb &db, TPathId pathId, const TPersQueueGroupInfo::TPtr);
+ void PersistRemovePersQueueGroupAlter(NIceDb::TNiceDb &db, TPathId pathId);
void PersistPersQueue(NIceDb::TNiceDb &db, TPathId pathId, TShardIdx shardIdx, const TPQShardInfo::TPersQueueInfo& pqInfo);
void PersistRemovePersQueue(NIceDb::TNiceDb &db, TPathId pathId, ui32 pqId);
- void PersistRtmrVolume(NIceDb::TNiceDb &db, TPathId pathId, const TRtmrVolumeInfo::TPtr rtmrVol);
+ void PersistRtmrVolume(NIceDb::TNiceDb &db, TPathId pathId, const TRtmrVolumeInfo::TPtr rtmrVol);
void PersistRemoveRtmrVolume(NIceDb::TNiceDb &db, TPathId pathId);
- void PersistSolomonVolume(NIceDb::TNiceDb &db, TPathId pathId, const TSolomonVolumeInfo::TPtr rtmrVol);
+ void PersistSolomonVolume(NIceDb::TNiceDb &db, TPathId pathId, const TSolomonVolumeInfo::TPtr rtmrVol);
void PersistRemoveSolomonVolume(NIceDb::TNiceDb &db, TPathId pathId);
- void PersistAlterSolomonVolume(NIceDb::TNiceDb &db, TPathId pathId, const TSolomonVolumeInfo::TPtr rtmrVol);
- static void PersistAddTxDependency(NIceDb::TNiceDb& db, const TTxId parentOpId, TTxId txId);
- static void PersistRemoveTxDependency(NIceDb::TNiceDb& db, TTxId opId, TTxId dependentOpId);
- void PersistUpdateTxShard(NIceDb::TNiceDb& db, TOperationId txId, TShardIdx shardIdx, ui32 operation);
- void PersistRemoveTxShard(NIceDb::TNiceDb& db, TOperationId txId, TShardIdx shardIdx);
- void PersistShardMapping(NIceDb::TNiceDb& db, TShardIdx shardIdx, TTabletId tabletId, TPathId pathId, TTxId txId, TTabletTypes::EType type);
- void PersistAdoptedShardMapping(NIceDb::TNiceDb& db, TShardIdx shardIdx, TTabletId tabletId, ui64 prevOwner, TLocalShardIdx prevShardIdx);
- void PersistShardPathId(NIceDb::TNiceDb& db, TShardIdx shardIdx, TPathId pathId);
- void PersistDeleteAdopted(NIceDb::TNiceDb& db, TShardIdx shardIdx);
-
- void PersistSnapshotTable(NIceDb::TNiceDb& db, const TTxId snapshotId, const TPathId tableId);
- void PersistSnapshotStepId(NIceDb::TNiceDb& db, const TTxId snapshotId, const TStepId stepId);
- void PersistDropSnapshot(NIceDb::TNiceDb& db, const TTxId snapshotId, const TPathId tableId);
- void PersistLongLock(NIceDb::TNiceDb& db, const TTxId lockId, const TPathId pathId);
- void PersistUnLock(NIceDb::TNiceDb& db, const TPathId pathId);
-
- void PersistTxState(NIceDb::TNiceDb& db, const TOperationId opId);
- void ChangeTxState(NIceDb::TNiceDb& db, const TOperationId opId, TTxState::ETxState newState);
+ void PersistAlterSolomonVolume(NIceDb::TNiceDb &db, TPathId pathId, const TSolomonVolumeInfo::TPtr rtmrVol);
+ static void PersistAddTxDependency(NIceDb::TNiceDb& db, const TTxId parentOpId, TTxId txId);
+ static void PersistRemoveTxDependency(NIceDb::TNiceDb& db, TTxId opId, TTxId dependentOpId);
+ void PersistUpdateTxShard(NIceDb::TNiceDb& db, TOperationId txId, TShardIdx shardIdx, ui32 operation);
+ void PersistRemoveTxShard(NIceDb::TNiceDb& db, TOperationId txId, TShardIdx shardIdx);
+ void PersistShardMapping(NIceDb::TNiceDb& db, TShardIdx shardIdx, TTabletId tabletId, TPathId pathId, TTxId txId, TTabletTypes::EType type);
+ void PersistAdoptedShardMapping(NIceDb::TNiceDb& db, TShardIdx shardIdx, TTabletId tabletId, ui64 prevOwner, TLocalShardIdx prevShardIdx);
+ void PersistShardPathId(NIceDb::TNiceDb& db, TShardIdx shardIdx, TPathId pathId);
+ void PersistDeleteAdopted(NIceDb::TNiceDb& db, TShardIdx shardIdx);
+
+ void PersistSnapshotTable(NIceDb::TNiceDb& db, const TTxId snapshotId, const TPathId tableId);
+ void PersistSnapshotStepId(NIceDb::TNiceDb& db, const TTxId snapshotId, const TStepId stepId);
+ void PersistDropSnapshot(NIceDb::TNiceDb& db, const TTxId snapshotId, const TPathId tableId);
+ void PersistLongLock(NIceDb::TNiceDb& db, const TTxId lockId, const TPathId pathId);
+ void PersistUnLock(NIceDb::TNiceDb& db, const TPathId pathId);
+
+ void PersistTxState(NIceDb::TNiceDb& db, const TOperationId opId);
+ void ChangeTxState(NIceDb::TNiceDb& db, const TOperationId opId, TTxState::ETxState newState);
void PersistCancelTx(NIceDb::TNiceDb& db, const TOperationId opId, const TTxState& txState);
- void PersistTxPlanStep(NIceDb::TNiceDb& db, TOperationId opId, TStepId step);
-
-
- void PersistShardTx(NIceDb::TNiceDb& db, TShardIdx shardIdx, TTxId txId);
+ void PersistTxPlanStep(NIceDb::TNiceDb& db, TOperationId opId, TStepId step);
+
+
+ void PersistShardTx(NIceDb::TNiceDb& db, TShardIdx shardIdx, TTxId txId);
void PersistUpdateNextPathId(NIceDb::TNiceDb& db) const;
void PersistUpdateNextShardIdx(NIceDb::TNiceDb& db) const;
- void PersistParentDomain(NIceDb::TNiceDb& db, TPathId parentDomain) const;
- void PersistParentDomainEffectiveACL(NIceDb::TNiceDb& db, const TString& owner, const TString& effectiveACL, ui64 effectiveACLVersion) const;
- void PersistShardsToDelete(NIceDb::TNiceDb& db, const THashSet<TShardIdx>& shardsIdxs);
- void PersistShardDeleted(NIceDb::TNiceDb& db, TShardIdx shardIdx, const TChannelsBindings& bindedChannels);
+ void PersistParentDomain(NIceDb::TNiceDb& db, TPathId parentDomain) const;
+ void PersistParentDomainEffectiveACL(NIceDb::TNiceDb& db, const TString& owner, const TString& effectiveACL, ui64 effectiveACLVersion) const;
+ void PersistShardsToDelete(NIceDb::TNiceDb& db, const THashSet<TShardIdx>& shardsIdxs);
+ void PersistShardDeleted(NIceDb::TNiceDb& db, TShardIdx shardIdx, const TChannelsBindings& bindedChannels);
void PersistUnknownShardDeleted(NIceDb::TNiceDb& db, TShardIdx shardIdx);
void PersistTxShardStatus(NIceDb::TNiceDb& db, TOperationId opId, TShardIdx shardIdx, const TTxState::TShardStatus& status);
- void PersistBackupSettings(NIceDb::TNiceDb& db, TPathId pathId, const NKikimrSchemeOp::TBackupTask& settings);
- void PersistBackupDone(NIceDb::TNiceDb& db, TPathId pathId);
+ void PersistBackupSettings(NIceDb::TNiceDb& db, TPathId pathId, const NKikimrSchemeOp::TBackupTask& settings);
+ void PersistBackupDone(NIceDb::TNiceDb& db, TPathId pathId);
void PersistCompletedBackupRestore(NIceDb::TNiceDb& db, TTxId txId, const TTxState& txState, const TTableInfo::TBackupRestoreResult& info, TTableInfo::TBackupRestoreResult::EKind kind);
void PersistCompletedBackup(NIceDb::TNiceDb& db, TTxId txId, const TTxState& txState, const TTableInfo::TBackupRestoreResult& backupInfo);
void PersistCompletedRestore(NIceDb::TNiceDb& db, TTxId txId, const TTxState& txState, const TTableInfo::TBackupRestoreResult& restoreInfo);
- void PersistSchemeLimit(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain);
- void PersistStoragePools(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain);
- void PersistSubDomain(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain);
+ void PersistSchemeLimit(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain);
+ void PersistStoragePools(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain);
+ void PersistSubDomain(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain);
void PersistRemoveSubDomain(NIceDb::TNiceDb& db, const TPathId& pathId);
- void PersistSubDomainVersion(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain);
- void PersistSubDomainAlter(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain);
+ void PersistSubDomainVersion(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain);
+ void PersistSubDomainAlter(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain);
void PersistSubDomainDeclaredSchemeQuotas(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain);
void PersistSubDomainDatabaseQuotas(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain);
void PersistSubDomainState(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain);
void PersistSubDomainSchemeQuotas(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain);
void PersistSubDomainSecurityStateVersion(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain);
- void PersistDeleteSubDomainAlter(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain);
- void PersistKesusInfo(NIceDb::TNiceDb& db, TPathId pathId, const TKesusInfo::TPtr);
- void PersistKesusVersion(NIceDb::TNiceDb& db, TPathId pathId, const TKesusInfo::TPtr);
- void PersistAddKesusAlter(NIceDb::TNiceDb& db, TPathId pathId, const TKesusInfo::TPtr);
- void PersistRemoveKesusAlter(NIceDb::TNiceDb& db, TPathId pathId);
+ void PersistDeleteSubDomainAlter(NIceDb::TNiceDb& db, const TPathId& pathId, const TSubDomainInfo& subDomain);
+ void PersistKesusInfo(NIceDb::TNiceDb& db, TPathId pathId, const TKesusInfo::TPtr);
+ void PersistKesusVersion(NIceDb::TNiceDb& db, TPathId pathId, const TKesusInfo::TPtr);
+ void PersistAddKesusAlter(NIceDb::TNiceDb& db, TPathId pathId, const TKesusInfo::TPtr);
+ void PersistRemoveKesusAlter(NIceDb::TNiceDb& db, TPathId pathId);
void PersistRemoveKesusInfo(NIceDb::TNiceDb& db, TPathId pathId);
- void PersistRemoveTableIndex(NIceDb::TNiceDb& db, TPathId tableId);
+ void PersistRemoveTableIndex(NIceDb::TNiceDb& db, TPathId tableId);
void PersistRemoveTable(NIceDb::TNiceDb& db, TPathId tableId, const TActorContext& ctx);
- void PersistRevertedMirgration(NIceDb::TNiceDb& db, TPathId pathId, TTabletId abandonedSchemeShardId);
+ void PersistRevertedMirgration(NIceDb::TNiceDb& db, TPathId pathId, TTabletId abandonedSchemeShardId);
// BlockStore
void PersistBlockStorePartition(NIceDb::TNiceDb& db, TPathId pathId, ui32 partitionId, TShardIdx shardIdx, ui64 version);
@@ -567,58 +567,58 @@ public:
void PersistReplicationAlter(NIceDb::TNiceDb& db, TPathId pathId, const TReplicationInfo& replicationInfo);
void PersistReplicationAlterRemove(NIceDb::TNiceDb& db, TPathId pathId);
- void PersistAddTableShardPartitionConfig(NIceDb::TNiceDb& db, TShardIdx shardIdx, const NKikimrSchemeOp::TPartitionConfig& config);
+ void PersistAddTableShardPartitionConfig(NIceDb::TNiceDb& db, TShardIdx shardIdx, const NKikimrSchemeOp::TPartitionConfig& config);
+
+ void PersistPublishingPath(NIceDb::TNiceDb& db, TTxId txId, TPathId pathId, ui64 version);
+ void PersistRemovePublishingPath(NIceDb::TNiceDb& db, TTxId txId, TPathId pathId, ui64 version);
- void PersistPublishingPath(NIceDb::TNiceDb& db, TTxId txId, TPathId pathId, ui64 version);
- void PersistRemovePublishingPath(NIceDb::TNiceDb& db, TTxId txId, TPathId pathId, ui64 version);
-
- void PersistInitState(NIceDb::TNiceDb& db);
-
- void PersistStorageBillingTime(NIceDb::TNiceDb& db);
-
- TTabletId GetGlobalHive(const TActorContext& ctx) const;
- TTabletId ResolveHive(TPathId pathId, const TActorContext& ctx) const;
- TTabletId ResolveHive(TShardIdx shardIdx, const TActorContext& ctx) const;
- TShardIdx GetShardIdx(TTabletId tabletId) const;
+ void PersistInitState(NIceDb::TNiceDb& db);
+
+ void PersistStorageBillingTime(NIceDb::TNiceDb& db);
+
+ TTabletId GetGlobalHive(const TActorContext& ctx) const;
+ TTabletId ResolveHive(TPathId pathId, const TActorContext& ctx) const;
+ TTabletId ResolveHive(TShardIdx shardIdx, const TActorContext& ctx) const;
+ TShardIdx GetShardIdx(TTabletId tabletId) const;
TShardIdx MustGetShardIdx(TTabletId tabletId) const;
TTabletTypes::EType GetTabletType(TTabletId tabletId) const;
- struct TTxMonitoring;
- //OnRenderAppHtmlPage
-
+ struct TTxMonitoring;
+ //OnRenderAppHtmlPage
+
struct TTxInit;
- NTabletFlatExecutor::ITransaction* CreateTxInit();
-
- struct TTxInitRoot;
- NTabletFlatExecutor::ITransaction* CreateTxInitRoot();
-
- struct TTxInitRootCompatibility;
+ NTabletFlatExecutor::ITransaction* CreateTxInit();
+
+ struct TTxInitRoot;
+ NTabletFlatExecutor::ITransaction* CreateTxInitRoot();
+
+ struct TTxInitRootCompatibility;
NTabletFlatExecutor::ITransaction* CreateTxInitRootCompatibility(TEvSchemeShard::TEvInitRootShard::TPtr &ev);
-
- struct TTxInitTenantSchemeShard;
- NTabletFlatExecutor::ITransaction* CreateTxInitTenantSchemeShard(TEvSchemeShard::TEvInitTenantSchemeShard::TPtr &ev);
-
- void ActivateAfterInitialization(const TActorContext &ctx,
- TSideEffects::TPublications&& delayPublications = {},
- const TVector<ui64>& exportIds = {},
- const TVector<ui64>& importsIds = {},
- TVector<TPathId>&& tablesToClean = {},
- TDeque<TPathId>&& blockStoreVolumesToClean = {}
- );
-
+
+ struct TTxInitTenantSchemeShard;
+ NTabletFlatExecutor::ITransaction* CreateTxInitTenantSchemeShard(TEvSchemeShard::TEvInitTenantSchemeShard::TPtr &ev);
+
+ void ActivateAfterInitialization(const TActorContext &ctx,
+ TSideEffects::TPublications&& delayPublications = {},
+ const TVector<ui64>& exportIds = {},
+ const TVector<ui64>& importsIds = {},
+ TVector<TPathId>&& tablesToClean = {},
+ TDeque<TPathId>&& blockStoreVolumesToClean = {}
+ );
+
struct TTxInitPopulator;
- NTabletFlatExecutor::ITransaction* CreateTxInitPopulator(TSideEffects::TPublications&& publications);
-
+ NTabletFlatExecutor::ITransaction* CreateTxInitPopulator(TSideEffects::TPublications&& publications);
+
struct TTxInitSchema;
- NTabletFlatExecutor::ITransaction* CreateTxInitSchema();
-
- struct TTxUpgradeSchema;
- NTabletFlatExecutor::ITransaction* CreateTxUpgradeSchema();
-
- struct TTxCleanTables;
- NTabletFlatExecutor::ITransaction* CreateTxCleanTables(TVector<TPathId> tablesToClean);
-
+ NTabletFlatExecutor::ITransaction* CreateTxInitSchema();
+
+ struct TTxUpgradeSchema;
+ NTabletFlatExecutor::ITransaction* CreateTxUpgradeSchema();
+
+ struct TTxCleanTables;
+ NTabletFlatExecutor::ITransaction* CreateTxCleanTables(TVector<TPathId> tablesToClean);
+
struct TTxCleanBlockStoreVolumes;
NTabletFlatExecutor::ITransaction* CreateTxCleanBlockStoreVolumes(TDeque<TPathId>&& blockStoreVolumes);
@@ -637,122 +637,122 @@ public:
void Handle(TEvPrivate::TEvCleanDroppedSubDomains::TPtr& ev, const TActorContext& ctx);
struct TTxFixBadPaths;
- NTabletFlatExecutor::ITransaction* CreateTxFixBadPaths();
-
- struct TTxPublishTenantAsReadOnly;
- NTabletFlatExecutor::ITransaction* CreateTxPublishTenantAsReadOnly(TEvSchemeShard::TEvPublishTenantAsReadOnly::TPtr &ev);
-
- struct TTxPublishTenant;
- NTabletFlatExecutor::ITransaction* CreateTxPublishTenant(TEvSchemeShard::TEvPublishTenant::TPtr &ev);
-
- struct TTxMigrate;
- NTabletFlatExecutor::ITransaction* CreateTxMigrate(TEvSchemeShard::TEvMigrateSchemeShard::TPtr &ev);
-
+ NTabletFlatExecutor::ITransaction* CreateTxFixBadPaths();
+
+ struct TTxPublishTenantAsReadOnly;
+ NTabletFlatExecutor::ITransaction* CreateTxPublishTenantAsReadOnly(TEvSchemeShard::TEvPublishTenantAsReadOnly::TPtr &ev);
+
+ struct TTxPublishTenant;
+ NTabletFlatExecutor::ITransaction* CreateTxPublishTenant(TEvSchemeShard::TEvPublishTenant::TPtr &ev);
+
+ struct TTxMigrate;
+ NTabletFlatExecutor::ITransaction* CreateTxMigrate(TEvSchemeShard::TEvMigrateSchemeShard::TPtr &ev);
+
struct TTxDescribeScheme;
- NTabletFlatExecutor::ITransaction* CreateTxDescribeScheme(TEvSchemeShard::TEvDescribeScheme::TPtr &ev);
-
+ NTabletFlatExecutor::ITransaction* CreateTxDescribeScheme(TEvSchemeShard::TEvDescribeScheme::TPtr &ev);
+
struct TTxNotifyCompletion;
- NTabletFlatExecutor::ITransaction* CreateTxNotifyTxCompletion(TEvSchemeShard::TEvNotifyTxCompletion::TPtr &ev);
-
+ NTabletFlatExecutor::ITransaction* CreateTxNotifyTxCompletion(TEvSchemeShard::TEvNotifyTxCompletion::TPtr &ev);
+
struct TTxDeleteTabletReply;
- NTabletFlatExecutor::ITransaction* CreateTxDeleteTabletReply(TEvHive::TEvDeleteTabletReply::TPtr& ev);
-
+ NTabletFlatExecutor::ITransaction* CreateTxDeleteTabletReply(TEvHive::TEvDeleteTabletReply::TPtr& ev);
+
struct TTxShardStateChanged;
- NTabletFlatExecutor::ITransaction* CreateTxShardStateChanged(TEvDataShard::TEvStateChanged::TPtr& ev);
-
+ NTabletFlatExecutor::ITransaction* CreateTxShardStateChanged(TEvDataShard::TEvStateChanged::TPtr& ev);
+
struct TTxRunConditionalErase;
NTabletFlatExecutor::ITransaction* CreateTxRunConditionalErase(TEvPrivate::TEvRunConditionalErase::TPtr& ev);
struct TTxScheduleConditionalErase;
NTabletFlatExecutor::ITransaction* CreateTxScheduleConditionalErase(TEvDataShard::TEvConditionalEraseRowsResponse::TPtr& ev);
- struct TTxSyncTenant;
- NTabletFlatExecutor::ITransaction* CreateTxSyncTenant(TPathId tabletId);
- struct TTxUpdateTenant;
- NTabletFlatExecutor::ITransaction* CreateTxUpdateTenant(TEvSchemeShard::TEvUpdateTenantSchemeShard::TPtr& ev);
+ struct TTxSyncTenant;
+ NTabletFlatExecutor::ITransaction* CreateTxSyncTenant(TPathId tabletId);
+ struct TTxUpdateTenant;
+ NTabletFlatExecutor::ITransaction* CreateTxUpdateTenant(TEvSchemeShard::TEvUpdateTenantSchemeShard::TPtr& ev);
struct TTxPublishToSchemeBoard;
NTabletFlatExecutor::ITransaction* CreateTxPublishToSchemeBoard(THashMap<TTxId, TDeque<TPathId>>&& paths);
struct TTxAckPublishToSchemeBoard;
NTabletFlatExecutor::ITransaction* CreateTxAckPublishToSchemeBoard(TSchemeBoardEvents::TEvUpdateAck::TPtr& ev);
- struct TTxOperationPropose;
- NTabletFlatExecutor::ITransaction* CreateTxOperationPropose(TEvSchemeShard::TEvModifySchemeTransaction::TPtr& ev);
-
+ struct TTxOperationPropose;
+ NTabletFlatExecutor::ITransaction* CreateTxOperationPropose(TEvSchemeShard::TEvModifySchemeTransaction::TPtr& ev);
+
struct TTxOperationProposeCancelTx;
- NTabletFlatExecutor::ITransaction* CreateTxOperationPropose(TEvSchemeShard::TEvCancelTx::TPtr& ev);
-
- struct TTxOperationProgress;
- NTabletFlatExecutor::ITransaction* CreateTxOperationProgress(TOperationId opId);
-
- struct TTxOperationPlanStep;
- NTabletFlatExecutor::ITransaction* CreateTxOperationPlanStep(TEvTxProcessing::TEvPlanStep::TPtr& ev);
-
- struct TTxUpgradeAccessDatabaseRights;
+ NTabletFlatExecutor::ITransaction* CreateTxOperationPropose(TEvSchemeShard::TEvCancelTx::TPtr& ev);
+
+ struct TTxOperationProgress;
+ NTabletFlatExecutor::ITransaction* CreateTxOperationProgress(TOperationId opId);
+
+ struct TTxOperationPlanStep;
+ NTabletFlatExecutor::ITransaction* CreateTxOperationPlanStep(TEvTxProcessing::TEvPlanStep::TPtr& ev);
+
+ struct TTxUpgradeAccessDatabaseRights;
NTabletFlatExecutor::ITransaction* CreateTxUpgradeAccessDatabaseRights(const TActorId& answerTo, bool isDryRun, std::function< NActors::IEventBase* (const TMap<TPathId, TSet<TString>>&) >);
-
- struct TTxMakeAccessDatabaseNoInheritable;
- NTabletFlatExecutor::ITransaction* CreateTxMakeAccessDatabaseNoInheritable(const TActorId& answerTo, bool isDryRun, std::function< NActors::IEventBase* (const TMap<TPathId, TSet<TString>>&) >);
-
- struct TTxServerlessStorageBilling;
- NTabletFlatExecutor::ITransaction* CreateTxServerlessStorageBilling();
-
+
+ struct TTxMakeAccessDatabaseNoInheritable;
+ NTabletFlatExecutor::ITransaction* CreateTxMakeAccessDatabaseNoInheritable(const TActorId& answerTo, bool isDryRun, std::function< NActors::IEventBase* (const TMap<TPathId, TSet<TString>>&) >);
+
+ struct TTxServerlessStorageBilling;
+ NTabletFlatExecutor::ITransaction* CreateTxServerlessStorageBilling();
+
struct TTxLogin;
- NTabletFlatExecutor::ITransaction* CreateTxLogin(TEvSchemeShard::TEvLogin::TPtr &ev);
-
-
- template<class T> struct TTxOperationReply;
-#define DeclareCreateTxOperationReply(TEvType, TxType) \
- NTabletFlatExecutor::ITransaction* CreateTxOperationReply(TOperationId id, TEvType::TPtr& ev);
- SCHEMESHARD_INCOMING_EVENTS(DeclareCreateTxOperationReply)
-#undef DeclareCreateTxOperationReply
-
+ NTabletFlatExecutor::ITransaction* CreateTxLogin(TEvSchemeShard::TEvLogin::TPtr &ev);
+
+
+ template<class T> struct TTxOperationReply;
+#define DeclareCreateTxOperationReply(TEvType, TxType) \
+ NTabletFlatExecutor::ITransaction* CreateTxOperationReply(TOperationId id, TEvType::TPtr& ev);
+ SCHEMESHARD_INCOMING_EVENTS(DeclareCreateTxOperationReply)
+#undef DeclareCreateTxOperationReply
+
void PublishToSchemeBoard(THashMap<TTxId, TDeque<TPathId>>&& paths, const TActorContext& ctx);
void PublishToSchemeBoard(TTxId txId, TDeque<TPathId>&& paths, const TActorContext& ctx);
-
+
void ApplyPartitionConfigStoragePatch(
- NKikimrSchemeOp::TPartitionConfig& config,
- const NKikimrSchemeOp::TPartitionConfig& patch) const;
+ NKikimrSchemeOp::TPartitionConfig& config,
+ const NKikimrSchemeOp::TPartitionConfig& patch) const;
void FillTableDescriptionForShardIdx(
- TPathId tableId, TShardIdx shardIdx, NKikimrSchemeOp::TTableDescription* tableDescr,
+ TPathId tableId, TShardIdx shardIdx, NKikimrSchemeOp::TTableDescription* tableDescr,
TString rangeBegin, TString rangeEnd,
bool rangeBeginInclusive, bool rangeEndInclusive,
bool newTable = false);
- void FillTableDescription(TPathId tableId, ui32 partitionIdx, ui64 schemaVersion, NKikimrSchemeOp::TTableDescription* tableDescr);
+ void FillTableDescription(TPathId tableId, ui32 partitionIdx, ui64 schemaVersion, NKikimrSchemeOp::TTableDescription* tableDescr);
static bool FillUniformPartitioning(TVector<TString>& rangeEnds, ui32 keySize, NScheme::TTypeId firstKeyColType,
ui32 partitionCount, const NScheme::TTypeRegistry* typeRegistry, TString& errStr);
static bool FillSplitPartitioning(TVector<TString>& rangeEnds, const TConstArrayRef<NScheme::TTypeId>& keyColTypes,
- const ::google::protobuf::RepeatedPtrField<NKikimrSchemeOp::TSplitBoundary>& boundaries,
+ const ::google::protobuf::RepeatedPtrField<NKikimrSchemeOp::TSplitBoundary>& boundaries,
TString& errStr);
- TString FillAlterTableTxBody(TPathId tableId, TShardIdx shardIdx, TMessageSeqNo seqNo) const;
- TString FillBackupTxBody(TPathId pathId, const NKikimrSchemeOp::TBackupTask& task, ui32 shardNum, TMessageSeqNo seqNo) const;
+ TString FillAlterTableTxBody(TPathId tableId, TShardIdx shardIdx, TMessageSeqNo seqNo) const;
+ TString FillBackupTxBody(TPathId pathId, const NKikimrSchemeOp::TBackupTask& task, ui32 shardNum, TMessageSeqNo seqNo) const;
- static void FillSeqNo(NKikimrTxDataShard::TFlatSchemeTransaction &tx, TMessageSeqNo seqNo);
+ static void FillSeqNo(NKikimrTxDataShard::TFlatSchemeTransaction &tx, TMessageSeqNo seqNo);
static void FillSeqNo(NKikimrTxColumnShard::TSchemaTxBody &tx, TMessageSeqNo seqNo);
void FillAsyncIndexInfo(const TPathId& tableId, NKikimrTxDataShard::TFlatSchemeTransaction& tx);
void DescribeTable(const TTableInfo::TPtr tableInfo, const NScheme::TTypeRegistry* typeRegistry,
- bool fillConfig, bool fillBoundaries, NKikimrSchemeOp::TTableDescription* entry) const;
- void DescribeTableIndex(const TPathId& pathId, const TString& name, NKikimrSchemeOp::TIndexDescription& entry);
- void DescribeTableIndex(const TPathId& pathId, const TString& name, TTableIndexInfo::TPtr indexInfo, NKikimrSchemeOp::TIndexDescription& entry);
- void DescribeCdcStream(const TPathId& pathId, const TString& name, NKikimrSchemeOp::TCdcStreamDescription& desc);
- void DescribeCdcStream(const TPathId& pathId, const TString& name, TCdcStreamInfo::TPtr info, NKikimrSchemeOp::TCdcStreamDescription& desc);
- void DescribeSequence(const TPathId& pathId, const TString& name, NKikimrSchemeOp::TSequenceDescription& desc);
- void DescribeSequence(const TPathId& pathId, const TString& name, TSequenceInfo::TPtr info, NKikimrSchemeOp::TSequenceDescription& desc);
+ bool fillConfig, bool fillBoundaries, NKikimrSchemeOp::TTableDescription* entry) const;
+ void DescribeTableIndex(const TPathId& pathId, const TString& name, NKikimrSchemeOp::TIndexDescription& entry);
+ void DescribeTableIndex(const TPathId& pathId, const TString& name, TTableIndexInfo::TPtr indexInfo, NKikimrSchemeOp::TIndexDescription& entry);
+ void DescribeCdcStream(const TPathId& pathId, const TString& name, NKikimrSchemeOp::TCdcStreamDescription& desc);
+ void DescribeCdcStream(const TPathId& pathId, const TString& name, TCdcStreamInfo::TPtr info, NKikimrSchemeOp::TCdcStreamDescription& desc);
+ void DescribeSequence(const TPathId& pathId, const TString& name, NKikimrSchemeOp::TSequenceDescription& desc);
+ void DescribeSequence(const TPathId& pathId, const TString& name, TSequenceInfo::TPtr info, NKikimrSchemeOp::TSequenceDescription& desc);
void DescribeReplication(const TPathId& pathId, const TString& name, NKikimrSchemeOp::TReplicationDescription& desc);
void DescribeReplication(const TPathId& pathId, const TString& name, TReplicationInfo::TPtr info, NKikimrSchemeOp::TReplicationDescription& desc);
- static void FillTableBoundaries(const TTableInfo::TPtr tableInfo, google::protobuf::RepeatedPtrField<NKikimrSchemeOp::TSplitBoundary>& boundaries);
+ static void FillTableBoundaries(const TTableInfo::TPtr tableInfo, google::protobuf::RepeatedPtrField<NKikimrSchemeOp::TSplitBoundary>& boundaries);
- void Handle(TEvSchemeShard::TEvInitRootShard::TPtr &ev, const TActorContext &ctx);
- void Handle(TEvSchemeShard::TEvInitTenantSchemeShard::TPtr &ev, const TActorContext &ctx);
-
- void Handle(TEvSchemeShard::TEvModifySchemeTransaction::TPtr &ev, const TActorContext &ctx);
- void Handle(TEvSchemeShard::TEvDescribeScheme::TPtr &ev, const TActorContext &ctx);
- void Handle(TEvSchemeShard::TEvNotifyTxCompletion::TPtr &ev, const TActorContext &ctx);
+ void Handle(TEvSchemeShard::TEvInitRootShard::TPtr &ev, const TActorContext &ctx);
+ void Handle(TEvSchemeShard::TEvInitTenantSchemeShard::TPtr &ev, const TActorContext &ctx);
- void Handle(TEvSchemeShard::TEvCancelTx::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvSchemeShard::TEvModifySchemeTransaction::TPtr &ev, const TActorContext &ctx);
+ void Handle(TEvSchemeShard::TEvDescribeScheme::TPtr &ev, const TActorContext &ctx);
+ void Handle(TEvSchemeShard::TEvNotifyTxCompletion::TPtr &ev, const TActorContext &ctx);
+
+ void Handle(TEvSchemeShard::TEvCancelTx::TPtr& ev, const TActorContext& ctx);
void Handle(TEvPrivate::TEvProgressOperation::TPtr &ev, const TActorContext &ctx);
@@ -762,10 +762,10 @@ public:
void Handle(TEvTabletPipe::TEvServerDisconnected::TPtr &ev, const TActorContext &ctx);
void Handle(TEvHive::TEvCreateTabletReply::TPtr &ev, const TActorContext &ctx);
- void Handle(TEvHive::TEvAdoptTabletReply::TPtr &ev, const TActorContext &ctx);
+ void Handle(TEvHive::TEvAdoptTabletReply::TPtr &ev, const TActorContext &ctx);
void Handle(TEvHive::TEvDeleteTabletReply::TPtr &ev, const TActorContext &ctx);
void Handle(TEvPrivate::TEvSubscribeToShardDeletion::TPtr &ev, const TActorContext &ctx);
- void Handle(TEvHive::TEvDeleteOwnerTabletsReply::TPtr &ev, const TActorContext &ctx);
+ void Handle(TEvHive::TEvDeleteOwnerTabletsReply::TPtr &ev, const TActorContext &ctx);
void Handle(TEvPersQueue::TEvDropTabletReply::TPtr &ev, const TActorContext &ctx);
void Handle(TEvColumnShard::TEvProposeTransactionResult::TPtr &ev, const TActorContext &ctx);
void Handle(TEvColumnShard::TEvNotifyTxCompletionResult::TPtr &ev, const TActorContext &ctx);
@@ -781,28 +781,28 @@ public:
void Handle(TEvDataShard::TEvSchemaChanged::TPtr &ev, const TActorContext &ctx);
void Handle(TEvDataShard::TEvStateChanged::TPtr &ev, const TActorContext &ctx);
void Handle(TEvPersQueue::TEvUpdateConfigResponse::TPtr &ev, const TActorContext &ctx);
- void Handle(TEvSubDomain::TEvConfigureStatus::TPtr &ev, const TActorContext &ctx);
+ void Handle(TEvSubDomain::TEvConfigureStatus::TPtr &ev, const TActorContext &ctx);
void Handle(TEvBlockStore::TEvUpdateVolumeConfigResponse::TPtr& ev, const TActorContext& ctx);
void Handle(TEvFileStore::TEvUpdateConfigResponse::TPtr& ev, const TActorContext& ctx);
void Handle(NKesus::TEvKesus::TEvSetConfigResult::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvSchemeShard::TEvInitTenantSchemeShardResult::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvSchemeShard::TEvPublishTenantAsReadOnly::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvSchemeShard::TEvPublishTenantAsReadOnlyResult::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvSchemeShard::TEvPublishTenant::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvSchemeShard::TEvPublishTenantResult::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvSchemeShard::TEvMigrateSchemeShard::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvSchemeShard::TEvMigrateSchemeShardResult::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvDataShard::TEvMigrateSchemeShardResponse::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvSchemeShard::TEvInitTenantSchemeShardResult::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvSchemeShard::TEvPublishTenantAsReadOnly::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvSchemeShard::TEvPublishTenantAsReadOnlyResult::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvSchemeShard::TEvPublishTenant::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvSchemeShard::TEvPublishTenantResult::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvSchemeShard::TEvMigrateSchemeShard::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvSchemeShard::TEvMigrateSchemeShardResult::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvDataShard::TEvMigrateSchemeShardResponse::TPtr& ev, const TActorContext& ctx);
void Handle(TEvDataShard::TEvCompactTableResult::TPtr &ev, const TActorContext &ctx);
-
- void Handle(TEvSchemeShard::TEvSyncTenantSchemeShard::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvSchemeShard::TEvUpdateTenantSchemeShard::TPtr& ev, const TActorContext& ctx);
+
+ void Handle(TEvSchemeShard::TEvSyncTenantSchemeShard::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvSchemeShard::TEvUpdateTenantSchemeShard::TPtr& ev, const TActorContext& ctx);
void Handle(TSchemeBoardEvents::TEvUpdateAck::TPtr& ev, const TActorContext& ctx);
-
+
void Handle(TEvTxProcessing::TEvPlanStep::TPtr &ev, const TActorContext &ctx);
- void Handle(TEvents::TEvPoisonPill::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvents::TEvPoisonPill::TPtr& ev, const TActorContext& ctx);
void Handle(NMon::TEvRemoteHttpInfo::TPtr& ev, const TActorContext& ctx);
void Handle(TEvDataShard::TEvInitSplitMergeDestinationAck::TPtr& ev, const TActorContext& ctx);
@@ -812,7 +812,7 @@ public:
void Handle(TEvDataShard::TEvPeriodicTableStats::TPtr& ev, const TActorContext& ctx);
void Handle(TEvDataShard::TEvGetTableStatsResult::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvSchemeShard::TEvFindTabletSubDomainPathId::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvSchemeShard::TEvFindTabletSubDomainPathId::TPtr& ev, const TActorContext& ctx);
void ScheduleConditionalEraseRun(const TActorContext& ctx);
void Handle(TEvPrivate::TEvRunConditionalErase::TPtr& ev, const TActorContext& ctx);
@@ -820,18 +820,18 @@ public:
void Handle(NSysView::TEvSysView::TEvGetPartitionStats::TPtr& ev, const TActorContext& ctx);
- void ScheduleServerlessStorageBilling(const TActorContext& ctx);
- void Handle(TEvPrivate::TEvServerlessStorageBilling::TPtr& ev, const TActorContext& ctx);
-
- void Handle(NConsole::TEvConfigsDispatcher::TEvSetConfigSubscriptionResponse::TPtr &ev, const TActorContext &ctx);
- void Handle(NConsole::TEvConsole::TEvConfigNotificationRequest::TPtr &ev, const TActorContext &ctx);
-
- void Handle(TEvSchemeShard::TEvLogin::TPtr& ev, const TActorContext& ctx);
+ void ScheduleServerlessStorageBilling(const TActorContext& ctx);
+ void Handle(TEvPrivate::TEvServerlessStorageBilling::TPtr& ev, const TActorContext& ctx);
+
+ void Handle(NConsole::TEvConfigsDispatcher::TEvSetConfigSubscriptionResponse::TPtr &ev, const TActorContext &ctx);
+ void Handle(NConsole::TEvConsole::TEvConfigNotificationRequest::TPtr &ev, const TActorContext &ctx);
+
+ void Handle(TEvSchemeShard::TEvLogin::TPtr& ev, const TActorContext& ctx);
- void RestartPipeTx(TTabletId tabletId, const TActorContext& ctx);
+ void RestartPipeTx(TTabletId tabletId, const TActorContext& ctx);
+
+ TOperationId RouteIncomming(TTabletId tabletId, const TActorContext& ctx);
- TOperationId RouteIncomming(TTabletId tabletId, const TActorContext& ctx);
-
// namespace NLongRunningCommon {
struct TXxport {
class TTxBase;
@@ -840,14 +840,14 @@ public:
};
void Handle(TEvTxAllocatorClient::TEvAllocateResult::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& ev, const TActorContext& ctx);
void Handle(TEvIndexBuilder::TEvCreateResponse::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvSchemeShard::TEvNotifyTxCompletionRegistered::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvSchemeShard::TEvCancelTxResult::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvSchemeShard::TEvNotifyTxCompletionRegistered::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvSchemeShard::TEvCancelTxResult::TPtr& ev, const TActorContext& ctx);
void Handle(TEvIndexBuilder::TEvCancelResponse::TPtr& ev, const TActorContext& ctx);
// } // NLongRunningCommon
-
+
// namespace NExport {
THashMap<ui64, TExportInfo::TPtr> Exports;
THashMap<TString, TExportInfo::TPtr> ExportsByUid;
@@ -871,18 +871,18 @@ public:
struct TTxProgress;
};
-
+
NTabletFlatExecutor::ITransaction* CreateTxCreateExport(TEvExport::TEvCreateExportRequest::TPtr& ev);
NTabletFlatExecutor::ITransaction* CreateTxGetExport(TEvExport::TEvGetExportRequest::TPtr& ev);
NTabletFlatExecutor::ITransaction* CreateTxCancelExport(TEvExport::TEvCancelExportRequest::TPtr& ev);
- NTabletFlatExecutor::ITransaction* CreateTxCancelExportAck(TEvSchemeShard::TEvCancelTxResult::TPtr& ev);
+ NTabletFlatExecutor::ITransaction* CreateTxCancelExportAck(TEvSchemeShard::TEvCancelTxResult::TPtr& ev);
NTabletFlatExecutor::ITransaction* CreateTxForgetExport(TEvExport::TEvForgetExportRequest::TPtr& ev);
NTabletFlatExecutor::ITransaction* CreateTxListExports(TEvExport::TEvListExportsRequest::TPtr& ev);
NTabletFlatExecutor::ITransaction* CreateTxProgressExport(ui64 id);
NTabletFlatExecutor::ITransaction* CreateTxProgressExport(TEvTxAllocatorClient::TEvAllocateResult::TPtr& ev);
- NTabletFlatExecutor::ITransaction* CreateTxProgressExport(TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& ev);
- NTabletFlatExecutor::ITransaction* CreateTxProgressExport(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev);
+ NTabletFlatExecutor::ITransaction* CreateTxProgressExport(TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& ev);
+ NTabletFlatExecutor::ITransaction* CreateTxProgressExport(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev);
void Handle(TEvExport::TEvCreateExportRequest::TPtr& ev, const TActorContext& ctx);
void Handle(TEvExport::TEvGetExportRequest::TPtr& ev, const TActorContext& ctx);
@@ -892,7 +892,7 @@ public:
void ResumeExports(const TVector<ui64>& exportIds, const TActorContext& ctx);
// } // NExport
-
+
// namespace NImport {
THashMap<ui64, TImportInfo::TPtr> Imports;
THashMap<TString, TImportInfo::TPtr> ImportsByUid;
@@ -921,7 +921,7 @@ public:
NTabletFlatExecutor::ITransaction* CreateTxCreateImport(TEvImport::TEvCreateImportRequest::TPtr& ev);
NTabletFlatExecutor::ITransaction* CreateTxGetImport(TEvImport::TEvGetImportRequest::TPtr& ev);
NTabletFlatExecutor::ITransaction* CreateTxCancelImport(TEvImport::TEvCancelImportRequest::TPtr& ev);
- NTabletFlatExecutor::ITransaction* CreateTxCancelImportAck(TEvSchemeShard::TEvCancelTxResult::TPtr& ev);
+ NTabletFlatExecutor::ITransaction* CreateTxCancelImportAck(TEvSchemeShard::TEvCancelTxResult::TPtr& ev);
NTabletFlatExecutor::ITransaction* CreateTxCancelImportAck(TEvIndexBuilder::TEvCancelResponse::TPtr& ev);
NTabletFlatExecutor::ITransaction* CreateTxForgetImport(TEvImport::TEvForgetImportRequest::TPtr& ev);
NTabletFlatExecutor::ITransaction* CreateTxListImports(TEvImport::TEvListImportsRequest::TPtr& ev);
@@ -929,9 +929,9 @@ public:
NTabletFlatExecutor::ITransaction* CreateTxProgressImport(ui64 id);
NTabletFlatExecutor::ITransaction* CreateTxProgressImport(TEvPrivate::TEvImportSchemeReady::TPtr& ev);
NTabletFlatExecutor::ITransaction* CreateTxProgressImport(TEvTxAllocatorClient::TEvAllocateResult::TPtr& ev);
- NTabletFlatExecutor::ITransaction* CreateTxProgressImport(TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& ev);
+ NTabletFlatExecutor::ITransaction* CreateTxProgressImport(TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& ev);
NTabletFlatExecutor::ITransaction* CreateTxProgressImport(TEvIndexBuilder::TEvCreateResponse::TPtr& ev);
- NTabletFlatExecutor::ITransaction* CreateTxProgressImport(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev);
+ NTabletFlatExecutor::ITransaction* CreateTxProgressImport(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev);
void Handle(TEvImport::TEvCreateImportRequest::TPtr& ev, const TActorContext& ctx);
void Handle(TEvImport::TEvGetImportRequest::TPtr& ev, const TActorContext& ctx);
@@ -943,39 +943,39 @@ public:
void ResumeImports(const TVector<ui64>& ids, const TActorContext& ctx);
// } // NImport
- void FillTableSchemaVersion(ui64 schemaVersion, NKikimrSchemeOp::TTableDescription *tableDescr) const;
+ void FillTableSchemaVersion(ui64 schemaVersion, NKikimrSchemeOp::TTableDescription *tableDescr) const;
- // namespace NIndexBuilder {
+ // namespace NIndexBuilder {
TControlWrapper AllowDataColumnForIndexTable;
TControlWrapper EnableAsyncIndexes;
- TControlWrapper EnableSchemeTransactionsAtSchemeShard;
-
- THashMap<TIndexBuildId, TIndexBuildInfo::TPtr> IndexBuilds;
- THashMap<TString, TIndexBuildInfo::TPtr> IndexBuildsByUid;
- THashMap<TTxId, TIndexBuildId> TxIdToIndexBuilds;
-
- // do not share pipes with operations
- // alse do not share pipes between IndexBuilds
- struct TDedicatedPipePool {
- using TMessage = std::pair<ui32, TIntrusivePtr<TEventSerializedData>>;
- using TOwnerRec = std::pair<TIndexBuildId, TTabletId>;
- NTabletPipe::TClientConfig PipeCfg;
-
- TMap<TIndexBuildId, TMap<TTabletId, TActorId>> Pipes;
+ TControlWrapper EnableSchemeTransactionsAtSchemeShard;
+
+ THashMap<TIndexBuildId, TIndexBuildInfo::TPtr> IndexBuilds;
+ THashMap<TString, TIndexBuildInfo::TPtr> IndexBuildsByUid;
+ THashMap<TTxId, TIndexBuildId> TxIdToIndexBuilds;
+
+ // do not share pipes with operations
+ // alse do not share pipes between IndexBuilds
+ struct TDedicatedPipePool {
+ using TMessage = std::pair<ui32, TIntrusivePtr<TEventSerializedData>>;
+ using TOwnerRec = std::pair<TIndexBuildId, TTabletId>;
+ NTabletPipe::TClientConfig PipeCfg;
+
+ TMap<TIndexBuildId, TMap<TTabletId, TActorId>> Pipes;
TMap<TActorId, TOwnerRec> Owners;
-
- TDedicatedPipePool();
-
- void Create(TIndexBuildId ownerTxId, TTabletId dst, THolder<IEventBase> message, const TActorContext& ctx);
- void Close(TIndexBuildId ownerTxId, TTabletId dst, const TActorContext& ctx);
- ui64 CloseAll(TIndexBuildId ownerTxId, const TActorContext& ctx);
-
+
+ TDedicatedPipePool();
+
+ void Create(TIndexBuildId ownerTxId, TTabletId dst, THolder<IEventBase> message, const TActorContext& ctx);
+ void Close(TIndexBuildId ownerTxId, TTabletId dst, const TActorContext& ctx);
+ ui64 CloseAll(TIndexBuildId ownerTxId, const TActorContext& ctx);
+
bool Has(TActorId actorId) const;
- TTabletId GetTabletId(TActorId actorId) const;
- TIndexBuildId GetOwnerId(TActorId actorId) const;
- };
- TDedicatedPipePool IndexBuildPipes;
-
+ TTabletId GetTabletId(TActorId actorId) const;
+ TIndexBuildId GetOwnerId(TActorId actorId) const;
+ };
+ TDedicatedPipePool IndexBuildPipes;
+
void PersistCreateBuildIndex(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo);
void PersistBuildIndexState(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo);
void PersistBuildIndexIssue(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo);
@@ -999,55 +999,55 @@ public:
void PersistBuildIndexUploadProgress(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo, const TShardIdx& shardIdx);
void PersistBuildIndexUploadInitiate(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo, const TShardIdx& shardIdx);
- void PersistBuildIndexBilling(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo);
+ void PersistBuildIndexBilling(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo);
void PersistBuildIndexForget(NIceDb::TNiceDb& db, const TIndexBuildInfo::TPtr indexInfo);
- struct TIndexBuilder {
- class TTxBase;
-
- class TTxCreate;
- struct TTxGet;
- struct TTxCancel;
- struct TTxForget;
- struct TTxList;
-
- struct TTxProgress;
- struct TTxReply;
-
- struct TTxPipeReset;
- struct TTxBilling;
- };
-
- NTabletFlatExecutor::ITransaction* CreateTxCreate(TEvIndexBuilder::TEvCreateRequest::TPtr& ev);
- NTabletFlatExecutor::ITransaction* CreateTxGet(TEvIndexBuilder::TEvGetRequest::TPtr& ev);
- NTabletFlatExecutor::ITransaction* CreateTxCancel(TEvIndexBuilder::TEvCancelRequest::TPtr& ev);
- NTabletFlatExecutor::ITransaction* CreateTxForget(TEvIndexBuilder::TEvForgetRequest::TPtr& ev);
- NTabletFlatExecutor::ITransaction* CreateTxList(TEvIndexBuilder::TEvListRequest::TPtr& ev);
- NTabletFlatExecutor::ITransaction* CreateTxProgress(TIndexBuildId id);
- NTabletFlatExecutor::ITransaction* CreateTxReply(TEvTxAllocatorClient::TEvAllocateResult::TPtr& allocateResult);
- NTabletFlatExecutor::ITransaction* CreateTxReply(TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& modifyResult);
- NTabletFlatExecutor::ITransaction* CreateTxReply(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& modifyResult);
- NTabletFlatExecutor::ITransaction* CreateTxReply(TEvDataShard::TEvBuildIndexProgressResponse::TPtr& progress);
- NTabletFlatExecutor::ITransaction* CreatePipeRetry(TIndexBuildId indexBuildId, TTabletId tabletId);
- NTabletFlatExecutor::ITransaction* CreateTxBilling(TEvPrivate::TEvIndexBuildingMakeABill::TPtr& ev);
-
-
- void Handle(TEvIndexBuilder::TEvCreateRequest::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvIndexBuilder::TEvGetRequest::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvIndexBuilder::TEvCancelRequest::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvIndexBuilder::TEvForgetRequest::TPtr& ev, const TActorContext& ctx);
- void Handle(TEvIndexBuilder::TEvListRequest::TPtr& ev, const TActorContext& ctx);
-
- void Handle(TEvDataShard::TEvBuildIndexProgressResponse::TPtr& ev, const TActorContext& ctx);
-
- void Handle(TEvPrivate::TEvIndexBuildingMakeABill::TPtr& ev, const TActorContext& ctx);
-
- void Resume(const TDeque<TIndexBuildId>& indexIds, const TActorContext& ctx);
- void SetupRouting(const TDeque<TIndexBuildId>& indexIds, const TActorContext& ctx);
-
- // } //NIndexBuilder
-
+ struct TIndexBuilder {
+ class TTxBase;
+
+ class TTxCreate;
+ struct TTxGet;
+ struct TTxCancel;
+ struct TTxForget;
+ struct TTxList;
+
+ struct TTxProgress;
+ struct TTxReply;
+
+ struct TTxPipeReset;
+ struct TTxBilling;
+ };
+
+ NTabletFlatExecutor::ITransaction* CreateTxCreate(TEvIndexBuilder::TEvCreateRequest::TPtr& ev);
+ NTabletFlatExecutor::ITransaction* CreateTxGet(TEvIndexBuilder::TEvGetRequest::TPtr& ev);
+ NTabletFlatExecutor::ITransaction* CreateTxCancel(TEvIndexBuilder::TEvCancelRequest::TPtr& ev);
+ NTabletFlatExecutor::ITransaction* CreateTxForget(TEvIndexBuilder::TEvForgetRequest::TPtr& ev);
+ NTabletFlatExecutor::ITransaction* CreateTxList(TEvIndexBuilder::TEvListRequest::TPtr& ev);
+ NTabletFlatExecutor::ITransaction* CreateTxProgress(TIndexBuildId id);
+ NTabletFlatExecutor::ITransaction* CreateTxReply(TEvTxAllocatorClient::TEvAllocateResult::TPtr& allocateResult);
+ NTabletFlatExecutor::ITransaction* CreateTxReply(TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& modifyResult);
+ NTabletFlatExecutor::ITransaction* CreateTxReply(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& modifyResult);
+ NTabletFlatExecutor::ITransaction* CreateTxReply(TEvDataShard::TEvBuildIndexProgressResponse::TPtr& progress);
+ NTabletFlatExecutor::ITransaction* CreatePipeRetry(TIndexBuildId indexBuildId, TTabletId tabletId);
+ NTabletFlatExecutor::ITransaction* CreateTxBilling(TEvPrivate::TEvIndexBuildingMakeABill::TPtr& ev);
+
+
+ void Handle(TEvIndexBuilder::TEvCreateRequest::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvIndexBuilder::TEvGetRequest::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvIndexBuilder::TEvCancelRequest::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvIndexBuilder::TEvForgetRequest::TPtr& ev, const TActorContext& ctx);
+ void Handle(TEvIndexBuilder::TEvListRequest::TPtr& ev, const TActorContext& ctx);
+
+ void Handle(TEvDataShard::TEvBuildIndexProgressResponse::TPtr& ev, const TActorContext& ctx);
+
+ void Handle(TEvPrivate::TEvIndexBuildingMakeABill::TPtr& ev, const TActorContext& ctx);
+
+ void Resume(const TDeque<TIndexBuildId>& indexIds, const TActorContext& ctx);
+ void SetupRouting(const TDeque<TIndexBuildId>& indexIds, const TActorContext& ctx);
+
+ // } //NIndexBuilder
+
public:
void ChangeStreamShardsCount(i64 delta) override;
void ChangeStreamShardsQuota(i64 delta) override;
@@ -1071,49 +1071,49 @@ private:
void Cleanup(const TActorContext &ctx);
void Enqueue(STFUNC_SIG) override;
void Die(const TActorContext &ctx) override;
-
+
bool ReassignChannelsEnabled() const override {
return true;
}
- const TDomainsInfo::TDomain& GetDomainDescription(const TActorContext &ctx) const;
- NKikimrSubDomains::TProcessingParams CreateRootProcessingParams(const TActorContext &ctx);
- static NTabletPipe::TClientConfig GetPipeClientConfig();
+ const TDomainsInfo::TDomain& GetDomainDescription(const TActorContext &ctx) const;
+ NKikimrSubDomains::TProcessingParams CreateRootProcessingParams(const TActorContext &ctx);
+ static NTabletPipe::TClientConfig GetPipeClientConfig();
public:
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
return NKikimrServices::TActivity::FLAT_SCHEMESHARD_ACTOR;
}
- TSchemeShard(const TActorId &tablet, TTabletStorageInfo *info);
+ TSchemeShard(const TActorId &tablet, TTabletStorageInfo *info);
+
+ //TTabletId TabletID() const { return TTabletId(ITablet::TabletID()); }
+ TTabletId SelfTabletId() const { return TTabletId(ITablet::TabletID()); }
- //TTabletId TabletID() const { return TTabletId(ITablet::TabletID()); }
- TTabletId SelfTabletId() const { return TTabletId(ITablet::TabletID()); }
-
STFUNC(StateInit);
- STFUNC(StateConfigure);
+ STFUNC(StateConfigure);
STFUNC(StateWork);
STFUNC(BrokenState);
-
- // A helper that enforces write-only access to the internal DB (reads must be done from the
- // internal structures)
- class TRwTxBase : public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
- protected:
- TDuration ExecuteDuration;
-
- protected:
- TRwTxBase(TSchemeShard* self) : TBase(self) {}
-
- public:
- virtual ~TRwTxBase() {}
-
- bool Execute(NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx) override;
- void Complete(const TActorContext &ctx) override;
-
- virtual void DoExecute(NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx) = 0;
- virtual void DoComplete(const TActorContext &ctx) = 0;
- };
+
+ // A helper that enforces write-only access to the internal DB (reads must be done from the
+ // internal structures)
+ class TRwTxBase : public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
+ protected:
+ TDuration ExecuteDuration;
+
+ protected:
+ TRwTxBase(TSchemeShard* self) : TBase(self) {}
+
+ public:
+ virtual ~TRwTxBase() {}
+
+ bool Execute(NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx) override;
+ void Complete(const TActorContext &ctx) override;
+
+ virtual void DoExecute(NTabletFlatExecutor::TTransactionContext &txc, const TActorContext &ctx) = 0;
+ virtual void DoComplete(const TActorContext &ctx) = 0;
+ };
};
-}
-}
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard_import.cpp b/ydb/core/tx/schemeshard/schemeshard_import.cpp
index 2f5d4f20dfc..c5e7d6c3d1e 100644
--- a/ydb/core/tx/schemeshard/schemeshard_import.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_import.cpp
@@ -5,7 +5,7 @@
#include <util/generic/xrange.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
namespace {
@@ -37,7 +37,7 @@ namespace {
} // anonymous
-void TSchemeShard::FromXxportInfo(NKikimrImport::TImport& import, const TImportInfo::TPtr importInfo) {
+void TSchemeShard::FromXxportInfo(NKikimrImport::TImport& import, const TImportInfo::TPtr importInfo) {
import.SetId(importInfo->Id);
import.SetStatus(Ydb::StatusIds::SUCCESS);
@@ -94,7 +94,7 @@ void TSchemeShard::FromXxportInfo(NKikimrImport::TImport& import, const TImportI
}
}
-void TSchemeShard::PersistCreateImport(NIceDb::TNiceDb& db, const TImportInfo::TPtr importInfo) {
+void TSchemeShard::PersistCreateImport(NIceDb::TNiceDb& db, const TImportInfo::TPtr importInfo) {
db.Table<Schema::Imports>().Key(importInfo->Id).Update(
NIceDb::TUpdate<Schema::Imports::Uid>(importInfo->Uid),
NIceDb::TUpdate<Schema::Imports::Kind>(static_cast<ui8>(importInfo->Kind)),
@@ -120,7 +120,7 @@ void TSchemeShard::PersistCreateImport(NIceDb::TNiceDb& db, const TImportInfo::T
}
}
-void TSchemeShard::PersistRemoveImport(NIceDb::TNiceDb& db, const TImportInfo::TPtr importInfo) {
+void TSchemeShard::PersistRemoveImport(NIceDb::TNiceDb& db, const TImportInfo::TPtr importInfo) {
for (ui32 itemIdx : xrange(importInfo->Items.size())) {
db.Table<Schema::ImportItems>().Key(importInfo->Id, itemIdx).Delete();
}
@@ -128,14 +128,14 @@ void TSchemeShard::PersistRemoveImport(NIceDb::TNiceDb& db, const TImportInfo::T
db.Table<Schema::Imports>().Key(importInfo->Id).Delete();
}
-void TSchemeShard::PersistImportState(NIceDb::TNiceDb& db, const TImportInfo::TPtr importInfo) {
+void TSchemeShard::PersistImportState(NIceDb::TNiceDb& db, const TImportInfo::TPtr importInfo) {
db.Table<Schema::Imports>().Key(importInfo->Id).Update(
NIceDb::TUpdate<Schema::Imports::State>(static_cast<ui8>(importInfo->State)),
NIceDb::TUpdate<Schema::Imports::Issue>(importInfo->Issue)
);
}
-void TSchemeShard::PersistImportItemState(NIceDb::TNiceDb& db, const TImportInfo::TPtr importInfo, ui32 itemIdx) {
+void TSchemeShard::PersistImportItemState(NIceDb::TNiceDb& db, const TImportInfo::TPtr importInfo, ui32 itemIdx) {
Y_VERIFY(itemIdx < importInfo->Items.size());
const auto& item = importInfo->Items.at(itemIdx);
@@ -147,7 +147,7 @@ void TSchemeShard::PersistImportItemState(NIceDb::TNiceDb& db, const TImportInfo
);
}
-void TSchemeShard::PersistImportItemScheme(NIceDb::TNiceDb& db, const TImportInfo::TPtr importInfo, ui32 itemIdx) {
+void TSchemeShard::PersistImportItemScheme(NIceDb::TNiceDb& db, const TImportInfo::TPtr importInfo, ui32 itemIdx) {
Y_VERIFY(itemIdx < importInfo->Items.size());
const auto& item = importInfo->Items.at(itemIdx);
@@ -156,7 +156,7 @@ void TSchemeShard::PersistImportItemScheme(NIceDb::TNiceDb& db, const TImportInf
);
}
-void TSchemeShard::PersistImportItemDstPathId(NIceDb::TNiceDb& db, const TImportInfo::TPtr importInfo, ui32 itemIdx) {
+void TSchemeShard::PersistImportItemDstPathId(NIceDb::TNiceDb& db, const TImportInfo::TPtr importInfo, ui32 itemIdx) {
Y_VERIFY(itemIdx < importInfo->Items.size());
const auto& item = importInfo->Items.at(itemIdx);
@@ -166,35 +166,35 @@ void TSchemeShard::PersistImportItemDstPathId(NIceDb::TNiceDb& db, const TImport
);
}
-void TSchemeShard::Handle(TEvImport::TEvCreateImportRequest::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvImport::TEvCreateImportRequest::TPtr& ev, const TActorContext& ctx) {
Execute(CreateTxCreateImport(ev), ctx);
}
-void TSchemeShard::Handle(TEvImport::TEvGetImportRequest::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvImport::TEvGetImportRequest::TPtr& ev, const TActorContext& ctx) {
Execute(CreateTxGetImport(ev), ctx);
}
-void TSchemeShard::Handle(TEvImport::TEvCancelImportRequest::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvImport::TEvCancelImportRequest::TPtr& ev, const TActorContext& ctx) {
Execute(CreateTxCancelImport(ev), ctx);
}
-void TSchemeShard::Handle(TEvImport::TEvForgetImportRequest::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvImport::TEvForgetImportRequest::TPtr& ev, const TActorContext& ctx) {
Execute(CreateTxForgetImport(ev), ctx);
}
-void TSchemeShard::Handle(TEvImport::TEvListImportsRequest::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvImport::TEvListImportsRequest::TPtr& ev, const TActorContext& ctx) {
Execute(CreateTxListImports(ev), ctx);
}
-void TSchemeShard::Handle(TEvPrivate::TEvImportSchemeReady::TPtr& ev, const TActorContext& ctx) {
+void TSchemeShard::Handle(TEvPrivate::TEvImportSchemeReady::TPtr& ev, const TActorContext& ctx) {
Execute(CreateTxProgressImport(ev), ctx);
}
-void TSchemeShard::ResumeImports(const TVector<ui64>& ids, const TActorContext& ctx) {
+void TSchemeShard::ResumeImports(const TVector<ui64>& ids, const TActorContext& ctx) {
for (const ui64 id : ids) {
Execute(CreateTxProgressImport(id), ctx);
}
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_import.h b/ydb/core/tx/schemeshard/schemeshard_import.h
index a3bcd225fd7..41e45e57689 100644
--- a/ydb/core/tx/schemeshard/schemeshard_import.h
+++ b/ydb/core/tx/schemeshard/schemeshard_import.h
@@ -5,7 +5,7 @@
#include <ydb/core/protos/import.pb.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
struct TEvImport {
enum EEv {
@@ -167,5 +167,5 @@ struct TEvImport {
}; // TEvImport
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_import__cancel.cpp b/ydb/core/tx/schemeshard/schemeshard_import__cancel.cpp
index 0b19fa0db01..bd1d9972c55 100644
--- a/ydb/core/tx/schemeshard/schemeshard_import__cancel.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_import__cancel.cpp
@@ -10,11 +10,11 @@
#include <util/generic/xrange.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TImport::TTxCancel: public TSchemeShard::TXxport::TTxBase {
+struct TSchemeShard::TImport::TTxCancel: public TSchemeShard::TXxport::TTxBase {
TEvImport::TEvCancelImportRequest::TPtr Request;
explicit TTxCancel(TSelf *self, TEvImport::TEvCancelImportRequest::TPtr& ev)
@@ -99,11 +99,11 @@ struct TSchemeShard::TImport::TTxCancel: public TSchemeShard::TXxport::TTxBase {
}; // TTxCancel
-struct TSchemeShard::TImport::TTxCancelAck: public TSchemeShard::TXxport::TTxBase {
- TEvSchemeShard::TEvCancelTxResult::TPtr CancelTxResult = nullptr;
+struct TSchemeShard::TImport::TTxCancelAck: public TSchemeShard::TXxport::TTxBase {
+ TEvSchemeShard::TEvCancelTxResult::TPtr CancelTxResult = nullptr;
TEvIndexBuilder::TEvCancelResponse::TPtr CancelIndexBuildResult = nullptr;
- explicit TTxCancelAck(TSelf *self, TEvSchemeShard::TEvCancelTxResult::TPtr& ev)
+ explicit TTxCancelAck(TSelf *self, TEvSchemeShard::TEvCancelTxResult::TPtr& ev)
: TXxport::TTxBase(self)
, CancelTxResult(ev)
{
@@ -194,17 +194,17 @@ struct TSchemeShard::TImport::TTxCancelAck: public TSchemeShard::TXxport::TTxBas
}; // TTxCancelAck
-ITransaction* TSchemeShard::CreateTxCancelImport(TEvImport::TEvCancelImportRequest::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxCancelImport(TEvImport::TEvCancelImportRequest::TPtr& ev) {
return new TImport::TTxCancel(this, ev);
}
-ITransaction* TSchemeShard::CreateTxCancelImportAck(TEvSchemeShard::TEvCancelTxResult::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxCancelImportAck(TEvSchemeShard::TEvCancelTxResult::TPtr& ev) {
return new TImport::TTxCancelAck(this, ev);
}
-ITransaction* TSchemeShard::CreateTxCancelImportAck(TEvIndexBuilder::TEvCancelResponse::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxCancelImportAck(TEvIndexBuilder::TEvCancelResponse::TPtr& ev) {
return new TImport::TTxCancelAck(this, ev);
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_import__create.cpp b/ydb/core/tx/schemeshard/schemeshard_import__create.cpp
index 2feead6c8da..947870d51bc 100644
--- a/ydb/core/tx/schemeshard/schemeshard_import__create.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_import__create.cpp
@@ -15,11 +15,11 @@
#include <util/string/builder.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TImport::TTxCreate: public TSchemeShard::TXxport::TTxBase {
+struct TSchemeShard::TImport::TTxCreate: public TSchemeShard::TXxport::TTxBase {
TEvImport::TEvCreateImportRequest::TPtr Request;
bool Progress;
@@ -214,7 +214,7 @@ private:
}; // TTxCreate
-struct TSchemeShard::TImport::TTxProgress: public TSchemeShard::TXxport::TTxBase {
+struct TSchemeShard::TImport::TTxProgress: public TSchemeShard::TXxport::TTxBase {
using EState = TImportInfo::EState;
using ESubState = TImportInfo::TItem::ESubState;
@@ -223,9 +223,9 @@ struct TSchemeShard::TImport::TTxProgress: public TSchemeShard::TXxport::TTxBase
ui64 Id;
TEvPrivate::TEvImportSchemeReady::TPtr SchemeResult = nullptr;
TEvTxAllocatorClient::TEvAllocateResult::TPtr AllocateResult = nullptr;
- TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr ModifyResult = nullptr;
+ TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr ModifyResult = nullptr;
TEvIndexBuilder::TEvCreateResponse::TPtr CreateIndexResult = nullptr;
- TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr NotifyResult = nullptr;
+ TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr NotifyResult = nullptr;
explicit TTxProgress(TSelf* self, ui64 id)
: TXxport::TTxBase(self)
@@ -245,7 +245,7 @@ struct TSchemeShard::TImport::TTxProgress: public TSchemeShard::TXxport::TTxBase
{
}
- explicit TTxProgress(TSelf* self, TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& ev)
+ explicit TTxProgress(TSelf* self, TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& ev)
: TXxport::TTxBase(self)
, ModifyResult(ev)
{
@@ -257,7 +257,7 @@ struct TSchemeShard::TImport::TTxProgress: public TSchemeShard::TXxport::TTxBase
{
}
- explicit TTxProgress(TSelf* self, TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev)
+ explicit TTxProgress(TSelf* self, TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev)
: TXxport::TTxBase(self)
, NotifyResult(ev)
{
@@ -421,7 +421,7 @@ private:
<< ", item# " << item.ToString(itemIdx));
Y_VERIFY(item.WaitTxId != InvalidTxId);
- Send(Self->SelfId(), new TEvSchemeShard::TEvNotifyTxCompletion(ui64(item.WaitTxId)));
+ Send(Self->SelfId(), new TEvSchemeShard::TEvNotifyTxCompletion(ui64(item.WaitTxId)));
}
TTxId GetActiveRestoreTxId(TImportInfo::TPtr importInfo, ui32 itemIdx) {
@@ -436,7 +436,7 @@ private:
}
auto path = Self->PathsById.at(item.DstPathId);
- if (path->PathState != NKikimrSchemeOp::EPathStateRestore) {
+ if (path->PathState != NKikimrSchemeOp::EPathStateRestore) {
return InvalidTxId;
}
@@ -682,7 +682,7 @@ private:
void OnAllocateResult(TTransactionContext&, const TActorContext&) {
Y_VERIFY(AllocateResult);
- const auto txId = TTxId(AllocateResult->Get()->TxIds.front());
+ const auto txId = TTxId(AllocateResult->Get()->TxIds.front());
const ui64 id = AllocateResult->Cookie;
LOG_D("TImport::TTxProgress: OnAllocateResult"
@@ -772,11 +772,11 @@ private:
Y_VERIFY(itemIdx < importInfo->Items.size());
auto& item = importInfo->Items.at(itemIdx);
- if (record.GetStatus() != NKikimrScheme::StatusAccepted) {
+ if (record.GetStatus() != NKikimrScheme::StatusAccepted) {
Self->TxIdToImport.erase(txId);
txId = InvalidTxId;
- if (record.GetStatus() == NKikimrScheme::StatusMultipleModifications) {
+ if (record.GetStatus() == NKikimrScheme::StatusMultipleModifications) {
if (record.GetPathCreateTxId()) {
txId = TTxId(record.GetPathCreateTxId());
} else if (item.State == EState::Transferring) {
@@ -973,33 +973,33 @@ private:
}; // TTxProgress
-ITransaction* TSchemeShard::CreateTxCreateImport(TEvImport::TEvCreateImportRequest::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxCreateImport(TEvImport::TEvCreateImportRequest::TPtr& ev) {
return new TImport::TTxCreate(this, ev);
}
-ITransaction* TSchemeShard::CreateTxProgressImport(ui64 id) {
+ITransaction* TSchemeShard::CreateTxProgressImport(ui64 id) {
return new TImport::TTxProgress(this, id);
}
-ITransaction* TSchemeShard::CreateTxProgressImport(TEvPrivate::TEvImportSchemeReady::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxProgressImport(TEvPrivate::TEvImportSchemeReady::TPtr& ev) {
return new TImport::TTxProgress(this, ev);
}
-ITransaction* TSchemeShard::CreateTxProgressImport(TEvTxAllocatorClient::TEvAllocateResult::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxProgressImport(TEvTxAllocatorClient::TEvAllocateResult::TPtr& ev) {
return new TImport::TTxProgress(this, ev);
}
-ITransaction* TSchemeShard::CreateTxProgressImport(TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxProgressImport(TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr& ev) {
return new TImport::TTxProgress(this, ev);
}
-ITransaction* TSchemeShard::CreateTxProgressImport(TEvIndexBuilder::TEvCreateResponse::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxProgressImport(TEvIndexBuilder::TEvCreateResponse::TPtr& ev) {
return new TImport::TTxProgress(this, ev);
}
-ITransaction* TSchemeShard::CreateTxProgressImport(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxProgressImport(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev) {
return new TImport::TTxProgress(this, ev);
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_import__forget.cpp b/ydb/core/tx/schemeshard/schemeshard_import__forget.cpp
index 057001accad..5574044683d 100644
--- a/ydb/core/tx/schemeshard/schemeshard_import__forget.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_import__forget.cpp
@@ -9,11 +9,11 @@
#include <util/generic/ptr.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TImport::TTxForget: public TSchemeShard::TXxport::TTxBase {
+struct TSchemeShard::TImport::TTxForget: public TSchemeShard::TXxport::TTxBase {
TEvImport::TEvForgetImportRequest::TPtr Request;
explicit TTxForget(TSelf *self, TEvImport::TEvForgetImportRequest::TPtr& ev)
@@ -72,9 +72,9 @@ struct TSchemeShard::TImport::TTxForget: public TSchemeShard::TXxport::TTxBase {
}; // TTxForget
-ITransaction* TSchemeShard::CreateTxForgetImport(TEvImport::TEvForgetImportRequest::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxForgetImport(TEvImport::TEvForgetImportRequest::TPtr& ev) {
return new TImport::TTxForget(this, ev);
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_import__get.cpp b/ydb/core/tx/schemeshard/schemeshard_import__get.cpp
index 05dc3f99cda..dcc8cb9c8f2 100644
--- a/ydb/core/tx/schemeshard/schemeshard_import__get.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_import__get.cpp
@@ -2,11 +2,11 @@
#include "schemeshard_import.h"
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TImport::TTxGet: public TSchemeShard::TXxport::TTxGet<
+struct TSchemeShard::TImport::TTxGet: public TSchemeShard::TXxport::TTxGet<
TImportInfo,
TEvImport::TEvGetImportRequest,
TEvImport::TEvGetImportResponse
@@ -23,9 +23,9 @@ struct TSchemeShard::TImport::TTxGet: public TSchemeShard::TXxport::TTxGet<
}; // TTxGet
-ITransaction* TSchemeShard::CreateTxGetImport(TEvImport::TEvGetImportRequest::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxGetImport(TEvImport::TEvGetImportRequest::TPtr& ev) {
return new TImport::TTxGet(this, ev);
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_import__list.cpp b/ydb/core/tx/schemeshard/schemeshard_import__list.cpp
index 4e8da5731a9..c2841669c8a 100644
--- a/ydb/core/tx/schemeshard/schemeshard_import__list.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_import__list.cpp
@@ -2,15 +2,15 @@
#include "schemeshard_import.h"
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NTabletFlatExecutor;
-struct TSchemeShard::TImport::TTxList: public TSchemeShard::TXxport::TTxList<
+struct TSchemeShard::TImport::TTxList: public TSchemeShard::TXxport::TTxList<
TImportInfo,
TEvImport::TEvListImportsRequest,
TEvImport::TEvListImportsResponse,
- TSchemeShard::TImport::TTxList
+ TSchemeShard::TImport::TTxList
> {
using TTxListBase::TTxListBase;
@@ -33,9 +33,9 @@ struct TSchemeShard::TImport::TTxList: public TSchemeShard::TXxport::TTxList<
}; // TTxList
-ITransaction* TSchemeShard::CreateTxListImports(TEvImport::TEvListImportsRequest::TPtr& ev) {
+ITransaction* TSchemeShard::CreateTxListImports(TEvImport::TEvListImportsRequest::TPtr& ev) {
return new TImport::TTxList(this, ev);
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_import_flow_proposals.cpp b/ydb/core/tx/schemeshard/schemeshard_import_flow_proposals.cpp
index 9991a5bcda1..5d510760fd4 100644
--- a/ydb/core/tx/schemeshard/schemeshard_import_flow_proposals.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_import_flow_proposals.cpp
@@ -5,10 +5,10 @@
#include <ydb/core/ydb_convert/table_description.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> CreateTablePropose(
- TSchemeShard* ss,
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> CreateTablePropose(
+ TSchemeShard* ss,
TTxId txId,
TImportInfo::TPtr importInfo,
ui32 itemIdx,
@@ -17,15 +17,15 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> CreateTablePropose(
Y_VERIFY(itemIdx < importInfo->Items.size());
const auto& item = importInfo->Items.at(itemIdx);
- auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(txId), ss->TabletID());
+ auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(txId), ss->TabletID());
auto& record = propose->Record;
if (importInfo->UserSID) {
record.SetOwner(*importInfo->UserSID);
}
- auto& modifyScheme = *record.AddTransaction();
- modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateTable);
+ auto& modifyScheme = *record.AddTransaction();
+ modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpCreateTable);
modifyScheme.SetInternal(true);
const TPath domainPath = TPath::Init(importInfo->DomainPathId, ss);
@@ -48,8 +48,8 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> CreateTablePropose(
return propose;
}
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> CreateTablePropose(
- TSchemeShard* ss,
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> CreateTablePropose(
+ TSchemeShard* ss,
TTxId txId,
TImportInfo::TPtr importInfo,
ui32 itemIdx
@@ -58,7 +58,7 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> CreateTablePropose(
return CreateTablePropose(ss, txId, importInfo, itemIdx, unused);
}
-static NKikimrSchemeOp::TTableDescription GetTableDescription(TSchemeShard* ss, const TPathId& pathId) {
+static NKikimrSchemeOp::TTableDescription GetTableDescription(TSchemeShard* ss, const TPathId& pathId) {
auto desc = DescribePath(ss, TlsActivationContext->AsActorContext(), pathId);
auto record = desc->GetRecord();
@@ -68,11 +68,11 @@ static NKikimrSchemeOp::TTableDescription GetTableDescription(TSchemeShard* ss,
return record.GetPathDescription().GetTable();
}
-static NKikimrSchemeOp::TTableDescription RebuildTableDescription(
- const NKikimrSchemeOp::TTableDescription& src,
+static NKikimrSchemeOp::TTableDescription RebuildTableDescription(
+ const NKikimrSchemeOp::TTableDescription& src,
const Ydb::Table::CreateTableRequest& scheme
) {
- NKikimrSchemeOp::TTableDescription tableDesc;
+ NKikimrSchemeOp::TTableDescription tableDesc;
tableDesc.MutableKeyColumnNames()->CopyFrom(src.GetKeyColumnNames());
THashMap<TString, ui32> columnNameToIdx;
@@ -91,8 +91,8 @@ static NKikimrSchemeOp::TTableDescription RebuildTableDescription(
return tableDesc;
}
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> RestorePropose(
- TSchemeShard* ss,
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> RestorePropose(
+ TSchemeShard* ss,
TTxId txId,
TImportInfo::TPtr importInfo,
ui32 itemIdx
@@ -100,10 +100,10 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> RestorePropose(
Y_VERIFY(itemIdx < importInfo->Items.size());
const auto& item = importInfo->Items.at(itemIdx);
- auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(txId), ss->TabletID());
+ auto propose = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(ui64(txId), ss->TabletID());
- auto& modifyScheme = *propose->Record.AddTransaction();
- modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpRestore);
+ auto& modifyScheme = *propose->Record.AddTransaction();
+ modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpRestore);
modifyScheme.SetInternal(true);
const TPath dstPath = TPath::Init(item.DstPathId, ss);
@@ -128,10 +128,10 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> RestorePropose(
switch (importInfo->Settings.scheme()) {
case Ydb::Import::ImportFromS3Settings::HTTP:
- restoreSettings.SetScheme(NKikimrSchemeOp::TS3Settings::HTTP);
+ restoreSettings.SetScheme(NKikimrSchemeOp::TS3Settings::HTTP);
break;
case Ydb::Import::ImportFromS3Settings::HTTPS:
- restoreSettings.SetScheme(NKikimrSchemeOp::TS3Settings::HTTPS);
+ restoreSettings.SetScheme(NKikimrSchemeOp::TS3Settings::HTTPS);
break;
default:
Y_FAIL("Unknown scheme");
@@ -143,11 +143,11 @@ THolder<TEvSchemeShard::TEvModifySchemeTransaction> RestorePropose(
return propose;
}
-THolder<TEvSchemeShard::TEvCancelTx> CancelRestorePropose(
+THolder<TEvSchemeShard::TEvCancelTx> CancelRestorePropose(
TImportInfo::TPtr importInfo,
TTxId restoreTxId
) {
- auto propose = MakeHolder<TEvSchemeShard::TEvCancelTx>();
+ auto propose = MakeHolder<TEvSchemeShard::TEvCancelTx>();
auto& record = propose->Record;
record.SetTxId(importInfo->Id);
@@ -157,7 +157,7 @@ THolder<TEvSchemeShard::TEvCancelTx> CancelRestorePropose(
}
THolder<TEvIndexBuilder::TEvCreateRequest> BuildIndexPropose(
- TSchemeShard* ss,
+ TSchemeShard* ss,
TTxId txId,
TImportInfo::TPtr importInfo,
ui32 itemIdx,
@@ -186,7 +186,7 @@ THolder<TEvIndexBuilder::TEvCreateRequest> BuildIndexPropose(
}
THolder<TEvIndexBuilder::TEvCancelRequest> CancelIndexBuildPropose(
- TSchemeShard* ss,
+ TSchemeShard* ss,
TImportInfo::TPtr importInfo,
TTxId indexBuildId
) {
@@ -194,5 +194,5 @@ THolder<TEvIndexBuilder::TEvCancelRequest> CancelIndexBuildPropose(
return MakeHolder<TEvIndexBuilder::TEvCancelRequest>(ui64(indexBuildId), domainPath.PathString(), ui64(indexBuildId));
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_import_flow_proposals.h b/ydb/core/tx/schemeshard/schemeshard_import_flow_proposals.h
index bd7aab28aa8..a99221db35b 100644
--- a/ydb/core/tx/schemeshard/schemeshard_import_flow_proposals.h
+++ b/ydb/core/tx/schemeshard/schemeshard_import_flow_proposals.h
@@ -3,37 +3,37 @@
#include "schemeshard_impl.h"
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> CreateTablePropose(
- TSchemeShard* ss,
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> CreateTablePropose(
+ TSchemeShard* ss,
TTxId txId,
TImportInfo::TPtr importInfo,
ui32 itemIdx,
TString& error
);
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> CreateTablePropose(
- TSchemeShard* ss,
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> CreateTablePropose(
+ TSchemeShard* ss,
TTxId txId,
TImportInfo::TPtr importInfo,
ui32 itemIdx
);
-THolder<TEvSchemeShard::TEvModifySchemeTransaction> RestorePropose(
- TSchemeShard* ss,
+THolder<TEvSchemeShard::TEvModifySchemeTransaction> RestorePropose(
+ TSchemeShard* ss,
TTxId txId,
TImportInfo::TPtr importInfo,
ui32 itemIdx
);
-THolder<TEvSchemeShard::TEvCancelTx> CancelRestorePropose(
+THolder<TEvSchemeShard::TEvCancelTx> CancelRestorePropose(
TImportInfo::TPtr importInfo,
TTxId restoreTxId
);
THolder<TEvIndexBuilder::TEvCreateRequest> BuildIndexPropose(
- TSchemeShard* ss,
+ TSchemeShard* ss,
TTxId txId,
TImportInfo::TPtr importInfo,
ui32 itemIdx,
@@ -41,10 +41,10 @@ THolder<TEvIndexBuilder::TEvCreateRequest> BuildIndexPropose(
);
THolder<TEvIndexBuilder::TEvCancelRequest> CancelIndexBuildPropose(
- TSchemeShard* ss,
+ TSchemeShard* ss,
TImportInfo::TPtr importInfo,
TTxId indexBuildId
);
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_import_scheme_getter.cpp b/ydb/core/tx/schemeshard/schemeshard_import_scheme_getter.cpp
index 3a228df60f0..e2fc78da5dc 100644
--- a/ydb/core/tx/schemeshard/schemeshard_import_scheme_getter.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_import_scheme_getter.cpp
@@ -11,7 +11,7 @@
#include <util/string/subst.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
using namespace NWrappers;
@@ -200,5 +200,5 @@ IActor* CreateSchemeGetter(const TActorId& replyTo, TImportInfo::TPtr importInfo
return new TSchemeGetter(replyTo, importInfo, itemIdx);
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_import_scheme_getter.h b/ydb/core/tx/schemeshard/schemeshard_import_scheme_getter.h
index 8173a32d703..24b67c7c659 100644
--- a/ydb/core/tx/schemeshard/schemeshard_import_scheme_getter.h
+++ b/ydb/core/tx/schemeshard/schemeshard_import_scheme_getter.h
@@ -4,9 +4,9 @@
#include "schemeshard_info_types.h"
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
IActor* CreateSchemeGetter(const TActorId& replyTo, TImportInfo::TPtr importInfo, ui32 itemIdx);
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_import_scheme_getter_fallback.cpp b/ydb/core/tx/schemeshard/schemeshard_import_scheme_getter_fallback.cpp
index cdd2a1aa4cf..eefb0e9e5a0 100644
--- a/ydb/core/tx/schemeshard/schemeshard_import_scheme_getter_fallback.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_import_scheme_getter_fallback.cpp
@@ -5,7 +5,7 @@
#include <library/cpp/actors/core/hfunc.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
class TSchemeGetterFallback: public TActorBootstrapped<TSchemeGetterFallback> {
public:
@@ -32,5 +32,5 @@ IActor* CreateSchemeGetter(const TActorId& replyTo, TImportInfo::TPtr importInfo
return new TSchemeGetterFallback(replyTo, importInfo, itemIdx);
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_info_types.cpp b/ydb/core/tx/schemeshard/schemeshard_info_types.cpp
index 79fb7665b22..fcb564b6065 100644
--- a/ydb/core/tx/schemeshard/schemeshard_info_types.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_info_types.cpp
@@ -1,6 +1,6 @@
-#include "schemeshard_info_types.h"
-#include "schemeshard_utils.h"
-
+#include "schemeshard_info_types.h"
+#include "schemeshard_utils.h"
+
#include <ydb/core/base/appdata.h>
#include <ydb/core/base/compile_time_flags.h>
#include <ydb/core/base/tx_processing.h>
@@ -9,50 +9,50 @@
#include <ydb/core/tablet/tablet_counters_aggregator.h>
#include <ydb/core/tablet/tablet_counters_protobuf.h>
#include <ydb/core/util/pb.h>
-
+
#include <ydb/library/yql/minikql/mkql_type_ops.h>
-
+
#include <util/generic/algorithm.h>
-namespace NKikimr {
-namespace NSchemeShard {
-
-TTableInfo::TAlterDataPtr TTableInfo::CreateAlterData(
- TPtr source,
- NKikimrSchemeOp::TTableDescription& op,
- const NScheme::TTypeRegistry& typeRegistry,
+namespace NKikimr {
+namespace NSchemeShard {
+
+TTableInfo::TAlterDataPtr TTableInfo::CreateAlterData(
+ TPtr source,
+ NKikimrSchemeOp::TTableDescription& op,
+ const NScheme::TTypeRegistry& typeRegistry,
const TSchemeLimits& limits, const TSubDomainInfo& subDomain,
TString& errStr, const THashSet<TString>& localSequences)
-{
- TAlterDataPtr alterData = new TTableInfo::TAlterTableInfo();
- alterData->TableDescriptionFull = NKikimrSchemeOp::TTableDescription();
-
- alterData->PartitionConfigFull().CopyFrom(op.GetPartitionConfig());
-
- TColumnFamiliesMerger columnFamilyMerger(alterData->PartitionConfigFull());
-
- if (source) {
- alterData->AlterVersion = source->AlterVersion + 1;
- alterData->NextColumnId = source->NextColumnId;
- }
- THashMap<TString, ui32> colName2Id;
- THashSet<ui32> keys;
-
- if (source) {
- for (const auto& col : source->Columns) {
- Y_VERIFY(col.first == col.second.Id);
- // There could be columns with same name. Only one of them can be active.
- if (col.second.IsDropped())
- continue;
-
- colName2Id[col.second.Name] = col.first;
- if (col.second.KeyOrder != Max<ui32>())
- keys.insert(col.first);
- }
- }
-
+{
+ TAlterDataPtr alterData = new TTableInfo::TAlterTableInfo();
+ alterData->TableDescriptionFull = NKikimrSchemeOp::TTableDescription();
+
+ alterData->PartitionConfigFull().CopyFrom(op.GetPartitionConfig());
+
+ TColumnFamiliesMerger columnFamilyMerger(alterData->PartitionConfigFull());
+
+ if (source) {
+ alterData->AlterVersion = source->AlterVersion + 1;
+ alterData->NextColumnId = source->NextColumnId;
+ }
+ THashMap<TString, ui32> colName2Id;
+ THashSet<ui32> keys;
+
+ if (source) {
+ for (const auto& col : source->Columns) {
+ Y_VERIFY(col.first == col.second.Id);
+ // There could be columns with same name. Only one of them can be active.
+ if (col.second.IsDropped())
+ continue;
+
+ colName2Id[col.second.Name] = col.first;
+ if (col.second.KeyOrder != Max<ui32>())
+ keys.insert(col.first);
+ }
+ }
+
for (auto& col : *op.MutableColumns()) {
- TString colName = col.GetName();
+ TString colName = col.GetName();
if (colName.size() > limits.MaxTableColumnNameLength) {
errStr = TStringBuilder()
@@ -61,128 +61,128 @@ TTableInfo::TAlterDataPtr TTableInfo::CreateAlterData(
return nullptr;
}
- if (!IsValidColumnName(colName)) {
+ if (!IsValidColumnName(colName)) {
errStr = Sprintf("Invalid name for column '%s'", colName.data());
- return nullptr;
- }
-
- auto typeName = NMiniKQL::AdaptLegacyYqlType(col.GetType());
- const NScheme::IType* type = typeRegistry.GetType(typeName);
-
- NKikimrSchemeOp::TFamilyDescription* columnFamily = nullptr;
- if (col.HasFamily() && col.HasFamilyName()) {
- columnFamily = columnFamilyMerger.Get(col.GetFamily(), col.GetFamilyName(), errStr);
- } else if (col.HasFamily()) {
- columnFamily = columnFamilyMerger.Get(col.GetFamily(), errStr);
+ return nullptr;
+ }
+
+ auto typeName = NMiniKQL::AdaptLegacyYqlType(col.GetType());
+ const NScheme::IType* type = typeRegistry.GetType(typeName);
+
+ NKikimrSchemeOp::TFamilyDescription* columnFamily = nullptr;
+ if (col.HasFamily() && col.HasFamilyName()) {
+ columnFamily = columnFamilyMerger.Get(col.GetFamily(), col.GetFamilyName(), errStr);
+ } else if (col.HasFamily()) {
+ columnFamily = columnFamilyMerger.Get(col.GetFamily(), errStr);
} else if (col.HasFamilyName()) {
- columnFamily = columnFamilyMerger.AddOrGet(col.GetFamilyName(), errStr);
- }
-
- if ((col.HasFamily() || col.HasFamilyName()) && !columnFamily) {
- return nullptr;
- }
-
- bool isAlterColumn = (source && colName2Id.contains(colName));
- if (isAlterColumn) {
- if (keys.contains(colName2Id.at(colName))) {
- errStr = TStringBuilder()
- << "Cannot alter key column ' " << colName << "' with id " << colName2Id.at(colName);
- return nullptr;
- }
-
+ columnFamily = columnFamilyMerger.AddOrGet(col.GetFamilyName(), errStr);
+ }
+
+ if ((col.HasFamily() || col.HasFamilyName()) && !columnFamily) {
+ return nullptr;
+ }
+
+ bool isAlterColumn = (source && colName2Id.contains(colName));
+ if (isAlterColumn) {
+ if (keys.contains(colName2Id.at(colName))) {
+ errStr = TStringBuilder()
+ << "Cannot alter key column ' " << colName << "' with id " << colName2Id.at(colName);
+ return nullptr;
+ }
+
if (col.HasType()) {
errStr = Sprintf("Cannot alter type for column '%s'", colName.data());
- return nullptr;
- }
-
- if (!columnFamily) {
+ return nullptr;
+ }
+
+ if (!columnFamily) {
errStr = Sprintf("Nothing to alter for column '%s'", colName.data());
- return nullptr;
- }
-
- if (col.DefaultValue_case() != NKikimrSchemeOp::TColumnDescription::DEFAULTVALUE_NOT_SET) {
+ return nullptr;
+ }
+
+ if (col.DefaultValue_case() != NKikimrSchemeOp::TColumnDescription::DEFAULTVALUE_NOT_SET) {
errStr = Sprintf("Cannot alter default for column '%s'", colName.c_str());
return nullptr;
}
- ui32 colId = colName2Id[colName];
- TTableInfo::TColumn& column = alterData->Columns[colId];
- column = source->Columns[colId];
- column.Family = columnFamily->GetId();
- } else {
- if (colName2Id.contains(colName)) {
+ ui32 colId = colName2Id[colName];
+ TTableInfo::TColumn& column = alterData->Columns[colId];
+ column = source->Columns[colId];
+ column.Family = columnFamily->GetId();
+ } else {
+ if (colName2Id.contains(colName)) {
errStr = Sprintf("Column '%s' specified more than once", colName.data());
- return nullptr;
- }
-
+ return nullptr;
+ }
+
if (source && !col.HasType()) {
errStr = Sprintf("Column '%s' cannot be altered (does not exist)", colName.c_str());
return nullptr;
}
- if (!type) {
+ if (!type) {
errStr = Sprintf("Type '%s' specified for column '%s' is not supported by storage", col.GetType().data(), colName.data());
- return nullptr;
- }
-
- // Only allow YQL types
- if (!NScheme::NTypeIds::IsYqlType(type->GetTypeId())) {
+ return nullptr;
+ }
+
+ // Only allow YQL types
+ if (!NScheme::NTypeIds::IsYqlType(type->GetTypeId())) {
errStr = Sprintf("Type '%s' specified for column '%s' is no longer supported", col.GetType().data(), colName.data());
- return nullptr;
- }
-
- ui32 colId = col.HasId() ? col.GetId() : alterData->NextColumnId;
- if (alterData->Columns.contains(colId)) {
- errStr = Sprintf("Duplicate column id: %" PRIu32, colId);
- return nullptr;
- }
-
+ return nullptr;
+ }
+
+ ui32 colId = col.HasId() ? col.GetId() : alterData->NextColumnId;
+ if (alterData->Columns.contains(colId)) {
+ errStr = Sprintf("Duplicate column id: %" PRIu32, colId);
+ return nullptr;
+ }
+
if (col.HasDefaultFromSequence() && !localSequences.contains(col.GetDefaultFromSequence())) {
errStr = Sprintf("Column '%s' cannot use an unknown sequence '%s'", colName.c_str(), col.GetDefaultFromSequence().c_str());
return nullptr;
}
- alterData->NextColumnId = Max(colId + 1, alterData->NextColumnId);
-
- colName2Id[colName] = colId;
- TTableInfo::TColumn& column = alterData->Columns[colId];
- column = TTableInfo::TColumn(colName, colId, type->GetTypeId());
- column.Family = columnFamily ? columnFamily->GetId() : 0;
+ alterData->NextColumnId = Max(colId + 1, alterData->NextColumnId);
+
+ colName2Id[colName] = colId;
+ TTableInfo::TColumn& column = alterData->Columns[colId];
+ column = TTableInfo::TColumn(colName, colId, type->GetTypeId());
+ column.Family = columnFamily ? columnFamily->GetId() : 0;
column.NotNull = col.GetNotNull();
- if (source)
- column.CreateVersion = alterData->AlterVersion;
+ if (source)
+ column.CreateVersion = alterData->AlterVersion;
if (col.HasDefaultFromSequence()) {
column.DefaultKind = ETableColumnDefaultKind::FromSequence;
column.DefaultValue = col.GetDefaultFromSequence();
}
- }
- }
-
- for (const auto& c : alterData->Columns) {
+ }
+ }
+
+ for (const auto& c : alterData->Columns) {
if (c.second.Family != 0 && keys.contains(c.second.Id)) {
errStr = Sprintf("Key column '%s' must belong to the default family", c.second.Name.data());
- return nullptr;
- }
- }
-
- if (source) {
- for (const auto& col : op.GetDropColumns()) {
- TString colName = col.GetName();
- auto it = colName2Id.find(colName);
- if (it == colName2Id.end()) {
+ return nullptr;
+ }
+ }
+
+ if (source) {
+ for (const auto& col : op.GetDropColumns()) {
+ TString colName = col.GetName();
+ auto it = colName2Id.find(colName);
+ if (it == colName2Id.end()) {
errStr = Sprintf("Can't drop unknown column: '%s'", colName.data());
- return nullptr;
- }
-
- ui32 colId = it->second;
- if (source->Columns.find(colId) == source->Columns.end()) {
+ return nullptr;
+ }
+
+ ui32 colId = it->second;
+ if (source->Columns.find(colId) == source->Columns.end()) {
errStr = Sprintf("Add + drop same column: '%s'", colName.data());
- return nullptr;
- }
- if (keys.find(colId) != keys.end()) {
+ return nullptr;
+ }
+ if (keys.find(colId) != keys.end()) {
errStr = Sprintf("Can't drop key column: '%s'", colName.data());
- return nullptr;
- }
+ return nullptr;
+ }
if (alterData->Columns[colId].DeleteVersion == alterData->AlterVersion) {
errStr = Sprintf("Duplicate drop column: %s", colName.data());
return nullptr;
@@ -192,11 +192,11 @@ TTableInfo::TAlterDataPtr TTableInfo::CreateAlterData(
return nullptr;
}
- alterData->Columns[colId] = source->Columns[colId];
- alterData->Columns[colId].DeleteVersion = alterData->AlterVersion;
- }
- }
-
+ alterData->Columns[colId] = source->Columns[colId];
+ alterData->Columns[colId].DeleteVersion = alterData->AlterVersion;
+ }
+ }
+
if ((colName2Id.size() - op.DropColumnsSize()) > limits.MaxTableColumns) {
errStr = TStringBuilder()
<< "Too many columns"
@@ -219,36 +219,36 @@ TTableInfo::TAlterDataPtr TTableInfo::CreateAlterData(
alterData->IsBackup = op.GetIsBackup();
- if (source && op.KeyColumnNamesSize() == 0)
- return alterData;
-
- TVector<ui32>& keyColIds = alterData->KeyColumnIds;
- ui32 keyOrder = 0;
- for (auto& keyName : op.GetKeyColumnNames()) {
- if (!colName2Id.contains(keyName)) {
+ if (source && op.KeyColumnNamesSize() == 0)
+ return alterData;
+
+ TVector<ui32>& keyColIds = alterData->KeyColumnIds;
+ ui32 keyOrder = 0;
+ for (auto& keyName : op.GetKeyColumnNames()) {
+ if (!colName2Id.contains(keyName)) {
errStr = Sprintf("Unknown column '%s' specified in key column list", keyName.data());
- return nullptr;
- }
-
- ui32 colId = colName2Id[keyName];
- TTableInfo::TColumn& column = alterData->Columns[colId];
- if (column.KeyOrder != (ui32)-1) {
+ return nullptr;
+ }
+
+ ui32 colId = colName2Id[keyName];
+ TTableInfo::TColumn& column = alterData->Columns[colId];
+ if (column.KeyOrder != (ui32)-1) {
errStr = Sprintf("Column '%s' specified more than once in key column list", keyName.data());
- return nullptr;
- }
- if (source && colId < source->NextColumnId && !keys.contains(colId)) {
+ return nullptr;
+ }
+ if (source && colId < source->NextColumnId && !keys.contains(colId)) {
errStr = Sprintf("Cannot add existing column '%s' to key", keyName.data());
- return nullptr;
- }
+ return nullptr;
+ }
if (column.Family != 0) {
errStr = Sprintf("Key column '%s' must belong to the default family", keyName.data());
- return nullptr;
- }
- column.KeyOrder = keyOrder;
- keyColIds.push_back(colId);
- ++keyOrder;
- }
-
+ return nullptr;
+ }
+ column.KeyOrder = keyOrder;
+ keyColIds.push_back(colId);
+ ++keyOrder;
+ }
+
if (keyColIds.size() > limits.MaxTableKeyColumns) {
errStr = TStringBuilder()
<< "Too many key columns"
@@ -258,135 +258,135 @@ TTableInfo::TAlterDataPtr TTableInfo::CreateAlterData(
return nullptr;
}
- if (source) {
- // key columns reorder or deletion is not supported
- const TVector<ui32>& oldColIds = source->KeyColumnIds;
- if (keyColIds.size() < oldColIds.size()) {
- errStr = Sprintf("Can't remove key column");
- return nullptr;
- }
- for (ui32 i = 0; i < oldColIds.size(); ++i) {
- if (oldColIds[i] != keyColIds[i]) {
- errStr = Sprintf("Can't remove/reorder key columns");
- return nullptr;
- }
- }
- }
-
- return alterData;
-}
-
-TVector<ui32> TTableInfo::FillDescription(TPathElement::TPtr pathInfo) {
- Y_VERIFY(pathInfo && pathInfo->IsTable());
-
- TVector<ui32> keyColumnIds;
- for (auto& col : Columns) {
- ui32 colId = col.second.Id;
- ui32 keyOrder = col.second.KeyOrder;
- if (keyOrder != (ui32)-1) {
- keyColumnIds.resize(std::max<ui32>(keyColumnIds.size(), keyOrder+1));
- keyColumnIds[keyOrder] = colId;
- }
- }
-
- if (!TableDescription.HasPathId()) {
- TableDescription.SetName(pathInfo->Name);
- TableDescription.SetId_Deprecated(pathInfo->PathId.LocalPathId);
+ if (source) {
+ // key columns reorder or deletion is not supported
+ const TVector<ui32>& oldColIds = source->KeyColumnIds;
+ if (keyColIds.size() < oldColIds.size()) {
+ errStr = Sprintf("Can't remove key column");
+ return nullptr;
+ }
+ for (ui32 i = 0; i < oldColIds.size(); ++i) {
+ if (oldColIds[i] != keyColIds[i]) {
+ errStr = Sprintf("Can't remove/reorder key columns");
+ return nullptr;
+ }
+ }
+ }
+
+ return alterData;
+}
+
+TVector<ui32> TTableInfo::FillDescription(TPathElement::TPtr pathInfo) {
+ Y_VERIFY(pathInfo && pathInfo->IsTable());
+
+ TVector<ui32> keyColumnIds;
+ for (auto& col : Columns) {
+ ui32 colId = col.second.Id;
+ ui32 keyOrder = col.second.KeyOrder;
+ if (keyOrder != (ui32)-1) {
+ keyColumnIds.resize(std::max<ui32>(keyColumnIds.size(), keyOrder+1));
+ keyColumnIds[keyOrder] = colId;
+ }
+ }
+
+ if (!TableDescription.HasPathId()) {
+ TableDescription.SetName(pathInfo->Name);
+ TableDescription.SetId_Deprecated(pathInfo->PathId.LocalPathId);
PathIdFromPathId(pathInfo->PathId, TableDescription.MutablePathId());
-
- for (auto& c : Columns) {
- const TColumn& column = c.second;
+
+ for (auto& c : Columns) {
+ const TColumn& column = c.second;
if (column.IsDropped()) {
continue;
}
- auto colDescr = TableDescription.AddColumns();
- colDescr->SetName(column.Name);
- colDescr->SetId(column.Id);
- colDescr->SetTypeId(column.PType);
- colDescr->SetFamily(column.Family);
- }
- for (auto ci : keyColumnIds) {
- TableDescription.AddKeyColumnIds(ci);
- }
- }
-
- return keyColumnIds;
-}
-
+ auto colDescr = TableDescription.AddColumns();
+ colDescr->SetName(column.Name);
+ colDescr->SetId(column.Id);
+ colDescr->SetTypeId(column.PType);
+ colDescr->SetFamily(column.Family);
+ }
+ for (auto ci : keyColumnIds) {
+ TableDescription.AddKeyColumnIds(ci);
+ }
+ }
+
+ return keyColumnIds;
+}
+
namespace {
-template<class TProto, class TGetId, class TPreferred>
-inline THashMap<ui32, size_t> DeduplicateRepeatedById(
- google::protobuf::RepeatedPtrField<TProto>* items,
- const TGetId& getId,
- const TPreferred& preferred)
-{
- Y_VERIFY(items, "Unexpected nullptr items");
-
- int size = items->size();
- THashMap<ui32, size_t> posById;
-
- if (size > 0) {
- posById[getId(items->Get(0))] = 0;
- }
-
- if (size > 1) {
- // For each item find the correct position
- // We want items sorted in their first-seen order
- // But each position must be filled with a preferred item
- int dst = 1;
- for (int src = 1; src < size; ++src) {
- ui32 id = getId(items->Get(src));
- auto it = posById.find(id);
- if (it != posById.end()) {
- int existing = it->second;
- if (preferred(items->Get(existing), items->Get(src))) {
- items->SwapElements(existing, src);
+template<class TProto, class TGetId, class TPreferred>
+inline THashMap<ui32, size_t> DeduplicateRepeatedById(
+ google::protobuf::RepeatedPtrField<TProto>* items,
+ const TGetId& getId,
+ const TPreferred& preferred)
+{
+ Y_VERIFY(items, "Unexpected nullptr items");
+
+ int size = items->size();
+ THashMap<ui32, size_t> posById;
+
+ if (size > 0) {
+ posById[getId(items->Get(0))] = 0;
+ }
+
+ if (size > 1) {
+ // For each item find the correct position
+ // We want items sorted in their first-seen order
+ // But each position must be filled with a preferred item
+ int dst = 1;
+ for (int src = 1; src < size; ++src) {
+ ui32 id = getId(items->Get(src));
+ auto it = posById.find(id);
+ if (it != posById.end()) {
+ int existing = it->second;
+ if (preferred(items->Get(existing), items->Get(src))) {
+ items->SwapElements(existing, src);
+ }
+ } else {
+ if (dst != src) {
+ items->SwapElements(dst, src);
}
- } else {
- if (dst != src) {
- items->SwapElements(dst, src);
- }
- posById[id] = dst++;
+ posById[id] = dst++;
}
- }
-
- if (dst < size) {
- items->Truncate(dst);
- }
- }
-
- return posById;
-}
-}
-
-NKikimrSchemeOp::TPartitionConfig TPartitionConfigMerger::DefaultConfig(const TAppData* appData) {
- NKikimrSchemeOp::TPartitionConfig cfg;
-
- TIntrusiveConstPtr<NLocalDb::TCompactionPolicy> compactionPolicy = appData->DomainsInfo->GetDefaultUserTablePolicy();
- compactionPolicy->Serialize(*cfg.MutableCompactionPolicy());
-
- return cfg;
-}
-
-bool TPartitionConfigMerger::ApplyChanges(
- NKikimrSchemeOp::TPartitionConfig &result,
- const NKikimrSchemeOp::TPartitionConfig &src, const NKikimrSchemeOp::TPartitionConfig &changes,
- const TAppData *appData, TString &errDesr)
-{
- result.CopyFrom(src); // inherit all data from src
-
- if (!ApplyChangesInColumnFamilies(result, src, changes, errDesr)) {
- return false;
- }
-
- if (changes.StorageRoomsSize()) {
- errDesr = TStringBuilder()
- << "StorageRooms should not be present in request.";
- return false;
- }
-
+ }
+
+ if (dst < size) {
+ items->Truncate(dst);
+ }
+ }
+
+ return posById;
+}
+}
+
+NKikimrSchemeOp::TPartitionConfig TPartitionConfigMerger::DefaultConfig(const TAppData* appData) {
+ NKikimrSchemeOp::TPartitionConfig cfg;
+
+ TIntrusiveConstPtr<NLocalDb::TCompactionPolicy> compactionPolicy = appData->DomainsInfo->GetDefaultUserTablePolicy();
+ compactionPolicy->Serialize(*cfg.MutableCompactionPolicy());
+
+ return cfg;
+}
+
+bool TPartitionConfigMerger::ApplyChanges(
+ NKikimrSchemeOp::TPartitionConfig &result,
+ const NKikimrSchemeOp::TPartitionConfig &src, const NKikimrSchemeOp::TPartitionConfig &changes,
+ const TAppData *appData, TString &errDesr)
+{
+ result.CopyFrom(src); // inherit all data from src
+
+ if (!ApplyChangesInColumnFamilies(result, src, changes, errDesr)) {
+ return false;
+ }
+
+ if (changes.StorageRoomsSize()) {
+ errDesr = TStringBuilder()
+ << "StorageRooms should not be present in request.";
+ return false;
+ }
+
if (changes.HasFreezeState()) {
- if (changes.GetFreezeState() == NKikimrSchemeOp::EFreezeState::Unspecified) {
+ if (changes.GetFreezeState() == NKikimrSchemeOp::EFreezeState::Unspecified) {
errDesr = TStringBuilder() << "Unexpected freeze state";
return false;
}
@@ -400,267 +400,267 @@ bool TPartitionConfigMerger::ApplyChanges(
}
}
- if (changes.HasCompactionPolicy()) {
- result.MutableCompactionPolicy()->Clear();
- result.MutableCompactionPolicy()->CopyFrom(changes.GetCompactionPolicy());
- }
-
- if (changes.HasNamedCompactionPolicy()) {
- auto policyName = changes.GetNamedCompactionPolicy();
- if (policyName.empty()) {
- errDesr = "Empty compaction policy name, either set name or don't fill the section NamedCompactionPolicy";
- return false;
- }
-
- if (!appData->DomainsInfo->NamedCompactionPolicies.contains(policyName)) {
- errDesr = TStringBuilder() << "Invalid compaction policy name: " << policyName;
- return false;
- }
-
- auto policyPtr = appData->DomainsInfo->NamedCompactionPolicies.at(policyName);
- result.MutableCompactionPolicy()->Clear();
- policyPtr->Serialize(*result.MutableCompactionPolicy());
- }
-
-
+ if (changes.HasCompactionPolicy()) {
+ result.MutableCompactionPolicy()->Clear();
+ result.MutableCompactionPolicy()->CopyFrom(changes.GetCompactionPolicy());
+ }
+
+ if (changes.HasNamedCompactionPolicy()) {
+ auto policyName = changes.GetNamedCompactionPolicy();
+ if (policyName.empty()) {
+ errDesr = "Empty compaction policy name, either set name or don't fill the section NamedCompactionPolicy";
+ return false;
+ }
+
+ if (!appData->DomainsInfo->NamedCompactionPolicies.contains(policyName)) {
+ errDesr = TStringBuilder() << "Invalid compaction policy name: " << policyName;
+ return false;
+ }
+
+ auto policyPtr = appData->DomainsInfo->NamedCompactionPolicies.at(policyName);
+ result.MutableCompactionPolicy()->Clear();
+ policyPtr->Serialize(*result.MutableCompactionPolicy());
+ }
+
+
if (changes.FollowerGroupsSize()) {
// use FollowerGroups
if (result.HasFollowerCount()) {
// migration into FollowerCount -> HasFollowerGroup
// just abandon FollowerCount
result.ClearFollowerCount();
- }
-
+ }
+
if (result.HasCrossDataCenterFollowerCount()) {
// migration into CrossDataCenterFollowerCount -> HasFollowerGroup
// just abandon CrossDataCenterFollowerCount
result.ClearCrossDataCenterFollowerCount();
- }
-
+ }
+
if (changes.HasAllowFollowerPromotion()) {
// migration into AllowFollowerPromotion -> HasFollowerGroup
// just abandon AllowFollowerPromotion
result.ClearAllowFollowerPromotion();
- }
-
+ }
+
// here is the right place to compare and check src->FollowerGroups and changes->FollowerGroup for wise update
result.MutableFollowerGroups()->CopyFrom(changes.GetFollowerGroups());
- }
-
+ }
+
if (changes.HasCrossDataCenterFollowerCount()) {
if (result.FollowerGroupsSize()) {
errDesr = TStringBuilder() << "Forbided downgrade from FollowerGroup option to the HasCrossDataCenterFollowerCount option";
- return false;
- }
-
+ return false;
+ }
+
if (result.HasFollowerCount()) {
// migration into FollowerCount -> CrossDataCenterFollowerCount
// just abandon FollowerCount
result.ClearFollowerCount();
- }
-
+ }
+
result.SetCrossDataCenterFollowerCount(changes.GetCrossDataCenterFollowerCount());
- }
-
+ }
+
if (changes.HasFollowerCount()) {
if (result.HasCrossDataCenterFollowerCount()) {
errDesr = TStringBuilder() << "Forbided downgrade from CrossDataCenterFollowerCount option to the FollowerGroup option";
- return false;
- }
-
+ return false;
+ }
+
if (result.FollowerGroupsSize()) {
errDesr = TStringBuilder() << "Forbided downgrade from FollowerGroup option to the FollowerGroup option";
- return false;
- }
-
+ return false;
+ }
+
result.SetFollowerCount(changes.GetFollowerCount());
- }
-
+ }
+
if (changes.HasAllowFollowerPromotion()) {
if (result.FollowerGroupsSize()) {
errDesr = TStringBuilder() << "Forbided downgrade from FollowerGroup option to the AllowFollowerPromotion option";
- return false;
- }
-
+ return false;
+ }
+
result.SetAllowFollowerPromotion(changes.GetAllowFollowerPromotion());
- }
-
- if (changes.HasExecutorCacheSize()) {
- result.SetExecutorCacheSize(changes.GetExecutorCacheSize());
- }
-
- if (changes.HasResourceProfile()) {
- result.SetResourceProfile(changes.GetResourceProfile());
- }
-
- if (changes.HasChannelProfileId()) {
- result.SetChannelProfileId(changes.GetChannelProfileId());
- }
-
- if (changes.HasTxReadSizeLimit()) {
- result.SetTxReadSizeLimit(changes.GetTxReadSizeLimit());
- }
-
- if (changes.HasDisableStatisticsCalculation()) {
- result.SetDisableStatisticsCalculation(changes.GetDisableStatisticsCalculation());
- }
-
- if (changes.HasPartitioningPolicy()) {
- auto& cfgPolicy = *result.MutablePartitioningPolicy();
- auto& changesPolicy = changes.GetPartitioningPolicy();
-
- if (changesPolicy.HasSizeToSplit()) {
- cfgPolicy.SetSizeToSplit(changesPolicy.GetSizeToSplit());
- }
-
- if (changesPolicy.HasMinPartitionsCount()) {
- cfgPolicy.SetMinPartitionsCount(changesPolicy.GetMinPartitionsCount());
- }
-
- if (changesPolicy.HasMaxPartitionsCount()) {
- cfgPolicy.SetMaxPartitionsCount(changesPolicy.GetMaxPartitionsCount());
- }
-
- if (changesPolicy.HasFastSplitSettings()) {
- cfgPolicy.MutableFastSplitSettings()->CopyFrom(changesPolicy.GetFastSplitSettings());
- }
-
- if (changesPolicy.HasSplitByLoadSettings()) {
- cfgPolicy.MutableSplitByLoadSettings()->CopyFrom(changesPolicy.GetSplitByLoadSettings());
- }
- }
-
- if (changes.HasPipelineConfig()) {
- result.MutablePipelineConfig()->CopyFrom(changes.GetPipelineConfig());
- }
-
- if (changes.HasEnableFilterByKey()) {
- result.SetEnableFilterByKey(changes.GetEnableFilterByKey());
- }
-
- if (changes.HasExecutorFastLogPolicy()) {
- result.SetExecutorFastLogPolicy(changes.GetExecutorFastLogPolicy());
- }
-
- if (changes.HasEnableEraseCache()) {
- result.SetEnableEraseCache(changes.GetEnableEraseCache());
- }
-
- if (changes.HasEraseCacheMinRows()) {
- result.SetEraseCacheMinRows(changes.GetEraseCacheMinRows());
- }
-
- if (changes.HasEraseCacheMaxBytes()) {
- result.SetEraseCacheMaxBytes(changes.GetEraseCacheMaxBytes());
- }
-
- if (changes.HasFreezeState()) {
- result.SetFreezeState(changes.GetFreezeState());
- } else {
- //Do not send freeze state to DS
- result.ClearFreezeState();
- }
-
- if (changes.HasShadowData()) {
- result.SetShadowData(changes.GetShadowData());
- }
-
+ }
+
+ if (changes.HasExecutorCacheSize()) {
+ result.SetExecutorCacheSize(changes.GetExecutorCacheSize());
+ }
+
+ if (changes.HasResourceProfile()) {
+ result.SetResourceProfile(changes.GetResourceProfile());
+ }
+
+ if (changes.HasChannelProfileId()) {
+ result.SetChannelProfileId(changes.GetChannelProfileId());
+ }
+
+ if (changes.HasTxReadSizeLimit()) {
+ result.SetTxReadSizeLimit(changes.GetTxReadSizeLimit());
+ }
+
+ if (changes.HasDisableStatisticsCalculation()) {
+ result.SetDisableStatisticsCalculation(changes.GetDisableStatisticsCalculation());
+ }
+
+ if (changes.HasPartitioningPolicy()) {
+ auto& cfgPolicy = *result.MutablePartitioningPolicy();
+ auto& changesPolicy = changes.GetPartitioningPolicy();
+
+ if (changesPolicy.HasSizeToSplit()) {
+ cfgPolicy.SetSizeToSplit(changesPolicy.GetSizeToSplit());
+ }
+
+ if (changesPolicy.HasMinPartitionsCount()) {
+ cfgPolicy.SetMinPartitionsCount(changesPolicy.GetMinPartitionsCount());
+ }
+
+ if (changesPolicy.HasMaxPartitionsCount()) {
+ cfgPolicy.SetMaxPartitionsCount(changesPolicy.GetMaxPartitionsCount());
+ }
+
+ if (changesPolicy.HasFastSplitSettings()) {
+ cfgPolicy.MutableFastSplitSettings()->CopyFrom(changesPolicy.GetFastSplitSettings());
+ }
+
+ if (changesPolicy.HasSplitByLoadSettings()) {
+ cfgPolicy.MutableSplitByLoadSettings()->CopyFrom(changesPolicy.GetSplitByLoadSettings());
+ }
+ }
+
+ if (changes.HasPipelineConfig()) {
+ result.MutablePipelineConfig()->CopyFrom(changes.GetPipelineConfig());
+ }
+
+ if (changes.HasEnableFilterByKey()) {
+ result.SetEnableFilterByKey(changes.GetEnableFilterByKey());
+ }
+
+ if (changes.HasExecutorFastLogPolicy()) {
+ result.SetExecutorFastLogPolicy(changes.GetExecutorFastLogPolicy());
+ }
+
+ if (changes.HasEnableEraseCache()) {
+ result.SetEnableEraseCache(changes.GetEnableEraseCache());
+ }
+
+ if (changes.HasEraseCacheMinRows()) {
+ result.SetEraseCacheMinRows(changes.GetEraseCacheMinRows());
+ }
+
+ if (changes.HasEraseCacheMaxBytes()) {
+ result.SetEraseCacheMaxBytes(changes.GetEraseCacheMaxBytes());
+ }
+
+ if (changes.HasFreezeState()) {
+ result.SetFreezeState(changes.GetFreezeState());
+ } else {
+ //Do not send freeze state to DS
+ result.ClearFreezeState();
+ }
+
+ if (changes.HasShadowData()) {
+ result.SetShadowData(changes.GetShadowData());
+ }
+
if (changes.HasKeepSnapshotTimeout()) {
result.SetKeepSnapshotTimeout(changes.GetKeepSnapshotTimeout());
}
- return true;
-}
-
-bool TPartitionConfigMerger::ApplyChangesInColumnFamilies(
- NKikimrSchemeOp::TPartitionConfig &result,
- const NKikimrSchemeOp::TPartitionConfig &src, const NKikimrSchemeOp::TPartitionConfig &changes,
- TString &errDesr)
-{
- result.MutableColumnFamilies()->CopyFrom(src.GetColumnFamilies());
- TColumnFamiliesMerger merger(result);
-
- THashSet<ui32> changedCFamilies;
-
- for (const auto& changesFamily : changes.GetColumnFamilies()) {
- NKikimrSchemeOp::TFamilyDescription* cFamilyPtr = nullptr;
- if (changesFamily.HasId() && changesFamily.HasName()) {
- cFamilyPtr = merger.AddOrGet(changesFamily.GetId(), changesFamily.GetName(), errDesr);
- } else if (changesFamily.HasId()) {
- cFamilyPtr = merger.AddOrGet(changesFamily.GetId(), errDesr);
- } else if (changesFamily.HasName()) {
- cFamilyPtr = merger.AddOrGet(changesFamily.GetName(), errDesr);
- } else {
- cFamilyPtr = merger.AddOrGet(0, errDesr);
- }
-
- if (!cFamilyPtr) {
- return false;
- }
-
- auto& dstFamily = *cFamilyPtr;
- const auto& familyId = dstFamily.GetId();
- const auto& familyName = dstFamily.GetName();
-
- if (!changedCFamilies.insert(familyId).second) {
+ return true;
+}
+
+bool TPartitionConfigMerger::ApplyChangesInColumnFamilies(
+ NKikimrSchemeOp::TPartitionConfig &result,
+ const NKikimrSchemeOp::TPartitionConfig &src, const NKikimrSchemeOp::TPartitionConfig &changes,
+ TString &errDesr)
+{
+ result.MutableColumnFamilies()->CopyFrom(src.GetColumnFamilies());
+ TColumnFamiliesMerger merger(result);
+
+ THashSet<ui32> changedCFamilies;
+
+ for (const auto& changesFamily : changes.GetColumnFamilies()) {
+ NKikimrSchemeOp::TFamilyDescription* cFamilyPtr = nullptr;
+ if (changesFamily.HasId() && changesFamily.HasName()) {
+ cFamilyPtr = merger.AddOrGet(changesFamily.GetId(), changesFamily.GetName(), errDesr);
+ } else if (changesFamily.HasId()) {
+ cFamilyPtr = merger.AddOrGet(changesFamily.GetId(), errDesr);
+ } else if (changesFamily.HasName()) {
+ cFamilyPtr = merger.AddOrGet(changesFamily.GetName(), errDesr);
+ } else {
+ cFamilyPtr = merger.AddOrGet(0, errDesr);
+ }
+
+ if (!cFamilyPtr) {
+ return false;
+ }
+
+ auto& dstFamily = *cFamilyPtr;
+ const auto& familyId = dstFamily.GetId();
+ const auto& familyName = dstFamily.GetName();
+
+ if (!changedCFamilies.insert(familyId).second) {
errDesr = TStringBuilder()
- << "Multiple changes for the same column family are not allowed. ColumnFamily id: " << familyId << " name: " << familyName;
- return false;
- }
-
- if (changesFamily.HasRoom() || changesFamily.HasCodec() || changesFamily.HasInMemory()) {
+ << "Multiple changes for the same column family are not allowed. ColumnFamily id: " << familyId << " name: " << familyName;
+ return false;
+ }
+
+ if (changesFamily.HasRoom() || changesFamily.HasCodec() || changesFamily.HasInMemory()) {
errDesr = TStringBuilder()
- << "Deprecated parameters in column family. ColumnFamily id: " << familyId << " name: " << familyName;
+ << "Deprecated parameters in column family. ColumnFamily id: " << familyId << " name: " << familyName;
return false;
- }
-
- if (familyId != 0) {
+ }
+
+ if (familyId != 0) {
const bool allowColumnFamilies = (
- KIKIMR_SCHEMESHARD_ALLOW_COLUMN_FAMILIES ||
- AppData()->AllowColumnFamiliesForTest);
+ KIKIMR_SCHEMESHARD_ALLOW_COLUMN_FAMILIES ||
+ AppData()->AllowColumnFamiliesForTest);
if (!allowColumnFamilies) {
errDesr = TStringBuilder()
<< "Server support for column families is not yet available";
return false;
}
- if (changesFamily.HasStorageConfig()) {
- if (changesFamily.GetStorageConfig().HasDataThreshold() ||
- changesFamily.GetStorageConfig().HasExternalThreshold() ||
- changesFamily.GetStorageConfig().HasSysLog() ||
- changesFamily.GetStorageConfig().HasLog() ||
- changesFamily.GetStorageConfig().HasExternal())
+ if (changesFamily.HasStorageConfig()) {
+ if (changesFamily.GetStorageConfig().HasDataThreshold() ||
+ changesFamily.GetStorageConfig().HasExternalThreshold() ||
+ changesFamily.GetStorageConfig().HasSysLog() ||
+ changesFamily.GetStorageConfig().HasLog() ||
+ changesFamily.GetStorageConfig().HasExternal())
{
errDesr = TStringBuilder()
- << "Unsupported StorageConfig settings found. Column Family id: " << familyId << " name: " << familyName;
+ << "Unsupported StorageConfig settings found. Column Family id: " << familyId << " name: " << familyName;
return false;
}
}
- if (changesFamily.HasStorage()) {
+ if (changesFamily.HasStorage()) {
errDesr = TStringBuilder()
- << "Deprecated Storage parameter in column family. ColumnFamily id: " << familyId << " name: " << familyName;
+ << "Deprecated Storage parameter in column family. ColumnFamily id: " << familyId << " name: " << familyName;
return false;
}
}
-
- if (changesFamily.HasColumnCodec()) {
- if (changesFamily.GetColumnCodec() == NKikimrSchemeOp::EColumnCodec::ColumnCodecZSTD) {
+
+ if (changesFamily.HasColumnCodec()) {
+ if (changesFamily.GetColumnCodec() == NKikimrSchemeOp::EColumnCodec::ColumnCodecZSTD) {
errDesr = TStringBuilder()
<< "Unsupported ColumnCodec. ColumnFamily id: " << familyId << " name: " << familyName;
return false;
}
- dstFamily.SetColumnCodec(changesFamily.GetColumnCodec());
- }
-
- if (changesFamily.HasColumnCache()) {
- dstFamily.SetColumnCache(changesFamily.GetColumnCache());
- }
-
- if (changesFamily.HasStorage()) {
- dstFamily.SetStorage(changesFamily.GetStorage());
- }
-
- if (changesFamily.HasStorageConfig()) {
- const auto& srcStorage = changesFamily.GetStorageConfig();
+ dstFamily.SetColumnCodec(changesFamily.GetColumnCodec());
+ }
+
+ if (changesFamily.HasColumnCache()) {
+ dstFamily.SetColumnCache(changesFamily.GetColumnCache());
+ }
+
+ if (changesFamily.HasStorage()) {
+ dstFamily.SetStorage(changesFamily.GetStorage());
+ }
+
+ if (changesFamily.HasStorageConfig()) {
+ const auto& srcStorage = changesFamily.GetStorageConfig();
auto& dstStorage = *dstFamily.MutableStorageConfig();
if (srcStorage.HasSysLog()) {
@@ -686,314 +686,314 @@ bool TPartitionConfigMerger::ApplyChangesInColumnFamilies(
if (srcStorage.HasExternalThreshold()) {
dstStorage.SetExternalThreshold(srcStorage.GetExternalThreshold());
}
- }
- }
-
- return true;
-}
-
-THashMap<ui32, size_t> TPartitionConfigMerger::DeduplicateColumnFamiliesById(NKikimrSchemeOp::TPartitionConfig &config)
-{
- return DeduplicateRepeatedById(
- config.MutableColumnFamilies(),
- [](const auto& item) { return item.GetId(); },
- [](const auto& left, const auto& right) -> bool {
- if (left.HasStorageConfig() && !right.HasStorageConfig()) {
- // Dropping storage config is not allowed
- return false;
- }
- if (left.HasId() && !right.HasId()) {
- // New item without id is suspicious
- return false;
- }
- // Prefer the right element
- return true;
- });
-}
-
-THashMap<ui32, size_t> TPartitionConfigMerger::DeduplicateStorageRoomsById(NKikimrSchemeOp::TPartitionConfig &config)
-{
- return DeduplicateRepeatedById(
- config.MutableStorageRooms(),
- [](const auto& item) { return item.GetRoomId(); },
- [](const auto& left, const auto& right) -> bool {
- Y_UNUSED(left);
- Y_UNUSED(right);
- // Always prefer the right element
- return true;
- });
-}
-
-NKikimrSchemeOp::TFamilyDescription &TPartitionConfigMerger::MutableColumnFamilyById(
- NKikimrSchemeOp::TPartitionConfig &partitionConfig,
- THashMap<ui32, size_t> &posById, ui32 familyId)
-{
- auto it = posById.find(familyId);
- if (it != posById.end()) {
- return *partitionConfig.MutableColumnFamilies(it->second);
- }
-
- auto& family = *partitionConfig.AddColumnFamilies();
- posById[familyId] = partitionConfig.ColumnFamiliesSize() - 1;
- family.SetId(familyId);
- return family;
-}
-
-bool TPartitionConfigMerger::VerifyCreateParams(
- const NKikimrSchemeOp::TPartitionConfig &config,
- const TAppData *appData, const bool shadowDataAllowed, TString &errDescr)
-{
- if (config.HasShadowData()) {
- if (!shadowDataAllowed) {
- errDescr = TStringBuilder() << "Setting ShadowData is prohibited";
- return false;
- }
- }
-
- if (!config.HasCompactionPolicy()) {
- errDescr = TStringBuilder() << "CompactionPolicy should be set";
- return false;
- }
-
- if (config.HasChannelProfileId()) {
- ui32 channelProfile = config.GetChannelProfileId();
- if (channelProfile >= appData->ChannelProfiles->Profiles.size()) {
- errDescr = TStringBuilder()
- << "Unknown profileId " << channelProfile
- << ", should be in [0 .. " << appData->ChannelProfiles->Profiles.size() - 1 << "]";
- return false;
- }
- }
-
+ }
+ }
+
+ return true;
+}
+
+THashMap<ui32, size_t> TPartitionConfigMerger::DeduplicateColumnFamiliesById(NKikimrSchemeOp::TPartitionConfig &config)
+{
+ return DeduplicateRepeatedById(
+ config.MutableColumnFamilies(),
+ [](const auto& item) { return item.GetId(); },
+ [](const auto& left, const auto& right) -> bool {
+ if (left.HasStorageConfig() && !right.HasStorageConfig()) {
+ // Dropping storage config is not allowed
+ return false;
+ }
+ if (left.HasId() && !right.HasId()) {
+ // New item without id is suspicious
+ return false;
+ }
+ // Prefer the right element
+ return true;
+ });
+}
+
+THashMap<ui32, size_t> TPartitionConfigMerger::DeduplicateStorageRoomsById(NKikimrSchemeOp::TPartitionConfig &config)
+{
+ return DeduplicateRepeatedById(
+ config.MutableStorageRooms(),
+ [](const auto& item) { return item.GetRoomId(); },
+ [](const auto& left, const auto& right) -> bool {
+ Y_UNUSED(left);
+ Y_UNUSED(right);
+ // Always prefer the right element
+ return true;
+ });
+}
+
+NKikimrSchemeOp::TFamilyDescription &TPartitionConfigMerger::MutableColumnFamilyById(
+ NKikimrSchemeOp::TPartitionConfig &partitionConfig,
+ THashMap<ui32, size_t> &posById, ui32 familyId)
+{
+ auto it = posById.find(familyId);
+ if (it != posById.end()) {
+ return *partitionConfig.MutableColumnFamilies(it->second);
+ }
+
+ auto& family = *partitionConfig.AddColumnFamilies();
+ posById[familyId] = partitionConfig.ColumnFamiliesSize() - 1;
+ family.SetId(familyId);
+ return family;
+}
+
+bool TPartitionConfigMerger::VerifyCreateParams(
+ const NKikimrSchemeOp::TPartitionConfig &config,
+ const TAppData *appData, const bool shadowDataAllowed, TString &errDescr)
+{
+ if (config.HasShadowData()) {
+ if (!shadowDataAllowed) {
+ errDescr = TStringBuilder() << "Setting ShadowData is prohibited";
+ return false;
+ }
+ }
+
+ if (!config.HasCompactionPolicy()) {
+ errDescr = TStringBuilder() << "CompactionPolicy should be set";
+ return false;
+ }
+
+ if (config.HasChannelProfileId()) {
+ ui32 channelProfile = config.GetChannelProfileId();
+ if (channelProfile >= appData->ChannelProfiles->Profiles.size()) {
+ errDescr = TStringBuilder()
+ << "Unknown profileId " << channelProfile
+ << ", should be in [0 .. " << appData->ChannelProfiles->Profiles.size() - 1 << "]";
+ return false;
+ }
+ }
+
if (config.HasFollowerCount()) {
ui32 count = config.GetFollowerCount();
if (count > MaxFollowersCount) {
- errDescr = TStringBuilder()
+ errDescr = TStringBuilder()
<< "Too much followers: " << count;
- return false;
- }
- }
-
+ return false;
+ }
+ }
+
if (config.HasCrossDataCenterFollowerCount()) {
ui32 count = config.GetCrossDataCenterFollowerCount();
if (count > MaxFollowersCount) {
- errDescr = TStringBuilder()
+ errDescr = TStringBuilder()
<< "Too much followers: " << count;
- return false;
- }
- }
-
+ return false;
+ }
+ }
+
for (const auto& followerGroup: config.GetFollowerGroups()) {
if (followerGroup.HasFollowerCount()) {
if (followerGroup.GetFollowerCount() > MaxFollowersCount) {
- errDescr = TStringBuilder()
+ errDescr = TStringBuilder()
<< "FollowerGroup: Too much followers: " << followerGroup.GetFollowerCount();
- return false;
- }
- }
-
+ return false;
+ }
+ }
+
if (followerGroup.HasAllowClientRead()) {
- errDescr = TStringBuilder()
+ errDescr = TStringBuilder()
<< "FollowerGroup: AllowClientRead is enabled, but hasn't been tested";
- return false;
- }
-
+ return false;
+ }
+
if (followerGroup.AllowedNodeIDsSize()) {
- errDescr = TStringBuilder()
+ errDescr = TStringBuilder()
<< "FollowerGroup: AllowedNodeIDs is enabled, but hasn't been tested";
- return false;
- }
-
+ return false;
+ }
+
if (followerGroup.AllowedDataCenterNumIDsSize() || followerGroup.AllowedDataCentersSize()) {
- errDescr = TStringBuilder()
+ errDescr = TStringBuilder()
<< "FollowerGroup: AllowedDataCenterIDs is enabled, hasn't been tested";
- return false;
- }
-
+ return false;
+ }
+
if (followerGroup.HasLocalNodeOnly()) {
- errDescr = TStringBuilder()
+ errDescr = TStringBuilder()
<< "FollowerGroup: LocalNodeOnly is enabled, but hasn't been tested";
- return false;
- }
-
+ return false;
+ }
+
if (followerGroup.HasRequireDifferentNodes()) {
- errDescr = TStringBuilder()
+ errDescr = TStringBuilder()
<< "FollowerGroup: LocalNodeOnly is enabled, but hasn't been tested";
- return false;
- }
- }
-
+ return false;
+ }
+ }
+
if (config.HasFollowerCount() + config.HasCrossDataCenterFollowerCount() + (config.FollowerGroupsSize() > 0) > 1) {
- errDescr = TStringBuilder()
+ errDescr = TStringBuilder()
<< "PartitionConfig: FollowerCount, CrossDataCenterFollowerCount and FollowerGroup are mutually exclusive.";
- return false;
- }
-
+ return false;
+ }
+
if (config.FollowerGroupsSize() > 1) {
- errDescr = TStringBuilder()
+ errDescr = TStringBuilder()
<< "FollowerGroup: only one follower group is allowed for now";
- return false;
- }
-
+ return false;
+ }
+
bool hasStorageConfig = false;
bool hasAuxilaryFamilies = false;
-
- for (const auto& family : config.GetColumnFamilies()) {
- ui32 fId = family.GetId();
+
+ for (const auto& family : config.GetColumnFamilies()) {
+ ui32 fId = family.GetId();
if (fId == 0) {
hasStorageConfig = family.HasStorageConfig();
} else {
hasAuxilaryFamilies = true;
- }
+ }
}
-
+
if (hasAuxilaryFamilies && !hasStorageConfig) {
errDescr = TStringBuilder()
- << "Column families require StorageConfig specification";
+ << "Column families require StorageConfig specification";
return false;
- }
-
- for (const auto& family : config.GetColumnFamilies()) {
- ui32 fId = family.GetId();
- auto fName = family.GetName();
- if (fId == 0) {
- if (fName != "" && fName != "default") {
- errDescr = TStringBuilder()
- << "Column family with id " << fId << " has to be named as default or be empty";
- }
- } else {
- if (fName == "default") {
- errDescr = TStringBuilder()
- << "Column family with id " << fId << " has name default"
- << ", name default is reseved for family with id 0";
- }
- }
- }
-
- if (!VerifyCompactionPolicy(config.GetCompactionPolicy(), errDescr)) {
+ }
+
+ for (const auto& family : config.GetColumnFamilies()) {
+ ui32 fId = family.GetId();
+ auto fName = family.GetName();
+ if (fId == 0) {
+ if (fName != "" && fName != "default") {
+ errDescr = TStringBuilder()
+ << "Column family with id " << fId << " has to be named as default or be empty";
+ }
+ } else {
+ if (fName == "default") {
+ errDescr = TStringBuilder()
+ << "Column family with id " << fId << " has name default"
+ << ", name default is reseved for family with id 0";
+ }
+ }
+ }
+
+ if (!VerifyCompactionPolicy(config.GetCompactionPolicy(), errDescr)) {
+ return false;
+ }
+
+ return true;
+}
+
+bool IsEquivalent(
+ const NKikimrSchemeOp::TStorageSettings& left,
+ const NKikimrSchemeOp::TStorageSettings& right)
+{
+ return left.HasPreferredPoolKind() == right.HasPreferredPoolKind()
+ && left.GetPreferredPoolKind() == right.GetPreferredPoolKind()
+ && left.HasAllowOtherKinds() == right.HasAllowOtherKinds()
+ && left.GetAllowOtherKinds() == right.GetAllowOtherKinds();
+}
+
+bool TPartitionConfigMerger::VerifyAlterParams(
+ const NKikimrSchemeOp::TPartitionConfig &srcConfig,
+ const NKikimrSchemeOp::TPartitionConfig &dstConfig,
+ const TAppData *appData, const bool shadowDataAllowed, TString &errDescr)
+{
+ if (!VerifyCreateParams(dstConfig, appData, shadowDataAllowed, errDescr)) {
return false;
}
- return true;
-}
-
-bool IsEquivalent(
- const NKikimrSchemeOp::TStorageSettings& left,
- const NKikimrSchemeOp::TStorageSettings& right)
-{
- return left.HasPreferredPoolKind() == right.HasPreferredPoolKind()
- && left.GetPreferredPoolKind() == right.GetPreferredPoolKind()
- && left.HasAllowOtherKinds() == right.HasAllowOtherKinds()
- && left.GetAllowOtherKinds() == right.GetAllowOtherKinds();
-}
-
-bool TPartitionConfigMerger::VerifyAlterParams(
- const NKikimrSchemeOp::TPartitionConfig &srcConfig,
- const NKikimrSchemeOp::TPartitionConfig &dstConfig,
- const TAppData *appData, const bool shadowDataAllowed, TString &errDescr)
-{
- if (!VerifyCreateParams(dstConfig, appData, shadowDataAllowed, errDescr)) {
- return false;
- }
-
-
- if (dstConfig.GetShadowData() && !srcConfig.GetShadowData()) {
+
+ if (dstConfig.GetShadowData() && !srcConfig.GetShadowData()) {
errDescr = TStringBuilder() << "Cannot enable ShadowData after table is created";
return false;
}
- if (dstConfig.HasChannelProfileId()) {
- for (const auto& family : dstConfig.GetColumnFamilies()) {
+ if (dstConfig.HasChannelProfileId()) {
+ for (const auto& family : dstConfig.GetColumnFamilies()) {
if (family.HasStorageConfig()) {
errDescr = TStringBuilder()
- << "Migration from profile id by storage config is not allowed, was "
- << srcConfig.GetChannelProfileId() << ", asks storage config";
+ << "Migration from profile id by storage config is not allowed, was "
+ << srcConfig.GetChannelProfileId() << ", asks storage config";
return false;
}
- }
-
- if (srcConfig.GetChannelProfileId() != dstConfig.GetChannelProfileId()) {
+ }
+
+ if (srcConfig.GetChannelProfileId() != dstConfig.GetChannelProfileId()) {
errDescr = TStringBuilder()
- << "Profile modification is not allowed, was "
- << srcConfig.GetChannelProfileId()
- << ", asks "
- << dstConfig.GetChannelProfileId();
- return false;
- }
- }
-
- const NKikimrSchemeOp::TStorageConfig* wasStorageConfig = nullptr;
- for (const auto& family : srcConfig.GetColumnFamilies()) {
+ << "Profile modification is not allowed, was "
+ << srcConfig.GetChannelProfileId()
+ << ", asks "
+ << dstConfig.GetChannelProfileId();
+ return false;
+ }
+ }
+
+ const NKikimrSchemeOp::TStorageConfig* wasStorageConfig = nullptr;
+ for (const auto& family : srcConfig.GetColumnFamilies()) {
if (family.GetId() == 0 && family.HasStorageConfig()) {
wasStorageConfig = &family.GetStorageConfig();
break;
}
}
-
- const NKikimrSchemeOp::TStorageConfig* isStorageConfig = nullptr;
- for (const auto& family : dstConfig.GetColumnFamilies()) {
+
+ const NKikimrSchemeOp::TStorageConfig* isStorageConfig = nullptr;
+ for (const auto& family : dstConfig.GetColumnFamilies()) {
if (family.GetId() == 0 && family.HasStorageConfig()) {
isStorageConfig = &family.GetStorageConfig();
break;
}
}
- if (wasStorageConfig) {
+ if (wasStorageConfig) {
Y_VERIFY(isStorageConfig); // by inherit logic
-
+
auto& srcStorage = *wasStorageConfig;
auto& cfgStorage = *isStorageConfig;
-
+
// SysLog and Log cannot be reassigned
if (srcStorage.HasSysLog() != cfgStorage.HasSysLog() ||
- srcStorage.HasLog() != cfgStorage.HasLog() ||
- !IsEquivalent(srcStorage.GetSysLog(), cfgStorage.GetSysLog()) ||
- !IsEquivalent(srcStorage.GetLog(), cfgStorage.GetLog()))
- {
- errDescr = TStringBuilder()
+ srcStorage.HasLog() != cfgStorage.HasLog() ||
+ !IsEquivalent(srcStorage.GetSysLog(), cfgStorage.GetSysLog()) ||
+ !IsEquivalent(srcStorage.GetLog(), cfgStorage.GetLog()))
+ {
+ errDescr = TStringBuilder()
<< "Incompatible alter of storage config in default column family denied."
<< " Data either missing or different in request."
- << " Was '" << srcStorage.ShortDebugString()
- << "', in request '" << cfgStorage.ShortDebugString() << "'";
- return false;
- }
+ << " Was '" << srcStorage.ShortDebugString()
+ << "', in request '" << cfgStorage.ShortDebugString() << "'";
+ return false;
+ }
if (!KIKIMR_SCHEMESHARD_ALLOW_COLUMN_FAMILIES && !AppData()->AllowColumnFamiliesForTest) {
// When feature flag is not enabled we don't allow changes to data channels
// This is so we stay compatible without surprises during migration periods
if (srcStorage.HasData() != cfgStorage.HasData() ||
- srcStorage.HasExternal() != cfgStorage.HasExternal() ||
- !IsEquivalent(srcStorage.GetData(), cfgStorage.GetData()) ||
- !IsEquivalent(srcStorage.GetExternal(), cfgStorage.GetExternal()))
+ srcStorage.HasExternal() != cfgStorage.HasExternal() ||
+ !IsEquivalent(srcStorage.GetData(), cfgStorage.GetData()) ||
+ !IsEquivalent(srcStorage.GetExternal(), cfgStorage.GetExternal()))
{
errDescr = TStringBuilder()
- << "Changing column family storage is currently disabled on the server."
- << " Was '" << srcStorage.ShortDebugString()
- << "', in request '" << cfgStorage.ShortDebugString() << "'";
+ << "Changing column family storage is currently disabled on the server."
+ << " Was '" << srcStorage.ShortDebugString()
+ << "', in request '" << cfgStorage.ShortDebugString() << "'";
return false;
}
}
- }
-
- if (isStorageConfig) {
- if (!wasStorageConfig) {
- errDescr = TStringBuilder()
- << "Couldn't add storage configuration if it hasn't been set before";
- return false;
- }
- }
-
+ }
+
+ if (isStorageConfig) {
+ if (!wasStorageConfig) {
+ errDescr = TStringBuilder()
+ << "Couldn't add storage configuration if it hasn't been set before";
+ return false;
+ }
+ }
+
// Verify auxilary families
bool srcFamiliesBuilt = false;
- THashMap<ui32, const NKikimrSchemeOp::TFamilyDescription*> srcFamilies;
- for (const auto& family : dstConfig.GetColumnFamilies()) {
+ THashMap<ui32, const NKikimrSchemeOp::TFamilyDescription*> srcFamilies;
+ for (const auto& family : dstConfig.GetColumnFamilies()) {
if (family.GetId() == 0) {
// Primary family has already been checked above
continue;
}
if (!srcFamiliesBuilt) {
- for (const auto& srcFamily : srcConfig.GetColumnFamilies()) {
+ for (const auto& srcFamily : srcConfig.GetColumnFamilies()) {
if (srcFamily.GetId() != 0) {
srcFamilies[srcFamily.GetId()] = &srcFamily;
}
@@ -1011,13 +1011,13 @@ bool TPartitionConfigMerger::VerifyAlterParams(
// Data may be freely changed, however unsupported settings cannot be handled
if (srcStorage.HasSysLog() != dstStorage.HasSysLog() ||
- srcStorage.HasLog() != dstStorage.HasLog() ||
- srcStorage.HasExternal() != dstStorage.HasExternal())
+ srcStorage.HasLog() != dstStorage.HasLog() ||
+ srcStorage.HasExternal() != dstStorage.HasExternal())
{
errDescr = TStringBuilder()
- << "Incompatible alter of storage config in column family " << family.GetId() << " denied."
- << " Was '" << srcStorage.ShortDebugString()
- << "', requested '" << dstStorage.ShortDebugString() << "'";
+ << "Incompatible alter of storage config in column family " << family.GetId() << " denied."
+ << " Was '" << srcStorage.ShortDebugString()
+ << "', requested '" << dstStorage.ShortDebugString() << "'";
return false;
}
@@ -1025,12 +1025,12 @@ bool TPartitionConfigMerger::VerifyAlterParams(
// When feature flag is not enabled we don't allow changes to data channels
// This is so we stay compatible without surprises during migration periods
if (srcStorage.HasData() != dstStorage.HasData() ||
- !IsEquivalent(srcStorage.GetData(), dstStorage.GetData()))
+ !IsEquivalent(srcStorage.GetData(), dstStorage.GetData()))
{
errDescr = TStringBuilder()
- << "Changing column family storage is currently disabled on the server."
- << " Was '" << srcStorage.ShortDebugString()
- << "', in request '" << dstStorage.ShortDebugString() << "'";
+ << "Changing column family storage is currently disabled on the server."
+ << " Was '" << srcStorage.ShortDebugString()
+ << "', in request '" << dstStorage.ShortDebugString() << "'";
return false;
}
}
@@ -1042,62 +1042,62 @@ bool TPartitionConfigMerger::VerifyAlterParams(
// When feature flag is not enabled we don't allow adding StorageConfig
if (family.HasStorageConfig() && (!srcFamily || !srcFamily->HasStorageConfig())) {
errDescr = TStringBuilder()
- << "Adding column family storage is currently disabled on the server.";
+ << "Adding column family storage is currently disabled on the server.";
return false;
}
}
}
- if (dstConfig.HasCompactionPolicy()) {
- if (!VerifyCompactionPolicy(dstConfig.GetCompactionPolicy(), errDescr)) {
+ if (dstConfig.HasCompactionPolicy()) {
+ if (!VerifyCompactionPolicy(dstConfig.GetCompactionPolicy(), errDescr)) {
+ return false;
+ }
+ NLocalDb::TCompactionPolicy oldPolicy(srcConfig.GetCompactionPolicy());
+ NLocalDb::TCompactionPolicy newPolicy(dstConfig.GetCompactionPolicy());
+ if (!NLocalDb::ValidateCompactionPolicyChange(oldPolicy, newPolicy, errDescr)) {
return false;
}
- NLocalDb::TCompactionPolicy oldPolicy(srcConfig.GetCompactionPolicy());
- NLocalDb::TCompactionPolicy newPolicy(dstConfig.GetCompactionPolicy());
- if (!NLocalDb::ValidateCompactionPolicyChange(oldPolicy, newPolicy, errDescr)) {
- return false;
- }
- }
-
- if (!VerifyCommandOnFrozenTable(srcConfig, dstConfig)) {
+ }
+
+ if (!VerifyCommandOnFrozenTable(srcConfig, dstConfig)) {
errDescr = TStringBuilder() <<
- "Table is frozen. Only unfreeze alter is allowed";
+ "Table is frozen. Only unfreeze alter is allowed";
return false;
}
- return true;
-}
-
-bool TPartitionConfigMerger::VerifyCompactionPolicy(const NKikimrSchemeOp::TCompactionPolicy &policy, TString &err)
+ return true;
+}
+
+bool TPartitionConfigMerger::VerifyCompactionPolicy(const NKikimrSchemeOp::TCompactionPolicy &policy, TString &err)
{
if (policy.HasCompactionStrategy()) {
switch (policy.GetCompactionStrategy()) {
- case NKikimrSchemeOp::CompactionStrategyUnset:
- case NKikimrSchemeOp::CompactionStrategyGenerational:
- break;
- case NKikimrSchemeOp::CompactionStrategySharded:
- if (!KIKIMR_ALLOW_SHARDED_COMPACTION) {
- err = TStringBuilder()
+ case NKikimrSchemeOp::CompactionStrategyUnset:
+ case NKikimrSchemeOp::CompactionStrategyGenerational:
+ break;
+ case NKikimrSchemeOp::CompactionStrategySharded:
+ if (!KIKIMR_ALLOW_SHARDED_COMPACTION) {
+ err = TStringBuilder()
<< "Unsupported compaction strategy.";
- return false;
- }
- break;
- default:
- err = TStringBuilder()
+ return false;
+ }
+ break;
+ default:
+ err = TStringBuilder()
<< "Unsupported compaction strategy.";
- return false;
+ return false;
}
}
return true;
}
-bool TPartitionConfigMerger::VerifyCommandOnFrozenTable(const NKikimrSchemeOp::TPartitionConfig &srcConfig, const NKikimrSchemeOp::TPartitionConfig &dstConfig)
-{
- if (srcConfig.HasFreezeState() &&
- srcConfig.GetFreezeState() == NKikimrSchemeOp::EFreezeState::Freeze) {
- if (dstConfig.HasFreezeState() &&
- dstConfig.GetFreezeState() == NKikimrSchemeOp::EFreezeState::Unfreeze) {
+bool TPartitionConfigMerger::VerifyCommandOnFrozenTable(const NKikimrSchemeOp::TPartitionConfig &srcConfig, const NKikimrSchemeOp::TPartitionConfig &dstConfig)
+{
+ if (srcConfig.HasFreezeState() &&
+ srcConfig.GetFreezeState() == NKikimrSchemeOp::EFreezeState::Freeze) {
+ if (dstConfig.HasFreezeState() &&
+ dstConfig.GetFreezeState() == NKikimrSchemeOp::EFreezeState::Unfreeze) {
// Only unfreeze cmd is allowd
return true;
}
@@ -1106,67 +1106,67 @@ bool TPartitionConfigMerger::VerifyCommandOnFrozenTable(const NKikimrSchemeOp::T
return true;
}
-void TTableInfo::FinishAlter() {
- Y_VERIFY(AlterData, "No alter data at Alter complete");
- AlterVersion = AlterData->AlterVersion;
- NextColumnId = AlterData->NextColumnId;
- for (const auto& col : AlterData->Columns) {
- TColumn * oldCol = Columns.FindPtr(col.first);
- if (oldCol) {
- //oldCol->CreateVersion = col.second.CreateVersion;
- oldCol->DeleteVersion = col.second.DeleteVersion;
+void TTableInfo::FinishAlter() {
+ Y_VERIFY(AlterData, "No alter data at Alter complete");
+ AlterVersion = AlterData->AlterVersion;
+ NextColumnId = AlterData->NextColumnId;
+ for (const auto& col : AlterData->Columns) {
+ TColumn * oldCol = Columns.FindPtr(col.first);
+ if (oldCol) {
+ //oldCol->CreateVersion = col.second.CreateVersion;
+ oldCol->DeleteVersion = col.second.DeleteVersion;
oldCol->Family = col.second.Family;
- } else {
- Columns[col.first] = col.second;
- if (col.second.KeyOrder != (ui32)-1) {
- KeyColumnIds.resize(Max<ui32>(KeyColumnIds.size(), col.second.KeyOrder + 1));
- KeyColumnIds[col.second.KeyOrder] = col.first;
- }
- }
- }
-
- // Apply partition config changes
+ } else {
+ Columns[col.first] = col.second;
+ if (col.second.KeyOrder != (ui32)-1) {
+ KeyColumnIds.resize(Max<ui32>(KeyColumnIds.size(), col.second.KeyOrder + 1));
+ KeyColumnIds[col.second.KeyOrder] = col.first;
+ }
+ }
+ }
+
+ // Apply partition config changes
auto& partitionConfig = MutablePartitionConfig();
- if (AlterData->IsFullPartitionConfig()) {
- auto& newConfig = AlterData->PartitionConfigFull();
+ if (AlterData->IsFullPartitionConfig()) {
+ auto& newConfig = AlterData->PartitionConfigFull();
partitionConfig.Swap(&newConfig);
- } else {
- // Copy pase from 18-6
- // Apply partition config changes
- const auto& newConfig = AlterData->PartitionConfigDiff();
- if (newConfig.HasExecutorCacheSize()) {
- partitionConfig.SetExecutorCacheSize(newConfig.GetExecutorCacheSize());
- }
- if (newConfig.HasTxReadSizeLimit()) {
- partitionConfig.SetTxReadSizeLimit(newConfig.GetTxReadSizeLimit());
- }
- if (newConfig.HasDisableStatisticsCalculation()) {
- partitionConfig.SetDisableStatisticsCalculation(newConfig.GetDisableStatisticsCalculation());
- }
- if (newConfig.HasCompactionPolicy()) {
- partitionConfig.MutableCompactionPolicy()->CopyFrom(newConfig.GetCompactionPolicy());
- }
- if (newConfig.HasPartitioningPolicy()) {
- partitionConfig.MutablePartitioningPolicy()->CopyFrom(newConfig.GetPartitioningPolicy());
- }
- if (newConfig.HasPipelineConfig()) {
- partitionConfig.MutablePipelineConfig()->CopyFrom(newConfig.GetPipelineConfig());
- }
+ } else {
+ // Copy pase from 18-6
+ // Apply partition config changes
+ const auto& newConfig = AlterData->PartitionConfigDiff();
+ if (newConfig.HasExecutorCacheSize()) {
+ partitionConfig.SetExecutorCacheSize(newConfig.GetExecutorCacheSize());
+ }
+ if (newConfig.HasTxReadSizeLimit()) {
+ partitionConfig.SetTxReadSizeLimit(newConfig.GetTxReadSizeLimit());
+ }
+ if (newConfig.HasDisableStatisticsCalculation()) {
+ partitionConfig.SetDisableStatisticsCalculation(newConfig.GetDisableStatisticsCalculation());
+ }
+ if (newConfig.HasCompactionPolicy()) {
+ partitionConfig.MutableCompactionPolicy()->CopyFrom(newConfig.GetCompactionPolicy());
+ }
+ if (newConfig.HasPartitioningPolicy()) {
+ partitionConfig.MutablePartitioningPolicy()->CopyFrom(newConfig.GetPartitioningPolicy());
+ }
+ if (newConfig.HasPipelineConfig()) {
+ partitionConfig.MutablePipelineConfig()->CopyFrom(newConfig.GetPipelineConfig());
+ }
if (newConfig.HasFollowerCount()) {
partitionConfig.SetFollowerCount(newConfig.GetFollowerCount());
- }
+ }
if (newConfig.HasAllowFollowerPromotion()) {
partitionConfig.SetAllowFollowerPromotion(newConfig.GetAllowFollowerPromotion());
- }
+ }
if (newConfig.HasCrossDataCenterFollowerCount()) {
partitionConfig.SetCrossDataCenterFollowerCount(newConfig.GetCrossDataCenterFollowerCount());
- }
- if (newConfig.HasEnableFilterByKey()) {
- partitionConfig.SetEnableFilterByKey(newConfig.GetEnableFilterByKey());
- }
- if (newConfig.HasExecutorFastLogPolicy()) {
- partitionConfig.SetExecutorFastLogPolicy(newConfig.GetExecutorFastLogPolicy());
- }
+ }
+ if (newConfig.HasEnableFilterByKey()) {
+ partitionConfig.SetEnableFilterByKey(newConfig.GetEnableFilterByKey());
+ }
+ if (newConfig.HasExecutorFastLogPolicy()) {
+ partitionConfig.SetExecutorFastLogPolicy(newConfig.GetExecutorFastLogPolicy());
+ }
if (newConfig.HasEnableEraseCache()) {
partitionConfig.SetEnableEraseCache(newConfig.GetEnableEraseCache());
}
@@ -1176,16 +1176,16 @@ void TTableInfo::FinishAlter() {
if (newConfig.HasEraseCacheMaxBytes()) {
partitionConfig.SetEraseCacheMaxBytes(newConfig.GetEraseCacheMaxBytes());
}
- if (newConfig.ColumnFamiliesSize()) {
+ if (newConfig.ColumnFamiliesSize()) {
// N.B. there is no deduplication, assumes legacy data
- partitionConfig.ClearColumnFamilies();
- partitionConfig.AddColumnFamilies()->CopyFrom(*newConfig.GetColumnFamilies().rbegin());
- }
+ partitionConfig.ClearColumnFamilies();
+ partitionConfig.AddColumnFamilies()->CopyFrom(*newConfig.GetColumnFamilies().rbegin());
+ }
if (newConfig.HasKeepSnapshotTimeout()) {
partitionConfig.SetKeepSnapshotTimeout(newConfig.GetKeepSnapshotTimeout());
}
- }
-
+ }
+
// Avoid ShadowData==false in the resulting config
if (partitionConfig.HasShadowData() && !partitionConfig.GetShadowData()) {
partitionConfig.ClearShadowData();
@@ -1197,249 +1197,249 @@ void TTableInfo::FinishAlter() {
}
// Force FillDescription to regenerate TableDescription
- TableDescription.ClearId_Deprecated();
- TableDescription.ClearPathId();
+ TableDescription.ClearId_Deprecated();
+ TableDescription.ClearPathId();
TableDescription.ClearName();
TableDescription.ClearColumns();
TableDescription.ClearKeyColumnIds();
- AlterData.Reset();
-}
-
-#if 1 // legacy
-TString TTableInfo::SerializeAlterExtraData() const {
- Y_VERIFY(AlterData);
- NKikimrSchemeOp::TAlterExtraData alterExtraData;
- alterExtraData.MutablePartitionConfig()->CopyFrom(AlterData->PartitionConfigDiff());
- TString str;
- bool serializeRes = alterExtraData.SerializeToString(&str);
- Y_VERIFY(serializeRes);
- return str;
-}
-
-void TTableInfo::DeserializeAlterExtraData(const TString& str) {
- Y_VERIFY(AlterData);
- NKikimrSchemeOp::TAlterExtraData alterExtraData;
- bool deserializeRes = ParseFromStringNoSizeLimit(alterExtraData, str);
- Y_VERIFY(deserializeRes);
- AlterData->PartitionConfigDiff().Swap(alterExtraData.MutablePartitionConfig());
-}
-#endif
-
-void TTableInfo::SetPartitioning(TVector<TTableShardInfo>&& newPartitioning) {
- THashMap<TShardIdx, TPartitionStats> newPartitionStats;
- TPartitionStats newAggregatedStats;
+ AlterData.Reset();
+}
+
+#if 1 // legacy
+TString TTableInfo::SerializeAlterExtraData() const {
+ Y_VERIFY(AlterData);
+ NKikimrSchemeOp::TAlterExtraData alterExtraData;
+ alterExtraData.MutablePartitionConfig()->CopyFrom(AlterData->PartitionConfigDiff());
+ TString str;
+ bool serializeRes = alterExtraData.SerializeToString(&str);
+ Y_VERIFY(serializeRes);
+ return str;
+}
+
+void TTableInfo::DeserializeAlterExtraData(const TString& str) {
+ Y_VERIFY(AlterData);
+ NKikimrSchemeOp::TAlterExtraData alterExtraData;
+ bool deserializeRes = ParseFromStringNoSizeLimit(alterExtraData, str);
+ Y_VERIFY(deserializeRes);
+ AlterData->PartitionConfigDiff().Swap(alterExtraData.MutablePartitionConfig());
+}
+#endif
+
+void TTableInfo::SetPartitioning(TVector<TTableShardInfo>&& newPartitioning) {
+ THashMap<TShardIdx, TPartitionStats> newPartitionStats;
+ TPartitionStats newAggregatedStats;
newAggregatedStats.PartCount = newPartitioning.size();
ui64 cpuTotal = 0;
- for (const auto& np : newPartitioning) {
- auto idx = np.ShardIdx;
- auto& newStats(newPartitionStats[idx]);
- newStats = Stats.PartitionStats.contains(idx) ? Stats.PartitionStats[idx] : TPartitionStats();
- newAggregatedStats.RowCount += newStats.RowCount;
- newAggregatedStats.DataSize += newStats.DataSize;
- newAggregatedStats.IndexSize += newStats.IndexSize;
+ for (const auto& np : newPartitioning) {
+ auto idx = np.ShardIdx;
+ auto& newStats(newPartitionStats[idx]);
+ newStats = Stats.PartitionStats.contains(idx) ? Stats.PartitionStats[idx] : TPartitionStats();
+ newAggregatedStats.RowCount += newStats.RowCount;
+ newAggregatedStats.DataSize += newStats.DataSize;
+ newAggregatedStats.IndexSize += newStats.IndexSize;
cpuTotal += newStats.GetCurrentRawCpuUsage();
- newAggregatedStats.Memory += newStats.Memory;
- newAggregatedStats.Network += newStats.Network;
- newAggregatedStats.Storage += newStats.Storage;
- newAggregatedStats.ReadThroughput += newStats.ReadThroughput;
- newAggregatedStats.WriteThroughput += newStats.WriteThroughput;
+ newAggregatedStats.Memory += newStats.Memory;
+ newAggregatedStats.Network += newStats.Network;
+ newAggregatedStats.Storage += newStats.Storage;
+ newAggregatedStats.ReadThroughput += newStats.ReadThroughput;
+ newAggregatedStats.WriteThroughput += newStats.WriteThroughput;
newAggregatedStats.ReadIops += newStats.ReadIops;
newAggregatedStats.WriteIops += newStats.WriteIops;
- }
+ }
newAggregatedStats.SetCurrentRawCpuUsage(cpuTotal, AppData()->TimeProvider->Now());
- newAggregatedStats.LastAccessTime = Stats.Aggregated.LastAccessTime;
- newAggregatedStats.LastUpdateTime = Stats.Aggregated.LastUpdateTime;
-
- newAggregatedStats.ImmediateTxCompleted = Stats.Aggregated.ImmediateTxCompleted;
- newAggregatedStats.PlannedTxCompleted = Stats.Aggregated.PlannedTxCompleted;
- newAggregatedStats.TxRejectedByOverload = Stats.Aggregated.TxRejectedByOverload;
- newAggregatedStats.TxRejectedBySpace = Stats.Aggregated.TxRejectedBySpace;
-
- newAggregatedStats.RowUpdates = Stats.Aggregated.RowUpdates;
- newAggregatedStats.RowDeletes = Stats.Aggregated.RowDeletes;
- newAggregatedStats.RowReads = Stats.Aggregated.RowReads;
- newAggregatedStats.RangeReads = Stats.Aggregated.RangeReads;
- newAggregatedStats.RangeReadRows = Stats.Aggregated.RangeReadRows;
-
- if (SplitOpsInFlight.empty()) {
- ExpectedPartitionCount = newPartitioning.size();
- }
-
- if (Partitions.empty()) {
- Y_VERIFY(SplitOpsInFlight.empty());
- }
-
- Stats.PartitionStats.swap(newPartitionStats);
- Stats.Aggregated = newAggregatedStats;
- Partitions.swap(newPartitioning);
- PreSerializedPathDescription.clear();
+ newAggregatedStats.LastAccessTime = Stats.Aggregated.LastAccessTime;
+ newAggregatedStats.LastUpdateTime = Stats.Aggregated.LastUpdateTime;
+
+ newAggregatedStats.ImmediateTxCompleted = Stats.Aggregated.ImmediateTxCompleted;
+ newAggregatedStats.PlannedTxCompleted = Stats.Aggregated.PlannedTxCompleted;
+ newAggregatedStats.TxRejectedByOverload = Stats.Aggregated.TxRejectedByOverload;
+ newAggregatedStats.TxRejectedBySpace = Stats.Aggregated.TxRejectedBySpace;
+
+ newAggregatedStats.RowUpdates = Stats.Aggregated.RowUpdates;
+ newAggregatedStats.RowDeletes = Stats.Aggregated.RowDeletes;
+ newAggregatedStats.RowReads = Stats.Aggregated.RowReads;
+ newAggregatedStats.RangeReads = Stats.Aggregated.RangeReads;
+ newAggregatedStats.RangeReadRows = Stats.Aggregated.RangeReadRows;
+
+ if (SplitOpsInFlight.empty()) {
+ ExpectedPartitionCount = newPartitioning.size();
+ }
+
+ if (Partitions.empty()) {
+ Y_VERIFY(SplitOpsInFlight.empty());
+ }
+
+ Stats.PartitionStats.swap(newPartitionStats);
+ Stats.Aggregated = newAggregatedStats;
+ Partitions.swap(newPartitioning);
+ PreSerializedPathDescription.clear();
CondEraseSchedule.clear();
InFlightCondErase.clear();
- Shard2PartitionIdx.clear();
- for (ui32 i = 0; i < Partitions.size(); ++i) {
- Shard2PartitionIdx[Partitions[i].ShardIdx] = i;
+ Shard2PartitionIdx.clear();
+ for (ui32 i = 0; i < Partitions.size(); ++i) {
+ Shard2PartitionIdx[Partitions[i].ShardIdx] = i;
CondEraseSchedule.push(Partitions.begin() + i);
- }
-}
-
+ }
+}
+
void TTableInfo::UpdateShardStats(TShardIdx datashardIdx, TPartitionStats& newStats) {
- // Ignore stats from unknown datashard (it could have been split)
- if (!Stats.PartitionStats.contains(datashardIdx))
- return;
-
- TPartitionStats& oldStats = Stats.PartitionStats[datashardIdx];
-
- if (newStats.SeqNo <= oldStats.SeqNo) {
- // Ignore outdated message
- return;
- }
-
- if (newStats.SeqNo.Generation > oldStats.SeqNo.Generation) {
- // Reset incremental counter baselines if tablet has restarted
- oldStats.ImmediateTxCompleted = 0;
- oldStats.PlannedTxCompleted = 0;
- oldStats.TxRejectedByOverload = 0;
- oldStats.TxRejectedBySpace = 0;
- oldStats.RowUpdates = 0;
- oldStats.RowDeletes = 0;
- oldStats.RowReads = 0;
- oldStats.RangeReads = 0;
- oldStats.RangeReadRows = 0;
- }
-
- Stats.Aggregated.RowCount += (newStats.RowCount - oldStats.RowCount);
- Stats.Aggregated.DataSize += (newStats.DataSize - oldStats.DataSize);
- Stats.Aggregated.IndexSize += (newStats.IndexSize - oldStats.IndexSize);
- Stats.Aggregated.LastAccessTime = Max(Stats.Aggregated.LastAccessTime, newStats.LastAccessTime);
- Stats.Aggregated.LastUpdateTime = Max(Stats.Aggregated.LastUpdateTime, newStats.LastUpdateTime);
- Stats.Aggregated.ImmediateTxCompleted += (newStats.ImmediateTxCompleted - oldStats.ImmediateTxCompleted);
- Stats.Aggregated.PlannedTxCompleted += (newStats.PlannedTxCompleted - oldStats.PlannedTxCompleted);
- Stats.Aggregated.TxRejectedByOverload += (newStats.TxRejectedByOverload - oldStats.TxRejectedByOverload);
- Stats.Aggregated.TxRejectedBySpace += (newStats.TxRejectedBySpace - oldStats.TxRejectedBySpace);
- Stats.Aggregated.InFlightTxCount += (newStats.InFlightTxCount - oldStats.InFlightTxCount);
-
- Stats.Aggregated.RowUpdates += (newStats.RowUpdates - oldStats.RowUpdates);
- Stats.Aggregated.RowDeletes += (newStats.RowDeletes - oldStats.RowDeletes);
- Stats.Aggregated.RowReads += (newStats.RowReads - oldStats.RowReads);
- Stats.Aggregated.RangeReads += (newStats.RangeReads - oldStats.RangeReads);
- Stats.Aggregated.RangeReadRows += (newStats.RangeReadRows - oldStats.RangeReadRows);
-
+ // Ignore stats from unknown datashard (it could have been split)
+ if (!Stats.PartitionStats.contains(datashardIdx))
+ return;
+
+ TPartitionStats& oldStats = Stats.PartitionStats[datashardIdx];
+
+ if (newStats.SeqNo <= oldStats.SeqNo) {
+ // Ignore outdated message
+ return;
+ }
+
+ if (newStats.SeqNo.Generation > oldStats.SeqNo.Generation) {
+ // Reset incremental counter baselines if tablet has restarted
+ oldStats.ImmediateTxCompleted = 0;
+ oldStats.PlannedTxCompleted = 0;
+ oldStats.TxRejectedByOverload = 0;
+ oldStats.TxRejectedBySpace = 0;
+ oldStats.RowUpdates = 0;
+ oldStats.RowDeletes = 0;
+ oldStats.RowReads = 0;
+ oldStats.RangeReads = 0;
+ oldStats.RangeReadRows = 0;
+ }
+
+ Stats.Aggregated.RowCount += (newStats.RowCount - oldStats.RowCount);
+ Stats.Aggregated.DataSize += (newStats.DataSize - oldStats.DataSize);
+ Stats.Aggregated.IndexSize += (newStats.IndexSize - oldStats.IndexSize);
+ Stats.Aggregated.LastAccessTime = Max(Stats.Aggregated.LastAccessTime, newStats.LastAccessTime);
+ Stats.Aggregated.LastUpdateTime = Max(Stats.Aggregated.LastUpdateTime, newStats.LastUpdateTime);
+ Stats.Aggregated.ImmediateTxCompleted += (newStats.ImmediateTxCompleted - oldStats.ImmediateTxCompleted);
+ Stats.Aggregated.PlannedTxCompleted += (newStats.PlannedTxCompleted - oldStats.PlannedTxCompleted);
+ Stats.Aggregated.TxRejectedByOverload += (newStats.TxRejectedByOverload - oldStats.TxRejectedByOverload);
+ Stats.Aggregated.TxRejectedBySpace += (newStats.TxRejectedBySpace - oldStats.TxRejectedBySpace);
+ Stats.Aggregated.InFlightTxCount += (newStats.InFlightTxCount - oldStats.InFlightTxCount);
+
+ Stats.Aggregated.RowUpdates += (newStats.RowUpdates - oldStats.RowUpdates);
+ Stats.Aggregated.RowDeletes += (newStats.RowDeletes - oldStats.RowDeletes);
+ Stats.Aggregated.RowReads += (newStats.RowReads - oldStats.RowReads);
+ Stats.Aggregated.RangeReads += (newStats.RangeReads - oldStats.RangeReads);
+ Stats.Aggregated.RangeReadRows += (newStats.RangeReadRows - oldStats.RangeReadRows);
+
i64 cpuUsageDelta = newStats.GetCurrentRawCpuUsage() - oldStats.GetCurrentRawCpuUsage();
i64 prevCpuUsage = Stats.Aggregated.GetCurrentRawCpuUsage();
ui64 newAggregatedCpuUsage = std::max<i64>(0, prevCpuUsage + cpuUsageDelta);
TInstant now = AppData()->TimeProvider->Now();
Stats.Aggregated.SetCurrentRawCpuUsage(newAggregatedCpuUsage, now);
- Stats.Aggregated.Memory += (newStats.Memory - oldStats.Memory);
- Stats.Aggregated.Network += (newStats.Network - oldStats.Network);
- Stats.Aggregated.Storage += (newStats.Storage - oldStats.Storage);
- Stats.Aggregated.ReadThroughput += (newStats.ReadThroughput - oldStats.ReadThroughput);
- Stats.Aggregated.WriteThroughput += (newStats.WriteThroughput - oldStats.WriteThroughput);
+ Stats.Aggregated.Memory += (newStats.Memory - oldStats.Memory);
+ Stats.Aggregated.Network += (newStats.Network - oldStats.Network);
+ Stats.Aggregated.Storage += (newStats.Storage - oldStats.Storage);
+ Stats.Aggregated.ReadThroughput += (newStats.ReadThroughput - oldStats.ReadThroughput);
+ Stats.Aggregated.WriteThroughput += (newStats.WriteThroughput - oldStats.WriteThroughput);
Stats.Aggregated.ReadIops += (newStats.ReadIops - oldStats.ReadIops);
Stats.Aggregated.WriteIops += (newStats.WriteIops - oldStats.WriteIops);
-
+
newStats.SaveCpuUsageHistory(oldStats);
- oldStats = newStats;
- Stats.PartitionStatsUpdated++;
-
- // Rescan stats for aggregations only once in a while
- if (Stats.PartitionStatsUpdated >= Stats.PartitionStats.size()) {
- Stats.PartitionStatsUpdated = 0;
- Stats.Aggregated.TxCompleteLag = TDuration();
- for (const auto& ps : Stats.PartitionStats) {
- Stats.Aggregated.TxCompleteLag = Max(Stats.Aggregated.TxCompleteLag, ps.second.TxCompleteLag);
- }
- }
-}
-
-void TTableInfo::RegisterSplitMegreOp(TOperationId opId, const TTxState& txState) {
- Y_VERIFY(txState.TxType == TTxState::TxSplitTablePartition || txState.TxType == TTxState::TxMergeTablePartition);
- Y_VERIFY(txState.SplitDescription);
-
- if (SplitOpsInFlight.empty()) {
- Y_VERIFY_S(Partitions.size() == ExpectedPartitionCount,
- "info "
- << "ExpectedPartitionCount: " << ExpectedPartitionCount
- << " Partitions.size(): " << Partitions.size());
- }
-
- if (txState.State < TTxState::NotifyPartitioningChanged) {
- ui64 srcCount = txState.SplitDescription->SourceRangesSize();
- ui64 dstCount = txState.SplitDescription->DestinationRangesSize();
- ExpectedPartitionCount += dstCount;
- ExpectedPartitionCount -= srcCount;
- }
-
- Y_VERIFY(!SplitOpsInFlight.contains(opId));
- SplitOpsInFlight.emplace(opId);
- ShardsInSplitMergeByOpId.emplace(opId, TVector<TShardIdx>());
-
- for (const auto& shardInfo: txState.Shards) {
- ShardsInSplitMergeByShards.emplace(shardInfo.Idx, opId);
- ShardsInSplitMergeByOpId.at(opId).push_back(shardInfo.Idx);
- }
-}
-
-bool TTableInfo::IsShardInSplitMergeOp(TShardIdx idx) const {
- if (ShardsInSplitMergeByShards.contains(idx)) {
- TOperationId opId = ShardsInSplitMergeByShards.at(idx);
- Y_VERIFY(ShardsInSplitMergeByOpId.contains(opId));
- Y_VERIFY(SplitOpsInFlight.contains(opId));
- }
-
- return ShardsInSplitMergeByShards.contains(idx);
-}
-
-
-void TTableInfo::AbortSplitMergeOp(TOperationId opId) {
- Y_VERIFY(SplitOpsInFlight.contains(opId));
- for (const auto& shardIdx: ShardsInSplitMergeByOpId.at(opId)) {
- ShardsInSplitMergeByShards.erase(shardIdx);
- }
- ShardsInSplitMergeByOpId.erase(opId);
- SplitOpsInFlight.erase(opId);
-}
-
-void TTableInfo::FinishSplitMergeOp(TOperationId opId) {
- AbortSplitMergeOp(opId);
-
- if (SplitOpsInFlight.empty()) {
- Y_VERIFY_S(Partitions.size() == ExpectedPartitionCount,
- "info "
- << "ExpectedPartitionCount: " << ExpectedPartitionCount
- << " Partitions.size(): " << Partitions.size());
- }
-}
-
+ oldStats = newStats;
+ Stats.PartitionStatsUpdated++;
+
+ // Rescan stats for aggregations only once in a while
+ if (Stats.PartitionStatsUpdated >= Stats.PartitionStats.size()) {
+ Stats.PartitionStatsUpdated = 0;
+ Stats.Aggregated.TxCompleteLag = TDuration();
+ for (const auto& ps : Stats.PartitionStats) {
+ Stats.Aggregated.TxCompleteLag = Max(Stats.Aggregated.TxCompleteLag, ps.second.TxCompleteLag);
+ }
+ }
+}
+
+void TTableInfo::RegisterSplitMegreOp(TOperationId opId, const TTxState& txState) {
+ Y_VERIFY(txState.TxType == TTxState::TxSplitTablePartition || txState.TxType == TTxState::TxMergeTablePartition);
+ Y_VERIFY(txState.SplitDescription);
+
+ if (SplitOpsInFlight.empty()) {
+ Y_VERIFY_S(Partitions.size() == ExpectedPartitionCount,
+ "info "
+ << "ExpectedPartitionCount: " << ExpectedPartitionCount
+ << " Partitions.size(): " << Partitions.size());
+ }
+
+ if (txState.State < TTxState::NotifyPartitioningChanged) {
+ ui64 srcCount = txState.SplitDescription->SourceRangesSize();
+ ui64 dstCount = txState.SplitDescription->DestinationRangesSize();
+ ExpectedPartitionCount += dstCount;
+ ExpectedPartitionCount -= srcCount;
+ }
+
+ Y_VERIFY(!SplitOpsInFlight.contains(opId));
+ SplitOpsInFlight.emplace(opId);
+ ShardsInSplitMergeByOpId.emplace(opId, TVector<TShardIdx>());
+
+ for (const auto& shardInfo: txState.Shards) {
+ ShardsInSplitMergeByShards.emplace(shardInfo.Idx, opId);
+ ShardsInSplitMergeByOpId.at(opId).push_back(shardInfo.Idx);
+ }
+}
+
+bool TTableInfo::IsShardInSplitMergeOp(TShardIdx idx) const {
+ if (ShardsInSplitMergeByShards.contains(idx)) {
+ TOperationId opId = ShardsInSplitMergeByShards.at(idx);
+ Y_VERIFY(ShardsInSplitMergeByOpId.contains(opId));
+ Y_VERIFY(SplitOpsInFlight.contains(opId));
+ }
+
+ return ShardsInSplitMergeByShards.contains(idx);
+}
+
+
+void TTableInfo::AbortSplitMergeOp(TOperationId opId) {
+ Y_VERIFY(SplitOpsInFlight.contains(opId));
+ for (const auto& shardIdx: ShardsInSplitMergeByOpId.at(opId)) {
+ ShardsInSplitMergeByShards.erase(shardIdx);
+ }
+ ShardsInSplitMergeByOpId.erase(opId);
+ SplitOpsInFlight.erase(opId);
+}
+
+void TTableInfo::FinishSplitMergeOp(TOperationId opId) {
+ AbortSplitMergeOp(opId);
+
+ if (SplitOpsInFlight.empty()) {
+ Y_VERIFY_S(Partitions.size() == ExpectedPartitionCount,
+ "info "
+ << "ExpectedPartitionCount: " << ExpectedPartitionCount
+ << " Partitions.size(): " << Partitions.size());
+ }
+}
+
bool TTableInfo::TryAddShardToMerge(const TSplitSettings& splitSettings,
TShardIdx shardIdx, TVector<TShardIdx>& shardsToMerge,
- THashSet<TTabletId>& partOwners, ui64& totalSize, float& totalLoad) const
-{
- if (ExpectedPartitionCount + 1 - shardsToMerge.size() <= GetMinPartitionsCount()) {
- return false;
- }
-
- if (IsShardInSplitMergeOp(shardIdx)) {
- return false;
- }
-
- const TPartitionStats* stats = Stats.PartitionStats.FindPtr(shardIdx);
-
- if (!stats) {
- return false;
- }
-
- if (stats->ShardState != NKikimrTxDataShard::Ready) {
- return false;
- }
-
- if (stats->PartOwners.empty()) {
- return false;
- }
-
+ THashSet<TTabletId>& partOwners, ui64& totalSize, float& totalLoad) const
+{
+ if (ExpectedPartitionCount + 1 - shardsToMerge.size() <= GetMinPartitionsCount()) {
+ return false;
+ }
+
+ if (IsShardInSplitMergeOp(shardIdx)) {
+ return false;
+ }
+
+ const TPartitionStats* stats = Stats.PartitionStats.FindPtr(shardIdx);
+
+ if (!stats) {
+ return false;
+ }
+
+ if (stats->ShardState != NKikimrTxDataShard::Ready) {
+ return false;
+ }
+
+ if (stats->PartOwners.empty()) {
+ return false;
+ }
+
// We don't want to merge shards that have borrowed non-compacted data
if (stats->HasBorrowed)
return false;
@@ -1459,8 +1459,8 @@ bool TTableInfo::TryAddShardToMerge(const TSplitSettings& splitSettings,
}
if (!canMerge)
- return false;
-
+ return false;
+
// Check that total size doesn't exceed the limits
if (IsSplitBySizeEnabled() && stats->DataSize + totalSize >= GetShardSizeToSplit()*0.9) {
return false;
@@ -1483,68 +1483,68 @@ bool TTableInfo::TryAddShardToMerge(const TSplitSettings& splitSettings,
// Merged shards must not have borrowed parts from the same original tablet
// because this will break part ref-counting
- for (auto tabletId : stats->PartOwners) {
- if (partOwners.contains(tabletId))
- return false;
- }
-
- shardsToMerge.push_back(shardIdx);
- totalSize += stats->DataSize;
+ for (auto tabletId : stats->PartOwners) {
+ if (partOwners.contains(tabletId))
+ return false;
+ }
+
+ shardsToMerge.push_back(shardIdx);
+ totalSize += stats->DataSize;
totalLoad += shardLoad;
- partOwners.insert(stats->PartOwners.begin(), stats->PartOwners.end());
-
- return true;
-}
-
+ partOwners.insert(stats->PartOwners.begin(), stats->PartOwners.end());
+
+ return true;
+}
+
bool TTableInfo::CheckCanMergePartitions(const TSplitSettings& splitSettings, TShardIdx shardIdx, TVector<TShardIdx>& shardsToMerge) const {
// Don't split/merge backup tables
- if (IsBackup) {
+ if (IsBackup) {
return false;
- }
-
- // Ignore stats from unknown datashard (it could have been split)
- if (!Stats.PartitionStats.contains(shardIdx)) {
- return false;
- }
-
- if (Partitions.size() <= GetMinPartitionsCount()) {
- return false;
- }
-
- if (!Shard2PartitionIdx.contains(shardIdx)) {
- return false;
- }
-
- i64 partitionIdx = *Shard2PartitionIdx.FindPtr(shardIdx);
-
- shardsToMerge.clear();
- ui64 totalSize = 0;
+ }
+
+ // Ignore stats from unknown datashard (it could have been split)
+ if (!Stats.PartitionStats.contains(shardIdx)) {
+ return false;
+ }
+
+ if (Partitions.size() <= GetMinPartitionsCount()) {
+ return false;
+ }
+
+ if (!Shard2PartitionIdx.contains(shardIdx)) {
+ return false;
+ }
+
+ i64 partitionIdx = *Shard2PartitionIdx.FindPtr(shardIdx);
+
+ shardsToMerge.clear();
+ ui64 totalSize = 0;
float totalLoad = 0;
- THashSet<TTabletId> partOwners;
-
+ THashSet<TTabletId> partOwners;
+
// Make sure we can actually merge current shard first
- if (!TryAddShardToMerge(splitSettings, shardIdx, shardsToMerge, partOwners, totalSize, totalLoad)) {
+ if (!TryAddShardToMerge(splitSettings, shardIdx, shardsToMerge, partOwners, totalSize, totalLoad)) {
return false;
- }
+ }
for (i64 pi = partitionIdx - 1; pi >= 0; --pi) {
- if (!TryAddShardToMerge(splitSettings, GetPartitions()[pi].ShardIdx, shardsToMerge, partOwners, totalSize, totalLoad)) {
- break;
- }
- }
- // make shardsToMerge ordered by partition index
- Reverse(shardsToMerge.begin(), shardsToMerge.end());
-
- for (ui64 pi = partitionIdx + 1; pi < GetPartitions().size(); ++pi) {
- if (!TryAddShardToMerge(splitSettings, GetPartitions()[pi].ShardIdx, shardsToMerge, partOwners, totalSize, totalLoad)) {
- break;
- }
- }
-
- return shardsToMerge.size() > 1;
-}
-
-bool TTableInfo::CheckFastSplitForPartition(const TSplitSettings& splitSettings, TShardIdx shardIdx, ui64 dataSize, ui64 rowCount) const {
+ if (!TryAddShardToMerge(splitSettings, GetPartitions()[pi].ShardIdx, shardsToMerge, partOwners, totalSize, totalLoad)) {
+ break;
+ }
+ }
+ // make shardsToMerge ordered by partition index
+ Reverse(shardsToMerge.begin(), shardsToMerge.end());
+
+ for (ui64 pi = partitionIdx + 1; pi < GetPartitions().size(); ++pi) {
+ if (!TryAddShardToMerge(splitSettings, GetPartitions()[pi].ShardIdx, shardsToMerge, partOwners, totalSize, totalLoad)) {
+ break;
+ }
+ }
+
+ return shardsToMerge.size() > 1;
+}
+
+bool TTableInfo::CheckFastSplitForPartition(const TSplitSettings& splitSettings, TShardIdx shardIdx, ui64 dataSize, ui64 rowCount) const {
// Don't split/merge backup tables
if (IsBackup)
return false;
@@ -1681,10 +1681,10 @@ bool TExportInfo::AllItemsAreDropped() const {
}
void TExportInfo::AddNotifySubscriber(const TActorId &actorId) {
- Y_VERIFY(!IsFinished());
- Subscribers.insert(actorId);
-}
-
+ Y_VERIFY(!IsFinished());
+ Subscribers.insert(actorId);
+}
+
TString TImportInfo::ToString() const {
return TStringBuilder() << "{"
<< " Id: " << Id
@@ -1723,133 +1723,133 @@ void TImportInfo::AddNotifySubscriber(const TActorId &actorId) {
Subscribers.insert(actorId);
}
-TIndexBuildInfo::TShardStatus::TShardStatus() {
- TCell cell;
- TVector<TCell> vec = {cell};
- TArrayRef<TCell> cells(vec);
- Range = TSerializedTableRange(TSerializedCellVec::Serialize(cells), "", true, false);
-
- LastKeyAck = Range.From.GetBuffer(); // -inf
-}
-
-TColumnFamiliesMerger::TColumnFamiliesMerger(NKikimrSchemeOp::TPartitionConfig &container)
- : Container(container)
- , DeduplicationById(TPartitionConfigMerger::DeduplicateColumnFamiliesById(Container))
-{
- IdByName["default"] = 0;
-
- // we trust in Container data
- for (const auto& family : Container.GetColumnFamilies()) {
- if (family.GetName()) { // ignore name "", some families don't have a name
- NameByIds.emplace(family.GetId(), family.GetName());
- IdByName.emplace(family.GetName(), family.GetId());
- }
- NextAutogenId = Max(NextAutogenId, family.GetId());
- }
-}
-
-bool TColumnFamiliesMerger::Has(ui32 familyId) const {
- return DeduplicationById.contains(familyId);
-}
-
-NKikimrSchemeOp::TFamilyDescription *TColumnFamiliesMerger::Get(ui32 familyId, TString &errDescr) {
- if (!Has(familyId)) {
- errDescr = TStringBuilder()
- << "Column family with id: " << familyId << " doesn't present"
- << ", auto generation new column family is allowed only by name in column description";
- return nullptr;
- }
-
- auto& dstFamily = TPartitionConfigMerger::MutableColumnFamilyById(Container, DeduplicationById, familyId);
-
- return &dstFamily;
-}
-
-NKikimrSchemeOp::TFamilyDescription *TColumnFamiliesMerger::AddOrGet(ui32 familyId, TString &errDescr) {
- if (NameByIds.contains(familyId)) {
- return AddOrGet(familyId, NameByIds.at(familyId), errDescr);
- }
-
- auto& dstFamily = TPartitionConfigMerger::MutableColumnFamilyById(Container, DeduplicationById, familyId);
- return &dstFamily;
-}
-
-NKikimrSchemeOp::TFamilyDescription *TColumnFamiliesMerger::AddOrGet(const TString &familyName, TString &errDescr) {
- const auto& canonicFamilyName = CanonizeName(familyName);
-
- if (IdByName.contains(canonicFamilyName)) {
- return AddOrGet(IdByName.at(canonicFamilyName), canonicFamilyName, errDescr);
- }
-
- // generate id
- if (NextAutogenId >= MAX_AUTOGENERATED_FAMILY_ID) {
- errDescr = TStringBuilder()
- << "Column family id overflow at adding column family with name " << familyName;
- return nullptr;
- }
-
- return AddOrGet(++NextAutogenId, canonicFamilyName, errDescr);
-}
-
-NKikimrSchemeOp::TFamilyDescription *TColumnFamiliesMerger::Get(ui32 familyId, const TString &familyName, TString &errDescr) {
- const auto& canonicFamilyName = CanonizeName(familyName);
-
- if (IdByName.contains(canonicFamilyName) && IdByName.at(canonicFamilyName) != familyId) {
- errDescr = TStringBuilder()
- << "at the request column family has Id " << familyId << " and name " << familyName
- << ", but table already has the column family with name " << canonicFamilyName << " and different Id " << IdByName.at(canonicFamilyName);
- return nullptr;
- }
-
- if (NameByIds.contains(familyId) && NameByIds.at(familyId) != canonicFamilyName) {
- errDescr = TStringBuilder()
- << "at the request column family has Id " << familyId << " and name " << familyName
- << ", but table already has the column family with Id " << familyId << " and different name " << NameByIds.at(familyId);
- return nullptr;
- }
-
- return Get(familyId, errDescr);
-}
-
-NKikimrSchemeOp::TFamilyDescription *TColumnFamiliesMerger::AddOrGet(ui32 familyId, const TString &familyName, TString &errDescr) {
- const auto& canonicFamilyName = CanonizeName(familyName);
-
- if (IdByName.contains(canonicFamilyName) && IdByName.at(canonicFamilyName) != familyId) {
- errDescr = TStringBuilder()
- << "at the request column family has Id " << familyId << " and name " << familyName
- << ", but table already has the column family with name " << canonicFamilyName << " and different Id " << IdByName.at(canonicFamilyName);
- return nullptr;
- }
-
- if (NameByIds.contains(familyId) && NameByIds.at(familyId) != canonicFamilyName) {
- errDescr = TStringBuilder()
- << "at the request column family has Id " << familyId << " and name " << familyName
- << ", but table already has the column family with Id " << familyId << " and different name " << NameByIds.at(familyId);
- return nullptr;
- }
-
- auto& dstFamily = TPartitionConfigMerger::MutableColumnFamilyById(Container, DeduplicationById, familyId);
-
- if (!dstFamily.HasName()) {
- dstFamily.SetName(canonicFamilyName);
- }
-
- NameByIds[familyId] = canonicFamilyName;
- IdByName[canonicFamilyName] = familyId;
-
- return &dstFamily;
-}
-
-const TString &TColumnFamiliesMerger::CanonizeName(const TString &familyName) {
- static const TString defName = "default";
-
- if (!familyName) {
- return defName;
- }
-
- return familyName;
-}
-
+TIndexBuildInfo::TShardStatus::TShardStatus() {
+ TCell cell;
+ TVector<TCell> vec = {cell};
+ TArrayRef<TCell> cells(vec);
+ Range = TSerializedTableRange(TSerializedCellVec::Serialize(cells), "", true, false);
+
+ LastKeyAck = Range.From.GetBuffer(); // -inf
+}
+
+TColumnFamiliesMerger::TColumnFamiliesMerger(NKikimrSchemeOp::TPartitionConfig &container)
+ : Container(container)
+ , DeduplicationById(TPartitionConfigMerger::DeduplicateColumnFamiliesById(Container))
+{
+ IdByName["default"] = 0;
+
+ // we trust in Container data
+ for (const auto& family : Container.GetColumnFamilies()) {
+ if (family.GetName()) { // ignore name "", some families don't have a name
+ NameByIds.emplace(family.GetId(), family.GetName());
+ IdByName.emplace(family.GetName(), family.GetId());
+ }
+ NextAutogenId = Max(NextAutogenId, family.GetId());
+ }
+}
+
+bool TColumnFamiliesMerger::Has(ui32 familyId) const {
+ return DeduplicationById.contains(familyId);
+}
+
+NKikimrSchemeOp::TFamilyDescription *TColumnFamiliesMerger::Get(ui32 familyId, TString &errDescr) {
+ if (!Has(familyId)) {
+ errDescr = TStringBuilder()
+ << "Column family with id: " << familyId << " doesn't present"
+ << ", auto generation new column family is allowed only by name in column description";
+ return nullptr;
+ }
+
+ auto& dstFamily = TPartitionConfigMerger::MutableColumnFamilyById(Container, DeduplicationById, familyId);
+
+ return &dstFamily;
+}
+
+NKikimrSchemeOp::TFamilyDescription *TColumnFamiliesMerger::AddOrGet(ui32 familyId, TString &errDescr) {
+ if (NameByIds.contains(familyId)) {
+ return AddOrGet(familyId, NameByIds.at(familyId), errDescr);
+ }
+
+ auto& dstFamily = TPartitionConfigMerger::MutableColumnFamilyById(Container, DeduplicationById, familyId);
+ return &dstFamily;
+}
+
+NKikimrSchemeOp::TFamilyDescription *TColumnFamiliesMerger::AddOrGet(const TString &familyName, TString &errDescr) {
+ const auto& canonicFamilyName = CanonizeName(familyName);
+
+ if (IdByName.contains(canonicFamilyName)) {
+ return AddOrGet(IdByName.at(canonicFamilyName), canonicFamilyName, errDescr);
+ }
+
+ // generate id
+ if (NextAutogenId >= MAX_AUTOGENERATED_FAMILY_ID) {
+ errDescr = TStringBuilder()
+ << "Column family id overflow at adding column family with name " << familyName;
+ return nullptr;
+ }
+
+ return AddOrGet(++NextAutogenId, canonicFamilyName, errDescr);
+}
+
+NKikimrSchemeOp::TFamilyDescription *TColumnFamiliesMerger::Get(ui32 familyId, const TString &familyName, TString &errDescr) {
+ const auto& canonicFamilyName = CanonizeName(familyName);
+
+ if (IdByName.contains(canonicFamilyName) && IdByName.at(canonicFamilyName) != familyId) {
+ errDescr = TStringBuilder()
+ << "at the request column family has Id " << familyId << " and name " << familyName
+ << ", but table already has the column family with name " << canonicFamilyName << " and different Id " << IdByName.at(canonicFamilyName);
+ return nullptr;
+ }
+
+ if (NameByIds.contains(familyId) && NameByIds.at(familyId) != canonicFamilyName) {
+ errDescr = TStringBuilder()
+ << "at the request column family has Id " << familyId << " and name " << familyName
+ << ", but table already has the column family with Id " << familyId << " and different name " << NameByIds.at(familyId);
+ return nullptr;
+ }
+
+ return Get(familyId, errDescr);
+}
+
+NKikimrSchemeOp::TFamilyDescription *TColumnFamiliesMerger::AddOrGet(ui32 familyId, const TString &familyName, TString &errDescr) {
+ const auto& canonicFamilyName = CanonizeName(familyName);
+
+ if (IdByName.contains(canonicFamilyName) && IdByName.at(canonicFamilyName) != familyId) {
+ errDescr = TStringBuilder()
+ << "at the request column family has Id " << familyId << " and name " << familyName
+ << ", but table already has the column family with name " << canonicFamilyName << " and different Id " << IdByName.at(canonicFamilyName);
+ return nullptr;
+ }
+
+ if (NameByIds.contains(familyId) && NameByIds.at(familyId) != canonicFamilyName) {
+ errDescr = TStringBuilder()
+ << "at the request column family has Id " << familyId << " and name " << familyName
+ << ", but table already has the column family with Id " << familyId << " and different name " << NameByIds.at(familyId);
+ return nullptr;
+ }
+
+ auto& dstFamily = TPartitionConfigMerger::MutableColumnFamilyById(Container, DeduplicationById, familyId);
+
+ if (!dstFamily.HasName()) {
+ dstFamily.SetName(canonicFamilyName);
+ }
+
+ NameByIds[familyId] = canonicFamilyName;
+ IdByName[canonicFamilyName] = familyId;
+
+ return &dstFamily;
+}
+
+const TString &TColumnFamiliesMerger::CanonizeName(const TString &familyName) {
+ static const TString defName = "default";
+
+ if (!familyName) {
+ return defName;
+ }
+
+ return familyName;
+}
+
void TPQShardInfo::TKeyRange::SerializeToProto(NKikimrPQ::TPartitionKeyRange& proto) const {
if (FromBound) {
proto.SetFromBound(*FromBound);
@@ -1888,98 +1888,98 @@ bool TPersQueueGroupInfo::FillKeySchema(const TString& tabletConfig) {
return FillKeySchema(proto, unused);
}
-TBillingStats::TBillingStats(ui64 rows, ui64 bytes)
- : Rows(rows)
- , Bytes(bytes)
-{
-}
-
-TBillingStats::TBillingStats(const TBillingStats &other)
- : Rows(other.Rows)
- , Bytes(other.Bytes)
-{
-}
-
-TBillingStats &TBillingStats::operator =(const TBillingStats &other) {
- if (this == &other) {
- return *this;
- }
-
- Rows = other.Rows;
- Bytes = other.Bytes;
- return *this;
-}
-
-TBillingStats TBillingStats::operator -(const TBillingStats &other) const {
- Y_VERIFY(Rows >= other.Rows);
- Y_VERIFY(Bytes >= other.Bytes);
-
- return TBillingStats(Rows - other.Rows, Bytes - other.Bytes);
-}
-
-TBillingStats &TBillingStats::operator -=(const TBillingStats &other) {
- if (this == &other) {
- Rows = 0;
- Bytes = 0;
- return *this;
- }
-
- Y_VERIFY(Rows >= other.Rows);
- Y_VERIFY(Bytes >= other.Bytes);
-
- Rows -= other.Rows;
- Bytes -= other.Bytes;
- return *this;
-}
-
-TBillingStats TBillingStats::operator +(const TBillingStats &other) const {
- return TBillingStats(Rows + other.Rows, Bytes + other.Bytes);
-}
-
-TBillingStats &TBillingStats::operator +=(const TBillingStats &other) {
- if (this == &other) {
- Rows += Rows;
- Bytes += Bytes;
- return *this;
- }
-
- Rows += other.Rows;
- Bytes += other.Bytes;
- return *this;
-}
-
-bool TBillingStats::operator < (const TBillingStats &other) const {
- return Rows < other.Rows && Bytes < other.Bytes;
-}
-
-bool TBillingStats::operator <= (const TBillingStats &other) const {
- return Rows <= other.Rows && Bytes <= other.Bytes;
-}
-
-bool TBillingStats::operator ==(const TBillingStats &other) const {
- return Rows == other.Rows && Bytes == other.Bytes;
-}
-
-TString TBillingStats::ToString() const {
- return TStringBuilder()
- << "{"
- << " rows: " << GetRows()
- << " bytes: " << GetBytes()
- << " }";
-}
-
-ui64 TBillingStats::GetRows() const {
- return Rows;
-}
-
-ui64 TBillingStats::GetBytes() const {
- return Bytes;
-}
-
-NKikimr::NSchemeShard::TBillingStats::operator bool() const {
- return Rows || Bytes;
-}
-
+TBillingStats::TBillingStats(ui64 rows, ui64 bytes)
+ : Rows(rows)
+ , Bytes(bytes)
+{
+}
+
+TBillingStats::TBillingStats(const TBillingStats &other)
+ : Rows(other.Rows)
+ , Bytes(other.Bytes)
+{
+}
+
+TBillingStats &TBillingStats::operator =(const TBillingStats &other) {
+ if (this == &other) {
+ return *this;
+ }
+
+ Rows = other.Rows;
+ Bytes = other.Bytes;
+ return *this;
+}
+
+TBillingStats TBillingStats::operator -(const TBillingStats &other) const {
+ Y_VERIFY(Rows >= other.Rows);
+ Y_VERIFY(Bytes >= other.Bytes);
+
+ return TBillingStats(Rows - other.Rows, Bytes - other.Bytes);
+}
+
+TBillingStats &TBillingStats::operator -=(const TBillingStats &other) {
+ if (this == &other) {
+ Rows = 0;
+ Bytes = 0;
+ return *this;
+ }
+
+ Y_VERIFY(Rows >= other.Rows);
+ Y_VERIFY(Bytes >= other.Bytes);
+
+ Rows -= other.Rows;
+ Bytes -= other.Bytes;
+ return *this;
+}
+
+TBillingStats TBillingStats::operator +(const TBillingStats &other) const {
+ return TBillingStats(Rows + other.Rows, Bytes + other.Bytes);
+}
+
+TBillingStats &TBillingStats::operator +=(const TBillingStats &other) {
+ if (this == &other) {
+ Rows += Rows;
+ Bytes += Bytes;
+ return *this;
+ }
+
+ Rows += other.Rows;
+ Bytes += other.Bytes;
+ return *this;
+}
+
+bool TBillingStats::operator < (const TBillingStats &other) const {
+ return Rows < other.Rows && Bytes < other.Bytes;
+}
+
+bool TBillingStats::operator <= (const TBillingStats &other) const {
+ return Rows <= other.Rows && Bytes <= other.Bytes;
+}
+
+bool TBillingStats::operator ==(const TBillingStats &other) const {
+ return Rows == other.Rows && Bytes == other.Bytes;
+}
+
+TString TBillingStats::ToString() const {
+ return TStringBuilder()
+ << "{"
+ << " rows: " << GetRows()
+ << " bytes: " << GetBytes()
+ << " }";
+}
+
+ui64 TBillingStats::GetRows() const {
+ return Rows;
+}
+
+ui64 TBillingStats::GetBytes() const {
+ return Bytes;
+}
+
+NKikimr::NSchemeShard::TBillingStats::operator bool() const {
+ return Rows || Bytes;
+}
+
TOlapStoreInfo::TOlapStoreInfo(
ui64 alterVersion,
NKikimrSchemeOp::TColumnStoreDescription&& description,
@@ -2071,8 +2071,8 @@ TOlapTableInfo::TOlapTableInfo(
TSequenceInfo::TSequenceInfo(
ui64 alterVersion,
- NKikimrSchemeOp::TSequenceDescription&& description,
- NKikimrSchemeOp::TSequenceSharding&& sharding)
+ NKikimrSchemeOp::TSequenceDescription&& description,
+ NKikimrSchemeOp::TSequenceSharding&& sharding)
: AlterVersion(alterVersion)
, Description(std::move(description))
, Sharding(std::move(sharding))
@@ -2080,7 +2080,7 @@ TSequenceInfo::TSequenceInfo(
// TODO: extract necessary info
}
-bool TSequenceInfo::ValidateCreate(const NKikimrSchemeOp::TSequenceDescription& p, TString& err) {
+bool TSequenceInfo::ValidateCreate(const NKikimrSchemeOp::TSequenceDescription& p, TString& err) {
if (p.HasPathId() || p.HasVersion() || p.HasSequenceShard()) {
err = "CreateSequence does not allow internal fields to be specified";
return false;
@@ -2119,6 +2119,6 @@ bool TSequenceInfo::ValidateCreate(const NKikimrSchemeOp::TSequenceDescription&
return true;
}
-} // namespace NSchemeShard
-} // namespace NKikimr
+} // namespace NSchemeShard
+} // namespace NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_info_types.h b/ydb/core/tx/schemeshard/schemeshard_info_types.h
index 7d7f2093a8f..2e5710c3d3e 100644
--- a/ydb/core/tx/schemeshard/schemeshard_info_types.h
+++ b/ydb/core/tx/schemeshard/schemeshard_info_types.h
@@ -1,37 +1,37 @@
-#pragma once
-
-#include "schemeshard_types.h"
-#include "schemeshard_tx_infly.h"
-#include "schemeshard_path_element.h"
-#include "schemeshard_identificators.h"
-
+#pragma once
+
+#include "schemeshard_types.h"
+#include "schemeshard_tx_infly.h"
+#include "schemeshard_path_element.h"
+#include "schemeshard_identificators.h"
+
#include <ydb/core/tx/message_seqno.h>
#include <ydb/core/tx/datashard/datashard.h>
-
+
#include <ydb/core/tablet_flat/flat_cxx_database.h>
#include <ydb/core/tablet_flat/flat_dbase_scheme.h>
#include <ydb/core/tablet_flat/flat_table_column.h>
#include <ydb/core/scheme/scheme_tabledefs.h>
-
+
#include <ydb/core/base/tx_processing.h>
#include <ydb/core/base/storage_pools.h>
#include <ydb/core/base/table_index.h>
#include <ydb/core/util/counted_leaky_bucket.h>
-
+
#include <ydb/library/login/protos/login.pb.h>
#include <ydb/public/api/protos/ydb_import.pb.h>
#include <ydb/public/lib/scheme_types/scheme_type_id.h>
-
-#include <google/protobuf/util/message_differencer.h>
-
-#include <util/generic/ptr.h>
+
+#include <google/protobuf/util/message_differencer.h>
+
+#include <util/generic/ptr.h>
#include <util/generic/queue.h>
#include <util/generic/vector.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+namespace NKikimr {
+namespace NSchemeShard {
+
struct TSplitSettings {
TControlWrapper SplitMergePartCountLimit;
TControlWrapper FastSplitSizeThreshold;
@@ -69,7 +69,7 @@ struct TSplitSettings {
struct TBindingsRoomsChange {
TChannelsBindings ChannelsBindings;
- NKikimrSchemeOp::TPartitionConfig PerShardConfig;
+ NKikimrSchemeOp::TPartitionConfig PerShardConfig;
bool ChannelsBindingsUpdated = false;
};
@@ -82,118 +82,118 @@ using TBindingsRoomsChanges = TMap<TChannelsMapping, TBindingsRoomsChange>;
TChannelsMapping GetPoolsMapping(const TChannelsBindings& bindings);
-struct TTableShardInfo {
- TShardIdx ShardIdx = InvalidShardIdx;
- TString EndOfRange;
+struct TTableShardInfo {
+ TShardIdx ShardIdx = InvalidShardIdx;
+ TString EndOfRange;
TInstant LastCondErase;
TInstant NextCondErase;
mutable TMaybe<TDuration> LastCondEraseLag;
-
- // TODO: remove this ctor. It's used for vector.resize() that is not clear.
- TTableShardInfo() = default;
-
+
+ // TODO: remove this ctor. It's used for vector.resize() that is not clear.
+ TTableShardInfo() = default;
+
TTableShardInfo(const TShardIdx& idx, TString rangeEnd, ui64 lastCondErase = 0, ui64 nextCondErase = 0)
- : ShardIdx(idx)
- , EndOfRange(rangeEnd)
+ : ShardIdx(idx)
+ , EndOfRange(rangeEnd)
, LastCondErase(TInstant::FromValue(lastCondErase))
, NextCondErase(TInstant::FromValue(nextCondErase))
- {}
-};
-
-struct TColumnFamiliesMerger {
- TColumnFamiliesMerger(NKikimrSchemeOp::TPartitionConfig &container);
-
- bool Has(ui32 familyId) const;
- NKikimrSchemeOp::TFamilyDescription* Get(ui32 familyId, TString &errDescr);
- NKikimrSchemeOp::TFamilyDescription* AddOrGet(ui32 familyId, TString& errDescr);
- NKikimrSchemeOp::TFamilyDescription* AddOrGet(const TString& familyName, TString& errDescr);
- NKikimrSchemeOp::TFamilyDescription* Get(ui32 familyId, const TString& familyName, TString& errDescr);
- NKikimrSchemeOp::TFamilyDescription* AddOrGet(ui32 familyId, const TString& familyName, TString& errDescr);
-
-private:
- static constexpr ui32 MAX_AUTOGENERATED_FAMILY_ID = Max<ui32>() - 1;
-
- static const TString& CanonizeName(const TString& familyName);
-
- NKikimrSchemeOp::TPartitionConfig &Container;
- THashMap<ui32, size_t> DeduplicationById;
- THashMap<ui32, TString> NameByIds;
- THashMap<TString, ui32> IdByName;
- ui32 NextAutogenId = 0;
-};
-
-struct TPartitionConfigMerger {
+ {}
+};
+
+struct TColumnFamiliesMerger {
+ TColumnFamiliesMerger(NKikimrSchemeOp::TPartitionConfig &container);
+
+ bool Has(ui32 familyId) const;
+ NKikimrSchemeOp::TFamilyDescription* Get(ui32 familyId, TString &errDescr);
+ NKikimrSchemeOp::TFamilyDescription* AddOrGet(ui32 familyId, TString& errDescr);
+ NKikimrSchemeOp::TFamilyDescription* AddOrGet(const TString& familyName, TString& errDescr);
+ NKikimrSchemeOp::TFamilyDescription* Get(ui32 familyId, const TString& familyName, TString& errDescr);
+ NKikimrSchemeOp::TFamilyDescription* AddOrGet(ui32 familyId, const TString& familyName, TString& errDescr);
+
+private:
+ static constexpr ui32 MAX_AUTOGENERATED_FAMILY_ID = Max<ui32>() - 1;
+
+ static const TString& CanonizeName(const TString& familyName);
+
+ NKikimrSchemeOp::TPartitionConfig &Container;
+ THashMap<ui32, size_t> DeduplicationById;
+ THashMap<ui32, TString> NameByIds;
+ THashMap<TString, ui32> IdByName;
+ ui32 NextAutogenId = 0;
+};
+
+struct TPartitionConfigMerger {
static constexpr ui32 MaxFollowersCount = 3;
-
- static NKikimrSchemeOp::TPartitionConfig DefaultConfig(const TAppData* appData);
- static bool ApplyChanges(
- NKikimrSchemeOp::TPartitionConfig& result,
- const NKikimrSchemeOp::TPartitionConfig& src, const NKikimrSchemeOp::TPartitionConfig& changes,
- const TAppData* appData, TString& errDesr);
-
- static bool ApplyChangesInColumnFamilies(
- NKikimrSchemeOp::TPartitionConfig& result,
- const NKikimrSchemeOp::TPartitionConfig& src, const NKikimrSchemeOp::TPartitionConfig& changes,
- TString& errDesr);
-
- static THashMap<ui32, size_t> DeduplicateColumnFamiliesById(NKikimrSchemeOp::TPartitionConfig& config);
- static THashMap<ui32, size_t> DeduplicateStorageRoomsById(NKikimrSchemeOp::TPartitionConfig& config);
- static NKikimrSchemeOp::TFamilyDescription& MutableColumnFamilyById(
- NKikimrSchemeOp::TPartitionConfig& partitionConfig,
- THashMap<ui32, size_t>& posById,
- ui32 familyId);
-
- static bool VerifyCreateParams(
- const NKikimrSchemeOp::TPartitionConfig& config,
- const TAppData* appData, const bool shadowDataAllowed, TString& errDescr);
-
- static bool VerifyAlterParams(
- const NKikimrSchemeOp::TPartitionConfig& srcConfig,
- const NKikimrSchemeOp::TPartitionConfig& dstConfig,
- const TAppData* appData,
- const bool shadowDataAllowed,
- TString& errDescr
- );
-
- static bool VerifyCompactionPolicy(
- const NKikimrSchemeOp::TCompactionPolicy& policy,
- TString& err);
-
- static bool VerifyCommandOnFrozenTable(
- const NKikimrSchemeOp::TPartitionConfig& srcConfig,
- const NKikimrSchemeOp::TPartitionConfig& dstConfig);
-
-};
-
+
+ static NKikimrSchemeOp::TPartitionConfig DefaultConfig(const TAppData* appData);
+ static bool ApplyChanges(
+ NKikimrSchemeOp::TPartitionConfig& result,
+ const NKikimrSchemeOp::TPartitionConfig& src, const NKikimrSchemeOp::TPartitionConfig& changes,
+ const TAppData* appData, TString& errDesr);
+
+ static bool ApplyChangesInColumnFamilies(
+ NKikimrSchemeOp::TPartitionConfig& result,
+ const NKikimrSchemeOp::TPartitionConfig& src, const NKikimrSchemeOp::TPartitionConfig& changes,
+ TString& errDesr);
+
+ static THashMap<ui32, size_t> DeduplicateColumnFamiliesById(NKikimrSchemeOp::TPartitionConfig& config);
+ static THashMap<ui32, size_t> DeduplicateStorageRoomsById(NKikimrSchemeOp::TPartitionConfig& config);
+ static NKikimrSchemeOp::TFamilyDescription& MutableColumnFamilyById(
+ NKikimrSchemeOp::TPartitionConfig& partitionConfig,
+ THashMap<ui32, size_t>& posById,
+ ui32 familyId);
+
+ static bool VerifyCreateParams(
+ const NKikimrSchemeOp::TPartitionConfig& config,
+ const TAppData* appData, const bool shadowDataAllowed, TString& errDescr);
+
+ static bool VerifyAlterParams(
+ const NKikimrSchemeOp::TPartitionConfig& srcConfig,
+ const NKikimrSchemeOp::TPartitionConfig& dstConfig,
+ const TAppData* appData,
+ const bool shadowDataAllowed,
+ TString& errDescr
+ );
+
+ static bool VerifyCompactionPolicy(
+ const NKikimrSchemeOp::TCompactionPolicy& policy,
+ TString& err);
+
+ static bool VerifyCommandOnFrozenTable(
+ const NKikimrSchemeOp::TPartitionConfig& srcConfig,
+ const NKikimrSchemeOp::TPartitionConfig& dstConfig);
+
+};
+
struct TSubDomainInfo;
-struct TTableInfo : public TSimpleRefCount<TTableInfo> {
- using TPtr = TIntrusivePtr<TTableInfo>;
- using TCPtr = TIntrusiveConstPtr<TTableInfo>;
-
- struct TColumn : public NTable::TColumn {
- ui64 CreateVersion;
- ui64 DeleteVersion;
+struct TTableInfo : public TSimpleRefCount<TTableInfo> {
+ using TPtr = TIntrusivePtr<TTableInfo>;
+ using TCPtr = TIntrusiveConstPtr<TTableInfo>;
+
+ struct TColumn : public NTable::TColumn {
+ ui64 CreateVersion;
+ ui64 DeleteVersion;
ETableColumnDefaultKind DefaultKind = ETableColumnDefaultKind::None;
TString DefaultValue;
bool NotNull = false;
-
- TColumn(const TString& name, ui32 id, NScheme::TTypeId type)
- : NTable::TScheme::TColumn(name, id, type)
- , CreateVersion(0)
- , DeleteVersion(Max<ui64>())
- {}
-
- TColumn()
- : NTable::TScheme::TColumn()
- , CreateVersion(0)
- , DeleteVersion(Max<ui64>())
- {}
-
- bool IsKey() const { return KeyOrder != Max<ui32>(); }
- bool IsDropped() const { return DeleteVersion != Max<ui64>(); }
- };
-
+
+ TColumn(const TString& name, ui32 id, NScheme::TTypeId type)
+ : NTable::TScheme::TColumn(name, id, type)
+ , CreateVersion(0)
+ , DeleteVersion(Max<ui64>())
+ {}
+
+ TColumn()
+ : NTable::TScheme::TColumn()
+ , CreateVersion(0)
+ , DeleteVersion(Max<ui64>())
+ {}
+
+ bool IsKey() const { return KeyOrder != Max<ui32>(); }
+ bool IsDropped() const { return DeleteVersion != Max<ui64>(); }
+ };
+
struct TBackupRestoreResult {
enum class EKind: ui8 {
Backup = 0,
@@ -202,47 +202,47 @@ struct TTableInfo : public TSimpleRefCount<TTableInfo> {
ui64 StartDateTime; // seconds
ui64 CompletionDateTime; // seconds
- ui32 TotalShardCount;
+ ui32 TotalShardCount;
ui32 SuccessShardCount;
THashMap<TShardIdx, TTxState::TShardStatus> ShardStatuses;
- ui64 DataTotalSize;
- };
-
- struct TPartitionStats {
- TMessageSeqNo SeqNo;
-
- ui64 RowCount = 0;
- ui64 DataSize = 0;
- ui64 IndexSize = 0;
-
- TInstant LastAccessTime;
- TInstant LastUpdateTime;
- TDuration TxCompleteLag;
-
- ui64 ImmediateTxCompleted = 0;
- ui64 PlannedTxCompleted = 0;
- ui64 TxRejectedByOverload = 0;
- ui64 TxRejectedBySpace = 0;
- ui64 InFlightTxCount = 0;
-
- ui64 RowUpdates = 0;
- ui64 RowDeletes = 0;
- ui64 RowReads = 0;
- ui64 RangeReads = 0;
- ui64 RangeReadRows = 0;
-
- ui64 Memory = 0;
- ui64 Network = 0;
- ui64 Storage = 0;
- ui64 ReadThroughput = 0;
- ui64 WriteThroughput = 0;
+ ui64 DataTotalSize;
+ };
+
+ struct TPartitionStats {
+ TMessageSeqNo SeqNo;
+
+ ui64 RowCount = 0;
+ ui64 DataSize = 0;
+ ui64 IndexSize = 0;
+
+ TInstant LastAccessTime;
+ TInstant LastUpdateTime;
+ TDuration TxCompleteLag;
+
+ ui64 ImmediateTxCompleted = 0;
+ ui64 PlannedTxCompleted = 0;
+ ui64 TxRejectedByOverload = 0;
+ ui64 TxRejectedBySpace = 0;
+ ui64 InFlightTxCount = 0;
+
+ ui64 RowUpdates = 0;
+ ui64 RowDeletes = 0;
+ ui64 RowReads = 0;
+ ui64 RangeReads = 0;
+ ui64 RangeReadRows = 0;
+
+ ui64 Memory = 0;
+ ui64 Network = 0;
+ ui64 Storage = 0;
+ ui64 ReadThroughput = 0;
+ ui64 WriteThroughput = 0;
ui64 ReadIops = 0;
ui64 WriteIops = 0;
-
- THashSet<TTabletId> PartOwners;
- ui64 PartCount = 0;
+
+ THashSet<TTabletId> PartOwners;
+ ui64 PartCount = 0;
ui64 SearchHeight = 0;
- ui32 ShardState = NKikimrTxDataShard::Unknown;
+ ui32 ShardState = NKikimrTxDataShard::Unknown;
// True when PartOwners has parts from other tablets
bool HasBorrowed = false;
@@ -303,87 +303,87 @@ struct TTableInfo : public TSimpleRefCount<TTableInfo> {
TInstant Last10PercentLoad;
TInstant Last20PercentLoad;
TInstant Last30PercentLoad;
- };
-
- struct TStats {
- TPartitionStats Aggregated;
- THashMap<TShardIdx, TPartitionStats> PartitionStats;
- size_t PartitionStatsUpdated = 0;
- };
-
- struct TAlterTableInfo : TSimpleRefCount<TAlterTableInfo> {
- using TPtr = TIntrusivePtr<TAlterTableInfo>;
-
- ui32 NextColumnId = 1;
- ui64 AlterVersion = 0;
- THashMap<ui32, TColumn> Columns;
- TVector<ui32> KeyColumnIds;
+ };
+
+ struct TStats {
+ TPartitionStats Aggregated;
+ THashMap<TShardIdx, TPartitionStats> PartitionStats;
+ size_t PartitionStatsUpdated = 0;
+ };
+
+ struct TAlterTableInfo : TSimpleRefCount<TAlterTableInfo> {
+ using TPtr = TIntrusivePtr<TAlterTableInfo>;
+
+ ui32 NextColumnId = 1;
+ ui64 AlterVersion = 0;
+ THashMap<ui32, TColumn> Columns;
+ TVector<ui32> KeyColumnIds;
bool IsBackup = false;
-
- NKikimrSchemeOp::TTableDescription TableDescriptionDiff;
- TMaybeFail<NKikimrSchemeOp::TTableDescription> TableDescriptionFull;
-
- bool IsFullPartitionConfig() const {
- return TableDescriptionFull.Defined();
- }
-
- const NKikimrSchemeOp::TTableDescription& TableDescription() const {
+
+ NKikimrSchemeOp::TTableDescription TableDescriptionDiff;
+ TMaybeFail<NKikimrSchemeOp::TTableDescription> TableDescriptionFull;
+
+ bool IsFullPartitionConfig() const {
+ return TableDescriptionFull.Defined();
+ }
+
+ const NKikimrSchemeOp::TTableDescription& TableDescription() const {
if (IsFullPartitionConfig()) {
return *TableDescriptionFull;
}
return TableDescriptionDiff;
}
- NKikimrSchemeOp::TTableDescription& TableDescription() {
+ NKikimrSchemeOp::TTableDescription& TableDescription() {
if (IsFullPartitionConfig()) {
return *TableDescriptionFull;
}
return TableDescriptionDiff;
}
- const NKikimrSchemeOp::TPartitionConfig& PartitionConfigDiff() const { return TableDescriptionDiff.GetPartitionConfig(); }
- NKikimrSchemeOp::TPartitionConfig& PartitionConfigDiff() { return *TableDescriptionDiff.MutablePartitionConfig(); }
-
- const NKikimrSchemeOp::TPartitionConfig& PartitionConfigFull() const { return TableDescriptionFull->GetPartitionConfig(); }
- NKikimrSchemeOp::TPartitionConfig& PartitionConfigFull() { return *TableDescriptionFull->MutablePartitionConfig(); }
-
- const NKikimrSchemeOp::TPartitionConfig& PartitionConfigCompatible() const {
+ const NKikimrSchemeOp::TPartitionConfig& PartitionConfigDiff() const { return TableDescriptionDiff.GetPartitionConfig(); }
+ NKikimrSchemeOp::TPartitionConfig& PartitionConfigDiff() { return *TableDescriptionDiff.MutablePartitionConfig(); }
+
+ const NKikimrSchemeOp::TPartitionConfig& PartitionConfigFull() const { return TableDescriptionFull->GetPartitionConfig(); }
+ NKikimrSchemeOp::TPartitionConfig& PartitionConfigFull() { return *TableDescriptionFull->MutablePartitionConfig(); }
+
+ const NKikimrSchemeOp::TPartitionConfig& PartitionConfigCompatible() const {
return TableDescription().GetPartitionConfig();
- }
- NKikimrSchemeOp::TPartitionConfig& PartitionConfigCompatible() {
+ }
+ NKikimrSchemeOp::TPartitionConfig& PartitionConfigCompatible() {
return *TableDescription().MutablePartitionConfig();
- }
- };
-
- using TAlterDataPtr = TAlterTableInfo::TPtr;
-
- ui32 NextColumnId = 1; // Next unallocated column id
- ui64 AlterVersion = 0;
+ }
+ };
+
+ using TAlterDataPtr = TAlterTableInfo::TPtr;
+
+ ui32 NextColumnId = 1; // Next unallocated column id
+ ui64 AlterVersion = 0;
ui64 PartitioningVersion = 0;
- THashMap<ui32, TColumn> Columns;
- TVector<ui32> KeyColumnIds;
+ THashMap<ui32, TColumn> Columns;
+ TVector<ui32> KeyColumnIds;
bool IsBackup = false;
-
- TAlterTableInfo::TPtr AlterData;
-
- NKikimrSchemeOp::TTableDescription TableDescription;
-
- NKikimrSchemeOp::TBackupTask BackupSettings;
- NKikimrSchemeOp::TRestoreTask RestoreSettings;
+
+ TAlterTableInfo::TPtr AlterData;
+
+ NKikimrSchemeOp::TTableDescription TableDescription;
+
+ NKikimrSchemeOp::TBackupTask BackupSettings;
+ NKikimrSchemeOp::TRestoreTask RestoreSettings;
TMap<TTxId, TBackupRestoreResult> BackupHistory;
TMap<TTxId, TBackupRestoreResult> RestoreHistory;
- TString PreSerializedPathDescription;
-
- THashMap<TShardIdx, NKikimrSchemeOp::TPartitionConfig> PerShardPartitionConfig;
+ TString PreSerializedPathDescription;
+
+ THashMap<TShardIdx, NKikimrSchemeOp::TPartitionConfig> PerShardPartitionConfig;
+
+ const NKikimrSchemeOp::TPartitionConfig& PartitionConfig() const { return TableDescription.GetPartitionConfig(); }
+ NKikimrSchemeOp::TPartitionConfig& MutablePartitionConfig() { return *TableDescription.MutablePartitionConfig(); }
- const NKikimrSchemeOp::TPartitionConfig& PartitionConfig() const { return TableDescription.GetPartitionConfig(); }
- NKikimrSchemeOp::TPartitionConfig& MutablePartitionConfig() { return *TableDescription.MutablePartitionConfig(); }
-
bool HasTTLSettings() const { return TableDescription.HasTTLSettings(); }
- const NKikimrSchemeOp::TTTLSettings& TTLSettings() const { return TableDescription.GetTTLSettings(); }
+ const NKikimrSchemeOp::TTTLSettings& TTLSettings() const { return TableDescription.GetTTLSettings(); }
bool IsTTLEnabled() const { return HasTTLSettings() && TTLSettings().HasEnabled(); }
- NKikimrSchemeOp::TTTLSettings& MutableTTLSettings() {
+ NKikimrSchemeOp::TTTLSettings& MutableTTLSettings() {
TTLColumnId.Clear();
return *TableDescription.MutableTTLSettings();
}
@@ -409,7 +409,7 @@ struct TTableInfo : public TSimpleRefCount<TTableInfo> {
return *TTLColumnId;
}
-private:
+private:
using TPartitionsVec = TVector<TTableShardInfo>;
struct TSortByNextCondErase {
@@ -421,17 +421,17 @@ private:
};
TPartitionsVec Partitions;
- THashMap<TShardIdx, ui64> Shard2PartitionIdx; // shardIdx -> index in Partitions
+ THashMap<TShardIdx, ui64> Shard2PartitionIdx; // shardIdx -> index in Partitions
TPriorityQueue<TPartitionsVec::iterator, TVector<TPartitionsVec::iterator>, TSortByNextCondErase> CondEraseSchedule;
THashSet<TShardIdx> InFlightCondErase;
mutable TMaybe<ui32> TTLColumnId;
- THashSet<TOperationId> SplitOpsInFlight;
- THashMap<TOperationId, TVector<TShardIdx>> ShardsInSplitMergeByOpId;
- THashMap<TShardIdx, TOperationId> ShardsInSplitMergeByShards;
- ui64 ExpectedPartitionCount = 0; // number of partitions after all in-flight splits/merges are finished
- TStats Stats;
- bool ShardsStatsDetached = false;
-
+ THashSet<TOperationId> SplitOpsInFlight;
+ THashMap<TOperationId, TVector<TShardIdx>> ShardsInSplitMergeByOpId;
+ THashMap<TShardIdx, TOperationId> ShardsInSplitMergeByShards;
+ ui64 ExpectedPartitionCount = 0; // number of partitions after all in-flight splits/merges are finished
+ TStats Stats;
+ bool ShardsStatsDetached = false;
+
TPartitionsVec::iterator FindPartition(const TShardIdx& shardIdx) {
auto it = Shard2PartitionIdx.find(shardIdx);
if (it == Shard2PartitionIdx.end()) {
@@ -446,37 +446,37 @@ private:
return Partitions.begin() + partitionIdx;
}
-public:
- TTableInfo() = default;
-
- explicit TTableInfo(TAlterTableInfo&& alterData)
- : NextColumnId(alterData.NextColumnId)
- , AlterVersion(alterData.AlterVersion)
- , Columns(std::move(alterData.Columns))
- , KeyColumnIds(std::move(alterData.KeyColumnIds))
+public:
+ TTableInfo() = default;
+
+ explicit TTableInfo(TAlterTableInfo&& alterData)
+ : NextColumnId(alterData.NextColumnId)
+ , AlterVersion(alterData.AlterVersion)
+ , Columns(std::move(alterData.Columns))
+ , KeyColumnIds(std::move(alterData.KeyColumnIds))
, IsBackup(alterData.IsBackup)
- {
- TableDescription.Swap(alterData.TableDescriptionFull.Get());
- }
-
- static TAlterDataPtr CreateAlterData(
- TPtr source,
- NKikimrSchemeOp::TTableDescription& descr,
- const NScheme::TTypeRegistry& typeRegistry,
+ {
+ TableDescription.Swap(alterData.TableDescriptionFull.Get());
+ }
+
+ static TAlterDataPtr CreateAlterData(
+ TPtr source,
+ NKikimrSchemeOp::TTableDescription& descr,
+ const NScheme::TTypeRegistry& typeRegistry,
const TSchemeLimits& limits, const TSubDomainInfo& subDomain,
TString& errStr, const THashSet<TString>& localSequences = {});
-
- static ui32 ShardsToCreate(const NKikimrSchemeOp::TTableDescription& descr) {
- if (descr.HasUniformPartitionsCount()) {
- return descr.GetUniformPartitionsCount();
- } else {
- return descr.SplitBoundarySize() + 1;
- }
- }
-
- TVector<ui32> FillDescription(TPathElement::TPtr pathInfo);
-
- void SetRoom(const TStorageRoom& room) {
+
+ static ui32 ShardsToCreate(const NKikimrSchemeOp::TTableDescription& descr) {
+ if (descr.HasUniformPartitionsCount()) {
+ return descr.GetUniformPartitionsCount();
+ } else {
+ return descr.SplitBoundarySize() + 1;
+ }
+ }
+
+ TVector<ui32> FillDescription(TPathElement::TPtr pathInfo);
+
+ void SetRoom(const TStorageRoom& room) {
// WARNING: this is legacy support code
// StorageRooms from per-table partition config are only used for
// tablets that don't have per-shard patches. During migration we
@@ -484,78 +484,78 @@ public:
// their storage config altered, so per-table and per-shard rooms
// cannot diverge. These settings will eventually become dead weight,
// only useful for ancient shards, after which may remove this code.
- Y_VERIFY(room.GetId() == 0);
+ Y_VERIFY(room.GetId() == 0);
auto rooms = MutablePartitionConfig().MutableStorageRooms();
- rooms->Clear();
- rooms->Add()->CopyFrom(room);
- }
-
-
- void InitAlterData() {
- if (!AlterData) {
- AlterData = new TTableInfo::TAlterTableInfo;
- AlterData->AlterVersion = AlterVersion + 1; // calc next AlterVersion
- AlterData->NextColumnId = NextColumnId;
- }
- }
-
- void PrepareAlter(TAlterDataPtr alterData) {
- Y_VERIFY(alterData, "No alter data at Alter prepare");
- Y_VERIFY(alterData->AlterVersion == AlterVersion + 1);
- AlterData = alterData;
- }
-
- void FinishAlter();
-
-#if 1 // legacy
- TString SerializeAlterExtraData() const;
-
- void DeserializeAlterExtraData(const TString& str);
-#endif
-
- void SetPartitioning(TVector<TTableShardInfo>&& newPartitioning);
-
- const TVector<TTableShardInfo>& GetPartitions() const {
- return Partitions;
- }
-
- const TStats& GetStats() const {
- return Stats;
- }
-
- bool IsShardsStatsDetached() const {
- return ShardsStatsDetached;
- }
- void DetachShardsStats() {
- ShardsStatsDetached = true;
- }
-
+ rooms->Clear();
+ rooms->Add()->CopyFrom(room);
+ }
+
+
+ void InitAlterData() {
+ if (!AlterData) {
+ AlterData = new TTableInfo::TAlterTableInfo;
+ AlterData->AlterVersion = AlterVersion + 1; // calc next AlterVersion
+ AlterData->NextColumnId = NextColumnId;
+ }
+ }
+
+ void PrepareAlter(TAlterDataPtr alterData) {
+ Y_VERIFY(alterData, "No alter data at Alter prepare");
+ Y_VERIFY(alterData->AlterVersion == AlterVersion + 1);
+ AlterData = alterData;
+ }
+
+ void FinishAlter();
+
+#if 1 // legacy
+ TString SerializeAlterExtraData() const;
+
+ void DeserializeAlterExtraData(const TString& str);
+#endif
+
+ void SetPartitioning(TVector<TTableShardInfo>&& newPartitioning);
+
+ const TVector<TTableShardInfo>& GetPartitions() const {
+ return Partitions;
+ }
+
+ const TStats& GetStats() const {
+ return Stats;
+ }
+
+ bool IsShardsStatsDetached() const {
+ return ShardsStatsDetached;
+ }
+ void DetachShardsStats() {
+ ShardsStatsDetached = true;
+ }
+
void UpdateShardStats(TShardIdx datashardIdx, TPartitionStats& newStats);
-
- void RegisterSplitMegreOp(TOperationId txId, const TTxState& txState);
-
- bool IsShardInSplitMergeOp(TShardIdx idx) const;
- void FinishSplitMergeOp(TOperationId txId);
- void AbortSplitMergeOp(TOperationId txId);
-
- const THashSet<TOperationId>& GetSplitOpsInFlight() const {
- return SplitOpsInFlight;
- }
-
+
+ void RegisterSplitMegreOp(TOperationId txId, const TTxState& txState);
+
+ bool IsShardInSplitMergeOp(TShardIdx idx) const;
+ void FinishSplitMergeOp(TOperationId txId);
+ void AbortSplitMergeOp(TOperationId txId);
+
+ const THashSet<TOperationId>& GetSplitOpsInFlight() const {
+ return SplitOpsInFlight;
+ }
+
const THashMap<TShardIdx, ui64>& GetShard2PartitionIdx() const {
return Shard2PartitionIdx;
}
- ui64 GetExpectedPartitionCount() const {
- return ExpectedPartitionCount;
- }
-
+ ui64 GetExpectedPartitionCount() const {
+ return ExpectedPartitionCount;
+ }
+
bool TryAddShardToMerge(const TSplitSettings& splitSettings, TShardIdx shardIdx, TVector<TShardIdx>& shardsToMerge,
THashSet<TTabletId>& partOwners, ui64& totalSize, float& totalLoad) const;
-
+
bool CheckCanMergePartitions(const TSplitSettings& splitSettings, TShardIdx shardIdx, TVector<TShardIdx>& shardsToMerge) const;
-
- bool CheckFastSplitForPartition(const TSplitSettings& splitSettings, TShardIdx shardIdx, ui64 dataSize, ui64 rowCount) const;
+
+ bool CheckFastSplitForPartition(const TSplitSettings& splitSettings, TShardIdx shardIdx, ui64 dataSize, ui64 rowCount) const;
bool CheckSplitByLoad(const TSplitSettings& splitSettings, TShardIdx shardIdx, ui64 dataSize, ui64 rowCount) const;
bool IsSplitBySizeEnabled() const {
@@ -574,71 +574,71 @@ public:
return IsSplitByLoadEnabled();
}
- ui64 GetShardSizeToSplit() const {
- ui64 threshold = PartitionConfig().GetPartitioningPolicy().GetSizeToSplit();
- return threshold == 0 ?
- Max<ui64>() : // Autosplit is OFF if theshold is not specified
- threshold;
- }
-
- ui64 GetSizeToMerge() const {
+ ui64 GetShardSizeToSplit() const {
+ ui64 threshold = PartitionConfig().GetPartitioningPolicy().GetSizeToSplit();
+ return threshold == 0 ?
+ Max<ui64>() : // Autosplit is OFF if theshold is not specified
+ threshold;
+ }
+
+ ui64 GetSizeToMerge() const {
if (!IsMergeBySizeEnabled()) {
- // Disable auto-merge by default
- return 0;
- } else {
- return GetShardSizeToSplit() / 2;
- }
- }
-
- ui64 GetMinPartitionsCount() const {
- ui64 val = PartitionConfig().GetPartitioningPolicy().GetMinPartitionsCount();
- return val == 0 ? 1 : val;
- }
-
- ui64 GetMaxPartitionsCount() const {
- ui64 val = PartitionConfig().GetPartitioningPolicy().GetMaxPartitionsCount();
- return val == 0 ? 32*1024 : val;
- }
-
- bool NeedRecreateParts() const {
- if (!AlterData) {
- return false;
- }
-
+ // Disable auto-merge by default
+ return 0;
+ } else {
+ return GetShardSizeToSplit() / 2;
+ }
+ }
+
+ ui64 GetMinPartitionsCount() const {
+ ui64 val = PartitionConfig().GetPartitioningPolicy().GetMinPartitionsCount();
+ return val == 0 ? 1 : val;
+ }
+
+ ui64 GetMaxPartitionsCount() const {
+ ui64 val = PartitionConfig().GetPartitioningPolicy().GetMaxPartitionsCount();
+ return val == 0 ? 32*1024 : val;
+ }
+
+ bool NeedRecreateParts() const {
+ if (!AlterData) {
+ return false;
+ }
+
auto srcFollowerParams = std::tuple<ui64, bool, ui32>(
PartitionConfig().GetFollowerCount(),
PartitionConfig().GetAllowFollowerPromotion(),
PartitionConfig().GetCrossDataCenterFollowerCount()
- );
-
+ );
+
auto alterFollowerParams = std::tuple<ui64, bool, ui32>(
AlterData->PartitionConfigCompatible().GetFollowerCount(),
AlterData->PartitionConfigCompatible().GetAllowFollowerPromotion(),
AlterData->PartitionConfigCompatible().GetCrossDataCenterFollowerCount()
-
- );
-
- auto equals_proto_array = [] (const auto& left, const auto& right) {
- if (left.size() != right.size()) {
- return false;
- }
-
- for (decltype(right.size()) i = 0; i < right.size(); ++i) {
- if (!google::protobuf::util::MessageDifferencer::Equals(left[i], right[i])) {
- return false;
- }
- }
-
- return true;
- };
-
-
-
+
+ );
+
+ auto equals_proto_array = [] (const auto& left, const auto& right) {
+ if (left.size() != right.size()) {
+ return false;
+ }
+
+ for (decltype(right.size()) i = 0; i < right.size(); ++i) {
+ if (!google::protobuf::util::MessageDifferencer::Equals(left[i], right[i])) {
+ return false;
+ }
+ }
+
+ return true;
+ };
+
+
+
return srcFollowerParams != alterFollowerParams
- || !equals_proto_array(
+ || !equals_proto_array(
PartitionConfig().GetFollowerGroups(),
AlterData->PartitionConfigCompatible().GetFollowerGroups());
- }
+ }
const TTableShardInfo* GetScheduledCondEraseShard() const {
if (CondEraseSchedule.empty()) {
@@ -694,8 +694,8 @@ public:
}
return false;
}
-};
-
+};
+
struct TOlapSchema {
struct TColumn {
ui32 Id = Max<ui32>();
@@ -810,10 +810,10 @@ struct TOlapTableInfo : TSimpleRefCount<TOlapTableInfo> {
}
};
-struct TPQShardInfo : TSimpleRefCount<TPQShardInfo> {
- using TPtr = TIntrusivePtr<TPQShardInfo>;
+struct TPQShardInfo : TSimpleRefCount<TPQShardInfo> {
+ using TPtr = TIntrusivePtr<TPQShardInfo>;
using TKeySchema = TVector<NScheme::TTypeId>;
-
+
struct TKeyRange {
TMaybe<TString> FromBound;
TMaybe<TString> ToBound;
@@ -821,41 +821,41 @@ struct TPQShardInfo : TSimpleRefCount<TPQShardInfo> {
void SerializeToProto(NKikimrPQ::TPartitionKeyRange& proto) const;
};
- struct TPersQueueInfo {
- ui32 PqId = 0;
- ui32 GroupId = 0;
- ui64 AlterVersion = 0;
+ struct TPersQueueInfo {
+ ui32 PqId = 0;
+ ui32 GroupId = 0;
+ ui64 AlterVersion = 0;
TMaybe<TKeyRange> KeyRange;
- };
-
- TVector<TPersQueueInfo> PQInfos;
-
- size_t PartsCount() const {
- return PQInfos.size();
- }
-};
-
-struct TAdoptedShard {
- ui64 PrevOwner;
- TLocalShardIdx PrevShardIdx;
-};
-
-struct TShardInfo {
- TTabletId TabletID = InvalidTabletId;
- TTxId CurrentTxId = InvalidTxId; ///< @note we support only one modifying transaction on shard at time
- TPathId PathId = InvalidPathId;
- TTabletTypes::EType TabletType = ETabletType::TypeInvalid;
- TChannelsBindings BindedChannels;
-
- TShardInfo(TTxId txId, TPathId pathId, TTabletTypes::EType type)
- : CurrentTxId(txId)
- , PathId(pathId)
- , TabletType(type)
- {}
-
- TShardInfo() = default;
- TShardInfo(const TShardInfo& other) = default;
-
+ };
+
+ TVector<TPersQueueInfo> PQInfos;
+
+ size_t PartsCount() const {
+ return PQInfos.size();
+ }
+};
+
+struct TAdoptedShard {
+ ui64 PrevOwner;
+ TLocalShardIdx PrevShardIdx;
+};
+
+struct TShardInfo {
+ TTabletId TabletID = InvalidTabletId;
+ TTxId CurrentTxId = InvalidTxId; ///< @note we support only one modifying transaction on shard at time
+ TPathId PathId = InvalidPathId;
+ TTabletTypes::EType TabletType = ETabletType::TypeInvalid;
+ TChannelsBindings BindedChannels;
+
+ TShardInfo(TTxId txId, TPathId pathId, TTabletTypes::EType type)
+ : CurrentTxId(txId)
+ , PathId(pathId)
+ , TabletType(type)
+ {}
+
+ TShardInfo() = default;
+ TShardInfo(const TShardInfo& other) = default;
+
TShardInfo&& WithTabletID(TTabletId tabletId) && {
TabletID = tabletId;
return std::move(*this);
@@ -889,34 +889,34 @@ struct TShardInfo {
return copy;
}
- static TShardInfo RtmrPartitionInfo(TTxId txId, TPathId pathId) {
- return TShardInfo(txId, pathId, ETabletType::RTMRPartition);
- }
-
- static TShardInfo SolomonPartitionInfo(TTxId txId, TPathId pathId) {
- return TShardInfo(txId, pathId, ETabletType::KeyValue);
- }
-
- static TShardInfo DataShardInfo(TTxId txId, TPathId pathId) {
- return TShardInfo(txId, pathId, ETabletType::DataShard);
- }
-
- static TShardInfo PersQShardInfo(TTxId txId, TPathId pathId) {
- return TShardInfo(txId, pathId, ETabletType::PersQueue);
- }
-
- static TShardInfo PQBalancerShardInfo(TTxId txId, TPathId pathId) {
- return TShardInfo(txId, pathId, ETabletType::PersQueueReadBalancer);
- }
-
- static TShardInfo BlockStoreVolumeInfo(TTxId txId, TPathId pathId) {
- return TShardInfo(txId, pathId, ETabletType::BlockStoreVolume);
- }
-
- static TShardInfo BlockStorePartitionInfo(TTxId txId, TPathId pathId) {
- return TShardInfo(txId, pathId, ETabletType::BlockStorePartition);
- }
-
+ static TShardInfo RtmrPartitionInfo(TTxId txId, TPathId pathId) {
+ return TShardInfo(txId, pathId, ETabletType::RTMRPartition);
+ }
+
+ static TShardInfo SolomonPartitionInfo(TTxId txId, TPathId pathId) {
+ return TShardInfo(txId, pathId, ETabletType::KeyValue);
+ }
+
+ static TShardInfo DataShardInfo(TTxId txId, TPathId pathId) {
+ return TShardInfo(txId, pathId, ETabletType::DataShard);
+ }
+
+ static TShardInfo PersQShardInfo(TTxId txId, TPathId pathId) {
+ return TShardInfo(txId, pathId, ETabletType::PersQueue);
+ }
+
+ static TShardInfo PQBalancerShardInfo(TTxId txId, TPathId pathId) {
+ return TShardInfo(txId, pathId, ETabletType::PersQueueReadBalancer);
+ }
+
+ static TShardInfo BlockStoreVolumeInfo(TTxId txId, TPathId pathId) {
+ return TShardInfo(txId, pathId, ETabletType::BlockStoreVolume);
+ }
+
+ static TShardInfo BlockStorePartitionInfo(TTxId txId, TPathId pathId) {
+ return TShardInfo(txId, pathId, ETabletType::BlockStorePartition);
+ }
+
static TShardInfo BlockStorePartition2Info(TTxId txId, TPathId pathId) {
return TShardInfo(txId, pathId, ETabletType::BlockStorePartition2);
}
@@ -925,9 +925,9 @@ struct TShardInfo {
return TShardInfo(txId, pathId, ETabletType::FileStore);
}
- static TShardInfo KesusInfo(TTxId txId, TPathId pathId) {
- return TShardInfo(txId, pathId, ETabletType::Kesus);
- }
+ static TShardInfo KesusInfo(TTxId txId, TPathId pathId) {
+ return TShardInfo(txId, pathId, ETabletType::Kesus);
+ }
static TShardInfo OlapShardInfo(TTxId txId, TPathId pathId) {
return TShardInfo(txId, pathId, ETabletType::OlapShard);
@@ -944,12 +944,12 @@ struct TShardInfo {
static TShardInfo ReplicationControllerInfo(TTxId txId, TPathId pathId) {
return TShardInfo(txId, pathId, ETabletType::ReplicationController);
}
-};
-
-struct TPersQueueGroupInfo : TSimpleRefCount<TPersQueueGroupInfo> {
- using TPtr = TIntrusivePtr<TPersQueueGroupInfo>;
+};
+
+struct TPersQueueGroupInfo : TSimpleRefCount<TPersQueueGroupInfo> {
+ using TPtr = TIntrusivePtr<TPersQueueGroupInfo>;
using TKeySchema = TPQShardInfo::TKeySchema;
-
+
struct TPartitionToAdd {
using TKeyRange = TPQShardInfo::TKeyRange;
@@ -979,137 +979,137 @@ struct TPersQueueGroupInfo : TSimpleRefCount<TPersQueueGroupInfo> {
ui64 TotalGroupCount = 0;
ui64 TotalPartitionCount = 0;
- ui32 NextPartitionId = 0;
+ ui32 NextPartitionId = 0;
THashSet<TPartitionToAdd, TPartitionToAdd::THash> PartitionsToAdd;
- THashSet<ui32> PartitionsToDelete;
- ui32 MaxPartsPerTablet = 0;
- ui64 AlterVersion = 0;
- TString TabletConfig;
+ THashSet<ui32> PartitionsToDelete;
+ ui32 MaxPartsPerTablet = 0;
+ ui64 AlterVersion = 0;
+ TString TabletConfig;
TString BootstrapConfig;
- THashMap<TShardIdx, TPQShardInfo::TPtr> Shards; // key - shardIdx
+ THashMap<TShardIdx, TPQShardInfo::TPtr> Shards; // key - shardIdx
TKeySchema KeySchema;
- TPersQueueGroupInfo::TPtr AlterData; // changes to be applyed
- TTabletId BalancerTabletID = InvalidTabletId;
- TShardIdx BalancerShardIdx = InvalidShardIdx;
-
- TString PreSerializedPathDescription; // Cached path description
- TString PreSerializedPartitionsDescription; // Cached partition description
-
+ TPersQueueGroupInfo::TPtr AlterData; // changes to be applyed
+ TTabletId BalancerTabletID = InvalidTabletId;
+ TShardIdx BalancerShardIdx = InvalidShardIdx;
+
+ TString PreSerializedPathDescription; // Cached path description
+ TString PreSerializedPartitionsDescription; // Cached partition description
+
bool FillKeySchema(const NKikimrPQ::TPQTabletConfig& tabletConfig, TString& error);
bool FillKeySchema(const TString& tabletConfig);
- bool HasBalancer() const { return bool(BalancerTabletID); }
-
- ui32 GetTotalPartitionCountWithAlter() const {
- ui32 res = 0;
- for (const auto& shard : Shards) {
- res += shard.second->PartsCount();
- }
- return res;
- }
-
- ui32 ExpectedShardCount() const {
-
- Y_VERIFY(TotalPartitionCount);
- Y_VERIFY(MaxPartsPerTablet);
-
- ui32 partsPerTablet = MaxPartsPerTablet;
- ui32 pqTabletCount = TotalPartitionCount / partsPerTablet;
- if (TotalPartitionCount % partsPerTablet) {
- ++pqTabletCount;
- }
- return pqTabletCount;
- }
-
- ui32 ShardCount() const {
- return Shards.size();
- }
-
- void PrepareAlter(TPersQueueGroupInfo::TPtr alterData) {
- Y_VERIFY(alterData, "No alter data at Alter prepare");
- alterData->AlterVersion = AlterVersion + 1;
- Y_VERIFY(alterData->TotalGroupCount);
- Y_VERIFY(alterData->TotalPartitionCount);
- Y_VERIFY(alterData->NextPartitionId);
- Y_VERIFY(alterData->MaxPartsPerTablet);
+ bool HasBalancer() const { return bool(BalancerTabletID); }
+
+ ui32 GetTotalPartitionCountWithAlter() const {
+ ui32 res = 0;
+ for (const auto& shard : Shards) {
+ res += shard.second->PartsCount();
+ }
+ return res;
+ }
+
+ ui32 ExpectedShardCount() const {
+
+ Y_VERIFY(TotalPartitionCount);
+ Y_VERIFY(MaxPartsPerTablet);
+
+ ui32 partsPerTablet = MaxPartsPerTablet;
+ ui32 pqTabletCount = TotalPartitionCount / partsPerTablet;
+ if (TotalPartitionCount % partsPerTablet) {
+ ++pqTabletCount;
+ }
+ return pqTabletCount;
+ }
+
+ ui32 ShardCount() const {
+ return Shards.size();
+ }
+
+ void PrepareAlter(TPersQueueGroupInfo::TPtr alterData) {
+ Y_VERIFY(alterData, "No alter data at Alter prepare");
+ alterData->AlterVersion = AlterVersion + 1;
+ Y_VERIFY(alterData->TotalGroupCount);
+ Y_VERIFY(alterData->TotalPartitionCount);
+ Y_VERIFY(alterData->NextPartitionId);
+ Y_VERIFY(alterData->MaxPartsPerTablet);
alterData->KeySchema = KeySchema;
- alterData->BalancerTabletID = BalancerTabletID;
- alterData->BalancerShardIdx = BalancerShardIdx;
- AlterData = alterData;
- }
-
- void FinishAlter() {
- Y_VERIFY(AlterData, "No alter data at Alter complete");
- TotalGroupCount = AlterData->TotalGroupCount;
- NextPartitionId = AlterData->NextPartitionId;
- TotalPartitionCount = AlterData->TotalPartitionCount;
- MaxPartsPerTablet = AlterData->MaxPartsPerTablet;
- if (!AlterData->TabletConfig.empty())
- TabletConfig = AlterData->TabletConfig;
- ++AlterVersion;
- Y_VERIFY(BalancerTabletID == AlterData->BalancerTabletID || !HasBalancer());
- Y_VERIFY(AlterData->HasBalancer());
- Y_VERIFY(AlterData->BalancerShardIdx);
+ alterData->BalancerTabletID = BalancerTabletID;
+ alterData->BalancerShardIdx = BalancerShardIdx;
+ AlterData = alterData;
+ }
+
+ void FinishAlter() {
+ Y_VERIFY(AlterData, "No alter data at Alter complete");
+ TotalGroupCount = AlterData->TotalGroupCount;
+ NextPartitionId = AlterData->NextPartitionId;
+ TotalPartitionCount = AlterData->TotalPartitionCount;
+ MaxPartsPerTablet = AlterData->MaxPartsPerTablet;
+ if (!AlterData->TabletConfig.empty())
+ TabletConfig = AlterData->TabletConfig;
+ ++AlterVersion;
+ Y_VERIFY(BalancerTabletID == AlterData->BalancerTabletID || !HasBalancer());
+ Y_VERIFY(AlterData->HasBalancer());
+ Y_VERIFY(AlterData->BalancerShardIdx);
KeySchema = AlterData->KeySchema;
- BalancerTabletID = AlterData->BalancerTabletID;
- BalancerShardIdx = AlterData->BalancerShardIdx;
- AlterData.Reset();
- }
-};
-
-struct TRtmrPartitionInfo: TSimpleRefCount<TRtmrPartitionInfo> {
- using TPtr = TIntrusivePtr<TRtmrPartitionInfo>;
- TGUID Id;
- ui64 BusKey;
- TShardIdx ShardIdx;
- TTabletId TabletId;
-
- TRtmrPartitionInfo(TGUID id, ui64 busKey, TShardIdx shardIdx, TTabletId tabletId = InvalidTabletId):
- Id(id), BusKey(busKey), ShardIdx(shardIdx), TabletId(tabletId)
- {}
-};
-
-struct TRtmrVolumeInfo: TSimpleRefCount<TRtmrVolumeInfo> {
- using TPtr = TIntrusivePtr<TRtmrVolumeInfo>;
-
- THashMap<TShardIdx, TRtmrPartitionInfo::TPtr> Partitions;
-};
-
-struct TSolomonPartitionInfo: TSimpleRefCount<TSolomonPartitionInfo> {
- using TPtr = TIntrusivePtr<TSolomonPartitionInfo>;
- ui64 PartitionId;
- TTabletId TabletId;
-
- TSolomonPartitionInfo(ui64 partId, TTabletId tabletId = InvalidTabletId)
- : PartitionId(partId)
- , TabletId(tabletId)
- {}
-};
-
-struct TSolomonVolumeInfo: TSimpleRefCount<TSolomonVolumeInfo> {
- using TPtr = TIntrusivePtr<TSolomonVolumeInfo>;
-
- THashMap<TShardIdx, TSolomonPartitionInfo::TPtr> Partitions;
- ui64 Version;
- TSolomonVolumeInfo::TPtr AlterData;
-
- TSolomonVolumeInfo(ui64 version)
- : Version(version)
- {
- }
-
- TSolomonVolumeInfo::TPtr CreateAlter() const {
- return CreateAlter(Version + 1);
- }
-
- TSolomonVolumeInfo::TPtr CreateAlter(ui64 version) const {
- Y_VERIFY(Version < version);
- TSolomonVolumeInfo::TPtr alter = new TSolomonVolumeInfo(*this);
- alter->Version = version;
- return alter;
- }
-};
-
+ BalancerTabletID = AlterData->BalancerTabletID;
+ BalancerShardIdx = AlterData->BalancerShardIdx;
+ AlterData.Reset();
+ }
+};
+
+struct TRtmrPartitionInfo: TSimpleRefCount<TRtmrPartitionInfo> {
+ using TPtr = TIntrusivePtr<TRtmrPartitionInfo>;
+ TGUID Id;
+ ui64 BusKey;
+ TShardIdx ShardIdx;
+ TTabletId TabletId;
+
+ TRtmrPartitionInfo(TGUID id, ui64 busKey, TShardIdx shardIdx, TTabletId tabletId = InvalidTabletId):
+ Id(id), BusKey(busKey), ShardIdx(shardIdx), TabletId(tabletId)
+ {}
+};
+
+struct TRtmrVolumeInfo: TSimpleRefCount<TRtmrVolumeInfo> {
+ using TPtr = TIntrusivePtr<TRtmrVolumeInfo>;
+
+ THashMap<TShardIdx, TRtmrPartitionInfo::TPtr> Partitions;
+};
+
+struct TSolomonPartitionInfo: TSimpleRefCount<TSolomonPartitionInfo> {
+ using TPtr = TIntrusivePtr<TSolomonPartitionInfo>;
+ ui64 PartitionId;
+ TTabletId TabletId;
+
+ TSolomonPartitionInfo(ui64 partId, TTabletId tabletId = InvalidTabletId)
+ : PartitionId(partId)
+ , TabletId(tabletId)
+ {}
+};
+
+struct TSolomonVolumeInfo: TSimpleRefCount<TSolomonVolumeInfo> {
+ using TPtr = TIntrusivePtr<TSolomonVolumeInfo>;
+
+ THashMap<TShardIdx, TSolomonPartitionInfo::TPtr> Partitions;
+ ui64 Version;
+ TSolomonVolumeInfo::TPtr AlterData;
+
+ TSolomonVolumeInfo(ui64 version)
+ : Version(version)
+ {
+ }
+
+ TSolomonVolumeInfo::TPtr CreateAlter() const {
+ return CreateAlter(Version + 1);
+ }
+
+ TSolomonVolumeInfo::TPtr CreateAlter(ui64 version) const {
+ Y_VERIFY(Version < version);
+ TSolomonVolumeInfo::TPtr alter = new TSolomonVolumeInfo(*this);
+ alter->Version = version;
+ return alter;
+ }
+};
+
using TSchemeQuota = TCountedLeakyBucket;
@@ -1130,10 +1130,10 @@ struct IQuotaCounters {
virtual void ChangeDiskSpaceSoftQuotaBytes(i64 delta) = 0;
};
-struct TSubDomainInfo: TSimpleRefCount<TSubDomainInfo> {
- using TPtr = TIntrusivePtr<TSubDomainInfo>;
- using TConstPtr = TIntrusiveConstPtr<TSubDomainInfo>;
-
+struct TSubDomainInfo: TSimpleRefCount<TSubDomainInfo> {
+ using TPtr = TIntrusivePtr<TSubDomainInfo>;
+ using TConstPtr = TIntrusiveConstPtr<TSubDomainInfo>;
+
struct TDiskSpaceUsage {
struct TTables {
ui64 TotalSize = 0;
@@ -1151,81 +1151,81 @@ struct TSubDomainInfo: TSimpleRefCount<TSubDomainInfo> {
}
};
- TSubDomainInfo() = default;
+ TSubDomainInfo() = default;
explicit TSubDomainInfo(ui64 version, const TPathId& resourcesDomainId)
- {
- ProcessingParams.SetVersion(version);
+ {
+ ProcessingParams.SetVersion(version);
ResourcesDomainId = resourcesDomainId;
- }
-
+ }
+
TSubDomainInfo(ui64 version, ui64 resolution, ui32 bucketsPerMediator, const TPathId& resourcesDomainId)
- {
- ProcessingParams.SetVersion(version);
- ProcessingParams.SetPlanResolution(resolution);
- ProcessingParams.SetTimeCastBucketsPerMediator(bucketsPerMediator);
+ {
+ ProcessingParams.SetVersion(version);
+ ProcessingParams.SetPlanResolution(resolution);
+ ProcessingParams.SetTimeCastBucketsPerMediator(bucketsPerMediator);
ResourcesDomainId = resourcesDomainId;
- }
-
- TSubDomainInfo(const TSubDomainInfo& other
- , ui64 planResolution
- , ui64 timeCastBucketsMediator
- , TStoragePools additionalPools = {})
- : TSubDomainInfo(other)
- {
- ProcessingParams.SetVersion(other.GetVersion() + 1);
-
- if (planResolution) {
- Y_VERIFY(other.GetPlanResolution() == 0 || other.GetPlanResolution() == planResolution);
- ProcessingParams.SetPlanResolution(planResolution);
- }
-
- if (timeCastBucketsMediator) {
- Y_VERIFY(other.GetTCB() == 0 || other.GetTCB() == timeCastBucketsMediator);
- ProcessingParams.SetTimeCastBucketsPerMediator(timeCastBucketsMediator);
- }
-
- for (auto& toAdd: additionalPools) {
- StoragePools.push_back(toAdd);
- }
- }
-
- void SetSchemeLimits(const TSchemeLimits& limits) {
- SchemeLimits = limits;
- }
-
- const TSchemeLimits& GetSchemeLimits() const {
- return SchemeLimits;
- }
-
- ui64 GetVersion() const {
- return ProcessingParams.GetVersion();
- }
-
- TPtr GetAlter() const {
- return AlterData;
- }
-
- void SetAlterPrivate(TPtr alterData) {
- AlterData = alterData;
- }
-
- void SetVersion(ui64 version) {
- Y_VERIFY(ProcessingParams.GetVersion() < version);
- ProcessingParams.SetVersion(version);
- }
-
- void SetAlter(TPtr alterData) {
- Y_VERIFY(alterData);
- Y_VERIFY(GetVersion() < alterData->GetVersion());
- AlterData = alterData;
- }
-
- void SetStoragePools(TStoragePools& storagePools, ui64 subDomainVersion) {
- Y_VERIFY(GetVersion() < subDomainVersion);
- StoragePools.swap(storagePools);
- ProcessingParams.SetVersion(subDomainVersion);
- }
-
+ }
+
+ TSubDomainInfo(const TSubDomainInfo& other
+ , ui64 planResolution
+ , ui64 timeCastBucketsMediator
+ , TStoragePools additionalPools = {})
+ : TSubDomainInfo(other)
+ {
+ ProcessingParams.SetVersion(other.GetVersion() + 1);
+
+ if (planResolution) {
+ Y_VERIFY(other.GetPlanResolution() == 0 || other.GetPlanResolution() == planResolution);
+ ProcessingParams.SetPlanResolution(planResolution);
+ }
+
+ if (timeCastBucketsMediator) {
+ Y_VERIFY(other.GetTCB() == 0 || other.GetTCB() == timeCastBucketsMediator);
+ ProcessingParams.SetTimeCastBucketsPerMediator(timeCastBucketsMediator);
+ }
+
+ for (auto& toAdd: additionalPools) {
+ StoragePools.push_back(toAdd);
+ }
+ }
+
+ void SetSchemeLimits(const TSchemeLimits& limits) {
+ SchemeLimits = limits;
+ }
+
+ const TSchemeLimits& GetSchemeLimits() const {
+ return SchemeLimits;
+ }
+
+ ui64 GetVersion() const {
+ return ProcessingParams.GetVersion();
+ }
+
+ TPtr GetAlter() const {
+ return AlterData;
+ }
+
+ void SetAlterPrivate(TPtr alterData) {
+ AlterData = alterData;
+ }
+
+ void SetVersion(ui64 version) {
+ Y_VERIFY(ProcessingParams.GetVersion() < version);
+ ProcessingParams.SetVersion(version);
+ }
+
+ void SetAlter(TPtr alterData) {
+ Y_VERIFY(alterData);
+ Y_VERIFY(GetVersion() < alterData->GetVersion());
+ AlterData = alterData;
+ }
+
+ void SetStoragePools(TStoragePools& storagePools, ui64 subDomainVersion) {
+ Y_VERIFY(GetVersion() < subDomainVersion);
+ StoragePools.swap(storagePools);
+ ProcessingParams.SetVersion(subDomainVersion);
+ }
+
TPathId GetResourcesDomainId() const {
return ResourcesDomainId;
}
@@ -1242,22 +1242,22 @@ struct TSubDomainInfo: TSimpleRefCount<TSubDomainInfo> {
SharedHive = hiveId;
}
- ui64 GetPlanResolution() const {
- return ProcessingParams.GetPlanResolution();
- }
-
- ui64 GetTCB() const {
- return ProcessingParams.GetTimeCastBucketsPerMediator();
- }
-
- TTabletId GetTenantSchemeShardID() const {
- if (!ProcessingParams.HasSchemeShard()) {
- return InvalidTabletId;
- }
- return TTabletId(ProcessingParams.GetSchemeShard());
- }
-
- TTabletId GetTenantHiveID() const {
+ ui64 GetPlanResolution() const {
+ return ProcessingParams.GetPlanResolution();
+ }
+
+ ui64 GetTCB() const {
+ return ProcessingParams.GetTimeCastBucketsPerMediator();
+ }
+
+ TTabletId GetTenantSchemeShardID() const {
+ if (!ProcessingParams.HasSchemeShard()) {
+ return InvalidTabletId;
+ }
+ return TTabletId(ProcessingParams.GetSchemeShard());
+ }
+
+ TTabletId GetTenantHiveID() const {
if (!ProcessingParams.HasHive()) {
return InvalidTabletId;
}
@@ -1271,24 +1271,24 @@ struct TSubDomainInfo: TSimpleRefCount<TSubDomainInfo> {
return TTabletId(ProcessingParams.GetSysViewProcessor());
}
- ui64 GetPathsInside() const {
- return PathsInsideCount;
- }
-
- void SetPathsInside(ui64 val) {
- PathsInsideCount = val;
- }
-
- void IncPathsInside(ui64 delta = 1) {
- Y_VERIFY(Max<ui64>() - PathsInsideCount >= delta);
- PathsInsideCount += delta;
- }
-
- void DecPathsInside(ui64 delta = 1) {
- Y_VERIFY_S(PathsInsideCount >= delta, "PathsInsideCount: " << PathsInsideCount << " delta: " << delta);
- PathsInsideCount -= delta;
- }
-
+ ui64 GetPathsInside() const {
+ return PathsInsideCount;
+ }
+
+ void SetPathsInside(ui64 val) {
+ PathsInsideCount = val;
+ }
+
+ void IncPathsInside(ui64 delta = 1) {
+ Y_VERIFY(Max<ui64>() - PathsInsideCount >= delta);
+ PathsInsideCount += delta;
+ }
+
+ void DecPathsInside(ui64 delta = 1) {
+ Y_VERIFY_S(PathsInsideCount >= delta, "PathsInsideCount: " << PathsInsideCount << " delta: " << delta);
+ PathsInsideCount -= delta;
+ }
+
ui64 GetPQPartitionsInside() const {
return PQPartitionsInsideCount;
}
@@ -1303,8 +1303,8 @@ struct TSubDomainInfo: TSimpleRefCount<TSubDomainInfo> {
}
void DecPQPartitionsInside(ui64 delta = 1) {
- Y_VERIFY_S(PQPartitionsInsideCount >= delta, "PQPartitionsInsideCount: " << PQPartitionsInsideCount << " delta: " << delta);
- PQPartitionsInsideCount -= delta;
+ Y_VERIFY_S(PQPartitionsInsideCount >= delta, "PQPartitionsInsideCount: " << PQPartitionsInsideCount << " delta: " << delta);
+ PQPartitionsInsideCount -= delta;
}
ui64 GetPQReservedStorage() const {
@@ -1332,16 +1332,16 @@ struct TSubDomainInfo: TSimpleRefCount<TSubDomainInfo> {
IncPQReservedStorage(newStorage);
}
- ui64 GetShardsInside() const {
- return InternalShards.size();
- }
-
+ ui64 GetShardsInside() const {
+ return InternalShards.size();
+ }
+
void ActualizeAlterData(const THashMap<TShardIdx, TShardInfo>& allShards, TInstant now, bool isExternal, IQuotaCounters* counters) {
- Y_VERIFY(AlterData);
+ Y_VERIFY(AlterData);
- AlterData->SetPathsInside(GetPathsInside());
- AlterData->InternalShards.swap(InternalShards);
- AlterData->Initialize(allShards);
+ AlterData->SetPathsInside(GetPathsInside());
+ AlterData->InternalShards.swap(InternalShards);
+ AlterData->Initialize(allShards);
AlterData->SchemeQuotas = SchemeQuotas;
if (isExternal) {
@@ -1367,8 +1367,8 @@ struct TSubDomainInfo: TSimpleRefCount<TSubDomainInfo> {
CountStreamShardsQuota(counters, GetStreamShardsQuota(), AlterData->GetStreamShardsQuota());
CountStreamReservedStorageQuota(counters, GetStreamReservedStorageQuota(), AlterData->GetStreamReservedStorageQuota());
- }
-
+ }
+
ui64 GetStreamShardsQuota() const {
return DatabaseQuotas ? DatabaseQuotas->data_stream_shards_quota() : 0;
}
@@ -1484,55 +1484,55 @@ struct TSubDomainInfo: TSimpleRefCount<TSubDomainInfo> {
return false;
}
- const TStoragePools& GetStoragePools() const {
- return StoragePools ;
- }
-
- const TStoragePools& EffectiveStoragePools() const {
- if (StoragePools) {
- return StoragePools;
- }
- if (AlterData) {
- return AlterData->StoragePools;
- }
- return StoragePools;
- }
-
- void AddStoragePool(const TStoragePool& pool) {
- StoragePools.push_back(pool);
- }
-
- void AddPrivateShard(TShardIdx shardId) {
- PrivateShards.push_back(shardId);
- }
-
- TVector<TShardIdx> GetPrivateShards() const {
- return PrivateShards;
- }
-
- void AddInternalShard(TShardIdx shardId) {
- InternalShards.insert(shardId);
- }
-
- const THashSet<TShardIdx>& GetInternalShards() const {
- return InternalShards;
- }
-
- void AddInternalShards(const TTxState& txState) {
- for (auto txShard: txState.Shards) {
- if (txShard.Operation != TTxState::CreateParts) {
- continue;
- }
- AddInternalShard(txShard.Idx);
- }
- }
-
- void RemoveInternalShard(TShardIdx shardIdx) {
- auto it = InternalShards.find(shardIdx);
- Y_VERIFY_S(it != InternalShards.end(), "shardIdx: " << shardIdx);
- InternalShards.erase(it);
- }
-
+ const TStoragePools& GetStoragePools() const {
+ return StoragePools ;
+ }
+
+ const TStoragePools& EffectiveStoragePools() const {
+ if (StoragePools) {
+ return StoragePools;
+ }
+ if (AlterData) {
+ return AlterData->StoragePools;
+ }
+ return StoragePools;
+ }
+
+ void AddStoragePool(const TStoragePool& pool) {
+ StoragePools.push_back(pool);
+ }
+
+ void AddPrivateShard(TShardIdx shardId) {
+ PrivateShards.push_back(shardId);
+ }
+
+ TVector<TShardIdx> GetPrivateShards() const {
+ return PrivateShards;
+ }
+
+ void AddInternalShard(TShardIdx shardId) {
+ InternalShards.insert(shardId);
+ }
+
+ const THashSet<TShardIdx>& GetInternalShards() const {
+ return InternalShards;
+ }
+
+ void AddInternalShards(const TTxState& txState) {
+ for (auto txShard: txState.Shards) {
+ if (txShard.Operation != TTxState::CreateParts) {
+ continue;
+ }
+ AddInternalShard(txShard.Idx);
+ }
+ }
+
+ void RemoveInternalShard(TShardIdx shardIdx) {
+ auto it = InternalShards.find(shardIdx);
+ Y_VERIFY_S(it != InternalShards.end(), "shardIdx: " << shardIdx);
+ InternalShards.erase(it);
+ }
+
const THashSet<TShardIdx>& GetSequenceShards() const {
return SequenceShards;
}
@@ -1561,50 +1561,50 @@ struct TSubDomainInfo: TSimpleRefCount<TSubDomainInfo> {
ReplicationControllers.erase(it);
}
- const NKikimrSubDomains::TProcessingParams& GetProcessingParams() const {
- return ProcessingParams;
- }
-
- TTabletId GetCoordinator(TTxId txId) const {
- Y_VERIFY(IsSupportTransactions());
- return TTabletId(CoordinatorSelector->Select(ui64(txId)));
- }
-
- bool IsSupportTransactions() const {
- return !PrivateShards.empty() || (CoordinatorSelector && !CoordinatorSelector->List().empty());
- }
-
- void Initialize(const THashMap<TShardIdx, TShardInfo>& allShards) {
- if (InitiatedAsGlobal) {
- return;
- }
-
- ProcessingParams.ClearCoordinators();
- TVector<TTabletId> coordinators = FilterTablets(ETabletType::Coordinator, allShards);
- for (TTabletId coordinator: coordinators) {
- ProcessingParams.AddCoordinators(ui64(coordinator));
- }
- CoordinatorSelector = new TCoordinators(ProcessingParams);
-
- ProcessingParams.ClearMediators();
- TVector<TTabletId> mediators = FilterTablets(ETabletType::Mediator, allShards);
- for (TTabletId mediator: mediators) {
- ProcessingParams.AddMediators(ui64(mediator));
- }
-
- ProcessingParams.ClearSchemeShard();
- TVector<TTabletId> schemeshards = FilterTablets(ETabletType::SchemeShard, allShards);
- Y_VERIFY_S(schemeshards.size() <= 1, "size was: " << schemeshards.size());
- if (schemeshards.size()) {
- ProcessingParams.SetSchemeShard(ui64(schemeshards.front()));
- }
+ const NKikimrSubDomains::TProcessingParams& GetProcessingParams() const {
+ return ProcessingParams;
+ }
+
+ TTabletId GetCoordinator(TTxId txId) const {
+ Y_VERIFY(IsSupportTransactions());
+ return TTabletId(CoordinatorSelector->Select(ui64(txId)));
+ }
+
+ bool IsSupportTransactions() const {
+ return !PrivateShards.empty() || (CoordinatorSelector && !CoordinatorSelector->List().empty());
+ }
+
+ void Initialize(const THashMap<TShardIdx, TShardInfo>& allShards) {
+ if (InitiatedAsGlobal) {
+ return;
+ }
+
+ ProcessingParams.ClearCoordinators();
+ TVector<TTabletId> coordinators = FilterTablets(ETabletType::Coordinator, allShards);
+ for (TTabletId coordinator: coordinators) {
+ ProcessingParams.AddCoordinators(ui64(coordinator));
+ }
+ CoordinatorSelector = new TCoordinators(ProcessingParams);
+
+ ProcessingParams.ClearMediators();
+ TVector<TTabletId> mediators = FilterTablets(ETabletType::Mediator, allShards);
+ for (TTabletId mediator: mediators) {
+ ProcessingParams.AddMediators(ui64(mediator));
+ }
+
+ ProcessingParams.ClearSchemeShard();
+ TVector<TTabletId> schemeshards = FilterTablets(ETabletType::SchemeShard, allShards);
+ Y_VERIFY_S(schemeshards.size() <= 1, "size was: " << schemeshards.size());
+ if (schemeshards.size()) {
+ ProcessingParams.SetSchemeShard(ui64(schemeshards.front()));
+ }
ProcessingParams.ClearHive();
TVector<TTabletId> hives = FilterTablets(ETabletType::Hive, allShards);
Y_VERIFY_S(hives.size() <= 1, "size was: " << hives.size());
if (hives.size()) {
ProcessingParams.SetHive(ui64(hives.front()));
- SetSharedHive(InvalidTabletId); // set off shared hive when our own hive has found
+ SetSharedHive(InvalidTabletId); // set off shared hive when our own hive has found
}
ProcessingParams.ClearSysViewProcessor();
@@ -1613,21 +1613,21 @@ struct TSubDomainInfo: TSimpleRefCount<TSubDomainInfo> {
if (sysViewProcessors.size()) {
ProcessingParams.SetSysViewProcessor(ui64(sysViewProcessors.front()));
}
- }
-
- void InitializeAsGlobal(NKikimrSubDomains::TProcessingParams&& processingParams) {
- InitiatedAsGlobal = true;
-
- Y_VERIFY(processingParams.GetPlanResolution());
- Y_VERIFY(processingParams.GetTimeCastBucketsPerMediator());
-
- ui64 version = ProcessingParams.GetVersion();
- ProcessingParams = std::move(processingParams);
- ProcessingParams.SetVersion(version);
-
- CoordinatorSelector = new TCoordinators(ProcessingParams);
- }
-
+ }
+
+ void InitializeAsGlobal(NKikimrSubDomains::TProcessingParams&& processingParams) {
+ InitiatedAsGlobal = true;
+
+ Y_VERIFY(processingParams.GetPlanResolution());
+ Y_VERIFY(processingParams.GetTimeCastBucketsPerMediator());
+
+ ui64 version = ProcessingParams.GetVersion();
+ ProcessingParams = std::move(processingParams);
+ ProcessingParams.SetVersion(version);
+
+ CoordinatorSelector = new TCoordinators(ProcessingParams);
+ }
+
void AggrDiskSpaceUsage(IQuotaCounters* counters, const TTableInfo::TPartitionStats& newAggr, const TTableInfo::TPartitionStats& oldAggr = TTableInfo::TPartitionStats()) {
DiskSpaceUsage.Tables.DataSize += (newAggr.DataSize - oldAggr.DataSize);
counters->ChangeDiskSpaceTablesDataBytes(newAggr.DataSize - oldAggr.DataSize);
@@ -1776,29 +1776,29 @@ struct TSubDomainInfo: TSimpleRefCount<TSubDomainInfo> {
++SecurityStateVersion;
}
-private:
- bool InitiatedAsGlobal = false;
- NKikimrSubDomains::TProcessingParams ProcessingParams;
- TCoordinators::TPtr CoordinatorSelector;
+private:
+ bool InitiatedAsGlobal = false;
+ NKikimrSubDomains::TProcessingParams ProcessingParams;
+ TCoordinators::TPtr CoordinatorSelector;
TMaybe<NKikimrSubDomains::TSchemeQuotas> DeclaredSchemeQuotas;
TMaybe<Ydb::Cms::DatabaseQuotas> DatabaseQuotas;
ui64 DomainStateVersion = 0;
bool DiskQuotaExceeded = false;
-
- TVector<TShardIdx> PrivateShards;
- TStoragePools StoragePools;
- TPtr AlterData;
-
- TSchemeLimits SchemeLimits;
+
+ TVector<TShardIdx> PrivateShards;
+ TStoragePools StoragePools;
+ TPtr AlterData;
+
+ TSchemeLimits SchemeLimits;
TSchemeQuotas SchemeQuotas;
-
- ui64 PathsInsideCount = 0;
+
+ ui64 PathsInsideCount = 0;
TDiskSpaceUsage DiskSpaceUsage;
-
- THashSet<TShardIdx> InternalShards;
+
+ THashSet<TShardIdx> InternalShards;
THashSet<TShardIdx> SequenceShards;
THashSet<TShardIdx> ReplicationControllers;
-
+
ui64 PQPartitionsInsideCount = 0;
ui64 PQReservedStorage = 0;
@@ -1808,54 +1808,54 @@ private:
NLoginProto::TSecurityState SecurityState;
ui64 SecurityStateVersion = 0;
- TVector<TTabletId> FilterTablets(TTabletTypes::EType type, const THashMap<TShardIdx, TShardInfo>& allShards) const {
- TVector<TTabletId> tablets;
- for (auto shardId: PrivateShards) {
-
- if (!allShards.contains(shardId)) {
- // KIKIMR-9849
- // some private shards, which has been migrated, might be deleted
- continue;
- }
-
- const auto& shard = allShards.at(shardId);
- if (shard.TabletType == type && shard.TabletID != InvalidTabletId) {
- tablets.push_back(shard.TabletID);
- }
- }
- return tablets;
- }
-};
-
-struct TBlockStorePartitionInfo : public TSimpleRefCount<TBlockStorePartitionInfo> {
- using TPtr = TIntrusivePtr<TBlockStorePartitionInfo>;
-
- ui32 PartitionId = 0;
- ui64 AlterVersion = 0;
-};
-
-struct TBlockStoreVolumeInfo : public TSimpleRefCount<TBlockStoreVolumeInfo> {
- using TPtr = TIntrusivePtr<TBlockStoreVolumeInfo>;
-
- struct TTabletCache {
- ui64 AlterVersion = 0;
- TVector<TTabletId> Tablets;
- };
-
+ TVector<TTabletId> FilterTablets(TTabletTypes::EType type, const THashMap<TShardIdx, TShardInfo>& allShards) const {
+ TVector<TTabletId> tablets;
+ for (auto shardId: PrivateShards) {
+
+ if (!allShards.contains(shardId)) {
+ // KIKIMR-9849
+ // some private shards, which has been migrated, might be deleted
+ continue;
+ }
+
+ const auto& shard = allShards.at(shardId);
+ if (shard.TabletType == type && shard.TabletID != InvalidTabletId) {
+ tablets.push_back(shard.TabletID);
+ }
+ }
+ return tablets;
+ }
+};
+
+struct TBlockStorePartitionInfo : public TSimpleRefCount<TBlockStorePartitionInfo> {
+ using TPtr = TIntrusivePtr<TBlockStorePartitionInfo>;
+
+ ui32 PartitionId = 0;
+ ui64 AlterVersion = 0;
+};
+
+struct TBlockStoreVolumeInfo : public TSimpleRefCount<TBlockStoreVolumeInfo> {
+ using TPtr = TIntrusivePtr<TBlockStoreVolumeInfo>;
+
+ struct TTabletCache {
+ ui64 AlterVersion = 0;
+ TVector<TTabletId> Tablets;
+ };
+
static constexpr size_t NumVolumeTabletChannels = 3;
ui32 DefaultPartitionCount = 0;
- NKikimrBlockStore::TVolumeConfig VolumeConfig;
- ui64 AlterVersion = 0;
+ NKikimrBlockStore::TVolumeConfig VolumeConfig;
+ ui64 AlterVersion = 0;
ui64 TokenVersion = 0;
- THashMap<TShardIdx, TBlockStorePartitionInfo::TPtr> Shards; // key ShardIdx
- TBlockStoreVolumeInfo::TPtr AlterData;
- TTabletId VolumeTabletId = InvalidTabletId;
- TShardIdx VolumeShardIdx = InvalidShardIdx;
- TString MountToken;
- TTabletCache TabletCache;
+ THashMap<TShardIdx, TBlockStorePartitionInfo::TPtr> Shards; // key ShardIdx
+ TBlockStoreVolumeInfo::TPtr AlterData;
+ TTabletId VolumeTabletId = InvalidTabletId;
+ TShardIdx VolumeShardIdx = InvalidShardIdx;
+ TString MountToken;
+ TTabletCache TabletCache;
ui32 ExplicitChannelProfileCount = 0;
-
+
static ui32 CalculateDefaultPartitionCount(
const NKikimrBlockStore::TVolumeConfig& config)
{
@@ -1869,83 +1869,83 @@ struct TBlockStoreVolumeInfo : public TSimpleRefCount<TBlockStoreVolumeInfo> {
return c;
}
- bool HasVolumeTablet() const { return VolumeTabletId != InvalidTabletId; }
-
- void PrepareAlter(TBlockStoreVolumeInfo::TPtr alterData) {
- Y_VERIFY(alterData, "No alter data at Alter preparation");
+ bool HasVolumeTablet() const { return VolumeTabletId != InvalidTabletId; }
+
+ void PrepareAlter(TBlockStoreVolumeInfo::TPtr alterData) {
+ Y_VERIFY(alterData, "No alter data at Alter preparation");
if (!alterData->DefaultPartitionCount) {
alterData->DefaultPartitionCount =
CalculateDefaultPartitionCount(alterData->VolumeConfig);
- }
- alterData->VolumeTabletId = VolumeTabletId;
- alterData->VolumeShardIdx = VolumeShardIdx;
- alterData->AlterVersion = AlterVersion + 1;
- AlterData = alterData;
- }
-
- void ForgetAlter() {
- Y_VERIFY(AlterData, "No alter data at Alter rollback");
- AlterData.Reset();
- }
-
- void FinishAlter() {
- Y_VERIFY(AlterData, "No alter data at Alter completion");
+ }
+ alterData->VolumeTabletId = VolumeTabletId;
+ alterData->VolumeShardIdx = VolumeShardIdx;
+ alterData->AlterVersion = AlterVersion + 1;
+ AlterData = alterData;
+ }
+
+ void ForgetAlter() {
+ Y_VERIFY(AlterData, "No alter data at Alter rollback");
+ AlterData.Reset();
+ }
+
+ void FinishAlter() {
+ Y_VERIFY(AlterData, "No alter data at Alter completion");
DefaultPartitionCount = AlterData->DefaultPartitionCount;
ExplicitChannelProfileCount = AlterData->ExplicitChannelProfileCount;
- VolumeConfig.CopyFrom(AlterData->VolumeConfig);
- ++AlterVersion;
- Y_VERIFY(AlterVersion == AlterData->AlterVersion);
- Y_VERIFY(VolumeTabletId == AlterData->VolumeTabletId || !HasVolumeTablet());
- Y_VERIFY(AlterData->HasVolumeTablet());
- Y_VERIFY(AlterData->VolumeShardIdx);
- VolumeTabletId = AlterData->VolumeTabletId;
- VolumeShardIdx = AlterData->VolumeShardIdx;
- AlterData.Reset();
- }
-
- const TVector<TTabletId>& GetTablets(const THashMap<TShardIdx, TShardInfo>& allShards) {
- if (TabletCache.AlterVersion == AlterVersion) {
- return TabletCache.Tablets;
- }
-
- TabletCache.Tablets.clear();
+ VolumeConfig.CopyFrom(AlterData->VolumeConfig);
+ ++AlterVersion;
+ Y_VERIFY(AlterVersion == AlterData->AlterVersion);
+ Y_VERIFY(VolumeTabletId == AlterData->VolumeTabletId || !HasVolumeTablet());
+ Y_VERIFY(AlterData->HasVolumeTablet());
+ Y_VERIFY(AlterData->VolumeShardIdx);
+ VolumeTabletId = AlterData->VolumeTabletId;
+ VolumeShardIdx = AlterData->VolumeShardIdx;
+ AlterData.Reset();
+ }
+
+ const TVector<TTabletId>& GetTablets(const THashMap<TShardIdx, TShardInfo>& allShards) {
+ if (TabletCache.AlterVersion == AlterVersion) {
+ return TabletCache.Tablets;
+ }
+
+ TabletCache.Tablets.clear();
TabletCache.Tablets.resize(DefaultPartitionCount);
-
- for (const auto& kv : Shards) {
- TShardIdx shardIdx = kv.first;
- const auto& partInfo = *kv.second;
-
- auto itShard = allShards.find(shardIdx);
- Y_VERIFY_S(itShard != allShards.end(), "No shard with shardIdx " << shardIdx);
- TTabletId tabletId = itShard->second.TabletID;
-
- if (partInfo.AlterVersion <= AlterVersion) {
+
+ for (const auto& kv : Shards) {
+ TShardIdx shardIdx = kv.first;
+ const auto& partInfo = *kv.second;
+
+ auto itShard = allShards.find(shardIdx);
+ Y_VERIFY_S(itShard != allShards.end(), "No shard with shardIdx " << shardIdx);
+ TTabletId tabletId = itShard->second.TabletID;
+
+ if (partInfo.AlterVersion <= AlterVersion) {
Y_VERIFY(partInfo.PartitionId < DefaultPartitionCount,
- "Wrong PartitionId %" PRIu32, partInfo.PartitionId);
- TabletCache.Tablets[partInfo.PartitionId] = tabletId;
- }
- }
-
- // Verify there are no missing tabletIds
- for (ui32 idx = 0; idx < TabletCache.Tablets.size(); ++idx) {
- TTabletId tabletId = TabletCache.Tablets[idx];
- Y_VERIFY_S(tabletId, "Unassigned tabletId"
- << " for partition " << idx
- << " out of " << TabletCache.Tablets.size()
- << " TabletCache.AlterVersion" << TabletCache.AlterVersion
- << " AlterVersion " << AlterVersion);
- }
-
- TabletCache.AlterVersion = AlterVersion;
- return TabletCache.Tablets;
- }
-
+ "Wrong PartitionId %" PRIu32, partInfo.PartitionId);
+ TabletCache.Tablets[partInfo.PartitionId] = tabletId;
+ }
+ }
+
+ // Verify there are no missing tabletIds
+ for (ui32 idx = 0; idx < TabletCache.Tablets.size(); ++idx) {
+ TTabletId tabletId = TabletCache.Tablets[idx];
+ Y_VERIFY_S(tabletId, "Unassigned tabletId"
+ << " for partition " << idx
+ << " out of " << TabletCache.Tablets.size()
+ << " TabletCache.AlterVersion" << TabletCache.AlterVersion
+ << " AlterVersion " << AlterVersion);
+ }
+
+ TabletCache.AlterVersion = AlterVersion;
+ return TabletCache.Tablets;
+ }
+
TVolumeSpace GetVolumeSpace() const {
- ui64 blockSize = VolumeConfig.GetBlockSize();
+ ui64 blockSize = VolumeConfig.GetBlockSize();
ui64 blockCount = 0;
for (const auto& partition: VolumeConfig.GetPartitions()) {
blockCount += partition.GetBlockCount();
- }
+ }
TVolumeSpace space;
space.Raw += blockCount * blockSize;
@@ -1971,19 +1971,19 @@ struct TBlockStoreVolumeInfo : public TSimpleRefCount<TBlockStoreVolumeInfo> {
break;
}
- if (AlterData) {
+ if (AlterData) {
auto altSpace = AlterData->GetVolumeSpace();
space.Raw = Max(space.Raw, altSpace.Raw);
space.SSD = Max(space.SSD, altSpace.SSD);
space.HDD = Max(space.HDD, altSpace.HDD);
space.SSDNonrepl = Max(space.SSDNonrepl, altSpace.SSDNonrepl);
space.SSDSystem = Max(space.SSDSystem, altSpace.SSDSystem);
- }
+ }
+
+ return space;
+ }
+};
- return space;
- }
-};
-
struct TFileStoreInfo : public TSimpleRefCount<TFileStoreInfo> {
using TPtr = TIntrusivePtr<TFileStoreInfo>;
@@ -2022,87 +2022,87 @@ struct TFileStoreInfo : public TSimpleRefCount<TFileStoreInfo> {
}
};
-struct TKesusInfo : public TSimpleRefCount<TKesusInfo> {
- using TPtr = TIntrusivePtr<TKesusInfo>;
-
- TShardIdx KesusShardIdx = InvalidShardIdx;
- TTabletId KesusTabletId = InvalidTabletId;
- Ydb::Coordination::Config Config;
- ui64 Version = 0;
- THolder<Ydb::Coordination::Config> AlterConfig;
- ui64 AlterVersion = 0;
-
- void FinishAlter() {
- Y_VERIFY(AlterConfig, "No alter config at Alter completion");
- Y_VERIFY(AlterVersion, "No alter version at Alter completion");
- Config.CopyFrom(*AlterConfig);
- ++Version;
- Y_VERIFY(Version == AlterVersion);
- AlterConfig.Reset();
- AlterVersion = 0;
- }
-};
-
-struct TTableIndexInfo : public TSimpleRefCount<TTableIndexInfo> {
- using TPtr = TIntrusivePtr<TTableIndexInfo>;
- using EType = NKikimrSchemeOp::EIndexType;
- using EState = NKikimrSchemeOp::EIndexState;
-
- TTableIndexInfo(ui64 version, EType type, EState state)
- : AlterVersion(version)
- , Type(type)
- , State(state)
- {}
-
- TTableIndexInfo(const TTableIndexInfo&) = default;
-
- TPtr CreateNextVersion() {
- this->AlterData = this->GetNextVersion();
- return this->AlterData;
- }
-
- TPtr GetNextVersion() const {
- Y_VERIFY(AlterData == nullptr);
- TPtr result = new TTableIndexInfo(*this);
- ++result->AlterVersion;
- return result;
- }
-
- static TPtr NotExistedYet(EType type) {
- return new TTableIndexInfo(0, type, EState::EIndexStateInvalid);
- }
-
- static TPtr Create(const NKikimrSchemeOp::TIndexCreationConfig& config, TString& errMsg) {
- if (!config.KeyColumnNamesSize()) {
- errMsg += TStringBuilder() << "no key colums in index creation config";
- return nullptr;
- }
-
- TPtr result = NotExistedYet(config.GetType());
-
- TPtr alterData = result->CreateNextVersion();
- alterData->IndexKeys.assign(config.GetKeyColumnNames().begin(), config.GetKeyColumnNames().end());
- Y_VERIFY(alterData->IndexKeys.size());
+struct TKesusInfo : public TSimpleRefCount<TKesusInfo> {
+ using TPtr = TIntrusivePtr<TKesusInfo>;
+
+ TShardIdx KesusShardIdx = InvalidShardIdx;
+ TTabletId KesusTabletId = InvalidTabletId;
+ Ydb::Coordination::Config Config;
+ ui64 Version = 0;
+ THolder<Ydb::Coordination::Config> AlterConfig;
+ ui64 AlterVersion = 0;
+
+ void FinishAlter() {
+ Y_VERIFY(AlterConfig, "No alter config at Alter completion");
+ Y_VERIFY(AlterVersion, "No alter version at Alter completion");
+ Config.CopyFrom(*AlterConfig);
+ ++Version;
+ Y_VERIFY(Version == AlterVersion);
+ AlterConfig.Reset();
+ AlterVersion = 0;
+ }
+};
+
+struct TTableIndexInfo : public TSimpleRefCount<TTableIndexInfo> {
+ using TPtr = TIntrusivePtr<TTableIndexInfo>;
+ using EType = NKikimrSchemeOp::EIndexType;
+ using EState = NKikimrSchemeOp::EIndexState;
+
+ TTableIndexInfo(ui64 version, EType type, EState state)
+ : AlterVersion(version)
+ , Type(type)
+ , State(state)
+ {}
+
+ TTableIndexInfo(const TTableIndexInfo&) = default;
+
+ TPtr CreateNextVersion() {
+ this->AlterData = this->GetNextVersion();
+ return this->AlterData;
+ }
+
+ TPtr GetNextVersion() const {
+ Y_VERIFY(AlterData == nullptr);
+ TPtr result = new TTableIndexInfo(*this);
+ ++result->AlterVersion;
+ return result;
+ }
+
+ static TPtr NotExistedYet(EType type) {
+ return new TTableIndexInfo(0, type, EState::EIndexStateInvalid);
+ }
+
+ static TPtr Create(const NKikimrSchemeOp::TIndexCreationConfig& config, TString& errMsg) {
+ if (!config.KeyColumnNamesSize()) {
+ errMsg += TStringBuilder() << "no key colums in index creation config";
+ return nullptr;
+ }
+
+ TPtr result = NotExistedYet(config.GetType());
+
+ TPtr alterData = result->CreateNextVersion();
+ alterData->IndexKeys.assign(config.GetKeyColumnNames().begin(), config.GetKeyColumnNames().end());
+ Y_VERIFY(alterData->IndexKeys.size());
alterData->IndexDataColumns.assign(config.GetDataColumnNames().begin(), config.GetDataColumnNames().end());
alterData->State = config.HasState() ? config.GetState() : EState::EIndexStateReady;
-
- return result;
- }
-
- ui64 AlterVersion = 1;
- EType Type;
- EState State;
-
- TVector<TString> IndexKeys;
+
+ return result;
+ }
+
+ ui64 AlterVersion = 1;
+ EType Type;
+ EState State;
+
+ TVector<TString> IndexKeys;
TVector<TString> IndexDataColumns;
-
- TTableIndexInfo::TPtr AlterData = nullptr;
-};
-
+
+ TTableIndexInfo::TPtr AlterData = nullptr;
+};
+
struct TCdcStreamInfo : public TSimpleRefCount<TCdcStreamInfo> {
using TPtr = TIntrusivePtr<TCdcStreamInfo>;
- using EMode = NKikimrSchemeOp::ECdcStreamMode;
- using EState = NKikimrSchemeOp::ECdcStreamState;
+ using EMode = NKikimrSchemeOp::ECdcStreamMode;
+ using EState = NKikimrSchemeOp::ECdcStreamState;
TCdcStreamInfo(ui64 version, EMode mode, EState state)
: AlterVersion(version)
@@ -2124,7 +2124,7 @@ struct TCdcStreamInfo : public TSimpleRefCount<TCdcStreamInfo> {
return new TCdcStreamInfo(0, mode, EState::ECdcStreamStateInvalid);
}
- static TPtr Create(const NKikimrSchemeOp::TCdcStreamDescription& desc) {
+ static TPtr Create(const NKikimrSchemeOp::TCdcStreamDescription& desc) {
TPtr result = New(desc.GetMode());
TPtr alterData = result->CreateNextVersion();
alterData->State = EState::ECdcStreamStateReady;
@@ -2148,8 +2148,8 @@ struct TSequenceInfo : public TSimpleRefCount<TSequenceInfo> {
TSequenceInfo(
ui64 alterVersion,
- NKikimrSchemeOp::TSequenceDescription&& description,
- NKikimrSchemeOp::TSequenceSharding&& sharding);
+ NKikimrSchemeOp::TSequenceDescription&& description,
+ NKikimrSchemeOp::TSequenceSharding&& sharding);
TPtr CreateNextVersion() {
Y_VERIFY(AlterData == nullptr);
@@ -2159,12 +2159,12 @@ struct TSequenceInfo : public TSimpleRefCount<TSequenceInfo> {
return result;
}
- static bool ValidateCreate(const NKikimrSchemeOp::TSequenceDescription& p, TString& err);
+ static bool ValidateCreate(const NKikimrSchemeOp::TSequenceDescription& p, TString& err);
ui64 AlterVersion = 0;
TSequenceInfo::TPtr AlterData = nullptr;
- NKikimrSchemeOp::TSequenceDescription Description;
- NKikimrSchemeOp::TSequenceSharding Sharding;
+ NKikimrSchemeOp::TSequenceDescription Description;
+ NKikimrSchemeOp::TSequenceSharding Sharding;
ui64 SequenceShard = 0;
};
@@ -2347,7 +2347,7 @@ struct TExportInfo: public TSimpleRefCount<TExportInfo> {
bool AllItemsAreDropped() const;
void AddNotifySubscriber(const TActorId& actorId);
-
+
TString ToString() const;
private:
@@ -2452,183 +2452,183 @@ struct TImportInfo: public TSimpleRefCount<TImportInfo> {
}; // TImportInfo
// } // NImport
-class TBillingStats {
-public:
- TBillingStats() = default;
- TBillingStats(ui64 rows, ui64 bytes);
- TBillingStats(const TBillingStats& other);
-
- TBillingStats& operator = (const TBillingStats& other);
-
- TBillingStats operator - (const TBillingStats& other) const;
- TBillingStats& operator -= (const TBillingStats& other);
-
- TBillingStats operator + (const TBillingStats& other) const;
- TBillingStats& operator += (const TBillingStats& other);
-
- bool operator < (const TBillingStats& other) const;
- bool operator <= (const TBillingStats& other) const;
- bool operator == (const TBillingStats& other) const;
-
- operator bool () const;
-
- TString ToString() const;
-
- ui64 GetRows() const;
- ui64 GetBytes() const;
-
-private:
- ui64 Rows = 0;
- ui64 Bytes = 0;
-};
-
-struct TIndexBuildInfo: public TSimpleRefCount<TIndexBuildInfo> {
- using TPtr = TIntrusivePtr<TIndexBuildInfo>;
-
- struct TLimits {
- ui32 MaxBatchRows = 100;
- ui32 MaxBatchBytes = 1 << 20;
- ui32 MaxShards = 100;
- ui32 MaxRetries = 50;
- };
- TLimits Limits;
-
- enum class EState: ui32 {
- Invalid = 0,
- Locking = 10,
- GatheringStatistics = 20,
- Initiating = 30,
- Filling = 40,
- Applying = 50,
- Unlocking = 60,
- Done = 200,
-
- Cancellation_Applying = 350,
- Cancellation_Unlocking = 360,
- Cancelled = 400,
-
- Rejection_Applying = 500,
- Rejection_Unlocking = 510,
- Rejected = 550
- };
-
+class TBillingStats {
+public:
+ TBillingStats() = default;
+ TBillingStats(ui64 rows, ui64 bytes);
+ TBillingStats(const TBillingStats& other);
+
+ TBillingStats& operator = (const TBillingStats& other);
+
+ TBillingStats operator - (const TBillingStats& other) const;
+ TBillingStats& operator -= (const TBillingStats& other);
+
+ TBillingStats operator + (const TBillingStats& other) const;
+ TBillingStats& operator += (const TBillingStats& other);
+
+ bool operator < (const TBillingStats& other) const;
+ bool operator <= (const TBillingStats& other) const;
+ bool operator == (const TBillingStats& other) const;
+
+ operator bool () const;
+
+ TString ToString() const;
+
+ ui64 GetRows() const;
+ ui64 GetBytes() const;
+
+private:
+ ui64 Rows = 0;
+ ui64 Bytes = 0;
+};
+
+struct TIndexBuildInfo: public TSimpleRefCount<TIndexBuildInfo> {
+ using TPtr = TIntrusivePtr<TIndexBuildInfo>;
+
+ struct TLimits {
+ ui32 MaxBatchRows = 100;
+ ui32 MaxBatchBytes = 1 << 20;
+ ui32 MaxShards = 100;
+ ui32 MaxRetries = 50;
+ };
+ TLimits Limits;
+
+ enum class EState: ui32 {
+ Invalid = 0,
+ Locking = 10,
+ GatheringStatistics = 20,
+ Initiating = 30,
+ Filling = 40,
+ Applying = 50,
+ Unlocking = 60,
+ Done = 200,
+
+ Cancellation_Applying = 350,
+ Cancellation_Unlocking = 360,
+ Cancelled = 400,
+
+ Rejection_Applying = 500,
+ Rejection_Unlocking = 510,
+ Rejected = 550
+ };
+
TActorId CreateSender;
- ui64 SenderCookie = 0;
-
- TIndexBuildId Id;
- TString Uid;
-
- TPathId DomainPathId;
- TPathId TablePathId;
- NKikimrSchemeOp::EIndexType IndexType = NKikimrSchemeOp::EIndexTypeInvalid;
-
- TString IndexName;
- TVector<TString> IndexColumns;
+ ui64 SenderCookie = 0;
+
+ TIndexBuildId Id;
+ TString Uid;
+
+ TPathId DomainPathId;
+ TPathId TablePathId;
+ NKikimrSchemeOp::EIndexType IndexType = NKikimrSchemeOp::EIndexTypeInvalid;
+
+ TString IndexName;
+ TVector<TString> IndexColumns;
TVector<TString> DataColumns;
-
- TString ImplTablePath;
- NTableIndex::TTableColumns ImplTableColumns;
-
- EState State = EState::Invalid;
- TString Issue;
-
+
+ TString ImplTablePath;
+ NTableIndex::TTableColumns ImplTableColumns;
+
+ EState State = EState::Invalid;
+ TString Issue;
+
TSet<TActorId> Subscribers;
-
- bool CancelRequested = false;
-
- TTxId LockTxId = TTxId();
- NKikimrScheme::EStatus LockTxStatus = NKikimrScheme::StatusSuccess;
- bool LockTxDone = false;
-
- TTxId InitiateTxId = TTxId();
- NKikimrScheme::EStatus InitiateTxStatus = NKikimrScheme::StatusSuccess;
- bool InitiateTxDone = false;
-
- TStepId SnapshotStep;
- TTxId SnapshotTxId;
-
- TTxId ApplyTxId = TTxId();
- NKikimrScheme::EStatus ApplyTxStatus = NKikimrScheme::StatusSuccess;
- bool ApplyTxDone = false;
-
- TTxId UnlockTxId = TTxId();
- NKikimrScheme::EStatus UnlockTxStatus = NKikimrScheme::StatusSuccess;
- bool UnlockTxDone = false;
-
- bool BillingEventIsScheduled = false;
- TDuration ReBillPeriod = TDuration::Seconds(10);
-
- struct TShardStatus {
- TSerializedTableRange Range;
- TString LastKeyAck;
- ui64 SeqNoRound = 0;
-
- NKikimrTxDataShard::TEvBuildIndexProgressResponse::EStatus Status = NKikimrTxDataShard::TEvBuildIndexProgressResponse::INVALID;
-
- Ydb::StatusIds::StatusCode UploadStatus = Ydb::StatusIds::STATUS_CODE_UNSPECIFIED;
- TString DebugMessage;
-
- TBillingStats Processed;
- TBillingStats Billed;
-
- TShardStatus();
-
- TString ToString(TShardIdx shardIdx = InvalidShardIdx) const {
- TStringBuilder result;
-
- result << "TShardStatus {";
-
- if (shardIdx) {
- result << " ShardIdx: " << shardIdx;
- }
- result << " Status: " << NKikimrTxDataShard::TEvBuildIndexProgressResponse::EStatus_Name(Status);
- result << " UploadStatus: " << Ydb::StatusIds::StatusCode_Name(UploadStatus);
- result << " DebugMessage: " << DebugMessage;
- result << " SeqNoRound: " << SeqNoRound;
- result << " Processed: " << Processed.ToString();
- result << " Billed: " << Billed.ToString();
-
- result << " }";
-
- return result;
- }
- };
- TMap<TShardIdx, TShardStatus> Shards;
-
- TDeque<TShardIdx> ToUploadShards;
-
- THashSet<TShardIdx> DoneShards;
- THashSet<TShardIdx> InProgressShards;
-
- TBillingStats Processed;
- TBillingStats Billed;
-
-
- TIndexBuildInfo(TIndexBuildId id, TString uid)
- : Id(id)
- , Uid(uid)
- {}
-
- bool IsCancellationRequested() const {
- return CancelRequested;
- }
-
- bool IsDone() const {
- return State == EState::Done;
- }
-
- bool IsCancelled() const {
- return State == EState::Cancelled || State == EState::Rejected;
- }
-
- bool IsFinished() const {
- return IsDone() || IsCancelled();
- }
-
+
+ bool CancelRequested = false;
+
+ TTxId LockTxId = TTxId();
+ NKikimrScheme::EStatus LockTxStatus = NKikimrScheme::StatusSuccess;
+ bool LockTxDone = false;
+
+ TTxId InitiateTxId = TTxId();
+ NKikimrScheme::EStatus InitiateTxStatus = NKikimrScheme::StatusSuccess;
+ bool InitiateTxDone = false;
+
+ TStepId SnapshotStep;
+ TTxId SnapshotTxId;
+
+ TTxId ApplyTxId = TTxId();
+ NKikimrScheme::EStatus ApplyTxStatus = NKikimrScheme::StatusSuccess;
+ bool ApplyTxDone = false;
+
+ TTxId UnlockTxId = TTxId();
+ NKikimrScheme::EStatus UnlockTxStatus = NKikimrScheme::StatusSuccess;
+ bool UnlockTxDone = false;
+
+ bool BillingEventIsScheduled = false;
+ TDuration ReBillPeriod = TDuration::Seconds(10);
+
+ struct TShardStatus {
+ TSerializedTableRange Range;
+ TString LastKeyAck;
+ ui64 SeqNoRound = 0;
+
+ NKikimrTxDataShard::TEvBuildIndexProgressResponse::EStatus Status = NKikimrTxDataShard::TEvBuildIndexProgressResponse::INVALID;
+
+ Ydb::StatusIds::StatusCode UploadStatus = Ydb::StatusIds::STATUS_CODE_UNSPECIFIED;
+ TString DebugMessage;
+
+ TBillingStats Processed;
+ TBillingStats Billed;
+
+ TShardStatus();
+
+ TString ToString(TShardIdx shardIdx = InvalidShardIdx) const {
+ TStringBuilder result;
+
+ result << "TShardStatus {";
+
+ if (shardIdx) {
+ result << " ShardIdx: " << shardIdx;
+ }
+ result << " Status: " << NKikimrTxDataShard::TEvBuildIndexProgressResponse::EStatus_Name(Status);
+ result << " UploadStatus: " << Ydb::StatusIds::StatusCode_Name(UploadStatus);
+ result << " DebugMessage: " << DebugMessage;
+ result << " SeqNoRound: " << SeqNoRound;
+ result << " Processed: " << Processed.ToString();
+ result << " Billed: " << Billed.ToString();
+
+ result << " }";
+
+ return result;
+ }
+ };
+ TMap<TShardIdx, TShardStatus> Shards;
+
+ TDeque<TShardIdx> ToUploadShards;
+
+ THashSet<TShardIdx> DoneShards;
+ THashSet<TShardIdx> InProgressShards;
+
+ TBillingStats Processed;
+ TBillingStats Billed;
+
+
+ TIndexBuildInfo(TIndexBuildId id, TString uid)
+ : Id(id)
+ , Uid(uid)
+ {}
+
+ bool IsCancellationRequested() const {
+ return CancelRequested;
+ }
+
+ bool IsDone() const {
+ return State == EState::Done;
+ }
+
+ bool IsCancelled() const {
+ return State == EState::Cancelled || State == EState::Rejected;
+ }
+
+ bool IsFinished() const {
+ return IsDone() || IsCancelled();
+ }
+
void AddNotifySubscriber(const TActorId& actorID) {
- Y_VERIFY(!IsFinished());
- Subscribers.insert(actorID);
- }
+ Y_VERIFY(!IsFinished());
+ Subscribers.insert(actorID);
+ }
float CalcProgressPercent() const {
if (Shards) {
@@ -2638,8 +2638,8 @@ struct TIndexBuildInfo: public TSimpleRefCount<TIndexBuildInfo> {
// No shards - no progress
return 0.0;
}
-};
-
+};
+
bool ValidateTtlSettings(const NKikimrSchemeOp::TTTLSettings& ttl,
const THashMap<ui32, TTableInfo::TColumn>& sourceColumns,
const THashMap<ui32, TTableInfo::TColumn>& alterColumns,
@@ -2655,77 +2655,77 @@ bool ValidateTtlSettingsChange(
const NKikimrSchemeOp::TColumnDataLifeCycle& ttl,
TString& errStr);
-}
-}
+}
+}
+
+template <>
+inline void Out<NKikimr::NSchemeShard::TIndexBuildInfo::TShardStatus>
+ (IOutputStream& o, const NKikimr::NSchemeShard::TIndexBuildInfo::TShardStatus& info)
+{
+ o << info.ToString();
+}
+
+template <>
+inline void Out<NKikimr::NSchemeShard::TBillingStats>
+ (IOutputStream& o, const NKikimr::NSchemeShard::TBillingStats& stats)
+{
+ o << stats.ToString();
+}
template <>
-inline void Out<NKikimr::NSchemeShard::TIndexBuildInfo::TShardStatus>
- (IOutputStream& o, const NKikimr::NSchemeShard::TIndexBuildInfo::TShardStatus& info)
-{
- o << info.ToString();
-}
-
-template <>
-inline void Out<NKikimr::NSchemeShard::TBillingStats>
- (IOutputStream& o, const NKikimr::NSchemeShard::TBillingStats& stats)
-{
- o << stats.ToString();
-}
-
-template <>
-inline void Out<NKikimr::NSchemeShard::TIndexBuildInfo>
- (IOutputStream& o, const NKikimr::NSchemeShard::TIndexBuildInfo& info)
-{
-
- o << "TBuildInfo{";
- o << " IndexBuildId: " << info.Id;
- o << ", Uid: " << info.Uid;
- o << ", DomainPathId: " << info.DomainPathId;
- o << ", TablePathId: " << info.TablePathId;
- o << ", IndexType: " << NKikimrSchemeOp::EIndexType_Name(info.IndexType);
- o << ", IndexName: " << info.IndexName;
- for (const auto& x: info.IndexColumns) {
- o << ", IndexColumn: " << x;
- }
+inline void Out<NKikimr::NSchemeShard::TIndexBuildInfo>
+ (IOutputStream& o, const NKikimr::NSchemeShard::TIndexBuildInfo& info)
+{
+
+ o << "TBuildInfo{";
+ o << " IndexBuildId: " << info.Id;
+ o << ", Uid: " << info.Uid;
+ o << ", DomainPathId: " << info.DomainPathId;
+ o << ", TablePathId: " << info.TablePathId;
+ o << ", IndexType: " << NKikimrSchemeOp::EIndexType_Name(info.IndexType);
+ o << ", IndexName: " << info.IndexName;
+ for (const auto& x: info.IndexColumns) {
+ o << ", IndexColumn: " << x;
+ }
for (const auto& x: info.DataColumns) {
o << ", DataColumns: " << x;
}
-
- o << ", State: " << info.State;
- o << ", IsCancellationRequested: " << info.CancelRequested;
-
- o << ", Issue: " << info.Issue;
- o << ", SubscribersCount: " << info.Subscribers.size();
-
- o << ", CreateSender: " << info.CreateSender.ToString();
-
- o << ", LockTxId: " << info.LockTxId;
- o << ", LockTxStatus: " << NKikimrScheme::EStatus_Name(info.LockTxStatus);
- o << ", LockTxDone: " << info.LockTxDone;
-
- o << ", InitiateTxId: " << info.InitiateTxId;
- o << ", InitiateTxStatus: " << NKikimrScheme::EStatus_Name(info.InitiateTxStatus);
- o << ", InitiateTxDone: " << info.InitiateTxDone;
-
- o << ", SnapshotStepId: " << info.SnapshotStep;
-
- o << ", ApplyTxId: " << info.ApplyTxId;
- o << ", ApplyTxStatus: " << NKikimrScheme::EStatus_Name(info.ApplyTxStatus);
- o << ", ApplyTxDone: " << info.ApplyTxDone;
-
- o << ", UnlockTxId: " << info.UnlockTxId;
- o << ", UnlockTxStatus: " << NKikimrScheme::EStatus_Name(info.UnlockTxStatus);
- o << ", UnlockTxDone: " << info.UnlockTxDone;
-
- o << ", ToUploadShards: " << info.ToUploadShards.size();
- o << ", DoneShards: " << info.DoneShards.size();
-
- for (const auto& x: info.InProgressShards) {
- o << ", ShardsInProgress: " << x;
- }
-
- o << ", Processed: " << info.Processed;
- o << ", Billed: " << info.Billed;
-
- o << "}";
-}
+
+ o << ", State: " << info.State;
+ o << ", IsCancellationRequested: " << info.CancelRequested;
+
+ o << ", Issue: " << info.Issue;
+ o << ", SubscribersCount: " << info.Subscribers.size();
+
+ o << ", CreateSender: " << info.CreateSender.ToString();
+
+ o << ", LockTxId: " << info.LockTxId;
+ o << ", LockTxStatus: " << NKikimrScheme::EStatus_Name(info.LockTxStatus);
+ o << ", LockTxDone: " << info.LockTxDone;
+
+ o << ", InitiateTxId: " << info.InitiateTxId;
+ o << ", InitiateTxStatus: " << NKikimrScheme::EStatus_Name(info.InitiateTxStatus);
+ o << ", InitiateTxDone: " << info.InitiateTxDone;
+
+ o << ", SnapshotStepId: " << info.SnapshotStep;
+
+ o << ", ApplyTxId: " << info.ApplyTxId;
+ o << ", ApplyTxStatus: " << NKikimrScheme::EStatus_Name(info.ApplyTxStatus);
+ o << ", ApplyTxDone: " << info.ApplyTxDone;
+
+ o << ", UnlockTxId: " << info.UnlockTxId;
+ o << ", UnlockTxStatus: " << NKikimrScheme::EStatus_Name(info.UnlockTxStatus);
+ o << ", UnlockTxDone: " << info.UnlockTxDone;
+
+ o << ", ToUploadShards: " << info.ToUploadShards.size();
+ o << ", DoneShards: " << info.DoneShards.size();
+
+ for (const auto& x: info.InProgressShards) {
+ o << ", ShardsInProgress: " << x;
+ }
+
+ o << ", Processed: " << info.Processed;
+ o << ", Billed: " << info.Billed;
+
+ o << "}";
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard_path.cpp b/ydb/core/tx/schemeshard/schemeshard_path.cpp
index eb320e07a01..7535ee673c8 100644
--- a/ydb/core/tx/schemeshard/schemeshard_path.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_path.cpp
@@ -1,268 +1,268 @@
-#include "schemeshard_path.h"
-#include "schemeshard_impl.h"
-
+#include "schemeshard_path.h"
+#include "schemeshard_impl.h"
+
#include <ydb/core/base/path.h>
-
+
#include <ydb/core/sys_view/common/path.h>
-namespace NKikimr {
-namespace NSchemeShard {
-
+namespace NKikimr {
+namespace NSchemeShard {
+
static constexpr ui64 MaxPQStorage = Max<ui64>() / 2;
-TPath::TChecker::TChecker(const TPath &path)
- : Path(path)
- , Failed(false)
- , Status(EStatus::StatusSuccess)
-{}
-
-NKikimr::NSchemeShard::TPath::TChecker::operator bool() const {
- return !Failed;
-}
-
-TPath::TChecker::EStatus TPath::TChecker::GetStatus(TString *explain) const {
- Y_VERIFY(Failed);
-
- if (explain) {
- if (!explain->empty()) {
- explain->append(": ");
- }
- explain->append(Explain);
- }
- return Status;
-}
-
-const TPath::TChecker& TPath::TChecker::IsResolved(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (Path.IsResolved()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- TPath nearestParent = Path.FirstResoledParent();
- Explain << "path hasn't been resolved"
- << ", nearest resolved path is: " << nearestParent.PathString()
- << ", with pathId: " << (nearestParent.IsResolved() ? nearestParent.Base()->PathId : InvalidPathId);
-
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::NotEmpty(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (!Path.IsEmpty()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path is empty";
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::NotRoot(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (!Path.Base()->IsRoot()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path is root";
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::NotResolved(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (!Path.IsResolved()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path has been resolved"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
- << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::NotUnderDeleting(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (!Path.IsUnderDeleting()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path is being deleted right now"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
- << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState)
- << ", msg for compatibility KIKIMR-6499 Another drop in progress";
- return *this;
-}
-
-const TPath::TChecker &TPath::TChecker::NotUnderDomainUpgrade(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (!Path.IsUnderDomainUpgrade()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path is being upgraded as part of subdomain right now"
- << ", domainId: " << Path.DomainId();
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::IsDeleted(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (Path.IsDeleted()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path hasn't been deleted yet"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
- << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::IsUnderDeleting(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (Path.IsUnderDeleting()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path isn't under deletion right now"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
- << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::IsUnderMoving(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (Path.IsUnderMoving()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path isn't under moving right now"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
- << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
- return *this;
-}
-
-
-const TPath::TChecker& TPath::TChecker::NotUnderOperation(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (!Path.IsUnderOperation()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path is under operation"
- << ", pathId: " << Path.Base()->PathId
- << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::IsUnderCreating(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (Path.IsUnderCreating()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path isn't under creating right now"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
- << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::IsUnderOperation(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (Path.IsUnderOperation()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path is not under operation at all"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
- << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::IsUnderTheSameOperation(TTxId txId, TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- TTxId activeTxId = Path.ActiveOperation();
- if (activeTxId == txId) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path is not under the same operation"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
- << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState)
- << ", active txId: " << activeTxId
- << ", expected txId: " << txId;
- return *this;
-}
-
+TPath::TChecker::TChecker(const TPath &path)
+ : Path(path)
+ , Failed(false)
+ , Status(EStatus::StatusSuccess)
+{}
+
+NKikimr::NSchemeShard::TPath::TChecker::operator bool() const {
+ return !Failed;
+}
+
+TPath::TChecker::EStatus TPath::TChecker::GetStatus(TString *explain) const {
+ Y_VERIFY(Failed);
+
+ if (explain) {
+ if (!explain->empty()) {
+ explain->append(": ");
+ }
+ explain->append(Explain);
+ }
+ return Status;
+}
+
+const TPath::TChecker& TPath::TChecker::IsResolved(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.IsResolved()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ TPath nearestParent = Path.FirstResoledParent();
+ Explain << "path hasn't been resolved"
+ << ", nearest resolved path is: " << nearestParent.PathString()
+ << ", with pathId: " << (nearestParent.IsResolved() ? nearestParent.Base()->PathId : InvalidPathId);
+
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::NotEmpty(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (!Path.IsEmpty()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path is empty";
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::NotRoot(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (!Path.Base()->IsRoot()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path is root";
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::NotResolved(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (!Path.IsResolved()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path has been resolved"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
+ << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::NotUnderDeleting(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (!Path.IsUnderDeleting()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path is being deleted right now"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
+ << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState)
+ << ", msg for compatibility KIKIMR-6499 Another drop in progress";
+ return *this;
+}
+
+const TPath::TChecker &TPath::TChecker::NotUnderDomainUpgrade(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (!Path.IsUnderDomainUpgrade()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path is being upgraded as part of subdomain right now"
+ << ", domainId: " << Path.DomainId();
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::IsDeleted(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.IsDeleted()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path hasn't been deleted yet"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
+ << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::IsUnderDeleting(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.IsUnderDeleting()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path isn't under deletion right now"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
+ << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::IsUnderMoving(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.IsUnderMoving()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path isn't under moving right now"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
+ << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
+ return *this;
+}
+
+
+const TPath::TChecker& TPath::TChecker::NotUnderOperation(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (!Path.IsUnderOperation()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path is under operation"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::IsUnderCreating(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.IsUnderCreating()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path isn't under creating right now"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
+ << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::IsUnderOperation(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.IsUnderOperation()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path is not under operation at all"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
+ << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::IsUnderTheSameOperation(TTxId txId, TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ TTxId activeTxId = Path.ActiveOperation();
+ if (activeTxId == txId) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path is not under the same operation"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
+ << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState)
+ << ", active txId: " << activeTxId
+ << ", expected txId: " << txId;
+ return *this;
+}
+
const TPath::TChecker& TPath::TChecker::NotUnderTheSameOperation(TTxId txId, TPath::TChecker::EStatus status) const {
if (Failed) {
return *this;
@@ -277,8 +277,8 @@ const TPath::TChecker& TPath::TChecker::NotUnderTheSameOperation(TTxId txId, TPa
Status = status;
Explain << "path is under the same operation"
<< ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
- << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState)
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
+ << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState)
<< ", txId: " << txId;
return *this;
}
@@ -328,7 +328,7 @@ const TPath::TChecker& TPath::TChecker::IsOlapStore(TPath::TChecker::EStatus sta
Status = status;
Explain << "path is not an olap store"
<< ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
return *this;
}
@@ -345,7 +345,7 @@ const TPath::TChecker& TPath::TChecker::IsOlapTable(TPath::TChecker::EStatus sta
Status = status;
Explain << "path is not an olap table"
<< ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
return *this;
}
@@ -362,7 +362,7 @@ const TPath::TChecker& TPath::TChecker::IsSequence(TPath::TChecker::EStatus stat
Status = status;
Explain << "path is not a sequence"
<< ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
return *this;
}
@@ -383,41 +383,41 @@ const TPath::TChecker& TPath::TChecker::IsReplication(TPath::TChecker::EStatus s
return *this;
}
-const TPath::TChecker& TPath::TChecker::IsCommonSensePath(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (Path.IsCommonSensePath()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path is not a simple path which goes through directories"
- << ", it might be a table index or private index table"
- << ", pathId " << Path.Base()->PathId;
-
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::IsInsideTableIndexPath(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (Path.IsInsideTableIndexPath()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path doesn't go through directories towards table index"
- << ", it might be a table index or private index table"
- << ", pathId " << Path.Base()->PathId;
- return *this;
-}
-
+const TPath::TChecker& TPath::TChecker::IsCommonSensePath(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.IsCommonSensePath()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path is not a simple path which goes through directories"
+ << ", it might be a table index or private index table"
+ << ", pathId " << Path.Base()->PathId;
+
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::IsInsideTableIndexPath(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.IsInsideTableIndexPath()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path doesn't go through directories towards table index"
+ << ", it might be a table index or private index table"
+ << ", pathId " << Path.Base()->PathId;
+ return *this;
+}
+
const TPath::TChecker& TPath::TChecker::IsInsideCdcStreamPath(TPath::TChecker::EStatus status) const {
if (Failed) {
return *this;
@@ -435,61 +435,61 @@ const TPath::TChecker& TPath::TChecker::IsInsideCdcStreamPath(TPath::TChecker::E
return *this;
}
-const TPath::TChecker& TPath::TChecker::IsTable(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (Path.Base()->IsTable()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path is not a table"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::NotBackupTable(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (!Path.Base()->IsTable()) {
- return *this;
- }
-
- if (!Path.IsBackupTable()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path is a backup table, scheme operation is limited with it"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::IsBlockStoreVolume(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (Path.Base()->IsBlockStoreVolume()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path is not a block store volume"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
- return *this;
-}
-
+const TPath::TChecker& TPath::TChecker::IsTable(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.Base()->IsTable()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path is not a table"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::NotBackupTable(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (!Path.Base()->IsTable()) {
+ return *this;
+ }
+
+ if (!Path.IsBackupTable()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path is a backup table, scheme operation is limited with it"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::IsBlockStoreVolume(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.Base()->IsBlockStoreVolume()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path is not a block store volume"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
+ return *this;
+}
+
const TPath::TChecker& TPath::TChecker::IsFileStore(TPath::TChecker::EStatus status) const {
if (Failed) {
return *this;
@@ -503,131 +503,131 @@ const TPath::TChecker& TPath::TChecker::IsFileStore(TPath::TChecker::EStatus sta
Status = status;
Explain << "path is not a FileStore"
<< ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::IsKesus(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.Base()->IsKesus()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path is not a kesus"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
return *this;
}
-const TPath::TChecker& TPath::TChecker::IsKesus(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (Path.Base()->IsKesus()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path is not a kesus"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
- return *this;
-}
-
const TPath::TChecker& TPath::TChecker::IsPQGroup(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (Path.Base()->IsPQGroup()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path is not a pq group"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::IsSubDomain(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (Path.Base()->IsSubDomainRoot()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path is not a sub domain"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::IsExternalSubDomain(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (Path.Base()->IsExternalSubDomainRoot()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path is not an external domain"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::IsAtLocalSchemeShard(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (Path.AtLocalSchemeShardPath()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- TPath nearestParent = Path.FirstResoledParent();
- Explain << "path is an external domain, the redirection is needed"
- << ", external domain is: " << nearestParent.PathString()
- << ", with pathId: " << (nearestParent.IsResolved() ? nearestParent.Base()->PathId : InvalidPathId);
-
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::IsSolomon(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (Path.Base()->IsSolomon()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path is not a solomon"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::IsTableIndex(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (Path.Base()->IsTableIndex()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path is not a table index"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
- return *this;
-}
-
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.Base()->IsPQGroup()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path is not a pq group"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::IsSubDomain(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.Base()->IsSubDomainRoot()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path is not a sub domain"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::IsExternalSubDomain(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.Base()->IsExternalSubDomainRoot()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path is not an external domain"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::IsAtLocalSchemeShard(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.AtLocalSchemeShardPath()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ TPath nearestParent = Path.FirstResoledParent();
+ Explain << "path is an external domain, the redirection is needed"
+ << ", external domain is: " << nearestParent.PathString()
+ << ", with pathId: " << (nearestParent.IsResolved() ? nearestParent.Base()->PathId : InvalidPathId);
+
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::IsSolomon(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.Base()->IsSolomon()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path is not a solomon"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::IsTableIndex(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.Base()->IsTableIndex()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path is not a table index"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
+ return *this;
+}
+
const TPath::TChecker& TPath::TChecker::IsCdcStream(TPath::TChecker::EStatus status) const {
if (Failed) {
return *this;
@@ -641,218 +641,218 @@ const TPath::TChecker& TPath::TChecker::IsCdcStream(TPath::TChecker::EStatus sta
Status = status;
Explain << "path is not a cdc stream"
<< ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
return *this;
}
-const TPath::TChecker& TPath::TChecker::IsLikeDirectory(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
+const TPath::TChecker& TPath::TChecker::IsLikeDirectory(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
if (Path.Base()->IsLikeDirectory()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path is not a directory"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::IsDirectory(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (Path.Base()->IsDirectory()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path is not a directory"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::IsTheSameDomain(const TPath &another, TPath::TChecker::EStatus status) const {
-
- if (Failed) {
- return *this;
- }
-
- if (Path.DomainId() == another.DomainId()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "only paths to single domain are allowed"
- << ", detected paths from different domains"
- << " for example one path: " << Path.PathString()
- << " another path: " << another.PathString();
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::FailOnExist(TSet<TPathElement::EPathType> expectedTypes, bool acceptAlreadyExist) const {
- if (Failed) {
- return *this;
- }
-
- if (!Path.IsResolved()) {
- return *this;
- }
-
- if (Path.IsDeleted()) {
- return *this;
- }
-
- Failed = true;
-
- if (!expectedTypes.contains(Path.Base()->PathType)) {
- Status = EStatus::StatusNameConflict;
- Explain << "unexpected path type for path"
- << ", expected type: ";
- for (auto& type: expectedTypes) {
- Explain << NKikimrSchemeOp::EPathType_Name(type) << ", ";
- }
- Explain << "pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
- << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
- return *this;
- }
-
- if (!Path.Base()->IsCreateFinished()) {
- Status = EStatus::StatusMultipleModifications;
- Explain << "Muliple modifications: path exist but creating right now"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
- << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
- return *this;
- }
-
- if (acceptAlreadyExist) {
- Status = EStatus::StatusAlreadyExists;
- Explain << "path exist, request accepts it"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
- << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
- return *this;
- }
-
- Status = EStatus::StatusSchemeError;
- Explain << "path exist, request doesn't accept it"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
- << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::FailOnExist(TPathElement::EPathType expectedType, bool acceptAlreadyExist) const {
- return FailOnExist(TSet<TPathElement::EPathType>{expectedType}, acceptAlreadyExist);
-}
-
-const TPath::TChecker& TPath::TChecker::IsValidLeafName(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (Path.IsValidLeafName(Explain)) {
- return *this;
- }
-
- Failed = true;
- Status = status;
-
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::DepthLimit(ui64 delta, TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- TSubDomainInfo::TPtr domainInfo = Path.DomainInfo();
- if (Path.Depth() + delta <= domainInfo->GetSchemeLimits().MaxDepth) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path depth has reached maximum value in the domain"
- << ", max path depth: " << domainInfo->GetSchemeLimits().MaxDepth
- << ", reached depth: " << Path.Depth()
- << ", aditional delta was: " << delta;
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::PathsLimit(ui64 delta, TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- TSubDomainInfo::TPtr domainInfo = Path.DomainInfo();
-
- if (!delta || domainInfo->GetPathsInside() + delta <= domainInfo->GetSchemeLimits().MaxPaths) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "paths count has reached maximum value in the domain"
- << ", paths limit for domain: " << domainInfo->GetSchemeLimits().MaxPaths
- << ", paths count inside domain: " << domainInfo->GetPathsInside()
- << ", intention to create new paths: " << delta;
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::DirChildrenLimit(ui64 delta, TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- TSubDomainInfo::TPtr domainInfo = Path.DomainInfo();
-
- auto parent = Path.Parent();
- ui64 aliveChildren = parent.Base()->GetAliveChildren();
-
- if (!delta || aliveChildren + delta <= domainInfo->GetSchemeLimits().MaxChildrenInDir) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "children count has reached maximum value in the dir"
- << ", children limit for domain dir: " << domainInfo->GetSchemeLimits().MaxChildrenInDir
- << ", children count inside dir: " << aliveChildren
- << ", intention to create new children: " << delta;
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::ShardsLimit(ui64 delta, TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- TSubDomainInfo::TPtr domainInfo = Path.DomainInfo();
-
- if (!delta || domainInfo->GetShardsInside() + delta <= domainInfo->GetSchemeLimits().MaxShards) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "shards count has reached maximum value in the domain"
- << ", shards limit for domain: " << domainInfo->GetSchemeLimits().MaxShards
- << ", shards count inside domain: " << domainInfo->GetShardsInside()
- << ", intention to create new shards: " << delta;
- return *this;
-}
-
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path is not a directory"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::IsDirectory(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.Base()->IsDirectory()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path is not a directory"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType);
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::IsTheSameDomain(const TPath &another, TPath::TChecker::EStatus status) const {
+
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.DomainId() == another.DomainId()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "only paths to single domain are allowed"
+ << ", detected paths from different domains"
+ << " for example one path: " << Path.PathString()
+ << " another path: " << another.PathString();
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::FailOnExist(TSet<TPathElement::EPathType> expectedTypes, bool acceptAlreadyExist) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (!Path.IsResolved()) {
+ return *this;
+ }
+
+ if (Path.IsDeleted()) {
+ return *this;
+ }
+
+ Failed = true;
+
+ if (!expectedTypes.contains(Path.Base()->PathType)) {
+ Status = EStatus::StatusNameConflict;
+ Explain << "unexpected path type for path"
+ << ", expected type: ";
+ for (auto& type: expectedTypes) {
+ Explain << NKikimrSchemeOp::EPathType_Name(type) << ", ";
+ }
+ Explain << "pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
+ << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
+ return *this;
+ }
+
+ if (!Path.Base()->IsCreateFinished()) {
+ Status = EStatus::StatusMultipleModifications;
+ Explain << "Muliple modifications: path exist but creating right now"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
+ << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
+ return *this;
+ }
+
+ if (acceptAlreadyExist) {
+ Status = EStatus::StatusAlreadyExists;
+ Explain << "path exist, request accepts it"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
+ << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
+ return *this;
+ }
+
+ Status = EStatus::StatusSchemeError;
+ Explain << "path exist, request doesn't accept it"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
+ << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::FailOnExist(TPathElement::EPathType expectedType, bool acceptAlreadyExist) const {
+ return FailOnExist(TSet<TPathElement::EPathType>{expectedType}, acceptAlreadyExist);
+}
+
+const TPath::TChecker& TPath::TChecker::IsValidLeafName(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ if (Path.IsValidLeafName(Explain)) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::DepthLimit(ui64 delta, TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ TSubDomainInfo::TPtr domainInfo = Path.DomainInfo();
+ if (Path.Depth() + delta <= domainInfo->GetSchemeLimits().MaxDepth) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path depth has reached maximum value in the domain"
+ << ", max path depth: " << domainInfo->GetSchemeLimits().MaxDepth
+ << ", reached depth: " << Path.Depth()
+ << ", aditional delta was: " << delta;
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::PathsLimit(ui64 delta, TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ TSubDomainInfo::TPtr domainInfo = Path.DomainInfo();
+
+ if (!delta || domainInfo->GetPathsInside() + delta <= domainInfo->GetSchemeLimits().MaxPaths) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "paths count has reached maximum value in the domain"
+ << ", paths limit for domain: " << domainInfo->GetSchemeLimits().MaxPaths
+ << ", paths count inside domain: " << domainInfo->GetPathsInside()
+ << ", intention to create new paths: " << delta;
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::DirChildrenLimit(ui64 delta, TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ TSubDomainInfo::TPtr domainInfo = Path.DomainInfo();
+
+ auto parent = Path.Parent();
+ ui64 aliveChildren = parent.Base()->GetAliveChildren();
+
+ if (!delta || aliveChildren + delta <= domainInfo->GetSchemeLimits().MaxChildrenInDir) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "children count has reached maximum value in the dir"
+ << ", children limit for domain dir: " << domainInfo->GetSchemeLimits().MaxChildrenInDir
+ << ", children count inside dir: " << aliveChildren
+ << ", intention to create new children: " << delta;
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::ShardsLimit(ui64 delta, TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ TSubDomainInfo::TPtr domainInfo = Path.DomainInfo();
+
+ if (!delta || domainInfo->GetShardsInside() + delta <= domainInfo->GetSchemeLimits().MaxShards) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "shards count has reached maximum value in the domain"
+ << ", shards limit for domain: " << domainInfo->GetSchemeLimits().MaxShards
+ << ", shards count inside domain: " << domainInfo->GetShardsInside()
+ << ", intention to create new shards: " << delta;
+ return *this;
+}
+
const TPath::TChecker& TPath::TChecker::PQPartitionsLimit(ui64 delta, TPath::TChecker::EStatus status) const {
if (Failed) {
return *this;
@@ -871,7 +871,7 @@ const TPath::TChecker& TPath::TChecker::PQPartitionsLimit(ui64 delta, TPath::TCh
Explain << "data stream shards count has reached maximum value in the domain"
<< ", data stream shards limit for domain: " << (domainInfo->GetDatabaseQuotas() ? domainInfo->GetDatabaseQuotas()->data_stream_shards_quota() : 0) << "(" << domainInfo->GetSchemeLimits().MaxPQPartitions << ")"
<< ", data stream shards count inside domain: " << domainInfo->GetPQPartitionsInside()
- << ", intention to create new data stream shards: " << delta;
+ << ", intention to create new data stream shards: " << delta;
return *this;
}
@@ -899,82 +899,82 @@ const TPath::TChecker& TPath::TChecker::PQReservedStorageLimit(ui64 delta, TPath
? domainInfo->GetDatabaseQuotas()->data_stream_reserved_storage_quota()
: MaxPQStorage) << " bytes"
<< ", data stream reserved storage size inside domain: " << domainInfo->GetPQReservedStorage() << " bytes"
- << ", intention to reserve more storage for : " << delta << " bytes";
+ << ", intention to reserve more storage for : " << delta << " bytes";
+ return *this;
+}
+
+
+
+const TPath::TChecker& TPath::TChecker::PathShardsLimit(ui64 delta, TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ const ui64 shardInPath = Path.Shards();
+
+ if (Path.IsResolved() && !Path.IsDeleted()) {
+ Y_VERIFY_DEBUG_S(Path.SS->CollectAllShards({Path.Base()->PathId}).size() == shardInPath, "pedantic check:"
+ << " CollectAllShards " << Path.SS->CollectAllShards({Path.Base()->PathId}).size()
+ << " !="
+ << " Path.GetShardsInside " << shardInPath
+ << " for path " << Path.PathString());
+ }
+
+ TSubDomainInfo::TPtr domainInfo = Path.DomainInfo();
+
+ if (!delta || shardInPath + delta <= domainInfo->GetSchemeLimits().MaxShardsInPath) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "shards count has reached maximum value in the path"
+ << ", shards limit for path: " << domainInfo->GetSchemeLimits().MaxShardsInPath
+ << ", shards count inside path: " << shardInPath
+ << ", intention to create new shards: " << delta;
+ return *this;
+}
+
+const TPath::TChecker& TPath::TChecker::NotChildren(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+
+ ui64 childrenCount = Path.Base()->GetAliveChildren();
+
+ if (0 == childrenCount) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path has children, request doesn't accept it"
+ << ", pathId: " << Path.Base()->PathId
+ << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
+ << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState)
+ << ", alive children: " << childrenCount;
return *this;
}
+const TPath::TChecker& TPath::TChecker::NotDeleted(TPath::TChecker::EStatus status) const {
+ if (Failed) {
+ return *this;
+ }
+ if (!Path.IsDeleted()) {
+ return *this;
+ }
+
+ Failed = true;
+ Status = status;
+ Explain << "path has been deleted"
+ << ", pathId: " << Path.Base()->PathId
+ << ", deleted in stepId: " << Path.Base()->StepDropped
+ << ", txId: " << Path.Base()->DropTxId
+ << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
+ return *this;
+}
-const TPath::TChecker& TPath::TChecker::PathShardsLimit(ui64 delta, TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- const ui64 shardInPath = Path.Shards();
-
- if (Path.IsResolved() && !Path.IsDeleted()) {
- Y_VERIFY_DEBUG_S(Path.SS->CollectAllShards({Path.Base()->PathId}).size() == shardInPath, "pedantic check:"
- << " CollectAllShards " << Path.SS->CollectAllShards({Path.Base()->PathId}).size()
- << " !="
- << " Path.GetShardsInside " << shardInPath
- << " for path " << Path.PathString());
- }
-
- TSubDomainInfo::TPtr domainInfo = Path.DomainInfo();
-
- if (!delta || shardInPath + delta <= domainInfo->GetSchemeLimits().MaxShardsInPath) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "shards count has reached maximum value in the path"
- << ", shards limit for path: " << domainInfo->GetSchemeLimits().MaxShardsInPath
- << ", shards count inside path: " << shardInPath
- << ", intention to create new shards: " << delta;
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::NotChildren(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- ui64 childrenCount = Path.Base()->GetAliveChildren();
-
- if (0 == childrenCount) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path has children, request doesn't accept it"
- << ", pathId: " << Path.Base()->PathId
- << ", path type: " << NKikimrSchemeOp::EPathType_Name(Path.Base()->PathType)
- << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState)
- << ", alive children: " << childrenCount;
- return *this;
-}
-
-const TPath::TChecker& TPath::TChecker::NotDeleted(TPath::TChecker::EStatus status) const {
- if (Failed) {
- return *this;
- }
-
- if (!Path.IsDeleted()) {
- return *this;
- }
-
- Failed = true;
- Status = status;
- Explain << "path has been deleted"
- << ", pathId: " << Path.Base()->PathId
- << ", deleted in stepId: " << Path.Base()->StepDropped
- << ", txId: " << Path.Base()->DropTxId
- << ", path state: " << NKikimrSchemeOp::EPathState_Name(Path.Base()->PathState);
- return *this;
-}
-
const TPath::TChecker& TPath::TChecker::IsValidACL(const TString& acl, EStatus status) const {
if (Failed) {
return *this;
@@ -1006,423 +1006,423 @@ const TPath::TChecker& TPath::TChecker::IsValidACL(const TString& acl, EStatus s
return *this;
}
-TPath::TPath(TSchemeShard* ss)
- : SS(ss)
-{
- Y_VERIFY(SS);
- Y_VERIFY(IsEmpty() && !IsResolved());
-}
-
-TPath::TPath(TVector<TPathElement::TPtr>&& elements, TSchemeShard* ss)
- : SS(ss)
-{
- Y_VERIFY(SS);
- Y_VERIFY(elements);
- Elements = std::move(elements);
- for (auto& item: Elements) {
- NameParts.push_back(item->Name);
- }
- Y_VERIFY(!IsEmpty());
- Y_VERIFY(IsResolved());
-}
-
-TPath::TChecker TPath::Check() const {
- return TChecker(*this);
-}
-
-bool TPath::IsEmpty() const {
- return NameParts.empty();
-}
-
-bool TPath::IsResolved() const {
- return !IsEmpty() && NameParts.size() == Elements.size();
-}
-
-NKikimr::NSchemeShard::TPath::operator bool() const {
- return IsResolved();
-}
-
-bool TPath::operator ==(const TPath& another) const { // likely O(1) complexity, but might be O(path length)
- if (Y_LIKELY(IsResolved() && another.IsResolved())) {
- return Base()->PathId == another.Base()->PathId; // check pathids is the only right way to compare
- } // PathStrings could be false equeal due operation Init form deleted path element
- if (IsResolved() || another.IsResolved()) {
- return false;
- }
- //both are not resolved
-
- if (IsEmpty() && another.IsEmpty()) {
- return true;
- }
-
- if (IsEmpty() || another.IsEmpty()) {
- return false;
- }
- //both are not empty
-
- if (Depth() != another.Depth()) {
- return false;
- }
-
- // we could have checked parents and unresolved tails
- // but better let's keep it simple
- return PathString() == another.PathString();
-}
-
-bool TPath::operator !=(const TPath& another) const {
- return !(*this == another);
-}
-
-TPath TPath::Root(TSchemeShard* ss) {
- Y_VERIFY(ss);
-
- auto result = TPath::Init(ss->RootPathId(), ss);
- return result;
-}
-
-TString TPath::PathString() const { // O(result length) complexity
- if (!NameParts) {
- return TString();
- }
-
- TStringBuilder result;
-
- for (auto& part: NameParts) {
- result << '/' << part;
- }
-
- return result;
-}
-
-TPath& TPath::Rise() {
- if (!NameParts) {
- Y_VERIFY(!Elements);
- return *this;
- }
-
- if (Elements.size() == NameParts.size()) {
- if (Base()->IsRoot()) {
- return *this;
- }
-
- Elements.pop_back();
- }
- NameParts.pop_back();
- return *this;
-}
-
-TPath TPath::Parent() const {
- TPath result = *this;
- result.Rise();
- return result;
-}
-
-TPath& TPath::RiseUntilFirstResolvedParent() {
- Rise();
- while (!IsEmpty() && !IsResolved()) {
- Rise();
- }
- return *this;
-}
-
-TPath TPath::FirstResoledParent() const {
- TPath result = *this;
- result.RiseUntilFirstResolvedParent();
- return result;
-}
-
-TPath& TPath::RiseUntilExisted() {
- if (!IsResolved()) {
- RiseUntilFirstResolvedParent();
- }
- while (!IsEmpty() && IsDeleted()) {
- Rise();
- }
- return *this;
-}
-
-TPath TPath::FirstExistedParent() const {
- TPath result = *this;
- result.RiseUntilExisted();
- return result;
-}
-
-TSubDomainInfo::TPtr TPath::DomainInfo() const {
- Y_VERIFY(!IsEmpty());
- Y_VERIFY(Elements.size());
-
- return SS->ResolveDomainInfo(Elements.back());
-}
-
-TPathId TPath::DomainId() const {
- Y_VERIFY(!IsEmpty());
- Y_VERIFY(Elements.size());
-
- return SS->ResolveDomainId(Elements.back());
-}
-
-bool TPath::IsDomain() const {
- Y_VERIFY(IsResolved());
-
- return Base()->IsDomainRoot();
-}
-
-TPath& TPath::Dive(const TString& name) {
- if (!SS->IsShemeShardConfigured()) {
- NameParts.push_back(name);
- return *this;
- }
-
- if (Elements.empty() && NameParts.size() < SS->RootPathElemets.size()) {
- NameParts.push_back(name);
-
- if (NameParts.size() == SS->RootPathElemets.size()
- && NameParts == SS->RootPathElemets)
- {
- Elements = {SS->PathsById.at(SS->RootPathId())};
- NameParts = {Elements.front()->Name};
- }
-
- return *this;
- }
-
- if (Elements.size() != NameParts.size()) {
- NameParts.push_back(name);
- return *this;
- }
-
- NameParts.push_back(name);
- TPathElement::TPtr last = Elements.back();
-
- TPathId* childId = last->FindChild(name);
-
- if (nullptr == childId) {
- return *this;
- }
-
- Elements.push_back(SS->PathsById.at(*childId));
- return *this;
-}
-
-
-TPath TPath::Child(const TString& name) const {
- TPath result = *this;
- result.Dive(name);
- return result;
-}
-
-TPath TPath::Resolve(const TString path, TSchemeShard* ss) {
- Y_VERIFY(ss);
-
- TPath nullPrefix{ss};
- return Resolve(nullPrefix, SplitPath(path));
-}
-
-TPath TPath::Resolve(const TPath& prefix, TVector<TString>&& pathParts) {
- TPath result = prefix;
-
- if (pathParts.empty()) {
- return result;
- }
-
- for (auto& part: pathParts) {
- result.Dive(part);
- }
-
- return result;
-}
-
-TPath TPath::ResolveWithInactive(TOperationId opId, const TString path, TSchemeShard* ss) {
- TPath nullPrefix{ss};
- auto pathParts = SplitPath(path);
-
+TPath::TPath(TSchemeShard* ss)
+ : SS(ss)
+{
+ Y_VERIFY(SS);
+ Y_VERIFY(IsEmpty() && !IsResolved());
+}
+
+TPath::TPath(TVector<TPathElement::TPtr>&& elements, TSchemeShard* ss)
+ : SS(ss)
+{
+ Y_VERIFY(SS);
+ Y_VERIFY(elements);
+ Elements = std::move(elements);
+ for (auto& item: Elements) {
+ NameParts.push_back(item->Name);
+ }
+ Y_VERIFY(!IsEmpty());
+ Y_VERIFY(IsResolved());
+}
+
+TPath::TChecker TPath::Check() const {
+ return TChecker(*this);
+}
+
+bool TPath::IsEmpty() const {
+ return NameParts.empty();
+}
+
+bool TPath::IsResolved() const {
+ return !IsEmpty() && NameParts.size() == Elements.size();
+}
+
+NKikimr::NSchemeShard::TPath::operator bool() const {
+ return IsResolved();
+}
+
+bool TPath::operator ==(const TPath& another) const { // likely O(1) complexity, but might be O(path length)
+ if (Y_LIKELY(IsResolved() && another.IsResolved())) {
+ return Base()->PathId == another.Base()->PathId; // check pathids is the only right way to compare
+ } // PathStrings could be false equeal due operation Init form deleted path element
+ if (IsResolved() || another.IsResolved()) {
+ return false;
+ }
+ //both are not resolved
+
+ if (IsEmpty() && another.IsEmpty()) {
+ return true;
+ }
+
+ if (IsEmpty() || another.IsEmpty()) {
+ return false;
+ }
+ //both are not empty
+
+ if (Depth() != another.Depth()) {
+ return false;
+ }
+
+ // we could have checked parents and unresolved tails
+ // but better let's keep it simple
+ return PathString() == another.PathString();
+}
+
+bool TPath::operator !=(const TPath& another) const {
+ return !(*this == another);
+}
+
+TPath TPath::Root(TSchemeShard* ss) {
+ Y_VERIFY(ss);
+
+ auto result = TPath::Init(ss->RootPathId(), ss);
+ return result;
+}
+
+TString TPath::PathString() const { // O(result length) complexity
+ if (!NameParts) {
+ return TString();
+ }
+
+ TStringBuilder result;
+
+ for (auto& part: NameParts) {
+ result << '/' << part;
+ }
+
+ return result;
+}
+
+TPath& TPath::Rise() {
+ if (!NameParts) {
+ Y_VERIFY(!Elements);
+ return *this;
+ }
+
+ if (Elements.size() == NameParts.size()) {
+ if (Base()->IsRoot()) {
+ return *this;
+ }
+
+ Elements.pop_back();
+ }
+ NameParts.pop_back();
+ return *this;
+}
+
+TPath TPath::Parent() const {
+ TPath result = *this;
+ result.Rise();
+ return result;
+}
+
+TPath& TPath::RiseUntilFirstResolvedParent() {
+ Rise();
+ while (!IsEmpty() && !IsResolved()) {
+ Rise();
+ }
+ return *this;
+}
+
+TPath TPath::FirstResoledParent() const {
+ TPath result = *this;
+ result.RiseUntilFirstResolvedParent();
+ return result;
+}
+
+TPath& TPath::RiseUntilExisted() {
+ if (!IsResolved()) {
+ RiseUntilFirstResolvedParent();
+ }
+ while (!IsEmpty() && IsDeleted()) {
+ Rise();
+ }
+ return *this;
+}
+
+TPath TPath::FirstExistedParent() const {
+ TPath result = *this;
+ result.RiseUntilExisted();
+ return result;
+}
+
+TSubDomainInfo::TPtr TPath::DomainInfo() const {
+ Y_VERIFY(!IsEmpty());
+ Y_VERIFY(Elements.size());
+
+ return SS->ResolveDomainInfo(Elements.back());
+}
+
+TPathId TPath::DomainId() const {
+ Y_VERIFY(!IsEmpty());
+ Y_VERIFY(Elements.size());
+
+ return SS->ResolveDomainId(Elements.back());
+}
+
+bool TPath::IsDomain() const {
+ Y_VERIFY(IsResolved());
+
+ return Base()->IsDomainRoot();
+}
+
+TPath& TPath::Dive(const TString& name) {
+ if (!SS->IsShemeShardConfigured()) {
+ NameParts.push_back(name);
+ return *this;
+ }
+
+ if (Elements.empty() && NameParts.size() < SS->RootPathElemets.size()) {
+ NameParts.push_back(name);
+
+ if (NameParts.size() == SS->RootPathElemets.size()
+ && NameParts == SS->RootPathElemets)
+ {
+ Elements = {SS->PathsById.at(SS->RootPathId())};
+ NameParts = {Elements.front()->Name};
+ }
+
+ return *this;
+ }
+
+ if (Elements.size() != NameParts.size()) {
+ NameParts.push_back(name);
+ return *this;
+ }
+
+ NameParts.push_back(name);
+ TPathElement::TPtr last = Elements.back();
+
+ TPathId* childId = last->FindChild(name);
+
+ if (nullptr == childId) {
+ return *this;
+ }
+
+ Elements.push_back(SS->PathsById.at(*childId));
+ return *this;
+}
+
+
+TPath TPath::Child(const TString& name) const {
+ TPath result = *this;
+ result.Dive(name);
+ return result;
+}
+
+TPath TPath::Resolve(const TString path, TSchemeShard* ss) {
+ Y_VERIFY(ss);
+
+ TPath nullPrefix{ss};
+ return Resolve(nullPrefix, SplitPath(path));
+}
+
+TPath TPath::Resolve(const TPath& prefix, TVector<TString>&& pathParts) {
+ TPath result = prefix;
+
+ if (pathParts.empty()) {
+ return result;
+ }
+
+ for (auto& part: pathParts) {
+ result.Dive(part);
+ }
+
+ return result;
+}
+
+TPath TPath::ResolveWithInactive(TOperationId opId, const TString path, TSchemeShard* ss) {
+ TPath nullPrefix{ss};
+ auto pathParts = SplitPath(path);
+
int headSubTxId = opId.GetSubTxId() - 1;
- while (headSubTxId >= 0) {
- auto headOpId = TOperationId(opId.GetTxId(), headSubTxId);
- TTxState* txState = ss->FindTx(headOpId);
- if (!txState) {
- break;
- }
-
- TPath headOpPath = Init(txState->TargetPathId, ss);
-
- auto headPathNameParts = ss->RootPathElemets;
- headPathNameParts.insert(headPathNameParts.end(), std::next(headOpPath.NameParts.begin()), headOpPath.NameParts.end());
-
- if (headPathNameParts.size() + 1 == pathParts.size()
- && std::equal(headPathNameParts.begin(), headPathNameParts.end(),
- pathParts.begin()))
- {
- // headOpPath is a prefix of the path
- LOG_DEBUG_S(TlsActivationContext->AsActorContext(), NKikimrServices::FLAT_TX_SCHEMESHARD,
- "ResolveWithInactive: attach to the TargetPath of head operation"
- << " path: " << path
- << " opId: " << opId
- << " head opId: " << headOpId
- << " headOpPath: " << headOpPath.PathString()
- << " headOpPath id: " << headOpPath->PathId);
-
- return headOpPath.Child(pathParts.back());
- }
-
- --headSubTxId;
- }
-
- LOG_DEBUG_S(TlsActivationContext->AsActorContext(), NKikimrServices::FLAT_TX_SCHEMESHARD,
- "ResolveWithInactive: NO attach to the TargetPath of head operation"
- << " path: " << path
- << " opId: " << opId);
-
- return Resolve(nullPrefix, std::move(pathParts));
-}
-
-
-TPath TPath::Init(const TPathId pathId, TSchemeShard* ss) {
- Y_VERIFY(ss);
-
- if (!ss->PathsById.contains(pathId)) {
- return TPath(ss);
- }
-
- TVector<TPathElement::TPtr> parts;
- TPathElement::TPtr cur = ss->PathsById.at(pathId);
-
- while (!cur->IsRoot()) {
- parts.push_back(cur);
- Y_VERIFY(ss->PathsById.contains(cur->ParentPathId));
- cur = ss->PathsById.at(cur->ParentPathId);
- }
-
- parts.push_back(cur); //add root
- std::reverse(parts.begin(), parts.end());
-
- return TPath(std::move(parts), ss);
-}
-
-TPathElement::TPtr TPath::Base() const {
- Y_VERIFY_S(IsResolved(), "not resolved path " << PathString()
- << " NameParts: " << NameParts.size()
- << " Elements: " << Elements.size());
-
- return Elements.back();
-}
-
+ while (headSubTxId >= 0) {
+ auto headOpId = TOperationId(opId.GetTxId(), headSubTxId);
+ TTxState* txState = ss->FindTx(headOpId);
+ if (!txState) {
+ break;
+ }
+
+ TPath headOpPath = Init(txState->TargetPathId, ss);
+
+ auto headPathNameParts = ss->RootPathElemets;
+ headPathNameParts.insert(headPathNameParts.end(), std::next(headOpPath.NameParts.begin()), headOpPath.NameParts.end());
+
+ if (headPathNameParts.size() + 1 == pathParts.size()
+ && std::equal(headPathNameParts.begin(), headPathNameParts.end(),
+ pathParts.begin()))
+ {
+ // headOpPath is a prefix of the path
+ LOG_DEBUG_S(TlsActivationContext->AsActorContext(), NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "ResolveWithInactive: attach to the TargetPath of head operation"
+ << " path: " << path
+ << " opId: " << opId
+ << " head opId: " << headOpId
+ << " headOpPath: " << headOpPath.PathString()
+ << " headOpPath id: " << headOpPath->PathId);
+
+ return headOpPath.Child(pathParts.back());
+ }
+
+ --headSubTxId;
+ }
+
+ LOG_DEBUG_S(TlsActivationContext->AsActorContext(), NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "ResolveWithInactive: NO attach to the TargetPath of head operation"
+ << " path: " << path
+ << " opId: " << opId);
+
+ return Resolve(nullPrefix, std::move(pathParts));
+}
+
+
+TPath TPath::Init(const TPathId pathId, TSchemeShard* ss) {
+ Y_VERIFY(ss);
+
+ if (!ss->PathsById.contains(pathId)) {
+ return TPath(ss);
+ }
+
+ TVector<TPathElement::TPtr> parts;
+ TPathElement::TPtr cur = ss->PathsById.at(pathId);
+
+ while (!cur->IsRoot()) {
+ parts.push_back(cur);
+ Y_VERIFY(ss->PathsById.contains(cur->ParentPathId));
+ cur = ss->PathsById.at(cur->ParentPathId);
+ }
+
+ parts.push_back(cur); //add root
+ std::reverse(parts.begin(), parts.end());
+
+ return TPath(std::move(parts), ss);
+}
+
+TPathElement::TPtr TPath::Base() const {
+ Y_VERIFY_S(IsResolved(), "not resolved path " << PathString()
+ << " NameParts: " << NameParts.size()
+ << " Elements: " << Elements.size());
+
+ return Elements.back();
+}
+
TPathElement* TPath::operator->() const {
Y_VERIFY_S(IsResolved(), "not resolved path " << PathString());
return Elements.back().Get();
}
-bool TPath::IsDeleted() const {
- Y_VERIFY(IsResolved());
-
- return Base()->Dropped();
-}
-
-bool TPath::IsUnderOperation() const {
- Y_VERIFY(IsResolved());
-
- if (Base()->Dropped()) {
- return false;
- }
-
- bool result = Base()->PathState != NKikimrSchemeOp::EPathState::EPathStateNoChanges;
- if (result) {
+bool TPath::IsDeleted() const {
+ Y_VERIFY(IsResolved());
+
+ return Base()->Dropped();
+}
+
+bool TPath::IsUnderOperation() const {
+ Y_VERIFY(IsResolved());
+
+ if (Base()->Dropped()) {
+ return false;
+ }
+
+ bool result = Base()->PathState != NKikimrSchemeOp::EPathState::EPathStateNoChanges;
+ if (result) {
ui32 summ = (ui32)IsUnderCreating()
+ (ui32)IsUnderAltering()
+ (ui32)IsUnderCopying()
+ (ui32)IsUnderBackuping()
+ (ui32)IsUnderRestoring()
+ (ui32)IsUnderDeleting()
- + (ui32)IsUnderDomainUpgrade()
- + (ui32)IsUnderMoving();
- Y_VERIFY_S(summ == 1,
- "only one operation at the time"
- << " pathId: " << Base()->PathId
- << " path state: " << NKikimrSchemeOp::EPathState_Name(Base()->PathState)
- << " path: " << PathString()
- << " sum is: " << summ);
- }
- return result;
-}
-
-TTxId TPath::ActiveOperation() const {
- Y_VERIFY(IsResolved());
-
- if (!IsUnderOperation()) {
- return InvalidTxId;
- }
-
- TTxId txId = InvalidTxId;
- if (IsUnderCreating()) {
- txId = Base()->CreateTxId;
- } else if (IsUnderDeleting()) {
- txId = Base()->DropTxId;
- } else {
- txId = Base()->LastTxId;
- }
-
- Y_VERIFY(txId != InvalidTxId);
- Y_VERIFY_S(SS->Operations.contains(txId),
- "no operation,"
- << " txId: " << txId
- << " pathId: " << Base()->PathId
- << " path state: " << NKikimrSchemeOp::EPathState_Name(Base()->PathState)
- << " path " << PathString());
-
- return txId;
-}
-
-bool TPath::IsUnderCreating() const {
- Y_VERIFY(IsResolved());
-
- return Base()->PathState == NKikimrSchemeOp::EPathState::EPathStateCreate;
-}
-
-bool TPath::IsUnderAltering() const {
- Y_VERIFY(IsResolved());
-
- return Base()->PathState == NKikimrSchemeOp::EPathState::EPathStateAlter;
-}
-
-bool TPath::IsUnderDomainUpgrade() const {
- if (Elements.empty()) {
- return false;
- }
-
- return SS->PathsById.at(DomainId())->PathState == NKikimrSchemeOp::EPathState::EPathStateUpgrade;
-}
-
-bool TPath::IsUnderCopying() const {
- Y_VERIFY(IsResolved());
-
- return Base()->PathState == NKikimrSchemeOp::EPathState::EPathStateCopying;
-}
-
-bool TPath::IsUnderBackuping() const {
- Y_VERIFY(IsResolved());
-
- return Base()->PathState == NKikimrSchemeOp::EPathState::EPathStateBackup;
-}
-
+ + (ui32)IsUnderDomainUpgrade()
+ + (ui32)IsUnderMoving();
+ Y_VERIFY_S(summ == 1,
+ "only one operation at the time"
+ << " pathId: " << Base()->PathId
+ << " path state: " << NKikimrSchemeOp::EPathState_Name(Base()->PathState)
+ << " path: " << PathString()
+ << " sum is: " << summ);
+ }
+ return result;
+}
+
+TTxId TPath::ActiveOperation() const {
+ Y_VERIFY(IsResolved());
+
+ if (!IsUnderOperation()) {
+ return InvalidTxId;
+ }
+
+ TTxId txId = InvalidTxId;
+ if (IsUnderCreating()) {
+ txId = Base()->CreateTxId;
+ } else if (IsUnderDeleting()) {
+ txId = Base()->DropTxId;
+ } else {
+ txId = Base()->LastTxId;
+ }
+
+ Y_VERIFY(txId != InvalidTxId);
+ Y_VERIFY_S(SS->Operations.contains(txId),
+ "no operation,"
+ << " txId: " << txId
+ << " pathId: " << Base()->PathId
+ << " path state: " << NKikimrSchemeOp::EPathState_Name(Base()->PathState)
+ << " path " << PathString());
+
+ return txId;
+}
+
+bool TPath::IsUnderCreating() const {
+ Y_VERIFY(IsResolved());
+
+ return Base()->PathState == NKikimrSchemeOp::EPathState::EPathStateCreate;
+}
+
+bool TPath::IsUnderAltering() const {
+ Y_VERIFY(IsResolved());
+
+ return Base()->PathState == NKikimrSchemeOp::EPathState::EPathStateAlter;
+}
+
+bool TPath::IsUnderDomainUpgrade() const {
+ if (Elements.empty()) {
+ return false;
+ }
+
+ return SS->PathsById.at(DomainId())->PathState == NKikimrSchemeOp::EPathState::EPathStateUpgrade;
+}
+
+bool TPath::IsUnderCopying() const {
+ Y_VERIFY(IsResolved());
+
+ return Base()->PathState == NKikimrSchemeOp::EPathState::EPathStateCopying;
+}
+
+bool TPath::IsUnderBackuping() const {
+ Y_VERIFY(IsResolved());
+
+ return Base()->PathState == NKikimrSchemeOp::EPathState::EPathStateBackup;
+}
+
bool TPath::IsUnderRestoring() const {
Y_VERIFY(IsResolved());
- return Base()->PathState == NKikimrSchemeOp::EPathState::EPathStateRestore;
-}
-
-bool TPath::IsUnderDeleting() const {
- Y_VERIFY(IsResolved());
-
- return Base()->PathState == NKikimrSchemeOp::EPathState::EPathStateDrop;
-}
-
-bool TPath::IsUnderMoving() const {
- Y_VERIFY(IsResolved());
-
- return Base()->PathState == NKikimrSchemeOp::EPathState::EPathStateMoving;
-}
-
+ return Base()->PathState == NKikimrSchemeOp::EPathState::EPathStateRestore;
+}
+
+bool TPath::IsUnderDeleting() const {
+ Y_VERIFY(IsResolved());
+
+ return Base()->PathState == NKikimrSchemeOp::EPathState::EPathStateDrop;
+}
+
+bool TPath::IsUnderMoving() const {
+ Y_VERIFY(IsResolved());
+
+ return Base()->PathState == NKikimrSchemeOp::EPathState::EPathStateMoving;
+}
+
TPath& TPath::RiseUntilOlapStore() {
size_t end = Elements.size();
while (end > 0) {
@@ -1443,71 +1443,71 @@ TPath TPath::FindOlapStore() const {
return result;
}
-bool TPath::IsCommonSensePath() const {
- Y_VERIFY(IsResolved());
-
- auto item = ++Elements.rbegin(); //do not check the Base
- for (; item != Elements.rend(); ++item) {
+bool TPath::IsCommonSensePath() const {
+ Y_VERIFY(IsResolved());
+
+ auto item = ++Elements.rbegin(); //do not check the Base
+ for (; item != Elements.rend(); ++item) {
// Directories and domain roots are always ok as intermediaries
bool ok = (*item)->IsDirectory() || (*item)->IsDomainRoot();
// Temporarily olap stores are treated like directories
ok = ok || (*item)->IsOlapStore();
if (!ok) {
- return false;
- }
- }
-
- return true;
-}
-
-bool TPath::AtLocalSchemeShardPath() const {
- if (Elements.empty()) {
- return true;
- }
-
- auto it = Elements.rbegin();
-
- if ((*it)->IsExternalSubDomainRoot() && !(*it)->Dropped()) {
- return IsResolved();
- }
-
- return !(*it)->IsMigrated();
-}
-
-bool TPath::IsInsideTableIndexPath() const {
- Y_VERIFY(IsResolved());
-
- // expected /<root>/.../<table>/<table_index>/<private_tables>
- if (Depth() < 3) {
- return false;
- }
-
- auto item = Elements.rbegin();
-
- //skip private_table
- if ((*item)->IsTable()) {
- ++item;
- }
-
- if (!(*item)->IsTableIndex()) {
- return false;
- }
-
- ++item;
- if (!(*item)->IsTable()) {
- return false;
- }
-
- ++item;
- for (; item != Elements.rend(); ++item) {
- if (!(*item)->IsDirectory() && !(*item)->IsSubDomainRoot()) {
- return false;
- }
- }
-
- return true;
-}
-
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool TPath::AtLocalSchemeShardPath() const {
+ if (Elements.empty()) {
+ return true;
+ }
+
+ auto it = Elements.rbegin();
+
+ if ((*it)->IsExternalSubDomainRoot() && !(*it)->Dropped()) {
+ return IsResolved();
+ }
+
+ return !(*it)->IsMigrated();
+}
+
+bool TPath::IsInsideTableIndexPath() const {
+ Y_VERIFY(IsResolved());
+
+ // expected /<root>/.../<table>/<table_index>/<private_tables>
+ if (Depth() < 3) {
+ return false;
+ }
+
+ auto item = Elements.rbegin();
+
+ //skip private_table
+ if ((*item)->IsTable()) {
+ ++item;
+ }
+
+ if (!(*item)->IsTableIndex()) {
+ return false;
+ }
+
+ ++item;
+ if (!(*item)->IsTable()) {
+ return false;
+ }
+
+ ++item;
+ for (; item != Elements.rend(); ++item) {
+ if (!(*item)->IsDirectory() && !(*item)->IsSubDomainRoot()) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
bool TPath::IsInsideCdcStreamPath() const {
Y_VERIFY(IsResolved());
@@ -1548,18 +1548,18 @@ bool TPath::IsTableIndex() const {
return Base()->IsTableIndex();
}
-bool TPath::IsBackupTable() const {
- Y_VERIFY(IsResolved());
-
- if (!Base()->IsTable() || !SS->Tables.contains(Base()->PathId)) {
- return false;
- }
-
- TTableInfo::TCPtr tableInfo = SS->Tables.at(Base()->PathId);
-
- return tableInfo->IsBackup;
-}
-
+bool TPath::IsBackupTable() const {
+ Y_VERIFY(IsResolved());
+
+ if (!Base()->IsTable() || !SS->Tables.contains(Base()->PathId)) {
+ return false;
+ }
+
+ TTableInfo::TCPtr tableInfo = SS->Tables.at(Base()->PathId);
+
+ return tableInfo->IsBackup;
+}
+
bool TPath::IsCdcStream() const {
Y_VERIFY(IsResolved());
@@ -1578,211 +1578,211 @@ bool TPath::IsReplication() const {
return Base()->IsReplication();
}
-ui32 TPath::Depth() const {
- return NameParts.size();
-}
-
-ui64 TPath::Shards() const {
- if (IsEmpty() || !IsResolved() || IsDeleted()) {
- return 0;
- }
-
- return Base()->GetShardsInside();
-}
-
-const TString &TPath::LeafName() const {
- Y_VERIFY(!IsEmpty());
- return NameParts.back();
-}
-
-bool TPath::IsValidLeafName(TString& explain) const {
- Y_VERIFY(!IsEmpty());
-
- const auto& leaf = NameParts.back();
- if (leaf.empty()) {
- explain += "path part shouldn't be empty";
- return false;
- }
-
- const auto& schemeLimits = DomainInfo()->GetSchemeLimits();
-
- if (leaf.size() > schemeLimits.MaxPathElementLength) {
- explain += "path part is too long";
- return false;
- }
-
- if (!SS->IsShemeShardConfigured()) {
- explain += "cluster don't have inited root jet";
- return false;
- }
-
+ui32 TPath::Depth() const {
+ return NameParts.size();
+}
+
+ui64 TPath::Shards() const {
+ if (IsEmpty() || !IsResolved() || IsDeleted()) {
+ return 0;
+ }
+
+ return Base()->GetShardsInside();
+}
+
+const TString &TPath::LeafName() const {
+ Y_VERIFY(!IsEmpty());
+ return NameParts.back();
+}
+
+bool TPath::IsValidLeafName(TString& explain) const {
+ Y_VERIFY(!IsEmpty());
+
+ const auto& leaf = NameParts.back();
+ if (leaf.empty()) {
+ explain += "path part shouldn't be empty";
+ return false;
+ }
+
+ const auto& schemeLimits = DomainInfo()->GetSchemeLimits();
+
+ if (leaf.size() > schemeLimits.MaxPathElementLength) {
+ explain += "path part is too long";
+ return false;
+ }
+
+ if (!SS->IsShemeShardConfigured()) {
+ explain += "cluster don't have inited root jet";
+ return false;
+ }
+
if (AppData()->FeatureFlags.GetEnableSystemViews() && leaf == NSysView::SysPathName) {
explain += TStringBuilder()
<< "path part '" << NSysView::SysPathName << "' is reserved by the system";
return false;
}
- auto brokenAt = PathPartBrokenAt(leaf, schemeLimits.ExtraPathSymbolsAllowed);
- if (brokenAt != leaf.end()) {
- explain += TStringBuilder()
- << "symbol '" << *brokenAt << "'"
- << " is not allowed in the path part '" << leaf << "'";
- return false;
- }
-
- return true;
-}
-
-TString TPath::GetEffectiveACL() const {
- Y_VERIFY(IsResolved());
-
- ui64 version = 0;
-
- if (!SS->IsDomainSchemeShard) {
- version += SS->ParentDomainEffectiveACLVersion;
- }
-
- //actualize CachedEffectiveACL in each element if needed
- for (auto elementIt = Elements.begin(); elementIt != Elements.end(); ++elementIt) {
- TPathElement::TPtr element = *elementIt;
- version += element->ACLVersion;
-
- if (element->CachedEffectiveACLVersion != version || !element->CachedEffectiveACL) { //path needs actualizing
- if (elementIt == Elements.begin()) { // it is root
- if (!SS->IsDomainSchemeShard) {
- element->CachedEffectiveACL.Update(SS->ParentDomainCachedEffectiveACL, element->ACL, element->IsContainer());
- } else {
- element->CachedEffectiveACL.Init(element->ACL);
- }
- } else { // path element in the middle
- auto prevIt = std::prev(elementIt);
- const auto& prevElement = *prevIt;
- element->CachedEffectiveACL.Update(prevElement->CachedEffectiveACL, element->ACL, element->IsContainer());
- }
- element->CachedEffectiveACLVersion = version;
- }
- }
-
- return Elements.back()->CachedEffectiveACL.GetForSelf();
-}
-
-ui64 TPath::GetEffectiveACLVersion() const {
- Y_VERIFY(IsResolved());
-
- ui64 version = 0;
-
- if (!SS->IsDomainSchemeShard) {
- version += SS->ParentDomainEffectiveACLVersion;
- }
-
- for (auto elementIt = Elements.begin(); elementIt != Elements.end(); ++elementIt) {
- version += (*elementIt)->ACLVersion;
- }
-
- return version;
-}
-
-TTxId TPath::LockedBy() const {
- auto it = SS->LockedPaths.find(Base()->PathId);
- if (it != SS->LockedPaths.end()) {
- return it->second;
- }
-
- return InvalidTxId;
-}
-
-bool TPath::IsActive() const {
- return SS->PathIsActive(Base()->PathId);
-}
-
-void TPath::Activate() {
- if (IsActive()) {
- return;
- }
-
- Y_VERIFY(Base()->IsCreateFinished());
-
- auto result = SS->AttachChild(Base());
- Y_VERIFY_S(result == EAttachChildResult::AttachedAsNewerActual, "result is: " << result);
-}
-
-void TPath::MaterializeLeaf(const TString& owner) {
- return MaterializeLeaf(owner, SS->AllocatePathId(), /*allowInactivePath*/ false);
-}
-
-void TPath::MaterializeLeaf(const TString &owner, const TPathId &newPathId, bool allowInactivePath) {
- auto result = MaterializeImpl(owner, newPathId);
- switch (result) {
- case EAttachChildResult::Undefined:
- Y_FAIL("unexpected result: Undefined");
- break;
-
- case EAttachChildResult::AttachedAsOnlyOne:
- case EAttachChildResult::AttachedAsActual:
- Y_VERIFY(SS->PathIsActive(newPathId));
- break;
-
- case EAttachChildResult::AttachedAsCreatedActual:
- case EAttachChildResult::AttachedAsOlderUnCreated:
- case EAttachChildResult::AttachedAsNewerDeleted:
- case EAttachChildResult::AttachedAsNewerActual:
- Y_FAIL_S("strange result for materialization: " << result);
- break;
-
- case EAttachChildResult::RejectAsInactve:
- if (allowInactivePath) {
- Y_VERIFY(!SS->PathIsActive(newPathId));
- } else {
- Y_FAIL_S("MaterializeLeaf do not accept shadow pathes, use allowInactivePath = true");
- }
- break;
-
- case EAttachChildResult::RejectAsOlderDeleted:
- case EAttachChildResult::RejectAsDeleted:
- case EAttachChildResult::RejectAsOlderActual:
- case EAttachChildResult::RejectAsNewerUnCreated:
- Y_FAIL_S("MaterializeLeaf do not accept rejection: " << result);
- break;
- };
-}
-
-EAttachChildResult TPath::MaterializeImpl(const TString& owner, const TPathId& newPathId) {
- const TString leafName = NameParts.back();
- Rise();
- Y_VERIFY(IsResolved());
-
- TPathId domainId = Base()->IsDomainRoot() ? Base()->PathId : Base()->DomainPathId;
- TPathElement::TPtr newPath = new TPathElement(newPathId, Base()->PathId, domainId, leafName, owner);
-
- auto attachResult = SS->AttachChild(newPath);
-
+ auto brokenAt = PathPartBrokenAt(leaf, schemeLimits.ExtraPathSymbolsAllowed);
+ if (brokenAt != leaf.end()) {
+ explain += TStringBuilder()
+ << "symbol '" << *brokenAt << "'"
+ << " is not allowed in the path part '" << leaf << "'";
+ return false;
+ }
+
+ return true;
+}
+
+TString TPath::GetEffectiveACL() const {
+ Y_VERIFY(IsResolved());
+
+ ui64 version = 0;
+
+ if (!SS->IsDomainSchemeShard) {
+ version += SS->ParentDomainEffectiveACLVersion;
+ }
+
+ //actualize CachedEffectiveACL in each element if needed
+ for (auto elementIt = Elements.begin(); elementIt != Elements.end(); ++elementIt) {
+ TPathElement::TPtr element = *elementIt;
+ version += element->ACLVersion;
+
+ if (element->CachedEffectiveACLVersion != version || !element->CachedEffectiveACL) { //path needs actualizing
+ if (elementIt == Elements.begin()) { // it is root
+ if (!SS->IsDomainSchemeShard) {
+ element->CachedEffectiveACL.Update(SS->ParentDomainCachedEffectiveACL, element->ACL, element->IsContainer());
+ } else {
+ element->CachedEffectiveACL.Init(element->ACL);
+ }
+ } else { // path element in the middle
+ auto prevIt = std::prev(elementIt);
+ const auto& prevElement = *prevIt;
+ element->CachedEffectiveACL.Update(prevElement->CachedEffectiveACL, element->ACL, element->IsContainer());
+ }
+ element->CachedEffectiveACLVersion = version;
+ }
+ }
+
+ return Elements.back()->CachedEffectiveACL.GetForSelf();
+}
+
+ui64 TPath::GetEffectiveACLVersion() const {
+ Y_VERIFY(IsResolved());
+
+ ui64 version = 0;
+
+ if (!SS->IsDomainSchemeShard) {
+ version += SS->ParentDomainEffectiveACLVersion;
+ }
+
+ for (auto elementIt = Elements.begin(); elementIt != Elements.end(); ++elementIt) {
+ version += (*elementIt)->ACLVersion;
+ }
+
+ return version;
+}
+
+TTxId TPath::LockedBy() const {
+ auto it = SS->LockedPaths.find(Base()->PathId);
+ if (it != SS->LockedPaths.end()) {
+ return it->second;
+ }
+
+ return InvalidTxId;
+}
+
+bool TPath::IsActive() const {
+ return SS->PathIsActive(Base()->PathId);
+}
+
+void TPath::Activate() {
+ if (IsActive()) {
+ return;
+ }
+
+ Y_VERIFY(Base()->IsCreateFinished());
+
+ auto result = SS->AttachChild(Base());
+ Y_VERIFY_S(result == EAttachChildResult::AttachedAsNewerActual, "result is: " << result);
+}
+
+void TPath::MaterializeLeaf(const TString& owner) {
+ return MaterializeLeaf(owner, SS->AllocatePathId(), /*allowInactivePath*/ false);
+}
+
+void TPath::MaterializeLeaf(const TString &owner, const TPathId &newPathId, bool allowInactivePath) {
+ auto result = MaterializeImpl(owner, newPathId);
+ switch (result) {
+ case EAttachChildResult::Undefined:
+ Y_FAIL("unexpected result: Undefined");
+ break;
+
+ case EAttachChildResult::AttachedAsOnlyOne:
+ case EAttachChildResult::AttachedAsActual:
+ Y_VERIFY(SS->PathIsActive(newPathId));
+ break;
+
+ case EAttachChildResult::AttachedAsCreatedActual:
+ case EAttachChildResult::AttachedAsOlderUnCreated:
+ case EAttachChildResult::AttachedAsNewerDeleted:
+ case EAttachChildResult::AttachedAsNewerActual:
+ Y_FAIL_S("strange result for materialization: " << result);
+ break;
+
+ case EAttachChildResult::RejectAsInactve:
+ if (allowInactivePath) {
+ Y_VERIFY(!SS->PathIsActive(newPathId));
+ } else {
+ Y_FAIL_S("MaterializeLeaf do not accept shadow pathes, use allowInactivePath = true");
+ }
+ break;
+
+ case EAttachChildResult::RejectAsOlderDeleted:
+ case EAttachChildResult::RejectAsDeleted:
+ case EAttachChildResult::RejectAsOlderActual:
+ case EAttachChildResult::RejectAsNewerUnCreated:
+ Y_FAIL_S("MaterializeLeaf do not accept rejection: " << result);
+ break;
+ };
+}
+
+EAttachChildResult TPath::MaterializeImpl(const TString& owner, const TPathId& newPathId) {
+ const TString leafName = NameParts.back();
+ Rise();
+ Y_VERIFY(IsResolved());
+
+ TPathId domainId = Base()->IsDomainRoot() ? Base()->PathId : Base()->DomainPathId;
+ TPathElement::TPtr newPath = new TPathElement(newPathId, Base()->PathId, domainId, leafName, owner);
+
+ auto attachResult = SS->AttachChild(newPath);
+
Base()->DbRefCount++;
Base()->AllChildrenCount++;
-
- Y_VERIFY_S(!SS->PathsById.contains(newPathId), "There's another path with PathId: " << newPathId);
- SS->PathsById[newPathId] = newPath;
-
- DiveByPathId(newPathId);
- Y_VERIFY_S(IsResolved(),
- "not resolved,"
- << " path: " << PathString()
- << ", Elements size: " << Elements.size()
- << ", NameParts size: " << NameParts.size());
-
- return attachResult;
-}
-
-TPath& TPath::DiveByPathId(const TPathId& pathId) {
- Y_VERIFY(IsResolved());
-
- TPathElement::TPtr nextElem = SS->PathsById.at(pathId);
- Y_VERIFY(nextElem->ParentPathId == Elements.back()->PathId);
-
- Elements.push_back(nextElem);
- NameParts.push_back(nextElem->Name);
-
- return *this;
-}
-
-
-}}
+
+ Y_VERIFY_S(!SS->PathsById.contains(newPathId), "There's another path with PathId: " << newPathId);
+ SS->PathsById[newPathId] = newPath;
+
+ DiveByPathId(newPathId);
+ Y_VERIFY_S(IsResolved(),
+ "not resolved,"
+ << " path: " << PathString()
+ << ", Elements size: " << Elements.size()
+ << ", NameParts size: " << NameParts.size());
+
+ return attachResult;
+}
+
+TPath& TPath::DiveByPathId(const TPathId& pathId) {
+ Y_VERIFY(IsResolved());
+
+ TPathElement::TPtr nextElem = SS->PathsById.at(pathId);
+ Y_VERIFY(nextElem->ParentPathId == Elements.back()->PathId);
+
+ Elements.push_back(nextElem);
+ NameParts.push_back(nextElem->Name);
+
+ return *this;
+}
+
+
+}}
diff --git a/ydb/core/tx/schemeshard/schemeshard_path.h b/ydb/core/tx/schemeshard/schemeshard_path.h
index 0235f204820..fb33c1cdd98 100644
--- a/ydb/core/tx/schemeshard/schemeshard_path.h
+++ b/ydb/core/tx/schemeshard/schemeshard_path.h
@@ -1,171 +1,171 @@
-#pragma once
-
-#include "schemeshard.h"
-#include "schemeshard_path_element.h"
-#include "schemeshard_info_types.h"
-
-#include "schemeshard__operation_memory_changes.h"
-
+#pragma once
+
+#include "schemeshard.h"
+#include "schemeshard_path_element.h"
+#include "schemeshard_info_types.h"
+
+#include "schemeshard__operation_memory_changes.h"
+
#include <ydb/core/protos/flat_tx_scheme.pb.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-class TSchemeShard;
-
-class TPath {
-private:
- TSchemeShard* SS;
- TVector<TString> NameParts;
- TVector<TPathElement::TPtr> Elements;
-
-public:
- class TChecker {
- private:
- using EStatus = TEvSchemeShard::EStatus;
-
- const TPath& Path;
- mutable bool Failed;
- mutable EStatus Status;
- mutable TStringBuilder Explain;
-
- public:
- TChecker(const TPath& path);
-
- operator bool() const;
-
- EStatus GetStatus(TString* explain = nullptr) const;
- const TChecker& IsResolved(EStatus status = EStatus::StatusPathDoesNotExist) const;
- const TChecker& NotEmpty(EStatus status = EStatus::StatusNameConflict) const;
- const TChecker& NotRoot(EStatus status = EStatus::StatusNameConflict) const;
- const TChecker& NotResolved(EStatus status = EStatus::StatusNameConflict) const;
- const TChecker& NotDeleted(EStatus status = EStatus::StatusPathDoesNotExist) const;
- const TChecker& NotUnderDeleting(EStatus status = EStatus::StatusMultipleModifications) const;
- const TChecker& NotUnderDomainUpgrade(EStatus status = EStatus::StatusMultipleModifications) const;
- const TChecker& IsDeleted(EStatus status = EStatus::StatusMultipleModifications) const;
- const TChecker& IsUnderDeleting(EStatus status = EStatus::StatusMultipleModifications) const;
- const TChecker& IsUnderMoving(TPath::TChecker::EStatus status = EStatus::StatusMultipleModifications) const;
- const TChecker& NotUnderOperation(EStatus status = EStatus::StatusMultipleModifications) const;
- const TChecker& IsUnderCreating(EStatus status = EStatus::StatusInvalidParameter) const;
- const TChecker& IsUnderOperation(EStatus status = EStatus::StatusMultipleModifications) const;
- const TChecker& IsUnderTheSameOperation(TTxId txId, EStatus status = EStatus::StatusMultipleModifications) const;
- const TChecker& NotUnderTheSameOperation(TTxId txId, EStatus status = EStatus::StatusInvalidParameter) const;
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+class TSchemeShard;
+
+class TPath {
+private:
+ TSchemeShard* SS;
+ TVector<TString> NameParts;
+ TVector<TPathElement::TPtr> Elements;
+
+public:
+ class TChecker {
+ private:
+ using EStatus = TEvSchemeShard::EStatus;
+
+ const TPath& Path;
+ mutable bool Failed;
+ mutable EStatus Status;
+ mutable TStringBuilder Explain;
+
+ public:
+ TChecker(const TPath& path);
+
+ operator bool() const;
+
+ EStatus GetStatus(TString* explain = nullptr) const;
+ const TChecker& IsResolved(EStatus status = EStatus::StatusPathDoesNotExist) const;
+ const TChecker& NotEmpty(EStatus status = EStatus::StatusNameConflict) const;
+ const TChecker& NotRoot(EStatus status = EStatus::StatusNameConflict) const;
+ const TChecker& NotResolved(EStatus status = EStatus::StatusNameConflict) const;
+ const TChecker& NotDeleted(EStatus status = EStatus::StatusPathDoesNotExist) const;
+ const TChecker& NotUnderDeleting(EStatus status = EStatus::StatusMultipleModifications) const;
+ const TChecker& NotUnderDomainUpgrade(EStatus status = EStatus::StatusMultipleModifications) const;
+ const TChecker& IsDeleted(EStatus status = EStatus::StatusMultipleModifications) const;
+ const TChecker& IsUnderDeleting(EStatus status = EStatus::StatusMultipleModifications) const;
+ const TChecker& IsUnderMoving(TPath::TChecker::EStatus status = EStatus::StatusMultipleModifications) const;
+ const TChecker& NotUnderOperation(EStatus status = EStatus::StatusMultipleModifications) const;
+ const TChecker& IsUnderCreating(EStatus status = EStatus::StatusInvalidParameter) const;
+ const TChecker& IsUnderOperation(EStatus status = EStatus::StatusMultipleModifications) const;
+ const TChecker& IsUnderTheSameOperation(TTxId txId, EStatus status = EStatus::StatusMultipleModifications) const;
+ const TChecker& NotUnderTheSameOperation(TTxId txId, EStatus status = EStatus::StatusInvalidParameter) const;
const TChecker& NoOlapStore(EStatus status = EStatus::StatusNameConflict) const;
const TChecker& HasOlapStore(EStatus status = EStatus::StatusInvalidParameter) const;
const TChecker& IsOlapStore(EStatus status = EStatus::StatusNameConflict) const;
const TChecker& IsOlapTable(EStatus status = EStatus::StatusNameConflict) const;
const TChecker& IsSequence(EStatus status = EStatus::StatusNameConflict) const;
const TChecker& IsReplication(EStatus status = EStatus::StatusNameConflict) const;
- const TChecker& IsCommonSensePath(EStatus status = EStatus::StatusNameConflict) const;
- const TChecker& IsInsideTableIndexPath(EStatus status = EStatus::StatusNameConflict) const;
+ const TChecker& IsCommonSensePath(EStatus status = EStatus::StatusNameConflict) const;
+ const TChecker& IsInsideTableIndexPath(EStatus status = EStatus::StatusNameConflict) const;
const TChecker& IsInsideCdcStreamPath(EStatus status = EStatus::StatusNameConflict) const;
- const TChecker& IsTable(EStatus status = EStatus::StatusNameConflict) const;
- const TChecker& NotBackupTable(EStatus status = NKikimrScheme::StatusSchemeError) const;
- const TChecker& IsBlockStoreVolume(EStatus status = EStatus::StatusNameConflict) const;
+ const TChecker& IsTable(EStatus status = EStatus::StatusNameConflict) const;
+ const TChecker& NotBackupTable(EStatus status = NKikimrScheme::StatusSchemeError) const;
+ const TChecker& IsBlockStoreVolume(EStatus status = EStatus::StatusNameConflict) const;
const TChecker& IsFileStore(EStatus status = EStatus::StatusNameConflict) const;
- const TChecker& IsKesus(EStatus status = EStatus::StatusNameConflict) const;
+ const TChecker& IsKesus(EStatus status = EStatus::StatusNameConflict) const;
const TChecker& IsPQGroup(EStatus status = EStatus::StatusNameConflict) const;
- const TChecker& IsSubDomain(EStatus status = EStatus::StatusNameConflict) const;
- const TChecker& IsExternalSubDomain(EStatus status = EStatus::StatusNameConflict) const;
- const TChecker& IsAtLocalSchemeShard(EStatus status = EStatus::StatusRedirectDomain) const;
- const TChecker& IsSolomon(EStatus status = EStatus::StatusNameConflict) const;
- const TChecker& IsTableIndex(EStatus status = EStatus::StatusNameConflict) const;
+ const TChecker& IsSubDomain(EStatus status = EStatus::StatusNameConflict) const;
+ const TChecker& IsExternalSubDomain(EStatus status = EStatus::StatusNameConflict) const;
+ const TChecker& IsAtLocalSchemeShard(EStatus status = EStatus::StatusRedirectDomain) const;
+ const TChecker& IsSolomon(EStatus status = EStatus::StatusNameConflict) const;
+ const TChecker& IsTableIndex(EStatus status = EStatus::StatusNameConflict) const;
const TChecker& IsCdcStream(EStatus status = EStatus::StatusNameConflict) const;
- const TChecker& IsLikeDirectory(EStatus status = EStatus::StatusPathIsNotDirectory) const;
- const TChecker& IsDirectory(EStatus status = EStatus::StatusPathIsNotDirectory) const;
- const TChecker& IsTheSameDomain(const TPath& another, EStatus status = EStatus::StatusInvalidParameter) const;
- const TChecker& FailOnExist(TSet<TPathElement::EPathType> expectedTypes, bool acceptAlreadyExist) const;
- const TChecker& FailOnExist(TPathElement::EPathType expectedType, bool acceptAlreadyExist) const;
- const TChecker& IsValidLeafName(EStatus status = EStatus::StatusSchemeError) const;
- const TChecker& DepthLimit(ui64 delta = 0, EStatus status = EStatus::StatusSchemeError) const;
+ const TChecker& IsLikeDirectory(EStatus status = EStatus::StatusPathIsNotDirectory) const;
+ const TChecker& IsDirectory(EStatus status = EStatus::StatusPathIsNotDirectory) const;
+ const TChecker& IsTheSameDomain(const TPath& another, EStatus status = EStatus::StatusInvalidParameter) const;
+ const TChecker& FailOnExist(TSet<TPathElement::EPathType> expectedTypes, bool acceptAlreadyExist) const;
+ const TChecker& FailOnExist(TPathElement::EPathType expectedType, bool acceptAlreadyExist) const;
+ const TChecker& IsValidLeafName(EStatus status = EStatus::StatusSchemeError) const;
+ const TChecker& DepthLimit(ui64 delta = 0, EStatus status = EStatus::StatusSchemeError) const;
const TChecker& PathsLimit(ui64 delta = 1, EStatus status = EStatus::StatusResourceExhausted) const;
const TChecker& DirChildrenLimit(ui64 delta = 1, EStatus status = EStatus::StatusResourceExhausted) const;
const TChecker& ShardsLimit(ui64 delta = 1, EStatus status = EStatus::StatusResourceExhausted) const;
const TChecker& PathShardsLimit(ui64 delta = 1, EStatus status = EStatus::StatusResourceExhausted) const;
- const TChecker& NotChildren(EStatus status = EStatus::StatusInvalidParameter) const;
+ const TChecker& NotChildren(EStatus status = EStatus::StatusInvalidParameter) const;
const TChecker& IsValidACL(const TString& acl, EStatus status = EStatus::StatusInvalidParameter) const;
const TChecker& PQPartitionsLimit(ui64 delta = 1, EStatus status = EStatus::StatusResourceExhausted) const;
const TChecker& PQReservedStorageLimit(ui64 delta = 1, EStatus status = EStatus::StatusResourceExhausted) const;
- };
-
-public:
- explicit TPath(TSchemeShard* ss);
- TPath(TVector<TPathElement::TPtr>&& elements, TSchemeShard* ss);
-
- TPath(const TPath& path) = default;
- TPath(TPath&& path) = default;
-
- TPath& operator = (TPath&& another) = default;
-
- bool operator ==(const TPath& another) const;
- bool operator !=(const TPath& another) const;
-
- explicit operator bool() const;
-
- static TPath Resolve(const TString path, TSchemeShard* ss);
- static TPath Resolve(const TPath& prefix, TVector<TString>&& pathParts);
- static TPath ResolveWithInactive(TOperationId opId, const TString path, TSchemeShard* ss);
-
- static TPath Init(const TPathId pathId, TSchemeShard* ss);
-
- TChecker Check() const;
- bool IsEmpty() const;
- bool IsResolved() const;
-
- static TPath Root(TSchemeShard* ss);
- TString PathString() const;
- TPath& Rise();
- TPath Parent() const;
- TPath& RiseUntilFirstResolvedParent();
- TPath FirstResoledParent() const;
- TPath& RiseUntilExisted();
- TPath FirstExistedParent() const;
- TSubDomainInfo::TPtr DomainInfo() const;
- TPathId DomainId() const;
- bool IsDomain() const;
- TPath& Dive(const TString& name);
- TPath Child(const TString& name) const;
- TPathElement::TPtr Base() const;
+ };
+
+public:
+ explicit TPath(TSchemeShard* ss);
+ TPath(TVector<TPathElement::TPtr>&& elements, TSchemeShard* ss);
+
+ TPath(const TPath& path) = default;
+ TPath(TPath&& path) = default;
+
+ TPath& operator = (TPath&& another) = default;
+
+ bool operator ==(const TPath& another) const;
+ bool operator !=(const TPath& another) const;
+
+ explicit operator bool() const;
+
+ static TPath Resolve(const TString path, TSchemeShard* ss);
+ static TPath Resolve(const TPath& prefix, TVector<TString>&& pathParts);
+ static TPath ResolveWithInactive(TOperationId opId, const TString path, TSchemeShard* ss);
+
+ static TPath Init(const TPathId pathId, TSchemeShard* ss);
+
+ TChecker Check() const;
+ bool IsEmpty() const;
+ bool IsResolved() const;
+
+ static TPath Root(TSchemeShard* ss);
+ TString PathString() const;
+ TPath& Rise();
+ TPath Parent() const;
+ TPath& RiseUntilFirstResolvedParent();
+ TPath FirstResoledParent() const;
+ TPath& RiseUntilExisted();
+ TPath FirstExistedParent() const;
+ TSubDomainInfo::TPtr DomainInfo() const;
+ TPathId DomainId() const;
+ bool IsDomain() const;
+ TPath& Dive(const TString& name);
+ TPath Child(const TString& name) const;
+ TPathElement::TPtr Base() const;
TPathElement* operator->() const;
- bool IsDeleted() const;
- bool IsUnderOperation() const;
- TTxId ActiveOperation() const;
- bool IsUnderCreating() const;
- bool IsUnderAltering() const;
- bool IsUnderDomainUpgrade() const;
- bool IsUnderCopying() const;
- bool IsUnderBackuping() const;
+ bool IsDeleted() const;
+ bool IsUnderOperation() const;
+ TTxId ActiveOperation() const;
+ bool IsUnderCreating() const;
+ bool IsUnderAltering() const;
+ bool IsUnderDomainUpgrade() const;
+ bool IsUnderCopying() const;
+ bool IsUnderBackuping() const;
bool IsUnderRestoring() const;
- bool IsUnderDeleting() const;
- bool IsUnderMoving() const;
+ bool IsUnderDeleting() const;
+ bool IsUnderMoving() const;
TPath& RiseUntilOlapStore();
TPath FindOlapStore() const;
- bool IsCommonSensePath() const;
- bool AtLocalSchemeShardPath() const;
- bool IsInsideTableIndexPath() const;
+ bool IsCommonSensePath() const;
+ bool AtLocalSchemeShardPath() const;
+ bool IsInsideTableIndexPath() const;
bool IsInsideCdcStreamPath() const;
bool IsTableIndex() const;
- bool IsBackupTable() const;
+ bool IsBackupTable() const;
bool IsCdcStream() const;
bool IsSequence() const;
bool IsReplication() const;
- ui32 Depth() const;
- ui64 Shards() const;
- const TString& LeafName() const;
- bool IsValidLeafName(TString& explain) const;
- TString GetEffectiveACL() const;
- ui64 GetEffectiveACLVersion() const;
- TTxId LockedBy() const;
-
- bool IsActive() const;
- void Activate();
-
- void MaterializeLeaf(const TString& owner);
- void MaterializeLeaf(const TString& owner, const TPathId& newPathId, bool allowInactivePath = false);
-
-private:
- EAttachChildResult MaterializeImpl(const TString& owner, const TPathId& newPathId);
- TPath& DiveByPathId(const TPathId& pathId);
-};
-
-}}
+ ui32 Depth() const;
+ ui64 Shards() const;
+ const TString& LeafName() const;
+ bool IsValidLeafName(TString& explain) const;
+ TString GetEffectiveACL() const;
+ ui64 GetEffectiveACLVersion() const;
+ TTxId LockedBy() const;
+
+ bool IsActive() const;
+ void Activate();
+
+ void MaterializeLeaf(const TString& owner);
+ void MaterializeLeaf(const TString& owner, const TPathId& newPathId, bool allowInactivePath = false);
+
+private:
+ EAttachChildResult MaterializeImpl(const TString& owner, const TPathId& newPathId);
+ TPath& DiveByPathId(const TPathId& pathId);
+};
+
+}}
diff --git a/ydb/core/tx/schemeshard/schemeshard_path_describer.cpp b/ydb/core/tx/schemeshard/schemeshard_path_describer.cpp
index f1754c35755..3789d3af1b8 100644
--- a/ydb/core/tx/schemeshard/schemeshard_path_describer.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_path_describer.cpp
@@ -7,7 +7,7 @@
#include <util/stream/format.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
static void FillTableStats(NKikimrTableStats::TTableStats* stats, const TTableInfo::TPartitionStats& tableStats) {
stats->SetRowCount(tableStats.RowCount);
@@ -42,44 +42,44 @@ static void FillTableMetrics(NKikimrTabletBase::TMetrics* metrics, const TTableI
metrics->SetWriteIops(tableStats.WriteIops);
}
-void TPathDescriber::FillPathDescr(NKikimrSchemeOp::TDirEntry* descr, TPathElement::TPtr pathEl, TPathElement::EPathSubType subType) {
- FillChildDescr(descr, pathEl);
-
- descr->SetACL(pathEl->ACL);
- descr->SetPathSubType(subType);
-}
-
-void TPathDescriber::FillChildDescr(NKikimrSchemeOp::TDirEntry* descr, TPathElement::TPtr pathEl) {
+void TPathDescriber::FillPathDescr(NKikimrSchemeOp::TDirEntry* descr, TPathElement::TPtr pathEl, TPathElement::EPathSubType subType) {
+ FillChildDescr(descr, pathEl);
+
+ descr->SetACL(pathEl->ACL);
+ descr->SetPathSubType(subType);
+}
+
+void TPathDescriber::FillChildDescr(NKikimrSchemeOp::TDirEntry* descr, TPathElement::TPtr pathEl) {
bool createFinished = pathEl->IsCreateFinished();
descr->SetName(pathEl->Name);
-
- descr->SetSchemeshardId(pathEl->PathId.OwnerId);
- descr->SetPathId(pathEl->PathId.LocalPathId);
-
- descr->SetParentPathId(pathEl->ParentPathId.LocalPathId); //???? ParnetPathOwnerId
-
+
+ descr->SetSchemeshardId(pathEl->PathId.OwnerId);
+ descr->SetPathId(pathEl->PathId.LocalPathId);
+
+ descr->SetParentPathId(pathEl->ParentPathId.LocalPathId); //???? ParnetPathOwnerId
+
descr->SetPathType(pathEl->PathType);
- descr->SetOwner(pathEl->Owner);
-
- descr->SetPathState(pathEl->PathState); // ???? can't be consistent KIKIMR-8861
- descr->SetCreateFinished(createFinished); // use this insted PathState
-
- descr->SetCreateTxId(ui64(pathEl->CreateTxId));
- if (createFinished) {
- descr->SetCreateStep(ui64(pathEl->StepCreated));
- }
-
- if (pathEl->PathType == NKikimrSchemeOp::EPathTypePersQueueGroup) {
+ descr->SetOwner(pathEl->Owner);
+
+ descr->SetPathState(pathEl->PathState); // ???? can't be consistent KIKIMR-8861
+ descr->SetCreateFinished(createFinished); // use this insted PathState
+
+ descr->SetCreateTxId(ui64(pathEl->CreateTxId));
+ if (createFinished) {
+ descr->SetCreateStep(ui64(pathEl->StepCreated));
+ }
+
+ if (pathEl->PathType == NKikimrSchemeOp::EPathTypePersQueueGroup) {
auto it = Self->PersQueueGroups.FindPtr(pathEl->PathId);
Y_VERIFY(it, "PersQueueGroup is not found");
TPersQueueGroupInfo::TPtr pqGroupInfo = *it;
if (pqGroupInfo->HasBalancer()) {
- descr->SetBalancerTabletID(ui64(pqGroupInfo->BalancerTabletID));
+ descr->SetBalancerTabletID(ui64(pqGroupInfo->BalancerTabletID));
}
- } else {
- descr->SetACL(pathEl->ACL); // YDBOPS-1328
+ } else {
+ descr->SetACL(pathEl->ACL); // YDBOPS-1328
}
}
@@ -113,80 +113,80 @@ TPathElement::EPathSubType TPathDescriber::CalcPathSubType(const TPath& path) {
return TPathElement::EPathSubType::EPathSubTypeEmpty;
}
-void TPathDescriber::FillPathDescr(NKikimrSchemeOp::TDirEntry* descr, const TPath& path) {
+void TPathDescriber::FillPathDescr(NKikimrSchemeOp::TDirEntry* descr, const TPath& path) {
FillPathDescr(descr, path.Base(), CalcPathSubType(path));
}
-void TPathDescriber::BuildEffectiveACL(NKikimrSchemeOp::TDirEntry* descr, const TPath& path) {
- descr->SetEffectiveACL(path.GetEffectiveACL());
+void TPathDescriber::BuildEffectiveACL(NKikimrSchemeOp::TDirEntry* descr, const TPath& path) {
+ descr->SetEffectiveACL(path.GetEffectiveACL());
}
void TPathDescriber::FillLastExistedPrefixDescr(const TPath& path) {
- if (path.IsEmpty()) {
+ if (path.IsEmpty()) {
return;
}
- Y_VERIFY(path.IsResolved());
- Y_VERIFY(!path.IsDeleted());
+ Y_VERIFY(path.IsResolved());
+ Y_VERIFY(!path.IsDeleted());
- Result->Record.SetLastExistedPrefixPathId(path.Base()->PathId.LocalPathId);
- Result->Record.SetLastExistedPrefixPath(path.PathString());
+ Result->Record.SetLastExistedPrefixPathId(path.Base()->PathId.LocalPathId);
+ Result->Record.SetLastExistedPrefixPath(path.PathString());
- Y_VERIFY_S(Self->PathsById.contains(path.Base()->PathId), "Unknown pathId " << path.Base()->PathId);
+ Y_VERIFY_S(Self->PathsById.contains(path.Base()->PathId), "Unknown pathId " << path.Base()->PathId);
auto descr = Result->Record.MutableLastExistedPrefixDescription()->MutableSelf();
FillPathDescr(descr, path);
- BuildEffectiveACL(descr, path);
+ BuildEffectiveACL(descr, path);
}
-void TPathDescriber::DescribeChildren(const TPath& path) {
- auto pathEl = path.Base();
-
- if (!Params.GetOptions().GetReturnChildren()) {
+void TPathDescriber::DescribeChildren(const TPath& path) {
+ auto pathEl = path.Base();
+
+ if (!Params.GetOptions().GetReturnChildren()) {
+ return;
+ }
+
+ if (pathEl->IsTable()) {
return;
}
- if (pathEl->IsTable()) {
- return;
- }
-
if (pathEl->PreSerializedChildrenListing.empty()) {
- NKikimrScheme::TEvDescribeSchemeResult preSerializedResult;
+ NKikimrScheme::TEvDescribeSchemeResult preSerializedResult;
auto pathDescription = preSerializedResult.MutablePathDescription();
- pathDescription->MutableChildren()->Reserve(pathEl->GetAliveChildren());
+ pathDescription->MutableChildren()->Reserve(pathEl->GetAliveChildren());
for (const auto& child : pathEl->GetChildren()) {
TPathId childId = child.second;
TPathElement::TPtr childEl = *Self->PathsById.FindPtr(childId);
- if (childEl->Dropped() || childEl->IsMigrated()) {
+ if (childEl->Dropped() || childEl->IsMigrated()) {
continue;
}
auto entry = pathDescription->AddChildren();
-
- if (pathEl->IsTableIndex()) {
- // we put version of child here in addition
- auto childPath = path.Child(child.first);
- FillPathDescr(entry, childEl, CalcPathSubType(childPath));
- const auto version = Self->GetPathVersion(childPath);
- entry->MutableVersion()->CopyFrom(version);
+
+ if (pathEl->IsTableIndex()) {
+ // we put version of child here in addition
+ auto childPath = path.Child(child.first);
+ FillPathDescr(entry, childEl, CalcPathSubType(childPath));
+ const auto version = Self->GetPathVersion(childPath);
+ entry->MutableVersion()->CopyFrom(version);
} else if (pathEl->IsCdcStream()) {
auto childPath = path.Child(child.first);
FillPathDescr(entry, childEl, CalcPathSubType(childPath));
- } else {
- FillChildDescr(entry, childEl);
- }
+ } else {
+ FillChildDescr(entry, childEl);
+ }
}
Y_PROTOBUF_SUPPRESS_NODISCARD preSerializedResult.SerializeToString(&pathEl->PreSerializedChildrenListing);
}
Result->PreSerializedData += pathEl->PreSerializedChildrenListing;
-
+
if (!pathEl->IsCreateFinished()) {
pathEl->PreSerializedChildrenListing.clear();
}
}
-
-void TPathDescriber::DescribeDir(const TPath& path) {
- DescribeChildren(path);
-}
-
+
+void TPathDescriber::DescribeDir(const TPath& path) {
+ DescribeChildren(path);
+}
+
void TPathDescriber::DescribeTable(const TActorContext& ctx, TPathId pathId, TPathElement::TPtr pathEl) {
const NScheme::TTypeRegistry* typeRegistry = AppData(ctx)->TypeRegistry;
const TTableInfo::TPtr tableInfo = *Self->Tables.FindPtr(pathId);
@@ -211,16 +211,16 @@ void TPathDescriber::DescribeTable(const TActorContext& ctx, TPathId pathId, TPa
if (returnPartitioning) {
// partitions
if (tableInfo->PreSerializedPathDescription.empty()) {
- NKikimrScheme::TEvDescribeSchemeResult preSerializedResult;
- NKikimrSchemeOp::TPathDescription& pathDescription = *preSerializedResult.MutablePathDescription();
+ NKikimrScheme::TEvDescribeSchemeResult preSerializedResult;
+ NKikimrSchemeOp::TPathDescription& pathDescription = *preSerializedResult.MutablePathDescription();
pathDescription.MutableTablePartitions()->Reserve(tableInfo->GetPartitions().size());
for (auto& p : tableInfo->GetPartitions()) {
auto part = pathDescription.AddTablePartitions();
- auto datashardIdx = p.ShardIdx;
- auto datashardTabletId = Self->ShardInfos[datashardIdx].TabletID;
+ auto datashardIdx = p.ShardIdx;
+ auto datashardTabletId = Self->ShardInfos[datashardIdx].TabletID;
// Currently we only support uniform partitioning where each range is [start, end)
// +inf as the end of the last range is represented by empty TCell vector
- part->SetDatashardId(ui64(datashardTabletId));
+ part->SetDatashardId(ui64(datashardTabletId));
part->SetIsPoint(false);
part->SetIsInclusive(false);
part->SetEndOfRangeKeyPrefix(p.EndOfRange);
@@ -246,7 +246,7 @@ void TPathDescriber::DescribeTable(const TActorContext& ctx, TPathId pathId, TPa
}
if (returnPartitionStats) {
- NKikimrSchemeOp::TPathDescription& pathDescription = *Result->Record.MutablePathDescription();
+ NKikimrSchemeOp::TPathDescription& pathDescription = *Result->Record.MutablePathDescription();
pathDescription.MutableTablePartitionStats()->Reserve(tableInfo->GetPartitions().size());
for (auto& p : tableInfo->GetPartitions()) {
const auto* stats = tableInfo->GetStats().PartitionStats.FindPtr(p.ShardIdx);
@@ -281,17 +281,17 @@ void TPathDescriber::DescribeTable(const TActorContext& ctx, TPathId pathId, TPa
progress->MutableYTSettings()->CopyFrom(
tableInfo->BackupSettings.GetYTSettings());
progress->SetDataTotalSize(txState.DataTotalSize);
- progress->SetTxId(ui64(txId));
+ progress->SetTxId(ui64(txId));
- LOG_TRACE(ctx, NKikimrServices::SCHEMESHARD_DESCRIBE,
+ LOG_TRACE(ctx, NKikimrServices::SCHEMESHARD_DESCRIBE,
"Add backup process info");
break;
}
/* Get information about last completed backup */
for (const auto& iter: tableInfo->BackupHistory) {
- LOG_TRACE(ctx, NKikimrServices::SCHEMESHARD_DESCRIBE,
- "Add last backup info item to history");
+ LOG_TRACE(ctx, NKikimrServices::SCHEMESHARD_DESCRIBE,
+ "Add last backup info item to history");
auto protoResult = pathDescription->AddLastBackupResult();
const auto& txId = iter.first;
const auto& tInfoResult = iter.second;
@@ -302,7 +302,7 @@ void TPathDescriber::DescribeTable(const TActorContext& ctx, TPathId pathId, TPa
protoResult->SetStartTimeStamp(tInfoResult.StartDateTime);
protoResult->SetDataTotalSize(
tInfoResult.DataTotalSize);
- protoResult->SetTxId(ui64(txId));
+ protoResult->SetTxId(ui64(txId));
for (const auto& [shardId, status]: tInfoResult.ShardStatuses) {
if (status.Success) {
@@ -324,17 +324,17 @@ void TPathDescriber::DescribeTable(const TActorContext& ctx, TPathId pathId, TPa
auto childPath = Self->PathsById.at(childPathId);
if (childPath->Dropped()) {
- continue;
- }
-
+ continue;
+ }
+
switch (childPath->PathType) {
- case NKikimrSchemeOp::EPathTypeTableIndex:
+ case NKikimrSchemeOp::EPathTypeTableIndex:
Self->DescribeTableIndex(childPathId, childName, *entry->AddTableIndexes());
break;
- case NKikimrSchemeOp::EPathTypeCdcStream:
+ case NKikimrSchemeOp::EPathTypeCdcStream:
Self->DescribeCdcStream(childPathId, childName, *entry->AddCdcStreams());
break;
- case NKikimrSchemeOp::EPathTypeSequence:
+ case NKikimrSchemeOp::EPathTypeSequence:
Self->DescribeSequence(childPathId, childName, *entry->AddSequences());
break;
default:
@@ -402,10 +402,10 @@ void TPathDescriber::DescribePersQueueGroup(TPathId pathId, TPathElement::TPtr p
TPersQueueGroupInfo::TPtr pqGroupInfo = *it;
if (pqGroupInfo->PreSerializedPathDescription.empty()) {
- NKikimrScheme::TEvDescribeSchemeResult preSerializedResult;
+ NKikimrScheme::TEvDescribeSchemeResult preSerializedResult;
auto entry = preSerializedResult.MutablePathDescription()->MutablePersQueueGroup();
entry->SetName(pathEl->Name);
- entry->SetPathId(pathId.LocalPathId);
+ entry->SetPathId(pathId.LocalPathId);
entry->SetNextPartitionId(pqGroupInfo->NextPartitionId);
entry->SetTotalGroupCount(pqGroupInfo->TotalGroupCount);
entry->SetPartitionPerTablet(pqGroupInfo->MaxPartsPerTablet);
@@ -413,7 +413,7 @@ void TPathDescriber::DescribePersQueueGroup(TPathId pathId, TPathElement::TPtr p
Y_PROTOBUF_SUPPRESS_NODISCARD entry->MutablePQTabletConfig()->ParseFromString(pqGroupInfo->TabletConfig);
if (pqGroupInfo->HasBalancer()) {
- entry->SetBalancerTabletID(ui64(pqGroupInfo->BalancerTabletID));
+ entry->SetBalancerTabletID(ui64(pqGroupInfo->BalancerTabletID));
}
Y_PROTOBUF_SUPPRESS_NODISCARD preSerializedResult.SerializeToString(&pqGroupInfo->PreSerializedPathDescription);
@@ -425,7 +425,7 @@ void TPathDescriber::DescribePersQueueGroup(TPathId pathId, TPathElement::TPtr p
bool returnPartitioning = Params.GetReturnPartitioningInfo();
if (returnPartitioning) {
if (pqGroupInfo->PreSerializedPartitionsDescription.empty()) {
- NKikimrScheme::TEvDescribeSchemeResult preSerializedResult;
+ NKikimrScheme::TEvDescribeSchemeResult preSerializedResult;
auto entry = preSerializedResult.MutablePathDescription()->MutablePersQueueGroup();
struct TPartitionDesc {
@@ -485,14 +485,14 @@ void TPathDescriber::DescribeRtmrVolume(TPathId pathId, TPathElement::TPtr pathE
auto entry = Result->Record.MutablePathDescription()->MutableRtmrVolumeDescription();
entry->SetName(pathEl->Name);
- entry->SetPathId(pathId.LocalPathId);
+ entry->SetPathId(pathId.LocalPathId);
entry->SetPartitionsCount(rtmrVolumeInfo->Partitions.size());
for (const auto& partition: rtmrVolumeInfo->Partitions) {
auto part = entry->AddPartitions();
part->SetPartitionId((const char*)partition.second->Id.dw, sizeof(TGUID));
part->SetBusKey(partition.second->BusKey);
- part->SetTabletId(ui64(partition.second->TabletId));
+ part->SetTabletId(ui64(partition.second->TabletId));
}
Sort(entry->MutablePartitions()->begin(),
@@ -502,10 +502,10 @@ void TPathDescriber::DescribeRtmrVolume(TPathId pathId, TPathElement::TPtr pathE
});
}
-void TPathDescriber::DescribeTableIndex(const TPath& path) {
+void TPathDescriber::DescribeTableIndex(const TPath& path) {
Self->DescribeTableIndex(path.Base()->PathId, path.Base()->Name,
*Result->Record.MutablePathDescription()->MutableTableIndex());
- DescribeChildren(path);
+ DescribeChildren(path);
}
void TPathDescriber::DescribeCdcStream(const TPath& path) {
@@ -521,7 +521,7 @@ void TPathDescriber::DescribeSolomonVolume(TPathId pathId, TPathElement::TPtr pa
auto entry = Result->Record.MutablePathDescription()->MutableSolomonDescription();
entry->SetName(pathEl->Name);
- entry->SetPathId(pathId.LocalPathId);
+ entry->SetPathId(pathId.LocalPathId);
entry->SetPartitionCount(solomonVolumeInfo->Partitions.size());
for (const auto& partition: solomonVolumeInfo->Partitions) {
@@ -531,10 +531,10 @@ void TPathDescriber::DescribeSolomonVolume(TPathId pathId, TPathElement::TPtr pa
auto part = entry->AddPartitions();
part->SetPartitionId(partition.second->PartitionId);
- part->SetShardIdx(ui64(shardId.GetLocalId()));
+ part->SetShardIdx(ui64(shardId.GetLocalId()));
auto tabletId = partition.second->TabletId;
if (tabletId != InvalidTabletId) {
- part->SetTabletId(ui64(partition.second->TabletId));
+ part->SetTabletId(ui64(partition.second->TabletId));
}
if (returnChannelsBinding) {
@@ -565,53 +565,53 @@ void TPathDescriber::DescribeUserAttributes(TPathElement::TPtr pathEl) {
pathEl->SerializeRuntimeAttrs(userAttrs);
}
-void TPathDescriber::DescribePathVersion(const TPath& path) {
+void TPathDescriber::DescribePathVersion(const TPath& path) {
const auto& version = Self->GetPathVersion(path);
Result->Record.MutablePathDescription()->MutableSelf()->SetPathVersion(version.GetGeneralVersion());
Result->Record.MutablePathDescription()->MutableSelf()->MutableVersion()->CopyFrom(version);
}
-void TPathDescriber::DescribeDomain(TPathElement::TPtr pathEl) {
- TPathId domainId = Self->ResolveDomainId(pathEl);
+void TPathDescriber::DescribeDomain(TPathElement::TPtr pathEl) {
+ TPathId domainId = Self->ResolveDomainId(pathEl);
+
+ TPathElement::TPtr domainEl = Self->PathsById.at(domainId);
+ Y_VERIFY(domainEl);
- TPathElement::TPtr domainEl = Self->PathsById.at(domainId);
- Y_VERIFY(domainEl);
-
- DescribeDomainRoot(domainEl);
+ DescribeDomainRoot(domainEl);
}
-void TPathDescriber::DescribeRevertedMigrations(TPathElement::TPtr pathEl) {
- Y_VERIFY(pathEl->IsDomainRoot());
-
- if (!Self->RevertedMigrations.contains(pathEl->PathId)) {
- return;
- }
-
- auto list = Result->Record.MutablePathDescription()->MutableAbandonedTenantsSchemeShards();
- for (const TTabletId& abandonedSchemeShardId: Self->RevertedMigrations.at(pathEl->PathId)) {
- list->Add(ui64(abandonedSchemeShardId));
- }
-}
-
-void TPathDescriber::DescribeDomainRoot(TPathElement::TPtr pathEl) {
- Y_VERIFY(pathEl->IsDomainRoot());
+void TPathDescriber::DescribeRevertedMigrations(TPathElement::TPtr pathEl) {
+ Y_VERIFY(pathEl->IsDomainRoot());
+
+ if (!Self->RevertedMigrations.contains(pathEl->PathId)) {
+ return;
+ }
+
+ auto list = Result->Record.MutablePathDescription()->MutableAbandonedTenantsSchemeShards();
+ for (const TTabletId& abandonedSchemeShardId: Self->RevertedMigrations.at(pathEl->PathId)) {
+ list->Add(ui64(abandonedSchemeShardId));
+ }
+}
+
+void TPathDescriber::DescribeDomainRoot(TPathElement::TPtr pathEl) {
+ Y_VERIFY(pathEl->IsDomainRoot());
auto it = Self->SubDomains.FindPtr(pathEl->PathId);
Y_VERIFY(it, "SubDomain not found");
auto subDomainInfo = *it;
NKikimrSubDomains::TDomainDescription * entry = Result->Record.MutablePathDescription()->MutableDomainDescription();
-
+
NKikimrSubDomains::TDomainKey *key = entry->MutableDomainKey();
- entry->SetSchemeShardId_Depricated(Self->ParentDomainId.OwnerId);
- entry->SetPathId_Depricated(Self->ParentDomainId.LocalPathId);
-
- if (pathEl->IsRoot()) {
- key->SetSchemeShard(Self->ParentDomainId.OwnerId);
- key->SetPathId(Self->ParentDomainId.LocalPathId);
- } else {
- key->SetSchemeShard(pathEl->PathId.OwnerId);
- key->SetPathId(pathEl->PathId.LocalPathId);
- }
+ entry->SetSchemeShardId_Depricated(Self->ParentDomainId.OwnerId);
+ entry->SetPathId_Depricated(Self->ParentDomainId.LocalPathId);
+
+ if (pathEl->IsRoot()) {
+ key->SetSchemeShard(Self->ParentDomainId.OwnerId);
+ key->SetPathId(Self->ParentDomainId.LocalPathId);
+ } else {
+ key->SetSchemeShard(pathEl->PathId.OwnerId);
+ key->SetPathId(pathEl->PathId.LocalPathId);
+ }
entry->MutableProcessingParams()->CopyFrom(subDomainInfo->GetProcessingParams());
@@ -668,10 +668,10 @@ void TPathDescriber::DescribeBlockStoreVolume(TPathId pathId, TPathElement::TPtr
auto* entry = Result->Record.MutablePathDescription()->MutableBlockStoreVolumeDescription();
entry->SetName(pathEl->Name);
- entry->SetPathId(pathId.LocalPathId);
+ entry->SetPathId(pathId.LocalPathId);
entry->MutableVolumeConfig()->CopyFrom(volume->VolumeConfig);
entry->MutableVolumeConfig()->SetVersion(volume->AlterVersion);
- entry->SetVolumeTabletId(ui64(volume->VolumeTabletId));
+ entry->SetVolumeTabletId(ui64(volume->VolumeTabletId));
entry->SetAlterVersion(volume->AlterVersion);
entry->SetMountToken(volume->MountToken);
entry->SetTokenVersion(volume->TokenVersion);
@@ -680,7 +680,7 @@ void TPathDescriber::DescribeBlockStoreVolume(TPathId pathId, TPathElement::TPtr
for (ui32 idx = 0; idx < tablets.size(); ++idx) {
auto* part = entry->AddPartitions();
part->SetPartitionId(idx);
- part->SetTabletId(ui64(tablets[idx]));
+ part->SetTabletId(ui64(tablets[idx]));
}
}
@@ -711,10 +711,10 @@ void TPathDescriber::DescribeKesus(TPathId pathId, TPathElement::TPtr pathEl) {
auto* entry = Result->Record.MutablePathDescription()->MutableKesus();
entry->SetName(pathEl->Name);
- entry->SetPathId(pathId.LocalPathId);
- if (kesus->KesusTabletId) {
- entry->SetKesusTabletId(ui64(kesus->KesusTabletId));
- }
+ entry->SetPathId(pathId.LocalPathId);
+ if (kesus->KesusTabletId) {
+ entry->SetKesusTabletId(ui64(kesus->KesusTabletId));
+ }
entry->MutableConfig()->CopyFrom(kesus->Config);
entry->SetVersion(kesus->Version);
}
@@ -729,8 +729,8 @@ void TPathDescriber::DescribeReplication(TPathId pathId, TPathElement::TPtr path
Self->DescribeReplication(pathId, pathEl->Name, *Result->Record.MutablePathDescription()->MutableReplicationDescription());
}
-THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder> TPathDescriber::Describe(const TActorContext& ctx) {
- TPathId pathId = Params.HasPathId() ? TPathId(Params.GetSchemeshardId(), Params.GetPathId()) : InvalidPathId;
+THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder> TPathDescriber::Describe(const TActorContext& ctx) {
+ TPathId pathId = Params.HasPathId() ? TPathId(Params.GetSchemeshardId(), Params.GetPathId()) : InvalidPathId;
TString pathStr = Params.GetPath();
TPath path = Params.HasPathId()
@@ -739,8 +739,8 @@ THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder> TPathDescriber::Describe
{
TPath::TChecker checks = path.Check();
checks
- .NotEmpty(NKikimrScheme::StatusPathDoesNotExist)
- .IsAtLocalSchemeShard()
+ .NotEmpty(NKikimrScheme::StatusPathDoesNotExist)
+ .IsAtLocalSchemeShard()
.IsResolved();
if (checks) {
@@ -752,149 +752,149 @@ THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder> TPathDescriber::Describe
}
checks
- .NotDeleted();
-
- if (checks && !path.Base()->IsTable() && !path.Base()->IsTableIndex() && !path.Base()->IsDirectory()) {
- // KIKIMR-13173
- // PQ BSV drop their shard before PlatStep
- // If they are being deleted consider them as deleted
- checks.NotUnderDeleting(NKikimrScheme::StatusPathDoesNotExist);
- }
-
- if (!Params.GetOptions().GetShowPrivateTable()) {
- checks.IsCommonSensePath();
- }
-
+ .NotDeleted();
+
+ if (checks && !path.Base()->IsTable() && !path.Base()->IsTableIndex() && !path.Base()->IsDirectory()) {
+ // KIKIMR-13173
+ // PQ BSV drop their shard before PlatStep
+ // If they are being deleted consider them as deleted
+ checks.NotUnderDeleting(NKikimrScheme::StatusPathDoesNotExist);
+ }
+
+ if (!Params.GetOptions().GetShowPrivateTable()) {
+ checks.IsCommonSensePath();
+ }
+
if (!checks) {
TString explain;
auto status = checks.GetStatus(&explain);
- if (Params.HasPathId()) {
- pathStr = path.PathString();
- }
-
- Result.Reset(new TEvSchemeShard::TEvDescribeSchemeResultBuilder(
- pathStr,
- Self->TabletID(),
- pathId
+ if (Params.HasPathId()) {
+ pathStr = path.PathString();
+ }
+
+ Result.Reset(new TEvSchemeShard::TEvDescribeSchemeResultBuilder(
+ pathStr,
+ Self->TabletID(),
+ pathId
));
Result->Record.SetStatus(status);
Result->Record.SetReason(explain);
- TPath firstExisted = path.FirstExistedParent();
- FillLastExistedPrefixDescr(firstExisted);
-
- if (status == NKikimrScheme::StatusRedirectDomain) {
- DescribeDomain(firstExisted.Base());
- }
-
+ TPath firstExisted = path.FirstExistedParent();
+ FillLastExistedPrefixDescr(firstExisted);
+
+ if (status == NKikimrScheme::StatusRedirectDomain) {
+ DescribeDomain(firstExisted.Base());
+ }
+
return std::move(Result);
}
}
- Result = MakeHolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder>(pathStr, Self->TabletID(), pathId);
+ Result = MakeHolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder>(pathStr, Self->TabletID(), pathId);
auto descr = Result->Record.MutablePathDescription()->MutableSelf();
FillPathDescr(descr, path);
- BuildEffectiveACL(descr, path);
+ BuildEffectiveACL(descr, path);
auto base = path.Base();
DescribeDomain(base);
DescribeUserAttributes(base);
- DescribePathVersion(path);
-
- if (base->IsCreateFinished()) {
- switch (base->PathType) {
- case NKikimrSchemeOp::EPathTypeDir:
- DescribeDir(path);
- if (base->IsRoot()) {
- DescribeDomainExtra(base);
- }
- break;
- case NKikimrSchemeOp::EPathTypeSubDomain:
- case NKikimrSchemeOp::EPathTypeExtSubDomain:
- DescribeDir(path);
- DescribeDomainExtra(base);
- DescribeRevertedMigrations(base);
- break;
- case NKikimrSchemeOp::EPathTypeTable:
- DescribeTable(ctx, base->PathId, base);
- break;
+ DescribePathVersion(path);
+
+ if (base->IsCreateFinished()) {
+ switch (base->PathType) {
+ case NKikimrSchemeOp::EPathTypeDir:
+ DescribeDir(path);
+ if (base->IsRoot()) {
+ DescribeDomainExtra(base);
+ }
+ break;
+ case NKikimrSchemeOp::EPathTypeSubDomain:
+ case NKikimrSchemeOp::EPathTypeExtSubDomain:
+ DescribeDir(path);
+ DescribeDomainExtra(base);
+ DescribeRevertedMigrations(base);
+ break;
+ case NKikimrSchemeOp::EPathTypeTable:
+ DescribeTable(ctx, base->PathId, base);
+ break;
case NKikimrSchemeOp::EPathTypeColumnStore:
DescribeDir(path);
- DescribeOlapStore(base->PathId, base);
- break;
+ DescribeOlapStore(base->PathId, base);
+ break;
case NKikimrSchemeOp::EPathTypeColumnTable:
- DescribeOlapTable(base->PathId, base);
- break;
- case NKikimrSchemeOp::EPathTypePersQueueGroup:
- DescribePersQueueGroup(base->PathId, base);
- break;
- case NKikimrSchemeOp::EPathTypeRtmrVolume:
- DescribeRtmrVolume(base->PathId, base);
- break;
- case NKikimrSchemeOp::EPathTypeBlockStoreVolume:
- DescribeBlockStoreVolume(base->PathId, base);
- break;
- case NKikimrSchemeOp::EPathTypeFileStore:
- DescribeFileStore(base->PathId, base);
- break;
- case NKikimrSchemeOp::EPathTypeKesus:
- DescribeKesus(base->PathId, base);
- break;
- case NKikimrSchemeOp::EPathTypeSolomonVolume:
- DescribeSolomonVolume(base->PathId, base, Params.GetOptions().GetReturnChannelsBinding());
- break;
- case NKikimrSchemeOp::EPathTypeTableIndex:
- DescribeTableIndex(path);
- break;
- case NKikimrSchemeOp::EPathTypeCdcStream:
+ DescribeOlapTable(base->PathId, base);
+ break;
+ case NKikimrSchemeOp::EPathTypePersQueueGroup:
+ DescribePersQueueGroup(base->PathId, base);
+ break;
+ case NKikimrSchemeOp::EPathTypeRtmrVolume:
+ DescribeRtmrVolume(base->PathId, base);
+ break;
+ case NKikimrSchemeOp::EPathTypeBlockStoreVolume:
+ DescribeBlockStoreVolume(base->PathId, base);
+ break;
+ case NKikimrSchemeOp::EPathTypeFileStore:
+ DescribeFileStore(base->PathId, base);
+ break;
+ case NKikimrSchemeOp::EPathTypeKesus:
+ DescribeKesus(base->PathId, base);
+ break;
+ case NKikimrSchemeOp::EPathTypeSolomonVolume:
+ DescribeSolomonVolume(base->PathId, base, Params.GetOptions().GetReturnChannelsBinding());
+ break;
+ case NKikimrSchemeOp::EPathTypeTableIndex:
+ DescribeTableIndex(path);
+ break;
+ case NKikimrSchemeOp::EPathTypeCdcStream:
DescribeCdcStream(path);
- break;
- case NKikimrSchemeOp::EPathTypeSequence:
+ break;
+ case NKikimrSchemeOp::EPathTypeSequence:
DescribeSequence(path.Base()->PathId, path.Base());
break;
case NKikimrSchemeOp::EPathTypeReplication:
DescribeReplication(path.Base()->PathId, path.Base());
break;
- case NKikimrSchemeOp::EPathTypeInvalid:
- Y_UNREACHABLE();
+ case NKikimrSchemeOp::EPathTypeInvalid:
+ Y_UNREACHABLE();
}
- } else {
- // here we do not full any object specific information, like table description
- // nevertheless, chindren list should be set even when dir or children is being created right now
- DescribeChildren(path);
+ } else {
+ // here we do not full any object specific information, like table description
+ // nevertheless, chindren list should be set even when dir or children is being created right now
+ DescribeChildren(path);
}
- Result->Record.SetStatus(NKikimrScheme::StatusSuccess);
+ Result->Record.SetStatus(NKikimrScheme::StatusSuccess);
return std::move(Result);
}
-THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder> DescribePath(
- TSchemeShard* self,
+THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder> DescribePath(
+ TSchemeShard* self,
const TActorContext& ctx,
TPathId pathId,
- const NKikimrSchemeOp::TDescribeOptions& opts
+ const NKikimrSchemeOp::TDescribeOptions& opts
) {
- NKikimrSchemeOp::TDescribePath params;
- params.SetSchemeshardId(pathId.OwnerId); // ????
- params.SetPathId(pathId.LocalPathId);
+ NKikimrSchemeOp::TDescribePath params;
+ params.SetSchemeshardId(pathId.OwnerId); // ????
+ params.SetPathId(pathId.LocalPathId);
params.MutableOptions()->CopyFrom(opts);
return TPathDescriber(self, std::move(params)).Describe(ctx);
}
-THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder> DescribePath(
- TSchemeShard* self,
+THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder> DescribePath(
+ TSchemeShard* self,
const TActorContext& ctx,
TPathId pathId
) {
- NKikimrSchemeOp::TDescribeOptions options;
+ NKikimrSchemeOp::TDescribeOptions options;
options.SetShowPrivateTable(true);
return DescribePath(self, ctx, pathId, options);
}
-void TSchemeShard::DescribeTable(const TTableInfo::TPtr tableInfo, const NScheme::TTypeRegistry* typeRegistry,
- bool fillConfig, bool fillBoundaries, NKikimrSchemeOp::TTableDescription* entry) const
+void TSchemeShard::DescribeTable(const TTableInfo::TPtr tableInfo, const NScheme::TTypeRegistry* typeRegistry,
+ bool fillConfig, bool fillBoundaries, NKikimrSchemeOp::TTableDescription* entry) const
{
THashMap<ui32, TString> familyNames;
bool familyNamesBuilt = false;
@@ -950,7 +950,7 @@ void TSchemeShard::DescribeTable(const TTableInfo::TPtr tableInfo, const NScheme
if (fillConfig) {
entry->MutablePartitionConfig()->CopyFrom(tableInfo->PartitionConfig());
- TPartitionConfigMerger::DeduplicateColumnFamiliesById(*entry->MutablePartitionConfig());
+ TPartitionConfigMerger::DeduplicateColumnFamiliesById(*entry->MutablePartitionConfig());
entry->MutablePartitionConfig()->MutableStorageRooms()->Clear();
}
@@ -965,8 +965,8 @@ void TSchemeShard::DescribeTable(const TTableInfo::TPtr tableInfo, const NScheme
entry->SetIsBackup(tableInfo->IsBackup);
}
-void TSchemeShard::DescribeTableIndex(const TPathId& pathId, const TString& name,
- NKikimrSchemeOp::TIndexDescription& entry)
+void TSchemeShard::DescribeTableIndex(const TPathId& pathId, const TString& name,
+ NKikimrSchemeOp::TIndexDescription& entry)
{
auto it = Indexes.FindPtr(pathId);
Y_VERIFY(it, "TableIndex is not found");
@@ -975,8 +975,8 @@ void TSchemeShard::DescribeTableIndex(const TPathId& pathId, const TString& name
DescribeTableIndex(pathId, name, indexInfo, entry);
}
-void TSchemeShard::DescribeTableIndex(const TPathId& pathId, const TString& name, TTableIndexInfo::TPtr indexInfo,
- NKikimrSchemeOp::TIndexDescription& entry)
+void TSchemeShard::DescribeTableIndex(const TPathId& pathId, const TString& name, TTableIndexInfo::TPtr indexInfo,
+ NKikimrSchemeOp::TIndexDescription& entry)
{
Y_VERIFY(indexInfo, "Empty index info");
@@ -1009,8 +1009,8 @@ void TSchemeShard::DescribeTableIndex(const TPathId& pathId, const TString& name
entry.SetDataSize(tableStats.DataSize + tableStats.IndexSize);
}
-void TSchemeShard::DescribeCdcStream(const TPathId& pathId, const TString& name,
- NKikimrSchemeOp::TCdcStreamDescription& desc)
+void TSchemeShard::DescribeCdcStream(const TPathId& pathId, const TString& name,
+ NKikimrSchemeOp::TCdcStreamDescription& desc)
{
Y_VERIFY_S(CdcStreams.contains(pathId), "Cdc stream not found"
<< ": pathId# " << pathId
@@ -1018,8 +1018,8 @@ void TSchemeShard::DescribeCdcStream(const TPathId& pathId, const TString& name,
DescribeCdcStream(pathId, name, CdcStreams.at(pathId), desc);
}
-void TSchemeShard::DescribeCdcStream(const TPathId& pathId, const TString& name, TCdcStreamInfo::TPtr info,
- NKikimrSchemeOp::TCdcStreamDescription& desc)
+void TSchemeShard::DescribeCdcStream(const TPathId& pathId, const TString& name, TCdcStreamInfo::TPtr info,
+ NKikimrSchemeOp::TCdcStreamDescription& desc)
{
Y_VERIFY_S(info, "Empty cdc stream info"
<< ": pathId# " << pathId
@@ -1032,8 +1032,8 @@ void TSchemeShard::DescribeCdcStream(const TPathId& pathId, const TString& name,
desc.SetSchemaVersion(info->AlterVersion);
}
-void TSchemeShard::DescribeSequence(const TPathId& pathId, const TString& name,
- NKikimrSchemeOp::TSequenceDescription& desc)
+void TSchemeShard::DescribeSequence(const TPathId& pathId, const TString& name,
+ NKikimrSchemeOp::TSequenceDescription& desc)
{
auto it = Sequences.find(pathId);
Y_VERIFY_S(it != Sequences.end(), "Sequence not found"
@@ -1042,8 +1042,8 @@ void TSchemeShard::DescribeSequence(const TPathId& pathId, const TString& name,
DescribeSequence(pathId, name, it->second, desc);
}
-void TSchemeShard::DescribeSequence(const TPathId& pathId, const TString& name, TSequenceInfo::TPtr info,
- NKikimrSchemeOp::TSequenceDescription& desc)
+void TSchemeShard::DescribeSequence(const TPathId& pathId, const TString& name, TSequenceInfo::TPtr info,
+ NKikimrSchemeOp::TSequenceDescription& desc)
{
Y_VERIFY_S(info, "Empty sequence info"
<< " pathId# " << pathId
@@ -1101,7 +1101,7 @@ void TSchemeShard::DescribeReplication(const TPathId& pathId, const TString& nam
}
}
-void TSchemeShard::FillTableBoundaries(const TTableInfo::TPtr tableInfo, google::protobuf::RepeatedPtrField<NKikimrSchemeOp::TSplitBoundary>& boundaries) {
+void TSchemeShard::FillTableBoundaries(const TTableInfo::TPtr tableInfo, google::protobuf::RepeatedPtrField<NKikimrSchemeOp::TSplitBoundary>& boundaries) {
TString errStr;
// Number of split boundaries equals to number of partitions - 1
boundaries.Reserve(tableInfo->GetPartitions().size() - 1);
@@ -1118,5 +1118,5 @@ void TSchemeShard::FillTableBoundaries(const TTableInfo::TPtr tableInfo, google:
}
}
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_path_describer.h b/ydb/core/tx/schemeshard/schemeshard_path_describer.h
index 73da56c3710..7d10ed1da7a 100644
--- a/ydb/core/tx/schemeshard/schemeshard_path_describer.h
+++ b/ydb/core/tx/schemeshard/schemeshard_path_describer.h
@@ -8,35 +8,35 @@
#include <util/generic/string.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
class TPathDescriber {
- void FillPathDescr(NKikimrSchemeOp::TDirEntry* descr, TPathElement::TPtr pathEl,
+ void FillPathDescr(NKikimrSchemeOp::TDirEntry* descr, TPathElement::TPtr pathEl,
TPathElement::EPathSubType subType = TPathElement::EPathSubType::EPathSubTypeEmpty);
- void FillPathDescr(NKikimrSchemeOp::TDirEntry* descr, const TPath& path);
- void FillChildDescr(NKikimrSchemeOp::TDirEntry* descr, TPathElement::TPtr pathEl);
+ void FillPathDescr(NKikimrSchemeOp::TDirEntry* descr, const TPath& path);
+ void FillChildDescr(NKikimrSchemeOp::TDirEntry* descr, TPathElement::TPtr pathEl);
TPathElement::EPathSubType CalcPathSubType(const TPath& path);
- void BuildEffectiveACL(NKikimrSchemeOp::TDirEntry* descr, const TPath& pathEl);
+ void BuildEffectiveACL(NKikimrSchemeOp::TDirEntry* descr, const TPath& pathEl);
void FillLastExistedPrefixDescr(const TPath& path);
- void DescribeChildren(const TPath& path);
- void DescribeDir(const TPath& path);
+ void DescribeChildren(const TPath& path);
+ void DescribeDir(const TPath& path);
void DescribeTable(const TActorContext& ctx, TPathId pathId, TPathElement::TPtr pathEl);
void DescribeOlapStore(TPathId pathId, TPathElement::TPtr pathEl);
void DescribeOlapTable(TPathId pathId, TPathElement::TPtr pathEl);
void DescribePersQueueGroup(TPathId pathId, TPathElement::TPtr pathEl);
void DescribeRtmrVolume(TPathId pathId, TPathElement::TPtr pathEl);
- void DescribeTableIndex(const TPath& path);
+ void DescribeTableIndex(const TPath& path);
void DescribeCdcStream(const TPath& path);
void DescribeSolomonVolume(TPathId pathId, TPathElement::TPtr pathEl, bool returnChannelsBinding);
void DescribeUserAttributes(TPathElement::TPtr pathEl);
- void DescribePathVersion(const TPath& path);
- void DescribeDomain(TPathElement::TPtr pathEl);
- void DescribeDomainRoot(TPathElement::TPtr pathEl);
+ void DescribePathVersion(const TPath& path);
+ void DescribeDomain(TPathElement::TPtr pathEl);
+ void DescribeDomainRoot(TPathElement::TPtr pathEl);
void DescribeDomainExtra(TPathElement::TPtr pathEl);
- void DescribeRevertedMigrations(TPathElement::TPtr pathEl);
-
+ void DescribeRevertedMigrations(TPathElement::TPtr pathEl);
+
void DescribeBlockStoreVolume(TPathId pathId, TPathElement::TPtr pathEl);
void DescribeFileStore(TPathId pathId, TPathElement::TPtr pathEl);
void DescribeKesus(TPathId pathId, TPathElement::TPtr pathEl);
@@ -44,38 +44,38 @@ class TPathDescriber {
void DescribeReplication(TPathId pathId, TPathElement::TPtr pathEl);
public:
- explicit TPathDescriber(TSchemeShard* self, NKikimrSchemeOp::TDescribePath&& params)
+ explicit TPathDescriber(TSchemeShard* self, NKikimrSchemeOp::TDescribePath&& params)
: Self(self)
, Params(std::move(params))
{
}
- const NKikimrSchemeOp::TDescribePath& GetParams() const {
+ const NKikimrSchemeOp::TDescribePath& GetParams() const {
return Params;
}
- THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder> Describe(const TActorContext& ctx);
+ THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder> Describe(const TActorContext& ctx);
private:
- TSchemeShard* Self;
- NKikimrSchemeOp::TDescribePath Params;
+ TSchemeShard* Self;
+ NKikimrSchemeOp::TDescribePath Params;
- THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder> Result;
+ THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder> Result;
}; // TPathDescriber
-THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder> DescribePath(
- TSchemeShard* self,
+THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder> DescribePath(
+ TSchemeShard* self,
const TActorContext& ctx,
TPathId pathId,
- const NKikimrSchemeOp::TDescribeOptions& opts
+ const NKikimrSchemeOp::TDescribeOptions& opts
);
-THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder> DescribePath(
- TSchemeShard* self,
+THolder<TEvSchemeShard::TEvDescribeSchemeResultBuilder> DescribePath(
+ TSchemeShard* self,
const TActorContext& ctx,
TPathId pathId
);
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_path_element.h b/ydb/core/tx/schemeshard/schemeshard_path_element.h
index d4b60f79b27..9912880c057 100644
--- a/ydb/core/tx/schemeshard/schemeshard_path_element.h
+++ b/ydb/core/tx/schemeshard/schemeshard_path_element.h
@@ -1,21 +1,21 @@
-#pragma once
-
-#include "schemeshard_types.h"
-#include "schemeshard_effective_acl.h"
+#pragma once
+
+#include "schemeshard_types.h"
+#include "schemeshard_effective_acl.h"
#include "schemeshard_user_attr_limits.h"
-
+
#include <ydb/core/protos/flat_scheme_op.pb.h>
#include <ydb/library/aclib/aclib.h>
-
-#include <util/generic/map.h>
-#include <util/generic/ptr.h>
-#include <util/string/cast.h>
-
+
+#include <util/generic/map.h>
+#include <util/generic/ptr.h>
+#include <util/string/cast.h>
+
#include <ydb/core/util/yverify_stream.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
+
+namespace NKikimr {
+namespace NSchemeShard {
+
constexpr TStringBuf ATTR_PREFIX = "__";
constexpr TStringBuf ATTR_VOLUME_SPACE_LIMIT = "__volume_space_limit";
constexpr TStringBuf ATTR_VOLUME_SPACE_LIMIT_HDD = "__volume_space_limit_hdd";
@@ -24,41 +24,41 @@ constexpr TStringBuf ATTR_VOLUME_SPACE_LIMIT_SSD_NONREPL = "__volume_space_limit
constexpr TStringBuf ATTR_VOLUME_SPACE_LIMIT_SSD_SYSTEM = "__volume_space_limit_ssd_system";
constexpr TStringBuf ATTR_EXTRA_PATH_SYMBOLS_ALLOWED = "__extra_path_symbols_allowed";
constexpr TStringBuf ATTR_DOCUMENT_API_VERSION = "__document_api_version";
-
-inline bool WeakCheck(char c) {
- // 33: ! " # $ % & ' ( ) * + , - . /
- // 48: 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @
- // 65: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
- // 91: [ \ ] ^ _ `
- // 97: a b c d e f g h i j k l m n o p q r s t u v w x y z
- // 123: { | } ~
- if (c >= 33 && c <= 126)
- return true;
- return false;
-}
-
-inline bool IsValidPathName_WeakCheck(const TString& name) {
- for (auto c: name) {
- if (!WeakCheck(c) || c == '/') {
- return false;
- }
- }
- return true;
-}
-
-enum class EAttribute {
- USER,
- UNKNOWN,
- VOLUME_SPACE_LIMIT,
- VOLUME_SPACE_LIMIT_HDD,
- VOLUME_SPACE_LIMIT_SSD,
- EXTRA_PATH_SYMBOLS_ALLOWED, // deprecated
+
+inline bool WeakCheck(char c) {
+ // 33: ! " # $ % & ' ( ) * + , - . /
+ // 48: 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @
+ // 65: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
+ // 91: [ \ ] ^ _ `
+ // 97: a b c d e f g h i j k l m n o p q r s t u v w x y z
+ // 123: { | } ~
+ if (c >= 33 && c <= 126)
+ return true;
+ return false;
+}
+
+inline bool IsValidPathName_WeakCheck(const TString& name) {
+ for (auto c: name) {
+ if (!WeakCheck(c) || c == '/') {
+ return false;
+ }
+ }
+ return true;
+}
+
+enum class EAttribute {
+ USER,
+ UNKNOWN,
+ VOLUME_SPACE_LIMIT,
+ VOLUME_SPACE_LIMIT_HDD,
+ VOLUME_SPACE_LIMIT_SSD,
+ EXTRA_PATH_SYMBOLS_ALLOWED, // deprecated
VOLUME_SPACE_LIMIT_SSD_NONREPL,
DOCUMENT_API_VERSION,
VOLUME_SPACE_LIMIT_SSD_SYSTEM,
-};
-
-struct TVolumeSpace {
+};
+
+struct TVolumeSpace {
ui64 Raw = 0;
ui64 SSD = 0;
ui64 HDD = 0;
@@ -68,9 +68,9 @@ struct TVolumeSpace {
struct TVolumeSpaceLimits {
ui64 Allocated = 0;
- ui64 Limit = Max<ui64>();
-};
-
+ ui64 Limit = Max<ui64>();
+};
+
enum class EUserAttributesOp {
InitRoot,
MkDir,
@@ -81,82 +81,82 @@ enum class EUserAttributesOp {
SyncUpdateTenants,
};
-struct TUserAttributes: TSimpleRefCount<TUserAttributes> {
- using TPtr = TIntrusivePtr<TUserAttributes>;
- using TAttrs = TMap<TString, TString>;
-
- TAttrs Attrs;
- ui64 AlterVersion;
- TPtr AlterData;
-
- explicit TUserAttributes(ui64 version)
- : AlterVersion(version)
- {}
-
- TUserAttributes(const TUserAttributes&) = default;
-
- TPtr CreateNextVersion() {
- auto result = new TUserAttributes(*this);
- ++result->AlterVersion;
- return result;
- }
-
- static EAttribute ParseName(TStringBuf name) {
- if (name.StartsWith(ATTR_PREFIX)) {
- #define HANDLE_ATTR(attr) \
- if (name == ATTR_ ## attr) { \
- return EAttribute::attr; \
- }
- HANDLE_ATTR(VOLUME_SPACE_LIMIT);
- HANDLE_ATTR(VOLUME_SPACE_LIMIT_HDD);
- HANDLE_ATTR(VOLUME_SPACE_LIMIT_SSD);
+struct TUserAttributes: TSimpleRefCount<TUserAttributes> {
+ using TPtr = TIntrusivePtr<TUserAttributes>;
+ using TAttrs = TMap<TString, TString>;
+
+ TAttrs Attrs;
+ ui64 AlterVersion;
+ TPtr AlterData;
+
+ explicit TUserAttributes(ui64 version)
+ : AlterVersion(version)
+ {}
+
+ TUserAttributes(const TUserAttributes&) = default;
+
+ TPtr CreateNextVersion() {
+ auto result = new TUserAttributes(*this);
+ ++result->AlterVersion;
+ return result;
+ }
+
+ static EAttribute ParseName(TStringBuf name) {
+ if (name.StartsWith(ATTR_PREFIX)) {
+ #define HANDLE_ATTR(attr) \
+ if (name == ATTR_ ## attr) { \
+ return EAttribute::attr; \
+ }
+ HANDLE_ATTR(VOLUME_SPACE_LIMIT);
+ HANDLE_ATTR(VOLUME_SPACE_LIMIT_HDD);
+ HANDLE_ATTR(VOLUME_SPACE_LIMIT_SSD);
HANDLE_ATTR(VOLUME_SPACE_LIMIT_SSD_NONREPL);
HANDLE_ATTR(VOLUME_SPACE_LIMIT_SSD_SYSTEM);
- HANDLE_ATTR(EXTRA_PATH_SYMBOLS_ALLOWED);
+ HANDLE_ATTR(EXTRA_PATH_SYMBOLS_ALLOWED);
HANDLE_ATTR(DOCUMENT_API_VERSION);
- #undef HANDLE_ATTR
- return EAttribute::UNKNOWN;
- }
-
- return EAttribute::USER;
- }
-
- bool ApplyPatch(EUserAttributesOp op, const NKikimrSchemeOp::TAlterUserAttributes& patch, TString& errStr) {
+ #undef HANDLE_ATTR
+ return EAttribute::UNKNOWN;
+ }
+
+ return EAttribute::USER;
+ }
+
+ bool ApplyPatch(EUserAttributesOp op, const NKikimrSchemeOp::TAlterUserAttributes& patch, TString& errStr) {
return ApplyPatch(op, patch.GetUserAttributes(), errStr);
- }
-
- template <class TContainer>
+ }
+
+ template <class TContainer>
bool ApplyPatch(EUserAttributesOp op, const TContainer& patch, TString& errStr) {
- for (auto& item: patch) {
- const auto& name = item.GetKey();
-
- if (item.HasValue()) {
- const auto& value = item.GetValue();
+ for (auto& item: patch) {
+ const auto& name = item.GetKey();
+
+ if (item.HasValue()) {
+ const auto& value = item.GetValue();
if (!CheckAttribute(op, name, value, errStr)) {
- return false;
- }
-
- Attrs[name] = value;
- } else {
+ return false;
+ }
+
+ Attrs[name] = value;
+ } else {
if (!CheckAttributeRemove(op, name, errStr)) {
return false;
}
- Attrs.erase(name);
- }
- }
-
- return true;
- }
-
- void Set(const TString& name, const TString& value) {
- Attrs[name] = value;
- }
-
- ui32 Size() const {
- return Attrs.size();
- }
-
+ Attrs.erase(name);
+ }
+ }
+
+ return true;
+ }
+
+ void Set(const TString& name, const TString& value) {
+ Attrs[name] = value;
+ }
+
+ ui32 Size() const {
+ return Attrs.size();
+ }
+
ui64 Bytes() const {
ui64 bytes = 0;
@@ -168,16 +168,16 @@ struct TUserAttributes: TSimpleRefCount<TUserAttributes> {
return bytes;
}
- bool CheckLimits(TString& errStr) const {
+ bool CheckLimits(TString& errStr) const {
const ui64 bytes = Bytes();
if (bytes > TUserAttributesLimits::MaxBytes) {
errStr = Sprintf("UserArttibutes::CheckLimits: user attributes too big: %" PRIu64, bytes);
- return false;
- }
-
- return true;
- }
-
+ return false;
+ }
+
+ return true;
+ }
+
static bool CheckAttribute(EUserAttributesOp op, const TString& name, const TString& value, TString& errStr) {
if (op == EUserAttributesOp::SyncUpdateTenants) {
// Migration, must never fail
@@ -185,42 +185,42 @@ struct TUserAttributes: TSimpleRefCount<TUserAttributes> {
}
if (name.size() > TUserAttributesLimits::MaxNameLen) {
- errStr = Sprintf("UserArttibutes: name too long, name# '%s' value# '%s'"
- , name.c_str(), value.c_str());
- return false;
- }
-
+ errStr = Sprintf("UserArttibutes: name too long, name# '%s' value# '%s'"
+ , name.c_str(), value.c_str());
+ return false;
+ }
+
if (value.size() > TUserAttributesLimits::MaxValueLen) {
- errStr = Sprintf("UserArttibutes: value too long, name# '%s' value# '%s'"
- , name.c_str(), value.c_str());
- return false;
- }
-
- switch (ParseName(name)) {
- case EAttribute::USER:
- return true;
- case EAttribute::UNKNOWN:
- errStr = Sprintf("UserAttributes: unsupported attribute '%s'", name.c_str());
- return false;
- case EAttribute::VOLUME_SPACE_LIMIT:
- case EAttribute::VOLUME_SPACE_LIMIT_HDD:
- case EAttribute::VOLUME_SPACE_LIMIT_SSD:
+ errStr = Sprintf("UserArttibutes: value too long, name# '%s' value# '%s'"
+ , name.c_str(), value.c_str());
+ return false;
+ }
+
+ switch (ParseName(name)) {
+ case EAttribute::USER:
+ return true;
+ case EAttribute::UNKNOWN:
+ errStr = Sprintf("UserAttributes: unsupported attribute '%s'", name.c_str());
+ return false;
+ case EAttribute::VOLUME_SPACE_LIMIT:
+ case EAttribute::VOLUME_SPACE_LIMIT_HDD:
+ case EAttribute::VOLUME_SPACE_LIMIT_SSD:
case EAttribute::VOLUME_SPACE_LIMIT_SSD_NONREPL:
case EAttribute::VOLUME_SPACE_LIMIT_SSD_SYSTEM:
- return CheckAttributeUint64(name, value, errStr);
- case EAttribute::EXTRA_PATH_SYMBOLS_ALLOWED:
- return CheckAttributeStringWithWeakCheck(name, value, errStr);
+ return CheckAttributeUint64(name, value, errStr);
+ case EAttribute::EXTRA_PATH_SYMBOLS_ALLOWED:
+ return CheckAttributeStringWithWeakCheck(name, value, errStr);
case EAttribute::DOCUMENT_API_VERSION:
if (op != EUserAttributesOp::CreateTable) {
errStr = Sprintf("UserAttributes: attribute '%s' can only be set during CreateTable", name.c_str());
return false;
}
return CheckAttributeUint64(name, value, errStr, /* minValue = */ 1);
- }
-
- Y_UNREACHABLE();
- }
-
+ }
+
+ Y_UNREACHABLE();
+ }
+
static bool CheckAttributeRemove(EUserAttributesOp op, const TString& name, TString& errStr) {
if (op == EUserAttributesOp::SyncUpdateTenants) {
// Migration, must never fail
@@ -251,22 +251,22 @@ struct TUserAttributes: TSimpleRefCount<TUserAttributes> {
Y_UNREACHABLE();
}
- static bool CheckAttributeStringWithWeakCheck(const TString& name, const TString& value, TString& errStr) {
- if (!IsValidPathName_WeakCheck(value)) {
- errStr = Sprintf("UserArttibutes: attribute '%s' has invalid value '%s', forbidden symbols are found",
- name.c_str(), value.c_str());
- return false;
- }
- return true;
- }
-
+ static bool CheckAttributeStringWithWeakCheck(const TString& name, const TString& value, TString& errStr) {
+ if (!IsValidPathName_WeakCheck(value)) {
+ errStr = Sprintf("UserArttibutes: attribute '%s' has invalid value '%s', forbidden symbols are found",
+ name.c_str(), value.c_str());
+ return false;
+ }
+ return true;
+ }
+
static bool CheckAttributeUint64(const TString& name, const TString& value, TString& errStr, ui64 minValue = 0, ui64 maxValue = Max<ui64>()) {
ui64 parsed;
if (!TryFromString(value, parsed)) {
- errStr = Sprintf("UserAttributes: attribute '%s' has invalid value '%s'",
- name.c_str(), value.c_str());
- return false;
- }
+ errStr = Sprintf("UserAttributes: attribute '%s' has invalid value '%s'",
+ name.c_str(), value.c_str());
+ return false;
+ }
if (parsed < minValue) {
errStr = Sprintf("UserAttributes: attribute '%s' has invalid value '%s' < %" PRIu64,
name.c_str(), value.c_str(), minValue);
@@ -277,173 +277,173 @@ struct TUserAttributes: TSimpleRefCount<TUserAttributes> {
name.c_str(), value.c_str(), maxValue);
return false;
}
- return true;
- }
-
- static bool CheckAttributeUnknown(const std::pair<const TString, TString>& item, bool& ok, TString& errStr) {
- Y_UNUSED(item);
- ok = false;
- errStr = Sprintf("UserAttributes::CheckLimits: unsupported attribute '%s'", item.first.c_str());
- return true;
- }
-};
-
-struct TPathElement : TSimpleRefCount<TPathElement> {
- using TPtr = TIntrusivePtr<TPathElement>;
- using TChildrenCont = TMap<TString, TPathId>;
- using EPathType = NKikimrSchemeOp::EPathType;
- using EPathSubType = NKikimrSchemeOp::EPathSubType;
- using EPathState = NKikimrSchemeOp::EPathState;
-
- static constexpr TLocalPathId RootPathId = 1;
-
- TPathId PathId = InvalidPathId;
- TPathId ParentPathId = InvalidPathId;
- TPathId DomainPathId = InvalidPathId;
-
- TString Name;
- TString Owner;
- TString ACL;
-
- EPathType PathType = EPathType::EPathTypeDir;
- EPathState PathState = EPathState::EPathStateNotExist;
-
- TStepId StepCreated = InvalidStepId;
- TTxId CreateTxId = InvalidTxId;
- TStepId StepDropped = InvalidStepId;
- TTxId DropTxId = InvalidTxId;
- TTxId LastTxId = InvalidTxId;
-
- ui64 DirAlterVersion = 0;
+ return true;
+ }
+
+ static bool CheckAttributeUnknown(const std::pair<const TString, TString>& item, bool& ok, TString& errStr) {
+ Y_UNUSED(item);
+ ok = false;
+ errStr = Sprintf("UserAttributes::CheckLimits: unsupported attribute '%s'", item.first.c_str());
+ return true;
+ }
+};
+
+struct TPathElement : TSimpleRefCount<TPathElement> {
+ using TPtr = TIntrusivePtr<TPathElement>;
+ using TChildrenCont = TMap<TString, TPathId>;
+ using EPathType = NKikimrSchemeOp::EPathType;
+ using EPathSubType = NKikimrSchemeOp::EPathSubType;
+ using EPathState = NKikimrSchemeOp::EPathState;
+
+ static constexpr TLocalPathId RootPathId = 1;
+
+ TPathId PathId = InvalidPathId;
+ TPathId ParentPathId = InvalidPathId;
+ TPathId DomainPathId = InvalidPathId;
+
+ TString Name;
+ TString Owner;
+ TString ACL;
+
+ EPathType PathType = EPathType::EPathTypeDir;
+ EPathState PathState = EPathState::EPathStateNotExist;
+
+ TStepId StepCreated = InvalidStepId;
+ TTxId CreateTxId = InvalidTxId;
+ TStepId StepDropped = InvalidStepId;
+ TTxId DropTxId = InvalidTxId;
+ TTxId LastTxId = InvalidTxId;
+
+ ui64 DirAlterVersion = 0;
ui64 ACLVersion = 0;
-
- TUserAttributes::TPtr UserAttrs;
-
- TString PreSerializedChildrenListing;
-
- TEffectiveACL CachedEffectiveACL;
- ui64 CachedEffectiveACLVersion = 0;
-
- TString ExtraPathSymbolsAllowed; // it's better to move it in TSubDomainInfo like SchemeLimits
-
+
+ TUserAttributes::TPtr UserAttrs;
+
+ TString PreSerializedChildrenListing;
+
+ TEffectiveACL CachedEffectiveACL;
+ ui64 CachedEffectiveACLVersion = 0;
+
+ TString ExtraPathSymbolsAllowed; // it's better to move it in TSubDomainInfo like SchemeLimits
+
TVolumeSpaceLimits VolumeSpaceRaw;
TVolumeSpaceLimits VolumeSpaceSSD;
TVolumeSpaceLimits VolumeSpaceHDD;
TVolumeSpaceLimits VolumeSpaceSSDNonrepl;
TVolumeSpaceLimits VolumeSpaceSSDSystem;
ui64 DocumentApiVersion = 0;
-
+
// Number of references to this path element in the database
size_t DbRefCount = 0;
size_t AllChildrenCount = 0;
-private:
- ui64 AliveChildrenCount = 0;
- ui64 ShardsInsideCount = 0;
- TChildrenCont Children;
-
-public:
- TPathElement(TPathId pathId, TPathId parentPathId, TPathId domainPathId, const TString& name, const TString& owner)
- : PathId(pathId)
- , ParentPathId(parentPathId)
- , DomainPathId(domainPathId)
- , Name(name)
- , Owner(owner)
- , UserAttrs(new TUserAttributes(1))
- {}
-
- ui64 GetAliveChildren() const {
- return AliveChildrenCount;
- }
-
- void SetAliveChildren(ui64 val) {
- AliveChildrenCount = val;
- }
-
- void IncAliveChildren(ui64 delta = 1) {
- Y_VERIFY(Max<ui64>() - AliveChildrenCount >= delta);
- AliveChildrenCount += delta;
- }
-
- void DecAliveChildren(ui64 delta = 1) {
- Y_VERIFY(AliveChildrenCount >= delta);
- AliveChildrenCount -= delta;
- }
-
- ui64 GetShardsInside() const {
- return ShardsInsideCount;
- }
-
- void SetShardsInside(ui64 val) {
- ShardsInsideCount = val;
- }
-
- void IncShardsInside(ui64 delta = 1) {
- Y_VERIFY(Max<ui64>() - ShardsInsideCount >= delta);
- ShardsInsideCount += delta;
- }
-
- void DecShardsInside(ui64 delta = 1) {
- Y_VERIFY(ShardsInsideCount >= delta);
- ShardsInsideCount -= delta;
- }
-
- bool IsRoot() const {
- return PathId.LocalPathId == RootPathId;
- }
-
- bool IsDirectory() const {
- return PathType == EPathType::EPathTypeDir;
- }
-
- bool IsTableIndex() const {
- return PathType == EPathType::EPathTypeTableIndex;
- }
-
+private:
+ ui64 AliveChildrenCount = 0;
+ ui64 ShardsInsideCount = 0;
+ TChildrenCont Children;
+
+public:
+ TPathElement(TPathId pathId, TPathId parentPathId, TPathId domainPathId, const TString& name, const TString& owner)
+ : PathId(pathId)
+ , ParentPathId(parentPathId)
+ , DomainPathId(domainPathId)
+ , Name(name)
+ , Owner(owner)
+ , UserAttrs(new TUserAttributes(1))
+ {}
+
+ ui64 GetAliveChildren() const {
+ return AliveChildrenCount;
+ }
+
+ void SetAliveChildren(ui64 val) {
+ AliveChildrenCount = val;
+ }
+
+ void IncAliveChildren(ui64 delta = 1) {
+ Y_VERIFY(Max<ui64>() - AliveChildrenCount >= delta);
+ AliveChildrenCount += delta;
+ }
+
+ void DecAliveChildren(ui64 delta = 1) {
+ Y_VERIFY(AliveChildrenCount >= delta);
+ AliveChildrenCount -= delta;
+ }
+
+ ui64 GetShardsInside() const {
+ return ShardsInsideCount;
+ }
+
+ void SetShardsInside(ui64 val) {
+ ShardsInsideCount = val;
+ }
+
+ void IncShardsInside(ui64 delta = 1) {
+ Y_VERIFY(Max<ui64>() - ShardsInsideCount >= delta);
+ ShardsInsideCount += delta;
+ }
+
+ void DecShardsInside(ui64 delta = 1) {
+ Y_VERIFY(ShardsInsideCount >= delta);
+ ShardsInsideCount -= delta;
+ }
+
+ bool IsRoot() const {
+ return PathId.LocalPathId == RootPathId;
+ }
+
+ bool IsDirectory() const {
+ return PathType == EPathType::EPathTypeDir;
+ }
+
+ bool IsTableIndex() const {
+ return PathType == EPathType::EPathTypeTableIndex;
+ }
+
bool IsCdcStream() const {
return PathType == EPathType::EPathTypeCdcStream;
}
- bool IsTable() const {
- return PathType == EPathType::EPathTypeTable;
- }
-
- bool IsSolomon() const {
- return PathType == EPathType::EPathTypeSolomonVolume;
- }
-
- bool IsPQGroup() const {
- return PathType == EPathType::EPathTypePersQueueGroup;
- }
-
- bool IsDomainRoot() const {
- return IsSubDomainRoot() || IsExternalSubDomainRoot();
- }
-
- bool IsSubDomainRoot() const {
- return PathType == EPathType::EPathTypeSubDomain || IsRoot();
- }
-
- bool IsExternalSubDomainRoot() const {
- return PathType == EPathType::EPathTypeExtSubDomain;
- }
-
- bool IsRtmrVolume() const {
- return PathType == EPathType::EPathTypeRtmrVolume;
- }
-
- bool IsBlockStoreVolume() const {
- return PathType == EPathType::EPathTypeBlockStoreVolume;
- }
-
+ bool IsTable() const {
+ return PathType == EPathType::EPathTypeTable;
+ }
+
+ bool IsSolomon() const {
+ return PathType == EPathType::EPathTypeSolomonVolume;
+ }
+
+ bool IsPQGroup() const {
+ return PathType == EPathType::EPathTypePersQueueGroup;
+ }
+
+ bool IsDomainRoot() const {
+ return IsSubDomainRoot() || IsExternalSubDomainRoot();
+ }
+
+ bool IsSubDomainRoot() const {
+ return PathType == EPathType::EPathTypeSubDomain || IsRoot();
+ }
+
+ bool IsExternalSubDomainRoot() const {
+ return PathType == EPathType::EPathTypeExtSubDomain;
+ }
+
+ bool IsRtmrVolume() const {
+ return PathType == EPathType::EPathTypeRtmrVolume;
+ }
+
+ bool IsBlockStoreVolume() const {
+ return PathType == EPathType::EPathTypeBlockStoreVolume;
+ }
+
bool IsFileStore() const {
return PathType == EPathType::EPathTypeFileStore;
}
- bool IsKesus() const {
- return PathType == EPathType::EPathTypeKesus;
- }
-
+ bool IsKesus() const {
+ return PathType == EPathType::EPathTypeKesus;
+ }
+
bool IsOlapStore() const {
return PathType == EPathType::EPathTypeColumnStore;
}
@@ -460,73 +460,73 @@ public:
return PathType == EPathType::EPathTypeReplication;
}
- bool IsContainer() const {
+ bool IsContainer() const {
return PathType == EPathType::EPathTypeDir || PathType == EPathType::EPathTypeSubDomain
|| PathType == EPathType::EPathTypeColumnStore;
- }
-
+ }
+
bool IsLikeDirectory() const {
return IsDirectory() || IsDomainRoot() || IsOlapStore();
}
- bool HasActiveChanges() const {
- // there are old clusters where Root node has CreateTxId == 0
- return (!IsRoot() && !CreateTxId) || (PathState != EPathState::EPathStateNoChanges);
- }
-
- bool IsCreateFinished() const {
- return (IsRoot() && CreateTxId) || StepCreated;
- }
-
- TGlobalTimestamp GetCreateTS() const {
- return TGlobalTimestamp(StepCreated, CreateTxId);
- }
-
- TGlobalTimestamp GetDropTS() const {
- return TGlobalTimestamp(StepDropped, DropTxId);
- }
-
- void SetDropped(TStepId step, TTxId txId) {
- PathState = EPathState::EPathStateNotExist;
- StepDropped = step;
- DropTxId = txId;
- }
-
- bool NormalState() const {
- return PathState == EPathState::EPathStateNoChanges;
- }
-
- bool Dropped() const {
- if (StepDropped) {
- Y_VERIFY_DEBUG_S(PathState == EPathState::EPathStateNotExist,
- "Non consistent PathState and StepDropped."
- << " PathState: " << NKikimrSchemeOp::EPathState_Name(PathState)
- << ", StepDropped: " << StepDropped
- << ", PathId: " << PathId);
- }
- return bool(StepDropped);
- }
-
- bool IsMigrated() const {
- return PathState == EPathState::EPathStateMigrated;
- }
-
- bool PlannedToCreate() const {
- return PathState == EPathState::EPathStateCreate;
- }
-
- bool PlannedToDrop() const {
- return PathState == EPathState::EPathStateDrop;
- }
-
- bool AddChild(const TString& name, TPathId pathId, bool replace = false) {
- TPathId* ptr = FindChild(name);
- if (ptr && !replace)
- return false;
- Children[name] = pathId;
- return true;
- }
-
+ bool HasActiveChanges() const {
+ // there are old clusters where Root node has CreateTxId == 0
+ return (!IsRoot() && !CreateTxId) || (PathState != EPathState::EPathStateNoChanges);
+ }
+
+ bool IsCreateFinished() const {
+ return (IsRoot() && CreateTxId) || StepCreated;
+ }
+
+ TGlobalTimestamp GetCreateTS() const {
+ return TGlobalTimestamp(StepCreated, CreateTxId);
+ }
+
+ TGlobalTimestamp GetDropTS() const {
+ return TGlobalTimestamp(StepDropped, DropTxId);
+ }
+
+ void SetDropped(TStepId step, TTxId txId) {
+ PathState = EPathState::EPathStateNotExist;
+ StepDropped = step;
+ DropTxId = txId;
+ }
+
+ bool NormalState() const {
+ return PathState == EPathState::EPathStateNoChanges;
+ }
+
+ bool Dropped() const {
+ if (StepDropped) {
+ Y_VERIFY_DEBUG_S(PathState == EPathState::EPathStateNotExist,
+ "Non consistent PathState and StepDropped."
+ << " PathState: " << NKikimrSchemeOp::EPathState_Name(PathState)
+ << ", StepDropped: " << StepDropped
+ << ", PathId: " << PathId);
+ }
+ return bool(StepDropped);
+ }
+
+ bool IsMigrated() const {
+ return PathState == EPathState::EPathStateMigrated;
+ }
+
+ bool PlannedToCreate() const {
+ return PathState == EPathState::EPathStateCreate;
+ }
+
+ bool PlannedToDrop() const {
+ return PathState == EPathState::EPathStateDrop;
+ }
+
+ bool AddChild(const TString& name, TPathId pathId, bool replace = false) {
+ TPathId* ptr = FindChild(name);
+ if (ptr && !replace)
+ return false;
+ Children[name] = pathId;
+ return true;
+ }
+
bool RemoveChild(const TString& name, TPathId pathId) {
auto it = Children.find(name);
if (it != Children.end() && it->second == pathId) {
@@ -536,72 +536,72 @@ public:
return false;
}
- TPathId* FindChild(const TString& name) {
- return Children.FindPtr(name);
- }
-
- const TChildrenCont& GetChildren() const {
- return Children;
- }
-
- void SwapChildren(TChildrenCont& container) {
- container.swap(Children);
- }
-
- void ApplyACL(const TString& acl) {
- NACLib::TACL secObj(ACL);
- NACLib::TDiffACL diffACL(acl);
- secObj.ApplyDiff(diffACL);
- ACL = secObj.SerializeAsString();
- }
-
- void ApplySpecialAttributes() {
+ TPathId* FindChild(const TString& name) {
+ return Children.FindPtr(name);
+ }
+
+ const TChildrenCont& GetChildren() const {
+ return Children;
+ }
+
+ void SwapChildren(TChildrenCont& container) {
+ container.swap(Children);
+ }
+
+ void ApplyACL(const TString& acl) {
+ NACLib::TACL secObj(ACL);
+ NACLib::TDiffACL diffACL(acl);
+ secObj.ApplyDiff(diffACL);
+ ACL = secObj.SerializeAsString();
+ }
+
+ void ApplySpecialAttributes() {
VolumeSpaceRaw.Limit = Max<ui64>();
VolumeSpaceSSD.Limit = Max<ui64>();
- VolumeSpaceHDD.Limit = Max<ui64>();
+ VolumeSpaceHDD.Limit = Max<ui64>();
VolumeSpaceSSDNonrepl.Limit = Max<ui64>();
VolumeSpaceSSDSystem.Limit = Max<ui64>();
- ExtraPathSymbolsAllowed = TString();
- for (const auto& item : UserAttrs->Attrs) {
- switch (TUserAttributes::ParseName(item.first)) {
- case EAttribute::VOLUME_SPACE_LIMIT:
+ ExtraPathSymbolsAllowed = TString();
+ for (const auto& item : UserAttrs->Attrs) {
+ switch (TUserAttributes::ParseName(item.first)) {
+ case EAttribute::VOLUME_SPACE_LIMIT:
HandleAttributeValue(item.second, VolumeSpaceRaw.Limit);
- break;
- case EAttribute::VOLUME_SPACE_LIMIT_SSD:
- HandleAttributeValue(item.second, VolumeSpaceSSD.Limit);
- break;
+ break;
+ case EAttribute::VOLUME_SPACE_LIMIT_SSD:
+ HandleAttributeValue(item.second, VolumeSpaceSSD.Limit);
+ break;
case EAttribute::VOLUME_SPACE_LIMIT_HDD:
HandleAttributeValue(item.second, VolumeSpaceHDD.Limit);
- break;
+ break;
case EAttribute::VOLUME_SPACE_LIMIT_SSD_NONREPL:
HandleAttributeValue(item.second, VolumeSpaceSSDNonrepl.Limit);
break;
case EAttribute::VOLUME_SPACE_LIMIT_SSD_SYSTEM:
HandleAttributeValue(item.second, VolumeSpaceSSDSystem.Limit);
break;
- case EAttribute::EXTRA_PATH_SYMBOLS_ALLOWED:
- HandleAttributeValue(item.second, ExtraPathSymbolsAllowed);
- break;
+ case EAttribute::EXTRA_PATH_SYMBOLS_ALLOWED:
+ HandleAttributeValue(item.second, ExtraPathSymbolsAllowed);
+ break;
case EAttribute::DOCUMENT_API_VERSION:
HandleAttributeValue(item.second, DocumentApiVersion);
break;
- default:
- break;
- }
- }
- }
-
- void HandleAttributeValue(const TString& value, TString& target) {
- target = value;
- }
-
- void HandleAttributeValue(const TString& value, ui64& target) {
- ui64 parsed;
- if (TryFromString(value, parsed)) {
- target = parsed;
- }
- }
-
+ default:
+ break;
+ }
+ }
+ }
+
+ void HandleAttributeValue(const TString& value, TString& target) {
+ target = value;
+ }
+
+ void HandleAttributeValue(const TString& value, ui64& target) {
+ ui64 parsed;
+ if (TryFromString(value, parsed)) {
+ target = parsed;
+ }
+ }
+
void ChangeVolumeSpaceBegin(TVolumeSpace newSpace, TVolumeSpace oldSpace) {
auto update = [](TVolumeSpaceLimits& limits, ui64 newValue, ui64 oldValue) {
if (newValue > oldValue) {
@@ -614,8 +614,8 @@ public:
update(VolumeSpaceHDD, newSpace.HDD, oldSpace.HDD);
update(VolumeSpaceSSDNonrepl, newSpace.SSDNonrepl, oldSpace.SSDNonrepl);
update(VolumeSpaceSSDSystem, newSpace.SSDSystem, oldSpace.SSDSystem);
- }
-
+ }
+
void ChangeVolumeSpaceCommit(TVolumeSpace newSpace, TVolumeSpace oldSpace) {
auto update = [](TVolumeSpaceLimits& limits, ui64 newValue, ui64 oldValue) {
if (newValue < oldValue) {
@@ -650,33 +650,33 @@ public:
check(VolumeSpaceHDD, newSpace.HDD, oldSpace.HDD, " (hdd)") &&
check(VolumeSpaceSSDNonrepl, newSpace.SSDNonrepl, oldSpace.SSDNonrepl, " (ssd_nonrepl)") &&
check(VolumeSpaceSSDSystem, newSpace.SSDSystem, oldSpace.SSDSystem, " (ssd_system)"));
- }
-
+ }
+
bool HasRuntimeAttrs() const {
return (VolumeSpaceRaw.Allocated > 0 ||
VolumeSpaceSSD.Allocated > 0 ||
VolumeSpaceHDD.Allocated > 0 ||
VolumeSpaceSSDNonrepl.Allocated > 0 ||
VolumeSpaceSSDSystem.Allocated > 0);
- }
-
+ }
+
void SerializeRuntimeAttrs(
- google::protobuf::RepeatedPtrField<NKikimrSchemeOp::TUserAttribute>* userAttrs) const
+ google::protobuf::RepeatedPtrField<NKikimrSchemeOp::TUserAttribute>* userAttrs) const
{
auto process = [userAttrs](const TVolumeSpaceLimits& limits, const char* name) {
if (limits.Allocated > 0) {
auto* attr = userAttrs->Add();
attr->SetKey(name);
attr->SetValue(TStringBuilder() << limits.Allocated);
- }
+ }
};
process(VolumeSpaceRaw, "__volume_space_allocated");
process(VolumeSpaceSSD, "__volume_space_allocated_ssd");
process(VolumeSpaceHDD, "__volume_space_allocated_hdd");
process(VolumeSpaceSSDNonrepl, "__volume_space_allocated_ssd_nonrepl");
process(VolumeSpaceSSDSystem, "__volume_space_allocated_ssd_system");
- }
+ }
-};
-}
-}
+};
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard_private.h b/ydb/core/tx/schemeshard/schemeshard_private.h
index c1c1bb60411..207fd8d2c77 100644
--- a/ydb/core/tx/schemeshard/schemeshard_private.h
+++ b/ydb/core/tx/schemeshard/schemeshard_private.h
@@ -4,25 +4,25 @@
#include "schemeshard_identificators.h"
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
struct TEvPrivate {
enum EEv {
EvProgressOperation = EventSpaceBegin(TKikimrEvents::ES_PRIVATE),
EvOperationPlanStep,
- EvCommitTenantUpdate,
- EvUndoTenantUpdate,
+ EvCommitTenantUpdate,
+ EvUndoTenantUpdate,
EvRunConditionalErase,
- EvIndexBuildBilling,
+ EvIndexBuildBilling,
EvImportSchemeReady,
- EvServerlessStorageBilling,
+ EvServerlessStorageBilling,
EvCleanDroppedPaths,
EvCleanDroppedSubDomains,
EvSubscribeToShardDeletion,
EvNotifyShardDeleted,
EvRunBackgroundCompaction,
- EvCompletePublication,
- EvCompleteBarrier,
+ EvCompletePublication,
+ EvCompleteBarrier,
EvEnd
};
@@ -32,7 +32,7 @@ struct TEvPrivate {
// and it should run all the actions associated with this state
struct TEvProgressOperation: public TEventLocal<TEvProgressOperation, EvProgressOperation> {
const ui64 TxId;
- const ui32 TxPartId;
+ const ui32 TxPartId;
TEvProgressOperation(ui64 txId, ui32 part)
: TxId(txId)
@@ -50,29 +50,29 @@ struct TEvPrivate {
{}
};
- struct TEvCommitTenantUpdate: public TEventLocal<TEvCommitTenantUpdate, EvCommitTenantUpdate> {
- TEvCommitTenantUpdate()
- {}
- };
-
- struct TEvUndoTenantUpdate: public TEventLocal<TEvUndoTenantUpdate, EvUndoTenantUpdate> {
- TEvUndoTenantUpdate()
- {}
- };
-
+ struct TEvCommitTenantUpdate: public TEventLocal<TEvCommitTenantUpdate, EvCommitTenantUpdate> {
+ TEvCommitTenantUpdate()
+ {}
+ };
+
+ struct TEvUndoTenantUpdate: public TEventLocal<TEvUndoTenantUpdate, EvUndoTenantUpdate> {
+ TEvUndoTenantUpdate()
+ {}
+ };
+
struct TEvRunConditionalErase: public TEventLocal<TEvRunConditionalErase, EvRunConditionalErase> {
};
- struct TEvIndexBuildingMakeABill: public TEventLocal<TEvIndexBuildingMakeABill, EvIndexBuildBilling> {
- const ui64 BuildId;
- const TInstant SendAt;
-
- TEvIndexBuildingMakeABill(ui64 id, TInstant sendAt)
- : BuildId(id)
- , SendAt(std::move(sendAt))
- {}
- };
-
+ struct TEvIndexBuildingMakeABill: public TEventLocal<TEvIndexBuildingMakeABill, EvIndexBuildBilling> {
+ const ui64 BuildId;
+ const TInstant SendAt;
+
+ TEvIndexBuildingMakeABill(ui64 id, TInstant sendAt)
+ : BuildId(id)
+ , SendAt(std::move(sendAt))
+ {}
+ };
+
struct TEvImportSchemeReady: public TEventLocal<TEvImportSchemeReady, EvImportSchemeReady> {
const ui64 ImportId;
const ui32 ItemIdx;
@@ -87,11 +87,11 @@ struct TEvPrivate {
{}
};
- struct TEvServerlessStorageBilling: public TEventLocal<TEvServerlessStorageBilling, EvServerlessStorageBilling> {
- TEvServerlessStorageBilling()
- {}
- };
-
+ struct TEvServerlessStorageBilling: public TEventLocal<TEvServerlessStorageBilling, EvServerlessStorageBilling> {
+ TEvServerlessStorageBilling()
+ {}
+ };
+
struct TEvCleanDroppedPaths : public TEventLocal<TEvCleanDroppedPaths, EvCleanDroppedPaths> {
TEvCleanDroppedPaths() = default;
};
@@ -116,47 +116,47 @@ struct TEvPrivate {
{ }
};
- struct TEvCompletePublication: public TEventLocal<TEvCompletePublication, EvCompletePublication> {
- const TOperationId OpId;
- const TPathId PathId;
- const ui64 Version;
-
- TEvCompletePublication(const TOperationId& opId, const TPathId& pathId, ui64 version)
- : OpId(opId)
- , PathId(pathId)
- , Version(version)
- {}
-
- TString ToString() const {
- return TStringBuilder() << ToStringHeader()
- << " {"
- << " OpId: " << OpId
- << " PathId: " << PathId
- << " Version: " << Version
- << " }";
- }
- };
-
- struct TEvCompleteBarrier: public TEventLocal<TEvCompleteBarrier, EvCompleteBarrier> {
- const TTxId TxId;
- const TString Name;
-
- TEvCompleteBarrier(const TTxId txId, const TString name)
- : TxId(txId)
- , Name(name)
- {}
-
- TString ToString() const {
- return TStringBuilder() << ToStringHeader()
- << " {"
- << " TxId: " << TxId
- << " Name: " << Name
- << " }";
- }
- };
-
-
+ struct TEvCompletePublication: public TEventLocal<TEvCompletePublication, EvCompletePublication> {
+ const TOperationId OpId;
+ const TPathId PathId;
+ const ui64 Version;
+
+ TEvCompletePublication(const TOperationId& opId, const TPathId& pathId, ui64 version)
+ : OpId(opId)
+ , PathId(pathId)
+ , Version(version)
+ {}
+
+ TString ToString() const {
+ return TStringBuilder() << ToStringHeader()
+ << " {"
+ << " OpId: " << OpId
+ << " PathId: " << PathId
+ << " Version: " << Version
+ << " }";
+ }
+ };
+
+ struct TEvCompleteBarrier: public TEventLocal<TEvCompleteBarrier, EvCompleteBarrier> {
+ const TTxId TxId;
+ const TString Name;
+
+ TEvCompleteBarrier(const TTxId txId, const TString name)
+ : TxId(txId)
+ , Name(name)
+ {}
+
+ TString ToString() const {
+ return TStringBuilder() << ToStringHeader()
+ << " {"
+ << " TxId: " << TxId
+ << " Name: " << Name
+ << " }";
+ }
+ };
+
+
}; // TEvPrivate
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_schema.h b/ydb/core/tx/schemeshard/schemeshard_schema.h
index 8213da970c3..f293136fe85 100644
--- a/ydb/core/tx/schemeshard/schemeshard_schema.h
+++ b/ydb/core/tx/schemeshard/schemeshard_schema.h
@@ -1,126 +1,126 @@
-#pragma once
-
+#pragma once
+
#include <ydb/core/tx/schemeshard/schemeshard_types.h>
-
+
#include <ydb/core/tablet_flat/flat_cxx_database.h>
-
+
#include <ydb/core/protos/tx.pb.h>
#include <ydb/core/protos/tx_datashard.pb.h>
-
+
#include <ydb/core/base/pathid.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-struct Schema : NIceDb::Schema {
- struct Paths : Table<1> {
- struct Id : Column<1, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId; };
- struct ParentId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId; };
- struct Name : Column<3, NScheme::NTypeIds::Utf8> {};
- struct CreateFinished : Column<4, NScheme::NTypeIds::Bool> {}; // legacy
- struct PathType : Column<5, NScheme::NTypeIds::Uint32> {};
- struct StepCreated : Column<6, NScheme::NTypeIds::Uint64> { using Type = TStepId; };
- struct CreateTxId : Column<7, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct StepDropped : Column<8, NScheme::NTypeIds::Uint64> { using Type = TStepId; };
- struct DropTxId : Column<9, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct Owner : Column<10, NScheme::NTypeIds::Utf8> {};
- struct ACL : Column<11, NScheme::NTypeIds::String> {};
- struct LastTxId : Column<12, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct DirAlterVersion : Column<13, NScheme::NTypeIds::Uint64> {};
- struct UserAttrsAlterVersion : Column<14, NScheme::NTypeIds::Uint64> {};
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+struct Schema : NIceDb::Schema {
+ struct Paths : Table<1> {
+ struct Id : Column<1, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId; };
+ struct ParentId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId; };
+ struct Name : Column<3, NScheme::NTypeIds::Utf8> {};
+ struct CreateFinished : Column<4, NScheme::NTypeIds::Bool> {}; // legacy
+ struct PathType : Column<5, NScheme::NTypeIds::Uint32> {};
+ struct StepCreated : Column<6, NScheme::NTypeIds::Uint64> { using Type = TStepId; };
+ struct CreateTxId : Column<7, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct StepDropped : Column<8, NScheme::NTypeIds::Uint64> { using Type = TStepId; };
+ struct DropTxId : Column<9, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct Owner : Column<10, NScheme::NTypeIds::Utf8> {};
+ struct ACL : Column<11, NScheme::NTypeIds::String> {};
+ struct LastTxId : Column<12, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct DirAlterVersion : Column<13, NScheme::NTypeIds::Uint64> {};
+ struct UserAttrsAlterVersion : Column<14, NScheme::NTypeIds::Uint64> {};
struct ACLVersion : Column<15, NScheme::NTypeIds::Uint64> {};
- struct ParentOwnerId : Column<16, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; static constexpr Type Default = InvalidOwnerId;};
-
- using TKey = TableKey<Id>;
- using TColumns = TableColumns<Id, ParentId, Name, CreateFinished, PathType, StepCreated, CreateTxId,
- StepDropped, DropTxId, Owner, ACL, LastTxId, DirAlterVersion, UserAttrsAlterVersion, ACLVersion, ParentOwnerId>;
- };
-
- struct MigratedPaths : Table<50> {
- struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
- struct ParentOwnerId : Column<3, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct ParentLocalId : Column<4, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
- struct Name : Column<5, NScheme::NTypeIds::Utf8> {};
- struct PathType : Column<6, NScheme::NTypeIds::Uint32> {};
- struct StepCreated : Column<7, NScheme::NTypeIds::Uint64> { using Type = TStepId; };
- struct CreateTxId : Column<8, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct StepDropped : Column<9, NScheme::NTypeIds::Uint64> { using Type = TStepId; };
- struct DropTxId : Column<10, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct Owner : Column<11, NScheme::NTypeIds::Utf8> {};
- struct ACL : Column<12, NScheme::NTypeIds::String> {};
- struct LastTxId : Column<13, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct DirAlterVersion : Column<14, NScheme::NTypeIds::Uint64> {};
- struct UserAttrsAlterVersion : Column<15, NScheme::NTypeIds::Uint64> {};
- struct ACLVersion : Column<16, NScheme::NTypeIds::Uint64> {};
-
- using TKey = TableKey<OwnerPathId, LocalPathId>;
- using TColumns = TableColumns<OwnerPathId, LocalPathId, ParentOwnerId, ParentLocalId, Name, PathType, StepCreated, CreateTxId,
- StepDropped, DropTxId, Owner, ACL, LastTxId, DirAlterVersion, UserAttrsAlterVersion, ACLVersion>;
- };
-
- struct TxInFlight : Table<2> { // not in use
- struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct TxType : Column<2, NScheme::NTypeIds::Byte> {};
- struct TargetPathId : Column<3, NScheme::NTypeIds::Uint64> {};
- struct State : Column<4, NScheme::NTypeIds::Byte> {};
- struct MinStep : Column<8, NScheme::NTypeIds::Uint64> { using Type = TStepId; };
- struct ExtraBytes : Column<10, NScheme::NTypeIds::String> {};
- struct StartTime : Column<11, NScheme::NTypeIds::Uint64> {};
- struct DataTotalSize: Column<12, NScheme::NTypeIds::Uint64> {};
- struct PlanStep: Column<13, NScheme::NTypeIds::Uint64> {};
-
- using TKey = TableKey<TxId>;
- using TColumns = TableColumns<
- TxId,
- TxType,
- TargetPathId,
- State,
- MinStep,
- ExtraBytes,
- StartTime,
- DataTotalSize,
- PlanStep>;
- };
-
- struct TxDependencies : Table<3> {
- struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct DependentTxId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
-
- using TKey = TableKey<TxId, DependentTxId>;
- using TColumns = TableColumns<TxId, DependentTxId>;
- };
-
- struct TxShards : Table<11> {
- struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct ShardIdx : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
- struct Operation : Column<3, NScheme::NTypeIds::Uint32> {};
-
- using TKey = TableKey<TxId, ShardIdx>;
- using TColumns = TableColumns<TxId, ShardIdx, Operation>;
- };
-
- struct SysParams : Table<4> {
- struct Id : Column<1, NScheme::NTypeIds::Uint64> {};
- struct Value : Column<2, NScheme::NTypeIds::Utf8> {};
-
- using TKey = TableKey<Id>;
- using TColumns = TableColumns<Id, Value>;
- };
-
- /// @note (Tables|Columns).TabId = Paths.Id = Shards.PathId (correct name - PathId)
- struct Tables : Table<5> {
- struct TabId : Column<1, NScheme::NTypeIds::Uint64> {};
- struct NextColId : Column<2, NScheme::NTypeIds::Uint32> {};
- struct PartitionConfig : Column<3, NScheme::NTypeIds::Utf8> {}; // TPartitionConfig, String?
- struct AlterVersion : Column<4, NScheme::NTypeIds::Uint64> {};
- struct AlterTable : Column<5, NScheme::NTypeIds::Utf8> {}; // TTableDescription
- struct AlterTableFull : Column<6, NScheme::NTypeIds::String> {}; // TTableDescription
+ struct ParentOwnerId : Column<16, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; static constexpr Type Default = InvalidOwnerId;};
+
+ using TKey = TableKey<Id>;
+ using TColumns = TableColumns<Id, ParentId, Name, CreateFinished, PathType, StepCreated, CreateTxId,
+ StepDropped, DropTxId, Owner, ACL, LastTxId, DirAlterVersion, UserAttrsAlterVersion, ACLVersion, ParentOwnerId>;
+ };
+
+ struct MigratedPaths : Table<50> {
+ struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
+ struct ParentOwnerId : Column<3, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct ParentLocalId : Column<4, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
+ struct Name : Column<5, NScheme::NTypeIds::Utf8> {};
+ struct PathType : Column<6, NScheme::NTypeIds::Uint32> {};
+ struct StepCreated : Column<7, NScheme::NTypeIds::Uint64> { using Type = TStepId; };
+ struct CreateTxId : Column<8, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct StepDropped : Column<9, NScheme::NTypeIds::Uint64> { using Type = TStepId; };
+ struct DropTxId : Column<10, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct Owner : Column<11, NScheme::NTypeIds::Utf8> {};
+ struct ACL : Column<12, NScheme::NTypeIds::String> {};
+ struct LastTxId : Column<13, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct DirAlterVersion : Column<14, NScheme::NTypeIds::Uint64> {};
+ struct UserAttrsAlterVersion : Column<15, NScheme::NTypeIds::Uint64> {};
+ struct ACLVersion : Column<16, NScheme::NTypeIds::Uint64> {};
+
+ using TKey = TableKey<OwnerPathId, LocalPathId>;
+ using TColumns = TableColumns<OwnerPathId, LocalPathId, ParentOwnerId, ParentLocalId, Name, PathType, StepCreated, CreateTxId,
+ StepDropped, DropTxId, Owner, ACL, LastTxId, DirAlterVersion, UserAttrsAlterVersion, ACLVersion>;
+ };
+
+ struct TxInFlight : Table<2> { // not in use
+ struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct TxType : Column<2, NScheme::NTypeIds::Byte> {};
+ struct TargetPathId : Column<3, NScheme::NTypeIds::Uint64> {};
+ struct State : Column<4, NScheme::NTypeIds::Byte> {};
+ struct MinStep : Column<8, NScheme::NTypeIds::Uint64> { using Type = TStepId; };
+ struct ExtraBytes : Column<10, NScheme::NTypeIds::String> {};
+ struct StartTime : Column<11, NScheme::NTypeIds::Uint64> {};
+ struct DataTotalSize: Column<12, NScheme::NTypeIds::Uint64> {};
+ struct PlanStep: Column<13, NScheme::NTypeIds::Uint64> {};
+
+ using TKey = TableKey<TxId>;
+ using TColumns = TableColumns<
+ TxId,
+ TxType,
+ TargetPathId,
+ State,
+ MinStep,
+ ExtraBytes,
+ StartTime,
+ DataTotalSize,
+ PlanStep>;
+ };
+
+ struct TxDependencies : Table<3> {
+ struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct DependentTxId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+
+ using TKey = TableKey<TxId, DependentTxId>;
+ using TColumns = TableColumns<TxId, DependentTxId>;
+ };
+
+ struct TxShards : Table<11> {
+ struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct ShardIdx : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+ struct Operation : Column<3, NScheme::NTypeIds::Uint32> {};
+
+ using TKey = TableKey<TxId, ShardIdx>;
+ using TColumns = TableColumns<TxId, ShardIdx, Operation>;
+ };
+
+ struct SysParams : Table<4> {
+ struct Id : Column<1, NScheme::NTypeIds::Uint64> {};
+ struct Value : Column<2, NScheme::NTypeIds::Utf8> {};
+
+ using TKey = TableKey<Id>;
+ using TColumns = TableColumns<Id, Value>;
+ };
+
+ /// @note (Tables|Columns).TabId = Paths.Id = Shards.PathId (correct name - PathId)
+ struct Tables : Table<5> {
+ struct TabId : Column<1, NScheme::NTypeIds::Uint64> {};
+ struct NextColId : Column<2, NScheme::NTypeIds::Uint32> {};
+ struct PartitionConfig : Column<3, NScheme::NTypeIds::Utf8> {}; // TPartitionConfig, String?
+ struct AlterVersion : Column<4, NScheme::NTypeIds::Uint64> {};
+ struct AlterTable : Column<5, NScheme::NTypeIds::Utf8> {}; // TTableDescription
+ struct AlterTableFull : Column<6, NScheme::NTypeIds::String> {}; // TTableDescription
struct PartitioningVersion : Column<7, NScheme::NTypeIds::Uint64> {};
struct TTLSettings : Column<8, NScheme::NTypeIds::String> {};
struct IsBackup : Column<9, NScheme::NTypeIds::Bool> {};
-
- using TKey = TableKey<TabId>;
+
+ using TKey = TableKey<TabId>;
using TColumns = TableColumns<
TabId,
NextColId,
@@ -132,22 +132,22 @@ struct Schema : NIceDb::Schema {
TTLSettings,
IsBackup
>;
- };
-
- struct MigratedTables : Table<54> {
- struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
-
- struct NextColId : Column<3, NScheme::NTypeIds::Uint32> {};
- struct PartitionConfig : Column<4, NScheme::NTypeIds::Utf8> {}; // TPartitionConfig, String?
- struct AlterVersion : Column<5, NScheme::NTypeIds::Uint64> {};
- struct AlterTable : Column<6, NScheme::NTypeIds::Utf8> {}; // TTableDescription
- struct AlterTableFull : Column<7, NScheme::NTypeIds::String> {}; // TTableDescription
- struct PartitioningVersion : Column<8, NScheme::NTypeIds::Uint64> {};
+ };
+
+ struct MigratedTables : Table<54> {
+ struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
+
+ struct NextColId : Column<3, NScheme::NTypeIds::Uint32> {};
+ struct PartitionConfig : Column<4, NScheme::NTypeIds::Utf8> {}; // TPartitionConfig, String?
+ struct AlterVersion : Column<5, NScheme::NTypeIds::Uint64> {};
+ struct AlterTable : Column<6, NScheme::NTypeIds::Utf8> {}; // TTableDescription
+ struct AlterTableFull : Column<7, NScheme::NTypeIds::String> {}; // TTableDescription
+ struct PartitioningVersion : Column<8, NScheme::NTypeIds::Uint64> {};
struct TTLSettings : Column<9, NScheme::NTypeIds::String> {};
struct IsBackup : Column<10, NScheme::NTypeIds::Bool> {};
-
- using TKey = TableKey<OwnerPathId, LocalPathId>;
+
+ using TKey = TableKey<OwnerPathId, LocalPathId>;
using TColumns = TableColumns<
OwnerPathId,
LocalPathId,
@@ -160,150 +160,150 @@ struct Schema : NIceDb::Schema {
TTLSettings,
IsBackup
>;
- };
-
- struct Columns : Table<6> {
- struct TabId : Column<1, NScheme::NTypeIds::Uint64> {};
- struct ColId : Column<2, NScheme::NTypeIds::Uint32> {};
- struct ColName : Column<3, NScheme::NTypeIds::Utf8> {};
- struct ColType : Column<4, NScheme::NTypeIds::Uint32> {};
- struct ColKeyOrder : Column<5, NScheme::NTypeIds::Uint32> {};
- struct CreateVersion : Column<6, NScheme::NTypeIds::Uint64> {};
- struct DeleteVersion : Column<7, NScheme::NTypeIds::Uint64> {};
- struct Family : Column<8, NScheme::NTypeIds::Uint32> {};
+ };
+
+ struct Columns : Table<6> {
+ struct TabId : Column<1, NScheme::NTypeIds::Uint64> {};
+ struct ColId : Column<2, NScheme::NTypeIds::Uint32> {};
+ struct ColName : Column<3, NScheme::NTypeIds::Utf8> {};
+ struct ColType : Column<4, NScheme::NTypeIds::Uint32> {};
+ struct ColKeyOrder : Column<5, NScheme::NTypeIds::Uint32> {};
+ struct CreateVersion : Column<6, NScheme::NTypeIds::Uint64> {};
+ struct DeleteVersion : Column<7, NScheme::NTypeIds::Uint64> {};
+ struct Family : Column<8, NScheme::NTypeIds::Uint32> {};
struct DefaultKind : Column<9, NScheme::NTypeIds::Uint32> { using Type = ETableColumnDefaultKind; static constexpr Type Default = Type::None; };
struct DefaultValue : Column<10, NScheme::NTypeIds::String> {};
struct NotNull: Column<11, NScheme::NTypeIds::Bool> {};
-
- using TKey = TableKey<TabId, ColId>;
- using TColumns = TableColumns<TabId,
- ColId, ColName, ColType, ColKeyOrder, CreateVersion, DeleteVersion,
+
+ using TKey = TableKey<TabId, ColId>;
+ using TColumns = TableColumns<TabId,
+ ColId, ColName, ColType, ColKeyOrder, CreateVersion, DeleteVersion,
Family, DefaultKind, DefaultValue, NotNull>;
- };
-
- struct MigratedColumns : Table<55> {
- struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
- struct ColId : Column<3, NScheme::NTypeIds::Uint32> {};
-
- struct ColName : Column<4, NScheme::NTypeIds::Utf8> {};
- struct ColType : Column<5, NScheme::NTypeIds::Uint32> {};
- struct ColKeyOrder : Column<6, NScheme::NTypeIds::Uint32> {};
- struct CreateVersion : Column<7, NScheme::NTypeIds::Uint64> {};
- struct DeleteVersion : Column<8, NScheme::NTypeIds::Uint64> {};
- struct Family : Column<9, NScheme::NTypeIds::Uint32> {};
+ };
+
+ struct MigratedColumns : Table<55> {
+ struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
+ struct ColId : Column<3, NScheme::NTypeIds::Uint32> {};
+
+ struct ColName : Column<4, NScheme::NTypeIds::Utf8> {};
+ struct ColType : Column<5, NScheme::NTypeIds::Uint32> {};
+ struct ColKeyOrder : Column<6, NScheme::NTypeIds::Uint32> {};
+ struct CreateVersion : Column<7, NScheme::NTypeIds::Uint64> {};
+ struct DeleteVersion : Column<8, NScheme::NTypeIds::Uint64> {};
+ struct Family : Column<9, NScheme::NTypeIds::Uint32> {};
struct DefaultKind : Column<10, NScheme::NTypeIds::Uint32> { using Type = ETableColumnDefaultKind; static constexpr Type Default = Type::None; };
struct DefaultValue : Column<11, NScheme::NTypeIds::String> {};
struct NotNull: Column<12, NScheme::NTypeIds::Bool> {};
-
- using TKey = TableKey<OwnerPathId, LocalPathId, ColId>;
- using TColumns = TableColumns<OwnerPathId, LocalPathId, ColId,
- ColName, ColType, ColKeyOrder, CreateVersion, DeleteVersion,
+
+ using TKey = TableKey<OwnerPathId, LocalPathId, ColId>;
+ using TColumns = TableColumns<OwnerPathId, LocalPathId, ColId,
+ ColName, ColType, ColKeyOrder, CreateVersion, DeleteVersion,
Family, DefaultKind, DefaultValue, NotNull>;
- };
-
- struct ColumnAlters : Table<13> {
- struct TabId : Column<1, NScheme::NTypeIds::Uint64> {};
- struct ColId : Column<2, NScheme::NTypeIds::Uint32> {};
- struct ColName : Column<3, NScheme::NTypeIds::Utf8> {};
- struct ColType : Column<4, NScheme::NTypeIds::Uint32> {};
- struct ColKeyOrder : Column<5, NScheme::NTypeIds::Uint32> {};
- struct CreateVersion : Column<6, NScheme::NTypeIds::Uint64> {};
- struct DeleteVersion : Column<7, NScheme::NTypeIds::Uint64> {};
- struct Family : Column<8, NScheme::NTypeIds::Uint32> {};
+ };
+
+ struct ColumnAlters : Table<13> {
+ struct TabId : Column<1, NScheme::NTypeIds::Uint64> {};
+ struct ColId : Column<2, NScheme::NTypeIds::Uint32> {};
+ struct ColName : Column<3, NScheme::NTypeIds::Utf8> {};
+ struct ColType : Column<4, NScheme::NTypeIds::Uint32> {};
+ struct ColKeyOrder : Column<5, NScheme::NTypeIds::Uint32> {};
+ struct CreateVersion : Column<6, NScheme::NTypeIds::Uint64> {};
+ struct DeleteVersion : Column<7, NScheme::NTypeIds::Uint64> {};
+ struct Family : Column<8, NScheme::NTypeIds::Uint32> {};
struct DefaultKind : Column<9, NScheme::NTypeIds::Uint32> { using Type = ETableColumnDefaultKind; static constexpr Type Default = Type::None; };
struct DefaultValue : Column<10, NScheme::NTypeIds::String> {};
struct NotNull: Column<11, NScheme::NTypeIds::Bool> {};
-
- using TKey = TableKey<TabId, ColId>;
- using TColumns = TableColumns<TabId, ColId, ColName, ColType, ColKeyOrder, CreateVersion, DeleteVersion,
+
+ using TKey = TableKey<TabId, ColId>;
+ using TColumns = TableColumns<TabId, ColId, ColName, ColType, ColKeyOrder, CreateVersion, DeleteVersion,
Family, DefaultKind, DefaultValue, NotNull>;
- };
-
- struct MigratedColumnAlters : Table<63> {
- struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
- struct ColId : Column<3, NScheme::NTypeIds::Uint32> {};
-
- struct ColName : Column<4, NScheme::NTypeIds::Utf8> {};
- struct ColType : Column<5, NScheme::NTypeIds::Uint32> {};
- struct ColKeyOrder : Column<6, NScheme::NTypeIds::Uint32> {};
- struct CreateVersion : Column<7, NScheme::NTypeIds::Uint64> {};
- struct DeleteVersion : Column<8, NScheme::NTypeIds::Uint64> {};
- struct Family : Column<9, NScheme::NTypeIds::Uint32> {};
+ };
+
+ struct MigratedColumnAlters : Table<63> {
+ struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
+ struct ColId : Column<3, NScheme::NTypeIds::Uint32> {};
+
+ struct ColName : Column<4, NScheme::NTypeIds::Utf8> {};
+ struct ColType : Column<5, NScheme::NTypeIds::Uint32> {};
+ struct ColKeyOrder : Column<6, NScheme::NTypeIds::Uint32> {};
+ struct CreateVersion : Column<7, NScheme::NTypeIds::Uint64> {};
+ struct DeleteVersion : Column<8, NScheme::NTypeIds::Uint64> {};
+ struct Family : Column<9, NScheme::NTypeIds::Uint32> {};
struct DefaultKind : Column<10, NScheme::NTypeIds::Uint32> { using Type = ETableColumnDefaultKind; static constexpr Type Default = Type::None; };
struct DefaultValue : Column<11, NScheme::NTypeIds::String> {};
struct NotNull: Column<12, NScheme::NTypeIds::Bool> {};
-
- using TKey = TableKey<OwnerPathId, LocalPathId, ColId>;
- using TColumns = TableColumns<OwnerPathId, LocalPathId, ColId, ColName, ColType, ColKeyOrder, CreateVersion, DeleteVersion,
+
+ using TKey = TableKey<OwnerPathId, LocalPathId, ColId>;
+ using TColumns = TableColumns<OwnerPathId, LocalPathId, ColId, ColName, ColType, ColKeyOrder, CreateVersion, DeleteVersion,
Family, DefaultKind, DefaultValue, NotNull>;
- };
-
- struct Shards : Table<7> {
- struct ShardIdx : Column<1, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
- struct TabletId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TTabletId; };
- struct PathId : Column<3, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId; }; // LocalPathId
- // there can be only 1 schema Tx on a shard at any moment in time
- struct LastTxId : Column<4, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct TabletType : Column<5, NScheme::NTypeIds::Uint32> { using Type = TTabletTypes::EType; static constexpr Type Default = ETabletType::TypeInvalid; };
- struct OwnerPathId : Column<6, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; static constexpr Type Default = InvalidOwnerId;};
-
- using TKey = TableKey<ShardIdx>;
- using TColumns = TableColumns<ShardIdx, TabletId, PathId, LastTxId, TabletType, OwnerPathId>;
- };
-
- struct MigratedShards : Table<52> {
- struct OwnerShardId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct LocalShardId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx;};
-
- struct TabletId : Column<3, NScheme::NTypeIds::Uint64> { using Type = TTabletId;};
- struct OwnerPathId : Column<4, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct LocalPathId : Column<5, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
-
- // there can be only 1 schema Tx on a shard at any moment in time
- struct LastTxId : Column<6, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct TabletType : Column<7, NScheme::NTypeIds::Uint32> { using Type = TTabletTypes::EType; static constexpr Type Default = ETabletType::TypeInvalid; };
-
- using TKey = TableKey<OwnerShardId, LocalShardId>;
- using TColumns = TableColumns<OwnerShardId, LocalShardId, TabletId, OwnerPathId, LocalPathId, LastTxId, TabletType>;
- };
-
- struct ChannelsBinding : Table<28> {
- struct ShardId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
- struct ChannelId : Column<2, NScheme::NTypeIds::Uint32> {};
-
- struct PoolName : Column<4, NScheme::NTypeIds::Utf8> {};
- struct Binding: Column<5, NScheme::NTypeIds::String> {};
-
- using TKey = TableKey<ShardId, ChannelId>;
- using TColumns = TableColumns<ShardId, ChannelId, PoolName, Binding>;
- };
-
- struct MigratedChannelsBinding : Table<53> {
- struct OwnerShardId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct LocalShardId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx;};
- struct ChannelId : Column<3, NScheme::NTypeIds::Uint32> {};
-
- struct PoolName : Column<4, NScheme::NTypeIds::Utf8> {};
- struct Binding: Column<5, NScheme::NTypeIds::String> {};
-
- using TKey = TableKey<OwnerShardId, LocalShardId, ChannelId>;
- using TColumns = TableColumns<OwnerShardId, LocalShardId, ChannelId, PoolName, Binding>;
- };
-
- struct TablePartitions : Table<8> {
- struct TabId : Column<1, NScheme::NTypeIds::Uint64> {};
- struct Id : Column<2, NScheme::NTypeIds::Uint64> {};
- struct RangeEnd : Column<3, NScheme::NTypeIds::String> { using Type = TString; };
- struct DatashardIdx : Column<4, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+ };
+
+ struct Shards : Table<7> {
+ struct ShardIdx : Column<1, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+ struct TabletId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TTabletId; };
+ struct PathId : Column<3, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId; }; // LocalPathId
+ // there can be only 1 schema Tx on a shard at any moment in time
+ struct LastTxId : Column<4, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct TabletType : Column<5, NScheme::NTypeIds::Uint32> { using Type = TTabletTypes::EType; static constexpr Type Default = ETabletType::TypeInvalid; };
+ struct OwnerPathId : Column<6, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; static constexpr Type Default = InvalidOwnerId;};
+
+ using TKey = TableKey<ShardIdx>;
+ using TColumns = TableColumns<ShardIdx, TabletId, PathId, LastTxId, TabletType, OwnerPathId>;
+ };
+
+ struct MigratedShards : Table<52> {
+ struct OwnerShardId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct LocalShardId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx;};
+
+ struct TabletId : Column<3, NScheme::NTypeIds::Uint64> { using Type = TTabletId;};
+ struct OwnerPathId : Column<4, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct LocalPathId : Column<5, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
+
+ // there can be only 1 schema Tx on a shard at any moment in time
+ struct LastTxId : Column<6, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct TabletType : Column<7, NScheme::NTypeIds::Uint32> { using Type = TTabletTypes::EType; static constexpr Type Default = ETabletType::TypeInvalid; };
+
+ using TKey = TableKey<OwnerShardId, LocalShardId>;
+ using TColumns = TableColumns<OwnerShardId, LocalShardId, TabletId, OwnerPathId, LocalPathId, LastTxId, TabletType>;
+ };
+
+ struct ChannelsBinding : Table<28> {
+ struct ShardId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+ struct ChannelId : Column<2, NScheme::NTypeIds::Uint32> {};
+
+ struct PoolName : Column<4, NScheme::NTypeIds::Utf8> {};
+ struct Binding: Column<5, NScheme::NTypeIds::String> {};
+
+ using TKey = TableKey<ShardId, ChannelId>;
+ using TColumns = TableColumns<ShardId, ChannelId, PoolName, Binding>;
+ };
+
+ struct MigratedChannelsBinding : Table<53> {
+ struct OwnerShardId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct LocalShardId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx;};
+ struct ChannelId : Column<3, NScheme::NTypeIds::Uint32> {};
+
+ struct PoolName : Column<4, NScheme::NTypeIds::Utf8> {};
+ struct Binding: Column<5, NScheme::NTypeIds::String> {};
+
+ using TKey = TableKey<OwnerShardId, LocalShardId, ChannelId>;
+ using TColumns = TableColumns<OwnerShardId, LocalShardId, ChannelId, PoolName, Binding>;
+ };
+
+ struct TablePartitions : Table<8> {
+ struct TabId : Column<1, NScheme::NTypeIds::Uint64> {};
+ struct Id : Column<2, NScheme::NTypeIds::Uint64> {};
+ struct RangeEnd : Column<3, NScheme::NTypeIds::String> { using Type = TString; };
+ struct DatashardIdx : Column<4, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
struct LastCondErase : Column<5, NScheme::NTypeIds::Uint64> {};
struct NextCondErase : Column<6, NScheme::NTypeIds::Uint64> {};
-
- using TKey = TableKey<TabId, Id>;
+
+ using TKey = TableKey<TabId, Id>;
using TColumns = TableColumns<TabId, Id, RangeEnd, DatashardIdx, LastCondErase, NextCondErase>;
- };
-
+ };
+
struct TablePartitionStats: Table<101> { // HACK: Force to use policy with multiple levels
// key
struct TableOwnerId: Column<1, NScheme::NTypeIds::Uint64> {using Type = TOwnerId;};
@@ -380,30 +380,30 @@ struct Schema : NIceDb::Schema {
>;
};
- struct MigratedTablePartitions : Table<56> {
- struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
- struct Id : Column<3, NScheme::NTypeIds::Uint64> {};
-
- struct RangeEnd : Column<4, NScheme::NTypeIds::String> { using Type = TString; };
- struct OwnerShardIdx : Column<5, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; };
- struct LocalShardIdx : Column<6, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+ struct MigratedTablePartitions : Table<56> {
+ struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
+ struct Id : Column<3, NScheme::NTypeIds::Uint64> {};
+
+ struct RangeEnd : Column<4, NScheme::NTypeIds::String> { using Type = TString; };
+ struct OwnerShardIdx : Column<5, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; };
+ struct LocalShardIdx : Column<6, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
struct LastCondErase : Column<7, NScheme::NTypeIds::Uint64> {};
struct NextCondErase : Column<8, NScheme::NTypeIds::Uint64> {};
-
- using TKey = TableKey<OwnerPathId, LocalPathId, Id>;
+
+ using TKey = TableKey<OwnerPathId, LocalPathId, Id>;
using TColumns = TableColumns<OwnerPathId, LocalPathId, Id, RangeEnd, OwnerShardIdx, LocalShardIdx, LastCondErase, NextCondErase>;
- };
-
- struct PersQueueGroups : Table<9> {
- struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
- struct TabletConfig : Column<2, NScheme::NTypeIds::Utf8> {};
- struct MaxPQPerShard : Column<3, NScheme::NTypeIds::Uint32> {};
- struct AlterVersion : Column<4, NScheme::NTypeIds::Uint64> {};
- struct NextPartitionId : Column<5, NScheme::NTypeIds::Uint32> {};
- struct TotalGroupCount : Column<6, NScheme::NTypeIds::Uint32> {};
-
- using TKey = TableKey<PathId>;
+ };
+
+ struct PersQueueGroups : Table<9> {
+ struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
+ struct TabletConfig : Column<2, NScheme::NTypeIds::Utf8> {};
+ struct MaxPQPerShard : Column<3, NScheme::NTypeIds::Uint32> {};
+ struct AlterVersion : Column<4, NScheme::NTypeIds::Uint64> {};
+ struct NextPartitionId : Column<5, NScheme::NTypeIds::Uint32> {};
+ struct TotalGroupCount : Column<6, NScheme::NTypeIds::Uint32> {};
+
+ using TKey = TableKey<PathId>;
using TColumns = TableColumns<
PathId,
TabletConfig,
@@ -412,18 +412,18 @@ struct Schema : NIceDb::Schema {
NextPartitionId,
TotalGroupCount
>;
- };
-
- struct PersQueueGroupAlters : Table<12> {
- struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
- struct TabletConfig : Column<2, NScheme::NTypeIds::Utf8> {};
- struct MaxPQPerShard : Column<3, NScheme::NTypeIds::Uint32> {};
- struct AlterVersion : Column<4, NScheme::NTypeIds::Uint64> {};
- struct NextPartitionId : Column<6, NScheme::NTypeIds::Uint32> {};
- struct TotalGroupCount : Column<5, NScheme::NTypeIds::Uint32> {};
+ };
+
+ struct PersQueueGroupAlters : Table<12> {
+ struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
+ struct TabletConfig : Column<2, NScheme::NTypeIds::Utf8> {};
+ struct MaxPQPerShard : Column<3, NScheme::NTypeIds::Uint32> {};
+ struct AlterVersion : Column<4, NScheme::NTypeIds::Uint64> {};
+ struct NextPartitionId : Column<6, NScheme::NTypeIds::Uint32> {};
+ struct TotalGroupCount : Column<5, NScheme::NTypeIds::Uint32> {};
struct BootstrapConfig : Column<7, NScheme::NTypeIds::String> { using Type = TString; };
-
- using TKey = TableKey<PathId>;
+
+ using TKey = TableKey<PathId>;
using TColumns = TableColumns<
PathId,
TabletConfig,
@@ -433,113 +433,113 @@ struct Schema : NIceDb::Schema {
TotalGroupCount,
BootstrapConfig
>;
- };
-
- struct PersQueues : Table<10> {
- struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
- struct PqId : Column<2, NScheme::NTypeIds::Uint32> {};
- struct ShardIdx : Column<3, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
- struct AlterVersion : Column<4, NScheme::NTypeIds::Uint64> {};
- struct GroupId : Column<5, NScheme::NTypeIds::Uint32> {};
+ };
+
+ struct PersQueues : Table<10> {
+ struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
+ struct PqId : Column<2, NScheme::NTypeIds::Uint32> {};
+ struct ShardIdx : Column<3, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+ struct AlterVersion : Column<4, NScheme::NTypeIds::Uint64> {};
+ struct GroupId : Column<5, NScheme::NTypeIds::Uint32> {};
struct RangeBegin : Column<6, NScheme::NTypeIds::String> { using Type = TString; };
struct RangeEnd : Column<7, NScheme::NTypeIds::String> { using Type = TString; };
-
- using TKey = TableKey<PathId, PqId>;
+
+ using TKey = TableKey<PathId, PqId>;
using TColumns = TableColumns<PathId, PqId, ShardIdx, AlterVersion, GroupId, RangeBegin, RangeEnd>;
- };
-
- struct RtmrVolumes : Table<20> {
- struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
- struct PartitionsCount :Column<2, NScheme::NTypeIds::Uint32> {};
-
- using TKey = TableKey<PathId>;
- using TColumns = TableColumns<PathId, PartitionsCount>;
- };
-
- struct RTMRPartitions : Table<25> {
- struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
- struct PartitionId : Column<2, NScheme::NTypeIds::String> {};
- struct BusKey : Column<3, NScheme::NTypeIds::Uint64> {};
- struct ShardIdx : Column<4, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
-
- using TKey = TableKey<PathId, ShardIdx>;
- using TColumns = TableColumns<PathId, PartitionId, BusKey, ShardIdx>;
- };
-
- struct SolomonVolumes : Table<29> {
- struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
- struct Version : Column<2, NScheme::NTypeIds::Uint64> {};
-
- using TKey = TableKey<PathId>;
- using TColumns = TableColumns<PathId, Version>;
- };
-
- struct SolomonPartitions : Table<30> {
- struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
- struct ShardId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
- struct PartitionId : Column<3, NScheme::NTypeIds::Uint64> {};
-
- using TKey = TableKey<PathId, ShardId>;
- using TColumns = TableColumns<PathId, ShardId, PartitionId>;
- };
-
- struct AlterSolomonVolumes : Table<75> {
- struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
- struct Version : Column<3, NScheme::NTypeIds::Uint64> {};
-
-
- using TKey = TableKey<OwnerPathId, LocalPathId>;
- using TColumns = TableColumns<OwnerPathId, LocalPathId, Version>;
- };
-
- struct AlterSolomonPartitions : Table<76> {
- struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
-
- struct ShardOwnerId : Column<3, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; };
- struct ShardLocalIdx : Column<4, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
-
- struct PartitionId : Column<5, NScheme::NTypeIds::Uint64> {};
-
- using TKey = TableKey<OwnerPathId, LocalPathId, ShardOwnerId, ShardLocalIdx>;
- using TColumns = TableColumns<OwnerPathId, LocalPathId, ShardOwnerId, ShardLocalIdx, PartitionId>;
- };
-
- struct ShardsToDelete : Table<14> {
- struct ShardIdx : Column<1, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
-
- using TKey = TableKey<ShardIdx>;
- using TColumns = TableColumns<ShardIdx>;
- };
-
- struct MigratedShardsToDelete: Table<60> {
- struct ShardOwnerId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; };
- struct ShardLocalIdx : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
-
- using TKey = TableKey<ShardOwnerId, ShardLocalIdx>;
- using TColumns = TableColumns<ShardOwnerId, ShardLocalIdx>;
- };
-
- struct BackupSettings: Table<15> {
- struct PathId: Column<1, NScheme::NTypeIds::Uint64> {using Type = TLocalPathId;};
- struct TableName: Column<2, NScheme::NTypeIds::Utf8> {};
- struct YTSettings: Column<3, NScheme::NTypeIds::String> {};
+ };
+
+ struct RtmrVolumes : Table<20> {
+ struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
+ struct PartitionsCount :Column<2, NScheme::NTypeIds::Uint32> {};
+
+ using TKey = TableKey<PathId>;
+ using TColumns = TableColumns<PathId, PartitionsCount>;
+ };
+
+ struct RTMRPartitions : Table<25> {
+ struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
+ struct PartitionId : Column<2, NScheme::NTypeIds::String> {};
+ struct BusKey : Column<3, NScheme::NTypeIds::Uint64> {};
+ struct ShardIdx : Column<4, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+
+ using TKey = TableKey<PathId, ShardIdx>;
+ using TColumns = TableColumns<PathId, PartitionId, BusKey, ShardIdx>;
+ };
+
+ struct SolomonVolumes : Table<29> {
+ struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
+ struct Version : Column<2, NScheme::NTypeIds::Uint64> {};
+
+ using TKey = TableKey<PathId>;
+ using TColumns = TableColumns<PathId, Version>;
+ };
+
+ struct SolomonPartitions : Table<30> {
+ struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
+ struct ShardId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+ struct PartitionId : Column<3, NScheme::NTypeIds::Uint64> {};
+
+ using TKey = TableKey<PathId, ShardId>;
+ using TColumns = TableColumns<PathId, ShardId, PartitionId>;
+ };
+
+ struct AlterSolomonVolumes : Table<75> {
+ struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
+ struct Version : Column<3, NScheme::NTypeIds::Uint64> {};
+
+
+ using TKey = TableKey<OwnerPathId, LocalPathId>;
+ using TColumns = TableColumns<OwnerPathId, LocalPathId, Version>;
+ };
+
+ struct AlterSolomonPartitions : Table<76> {
+ struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
+
+ struct ShardOwnerId : Column<3, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; };
+ struct ShardLocalIdx : Column<4, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+
+ struct PartitionId : Column<5, NScheme::NTypeIds::Uint64> {};
+
+ using TKey = TableKey<OwnerPathId, LocalPathId, ShardOwnerId, ShardLocalIdx>;
+ using TColumns = TableColumns<OwnerPathId, LocalPathId, ShardOwnerId, ShardLocalIdx, PartitionId>;
+ };
+
+ struct ShardsToDelete : Table<14> {
+ struct ShardIdx : Column<1, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+
+ using TKey = TableKey<ShardIdx>;
+ using TColumns = TableColumns<ShardIdx>;
+ };
+
+ struct MigratedShardsToDelete: Table<60> {
+ struct ShardOwnerId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; };
+ struct ShardLocalIdx : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+
+ using TKey = TableKey<ShardOwnerId, ShardLocalIdx>;
+ using TColumns = TableColumns<ShardOwnerId, ShardLocalIdx>;
+ };
+
+ struct BackupSettings: Table<15> {
+ struct PathId: Column<1, NScheme::NTypeIds::Uint64> {using Type = TLocalPathId;};
+ struct TableName: Column<2, NScheme::NTypeIds::Utf8> {};
+ struct YTSettings: Column<3, NScheme::NTypeIds::String> {};
struct S3Settings: Column<6, NScheme::NTypeIds::String> {};
struct TableDescription : Column<7, NScheme::NTypeIds::String> {};
struct NumberOfRetries : Column<8, NScheme::NTypeIds::Uint32> {};
struct ScanSettings : Column<9, NScheme::NTypeIds::String> {};
struct NeedToBill: Column<10, NScheme::NTypeIds::Bool> {};
// deprecated
- struct CreateDestinationFlag: Column<4, NScheme::NTypeIds::Bool> {};
- struct EraseOldDataFlag: Column<5, NScheme::NTypeIds::Bool> {};
-
- using TKey = TableKey<PathId>;
- using TColumns = TableColumns<
- PathId,
- TableName,
- YTSettings,
- CreateDestinationFlag,
+ struct CreateDestinationFlag: Column<4, NScheme::NTypeIds::Bool> {};
+ struct EraseOldDataFlag: Column<5, NScheme::NTypeIds::Bool> {};
+
+ using TKey = TableKey<PathId>;
+ using TColumns = TableColumns<
+ PathId,
+ TableName,
+ YTSettings,
+ CreateDestinationFlag,
EraseOldDataFlag,
S3Settings,
TableDescription,
@@ -547,30 +547,30 @@ struct Schema : NIceDb::Schema {
ScanSettings,
NeedToBill
>;
- };
-
- struct MigratedBackupSettings: Table<64> {
- struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
-
- struct TableName: Column<3, NScheme::NTypeIds::Utf8> {};
- struct YTSettings: Column<4, NScheme::NTypeIds::String> {};
+ };
+
+ struct MigratedBackupSettings: Table<64> {
+ struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
+
+ struct TableName: Column<3, NScheme::NTypeIds::Utf8> {};
+ struct YTSettings: Column<4, NScheme::NTypeIds::String> {};
struct S3Settings: Column<7, NScheme::NTypeIds::String> {};
struct TableDescription : Column<8, NScheme::NTypeIds::String> {};
struct NumberOfRetries : Column<9, NScheme::NTypeIds::Uint32> {};
struct ScanSettings : Column<10, NScheme::NTypeIds::String> {};
struct NeedToBill: Column<11, NScheme::NTypeIds::Bool> {};
// deprecated
- struct CreateDestinationFlag: Column<5, NScheme::NTypeIds::Bool> {};
- struct EraseOldDataFlag: Column<6, NScheme::NTypeIds::Bool> {};
-
- using TKey = TableKey<OwnerPathId, LocalPathId>;
- using TColumns = TableColumns<
- OwnerPathId,
- LocalPathId,
- TableName,
- YTSettings,
- CreateDestinationFlag,
+ struct CreateDestinationFlag: Column<5, NScheme::NTypeIds::Bool> {};
+ struct EraseOldDataFlag: Column<6, NScheme::NTypeIds::Bool> {};
+
+ using TKey = TableKey<OwnerPathId, LocalPathId>;
+ using TColumns = TableColumns<
+ OwnerPathId,
+ LocalPathId,
+ TableName,
+ YTSettings,
+ CreateDestinationFlag,
EraseOldDataFlag,
S3Settings,
TableDescription,
@@ -578,103 +578,103 @@ struct Schema : NIceDb::Schema {
ScanSettings,
NeedToBill
>;
- };
-
- struct CompletedBackups: Table<16> {
- struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
- struct TxId: Column<2, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct DateTimeOfCompletion: Column<3, NScheme::NTypeIds::Uint64> {};
-
- struct SuccessShardCount: Column<4, NScheme::NTypeIds::Uint32> {};
- struct TotalShardCount: Column<5, NScheme::NTypeIds::Uint32> {};
- struct StartTime: Column<6, NScheme::NTypeIds::Uint64> {};
- struct YTSettings: Column<7, NScheme::NTypeIds::String> {};
+ };
+
+ struct CompletedBackups: Table<16> {
+ struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
+ struct TxId: Column<2, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct DateTimeOfCompletion: Column<3, NScheme::NTypeIds::Uint64> {};
+
+ struct SuccessShardCount: Column<4, NScheme::NTypeIds::Uint32> {};
+ struct TotalShardCount: Column<5, NScheme::NTypeIds::Uint32> {};
+ struct StartTime: Column<6, NScheme::NTypeIds::Uint64> {};
+ struct YTSettings: Column<7, NScheme::NTypeIds::String> {};
struct S3Settings: Column<9, NScheme::NTypeIds::String> {};
- struct DataTotalSize: Column<8, NScheme::NTypeIds::Uint64> {};
+ struct DataTotalSize: Column<8, NScheme::NTypeIds::Uint64> {};
struct Kind: Column<10, NScheme::NTypeIds::Byte> {};
-
- using TKey = TableKey<PathId, TxId, DateTimeOfCompletion>;
- using TColumns = TableColumns<
- PathId,
- TxId,
- DateTimeOfCompletion,
- SuccessShardCount,
- TotalShardCount,
- StartTime,
- YTSettings,
+
+ using TKey = TableKey<PathId, TxId, DateTimeOfCompletion>;
+ using TColumns = TableColumns<
+ PathId,
+ TxId,
+ DateTimeOfCompletion,
+ SuccessShardCount,
+ TotalShardCount,
+ StartTime,
+ YTSettings,
DataTotalSize,
S3Settings,
Kind
- >;
- };
-
- struct MigratedCompletedBackups: Table<65> {
- struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
- struct TxId : Column<3, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct DateTimeOfCompletion: Column<5, NScheme::NTypeIds::Uint64> {};
-
- struct SuccessShardCount: Column<6, NScheme::NTypeIds::Uint32> {};
- struct TotalShardCount: Column<7, NScheme::NTypeIds::Uint32> {};
- struct StartTime: Column<8, NScheme::NTypeIds::Uint64> {};
- struct YTSettings: Column<9, NScheme::NTypeIds::String> {};
+ >;
+ };
+
+ struct MigratedCompletedBackups: Table<65> {
+ struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
+ struct TxId : Column<3, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct DateTimeOfCompletion: Column<5, NScheme::NTypeIds::Uint64> {};
+
+ struct SuccessShardCount: Column<6, NScheme::NTypeIds::Uint32> {};
+ struct TotalShardCount: Column<7, NScheme::NTypeIds::Uint32> {};
+ struct StartTime: Column<8, NScheme::NTypeIds::Uint64> {};
+ struct YTSettings: Column<9, NScheme::NTypeIds::String> {};
struct S3Settings: Column<11, NScheme::NTypeIds::String> {};
- struct DataTotalSize: Column<10, NScheme::NTypeIds::Uint64> {};
+ struct DataTotalSize: Column<10, NScheme::NTypeIds::Uint64> {};
struct Kind: Column<12, NScheme::NTypeIds::Byte> {};
-
- using TKey = TableKey<OwnerPathId, LocalPathId, TxId, DateTimeOfCompletion>;
-
- using TColumns = TableColumns<
- OwnerPathId,
- LocalPathId,
- TxId,
- DateTimeOfCompletion,
- SuccessShardCount,
- TotalShardCount,
- StartTime,
- YTSettings,
+
+ using TKey = TableKey<OwnerPathId, LocalPathId, TxId, DateTimeOfCompletion>;
+
+ using TColumns = TableColumns<
+ OwnerPathId,
+ LocalPathId,
+ TxId,
+ DateTimeOfCompletion,
+ SuccessShardCount,
+ TotalShardCount,
+ StartTime,
+ YTSettings,
DataTotalSize,
S3Settings,
Kind
>;
- };
-
+ };
+
// *ShardBackupStatus is deprecated, use TxShardStatus instead
- struct ShardBackupStatus: Table<17> {
- struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct ShardIdx : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
-
- struct Explain : Column<3, NScheme::NTypeIds::Utf8> {};
-
- using TKey = TableKey<TxId, ShardIdx>;
- using TColumns = TableColumns<
- TxId,
- ShardIdx,
- Explain
- >;
- };
-
- struct MigratedShardBackupStatus: Table<66> {
- struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct OwnerShardId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct LocalShardId : Column<3, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx;};
-
- struct Explain: Column<4, NScheme::NTypeIds::Utf8> {};
-
- using TKey = TableKey<TxId, OwnerShardId, LocalShardId>;
- using TColumns = TableColumns<
- TxId,
- OwnerShardId,
- LocalShardId,
- Explain
- >;
- };
-
+ struct ShardBackupStatus: Table<17> {
+ struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct ShardIdx : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+
+ struct Explain : Column<3, NScheme::NTypeIds::Utf8> {};
+
+ using TKey = TableKey<TxId, ShardIdx>;
+ using TColumns = TableColumns<
+ TxId,
+ ShardIdx,
+ Explain
+ >;
+ };
+
+ struct MigratedShardBackupStatus: Table<66> {
+ struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct OwnerShardId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct LocalShardId : Column<3, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx;};
+
+ struct Explain: Column<4, NScheme::NTypeIds::Utf8> {};
+
+ using TKey = TableKey<TxId, OwnerShardId, LocalShardId>;
+ using TColumns = TableColumns<
+ TxId,
+ OwnerShardId,
+ LocalShardId,
+ Explain
+ >;
+ };
+
struct TxShardStatus : Table<87> {
struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
struct OwnerShardId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
struct LocalShardId : Column<3, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx;};
-
+
struct Success : Column<4, NScheme::NTypeIds::Bool> {};
struct Error : Column<5, NScheme::NTypeIds::Utf8> {};
struct BytesProcessed : Column<6, NScheme::NTypeIds::Uint64> {};
@@ -692,24 +692,24 @@ struct Schema : NIceDb::Schema {
>;
};
- struct SubDomains: Table<18> {
- struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
- struct AlterVersion : Column<2, NScheme::NTypeIds::Uint64> {};
- struct PlanResolution : Column<3, NScheme::NTypeIds::Uint64> {};
- struct TimeCastBuckets : Column<4, NScheme::NTypeIds::Uint32> {};
- struct DepthLimit : Column<5, NScheme::NTypeIds::Uint64> {};
- struct PathsLimit : Column<6, NScheme::NTypeIds::Uint64> {};
- struct ChildrenLimit : Column<7, NScheme::NTypeIds::Uint64> {};
- struct ShardsLimit : Column<8, NScheme::NTypeIds::Uint64> {};
- struct PathShardsLimit : Column<9, NScheme::NTypeIds::Uint64> {};
+ struct SubDomains: Table<18> {
+ struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
+ struct AlterVersion : Column<2, NScheme::NTypeIds::Uint64> {};
+ struct PlanResolution : Column<3, NScheme::NTypeIds::Uint64> {};
+ struct TimeCastBuckets : Column<4, NScheme::NTypeIds::Uint32> {};
+ struct DepthLimit : Column<5, NScheme::NTypeIds::Uint64> {};
+ struct PathsLimit : Column<6, NScheme::NTypeIds::Uint64> {};
+ struct ChildrenLimit : Column<7, NScheme::NTypeIds::Uint64> {};
+ struct ShardsLimit : Column<8, NScheme::NTypeIds::Uint64> {};
+ struct PathShardsLimit : Column<9, NScheme::NTypeIds::Uint64> {};
struct TableColumnsLimit : Column<10, NScheme::NTypeIds::Uint64> {};
struct TableColumnNameLengthLimit : Column<11, NScheme::NTypeIds::Uint64> {};
struct TableKeyColumnsLimit : Column<12, NScheme::NTypeIds::Uint64> {};
struct TableIndicesLimit : Column<13, NScheme::NTypeIds::Uint64> {};
struct AclByteSizeLimit : Column<14, NScheme::NTypeIds::Uint64> {};
struct ConsistentCopyingTargetsLimit: Column<15, NScheme::NTypeIds::Uint64> {};
- struct PathElementLength: Column<16, NScheme::NTypeIds::Uint64> {};
- struct ExtraPathSymbolsAllowed: Column<17, NScheme::NTypeIds::Utf8> {};
+ struct PathElementLength: Column<16, NScheme::NTypeIds::Uint64> {};
+ struct ExtraPathSymbolsAllowed: Column<17, NScheme::NTypeIds::Utf8> {};
struct ResourcesDomainOwnerPathId : Column<18, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; static constexpr Type Default = InvalidOwnerId; };
struct ResourcesDomainLocalPathId : Column<19, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId; static constexpr Type Default = InvalidLocalPathId; };
struct SharedHiveId : Column<20, NScheme::NTypeIds::Uint64> { using Type = TTabletId; static constexpr Type Default = InvalidTabletId; };
@@ -719,25 +719,25 @@ struct Schema : NIceDb::Schema {
struct StateVersion : Column<24, NScheme::NTypeIds::Uint64> {};
struct DiskQuotaExceeded : Column<25, NScheme::NTypeIds::Bool> {};
struct SecurityStateVersion : Column<26, NScheme::NTypeIds::Uint64> {};
-
- using TKey = TableKey<PathId>;
- using TColumns = TableColumns<
- PathId,
- AlterVersion,
- PlanResolution,
- TimeCastBuckets,
- DepthLimit,
- PathsLimit,
- ChildrenLimit,
- ShardsLimit,
+
+ using TKey = TableKey<PathId>;
+ using TColumns = TableColumns<
+ PathId,
+ AlterVersion,
+ PlanResolution,
+ TimeCastBuckets,
+ DepthLimit,
+ PathsLimit,
+ ChildrenLimit,
+ ShardsLimit,
PathShardsLimit,
TableColumnsLimit,
TableColumnNameLengthLimit,
TableKeyColumnsLimit,
TableIndicesLimit,
AclByteSizeLimit,
- ConsistentCopyingTargetsLimit,
- PathElementLength,
+ ConsistentCopyingTargetsLimit,
+ PathElementLength,
ExtraPathSymbolsAllowed,
ResourcesDomainOwnerPathId,
ResourcesDomainLocalPathId,
@@ -748,50 +748,50 @@ struct Schema : NIceDb::Schema {
StateVersion,
DiskQuotaExceeded,
SecurityStateVersion
- >;
- };
-
- struct SubDomainShards: Table<19> {
- struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
- struct ShardIdx: Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
-
- using TKey = TableKey<PathId, ShardIdx>;
- using TColumns = TableColumns<PathId, ShardIdx>;
- };
-
- struct SubDomainsAlterData: Table<33> {
- struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
- struct AlterVersion: Column<2, NScheme::NTypeIds::Uint64> {};
- struct PlanResolution: Column<3, NScheme::NTypeIds::Uint64> {};
- struct TimeCastBuckets: Column<4, NScheme::NTypeIds::Uint32> {};
+ >;
+ };
+
+ struct SubDomainShards: Table<19> {
+ struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
+ struct ShardIdx: Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+
+ using TKey = TableKey<PathId, ShardIdx>;
+ using TColumns = TableColumns<PathId, ShardIdx>;
+ };
+
+ struct SubDomainsAlterData: Table<33> {
+ struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
+ struct AlterVersion: Column<2, NScheme::NTypeIds::Uint64> {};
+ struct PlanResolution: Column<3, NScheme::NTypeIds::Uint64> {};
+ struct TimeCastBuckets: Column<4, NScheme::NTypeIds::Uint32> {};
struct ResourcesDomainOwnerPathId : Column<5, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; static constexpr Type Default = InvalidOwnerId; };
struct ResourcesDomainLocalPathId : Column<6, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId; static constexpr Type Default = InvalidLocalPathId; };
struct SharedHiveId : Column<7, NScheme::NTypeIds::Uint64> { using Type = TTabletId; static constexpr Type Default = InvalidTabletId; };
struct DeclaredSchemeQuotas : Column<8, NScheme::NTypeIds::String> {};
struct DatabaseQuotas : Column<9, NScheme::NTypeIds::String> {};
-
- using TKey = TableKey<PathId>;
- using TColumns = TableColumns<
- PathId,
- AlterVersion,
- PlanResolution,
+
+ using TKey = TableKey<PathId>;
+ using TColumns = TableColumns<
+ PathId,
+ AlterVersion,
+ PlanResolution,
TimeCastBuckets,
ResourcesDomainOwnerPathId,
ResourcesDomainLocalPathId,
SharedHiveId,
DeclaredSchemeQuotas,
DatabaseQuotas
- >;
- };
-
- struct SubDomainShardsAlterData: Table<34> {
- struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
- struct ShardIdx: Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
-
- using TKey = TableKey<PathId, ShardIdx>;
- using TColumns = TableColumns<PathId, ShardIdx>;
- };
-
+ >;
+ };
+
+ struct SubDomainShardsAlterData: Table<34> {
+ struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
+ struct ShardIdx: Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+
+ using TKey = TableKey<PathId, ShardIdx>;
+ using TColumns = TableColumns<PathId, ShardIdx>;
+ };
+
struct SubDomainSchemeQuotas : Table<77> {
struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
struct QuotaIdx: Column<2, NScheme::NTypeIds::Uint64> {};
@@ -804,55 +804,55 @@ struct Schema : NIceDb::Schema {
using TColumns = TableColumns<PathId, QuotaIdx, BucketSize, BucketDurationUs, Available, LastUpdateUs>;
};
- struct StoragePools: Table<27> {
- struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
- struct PoolName: Column<4, NScheme::NTypeIds::Utf8> {};
- struct PoolKind: Column<5, NScheme::NTypeIds::Utf8> {};
-
- using TKey = TableKey<PathId, PoolName, PoolKind>;
- using TColumns = TableColumns<PathId, PoolName, PoolKind>;
- };
-
- struct StoragePoolsAlterData: Table<35> {
- struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
- struct PoolName: Column<4, NScheme::NTypeIds::Utf8> {};
- struct PoolKind: Column<5, NScheme::NTypeIds::Utf8> {};
-
- using TKey = TableKey<PathId, PoolName, PoolKind>;
- using TColumns = TableColumns<PathId, PoolName, PoolKind>;
- };
-
- struct BlockStorePartitions : Table<22> {
- struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
- struct PartitionId: Column<2, NScheme::NTypeIds::Uint32> {};
- struct ShardIdx: Column<3, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
- struct AlterVersion: Column<4, NScheme::NTypeIds::Uint64> {};
-
- using TKey = TableKey<PathId, PartitionId>;
- using TColumns = TableColumns<PathId, PartitionId, ShardIdx, AlterVersion>;
- };
-
- struct BlockStoreVolumes : Table<23> {
- struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
- struct VolumeConfig: Column<2, NScheme::NTypeIds::String> {};
- struct AlterVersion: Column<3, NScheme::NTypeIds::Uint64> {};
- struct MountToken: Column<4, NScheme::NTypeIds::Utf8> {};
+ struct StoragePools: Table<27> {
+ struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
+ struct PoolName: Column<4, NScheme::NTypeIds::Utf8> {};
+ struct PoolKind: Column<5, NScheme::NTypeIds::Utf8> {};
+
+ using TKey = TableKey<PathId, PoolName, PoolKind>;
+ using TColumns = TableColumns<PathId, PoolName, PoolKind>;
+ };
+
+ struct StoragePoolsAlterData: Table<35> {
+ struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
+ struct PoolName: Column<4, NScheme::NTypeIds::Utf8> {};
+ struct PoolKind: Column<5, NScheme::NTypeIds::Utf8> {};
+
+ using TKey = TableKey<PathId, PoolName, PoolKind>;
+ using TColumns = TableColumns<PathId, PoolName, PoolKind>;
+ };
+
+ struct BlockStorePartitions : Table<22> {
+ struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
+ struct PartitionId: Column<2, NScheme::NTypeIds::Uint32> {};
+ struct ShardIdx: Column<3, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+ struct AlterVersion: Column<4, NScheme::NTypeIds::Uint64> {};
+
+ using TKey = TableKey<PathId, PartitionId>;
+ using TColumns = TableColumns<PathId, PartitionId, ShardIdx, AlterVersion>;
+ };
+
+ struct BlockStoreVolumes : Table<23> {
+ struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
+ struct VolumeConfig: Column<2, NScheme::NTypeIds::String> {};
+ struct AlterVersion: Column<3, NScheme::NTypeIds::Uint64> {};
+ struct MountToken: Column<4, NScheme::NTypeIds::Utf8> {};
struct TokenVersion: Column<5, NScheme::NTypeIds::Uint64> {};
-
- using TKey = TableKey<PathId>;
+
+ using TKey = TableKey<PathId>;
using TColumns = TableColumns<PathId, VolumeConfig, AlterVersion, MountToken, TokenVersion>;
- };
-
- struct BlockStoreVolumeAlters : Table<24> {
- struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
- struct VolumeConfig: Column<2, NScheme::NTypeIds::String> {};
- struct AlterVersion: Column<3, NScheme::NTypeIds::Uint64> {};
- struct PartitionCount: Column<4, NScheme::NTypeIds::Uint32> {};
-
- using TKey = TableKey<PathId>;
- using TColumns = TableColumns<PathId, VolumeConfig, AlterVersion, PartitionCount>;
- };
-
+ };
+
+ struct BlockStoreVolumeAlters : Table<24> {
+ struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
+ struct VolumeConfig: Column<2, NScheme::NTypeIds::String> {};
+ struct AlterVersion: Column<3, NScheme::NTypeIds::Uint64> {};
+ struct PartitionCount: Column<4, NScheme::NTypeIds::Uint32> {};
+
+ using TKey = TableKey<PathId>;
+ using TColumns = TableColumns<PathId, VolumeConfig, AlterVersion, PartitionCount>;
+ };
+
struct FileStoreInfos : Table<78> {
struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
struct Config: Column<2, NScheme::NTypeIds::String> {};
@@ -871,225 +871,225 @@ struct Schema : NIceDb::Schema {
using TColumns = TableColumns<PathId, Config, Version>;
};
- struct KesusInfos : Table<26> {
- struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
- struct Config: Column<2, NScheme::NTypeIds::String> {};
- struct Version: Column<3, NScheme::NTypeIds::Uint64> { static constexpr ui64 Default = 1; };
-
- using TKey = TableKey<PathId>;
- using TColumns = TableColumns<PathId, Config, Version>;
- };
-
- struct MigratedKesusInfos : Table<83> {
- struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
-
- struct Config: Column<3, NScheme::NTypeIds::String> {};
- struct Version: Column<4, NScheme::NTypeIds::Uint64> { static constexpr ui64 Default = 1; };
-
- using TKey = TableKey<OwnerPathId, LocalPathId>;
- using TColumns = TableColumns<OwnerPathId, LocalPathId, Config, Version>;
- };
-
- struct KesusAlters : Table<32> {
- struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
- struct Config: Column<2, NScheme::NTypeIds::String> {};
- struct Version: Column<3, NScheme::NTypeIds::Uint64> {};
-
- using TKey = TableKey<PathId>;
- using TColumns = TableColumns<PathId, Config, Version>;
- };
-
- struct MigratedKesusAlters : Table<84> {
- struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
-
- struct Config: Column<3, NScheme::NTypeIds::String> {};
- struct Version: Column<4, NScheme::NTypeIds::Uint64> {};
-
- using TKey = TableKey<OwnerPathId, LocalPathId>;
- using TColumns = TableColumns<OwnerPathId, LocalPathId, Config, Version>;
- };
-
- struct AdoptedShards : Table<31> {
- struct ShardIdx: Column<1, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
- struct PrevOwner: Column<2, NScheme::NTypeIds::Uint64> {};
- struct PrevShardIdx: Column<3, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
- struct TabletId : Column<4, NScheme::NTypeIds::Uint64> { using Type = TTabletId; };
-
- using TKey = TableKey<ShardIdx>;
- using TColumns = TableColumns<ShardIdx, PrevOwner, PrevShardIdx, TabletId>;
- };
-
- struct UserAttributes : Table<36> {
- struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
- struct AttrName: Column<2, NScheme::NTypeIds::Utf8> {};
- struct AttrValue: Column<3, NScheme::NTypeIds::Utf8> {};
-
- using TKey = TableKey<PathId, AttrName>;
- using TColumns = TableColumns<PathId, AttrName, AttrValue>;
- };
-
- struct MigratedUserAttributes : Table<51> {
- struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
- struct AttrName: Column<3, NScheme::NTypeIds::Utf8> {};
- struct AttrValue: Column<4, NScheme::NTypeIds::Utf8> {};
-
- using TKey = TableKey<OwnerPathId, LocalPathId, AttrName>;
- using TColumns = TableColumns<OwnerPathId, LocalPathId, AttrName, AttrValue>;
- };
-
- struct UserAttributesAlterData : Table<37> {
- struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
- struct AttrName: Column<2, NScheme::NTypeIds::Utf8> {};
- struct AttrValue: Column<3, NScheme::NTypeIds::Utf8> {};
-
- using TKey = TableKey<PathId, AttrName>;
- using TColumns = TableColumns<PathId, AttrName, AttrValue>;
- };
-
- struct MigratedUserAttributesAlterData : Table<62> {
- struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
- struct AttrName: Column<3, NScheme::NTypeIds::Utf8> {};
- struct AttrValue: Column<4, NScheme::NTypeIds::Utf8> {};
-
- using TKey = TableKey<OwnerPathId, LocalPathId, AttrName>;
- using TColumns = TableColumns<OwnerPathId, LocalPathId, AttrName, AttrValue>;
- };
-
- struct TableIndex : Table<38> {
- struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
- struct AlterVersion : Column<3, NScheme::NTypeIds::Uint64> {};
- struct IndexType : Column<4, NScheme::NTypeIds::Uint32> {using Type = NKikimrSchemeOp::EIndexType; static constexpr Type Default = NKikimrSchemeOp::EIndexTypeInvalid;};
- struct State : Column<5, NScheme::NTypeIds::Uint32> {using Type = NKikimrSchemeOp::EIndexState; static constexpr Type Default = NKikimrSchemeOp::EIndexStateInvalid;};
-
- using TKey = TableKey<PathId>;
- using TColumns = TableColumns<PathId, AlterVersion, IndexType, State>;
- };
-
- struct MigratedTableIndex : Table<67> {
- struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
- struct AlterVersion : Column<3, NScheme::NTypeIds::Uint64> {};
- struct IndexType : Column<4, NScheme::NTypeIds::Uint32> {using Type = NKikimrSchemeOp::EIndexType; static constexpr Type Default = NKikimrSchemeOp::EIndexTypeInvalid;};
- struct State : Column<5, NScheme::NTypeIds::Uint32> {using Type = NKikimrSchemeOp::EIndexState; static constexpr Type Default = NKikimrSchemeOp::EIndexStateInvalid;};
-
- using TKey = TableKey<OwnerPathId, LocalPathId>;
- using TColumns = TableColumns<OwnerPathId, LocalPathId, AlterVersion, IndexType, State>;
- };
-
- struct TableIndexAlterData : Table<39> {
- struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
- struct AlterVersion : Column<3, NScheme::NTypeIds::Uint64> {};
- struct IndexType : Column<4, NScheme::NTypeIds::Uint32> {using Type = NKikimrSchemeOp::EIndexType; static constexpr Type Default = NKikimrSchemeOp::EIndexTypeInvalid;};
- struct State : Column<5, NScheme::NTypeIds::Uint32> {using Type = NKikimrSchemeOp::EIndexState; static constexpr Type Default = NKikimrSchemeOp::EIndexStateInvalid;};
-
- using TKey = TableKey<PathId>;
- using TColumns = TableColumns<PathId, AlterVersion, IndexType, State>;
- };
-
- struct TableIndexKeys : Table<40> {
- struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
- struct KeyId : Column<2, NScheme::NTypeIds::Uint32> {};
- struct KeyName : Column<3, NScheme::NTypeIds::Utf8> {};
-
- using TKey = TableKey<PathId, KeyId>;
- using TColumns = TableColumns<PathId, KeyId, KeyName>;
- };
-
- struct MigratedTableIndexKeys: Table<68> {
- struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
- struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
- struct KeyId : Column<3, NScheme::NTypeIds::Uint32> {};
- struct KeyName : Column<4, NScheme::NTypeIds::Utf8> {};
-
- using TKey = TableKey<OwnerPathId, LocalPathId, KeyId>;
- using TColumns = TableColumns<OwnerPathId, LocalPathId, KeyId, KeyName>;
- };
-
- struct TableIndexKeysAlterData : Table<41> {
- struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
- struct KeyId : Column<2, NScheme::NTypeIds::Uint32> {};
- struct KeyName : Column<3, NScheme::NTypeIds::Utf8> {};
-
- using TKey = TableKey<PathId, KeyId>;
- using TColumns = TableColumns<PathId, KeyId, KeyName>;
- };
-
- struct TxInFlightV2 : Table<42> {
- struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct TxPartId: Column<2, NScheme::NTypeIds::Uint32> { using Type = TSubTxId; };
-
- struct TxType : Column<3, NScheme::NTypeIds::Byte> {};
- struct TargetPathId : Column<4, NScheme::NTypeIds::Uint64> {};
- struct State : Column<5, NScheme::NTypeIds::Byte> {};
- struct MinStep : Column<6, NScheme::NTypeIds::Uint64> { using Type = TStepId; };
- struct ExtraBytes : Column<7, NScheme::NTypeIds::String> {};
- struct StartTime : Column<8, NScheme::NTypeIds::Uint64> {};
- struct DataTotalSize: Column<9, NScheme::NTypeIds::Uint64> {};
- struct CancelBackup: Column<10, NScheme::NTypeIds::Bool> {};
- struct TargetOwnerPathId: Column<11, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; static constexpr Type Default = InvalidOwnerId;};
- struct BuildIndexId: Column<12, NScheme::NTypeIds::Uint64> { using Type = TTxId;};
- struct SourceOwnerId: Column<13, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; static constexpr Type Default = InvalidOwnerId;};
- struct SourceLocalPathId: Column<14, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId; static constexpr Type Default = InvalidLocalPathId;};
- struct PlanStep: Column<15, NScheme::NTypeIds::Uint64> { using Type = TStepId; };
-
-
- using TKey = TableKey<TxId, TxPartId>;
- using TColumns = TableColumns<
- TxId,
- TxPartId,
- TxType,
- TargetPathId,
- State,
- MinStep,
- ExtraBytes,
- StartTime,
- DataTotalSize,
- CancelBackup,
- TargetOwnerPathId,
- BuildIndexId,
- SourceOwnerId,
- SourceLocalPathId,
- PlanStep
- >;
- };
-
- struct TxDependenciesV2 : Table<43> { // has dieded before release
- struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct TxPartId : Column<2, NScheme::NTypeIds::Uint32> { using Type = TSubTxId; };
- struct DependentTxId : Column<3, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct DependentTxPartId : Column<4, NScheme::NTypeIds::Uint32> { using Type = TSubTxId; };
-
- using TKey = TableKey<TxId, TxPartId, DependentTxId, DependentTxPartId>;
- using TColumns = TableColumns<TxId, DependentTxId, TxPartId, DependentTxPartId>;
- };
-
- struct TxShardsV2 : Table<44> {
- struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct TxPartId : Column<2, NScheme::NTypeIds::Uint32> { using Type = TSubTxId; };
- struct ShardIdx : Column<3, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
-
- struct Operation : Column<4, NScheme::NTypeIds::Uint32> {};
-
- using TKey = TableKey<TxId, TxPartId, ShardIdx>;
- using TColumns = TableColumns<TxId, ShardIdx, Operation, TxPartId>;
- };
-
- struct MigratedTxShards : Table<61> {
- struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct TxPartId : Column<2, NScheme::NTypeIds::Uint32> { using Type = TSubTxId; };
- struct ShardOwnerId : Column<3, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; };
- struct ShardLocalIdx : Column<4, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
-
- struct Operation : Column<5, NScheme::NTypeIds::Uint32> {};
-
- using TKey = TableKey<TxId, TxPartId, ShardOwnerId, ShardLocalIdx>;
- using TColumns = TableColumns<TxId, ShardOwnerId, ShardLocalIdx, Operation, TxPartId>;
- };
-
+ struct KesusInfos : Table<26> {
+ struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
+ struct Config: Column<2, NScheme::NTypeIds::String> {};
+ struct Version: Column<3, NScheme::NTypeIds::Uint64> { static constexpr ui64 Default = 1; };
+
+ using TKey = TableKey<PathId>;
+ using TColumns = TableColumns<PathId, Config, Version>;
+ };
+
+ struct MigratedKesusInfos : Table<83> {
+ struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
+
+ struct Config: Column<3, NScheme::NTypeIds::String> {};
+ struct Version: Column<4, NScheme::NTypeIds::Uint64> { static constexpr ui64 Default = 1; };
+
+ using TKey = TableKey<OwnerPathId, LocalPathId>;
+ using TColumns = TableColumns<OwnerPathId, LocalPathId, Config, Version>;
+ };
+
+ struct KesusAlters : Table<32> {
+ struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
+ struct Config: Column<2, NScheme::NTypeIds::String> {};
+ struct Version: Column<3, NScheme::NTypeIds::Uint64> {};
+
+ using TKey = TableKey<PathId>;
+ using TColumns = TableColumns<PathId, Config, Version>;
+ };
+
+ struct MigratedKesusAlters : Table<84> {
+ struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
+
+ struct Config: Column<3, NScheme::NTypeIds::String> {};
+ struct Version: Column<4, NScheme::NTypeIds::Uint64> {};
+
+ using TKey = TableKey<OwnerPathId, LocalPathId>;
+ using TColumns = TableColumns<OwnerPathId, LocalPathId, Config, Version>;
+ };
+
+ struct AdoptedShards : Table<31> {
+ struct ShardIdx: Column<1, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+ struct PrevOwner: Column<2, NScheme::NTypeIds::Uint64> {};
+ struct PrevShardIdx: Column<3, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+ struct TabletId : Column<4, NScheme::NTypeIds::Uint64> { using Type = TTabletId; };
+
+ using TKey = TableKey<ShardIdx>;
+ using TColumns = TableColumns<ShardIdx, PrevOwner, PrevShardIdx, TabletId>;
+ };
+
+ struct UserAttributes : Table<36> {
+ struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
+ struct AttrName: Column<2, NScheme::NTypeIds::Utf8> {};
+ struct AttrValue: Column<3, NScheme::NTypeIds::Utf8> {};
+
+ using TKey = TableKey<PathId, AttrName>;
+ using TColumns = TableColumns<PathId, AttrName, AttrValue>;
+ };
+
+ struct MigratedUserAttributes : Table<51> {
+ struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
+ struct AttrName: Column<3, NScheme::NTypeIds::Utf8> {};
+ struct AttrValue: Column<4, NScheme::NTypeIds::Utf8> {};
+
+ using TKey = TableKey<OwnerPathId, LocalPathId, AttrName>;
+ using TColumns = TableColumns<OwnerPathId, LocalPathId, AttrName, AttrValue>;
+ };
+
+ struct UserAttributesAlterData : Table<37> {
+ struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
+ struct AttrName: Column<2, NScheme::NTypeIds::Utf8> {};
+ struct AttrValue: Column<3, NScheme::NTypeIds::Utf8> {};
+
+ using TKey = TableKey<PathId, AttrName>;
+ using TColumns = TableColumns<PathId, AttrName, AttrValue>;
+ };
+
+ struct MigratedUserAttributesAlterData : Table<62> {
+ struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
+ struct AttrName: Column<3, NScheme::NTypeIds::Utf8> {};
+ struct AttrValue: Column<4, NScheme::NTypeIds::Utf8> {};
+
+ using TKey = TableKey<OwnerPathId, LocalPathId, AttrName>;
+ using TColumns = TableColumns<OwnerPathId, LocalPathId, AttrName, AttrValue>;
+ };
+
+ struct TableIndex : Table<38> {
+ struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
+ struct AlterVersion : Column<3, NScheme::NTypeIds::Uint64> {};
+ struct IndexType : Column<4, NScheme::NTypeIds::Uint32> {using Type = NKikimrSchemeOp::EIndexType; static constexpr Type Default = NKikimrSchemeOp::EIndexTypeInvalid;};
+ struct State : Column<5, NScheme::NTypeIds::Uint32> {using Type = NKikimrSchemeOp::EIndexState; static constexpr Type Default = NKikimrSchemeOp::EIndexStateInvalid;};
+
+ using TKey = TableKey<PathId>;
+ using TColumns = TableColumns<PathId, AlterVersion, IndexType, State>;
+ };
+
+ struct MigratedTableIndex : Table<67> {
+ struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
+ struct AlterVersion : Column<3, NScheme::NTypeIds::Uint64> {};
+ struct IndexType : Column<4, NScheme::NTypeIds::Uint32> {using Type = NKikimrSchemeOp::EIndexType; static constexpr Type Default = NKikimrSchemeOp::EIndexTypeInvalid;};
+ struct State : Column<5, NScheme::NTypeIds::Uint32> {using Type = NKikimrSchemeOp::EIndexState; static constexpr Type Default = NKikimrSchemeOp::EIndexStateInvalid;};
+
+ using TKey = TableKey<OwnerPathId, LocalPathId>;
+ using TColumns = TableColumns<OwnerPathId, LocalPathId, AlterVersion, IndexType, State>;
+ };
+
+ struct TableIndexAlterData : Table<39> {
+ struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
+ struct AlterVersion : Column<3, NScheme::NTypeIds::Uint64> {};
+ struct IndexType : Column<4, NScheme::NTypeIds::Uint32> {using Type = NKikimrSchemeOp::EIndexType; static constexpr Type Default = NKikimrSchemeOp::EIndexTypeInvalid;};
+ struct State : Column<5, NScheme::NTypeIds::Uint32> {using Type = NKikimrSchemeOp::EIndexState; static constexpr Type Default = NKikimrSchemeOp::EIndexStateInvalid;};
+
+ using TKey = TableKey<PathId>;
+ using TColumns = TableColumns<PathId, AlterVersion, IndexType, State>;
+ };
+
+ struct TableIndexKeys : Table<40> {
+ struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
+ struct KeyId : Column<2, NScheme::NTypeIds::Uint32> {};
+ struct KeyName : Column<3, NScheme::NTypeIds::Utf8> {};
+
+ using TKey = TableKey<PathId, KeyId>;
+ using TColumns = TableColumns<PathId, KeyId, KeyName>;
+ };
+
+ struct MigratedTableIndexKeys: Table<68> {
+ struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId;};
+ struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId;};
+ struct KeyId : Column<3, NScheme::NTypeIds::Uint32> {};
+ struct KeyName : Column<4, NScheme::NTypeIds::Utf8> {};
+
+ using TKey = TableKey<OwnerPathId, LocalPathId, KeyId>;
+ using TColumns = TableColumns<OwnerPathId, LocalPathId, KeyId, KeyName>;
+ };
+
+ struct TableIndexKeysAlterData : Table<41> {
+ struct PathId : Column<1, NScheme::NTypeIds::Uint64> {};
+ struct KeyId : Column<2, NScheme::NTypeIds::Uint32> {};
+ struct KeyName : Column<3, NScheme::NTypeIds::Utf8> {};
+
+ using TKey = TableKey<PathId, KeyId>;
+ using TColumns = TableColumns<PathId, KeyId, KeyName>;
+ };
+
+ struct TxInFlightV2 : Table<42> {
+ struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct TxPartId: Column<2, NScheme::NTypeIds::Uint32> { using Type = TSubTxId; };
+
+ struct TxType : Column<3, NScheme::NTypeIds::Byte> {};
+ struct TargetPathId : Column<4, NScheme::NTypeIds::Uint64> {};
+ struct State : Column<5, NScheme::NTypeIds::Byte> {};
+ struct MinStep : Column<6, NScheme::NTypeIds::Uint64> { using Type = TStepId; };
+ struct ExtraBytes : Column<7, NScheme::NTypeIds::String> {};
+ struct StartTime : Column<8, NScheme::NTypeIds::Uint64> {};
+ struct DataTotalSize: Column<9, NScheme::NTypeIds::Uint64> {};
+ struct CancelBackup: Column<10, NScheme::NTypeIds::Bool> {};
+ struct TargetOwnerPathId: Column<11, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; static constexpr Type Default = InvalidOwnerId;};
+ struct BuildIndexId: Column<12, NScheme::NTypeIds::Uint64> { using Type = TTxId;};
+ struct SourceOwnerId: Column<13, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; static constexpr Type Default = InvalidOwnerId;};
+ struct SourceLocalPathId: Column<14, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId; static constexpr Type Default = InvalidLocalPathId;};
+ struct PlanStep: Column<15, NScheme::NTypeIds::Uint64> { using Type = TStepId; };
+
+
+ using TKey = TableKey<TxId, TxPartId>;
+ using TColumns = TableColumns<
+ TxId,
+ TxPartId,
+ TxType,
+ TargetPathId,
+ State,
+ MinStep,
+ ExtraBytes,
+ StartTime,
+ DataTotalSize,
+ CancelBackup,
+ TargetOwnerPathId,
+ BuildIndexId,
+ SourceOwnerId,
+ SourceLocalPathId,
+ PlanStep
+ >;
+ };
+
+ struct TxDependenciesV2 : Table<43> { // has dieded before release
+ struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct TxPartId : Column<2, NScheme::NTypeIds::Uint32> { using Type = TSubTxId; };
+ struct DependentTxId : Column<3, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct DependentTxPartId : Column<4, NScheme::NTypeIds::Uint32> { using Type = TSubTxId; };
+
+ using TKey = TableKey<TxId, TxPartId, DependentTxId, DependentTxPartId>;
+ using TColumns = TableColumns<TxId, DependentTxId, TxPartId, DependentTxPartId>;
+ };
+
+ struct TxShardsV2 : Table<44> {
+ struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct TxPartId : Column<2, NScheme::NTypeIds::Uint32> { using Type = TSubTxId; };
+ struct ShardIdx : Column<3, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+
+ struct Operation : Column<4, NScheme::NTypeIds::Uint32> {};
+
+ using TKey = TableKey<TxId, TxPartId, ShardIdx>;
+ using TColumns = TableColumns<TxId, ShardIdx, Operation, TxPartId>;
+ };
+
+ struct MigratedTxShards : Table<61> {
+ struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct TxPartId : Column<2, NScheme::NTypeIds::Uint32> { using Type = TSubTxId; };
+ struct ShardOwnerId : Column<3, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; };
+ struct ShardLocalIdx : Column<4, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+
+ struct Operation : Column<5, NScheme::NTypeIds::Uint32> {};
+
+ using TKey = TableKey<TxId, TxPartId, ShardOwnerId, ShardLocalIdx>;
+ using TColumns = TableColumns<TxId, ShardOwnerId, ShardLocalIdx, Operation, TxPartId>;
+ };
+
struct Exports : Table<45> {
struct Id: Column<1, NScheme::NTypeIds::Uint64> {};
struct Uid: Column<2, NScheme::NTypeIds::Utf8> {};
@@ -1098,15 +1098,15 @@ struct Schema : NIceDb::Schema {
struct DomainPathId: Column<4, NScheme::NTypeIds::Uint64> {};
struct UserSID : Column<13, NScheme::NTypeIds::Utf8> {};
struct Items: Column<5, NScheme::NTypeIds::Uint32> {};
-
- struct ExportPathId: Column<6, NScheme::NTypeIds::Uint64> {using Type = TLocalPathId;};
+
+ struct ExportPathId: Column<6, NScheme::NTypeIds::Uint64> {using Type = TLocalPathId;};
struct State: Column<7, NScheme::NTypeIds::Byte> {};
- struct WaitTxId: Column<8, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct WaitTxId: Column<8, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
struct Issue: Column<9, NScheme::NTypeIds::Utf8> {};
- struct ExportOwnerPathId: Column<10, NScheme::NTypeIds::Uint64> {using Type = TOwnerId;};
- struct DomainPathOwnerId: Column<11, NScheme::NTypeIds::Uint64> {using Type = TOwnerId;};
+ struct ExportOwnerPathId: Column<10, NScheme::NTypeIds::Uint64> {using Type = TOwnerId;};
+ struct DomainPathOwnerId: Column<11, NScheme::NTypeIds::Uint64> {using Type = TOwnerId;};
+
-
using TKey = TableKey<Id>;
using TColumns = TableColumns<
Id,
@@ -1117,8 +1117,8 @@ struct Schema : NIceDb::Schema {
ExportPathId,
State,
WaitTxId,
- Issue,
- ExportOwnerPathId,
+ Issue,
+ ExportOwnerPathId,
DomainPathOwnerId,
Kind,
UserSID
@@ -1129,12 +1129,12 @@ struct Schema : NIceDb::Schema {
struct ExportId: Column<1, NScheme::NTypeIds::Uint64> {};
struct Index: Column<2, NScheme::NTypeIds::Uint32> {};
struct SourcePathName: Column<3, NScheme::NTypeIds::Utf8> {};
- struct SourcePathId: Column<4, NScheme::NTypeIds::Uint64> {using Type = TLocalPathId;};
+ struct SourcePathId: Column<4, NScheme::NTypeIds::Uint64> {using Type = TLocalPathId;};
struct State: Column<5, NScheme::NTypeIds::Byte> {};
- struct BackupTxId: Column<6, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct BackupTxId: Column<6, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
struct Issue: Column<7, NScheme::NTypeIds::Utf8> {};
- struct SourceOwnerPathId: Column<8, NScheme::NTypeIds::Uint64> {using Type = TOwnerId;};
+ struct SourceOwnerPathId: Column<8, NScheme::NTypeIds::Uint64> {using Type = TOwnerId;};
using TKey = TableKey<ExportId, Index>;
using TColumns = TableColumns<
@@ -1144,13 +1144,13 @@ struct Schema : NIceDb::Schema {
SourcePathId,
State,
BackupTxId,
- Issue,
- SourceOwnerPathId
+ Issue,
+ SourceOwnerPathId
>;
};
struct TableShardPartitionConfigs : Table<47> {
- struct ShardIdx : Column<1, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+ struct ShardIdx : Column<1, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
struct PartitionConfig : Column<2, NScheme::NTypeIds::String> {};
using TKey = TableKey<ShardIdx>;
@@ -1159,20 +1159,20 @@ struct Schema : NIceDb::Schema {
PartitionConfig>;
};
- struct MigratedTableShardPartitionConfigs : Table<57> {
- struct OwnerShardIdx : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; };
- struct LocalShardIdx : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
-
- struct PartitionConfig : Column<3, NScheme::NTypeIds::String> {};
-
- using TKey = TableKey<OwnerShardIdx, LocalShardIdx>;
- using TColumns = TableColumns<
- OwnerShardIdx, LocalShardIdx,
- PartitionConfig>;
- };
-
+ struct MigratedTableShardPartitionConfigs : Table<57> {
+ struct OwnerShardIdx : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; };
+ struct LocalShardIdx : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalShardIdx; };
+
+ struct PartitionConfig : Column<3, NScheme::NTypeIds::String> {};
+
+ using TKey = TableKey<OwnerShardIdx, LocalShardIdx>;
+ using TColumns = TableColumns<
+ OwnerShardIdx, LocalShardIdx,
+ PartitionConfig>;
+ };
+
struct PublishingPaths : Table<48> {
- struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
struct PathId : Column<2, NScheme::NTypeIds::Uint64> {};
struct Version : Column<3, NScheme::NTypeIds::Uint64> {};
@@ -1180,195 +1180,195 @@ struct Schema : NIceDb::Schema {
using TColumns = TableColumns<TxId, PathId, Version>;
};
- struct MigratedPublishingPaths : Table<59> {
- struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
- struct PathOwnerId : Column<2, NScheme::NTypeIds::Uint64> {};
- struct LocalPathId : Column<3, NScheme::NTypeIds::Uint64> {};
- struct Version : Column<4, NScheme::NTypeIds::Uint64> {};
-
- using TKey = TableKey<TxId, PathOwnerId, LocalPathId, Version>;
- using TColumns = TableColumns<TxId, PathOwnerId, LocalPathId, Version>;
- };
-
- struct FillIndexDesc : Table<49> { // DEPRECATED, left only for forbidding reuse table Id 49
- struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
- struct Body: Column<2, NScheme::NTypeIds::String> {};
-
- using TKey = TableKey<PathId>;
- using TColumns = TableColumns<PathId, Body>;
- };
-
- // TODO: Snapshot {PlanStep, PathId, AlterVersion}
-
- struct RevertedMigrations : Table<58> {
- // it is only because we need to manage undo of upgrade subdomain, finally remove it
- struct LocalPathId: Column<1, NScheme::NTypeIds::Uint64> {};
- struct SchemeShardId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TTabletId;};
-
- using TKey = TableKey<LocalPathId, SchemeShardId>;
- using TColumns = TableColumns<LocalPathId, SchemeShardId>;
- };
-
- struct IndexBuild : Table<69> {
- struct Id: Column<1, NScheme::NTypeIds::Uint64> {using Type = TIndexBuildId;};
- struct Uid: Column<2, NScheme::NTypeIds::Utf8> {};
-
- struct DomainOwnerId: Column<3, NScheme::NTypeIds::Uint64> {using Type = TOwnerId;};
- struct DomainLocalId: Column<4, NScheme::NTypeIds::Uint64> {using Type = TLocalPathId;};
- struct TableOwnerId: Column<5, NScheme::NTypeIds::Uint64> {using Type = TOwnerId;};
- struct TableLocalId: Column<6, NScheme::NTypeIds::Uint64> {using Type = TLocalPathId;};
- struct IndexName: Column<7, NScheme::NTypeIds::Utf8> {};
- struct IndexType: Column<8, NScheme::NTypeIds::Uint32> {using Type = NKikimrSchemeOp::EIndexType;};
-
- struct State: Column<9, NScheme::NTypeIds::Uint32> {};
- struct Issue: Column<10, NScheme::NTypeIds::Utf8> {};
-
- struct InitiateTxId: Column<11, NScheme::NTypeIds::Uint64> {using Type = TTxId;};
- struct InitiateTxStatus: Column<12, NScheme::NTypeIds::Uint32> {using Type = NKikimrScheme::EStatus;};
- struct InitiateTxDone: Column<13, NScheme::NTypeIds::Bool> {};
-
- struct LockTxId: Column<14, NScheme::NTypeIds::Uint64> {using Type = TTxId;};
- struct LockTxStatus: Column<15, NScheme::NTypeIds::Uint32> {using Type = NKikimrScheme::EStatus;};
- struct LockTxDone: Column<16, NScheme::NTypeIds::Bool> {};
-
- struct MaxBatchRows: Column<17, NScheme::NTypeIds::Uint32> {};
- struct MaxBatchBytes: Column<18, NScheme::NTypeIds::Uint64> {};
- struct MaxShards: Column<19, NScheme::NTypeIds::Uint32> {};
-
- struct ApplyTxId: Column<20, NScheme::NTypeIds::Uint64> {using Type = TTxId;};
- struct ApplyTxStatus: Column<21, NScheme::NTypeIds::Uint32> {using Type = NKikimrScheme::EStatus;};
- struct ApplyTxDone: Column<22, NScheme::NTypeIds::Bool> {};
-
-
- struct UnlockTxId: Column<23, NScheme::NTypeIds::Uint64> {using Type = TTxId;};
- struct UnlockTxStatus: Column<24, NScheme::NTypeIds::Uint32> {using Type = NKikimrScheme::EStatus;};
- struct UnlockTxDone: Column<25, NScheme::NTypeIds::Bool> {};
-
- struct CancelRequest: Column<26, NScheme::NTypeIds::Bool> {};
-
- struct MaxRetries: Column<27, NScheme::NTypeIds::Uint32> {};
-
- struct RowsBilled: Column<28, NScheme::NTypeIds::Uint64> {};
- struct BytesBilled: Column<29, NScheme::NTypeIds::Uint64> {};
-
- using TKey = TableKey<Id>;
- using TColumns = TableColumns<
- Id,
- Uid,
- DomainOwnerId,
- DomainLocalId,
- TableOwnerId,
- TableLocalId,
- IndexName,
- IndexType,
- State,
- Issue,
- InitiateTxId,
- InitiateTxStatus,
- InitiateTxDone,
- LockTxId,
- LockTxStatus,
- LockTxDone,
- MaxBatchRows,
- MaxBatchBytes,
- MaxShards,
- ApplyTxId,
- ApplyTxStatus,
- ApplyTxDone,
- UnlockTxId,
- UnlockTxStatus,
- UnlockTxDone,
- CancelRequest,
- MaxRetries,
- RowsBilled,
- BytesBilled
- >;
- };
-
- struct IndexBuildColumns : Table<70> {
- struct Id: Column<1, NScheme::NTypeIds::Uint64> {using Type = TIndexBuildId;};
- struct ColumnNo: Column<2, NScheme::NTypeIds::Uint32> {};
- struct ColumnName: Column<3, NScheme::NTypeIds::Utf8> {};
+ struct MigratedPublishingPaths : Table<59> {
+ struct TxId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TTxId; };
+ struct PathOwnerId : Column<2, NScheme::NTypeIds::Uint64> {};
+ struct LocalPathId : Column<3, NScheme::NTypeIds::Uint64> {};
+ struct Version : Column<4, NScheme::NTypeIds::Uint64> {};
+
+ using TKey = TableKey<TxId, PathOwnerId, LocalPathId, Version>;
+ using TColumns = TableColumns<TxId, PathOwnerId, LocalPathId, Version>;
+ };
+
+ struct FillIndexDesc : Table<49> { // DEPRECATED, left only for forbidding reuse table Id 49
+ struct PathId: Column<1, NScheme::NTypeIds::Uint64> {};
+ struct Body: Column<2, NScheme::NTypeIds::String> {};
+
+ using TKey = TableKey<PathId>;
+ using TColumns = TableColumns<PathId, Body>;
+ };
+
+ // TODO: Snapshot {PlanStep, PathId, AlterVersion}
+
+ struct RevertedMigrations : Table<58> {
+ // it is only because we need to manage undo of upgrade subdomain, finally remove it
+ struct LocalPathId: Column<1, NScheme::NTypeIds::Uint64> {};
+ struct SchemeShardId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TTabletId;};
+
+ using TKey = TableKey<LocalPathId, SchemeShardId>;
+ using TColumns = TableColumns<LocalPathId, SchemeShardId>;
+ };
+
+ struct IndexBuild : Table<69> {
+ struct Id: Column<1, NScheme::NTypeIds::Uint64> {using Type = TIndexBuildId;};
+ struct Uid: Column<2, NScheme::NTypeIds::Utf8> {};
+
+ struct DomainOwnerId: Column<3, NScheme::NTypeIds::Uint64> {using Type = TOwnerId;};
+ struct DomainLocalId: Column<4, NScheme::NTypeIds::Uint64> {using Type = TLocalPathId;};
+ struct TableOwnerId: Column<5, NScheme::NTypeIds::Uint64> {using Type = TOwnerId;};
+ struct TableLocalId: Column<6, NScheme::NTypeIds::Uint64> {using Type = TLocalPathId;};
+ struct IndexName: Column<7, NScheme::NTypeIds::Utf8> {};
+ struct IndexType: Column<8, NScheme::NTypeIds::Uint32> {using Type = NKikimrSchemeOp::EIndexType;};
+
+ struct State: Column<9, NScheme::NTypeIds::Uint32> {};
+ struct Issue: Column<10, NScheme::NTypeIds::Utf8> {};
+
+ struct InitiateTxId: Column<11, NScheme::NTypeIds::Uint64> {using Type = TTxId;};
+ struct InitiateTxStatus: Column<12, NScheme::NTypeIds::Uint32> {using Type = NKikimrScheme::EStatus;};
+ struct InitiateTxDone: Column<13, NScheme::NTypeIds::Bool> {};
+
+ struct LockTxId: Column<14, NScheme::NTypeIds::Uint64> {using Type = TTxId;};
+ struct LockTxStatus: Column<15, NScheme::NTypeIds::Uint32> {using Type = NKikimrScheme::EStatus;};
+ struct LockTxDone: Column<16, NScheme::NTypeIds::Bool> {};
+
+ struct MaxBatchRows: Column<17, NScheme::NTypeIds::Uint32> {};
+ struct MaxBatchBytes: Column<18, NScheme::NTypeIds::Uint64> {};
+ struct MaxShards: Column<19, NScheme::NTypeIds::Uint32> {};
+
+ struct ApplyTxId: Column<20, NScheme::NTypeIds::Uint64> {using Type = TTxId;};
+ struct ApplyTxStatus: Column<21, NScheme::NTypeIds::Uint32> {using Type = NKikimrScheme::EStatus;};
+ struct ApplyTxDone: Column<22, NScheme::NTypeIds::Bool> {};
+
+
+ struct UnlockTxId: Column<23, NScheme::NTypeIds::Uint64> {using Type = TTxId;};
+ struct UnlockTxStatus: Column<24, NScheme::NTypeIds::Uint32> {using Type = NKikimrScheme::EStatus;};
+ struct UnlockTxDone: Column<25, NScheme::NTypeIds::Bool> {};
+
+ struct CancelRequest: Column<26, NScheme::NTypeIds::Bool> {};
+
+ struct MaxRetries: Column<27, NScheme::NTypeIds::Uint32> {};
+
+ struct RowsBilled: Column<28, NScheme::NTypeIds::Uint64> {};
+ struct BytesBilled: Column<29, NScheme::NTypeIds::Uint64> {};
+
+ using TKey = TableKey<Id>;
+ using TColumns = TableColumns<
+ Id,
+ Uid,
+ DomainOwnerId,
+ DomainLocalId,
+ TableOwnerId,
+ TableLocalId,
+ IndexName,
+ IndexType,
+ State,
+ Issue,
+ InitiateTxId,
+ InitiateTxStatus,
+ InitiateTxDone,
+ LockTxId,
+ LockTxStatus,
+ LockTxDone,
+ MaxBatchRows,
+ MaxBatchBytes,
+ MaxShards,
+ ApplyTxId,
+ ApplyTxStatus,
+ ApplyTxDone,
+ UnlockTxId,
+ UnlockTxStatus,
+ UnlockTxDone,
+ CancelRequest,
+ MaxRetries,
+ RowsBilled,
+ BytesBilled
+ >;
+ };
+
+ struct IndexBuildColumns : Table<70> {
+ struct Id: Column<1, NScheme::NTypeIds::Uint64> {using Type = TIndexBuildId;};
+ struct ColumnNo: Column<2, NScheme::NTypeIds::Uint32> {};
+ struct ColumnName: Column<3, NScheme::NTypeIds::Utf8> {};
struct ColumnKind: Column<4, NScheme::NTypeIds::Uint8> {using Type = EIndexColumnKind;};
-
- using TKey = TableKey<Id, ColumnNo>;
- using TColumns = TableColumns<
- Id,
- ColumnNo,
+
+ using TKey = TableKey<Id, ColumnNo>;
+ using TColumns = TableColumns<
+ Id,
+ ColumnNo,
ColumnName,
ColumnKind
- >;
- };
-
- struct SnapshotTables : Table<71> {
- struct Id: Column<1, NScheme::NTypeIds::Uint64> {using Type = TTxId;};
- struct TableOwnerId: Column<2, NScheme::NTypeIds::Uint64> {using Type = TOwnerId;};
- struct TableLocalId: Column<3, NScheme::NTypeIds::Uint64> {using Type = TLocalPathId;};
-
-
- using TKey = TableKey<Id, TableOwnerId, TableLocalId>;
- using TColumns = TableColumns<
- Id,
- TableOwnerId,
- TableLocalId
- >;
- };
-
- struct SnapshotSteps : Table<72> {
- struct Id: Column<1, NScheme::NTypeIds::Uint64> {using Type = TTxId;};
- struct StepId: Column<2, NScheme::NTypeIds::Uint64> {using Type = TStepId;};
-
- using TKey = TableKey<Id>;
- using TColumns = TableColumns<
- Id,
- StepId
- >;
- };
-
- struct LongLocks : Table<73> {
- struct PathOwnerId: Column<1, NScheme::NTypeIds::Uint64> {using Type = TOwnerId;};
- struct PathLocalId: Column<2, NScheme::NTypeIds::Uint64> {using Type = TLocalPathId;};
- struct LockId: Column<3, NScheme::NTypeIds::Uint64> {using Type = TTxId;};
-
-
- using TKey = TableKey<PathOwnerId, PathLocalId>;
- using TColumns = TableColumns<
- PathOwnerId,
- PathLocalId,
- LockId
- >;
- };
-
- struct IndexBuildShardStatus : Table<74> {
- struct Id: Column<1, NScheme::NTypeIds::Uint64> {using Type = TIndexBuildId;};
- struct OwnerShardIdx: Column<2, NScheme::NTypeIds::Uint64> {using Type = TOwnerId;};
- struct LocalShardIdx: Column<3, NScheme::NTypeIds::Uint64> {using Type = TLocalShardIdx;};
-
- struct Range : Column<4, NScheme::NTypeIds::String> {using Type = NKikimrTx::TKeyRange;};
- struct LastKeyAck : Column<5, NScheme::NTypeIds::String> {using Type = TString;};
-
- struct Status: Column<6, NScheme::NTypeIds::Uint32> {using Type = NKikimrTxDataShard::TEvBuildIndexProgressResponse::EStatus;};
- struct Message: Column<7, NScheme::NTypeIds::Utf8> {};
- struct UploadStatus: Column<8, NScheme::NTypeIds::Uint32> {using Type = Ydb::StatusIds::StatusCode;};
-
- struct RowsProcessed: Column<9, NScheme::NTypeIds::Uint64> {};
- struct BytesProcessed: Column<10, NScheme::NTypeIds::Uint64> {};
-
- using TKey = TableKey<Id, OwnerShardIdx, LocalShardIdx>;
- using TColumns = TableColumns<
- Id,
- OwnerShardIdx,
- LocalShardIdx,
- Range,
- LastKeyAck,
- Status,
- Message,
- UploadStatus,
- RowsProcessed,
- BytesProcessed
- >;
- };
-
+ >;
+ };
+
+ struct SnapshotTables : Table<71> {
+ struct Id: Column<1, NScheme::NTypeIds::Uint64> {using Type = TTxId;};
+ struct TableOwnerId: Column<2, NScheme::NTypeIds::Uint64> {using Type = TOwnerId;};
+ struct TableLocalId: Column<3, NScheme::NTypeIds::Uint64> {using Type = TLocalPathId;};
+
+
+ using TKey = TableKey<Id, TableOwnerId, TableLocalId>;
+ using TColumns = TableColumns<
+ Id,
+ TableOwnerId,
+ TableLocalId
+ >;
+ };
+
+ struct SnapshotSteps : Table<72> {
+ struct Id: Column<1, NScheme::NTypeIds::Uint64> {using Type = TTxId;};
+ struct StepId: Column<2, NScheme::NTypeIds::Uint64> {using Type = TStepId;};
+
+ using TKey = TableKey<Id>;
+ using TColumns = TableColumns<
+ Id,
+ StepId
+ >;
+ };
+
+ struct LongLocks : Table<73> {
+ struct PathOwnerId: Column<1, NScheme::NTypeIds::Uint64> {using Type = TOwnerId;};
+ struct PathLocalId: Column<2, NScheme::NTypeIds::Uint64> {using Type = TLocalPathId;};
+ struct LockId: Column<3, NScheme::NTypeIds::Uint64> {using Type = TTxId;};
+
+
+ using TKey = TableKey<PathOwnerId, PathLocalId>;
+ using TColumns = TableColumns<
+ PathOwnerId,
+ PathLocalId,
+ LockId
+ >;
+ };
+
+ struct IndexBuildShardStatus : Table<74> {
+ struct Id: Column<1, NScheme::NTypeIds::Uint64> {using Type = TIndexBuildId;};
+ struct OwnerShardIdx: Column<2, NScheme::NTypeIds::Uint64> {using Type = TOwnerId;};
+ struct LocalShardIdx: Column<3, NScheme::NTypeIds::Uint64> {using Type = TLocalShardIdx;};
+
+ struct Range : Column<4, NScheme::NTypeIds::String> {using Type = NKikimrTx::TKeyRange;};
+ struct LastKeyAck : Column<5, NScheme::NTypeIds::String> {using Type = TString;};
+
+ struct Status: Column<6, NScheme::NTypeIds::Uint32> {using Type = NKikimrTxDataShard::TEvBuildIndexProgressResponse::EStatus;};
+ struct Message: Column<7, NScheme::NTypeIds::Utf8> {};
+ struct UploadStatus: Column<8, NScheme::NTypeIds::Uint32> {using Type = Ydb::StatusIds::StatusCode;};
+
+ struct RowsProcessed: Column<9, NScheme::NTypeIds::Uint64> {};
+ struct BytesProcessed: Column<10, NScheme::NTypeIds::Uint64> {};
+
+ using TKey = TableKey<Id, OwnerShardIdx, LocalShardIdx>;
+ using TColumns = TableColumns<
+ Id,
+ OwnerShardIdx,
+ LocalShardIdx,
+ Range,
+ LastKeyAck,
+ Status,
+ Message,
+ UploadStatus,
+ RowsProcessed,
+ BytesProcessed
+ >;
+ };
+
struct TableIndexDataColumns : Table<80> {
struct PathOwnerId: Column<1, NScheme::NTypeIds::Uint64> {using Type = TOwnerId;};
struct PathLocalId: Column<2, NScheme::NTypeIds::Uint64> {using Type = TLocalPathId;};
@@ -1530,8 +1530,8 @@ struct Schema : NIceDb::Schema {
struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; };
struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId; };
struct AlterVersion : Column<3, NScheme::NTypeIds::Uint64> {};
- struct State : Column<4, NScheme::NTypeIds::Uint32> { using Type = NKikimrSchemeOp::ECdcStreamState; static constexpr Type Default = NKikimrSchemeOp::ECdcStreamStateInvalid; };
- struct Mode : Column<5, NScheme::NTypeIds::Uint32> { using Type = NKikimrSchemeOp::ECdcStreamMode; static constexpr Type Default = NKikimrSchemeOp::ECdcStreamModeInvalid; };
+ struct State : Column<4, NScheme::NTypeIds::Uint32> { using Type = NKikimrSchemeOp::ECdcStreamState; static constexpr Type Default = NKikimrSchemeOp::ECdcStreamStateInvalid; };
+ struct Mode : Column<5, NScheme::NTypeIds::Uint32> { using Type = NKikimrSchemeOp::ECdcStreamMode; static constexpr Type Default = NKikimrSchemeOp::ECdcStreamModeInvalid; };
using TKey = TableKey<OwnerPathId, LocalPathId>;
using TColumns = TableColumns<OwnerPathId, LocalPathId, AlterVersion, State, Mode>;
@@ -1541,8 +1541,8 @@ struct Schema : NIceDb::Schema {
struct OwnerPathId : Column<1, NScheme::NTypeIds::Uint64> { using Type = TOwnerId; };
struct LocalPathId : Column<2, NScheme::NTypeIds::Uint64> { using Type = TLocalPathId; };
struct AlterVersion : Column<3, NScheme::NTypeIds::Uint64> {};
- struct State : Column<4, NScheme::NTypeIds::Uint32> { using Type = NKikimrSchemeOp::ECdcStreamState; static constexpr Type Default = NKikimrSchemeOp::ECdcStreamStateInvalid; };
- struct Mode : Column<5, NScheme::NTypeIds::Uint32> { using Type = NKikimrSchemeOp::ECdcStreamMode; static constexpr Type Default = NKikimrSchemeOp::ECdcStreamModeInvalid; };
+ struct State : Column<4, NScheme::NTypeIds::Uint32> { using Type = NKikimrSchemeOp::ECdcStreamState; static constexpr Type Default = NKikimrSchemeOp::ECdcStreamStateInvalid; };
+ struct Mode : Column<5, NScheme::NTypeIds::Uint32> { using Type = NKikimrSchemeOp::ECdcStreamMode; static constexpr Type Default = NKikimrSchemeOp::ECdcStreamModeInvalid; };
using TKey = TableKey<OwnerPathId, LocalPathId>;
using TColumns = TableColumns<OwnerPathId, LocalPathId, AlterVersion, State, Mode>;
@@ -1586,81 +1586,81 @@ struct Schema : NIceDb::Schema {
using TColumns = TableColumns<PathId, AlterVersion, Description>;
};
- using TTables = SchemaTables<
- Paths,
- TxInFlight,
- TxDependencies,
- SysParams,
- Tables,
- Columns,
- Shards,
- TablePartitions,
- PersQueueGroups,
- PersQueues,
- RtmrVolumes,
- RTMRPartitions,
- TxShards,
- PersQueueGroupAlters,
- ColumnAlters,
- ShardsToDelete,
- BackupSettings,
- CompletedBackups,
- ShardBackupStatus,
- SubDomains,
- SubDomainShards,
- BlockStorePartitions,
- BlockStoreVolumes,
- BlockStoreVolumeAlters,
- KesusInfos,
- KesusAlters,
- StoragePools,
- ChannelsBinding,
- SolomonVolumes,
- SolomonPartitions,
- AdoptedShards,
- SubDomainsAlterData,
- SubDomainShardsAlterData,
- StoragePoolsAlterData,
- UserAttributes,
- UserAttributesAlterData,
- TableIndex,
- TableIndexAlterData,
- TableIndexKeys,
- TableIndexKeysAlterData,
- TxInFlightV2,
- TxDependenciesV2,
+ using TTables = SchemaTables<
+ Paths,
+ TxInFlight,
+ TxDependencies,
+ SysParams,
+ Tables,
+ Columns,
+ Shards,
+ TablePartitions,
+ PersQueueGroups,
+ PersQueues,
+ RtmrVolumes,
+ RTMRPartitions,
+ TxShards,
+ PersQueueGroupAlters,
+ ColumnAlters,
+ ShardsToDelete,
+ BackupSettings,
+ CompletedBackups,
+ ShardBackupStatus,
+ SubDomains,
+ SubDomainShards,
+ BlockStorePartitions,
+ BlockStoreVolumes,
+ BlockStoreVolumeAlters,
+ KesusInfos,
+ KesusAlters,
+ StoragePools,
+ ChannelsBinding,
+ SolomonVolumes,
+ SolomonPartitions,
+ AdoptedShards,
+ SubDomainsAlterData,
+ SubDomainShardsAlterData,
+ StoragePoolsAlterData,
+ UserAttributes,
+ UserAttributesAlterData,
+ TableIndex,
+ TableIndexAlterData,
+ TableIndexKeys,
+ TableIndexKeysAlterData,
+ TxInFlightV2,
+ TxDependenciesV2,
TxShardsV2,
Exports,
ExportItems,
TableShardPartitionConfigs,
PublishingPaths,
- FillIndexDesc,
- MigratedPaths,
- MigratedUserAttributes,
- MigratedShards,
- MigratedChannelsBinding,
- MigratedTables,
- MigratedColumns,
- MigratedTablePartitions,
- MigratedTableShardPartitionConfigs,
- RevertedMigrations,
- MigratedPublishingPaths,
- MigratedShardsToDelete,
- MigratedTxShards,
- MigratedUserAttributesAlterData,
- MigratedColumnAlters,
- MigratedBackupSettings,
- MigratedCompletedBackups,
- MigratedShardBackupStatus,
- MigratedTableIndex,
- MigratedTableIndexKeys,
- IndexBuild,
- IndexBuildColumns,
- SnapshotTables,
- SnapshotSteps,
- LongLocks,
- IndexBuildShardStatus,
- AlterSolomonVolumes,
+ FillIndexDesc,
+ MigratedPaths,
+ MigratedUserAttributes,
+ MigratedShards,
+ MigratedChannelsBinding,
+ MigratedTables,
+ MigratedColumns,
+ MigratedTablePartitions,
+ MigratedTableShardPartitionConfigs,
+ RevertedMigrations,
+ MigratedPublishingPaths,
+ MigratedShardsToDelete,
+ MigratedTxShards,
+ MigratedUserAttributesAlterData,
+ MigratedColumnAlters,
+ MigratedBackupSettings,
+ MigratedCompletedBackups,
+ MigratedShardBackupStatus,
+ MigratedTableIndex,
+ MigratedTableIndexKeys,
+ IndexBuild,
+ IndexBuildColumns,
+ SnapshotTables,
+ SnapshotSteps,
+ LongLocks,
+ IndexBuildShardStatus,
+ AlterSolomonVolumes,
AlterSolomonPartitions,
TablePartitionStats,
SubDomainSchemeQuotas,
@@ -1668,8 +1668,8 @@ struct Schema : NIceDb::Schema {
FileStoreAlters,
TableIndexDataColumns,
TableIndexDataColumnsAlterData,
- RestoreTasks,
- MigratedKesusInfos,
+ RestoreTasks,
+ MigratedKesusInfos,
MigratedKesusAlters,
Imports,
ImportItems,
@@ -1687,19 +1687,19 @@ struct Schema : NIceDb::Schema {
SequencesAlters,
Replications,
ReplicationsAlterData
- >;
-
- static constexpr ui64 SysParam_NextPathId = 1;
- static constexpr ui64 SysParam_NextShardIdx = 2;
- static constexpr ui64 SysParam_IsReadOnlyMode = 3;
- static constexpr ui64 SysParam_ParentDomainSchemeShard = 4;
- static constexpr ui64 SysParam_ParentDomainPathId = 5;
- static constexpr ui64 SysParam_ParentDomainOwner = 6;
- static constexpr ui64 SysParam_ParentDomainEffectiveACL = 7;
- static constexpr ui64 SysParam_ParentDomainEffectiveACLVersion = 8;
- static constexpr ui64 SysParam_TenantInitState = 9;
- static constexpr ui64 SysParam_ServerlessStorageLastBillTime = 10;
-};
-
-}
-}
+ >;
+
+ static constexpr ui64 SysParam_NextPathId = 1;
+ static constexpr ui64 SysParam_NextShardIdx = 2;
+ static constexpr ui64 SysParam_IsReadOnlyMode = 3;
+ static constexpr ui64 SysParam_ParentDomainSchemeShard = 4;
+ static constexpr ui64 SysParam_ParentDomainPathId = 5;
+ static constexpr ui64 SysParam_ParentDomainOwner = 6;
+ static constexpr ui64 SysParam_ParentDomainEffectiveACL = 7;
+ static constexpr ui64 SysParam_ParentDomainEffectiveACLVersion = 8;
+ static constexpr ui64 SysParam_TenantInitState = 9;
+ static constexpr ui64 SysParam_ServerlessStorageLastBillTime = 10;
+};
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard_tx_infly.h b/ydb/core/tx/schemeshard/schemeshard_tx_infly.h
index 71dc510cec1..41a8045155a 100644
--- a/ydb/core/tx/schemeshard/schemeshard_tx_infly.h
+++ b/ydb/core/tx/schemeshard/schemeshard_tx_infly.h
@@ -1,90 +1,90 @@
-#pragma once
-
-#include "schemeshard_types.h"
-
+#pragma once
+
+#include "schemeshard_types.h"
+
#include <ydb/core/protos/counters_schemeshard.pb.h>
#include <ydb/core/protos/tx_datashard.pb.h>
-
+
#include <ydb/core/tx/datashard/datashard.h>
-
+
#include <library/cpp/actors/core/actorid.h>
-#include <util/generic/hash.h>
-#include <util/generic/hash_set.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-struct TNotifyes {
- TTxId TxId = InvalidTxId;
+#include <util/generic/hash.h>
+#include <util/generic/hash_set.h>
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+struct TNotifyes {
+ TTxId TxId = InvalidTxId;
THashSet<TActorId> Actors;
-
+
void Add(const TActorId& actor, TTxId txId) {
- Y_VERIFY(!TxId || TxId == txId);
- TxId = txId;
- Actors.insert(actor);
- }
-
- void Swap(TNotifyes& notifyes) {
- std::swap(TxId, notifyes.TxId);
- Actors.swap(notifyes.Actors);
- }
-
- bool Empty() const { return Actors.empty(); }
-};
-
-// Describes in-progress operation
-struct TTxState {
- #define TX_STATE_DECLARE_ENUM(n, v, ...) n = v,
- #define TX_STATE_ENUM_NAME(n, ...) case n: return #n;
- #define TX_STATE_IN_FLIGHT_COUNTER(n, ...) case n: return COUNTER_IN_FLIGHT_OPS_##n ;
- #define TX_STATE_FINISHED_COUNTER(n, ...) case n: return COUNTER_FINISHED_OPS_##n ;
-
- // WARNING: DO NOT REORDER this constants
- // reordering breaks update
- #define TX_STATE_TYPE_ENUM(item) \
- item(TxInvalid, 0) \
- item(TxMkDir, 1) \
- item(TxCreateTable, 2) \
- item(TxCreatePQGroup, 3) \
- item(TxAlterPQGroup, 4) \
- item(TxAlterTable, 5) \
- item(TxDropTable, 6) \
- item(TxDropPQGroup, 7) \
- item(TxModifyACL, 8) \
- item(TxRmDir, 9) \
- item(TxCopyTable, 10) \
- item(TxSplitTablePartition, 11) \
- item(TxBackup, 12) \
- item(TxCreateSubDomain, 13) \
- item(TxDropSubDomain, 14) \
- item(TxCreateRtmrVolume, 15) \
- item(TxCreateBlockStoreVolume, 16) \
- item(TxAlterBlockStoreVolume, 17) \
- item(TxAssignBlockStoreVolume, 18) \
- item(TxDropBlockStoreVolume, 19) \
- item(TxCreateKesus, 20) \
- item(TxDropKesus, 21) \
- item(TxForceDropSubDomain, 22) \
- item(TxCreateSolomonVolume, 23) \
- item(TxDropSolomonVolume, 24) \
- item(TxAlterKesus, 25) \
- item(TxAlterSubDomain, 26) \
- item(TxAlterUserAttributes, 27) \
- item(TxCreateTableIndex, 28) \
- item(TxDropTableIndex, 29) \
- item(TxCreateExtSubDomain, 30) \
- item(TxMergeTablePartition, 31) \
- item(TxAlterExtSubDomain, 32) \
+ Y_VERIFY(!TxId || TxId == txId);
+ TxId = txId;
+ Actors.insert(actor);
+ }
+
+ void Swap(TNotifyes& notifyes) {
+ std::swap(TxId, notifyes.TxId);
+ Actors.swap(notifyes.Actors);
+ }
+
+ bool Empty() const { return Actors.empty(); }
+};
+
+// Describes in-progress operation
+struct TTxState {
+ #define TX_STATE_DECLARE_ENUM(n, v, ...) n = v,
+ #define TX_STATE_ENUM_NAME(n, ...) case n: return #n;
+ #define TX_STATE_IN_FLIGHT_COUNTER(n, ...) case n: return COUNTER_IN_FLIGHT_OPS_##n ;
+ #define TX_STATE_FINISHED_COUNTER(n, ...) case n: return COUNTER_FINISHED_OPS_##n ;
+
+ // WARNING: DO NOT REORDER this constants
+ // reordering breaks update
+ #define TX_STATE_TYPE_ENUM(item) \
+ item(TxInvalid, 0) \
+ item(TxMkDir, 1) \
+ item(TxCreateTable, 2) \
+ item(TxCreatePQGroup, 3) \
+ item(TxAlterPQGroup, 4) \
+ item(TxAlterTable, 5) \
+ item(TxDropTable, 6) \
+ item(TxDropPQGroup, 7) \
+ item(TxModifyACL, 8) \
+ item(TxRmDir, 9) \
+ item(TxCopyTable, 10) \
+ item(TxSplitTablePartition, 11) \
+ item(TxBackup, 12) \
+ item(TxCreateSubDomain, 13) \
+ item(TxDropSubDomain, 14) \
+ item(TxCreateRtmrVolume, 15) \
+ item(TxCreateBlockStoreVolume, 16) \
+ item(TxAlterBlockStoreVolume, 17) \
+ item(TxAssignBlockStoreVolume, 18) \
+ item(TxDropBlockStoreVolume, 19) \
+ item(TxCreateKesus, 20) \
+ item(TxDropKesus, 21) \
+ item(TxForceDropSubDomain, 22) \
+ item(TxCreateSolomonVolume, 23) \
+ item(TxDropSolomonVolume, 24) \
+ item(TxAlterKesus, 25) \
+ item(TxAlterSubDomain, 26) \
+ item(TxAlterUserAttributes, 27) \
+ item(TxCreateTableIndex, 28) \
+ item(TxDropTableIndex, 29) \
+ item(TxCreateExtSubDomain, 30) \
+ item(TxMergeTablePartition, 31) \
+ item(TxAlterExtSubDomain, 32) \
item(TxForceDropExtSubDomain, 33) \
- item(TxFillIndex, 34) \
- item(TxUpgradeSubDomain, 35) \
- item(TxUpgradeSubDomainDecision, 36) \
- item(TxInitializeBuildIndex, 37) \
- item(TxCreateLockForIndexBuild, 38) \
- item(TxAlterTableIndex, 39) \
- item(TxFinalizeBuildIndex, 40) \
- item(TxAlterSolomonVolume, 41) \
- item(TxDropLock, 42) \
+ item(TxFillIndex, 34) \
+ item(TxUpgradeSubDomain, 35) \
+ item(TxUpgradeSubDomainDecision, 36) \
+ item(TxInitializeBuildIndex, 37) \
+ item(TxCreateLockForIndexBuild, 38) \
+ item(TxAlterTableIndex, 39) \
+ item(TxFinalizeBuildIndex, 40) \
+ item(TxAlterSolomonVolume, 41) \
+ item(TxDropLock, 42) \
item(TxDropTableIndexAtMainTable, 43) \
item(TxCreateFileStore, 44) \
item(TxAlterFileStore, 45) \
@@ -102,105 +102,105 @@ struct TTxState {
item(TxAlterCdcStreamAtTable, 57) \
item(TxDropCdcStream, 58) \
item(TxDropCdcStreamAtTable, 59) \
- item(TxMoveTable, 60) \
- item(TxMoveTableIndex, 61) \
+ item(TxMoveTable, 60) \
+ item(TxMoveTableIndex, 61) \
item(TxCreateSequence, 62) \
item(TxAlterSequence, 63) \
item(TxDropSequence, 64) \
item(TxCreateReplication, 65) \
item(TxAlterReplication, 66) \
item(TxDropReplication, 67) \
-
+
// TX_STATE_TYPE_ENUM
-
+
//TxMergeTablePartition only for sensors yet
-
- enum ETxType {
- TX_STATE_TYPE_ENUM(TX_STATE_DECLARE_ENUM)
- };
-
- static TString TypeName(ETxType t) {
- switch(t) {
- TX_STATE_TYPE_ENUM(TX_STATE_ENUM_NAME)
- default:
- return Sprintf("Unknown tx type %d", t);
- }
- }
- static ui32 TxTypeInFlightCounter(ETxType t) {
- switch(t) {
- TX_STATE_TYPE_ENUM(TX_STATE_IN_FLIGHT_COUNTER)
- default:
- return COUNTER_IN_FLIGHT_OPS_UNKNOWN;
- }
- }
- static ui32 TxTypeFinishedCounter(ETxType t) {
- switch(t) {
- TX_STATE_TYPE_ENUM(TX_STATE_FINISHED_COUNTER)
- default:
- return COUNTER_FINISHED_OPS_UNKNOWN;
- }
- }
- #undef TX_STATE_TYPE_ENUM
-
-
- // WARNING: DO NOT REORDER this constants
- // reordering breaks update
- #define TX_STATE_STATE_ENUM(item) \
- item(Invalid, 0, "") \
- item(Waiting, 1, "") \
- item(CreateParts, 2, "get shards from Hive") \
- item(ConfigureParts, 3, "send msg to shards to configure them") \
- item(DropParts, 4, "send msg to shards that they are dropped") \
- item(DeleteParts, 5, "send shards back to Hive (to drop their data)") \
- item(PublishTenantReadOnly, 6, "send msg to tenant schemeshard to get it online in RO mode") \
- item(PublishGlobal, 7, "start provide subdomains description as external domain") \
- item(RewriteOwners, 8, "") \
- item(PublishTenant, 9, "") \
- item(DoneMigrateTree, 10, "") \
- item(DeleteTenantSS, 11, "") \
- item(Propose, 128, "propose operation to Coordinator (get global timestamp of operation)") \
- item(ProposedWaitParts, 129, "") \
- item(ProposedDeleteParts, 130, "") \
- item(TransferData, 131, "") \
- item(NotifyPartitioningChanged, 132, "") \
+
+ enum ETxType {
+ TX_STATE_TYPE_ENUM(TX_STATE_DECLARE_ENUM)
+ };
+
+ static TString TypeName(ETxType t) {
+ switch(t) {
+ TX_STATE_TYPE_ENUM(TX_STATE_ENUM_NAME)
+ default:
+ return Sprintf("Unknown tx type %d", t);
+ }
+ }
+ static ui32 TxTypeInFlightCounter(ETxType t) {
+ switch(t) {
+ TX_STATE_TYPE_ENUM(TX_STATE_IN_FLIGHT_COUNTER)
+ default:
+ return COUNTER_IN_FLIGHT_OPS_UNKNOWN;
+ }
+ }
+ static ui32 TxTypeFinishedCounter(ETxType t) {
+ switch(t) {
+ TX_STATE_TYPE_ENUM(TX_STATE_FINISHED_COUNTER)
+ default:
+ return COUNTER_FINISHED_OPS_UNKNOWN;
+ }
+ }
+ #undef TX_STATE_TYPE_ENUM
+
+
+ // WARNING: DO NOT REORDER this constants
+ // reordering breaks update
+ #define TX_STATE_STATE_ENUM(item) \
+ item(Invalid, 0, "") \
+ item(Waiting, 1, "") \
+ item(CreateParts, 2, "get shards from Hive") \
+ item(ConfigureParts, 3, "send msg to shards to configure them") \
+ item(DropParts, 4, "send msg to shards that they are dropped") \
+ item(DeleteParts, 5, "send shards back to Hive (to drop their data)") \
+ item(PublishTenantReadOnly, 6, "send msg to tenant schemeshard to get it online in RO mode") \
+ item(PublishGlobal, 7, "start provide subdomains description as external domain") \
+ item(RewriteOwners, 8, "") \
+ item(PublishTenant, 9, "") \
+ item(DoneMigrateTree, 10, "") \
+ item(DeleteTenantSS, 11, "") \
+ item(Propose, 128, "propose operation to Coordinator (get global timestamp of operation)") \
+ item(ProposedWaitParts, 129, "") \
+ item(ProposedDeleteParts, 130, "") \
+ item(TransferData, 131, "") \
+ item(NotifyPartitioningChanged, 132, "") \
item(Aborting, 133, "") \
- item(DeleteExternalShards, 134, "") \
- item(DeletePrivateShards, 135, "") \
- item(WaitShadowPathPublication, 136, "") \
- item(DeletePathBarrier, 137, "") \
- item(Done, 240, "") \
- item(Aborted, 250, "")
-
- enum ETxState {
- TX_STATE_STATE_ENUM(TX_STATE_DECLARE_ENUM)
- };
-
- static TString StateName(ETxState s) {
- switch(s) {
- TX_STATE_STATE_ENUM(TX_STATE_ENUM_NAME)
- default:
- return Sprintf("Unknown state %d", s);
- }
- }
- #undef TX_STATE_STATE_ENUM
-
- #undef TX_STATE_FINISHED_COUNTER
- #undef TX_STATE_IN_FLIGHT_COUNTER
- #undef TX_STATE_ENUM_NAME
- #undef TX_STATE_DECLARE_ENUM
-
- struct TShardOperation {
- TShardIdx Idx; // shard's internal index
- TTabletTypes::EType TabletType;
- ETxState Operation; // (first) TxState, that affects on shard
-
- TString RangeEnd; // For datashard split
-
- TShardOperation(TShardIdx idx, TTabletTypes::EType type, ETxState op)
- : Idx(idx), TabletType(type), Operation(op)
- {}
- };
-
+ item(DeleteExternalShards, 134, "") \
+ item(DeletePrivateShards, 135, "") \
+ item(WaitShadowPathPublication, 136, "") \
+ item(DeletePathBarrier, 137, "") \
+ item(Done, 240, "") \
+ item(Aborted, 250, "")
+
+ enum ETxState {
+ TX_STATE_STATE_ENUM(TX_STATE_DECLARE_ENUM)
+ };
+
+ static TString StateName(ETxState s) {
+ switch(s) {
+ TX_STATE_STATE_ENUM(TX_STATE_ENUM_NAME)
+ default:
+ return Sprintf("Unknown state %d", s);
+ }
+ }
+ #undef TX_STATE_STATE_ENUM
+
+ #undef TX_STATE_FINISHED_COUNTER
+ #undef TX_STATE_IN_FLIGHT_COUNTER
+ #undef TX_STATE_ENUM_NAME
+ #undef TX_STATE_DECLARE_ENUM
+
+ struct TShardOperation {
+ TShardIdx Idx; // shard's internal index
+ TTabletTypes::EType TabletType;
+ ETxState Operation; // (first) TxState, that affects on shard
+
+ TString RangeEnd; // For datashard split
+
+ TShardOperation(TShardIdx idx, TTabletTypes::EType type, ETxState op)
+ : Idx(idx), TabletType(type), Operation(op)
+ {}
+ };
+
struct TShardStatus {
bool Success = false;
TString Error;
@@ -223,310 +223,310 @@ struct TTxState {
}
};
- // persist - TxInFlight:
- ETxType TxType = TxInvalid;
- TPathId TargetPathId = InvalidPathId; // path (dir or table) being modified
- TPathId SourcePathId = InvalidPathId; // path (dir or table) being modified
- ETxState State = Invalid;
- TStepId MinStep = InvalidStepId;
- TStepId PlanStep = InvalidStepId;
-
- // persist - TxShards:
- TVector<TShardOperation> Shards; // shards + operations on them
- // not persist:
- THashSet<TShardIdx> ShardsInProgress; // indexes of datashards or pqs that operation waits for
+ // persist - TxInFlight:
+ ETxType TxType = TxInvalid;
+ TPathId TargetPathId = InvalidPathId; // path (dir or table) being modified
+ TPathId SourcePathId = InvalidPathId; // path (dir or table) being modified
+ ETxState State = Invalid;
+ TStepId MinStep = InvalidStepId;
+ TStepId PlanStep = InvalidStepId;
+
+ // persist - TxShards:
+ TVector<TShardOperation> Shards; // shards + operations on them
+ // not persist:
+ THashSet<TShardIdx> ShardsInProgress; // indexes of datashards or pqs that operation waits for
THashMap<TShardIdx, std::pair<TActorId, ui32>> SchemeChangeNotificationReceived;
- bool ReadyForNotifications = false;
+ bool ReadyForNotifications = false;
std::shared_ptr<NKikimrTxDataShard::TSplitMergeDescription> SplitDescription;
- bool TxShardsListFinalized = false;
- TTxId BuildIndexId;
+ bool TxShardsListFinalized = false;
+ TTxId BuildIndexId;
// fields below used for backup/restore
bool Cancel = false;
THashMap<TShardIdx, TShardStatus> ShardStatuses;
ui64 DataTotalSize = 0;
-
-
- TMessageSeqNo SchemeOpSeqNo; // For SS -> DS propose events
-
-// TNotifyes Notify; // volatile set of actors that requested completion notification
- TInstant StartTime = TInstant::Zero();
-
- TTxState()
- : StartTime(::Now())
- {}
-
- TTxState(ETxType txType, TPathId targetPath, TPathId sourcePath = InvalidPathId)
- : TxType(txType)
- , TargetPathId(targetPath)
- , SourcePathId(sourcePath)
- , State(Waiting)
- , StartTime(::Now())
- {}
-
- void AcceptPendingSchemeNotification() {
- ReadyForNotifications = true;
- for (const auto& shard : SchemeChangeNotificationReceived) {
- ShardsInProgress.erase(shard.first);
- }
- }
-
- void ClearShardsInProgress() {
- ShardsInProgress.clear();
- }
-
- void UpdateShardsInProgress(ETxState operation = Invalid) {
- for (auto shard : Shards) {
- if (!operation || operation == shard.Operation) {
- ShardsInProgress.insert(shard.Idx);
- }
- }
- }
-
- bool IsItActuallyMerge() {
- return TxType == TTxState::TxSplitTablePartition
- && SplitDescription
- && SplitDescription->SourceRangesSize() > 1;
- }
-
- bool IsCreate() const {
- switch (TxType) {
- case TxMkDir:
- case TxCreateTable:
- case TxCopyTable:
+
+
+ TMessageSeqNo SchemeOpSeqNo; // For SS -> DS propose events
+
+// TNotifyes Notify; // volatile set of actors that requested completion notification
+ TInstant StartTime = TInstant::Zero();
+
+ TTxState()
+ : StartTime(::Now())
+ {}
+
+ TTxState(ETxType txType, TPathId targetPath, TPathId sourcePath = InvalidPathId)
+ : TxType(txType)
+ , TargetPathId(targetPath)
+ , SourcePathId(sourcePath)
+ , State(Waiting)
+ , StartTime(::Now())
+ {}
+
+ void AcceptPendingSchemeNotification() {
+ ReadyForNotifications = true;
+ for (const auto& shard : SchemeChangeNotificationReceived) {
+ ShardsInProgress.erase(shard.first);
+ }
+ }
+
+ void ClearShardsInProgress() {
+ ShardsInProgress.clear();
+ }
+
+ void UpdateShardsInProgress(ETxState operation = Invalid) {
+ for (auto shard : Shards) {
+ if (!operation || operation == shard.Operation) {
+ ShardsInProgress.insert(shard.Idx);
+ }
+ }
+ }
+
+ bool IsItActuallyMerge() {
+ return TxType == TTxState::TxSplitTablePartition
+ && SplitDescription
+ && SplitDescription->SourceRangesSize() > 1;
+ }
+
+ bool IsCreate() const {
+ switch (TxType) {
+ case TxMkDir:
+ case TxCreateTable:
+ case TxCopyTable:
case TxCreateOlapStore:
case TxCreateOlapTable:
- case TxCreatePQGroup:
- case TxCreateSubDomain:
- case TxCreateExtSubDomain:
- case TxCreateBlockStoreVolume:
+ case TxCreatePQGroup:
+ case TxCreateSubDomain:
+ case TxCreateExtSubDomain:
+ case TxCreateBlockStoreVolume:
case TxCreateFileStore:
- case TxCreateKesus:
- case TxCreateSolomonVolume:
- case TxCreateRtmrVolume:
- case TxCreateTableIndex:
+ case TxCreateKesus:
+ case TxCreateSolomonVolume:
+ case TxCreateRtmrVolume:
+ case TxCreateTableIndex:
case TxFillIndex:
case TxCreateCdcStream:
case TxCreateSequence:
case TxCreateReplication:
- return true;
- case TxInitializeBuildIndex: //this is more like alter
+ return true;
+ case TxInitializeBuildIndex: //this is more like alter
case TxCreateCdcStreamAtTable:
- return false;
- case TxCreateLockForIndexBuild: //this is more like alter
- case TxDropLock: //this is more like alter
- return false;
- case TxDropTable:
+ return false;
+ case TxCreateLockForIndexBuild: //this is more like alter
+ case TxDropLock: //this is more like alter
+ return false;
+ case TxDropTable:
case TxDropOlapStore:
case TxDropOlapTable:
- case TxDropPQGroup:
- case TxDropSubDomain:
- case TxDropBlockStoreVolume:
+ case TxDropPQGroup:
+ case TxDropSubDomain:
+ case TxDropBlockStoreVolume:
case TxDropFileStore:
- case TxDropKesus:
- case TxForceDropSubDomain:
- case TxForceDropExtSubDomain:
- case TxDropTableIndex:
- case TxDropSolomonVolume:
- case TxRmDir:
- case TxFinalizeBuildIndex:
- case TxDropTableIndexAtMainTable:
+ case TxDropKesus:
+ case TxForceDropSubDomain:
+ case TxForceDropExtSubDomain:
+ case TxDropTableIndex:
+ case TxDropSolomonVolume:
+ case TxRmDir:
+ case TxFinalizeBuildIndex:
+ case TxDropTableIndexAtMainTable:
case TxDropCdcStream:
case TxDropCdcStreamAtTable:
case TxDropSequence:
case TxDropReplication:
- return false;
- case TxAlterPQGroup:
- case TxAlterTable:
+ return false;
+ case TxAlterPQGroup:
+ case TxAlterTable:
case TxAlterOlapStore:
case TxAlterOlapTable:
- case TxModifyACL:
- case TxSplitTablePartition:
- case TxMergeTablePartition:
- case TxBackup:
+ case TxModifyACL:
+ case TxSplitTablePartition:
+ case TxMergeTablePartition:
+ case TxBackup:
case TxRestore:
- case TxAlterBlockStoreVolume:
- case TxAssignBlockStoreVolume:
+ case TxAlterBlockStoreVolume:
+ case TxAssignBlockStoreVolume:
case TxAlterFileStore:
- case TxAlterKesus:
- case TxAlterSubDomain:
- case TxUpgradeSubDomain:
- case TxUpgradeSubDomainDecision:
- case TxAlterExtSubDomain:
- case TxAlterUserAttributes:
- case TxAlterTableIndex:
- case TxAlterSolomonVolume:
+ case TxAlterKesus:
+ case TxAlterSubDomain:
+ case TxUpgradeSubDomain:
+ case TxUpgradeSubDomainDecision:
+ case TxAlterExtSubDomain:
+ case TxAlterUserAttributes:
+ case TxAlterTableIndex:
+ case TxAlterSolomonVolume:
case TxAlterCdcStream:
case TxAlterCdcStreamAtTable:
case TxAlterSequence:
case TxAlterReplication:
- return false;
- case TxMoveTable:
- case TxMoveTableIndex:
- return true;
- case TxInvalid:
- Y_VERIFY_DEBUG("UNREACHEBLE");
- Y_UNREACHABLE();
- }
- }
-
- bool IsDrop() const {
- switch (TxType) {
- case TxDropTable:
+ return false;
+ case TxMoveTable:
+ case TxMoveTableIndex:
+ return true;
+ case TxInvalid:
+ Y_VERIFY_DEBUG("UNREACHEBLE");
+ Y_UNREACHABLE();
+ }
+ }
+
+ bool IsDrop() const {
+ switch (TxType) {
+ case TxDropTable:
case TxDropOlapStore:
case TxDropOlapTable:
- case TxDropPQGroup:
- case TxDropSubDomain:
- case TxDropBlockStoreVolume:
+ case TxDropPQGroup:
+ case TxDropSubDomain:
+ case TxDropBlockStoreVolume:
case TxDropFileStore:
- case TxDropKesus:
- case TxForceDropSubDomain:
- case TxForceDropExtSubDomain:
- case TxDropTableIndex:
- case TxDropSolomonVolume:
- case TxRmDir:
+ case TxDropKesus:
+ case TxForceDropSubDomain:
+ case TxForceDropExtSubDomain:
+ case TxDropTableIndex:
+ case TxDropSolomonVolume:
+ case TxRmDir:
case TxDropCdcStream:
case TxDropSequence:
case TxDropReplication:
- return true;
- case TxMkDir:
- case TxCreateTable:
- case TxCopyTable:
+ return true;
+ case TxMkDir:
+ case TxCreateTable:
+ case TxCopyTable:
case TxCreateOlapStore:
case TxCreateOlapTable:
- case TxCreatePQGroup:
- case TxCreateSubDomain:
- case TxCreateExtSubDomain:
- case TxCreateBlockStoreVolume:
+ case TxCreatePQGroup:
+ case TxCreateSubDomain:
+ case TxCreateExtSubDomain:
+ case TxCreateBlockStoreVolume:
case TxCreateFileStore:
- case TxCreateKesus:
- case TxCreateSolomonVolume:
- case TxCreateRtmrVolume:
- case TxCreateTableIndex:
+ case TxCreateKesus:
+ case TxCreateSolomonVolume:
+ case TxCreateRtmrVolume:
+ case TxCreateTableIndex:
case TxFillIndex:
case TxCreateCdcStream:
case TxCreateCdcStreamAtTable:
case TxCreateSequence:
case TxCreateReplication:
- case TxInitializeBuildIndex:
- case TxCreateLockForIndexBuild:
- case TxDropLock:
- case TxFinalizeBuildIndex:
- case TxDropTableIndexAtMainTable: // just increments schemaversion at main table
+ case TxInitializeBuildIndex:
+ case TxCreateLockForIndexBuild:
+ case TxDropLock:
+ case TxFinalizeBuildIndex:
+ case TxDropTableIndexAtMainTable: // just increments schemaversion at main table
case TxDropCdcStreamAtTable:
- return false;
- case TxAlterPQGroup:
- case TxAlterTable:
+ return false;
+ case TxAlterPQGroup:
+ case TxAlterTable:
case TxAlterOlapStore:
case TxAlterOlapTable:
- case TxModifyACL:
- case TxSplitTablePartition:
- case TxMergeTablePartition:
- case TxBackup:
+ case TxModifyACL:
+ case TxSplitTablePartition:
+ case TxMergeTablePartition:
+ case TxBackup:
case TxRestore:
- case TxAlterBlockStoreVolume:
- case TxAssignBlockStoreVolume:
+ case TxAlterBlockStoreVolume:
+ case TxAssignBlockStoreVolume:
case TxAlterFileStore:
- case TxAlterKesus:
- case TxAlterSubDomain:
- case TxUpgradeSubDomain:
- case TxUpgradeSubDomainDecision:
- case TxAlterExtSubDomain:
- case TxAlterUserAttributes:
- case TxAlterTableIndex:
- case TxAlterSolomonVolume:
+ case TxAlterKesus:
+ case TxAlterSubDomain:
+ case TxUpgradeSubDomain:
+ case TxUpgradeSubDomainDecision:
+ case TxAlterExtSubDomain:
+ case TxAlterUserAttributes:
+ case TxAlterTableIndex:
+ case TxAlterSolomonVolume:
case TxAlterCdcStream:
case TxAlterCdcStreamAtTable:
case TxAlterSequence:
case TxAlterReplication:
- return false;
- case TxMoveTable:
- case TxMoveTableIndex:
- return false;
- case TxInvalid:
- Y_VERIFY_DEBUG("UNREACHEBLE");
- Y_UNREACHABLE();
- }
- }
-
- bool CanDeleteParts() const {
- switch (TxType) {
- case TxDropTable:
+ return false;
+ case TxMoveTable:
+ case TxMoveTableIndex:
+ return false;
+ case TxInvalid:
+ Y_VERIFY_DEBUG("UNREACHEBLE");
+ Y_UNREACHABLE();
+ }
+ }
+
+ bool CanDeleteParts() const {
+ switch (TxType) {
+ case TxDropTable:
case TxDropOlapStore:
case TxDropOlapTable:
- case TxDropPQGroup:
- case TxDropSubDomain:
- case TxDropBlockStoreVolume:
+ case TxDropPQGroup:
+ case TxDropSubDomain:
+ case TxDropBlockStoreVolume:
case TxDropFileStore:
- case TxDropKesus:
- case TxForceDropSubDomain:
- case TxForceDropExtSubDomain:
- case TxDropSolomonVolume:
- case TxSplitTablePartition:
- case TxMergeTablePartition:
+ case TxDropKesus:
+ case TxForceDropSubDomain:
+ case TxForceDropExtSubDomain:
+ case TxDropSolomonVolume:
+ case TxSplitTablePartition:
+ case TxMergeTablePartition:
case TxDropCdcStream:
case TxDropSequence:
case TxDropReplication:
- return true;
- case TxDropTableIndex:
- case TxRmDir:
- case TxFinalizeBuildIndex:
- return false;
- case TxMkDir:
- case TxCreateTable:
+ return true;
+ case TxDropTableIndex:
+ case TxRmDir:
+ case TxFinalizeBuildIndex:
+ return false;
+ case TxMkDir:
+ case TxCreateTable:
case TxCreateOlapStore:
case TxCreateOlapTable:
- case TxCopyTable:
- case TxCreatePQGroup:
- case TxCreateSubDomain:
- case TxCreateExtSubDomain:
- case TxCreateBlockStoreVolume:
+ case TxCopyTable:
+ case TxCreatePQGroup:
+ case TxCreateSubDomain:
+ case TxCreateExtSubDomain:
+ case TxCreateBlockStoreVolume:
case TxCreateFileStore:
- case TxCreateKesus:
- case TxCreateSolomonVolume:
- case TxCreateRtmrVolume:
- case TxCreateTableIndex:
+ case TxCreateKesus:
+ case TxCreateSolomonVolume:
+ case TxCreateRtmrVolume:
+ case TxCreateTableIndex:
case TxCreateCdcStream:
case TxCreateCdcStreamAtTable:
case TxCreateSequence:
case TxCreateReplication:
- case TxInitializeBuildIndex:
- case TxCreateLockForIndexBuild:
- case TxDropLock:
- case TxDropTableIndexAtMainTable:
+ case TxInitializeBuildIndex:
+ case TxCreateLockForIndexBuild:
+ case TxDropLock:
+ case TxDropTableIndexAtMainTable:
case TxDropCdcStreamAtTable:
- return false;
- case TxAlterPQGroup:
- case TxAlterTable:
+ return false;
+ case TxAlterPQGroup:
+ case TxAlterTable:
case TxAlterOlapStore:
case TxAlterOlapTable:
- case TxModifyACL:
- case TxBackup:
+ case TxModifyACL:
+ case TxBackup:
case TxRestore:
- case TxAlterBlockStoreVolume:
- case TxAssignBlockStoreVolume:
+ case TxAlterBlockStoreVolume:
+ case TxAssignBlockStoreVolume:
case TxAlterFileStore:
- case TxAlterKesus:
- case TxAlterSubDomain:
- case TxAlterExtSubDomain:
- case TxUpgradeSubDomain:
- case TxUpgradeSubDomainDecision:
- case TxAlterUserAttributes:
+ case TxAlterKesus:
+ case TxAlterSubDomain:
+ case TxAlterExtSubDomain:
+ case TxUpgradeSubDomain:
+ case TxUpgradeSubDomainDecision:
+ case TxAlterUserAttributes:
case TxFillIndex:
- case TxAlterTableIndex:
- case TxAlterSolomonVolume:
+ case TxAlterTableIndex:
+ case TxAlterSolomonVolume:
case TxAlterCdcStream:
case TxAlterCdcStreamAtTable:
- case TxMoveTable:
- case TxMoveTableIndex:
+ case TxMoveTable:
+ case TxMoveTableIndex:
case TxAlterSequence:
case TxAlterReplication:
- return false;
- case TxInvalid:
- Y_VERIFY_DEBUG("UNREACHEBLE");
- Y_UNREACHABLE();
- }
- }
-};
-
-}
-}
+ return false;
+ case TxInvalid:
+ Y_VERIFY_DEBUG("UNREACHEBLE");
+ Y_UNREACHABLE();
+ }
+ }
+};
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard_types.cpp b/ydb/core/tx/schemeshard/schemeshard_types.cpp
index d5547632806..57e94efac10 100644
--- a/ydb/core/tx/schemeshard/schemeshard_types.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_types.cpp
@@ -1,76 +1,76 @@
-#include "schemeshard_types.h"
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-TSchemeLimits::TSchemeLimits(const NKikimrScheme::TSchemeLimits &proto) {
- if (proto.HasMaxDepth()) {
- MaxDepth = proto.GetMaxDepth();
- }
- if (proto.HasMaxPaths()) {
- MaxPaths = proto.GetMaxPaths();
- }
- if (proto.HasMaxChildrenInDir()) {
- MaxChildrenInDir = proto.GetMaxChildrenInDir();
- }
- if (proto.HasMaxAclBytesSize()) {
- MaxAclBytesSize = proto.GetMaxAclBytesSize();
- }
- if (proto.HasMaxTableColumns()) {
- MaxTableColumns = proto.GetMaxTableColumns();
- }
- if (proto.HasMaxTableColumnNameLength()) {
- MaxTableColumnNameLength = proto.GetMaxTableColumnNameLength();
- }
- if (proto.HasMaxTableKeyColumns()) {
- MaxTableKeyColumns = proto.GetMaxTableKeyColumns();
- }
- if (proto.HasMaxTableIndices()) {
- MaxTableIndices = proto.GetMaxTableIndices();
- }
- if (proto.HasMaxShards()) {
- MaxShards = proto.GetMaxShards();
- }
- if (proto.HasMaxShardsInPath()) {
- MaxShardsInPath = proto.GetMaxShardsInPath();
- }
- if (proto.HasMaxConsistentCopyTargets()) {
- MaxConsistentCopyTargets = proto.GetMaxConsistentCopyTargets();
- }
- if (proto.HasMaxPathElementLength()) {
- MaxPathElementLength = proto.GetMaxPathElementLength();
- }
- if (proto.HasExtraPathSymbolsAllowed()) {
- ExtraPathSymbolsAllowed = proto.GetExtraPathSymbolsAllowed();
- }
- if (proto.HasMaxPQPartitions()) {
- MaxPQPartitions = proto.GetMaxPQPartitions();
- }
-}
-
-NKikimrScheme::TSchemeLimits TSchemeLimits::AsProto() const {
- NKikimrScheme::TSchemeLimits result;
-
- result.SetMaxDepth(MaxDepth);
- result.SetMaxPaths(MaxPaths);
- result.SetMaxChildrenInDir(MaxChildrenInDir);
- result.SetMaxAclBytesSize(MaxAclBytesSize);
-
- result.SetMaxTableColumns(MaxTableColumns);
- result.SetMaxTableColumnNameLength(MaxTableColumnNameLength);
- result.SetMaxTableKeyColumns(MaxTableKeyColumns);
- result.SetMaxTableIndices(MaxTableIndices);
- result.SetMaxShards(MaxShards);
- result.SetMaxShardsInPath(MaxShardsInPath);
- result.SetMaxConsistentCopyTargets(MaxConsistentCopyTargets);
-
- result.SetMaxPathElementLength(MaxPathElementLength);
- result.SetExtraPathSymbolsAllowed(ExtraPathSymbolsAllowed);
-
- result.SetMaxPQPartitions(MaxPQPartitions);
-
- return result;
-}
-
-}
-}
+#include "schemeshard_types.h"
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+TSchemeLimits::TSchemeLimits(const NKikimrScheme::TSchemeLimits &proto) {
+ if (proto.HasMaxDepth()) {
+ MaxDepth = proto.GetMaxDepth();
+ }
+ if (proto.HasMaxPaths()) {
+ MaxPaths = proto.GetMaxPaths();
+ }
+ if (proto.HasMaxChildrenInDir()) {
+ MaxChildrenInDir = proto.GetMaxChildrenInDir();
+ }
+ if (proto.HasMaxAclBytesSize()) {
+ MaxAclBytesSize = proto.GetMaxAclBytesSize();
+ }
+ if (proto.HasMaxTableColumns()) {
+ MaxTableColumns = proto.GetMaxTableColumns();
+ }
+ if (proto.HasMaxTableColumnNameLength()) {
+ MaxTableColumnNameLength = proto.GetMaxTableColumnNameLength();
+ }
+ if (proto.HasMaxTableKeyColumns()) {
+ MaxTableKeyColumns = proto.GetMaxTableKeyColumns();
+ }
+ if (proto.HasMaxTableIndices()) {
+ MaxTableIndices = proto.GetMaxTableIndices();
+ }
+ if (proto.HasMaxShards()) {
+ MaxShards = proto.GetMaxShards();
+ }
+ if (proto.HasMaxShardsInPath()) {
+ MaxShardsInPath = proto.GetMaxShardsInPath();
+ }
+ if (proto.HasMaxConsistentCopyTargets()) {
+ MaxConsistentCopyTargets = proto.GetMaxConsistentCopyTargets();
+ }
+ if (proto.HasMaxPathElementLength()) {
+ MaxPathElementLength = proto.GetMaxPathElementLength();
+ }
+ if (proto.HasExtraPathSymbolsAllowed()) {
+ ExtraPathSymbolsAllowed = proto.GetExtraPathSymbolsAllowed();
+ }
+ if (proto.HasMaxPQPartitions()) {
+ MaxPQPartitions = proto.GetMaxPQPartitions();
+ }
+}
+
+NKikimrScheme::TSchemeLimits TSchemeLimits::AsProto() const {
+ NKikimrScheme::TSchemeLimits result;
+
+ result.SetMaxDepth(MaxDepth);
+ result.SetMaxPaths(MaxPaths);
+ result.SetMaxChildrenInDir(MaxChildrenInDir);
+ result.SetMaxAclBytesSize(MaxAclBytesSize);
+
+ result.SetMaxTableColumns(MaxTableColumns);
+ result.SetMaxTableColumnNameLength(MaxTableColumnNameLength);
+ result.SetMaxTableKeyColumns(MaxTableKeyColumns);
+ result.SetMaxTableIndices(MaxTableIndices);
+ result.SetMaxShards(MaxShards);
+ result.SetMaxShardsInPath(MaxShardsInPath);
+ result.SetMaxConsistentCopyTargets(MaxConsistentCopyTargets);
+
+ result.SetMaxPathElementLength(MaxPathElementLength);
+ result.SetExtraPathSymbolsAllowed(ExtraPathSymbolsAllowed);
+
+ result.SetMaxPQPartitions(MaxPQPartitions);
+
+ return result;
+}
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard_types.h b/ydb/core/tx/schemeshard/schemeshard_types.h
index 0d3b0963d35..a60df6317da 100644
--- a/ydb/core/tx/schemeshard/schemeshard_types.h
+++ b/ydb/core/tx/schemeshard/schemeshard_types.h
@@ -1,82 +1,82 @@
-#pragma once
-
-#include "schemeshard_identificators.h"
-
+#pragma once
+
+#include "schemeshard_identificators.h"
+
#include <ydb/core/base/tablet_types.h>
#include <ydb/core/protos/flat_tx_scheme.pb.h>
#include <ydb/core/tablet_flat/flat_cxx_database.h>
-#include <util/generic/fwd.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-struct TSchemeLimits {
+#include <util/generic/fwd.h>
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+struct TSchemeLimits {
// path
- ui64 MaxDepth = 32;
- ui64 MaxPaths = 200*1000;
- ui64 MaxChildrenInDir = 100*1000;
+ ui64 MaxDepth = 32;
+ ui64 MaxPaths = 200*1000;
+ ui64 MaxChildrenInDir = 100*1000;
ui64 MaxAclBytesSize = 10 << 10;
- ui64 MaxPathElementLength = 255;
- TString ExtraPathSymbolsAllowed = "!\"#$%&'()*+,-.:;<=>?@[\\]^_`{|}~";
+ ui64 MaxPathElementLength = 255;
+ TString ExtraPathSymbolsAllowed = "!\"#$%&'()*+,-.:;<=>?@[\\]^_`{|}~";
// table
ui64 MaxTableColumns = 200;
ui64 MaxTableColumnNameLength = 255;
ui64 MaxTableKeyColumns = 20;
ui64 MaxTableIndices = 20;
- ui64 MaxShards = 200*1000; // In each database
- ui64 MaxShardsInPath = 35*1000; // In each path in database
+ ui64 MaxShards = 200*1000; // In each database
+ ui64 MaxShardsInPath = 35*1000; // In each path in database
ui64 MaxConsistentCopyTargets = 1000;
-
+
// pq group
ui64 MaxPQPartitions = 1000000;
- TSchemeLimits() = default;
- explicit TSchemeLimits(const NKikimrScheme::TSchemeLimits& proto);
-
- NKikimrScheme::TSchemeLimits AsProto() const;
-};
-
-using ETabletType = TTabletTypes;
-
-
-struct TGlobalTimestamp {
- TStepId Step = InvalidStepId;
- TTxId TxId = InvalidTxId;
-
- TGlobalTimestamp(TStepId step, TTxId txId)
- : Step(step)
- , TxId(txId)
- {}
-
- bool Empty() const {
- return !bool(Step);
- }
-
- explicit operator bool () const {
- return !Empty();
- }
-
- bool operator < (const TGlobalTimestamp& ts) const {
- Y_VERIFY_DEBUG(Step, "Comparing with unset timestemp");
- Y_VERIFY_DEBUG(ts.Step, "Comparing with unset timestemp");
- return Step < ts.Step || Step == ts.Step && TxId < ts.TxId;
- }
-
- bool operator == (const TGlobalTimestamp& ts) const {
- return Step == ts.Step && TxId == ts.TxId;
- }
-
- TString ToString() const {
- if (Empty()) {
- return "unset";
- }
-
- return TStringBuilder()
- << "[" << Step << ":" << TxId << "]";
- }
-};
-
+ TSchemeLimits() = default;
+ explicit TSchemeLimits(const NKikimrScheme::TSchemeLimits& proto);
+
+ NKikimrScheme::TSchemeLimits AsProto() const;
+};
+
+using ETabletType = TTabletTypes;
+
+
+struct TGlobalTimestamp {
+ TStepId Step = InvalidStepId;
+ TTxId TxId = InvalidTxId;
+
+ TGlobalTimestamp(TStepId step, TTxId txId)
+ : Step(step)
+ , TxId(txId)
+ {}
+
+ bool Empty() const {
+ return !bool(Step);
+ }
+
+ explicit operator bool () const {
+ return !Empty();
+ }
+
+ bool operator < (const TGlobalTimestamp& ts) const {
+ Y_VERIFY_DEBUG(Step, "Comparing with unset timestemp");
+ Y_VERIFY_DEBUG(ts.Step, "Comparing with unset timestemp");
+ return Step < ts.Step || Step == ts.Step && TxId < ts.TxId;
+ }
+
+ bool operator == (const TGlobalTimestamp& ts) const {
+ return Step == ts.Step && TxId == ts.TxId;
+ }
+
+ TString ToString() const {
+ if (Empty()) {
+ return "unset";
+ }
+
+ return TStringBuilder()
+ << "[" << Step << ":" << TxId << "]";
+ }
+};
+
enum class ETableColumnDefaultKind : ui32 {
None = 0,
@@ -84,26 +84,26 @@ enum class ETableColumnDefaultKind : ui32 {
};
-enum class EAttachChildResult : ui32 {
- Undefined = 0,
-
- AttachedAsOnlyOne,
-
- AttachedAsNewerDeleted,
- RejectAsOlderDeleted,
-
- AttachedAsActual,
- RejectAsDeleted,
-
- AttachedAsNewerActual,
- RejectAsOlderActual,
-
- AttachedAsCreatedActual,
- RejectAsInactve,
-
- AttachedAsOlderUnCreated,
- RejectAsNewerUnCreated
-};
-
-}
-}
+enum class EAttachChildResult : ui32 {
+ Undefined = 0,
+
+ AttachedAsOnlyOne,
+
+ AttachedAsNewerDeleted,
+ RejectAsOlderDeleted,
+
+ AttachedAsActual,
+ RejectAsDeleted,
+
+ AttachedAsNewerActual,
+ RejectAsOlderActual,
+
+ AttachedAsCreatedActual,
+ RejectAsInactve,
+
+ AttachedAsOlderUnCreated,
+ RejectAsNewerUnCreated
+};
+
+}
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard_ui64id.cpp b/ydb/core/tx/schemeshard/schemeshard_ui64id.cpp
index ab7f4c6895b..b50a3542ddc 100644
--- a/ydb/core/tx/schemeshard/schemeshard_ui64id.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_ui64id.cpp
@@ -1 +1 @@
-#include "schemeshard_ui64id.h"
+#include "schemeshard_ui64id.h"
diff --git a/ydb/core/tx/schemeshard/schemeshard_ui64id.h b/ydb/core/tx/schemeshard/schemeshard_ui64id.h
index 7088c9903be..26965918c8e 100644
--- a/ydb/core/tx/schemeshard/schemeshard_ui64id.h
+++ b/ydb/core/tx/schemeshard/schemeshard_ui64id.h
@@ -1,128 +1,128 @@
-#pragma once
-
+#pragma once
+
#include <ydb/core/base/defs.h>
#include <ydb/core/tablet_flat/flat_cxx_database.h>
-
-#include <util/system/types.h>
+
+#include <util/system/types.h>
#include <util/system/type_name.h>
-#include <util/stream/output.h>
-
-namespace NKikimr {
-
-template <class TTag, ui64 invalidValue>
-class TUi64Id {
-protected:
- ui64 Value;
-
-public:
- using TSelf = TUi64Id<TTag, invalidValue>;
-
- constexpr TUi64Id()
- : Value(invalidValue)
- {
- }
-
- constexpr explicit TUi64Id(ui64 value)
- : Value(value)
- {
- }
-
- TUi64Id(const TSelf& value) = default;
- TUi64Id(TSelf&& value) = default;
- TSelf& operator =(const TSelf& value) = default;
- TSelf& operator =(TSelf&& value) = default;
-
- ui64 Hash() const {
- return Hash64to32(Value);
- }
-
- bool operator==(const TSelf& r) const {
- return Value == r.Value;
- }
-
- bool operator!=(const TSelf& r) const {
- return Value != r.Value;
- }
-
- bool operator<(const TSelf& r) const {
- return Value < r.Value;
- }
-
- bool operator>(const TSelf& r) const {
- return Value > r.Value;
- }
-
- bool operator<=(const TSelf& r) const {
- return Value <= r.Value;
- }
-
- bool operator>=(const TSelf& r) const {
- return Value >= r.Value;
- }
-
- explicit operator bool() const {
- return Value != invalidValue;
- }
-
+#include <util/stream/output.h>
+
+namespace NKikimr {
+
+template <class TTag, ui64 invalidValue>
+class TUi64Id {
+protected:
+ ui64 Value;
+
+public:
+ using TSelf = TUi64Id<TTag, invalidValue>;
+
+ constexpr TUi64Id()
+ : Value(invalidValue)
+ {
+ }
+
+ constexpr explicit TUi64Id(ui64 value)
+ : Value(value)
+ {
+ }
+
+ TUi64Id(const TSelf& value) = default;
+ TUi64Id(TSelf&& value) = default;
+ TSelf& operator =(const TSelf& value) = default;
+ TSelf& operator =(TSelf&& value) = default;
+
+ ui64 Hash() const {
+ return Hash64to32(Value);
+ }
+
+ bool operator==(const TSelf& r) const {
+ return Value == r.Value;
+ }
+
+ bool operator!=(const TSelf& r) const {
+ return Value != r.Value;
+ }
+
+ bool operator<(const TSelf& r) const {
+ return Value < r.Value;
+ }
+
+ bool operator>(const TSelf& r) const {
+ return Value > r.Value;
+ }
+
+ bool operator<=(const TSelf& r) const {
+ return Value <= r.Value;
+ }
+
+ bool operator>=(const TSelf& r) const {
+ return Value >= r.Value;
+ }
+
+ explicit operator bool() const {
+ return Value != invalidValue;
+ }
+
ui64 GetValue() const {
return Value;
}
- explicit operator ui64() const {
- return Value;
- }
-
- friend inline IOutputStream& operator<<(IOutputStream& out, const TSelf& id) {
- return out << id.Value;
- }
-};
-
-namespace NIceDb {
-
-template <typename TColumnType, class TTag, ui64 invalidValue>
-struct TConvertValue<TColumnType, TRawTypeValue, NKikimr::TUi64Id<TTag, invalidValue>> {
- typedef NKikimr::TUi64Id<TTag, invalidValue> TSourceType;
-
- ui64 Store;
- TTypeValue Value;
-
- TConvertValue(const TSourceType& value)
- : Store(ui64(value))
- , Value(Store, TColumnType::ColumnType)
- {
- static_assert(TColumnType::ColumnType == NScheme::NTypeIds::Uint64, "use TUi64Id only with Uint64");
- }
-
- operator const TRawTypeValue&() const {
- return Value;
- }
-};
-
-template <typename TColumnType, class TTag, ui64 invalidValue>
-struct TConvertValue<TColumnType, NKikimr::TUi64Id<TTag, invalidValue>, TRawTypeValue> {
- typedef NKikimr::TUi64Id<TTag, invalidValue> TTargetType;
-
- TTypeValue Value;
-
- TConvertValue(const TRawTypeValue& value)
- : Value(value)
- {
- static_assert(TColumnType::ColumnType == NScheme::NTypeIds::Uint64, "use TUi64Id only with Uint64");
- }
-
- operator TTargetType() const {
- return TTargetType(ui64(Value));
- }
-};
-
-}
-}
-
-template <class TTag, ui64 invalidValue>
-struct THash<NKikimr::TUi64Id<TTag, invalidValue>> {
- inline ui64 operator()(const NKikimr::TUi64Id<TTag, invalidValue> &x) const noexcept {
- return x.Hash();
- }
-};
-
-
+ explicit operator ui64() const {
+ return Value;
+ }
+
+ friend inline IOutputStream& operator<<(IOutputStream& out, const TSelf& id) {
+ return out << id.Value;
+ }
+};
+
+namespace NIceDb {
+
+template <typename TColumnType, class TTag, ui64 invalidValue>
+struct TConvertValue<TColumnType, TRawTypeValue, NKikimr::TUi64Id<TTag, invalidValue>> {
+ typedef NKikimr::TUi64Id<TTag, invalidValue> TSourceType;
+
+ ui64 Store;
+ TTypeValue Value;
+
+ TConvertValue(const TSourceType& value)
+ : Store(ui64(value))
+ , Value(Store, TColumnType::ColumnType)
+ {
+ static_assert(TColumnType::ColumnType == NScheme::NTypeIds::Uint64, "use TUi64Id only with Uint64");
+ }
+
+ operator const TRawTypeValue&() const {
+ return Value;
+ }
+};
+
+template <typename TColumnType, class TTag, ui64 invalidValue>
+struct TConvertValue<TColumnType, NKikimr::TUi64Id<TTag, invalidValue>, TRawTypeValue> {
+ typedef NKikimr::TUi64Id<TTag, invalidValue> TTargetType;
+
+ TTypeValue Value;
+
+ TConvertValue(const TRawTypeValue& value)
+ : Value(value)
+ {
+ static_assert(TColumnType::ColumnType == NScheme::NTypeIds::Uint64, "use TUi64Id only with Uint64");
+ }
+
+ operator TTargetType() const {
+ return TTargetType(ui64(Value));
+ }
+};
+
+}
+}
+
+template <class TTag, ui64 invalidValue>
+struct THash<NKikimr::TUi64Id<TTag, invalidValue>> {
+ inline ui64 operator()(const NKikimr::TUi64Id<TTag, invalidValue> &x) const noexcept {
+ return x.Hash();
+ }
+};
+
+
diff --git a/ydb/core/tx/schemeshard/schemeshard_user_attr_limits.h b/ydb/core/tx/schemeshard/schemeshard_user_attr_limits.h
index 235008dc5af..aeddaa22be6 100644
--- a/ydb/core/tx/schemeshard/schemeshard_user_attr_limits.h
+++ b/ydb/core/tx/schemeshard/schemeshard_user_attr_limits.h
@@ -3,7 +3,7 @@
#include <util/system/types.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
struct TUserAttributesLimits {
static constexpr ui32 MaxNameLen = 100;
diff --git a/ydb/core/tx/schemeshard/schemeshard_utils.cpp b/ydb/core/tx/schemeshard/schemeshard_utils.cpp
index 7f091a9f4c8..4ee28e35435 100644
--- a/ydb/core/tx/schemeshard/schemeshard_utils.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_utils.cpp
@@ -1,39 +1,39 @@
-#include "schemeshard_utils.h"
-
+#include "schemeshard_utils.h"
+
#include <ydb/core/mind/hive/hive.h>
#include <ydb/core/protos/counters_schemeshard.pb.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-void TShardDeleter::Shutdown(const NActors::TActorContext &ctx) {
- for (auto& info : PerHiveDeletions) {
- NTabletPipe::CloseClient(ctx, info.second.PipeToHive);
- }
- PerHiveDeletions.clear();
-}
-
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+void TShardDeleter::Shutdown(const NActors::TActorContext &ctx) {
+ for (auto& info : PerHiveDeletions) {
+ NTabletPipe::CloseClient(ctx, info.second.PipeToHive);
+ }
+ PerHiveDeletions.clear();
+}
+
void TShardDeleter::SendDeleteRequests(TTabletId hiveTabletId,
const THashSet<TShardIdx> &shardsToDelete,
- const THashMap<NKikimr::NSchemeShard::TShardIdx, NKikimr::NSchemeShard::TShardInfo>& shardsInfos,
+ const THashMap<NKikimr::NSchemeShard::TShardIdx, NKikimr::NSchemeShard::TShardInfo>& shardsInfos,
const NActors::TActorContext &ctx) {
- if (shardsToDelete.empty())
- return;
-
- TPerHiveDeletions& info = PerHiveDeletions[hiveTabletId];
- if (!info.PipeToHive) {
- NTabletPipe::TClientConfig clientConfig;
- clientConfig.RetryPolicy = HivePipeRetryPolicy;
- info.PipeToHive = ctx.Register(NTabletPipe::CreateClient(ctx.SelfID, ui64(hiveTabletId), clientConfig));
- }
- info.ShardsToDelete.insert(shardsToDelete.begin(), shardsToDelete.end());
-
- for (auto shardIdx : shardsToDelete) {
- ShardHive[shardIdx] = hiveTabletId;
- // !HACK: use shardIdx as TxId because Hive only replies with TxId
- // TODO: change hive events to get rid of this hack
- // svc@ in progress fixing it
- TAutoPtr<TEvHive::TEvDeleteTablet> event = new TEvHive::TEvDeleteTablet(shardIdx.GetOwnerId(), ui64(shardIdx.GetLocalId()), ui64(shardIdx.GetLocalId()));
+ if (shardsToDelete.empty())
+ return;
+
+ TPerHiveDeletions& info = PerHiveDeletions[hiveTabletId];
+ if (!info.PipeToHive) {
+ NTabletPipe::TClientConfig clientConfig;
+ clientConfig.RetryPolicy = HivePipeRetryPolicy;
+ info.PipeToHive = ctx.Register(NTabletPipe::CreateClient(ctx.SelfID, ui64(hiveTabletId), clientConfig));
+ }
+ info.ShardsToDelete.insert(shardsToDelete.begin(), shardsToDelete.end());
+
+ for (auto shardIdx : shardsToDelete) {
+ ShardHive[shardIdx] = hiveTabletId;
+ // !HACK: use shardIdx as TxId because Hive only replies with TxId
+ // TODO: change hive events to get rid of this hack
+ // svc@ in progress fixing it
+ TAutoPtr<TEvHive::TEvDeleteTablet> event = new TEvHive::TEvDeleteTablet(shardIdx.GetOwnerId(), ui64(shardIdx.GetLocalId()), ui64(shardIdx.GetLocalId()));
auto itShard = shardsInfos.find(shardIdx);
if (itShard != shardsInfos.end()) {
TTabletId shardTabletId = itShard->second.TabletID;
@@ -41,33 +41,33 @@ void TShardDeleter::SendDeleteRequests(TTabletId hiveTabletId,
event->Record.AddTabletID(ui64(shardTabletId));
}
}
-
- Y_VERIFY(shardIdx);
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Free shard " << shardIdx << " hive " << hiveTabletId << " at ss " << MyTabletID);
-
- NTabletPipe::SendData(ctx, info.PipeToHive, event.Release());
- }
-}
-
+
+ Y_VERIFY(shardIdx);
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Free shard " << shardIdx << " hive " << hiveTabletId << " at ss " << MyTabletID);
+
+ NTabletPipe::SendData(ctx, info.PipeToHive, event.Release());
+ }
+}
+
void TShardDeleter::ResendDeleteRequests(TTabletId hiveTabletId, const THashMap<TShardIdx, TShardInfo>& shardsInfos, const NActors::TActorContext &ctx) {
LOG_NOTICE_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Resending tablet deletion requests from " << MyTabletID << " to " << hiveTabletId);
-
+
auto itPerHive = PerHiveDeletions.find(hiveTabletId);
if (itPerHive == PerHiveDeletions.end()) {
LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Hive " << hiveTabletId << " not found for delete requests");
- return;
+ return;
}
-
+
THashSet<TShardIdx> toResend(std::move(itPerHive->second.ShardsToDelete));
PerHiveDeletions.erase(itPerHive);
-
+
SendDeleteRequests(hiveTabletId, toResend, shardsInfos, ctx);
}
-
+
void TShardDeleter::ResendDeleteRequest(TTabletId hiveTabletId,
const THashMap<TShardIdx, TShardInfo>& shardsInfos,
TShardIdx shardIdx,
@@ -91,8 +91,8 @@ void TShardDeleter::ResendDeleteRequest(TTabletId hiveTabletId,
LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
"Shard " << shardIdx << " not found for delete request for Hive " << hiveTabletId);
}
-}
-
+}
+
void TShardDeleter::RedirectDeleteRequest(TTabletId hiveFromTabletId,
TTabletId hiveToTabletId,
TShardIdx shardIdx,
@@ -119,440 +119,440 @@ void TShardDeleter::RedirectDeleteRequest(TTabletId hiveFromTabletId,
ResendDeleteRequest(hiveToTabletId, shardsInfos, shardIdx, ctx);
}
-void TShardDeleter::ShardDeleted(TShardIdx shardIdx, const NActors::TActorContext &ctx) {
- if (!ShardHive.contains(shardIdx))
- return;
-
- TTabletId hiveTabletId = ShardHive[shardIdx];
- ShardHive.erase(shardIdx);
- PerHiveDeletions[hiveTabletId].ShardsToDelete.erase(shardIdx);
-
- if (PerHiveDeletions[hiveTabletId].ShardsToDelete.empty()) {
- NTabletPipe::CloseClient(ctx, PerHiveDeletions[hiveTabletId].PipeToHive);
- PerHiveDeletions.erase(hiveTabletId);
- }
-}
-
+void TShardDeleter::ShardDeleted(TShardIdx shardIdx, const NActors::TActorContext &ctx) {
+ if (!ShardHive.contains(shardIdx))
+ return;
+
+ TTabletId hiveTabletId = ShardHive[shardIdx];
+ ShardHive.erase(shardIdx);
+ PerHiveDeletions[hiveTabletId].ShardsToDelete.erase(shardIdx);
+
+ if (PerHiveDeletions[hiveTabletId].ShardsToDelete.empty()) {
+ NTabletPipe::CloseClient(ctx, PerHiveDeletions[hiveTabletId].PipeToHive);
+ PerHiveDeletions.erase(hiveTabletId);
+ }
+}
+
bool TShardDeleter::Has(TTabletId hiveTabletId, TActorId pipeClientActorId) const {
- return PerHiveDeletions.contains(hiveTabletId) && PerHiveDeletions.at(hiveTabletId).PipeToHive == pipeClientActorId;
-}
-
-bool TShardDeleter::Has(TShardIdx shardIdx) const {
- return ShardHive.contains(shardIdx);
-}
-
-bool TShardDeleter::Empty() const {
- return PerHiveDeletions.empty();
-}
-
-void TSelfPinger::Handle(TEvSchemeShard::TEvMeasureSelfResponseTime::TPtr &ev, const NActors::TActorContext &ctx) {
- Y_UNUSED(ev);
- TInstant now = AppData(ctx)->TimeProvider->Now();
- TDuration responseTime = now - SelfPingSentTime;
- LastResponseTime = responseTime;
- TabletCounters->Simple()[COUNTER_RESPONSE_TIME_USEC].Set(LastResponseTime.MicroSeconds());
- if (responseTime.MilliSeconds() > 1000) {
- LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "Schemeshard " << TabletId << " response time is " << responseTime.MilliSeconds() << " msec");
- }
- SelfPingInFlight = false;
- if (responseTime > SELF_PING_INTERVAL) {
- DoSelfPing(ctx);
- } else {
- SheduleSelfPingWakeup(ctx);
- }
-}
-
-void TSelfPinger::Handle(TEvSchemeShard::TEvWakeupToMeasureSelfResponseTime::TPtr &ev, const NActors::TActorContext &ctx) {
- Y_UNUSED(ev);
- SelfPingWakeupScheduled = false;
- DoSelfPing(ctx);
-}
-
-void TSelfPinger::OnAnyEvent(const NActors::TActorContext &ctx) {
- TInstant now = AppData(ctx)->TimeProvider->Now();
- if (SelfPingInFlight) {
- TDuration responseTime = now - SelfPingSentTime;
- // Increase measured response time is ping is taking longer than then the previous one
- LastResponseTime = Max(LastResponseTime, responseTime);
- TabletCounters->Simple()[COUNTER_RESPONSE_TIME_USEC].Set(LastResponseTime.MicroSeconds());
- } else if ((now - SelfPingWakeupScheduledTime) > SELF_PING_INTERVAL) {
- DoSelfPing(ctx);
- }
-}
-
-void TSelfPinger::DoSelfPing(const NActors::TActorContext &ctx) {
- if (SelfPingInFlight)
- return;
-
- ctx.Send(ctx.SelfID, new TEvSchemeShard::TEvMeasureSelfResponseTime);
- SelfPingSentTime = AppData(ctx)->TimeProvider->Now();
- SelfPingInFlight = true;
-}
-
-void TSelfPinger::SheduleSelfPingWakeup(const NActors::TActorContext &ctx) {
- if (SelfPingWakeupScheduled)
- return;
-
- ctx.Schedule(SELF_PING_INTERVAL, new TEvSchemeShard::TEvWakeupToMeasureSelfResponseTime);
- SelfPingWakeupScheduled = true;
- SelfPingWakeupScheduledTime = AppData(ctx)->TimeProvider->Now();
-}
-
-}
-
-namespace NTableIndex {
-
-TTableColumns ExtractInfo(const NKikimrSchemeOp::TTableDescription &tableDesrc) {
- NTableIndex::TTableColumns result;
- for (auto& column: tableDesrc.GetColumns()) {
- result.Columns.insert(column.GetName());
- }
- for (auto& keyName: tableDesrc.GetKeyColumnNames()) {
- result.Keys.push_back(keyName);
- }
- return result;
-}
-
-TIndexColumns ExtractInfo(const NKikimrSchemeOp::TIndexCreationConfig &indexDesc) {
+ return PerHiveDeletions.contains(hiveTabletId) && PerHiveDeletions.at(hiveTabletId).PipeToHive == pipeClientActorId;
+}
+
+bool TShardDeleter::Has(TShardIdx shardIdx) const {
+ return ShardHive.contains(shardIdx);
+}
+
+bool TShardDeleter::Empty() const {
+ return PerHiveDeletions.empty();
+}
+
+void TSelfPinger::Handle(TEvSchemeShard::TEvMeasureSelfResponseTime::TPtr &ev, const NActors::TActorContext &ctx) {
+ Y_UNUSED(ev);
+ TInstant now = AppData(ctx)->TimeProvider->Now();
+ TDuration responseTime = now - SelfPingSentTime;
+ LastResponseTime = responseTime;
+ TabletCounters->Simple()[COUNTER_RESPONSE_TIME_USEC].Set(LastResponseTime.MicroSeconds());
+ if (responseTime.MilliSeconds() > 1000) {
+ LOG_WARN_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "Schemeshard " << TabletId << " response time is " << responseTime.MilliSeconds() << " msec");
+ }
+ SelfPingInFlight = false;
+ if (responseTime > SELF_PING_INTERVAL) {
+ DoSelfPing(ctx);
+ } else {
+ SheduleSelfPingWakeup(ctx);
+ }
+}
+
+void TSelfPinger::Handle(TEvSchemeShard::TEvWakeupToMeasureSelfResponseTime::TPtr &ev, const NActors::TActorContext &ctx) {
+ Y_UNUSED(ev);
+ SelfPingWakeupScheduled = false;
+ DoSelfPing(ctx);
+}
+
+void TSelfPinger::OnAnyEvent(const NActors::TActorContext &ctx) {
+ TInstant now = AppData(ctx)->TimeProvider->Now();
+ if (SelfPingInFlight) {
+ TDuration responseTime = now - SelfPingSentTime;
+ // Increase measured response time is ping is taking longer than then the previous one
+ LastResponseTime = Max(LastResponseTime, responseTime);
+ TabletCounters->Simple()[COUNTER_RESPONSE_TIME_USEC].Set(LastResponseTime.MicroSeconds());
+ } else if ((now - SelfPingWakeupScheduledTime) > SELF_PING_INTERVAL) {
+ DoSelfPing(ctx);
+ }
+}
+
+void TSelfPinger::DoSelfPing(const NActors::TActorContext &ctx) {
+ if (SelfPingInFlight)
+ return;
+
+ ctx.Send(ctx.SelfID, new TEvSchemeShard::TEvMeasureSelfResponseTime);
+ SelfPingSentTime = AppData(ctx)->TimeProvider->Now();
+ SelfPingInFlight = true;
+}
+
+void TSelfPinger::SheduleSelfPingWakeup(const NActors::TActorContext &ctx) {
+ if (SelfPingWakeupScheduled)
+ return;
+
+ ctx.Schedule(SELF_PING_INTERVAL, new TEvSchemeShard::TEvWakeupToMeasureSelfResponseTime);
+ SelfPingWakeupScheduled = true;
+ SelfPingWakeupScheduledTime = AppData(ctx)->TimeProvider->Now();
+}
+
+}
+
+namespace NTableIndex {
+
+TTableColumns ExtractInfo(const NKikimrSchemeOp::TTableDescription &tableDesrc) {
+ NTableIndex::TTableColumns result;
+ for (auto& column: tableDesrc.GetColumns()) {
+ result.Columns.insert(column.GetName());
+ }
+ for (auto& keyName: tableDesrc.GetKeyColumnNames()) {
+ result.Keys.push_back(keyName);
+ }
+ return result;
+}
+
+TIndexColumns ExtractInfo(const NKikimrSchemeOp::TIndexCreationConfig &indexDesc) {
NTableIndex::TIndexColumns result;
- for (auto& keyName: indexDesc.GetKeyColumnNames()) {
+ for (auto& keyName: indexDesc.GetKeyColumnNames()) {
result.KeyColumns.push_back(keyName);
- }
+ }
for (auto& keyName: indexDesc.GetDataColumnNames()) {
result.DataColumns.push_back(keyName);
}
- return result;
-}
-
-TTableColumns ExtractInfo(const NSchemeShard::TTableInfo::TPtr &tableInfo) {
- NTableIndex::TTableColumns result;
- for (auto& item: tableInfo->Columns) {
- const auto& column = item.second;
- if (column.IsDropped()) {
- continue;
- }
-
- result.Columns.insert(item.second.Name);
- }
-
- for (auto& keyId: tableInfo->KeyColumnIds) {
- const auto& keyColumn = tableInfo->Columns.at(keyId);
- if (keyColumn.IsDropped()) {
- continue;
- }
-
- Y_VERIFY(result.Columns.contains(keyColumn.Name));
- result.Keys.push_back(keyColumn.Name);
- }
-
- return result;
-}
-
-NKikimrSchemeOp::TTableDescription CalcImplTableDesc(
- const NSchemeShard::TTableInfo::TPtr& baseTableInfo,
- const NTableIndex::TTableColumns& implTableColumns,
- const NKikimrSchemeOp::TTableDescription& indexTableDesc)
-{
- NKikimrSchemeOp::TTableDescription result;
-
- result.SetName("indexImplTable");
-
- if (indexTableDesc.HasUniformPartitionsCount()) {
- result.SetUniformPartitionsCount(indexTableDesc.GetUniformPartitionsCount());
- }
-
- if (indexTableDesc.SplitBoundarySize()) {
- result.MutableSplitBoundary()->CopyFrom(indexTableDesc.GetSplitBoundary());
- }
-
- *result.MutablePartitionConfig() = PartitionConfigForIndexes(baseTableInfo, indexTableDesc);
-
- //Columns and KeyColumnNames order is really important
- //the order of implTableColumns.Keys is the right one
-
- THashMap<TString, ui32> implKeyToImplColumn;
- for (ui32 keyId = 0; keyId < implTableColumns.Keys.size(); ++keyId) {
- implKeyToImplColumn[implTableColumns.Keys[keyId]] = keyId;
- }
-
- const TAppData* appData = AppData();
-
- result.ClearColumns();
- for (auto& iter: baseTableInfo->Columns) {
- const NSchemeShard::TTableInfo::TColumn& column = iter.second;
+ return result;
+}
+
+TTableColumns ExtractInfo(const NSchemeShard::TTableInfo::TPtr &tableInfo) {
+ NTableIndex::TTableColumns result;
+ for (auto& item: tableInfo->Columns) {
+ const auto& column = item.second;
if (column.IsDropped()) {
continue;
}
-
- if (implTableColumns.Columns.contains(column.Name)) {
- auto item = result.AddColumns();
- item->SetName(column.Name);
-
- item->SetType(appData->TypeRegistry->GetTypeName(column.PType));
-
- ui32 order = Max<ui32>();
- if (implKeyToImplColumn.contains(column.Name)) {
- order = implKeyToImplColumn.at(column.Name);
- }
- item->SetId(order);
- }
- }
-
- std::sort(result.MutableColumns()->begin(),
- result.MutableColumns()->end(),
- [] (auto& left, auto& right) {
- return left.GetId() < right.GetId();
- });
-
- for (auto& column: *result.MutableColumns()) {
- column.ClearId();
- }
-
- result.ClearKeyColumnNames();
- for (auto& keyName: implTableColumns.Keys) {
- result.AddKeyColumnNames(keyName);
- }
-
- return result;
-}
-
-NKikimrSchemeOp::TTableDescription CalcImplTableDesc(
- const NKikimrSchemeOp::TTableDescription &baseTableDesrc,
- const TTableColumns &implTableColumns,
- const NKikimrSchemeOp::TTableDescription &indexTableDesc)
-{
- NKikimrSchemeOp::TTableDescription result;
-
- result.SetName("indexImplTable");
-
- if (indexTableDesc.HasUniformPartitionsCount()) {
- result.SetUniformPartitionsCount(indexTableDesc.GetUniformPartitionsCount());
- }
-
- if (indexTableDesc.SplitBoundarySize()) {
- result.MutableSplitBoundary()->CopyFrom(indexTableDesc.GetSplitBoundary());
- }
-
- *result.MutablePartitionConfig() = PartitionConfigForIndexes(baseTableDesrc, indexTableDesc);
-
- //Columns and KeyColumnNames order is really important
- //the order of implTableColumns.Keys is the right one
-
- THashMap<TString, ui32> implKeyToImplColumn;
- for (ui32 keyId = 0; keyId < implTableColumns.Keys.size(); ++keyId) {
- implKeyToImplColumn[implTableColumns.Keys[keyId]] = keyId;
- }
-
- result.ClearColumns();
- for (auto& column: baseTableDesrc.GetColumns()) {
- auto& columnName = column.GetName();
- if (implTableColumns.Columns.contains(columnName)) {
- auto item = result.AddColumns();
- item->CopyFrom(column);
-
- // Indexes don't use column families
- item->ClearFamily();
- item->ClearFamilyName();
-
- ui32 order = Max<ui32>();
- if (implKeyToImplColumn.contains(columnName)) {
- order = implKeyToImplColumn.at(columnName);
- }
- item->SetId(order);
- }
- }
-
- std::sort(result.MutableColumns()->begin(),
- result.MutableColumns()->end(),
- [] (auto& left, auto& right) {
- return left.GetId() < right.GetId();
- });
-
- for (auto& column: *result.MutableColumns()) {
- column.ClearId();
- }
-
- result.ClearKeyColumnNames();
- for (auto& keyName: implTableColumns.Keys) {
- result.AddKeyColumnNames(keyName);
- }
-
- return result;
-}
-
-NKikimrSchemeOp::TPartitionConfig PartitionConfigForIndexes(
- const NKikimrSchemeOp::TPartitionConfig& baseTablePartitionConfig,
- const NKikimrSchemeOp::TTableDescription& indexTableDesc)
-{
- // KIKIMR-6687
- NKikimrSchemeOp::TPartitionConfig result;
-
- if (baseTablePartitionConfig.HasNamedCompactionPolicy()) {
- result.SetNamedCompactionPolicy(baseTablePartitionConfig.GetNamedCompactionPolicy());
- }
- if (baseTablePartitionConfig.HasCompactionPolicy()) {
- result.MutableCompactionPolicy()->CopyFrom(baseTablePartitionConfig.GetCompactionPolicy());
- }
+
+ result.Columns.insert(item.second.Name);
+ }
+
+ for (auto& keyId: tableInfo->KeyColumnIds) {
+ const auto& keyColumn = tableInfo->Columns.at(keyId);
+ if (keyColumn.IsDropped()) {
+ continue;
+ }
+
+ Y_VERIFY(result.Columns.contains(keyColumn.Name));
+ result.Keys.push_back(keyColumn.Name);
+ }
+
+ return result;
+}
+
+NKikimrSchemeOp::TTableDescription CalcImplTableDesc(
+ const NSchemeShard::TTableInfo::TPtr& baseTableInfo,
+ const NTableIndex::TTableColumns& implTableColumns,
+ const NKikimrSchemeOp::TTableDescription& indexTableDesc)
+{
+ NKikimrSchemeOp::TTableDescription result;
+
+ result.SetName("indexImplTable");
+
+ if (indexTableDesc.HasUniformPartitionsCount()) {
+ result.SetUniformPartitionsCount(indexTableDesc.GetUniformPartitionsCount());
+ }
+
+ if (indexTableDesc.SplitBoundarySize()) {
+ result.MutableSplitBoundary()->CopyFrom(indexTableDesc.GetSplitBoundary());
+ }
+
+ *result.MutablePartitionConfig() = PartitionConfigForIndexes(baseTableInfo, indexTableDesc);
+
+ //Columns and KeyColumnNames order is really important
+ //the order of implTableColumns.Keys is the right one
+
+ THashMap<TString, ui32> implKeyToImplColumn;
+ for (ui32 keyId = 0; keyId < implTableColumns.Keys.size(); ++keyId) {
+ implKeyToImplColumn[implTableColumns.Keys[keyId]] = keyId;
+ }
+
+ const TAppData* appData = AppData();
+
+ result.ClearColumns();
+ for (auto& iter: baseTableInfo->Columns) {
+ const NSchemeShard::TTableInfo::TColumn& column = iter.second;
+ if (column.IsDropped()) {
+ continue;
+ }
+
+ if (implTableColumns.Columns.contains(column.Name)) {
+ auto item = result.AddColumns();
+ item->SetName(column.Name);
+
+ item->SetType(appData->TypeRegistry->GetTypeName(column.PType));
+
+ ui32 order = Max<ui32>();
+ if (implKeyToImplColumn.contains(column.Name)) {
+ order = implKeyToImplColumn.at(column.Name);
+ }
+ item->SetId(order);
+ }
+ }
+
+ std::sort(result.MutableColumns()->begin(),
+ result.MutableColumns()->end(),
+ [] (auto& left, auto& right) {
+ return left.GetId() < right.GetId();
+ });
+
+ for (auto& column: *result.MutableColumns()) {
+ column.ClearId();
+ }
+
+ result.ClearKeyColumnNames();
+ for (auto& keyName: implTableColumns.Keys) {
+ result.AddKeyColumnNames(keyName);
+ }
+
+ return result;
+}
+
+NKikimrSchemeOp::TTableDescription CalcImplTableDesc(
+ const NKikimrSchemeOp::TTableDescription &baseTableDesrc,
+ const TTableColumns &implTableColumns,
+ const NKikimrSchemeOp::TTableDescription &indexTableDesc)
+{
+ NKikimrSchemeOp::TTableDescription result;
+
+ result.SetName("indexImplTable");
+
+ if (indexTableDesc.HasUniformPartitionsCount()) {
+ result.SetUniformPartitionsCount(indexTableDesc.GetUniformPartitionsCount());
+ }
+
+ if (indexTableDesc.SplitBoundarySize()) {
+ result.MutableSplitBoundary()->CopyFrom(indexTableDesc.GetSplitBoundary());
+ }
+
+ *result.MutablePartitionConfig() = PartitionConfigForIndexes(baseTableDesrc, indexTableDesc);
+
+ //Columns and KeyColumnNames order is really important
+ //the order of implTableColumns.Keys is the right one
+
+ THashMap<TString, ui32> implKeyToImplColumn;
+ for (ui32 keyId = 0; keyId < implTableColumns.Keys.size(); ++keyId) {
+ implKeyToImplColumn[implTableColumns.Keys[keyId]] = keyId;
+ }
+
+ result.ClearColumns();
+ for (auto& column: baseTableDesrc.GetColumns()) {
+ auto& columnName = column.GetName();
+ if (implTableColumns.Columns.contains(columnName)) {
+ auto item = result.AddColumns();
+ item->CopyFrom(column);
+
+ // Indexes don't use column families
+ item->ClearFamily();
+ item->ClearFamilyName();
+
+ ui32 order = Max<ui32>();
+ if (implKeyToImplColumn.contains(columnName)) {
+ order = implKeyToImplColumn.at(columnName);
+ }
+ item->SetId(order);
+ }
+ }
+
+ std::sort(result.MutableColumns()->begin(),
+ result.MutableColumns()->end(),
+ [] (auto& left, auto& right) {
+ return left.GetId() < right.GetId();
+ });
+
+ for (auto& column: *result.MutableColumns()) {
+ column.ClearId();
+ }
+
+ result.ClearKeyColumnNames();
+ for (auto& keyName: implTableColumns.Keys) {
+ result.AddKeyColumnNames(keyName);
+ }
+
+ return result;
+}
+
+NKikimrSchemeOp::TPartitionConfig PartitionConfigForIndexes(
+ const NKikimrSchemeOp::TPartitionConfig& baseTablePartitionConfig,
+ const NKikimrSchemeOp::TTableDescription& indexTableDesc)
+{
+ // KIKIMR-6687
+ NKikimrSchemeOp::TPartitionConfig result;
+
+ if (baseTablePartitionConfig.HasNamedCompactionPolicy()) {
+ result.SetNamedCompactionPolicy(baseTablePartitionConfig.GetNamedCompactionPolicy());
+ }
+ if (baseTablePartitionConfig.HasCompactionPolicy()) {
+ result.MutableCompactionPolicy()->CopyFrom(baseTablePartitionConfig.GetCompactionPolicy());
+ }
// skip optional uint64 FollowerCount = 3;
- if (baseTablePartitionConfig.HasExecutorCacheSize()) {
- result.SetExecutorCacheSize(baseTablePartitionConfig.GetExecutorCacheSize());
- }
+ if (baseTablePartitionConfig.HasExecutorCacheSize()) {
+ result.SetExecutorCacheSize(baseTablePartitionConfig.GetExecutorCacheSize());
+ }
// skip optional bool AllowFollowerPromotion = 5 [default = true];
- if (baseTablePartitionConfig.HasTxReadSizeLimit()) {
- result.SetTxReadSizeLimit(baseTablePartitionConfig.GetTxReadSizeLimit());
- }
+ if (baseTablePartitionConfig.HasTxReadSizeLimit()) {
+ result.SetTxReadSizeLimit(baseTablePartitionConfig.GetTxReadSizeLimit());
+ }
// skip optional uint32 CrossDataCenterFollowerCount = 8;
- if (baseTablePartitionConfig.HasChannelProfileId()) {
- result.SetChannelProfileId(baseTablePartitionConfig.GetChannelProfileId());
- }
-
- if (indexTableDesc.GetPartitionConfig().HasPartitioningPolicy()) {
- result.MutablePartitioningPolicy()->CopyFrom(indexTableDesc.GetPartitionConfig().GetPartitioningPolicy());
- } else {
- result.MutablePartitioningPolicy()->SetSizeToSplit((ui64)1 << 27);
- //result.MutablePartitioningPolicy()->SetMinPartitionsCount(1); do not auto merge
- result.MutablePartitioningPolicy()->SetMaxPartitionsCount(100);
- }
- if (baseTablePartitionConfig.HasPipelineConfig()) {
- result.MutablePipelineConfig()->CopyFrom(baseTablePartitionConfig.GetPipelineConfig());
- }
- if (baseTablePartitionConfig.ColumnFamiliesSize()) {
- // Indexes don't need column families unless it's the default column family
- for (const auto& family : baseTablePartitionConfig.GetColumnFamilies()) {
- const bool isDefaultFamily = (
- (!family.HasId() && !family.HasName()) ||
- (family.HasId() && family.GetId() == 0) ||
- (family.HasName() && family.GetName() == "default"));
- if (isDefaultFamily) {
- result.AddColumnFamilies()->CopyFrom(family);
- }
- }
- }
- if (baseTablePartitionConfig.HasResourceProfile()) {
- result.SetResourceProfile(baseTablePartitionConfig.GetResourceProfile());
- }
- if (baseTablePartitionConfig.HasDisableStatisticsCalculation()) {
- result.SetDisableStatisticsCalculation(baseTablePartitionConfig.GetDisableStatisticsCalculation());
- }
- if (baseTablePartitionConfig.HasEnableFilterByKey()) {
- result.SetEnableFilterByKey(baseTablePartitionConfig.GetEnableFilterByKey());
- }
- if (baseTablePartitionConfig.HasExecutorFastLogPolicy()) {
- result.SetExecutorFastLogPolicy(baseTablePartitionConfig.GetExecutorFastLogPolicy());
- }
- if (baseTablePartitionConfig.HasEnableEraseCache()) {
- result.SetEnableEraseCache(baseTablePartitionConfig.GetEnableEraseCache());
- }
- if (baseTablePartitionConfig.HasEraseCacheMinRows()) {
- result.SetEraseCacheMinRows(baseTablePartitionConfig.GetEraseCacheMinRows());
- }
- if (baseTablePartitionConfig.HasEraseCacheMaxBytes()) {
- result.SetEraseCacheMaxBytes(baseTablePartitionConfig.GetEraseCacheMaxBytes());
- }
+ if (baseTablePartitionConfig.HasChannelProfileId()) {
+ result.SetChannelProfileId(baseTablePartitionConfig.GetChannelProfileId());
+ }
+
+ if (indexTableDesc.GetPartitionConfig().HasPartitioningPolicy()) {
+ result.MutablePartitioningPolicy()->CopyFrom(indexTableDesc.GetPartitionConfig().GetPartitioningPolicy());
+ } else {
+ result.MutablePartitioningPolicy()->SetSizeToSplit((ui64)1 << 27);
+ //result.MutablePartitioningPolicy()->SetMinPartitionsCount(1); do not auto merge
+ result.MutablePartitioningPolicy()->SetMaxPartitionsCount(100);
+ }
+ if (baseTablePartitionConfig.HasPipelineConfig()) {
+ result.MutablePipelineConfig()->CopyFrom(baseTablePartitionConfig.GetPipelineConfig());
+ }
+ if (baseTablePartitionConfig.ColumnFamiliesSize()) {
+ // Indexes don't need column families unless it's the default column family
+ for (const auto& family : baseTablePartitionConfig.GetColumnFamilies()) {
+ const bool isDefaultFamily = (
+ (!family.HasId() && !family.HasName()) ||
+ (family.HasId() && family.GetId() == 0) ||
+ (family.HasName() && family.GetName() == "default"));
+ if (isDefaultFamily) {
+ result.AddColumnFamilies()->CopyFrom(family);
+ }
+ }
+ }
+ if (baseTablePartitionConfig.HasResourceProfile()) {
+ result.SetResourceProfile(baseTablePartitionConfig.GetResourceProfile());
+ }
+ if (baseTablePartitionConfig.HasDisableStatisticsCalculation()) {
+ result.SetDisableStatisticsCalculation(baseTablePartitionConfig.GetDisableStatisticsCalculation());
+ }
+ if (baseTablePartitionConfig.HasEnableFilterByKey()) {
+ result.SetEnableFilterByKey(baseTablePartitionConfig.GetEnableFilterByKey());
+ }
+ if (baseTablePartitionConfig.HasExecutorFastLogPolicy()) {
+ result.SetExecutorFastLogPolicy(baseTablePartitionConfig.GetExecutorFastLogPolicy());
+ }
+ if (baseTablePartitionConfig.HasEnableEraseCache()) {
+ result.SetEnableEraseCache(baseTablePartitionConfig.GetEnableEraseCache());
+ }
+ if (baseTablePartitionConfig.HasEraseCacheMinRows()) {
+ result.SetEraseCacheMinRows(baseTablePartitionConfig.GetEraseCacheMinRows());
+ }
+ if (baseTablePartitionConfig.HasEraseCacheMaxBytes()) {
+ result.SetEraseCacheMaxBytes(baseTablePartitionConfig.GetEraseCacheMaxBytes());
+ }
if (baseTablePartitionConfig.HasKeepSnapshotTimeout()) {
result.SetKeepSnapshotTimeout(baseTablePartitionConfig.GetKeepSnapshotTimeout());
}
- // skip repeated NKikimrStorageSettings.TStorageRoom StorageRooms = 17;
+ // skip repeated NKikimrStorageSettings.TStorageRoom StorageRooms = 17;
// skip optional NKikimrHive.TFollowerGroup FollowerGroup = 23;
-
- return result;
-}
-
-NKikimrSchemeOp::TPartitionConfig PartitionConfigForIndexes(
- const NSchemeShard::TTableInfo::TPtr& baseTableInfo,
- const NKikimrSchemeOp::TTableDescription& indexTableDesc)
-{
- return PartitionConfigForIndexes(baseTableInfo->PartitionConfig(), indexTableDesc);
-}
-
-NKikimrSchemeOp::TPartitionConfig PartitionConfigForIndexes(
- const NKikimrSchemeOp::TTableDescription& baseTableDesrc,
- const NKikimrSchemeOp::TTableDescription& indexTableDesc)
-{
- return PartitionConfigForIndexes(baseTableDesrc.GetPartitionConfig(), indexTableDesc);
-}
-
-bool ExtractTypes(const NKikimrSchemeOp::TTableDescription& baseTableDesrc, TColumnTypes& columsTypes, TString& explain) {
- const NScheme::TTypeRegistry* typeRegistry = AppData()->TypeRegistry;
- Y_VERIFY(typeRegistry);
-
- for (auto& column: baseTableDesrc.GetColumns()) {
- auto& columnName = column.GetName();
- auto typeName = NMiniKQL::AdaptLegacyYqlType(column.GetType());
- const NScheme::IType* type = typeRegistry->GetType(typeName);
- if (!type) {
- explain += TStringBuilder() << "Type '" << column.GetType() << "' specified for column '" << columnName << "' is not supported by storage";
- return false;
- }
- auto typeId = type->GetTypeId();
- columsTypes[columnName] = typeId;
- }
-
- return true;
-}
-
-TColumnTypes ExtractTypes(const NSchemeShard::TTableInfo::TPtr& baseTableInfo) {
- TColumnTypes columsTypes;
- for (auto& column: baseTableInfo->Columns) {
- auto& columnName = column.second.Name;
- columsTypes[columnName] = column.second.PType;
- }
-
- return columsTypes;
-}
-
-bool IsCompatibleKeyTypes(
- const TColumnTypes& baseTableColumsTypes,
- const TTableColumns& implTableColumns,
- bool uniformTable,
- TString& explain)
-{
- const NScheme::TTypeRegistry* typeRegistry = AppData()->TypeRegistry;
- Y_VERIFY(typeRegistry);
-
- for (const auto& item: baseTableColumsTypes) {
- auto& columnName = item.first;
- auto& typeId = item.second;
-
- auto typeSP = typeRegistry->GetType(typeId);
- if (!typeSP) {
- explain += TStringBuilder() << "unknown typeId '" << typeId << "' for column '" << columnName << "'";
- return false;
- }
-
- if (!NScheme::NTypeIds::IsYqlType(typeId)) {
- explain += TStringBuilder() << "Type '" << typeId << "' specified for column '" << columnName << "' is no longer supported";
- return false;
- }
- }
-
-
- for (auto& keyName: implTableColumns.Keys) {
- Y_VERIFY(baseTableColumsTypes.contains(keyName));
- auto typeId = baseTableColumsTypes.at(keyName);
-
- if (uniformTable) {
- switch (typeId) {
- case NScheme::NTypeIds::Uint32:
- case NScheme::NTypeIds::Uint64:
- break;
- default:
- explain += TStringBuilder() << "Column '" << keyName << "' has wrong key type "
- << NScheme::GetTypeName(typeId) << " for being key of table with uniform partitioning";
- return false;
- }
- }
-
- if (!NSchemeShard::IsAllowedKeyType(typeId)) {
- explain += TStringBuilder() << "Column '" << keyName << "' has wrong key type " << NScheme::GetTypeName(typeId) << " for being key";
- return false;
- }
- }
-
- return true;
-}
-
-}
-
-}
+
+ return result;
+}
+
+NKikimrSchemeOp::TPartitionConfig PartitionConfigForIndexes(
+ const NSchemeShard::TTableInfo::TPtr& baseTableInfo,
+ const NKikimrSchemeOp::TTableDescription& indexTableDesc)
+{
+ return PartitionConfigForIndexes(baseTableInfo->PartitionConfig(), indexTableDesc);
+}
+
+NKikimrSchemeOp::TPartitionConfig PartitionConfigForIndexes(
+ const NKikimrSchemeOp::TTableDescription& baseTableDesrc,
+ const NKikimrSchemeOp::TTableDescription& indexTableDesc)
+{
+ return PartitionConfigForIndexes(baseTableDesrc.GetPartitionConfig(), indexTableDesc);
+}
+
+bool ExtractTypes(const NKikimrSchemeOp::TTableDescription& baseTableDesrc, TColumnTypes& columsTypes, TString& explain) {
+ const NScheme::TTypeRegistry* typeRegistry = AppData()->TypeRegistry;
+ Y_VERIFY(typeRegistry);
+
+ for (auto& column: baseTableDesrc.GetColumns()) {
+ auto& columnName = column.GetName();
+ auto typeName = NMiniKQL::AdaptLegacyYqlType(column.GetType());
+ const NScheme::IType* type = typeRegistry->GetType(typeName);
+ if (!type) {
+ explain += TStringBuilder() << "Type '" << column.GetType() << "' specified for column '" << columnName << "' is not supported by storage";
+ return false;
+ }
+ auto typeId = type->GetTypeId();
+ columsTypes[columnName] = typeId;
+ }
+
+ return true;
+}
+
+TColumnTypes ExtractTypes(const NSchemeShard::TTableInfo::TPtr& baseTableInfo) {
+ TColumnTypes columsTypes;
+ for (auto& column: baseTableInfo->Columns) {
+ auto& columnName = column.second.Name;
+ columsTypes[columnName] = column.second.PType;
+ }
+
+ return columsTypes;
+}
+
+bool IsCompatibleKeyTypes(
+ const TColumnTypes& baseTableColumsTypes,
+ const TTableColumns& implTableColumns,
+ bool uniformTable,
+ TString& explain)
+{
+ const NScheme::TTypeRegistry* typeRegistry = AppData()->TypeRegistry;
+ Y_VERIFY(typeRegistry);
+
+ for (const auto& item: baseTableColumsTypes) {
+ auto& columnName = item.first;
+ auto& typeId = item.second;
+
+ auto typeSP = typeRegistry->GetType(typeId);
+ if (!typeSP) {
+ explain += TStringBuilder() << "unknown typeId '" << typeId << "' for column '" << columnName << "'";
+ return false;
+ }
+
+ if (!NScheme::NTypeIds::IsYqlType(typeId)) {
+ explain += TStringBuilder() << "Type '" << typeId << "' specified for column '" << columnName << "' is no longer supported";
+ return false;
+ }
+ }
+
+
+ for (auto& keyName: implTableColumns.Keys) {
+ Y_VERIFY(baseTableColumsTypes.contains(keyName));
+ auto typeId = baseTableColumsTypes.at(keyName);
+
+ if (uniformTable) {
+ switch (typeId) {
+ case NScheme::NTypeIds::Uint32:
+ case NScheme::NTypeIds::Uint64:
+ break;
+ default:
+ explain += TStringBuilder() << "Column '" << keyName << "' has wrong key type "
+ << NScheme::GetTypeName(typeId) << " for being key of table with uniform partitioning";
+ return false;
+ }
+ }
+
+ if (!NSchemeShard::IsAllowedKeyType(typeId)) {
+ explain += TStringBuilder() << "Column '" << keyName << "' has wrong key type " << NScheme::GetTypeName(typeId) << " for being key";
+ return false;
+ }
+ }
+
+ return true;
+}
+
+}
+
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard_utils.h b/ydb/core/tx/schemeshard/schemeshard_utils.h
index ac98acf5d09..de7d17f316f 100644
--- a/ydb/core/tx/schemeshard/schemeshard_utils.h
+++ b/ydb/core/tx/schemeshard/schemeshard_utils.h
@@ -1,50 +1,50 @@
-#pragma once
-
-#include "schemeshard.h"
-#include "schemeshard_types.h"
-#include "schemeshard_info_types.h"
-
+#pragma once
+
+#include "schemeshard.h"
+#include "schemeshard_types.h"
+#include "schemeshard_info_types.h"
+
#include <ydb/core/tablet/tablet_counters.h>
#include <ydb/core/base/tablet_pipe.h>
#include <ydb/core/base/table_index.h>
-
+
#include <ydb/public/lib/scheme_types/scheme_type_id.h>
-
+
#include <ydb/library/yql/minikql/mkql_type_ops.h>
-
+
#include <library/cpp/actors/core/actorid.h>
-#include <util/generic/hash.h>
-#include <util/generic/hash_set.h>
+#include <util/generic/hash.h>
+#include <util/generic/hash_set.h>
#include <util/generic/intrlist.h>
-
-namespace NKikimr {
-namespace NSchemeShard {
-
-inline bool IsAllowedKeyType(NScheme::TTypeId typeId) {
- switch (typeId) {
- case NScheme::NTypeIds::Json:
- case NScheme::NTypeIds::Yson:
- case NScheme::NTypeIds::Float:
- case NScheme::NTypeIds::Double:
+
+namespace NKikimr {
+namespace NSchemeShard {
+
+inline bool IsAllowedKeyType(NScheme::TTypeId typeId) {
+ switch (typeId) {
+ case NScheme::NTypeIds::Json:
+ case NScheme::NTypeIds::Yson:
+ case NScheme::NTypeIds::Float:
+ case NScheme::NTypeIds::Double:
case NScheme::NTypeIds::JsonDocument:
- return false;
- default:
- return true;
- }
-}
-
-inline bool IsValidColumnName(const TString& name) {
- for (auto c: name) {
- if (!std::isalnum(c) && c != '_' && c != '-') {
- return false;
- }
- }
- return true;
-}
-
-inline NKikimrSchemeOp::TModifyScheme TransactionTemplate(const TString& workingDir, NKikimrSchemeOp::EOperationType type) {
- NKikimrSchemeOp::TModifyScheme tx;
+ return false;
+ default:
+ return true;
+ }
+}
+
+inline bool IsValidColumnName(const TString& name) {
+ for (auto c: name) {
+ if (!std::isalnum(c) && c != '_' && c != '-') {
+ return false;
+ }
+ }
+ return true;
+}
+
+inline NKikimrSchemeOp::TModifyScheme TransactionTemplate(const TString& workingDir, NKikimrSchemeOp::EOperationType type) {
+ NKikimrSchemeOp::TModifyScheme tx;
tx.SetWorkingDir(workingDir);
tx.SetOperationType(type);
@@ -54,29 +54,29 @@ inline NKikimrSchemeOp::TModifyScheme TransactionTemplate(const TString& working
TSerializedCellVec ChooseSplitKeyByHistogram(const NKikimrTableStats::THistogram& histogram,
const TConstArrayRef<NScheme::TTypeId>& keyColumnTypes);
-class TShardDeleter {
- struct TPerHiveDeletions {
+class TShardDeleter {
+ struct TPerHiveDeletions {
TActorId PipeToHive;
- THashSet<TShardIdx> ShardsToDelete;
- };
-
- ui64 MyTabletID;
- // Hive TabletID -> non-acked deletions
- THashMap<TTabletId, TPerHiveDeletions> PerHiveDeletions;
- // Tablet -> Hive TabletID
- THashMap<TShardIdx, TTabletId> ShardHive;
+ THashSet<TShardIdx> ShardsToDelete;
+ };
+
+ ui64 MyTabletID;
+ // Hive TabletID -> non-acked deletions
+ THashMap<TTabletId, TPerHiveDeletions> PerHiveDeletions;
+ // Tablet -> Hive TabletID
+ THashMap<TShardIdx, TTabletId> ShardHive;
NTabletPipe::TClientRetryPolicy HivePipeRetryPolicy;
-
-public:
- explicit TShardDeleter(ui64 myTabletId)
- : MyTabletID(myTabletId)
+
+public:
+ explicit TShardDeleter(ui64 myTabletId)
+ : MyTabletID(myTabletId)
, HivePipeRetryPolicy({})
- {}
-
- TShardDeleter(const TShardDeleter&) = delete;
- TShardDeleter& operator=(const TShardDeleter&) = delete;
-
- void Shutdown(const TActorContext& ctx);
+ {}
+
+ TShardDeleter(const TShardDeleter&) = delete;
+ TShardDeleter& operator=(const TShardDeleter&) = delete;
+
+ void Shutdown(const TActorContext& ctx);
void SendDeleteRequests(TTabletId hiveTabletId, const THashSet<TShardIdx>& shardsToDelete,
const THashMap<TShardIdx, TShardInfo>& shardsInfos, const TActorContext& ctx);
void ResendDeleteRequests(TTabletId hiveTabletId,
@@ -85,78 +85,78 @@ public:
const THashMap<TShardIdx, TShardInfo>& shardsInfos, TShardIdx shardIdx, const TActorContext& ctx);
void RedirectDeleteRequest(TTabletId hiveFromTabletId, TTabletId hiveToTabletId, TShardIdx shardIdx,
const THashMap<TShardIdx, TShardInfo>& shardsInfos, const TActorContext& ctx);
- void ShardDeleted(TShardIdx shardIdx, const TActorContext& ctx);
+ void ShardDeleted(TShardIdx shardIdx, const TActorContext& ctx);
bool Has(TTabletId hiveTabletId, TActorId pipeClientActorId) const;
- bool Has(TShardIdx shardIdx) const;
- bool Empty() const;
-};
-
-// Self ping stuff
-class TSelfPinger {
-private:
- static constexpr TDuration SELF_PING_INTERVAL = TDuration::MilliSeconds(1000);
-
-public:
- TSelfPinger(TTabletId id, TTabletCountersBase* counters)
- : TabletId(id)
- , TabletCounters(counters)
- , SelfPingInFlight(false)
- , SelfPingWakeupScheduled(false)
- {}
-
- void Handle(TEvSchemeShard::TEvMeasureSelfResponseTime::TPtr &ev, const TActorContext &ctx);
- void Handle(TEvSchemeShard::TEvWakeupToMeasureSelfResponseTime::TPtr &ev, const TActorContext &ctx);
- void OnAnyEvent(const TActorContext &ctx);
- void DoSelfPing(const TActorContext &ctx);
- void SheduleSelfPingWakeup(const TActorContext &ctx);
-
-private:
- const TTabletId TabletId;
- TTabletCountersBase * const TabletCounters;
-
- TDuration LastResponseTime;
- TInstant SelfPingSentTime;
- bool SelfPingInFlight;
- TInstant SelfPingWakeupScheduledTime;
- bool SelfPingWakeupScheduled;
-};
-
-}
-
-namespace NTableIndex {
-
-NKikimrSchemeOp::TTableDescription CalcImplTableDesc(
- const NSchemeShard::TTableInfo::TPtr& baseTableInfo,
- const NTableIndex::TTableColumns& implTableColumns,
- const NKikimrSchemeOp::TTableDescription& indexTableDesc);
-
-NKikimrSchemeOp::TTableDescription CalcImplTableDesc(
- const NKikimrSchemeOp::TTableDescription& baseTableDesrc,
- const NTableIndex::TTableColumns& implTableColumns,
- const NKikimrSchemeOp::TTableDescription& indexTableDesc);
-
-NKikimrSchemeOp::TPartitionConfig PartitionConfigForIndexes(
- const NSchemeShard::TTableInfo::TPtr& baseTableInfo,
- const NKikimrSchemeOp::TTableDescription& indexTableDesc);
-
-NKikimrSchemeOp::TPartitionConfig PartitionConfigForIndexes(
- const NKikimrSchemeOp::TTableDescription& baseTableDesrc,
- const NKikimrSchemeOp::TTableDescription& indexTableDesc);
-
-TTableColumns ExtractInfo(const NKikimrSchemeOp::TTableDescription& tableDesrc);
-TIndexColumns ExtractInfo(const NKikimrSchemeOp::TIndexCreationConfig& indexDesc);
-TTableColumns ExtractInfo(const NSchemeShard::TTableInfo::TPtr& tableInfo);
-
-using TColumnTypes = THashMap<TString, NScheme::TTypeId>;
-
-bool ExtractTypes(const NKikimrSchemeOp::TTableDescription& baseTableDesrc, TColumnTypes& columsTypes, TString& explain);
-TColumnTypes ExtractTypes(const NSchemeShard::TTableInfo::TPtr& baseTableInfo);
-
-bool IsCompatibleKeyTypes(
- const TColumnTypes& baseTableColumsTypes,
- const TTableColumns& implTableColumns,
- bool uniformTable,
- TString& explain);
-}
-
-}
+ bool Has(TShardIdx shardIdx) const;
+ bool Empty() const;
+};
+
+// Self ping stuff
+class TSelfPinger {
+private:
+ static constexpr TDuration SELF_PING_INTERVAL = TDuration::MilliSeconds(1000);
+
+public:
+ TSelfPinger(TTabletId id, TTabletCountersBase* counters)
+ : TabletId(id)
+ , TabletCounters(counters)
+ , SelfPingInFlight(false)
+ , SelfPingWakeupScheduled(false)
+ {}
+
+ void Handle(TEvSchemeShard::TEvMeasureSelfResponseTime::TPtr &ev, const TActorContext &ctx);
+ void Handle(TEvSchemeShard::TEvWakeupToMeasureSelfResponseTime::TPtr &ev, const TActorContext &ctx);
+ void OnAnyEvent(const TActorContext &ctx);
+ void DoSelfPing(const TActorContext &ctx);
+ void SheduleSelfPingWakeup(const TActorContext &ctx);
+
+private:
+ const TTabletId TabletId;
+ TTabletCountersBase * const TabletCounters;
+
+ TDuration LastResponseTime;
+ TInstant SelfPingSentTime;
+ bool SelfPingInFlight;
+ TInstant SelfPingWakeupScheduledTime;
+ bool SelfPingWakeupScheduled;
+};
+
+}
+
+namespace NTableIndex {
+
+NKikimrSchemeOp::TTableDescription CalcImplTableDesc(
+ const NSchemeShard::TTableInfo::TPtr& baseTableInfo,
+ const NTableIndex::TTableColumns& implTableColumns,
+ const NKikimrSchemeOp::TTableDescription& indexTableDesc);
+
+NKikimrSchemeOp::TTableDescription CalcImplTableDesc(
+ const NKikimrSchemeOp::TTableDescription& baseTableDesrc,
+ const NTableIndex::TTableColumns& implTableColumns,
+ const NKikimrSchemeOp::TTableDescription& indexTableDesc);
+
+NKikimrSchemeOp::TPartitionConfig PartitionConfigForIndexes(
+ const NSchemeShard::TTableInfo::TPtr& baseTableInfo,
+ const NKikimrSchemeOp::TTableDescription& indexTableDesc);
+
+NKikimrSchemeOp::TPartitionConfig PartitionConfigForIndexes(
+ const NKikimrSchemeOp::TTableDescription& baseTableDesrc,
+ const NKikimrSchemeOp::TTableDescription& indexTableDesc);
+
+TTableColumns ExtractInfo(const NKikimrSchemeOp::TTableDescription& tableDesrc);
+TIndexColumns ExtractInfo(const NKikimrSchemeOp::TIndexCreationConfig& indexDesc);
+TTableColumns ExtractInfo(const NSchemeShard::TTableInfo::TPtr& tableInfo);
+
+using TColumnTypes = THashMap<TString, NScheme::TTypeId>;
+
+bool ExtractTypes(const NKikimrSchemeOp::TTableDescription& baseTableDesrc, TColumnTypes& columsTypes, TString& explain);
+TColumnTypes ExtractTypes(const NSchemeShard::TTableInfo::TPtr& baseTableInfo);
+
+bool IsCompatibleKeyTypes(
+ const TColumnTypes& baseTableColumsTypes,
+ const TTableColumns& implTableColumns,
+ bool uniformTable,
+ TString& explain);
+}
+
+}
diff --git a/ydb/core/tx/schemeshard/schemeshard_validate_ttl.cpp b/ydb/core/tx/schemeshard/schemeshard_validate_ttl.cpp
index ef80c695de8..58cc395905c 100644
--- a/ydb/core/tx/schemeshard/schemeshard_validate_ttl.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_validate_ttl.cpp
@@ -2,7 +2,7 @@
#include <ydb/core/protos/flat_scheme_op.pb.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
// Helper accessors for OLTP and OLAP tables that use different TColumn's
namespace {
diff --git a/ydb/core/tx/schemeshard/schemeshard_xxport__get.h b/ydb/core/tx/schemeshard/schemeshard_xxport__get.h
index afb47355ffa..fb22a6458d6 100644
--- a/ydb/core/tx/schemeshard/schemeshard_xxport__get.h
+++ b/ydb/core/tx/schemeshard/schemeshard_xxport__get.h
@@ -6,10 +6,10 @@
#include <ydb/public/api/protos/ydb_status_codes.pb.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
template <typename TInfo, typename TEvRequest, typename TEvResponse>
-struct TSchemeShard::TXxport::TTxGet: public TSchemeShard::TXxport::TTxBase {
+struct TSchemeShard::TXxport::TTxGet: public TSchemeShard::TXxport::TTxBase {
using TTxGetBase = TTxGet<TInfo, TEvRequest, TEvResponse>;
typename TEvRequest::TPtr Request;
@@ -45,5 +45,5 @@ struct TSchemeShard::TXxport::TTxGet: public TSchemeShard::TXxport::TTxBase {
}; // TTxGet
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_xxport__list.h b/ydb/core/tx/schemeshard/schemeshard_xxport__list.h
index 1b1187d047c..2af8c7948a8 100644
--- a/ydb/core/tx/schemeshard/schemeshard_xxport__list.h
+++ b/ydb/core/tx/schemeshard/schemeshard_xxport__list.h
@@ -6,10 +6,10 @@
#include <util/string/cast.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
template <typename TInfo, typename TEvRequest, typename TEvResponse, typename TDerived>
-struct TSchemeShard::TXxport::TTxList: public TSchemeShard::TXxport::TTxBase {
+struct TSchemeShard::TXxport::TTxList: public TSchemeShard::TXxport::TTxBase {
using TTxListBase = TTxList<TInfo, TEvRequest, TEvResponse, TDerived>;
static constexpr ui64 DefaultPageSize = 10;
@@ -87,5 +87,5 @@ struct TSchemeShard::TXxport::TTxList: public TSchemeShard::TXxport::TTxBase {
}; // TTxList
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/schemeshard_xxport__tx_base.h b/ydb/core/tx/schemeshard/schemeshard_xxport__tx_base.h
index d3ed5f0cecd..84b46815c2c 100644
--- a/ydb/core/tx/schemeshard/schemeshard_xxport__tx_base.h
+++ b/ydb/core/tx/schemeshard/schemeshard_xxport__tx_base.h
@@ -6,9 +6,9 @@
#include <util/generic/vector.h>
namespace NKikimr {
-namespace NSchemeShard {
+namespace NSchemeShard {
-class TSchemeShard::TXxport::TTxBase: public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
+class TSchemeShard::TXxport::TTxBase: public NTabletFlatExecutor::TTransactionBase<TSchemeShard> {
TVector<THolder<IEventHandle>> SendOnComplete;
protected:
@@ -54,21 +54,21 @@ protected:
template <typename TInfoPtr>
void SendNotificationsIfFinished(TInfoPtr info, bool force = false) {
if (!info->IsFinished() && !force) {
- return;
- }
-
+ return;
+ }
+
LOG_TRACE_S(TlsActivationContext->AsActorContext(), NKikimrServices::FLAT_TX_SCHEMESHARD,
"SendNotifications: "
<< ": id# " << info->Id
<< ", subscribers count# " << info->Subscribers.size());
-
+
TSet<TActorId> toAnswer;
toAnswer.swap(info->Subscribers);
- for (auto& actorId: toAnswer) {
- Send(actorId, new TEvSchemeShard::TEvNotifyTxCompletionResult(info->Id));
- }
- }
-
+ for (auto& actorId: toAnswer) {
+ Send(actorId, new TEvSchemeShard::TEvNotifyTxCompletionResult(info->Id));
+ }
+ }
+
public:
virtual bool DoExecute(TTransactionContext& txc, const TActorContext& ctx) = 0;
virtual void DoComplete(const TActorContext& ctx) = 0;
@@ -87,5 +87,5 @@ public:
}; // TTxBase
-} // NSchemeShard
+} // NSchemeShard
} // NKikimr
diff --git a/ydb/core/tx/schemeshard/ut_async_index.cpp b/ydb/core/tx/schemeshard/ut_async_index.cpp
index ef1a2f6111c..a2fc2d39741 100644
--- a/ydb/core/tx/schemeshard/ut_async_index.cpp
+++ b/ydb/core/tx/schemeshard/ut_async_index.cpp
@@ -2,7 +2,7 @@
#include <ydb/core/testlib/tablet_helpers.h>
using namespace NKikimr;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NSchemeShardUT_Private;
Y_UNIT_TEST_SUITE(TAsyncIndexTests) {
@@ -12,8 +12,8 @@ Y_UNIT_TEST_SUITE(TAsyncIndexTests) {
ui64 txId = 100;
const auto status = enableAsyncIndexes
- ? NKikimrScheme::StatusAccepted
- : NKikimrScheme::StatusPreconditionFailed;
+ ? NKikimrScheme::StatusAccepted
+ : NKikimrScheme::StatusPreconditionFailed;
TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
TableDescription {
@@ -60,7 +60,7 @@ Y_UNIT_TEST_SUITE(TAsyncIndexTests) {
: Ydb::StatusIds::UNSUPPORTED;
TestBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/Table", TBuildIndexConfig{
- "UserDefinedIndex", NKikimrSchemeOp::EIndexTypeGlobalAsync, {"indexed"}, {}
+ "UserDefinedIndex", NKikimrSchemeOp::EIndexTypeGlobalAsync, {"indexed"}, {}
}, status);
if (enableAsyncIndexes) {
diff --git a/ydb/core/tx/schemeshard/ut_base.cpp b/ydb/core/tx/schemeshard/ut_base.cpp
index 1e2bc233274..a76dcf9d5bb 100644
--- a/ydb/core/tx/schemeshard/ut_base.cpp
+++ b/ydb/core/tx/schemeshard/ut_base.cpp
@@ -7,7 +7,7 @@
#include <util/string/cast.h>
using namespace NKikimr;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NSchemeShardUT_Private;
Y_UNIT_TEST_SUITE(TSchemeShardTest) {
@@ -16,103 +16,103 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TTestEnv env(runtime);
}
- Y_UNIT_TEST(InitRootAgain) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
-
-
+ Y_UNIT_TEST(InitRootAgain) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+
+
auto result = env.InitRoot(runtime, TTestTxConfig::SchemeShard, runtime.AllocateEdgeActor(), "MyRoot");
- UNIT_ASSERT_VALUES_EQUAL((ui32)result, (ui32)TEvSchemeShard::TEvInitRootShardResult::StatusAlreadyInitialized);
- }
-
- Y_UNIT_TEST(InitRootWithOwner) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
-
- TString newOwner = "something@builtin";
-
+ UNIT_ASSERT_VALUES_EQUAL((ui32)result, (ui32)TEvSchemeShard::TEvInitRootShardResult::StatusAlreadyInitialized);
+ }
+
+ Y_UNIT_TEST(InitRootWithOwner) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+
+ TString newOwner = "something@builtin";
+
auto result = env.InitRoot(runtime, TTestTxConfig::SchemeShard, runtime.AllocateEdgeActor(), "MyRoot", {}, newOwner);
- UNIT_ASSERT_VALUES_EQUAL((ui32)result, (ui32)TEvSchemeShard::TEvInitRootShardResult::StatusSuccess);
-
- auto checkOwner = [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- const auto& self = record.GetPathDescription().GetSelf();
- UNIT_ASSERT_EQUAL(self.GetOwner(), newOwner);
- };
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {checkOwner});
- }
-
- Y_UNIT_TEST(MkRmDir) {
+ UNIT_ASSERT_VALUES_EQUAL((ui32)result, (ui32)TEvSchemeShard::TEvInitRootShardResult::StatusSuccess);
+
+ auto checkOwner = [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ const auto& self = record.GetPathDescription().GetSelf();
+ UNIT_ASSERT_EQUAL(self.GetOwner(), newOwner);
+ };
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {checkOwner});
+ }
+
+ Y_UNIT_TEST(MkRmDir) {
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
- TestMkDir(runtime, ++txId, "/", "DirA", {NKikimrScheme::StatusPathDoesNotExist});
- TestMkDir(runtime, ++txId, "/", "MyRoot", {NKikimrScheme::StatusPathDoesNotExist});
- TestMkDir(runtime, ++txId, "/MyRoot", "DirA");
- TestMkDir(runtime, ++txId, "/MyRoot", "DirB");
- TestMkDir(runtime, ++txId, "/MyRoot/DirA", "SubDirA");
- TestMkDir(runtime, ++txId, "/MyRoot/DirA/SubDirA", "DirB");
-
- env.TestWaitNotification(runtime, xrange(txId - 5, txId + 1));
-
- TestDescribeResult(DescribePath(runtime, "/"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished,
- NLs::PathsInsideDomain(4)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::Finished,
- NLs::PathVersionEqual(5)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- {NLs::Finished,
- NLs::PathVersionEqual(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA"),
- {NLs::Finished,
- NLs::PathVersionEqual(5)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA/DirB"),
- {NLs::Finished,
- NLs::PathVersionEqual(3)});
+ TestMkDir(runtime, ++txId, "/", "DirA", {NKikimrScheme::StatusPathDoesNotExist});
+ TestMkDir(runtime, ++txId, "/", "MyRoot", {NKikimrScheme::StatusPathDoesNotExist});
+ TestMkDir(runtime, ++txId, "/MyRoot", "DirA");
+ TestMkDir(runtime, ++txId, "/MyRoot", "DirB");
+ TestMkDir(runtime, ++txId, "/MyRoot/DirA", "SubDirA");
+ TestMkDir(runtime, ++txId, "/MyRoot/DirA/SubDirA", "DirB");
+
+ env.TestWaitNotification(runtime, xrange(txId - 5, txId + 1));
+
+ TestDescribeResult(DescribePath(runtime, "/"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished,
+ NLs::PathsInsideDomain(4)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(5)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(5)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA/DirB"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(3)});
TestRmDir(runtime, ++txId, "/MyRoot/DirA", "SubDirA", {NKikimrScheme::StatusNameConflict});
- TestRmDir(runtime, ++txId, "/MyRoot/DirA/SubDirA", "DirB");
- env.TestWaitNotification(runtime, txId);
- TestRmDir(runtime, ++txId, "/MyRoot/DirA", "SubDirA");
- env.TestWaitNotification(runtime, txId);
+ TestRmDir(runtime, ++txId, "/MyRoot/DirA/SubDirA", "DirB");
+ env.TestWaitNotification(runtime, txId);
+ TestRmDir(runtime, ++txId, "/MyRoot/DirA", "SubDirA");
+ env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA/DirB"), {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA"), {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA/DirB"), {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA"), {NLs::PathNotExist});
//
- TestMkDir(runtime, ++txId, "/MyRoot/DirA/SubDirA", "DirB", {NKikimrScheme::StatusPathDoesNotExist});
+ TestMkDir(runtime, ++txId, "/MyRoot/DirA/SubDirA", "DirB", {NKikimrScheme::StatusPathDoesNotExist});
//
- TestMkDir(runtime, ++txId, "/MyRoot", "DirA", {NKikimrScheme::StatusAlreadyExists});
- TestRmDir(runtime, ++txId, "/MyRoot", "DirA");
- env.TestWaitNotification(runtime, txId);
- TestMkDir(runtime, ++txId, "/MyRoot", "DirA");
- env.TestWaitNotification(runtime, txId);
+ TestMkDir(runtime, ++txId, "/MyRoot", "DirA", {NKikimrScheme::StatusAlreadyExists});
+ TestRmDir(runtime, ++txId, "/MyRoot", "DirA");
+ env.TestWaitNotification(runtime, txId);
+ TestMkDir(runtime, ++txId, "/MyRoot", "DirA");
+ env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished,
- NLs::PathsInsideDomain(2)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished,
+ NLs::PathsInsideDomain(2)});
//
- TestRmDir(runtime, ++txId, "/MyRoot", "DirA");
- TestRmDir(runtime, ++txId, "/MyRoot", "DirB");
- env.TestWaitNotification(runtime, {txId-1, txId});
+ TestRmDir(runtime, ++txId, "/MyRoot", "DirA");
+ TestRmDir(runtime, ++txId, "/MyRoot", "DirB");
+ env.TestWaitNotification(runtime, {txId-1, txId});
TestRmDir(runtime, ++txId, "/", "MyRoot", {NKikimrScheme::StatusNameConflict});
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::NoChildren,
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(0)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::NoChildren,
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(0)});
}
using TRuntimeTxFn = std::function<void(TTestBasicRuntime&, ui64)>;
@@ -129,12 +129,12 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
dropFn(runtime, ++txId);
TestModificationResult(runtime, txId - 1);
- auto ev = runtime.GrabEdgeEvent<TEvSchemeShard::TEvModifySchemeTransactionResult>();
+ auto ev = runtime.GrabEdgeEvent<TEvSchemeShard::TEvModifySchemeTransactionResult>();
UNIT_ASSERT(ev);
const auto& record = ev->Record;
UNIT_ASSERT_VALUES_EQUAL(record.GetTxId(), txId);
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusMultipleModifications);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusMultipleModifications);
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDropTxId(), txId - 1);
env.TestWaitNotification(runtime, txId - 1);
@@ -172,510 +172,510 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
DropTwice("/MyRoot/Table", createFn, dropFn);
}
- Y_UNIT_TEST(CacheEffectiveACL) {
-
- TEffectiveACL firstACL;
-
- {
- NACLib::TDiffACL diff;
- diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff");
- diff.AddAccess(NACLib::EAccessType::Allow, NACLib::ConnectDatabase, "1@staff", NACLib::InheritNone);
- diff.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "2@staff", NACLib::InheritObject);
- diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "3@staff", NACLib::InheritContainer);
- diff.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "4@staff", NACLib::InheritOnly);
- diff.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "5@staff", NACLib::InheritObject | NACLib::InheritOnly);
- diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "6@staff", NACLib::InheritContainer | NACLib::InheritOnly);
- diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer | NACLib::InheritOnly);
-
- NACLib::TACL input;
- input.ApplyDiff(diff);
-
- {
- NACLib::TACL connonic;
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "2@staff", NACLib::InheritObject);
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "4@staff", NACLib::InheritOnly);
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "5@staff", NACLib::InheritObject | NACLib::InheritOnly);
-
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff");
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::ConnectDatabase, "1@staff", NACLib::InheritNone);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "3@staff", NACLib::InheritContainer);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "6@staff", NACLib::InheritContainer | NACLib::InheritOnly);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer | NACLib::InheritOnly);
-
- Cerr << "canonic: " << connonic.DebugString() << Endl;
- Cerr << "result: " << input.DebugString() << Endl;
- UNIT_ASSERT_NO_DIFF(connonic.DebugString(), input.DebugString());
- }
-
- Y_ASSERT(!firstACL);
- firstACL.Init(input.SerializeAsString());
- Y_ASSERT(firstACL);
- }
-
- {
- // InheritOnly is not filtered from self effective.
- // Record with InheritOnly doesn't counted at CheckAccess
- // InheritOnly flag is eliminated on inheriting
- NACLib::TACL connonic;
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "2@staff", NACLib::InheritObject);
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "4@staff", NACLib::InheritOnly);
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "5@staff", NACLib::InheritObject | NACLib::InheritOnly);
-
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff");
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::ConnectDatabase, "1@staff", NACLib::InheritNone);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "3@staff", NACLib::InheritContainer);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "6@staff", NACLib::InheritContainer | NACLib::InheritOnly);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer | NACLib::InheritOnly);
-
-
- Cerr << "canonic: " << connonic.DebugString() << Endl;
- Cerr << "result: " << NACLib::TACL(firstACL.GetForSelf()).DebugString() << Endl;
- UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(firstACL.GetForSelf()).DebugString());
- }
-
- {
- NACLib::TACL connonic;
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "3@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "6@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- Cerr << "canonic: " << connonic.DebugString() << Endl;
- Cerr << "result: " << NACLib::TACL(firstACL.GetForChildren(/*isContainer=*/ true)).DebugString() << Endl;
- UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(firstACL.GetForChildren(/*isContainer=*/ true)).DebugString());
- }
-
- {
- NACLib::TACL connonic;
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "2@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "5@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- Cerr << "canonic: " << connonic.DebugString() << Endl;
- Cerr << "result: " << NACLib::TACL(firstACL.GetForChildren(/*isContainer=*/ false)).DebugString() << Endl;
- UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(firstACL.GetForChildren(/*isContainer=*/ false)).DebugString());
- }
-
- {
- TEffectiveACL secondACL;
-
- {
- NACLib::TDiffACL diff;
- diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "00@staff");
- diff.AddAccess(NACLib::EAccessType::Allow, NACLib::ConnectDatabase, "11@staff", NACLib::InheritNone);
- diff.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "22@staff", NACLib::InheritObject);
- diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "33@staff", NACLib::InheritContainer);
- diff.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "44@staff", NACLib::InheritOnly);
- diff.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "55@staff", NACLib::InheritObject | NACLib::InheritOnly);
- diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "66@staff", NACLib::InheritContainer | NACLib::InheritOnly);
- diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "77@staff", NACLib::InheritObject | NACLib::InheritContainer | NACLib::InheritOnly);
-
- NACLib::TACL input;
- input.ApplyDiff(diff);
-
- Y_ASSERT(!secondACL);
- secondACL.Update(firstACL, input.SerializeAsString(), /*isContainer=*/ true);
- Y_ASSERT(secondACL);
- }
-
- {
- NACLib::TACL connonic;
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "22@staff", NACLib::InheritObject);
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "44@staff", NACLib::InheritOnly);
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "55@staff", NACLib::InheritObject | NACLib::InheritOnly);
-
-
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "3@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "6@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "00@staff");
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::ConnectDatabase, "11@staff", NACLib::InheritNone);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "33@staff", NACLib::InheritContainer);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "66@staff", NACLib::InheritContainer | NACLib::InheritOnly);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "77@staff", NACLib::InheritObject | NACLib::InheritContainer | NACLib::InheritOnly);
-
- Cerr << "canonic: " << connonic.DebugString() << Endl;
- Cerr << "result: " << NACLib::TACL(secondACL.GetForSelf()).DebugString() << Endl;
- UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForSelf()).DebugString());
- }
-
- {
- NACLib::TACL connonic;
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "3@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "6@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "00@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "33@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "66@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "77@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- Cerr << "canonic: " << connonic.DebugString() << Endl;
- Cerr << "result: " << NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ true)).DebugString() << Endl;
- UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ true)).DebugString());
- }
-
- {
- NACLib::TACL connonic;
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "22@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "55@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "00@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "77@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- Cerr << "canonic: " << connonic.DebugString() << Endl;
- Cerr << "result: " << NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ false)).DebugString() << Endl;
- UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ false)).DebugString());
- }
- }
-
- {
- TEffectiveACL secondACL;
-
- {
- NACLib::TDiffACL diff;
- diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "00@staff");
- diff.AddAccess(NACLib::EAccessType::Allow, NACLib::ConnectDatabase, "11@staff", NACLib::InheritNone);
- diff.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "22@staff", NACLib::InheritObject);
- diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "33@staff", NACLib::InheritContainer);
- diff.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "44@staff", NACLib::InheritOnly);
- diff.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "55@staff", NACLib::InheritObject | NACLib::InheritOnly);
- diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "66@staff", NACLib::InheritContainer | NACLib::InheritOnly);
- diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "77@staff", NACLib::InheritObject | NACLib::InheritContainer | NACLib::InheritOnly);
-
- NACLib::TACL input;
- input.ApplyDiff(diff);
-
- Y_ASSERT(!secondACL);
- secondACL.Update(firstACL, input.SerializeAsString(), /*isContainer=*/ false);
- Y_ASSERT(secondACL);
- }
-
- {
- NACLib::TACL connonic;
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "2@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "5@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "22@staff", NACLib::InheritObject);
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "44@staff", NACLib::InheritOnly);
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "55@staff", NACLib::InheritObject | NACLib::InheritOnly);
-
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "00@staff");
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::ConnectDatabase, "11@staff", NACLib::InheritNone);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "33@staff", NACLib::InheritContainer);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "66@staff", NACLib::InheritContainer | NACLib::InheritOnly);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "77@staff", NACLib::InheritObject | NACLib::InheritContainer | NACLib::InheritOnly);
-
- Cerr << "canonic: " << connonic.DebugString() << Endl;
- Cerr << "result: " << NACLib::TACL(secondACL.GetForSelf()).DebugString() << Endl;
- UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForSelf()).DebugString());
- }
-
- {
- NACLib::TACL connonic;
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "00@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "33@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "66@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "77@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- Cerr << "canonic: " << connonic.DebugString() << Endl;
- Cerr << "result: " << NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ true)).DebugString() << Endl;
- UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ true)).DebugString());
- }
-
- {
- NACLib::TACL connonic;
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "2@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "5@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "22@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "55@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "00@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "77@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- Cerr << "canonic: " << connonic.DebugString() << Endl;
- Cerr << "result: " << NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ false)).DebugString() << Endl;
- UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ false)).DebugString());
- }
- }
-
- {
- TEffectiveACL secondACL;
-
- NACLib::TACL input; // empty
-
- Y_ASSERT(!secondACL);
- secondACL.Update(firstACL, input.SerializeAsString(), /*isContainer=*/ true);
- Y_ASSERT(secondACL);
-
- {
- NACLib::TACL connonic;
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "3@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "6@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- Cerr << "canonic: " << connonic.DebugString() << Endl;
- Cerr << "result: " << NACLib::TACL(secondACL.GetForSelf()).DebugString() << Endl;
- UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForSelf()).DebugString());
- }
-
- {
- NACLib::TACL connonic;
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "3@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "6@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- Cerr << "canonic: " << connonic.DebugString() << Endl;
- Cerr << "result: " << NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ true)).DebugString() << Endl;
- UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ true)).DebugString());
- }
-
- {
- NACLib::TACL connonic;
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "2@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "5@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- Cerr << "canonic: " << connonic.DebugString() << Endl;
- Cerr << "result: " << NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ false)).DebugString() << Endl;
- UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ false)).DebugString());
- }
- }
-
- {
- TEffectiveACL secondACL;
-
- NACLib::TACL input; // empty
-
- Y_ASSERT(!secondACL);
- secondACL.Update(firstACL, input.SerializeAsString(), /*isContainer=*/ false);
- Y_ASSERT(secondACL);
-
- {
- NACLib::TACL connonic;
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "2@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "5@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- Cerr << "canonic: " << connonic.DebugString() << Endl;
- Cerr << "result: " << NACLib::TACL(secondACL.GetForSelf()).DebugString() << Endl;
- UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForSelf()).DebugString()); }
-
- {
- NACLib::TACL connonic;
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "3@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "6@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- Cerr << "canonic: " << connonic.DebugString() << Endl;
- Cerr << "result: " << NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ true)).DebugString() << Endl;
- UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ true)).DebugString());
- }
-
- {
- NACLib::TACL connonic;
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "2@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "5@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
- connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
-
- Cerr << "canonic: " << connonic.DebugString() << Endl;
- Cerr << "result: " << NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ false)).DebugString() << Endl;
- UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ false)).DebugString());
- }
- }
-
- }
-
- Y_UNIT_TEST(ModifyACL) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::NoChildren,
- NLs::PathVersionEqual(3)});
-
- {
- AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
-
- NACLib::TDiffACL diffACL;
- diffACL.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "user0@builtin");
-
- AsyncModifyACL(runtime, ++txId, "/MyRoot", "DirA", diffACL.SerializeAsString(), "svc@staff");
-
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusSuccess);
-
- env.TestWaitNotification(runtime, {txId, txId-1});
- }
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(1)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(5),
- NLs::HasEffectiveRight("+U:user0@builtin")});
-
- {
- NACLib::TDiffACL diffACL;
- diffACL.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "user1@builtin", NACLib::InheritNone);
-
- TestModifyACL(runtime, ++txId, "/", "MyRoot", diffACL.SerializeAsString(), "");
- env.TestWaitNotification(runtime, txId);
- }
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(1),
- NLs::HasEffectiveRight("+U:user1@builtin:-")});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(6),
- NLs::HasEffectiveRight("+U:user0@builtin"),
- NLs::HasNotEffectiveRight("+U:user1@builtin:-")});
-
- {
- TestMkDir(runtime, ++txId, "/MyRoot/DirA", "DirB");
- env.TestWaitNotification(runtime, txId);
- }
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/DirB"),
- {NLs::PathVersionEqual(5),
- NLs::HasEffectiveRight("+U:user0@builtin"),
- NLs::HasNotEffectiveRight("+U:user1@builtin:-")});
-
- }
-
- Y_UNIT_TEST(NameFormat) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateTable(runtime, ++txId, "/MyRoot",
- "Name: \"Table\""
- "Columns { Name: \"RowId!\" Type: \"Yson\"}"
- "KeyColumnNames: [\"RowId\"]",
- {NKikimrScheme::StatusSchemeError});
- TestCreateTable(runtime, ++txId, "/MyRoot",
- "Name: \"Table\""
- "Columns { Name: \"RowId?\" Type: \"Yson\"}"
- "KeyColumnNames: [\"RowId\"]",
- {NKikimrScheme::StatusSchemeError});
- TestCreateTable(runtime, ++txId, "/MyRoot",
- "Name: \"Table\""
- "Columns { Name: \"RowId@\" Type: \"Yson\"}"
- "KeyColumnNames: [\"RowId\"]",
- {NKikimrScheme::StatusSchemeError});
- TestCreateTable(runtime, ++txId, "/MyRoot",
- "Name: \"Table\""
- "Columns { Name: \"RowId:\" Type: \"Yson\"}"
- "KeyColumnNames: [\"RowId\"]",
- {NKikimrScheme::StatusSchemeError});
- TestCreateTable(runtime, ++txId, "/MyRoot",
- "Name: \"Table\""
- "Columns { Name: \"RowId:\" Type: \"Yson\"}"
- "KeyColumnNames: [\"RowId\"]",
- {NKikimrScheme::StatusSchemeError});
-
- AsyncMkDir(runtime, ++txId, "/MyRoot", "Dir0!");
- AsyncMkDir(runtime, ++txId, "/MyRoot", "Dir0?");
- AsyncMkDir(runtime, ++txId, "/MyRoot", "Dir0@");
- AsyncMkDir(runtime, ++txId, "/MyRoot", "Dir0:");
-
- TestModificationResult(runtime, txId-3, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
-
- env.TestWaitNotification(runtime, {txId, txId-1, txId-2, txId-3});
-
- TestUserAttrs(runtime, ++txId, "/", "MyRoot", AlterUserAttrs({{"__extra_path_symbols_allowed", "_.-"}}));
- env.TestWaitNotification(runtime, txId);
+ Y_UNIT_TEST(CacheEffectiveACL) {
+
+ TEffectiveACL firstACL;
+
+ {
+ NACLib::TDiffACL diff;
+ diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff");
+ diff.AddAccess(NACLib::EAccessType::Allow, NACLib::ConnectDatabase, "1@staff", NACLib::InheritNone);
+ diff.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "2@staff", NACLib::InheritObject);
+ diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "3@staff", NACLib::InheritContainer);
+ diff.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "4@staff", NACLib::InheritOnly);
+ diff.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "5@staff", NACLib::InheritObject | NACLib::InheritOnly);
+ diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "6@staff", NACLib::InheritContainer | NACLib::InheritOnly);
+ diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer | NACLib::InheritOnly);
+
+ NACLib::TACL input;
+ input.ApplyDiff(diff);
+
+ {
+ NACLib::TACL connonic;
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "2@staff", NACLib::InheritObject);
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "4@staff", NACLib::InheritOnly);
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "5@staff", NACLib::InheritObject | NACLib::InheritOnly);
+
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff");
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::ConnectDatabase, "1@staff", NACLib::InheritNone);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "3@staff", NACLib::InheritContainer);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "6@staff", NACLib::InheritContainer | NACLib::InheritOnly);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer | NACLib::InheritOnly);
+
+ Cerr << "canonic: " << connonic.DebugString() << Endl;
+ Cerr << "result: " << input.DebugString() << Endl;
+ UNIT_ASSERT_NO_DIFF(connonic.DebugString(), input.DebugString());
+ }
+
+ Y_ASSERT(!firstACL);
+ firstACL.Init(input.SerializeAsString());
+ Y_ASSERT(firstACL);
+ }
+
+ {
+ // InheritOnly is not filtered from self effective.
+ // Record with InheritOnly doesn't counted at CheckAccess
+ // InheritOnly flag is eliminated on inheriting
+ NACLib::TACL connonic;
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "2@staff", NACLib::InheritObject);
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "4@staff", NACLib::InheritOnly);
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "5@staff", NACLib::InheritObject | NACLib::InheritOnly);
+
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff");
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::ConnectDatabase, "1@staff", NACLib::InheritNone);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "3@staff", NACLib::InheritContainer);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "6@staff", NACLib::InheritContainer | NACLib::InheritOnly);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer | NACLib::InheritOnly);
+
+
+ Cerr << "canonic: " << connonic.DebugString() << Endl;
+ Cerr << "result: " << NACLib::TACL(firstACL.GetForSelf()).DebugString() << Endl;
+ UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(firstACL.GetForSelf()).DebugString());
+ }
+
+ {
+ NACLib::TACL connonic;
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "3@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "6@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ Cerr << "canonic: " << connonic.DebugString() << Endl;
+ Cerr << "result: " << NACLib::TACL(firstACL.GetForChildren(/*isContainer=*/ true)).DebugString() << Endl;
+ UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(firstACL.GetForChildren(/*isContainer=*/ true)).DebugString());
+ }
+
+ {
+ NACLib::TACL connonic;
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "2@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "5@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ Cerr << "canonic: " << connonic.DebugString() << Endl;
+ Cerr << "result: " << NACLib::TACL(firstACL.GetForChildren(/*isContainer=*/ false)).DebugString() << Endl;
+ UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(firstACL.GetForChildren(/*isContainer=*/ false)).DebugString());
+ }
+
+ {
+ TEffectiveACL secondACL;
+
+ {
+ NACLib::TDiffACL diff;
+ diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "00@staff");
+ diff.AddAccess(NACLib::EAccessType::Allow, NACLib::ConnectDatabase, "11@staff", NACLib::InheritNone);
+ diff.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "22@staff", NACLib::InheritObject);
+ diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "33@staff", NACLib::InheritContainer);
+ diff.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "44@staff", NACLib::InheritOnly);
+ diff.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "55@staff", NACLib::InheritObject | NACLib::InheritOnly);
+ diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "66@staff", NACLib::InheritContainer | NACLib::InheritOnly);
+ diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "77@staff", NACLib::InheritObject | NACLib::InheritContainer | NACLib::InheritOnly);
+
+ NACLib::TACL input;
+ input.ApplyDiff(diff);
+
+ Y_ASSERT(!secondACL);
+ secondACL.Update(firstACL, input.SerializeAsString(), /*isContainer=*/ true);
+ Y_ASSERT(secondACL);
+ }
+
+ {
+ NACLib::TACL connonic;
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "22@staff", NACLib::InheritObject);
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "44@staff", NACLib::InheritOnly);
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "55@staff", NACLib::InheritObject | NACLib::InheritOnly);
+
+
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "3@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "6@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "00@staff");
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::ConnectDatabase, "11@staff", NACLib::InheritNone);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "33@staff", NACLib::InheritContainer);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "66@staff", NACLib::InheritContainer | NACLib::InheritOnly);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "77@staff", NACLib::InheritObject | NACLib::InheritContainer | NACLib::InheritOnly);
+
+ Cerr << "canonic: " << connonic.DebugString() << Endl;
+ Cerr << "result: " << NACLib::TACL(secondACL.GetForSelf()).DebugString() << Endl;
+ UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForSelf()).DebugString());
+ }
+
+ {
+ NACLib::TACL connonic;
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "3@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "6@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "00@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "33@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "66@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "77@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ Cerr << "canonic: " << connonic.DebugString() << Endl;
+ Cerr << "result: " << NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ true)).DebugString() << Endl;
+ UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ true)).DebugString());
+ }
+
+ {
+ NACLib::TACL connonic;
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "22@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "55@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "00@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "77@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ Cerr << "canonic: " << connonic.DebugString() << Endl;
+ Cerr << "result: " << NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ false)).DebugString() << Endl;
+ UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ false)).DebugString());
+ }
+ }
+
+ {
+ TEffectiveACL secondACL;
+
+ {
+ NACLib::TDiffACL diff;
+ diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "00@staff");
+ diff.AddAccess(NACLib::EAccessType::Allow, NACLib::ConnectDatabase, "11@staff", NACLib::InheritNone);
+ diff.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "22@staff", NACLib::InheritObject);
+ diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "33@staff", NACLib::InheritContainer);
+ diff.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "44@staff", NACLib::InheritOnly);
+ diff.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "55@staff", NACLib::InheritObject | NACLib::InheritOnly);
+ diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "66@staff", NACLib::InheritContainer | NACLib::InheritOnly);
+ diff.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "77@staff", NACLib::InheritObject | NACLib::InheritContainer | NACLib::InheritOnly);
+
+ NACLib::TACL input;
+ input.ApplyDiff(diff);
+
+ Y_ASSERT(!secondACL);
+ secondACL.Update(firstACL, input.SerializeAsString(), /*isContainer=*/ false);
+ Y_ASSERT(secondACL);
+ }
+
+ {
+ NACLib::TACL connonic;
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "2@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "5@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "22@staff", NACLib::InheritObject);
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "44@staff", NACLib::InheritOnly);
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "55@staff", NACLib::InheritObject | NACLib::InheritOnly);
+
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "00@staff");
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::ConnectDatabase, "11@staff", NACLib::InheritNone);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "33@staff", NACLib::InheritContainer);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "66@staff", NACLib::InheritContainer | NACLib::InheritOnly);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "77@staff", NACLib::InheritObject | NACLib::InheritContainer | NACLib::InheritOnly);
+
+ Cerr << "canonic: " << connonic.DebugString() << Endl;
+ Cerr << "result: " << NACLib::TACL(secondACL.GetForSelf()).DebugString() << Endl;
+ UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForSelf()).DebugString());
+ }
+
+ {
+ NACLib::TACL connonic;
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "00@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "33@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "66@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "77@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ Cerr << "canonic: " << connonic.DebugString() << Endl;
+ Cerr << "result: " << NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ true)).DebugString() << Endl;
+ UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ true)).DebugString());
+ }
+
+ {
+ NACLib::TACL connonic;
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "2@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "5@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "22@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "55@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "00@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "77@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ Cerr << "canonic: " << connonic.DebugString() << Endl;
+ Cerr << "result: " << NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ false)).DebugString() << Endl;
+ UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ false)).DebugString());
+ }
+ }
+
+ {
+ TEffectiveACL secondACL;
+
+ NACLib::TACL input; // empty
+
+ Y_ASSERT(!secondACL);
+ secondACL.Update(firstACL, input.SerializeAsString(), /*isContainer=*/ true);
+ Y_ASSERT(secondACL);
+
+ {
+ NACLib::TACL connonic;
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "3@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "6@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ Cerr << "canonic: " << connonic.DebugString() << Endl;
+ Cerr << "result: " << NACLib::TACL(secondACL.GetForSelf()).DebugString() << Endl;
+ UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForSelf()).DebugString());
+ }
+
+ {
+ NACLib::TACL connonic;
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "3@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "6@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ Cerr << "canonic: " << connonic.DebugString() << Endl;
+ Cerr << "result: " << NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ true)).DebugString() << Endl;
+ UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ true)).DebugString());
+ }
+
+ {
+ NACLib::TACL connonic;
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "2@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "5@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ Cerr << "canonic: " << connonic.DebugString() << Endl;
+ Cerr << "result: " << NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ false)).DebugString() << Endl;
+ UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ false)).DebugString());
+ }
+ }
+
+ {
+ TEffectiveACL secondACL;
+
+ NACLib::TACL input; // empty
+
+ Y_ASSERT(!secondACL);
+ secondACL.Update(firstACL, input.SerializeAsString(), /*isContainer=*/ false);
+ Y_ASSERT(secondACL);
+
+ {
+ NACLib::TACL connonic;
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "2@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "5@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ Cerr << "canonic: " << connonic.DebugString() << Endl;
+ Cerr << "result: " << NACLib::TACL(secondACL.GetForSelf()).DebugString() << Endl;
+ UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForSelf()).DebugString()); }
+
+ {
+ NACLib::TACL connonic;
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "3@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "6@staff", NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ Cerr << "canonic: " << connonic.DebugString() << Endl;
+ Cerr << "result: " << NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ true)).DebugString() << Endl;
+ UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ true)).DebugString());
+ }
+
+ {
+ NACLib::TACL connonic;
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericUse, "2@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Deny, NACLib::GenericRead, "5@staff", NACLib::InheritObject); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "0@staff"); connonic.MutableACE()->rbegin()->SetInherited(true);
+ connonic.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericRead, "7@staff", NACLib::InheritObject | NACLib::InheritContainer); connonic.MutableACE()->rbegin()->SetInherited(true);
+
+ Cerr << "canonic: " << connonic.DebugString() << Endl;
+ Cerr << "result: " << NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ false)).DebugString() << Endl;
+ UNIT_ASSERT_NO_DIFF(connonic.DebugString(), NACLib::TACL(secondACL.GetForChildren(/*isContainer=*/ false)).DebugString());
+ }
+ }
+
+ }
+
+ Y_UNIT_TEST(ModifyACL) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::NoChildren,
+ NLs::PathVersionEqual(3)});
+
+ {
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
+
+ NACLib::TDiffACL diffACL;
+ diffACL.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "user0@builtin");
+
+ AsyncModifyACL(runtime, ++txId, "/MyRoot", "DirA", diffACL.SerializeAsString(), "svc@staff");
+
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusSuccess);
+
+ env.TestWaitNotification(runtime, {txId, txId-1});
+ }
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(1)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(5),
+ NLs::HasEffectiveRight("+U:user0@builtin")});
+
+ {
+ NACLib::TDiffACL diffACL;
+ diffACL.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, "user1@builtin", NACLib::InheritNone);
+
+ TestModifyACL(runtime, ++txId, "/", "MyRoot", diffACL.SerializeAsString(), "");
+ env.TestWaitNotification(runtime, txId);
+ }
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(1),
+ NLs::HasEffectiveRight("+U:user1@builtin:-")});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(6),
+ NLs::HasEffectiveRight("+U:user0@builtin"),
+ NLs::HasNotEffectiveRight("+U:user1@builtin:-")});
+
+ {
+ TestMkDir(runtime, ++txId, "/MyRoot/DirA", "DirB");
+ env.TestWaitNotification(runtime, txId);
+ }
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/DirB"),
+ {NLs::PathVersionEqual(5),
+ NLs::HasEffectiveRight("+U:user0@builtin"),
+ NLs::HasNotEffectiveRight("+U:user1@builtin:-")});
+
+ }
+
+ Y_UNIT_TEST(NameFormat) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateTable(runtime, ++txId, "/MyRoot",
+ "Name: \"Table\""
+ "Columns { Name: \"RowId!\" Type: \"Yson\"}"
+ "KeyColumnNames: [\"RowId\"]",
+ {NKikimrScheme::StatusSchemeError});
+ TestCreateTable(runtime, ++txId, "/MyRoot",
+ "Name: \"Table\""
+ "Columns { Name: \"RowId?\" Type: \"Yson\"}"
+ "KeyColumnNames: [\"RowId\"]",
+ {NKikimrScheme::StatusSchemeError});
+ TestCreateTable(runtime, ++txId, "/MyRoot",
+ "Name: \"Table\""
+ "Columns { Name: \"RowId@\" Type: \"Yson\"}"
+ "KeyColumnNames: [\"RowId\"]",
+ {NKikimrScheme::StatusSchemeError});
+ TestCreateTable(runtime, ++txId, "/MyRoot",
+ "Name: \"Table\""
+ "Columns { Name: \"RowId:\" Type: \"Yson\"}"
+ "KeyColumnNames: [\"RowId\"]",
+ {NKikimrScheme::StatusSchemeError});
+ TestCreateTable(runtime, ++txId, "/MyRoot",
+ "Name: \"Table\""
+ "Columns { Name: \"RowId:\" Type: \"Yson\"}"
+ "KeyColumnNames: [\"RowId\"]",
+ {NKikimrScheme::StatusSchemeError});
+
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "Dir0!");
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "Dir0?");
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "Dir0@");
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "Dir0:");
+
+ TestModificationResult(runtime, txId-3, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+
+ env.TestWaitNotification(runtime, {txId, txId-1, txId-2, txId-3});
+
+ TestUserAttrs(runtime, ++txId, "/", "MyRoot", AlterUserAttrs({{"__extra_path_symbols_allowed", "_.-"}}));
+ env.TestWaitNotification(runtime, txId);
RebootTablet(runtime, TTestTxConfig::SchemeShard, runtime.AllocateEdgeActor());
-
- TestMkDir(runtime, ++txId, "/MyRoot", "Dir1!", {NKikimrScheme::StatusSchemeError});
- TestMkDir(runtime, ++txId, "/MyRoot", "Dir1?", {NKikimrScheme::StatusSchemeError});
- TestMkDir(runtime, ++txId, "/MyRoot", "Dir1@", {NKikimrScheme::StatusSchemeError});
- TestMkDir(runtime, ++txId, "/MyRoot", "Dir1:", {NKikimrScheme::StatusSchemeError});
-
-
- TSchemeLimits lowLimits;
-
- lowLimits.ExtraPathSymbolsAllowed = "!?@:";
- SetSchemeshardSchemaLimits(runtime, lowLimits);
-
- AsyncMkDir(runtime, ++txId, "/MyRoot", "Dir1!");
- AsyncMkDir(runtime, ++txId, "/MyRoot", "Dir1@");
-
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
-
- env.TestWaitNotification(runtime, {txId, txId-1});
-
- lowLimits.ExtraPathSymbolsAllowed = "!";
- SetSchemeshardSchemaLimits(runtime, lowLimits);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::UserAttrsEqual({{"__extra_path_symbols_allowed", "_.-"}})});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir1!"),
- {NLs::Finished,
- NLs::PathVersionEqual(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir1@"),
- {NLs::Finished,
- NLs::PathVersionEqual(3)});
-
- AsyncMkDir(runtime, ++txId, "/MyRoot/Dir1!", "Ok");
- AsyncMkDir(runtime, ++txId, "/MyRoot/Dir1@", "Ok");
-
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
-
- env.TestWaitNotification(runtime, {txId, txId-1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(8),
- NLs::ChildrenCount(6)});
- }
-
- Y_UNIT_TEST(CreateTable) { //+
+
+ TestMkDir(runtime, ++txId, "/MyRoot", "Dir1!", {NKikimrScheme::StatusSchemeError});
+ TestMkDir(runtime, ++txId, "/MyRoot", "Dir1?", {NKikimrScheme::StatusSchemeError});
+ TestMkDir(runtime, ++txId, "/MyRoot", "Dir1@", {NKikimrScheme::StatusSchemeError});
+ TestMkDir(runtime, ++txId, "/MyRoot", "Dir1:", {NKikimrScheme::StatusSchemeError});
+
+
+ TSchemeLimits lowLimits;
+
+ lowLimits.ExtraPathSymbolsAllowed = "!?@:";
+ SetSchemeshardSchemaLimits(runtime, lowLimits);
+
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "Dir1!");
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "Dir1@");
+
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+
+ env.TestWaitNotification(runtime, {txId, txId-1});
+
+ lowLimits.ExtraPathSymbolsAllowed = "!";
+ SetSchemeshardSchemaLimits(runtime, lowLimits);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::UserAttrsEqual({{"__extra_path_symbols_allowed", "_.-"}})});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir1!"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir1@"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(3)});
+
+ AsyncMkDir(runtime, ++txId, "/MyRoot/Dir1!", "Ok");
+ AsyncMkDir(runtime, ++txId, "/MyRoot/Dir1@", "Ok");
+
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+
+ env.TestWaitNotification(runtime, {txId, txId-1});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(8),
+ NLs::ChildrenCount(6)});
+ }
+
+ Y_UNIT_TEST(CreateTable) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
- AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
Name: "Table1"
Columns { Name: "key" Type: "Uint64" }
Columns { Name: "value" Type: "Utf8" }
KeyColumnNames: ["key"]
)");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"Table2\""
"Columns { Name: \"key1\" Type: \"Uint32\"}"
"Columns { Name: \"key2\" Type: \"Utf8\"}"
@@ -685,1354 +685,1354 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
"Columns { Name: \"MoreValue\" Type: \"Json\"}"
"KeyColumnNames: [\"RowId\", \"key1\", \"key2\"]"
);
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"x/y\""
"Columns { Name: \"key\" Type: \"Uint32\"}"
"KeyColumnNames: [\"key\"]"
);
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"Table3\""
"Columns { Name: \"RowId\" Type: \"Yson\"}"
"Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ "KeyColumnNames: [\"RowId\"]");
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"Table3\""
"Columns { Name: \"RowId\" Type: \"Json\"}"
"Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ "KeyColumnNames: [\"RowId\"]");
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"Table3\""
"Columns { Name: \"RowId\" Type: \"Json\"}"
"Columns { Name: \"key1\" Type: \"Uint32\"}"
"Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\", \"key1\"]");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ "KeyColumnNames: [\"RowId\", \"key1\"]");
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"\""
"Columns { Name: \"key\" Type: \"Uint32\"}"
- "KeyColumnNames: [\"key\"]");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA/Table1",
+ "KeyColumnNames: [\"key\"]");
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA/Table1",
"Name: \"x/y\""
"Columns { Name: \"key\" Type: \"Uint32\"}"
- "KeyColumnNames: [\"key\"]");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ "KeyColumnNames: [\"key\"]");
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"Name with spaces\""
"Columns { Name: \"key\" Type: \"Uint32\"}"
- "KeyColumnNames: [\"key\"]");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ "KeyColumnNames: [\"key\"]");
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"TableN\""
"Columns { Name: \"key\" Type: \"Uint32\"}"
"Columns { Name: \"column with spaces\" Type: \"Uint32\"}"
- "KeyColumnNames: [\"key\"]");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ "KeyColumnNames: [\"key\"]");
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"TableN\""
"Columns { Name: \"key\" Type: \"Uint32\"}"
"Columns { Name: \"кокошник\" Type: \"Uint32\"}"
- "KeyColumnNames: [\"key\"]");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ "KeyColumnNames: [\"key\"]");
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"*.#\""
"Columns { Name: \"key\" Type: \"Uint32\"}"
"Columns { Name: \"!a~\" Type: \"Uint32\"}"
"Columns { Name: \"(a+b)*c=5\" Type: \"Uint32\"}"
"Columns { Name: \"1-x/y+q^6\" Type: \"Uint32\"}"
"Columns { Name: \"!@#$%^&*()_-+=~:;,./?{}|\" Type: \"Uint32\"}"
- "KeyColumnNames: [\"key\"]");
- AsyncCreateTable(runtime, ++txId, "/NotMyRoot/DirA",
+ "KeyColumnNames: [\"key\"]");
+ AsyncCreateTable(runtime, ++txId, "/NotMyRoot/DirA",
"Name: \"Table3\""
"Columns { Name: \"key\" Type: \"Uint32\"}"
- "KeyColumnNames: [\"key\"]");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ "KeyColumnNames: [\"key\"]");
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"Table3\""
"Columns { Name: \"key\" Type: \"Uint32\"}"
- "KeyColumnNames: [\"key\", \"key\"]");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ "KeyColumnNames: [\"key\", \"key\"]");
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"Table3\""
- "Columns { Name: \"key\" Type: \"Uint32\"}");
+ "Columns { Name: \"key\" Type: \"Uint32\"}");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"Table3\""
"Columns { Name: \"key\" Type: \"Uint32\"}"
"KeyColumnNames: [\"key\"]"
- "PartitionConfig {ChannelProfileId: 42}");
+ "PartitionConfig {ChannelProfileId: 42}");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"Table3\""
"Columns { Name: \"key\" Type: \"Uint32\"}"
"KeyColumnNames: [\"key\"]"
"PartitionConfig {ChannelProfileId: 1}");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"Table4\""
"Columns { Name: \"key\" Type: \"Uint32\"}"
"KeyColumnNames: [\"key\"]"
"PartitionConfig {ChannelProfileId: 0}");
- TestModificationResult(runtime, txId-18, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-17, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-16, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-15, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-14, NKikimrScheme::StatusSchemeError);
- TestModificationResult(runtime, txId-13, NKikimrScheme::StatusSchemeError);
- TestModificationResult(runtime, txId-12, NKikimrScheme::StatusSchemeError);
- TestModificationResult(runtime, txId-11, NKikimrScheme::StatusSchemeError);
- TestModificationResult(runtime, txId-10, NKikimrScheme::StatusPathIsNotDirectory);
- TestModificationResult(runtime, txId-9, NKikimrScheme::StatusSchemeError);
- TestModificationResult(runtime, txId-8, NKikimrScheme::StatusSchemeError);
- TestModificationResult(runtime, txId-7, NKikimrScheme::StatusSchemeError);
- TestModificationResult(runtime, txId-6, NKikimrScheme::StatusSchemeError);
- TestModificationResult(runtime, txId-5, NKikimrScheme::StatusPathDoesNotExist);
- TestModificationResult(runtime, txId-4, NKikimrScheme::StatusSchemeError);
- TestModificationResult(runtime, txId-3, NKikimrScheme::StatusSchemeError);
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusInvalidParameter);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
-
- env.TestWaitNotification(runtime, xrange(txId - 18, txId + 1));
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(1)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(13),
+ TestModificationResult(runtime, txId-18, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-17, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-16, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-15, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-14, NKikimrScheme::StatusSchemeError);
+ TestModificationResult(runtime, txId-13, NKikimrScheme::StatusSchemeError);
+ TestModificationResult(runtime, txId-12, NKikimrScheme::StatusSchemeError);
+ TestModificationResult(runtime, txId-11, NKikimrScheme::StatusSchemeError);
+ TestModificationResult(runtime, txId-10, NKikimrScheme::StatusPathIsNotDirectory);
+ TestModificationResult(runtime, txId-9, NKikimrScheme::StatusSchemeError);
+ TestModificationResult(runtime, txId-8, NKikimrScheme::StatusSchemeError);
+ TestModificationResult(runtime, txId-7, NKikimrScheme::StatusSchemeError);
+ TestModificationResult(runtime, txId-6, NKikimrScheme::StatusSchemeError);
+ TestModificationResult(runtime, txId-5, NKikimrScheme::StatusPathDoesNotExist);
+ TestModificationResult(runtime, txId-4, NKikimrScheme::StatusSchemeError);
+ TestModificationResult(runtime, txId-3, NKikimrScheme::StatusSchemeError);
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusInvalidParameter);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+
+ env.TestWaitNotification(runtime, xrange(txId - 18, txId + 1));
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(1)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(13),
NLs::ChildrenCount(5)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table1"),
- {NLs::PathExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table2"),
- {NLs::PathExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table1"),
+ {NLs::PathExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table2"),
+ {NLs::PathExist});
+ }
+
+ Y_UNIT_TEST(CreateTableWithDate) { //+
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "DateInColumns"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Date" }
+ KeyColumnNames: ["key"]
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint64 : 200 } }
+ }
+ }
+ )");
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "DateInKeys"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Date" }
+ KeyColumnNames: ["key", "value"]
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint64 : 200 } }
+ Tuple { Optional { Uint32 : 678 } }
+ }
+ }
+ )");
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "TzDateInKeys"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "TzDate" }
+ KeyColumnNames: ["key", "value"]
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint64 : 200 } }
+ Tuple { Optional { Uint32 : 678 } }
+ }
+ }
+ )", {NKikimrScheme::StatusSchemeError}); // Type 'TzDate' specified for column 'value' is not supported by storage
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "TzDateInColumns"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "TzDate" }
+ KeyColumnNames: ["key"]
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint64 : 200 } }
+ }
+ }
+ )", {NKikimrScheme::StatusSchemeError}); // Type 'TzDate' specified for column 'value' is not supported by storage
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "DatetimeInKeys"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Datetime" }
+ KeyColumnNames: ["key", "value"]
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint64 : 200 } }
+ Tuple { Optional { Uint32 : 678 } }
+ }
+ }
+ )");
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "TzDatetimeInKeys"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "TzDatetime" }
+ KeyColumnNames: ["key", "value"]
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint64 : 200 } }
+ Tuple { Optional { Uint32 : 678 } }
+ }
+ }
+ )", {NKikimrScheme::StatusSchemeError});
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "TimestampInKeys"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Timestamp" }
+ KeyColumnNames: ["key", "value"]
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint64 : 200 } }
+ Tuple { Optional { Uint64 : 18446744073709551606 } }
+ }
+ }
+ )");
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "TzTimestampInKeys"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "TzTimestamp" }
+ KeyColumnNames: ["key", "value"]
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint64 : 200 } }
+ Tuple { Optional { Uint64 : 678 } }
+ }
+ }
+ )", {NKikimrScheme::StatusSchemeError});
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
+ TableDescription {
+ Name: "TzTimestampInIndex"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "TzTimestamp" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
+ TableDescription {
+ Name: "TimestampInIndex"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Timestamp" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ )");
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "IntervalInKeys"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Interval" }
+ KeyColumnNames: ["key", "value"]
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint64 : 200 } }
+ Tuple { Optional { Int64 : -9223372036854775807 } }
+ }
+ }
+ )");
+
+ env.TestWaitNotification(runtime, {100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot", true, true),
+ {NLs::PathExist,
+ NLs::Finished,
+ NLs::ShardsInsideDomain(12)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DateInColumns", true, true),
+ {NLs::PathVersionEqual(3),
+ NLs::PathExist,
+ NLs::Finished});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DateInKeys", true, true),
+ {NLs::PathVersionEqual(3),
+ NLs::PathExist,
+ NLs::Finished});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TzDateInKeys", true, true),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TzDateInColumns", true, true),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DatetimeInKeys", true, true),
+ {NLs::PathVersionEqual(3),
+ NLs::PathExist,
+ NLs::Finished});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TzDatetimeInKeys", true, true),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TimestampInKeys", true, true),
+ {NLs::PathVersionEqual(3),
+ NLs::PathExist,
+ NLs::Finished,
+ [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ UNIT_ASSERT_EQUAL(record.GetPathDescription()
+ .GetTable()
+ .GetSplitBoundary(0)
+ .GetKeyPrefix()
+ .GetTuple(1)
+ .GetOptional()
+ .GetUint64()
+ , ui64(18446744073709551606ul));
+ }});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TzTimestampInIndex", true, true),
+ {NLs::PathNotExist});
+
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TimestampInIndex", true, true),
+ {NLs::PathVersionEqual(3),
+ NLs::PathExist,
+ NLs::Finished,
+ NLs::IndexesCount(1)
+ });
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TzTimestampInKeys", true, true),
+ {NLs::PathNotExist});
+
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/IntervalInKeys", true, true),
+ {NLs::PathVersionEqual(3),
+ NLs::PathExist,
+ NLs::Finished,
+ [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ UNIT_ASSERT_EQUAL(record.GetPathDescription()
+ .GetTable()
+ .GetSplitBoundary(0)
+ .GetKeyPrefix()
+ .GetTuple(1)
+ .GetOptional()
+ .GetInt64()
+ , i64(-9223372036854775807l));
+ }});
}
- Y_UNIT_TEST(CreateTableWithDate) { //+
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "DateInColumns"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Date" }
- KeyColumnNames: ["key"]
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Uint64 : 200 } }
- }
- }
- )");
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "DateInKeys"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Date" }
- KeyColumnNames: ["key", "value"]
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Uint64 : 200 } }
- Tuple { Optional { Uint32 : 678 } }
- }
- }
- )");
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "TzDateInKeys"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "TzDate" }
- KeyColumnNames: ["key", "value"]
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Uint64 : 200 } }
- Tuple { Optional { Uint32 : 678 } }
- }
- }
- )", {NKikimrScheme::StatusSchemeError}); // Type 'TzDate' specified for column 'value' is not supported by storage
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "TzDateInColumns"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "TzDate" }
- KeyColumnNames: ["key"]
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Uint64 : 200 } }
- }
- }
- )", {NKikimrScheme::StatusSchemeError}); // Type 'TzDate' specified for column 'value' is not supported by storage
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "DatetimeInKeys"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Datetime" }
- KeyColumnNames: ["key", "value"]
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Uint64 : 200 } }
- Tuple { Optional { Uint32 : 678 } }
- }
- }
- )");
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "TzDatetimeInKeys"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "TzDatetime" }
- KeyColumnNames: ["key", "value"]
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Uint64 : 200 } }
- Tuple { Optional { Uint32 : 678 } }
- }
- }
- )", {NKikimrScheme::StatusSchemeError});
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "TimestampInKeys"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Timestamp" }
- KeyColumnNames: ["key", "value"]
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Uint64 : 200 } }
- Tuple { Optional { Uint64 : 18446744073709551606 } }
- }
- }
- )");
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "TzTimestampInKeys"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "TzTimestamp" }
- KeyColumnNames: ["key", "value"]
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Uint64 : 200 } }
- Tuple { Optional { Uint64 : 678 } }
- }
- }
- )", {NKikimrScheme::StatusSchemeError});
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
- TableDescription {
- Name: "TzTimestampInIndex"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "TzTimestamp" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- )", {NKikimrScheme::StatusInvalidParameter});
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
- TableDescription {
- Name: "TimestampInIndex"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Timestamp" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- )");
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "IntervalInKeys"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Interval" }
- KeyColumnNames: ["key", "value"]
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Uint64 : 200 } }
- Tuple { Optional { Int64 : -9223372036854775807 } }
- }
- }
- )");
-
- env.TestWaitNotification(runtime, {100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot", true, true),
- {NLs::PathExist,
- NLs::Finished,
- NLs::ShardsInsideDomain(12)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DateInColumns", true, true),
- {NLs::PathVersionEqual(3),
- NLs::PathExist,
- NLs::Finished});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DateInKeys", true, true),
- {NLs::PathVersionEqual(3),
- NLs::PathExist,
- NLs::Finished});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TzDateInKeys", true, true),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TzDateInColumns", true, true),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DatetimeInKeys", true, true),
- {NLs::PathVersionEqual(3),
- NLs::PathExist,
- NLs::Finished});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TzDatetimeInKeys", true, true),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TimestampInKeys", true, true),
- {NLs::PathVersionEqual(3),
- NLs::PathExist,
- NLs::Finished,
- [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- UNIT_ASSERT_EQUAL(record.GetPathDescription()
- .GetTable()
- .GetSplitBoundary(0)
- .GetKeyPrefix()
- .GetTuple(1)
- .GetOptional()
- .GetUint64()
- , ui64(18446744073709551606ul));
- }});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TzTimestampInIndex", true, true),
- {NLs::PathNotExist});
-
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TimestampInIndex", true, true),
- {NLs::PathVersionEqual(3),
- NLs::PathExist,
- NLs::Finished,
- NLs::IndexesCount(1)
- });
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TzTimestampInKeys", true, true),
- {NLs::PathNotExist});
-
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/IntervalInKeys", true, true),
- {NLs::PathVersionEqual(3),
- NLs::PathExist,
- NLs::Finished,
- [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- UNIT_ASSERT_EQUAL(record.GetPathDescription()
- .GetTable()
- .GetSplitBoundary(0)
- .GetKeyPrefix()
- .GetTuple(1)
- .GetOptional()
- .GetInt64()
- , i64(-9223372036854775807l));
- }});
- }
-
- Y_UNIT_TEST(ConsistentCopyTable) { //+
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
-
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
- Name: "src1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- AsyncCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
- TableDescription {
- Name: "src2"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValues"
- KeyColumnNames: ["value0", "value1"]
- }
+ Y_UNIT_TEST(ConsistentCopyTable) { //+
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
+
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ Name: "src1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ AsyncCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ TableDescription {
+ Name: "src2"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValues"
+ KeyColumnNames: ["value0", "value1"]
+ }
IndexDescription {
Name: "UserDefinedIndexByValue0CoveringValue1"
KeyColumnNames: ["value0"]
DataColumnNames: ["value1"]
}
- )");
-
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
-
- env.TestWaitNotification(runtime, {txId, txId-1 , txId-2});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(7),
- NLs::Finished,
- NLs::PathExist,
+ )");
+
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+
+ env.TestWaitNotification(runtime, {txId, txId-1 , txId-2});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(7),
+ NLs::Finished,
+ NLs::PathExist,
NLs::PathsInsideDomain(9),
NLs::ShardsInsideDomain(5),
- NLs::ChildrenCount(2)
- });
-
+ NLs::ChildrenCount(2)
+ });
+
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/dst1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src2"
- DstPath: "/MyRoot/DirA/dst2"
- })");
- env.TestWaitNotification(runtime, txId);
-
- auto dst1Version = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/dst1"),
- {NLs::PathVersionEqual(3),
- NLs::PathExist,
- NLs::Finished});
-
- auto dst2Version = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/dst2"),
- {NLs::PathVersionEqual(3),
- NLs::PathExist,
- NLs::Finished});
-
- auto dirAVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(11),
- NLs::PathExist,
- NLs::Finished,
- NLs::PathExist,
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/dst1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src2"
+ DstPath: "/MyRoot/DirA/dst2"
+ })");
+ env.TestWaitNotification(runtime, txId);
+
+ auto dst1Version = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/dst1"),
+ {NLs::PathVersionEqual(3),
+ NLs::PathExist,
+ NLs::Finished});
+
+ auto dst2Version = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/dst2"),
+ {NLs::PathVersionEqual(3),
+ NLs::PathExist,
+ NLs::Finished});
+
+ auto dirAVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(11),
+ NLs::PathExist,
+ NLs::Finished,
+ NLs::PathExist,
NLs::PathsInsideDomain(17),
NLs::ShardsInsideDomain(10)});
-
+
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/dst1"
- DstPath: "/MyRoot/DirA/seconddst1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/dst2"
- DstPath: "/MyRoot/DirA/seconddst2"
- }
- )", {NKikimrScheme::StatusAccepted}, {dst1Version, dst2Version, dirAVersion});
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(15),
- NLs::PathExist,
- NLs::Finished,
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/dst1"
+ DstPath: "/MyRoot/DirA/seconddst1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/dst2"
+ DstPath: "/MyRoot/DirA/seconddst2"
+ }
+ )", {NKikimrScheme::StatusAccepted}, {dst1Version, dst2Version, dirAVersion});
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(15),
+ NLs::PathExist,
+ NLs::Finished,
NLs::PathsInsideDomain(25),
NLs::ShardsInsideDomain(15),
- NLs::ChildrenCount(6)
- });
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/src1"),
- {NLs::PathVersionEqual(3),
- NLs::PathExist,
- NLs::Finished,
- NLs::CreatedAt(txId-3)
- });
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/src2"),
- {NLs::PathVersionEqual(3),
- NLs::PathExist,
- NLs::Finished,
- NLs::CreatedAt(txId-2)
- });
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/dst1"),
- {NLs::PathVersionEqual(3),
- NLs::PathExist,
- NLs::Finished,
- NLs::CreatedAt(txId-1)
- });
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/dst2"),
- {NLs::PathVersionEqual(3),
- NLs::PathExist,
- NLs::Finished,
- NLs::CreatedAt(txId-1)
- });
-
+ NLs::ChildrenCount(6)
+ });
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/src1"),
+ {NLs::PathVersionEqual(3),
+ NLs::PathExist,
+ NLs::Finished,
+ NLs::CreatedAt(txId-3)
+ });
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/src2"),
+ {NLs::PathVersionEqual(3),
+ NLs::PathExist,
+ NLs::Finished,
+ NLs::CreatedAt(txId-2)
+ });
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/dst1"),
+ {NLs::PathVersionEqual(3),
+ NLs::PathExist,
+ NLs::Finished,
+ NLs::CreatedAt(txId-1)
+ });
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/dst2"),
+ {NLs::PathVersionEqual(3),
+ NLs::PathExist,
+ NLs::Finished,
+ NLs::CreatedAt(txId-1)
+ });
+
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirA/dst2/UserDefinedIndexByValue0CoveringValue1"),
{NLs::Finished,
- NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
- NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
+ NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
+ NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
NLs::IndexKeys({"value0"}),
NLs::IndexDataColumns({"value1"})});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirA/dst2/UserDefinedIndexByValue0CoveringValue1/indexImplTable"),
{NLs::Finished});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/seconddst1"),
- {NLs::PathVersionEqual(3),
- NLs::PathExist,
- NLs::Finished,
- NLs::IndexesCount(0),
- NLs::CreatedAt(txId)
- });
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/seconddst2"),
- {NLs::PathVersionEqual(3),
- NLs::PathExist,
- NLs::Finished,
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/seconddst1"),
+ {NLs::PathVersionEqual(3),
+ NLs::PathExist,
+ NLs::Finished,
+ NLs::IndexesCount(0),
+ NLs::CreatedAt(txId)
+ });
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/seconddst2"),
+ {NLs::PathVersionEqual(3),
+ NLs::PathExist,
+ NLs::Finished,
NLs::IndexesCount(3),
- NLs::CreatedAt(txId)
- });
-
+ NLs::CreatedAt(txId)
+ });
+
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/seconddst1"
- DstPath: "/MyRoot/DirA/thirddst1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/seconddst2"
- DstPath: "/MyRoot/DirA/thirddst2"
- OmitIndexes: true
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(19),
- NLs::PathExist,
- NLs::Finished,
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/seconddst1"
+ DstPath: "/MyRoot/DirA/thirddst1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/seconddst2"
+ DstPath: "/MyRoot/DirA/thirddst2"
+ OmitIndexes: true
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(19),
+ NLs::PathExist,
+ NLs::Finished,
NLs::PathsInsideDomain(27),
NLs::ShardsInsideDomain(17),
- NLs::ChildrenCount(8)
- });
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/thirddst2"),
- {NLs::PathVersionEqual(3),
- NLs::PathExist,
- NLs::Finished,
- NLs::IndexesCount(0), //Omit Indexes
- NLs::CreatedAt(txId)
- });
- }
-
- Y_UNIT_TEST(ConsistentCopyTableAwait) { //+
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
-
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
- Name: "src1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
- Name: "src2"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
- env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(7),
- NLs::PathExist,
- NLs::Finished,
- NLs::PathsInsideDomain(3),
- NLs::ChildrenCount(2),
- NLs::ShardsInsideDomain(2)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/src1"),
- {NLs::PathVersionEqual(3),
- NLs::PathExist,
- NLs::Finished});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/src2"),
- {NLs::PathVersionEqual(3),
- NLs::PathExist,
- NLs::Finished});
-
- AsyncMkDir(runtime, ++txId, "/MyRoot", "DirB");
+ NLs::ChildrenCount(8)
+ });
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/thirddst2"),
+ {NLs::PathVersionEqual(3),
+ NLs::PathExist,
+ NLs::Finished,
+ NLs::IndexesCount(0), //Omit Indexes
+ NLs::CreatedAt(txId)
+ });
+ }
+
+ Y_UNIT_TEST(ConsistentCopyTableAwait) { //+
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
+
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ Name: "src1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ Name: "src2"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+ env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(7),
+ NLs::PathExist,
+ NLs::Finished,
+ NLs::PathsInsideDomain(3),
+ NLs::ChildrenCount(2),
+ NLs::ShardsInsideDomain(2)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/src1"),
+ {NLs::PathVersionEqual(3),
+ NLs::PathExist,
+ NLs::Finished});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/src2"),
+ {NLs::PathVersionEqual(3),
+ NLs::PathExist,
+ NLs::Finished});
+
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "DirB");
AsyncConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirB/await1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src2"
- DstPath: "/MyRoot/DirB/await2"
- }
- )");
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
- env.TestWaitNotification(runtime, {txId-1, txId});
-
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirB/await1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src2"
+ DstPath: "/MyRoot/DirB/await2"
+ }
+ )");
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ env.TestWaitNotification(runtime, {txId-1, txId});
+
AsyncConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirB/await1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src2"
- DstPath: "/MyRoot/DirB/await2"
- }
- )");
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(7),
- NLs::PathExist,
- NLs::Finished,
- NLs::ChildrenCount(2),
- NLs::PathsInsideDomain(6),
- NLs::ShardsInsideDomain(4)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- {NLs::PathVersionEqual(7),
- NLs::PathExist,
- NLs::Finished,
- NLs::ChildrenCount(2)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/await1"),
- {NLs::PathVersionEqual(3),
- NLs::PathExist,
- NLs::Finished,
- NLs::CreatedAt(txId)
- });
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/await2"),
- {NLs::PathVersionEqual(3),
- NLs::PathExist,
- NLs::Finished,
- NLs::CreatedAt(txId)
- });
- }
-
- Y_UNIT_TEST(ConsistentCopyTableRejects) { //+
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
- Name: "src1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
- Name: "src2"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
- Name: "src3"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- TestModificationResult(runtime, txId-3, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
- env.TestWaitNotification(runtime, {txId-3, txId-2, txId-1, txId});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(9),
- NLs::PathExist,
- NLs::ChildrenCount(3)
- });
-
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirB/await1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src2"
+ DstPath: "/MyRoot/DirB/await2"
+ }
+ )");
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(7),
+ NLs::PathExist,
+ NLs::Finished,
+ NLs::ChildrenCount(2),
+ NLs::PathsInsideDomain(6),
+ NLs::ShardsInsideDomain(4)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ {NLs::PathVersionEqual(7),
+ NLs::PathExist,
+ NLs::Finished,
+ NLs::ChildrenCount(2)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/await1"),
+ {NLs::PathVersionEqual(3),
+ NLs::PathExist,
+ NLs::Finished,
+ NLs::CreatedAt(txId)
+ });
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/await2"),
+ {NLs::PathVersionEqual(3),
+ NLs::PathExist,
+ NLs::Finished,
+ NLs::CreatedAt(txId)
+ });
+ }
+
+ Y_UNIT_TEST(ConsistentCopyTableRejects) { //+
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ Name: "src1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ Name: "src2"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ Name: "src3"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ TestModificationResult(runtime, txId-3, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+ env.TestWaitNotification(runtime, {txId-3, txId-2, txId-1, txId});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(9),
+ NLs::PathExist,
+ NLs::ChildrenCount(3)
+ });
+
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/dst1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/dst2"
- }
- )", {NKikimrScheme::StatusInvalidParameter});
-
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/dst1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/dst2"
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- )", {NKikimrScheme::StatusInvalidParameter});
-
+ )", {NKikimrScheme::StatusInvalidParameter});
+
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/src1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src2"
- DstPath: "/MyRoot/DirA/dst2"
- }
- )", {NKikimrScheme::StatusSchemeError});
-
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/src1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src2"
+ DstPath: "/MyRoot/DirA/dst2"
+ }
+ )", {NKikimrScheme::StatusSchemeError});
+
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA"
- DstPath: "/MyRoot/DirA/dst1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src2"
- DstPath: "/MyRoot/DirA/dst2"
- }
- )", {NKikimrScheme::StatusNameConflict});
-
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA"
+ DstPath: "/MyRoot/DirA/dst1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src2"
+ DstPath: "/MyRoot/DirA/dst2"
+ }
+ )", {NKikimrScheme::StatusNameConflict});
+
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/dst1"
- }
- CopyTableDescriptions {
- SrcPath: ""
- DstPath: "/MyRoot/DirA/dst2"
- }
- )", {NKikimrScheme::StatusPathDoesNotExist});
-
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/dst1"
+ }
+ CopyTableDescriptions {
+ SrcPath: ""
+ DstPath: "/MyRoot/DirA/dst2"
+ }
+ )", {NKikimrScheme::StatusPathDoesNotExist});
+
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/dst1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/notExist"
- DstPath: "/MyRoot/DirA/dst2"
- }
- )", {NKikimrScheme::StatusPathDoesNotExist});
-
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/dst1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/notExist"
+ DstPath: "/MyRoot/DirA/dst2"
+ }
+ )", {NKikimrScheme::StatusPathDoesNotExist});
+
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/src2"
- }
- )", {NKikimrScheme::StatusSchemeError});
-
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/src2"
+ }
+ )", {NKikimrScheme::StatusSchemeError});
+
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/dst1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src2"
- DstPath: "/MyRoot/notExist/dst2"
- }
- )", {NKikimrScheme::StatusPathDoesNotExist});
-
- {
- TestUserAttrs(runtime, ++txId, "/", "MyRoot", AlterUserAttrs({{"__extra_path_symbols_allowed", "-_."}}));
- env.TestWaitNotification(runtime, txId);
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/dst1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src2"
+ DstPath: "/MyRoot/notExist/dst2"
+ }
+ )", {NKikimrScheme::StatusPathDoesNotExist});
+
+ {
+ TestUserAttrs(runtime, ++txId, "/", "MyRoot", AlterUserAttrs({{"__extra_path_symbols_allowed", "-_."}}));
+ env.TestWaitNotification(runtime, txId);
RebootTablet(runtime, TTestTxConfig::SchemeShard, runtime.AllocateEdgeActor());
-
+
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/dst1{not*allowed$symbols!"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src2"
- DstPath: "/MyRoot/DirA/dst2"
- }
- )", {NKikimrScheme::StatusSchemeError});
- }
-
- auto dirAVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(9),
- NLs::PathExist,
- NLs::Finished});
-
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/dst1{not*allowed$symbols!"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src2"
+ DstPath: "/MyRoot/DirA/dst2"
+ }
+ )", {NKikimrScheme::StatusSchemeError});
+ }
+
+ auto dirAVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(9),
+ NLs::PathExist,
+ NLs::Finished});
+
AsyncConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/dst1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src2"
- DstPath: "/MyRoot/DirA/dst2"
- }
- )");
- ui64 copyingTx = txId;
- //Still in fly checks
-
- //retry, must never happen with the same txId, but check that behavior just in case
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/dst1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src2"
+ DstPath: "/MyRoot/DirA/dst2"
+ }
+ )");
+ ui64 copyingTx = txId;
+ //Still in fly checks
+
+ //retry, must never happen with the same txId, but check that behavior just in case
AsyncConsistentCopyTables(runtime, copyingTx, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/dst1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src2"
- DstPath: "/MyRoot/DirA/dst2"
- }
- )");
-
- //retry with different body, just in case
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/dst1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src2"
+ DstPath: "/MyRoot/DirA/dst2"
+ }
+ )");
+
+ //retry with different body, just in case
AsyncConsistentCopyTables(runtime, copyingTx, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src2"
- DstPath: "/MyRoot/DirA/dst1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/dst2"
- })");
-
- //simultaneous
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src2"
+ DstPath: "/MyRoot/DirA/dst1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/dst2"
+ })");
+
+ //simultaneous
AsyncConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/dst1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src2"
- DstPath: "/MyRoot/DirA/dst2"
- })");
-
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/dst1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src2"
+ DstPath: "/MyRoot/DirA/dst2"
+ })");
+
AsyncConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src3"
- DstPath: "/MyRoot/DirA/dst1"
- })");
-
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
-
- env.TestWaitNotification(runtime, copyingTx);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(13),
- NLs::PathExist,
- NLs::Finished,
- NLs::ChildrenCount(5)});
-
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src3"
+ DstPath: "/MyRoot/DirA/dst1"
+ })");
+
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+
+ env.TestWaitNotification(runtime, copyingTx);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(13),
+ NLs::PathExist,
+ NLs::Finished,
+ NLs::ChildrenCount(5)});
+
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/x1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src2"
- DstPath: "/MyRoot/DirA/x2"
- }
- )", {NKikimrScheme::StatusPreconditionFailed}, {dirAVersion});
-
- TestCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
- Name: "WithEnabledExternalBlobs"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- KeyColumnNames: ["key"]
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- ColumnCodec: ColumnCodecLZ4
- ColumnCache: ColumnCacheEver
- StorageConfig {
- SysLog {
- PreferredPoolKind: "hdd-1"
- }
- Log {
- PreferredPoolKind: "hdd-1"
- }
- Data {
- PreferredPoolKind: "hdd-1"
- }
- External {
- PreferredPoolKind: "hdd-2"
- }
- ExternalThreshold: 5604288
- }
- }
- })");
- env.TestWaitNotification(runtime, txId);
-
- TestCopyTable(runtime, ++txId, "/MyRoot/DirA", "NotOk", "/MyRoot/DirA/WithEnabledExternalBlobs",
- NKikimrScheme::StatusPreconditionFailed);
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/x1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src2"
+ DstPath: "/MyRoot/DirA/x2"
+ }
+ )", {NKikimrScheme::StatusPreconditionFailed}, {dirAVersion});
+
+ TestCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ Name: "WithEnabledExternalBlobs"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ ColumnCodec: ColumnCodecLZ4
+ ColumnCache: ColumnCacheEver
+ StorageConfig {
+ SysLog {
+ PreferredPoolKind: "hdd-1"
+ }
+ Log {
+ PreferredPoolKind: "hdd-1"
+ }
+ Data {
+ PreferredPoolKind: "hdd-1"
+ }
+ External {
+ PreferredPoolKind: "hdd-2"
+ }
+ ExternalThreshold: 5604288
+ }
+ }
+ })");
+ env.TestWaitNotification(runtime, txId);
+
+ TestCopyTable(runtime, ++txId, "/MyRoot/DirA", "NotOk", "/MyRoot/DirA/WithEnabledExternalBlobs",
+ NKikimrScheme::StatusPreconditionFailed);
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/IsOk"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/WithEnabledExternalBlobs"
- DstPath: "/MyRoot/DirA/NotOk"
- }
- )", {NKikimrScheme::StatusPreconditionFailed});
- env.TestWaitNotification(runtime, {txId-1, txId});
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
- TableDescription {
- Name: "IndexedTableWithEnabledExternalBlobs"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- ColumnCodec: ColumnCodecLZ4
- ColumnCache: ColumnCacheEver
- StorageConfig {
- SysLog {
- PreferredPoolKind: "hdd-1"
- }
- Log {
- PreferredPoolKind: "hdd-1"
- }
- Data {
- PreferredPoolKind: "hdd-1"
- }
- External {
- PreferredPoolKind: "hdd-2"
- }
- ExternalThreshold: 5604288
- }
- }
- }
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestCopyTable(runtime, ++txId, "/MyRoot/DirA", "NotOk", "/MyRoot/DirA/IndexedTableWithEnabledExternalBlobs",
- NKikimrScheme::StatusPreconditionFailed);
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/IsOk"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/WithEnabledExternalBlobs"
+ DstPath: "/MyRoot/DirA/NotOk"
+ }
+ )", {NKikimrScheme::StatusPreconditionFailed});
+ env.TestWaitNotification(runtime, {txId-1, txId});
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ TableDescription {
+ Name: "IndexedTableWithEnabledExternalBlobs"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ ColumnCodec: ColumnCodecLZ4
+ ColumnCache: ColumnCacheEver
+ StorageConfig {
+ SysLog {
+ PreferredPoolKind: "hdd-1"
+ }
+ Log {
+ PreferredPoolKind: "hdd-1"
+ }
+ Data {
+ PreferredPoolKind: "hdd-1"
+ }
+ External {
+ PreferredPoolKind: "hdd-2"
+ }
+ ExternalThreshold: 5604288
+ }
+ }
+ }
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestCopyTable(runtime, ++txId, "/MyRoot/DirA", "NotOk", "/MyRoot/DirA/IndexedTableWithEnabledExternalBlobs",
+ NKikimrScheme::StatusPreconditionFailed);
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/IsOk"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/IndexedTableWithEnabledExternalBlobs"
- DstPath: "/MyRoot/DirA/NotOk"
- }
- )", {NKikimrScheme::StatusPreconditionFailed});
- env.TestWaitNotification(runtime, {txId-1, txId});
-
- TestAlterTable(runtime, ++txId, "/MyRoot/DirA", R"(
- Name: "IndexedTableWithEnabledExternalBlobs"
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- ColumnCodec: ColumnCodecLZ4
- ColumnCache: ColumnCacheEver
- StorageConfig {
- ExternalThreshold: 0
- }
- }
- })");
- env.TestWaitNotification(runtime, txId);
-
- TestCopyTable(runtime, ++txId, "/MyRoot/DirA", "NotOk", "/MyRoot/DirA/IndexedTableWithEnabledExternalBlobs",
- NKikimrScheme::StatusPreconditionFailed);
-
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/IsOk"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/IndexedTableWithEnabledExternalBlobs"
+ DstPath: "/MyRoot/DirA/NotOk"
+ }
+ )", {NKikimrScheme::StatusPreconditionFailed});
+ env.TestWaitNotification(runtime, {txId-1, txId});
+
+ TestAlterTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ Name: "IndexedTableWithEnabledExternalBlobs"
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ ColumnCodec: ColumnCodecLZ4
+ ColumnCache: ColumnCacheEver
+ StorageConfig {
+ ExternalThreshold: 0
+ }
+ }
+ })");
+ env.TestWaitNotification(runtime, txId);
+
+ TestCopyTable(runtime, ++txId, "/MyRoot/DirA", "NotOk", "/MyRoot/DirA/IndexedTableWithEnabledExternalBlobs",
+ NKikimrScheme::StatusPreconditionFailed);
+
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/IsOk"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/IndexedTableWithEnabledExternalBlobs"
- DstPath: "/MyRoot/DirA/NotOk"
- }
- )", {NKikimrScheme::StatusPreconditionFailed});
- env.TestWaitNotification(runtime, {txId-1, txId});
- }
-
- Y_UNIT_TEST(ConsistentCopyTableToDeletedPath) { //+
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
-
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
- Name: "src1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
- Name: "src2"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
- env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(7),
- NLs::PathExist,
- NLs::ChildrenCount(2)
- });
-
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/IsOk"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/IndexedTableWithEnabledExternalBlobs"
+ DstPath: "/MyRoot/DirA/NotOk"
+ }
+ )", {NKikimrScheme::StatusPreconditionFailed});
+ env.TestWaitNotification(runtime, {txId-1, txId});
+ }
+
+ Y_UNIT_TEST(ConsistentCopyTableToDeletedPath) { //+
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
+
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ Name: "src1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ Name: "src2"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+ env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(7),
+ NLs::PathExist,
+ NLs::ChildrenCount(2)
+ });
+
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/dst1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src2"
- DstPath: "/MyRoot/DirA/dst2"
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- AsyncDropTable(runtime, ++txId, "/MyRoot/DirA", "dst1");
- AsyncDropTable(runtime, ++txId, "/MyRoot/DirA", "dst2");
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
- env.TestWaitNotification(runtime, {txId, txId-1});
-
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/dst1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src2"
+ DstPath: "/MyRoot/DirA/dst2"
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ AsyncDropTable(runtime, ++txId, "/MyRoot/DirA", "dst1");
+ AsyncDropTable(runtime, ++txId, "/MyRoot/DirA", "dst2");
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+ env.TestWaitNotification(runtime, {txId, txId-1});
+
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/dst1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src2"
- DstPath: "/MyRoot/DirA/dst2"
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- //simonteniously
- AsyncDropTable(runtime, ++txId, "/MyRoot/DirA", "dst1");
- AsyncDropTable(runtime, ++txId, "/MyRoot/DirA", "dst2");
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/dst1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src2"
+ DstPath: "/MyRoot/DirA/dst2"
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ //simonteniously
+ AsyncDropTable(runtime, ++txId, "/MyRoot/DirA", "dst1");
+ AsyncDropTable(runtime, ++txId, "/MyRoot/DirA", "dst2");
AsyncConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src1"
- DstPath: "/MyRoot/DirA/dst1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirA/src2"
- DstPath: "/MyRoot/DirA/dst2"
- }
- )");
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
- env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
- }
-
- Y_UNIT_TEST(CreateIndexedTable) { //+
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
- AsyncCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
- TableDescription {
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue1"
- KeyColumnNames: ["value1"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValues"
- KeyColumnNames: ["value0", "value1"]
- }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src1"
+ DstPath: "/MyRoot/DirA/dst1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirA/src2"
+ DstPath: "/MyRoot/DirA/dst2"
+ }
+ )");
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
+ }
+
+ Y_UNIT_TEST(CreateIndexedTable) { //+
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
+ AsyncCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ TableDescription {
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue1"
+ KeyColumnNames: ["value1"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValues"
+ KeyColumnNames: ["value0", "value1"]
+ }
IndexDescription {
Name: "UserDefinedIndexByValue0CoveringValue1"
KeyColumnNames: ["value0"]
DataColumnNames: ["value1"]
}
- )");
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table1"),
- {NLs::NotFinished,
- NLs::PathVersionEqual(1),
- NLs::IndexesCount(0)});
+ )");
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table1"),
+ {NLs::NotFinished,
+ NLs::PathVersionEqual(1),
+ NLs::IndexesCount(0)});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirA/Table1/UserDefinedIndexByValue1"),
- {NLs::NotFinished});
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
- env.TestWaitNotification(runtime, {txId, txId-1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::Finished,
- NLs::PathVersionEqual(5),
- NLs::ChildrenCount(1)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table1"),
- {NLs::Finished,
- NLs::PathVersionEqual(3),
+ {NLs::NotFinished});
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+ env.TestWaitNotification(runtime, {txId, txId-1});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(5),
+ NLs::ChildrenCount(1)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table1"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(3),
NLs::IndexesCount(4)});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirA/Table1/UserDefinedIndexByValue0"),
- {NLs::Finished,
- NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
- NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
- NLs::IndexKeys({"value0"})});
+ {NLs::Finished,
+ NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
+ NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
+ NLs::IndexKeys({"value0"})});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirA/Table1/UserDefinedIndexByValue0/indexImplTable"),
- {NLs::Finished});
+ {NLs::Finished});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirA/Table1/UserDefinedIndexByValue1"),
- {NLs::Finished,
- NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
- NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
- NLs::IndexKeys({"value1"})});
+ {NLs::Finished,
+ NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
+ NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
+ NLs::IndexKeys({"value1"})});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirA/Table1/UserDefinedIndexByValue1/indexImplTable"),
- {NLs::Finished});
+ {NLs::Finished});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirA/Table1/UserDefinedIndexByValues"),
- {NLs::Finished,
- NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
- NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
- NLs::IndexKeys({"value0", "value1"})});
+ {NLs::Finished,
+ NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
+ NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
+ NLs::IndexKeys({"value0", "value1"})});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirA/Table1/UserDefinedIndexByValues/indexImplTable"),
- {NLs::Finished});
-
+ {NLs::Finished});
+
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirA/Table1/UserDefinedIndexByValue0CoveringValue1"),
{NLs::Finished,
- NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
- NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
+ NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
+ NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
NLs::IndexKeys({"value0"}),
NLs::IndexDataColumns({"value1"})});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirA/Table1/UserDefinedIndexByValue0CoveringValue1/indexImplTable"),
{NLs::Finished});
- TestDropTable(runtime, ++txId, "/MyRoot/DirA", "Table1");
- env.TestWaitNotification(runtime, 103);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathExist,
- NLs::ChildrenCount(0)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table1"),
- {NLs::PathNotExist});
-
+ TestDropTable(runtime, ++txId, "/MyRoot/DirA", "Table1");
+ env.TestWaitNotification(runtime, 103);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathExist,
+ NLs::ChildrenCount(0)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table1"),
+ {NLs::PathNotExist});
+
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 10));
- }
-
- Y_UNIT_TEST(CopyIndexedTable) { //+
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestMkDir(runtime, ++txId, "/MyRoot", "DirA");
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
- TableDescription {
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue1"
- KeyColumnNames: ["value1"]
- }
+ }
+
+ Y_UNIT_TEST(CopyIndexedTable) { //+
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestMkDir(runtime, ++txId, "/MyRoot", "DirA");
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ TableDescription {
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue1"
+ KeyColumnNames: ["value1"]
+ }
IndexDescription {
Name: "UserDefinedIndexByValue0CoveringValue1"
KeyColumnNames: ["value0"]
DataColumnNames: ["value1"]
}
- )");
- env.TestWaitNotification(runtime, {txId, txId-1});
-
-
- TestCopyTable(runtime, ++txId, "/MyRoot/DirA", "copy", "/MyRoot/DirA/Table1");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/copy"),
- {NLs::Finished,
- NLs::PathVersionEqual(3),
+ )");
+ env.TestWaitNotification(runtime, {txId, txId-1});
+
+
+ TestCopyTable(runtime, ++txId, "/MyRoot/DirA", "copy", "/MyRoot/DirA/Table1");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/copy"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(3),
NLs::IndexesCount(3)});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirA/copy/UserDefinedIndexByValue0"),
- {NLs::Finished,
- NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
- NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
- NLs::IndexKeys({"value0"})});
+ {NLs::Finished,
+ NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
+ NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
+ NLs::IndexKeys({"value0"})});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirA/copy/UserDefinedIndexByValue0/indexImplTable"),
- {NLs::Finished});
+ {NLs::Finished});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirA/copy/UserDefinedIndexByValue1"),
- {NLs::Finished,
- NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
- NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
- NLs::IndexKeys({"value1"})});
+ {NLs::Finished,
+ NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
+ NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
+ NLs::IndexKeys({"value1"})});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirA/copy/UserDefinedIndexByValue1/indexImplTable"),
- {NLs::Finished});
+ {NLs::Finished});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirA/copy/UserDefinedIndexByValue0CoveringValue1"),
{NLs::Finished,
- NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
- NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
+ NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
+ NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
NLs::IndexKeys({"value0"}),
NLs::IndexDataColumns({"value1"})});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirA/copy/UserDefinedIndexByValue0CoveringValue1/indexImplTable"),
{NLs::Finished});
- }
-
- Y_UNIT_TEST(CreateIndexedTableRejects) { //+
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestMkDir(runtime, ++txId, "/MyRoot", "DirA");
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
- TableDescription {
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue1"
- KeyColumnNames: ["value1"]
- }
- )");
- env.TestWaitNotification(runtime, {100, 101, 102});
-
- //the same table
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
- TableDescription {
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue1"
- KeyColumnNames: ["value1"]
- }
- )", {TEvSchemeShard::EStatus::StatusAlreadyExists});
-
- //the same index name
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
- TableDescription {
- Name: "Table2"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value1"]
- }
- )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
-
- //value_not_exist
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
- TableDescription {
- Name: "Table2"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value_not_exist"]
- }
- )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
-
- //no key in index descr
- TestCreateIndexedTable(runtime, txId++, "/MyRoot/USER_0", R"(
- TableDescription {
- Name: "Table2"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- }
- )", {NKikimrScheme::StatusInvalidParameter});
-
- //not uniq keys
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
- TableDescription {
- Name: "Table2"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0", "value1", "value0"]
- }
- )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
-
- //too many keys in index table
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
- TableDescription {
- Name: "Table2"
- Columns { Name: "key1" Type: "Uint64" }
- Columns { Name: "key2" Type: "Uint64" }
- Columns { Name: "key3" Type: "Uint64" }
- Columns { Name: "key4" Type: "Uint64" }
- Columns { Name: "key5" Type: "Uint64" }
- Columns { Name: "key6" Type: "Uint64" }
- Columns { Name: "key7" Type: "Uint64" }
- Columns { Name: "key8" Type: "Uint64" }
- Columns { Name: "key9" Type: "Uint64" }
- Columns { Name: "key10" Type: "Uint64" }
- Columns { Name: "key11" Type: "Uint64" }
- Columns { Name: "key12" Type: "Uint64" }
- Columns { Name: "key13" Type: "Uint64" }
- Columns { Name: "key14" Type: "Uint64" }
- Columns { Name: "key15" Type: "Uint64" }
- Columns { Name: "key16" Type: "Uint64" }
- Columns { Name: "key17" Type: "Uint64" }
- Columns { Name: "key18" Type: "Uint64" }
- Columns { Name: "key19" Type: "Uint64" }
- Columns { Name: "key20" Type: "Uint64" }
-
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key1", "key2", "key3", "key4", "key5", "key6", "key7", "key8", "key9", "key10",
- "key11", "key12", "key13", "key14", "key15", "key16", "key17", "key18", "key19", "key20"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- )", {TEvSchemeShard::EStatus::StatusSchemeError});
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
- TableDescription {
- Name: "Table2"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Float" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0", "value0"]
- }
- )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
-
+ }
+
+ Y_UNIT_TEST(CreateIndexedTableRejects) { //+
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestMkDir(runtime, ++txId, "/MyRoot", "DirA");
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ TableDescription {
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue1"
+ KeyColumnNames: ["value1"]
+ }
+ )");
+ env.TestWaitNotification(runtime, {100, 101, 102});
+
+ //the same table
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ TableDescription {
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue1"
+ KeyColumnNames: ["value1"]
+ }
+ )", {TEvSchemeShard::EStatus::StatusAlreadyExists});
+
+ //the same index name
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ TableDescription {
+ Name: "Table2"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value1"]
+ }
+ )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
+
+ //value_not_exist
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ TableDescription {
+ Name: "Table2"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value_not_exist"]
+ }
+ )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
+
+ //no key in index descr
+ TestCreateIndexedTable(runtime, txId++, "/MyRoot/USER_0", R"(
+ TableDescription {
+ Name: "Table2"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+
+ //not uniq keys
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ TableDescription {
+ Name: "Table2"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0", "value1", "value0"]
+ }
+ )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
+
+ //too many keys in index table
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ TableDescription {
+ Name: "Table2"
+ Columns { Name: "key1" Type: "Uint64" }
+ Columns { Name: "key2" Type: "Uint64" }
+ Columns { Name: "key3" Type: "Uint64" }
+ Columns { Name: "key4" Type: "Uint64" }
+ Columns { Name: "key5" Type: "Uint64" }
+ Columns { Name: "key6" Type: "Uint64" }
+ Columns { Name: "key7" Type: "Uint64" }
+ Columns { Name: "key8" Type: "Uint64" }
+ Columns { Name: "key9" Type: "Uint64" }
+ Columns { Name: "key10" Type: "Uint64" }
+ Columns { Name: "key11" Type: "Uint64" }
+ Columns { Name: "key12" Type: "Uint64" }
+ Columns { Name: "key13" Type: "Uint64" }
+ Columns { Name: "key14" Type: "Uint64" }
+ Columns { Name: "key15" Type: "Uint64" }
+ Columns { Name: "key16" Type: "Uint64" }
+ Columns { Name: "key17" Type: "Uint64" }
+ Columns { Name: "key18" Type: "Uint64" }
+ Columns { Name: "key19" Type: "Uint64" }
+ Columns { Name: "key20" Type: "Uint64" }
+
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key1", "key2", "key3", "key4", "key5", "key6", "key7", "key8", "key9", "key10",
+ "key11", "key12", "key13", "key14", "key15", "key16", "key17", "key18", "key19", "key20"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ )", {TEvSchemeShard::EStatus::StatusSchemeError});
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ TableDescription {
+ Name: "Table2"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Float" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0", "value0"]
+ }
+ )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
+
TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
TableDescription {
Name: "Table2"
@@ -2046,7 +2046,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
KeyColumnNames: ["value0"]
DataColumnNames: ["value0"]
}
- )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
+ )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
TableDescription {
@@ -2061,7 +2061,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
KeyColumnNames: ["value0"]
DataColumnNames: ["value0", "value1"]
}
- )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
+ )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
TableDescription {
@@ -2076,7 +2076,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
KeyColumnNames: ["value0"]
DataColumnNames: ["key"]
}
- )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
+ )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
TableDescription {
@@ -2091,7 +2091,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
KeyColumnNames: ["value0"]
DataColumnNames: ["key", "value1"]
}
- )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
+ )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
TableDescription {
@@ -2106,295 +2106,295 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
KeyColumnNames: ["value0"]
DataColumnNames: ["blabla"]
}
- )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
-
- TestCreateTable(runtime, ++txId, "/MyRoot/DirA/Table1", R"(
- Name: "inside_table"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )", {TEvSchemeShard::EStatus::StatusPathIsNotDirectory});
-
- TestCreateTable(runtime, ++txId, "/MyRoot/DirA/Table1/UserDefinedIndexByValue0", R"(
- Name: "inside_index"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )", {TEvSchemeShard::EStatus::StatusNameConflict});
-
- TestCreateTable(runtime, ++txId, "/MyRoot/DirA/Table1/UserDefinedIndexByValue0/indexImplTable", R"(
- Name: "inside_impl_table"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )", {TEvSchemeShard::EStatus::StatusNameConflict});
-
- TestAlterTable(runtime, ++txId, "/MyRoot/DirA/Table1/UserDefinedIndexByValue0", R"(
- Name: "indexImplTable"
- Columns { Name: "add_1" Type: "Uint32"}
- Columns { Name: "add_2" Type: "Uint64"}
- )", {TEvSchemeShard::EStatus::StatusNameConflict});
-
- TestCopyTable(runtime, ++txId, "/MyRoot/DirA", "copy_is_ok", "/MyRoot/DirA/Table1");
- env.TestWaitNotification(runtime, txId);
-
- TestCopyTable(runtime, ++txId, "/MyRoot/DirA", "copy", "/MyRoot/DirA/Table1/UserDefinedIndexByValue0", TEvSchemeShard::EStatus::StatusNameConflict);
- TestCopyTable(runtime, ++txId, "/MyRoot/DirA", "copy", "/MyRoot/DirA/Table1/UserDefinedIndexByValue0/indexImplTable", TEvSchemeShard::EStatus::StatusNameConflict);
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
- TableDescription {
+ )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
+
+ TestCreateTable(runtime, ++txId, "/MyRoot/DirA/Table1", R"(
+ Name: "inside_table"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )", {TEvSchemeShard::EStatus::StatusPathIsNotDirectory});
+
+ TestCreateTable(runtime, ++txId, "/MyRoot/DirA/Table1/UserDefinedIndexByValue0", R"(
+ Name: "inside_index"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )", {TEvSchemeShard::EStatus::StatusNameConflict});
+
+ TestCreateTable(runtime, ++txId, "/MyRoot/DirA/Table1/UserDefinedIndexByValue0/indexImplTable", R"(
+ Name: "inside_impl_table"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )", {TEvSchemeShard::EStatus::StatusNameConflict});
+
+ TestAlterTable(runtime, ++txId, "/MyRoot/DirA/Table1/UserDefinedIndexByValue0", R"(
+ Name: "indexImplTable"
+ Columns { Name: "add_1" Type: "Uint32"}
+ Columns { Name: "add_2" Type: "Uint64"}
+ )", {TEvSchemeShard::EStatus::StatusNameConflict});
+
+ TestCopyTable(runtime, ++txId, "/MyRoot/DirA", "copy_is_ok", "/MyRoot/DirA/Table1");
+ env.TestWaitNotification(runtime, txId);
+
+ TestCopyTable(runtime, ++txId, "/MyRoot/DirA", "copy", "/MyRoot/DirA/Table1/UserDefinedIndexByValue0", TEvSchemeShard::EStatus::StatusNameConflict);
+ TestCopyTable(runtime, ++txId, "/MyRoot/DirA", "copy", "/MyRoot/DirA/Table1/UserDefinedIndexByValue0/indexImplTable", TEvSchemeShard::EStatus::StatusNameConflict);
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ TableDescription {
Name: "WithFollowerGroup"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Uint64" }
- KeyColumnNames: ["key"]
- PartitionConfig {
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Uint64" }
+ KeyColumnNames: ["key"]
+ PartitionConfig {
FollowerGroups {
FollowerCount: 1
- }
- }
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
- TableDescription {
+ }
+ }
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ TableDescription {
Name: "WithFollowerCount"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Uint64" }
- KeyColumnNames: ["key"]
- PartitionConfig {
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Uint64" }
+ KeyColumnNames: ["key"]
+ PartitionConfig {
FollowerCount: 1
- }
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
- TableDescription {
+ }
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ TableDescription {
Name: "WithNoFollowers"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Uint64" }
- KeyColumnNames: ["key"]
- PartitionConfig {
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Uint64" }
+ KeyColumnNames: ["key"]
+ PartitionConfig {
FollowerGroups {
- }
- }
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestAlterTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ }
+ }
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestAlterTable(runtime, ++txId, "/MyRoot/DirA", R"(
Name: "WithNoFollowers"
- PartitionConfig {
+ PartitionConfig {
CrossDataCenterFollowerCount: 1
- }
- )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
- TestAlterTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ }
+ )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
+ TestAlterTable(runtime, ++txId, "/MyRoot/DirA", R"(
Name: "WithNoFollowers"
- PartitionConfig {
+ PartitionConfig {
FollowerCount: 1
- }
- )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
- TestAlterTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ }
+ )", {TEvSchemeShard::EStatus::StatusInvalidParameter});
+ TestAlterTable(runtime, ++txId, "/MyRoot/DirA", R"(
Name: "WithNoFollowers"
- PartitionConfig {
+ PartitionConfig {
FollowerGroups {
FollowerCount: 1
- }
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
+ }
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
TestDropTable(runtime, ++txId, "/MyRoot/DirA", "WithFollowerGroup");
TestDropTable(runtime, ++txId, "/MyRoot/DirA", "WithFollowerCount");
TestDropTable(runtime, ++txId, "/MyRoot/DirA", "WithNoFollowers");
- env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
-
- TestDropTable(runtime, ++txId, "/", "Table1", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
- TestDropTable(runtime, ++txId, "", "Table1", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
- TestDropTable(runtime, ++txId, "", "", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
- TestDropTable(runtime, ++txId, "/MyRoot/DirA", "", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
- TestDropTable(runtime, ++txId, "/MyRoot/DirA/Table", "", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
-
- TestDropTable(runtime, ++txId, "/MyRoot/not_exist", "Table1", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
- TestDropTable(runtime, ++txId, "/not_exist/DirA", "Table1", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
- TestDropTable(runtime, ++txId, "/MyRoot/DirA", "not_exist", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
-
- TestDropTable(runtime, ++txId, "/MyRoot/DirA/Table_not_exist", "UserDefinedIndexByValue0", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
- TestDropTable(runtime, ++txId, "/MyRoot/DirA/Table1", "UserDefinedIndexByValue0_not_exist", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
- TestDropTable(runtime, ++txId, "/MyRoot/DirA/Table1", "UserDefinedIndexByValue0", {TEvSchemeShard::EStatus::StatusNameConflict});
- TestDropTable(runtime, ++txId, "/MyRoot/DirA/Table1/UserDefinedIndexByValue0", "indexImplTable_not_exist", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
- TestDropTable(runtime, ++txId, "/MyRoot/DirA/Table1/UserDefinedIndexByValue0", "indexImplTable", {TEvSchemeShard::EStatus::StatusNameConflict});
-
- AsyncDropTable(runtime, ++txId, "/MyRoot/DirA", "Table1");
- AsyncDropTable(runtime, ++txId, "/MyRoot/DirA", "copy_is_ok");
- AsyncDropTable(runtime, ++txId, "/MyRoot/DirA", "Table1");
-
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
-
+ env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
+
+ TestDropTable(runtime, ++txId, "/", "Table1", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
+ TestDropTable(runtime, ++txId, "", "Table1", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
+ TestDropTable(runtime, ++txId, "", "", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
+ TestDropTable(runtime, ++txId, "/MyRoot/DirA", "", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
+ TestDropTable(runtime, ++txId, "/MyRoot/DirA/Table", "", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
+
+ TestDropTable(runtime, ++txId, "/MyRoot/not_exist", "Table1", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
+ TestDropTable(runtime, ++txId, "/not_exist/DirA", "Table1", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
+ TestDropTable(runtime, ++txId, "/MyRoot/DirA", "not_exist", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
+
+ TestDropTable(runtime, ++txId, "/MyRoot/DirA/Table_not_exist", "UserDefinedIndexByValue0", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
+ TestDropTable(runtime, ++txId, "/MyRoot/DirA/Table1", "UserDefinedIndexByValue0_not_exist", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
+ TestDropTable(runtime, ++txId, "/MyRoot/DirA/Table1", "UserDefinedIndexByValue0", {TEvSchemeShard::EStatus::StatusNameConflict});
+ TestDropTable(runtime, ++txId, "/MyRoot/DirA/Table1/UserDefinedIndexByValue0", "indexImplTable_not_exist", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
+ TestDropTable(runtime, ++txId, "/MyRoot/DirA/Table1/UserDefinedIndexByValue0", "indexImplTable", {TEvSchemeShard::EStatus::StatusNameConflict});
+
+ AsyncDropTable(runtime, ++txId, "/MyRoot/DirA", "Table1");
+ AsyncDropTable(runtime, ++txId, "/MyRoot/DirA", "copy_is_ok");
+ AsyncDropTable(runtime, ++txId, "/MyRoot/DirA", "Table1");
+
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+
{
- auto ev = runtime.GrabEdgeEvent<TEvSchemeShard::TEvModifySchemeTransactionResult>();
+ auto ev = runtime.GrabEdgeEvent<TEvSchemeShard::TEvModifySchemeTransactionResult>();
UNIT_ASSERT(ev);
const auto& record = ev->Record;
UNIT_ASSERT_VALUES_EQUAL(record.GetTxId(), txId);
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusMultipleModifications);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusMultipleModifications);
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDropTxId(), txId - 2);
}
- env.TestWaitNotification(runtime, {txId-1, txId-2});
-
- TestDropTable(runtime, ++txId, "/MyRoot/DirA", "Table1", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
-
+ env.TestWaitNotification(runtime, {txId-1, txId-2});
+
+ TestDropTable(runtime, ++txId, "/MyRoot/DirA", "Table1", {TEvSchemeShard::EStatus::StatusPathDoesNotExist});
+
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 20));
- }
-
- Y_UNIT_TEST(CreateIndexedTableAndForceDrop) { //+
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestMkDir(runtime, ++txId, "/MyRoot", "DirA");
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
- TableDescription {
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue1"
- KeyColumnNames: ["value1"]
- }
- )");
- env.TestWaitNotification(runtime, {txId, txId-1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished,
- NLs::PathVersionEqual(5),
- NLs::ChildrenCount(1)});
-
- auto dirAVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::Finished,
- NLs::PathVersionEqual(5),
- NLs::ChildrenCount(1),
- NLs::ShardsInsideDomain(3)});
-
- TestForceDropUnsafe(runtime, ++txId, dirAVersion.PathId.LocalPathId);
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished,
- NLs::PathVersionEqual(7),
- NLs::ChildrenCount(0)});
-
+ }
+
+ Y_UNIT_TEST(CreateIndexedTableAndForceDrop) { //+
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestMkDir(runtime, ++txId, "/MyRoot", "DirA");
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ TableDescription {
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue1"
+ KeyColumnNames: ["value1"]
+ }
+ )");
+ env.TestWaitNotification(runtime, {txId, txId-1});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(5),
+ NLs::ChildrenCount(1)});
+
+ auto dirAVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(5),
+ NLs::ChildrenCount(1),
+ NLs::ShardsInsideDomain(3)});
+
+ TestForceDropUnsafe(runtime, ++txId, dirAVersion.PathId.LocalPathId);
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(7),
+ NLs::ChildrenCount(0)});
+
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 5));
- }
-
- Y_UNIT_TEST(CreateIndexedTableAndForceDropSimonteniously) { //+
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestMkDir(runtime, ++txId, "/MyRoot", "DirA");
- env.TestWaitNotification(runtime, txId);
-
- auto dirAVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::Finished,
- NLs::PathVersionEqual(3),
- NLs::ChildrenCount(0)});
-
- AsyncCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
- TableDescription {
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue1"
- KeyColumnNames: ["value1"]
- }
- )");
- AsyncForceDropUnsafe(runtime, ++txId, dirAVersion.PathId.LocalPathId);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
- env.TestWaitNotification(runtime, {txId, txId-1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished,
- NLs::ChildrenCount(0)});
-
+ }
+
+ Y_UNIT_TEST(CreateIndexedTableAndForceDropSimonteniously) { //+
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestMkDir(runtime, ++txId, "/MyRoot", "DirA");
+ env.TestWaitNotification(runtime, txId);
+
+ auto dirAVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(3),
+ NLs::ChildrenCount(0)});
+
+ AsyncCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ TableDescription {
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue1"
+ KeyColumnNames: ["value1"]
+ }
+ )");
+ AsyncForceDropUnsafe(runtime, ++txId, dirAVersion.PathId.LocalPathId);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+ env.TestWaitNotification(runtime, {txId, txId-1});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished,
+ NLs::ChildrenCount(0)});
+
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 5));
- }
-
- Y_UNIT_TEST(DropIndexedTableAndForceDropSimonteniously) { //+
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestMkDir(runtime, ++txId, "/MyRoot", "DirA");
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
- TableDescription {
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue1"
- KeyColumnNames: ["value1"]
- }
- )");
- env.TestWaitNotification(runtime, {txId, txId-1});
-
-
- auto dirAVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::Finished,
- NLs::PathVersionEqual(5),
- NLs::ChildrenCount(1)});
-
- AsyncDropTable(runtime, ++txId, "/MyRoot/DirA", "Table1");
- AsyncForceDropUnsafe(runtime, ++txId, dirAVersion.PathId.LocalPathId);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
- env.TestWaitNotification(runtime, {txId, txId-1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished,
- NLs::ChildrenCount(0)});
-
+ }
+
+ Y_UNIT_TEST(DropIndexedTableAndForceDropSimonteniously) { //+
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestMkDir(runtime, ++txId, "/MyRoot", "DirA");
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot/DirA", R"(
+ TableDescription {
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue1"
+ KeyColumnNames: ["value1"]
+ }
+ )");
+ env.TestWaitNotification(runtime, {txId, txId-1});
+
+
+ auto dirAVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(5),
+ NLs::ChildrenCount(1)});
+
+ AsyncDropTable(runtime, ++txId, "/MyRoot/DirA", "Table1");
+ AsyncForceDropUnsafe(runtime, ++txId, dirAVersion.PathId.LocalPathId);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+ env.TestWaitNotification(runtime, {txId, txId-1});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished,
+ NLs::ChildrenCount(0)});
+
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 5));
- }
-
- Y_UNIT_TEST(IgnoreUserColumnIds) { //+
+ }
+
+ Y_UNIT_TEST(IgnoreUserColumnIds) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
@@ -2407,22 +2407,22 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
"Columns { Name: \"col1\" Type: \"Uint32\" Id: 100}"
"KeyColumnNames: [\"key\"]"
"KeyColumnIds: 100500");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/TableIgnoreIds"),
- {NLs::Finished,
- NLs::IsTable,
- [](const NKikimrScheme::TEvDescribeSchemeResult& record) {
- Cerr << record.ShortDebugString();
- THashMap<TString, ui32> expectedIds = {{"key", 1}, {"col3", 2}, {"col1", 3}};
- auto& table = record.GetPathDescription().GetTable();
- UNIT_ASSERT_VALUES_EQUAL(3, table.ColumnsSize());
- for (auto& col : table.GetColumns()) {
- UNIT_ASSERT_VALUES_EQUAL(col.GetId(), expectedIds[col.GetName()]);
- }
- UNIT_ASSERT_VALUES_EQUAL(1, table.KeyColumnIdsSize());
- UNIT_ASSERT_VALUES_EQUAL(1, table.GetKeyColumnIds(0));
- }});
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/TableIgnoreIds"),
+ {NLs::Finished,
+ NLs::IsTable,
+ [](const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ Cerr << record.ShortDebugString();
+ THashMap<TString, ui32> expectedIds = {{"key", 1}, {"col3", 2}, {"col1", 3}};
+ auto& table = record.GetPathDescription().GetTable();
+ UNIT_ASSERT_VALUES_EQUAL(3, table.ColumnsSize());
+ for (auto& col : table.GetColumns()) {
+ UNIT_ASSERT_VALUES_EQUAL(col.GetId(), expectedIds[col.GetName()]);
+ }
+ UNIT_ASSERT_VALUES_EQUAL(1, table.KeyColumnIdsSize());
+ UNIT_ASSERT_VALUES_EQUAL(1, table.GetKeyColumnIds(0));
+ }});
}
#if 0 // KIKIMR-1452
@@ -2444,44 +2444,44 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
Columns { Name: "key" Type: "Uint64" }
Columns { Name: "value" Type: "Utf8" }
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusAlreadyExists});
+ )", {NKikimrScheme::StatusAlreadyExists});
TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
Columns { Name: "key" Type: "Uint64" }
Columns { Name: "value" Type: "Utf8" }
KeyColumnNames: ["value"]
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
Columns { Name: "diff" Type: "Uint64" }
Columns { Name: "value" Type: "Utf8" }
KeyColumnNames: ["diff"]
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
Columns { Name: "key" Type: "Uint32" }
Columns { Name: "value" Type: "Utf8" }
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
Columns { Name: "key" Type: "Uint64" }
Columns { Name: "value" Type: "Utf8" }
KeyColumnNames: ["key"]
PartitionConfig {ChannelProfileId: 0}
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
Columns { Name: "key" Type: "Uint64" }
Columns { Name: "value" Type: "Utf8" }
KeyColumnNames: ["key"]
UniformPartitionsCount: 10
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
}
#endif
- Y_UNIT_TEST(CreateTableWithUniformPartitioning) { //+
+ Y_UNIT_TEST(CreateTableWithUniformPartitioning) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 123;
@@ -2497,9 +2497,9 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
);
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/PartitionedTable1"),
- {NLs::IsTable,
- NLs::ShardsInsideDomain(10)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/PartitionedTable1"),
+ {NLs::IsTable,
+ NLs::ShardsInsideDomain(10)});
TestCreateTable(runtime, ++txId, "/MyRoot",
R"(Name: "PartitionedTable2"
@@ -2511,13 +2511,13 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TxReadSizeLimit: 1000
})");
env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/PartitionedTable2"),
- {NLs::IsTable,
- NLs::ShardsInsideDomain(20)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/PartitionedTable2"),
+ {NLs::IsTable,
+ NLs::ShardsInsideDomain(20)});
}
- Y_UNIT_TEST(CreateTableWithSplitBounadaries) { //+
+ Y_UNIT_TEST(CreateTableWithSplitBounadaries) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 123;
@@ -2547,91 +2547,91 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
)");
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot//PartitionedTable1", true, true),
- {NLs::IsTable,
- NLs::CheckBoundaries});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot//PartitionedTable1", true, true),
+ {NLs::IsTable,
+ NLs::CheckBoundaries});
}
- Y_UNIT_TEST(CreateTableWithConfig) { //+
+ Y_UNIT_TEST(CreateTableWithConfig) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 123;
- TestCreateTable(runtime, ++txId, "/MyRoot", R"___(
- Name: "Table1"
- Columns { Name: "key1" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1"]
- UniformPartitionsCount: 2
- PartitionConfig {
- CompactionPolicy {
- InMemSizeToSnapshot: 1000
- InMemStepsToSnapshot : 10
- InMemCompactionBrokerQueue: 0
- Generation {
- GenerationId: 0
- SizeToCompact: 10000
- CountToCompact: 3
- ForceCountToCompact: 5
- ForceSizeToCompact: 20000
- CompactionBrokerQueue: 1
- KeepInCache: true
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"___(
+ Name: "Table1"
+ Columns { Name: "key1" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1"]
+ UniformPartitionsCount: 2
+ PartitionConfig {
+ CompactionPolicy {
+ InMemSizeToSnapshot: 1000
+ InMemStepsToSnapshot : 10
+ InMemCompactionBrokerQueue: 0
+ Generation {
+ GenerationId: 0
+ SizeToCompact: 10000
+ CountToCompact: 3
+ ForceCountToCompact: 5
+ ForceSizeToCompact: 20000
+ CompactionBrokerQueue: 1
+ KeepInCache: true
}
- }
- })___");
- env.TestWaitNotification(runtime, txId);
+ }
+ })___");
+ env.TestWaitNotification(runtime, txId);
- auto t1 = DescribePath(runtime, "/MyRoot/Table1");
+ auto t1 = DescribePath(runtime, "/MyRoot/Table1");
TActorId sender = runtime.AllocateEdgeActor();
RebootTablet(runtime, TTestTxConfig::SchemeShard, sender);
- auto t2 = DescribePath(runtime, "/MyRoot/Table1");
+ auto t2 = DescribePath(runtime, "/MyRoot/Table1");
- UNIT_ASSERT_VALUES_EQUAL(t1.DebugString(), t2.DebugString());
+ UNIT_ASSERT_VALUES_EQUAL(t1.DebugString(), t2.DebugString());
}
- Y_UNIT_TEST(CreateTableWithNamedConfig) { //+
+ Y_UNIT_TEST(CreateTableWithNamedConfig) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 123;
- TestCreateTable(runtime, ++txId, "/MyRoot", R"___(
- Name: "Table2"
- Columns { Name: "key1" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1"]
- UniformPartitionsCount: 2
- PartitionConfig {
- NamedCompactionPolicy : "UserTableDefault"
- })___");
- env.TestWaitNotification(runtime, txId);
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"___(
+ Name: "Table2"
+ Columns { Name: "key1" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1"]
+ UniformPartitionsCount: 2
+ PartitionConfig {
+ NamedCompactionPolicy : "UserTableDefault"
+ })___");
+ env.TestWaitNotification(runtime, txId);
- auto t1 = DescribePath(runtime, "/MyRoot/Table2");
+ auto t1 = DescribePath(runtime, "/MyRoot/Table2");
TActorId sender = runtime.AllocateEdgeActor();
RebootTablet(runtime, TTestTxConfig::SchemeShard, sender);
- auto t2 = DescribePath(runtime, "/MyRoot/Table2");
+ auto t2 = DescribePath(runtime, "/MyRoot/Table2");
- UNIT_ASSERT_VALUES_EQUAL(t1.DebugString(), t2.DebugString());
+ UNIT_ASSERT_VALUES_EQUAL(t1.DebugString(), t2.DebugString());
}
- Y_UNIT_TEST(CreateTableWithUnknownNamedConfig) { //+
+ Y_UNIT_TEST(CreateTableWithUnknownNamedConfig) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 123;
- TestCreateTable(runtime, ++txId, "/MyRoot", R"___(
- Name: "Table2"
- Columns { Name: "key1" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1"]
- UniformPartitionsCount: 2
- PartitionConfig {
- NamedCompactionPolicy : "Default"
- })___",
- {NKikimrScheme::StatusInvalidParameter});
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"___(
+ Name: "Table2"
+ Columns { Name: "key1" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1"]
+ UniformPartitionsCount: 2
+ PartitionConfig {
+ NamedCompactionPolicy : "Default"
+ })___",
+ {NKikimrScheme::StatusInvalidParameter});
}
Y_UNIT_TEST(CreateAlterTableWithCodec) {
@@ -2674,7 +2674,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
ColumnCodec: ColumnCodecZSTD
ColumnCache: ColumnCacheNone
}
- })_", {NKikimrScheme::StatusInvalidParameter});
+ })_", {NKikimrScheme::StatusInvalidParameter});
TestAlterTable(runtime, ++txId, "/MyRoot", R"_(
Name: "Table1"
@@ -2708,10 +2708,10 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
ColumnCodec: ColumnCodecZSTD
ColumnCache: ColumnCacheNone
}
- })_", {NKikimrScheme::StatusInvalidParameter});
+ })_", {NKikimrScheme::StatusInvalidParameter});
}
- Y_UNIT_TEST(DependentOps) { //+
+ Y_UNIT_TEST(DependentOps) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 123;
@@ -2727,46 +2727,46 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
++txId;
AsyncMkDir(runtime, txId, "/MyRoot/DirA/SubDirA/AAA", "aaa");
- env.TestWaitNotification(runtime, {txId, txId-1, txId-2, txId-3, txId-4});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/"),
- {NLs::Finished,
- NLs::ChildrenCount(2)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- {NLs::Finished,
- NLs::PathVersionEqual(3),
- NLs::NoChildren});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::Finished,
- NLs::PathVersionEqual(5),
- NLs::ChildrenCount(1)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA"),
- {NLs::Finished,
- NLs::PathVersionEqual(5),
- NLs::ChildrenCount(1)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA/AAA"),
- {NLs::Finished,
- NLs::PathVersionEqual(5),
- NLs::ChildrenCount(1)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA/AAA/aaa"),
- {NLs::Finished,
- NLs::PathVersionEqual(3),
- NLs::NoChildren});
+ env.TestWaitNotification(runtime, {txId, txId-1, txId-2, txId-3, txId-4});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/"),
+ {NLs::Finished,
+ NLs::ChildrenCount(2)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(3),
+ NLs::NoChildren});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(5),
+ NLs::ChildrenCount(1)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(5),
+ NLs::ChildrenCount(1)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA/AAA"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(5),
+ NLs::ChildrenCount(1)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA/AAA/aaa"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(3),
+ NLs::NoChildren});
}
- Y_UNIT_TEST(ParallelCreateTable) { //+
+ Y_UNIT_TEST(ParallelCreateTable) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 123;
- AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"Table1\""
"Columns { Name: \"RowId\" Type: \"Uint64\"}"
"Columns { Name: \"Value\" Type: \"Utf8\"}"
"KeyColumnNames: [\"RowId\"]"
);
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"Table2\""
"Columns { Name: \"key1\" Type: \"Uint32\"}"
"Columns { Name: \"key2\" Type: \"Utf8\"}"
@@ -2774,25 +2774,25 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
"Columns { Name: \"Value\" Type: \"Utf8\"}"
"KeyColumnNames: [\"RowId\", \"key1\", \"key2\"]"
);
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
- env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
+ env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
TestDescribe(runtime, "/MyRoot/DirA/Table1");
TestDescribe(runtime, "/MyRoot/DirA/Table2");
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(7)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table1"),
- {NLs::PathVersionEqual(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table2"),
- {NLs::PathVersionEqual(3)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(7)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table1"),
+ {NLs::PathVersionEqual(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table2"),
+ {NLs::PathVersionEqual(3)});
}
- Y_UNIT_TEST(ParallelCreateSameTable) { //+
- using ESts = NKikimrScheme::EStatus;
+ Y_UNIT_TEST(ParallelCreateSameTable) { //+
+ using ESts = NKikimrScheme::EStatus;
TTestBasicRuntime runtime;
TTestEnv env(runtime);
@@ -2809,40 +2809,40 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
AsyncCreateTable(runtime, ++txId, "/MyRoot", tableConfig);
ui64 sts[3];
- sts[0] = TestModificationResults(runtime, txId-2, {ESts::StatusAccepted, ESts::StatusMultipleModifications, ESts::StatusAlreadyExists});
- sts[1] = TestModificationResults(runtime, txId-1, {ESts::StatusAccepted, ESts::StatusMultipleModifications, ESts::StatusAlreadyExists});
- sts[2] = TestModificationResults(runtime, txId, {ESts::StatusAccepted, ESts::StatusMultipleModifications, ESts::StatusAlreadyExists});
+ sts[0] = TestModificationResults(runtime, txId-2, {ESts::StatusAccepted, ESts::StatusMultipleModifications, ESts::StatusAlreadyExists});
+ sts[1] = TestModificationResults(runtime, txId-1, {ESts::StatusAccepted, ESts::StatusMultipleModifications, ESts::StatusAlreadyExists});
+ sts[2] = TestModificationResults(runtime, txId, {ESts::StatusAccepted, ESts::StatusMultipleModifications, ESts::StatusAlreadyExists});
for (ui32 i=0; i<3; ++i) {
- if (sts[i] == ESts::StatusAlreadyExists) {
- TestDescribeResult(DescribePath(runtime, "/MyRoot/NilNoviSubLuna"),
- {NLs::Finished,
- NLs::IsTable});
- }
-
- if (sts[i] == ESts::StatusMultipleModifications) {
- TestDescribeResult(DescribePath(runtime, "/MyRoot/NilNoviSubLuna"),
- {NLs::NotFinished,
- NLs::IsTable});
- }
+ if (sts[i] == ESts::StatusAlreadyExists) {
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/NilNoviSubLuna"),
+ {NLs::Finished,
+ NLs::IsTable});
+ }
+
+ if (sts[i] == ESts::StatusMultipleModifications) {
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/NilNoviSubLuna"),
+ {NLs::NotFinished,
+ NLs::IsTable});
+ }
}
env.TestWaitNotification(runtime, {txId-2, txId-1, txId});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/NilNoviSubLuna"),
- {NLs::Finished,
- NLs::IsTable,
- NLs::PathVersionEqual(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/NilNoviSubLuna"),
+ {NLs::Finished,
+ NLs::IsTable,
+ NLs::PathVersionEqual(3)});
TestCreateTable(runtime, ++txId, "/MyRoot", tableConfig, {ESts::StatusAlreadyExists});
}
- Y_UNIT_TEST(CopyTable) { //+
+ Y_UNIT_TEST(CopyTable) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 123;
- TestCreateTable(runtime, ++txId, "/MyRoot",
+ TestCreateTable(runtime, ++txId, "/MyRoot",
"Name: \"Table\""
"Columns { Name: \"key1\" Type: \"Uint32\"}"
"Columns { Name: \"key2\" Type: \"Utf8\"}"
@@ -2853,37 +2853,37 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
);
env.TestWaitNotification(runtime, txId);
- TestCopyTable(runtime, ++txId, "/MyRoot", "NewTable", "/MyRoot/Table");
+ TestCopyTable(runtime, ++txId, "/MyRoot", "NewTable", "/MyRoot/Table");
env.TestWaitNotification(runtime, txId);
TestDescribe(runtime, "/MyRoot/NewTable");
// Try to Copy over existing table
- TestCopyTable(runtime, ++txId, "/MyRoot", "Table", "/MyRoot/NewTable", NKikimrScheme::StatusAlreadyExists);
+ TestCopyTable(runtime, ++txId, "/MyRoot", "Table", "/MyRoot/NewTable", NKikimrScheme::StatusAlreadyExists);
// Try to Copy over exisitng dir
- AsyncMkDir(runtime, ++txId, "/MyRoot", "Dir");
- AsyncCopyTable(runtime, ++txId, "/MyRoot", "Dir", "/MyRoot/Table");
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusNameConflict);
- env.TestWaitNotification(runtime, {txId-1, txId});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::Finished,
- NLs::IsTable,
- NLs::PathVersionEqual(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/NewTable"),
- {NLs::Finished,
- NLs::IsTable,
- NLs::PathVersionEqual(3)});
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "Dir");
+ AsyncCopyTable(runtime, ++txId, "/MyRoot", "Dir", "/MyRoot/Table");
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusNameConflict);
+ env.TestWaitNotification(runtime, {txId-1, txId});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::Finished,
+ NLs::IsTable,
+ NLs::PathVersionEqual(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/NewTable"),
+ {NLs::Finished,
+ NLs::IsTable,
+ NLs::PathVersionEqual(3)});
}
- Y_UNIT_TEST(CopyTableTwiceSimultaneously) { //+
+ Y_UNIT_TEST(CopyTableTwiceSimultaneously) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 123;
- TestCreateTable(runtime, ++txId, "/MyRoot",
+ TestCreateTable(runtime, ++txId, "/MyRoot",
"Name: \"Table\""
"Columns { Name: \"key\" Type: \"Uint32\"}"
"Columns { Name: \"Value\" Type: \"Utf8\"}"
@@ -2910,31 +2910,31 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
fnWriteRow(TTestTxConfig::FakeHiveTablets, 0);
fnWriteRow(TTestTxConfig::FakeHiveTablets+1, 0x80000000u);
- AsyncCopyTable(runtime, ++txId, "/MyRoot", "NewTable", "/MyRoot/Table");
- AsyncCopyTable(runtime, ++txId, "/MyRoot", "NewTable2", "/MyRoot/NewTable");
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
- env.TestWaitNotification(runtime, {txId, txId-1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::Finished,
- NLs::PathVersionEqual(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/NewTable"),
- {NLs::Finished,
- NLs::PathVersionEqual(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/NewTable2"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished,
- NLs::ChildrenCount(2)});
+ AsyncCopyTable(runtime, ++txId, "/MyRoot", "NewTable", "/MyRoot/Table");
+ AsyncCopyTable(runtime, ++txId, "/MyRoot", "NewTable2", "/MyRoot/NewTable");
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ env.TestWaitNotification(runtime, {txId, txId-1});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/NewTable"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/NewTable2"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished,
+ NLs::ChildrenCount(2)});
}
- Y_UNIT_TEST(CopyTableAndConcurrentChanges) { //+
+ Y_UNIT_TEST(CopyTableAndConcurrentChanges) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 123;
- TestCreateTable(runtime, ++txId, "/MyRoot", //124
+ TestCreateTable(runtime, ++txId, "/MyRoot", //124
"Name: \"Table\""
"Columns { Name: \"key1\" Type: \"Uint32\"}"
"Columns { Name: \"key2\" Type: \"Utf8\"}"
@@ -2945,137 +2945,137 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
);
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathVersionEqual(3)});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathVersionEqual(3)});
+
// Copy & Drop
- AsyncCopyTable(runtime, ++txId, "/MyRoot", "Copy1", "/MyRoot/Table"); //125
- AsyncDropTable(runtime, ++txId, "/MyRoot", "Table"); //126
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ AsyncCopyTable(runtime, ++txId, "/MyRoot", "Copy1", "/MyRoot/Table"); //125
+ AsyncDropTable(runtime, ++txId, "/MyRoot", "Table"); //126
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
env.TestWaitNotification(runtime, {txId-1, txId});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathVersionEqual(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy1"),
- {NLs::PathVersionEqual(3)});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathVersionEqual(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy1"),
+ {NLs::PathVersionEqual(3)});
+
// Copy & Alter
- AsyncCopyTable(runtime, ++txId, "/MyRoot", "Copy2", "/MyRoot/Table"); //127
- AsyncAlterTable(runtime, ++txId, "/MyRoot", //128
+ AsyncCopyTable(runtime, ++txId, "/MyRoot", "Copy2", "/MyRoot/Table"); //127
+ AsyncAlterTable(runtime, ++txId, "/MyRoot", //128
"Name: \"Table\""
"Columns { Name: \"add_1\" Type: \"Uint32\"}"
"Columns { Name: \"add_2\" Type: \"Uint64\"}"
);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
env.TestWaitNotification(runtime, {txId-1, txId});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathVersionEqual(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy2"),
- {NLs::PathVersionEqual(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathVersionEqual(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy2"),
+ {NLs::PathVersionEqual(3)});
// Alter & Copy
- AsyncAlterTable(runtime, ++txId, "/MyRoot", //129
+ AsyncAlterTable(runtime, ++txId, "/MyRoot", //129
"Name: \"Table\""
"Columns { Name: \"add_1\" Type: \"Uint32\"}"
"Columns { Name: \"add_2\" Type: \"Uint64\"}"
);
- AsyncCopyTable(runtime, ++txId, "/MyRoot", "Copy3", "/MyRoot/Table"); //130
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ AsyncCopyTable(runtime, ++txId, "/MyRoot", "Copy3", "/MyRoot/Table"); //130
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
env.TestWaitNotification(runtime, {txId-1, txId});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathVersionEqual(4)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy3"),
- {NLs::PathNotExist});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathVersionEqual(4)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy3"),
+ {NLs::PathNotExist});
+
// Copy & Copy
- AsyncCopyTable(runtime, ++txId, "/MyRoot", "Copy4", "/MyRoot/Table"); //131
- AsyncCopyTable(runtime, ++txId, "/MyRoot", "Copy5", "/MyRoot/Table"); //132
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ AsyncCopyTable(runtime, ++txId, "/MyRoot", "Copy4", "/MyRoot/Table"); //131
+ AsyncCopyTable(runtime, ++txId, "/MyRoot", "Copy5", "/MyRoot/Table"); //132
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
env.TestWaitNotification(runtime, {txId-1, txId});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathVersionEqual(4)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy4"),
- {NLs::PathVersionEqual(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy5"),
- {NLs::PathNotExist});
-
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathVersionEqual(4)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy4"),
+ {NLs::PathVersionEqual(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy5"),
+ {NLs::PathNotExist});
+
// Drop & Copy
- AsyncDropTable(runtime, ++txId, "/MyRoot", "Table"); //133
- AsyncCopyTable(runtime, ++txId, "/MyRoot", "Copy6", "/MyRoot/Table"); //134
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ AsyncDropTable(runtime, ++txId, "/MyRoot", "Table"); //133
+ AsyncCopyTable(runtime, ++txId, "/MyRoot", "Copy6", "/MyRoot/Table"); //134
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
env.TestWaitNotification(runtime, {txId-1, txId});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy6"),
- {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy6"),
+ {NLs::PathNotExist});
}
- Y_UNIT_TEST(CopyTableAndConcurrentSplit) { //+
+ Y_UNIT_TEST(CopyTableAndConcurrentSplit) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- UniformPartitionsCount: 2)");
+ UniformPartitionsCount: 2)");
env.TestWaitNotification(runtime, txId);
- AsyncSplitTable(runtime, ++txId, "/MyRoot/Table", R"(
- SourceTabletId: 9437195
+ AsyncSplitTable(runtime, ++txId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437195
SplitBoundary {
KeyPrefix {
Tuple { Optional { Uint32: 3000000000 } }
}
- })");
- AsyncCopyTable(runtime, ++txId, "/MyRoot", "NewTable", "/MyRoot/Table");
+ })");
+ AsyncCopyTable(runtime, ++txId, "/MyRoot", "NewTable", "/MyRoot/Table");
// New split must be rejected while CopyTable is in progress
- AsyncSplitTable(runtime, ++txId, "/MyRoot/Table", R"(
- SourceTabletId: 9437194
+ AsyncSplitTable(runtime, ++txId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437194
SplitBoundary {
KeyPrefix {
Tuple { Optional { Uint32: 1000000000 } }
}
- })");
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
- env.TestWaitNotification(runtime, {txId-1, txId-2});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/NewTable", true),
- {NLs::PartitionCount(3),
- NLs::PathVersionEqual(4)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionCount(3),
- NLs::PathVersionEqual(4)});
+ })");
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ env.TestWaitNotification(runtime, {txId-1, txId-2});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/NewTable", true),
+ {NLs::PartitionCount(3),
+ NLs::PathVersionEqual(4)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionCount(3),
+ NLs::PathVersionEqual(4)});
// Delete all tables and wait for everything to be cleaned up
- AsyncDropTable(runtime, ++txId, "/MyRoot", "Table");
- AsyncDropTable(runtime, ++txId, "/MyRoot", "NewTable");
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+ AsyncDropTable(runtime, ++txId, "/MyRoot", "Table");
+ AsyncDropTable(runtime, ++txId, "/MyRoot", "NewTable");
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
env.TestWaitNotification(runtime, {txId-1, txId});
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+10));
}
- Y_UNIT_TEST(CopyTableAndConcurrentMerge) { //+
+ Y_UNIT_TEST(CopyTableAndConcurrentMerge) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
@@ -3084,48 +3084,48 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
)");
env.TestWaitNotification(runtime, txId);
- AsyncSplitTable(runtime, ++txId, "/MyRoot/Table",
+ AsyncSplitTable(runtime, ++txId, "/MyRoot/Table",
R"(
- SourceTabletId: 9437195
- SourceTabletId: 9437196
+ SourceTabletId: 9437195
+ SourceTabletId: 9437196
)");
- AsyncCopyTable(runtime, ++txId, "/MyRoot", "NewTable", "/MyRoot/Table");
+ AsyncCopyTable(runtime, ++txId, "/MyRoot", "NewTable", "/MyRoot/Table");
// New split must be rejected while CopyTable is in progress
- AsyncSplitTable(runtime, ++txId, "/MyRoot/Table",
+ AsyncSplitTable(runtime, ++txId, "/MyRoot/Table",
R"(
- SourceTabletId: 9437197
+ SourceTabletId: 9437197
SplitBoundary {
KeyPrefix {
Tuple { Optional { Uint32: 300 } }
}
}
- )");
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ )");
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
- env.TestWaitNotification(runtime, {txId-1, txId-2});
+ env.TestWaitNotification(runtime, {txId-1, txId-2});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/NewTable", true),
- {NLs::PartitionCount(2),
- NLs::PathVersionEqual(4)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/NewTable", true),
+ {NLs::PartitionCount(2),
+ NLs::PathVersionEqual(4)});
// Delete all tables and wait for everything to be cleaned up
- AsyncDropTable(runtime, ++txId, "/MyRoot", "Table");
- AsyncDropTable(runtime, ++txId, "/MyRoot", "NewTable");
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+ AsyncDropTable(runtime, ++txId, "/MyRoot", "Table");
+ AsyncDropTable(runtime, ++txId, "/MyRoot", "NewTable");
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
env.TestWaitNotification(runtime, {txId-1, txId});
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+10));
}
- Y_UNIT_TEST(CopyTableAndConcurrentSplitMerge) { //+
+ Y_UNIT_TEST(CopyTableAndConcurrentSplitMerge) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
@@ -3140,26 +3140,26 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
env.TestWaitNotification(runtime, txId);
// Merge and split so that overall partition count stays the same but shard boundaries change
- AsyncSplitTable(runtime, ++txId, "/MyRoot/Table",
+ AsyncSplitTable(runtime, ++txId, "/MyRoot/Table",
R"(
- SourceTabletId: 9437194
- SourceTabletId: 9437195
+ SourceTabletId: 9437194
+ SourceTabletId: 9437195
)");
- AsyncSplitTable(runtime, ++txId, "/MyRoot/Table",
+ AsyncSplitTable(runtime, ++txId, "/MyRoot/Table",
R"(
- SourceTabletId: 9437196
+ SourceTabletId: 9437196
SplitBoundary {
KeyPrefix {
Tuple { Optional { Uint32: 4000 } }
}
}
)");
- AsyncCopyTable(runtime, ++txId, "/MyRoot", "NewTable", "/MyRoot/Table"); //104
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+ AsyncCopyTable(runtime, ++txId, "/MyRoot", "NewTable", "/MyRoot/Table"); //104
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
- env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
+ env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
auto fnCheckSingleColumnKey = [](TString keyBuf, ui32 val) {
TSerializedCellVec cells(keyBuf);
@@ -3169,117 +3169,117 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TVector<ui32> expectedBoundaries = {200, 4000};
- TestDescribeResult(DescribePath(runtime, "/MyRoot/NewTable", true),
- {NLs::PartitionCount(expectedBoundaries.size()+1),
- NLs::PathVersionEqual(4),
- [&] (auto describeRec) {
- for (ui32 i = 0; i < expectedBoundaries.size(); ++i) {
- fnCheckSingleColumnKey(describeRec.GetPathDescription().GetTablePartitions(i).GetEndOfRangeKeyPrefix(), expectedBoundaries[i]);
- }
- }});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/NewTable", true),
+ {NLs::PartitionCount(expectedBoundaries.size()+1),
+ NLs::PathVersionEqual(4),
+ [&] (auto describeRec) {
+ for (ui32 i = 0; i < expectedBoundaries.size(); ++i) {
+ fnCheckSingleColumnKey(describeRec.GetPathDescription().GetTablePartitions(i).GetEndOfRangeKeyPrefix(), expectedBoundaries[i]);
+ }
+ }});
// Delete all tables and wait for everything to be cleaned up
- AsyncDropTable(runtime, ++txId, "/MyRoot", "Table");
- AsyncDropTable(runtime, ++txId, "/MyRoot", "NewTable");
+ AsyncDropTable(runtime, ++txId, "/MyRoot", "Table");
+ AsyncDropTable(runtime, ++txId, "/MyRoot", "NewTable");
env.TestWaitNotification(runtime, {txId-1, txId});
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 10));
}
- Y_UNIT_TEST(CopyTableWithAlterConfig) { //+
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
+ Y_UNIT_TEST(CopyTableWithAlterConfig) { //+
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
runtime.GetAppData().AllowColumnFamiliesForTest = true;
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key"]
- SplitBoundary { KeyPrefix {
- Tuple { Optional { Uint32 : 100 } }
- }}
- SplitBoundary { KeyPrefix {
- Tuple { Optional { Uint32 : 200 } }
- }}
- )");
- env.TestWaitNotification(runtime, txId);
-
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key"]
+ SplitBoundary { KeyPrefix {
+ Tuple { Optional { Uint32 : 100 } }
+ }}
+ SplitBoundary { KeyPrefix {
+ Tuple { Optional { Uint32 : 200 } }
+ }}
+ )");
+ env.TestWaitNotification(runtime, txId);
+
// Cannot have multiple column families without StorageConfig
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
- ColumnFamilies {
- Id: 1
- ColumnCodec: ColumnCodecLZ4
- ColumnCache: ColumnCacheNone
- }
- }
- )", {NKikimrScheme::StatusInvalidParameter});
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 1
+ ColumnCodec: ColumnCodecLZ4
+ ColumnCache: ColumnCacheNone
+ }
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
// Cannot have multiple changes for the same column family 0
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- ColumnCodec: ColumnCodecLZ4
- ColumnCache: ColumnCacheNone
- }
- ColumnFamilies {
- Id: 0
- ColumnCodec: ColumnCodecLZ4
- ColumnCache: ColumnCacheNone
- }
- }
- )", {NKikimrScheme::StatusInvalidParameter});
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ ColumnCodec: ColumnCodecLZ4
+ ColumnCache: ColumnCacheNone
+ }
+ ColumnFamilies {
+ Id: 0
+ ColumnCodec: ColumnCodecLZ4
+ ColumnCache: ColumnCacheNone
+ }
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
// Cannot switch from legacy table to StorageConfig
- TestAlterTable(runtime, ++txId, "/MyRoot",
- R"(
- Name: "Table"
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- ColumnCodec: ColumnCodecLZ4
- ColumnCache: ColumnCacheNone
- StorageConfig {
- SysLog {}
- Log {}
- }
- }
- })", {NKikimrScheme::StatusInvalidParameter});
-
+ TestAlterTable(runtime, ++txId, "/MyRoot",
+ R"(
+ Name: "Table"
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ ColumnCodec: ColumnCodecLZ4
+ ColumnCache: ColumnCacheNone
+ StorageConfig {
+ SysLog {}
+ Log {}
+ }
+ }
+ })", {NKikimrScheme::StatusInvalidParameter});
+
// Changing column family settings should be OK
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- ColumnCodec: ColumnCodecLZ4
- ColumnCache: ColumnCacheEver
- }
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ ColumnCodec: ColumnCodecLZ4
+ ColumnCache: ColumnCacheEver
+ }
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
// Copying table with changed column family settings should be OK
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "CopyTable"
- CopyFromTable: "/MyRoot/Table"
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- ColumnCodec: ColumnCodecLZ4
- ColumnCache: ColumnCacheOnce
- }
- })");
- env.TestWaitNotification(runtime, txId);
-
- TestAlterSubDomain(runtime, ++txId, "/",
- "StoragePools { "
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "CopyTable"
+ CopyFromTable: "/MyRoot/Table"
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ ColumnCodec: ColumnCodecLZ4
+ ColumnCache: ColumnCacheOnce
+ }
+ })");
+ env.TestWaitNotification(runtime, txId);
+
+ TestAlterSubDomain(runtime, ++txId, "/",
+ "StoragePools { "
" Name: \"pool-1\" "
" Kind: \"pool-kind-1\" "
"} "
@@ -3288,48 +3288,48 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
" Kind: \"pool-kind-2\" "
"} "
"StoragePools { "
- " Name: \"name_USER_0_kind_hdd-1\" "
- " Kind: \"hdd-1\" "
- "} "
- "StoragePools { "
- " Name: \"name_USER_0_kind_hdd-2\" "
- " Kind: \"hdd-2\" "
- "} "
- "Name: \"MyRoot\"");
- env.TestWaitNotification(runtime, txId);
-
+ " Name: \"name_USER_0_kind_hdd-1\" "
+ " Kind: \"hdd-1\" "
+ "} "
+ "StoragePools { "
+ " Name: \"name_USER_0_kind_hdd-2\" "
+ " Kind: \"hdd-2\" "
+ "} "
+ "Name: \"MyRoot\"");
+ env.TestWaitNotification(runtime, txId);
+
// Copy table while changing StorageConfig is OK
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "CopyTable2"
- CopyFromTable: "/MyRoot/Table"
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- ColumnCodec: ColumnCodecLZ4
- ColumnCache: ColumnCacheOnce
- StorageConfig {
- SysLog {}
- Log {}
- }
- }
- })");
- env.TestWaitNotification(runtime, txId);
-
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "CopyTable2"
+ CopyFromTable: "/MyRoot/Table"
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ ColumnCodec: ColumnCodecLZ4
+ ColumnCache: ColumnCacheOnce
+ StorageConfig {
+ SysLog {}
+ Log {}
+ }
+ }
+ })");
+ env.TestWaitNotification(runtime, txId);
+
// Changing codecs doesn't change StorageConfig, so it's OK
- TestAlterTable(runtime, ++txId, "/MyRoot",
- R"(
- Name: "CopyTable2"
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- ColumnCodec: ColumnCodecLZ4
- ColumnCache: ColumnCacheNone
- }
- })");
- env.TestWaitNotification(runtime, txId);
-
+ TestAlterTable(runtime, ++txId, "/MyRoot",
+ R"(
+ Name: "CopyTable2"
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ ColumnCodec: ColumnCodecLZ4
+ ColumnCache: ColumnCacheNone
+ }
+ })");
+ env.TestWaitNotification(runtime, txId);
+
// Adding column families to StorageConfig based tables is OK
- TestAlterTable(runtime, ++txId, "/MyRoot",
+ TestAlterTable(runtime, ++txId, "/MyRoot",
R"(
Name: "CopyTable2"
Columns { Name: "Value" Family: 1 }
@@ -3341,78 +3341,78 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
}
})");
env.TestWaitNotification(runtime, txId);
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "CopyTable3"
- CopyFromTable: "/MyRoot/Table")");
- env.TestWaitNotification(runtime, txId);
-
- auto checher = [] (NKikimrSchemeOp::EColumnCache cacheType, size_t families = 1) {
- return [=] (const NKikimrSchemeOp::TTableDescription& tableDescription) {
- auto partConfig = tableDescription.GetPartitionConfig();
- Cdbg << "-----------" << Endl << partConfig.DebugString() << "\n~~~~~~\n" << Endl;
-
- UNIT_ASSERT_VALUES_EQUAL(tableDescription.ColumnsSize(), 2);
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "CopyTable3"
+ CopyFromTable: "/MyRoot/Table")");
+ env.TestWaitNotification(runtime, txId);
+
+ auto checher = [] (NKikimrSchemeOp::EColumnCache cacheType, size_t families = 1) {
+ return [=] (const NKikimrSchemeOp::TTableDescription& tableDescription) {
+ auto partConfig = tableDescription.GetPartitionConfig();
+ Cdbg << "-----------" << Endl << partConfig.DebugString() << "\n~~~~~~\n" << Endl;
+
+ UNIT_ASSERT_VALUES_EQUAL(tableDescription.ColumnsSize(), 2);
UNIT_ASSERT_VALUES_EQUAL(partConfig.ColumnFamiliesSize(), families);
-
- const auto& otherFamily = partConfig.GetColumnFamilies(0);
- UNIT_ASSERT_VALUES_EQUAL(otherFamily.GetId(), 0);
- UNIT_ASSERT_EQUAL(otherFamily.GetColumnCache(), cacheType);
-
+
+ const auto& otherFamily = partConfig.GetColumnFamilies(0);
+ UNIT_ASSERT_VALUES_EQUAL(otherFamily.GetId(), 0);
+ UNIT_ASSERT_EQUAL(otherFamily.GetColumnCache(), cacheType);
+
UNIT_ASSERT_VALUES_EQUAL(tableDescription.GetColumns(1).GetFamily(), families - 1);
- };
- };
-
- // /Root/Table
+ };
+ };
+
+ // /Root/Table
for (ui64 tabletId : {TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+1, TTestTxConfig::FakeHiveTablets+2}) {
- NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 2);
- checher(NKikimrSchemeOp::EColumnCache::ColumnCacheEver)(tableDescription);
- }
-
- // /Root/CopyTable
+ NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 2);
+ checher(NKikimrSchemeOp::EColumnCache::ColumnCacheEver)(tableDescription);
+ }
+
+ // /Root/CopyTable
for (ui64 tabletId : {TTestTxConfig::FakeHiveTablets+3, TTestTxConfig::FakeHiveTablets+4, TTestTxConfig::FakeHiveTablets+5}) {
- NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 3);
- checher(NKikimrSchemeOp::EColumnCache::ColumnCacheOnce)(tableDescription);
- }
-
- // /Root/CopyTable2
+ NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 3);
+ checher(NKikimrSchemeOp::EColumnCache::ColumnCacheOnce)(tableDescription);
+ }
+
+ // /Root/CopyTable2
for (ui64 tabletId : {TTestTxConfig::FakeHiveTablets+6, TTestTxConfig::FakeHiveTablets+7, TTestTxConfig::FakeHiveTablets+8}) {
- NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 4);
- checher(NKikimrSchemeOp::EColumnCache::ColumnCacheNone, 2)(tableDescription);
- }
-
- // /Root/CopyTable3
+ NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 4);
+ checher(NKikimrSchemeOp::EColumnCache::ColumnCacheNone, 2)(tableDescription);
+ }
+
+ // /Root/CopyTable3
for (ui64 tabletId : {TTestTxConfig::FakeHiveTablets+9, TTestTxConfig::FakeHiveTablets+10, TTestTxConfig::FakeHiveTablets+11}) {
- NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 5);
- checher(NKikimrSchemeOp::EColumnCache::ColumnCacheEver)(tableDescription);
- }
-
- auto descrChecker = [] (size_t families) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 5);
+ checher(NKikimrSchemeOp::EColumnCache::ColumnCacheEver)(tableDescription);
+ }
+
+ auto descrChecker = [] (size_t families) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
//Cerr << record.DebugString() << Endl;
- UNIT_ASSERT_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
+ UNIT_ASSERT_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
UNIT_ASSERT_EQUAL(families, record.GetPathDescription().GetTable().GetPartitionConfig().ColumnFamiliesSize());
};
- };
-
+ };
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {descrChecker(1)});
-
+ {descrChecker(1)});
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/CopyTable", true),
- {descrChecker(1)});
-
+ {descrChecker(1)});
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/CopyTable2", true),
- {descrChecker(2)});
-
+ {descrChecker(2)});
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/CopyTable3", true),
- {descrChecker(1)});
- }
-
+ {descrChecker(1)});
+ }
+
Y_UNIT_TEST(CopyTableOmitFollowers) {
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
-
+
// create src table
TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
@@ -3517,7 +3517,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
Columns { Name: "value" Type: "Utf8"}
KeyColumnNames: ["key"]
IsBackup: true
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
TableDescription {
@@ -3531,39 +3531,39 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
Name: "UserDefinedIndexByValue"
KeyColumnNames: ["value"]
}
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
// cannot add 'IsBackup' property to existent table
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
IsBackup: true
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
IsBackup: true
DropColumns { Name: "value" }
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
// cannot remove 'IsBackup' property from existent table
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "CopyTable"
IsBackup: false
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "CopyTable"
IsBackup: false
DropColumns { Name: "value" }
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
}
- Y_UNIT_TEST(AlterTableAndConcurrentSplit) { //+
+ Y_UNIT_TEST(AlterTableAndConcurrentSplit) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
@@ -3611,11 +3611,11 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
fnWriteRow(TTestTxConfig::FakeHiveTablets, 0);
fnWriteRow(TTestTxConfig::FakeHiveTablets+1, 0x80000000u);
- AsyncSplitTable(runtime, ++txId, "/MyRoot/Table", R"(
- SourceTabletId: 9437194
- SourceTabletId: 9437195
+ AsyncSplitTable(runtime, ++txId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437194
+ SourceTabletId: 9437195
)");
- AsyncAlterTable(runtime, ++txId, "/MyRoot", R"(
+ AsyncAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
PartitionConfig {
ExecutorCacheSize: 12121212
@@ -3651,21 +3651,21 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
}
)");
// New split must be rejected while CopyTable is in progress
- AsyncSplitTable(runtime, ++txId, "/MyRoot/Table", R"(
- SourceTabletId: 9437196
+ AsyncSplitTable(runtime, ++txId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437196
SplitBoundary {
KeyPrefix {
Tuple { Optional { Uint32: 300 } }
}
}
- )");
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
- env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
+ )");
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionCount(2)});
+ {NLs::PartitionCount(2)});
NTabletFlatScheme::TSchemeChanges scheme;
TString errStr;
@@ -3703,7 +3703,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TString schemaStr = result.GetValue().GetStruct(0).GetOptional().GetStruct(0).GetList(0).GetStruct(1).GetOptional().GetBytes();
UNIT_ASSERT_VALUES_EQUAL(localTid, 1001);
UNIT_ASSERT(!schemaStr.empty());
- NKikimrSchemeOp::TTableDescription tableDescr;
+ NKikimrSchemeOp::TTableDescription tableDescr;
bool ok = tableDescr.ParseFromArray(schemaStr.data(), schemaStr.size());
UNIT_ASSERT(ok);
// Cerr << tableDescr << Endl;
@@ -3717,18 +3717,18 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
UNIT_ASSERT_STRING_CONTAINS_C(ToString(scheme), "ExecutorCacheSize: 12121212", "Non-splitted shard must participate in ALTER");
// Drop the table and wait for everything to be cleaned up
- TestDropTable(runtime, ++txId, "/MyRoot", "Table");
+ TestDropTable(runtime, ++txId, "/MyRoot", "Table");
env.TestWaitNotification(runtime, txId);
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+10));
}
- Y_UNIT_TEST(DropTableAndConcurrentSplit) { //+
+ Y_UNIT_TEST(DropTableAndConcurrentSplit) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
@@ -3737,30 +3737,30 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
)");
env.TestWaitNotification(runtime, txId);
- AsyncSplitTable(runtime, ++txId, "/MyRoot/Table", R"(
- SourceTabletId: 9437195
- SourceTabletId: 9437196
+ AsyncSplitTable(runtime, ++txId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437195
+ SourceTabletId: 9437196
)");
- AsyncDropTable(runtime, ++txId, "/MyRoot", "Table");
- // New split must be rejected while DropTable is in progress
- AsyncSplitTable(runtime, ++txId, "/MyRoot/Table", R"(
- SourceTabletId: 9437197
+ AsyncDropTable(runtime, ++txId, "/MyRoot", "Table");
+ // New split must be rejected while DropTable is in progress
+ AsyncSplitTable(runtime, ++txId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437197
SplitBoundary {
KeyPrefix {
Tuple { Optional { Uint32: 300 } }
}
}
- )");
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
- env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
+ )");
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
// Wait for everything to be cleaned up
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+10));
}
- Y_UNIT_TEST(AlterTable) { //+
+ Y_UNIT_TEST(AlterTable) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
@@ -3778,9 +3778,9 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
)");
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
+
Cdbg << "AlterTable: add column" << Endl;
cols.insert("add_1");
cols.insert("add_2");
@@ -3793,43 +3793,43 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
)");
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
+
Cdbg << "AlterTable: add existed column" << Endl;
TestAlterTable(runtime, ++txId, "/MyRoot",
R"(Name: "Table" Columns { Name: "value" Type: "Utf8"})",
- {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
TestAlterTable(runtime, ++txId, "/MyRoot",
R"(Name: "Table" Columns { Name: "add_1" Type: "Uint64"})",
- {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
-
Cdbg << "AlterTable: add wrong column" << Endl;
TestAlterTable(runtime, ++txId, "/MyRoot",
R"(Name: "Table" Columns { Name: "кокошник" Type: "Utf8"})",
- {NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusInvalidParameter});
TestAlterTable(runtime, ++txId, "/MyRoot",
R"(Name: "Table" Columns { Name: "name with spaces" Type: "Uint64"})",
- {NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusInvalidParameter});
TestAlterTable(runtime, ++txId, "/MyRoot",
R"(Name: "Table" Columns { Name: "\x10xyz" Type: "Uint64"})",
- {NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusInvalidParameter});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
-
Cdbg << "AlterTable: add column ignores id" << Endl;
TestAlterTable(runtime, ++txId, "/MyRoot",
R"(Name: "Table" Columns { Name: "add_100" Type: "Utf8" Id: 1 })");
cols.insert("add_100");
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
+
Cdbg << "AlterTable: drop column" << Endl;
cols.erase("value");
cols.erase("add_2");
@@ -3839,32 +3839,32 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
R"(Name: "Table" DropColumns { Name: "value" } DropColumns { Name: "add_2" })");
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
+
Cdbg << "AlterTable: drop column ignores id" << Endl;
dropCols.insert("add_100");
TestAlterTable(runtime, ++txId, "/MyRoot",
R"(Name: "Table" DropColumns { Name: "add_100" Id: 500100 })");
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
+
Cdbg << "AlterTable: drop dropped column" << Endl;
TestAlterTable(runtime, ++txId, "/MyRoot",
R"(Name: "Table" DropColumns { Name: "add_2"})",
- {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
Cdbg << "AlterTable: drop key column" << Endl;
TestAlterTable(runtime, ++txId, "/MyRoot",
R"(Name: "Table" DropColumns { Name: "key1" })",
- {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
Cdbg << "AlterTable: drop without column name " << Endl;
TestAlterTable(runtime, ++txId, "/MyRoot",
R"(Name: "Table" DropColumns { Id: 3 })",
- {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
Cdbg << "AlterTable: add + drop different column" << Endl;
cols.insert("add_3");
@@ -3876,25 +3876,25 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
)");
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
+
Cdbg << "AlterTable: add + drop same column (exist)" << Endl;
TestAlterTable(runtime, ++txId, "/MyRoot",
R"(Name: "Table"
Columns { Name: "add_3" Type: "Uint32"}
DropColumns { Name: "add_3" }
- )", {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
Cdbg << "AlterTable: add + drop same column (not exist)" << Endl;
TestAlterTable(runtime, ++txId, "/MyRoot",
R"(Name: "Table"
Columns { Name: "add_4" Type: "Uint32"}
DropColumns { Name: "add_4" }
- )", {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
}
Y_UNIT_TEST(AlterTableDropColumnReCreateSplit) {
@@ -3986,35 +3986,35 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
)");
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
+
Cdbg << "AlterTable: add key column (errors)" << Endl;
TestAlterTable(runtime, ++txId, "/MyRoot",
R"(Name: "Table"
Columns { Name: "key2" Type: "Uint32" }
KeyColumnNames: ["key2", "key1"]
- )", {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
TestAlterTable(runtime, ++txId, "/MyRoot",
R"(Name: "Table"
Columns { Name: "key1" Type: "Uint64" }
KeyColumnNames: ["key1", "key1"]
- )", {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
TestAlterTable(runtime, ++txId, "/MyRoot",
R"(Name: "Table"
Columns { Name: "some" Type: "Uint32" }
KeyColumnNames: ["key1", "value"]
- )", {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
TestAlterTable(runtime, ++txId, "/MyRoot",
R"(Name: "Table"
KeyColumnNames: ["key1"]
- )", {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
TestAlterTable(runtime, ++txId, "/MyRoot",
R"(Name: "Table"
Columns { Name: "key2" Type: "Uint32" }
KeyColumnNames: ["key1", "key2"]
- PartitionConfig { ChannelProfileId: 1 }
- )", {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
+ PartitionConfig { ChannelProfileId: 1 }
+ )", {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
Cdbg << "AlterTable: add key column" << Endl;
cols.insert("key2");
@@ -4026,9 +4026,9 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
)");
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
+
cols.insert("key3");
cols.insert("value2");
keyCol.insert("key3");
@@ -4042,9 +4042,9 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
)");
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
+
cols.insert("value3");
dropCols.insert("value");
TestAlterTable(runtime, ++txId, "/MyRoot",
@@ -4053,12 +4053,12 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
KeyColumnNames: ["key1", "key2", "key3"]
)");
env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
}
- Y_UNIT_TEST(AlterTableById) { //+
+ Y_UNIT_TEST(AlterTableById) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
@@ -4076,24 +4076,24 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
)");
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
+
Cdbg << "AlterTable: add column" << Endl;
cols.insert("add_1");
cols.insert("add_2");
TestAlterTable(runtime, ++txId, "not used",
- R"(Id_Deprecated: 2
+ R"(Id_Deprecated: 2
Columns { Name: "add_1" Type: "Uint32"}
Columns { Name: "add_2" Type: "Uint64"})"
);
env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::CheckColumns("Table", cols, dropCols, keyCol)});
}
- Y_UNIT_TEST(AlterTableConfig) { //+
+ Y_UNIT_TEST(AlterTableConfig) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
@@ -4117,7 +4117,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
UNIT_ASSERT_VALUES_EQUAL(GetExecutorCacheSize(runtime, datashardTabletId), 42);
{ // ChannelProfileId
- NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, datashardTabletId, 2);
+ NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, datashardTabletId, 2);
UNIT_ASSERT_VALUES_EQUAL(tableDescription.GetPartitionConfig().GetChannelProfileId(), 1);
}
@@ -4158,12 +4158,12 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
DropColumns { Name: "value" }
PartitionConfig {
PipelineConfig {
- NumActiveTx: 8
+ NumActiveTx: 8
EnableOutOfOrder: 1
}
}
)");
-
+
env.TestWaitNotification(runtime, txId);
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
@@ -4182,7 +4182,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
env.TestWaitNotification(runtime, txId);
{ // ChannelProfileId
- NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, datashardTabletId, 2);
+ NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, datashardTabletId, 2);
UNIT_ASSERT_VALUES_EQUAL(tableDescription.GetPartitionConfig().GetChannelProfileId(), 1);
}
@@ -4191,7 +4191,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
PartitionConfig {
ChannelProfileId: 0
}
- )", {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
@@ -4211,15 +4211,15 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
env.TestWaitNotification(runtime, txId);
UNIT_ASSERT_VALUES_EQUAL(GetStatDisabled(runtime, datashardTabletId), 0);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::IsTable,
- NLs::PathVersionEqual(11)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(11)});
}
Y_UNIT_TEST(ConfigColumnFamily) {
- using NKikimrSchemeOp::EColumnCodec;
- using NKikimrSchemeOp::EColumnCache;
- using NKikimrSchemeOp::EColumnStorage;
+ using NKikimrSchemeOp::EColumnCodec;
+ using NKikimrSchemeOp::EColumnCache;
+ using NKikimrSchemeOp::EColumnStorage;
TTestBasicRuntime runtime;
TTestEnv env(runtime);
@@ -4244,7 +4244,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
env.TestWaitNotification(runtime, txId);
for (ui64 tabletId : tabletIds) {
- NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 2);
+ NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 2);
auto partConfig = tableDescription.GetPartitionConfig();
Cdbg << ToString(partConfig) << Endl;
UNIT_ASSERT_VALUES_EQUAL(tableDescription.ColumnsSize(), 4);
@@ -4274,7 +4274,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
PartitionConfig {
ColumnFamilies { Id: 1 Name: "other" Storage: ColumnStorage1 ColumnCache: ColumnCacheEver }
}
- )", {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusSchemeError, NKikimrScheme::StatusInvalidParameter});
// change colFamily + change family for columns
@@ -4287,17 +4287,17 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
)");
env.TestWaitNotification(runtime, txId);
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "c1" Family: 0 }
- PartitionConfig {
- ColumnFamilies { Id: 0 ColumnCache: ColumnCacheEver }
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "c1" Family: 0 }
+ PartitionConfig {
+ ColumnFamilies { Id: 0 ColumnCache: ColumnCacheEver }
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
for (ui64 tabletId : tabletIds) {
- NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 2);
+ NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 2);
auto partConfig = tableDescription.GetPartitionConfig();
//Cdbg << ToString(partConfig) << Endl;
UNIT_ASSERT_VALUES_EQUAL(tableDescription.ColumnsSize(), 4);
@@ -4310,24 +4310,24 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
UNIT_ASSERT_VALUES_EQUAL(tableDescription.GetColumns(1).GetFamily(), 0);
}
-
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::IsTable,
- [] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- Cerr << record.DebugString() << Endl;
- UNIT_ASSERT_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
- UNIT_ASSERT_EQUAL(1, record.GetPathDescription().GetTable().GetPartitionConfig().ColumnFamiliesSize());
- }});
+ {NLs::IsTable,
+ [] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ Cerr << record.DebugString() << Endl;
+ UNIT_ASSERT_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
+ UNIT_ASSERT_EQUAL(1, record.GetPathDescription().GetTable().GetPartitionConfig().ColumnFamiliesSize());
+ }});
}
- Y_UNIT_TEST(MultipleColumnFamilies) { //+
+ Y_UNIT_TEST(MultipleColumnFamilies) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
runtime.GetAppData().AllowColumnFamiliesForTest = true;
- TestAlterSubDomain(runtime, ++txId, "/", R"(
+ TestAlterSubDomain(runtime, ++txId, "/", R"(
StoragePools {
Name: "pool-1"
Kind: "pool-kind-1"
@@ -4349,7 +4349,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
env.TestWaitNotification(runtime, txId);
// Multiple column families with StorageConfig are forbidden
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table0"
Columns { Name: "key" Type: "Uint32" }
Columns { Name: "Value" Type: "Utf8" Family: 1 }
@@ -4379,34 +4379,34 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
Log {}
}
}
- })", {NKikimrScheme::StatusInvalidParameter});
-
- // Auto generation column families do not generate by ID
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table0"
- Columns { Name: "key" Type: "Uint32" }
- Columns { Name: "Value" Type: "Utf8" Family: 1 }
- KeyColumnNames: ["key"]
- SplitBoundary { KeyPrefix {
- Tuple { Optional { Uint32 : 100 } }
- }}
- SplitBoundary { KeyPrefix {
- Tuple { Optional { Uint32 : 200 } }
- }}
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- ColumnCodec: ColumnCodecPlain
- ColumnCache: ColumnCacheNone
- StorageConfig {
- SysLog {}
- Log {}
- }
- }
- })", {NKikimrScheme::StatusSchemeError});
-
+ })", {NKikimrScheme::StatusInvalidParameter});
+
+ // Auto generation column families do not generate by ID
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table0"
+ Columns { Name: "key" Type: "Uint32" }
+ Columns { Name: "Value" Type: "Utf8" Family: 1 }
+ KeyColumnNames: ["key"]
+ SplitBoundary { KeyPrefix {
+ Tuple { Optional { Uint32 : 100 } }
+ }}
+ SplitBoundary { KeyPrefix {
+ Tuple { Optional { Uint32 : 200 } }
+ }}
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ ColumnCodec: ColumnCodecPlain
+ ColumnCache: ColumnCacheNone
+ StorageConfig {
+ SysLog {}
+ Log {}
+ }
+ }
+ })", {NKikimrScheme::StatusSchemeError});
+
// Creating a table with family should be OK
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table1"
Columns { Name: "key" Type: "Uint32" FamilyName: "default" }
Columns { Name: "Value" Type: "Utf8" FamilyName: "alt" }
@@ -4436,7 +4436,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
env.TestWaitNotification(runtime, txId);
// Specifying FamilyName should be enough to autogenerate the family
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table2"
Columns { Name: "key" Type: "Uint32" }
Columns { Name: "Value" Type: "Utf8" FamilyName: "alt" }
@@ -4461,7 +4461,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
env.TestWaitNotification(runtime, txId);
// Create a table that has no alternative families initially
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table3"
Columns { Name: "key" Type: "Uint32" }
Columns { Name: "Value" Type: "Utf8" }
@@ -4485,34 +4485,34 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
})");
env.TestWaitNotification(runtime, txId);
- // Create a table that has no alternative families initially
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table4"
- Columns { Name: "key" Type: "Uint32" }
- Columns { Name: "Value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- SplitBoundary { KeyPrefix {
- Tuple { Optional { Uint32 : 100 } }
- }}
- SplitBoundary { KeyPrefix {
- Tuple { Optional { Uint32 : 200 } }
- }}
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- Name: ""
- ColumnCodec: ColumnCodecPlain
- ColumnCache: ColumnCacheNone
- StorageConfig {
- SysLog {}
- Log {}
- }
- }
- })");
- env.TestWaitNotification(runtime, txId);
-
+ // Create a table that has no alternative families initially
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table4"
+ Columns { Name: "key" Type: "Uint32" }
+ Columns { Name: "Value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ SplitBoundary { KeyPrefix {
+ Tuple { Optional { Uint32 : 100 } }
+ }}
+ SplitBoundary { KeyPrefix {
+ Tuple { Optional { Uint32 : 200 } }
+ }}
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ Name: ""
+ ColumnCodec: ColumnCodecPlain
+ ColumnCache: ColumnCacheNone
+ StorageConfig {
+ SysLog {}
+ Log {}
+ }
+ }
+ })");
+ env.TestWaitNotification(runtime, txId);
+
auto schemaChecker = [] (size_t families = 2) {
- return [=] (const NKikimrSchemeOp::TTableDescription& tableDescription) {
+ return [=] (const NKikimrSchemeOp::TTableDescription& tableDescription) {
Cerr << "-----------\n" << tableDescription.DebugString() << "\n~~~~~~\n";
const auto& partConfig = tableDescription.GetPartitionConfig();
@@ -4536,322 +4536,322 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
};
auto descrChecker = [schemaChecker] (size_t families = 2) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- UNIT_ASSERT_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ UNIT_ASSERT_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
schemaChecker(families)(record.GetPathDescription().GetTable());
};
};
Cerr << "Checking Table1" << Endl;
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1", true),
- {descrChecker()});
+ {descrChecker()});
Cerr << "Checking Table2" << Endl;
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table2", true),
- {descrChecker()});
+ {descrChecker()});
Cerr << "Checking Table3" << Endl;
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table3", true),
- {descrChecker(1)});
-
- TActorId sender = runtime.AllocateEdgeActor();
+ {descrChecker(1)});
+
+ TActorId sender = runtime.AllocateEdgeActor();
RebootTablet(runtime, TTestTxConfig::SchemeShard, sender);
-
- Cerr << "Checking Table1" << Endl;
+
+ Cerr << "Checking Table1" << Endl;
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1", true),
- {descrChecker()});
+ {descrChecker()});
- Cerr << "Checking Table2" << Endl;
+ Cerr << "Checking Table2" << Endl;
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table2", true),
- {descrChecker()});
-
- Cerr << "Checking Table3" << Endl;
+ {descrChecker()});
+
+ Cerr << "Checking Table3" << Endl;
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table3", true),
- {descrChecker(1)});
-
- Cerr << "Checking Table4" << Endl;
+ {descrChecker(1)});
+
+ Cerr << "Checking Table4" << Endl;
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table4", true),
- {descrChecker(1)});
-
- // Copy table of table with families should succeed
- TestCopyTable(runtime, ++txId, "/MyRoot", "Table2Copy", "/MyRoot/Table2");
- env.TestWaitNotification(runtime, txId);
-
- // Auto generation column families do not generate by ID
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table3"
- Columns { Name: "Value" Family: 1 }
- )", {NKikimrScheme::StatusInvalidParameter});
-
- // Auto generation column families do not generate by ID
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table3"
- Columns { Name: "Value" Family: 1 FamilyName: "alt" }
- )", {NKikimrScheme::StatusInvalidParameter});
-
- // Altering a column should autogenerate the family
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table3"
- Columns { Name: "Value" FamilyName: "alt" }
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table4"
- Columns { Name: "Value" Family: 0 FamilyName: "" }
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table4"
- Columns { Name: "Value" Family: 0 FamilyName: "default" }
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table4"
- Columns { Name: "Value" Family: 1 FamilyName: "" }
- )", {NKikimrScheme::StatusInvalidParameter});
-
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table4"
- Columns { Name: "Value" Family: 1 FamilyName: "default" }
- )", {NKikimrScheme::StatusInvalidParameter});
-
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table4"
- PartitionConfig {
- ColumnFamilies {
- Id: 1
- Name: ""
- }
- })", {NKikimrScheme::StatusInvalidParameter});
-
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table4"
- PartitionConfig {
- ColumnFamilies {
- Id: 1
- Name: "default"
- }
- })", {NKikimrScheme::StatusInvalidParameter});
-
- // Copy table of table with families should succeed
- TestCopyTable(runtime, ++txId, "/MyRoot", "Table3Copy", "/MyRoot/Table3");
- env.TestWaitNotification(runtime, txId);
-
- // Trying to specify a non-default column family for key columns should fail
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table3"
- Columns { Name: "key" FamilyName: "more" }
- )", {NKikimrScheme::StatusInvalidParameter});
-
- Cerr << "Checking Table1" << Endl;
+ {descrChecker(1)});
+
+ // Copy table of table with families should succeed
+ TestCopyTable(runtime, ++txId, "/MyRoot", "Table2Copy", "/MyRoot/Table2");
+ env.TestWaitNotification(runtime, txId);
+
+ // Auto generation column families do not generate by ID
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table3"
+ Columns { Name: "Value" Family: 1 }
+ )", {NKikimrScheme::StatusInvalidParameter});
+
+ // Auto generation column families do not generate by ID
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table3"
+ Columns { Name: "Value" Family: 1 FamilyName: "alt" }
+ )", {NKikimrScheme::StatusInvalidParameter});
+
+ // Altering a column should autogenerate the family
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table3"
+ Columns { Name: "Value" FamilyName: "alt" }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table4"
+ Columns { Name: "Value" Family: 0 FamilyName: "" }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table4"
+ Columns { Name: "Value" Family: 0 FamilyName: "default" }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table4"
+ Columns { Name: "Value" Family: 1 FamilyName: "" }
+ )", {NKikimrScheme::StatusInvalidParameter});
+
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table4"
+ Columns { Name: "Value" Family: 1 FamilyName: "default" }
+ )", {NKikimrScheme::StatusInvalidParameter});
+
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table4"
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 1
+ Name: ""
+ }
+ })", {NKikimrScheme::StatusInvalidParameter});
+
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table4"
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 1
+ Name: "default"
+ }
+ })", {NKikimrScheme::StatusInvalidParameter});
+
+ // Copy table of table with families should succeed
+ TestCopyTable(runtime, ++txId, "/MyRoot", "Table3Copy", "/MyRoot/Table3");
+ env.TestWaitNotification(runtime, txId);
+
+ // Trying to specify a non-default column family for key columns should fail
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table3"
+ Columns { Name: "key" FamilyName: "more" }
+ )", {NKikimrScheme::StatusInvalidParameter});
+
+ Cerr << "Checking Table1" << Endl;
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1", true),
- {descrChecker()});
-
- Cerr << "Checking Table2" << Endl;
+ {descrChecker()});
+
+ Cerr << "Checking Table2" << Endl;
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table2", true),
- {descrChecker()});
-
- Cerr << "Checking Table3" << Endl;
+ {descrChecker()});
+
+ Cerr << "Checking Table3" << Endl;
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table3", true),
- {descrChecker()});
-
+ {descrChecker()});
+
// /MyRoot/Table1
Cerr << "Checking tablets for Table1" << Endl;
for (ui64 tabletId : {TTestTxConfig::FakeHiveTablets+0, TTestTxConfig::FakeHiveTablets+1, TTestTxConfig::FakeHiveTablets+2}) {
- NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 2);
+ NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 2);
schemaChecker()(tableDescription);
}
// /MyRoot/Table2
Cerr << "Checking tablets for Table2" << Endl;
for (ui64 tabletId : {TTestTxConfig::FakeHiveTablets+3, TTestTxConfig::FakeHiveTablets+4, TTestTxConfig::FakeHiveTablets+5}) {
- NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 3);
+ NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 3);
schemaChecker()(tableDescription);
}
// /MyRoot/Table3
Cerr << "Checking tablets for Table3" << Endl;
for (ui64 tabletId : {TTestTxConfig::FakeHiveTablets+6, TTestTxConfig::FakeHiveTablets+7, TTestTxConfig::FakeHiveTablets+8}) {
- NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 4);
+ NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 4);
schemaChecker()(tableDescription);
}
}
- Y_UNIT_TEST(DefaulColumnFamiliesWithNonCanonicName) { //+
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- runtime.GetAppData().AllowColumnFamiliesForTest = true;
-
- TestAlterSubDomain(runtime, ++txId, "/", R"(
- StoragePools {
- Name: "pool-1"
- Kind: "pool-kind-1"
- }
- StoragePools {
- Name: "pool-2"
- Kind: "pool-kind-2"
- }
- StoragePools {
- Name: "name_USER_0_kind_hdd-1"
- Kind: "hdd-1"
- }
- StoragePools {
- Name: "name_USER_0_kind_hdd-2"
- Kind: "hdd-2"
- }
- StoragePools {
- Name: "name_USER_0_kind_hdd-3"
- Kind: "hdd-3"
- }
- Name: "MyRoot"
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table1"
- Columns { Name: "key" Type: "Uint32" FamilyName: "default" }
- Columns { Name: "Value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- SplitBoundary { KeyPrefix {
- Tuple { Optional { Uint32 : 100 } }
- }}
- SplitBoundary { KeyPrefix {
- Tuple { Optional { Uint32 : 200 } }
- }}
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- Name: "ExtBlobsOnHDD"
- ColumnCodec: ColumnCodecPlain
- ColumnCache: ColumnCacheNone
- StorageConfig {
- SysLog { PreferredPoolKind: "hdd-1" }
- Log { PreferredPoolKind: "hdd-1" }
- Data { PreferredPoolKind: "hdd-1" }
- }
- }
- })", {NKikimrScheme::StatusSchemeError});
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table1"
- Columns { Name: "key" Type: "Uint32" }
- Columns { Name: "Value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- SplitBoundary { KeyPrefix {
- Tuple { Optional { Uint32 : 100 } }
- }}
- SplitBoundary { KeyPrefix {
- Tuple { Optional { Uint32 : 200 } }
- }}
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- Name: "ExtBlobsOnHDD"
- ColumnCodec: ColumnCodecPlain
- ColumnCache: ColumnCacheNone
- StorageConfig {
- SysLog { PreferredPoolKind: "hdd-1" }
- Log { PreferredPoolKind: "hdd-1" }
- Data { PreferredPoolKind: "hdd-1" }
- }
- }
- })");
- env.TestWaitNotification(runtime, txId);
-
- TestCopyTable(runtime, ++txId, "/MyRoot", "Table1Copy", "/MyRoot/Table1");
- env.TestWaitNotification(runtime, txId);
-
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table1"
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- Name: "default"
- }
- })", {NKikimrScheme::StatusInvalidParameter});
-
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table1"
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- }
- })");
- env.TestWaitNotification(runtime, txId);
-
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table1"
- PartitionConfig {
- ColumnFamilies {
- Name: "ExtBlobsOnHDD"
- }
- })");
- env.TestWaitNotification(runtime, txId);
-
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table1"
- Columns { Name: "key" Family: 0 FamilyName: "default" }
- )", {NKikimrScheme::StatusInvalidParameter});
-
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table1"
- Columns { Name: "Value" Family: 0 FamilyName: "default" }
- )", {NKikimrScheme::StatusInvalidParameter});
-
-// https://st.yandex-team.ru/KIKIMR-10458
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table1"
- Columns { Name: "key" Family: 0 FamilyName: "ExtBlobsOnHDD" }
- )", {NKikimrScheme::StatusInvalidParameter});
- env.TestWaitNotification(runtime, txId);
-
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table1"
- Columns { Name: "Value" Family: 0 FamilyName: "ExtBlobsOnHDD" }
- )");
- env.TestWaitNotification(runtime, txId);
-
- auto descrChecker = [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- const NKikimrSchemeOp::TTableDescription& tableDescription = record.GetPathDescription().GetTable();
- Cerr << "-----------\n" << tableDescription.DebugString() << "\n~~~~~~\n";
-
- const auto& partConfig = tableDescription.GetPartitionConfig();
-
- UNIT_ASSERT_VALUES_EQUAL(tableDescription.ColumnsSize(), 2);
- UNIT_ASSERT_VALUES_EQUAL(partConfig.ColumnFamiliesSize(), 1);
-
- const auto& mainFamily = partConfig.GetColumnFamilies(0);
- UNIT_ASSERT_VALUES_EQUAL(mainFamily.GetId(), 0);
- UNIT_ASSERT_VALUES_EQUAL(mainFamily.GetName(), "ExtBlobsOnHDD");
-
- UNIT_ASSERT_VALUES_EQUAL(tableDescription.GetColumns(0).GetFamily(), 0);
- };
-
+ Y_UNIT_TEST(DefaulColumnFamiliesWithNonCanonicName) { //+
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ runtime.GetAppData().AllowColumnFamiliesForTest = true;
+
+ TestAlterSubDomain(runtime, ++txId, "/", R"(
+ StoragePools {
+ Name: "pool-1"
+ Kind: "pool-kind-1"
+ }
+ StoragePools {
+ Name: "pool-2"
+ Kind: "pool-kind-2"
+ }
+ StoragePools {
+ Name: "name_USER_0_kind_hdd-1"
+ Kind: "hdd-1"
+ }
+ StoragePools {
+ Name: "name_USER_0_kind_hdd-2"
+ Kind: "hdd-2"
+ }
+ StoragePools {
+ Name: "name_USER_0_kind_hdd-3"
+ Kind: "hdd-3"
+ }
+ Name: "MyRoot"
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint32" FamilyName: "default" }
+ Columns { Name: "Value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ SplitBoundary { KeyPrefix {
+ Tuple { Optional { Uint32 : 100 } }
+ }}
+ SplitBoundary { KeyPrefix {
+ Tuple { Optional { Uint32 : 200 } }
+ }}
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ Name: "ExtBlobsOnHDD"
+ ColumnCodec: ColumnCodecPlain
+ ColumnCache: ColumnCacheNone
+ StorageConfig {
+ SysLog { PreferredPoolKind: "hdd-1" }
+ Log { PreferredPoolKind: "hdd-1" }
+ Data { PreferredPoolKind: "hdd-1" }
+ }
+ }
+ })", {NKikimrScheme::StatusSchemeError});
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint32" }
+ Columns { Name: "Value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ SplitBoundary { KeyPrefix {
+ Tuple { Optional { Uint32 : 100 } }
+ }}
+ SplitBoundary { KeyPrefix {
+ Tuple { Optional { Uint32 : 200 } }
+ }}
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ Name: "ExtBlobsOnHDD"
+ ColumnCodec: ColumnCodecPlain
+ ColumnCache: ColumnCacheNone
+ StorageConfig {
+ SysLog { PreferredPoolKind: "hdd-1" }
+ Log { PreferredPoolKind: "hdd-1" }
+ Data { PreferredPoolKind: "hdd-1" }
+ }
+ }
+ })");
+ env.TestWaitNotification(runtime, txId);
+
+ TestCopyTable(runtime, ++txId, "/MyRoot", "Table1Copy", "/MyRoot/Table1");
+ env.TestWaitNotification(runtime, txId);
+
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table1"
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ Name: "default"
+ }
+ })", {NKikimrScheme::StatusInvalidParameter});
+
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table1"
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ }
+ })");
+ env.TestWaitNotification(runtime, txId);
+
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table1"
+ PartitionConfig {
+ ColumnFamilies {
+ Name: "ExtBlobsOnHDD"
+ }
+ })");
+ env.TestWaitNotification(runtime, txId);
+
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table1"
+ Columns { Name: "key" Family: 0 FamilyName: "default" }
+ )", {NKikimrScheme::StatusInvalidParameter});
+
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table1"
+ Columns { Name: "Value" Family: 0 FamilyName: "default" }
+ )", {NKikimrScheme::StatusInvalidParameter});
+
+// https://st.yandex-team.ru/KIKIMR-10458
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table1"
+ Columns { Name: "key" Family: 0 FamilyName: "ExtBlobsOnHDD" }
+ )", {NKikimrScheme::StatusInvalidParameter});
+ env.TestWaitNotification(runtime, txId);
+
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table1"
+ Columns { Name: "Value" Family: 0 FamilyName: "ExtBlobsOnHDD" }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ auto descrChecker = [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ const NKikimrSchemeOp::TTableDescription& tableDescription = record.GetPathDescription().GetTable();
+ Cerr << "-----------\n" << tableDescription.DebugString() << "\n~~~~~~\n";
+
+ const auto& partConfig = tableDescription.GetPartitionConfig();
+
+ UNIT_ASSERT_VALUES_EQUAL(tableDescription.ColumnsSize(), 2);
+ UNIT_ASSERT_VALUES_EQUAL(partConfig.ColumnFamiliesSize(), 1);
+
+ const auto& mainFamily = partConfig.GetColumnFamilies(0);
+ UNIT_ASSERT_VALUES_EQUAL(mainFamily.GetId(), 0);
+ UNIT_ASSERT_VALUES_EQUAL(mainFamily.GetName(), "ExtBlobsOnHDD");
+
+ UNIT_ASSERT_VALUES_EQUAL(tableDescription.GetColumns(0).GetFamily(), 0);
+ };
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1", true),
- {NLs::ColumnFamiliesCount(1),
- NLs::ColumnFamiliesHas(0, "ExtBlobsOnHDD"),
- descrChecker});
-
+ {NLs::ColumnFamiliesCount(1),
+ NLs::ColumnFamiliesHas(0, "ExtBlobsOnHDD"),
+ descrChecker});
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1Copy", true),
- {descrChecker,
- NLs::ColumnFamiliesHas(0, "ExtBlobsOnHDD"),
- NLs::ColumnFamiliesCount(1)});
- }
-
-
- Y_UNIT_TEST(MultipleColumnFamiliesWithStorage) { //+
+ {descrChecker,
+ NLs::ColumnFamiliesHas(0, "ExtBlobsOnHDD"),
+ NLs::ColumnFamiliesCount(1)});
+ }
+
+
+ Y_UNIT_TEST(MultipleColumnFamiliesWithStorage) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
runtime.GetAppData().AllowColumnFamiliesForTest = true;
- TestAlterSubDomain(runtime, ++txId, "/", R"(
+ TestAlterSubDomain(runtime, ++txId, "/", R"(
StoragePools {
Name: "pool-1"
Kind: "pool-kind-1"
@@ -4897,7 +4897,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TVector<TFamilyExpectation> Families;
TVector<TRoomExpectation> Rooms;
- void operator()(const NKikimrSchemeOp::TTableDescription& tableDescription) const {
+ void operator()(const NKikimrSchemeOp::TTableDescription& tableDescription) const {
Cerr << "-----------\n" << tableDescription.DebugString() << "\n~~~~~~\n";
const auto& partConfig = tableDescription.GetPartitionConfig();
@@ -4960,8 +4960,8 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
}
}
- void operator()(const NKikimrScheme::TEvDescribeSchemeResult& record) const {
- UNIT_ASSERT_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
+ void operator()(const NKikimrScheme::TEvDescribeSchemeResult& record) const {
+ UNIT_ASSERT_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
// Schemeshard must return data without any mention of rooms
TSchemaChecker derived{ CheckName, Columns, Families, { } };
@@ -4976,7 +4976,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
auto checkSchema = [&] (const TSchemaChecker& checker) {
Cerr << "Checking tablets for Table1" << Endl;
for (ui64 tabletId : {TTestTxConfig::FakeHiveTablets+0, TTestTxConfig::FakeHiveTablets+1, TTestTxConfig::FakeHiveTablets+2}) {
- NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 2);
+ NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 2);
checker(tableDescription);
}
@@ -4985,7 +4985,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
};
// Creating a table with alt family on a different data storage should be OK
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table1"
Columns { Name: "key" Type: "Uint32" FamilyName: "default" }
Columns { Name: "Value" Type: "Utf8" FamilyName: "alt" }
@@ -5021,12 +5021,12 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
checkSchema({
"After initial create",
{ { 0 }, { 1 } },
- { { 0, "default", 0 }, { 1, "alt", 1 } },
+ { { 0, "default", 0 }, { 1, "alt", 1 } },
{ { 0, 1 }, { 1, 2 } }
});
// Trying to move default column family to the same storage should add default name
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table1"
PartitionConfig {
ColumnFamilies {
@@ -5046,7 +5046,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
});
// Trying to move alt column family to the same storage should succeed without changes
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table1"
PartitionConfig {
ColumnFamilies {
@@ -5066,7 +5066,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
});
// Trying to move default column family to a different storage
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table1"
PartitionConfig {
ColumnFamilies {
@@ -5086,7 +5086,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
});
// Trying to move alt column family to the same different storage should combine rooms
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table1"
PartitionConfig {
ColumnFamilies {
@@ -5106,7 +5106,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
});
// Trying to move alt column family to some older storage should reuse existing channel
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table1"
PartitionConfig {
ColumnFamilies {
@@ -5126,14 +5126,14 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
});
}
- NLs::TCheckFunc CheckCompactionPolicy(NKikimr::NLocalDb::TCompactionPolicyPtr expecedPolicy) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& describeRec) {
- NKikimr::NLocalDb::TCompactionPolicy realPolicy(describeRec.GetPathDescription().GetTable().GetPartitionConfig().GetCompactionPolicy());
- UNIT_ASSERT(realPolicy == *expecedPolicy);
- };
+ NLs::TCheckFunc CheckCompactionPolicy(NKikimr::NLocalDb::TCompactionPolicyPtr expecedPolicy) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& describeRec) {
+ NKikimr::NLocalDb::TCompactionPolicy realPolicy(describeRec.GetPathDescription().GetTable().GetPartitionConfig().GetCompactionPolicy());
+ UNIT_ASSERT(realPolicy == *expecedPolicy);
+ };
}
- Y_UNIT_TEST(AlterTableComapctionPolicy) { //+
+ Y_UNIT_TEST(AlterTableComapctionPolicy) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
@@ -5158,9 +5158,9 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
NKikimr::NLocalDb::TCompactionPolicyPtr policyInDatashard;
policyInDatashard = GetCompactionPolicy(runtime, datashardTabletId, 1001);
UNIT_ASSERT(*policyInDatashard == *defaultSystemTablePolicy);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {CheckCompactionPolicy(policyInDatashard),
- NLs::PathVersionEqual(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {CheckCompactionPolicy(policyInDatashard),
+ NLs::PathVersionEqual(3)});
// Invalid compaction policy name - should fail
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
@@ -5169,12 +5169,12 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
PartitionConfig {
NamedCompactionPolicy: "Non-existing policy"
}
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
policyInDatashard = GetCompactionPolicy(runtime, datashardTabletId, 1001);
UNIT_ASSERT(*policyInDatashard == *defaultSystemTablePolicy);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {CheckCompactionPolicy(policyInDatashard),
- NLs::PathVersionEqual(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {CheckCompactionPolicy(policyInDatashard),
+ NLs::PathVersionEqual(3)});
// Valid policy with more levels - should succeed
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
@@ -5187,9 +5187,9 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
env.TestWaitNotification(runtime, txId);
policyInDatashard = GetCompactionPolicy(runtime, datashardTabletId, 1001);
UNIT_ASSERT(*policyInDatashard == *defaultUserTablePolicy);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {CheckCompactionPolicy(policyInDatashard),
- NLs::PathVersionEqual(4)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {CheckCompactionPolicy(policyInDatashard),
+ NLs::PathVersionEqual(4)});
// Try to switch back to fewer levels - should fail
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
@@ -5197,12 +5197,12 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
PartitionConfig {
NamedCompactionPolicy: "SystemTableDefault"
}
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
policyInDatashard = GetCompactionPolicy(runtime, datashardTabletId, 1001);
UNIT_ASSERT(*policyInDatashard == *defaultUserTablePolicy);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {CheckCompactionPolicy(policyInDatashard),
- NLs::PathVersionEqual(4)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {CheckCompactionPolicy(policyInDatashard),
+ NLs::PathVersionEqual(4)});
}
Y_UNIT_TEST(AlterTableFollowers) { //+
@@ -5218,99 +5218,99 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
PartitionConfig {
FollowerCount: 100
}
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
Columns { Name: "key" Type: "Uint64"}
Columns { Name: "value" Type: "Utf8"}
KeyColumnNames: ["key"]
- PartitionConfig {
+ PartitionConfig {
FollowerCount: 1
CrossDataCenterFollowerCount: 1
- }
- )", {NKikimrScheme::StatusInvalidParameter});
-
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint64"}
- Columns { Name: "value" Type: "Utf8"}
- KeyColumnNames: ["key"]
- PartitionConfig {
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64"}
+ Columns { Name: "value" Type: "Utf8"}
+ KeyColumnNames: ["key"]
+ PartitionConfig {
FollowerCount: 1
FollowerGroups { }
- }
- )", {NKikimrScheme::StatusInvalidParameter});
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint64"}
- Columns { Name: "value" Type: "Utf8"}
- KeyColumnNames: ["key"]
- PartitionConfig {
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64"}
+ Columns { Name: "value" Type: "Utf8"}
+ KeyColumnNames: ["key"]
+ PartitionConfig {
CrossDataCenterFollowerCount: 1
FollowerGroups { }
- }
- )", {NKikimrScheme::StatusInvalidParameter});
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint64"}
- Columns { Name: "value" Type: "Utf8"}
- KeyColumnNames: ["key"]
- PartitionConfig {
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64"}
+ Columns { Name: "value" Type: "Utf8"}
+ KeyColumnNames: ["key"]
+ PartitionConfig {
FollowerCount: 1
CrossDataCenterFollowerCount: 1
FollowerGroups { }
- }
- )", {NKikimrScheme::StatusInvalidParameter});
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint64"}
- Columns { Name: "value" Type: "Utf8"}
- KeyColumnNames: ["key"]
- PartitionConfig {
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64"}
+ Columns { Name: "value" Type: "Utf8"}
+ KeyColumnNames: ["key"]
+ PartitionConfig {
FollowerGroups { }
FollowerGroups { }
- }
- )", {NKikimrScheme::StatusInvalidParameter});
-
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint64"}
- Columns { Name: "value" Type: "Utf8"}
- KeyColumnNames: ["key"]
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64"}
+ Columns { Name: "value" Type: "Utf8"}
+ KeyColumnNames: ["key"]
)");
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(1)});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(1)});
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(0),
NLs::CrossDataCenterFollowerCount(0),
NLs::AllowFollowerPromotion(true),
NLs::FollowerGroups({})
- });
-
+ });
+
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
PartitionConfig {
FollowerCount: 100
AllowFollowerPromotion: true
}
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
PartitionConfig {
CrossDataCenterFollowerCount: 100
AllowFollowerPromotion: true
}
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
@@ -5320,19 +5320,19 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
}
)");
env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(1)});
-
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(1)});
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(2),
NLs::CrossDataCenterFollowerCount(0),
NLs::AllowFollowerPromotion(true),
NLs::FollowerGroups({})
- });
+ });
- //////////
+ //////////
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
DropColumns { Name: "value" }
@@ -5341,20 +5341,20 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
}
)");
env.TestWaitNotification(runtime, txId);
-
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(1),
NLs::CrossDataCenterFollowerCount(0),
NLs::AllowFollowerPromotion(true),
NLs::FollowerGroups({})
- });
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(1)});
+ });
-
- //////////
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(1)});
+
+
+ //////////
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
Columns { Name: "value" Type: "Utf8" }
@@ -5365,14 +5365,14 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
env.TestWaitNotification(runtime, txId);
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(1),
NLs::CrossDataCenterFollowerCount(0),
NLs::AllowFollowerPromotion(false),
NLs::FollowerGroups({})
- });
-
- //////////
+ });
+
+ //////////
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
PartitionConfig {
@@ -5383,14 +5383,14 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
env.TestWaitNotification(runtime, txId);
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(1),
NLs::CrossDataCenterFollowerCount(0),
NLs::AllowFollowerPromotion(true),
NLs::FollowerGroups({})
- });
-
- //////////
+ });
+
+ //////////
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
PartitionConfig {
@@ -5401,14 +5401,14 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
env.TestWaitNotification(runtime, txId);
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(0),
NLs::CrossDataCenterFollowerCount(0),
NLs::AllowFollowerPromotion(false),
NLs::FollowerGroups({})
- });
-
- //////////
+ });
+
+ //////////
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
PartitionConfig {
@@ -5419,14 +5419,14 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
env.TestWaitNotification(runtime, txId);
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(0),
NLs::CrossDataCenterFollowerCount(1),
NLs::AllowFollowerPromotion(true),
NLs::FollowerGroups({})
- });
-
- //////////
+ });
+
+ //////////
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
PartitionConfig {
@@ -5436,14 +5436,14 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
env.TestWaitNotification(runtime, txId);
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(0),
NLs::CrossDataCenterFollowerCount(0),
NLs::AllowFollowerPromotion(true),
NLs::FollowerGroups({})
- });
-
- //////////
+ });
+
+ //////////
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
PartitionConfig {
@@ -5451,274 +5451,274 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
}
)");
env.TestWaitNotification(runtime, txId);
-
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(0),
NLs::CrossDataCenterFollowerCount(0),
NLs::AllowFollowerPromotion(false),
NLs::FollowerGroups({})
- });
-
- //////////
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
+ });
+
+ //////////
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
CrossDataCenterFollowerCount: 2
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(0),
NLs::CrossDataCenterFollowerCount(2),
NLs::AllowFollowerPromotion(false),
NLs::FollowerGroups({})
- });
-
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
+ });
+
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
FollowerCount: 1
- }
- )", {NKikimrScheme::StatusInvalidParameter});
- env.TestWaitNotification(runtime, txId);
-
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+ env.TestWaitNotification(runtime, txId);
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(0),
NLs::CrossDataCenterFollowerCount(2),
NLs::AllowFollowerPromotion(false),
NLs::FollowerGroups({})
- });
-
- /////////
- {
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
+ });
+
+ /////////
+ {
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
FollowerGroups {
FollowerCount: 1
- }
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
+ }
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
NKikimrHive::TFollowerGroup control;
control.SetFollowerCount(1);
-
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(0),
NLs::CrossDataCenterFollowerCount(0),
NLs::AllowFollowerPromotion(false),
NLs::FollowerGroups({control})
- });
- }
-
- /////////
- {
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
+ });
+ }
+
+ /////////
+ {
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
FollowerCount: 1
- }
- )", {NKikimrScheme::StatusInvalidParameter});
- env.TestWaitNotification(runtime, txId);
-
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+ env.TestWaitNotification(runtime, txId);
+
NKikimrHive::TFollowerGroup control;
control.SetFollowerCount(1);
-
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(0),
NLs::CrossDataCenterFollowerCount(0),
NLs::AllowFollowerPromotion(false),
NLs::FollowerGroups({control})
- });
- }
-
- /////////
- {
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
+ });
+ }
+
+ /////////
+ {
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
CrossDataCenterFollowerCount: 2
- }
- )", {NKikimrScheme::StatusInvalidParameter});
- env.TestWaitNotification(runtime, txId);
-
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+ env.TestWaitNotification(runtime, txId);
+
NKikimrHive::TFollowerGroup control;
control.SetFollowerCount(1);
-
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(0),
NLs::CrossDataCenterFollowerCount(0),
NLs::AllowFollowerPromotion(false),
NLs::FollowerGroups({control})
- });
- }
-
- //////////
- {
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
+ });
+ }
+
+ //////////
+ {
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
AllowFollowerPromotion: false
- }
- )", {NKikimrScheme::StatusInvalidParameter});
- env.TestWaitNotification(runtime, txId);
-
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+ env.TestWaitNotification(runtime, txId);
+
NKikimrHive::TFollowerGroup control;
control.SetFollowerCount(1);
-
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(0),
NLs::CrossDataCenterFollowerCount(0),
NLs::AllowFollowerPromotion(false),
NLs::FollowerGroups({control})
- });
- }
-
- ////////////
- {
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
+ });
+ }
+
+ ////////////
+ {
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
FollowerGroups {
FollowerCount: 10
AllowLeaderPromotion: false
- RequireAllDataCenters: true
- }
- }
- )", {NKikimrScheme::StatusInvalidParameter});
- env.TestWaitNotification(runtime, txId);
-
+ RequireAllDataCenters: true
+ }
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+ env.TestWaitNotification(runtime, txId);
+
NKikimrHive::TFollowerGroup control;
control.SetFollowerCount(1);
-
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(0),
NLs::CrossDataCenterFollowerCount(0),
NLs::AllowFollowerPromotion(false),
NLs::FollowerGroups({control})
- });
- }
-
- ////////////
- {
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
+ });
+ }
+
+ ////////////
+ {
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
FollowerGroups {
- LocalNodeOnly: true
- }
- }
- )", {NKikimrScheme::StatusInvalidParameter});
- env.TestWaitNotification(runtime, txId);
-
+ LocalNodeOnly: true
+ }
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+ env.TestWaitNotification(runtime, txId);
+
NKikimrHive::TFollowerGroup control;
control.SetFollowerCount(1);
-
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(0),
NLs::CrossDataCenterFollowerCount(0),
NLs::AllowFollowerPromotion(false),
NLs::FollowerGroups({control})
- });
- }
-
- ////////////
- {
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
+ });
+ }
+
+ ////////////
+ {
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
FollowerGroups {
- RequireDifferentNodes: true
- }
- }
- )", {NKikimrScheme::StatusInvalidParameter});
- env.TestWaitNotification(runtime, txId);
-
+ RequireDifferentNodes: true
+ }
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+ env.TestWaitNotification(runtime, txId);
+
NKikimrHive::TFollowerGroup control;
control.SetFollowerCount(1);
-
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(0),
NLs::CrossDataCenterFollowerCount(0),
NLs::AllowFollowerPromotion(false),
NLs::FollowerGroups({control})
- });
- }
-
- ////////////
- {
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
+ });
+ }
+
+ ////////////
+ {
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
FollowerGroups {
FollowerCount: 3
AllowLeaderPromotion: true
- RequireAllDataCenters: true
- }
+ RequireAllDataCenters: true
+ }
FollowerGroups {
FollowerCount: 3
AllowLeaderPromotion: true
- RequireAllDataCenters: true
- }
- }
- )", {NKikimrScheme::StatusInvalidParameter});
- env.TestWaitNotification(runtime, txId);
-
+ RequireAllDataCenters: true
+ }
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+ env.TestWaitNotification(runtime, txId);
+
NKikimrHive::TFollowerGroup control;
control.SetFollowerCount(1);
-
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(0),
NLs::CrossDataCenterFollowerCount(0),
NLs::AllowFollowerPromotion(false),
NLs::FollowerGroups({control})
- });
- }
-
- ////////////
- {
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
+ });
+ }
+
+ ////////////
+ {
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
FollowerGroups {
FollowerCount: 3
AllowLeaderPromotion: true
- RequireAllDataCenters: true
- }
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
+ RequireAllDataCenters: true
+ }
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
NKikimrHive::TFollowerGroup control;
control.SetFollowerCount(3);
control.SetAllowLeaderPromotion(true);
- control.SetRequireAllDataCenters(true);
-
+ control.SetRequireAllDataCenters(true);
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {
+ {
NLs::FollowerCount(0),
NLs::CrossDataCenterFollowerCount(0),
NLs::AllowFollowerPromotion(false),
NLs::FollowerGroups({control})
- });
- }
+ });
+ }
}
- Y_UNIT_TEST(AlterTableSizeToSplit) { //+
+ Y_UNIT_TEST(AlterTableSizeToSplit) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
@@ -5731,8 +5731,8 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
)");
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::SizeToSplitEqual(0)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::SizeToSplitEqual(0)});
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table"
@@ -5744,17 +5744,17 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
)");
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::SizeToSplitEqual(100500)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::SizeToSplitEqual(100500)});
}
- Y_UNIT_TEST(AlterTableSplitSchema) { //+
+ Y_UNIT_TEST(AlterTableSplitSchema) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
auto schemaChecker = [](TVector<TString> columns) {
- return [=] (const NKikimrSchemeOp::TTableDescription& tableDescription) {
+ return [=] (const NKikimrSchemeOp::TTableDescription& tableDescription) {
UNIT_ASSERT_VALUES_EQUAL(tableDescription.ColumnsSize(), columns.size());
for (size_t idx = 0; idx < tableDescription.ColumnsSize(); ++idx) {
UNIT_ASSERT_VALUES_EQUAL_C(tableDescription.GetColumns(idx).GetName(), columns[idx],
@@ -5767,13 +5767,13 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
auto checker = schemaChecker(std::move(columns));
for (int tabletIdx : tabletIdxs) {
ui64 tabletId = TTestTxConfig::FakeHiveTablets + tabletIdx;
- NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 2);
+ NKikimrSchemeOp::TTableDescription tableDescription = GetDatashardSchema(runtime, tabletId, 2);
checker(tableDescription);
}
};
// Creating a table with initial columns
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table1"
Columns { Name: "Key" Type: "Uint32" }
Columns { Name: "Value" Type: "Utf8" }
@@ -5790,7 +5790,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
checkSchema({ 0, 1, 2 }, { "Key", "Value" });
// Alter table adding more volumns
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "Table1"
Columns { Name: "Add1" Type: "Uint32" }
Columns { Name: "Add2" Type: "Uint32" }
@@ -5800,7 +5800,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
checkSchema({ 0, 1, 2 }, { "Key", "Value", "Add1", "Add2" });
// Split the middle tablet in two
- TestSplitTable(runtime, ++txId, "/MyRoot/Table1", R"(
+ TestSplitTable(runtime, ++txId, "/MyRoot/Table1", R"(
SourceTabletId: 9437195
SplitBoundary { KeyPrefix {
Tuple { Optional { Uint32 : 150 } }
@@ -5811,23 +5811,23 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
checkSchema({ 0, 3, 4, 2 }, { "Key", "Value", "Add1", "Add2" });
}
- Y_UNIT_TEST(AlterTableSettings) { //+
+ Y_UNIT_TEST(AlterTableSettings) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
struct TCheckExecutorFastLogPolicy {
bool ExpectedValue;
- void operator ()(const NKikimrScheme::TEvDescribeSchemeResult& describeRec) {
- bool real = describeRec.GetPathDescription().GetTable().GetPartitionConfig().GetExecutorFastLogPolicy();
+ void operator ()(const NKikimrScheme::TEvDescribeSchemeResult& describeRec) {
+ bool real = describeRec.GetPathDescription().GetTable().GetPartitionConfig().GetExecutorFastLogPolicy();
UNIT_ASSERT_VALUES_EQUAL(ExpectedValue, real);
}
};
struct TCheckEnableFilterByKey {
bool ExpectedValue;
- void operator ()(const NKikimrScheme::TEvDescribeSchemeResult& describeRec) {
- bool real = describeRec.GetPathDescription().GetTable().GetPartitionConfig().GetEnableFilterByKey();
+ void operator ()(const NKikimrScheme::TEvDescribeSchemeResult& describeRec) {
+ bool real = describeRec.GetPathDescription().GetTable().GetPartitionConfig().GetEnableFilterByKey();
UNIT_ASSERT_VALUES_EQUAL(ExpectedValue, real);
}
};
@@ -5839,10 +5839,10 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
KeyColumnNames: ["key"]
)");
env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {TCheckExecutorFastLogPolicy{true},
- TCheckEnableFilterByKey{false}});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {TCheckExecutorFastLogPolicy{true},
+ TCheckEnableFilterByKey{false}});
UNIT_ASSERT_VALUES_EQUAL_C(true, GetFastLogPolicy(runtime, TTestTxConfig::FakeHiveTablets), "FastLogPolicy must be enabled by default");
UNIT_ASSERT_VALUES_EQUAL_C(false, GetByKeyFilterEnabled(runtime, TTestTxConfig::FakeHiveTablets, 1001), "ByKeyFilter must be disabled by default");
@@ -5853,10 +5853,10 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
}
)");
env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {TCheckExecutorFastLogPolicy{false},
- TCheckEnableFilterByKey{false}});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {TCheckExecutorFastLogPolicy{false},
+ TCheckEnableFilterByKey{false}});
UNIT_ASSERT_VALUES_EQUAL(false, GetFastLogPolicy(runtime, TTestTxConfig::FakeHiveTablets));
UNIT_ASSERT_VALUES_EQUAL(false, GetByKeyFilterEnabled(runtime, TTestTxConfig::FakeHiveTablets, 1001));
@@ -5867,10 +5867,10 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
}
)");
env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {TCheckExecutorFastLogPolicy{false},
- TCheckEnableFilterByKey{true}});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {TCheckExecutorFastLogPolicy{false},
+ TCheckEnableFilterByKey{true}});
UNIT_ASSERT_VALUES_EQUAL(false, GetFastLogPolicy(runtime, TTestTxConfig::FakeHiveTablets));
UNIT_ASSERT_VALUES_EQUAL(true, GetByKeyFilterEnabled(runtime, TTestTxConfig::FakeHiveTablets, 1001));
@@ -5881,10 +5881,10 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
}
)");
env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {TCheckExecutorFastLogPolicy{false},
- TCheckEnableFilterByKey{true}});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {TCheckExecutorFastLogPolicy{false},
+ TCheckEnableFilterByKey{true}});
UNIT_ASSERT_VALUES_EQUAL(false, GetFastLogPolicy(runtime, TTestTxConfig::FakeHiveTablets));
UNIT_ASSERT_VALUES_EQUAL(true, GetByKeyFilterEnabled(runtime, TTestTxConfig::FakeHiveTablets, 1001));
UNIT_ASSERT_VALUES_EQUAL(true, GetEraseCacheEnabled(runtime, TTestTxConfig::FakeHiveTablets, 1001));
@@ -5896,10 +5896,10 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
}
)");
env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {TCheckExecutorFastLogPolicy{false},
- TCheckEnableFilterByKey{true}});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {TCheckExecutorFastLogPolicy{false},
+ TCheckEnableFilterByKey{true}});
UNIT_ASSERT_VALUES_EQUAL(false, GetFastLogPolicy(runtime, TTestTxConfig::FakeHiveTablets));
UNIT_ASSERT_VALUES_EQUAL(true, GetByKeyFilterEnabled(runtime, TTestTxConfig::FakeHiveTablets, 1001));
UNIT_ASSERT_VALUES_EQUAL(false, GetEraseCacheEnabled(runtime, TTestTxConfig::FakeHiveTablets, 1001));
@@ -5912,71 +5912,71 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
}
)");
env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {TCheckExecutorFastLogPolicy{true},
- TCheckEnableFilterByKey{false}});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {TCheckExecutorFastLogPolicy{true},
+ TCheckEnableFilterByKey{false}});
UNIT_ASSERT_VALUES_EQUAL(true, GetFastLogPolicy(runtime, TTestTxConfig::FakeHiveTablets));
UNIT_ASSERT_VALUES_EQUAL(false, GetByKeyFilterEnabled(runtime, TTestTxConfig::FakeHiveTablets, 1001));
UNIT_ASSERT_VALUES_EQUAL(false, GetEraseCacheEnabled(runtime, TTestTxConfig::FakeHiveTablets, 1001));
}
- Y_UNIT_TEST(CreatePersQueueGroup) { //+
+ Y_UNIT_TEST(CreatePersQueueGroup) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 1000;
- AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
- AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", "");
- AsyncCreatePQGroup(runtime, ++txId, "/MyRoot/DirA",
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
+ AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", "");
+ AsyncCreatePQGroup(runtime, ++txId, "/MyRoot/DirA",
"Name: \"PQGroup_2\""
"TotalGroupCount: 10 "
"PartitionPerTablet: 10 "
- "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}");
- AsyncCreatePQGroup(runtime, ++txId, "/MyRoot/DirA",
+ "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}");
+ AsyncCreatePQGroup(runtime, ++txId, "/MyRoot/DirA",
"Name: \"PQGroup_3\""
"TotalGroupCount: 10 "
"PartitionPerTablet: 3 "
- "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}");
- TestModificationResult(runtime, txId-3, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusSchemeError);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
- env.TestWaitNotification(runtime, {txId-3, txId-2, txId-1, txId});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::Finished,
- NLs::PathsInsideDomain(3),
- NLs::ShardsInsideDomain(7)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup_2", true),
- {NLs::CheckPartCount("PQGroup_2", 10, 10, 1, 10)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup_3", true),
- {NLs::CheckPartCount("PQGroup_3", 10, 3, 4, 10)});
-
- TestCreatePQGroup(runtime, ++txId, "/MyRoot/DirA",
+ "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}");
+ TestModificationResult(runtime, txId-3, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusSchemeError);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+ env.TestWaitNotification(runtime, {txId-3, txId-2, txId-1, txId});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::Finished,
+ NLs::PathsInsideDomain(3),
+ NLs::ShardsInsideDomain(7)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup_2", true),
+ {NLs::CheckPartCount("PQGroup_2", 10, 10, 1, 10)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup_3", true),
+ {NLs::CheckPartCount("PQGroup_3", 10, 3, 4, 10)});
+
+ TestCreatePQGroup(runtime, ++txId, "/MyRoot/DirA",
"Name: \"PQGroup_1\""
"TotalGroupCount: 100 "
"PartitionPerTablet: 10 "
"PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}"
);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup_1", true),
- {NLs::PathsInsideDomain(4),
- NLs::ShardsInsideDomain(18),
- NLs::PathVersionEqual(1),
- NLs::NotFinished});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup_1", true),
+ {NLs::PathsInsideDomain(4),
+ NLs::ShardsInsideDomain(18),
+ NLs::PathVersionEqual(1),
+ NLs::NotFinished});
TActorId sender = runtime.AllocateEdgeActor();
RebootTablet(runtime, TTestTxConfig::SchemeShard, sender);
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup_1", true),
- {NLs::CheckPartCount("PQGroup_1", 100, 10, 10, 100),
- NLs::PathsInsideDomain(4),
- NLs::ShardsInsideDomain(18),
- NLs::PathVersionEqual(2),
- NLs::Finished});
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup_1", true),
+ {NLs::CheckPartCount("PQGroup_1", 100, 10, 10, 100),
+ NLs::PathsInsideDomain(4),
+ NLs::ShardsInsideDomain(18),
+ NLs::PathVersionEqual(2),
+ NLs::Finished});
}
Y_UNIT_TEST(AlterPersQueueGroup) { //+
@@ -5984,108 +5984,108 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TTestEnv env(runtime);
ui64 txId = 1000;
- TestCreatePQGroup(runtime, ++txId, "/MyRoot",
+ TestCreatePQGroup(runtime, ++txId, "/MyRoot",
"Name: \"PQGroup\""
"TotalGroupCount: 4 "
"PartitionPerTablet: 3 "
"PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/PQGroup"),
- {NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(3)});
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/PQGroup"),
+ {NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(3)});
// invalid params
- TestAlterPQGroup(runtime, ++txId, "/MyRoot",
+ TestAlterPQGroup(runtime, ++txId, "/MyRoot",
"Name: \"PQGroup\""
"TotalGroupCount: 3 "
"PartitionPerTablet: 3 ",
- {NKikimrScheme::StatusInvalidParameter});
- TestAlterPQGroup(runtime, ++txId, "/MyRoot",
+ {NKikimrScheme::StatusInvalidParameter});
+ TestAlterPQGroup(runtime, ++txId, "/MyRoot",
"Name: \"PQGroup\""
"TotalGroupCount: 4 "
"PartitionPerTablet: 2 ",
- {NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusInvalidParameter});
// TODO: describe + alter by PathId
// same sizes - reconfig
- TestAlterPQGroup(runtime, ++txId, "/MyRoot",
+ TestAlterPQGroup(runtime, ++txId, "/MyRoot",
"Name: \"PQGroup\""
"PartitionPerTablet: 3 "); // do not change TotalGroupCount
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/PQGroup", true),
- {NLs::CheckPartCount("PQGroup", 4, 3, 2, 4),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(3)});
-
- TestAlterPQGroup(runtime, ++txId, "/MyRoot",
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/PQGroup", true),
+ {NLs::CheckPartCount("PQGroup", 4, 3, 2, 4),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(3)});
+
+ TestAlterPQGroup(runtime, ++txId, "/MyRoot",
"Name: \"PQGroup\""
"TotalGroupCount: 6 "
"PartitionPerTablet: 3 "
"PQTabletConfig: {PartitionConfig { LifetimeSeconds : 42}}");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/PQGroup", true),
- {NLs::CheckPartCount("PQGroup", 6, 3, 2, 6),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(3)});
-
- TestAlterPQGroup(runtime, ++txId, "/MyRoot",
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/PQGroup", true),
+ {NLs::CheckPartCount("PQGroup", 6, 3, 2, 6),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(3)});
+
+ TestAlterPQGroup(runtime, ++txId, "/MyRoot",
"Name: \"PQGroup\""
"TotalGroupCount: 8 "); // do not change PartitionPerTablet
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/PQGroup", true),
- {NLs::CheckPartCount("PQGroup", 8, 3, 3, 8),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(4)});
-
- TestAlterPQGroup(runtime, ++txId, "/MyRoot",
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/PQGroup", true),
+ {NLs::CheckPartCount("PQGroup", 8, 3, 3, 8),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(4)});
+
+ TestAlterPQGroup(runtime, ++txId, "/MyRoot",
"Name: \"PQGroup\""
"TotalGroupCount: 8 "
"PartitionPerTablet: 4 ");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/PQGroup", true),
- {NLs::CheckPartCount("PQGroup", 8, 4, 3, 8),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(4)});
-
- TestAlterPQGroup(runtime, ++txId, "/MyRoot",
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/PQGroup", true),
+ {NLs::CheckPartCount("PQGroup", 8, 4, 3, 8),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(4)});
+
+ TestAlterPQGroup(runtime, ++txId, "/MyRoot",
"Name: \"PQGroup\""
"TotalGroupCount: 14 "
"PartitionPerTablet: 4 ");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/PQGroup", true),
- {NLs::CheckPartCount("PQGroup", 14, 4, 4, 14),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(5)});
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/PQGroup", true),
+ {NLs::CheckPartCount("PQGroup", 14, 4, 4, 14),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(5)});
// Alter + Alter + reboot
- TestAlterPQGroup(runtime, ++txId, "/MyRoot",
+ TestAlterPQGroup(runtime, ++txId, "/MyRoot",
"Name: \"PQGroup\""
"TotalGroupCount: 400 "
"PartitionPerTablet: 10 ");
- TestAlterPQGroup(runtime, ++txId, "/MyRoot", "Name: \"PQGroup\"",
- {NKikimrScheme::StatusMultipleModifications});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/PQGroup", true),
- {NLs::CheckPartCount("PQGroup", 14, 4, 4, 14, NKikimrSchemeOp::EPathStateAlter),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(41)});
-
-
+ TestAlterPQGroup(runtime, ++txId, "/MyRoot", "Name: \"PQGroup\"",
+ {NKikimrScheme::StatusMultipleModifications});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/PQGroup", true),
+ {NLs::CheckPartCount("PQGroup", 14, 4, 4, 14, NKikimrSchemeOp::EPathStateAlter),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(41)});
+
+
TActorId sender = runtime.AllocateEdgeActor();
RebootTablet(runtime, TTestTxConfig::SchemeShard, sender);
env.TestWaitNotification(runtime, txId-1);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/PQGroup", true),
- {NLs::CheckPartCount("PQGroup", 400, 10, 40, 400),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(41)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/PQGroup", true),
+ {NLs::CheckPartCount("PQGroup", 400, 10, 40, 400),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(41)});
}
Y_UNIT_TEST(CreatePersQueueGroupWithKeySchema) {
@@ -6105,7 +6105,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
PartitionBoundaries {
Tuple { Optional { Uint32: 1000 } }
}
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
// Missing key schema
TestCreatePQGroup(runtime, ++txId, "/MyRoot", R"(
@@ -6118,7 +6118,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
PartitionBoundaries {
Tuple { Optional { Uint32: 1000 } }
}
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
// Invalid partition boundary
TestCreatePQGroup(runtime, ++txId, "/MyRoot", R"(
@@ -6133,7 +6133,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
Tuple { Optional { Uint32: 1000 } }
Tuple { Optional { Uint32: 2000 } }
}
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
// Invalid type
TestCreatePQGroup(runtime, ++txId, "/MyRoot", R"(
@@ -6147,7 +6147,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
PartitionBoundaries {
Tuple { Optional { Uint32: 1000 } }
}
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
TestCreatePQGroup(runtime, ++txId, "/MyRoot", R"(
Name: "PQGroup1"
@@ -6219,13 +6219,13 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TestAlterPQGroup(runtime, ++txId, "/MyRoot", R"(
Name: "PQGroup"
TotalGroupCount: 2
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
// add partitions
TestAlterPQGroup(runtime, ++txId, "/MyRoot", R"(
Name: "PQGroup"
PartitionsToAdd { PartitionId: 1 GroupId: 1 }
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
// change key schema
TestAlterPQGroup(runtime, ++txId, "/MyRoot", R"(
@@ -6233,10 +6233,10 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
PQTabletConfig {
PartitionKeySchema { Name: "key2" TypeId: 2 }
}
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
}
- Y_UNIT_TEST(DropTable) { //+
+ Y_UNIT_TEST(DropTable) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 1000;
@@ -6254,51 +6254,51 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
"KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
"UniformPartitionsCount: 10";
- TestMkDir(runtime, ++txId, "/MyRoot", "Ops");
+ TestMkDir(runtime, ++txId, "/MyRoot", "Ops");
- TestDropTable(runtime, ++txId, "/MyRoot/Ops", "Table", {NKikimrScheme::StatusPathDoesNotExist});
+ TestDropTable(runtime, ++txId, "/MyRoot/Ops", "Table", {NKikimrScheme::StatusPathDoesNotExist});
Cdbg << "Create, Drop (simple table)" << Endl;
- TestCreateTable(runtime, ++txId, "/MyRoot/Ops", tcfg1);
- env.TestWaitNotification(runtime, txId);
+ TestCreateTable(runtime, ++txId, "/MyRoot/Ops", tcfg1);
+ env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/Table", true),
- {NLs::Finished});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/Table", true),
+ {NLs::Finished});
TestRmDir(runtime, ++txId, "/MyRoot", "Ops", {NKikimrScheme::StatusNameConflict});
- TestDropTable(runtime, ++txId, "/MyRoot/Ops", "Table");
- env.TestWaitNotification(runtime, txId);
+ TestDropTable(runtime, ++txId, "/MyRoot/Ops", "Table");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/Table"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops"),
+ {NLs::NoChildren});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/Table"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops"),
- {NLs::NoChildren});
-
env.TestWaitTabletDeletion(runtime, TTestTxConfig::FakeHiveTablets);
-
-
+
+
Cdbg << "Create, Drop (partitioned table)" << Endl;
- TestCreateTable(runtime, ++txId, "/MyRoot/Ops", tcfg2);
- env.TestWaitNotification(runtime, txId);
+ TestCreateTable(runtime, ++txId, "/MyRoot/Ops", tcfg2);
+ env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/PartTable", true),
- {NLs::Finished});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/PartTable", true),
+ {NLs::Finished});
TestRmDir(runtime, ++txId, "/MyRoot", "Ops", {NKikimrScheme::StatusNameConflict});
-
- TestDropTable(runtime, ++txId, "/MyRoot/Ops", "PartTable");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/Table"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops"),
- {NLs::NoChildren});
-
+
+ TestDropTable(runtime, ++txId, "/MyRoot/Ops", "PartTable");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/Table"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops"),
+ {NLs::NoChildren});
+
env.TestWaitTabletDeletion(runtime, TTestTxConfig::FakeHiveTablets+1);
}
- Y_UNIT_TEST(DropTableById) { //+
+ Y_UNIT_TEST(DropTableById) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 1000;
@@ -6314,21 +6314,21 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TestCreateTable(runtime, ++txId, "/MyRoot", tcfg);
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::Finished});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::Finished});
+
TestDropTable(runtime, ++txId, 2);
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::NoChildren});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::NoChildren});
+
env.TestWaitTabletDeletion(runtime, TTestTxConfig::FakeHiveTablets);
}
- Y_UNIT_TEST(DropPQ) { //+
+ Y_UNIT_TEST(DropPQ) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 1000;
@@ -6351,106 +6351,106 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TString pqGroupAlter = "Name: \"DropMeBaby\""
"TotalGroupCount: 3 ";
- TestMkDir(runtime, ++txId, "/MyRoot", "Ops");
+ TestMkDir(runtime, ++txId, "/MyRoot", "Ops");
+
+ TestDropPQGroup(runtime, ++txId, "/MyRoot/Ops", "DropMeBaby", {NKikimrScheme::StatusPathDoesNotExist});
- TestDropPQGroup(runtime, ++txId, "/MyRoot/Ops", "DropMeBaby", {NKikimrScheme::StatusPathDoesNotExist});
+ TestCreatePQGroup(runtime, ++txId, "/MyRoot/Ops", pqGroupConfig);
+ env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
- TestCreatePQGroup(runtime, ++txId, "/MyRoot/Ops", pqGroupConfig);
- env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops"),
+ {NLs::Finished});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops"),
- {NLs::Finished});
-
TestRmDir(runtime, ++txId, "/MyRoot", "Ops", {NKikimrScheme::StatusNameConflict});
- TestDropPQGroup(runtime, ++txId, "/MyRoot/Ops", "DropMeBaby");
- env.TestWaitNotification(runtime, txId);
+ TestDropPQGroup(runtime, ++txId, "/MyRoot/Ops", "DropMeBaby");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops"),
+ {NLs::NoChildren});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/DropMeBaby"),
+ {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops"),
- {NLs::NoChildren});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/DropMeBaby"),
- {NLs::PathNotExist});
-
// check config after Drop
- TestCreatePQGroup(runtime, ++txId, "/MyRoot/Ops", pqGroupConfig1);
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/DropMeBaby", true),
- {NLs::CheckPartCount("DropMeBaby", 2, 1, 2, 2)});
-
- TestAlterPQGroup(runtime, ++txId, "/MyRoot/Ops", pqGroupAlter);
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/DropMeBaby", true),
- {NLs::CheckPartCount("DropMeBaby", 3, 1, 3, 3)});
-
- TestDropPQGroup(runtime, ++txId, "/MyRoot/Ops", "DropMeBaby");
- env.TestWaitNotification(runtime, txId);
-
- TestCreatePQGroup(runtime, ++txId, "/MyRoot/Ops", pqGroupConfig1);
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/DropMeBaby", true),
- {NLs::CheckPartCount("DropMeBaby", 2, 1, 2, 2)});
-
- TestDropPQGroup(runtime, ++txId, "/MyRoot/Ops", "DropMeBaby");
- env.TestWaitNotification(runtime, txId);
+ TestCreatePQGroup(runtime, ++txId, "/MyRoot/Ops", pqGroupConfig1);
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/DropMeBaby", true),
+ {NLs::CheckPartCount("DropMeBaby", 2, 1, 2, 2)});
+
+ TestAlterPQGroup(runtime, ++txId, "/MyRoot/Ops", pqGroupAlter);
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/DropMeBaby", true),
+ {NLs::CheckPartCount("DropMeBaby", 3, 1, 3, 3)});
+
+ TestDropPQGroup(runtime, ++txId, "/MyRoot/Ops", "DropMeBaby");
+ env.TestWaitNotification(runtime, txId);
+
+ TestCreatePQGroup(runtime, ++txId, "/MyRoot/Ops", pqGroupConfig1);
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/DropMeBaby", true),
+ {NLs::CheckPartCount("DropMeBaby", 2, 1, 2, 2)});
+
+ TestDropPQGroup(runtime, ++txId, "/MyRoot/Ops", "DropMeBaby");
+ env.TestWaitNotification(runtime, txId);
//
- TestCreateTable(runtime, ++txId, "/MyRoot/Ops", tableConfig);
- env.TestWaitNotification(runtime, txId);
+ TestCreateTable(runtime, ++txId, "/MyRoot/Ops", tableConfig);
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/DropMeBaby", true),
+ {NLs::Finished});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/DropMeBaby", true),
- {NLs::Finished});
-
TestRmDir(runtime, ++txId, "/MyRoot", "Ops", {NKikimrScheme::StatusNameConflict});
- TestDropTable(runtime, ++txId, "/MyRoot/Ops", "DropMeBaby");
- env.TestWaitNotification(runtime, txId);
+ TestDropTable(runtime, ++txId, "/MyRoot/Ops", "DropMeBaby");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops"),
+ {NLs::NoChildren});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/DropMeBaby"),
+ {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops"),
- {NLs::NoChildren});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/DropMeBaby"),
- {NLs::PathNotExist});
-
//
Cdbg << "Create + Drop + Drop" << Endl;
- AsyncCreatePQGroup(runtime, ++txId, "/MyRoot/Ops", pqGroupConfig);
- auto pVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/DropMeBaby"));
- AsyncDropPQGroup(runtime, ++txId, "/MyRoot/Ops", "DropMeBaby");
- AsyncForceDropUnsafe(runtime, ++txId, pVer.PathId.LocalPathId);
-
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
-
+ AsyncCreatePQGroup(runtime, ++txId, "/MyRoot/Ops", pqGroupConfig);
+ auto pVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/DropMeBaby"));
+ AsyncDropPQGroup(runtime, ++txId, "/MyRoot/Ops", "DropMeBaby");
+ AsyncForceDropUnsafe(runtime, ++txId, pVer.PathId.LocalPathId);
+
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+
TActorId sender = runtime.AllocateEdgeActor();
RebootTablet(runtime, TTestTxConfig::SchemeShard, sender);
- env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
+ env.TestWaitNotification(runtime, {txId, txId-1, txId-2});
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+20));
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/DropMeBaby"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops"),
- {NLs::NoChildren,
- NLs::PathExist});
-
- TestRmDir(runtime, ++txId, "/MyRoot", "Ops");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops"),
- {NLs::PathNotExist});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops/DropMeBaby"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops"),
+ {NLs::NoChildren,
+ NLs::PathExist});
+
+ TestRmDir(runtime, ++txId, "/MyRoot", "Ops");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Ops"),
+ {NLs::PathNotExist});
+
TestRmDir(runtime, ++txId, "/MyRoot", "Ops", {NKikimrScheme::StatusPathDoesNotExist});
-
+
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+40));
}
- Y_UNIT_TEST(ParallelModifying) { //+
+ Y_UNIT_TEST(ParallelModifying) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 1000;
@@ -6464,149 +6464,149 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
"TotalGroupCount: 100 ";
Cdbg << "Create + Drop + Create" << Endl;
- AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
- AsyncDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
- AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
- env.TestWaitNotification(runtime, {txId-2, txId-1, txId});
+ AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
+ AsyncDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
+ AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ env.TestWaitNotification(runtime, {txId-2, txId-1, txId});
- TestDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
- env.TestWaitNotification(runtime, txId);
+ TestDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
+ env.TestWaitNotification(runtime, txId);
Cdbg << "Create + Create + Drop" << Endl;
- AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
- AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
- AsyncDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
- env.TestWaitNotification(runtime, {txId-2, txId-1, txId});
-
- TestDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
- env.TestWaitNotification(runtime, txId);
-
+ AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
+ AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
+ AsyncDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ env.TestWaitNotification(runtime, {txId-2, txId-1, txId});
+
+ TestDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
+ env.TestWaitNotification(runtime, txId);
+
Cdbg << "Create + Alter + Drop" << Endl;
- AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
- AsyncAlterPQGroup(runtime, ++txId, "/MyRoot", pqGroupAlter);
- AsyncDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
- env.TestWaitNotification(runtime, {txId-2, txId-1, txId});
-
- TestDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
- env.TestWaitNotification(runtime, txId);
-
+ AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
+ AsyncAlterPQGroup(runtime, ++txId, "/MyRoot", pqGroupAlter);
+ AsyncDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ env.TestWaitNotification(runtime, {txId-2, txId-1, txId});
+
+ TestDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
+ env.TestWaitNotification(runtime, txId);
+
Cdbg << "Create + Drop + Alter" << Endl;
- AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
- AsyncDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
- AsyncAlterPQGroup(runtime, ++txId, "/MyRoot", pqGroupAlter);
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
- env.TestWaitNotification(runtime, {txId-2, txId-1, txId});
-
- TestDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
- env.TestWaitNotification(runtime, txId);
-
+ AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
+ AsyncDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
+ AsyncAlterPQGroup(runtime, ++txId, "/MyRoot", pqGroupAlter);
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ env.TestWaitNotification(runtime, {txId-2, txId-1, txId});
+
+ TestDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
+ env.TestWaitNotification(runtime, txId);
+
Cdbg << "Create + Drop + Drop" << Endl;
- AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
- AsyncDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
- AsyncDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
- env.TestWaitNotification(runtime, {txId-2, txId-1, txId});
-
- TestDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
- env.TestWaitNotification(runtime, txId);
-
+ AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
+ AsyncDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
+ AsyncDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ env.TestWaitNotification(runtime, {txId-2, txId-1, txId});
+
+ TestDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
+ env.TestWaitNotification(runtime, txId);
+
Cdbg << "Create + Alter + Create + Drop" << Endl;
- AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
- AsyncAlterPQGroup(runtime, ++txId, "/MyRoot", pqGroupAlter);
- AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
- AsyncDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
- TestModificationResult(runtime, txId-3, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusMultipleModifications);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
- env.TestWaitNotification(runtime, {txId-3, txId-2, txId-1, txId});
-
- TestDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
- env.TestWaitNotification(runtime, txId);
-
+ AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
+ AsyncAlterPQGroup(runtime, ++txId, "/MyRoot", pqGroupAlter);
+ AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
+ AsyncDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
+ TestModificationResult(runtime, txId-3, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusMultipleModifications);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ env.TestWaitNotification(runtime, {txId-3, txId-2, txId-1, txId});
+
+ TestDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
+ env.TestWaitNotification(runtime, txId);
+
Cdbg << "Create + Alter + Alter + Drop" << Endl;
- AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
- AsyncAlterPQGroup(runtime, ++txId, "/MyRoot", pqGroupAlter);
- AsyncAlterPQGroup(runtime, ++txId, "/MyRoot", pqGroupAlter);
- AsyncDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
- TestModificationResult(runtime, txId-3, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusMultipleModifications);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
- env.TestWaitNotification(runtime, {txId-3, txId-2, txId-1, txId});
-
- TestDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
- env.TestWaitNotification(runtime, txId);
-
+ AsyncCreatePQGroup(runtime, ++txId, "/MyRoot", pqGroupConfig);
+ AsyncAlterPQGroup(runtime, ++txId, "/MyRoot", pqGroupAlter);
+ AsyncAlterPQGroup(runtime, ++txId, "/MyRoot", pqGroupAlter);
+ AsyncDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
+ TestModificationResult(runtime, txId-3, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusMultipleModifications);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ env.TestWaitNotification(runtime, {txId-3, txId-2, txId-1, txId});
+
+ TestDropPQGroup(runtime, ++txId, "/MyRoot", "Isolda");
+ env.TestWaitNotification(runtime, txId);
+
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+40));
}
- Y_UNIT_TEST(DropPQFail) { //+
+ Y_UNIT_TEST(DropPQFail) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
- TString pqGroupConfig = "Name: \"Isolda\""
- "TotalGroupCount: 100 "
- "PartitionPerTablet: 10 "
- "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}";
+ TString pqGroupConfig = "Name: \"Isolda\""
+ "TotalGroupCount: 100 "
+ "PartitionPerTablet: 10 "
+ "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}";
const char * path = "/MyRoot/A/B/C/D/I/F";
- AsyncMkDir(runtime, ++txId, "/MyRoot", "A");
- AsyncMkDir(runtime, ++txId, "/MyRoot/A", "B");
- AsyncMkDir(runtime, ++txId, "/MyRoot/A/B", "C");
- AsyncMkDir(runtime, ++txId, "/MyRoot/A/B/C", "D");
- AsyncMkDir(runtime, ++txId, "/MyRoot/A/B/C/D", "I");
- AsyncMkDir(runtime, ++txId, "/MyRoot/A/B/C/D/I", "F");
- AsyncCreatePQGroup(runtime, ++txId, path, pqGroupConfig);
- AsyncDropPQGroup(runtime, ++txId, path, "Isolda");
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "A");
+ AsyncMkDir(runtime, ++txId, "/MyRoot/A", "B");
+ AsyncMkDir(runtime, ++txId, "/MyRoot/A/B", "C");
+ AsyncMkDir(runtime, ++txId, "/MyRoot/A/B/C", "D");
+ AsyncMkDir(runtime, ++txId, "/MyRoot/A/B/C/D", "I");
+ AsyncMkDir(runtime, ++txId, "/MyRoot/A/B/C/D/I", "F");
+ AsyncCreatePQGroup(runtime, ++txId, path, pqGroupConfig);
+ AsyncDropPQGroup(runtime, ++txId, path, "Isolda");
SkipModificationReply(runtime, 8);
- env.TestWaitNotification(runtime, xrange(txId-7, txId+1));
+ env.TestWaitNotification(runtime, xrange(txId-7, txId+1));
- TestDescribeResult(DescribePath(runtime, TString(path) + "/Isolda"),
- {NLs::Finished});
+ TestDescribeResult(DescribePath(runtime, TString(path) + "/Isolda"),
+ {NLs::Finished});
- TestDropPQGroup(runtime, ++txId, path, "Isolda");
- env.TestWaitNotification(runtime, txId);
+ TestDropPQGroup(runtime, ++txId, path, "Isolda");
+ env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, TString(path) + "/Isolda"),
- {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, TString(path) + "/Isolda"),
+ {NLs::PathNotExist});
- Cdbg << "Create + Drop (fail) + Drop" << Endl;
- AsyncCreatePQGroup(runtime, ++txId, path, pqGroupConfig);
- AsyncDropPQGroup(runtime, ++txId, path, "Isolda");
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
- env.TestWaitNotification(runtime, {txId-1, txId});
+ Cdbg << "Create + Drop (fail) + Drop" << Endl;
+ AsyncCreatePQGroup(runtime, ++txId, path, pqGroupConfig);
+ AsyncDropPQGroup(runtime, ++txId, path, "Isolda");
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ env.TestWaitNotification(runtime, {txId-1, txId});
+
+ TestDropPQGroup(runtime, ++txId, path, "Isolda");
+ env.TestWaitNotification(runtime, txId);
- TestDropPQGroup(runtime, ++txId, path, "Isolda");
- env.TestWaitNotification(runtime, txId);
-
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+5));
}
- Y_UNIT_TEST(DropPQAbort) { //+
+ Y_UNIT_TEST(DropPQAbort) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
- //using ESts = NKikimrScheme::EStatus;
+ //using ESts = NKikimrScheme::EStatus;
- const TString basePath = "/MyRoot/A/B/C/D/I/F";
- const TString pqPath = basePath + "/Isolda";
+ const TString basePath = "/MyRoot/A/B/C/D/I/F";
+ const TString pqPath = basePath + "/Isolda";
TString pqGroupConfig = "Name: \"Isolda\""
"TotalGroupCount: 1 "
@@ -6621,50 +6621,50 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TString pqGroupBigAlter = "Name: \"Isolda\""
"TotalGroupCount: 1000 ";
- AsyncMkDir(runtime, ++txId, "/MyRoot", "A");
- AsyncMkDir(runtime, ++txId, "/MyRoot/A", "B");
- AsyncMkDir(runtime, ++txId, "/MyRoot/A/B", "C");
- AsyncMkDir(runtime, ++txId, "/MyRoot/A/B/C", "D");
- AsyncMkDir(runtime, ++txId, "/MyRoot/A/B/C/D", "I");
- AsyncMkDir(runtime, ++txId, "/MyRoot/A/B/C/D/I", "F");
- Cdbg << "N*MkDir + CreatePQ (big) + Drop (abort)" << Endl;
- AsyncCreatePQGroup(runtime, ++txId, basePath, pqGroupBigConfig);
- AsyncDropPQGroup(runtime, ++txId, basePath, "Isolda");
- auto pVer = TestDescribeResult(DescribePath(runtime, pqPath));
- AsyncForceDropUnsafe(runtime, ++txId, pVer.PathId.LocalPathId);
- TestModificationResult(runtime, txId-8, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-7, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-6, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-5, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-4, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-3, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
- env.TestWaitNotification(runtime, xrange(txId - 8, txId + 1));
-
- TestDescribeResult(DescribePath(runtime, pqPath),
- {NLs::PathNotExist});
-
- TestCreatePQGroup(runtime, ++txId, basePath, pqGroupBigConfig);
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, pqPath),
- {NLs::PathExist});
-
- Cdbg << "AlterPQ (big) + Drop (abort)" << Endl;
- AsyncAlterPQGroup(runtime, ++txId, basePath, pqGroupBigAlter);
- AsyncDropPQGroup(runtime, ++txId, basePath, "Isolda");
- pVer = TestDescribeResult(DescribePath(runtime, pqPath));
- AsyncForceDropUnsafe(runtime, ++txId, pVer.PathId.LocalPathId);
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
- env.TestWaitNotification(runtime, {txId-2, txId-1, txId});
-
- TestDescribeResult(DescribePath(runtime, pqPath),
- {NLs::PathNotExist});
-
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "A");
+ AsyncMkDir(runtime, ++txId, "/MyRoot/A", "B");
+ AsyncMkDir(runtime, ++txId, "/MyRoot/A/B", "C");
+ AsyncMkDir(runtime, ++txId, "/MyRoot/A/B/C", "D");
+ AsyncMkDir(runtime, ++txId, "/MyRoot/A/B/C/D", "I");
+ AsyncMkDir(runtime, ++txId, "/MyRoot/A/B/C/D/I", "F");
+ Cdbg << "N*MkDir + CreatePQ (big) + Drop (abort)" << Endl;
+ AsyncCreatePQGroup(runtime, ++txId, basePath, pqGroupBigConfig);
+ AsyncDropPQGroup(runtime, ++txId, basePath, "Isolda");
+ auto pVer = TestDescribeResult(DescribePath(runtime, pqPath));
+ AsyncForceDropUnsafe(runtime, ++txId, pVer.PathId.LocalPathId);
+ TestModificationResult(runtime, txId-8, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-7, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-6, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-5, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-4, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-3, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+ env.TestWaitNotification(runtime, xrange(txId - 8, txId + 1));
+
+ TestDescribeResult(DescribePath(runtime, pqPath),
+ {NLs::PathNotExist});
+
+ TestCreatePQGroup(runtime, ++txId, basePath, pqGroupBigConfig);
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, pqPath),
+ {NLs::PathExist});
+
+ Cdbg << "AlterPQ (big) + Drop (abort)" << Endl;
+ AsyncAlterPQGroup(runtime, ++txId, basePath, pqGroupBigAlter);
+ AsyncDropPQGroup(runtime, ++txId, basePath, "Isolda");
+ pVer = TestDescribeResult(DescribePath(runtime, pqPath));
+ AsyncForceDropUnsafe(runtime, ++txId, pVer.PathId.LocalPathId);
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusAccepted);
+ env.TestWaitNotification(runtime, {txId-2, txId-1, txId});
+
+ TestDescribeResult(DescribePath(runtime, pqPath),
+ {NLs::PathNotExist});
+
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+20));
}
@@ -6685,7 +6685,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
" ExplicitChannelProfiles { PoolKind: \"pool-kind-1\" } "
" ExplicitChannelProfiles { PoolKind: \"pool-kind-1\" } "
"} }",
- {NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusInvalidParameter});
// It's ok to create a group with 4 channels
TestCreatePQGroup(runtime, ++txId, "/MyRoot/DirA",
@@ -6779,7 +6779,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
" ExplicitChannelProfiles { PoolKind: \"pool-kind-2\" } "
" ExplicitChannelProfiles { PoolKind: \"pool-kind-2\" } "
"} }",
- {NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusInvalidParameter});
// Changing pool kinds, tablets should be recreated
TestAlterPQGroup(runtime, ++txId, "/MyRoot/DirA",
@@ -6808,54 +6808,54 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
}
}
- Y_UNIT_TEST(Restart) { //+
+ Y_UNIT_TEST(Restart) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 123;
- AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
- AsyncMkDir(runtime, ++txId, "/MyRoot/DirA", "SubDirA");
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
- "Name: \"Table1\""
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
+ AsyncMkDir(runtime, ++txId, "/MyRoot/DirA", "SubDirA");
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ "Name: \"Table1\""
"Columns { Name: \"RowId\" Type: \"Uint64\"}"
"Columns { Name: \"Value\" Type: \"Utf8\"}"
"KeyColumnNames: [\"RowId\"]");
- AsyncMkDir(runtime, ++txId, "/MyRoot/DirA/SubDirA", "AAA");
- AsyncMkDir(runtime, ++txId, "/MyRoot/DirA/SubDirA", "BBB");
- AsyncMkDir(runtime, ++txId, "/MyRoot/DirA/SubDirA", "CCC");
+ AsyncMkDir(runtime, ++txId, "/MyRoot/DirA/SubDirA", "AAA");
+ AsyncMkDir(runtime, ++txId, "/MyRoot/DirA/SubDirA", "BBB");
+ AsyncMkDir(runtime, ++txId, "/MyRoot/DirA/SubDirA", "CCC");
TActorId sender = runtime.AllocateEdgeActor();
RebootTablet(runtime, TTestTxConfig::SchemeShard, sender);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA"),
- {NLs::PathExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table1"),
- {NLs::PathExist,
- NLs::IsTable});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA"),
- {NLs::PathExist,
- NLs::ChildrenCount(3)});
-
- TestMkDir(runtime, ++txId, "/MyRoot/DirA/SubDirA", "DDD");
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA/DDD"),
- {NLs::PathExist});
-
- env.TestWaitNotification(runtime, xrange(txId-6, txId+1));
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA"),
+ {NLs::PathExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table1"),
+ {NLs::PathExist,
+ NLs::IsTable});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA"),
+ {NLs::PathExist,
+ NLs::ChildrenCount(3)});
+
+ TestMkDir(runtime, ++txId, "/MyRoot/DirA/SubDirA", "DDD");
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA/DDD"),
+ {NLs::PathExist});
+
+ env.TestWaitNotification(runtime, xrange(txId-6, txId+1));
+
}
- Y_UNIT_TEST(ReadOnlyMode) { //+
+ Y_UNIT_TEST(ReadOnlyMode) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 123;
- AsyncMkDir(runtime, ++txId, "/MyRoot", "SubDirA");
- AsyncCreateTable(runtime, ++txId, "/MyRoot",
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "SubDirA");
+ AsyncCreateTable(runtime, ++txId, "/MyRoot",
"Name: \"Table1\""
"Columns { Name: \"RowId\" Type: \"Uint64\"}"
"Columns { Name: \"Value\" Type: \"Utf8\"}"
@@ -6869,20 +6869,20 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
env.TestWaitNotification(runtime, txId);
// Check that describe works
- TestDescribeResult(DescribePath(runtime, "/MyRoot/SubDirA"),
- {NLs::Finished});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
- {NLs::Finished,
- NLs::IsTable});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/SubDirA"),
+ {NLs::Finished});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
+ {NLs::Finished,
+ NLs::IsTable});
// Check that new modifications fail
- TestMkDir(runtime, ++txId, "/MyRoot", "SubDirBBBB", {NKikimrScheme::StatusReadOnly});
- TestCreateTable(runtime, ++txId, "/MyRoot",
+ TestMkDir(runtime, ++txId, "/MyRoot", "SubDirBBBB", {NKikimrScheme::StatusReadOnly});
+ TestCreateTable(runtime, ++txId, "/MyRoot",
"Name: \"Table1\""
"Columns { Name: \"RowId\" Type: \"Uint64\"}"
"Columns { Name: \"Value\" Type: \"Utf8\"}"
"KeyColumnNames: [\"RowId\"]",
- {NKikimrScheme::StatusReadOnly});
+ {NKikimrScheme::StatusReadOnly});
// Disable ReadOnly
SetSchemeshardReadOnlyMode(runtime, false);
@@ -6890,132 +6890,132 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
RebootTablet(runtime, TTestTxConfig::SchemeShard, sender);
// Check that modifications now work again
- TestMkDir(runtime, ++txId, "/MyRoot", "SubDirBBBB");
+ TestMkDir(runtime, ++txId, "/MyRoot", "SubDirBBBB");
}
- Y_UNIT_TEST(PathErrors) { //+
+ Y_UNIT_TEST(PathErrors) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 123;
- auto tableDesrc = [=] (const TString& name) {
- return Sprintf(R"(Name: "%s"
+ auto tableDesrc = [=] (const TString& name) {
+ return Sprintf(R"(Name: "%s"
Columns { Name: "RowId" Type: "Uint64" }
KeyColumnNames: ["RowId"]
- )", name.c_str());
- };
-
- TestMkDir(runtime, ++txId, "/MyRoot", "DirA");
- env.TestWaitNotification(runtime, txId);
-
- TestMkDir(runtime, ++txId, "/MyRoot", "DirA", {NKikimrScheme::StatusAlreadyExists});
- TestCreateTable(runtime, ++txId, "/MyRoot", tableDesrc("DirA"), {NKikimrScheme::StatusNameConflict});
- TestMkDir(runtime, ++txId, "/MyRoot/DirA/SubDirA", "AAA", {NKikimrScheme::StatusPathDoesNotExist});
-
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", tableDesrc("Table1"));
- AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA/", tableDesrc("Table1"));
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
- env.TestWaitNotification(runtime, {txId, txId-1});
-
- TestCreateTable(runtime, ++txId, "/MyRoot/DirA/", tableDesrc("Table1"), {NKikimrScheme::StatusAlreadyExists});
- TestMkDir(runtime, ++txId, "/MyRoot/DirA", "Table1", {NKikimrScheme::StatusNameConflict});
- TestMkDir(runtime, ++txId, "/MyRoot/DirA/Table1", "CCC", {NKikimrScheme::StatusPathIsNotDirectory});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/"),
- {NLs::Finished});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::Finished});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table1"),
- {NLs::IsTable,
- NLs::Finished});
-
- TestCreateTable(runtime, ++txId, "/MyRoot/DirA", tableDesrc("/WrongPath"), {NKikimrScheme::StatusSchemeError});
- TestCreateTable(runtime, ++txId, "/MyRoot/DirA", tableDesrc("WrongPath/"), {NKikimrScheme::StatusSchemeError});
- TestCreateTable(runtime, ++txId, "/MyRoot/DirA", tableDesrc("Table1/WrongPath"), {NKikimrScheme::StatusPathIsNotDirectory});
+ )", name.c_str());
+ };
+
+ TestMkDir(runtime, ++txId, "/MyRoot", "DirA");
+ env.TestWaitNotification(runtime, txId);
+
+ TestMkDir(runtime, ++txId, "/MyRoot", "DirA", {NKikimrScheme::StatusAlreadyExists});
+ TestCreateTable(runtime, ++txId, "/MyRoot", tableDesrc("DirA"), {NKikimrScheme::StatusNameConflict});
+ TestMkDir(runtime, ++txId, "/MyRoot/DirA/SubDirA", "AAA", {NKikimrScheme::StatusPathDoesNotExist});
+
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA", tableDesrc("Table1"));
+ AsyncCreateTable(runtime, ++txId, "/MyRoot/DirA/", tableDesrc("Table1"));
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ env.TestWaitNotification(runtime, {txId, txId-1});
+
+ TestCreateTable(runtime, ++txId, "/MyRoot/DirA/", tableDesrc("Table1"), {NKikimrScheme::StatusAlreadyExists});
+ TestMkDir(runtime, ++txId, "/MyRoot/DirA", "Table1", {NKikimrScheme::StatusNameConflict});
+ TestMkDir(runtime, ++txId, "/MyRoot/DirA/Table1", "CCC", {NKikimrScheme::StatusPathIsNotDirectory});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/"),
+ {NLs::Finished});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::Finished});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table1"),
+ {NLs::IsTable,
+ NLs::Finished});
+
+ TestCreateTable(runtime, ++txId, "/MyRoot/DirA", tableDesrc("/WrongPath"), {NKikimrScheme::StatusSchemeError});
+ TestCreateTable(runtime, ++txId, "/MyRoot/DirA", tableDesrc("WrongPath/"), {NKikimrScheme::StatusSchemeError});
+ TestCreateTable(runtime, ++txId, "/MyRoot/DirA", tableDesrc("Table1/WrongPath"), {NKikimrScheme::StatusPathIsNotDirectory});
}
- Y_UNIT_TEST(SchemeErrors) { //+
+ Y_UNIT_TEST(SchemeErrors) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 123;
- TestMkDir(runtime, ++txId, "/MyRoot", "DirA");
- env.TestWaitNotification(runtime, txId);
+ TestMkDir(runtime, ++txId, "/MyRoot", "DirA");
+ env.TestWaitNotification(runtime, txId);
- TestCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ TestCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"Table2\""
"Columns { Name: \"RowId\" Type: \"BlaBlaType\"}"
"KeyColumnNames: [\"RowId\"]",
- {NKikimrScheme::StatusSchemeError});
- TestCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ {NKikimrScheme::StatusSchemeError});
+ TestCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"Table2\""
"Columns { Name: \"RowId\" Type: \"Uint32\"}",
- {NKikimrScheme::StatusSchemeError});
- TestCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ {NKikimrScheme::StatusSchemeError});
+ TestCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"Table2\""
"Columns { Name: \"RowId\" Type: \"Uint32\"}"
"KeyColumnNames: [\"AAAA\"]",
- {NKikimrScheme::StatusSchemeError});
- TestCreateTable(runtime, ++txId, "/MyRoot/DirA",
+ {NKikimrScheme::StatusSchemeError});
+ TestCreateTable(runtime, ++txId, "/MyRoot/DirA",
"Name: \"Table2\""
"Columns { Name: \"RowId\" Type: \"Uint32\"}"
"KeyColumnNames: [\"RowId\", \"RowId\"]",
- {NKikimrScheme::StatusSchemeError});
+ {NKikimrScheme::StatusSchemeError});
}
- Y_UNIT_TEST(ManyDirs) { //+
+ Y_UNIT_TEST(ManyDirs) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 num = 500;
- ui64 txId = 123;
+ ui64 txId = 123;
TSet<ui64> ids;
for (ui32 id = 0; id < num; ++id) {
- AsyncMkDir(runtime, ++txId, "/MyRoot", Sprintf("Dir_%u", id));
- ids.insert(txId);
+ AsyncMkDir(runtime, ++txId, "/MyRoot", Sprintf("Dir_%u", id));
+ ids.insert(txId);
}
env.TestWaitNotification(runtime, ids);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(num),
- NLs::ChildrenCount(num)});
-
- ids.clear();
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(num),
+ NLs::ChildrenCount(num)});
+
+ ids.clear();
for (ui32 id = 0; id < num; ++id) {
- AsyncRmDir(runtime, ++txId, "/MyRoot", Sprintf("Dir_%u", id));
- ids.insert(txId);
+ AsyncRmDir(runtime, ++txId, "/MyRoot", Sprintf("Dir_%u", id));
+ ids.insert(txId);
}
- env.TestWaitNotification(runtime, ids);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(0),
- NLs::ChildrenCount(0)});
+ env.TestWaitNotification(runtime, ids);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(0),
+ NLs::ChildrenCount(0)});
}
- Y_UNIT_TEST(NestedDirs) { //+
+ Y_UNIT_TEST(NestedDirs) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
- ui64 txId = 123;
- TSchemeLimits limits;
+ ui64 txId = 123;
+ TSchemeLimits limits;
TString path = "/MyRoot";
TSet<ui64> ids;
- for (ui32 i = 1; i < limits.MaxDepth; ++i) {
+ for (ui32 i = 1; i < limits.MaxDepth; ++i) {
TString name = Sprintf("%u", i);
- TestMkDir(runtime, ++txId, path, name);
+ TestMkDir(runtime, ++txId, path, name);
path += '/';
path += name;
- ids.insert(txId);
+ ids.insert(txId);
}
- env.TestWaitNotification(runtime, ids);
+ env.TestWaitNotification(runtime, ids);
- TestMkDir(runtime, ++txId, path, "fail", {NKikimrScheme::StatusSchemeError});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(limits.MaxDepth - 1)});
+ TestMkDir(runtime, ++txId, path, "fail", {NKikimrScheme::StatusSchemeError});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(limits.MaxDepth - 1)});
}
void VerifyEqualCells(const TCell& a, const TCell& b) {
@@ -7039,7 +7039,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
}
}
- Y_UNIT_TEST(SerializedCellVec) { //+
+ Y_UNIT_TEST(SerializedCellVec) { //+
TVector<TCell> cells;
TestSerializedCellVec(cells);
@@ -7062,124 +7062,124 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TestSerializedCellVec(cells);
}
}
-
- Y_UNIT_TEST(CreateFinishedInDescription) { //+
+
+ Y_UNIT_TEST(CreateFinishedInDescription) { //+
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::NotFinished});
-
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::Finished});
- }
-
- class TSuppresPlanStepObserver : public TNonCopyable {
- public:
- typedef std::function<void(TTestActorRuntime& runtime, bool& suppres)> TEventInjection;
-
- private:
- ui64 Coordinator;
- ui64 Shard;
- TEventInjection InjectionUnderSuppres;
- bool Injected;
- bool Suppres;
-
- public:
- TSuppresPlanStepObserver(ui64 fromCoordinator,
- ui64 toShard,
- TEventInjection injection)
- : Coordinator(fromCoordinator)
- , Shard(toShard)
- , InjectionUnderSuppres(injection)
- , Injected(false)
- , Suppres(true)
- {
- }
-
- void SetUp(TTestActorRuntime& runtime) {
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::NotFinished});
+
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::Finished});
+ }
+
+ class TSuppresPlanStepObserver : public TNonCopyable {
+ public:
+ typedef std::function<void(TTestActorRuntime& runtime, bool& suppres)> TEventInjection;
+
+ private:
+ ui64 Coordinator;
+ ui64 Shard;
+ TEventInjection InjectionUnderSuppres;
+ bool Injected;
+ bool Suppres;
+
+ public:
+ TSuppresPlanStepObserver(ui64 fromCoordinator,
+ ui64 toShard,
+ TEventInjection injection)
+ : Coordinator(fromCoordinator)
+ , Shard(toShard)
+ , InjectionUnderSuppres(injection)
+ , Injected(false)
+ , Suppres(true)
+ {
+ }
+
+ void SetUp(TTestActorRuntime& runtime) {
runtime.SetObserverFunc([&](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event) {
return this->OnEvent(static_cast<TTestActorRuntime&>(runtime), event);
- });
- }
-
+ });
+ }
+
bool IsPlanStepMessage(TTestActorRuntimeBase& /*runtime*/, TAutoPtr<IEventHandle>& event) {
- if (event->GetTypeRewrite() != TEvTxProcessing::EvPlanStep) {
- return false;
- }
-
- NKikimrTx::TEvMediatorPlanStep& record = event->Get<TEvTxProcessing::TEvPlanStep>()->Record;
- if (record.GetTabletID() != Shard)
- return false;
-
- for(auto &tx: record.GetTransactions()) {
- if (tx.GetCoordinator() == Coordinator)
- return true;
- }
-
- return false;
- }
-
- TTestActorRuntime::EEventAction OnEvent(TTestActorRuntime& runtime, TAutoPtr<IEventHandle>& event) {
- if (!IsPlanStepMessage(runtime, event)) {
- return TTestActorRuntime::EEventAction::PROCESS;
- }
-
- if (!Injected) {
- Cerr << "!Do injection!\n";
- Injected = true;
- InjectionUnderSuppres(runtime, Suppres);
- Cerr << "!Do injection DONE!\n";
- }
-
- if (Suppres) {
- Cerr << "!Suppress planStep event!\n";
- return TTestActorRuntime::EEventAction::DROP;
- }
-
- return TTestActorRuntime::EEventAction::PROCESS;
- }
-
- };
-
- Y_UNIT_TEST(CreateBlockStoreVolume) { //+
+ if (event->GetTypeRewrite() != TEvTxProcessing::EvPlanStep) {
+ return false;
+ }
+
+ NKikimrTx::TEvMediatorPlanStep& record = event->Get<TEvTxProcessing::TEvPlanStep>()->Record;
+ if (record.GetTabletID() != Shard)
+ return false;
+
+ for(auto &tx: record.GetTransactions()) {
+ if (tx.GetCoordinator() == Coordinator)
+ return true;
+ }
+
+ return false;
+ }
+
+ TTestActorRuntime::EEventAction OnEvent(TTestActorRuntime& runtime, TAutoPtr<IEventHandle>& event) {
+ if (!IsPlanStepMessage(runtime, event)) {
+ return TTestActorRuntime::EEventAction::PROCESS;
+ }
+
+ if (!Injected) {
+ Cerr << "!Do injection!\n";
+ Injected = true;
+ InjectionUnderSuppres(runtime, Suppres);
+ Cerr << "!Do injection DONE!\n";
+ }
+
+ if (Suppres) {
+ Cerr << "!Suppress planStep event!\n";
+ return TTestActorRuntime::EEventAction::DROP;
+ }
+
+ return TTestActorRuntime::EEventAction::PROCESS;
+ }
+
+ };
+
+ Y_UNIT_TEST(CreateBlockStoreVolume) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
vdescr.SetName("BSVolume");
auto& vc = *vdescr.MutableVolumeConfig();
// Missing parameters
- TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", "", {NKikimrScheme::StatusSchemeError});
+ TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", "", {NKikimrScheme::StatusSchemeError});
vc.SetBlockSize(4096);
// Creating volumes without partitions not allowed
- TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot",
+ TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusSchemeError});
+ {NKikimrScheme::StatusSchemeError});
vc.AddPartitions()->SetBlockCount(16);
// Specifying config version not allowed
vc.SetVersion(123);
- TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot",
+ TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusSchemeError});
+ {NKikimrScheme::StatusSchemeError});
vc.ClearVersion();
// No channel profiles
- TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot",
+ TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusInvalidParameter});
// Normal volume with 2 partitions
vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1");
@@ -7189,15 +7189,15 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vc.AddPartitions()->SetBlockCount(16);
TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
- {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(3)});
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
+ {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(3)});
// Already exists
- TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot",
+ TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusAlreadyExists});
+ {NKikimrScheme::StatusAlreadyExists});
}
Y_UNIT_TEST(CreateBlockStoreVolumeWithVolumeChannelsProfiles) { //+
@@ -7205,7 +7205,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TTestEnv env(runtime);
ui64 txId = 100;
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
vdescr.SetName("BSVolume");
auto& vc = *vdescr.MutableVolumeConfig();
@@ -7219,7 +7219,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusInvalidParameter});
vc.AddVolumeExplicitChannelProfiles()->SetPoolKind("pool-kind-2");
@@ -7235,7 +7235,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TTestEnv env(runtime);
ui64 txId = 100;
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
vdescr.SetName("BSVolume");
auto& vc = *vdescr.MutableVolumeConfig();
@@ -7257,16 +7257,16 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TTestEnv env(runtime, /* nchannels */ 6);
ui64 txId = 100;
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
vdescr.SetName("BSVolume");
auto& vc = *vdescr.MutableVolumeConfig();
// Cannot alter missing volumes
vc.AddPartitions()->SetBlockCount(32);
vc.AddPartitions()->SetBlockCount(32);
- TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
+ TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusPathDoesNotExist});
+ {NKikimrScheme::StatusPathDoesNotExist});
vc.Clear();
// Create volume with 1 partition
@@ -7287,46 +7287,46 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vc.MutableExplicitChannelProfiles(3)->SetWriteBandwidth(200500);
vc.MutableExplicitChannelProfiles(3)->SetDataKind(1);
TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
vc.Clear();
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
- {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(2)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
+ {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(2)});
// Alter it into 2 bigger partitions
vc.SetVersion(1);
vc.AddPartitions()->SetBlockCount(32);
vc.AddPartitions()->SetBlockCount(32);
TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
vc.Clear();
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
- {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(3)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
+ {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(3)});
vc.SetVersion(2);
// Alter with less partitions not allowed
vc.AddPartitions()->SetBlockCount(32);
- TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
+ TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusInvalidParameter});
// Changing block size not allowed
vc.AddPartitions()->SetBlockCount(32);
vc.SetBlockSize(8192);
- TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
+ TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusInvalidParameter});
vc.ClearBlockSize();
vc.ClearPartitions();
// Setting media kind for the first time is allowed
vc.SetStorageMediaKind(1);
TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
vc.Clear();
-
+
{
NKikimrBlockStore::TVolumeConfig config;
TestLs(runtime, "/MyRoot/BSVolume", false, NLs::ExtractVolumeConfig(&config));
@@ -7337,9 +7337,9 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
// But changing media kind is not allowed
vc.SetStorageMediaKind(2);
- TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
+ TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusInvalidParameter});
vc.ClearStorageMediaKind();
// Adding channel profiles is allowed
@@ -7371,7 +7371,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vc.MutableExplicitChannelProfiles(5)->SetWriteBandwidth(600500);
vc.MutableExplicitChannelProfiles(5)->SetDataKind(2);
TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
vc.Clear();
vc.SetVersion(4);
@@ -7399,7 +7399,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vc.MutableExplicitChannelProfiles(4)->SetDataKind(2);
TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusInvalidParameter});
vc.ClearExplicitChannelProfiles();
// Number of volume channel explicit profiles must be equal to 3
@@ -7407,7 +7407,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vc.AddVolumeExplicitChannelProfiles()->SetPoolKind("pool-kind-2");
TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusInvalidParameter});
vc.ClearVolumeExplicitChannelProfiles();
// Changing PoolKind is not allowed
@@ -7440,7 +7440,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vc.MutableExplicitChannelProfiles(5)->SetDataKind(2);
TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusInvalidParameter});
// Actually, it's allowed if you say a magic word
vc.SetPoolKindChangeAllowed(true);
@@ -7491,15 +7491,15 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vc.AddPartitions()->SetBlockCount(32);
TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusInvalidParameter});
vc.ClearPartitions();
// Changing Opaque is allowed
vc.SetOpaque("binary data");
TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
vc.Clear();
-
+
{
NKikimrBlockStore::TVolumeConfig config;
TestLs(runtime, "/MyRoot/BSVolume", false, NLs::ExtractVolumeConfig(&config));
@@ -7515,9 +7515,9 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
*vc.AddTags() = "tag1";
*vc.AddTags() = "tag2";
TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
vc.Clear();
-
+
vc.SetVersion(8);
// Changing Tags
@@ -7551,7 +7551,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
{
NKikimrBlockStore::TVolumeConfig config;
- NLs::ExtractVolumeConfig(&config)(DescribePath(runtime, "/MyRoot/BSVolume"));
+ NLs::ExtractVolumeConfig(&config)(DescribePath(runtime, "/MyRoot/BSVolume"));
UNIT_ASSERT_VALUES_EQUAL(config.GetBlockSize(), 4096u);
UNIT_ASSERT_VALUES_EQUAL(config.PartitionsSize(), 2);
UNIT_ASSERT_VALUES_EQUAL(config.GetDiskId(), "foobaz");
@@ -7629,7 +7629,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TTestEnv env(runtime);
ui64 txId = 100;
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
vdescr.SetName("BSVolume");
auto& vc = *vdescr.MutableVolumeConfig();
@@ -7673,18 +7673,18 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
}
TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusInvalidParameter});
}
- Y_UNIT_TEST(DropBlockStoreVolume) { //+
+ Y_UNIT_TEST(DropBlockStoreVolume) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
- TestDropBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume", {NKikimrScheme::StatusPathDoesNotExist});
+ TestDropBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume", {NKikimrScheme::StatusPathDoesNotExist});
// Create volume with 1 partition
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
vdescr.SetName("BSVolume");
auto& vc = *vdescr.MutableVolumeConfig();
vc.SetBlockSize(4096);
@@ -7695,20 +7695,20 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1");
TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
- {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(2)});
+ env.TestWaitNotification(runtime, txId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
+ {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(2)});
// Drop the volume
- TestDropBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume");
- env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
- {NLs::PathNotExist});
-
+ TestDropBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume");
+ env.TestWaitNotification(runtime, txId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
+ {NLs::PathNotExist});
+
env.TestWaitTabletDeletion(runtime, {TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished, NLs::PathsInsideDomain(0), NLs::ShardsInsideDomain(0)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished, NLs::PathsInsideDomain(0), NLs::ShardsInsideDomain(0)});
}
Y_UNIT_TEST(DropBlockStoreVolumeWithNonReplicatedPartitions) { //+
@@ -7716,7 +7716,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TTestEnv env(runtime);
ui64 txId = 100;
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
vdescr.SetName("BSVolume");
auto& vc = *vdescr.MutableVolumeConfig();
@@ -7747,13 +7747,13 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
{NLs::Finished, NLs::PathsInsideDomain(0), NLs::ShardsInsideDomain(0)});
}
- Y_UNIT_TEST(DropBlockStoreVolume2) { //+
+ Y_UNIT_TEST(DropBlockStoreVolume2) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
// Create volume with 1 partition
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
vdescr.SetName("BSVolume");
auto& vc = *vdescr.MutableVolumeConfig();
vc.SetBlockSize(4096);
@@ -7764,40 +7764,40 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1");
TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
{NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(2)});
// Drop the volume twice in parallel
- AsyncDropBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume");
- AsyncDropBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume");
- TestModificationResult(runtime, txId-1);
-
- auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvModifySchemeTransactionResult>();
+ AsyncDropBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume");
+ AsyncDropBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume");
+ TestModificationResult(runtime, txId-1);
+
+ auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvModifySchemeTransactionResult>();
UNIT_ASSERT(event);
- UNIT_ASSERT_VALUES_EQUAL(event->Record.GetTxId(), txId);
+ UNIT_ASSERT_VALUES_EQUAL(event->Record.GetTxId(), txId);
CheckExpected(
- { NKikimrScheme::StatusMultipleModifications },
+ { NKikimrScheme::StatusMultipleModifications },
event->Record.GetStatus(), event->Record.GetReason());
- UNIT_ASSERT_VALUES_EQUAL(event->Record.GetPathDropTxId(), txId-1);
+ UNIT_ASSERT_VALUES_EQUAL(event->Record.GetPathDropTxId(), txId-1);
- env.TestWaitNotification(runtime, txId-1);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
- {NLs::PathNotExist});
+ env.TestWaitNotification(runtime, txId-1);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
+ {NLs::PathNotExist});
}
- Y_UNIT_TEST(AssignBlockStoreVolume) { //+
+ Y_UNIT_TEST(AssignBlockStoreVolume) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
// Cannot assign non-existant volume
TestAssignBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume", "Owner123", 0,
- {NKikimrScheme::StatusPathDoesNotExist});
+ {NKikimrScheme::StatusPathDoesNotExist});
// Create volume with 1 partition
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
vdescr.SetName("BSVolume");
auto& vc = *vdescr.MutableVolumeConfig();
vc.SetBlockSize(4096);
@@ -7808,18 +7808,18 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1");
TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
vc.Clear();
- TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
- {NLs::Finished});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
+ {NLs::Finished});
+
// Assign volume to Owner123
- TestAssignBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume", "Owner123");
+ TestAssignBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume", "Owner123");
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
+ {NLs::CheckMountToken("BSVolume", "Owner123")});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
- {NLs::CheckMountToken("BSVolume", "Owner123")});
-
// AssignVolume to Owner124
TestAssignBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume", "Owner124");
@@ -7834,7 +7834,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
// AssignVolume using wrong TokenVersion
TestAssignBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume", "Owner126", 2,
- {NKikimrScheme::StatusPreconditionFailed});
+ {NKikimrScheme::StatusPreconditionFailed});
// Alter is allowed
vc.SetVersion(1);
@@ -7843,7 +7843,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
// Drop is allowed
- TestDropBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume");
+ TestDropBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume");
}
Y_UNIT_TEST(AssignBlockStoreVolumeDuringAlter) {
@@ -7852,7 +7852,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
ui64 txId = 100;
// Create volume with 1 partition
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
vdescr.SetName("BSVolume");
auto& vc = *vdescr.MutableVolumeConfig();
vc.SetBlockSize(4096);
@@ -7863,34 +7863,34 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1");
TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
vc.Clear();
- TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
- {NLs::Finished});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
+ {NLs::Finished});
+
vc.SetVersion(1);
vc.AddPartitions()->SetBlockCount(32);
vc.AddPartitions()->SetBlockCount(32);
AsyncAlterBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- AsyncAssignBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume", "Owner123");
+ AsyncAssignBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume", "Owner123");
+
+ TestModificationResult(runtime, txId-1);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusSuccess);
+
+ env.TestWaitNotification(runtime, {txId-1, txId});
- TestModificationResult(runtime, txId-1);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusSuccess);
-
- env.TestWaitNotification(runtime, {txId-1, txId});
-
// Mount token should be set correctly
- TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
- {NLs::CheckMountToken("BSVolume", "Owner123")});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
+ {NLs::CheckMountToken("BSVolume", "Owner123")});
}
- Y_UNIT_TEST(AssignBlockStoreCheckVersionInAlter) { //+
+ Y_UNIT_TEST(AssignBlockStoreCheckVersionInAlter) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
vdescr.SetName("BSVolume");
auto& vc = *vdescr.MutableVolumeConfig();
vc.SetBlockSize(4096);
@@ -7901,7 +7901,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1");
TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
vc.Clear();
vc.SetVersion(1);
@@ -7909,27 +7909,27 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vc.AddPartitions()->SetBlockCount(24);
TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
vc.Clear();
vc.SetVersion(0);
vc.AddPartitions()->SetBlockCount(25);
vc.AddPartitions()->SetBlockCount(25);
- TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
+ TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusPreconditionFailed});
- env.TestWaitNotification(runtime, txId);
+ {NKikimrScheme::StatusPreconditionFailed});
+ env.TestWaitNotification(runtime, txId);
vc.Clear();
vc.SetVersion(1);
vc.AddPartitions()->SetBlockCount(32);
vc.AddPartitions()->SetBlockCount(32);
- TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
+ TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusPreconditionFailed});
- env.TestWaitNotification(runtime, txId);
+ {NKikimrScheme::StatusPreconditionFailed});
+ env.TestWaitNotification(runtime, txId);
vc.Clear();
vc.SetVersion(2);
@@ -7937,19 +7937,19 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vc.AddPartitions()->SetBlockCount(48);
TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
}
- Y_UNIT_TEST(BlockStoreVolumeLimits) { //+
+ Y_UNIT_TEST(BlockStoreVolumeLimits) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
- TestUserAttrs(runtime, ++txId, "", "MyRoot",
+ TestUserAttrs(runtime, ++txId, "", "MyRoot",
AlterUserAttrs({{"__volume_space_limit", "131072"}})); /* 32 x 4096 */
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
auto& vc = *vdescr.MutableVolumeConfig();
vc.SetBlockSize(4096);
vc.AddPartitions()->SetBlockCount(16);
@@ -7961,36 +7961,36 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
// Use half of the quota initially
vdescr.SetName("BSVolume1");
TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
// Cannot have more than quota
vdescr.SetName("BSVolume2");
vc.MutablePartitions(0)->SetBlockCount(17);
- TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot",
+ TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusPreconditionFailed});
+ {NKikimrScheme::StatusPreconditionFailed});
// It's ok to use quota completely, but only the first create should succeed
vc.SetSizeDecreaseAllowed(true);
vc.MutablePartitions(0)->SetBlockCount(16);
AsyncCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
AsyncCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- TestModificationResult(runtime, txId-1);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
- env.TestWaitNotification(runtime, {txId, txId-1});
+ TestModificationResult(runtime, txId-1);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusMultipleModifications);
+ env.TestWaitNotification(runtime, {txId, txId-1});
// Cannot increase volume size beyond current quota
vc.Clear();
vc.SetVersion(1);
vc.AddPartitions()->SetBlockCount(17);
- TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
+ TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusPreconditionFailed});
+ {NKikimrScheme::StatusPreconditionFailed});
// It's ok to decrease volume size for volumes with the SizeDecreaseAllowed flag
vc.MutablePartitions(0)->SetBlockCount(8);
TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
// After successful alter we may use freed quota for more volumes
vdescr.SetName("BSVolume3");
@@ -8002,18 +8002,18 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1");
vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1");
TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
// We may drop a volume and then use freed quota in an alter
- TestDropBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume1");
- env.TestWaitNotification(runtime, txId);
-
+ TestDropBlockStoreVolume(runtime, ++txId, "/MyRoot", "BSVolume1");
+ env.TestWaitNotification(runtime, txId);
+
vdescr.SetName("BSVolume2");
vc.Clear();
vc.SetVersion(2);
vc.AddPartitions()->SetBlockCount(24);
TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
// Currently quota is full, cannot create even a single block volume
vdescr.SetName("BSVolume4");
@@ -8024,41 +8024,41 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1");
vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1");
vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1");
- TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot",
+ TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusPreconditionFailed});
+ {NKikimrScheme::StatusPreconditionFailed});
// It's possible to modify quota size
- TestUserAttrs(runtime, ++txId, "", "MyRoot",
+ TestUserAttrs(runtime, ++txId, "", "MyRoot",
AlterUserAttrs({{"__volume_space_limit", "135168"}})); /* 33 x 4096 */
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
// Now single block volume should succeed
TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
// Change limit to be specifically about SSD
- TestUserAttrs(runtime, ++txId, "", "MyRoot",
+ TestUserAttrs(runtime, ++txId, "", "MyRoot",
AlterUserAttrs({{"__volume_space_limit_ssd", "147456"}}, {"__volume_space_limit"})); /* (32 + 4) x 4096 */
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
// Now we should be able to create any size volumes with the default kind
vdescr.SetName("BSVolume5");
vc.MutablePartitions(0)->SetBlockCount(128);
TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
// But no more than 32 blocks for SSD volumes
vdescr.SetName("BSVolume6");
vc.SetStorageMediaKind(1);
vc.SetSizeDecreaseAllowed(true);
vc.MutablePartitions(0)->SetBlockCount(33);
- TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot",
+ TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusPreconditionFailed});
+ {NKikimrScheme::StatusPreconditionFailed});
vc.MutablePartitions(0)->SetBlockCount(32);
TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
TestDescribeResult(DescribePath(runtime, "/MyRoot"), {
NLs::UserAttrsHas({
@@ -8070,7 +8070,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vc.SetVersion(1);
vc.AddPartitions()->SetBlockCount(8);
TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
TestDescribeResult(DescribePath(runtime, "/MyRoot"), {
NLs::UserAttrsHas({
@@ -8102,7 +8102,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vdescr.SetName("BSVolume8");
TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot/MyDir",
vdescr.DebugString(),
- {NKikimrScheme::StatusPreconditionFailed});
+ {NKikimrScheme::StatusPreconditionFailed});
// Create a subdomain
TestCreateSubDomain(runtime, ++txId, "/MyRoot",
@@ -8155,7 +8155,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vdescr.SetName("BSVolume3");
TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot/NBS",
vdescr.DebugString(),
- {NKikimrScheme::StatusPreconditionFailed});
+ {NKikimrScheme::StatusPreconditionFailed});
}
Y_UNIT_TEST(BlockStoreNonreplVolumeLimits) { //+
@@ -8176,7 +8176,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
env.TestWaitNotification(runtime, txId);
// Other pool kinds should not be affected
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
auto& vc = *vdescr.MutableVolumeConfig();
vc.SetBlockSize(4_KB);
vc.AddPartitions()->SetBlockCount(100500);
@@ -8214,7 +8214,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
++txId,
"/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusPreconditionFailed}
+ {NKikimrScheme::StatusPreconditionFailed}
);
// It's ok to use quota completely, but only the first create should succeed
@@ -8240,7 +8240,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
++txId,
"/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusPreconditionFailed}
+ {NKikimrScheme::StatusPreconditionFailed}
);
// We may drop a volume and then use freed quota in an alter
@@ -8273,7 +8273,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
++txId,
"/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusPreconditionFailed}
+ {NKikimrScheme::StatusPreconditionFailed}
);
// It's possible to modify quota size
@@ -8317,7 +8317,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
env.TestWaitNotification(runtime, txId);
// Other pool kinds should not be affected
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
auto& vc = *vdescr.MutableVolumeConfig();
vc.SetStorageMediaKind(1);
vc.SetBlockSize(4_KB);
@@ -8348,7 +8348,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
++txId,
"/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusPreconditionFailed}
+ {NKikimrScheme::StatusPreconditionFailed}
);
env.TestWaitNotification(runtime, txId);
@@ -8392,7 +8392,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
++txId,
"/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusPreconditionFailed}
+ {NKikimrScheme::StatusPreconditionFailed}
);
// It's possible to modify quota size
@@ -8423,7 +8423,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TTestEnv env(runtime, /* nchannels */ 6);
ui64 txId = 100;
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
vdescr.SetName("BSVolume");
auto& vc = *vdescr.MutableVolumeConfig();
@@ -8434,13 +8434,13 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1");
vc.AddExplicitChannelProfiles()->SetPoolKind("pool-kind-1");
vc.AddExplicitChannelProfiles()->SetPoolKind("invalid-pool-kind");
- TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot",
+ TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusInvalidParameter});
vc.MutableExplicitChannelProfiles(3)->SetPoolKind("pool-kind-1");
TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
vc.Clear();
TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
@@ -8453,7 +8453,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
vc.AddExplicitChannelProfiles()->SetPoolKind("invalid-pool-kind");
TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot",
vdescr.DebugString(),
- {NKikimrScheme::StatusInvalidParameter});
+ {NKikimrScheme::StatusInvalidParameter});
vc.MutableExplicitChannelProfiles(3)->SetPoolKind("pool-kind-1");
TestAlterBlockStoreVolume(runtime, ++txId, "/MyRoot", vdescr.DebugString());
@@ -8463,230 +8463,230 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
{NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(2)});
}
- Y_UNIT_TEST(CreateDropKesus) { //+
+ Y_UNIT_TEST(CreateDropKesus) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
// Create two kesus nodes
- TestCreateKesus(runtime, ++txId, "/MyRoot", "Name: \"Kesus1\"");
- TestCreateKesus(runtime, ++txId, "/MyRoot", "Name: \"Kesus2\"");
- env.TestWaitNotification(runtime, {txId, txId-1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(2), NLs::ShardsInsideDomain(2)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Kesus1"),
- {NLs::Finished});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Kesus2"),
- {NLs::Finished});
-
+ TestCreateKesus(runtime, ++txId, "/MyRoot", "Name: \"Kesus1\"");
+ TestCreateKesus(runtime, ++txId, "/MyRoot", "Name: \"Kesus2\"");
+ env.TestWaitNotification(runtime, {txId, txId-1});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(2), NLs::ShardsInsideDomain(2)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Kesus1"),
+ {NLs::Finished});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Kesus2"),
+ {NLs::Finished});
+
// Already exists
- TestCreateKesus(runtime, ++txId, "/MyRoot", "Name: \"Kesus1\"",
- {NKikimrScheme::StatusAlreadyExists});
+ TestCreateKesus(runtime, ++txId, "/MyRoot", "Name: \"Kesus1\"",
+ {NKikimrScheme::StatusAlreadyExists});
// Drop the first one
- TestDropKesus(runtime, ++txId, "/MyRoot", "Kesus1");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Kesus1"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Kesus2"),
- {NLs::Finished});
-
+ TestDropKesus(runtime, ++txId, "/MyRoot", "Kesus1");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Kesus1"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Kesus2"),
+ {NLs::Finished});
+
env.TestWaitTabletDeletion(runtime, TTestTxConfig::FakeHiveTablets);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(1)});
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(1)});
+
// Drop the second one
- TestDropKesus(runtime, ++txId, "/MyRoot", "Kesus2");
- env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Kesus2"),
- {NLs::PathNotExist});
-
+ TestDropKesus(runtime, ++txId, "/MyRoot", "Kesus2");
+ env.TestWaitNotification(runtime, txId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Kesus2"),
+ {NLs::PathNotExist});
+
env.TestWaitTabletDeletion(runtime, TTestTxConfig::FakeHiveTablets + 1);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(0), NLs::ShardsInsideDomain(0)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(0), NLs::ShardsInsideDomain(0)});
}
-
- Y_UNIT_TEST(CreateAlterKesus) { //+
+
+ Y_UNIT_TEST(CreateAlterKesus) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
-
- TestCreateKesus(runtime, ++txId, "/MyRoot",
+
+ TestCreateKesus(runtime, ++txId, "/MyRoot",
"Name: \"Kesus1\" "
"Config: { self_check_period_millis: 1234 session_grace_period_millis: 5678 }");
- env.TestWaitNotification(runtime, txId);
-
-
- auto checkKesusConfig = [=] (ui64 a, ui64 b) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- const auto& config = record.GetPathDescription().GetKesus().GetConfig();
- UNIT_ASSERT_EQUAL(config.self_check_period_millis(), a);
- UNIT_ASSERT_EQUAL(config.session_grace_period_millis(), b);
- };
+ env.TestWaitNotification(runtime, txId);
+
+
+ auto checkKesusConfig = [=] (ui64 a, ui64 b) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ const auto& config = record.GetPathDescription().GetKesus().GetConfig();
+ UNIT_ASSERT_EQUAL(config.self_check_period_millis(), a);
+ UNIT_ASSERT_EQUAL(config.session_grace_period_millis(), b);
+ };
};
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Kesus1"),
- {NLs::Finished, checkKesusConfig(1234, 5678)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Kesus1"),
+ {NLs::Finished, checkKesusConfig(1234, 5678)});
+
-
// Test the first setting is modified independently
- TestAlterKesus(runtime, ++txId, "/MyRoot",
+ TestAlterKesus(runtime, ++txId, "/MyRoot",
"Name: \"Kesus1\" "
"Config: { self_check_period_millis: 2345 }");
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Kesus1"),
+ {checkKesusConfig(2345, 5678)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Kesus1"),
- {checkKesusConfig(2345, 5678)});
-
// Test the second setting is modified independently
- TestAlterKesus(runtime, ++txId, "/MyRoot",
+ TestAlterKesus(runtime, ++txId, "/MyRoot",
"Name: \"Kesus1\" "
"Config: { session_grace_period_millis: 6789 }");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Kesus1"),
- {checkKesusConfig(2345, 6789)});
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Kesus1"),
+ {checkKesusConfig(2345, 6789)});
}
- Y_UNIT_TEST(CreateDropSolomon) { //+
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
- "PartitionCount: 40 ");
- env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Solomon"),
- {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(40)});
-
- // Already exists
- TestCreateSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
- "PartitionCount: 40 ",
- {NKikimrScheme::StatusAlreadyExists});
-
- TestDropSolomon(runtime, ++txId, "/MyRoot", "Solomon");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Solomon"),
- {NLs::PathNotExist});
-
+ Y_UNIT_TEST(CreateDropSolomon) { //+
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
+ "PartitionCount: 40 ");
+ env.TestWaitNotification(runtime, txId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Solomon"),
+ {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(40)});
+
+ // Already exists
+ TestCreateSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
+ "PartitionCount: 40 ",
+ {NKikimrScheme::StatusAlreadyExists});
+
+ TestDropSolomon(runtime, ++txId, "/MyRoot", "Solomon");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Solomon"),
+ {NLs::PathNotExist});
+
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 40));
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished, NLs::PathsInsideDomain(0), NLs::ShardsInsideDomain(0)});
- }
-
- NKikimrSchemeOp::TCreateSolomonVolume
- GenerateAdoptedPartitions(ui32 count
- , ui64 ownerIdStart, ui64 ownerIdDelta
- , ui64 shardIdStart, ui64 shardIdDelta
- , ui64 tabletIdStart, ui64 tabletIdDelta)
- {
- NKikimrSchemeOp::TCreateSolomonVolume volume;
-
-
- ui64 ownerId = ownerIdStart;
- ui64 shardId = shardIdStart;
- ui64 tabletId = tabletIdStart;
-
- for (ui32 i = 0; i < count; ++i) {
- NKikimrSchemeOp::TCreateSolomonVolume::TAdoptedPartition* part = volume.AddAdoptedPartitions();
- part->SetOwnerId(ownerId);
- part->SetShardIdx(shardId);
- part->SetTabletId(tabletId);
-
- ownerId += ownerIdDelta;
- shardId += shardIdDelta;
- tabletId += tabletIdDelta;
- }
-
- return volume;
- }
-
- Y_UNIT_TEST(AdoptDropSolomon) { //+
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSolomon(runtime, ++txId, "/MyRoot", "Name: \"JunkSolomon\" "
- "PartitionCount: 5 ");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(5)});
-
- NKikimrScheme::TEvDescribeSchemeResult ls = DescribePath(runtime, "/MyRoot/JunkSolomon");
- NLs::Finished(ls);
-
- auto volumeDescr = TakeTabletsFromAnotherSolomonVol("Solomon", ls.DebugString());
-
- TestCreateSolomon(runtime, ++txId, "/MyRoot", volumeDescr.DebugString());
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Solomon"),
- {NLs::Finished,
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(10)});
-
- TestDropSolomon(runtime, ++txId, "/MyRoot", "Solomon");
- env.TestWaitNotification(runtime, txId);
-
- TestDropSolomon(runtime, ++txId, "/MyRoot", "JunkSolomon");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Solomon"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/JunkSolomon"),
- {NLs::PathNotExist});
- }
-
- Y_UNIT_TEST(CreateAlterDropSolomon) { //+
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
- "PartitionCount: 2 ");
- env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Solomon"),
- {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(2)});
-
- TestAlterSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
- "PartitionCount: 4 "
- "ChannelProfileId: 0 ");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Solomon"),
- {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(4)});
-
- TestDropSolomon(runtime, ++txId, "/MyRoot", "Solomon");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Solomon"),
- {NLs::PathNotExist});
-
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished, NLs::PathsInsideDomain(0), NLs::ShardsInsideDomain(0)});
+ }
+
+ NKikimrSchemeOp::TCreateSolomonVolume
+ GenerateAdoptedPartitions(ui32 count
+ , ui64 ownerIdStart, ui64 ownerIdDelta
+ , ui64 shardIdStart, ui64 shardIdDelta
+ , ui64 tabletIdStart, ui64 tabletIdDelta)
+ {
+ NKikimrSchemeOp::TCreateSolomonVolume volume;
+
+
+ ui64 ownerId = ownerIdStart;
+ ui64 shardId = shardIdStart;
+ ui64 tabletId = tabletIdStart;
+
+ for (ui32 i = 0; i < count; ++i) {
+ NKikimrSchemeOp::TCreateSolomonVolume::TAdoptedPartition* part = volume.AddAdoptedPartitions();
+ part->SetOwnerId(ownerId);
+ part->SetShardIdx(shardId);
+ part->SetTabletId(tabletId);
+
+ ownerId += ownerIdDelta;
+ shardId += shardIdDelta;
+ tabletId += tabletIdDelta;
+ }
+
+ return volume;
+ }
+
+ Y_UNIT_TEST(AdoptDropSolomon) { //+
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSolomon(runtime, ++txId, "/MyRoot", "Name: \"JunkSolomon\" "
+ "PartitionCount: 5 ");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(5)});
+
+ NKikimrScheme::TEvDescribeSchemeResult ls = DescribePath(runtime, "/MyRoot/JunkSolomon");
+ NLs::Finished(ls);
+
+ auto volumeDescr = TakeTabletsFromAnotherSolomonVol("Solomon", ls.DebugString());
+
+ TestCreateSolomon(runtime, ++txId, "/MyRoot", volumeDescr.DebugString());
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Solomon"),
+ {NLs::Finished,
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(10)});
+
+ TestDropSolomon(runtime, ++txId, "/MyRoot", "Solomon");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDropSolomon(runtime, ++txId, "/MyRoot", "JunkSolomon");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Solomon"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/JunkSolomon"),
+ {NLs::PathNotExist});
+ }
+
+ Y_UNIT_TEST(CreateAlterDropSolomon) { //+
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
+ "PartitionCount: 2 ");
+ env.TestWaitNotification(runtime, txId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Solomon"),
+ {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(2)});
+
+ TestAlterSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
+ "PartitionCount: 4 "
+ "ChannelProfileId: 0 ");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Solomon"),
+ {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(4)});
+
+ TestDropSolomon(runtime, ++txId, "/MyRoot", "Solomon");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Solomon"),
+ {NLs::PathNotExist});
+
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 4));
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished, NLs::PathsInsideDomain(0), NLs::ShardsInsideDomain(0)});
- }
-
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished, NLs::PathsInsideDomain(0), NLs::ShardsInsideDomain(0)});
+ }
+
void UpdateChannelsBindingSolomon(bool allow) {
TTestBasicRuntime runtime;
TTestEnv env(runtime, TTestEnvOptions().AllowUpdateChannelsBindingOfSolomonPartitions(allow));
ui64 txId = 100;
auto check = [&](const TString& path, ui64 shards, const TVector<THashMap<TString, ui32>>& expectedChannels) {
- NKikimrSchemeOp::TDescribeOptions opts;
+ NKikimrSchemeOp::TDescribeOptions opts;
opts.SetReturnChannelsBinding(true);
TestDescribeResult(DescribePath(runtime, path, opts), {
NLs::Finished,
NLs::ShardsInsideDomain(shards),
- [&expectedChannels] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ [&expectedChannels] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
const auto& desc = record.GetPathDescription().GetSolomonDescription();
UNIT_ASSERT_VALUES_EQUAL(expectedChannels.size(), desc.PartitionsSize());
@@ -8727,7 +8727,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
TestAlterSolomon(runtime, ++txId, "/MyRoot", R"(
Name: "Solomon"
ChannelProfileId: 3
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
// case 2: add partition, do not update channels binding
TestAlterSolomon(runtime, ++txId, "/MyRoot", R"(
@@ -8744,7 +8744,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
Name: "Solomon"
ChannelProfileId: 3
UpdateChannelsBinding: true
- )", {allow ? NKikimrScheme::StatusAccepted : NKikimrScheme::StatusPreconditionFailed});
+ )", {allow ? NKikimrScheme::StatusAccepted : NKikimrScheme::StatusPreconditionFailed});
if (!allow) {
return;
@@ -8773,43 +8773,43 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
UpdateChannelsBindingSolomon(true);
}
- Y_UNIT_TEST(RejectAlterSolomon) { //+
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
- "PartitionCount: 2 ");
- env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Solomon"),
- {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(2)});
-
- TestAlterSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
- "PartitionCount: 100000000 "
- "ChannelProfileId: 0 ",
- { NKikimrScheme::StatusResourceExhausted });
-
- TestAlterSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
- "PartitionCount: 4 "
- "ChannelProfileId: 100 ",
- { NKikimrScheme::StatusInvalidParameter });
-
- TestAlterSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
- "PartitionCount: 4 ",
- { NKikimrScheme::StatusInvalidParameter });
-
- TestAlterSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
- "PartitionCount: 2 "
- "ChannelProfileId: 0 ",
- { NKikimrScheme::StatusSuccess });
-
- TestAlterSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
- "PartitionCount: 1 "
- "ChannelProfileId: 0 ",
- { NKikimrScheme::StatusInvalidParameter });
- }
-
-
+ Y_UNIT_TEST(RejectAlterSolomon) { //+
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
+ "PartitionCount: 2 ");
+ env.TestWaitNotification(runtime, txId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Solomon"),
+ {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(2)});
+
+ TestAlterSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
+ "PartitionCount: 100000000 "
+ "ChannelProfileId: 0 ",
+ { NKikimrScheme::StatusResourceExhausted });
+
+ TestAlterSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
+ "PartitionCount: 4 "
+ "ChannelProfileId: 100 ",
+ { NKikimrScheme::StatusInvalidParameter });
+
+ TestAlterSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
+ "PartitionCount: 4 ",
+ { NKikimrScheme::StatusInvalidParameter });
+
+ TestAlterSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
+ "PartitionCount: 2 "
+ "ChannelProfileId: 0 ",
+ { NKikimrScheme::StatusSuccess });
+
+ TestAlterSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
+ "PartitionCount: 1 "
+ "ChannelProfileId: 0 ",
+ { NKikimrScheme::StatusInvalidParameter });
+ }
+
+
Y_UNIT_TEST(CreateTableWithCompactionStrategies) {
TTestBasicRuntime runtime;
TTestEnv env(runtime);
@@ -8839,24 +8839,24 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
}
)",
{ KIKIMR_ALLOW_SHARDED_COMPACTION ?
- NKikimrScheme::StatusAccepted :
- NKikimrScheme::StatusInvalidParameter });
+ NKikimrScheme::StatusAccepted :
+ NKikimrScheme::StatusInvalidParameter });
if (KIKIMR_ALLOW_SHARDED_COMPACTION) {
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table2"),
- { [](const auto& result) {
- auto strategy = result
- .GetPathDescription()
- .GetTable()
- .GetPartitionConfig()
- .GetCompactionPolicy()
- .GetCompactionStrategy();
- UNIT_ASSERT(strategy == NKikimrSchemeOp::CompactionStrategySharded);}});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table2"),
+ { [](const auto& result) {
+ auto strategy = result
+ .GetPathDescription()
+ .GetTable()
+ .GetPartitionConfig()
+ .GetCompactionPolicy()
+ .GetCompactionStrategy();
+ UNIT_ASSERT(strategy == NKikimrSchemeOp::CompactionStrategySharded);}});
}
}
- Y_UNIT_TEST(AlterTableWithCompactionStrategies) { //+
+ Y_UNIT_TEST(AlterTableWithCompactionStrategies) { //+
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
@@ -8893,56 +8893,56 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
}
)",
{ KIKIMR_ALLOW_SHARDED_COMPACTION ?
- NKikimrScheme::StatusAccepted :
- NKikimrScheme::StatusInvalidParameter });
+ NKikimrScheme::StatusAccepted :
+ NKikimrScheme::StatusInvalidParameter });
if (KIKIMR_ALLOW_SHARDED_COMPACTION) {
env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
- { [](const auto& result) {
- auto strategy = result
- .GetPathDescription()
- .GetTable()
- .GetPartitionConfig()
- .GetCompactionPolicy()
- .GetCompactionStrategy();
- UNIT_ASSERT(strategy == NKikimrSchemeOp::CompactionStrategySharded);}});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
+ { [](const auto& result) {
+ auto strategy = result
+ .GetPathDescription()
+ .GetTable()
+ .GetPartitionConfig()
+ .GetCompactionPolicy()
+ .GetCompactionStrategy();
+ UNIT_ASSERT(strategy == NKikimrSchemeOp::CompactionStrategySharded);}});
}
}
- Y_UNIT_TEST(SimultaneousDropFroceDrop) { //+
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
-
- env.TestWaitNotification(runtime, 101);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist});
-
+ Y_UNIT_TEST(SimultaneousDropFroceDrop) { //+
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+
+ env.TestWaitNotification(runtime, 101);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist});
+
auto pathVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
- {NLs::PathExist,
- NLs::PathVersionEqual(3)});
-
- AsyncDropTable(runtime, ++txId, "/MyRoot", "Table1");
- AsyncForceDropUnsafe(runtime, ++txId, pathVer.PathId.LocalPathId);
- env.TestWaitNotification(runtime, {txId, txId-1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::NoChildren,
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomainOneOf({0, 1})});
- }
+ {NLs::PathExist,
+ NLs::PathVersionEqual(3)});
+
+ AsyncDropTable(runtime, ++txId, "/MyRoot", "Table1");
+ AsyncForceDropUnsafe(runtime, ++txId, pathVer.PathId.LocalPathId);
+ env.TestWaitNotification(runtime, {txId, txId-1});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::NoChildren,
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomainOneOf({0, 1})});
+ }
Y_UNIT_TEST(CreateWithIntermediateDirs) {
TTestBasicRuntime runtime;
@@ -8950,359 +8950,359 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
ui64 txId = 123;
TestMkDir(runtime, ++txId, "/MyRoot", "DirA/DirB");
- env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/DirB"),
- {NLs::Finished});
+ env.TestWaitNotification(runtime, txId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/DirB"),
+ {NLs::Finished});
TestMkDir(runtime, ++txId, "/MyRoot/DirA", "DirB/DirC");
- env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/DirB/DirC"),
- {NLs::Finished});
+ env.TestWaitNotification(runtime, txId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/DirB/DirC"),
+ {NLs::Finished});
TestCreateTable(runtime, ++txId, "/MyRoot",
R"( Name: "Tables/Table1"
Columns { Name: "RowId" Type: "Uint64" }
KeyColumnNames: ["RowId"]
)");
- env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Tables"),
- {NLs::Finished});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Tables/Table1"),
- {NLs::Finished,
- NLs::IsTable});
-
- TestCreatePQGroup(runtime, ++txId, "/MyRoot",
+ env.TestWaitNotification(runtime, txId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Tables"),
+ {NLs::Finished});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Tables/Table1"),
+ {NLs::Finished,
+ NLs::IsTable});
+
+ TestCreatePQGroup(runtime, ++txId, "/MyRoot",
R"( Name: "PQ/Topic1"
TotalGroupCount: 2
PartitionPerTablet: 2
PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}
)");
- env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/PQ"),
- {NLs::Finished});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/PQ/Topic1"),
- {NLs::Finished});
-
- TestMkDir(runtime, ++txId, "/MyRoot", "DirA/DirB", {NKikimrScheme::StatusAlreadyExists});
- TestMkDir(runtime, ++txId, "/MyRoot/DirC", "DirA/DirB", {NKikimrScheme::StatusPathDoesNotExist});
- TestMkDir(runtime, ++txId, "/MyRoot/DirA", "/DirD/DirE", {NKikimrScheme::StatusSchemeError});
- TestMkDir(runtime, ++txId, "/MyRoot/DirA", "DirD/DirE/", {NKikimrScheme::StatusSchemeError});
- TestMkDir(runtime, ++txId, "/MyRoot/Tables/Table1", "DirA/DirB", {NKikimrScheme::StatusPathIsNotDirectory});
+ env.TestWaitNotification(runtime, txId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/PQ"),
+ {NLs::Finished});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/PQ/Topic1"),
+ {NLs::Finished});
+
+ TestMkDir(runtime, ++txId, "/MyRoot", "DirA/DirB", {NKikimrScheme::StatusAlreadyExists});
+ TestMkDir(runtime, ++txId, "/MyRoot/DirC", "DirA/DirB", {NKikimrScheme::StatusPathDoesNotExist});
+ TestMkDir(runtime, ++txId, "/MyRoot/DirA", "/DirD/DirE", {NKikimrScheme::StatusSchemeError});
+ TestMkDir(runtime, ++txId, "/MyRoot/DirA", "DirD/DirE/", {NKikimrScheme::StatusSchemeError});
+ TestMkDir(runtime, ++txId, "/MyRoot/Tables/Table1", "DirA/DirB", {NKikimrScheme::StatusPathIsNotDirectory});
TestMkDir(runtime, ++txId, "/MyRoot", "x/y/z");
- env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/x/y/z"),
- {NLs::Finished,
- NLs::CreatedAt(txId)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/x/y"),
- {NLs::Finished,
- NLs::CreatedAt(txId)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/x"),
- {NLs::Finished,
- NLs::CreatedAt(txId)});
-
+ env.TestWaitNotification(runtime, txId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/x/y/z"),
+ {NLs::Finished,
+ NLs::CreatedAt(txId)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/x/y"),
+ {NLs::Finished,
+ NLs::CreatedAt(txId)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/x"),
+ {NLs::Finished,
+ NLs::CreatedAt(txId)});
+
TestRmDir(runtime, ++txId, "/MyRoot/x/y", "z");
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
TestRmDir(runtime, ++txId, "/MyRoot/x", "y");
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
TestMkDir(runtime, ++txId, "/MyRoot", "x/y/z");
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
TestRmDir(runtime, ++txId, "/MyRoot/x/y", "z");
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
TestMkDir(runtime, ++txId, "/MyRoot", "x/y/z");
- env.TestWaitNotification(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
TestCreateTable(runtime, ++txId, "/MyRoot",
R"( Name: "WrongTables/Table1"
Columns { Name: "RowId" Type: "Uint64" }
KeyColumnNames: ["WrongRowId"]
- )", {NKikimrScheme::StatusSchemeError});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/WrongTables"),
- {NLs::PathNotExist});
+ )", {NKikimrScheme::StatusSchemeError});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/WrongTables"),
+ {NLs::PathNotExist});
}
-
- Y_UNIT_TEST(AlterTableAndAfterSplit) { //+
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 123;
-
- TestCreateSubDomain(runtime, ++txId, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\""
- "StoragePools {"
- " Name: \"name_USER_0_kind_hdd-1\""
- " Kind: \"hdd-1\""
- "}"
- "StoragePools {"
- " Name: \"name_USER_0_kind_hdd-2\""
- " Kind: \"hdd-2\""
- "}");
-
- TestCreateTable(runtime, ++txId, "/MyRoot/USER_0", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key"]
- UniformPartitionsCount: 1
- PartitionConfig {
- CompactionPolicy {
- InMemSizeToSnapshot: 4194304
- InMemStepsToSnapshot: 300
- InMemForceStepsToSnapshot: 500
- InMemForceSizeToSnapshot: 16777216
- InMemCompactionBrokerQueue: 0
- ReadAheadHiThreshold: 67108864
- ReadAheadLoThreshold: 16777216
- MinDataPageSize: 7168
- SnapBrokerQueue: 0
- Generation {
- GenerationId: 0
- SizeToCompact: 0
- CountToCompact: 8
- ForceCountToCompact: 8
- ForceSizeToCompact: 134217728
- CompactionBrokerQueue: 1
- KeepInCache: true
- }
- }
- ColumnFamilies {
- Id: 0
- ColumnCodec: ColumnCodecPlain
- ColumnCache: ColumnCacheNone
- StorageConfig {
- SysLog {
- PreferredPoolKind: "hdd-1"
- }
- Log {
- PreferredPoolKind: "hdd-1"
- }
- Data {
- PreferredPoolKind: "hdd-1"
- }
- External {
- PreferredPoolKind: "hdd-2"
- }
- ExternalThreshold: 524288
- }
- }
- ColumnFamilies {
- Id: 0
- ColumnCodec: ColumnCodecPlain
- ColumnCache: ColumnCacheNone
- StorageConfig {
- SysLog {
- PreferredPoolKind: "hdd-1"
- }
- Log {
- PreferredPoolKind: "hdd-1"
- }
- Data {
- PreferredPoolKind: "hdd-1"
- }
- External {
- PreferredPoolKind: "hdd-2"
- }
- ExternalThreshold: 524288
- }
- }
- }
- )", {NKikimrScheme::StatusInvalidParameter});
- env.TestWaitNotification(runtime, txId);
-
- TestCreateTable(runtime, ++txId, "/MyRoot/USER_0", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key"]
- UniformPartitionsCount: 1
- PartitionConfig {
- CompactionPolicy {
- InMemSizeToSnapshot: 4194304
- InMemStepsToSnapshot: 300
- InMemForceStepsToSnapshot: 500
- InMemForceSizeToSnapshot: 16777216
- InMemCompactionBrokerQueue: 0
- ReadAheadHiThreshold: 67108864
- ReadAheadLoThreshold: 16777216
- MinDataPageSize: 7168
- SnapBrokerQueue: 0
- Generation {
- GenerationId: 0
- SizeToCompact: 0
- CountToCompact: 8
- ForceCountToCompact: 8
- ForceSizeToCompact: 134217728
- CompactionBrokerQueue: 1
- KeepInCache: true
- }
- }
- ColumnFamilies {
- Id: 0
- ColumnCodec: ColumnCodecPlain
- ColumnCache: ColumnCacheNone
- StorageConfig {
- SysLog {
- PreferredPoolKind: "hdd-1"
- }
- Log {
- PreferredPoolKind: "hdd-1"
- }
- Data {
- PreferredPoolKind: "hdd-1"
- }
- External {
- PreferredPoolKind: "hdd-2"
- }
- ExternalThreshold: 524288
- }
- }
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestAlterTable(runtime, ++txId, "/MyRoot/USER_0", R"(
- Name: "Table"
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- ColumnCodec: ColumnCodecLZ4
- ColumnCache: ColumnCacheNone
- StorageConfig {
- SysLog {
- PreferredPoolKind: "hdd-1"
- }
- Log {
- PreferredPoolKind: "hdd-1"
- }
- Data {
- PreferredPoolKind: "hdd-1"
- }
- External {
- PreferredPoolKind: "hdd-2"
- }
- ExternalThreshold: 5204288
- }
- }
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/Table", true, true),
- {[] (auto describeRes) {
- auto& partConfig = describeRes.GetPathDescription().GetTable().GetPartitionConfig();
- UNIT_ASSERT_VALUES_EQUAL_C(partConfig.ColumnFamiliesSize(), 1, "ColumnFamilies is uniq");
- UNIT_ASSERT_VALUES_EQUAL_C(partConfig.GetColumnFamilies(0).GetStorageConfig().GetExternalThreshold(), 5204288, "ExternalThreshold is altered");
- UNIT_ASSERT_VALUES_EQUAL_C((int)partConfig.GetColumnFamilies(0).GetColumnCodec(), (int)NKikimrSchemeOp::EColumnCodec::ColumnCodecLZ4, "ColumnCodec is altered");
- }});
-
- TestSplitTable(runtime, ++txId, "/MyRoot/USER_0/Table", R"(
- SourceTabletId: 9437196
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Uint32: 1000 } }
- }
- })");
- env.TestWaitNotification(runtime, txId);
-
- TestAlterTable(runtime, ++txId, "/MyRoot/USER_0", R"(
- Name: "Table"
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- ColumnCodec: ColumnCodecLZ4
- ColumnCache: ColumnCacheEver
- StorageConfig {
- SysLog {
- PreferredPoolKind: "hdd-1"
- }
- Log {
- PreferredPoolKind: "hdd-1"
- }
- Data {
- PreferredPoolKind: "hdd-1"
- }
- External {
- PreferredPoolKind: "hdd-2"
- }
- ExternalThreshold: 5604288
- }
- }
- })");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/Table", true, true),
- {[] (auto describeRes) {
- auto& partConfig = describeRes.GetPathDescription().GetTable().GetPartitionConfig();
- UNIT_ASSERT_VALUES_EQUAL_C(partConfig.ColumnFamiliesSize(), 1, "ColumnFamilies is uniq");
- UNIT_ASSERT_VALUES_EQUAL_C(partConfig.GetColumnFamilies(0).GetStorageConfig().GetExternalThreshold(), 5604288, "ExternalThreshold is altered");
- UNIT_ASSERT_VALUES_EQUAL_C((int)partConfig.GetColumnFamilies(0).GetColumnCache(), (int)NKikimrSchemeOp::EColumnCache::ColumnCacheEver, "ColumnCache is altered");
- }});
-
- TestAlterTable(runtime, ++txId, "/MyRoot/USER_0", R"(
- Name: "Table"
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- ColumnCodec: ColumnCodecLZ4
- ColumnCache: ColumnCacheEver
- StorageConfig {
- ExternalThreshold: 5604289
- }
- }
- })");
- env.TestWaitNotification(runtime, txId);
-
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/Table", true, true),
- {[] (auto describeRes) {
- auto& partConfig = describeRes.GetPathDescription().GetTable().GetPartitionConfig();
- UNIT_ASSERT_VALUES_EQUAL_C(partConfig.ColumnFamiliesSize(), 1, "ColumnFamilies is uniq");
- UNIT_ASSERT_VALUES_EQUAL_C(partConfig.GetColumnFamilies(0).GetStorageConfig().GetExternalThreshold(), 5604289, "ExternalThreshold is altered");
- UNIT_ASSERT_VALUES_EQUAL_C((int)partConfig.GetColumnFamilies(0).GetColumnCache(), (int)NKikimrSchemeOp::EColumnCache::ColumnCacheEver, "ColumnCache is altered");
- const auto& storageConfig = partConfig.GetColumnFamilies(0).GetStorageConfig();
- UNIT_ASSERT_VALUES_EQUAL_C(storageConfig.GetSysLog().GetPreferredPoolKind(), "hdd-1", "SysLog pool kind must not be lost");
- UNIT_ASSERT_VALUES_EQUAL_C(storageConfig.GetLog().GetPreferredPoolKind(), "hdd-1", "Log pool kind must not be lost");
- UNIT_ASSERT_VALUES_EQUAL_C(storageConfig.GetData().GetPreferredPoolKind(), "hdd-1", "Data pool kind must not be lost");
- UNIT_ASSERT_VALUES_EQUAL_C(storageConfig.GetExternal().GetPreferredPoolKind(), "hdd-2", "External pool kind must not be lost");
- }});
-
- TestAlterTable(runtime, ++txId, "/MyRoot/USER_0", R"(
- Name: "Table"
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- ColumnCodec: ColumnCodecLZ4
- ColumnCache: ColumnCacheEver
- StorageConfig {
- SysLog {
- PreferredPoolKind: "hdd-1"
- }
- Log {
- PreferredPoolKind: "hdd-1"
- }
- Data {
- PreferredPoolKind: "hdd-1"
- }
- External {
- PreferredPoolKind: "hdd-2"
- }
- ExternalThreshold: 5604288
- }
- }
- StorageRooms {}
- }
- )", {NKikimrScheme::StatusInvalidParameter});
-
- // Drop the table and wait for everytTFamilyDescriptionhing to be cleaned up
- TestDropTable(runtime, ++txId, "/MyRoot/USER_0", "Table");
- env.TestWaitNotification(runtime, txId);
+
+ Y_UNIT_TEST(AlterTableAndAfterSplit) { //+
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 123;
+
+ TestCreateSubDomain(runtime, ++txId, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\""
+ "StoragePools {"
+ " Name: \"name_USER_0_kind_hdd-1\""
+ " Kind: \"hdd-1\""
+ "}"
+ "StoragePools {"
+ " Name: \"name_USER_0_kind_hdd-2\""
+ " Kind: \"hdd-2\""
+ "}");
+
+ TestCreateTable(runtime, ++txId, "/MyRoot/USER_0", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key"]
+ UniformPartitionsCount: 1
+ PartitionConfig {
+ CompactionPolicy {
+ InMemSizeToSnapshot: 4194304
+ InMemStepsToSnapshot: 300
+ InMemForceStepsToSnapshot: 500
+ InMemForceSizeToSnapshot: 16777216
+ InMemCompactionBrokerQueue: 0
+ ReadAheadHiThreshold: 67108864
+ ReadAheadLoThreshold: 16777216
+ MinDataPageSize: 7168
+ SnapBrokerQueue: 0
+ Generation {
+ GenerationId: 0
+ SizeToCompact: 0
+ CountToCompact: 8
+ ForceCountToCompact: 8
+ ForceSizeToCompact: 134217728
+ CompactionBrokerQueue: 1
+ KeepInCache: true
+ }
+ }
+ ColumnFamilies {
+ Id: 0
+ ColumnCodec: ColumnCodecPlain
+ ColumnCache: ColumnCacheNone
+ StorageConfig {
+ SysLog {
+ PreferredPoolKind: "hdd-1"
+ }
+ Log {
+ PreferredPoolKind: "hdd-1"
+ }
+ Data {
+ PreferredPoolKind: "hdd-1"
+ }
+ External {
+ PreferredPoolKind: "hdd-2"
+ }
+ ExternalThreshold: 524288
+ }
+ }
+ ColumnFamilies {
+ Id: 0
+ ColumnCodec: ColumnCodecPlain
+ ColumnCache: ColumnCacheNone
+ StorageConfig {
+ SysLog {
+ PreferredPoolKind: "hdd-1"
+ }
+ Log {
+ PreferredPoolKind: "hdd-1"
+ }
+ Data {
+ PreferredPoolKind: "hdd-1"
+ }
+ External {
+ PreferredPoolKind: "hdd-2"
+ }
+ ExternalThreshold: 524288
+ }
+ }
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+ env.TestWaitNotification(runtime, txId);
+
+ TestCreateTable(runtime, ++txId, "/MyRoot/USER_0", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key"]
+ UniformPartitionsCount: 1
+ PartitionConfig {
+ CompactionPolicy {
+ InMemSizeToSnapshot: 4194304
+ InMemStepsToSnapshot: 300
+ InMemForceStepsToSnapshot: 500
+ InMemForceSizeToSnapshot: 16777216
+ InMemCompactionBrokerQueue: 0
+ ReadAheadHiThreshold: 67108864
+ ReadAheadLoThreshold: 16777216
+ MinDataPageSize: 7168
+ SnapBrokerQueue: 0
+ Generation {
+ GenerationId: 0
+ SizeToCompact: 0
+ CountToCompact: 8
+ ForceCountToCompact: 8
+ ForceSizeToCompact: 134217728
+ CompactionBrokerQueue: 1
+ KeepInCache: true
+ }
+ }
+ ColumnFamilies {
+ Id: 0
+ ColumnCodec: ColumnCodecPlain
+ ColumnCache: ColumnCacheNone
+ StorageConfig {
+ SysLog {
+ PreferredPoolKind: "hdd-1"
+ }
+ Log {
+ PreferredPoolKind: "hdd-1"
+ }
+ Data {
+ PreferredPoolKind: "hdd-1"
+ }
+ External {
+ PreferredPoolKind: "hdd-2"
+ }
+ ExternalThreshold: 524288
+ }
+ }
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestAlterTable(runtime, ++txId, "/MyRoot/USER_0", R"(
+ Name: "Table"
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ ColumnCodec: ColumnCodecLZ4
+ ColumnCache: ColumnCacheNone
+ StorageConfig {
+ SysLog {
+ PreferredPoolKind: "hdd-1"
+ }
+ Log {
+ PreferredPoolKind: "hdd-1"
+ }
+ Data {
+ PreferredPoolKind: "hdd-1"
+ }
+ External {
+ PreferredPoolKind: "hdd-2"
+ }
+ ExternalThreshold: 5204288
+ }
+ }
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/Table", true, true),
+ {[] (auto describeRes) {
+ auto& partConfig = describeRes.GetPathDescription().GetTable().GetPartitionConfig();
+ UNIT_ASSERT_VALUES_EQUAL_C(partConfig.ColumnFamiliesSize(), 1, "ColumnFamilies is uniq");
+ UNIT_ASSERT_VALUES_EQUAL_C(partConfig.GetColumnFamilies(0).GetStorageConfig().GetExternalThreshold(), 5204288, "ExternalThreshold is altered");
+ UNIT_ASSERT_VALUES_EQUAL_C((int)partConfig.GetColumnFamilies(0).GetColumnCodec(), (int)NKikimrSchemeOp::EColumnCodec::ColumnCodecLZ4, "ColumnCodec is altered");
+ }});
+
+ TestSplitTable(runtime, ++txId, "/MyRoot/USER_0/Table", R"(
+ SourceTabletId: 9437196
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint32: 1000 } }
+ }
+ })");
+ env.TestWaitNotification(runtime, txId);
+
+ TestAlterTable(runtime, ++txId, "/MyRoot/USER_0", R"(
+ Name: "Table"
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ ColumnCodec: ColumnCodecLZ4
+ ColumnCache: ColumnCacheEver
+ StorageConfig {
+ SysLog {
+ PreferredPoolKind: "hdd-1"
+ }
+ Log {
+ PreferredPoolKind: "hdd-1"
+ }
+ Data {
+ PreferredPoolKind: "hdd-1"
+ }
+ External {
+ PreferredPoolKind: "hdd-2"
+ }
+ ExternalThreshold: 5604288
+ }
+ }
+ })");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/Table", true, true),
+ {[] (auto describeRes) {
+ auto& partConfig = describeRes.GetPathDescription().GetTable().GetPartitionConfig();
+ UNIT_ASSERT_VALUES_EQUAL_C(partConfig.ColumnFamiliesSize(), 1, "ColumnFamilies is uniq");
+ UNIT_ASSERT_VALUES_EQUAL_C(partConfig.GetColumnFamilies(0).GetStorageConfig().GetExternalThreshold(), 5604288, "ExternalThreshold is altered");
+ UNIT_ASSERT_VALUES_EQUAL_C((int)partConfig.GetColumnFamilies(0).GetColumnCache(), (int)NKikimrSchemeOp::EColumnCache::ColumnCacheEver, "ColumnCache is altered");
+ }});
+
+ TestAlterTable(runtime, ++txId, "/MyRoot/USER_0", R"(
+ Name: "Table"
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ ColumnCodec: ColumnCodecLZ4
+ ColumnCache: ColumnCacheEver
+ StorageConfig {
+ ExternalThreshold: 5604289
+ }
+ }
+ })");
+ env.TestWaitNotification(runtime, txId);
+
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/Table", true, true),
+ {[] (auto describeRes) {
+ auto& partConfig = describeRes.GetPathDescription().GetTable().GetPartitionConfig();
+ UNIT_ASSERT_VALUES_EQUAL_C(partConfig.ColumnFamiliesSize(), 1, "ColumnFamilies is uniq");
+ UNIT_ASSERT_VALUES_EQUAL_C(partConfig.GetColumnFamilies(0).GetStorageConfig().GetExternalThreshold(), 5604289, "ExternalThreshold is altered");
+ UNIT_ASSERT_VALUES_EQUAL_C((int)partConfig.GetColumnFamilies(0).GetColumnCache(), (int)NKikimrSchemeOp::EColumnCache::ColumnCacheEver, "ColumnCache is altered");
+ const auto& storageConfig = partConfig.GetColumnFamilies(0).GetStorageConfig();
+ UNIT_ASSERT_VALUES_EQUAL_C(storageConfig.GetSysLog().GetPreferredPoolKind(), "hdd-1", "SysLog pool kind must not be lost");
+ UNIT_ASSERT_VALUES_EQUAL_C(storageConfig.GetLog().GetPreferredPoolKind(), "hdd-1", "Log pool kind must not be lost");
+ UNIT_ASSERT_VALUES_EQUAL_C(storageConfig.GetData().GetPreferredPoolKind(), "hdd-1", "Data pool kind must not be lost");
+ UNIT_ASSERT_VALUES_EQUAL_C(storageConfig.GetExternal().GetPreferredPoolKind(), "hdd-2", "External pool kind must not be lost");
+ }});
+
+ TestAlterTable(runtime, ++txId, "/MyRoot/USER_0", R"(
+ Name: "Table"
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ ColumnCodec: ColumnCodecLZ4
+ ColumnCache: ColumnCacheEver
+ StorageConfig {
+ SysLog {
+ PreferredPoolKind: "hdd-1"
+ }
+ Log {
+ PreferredPoolKind: "hdd-1"
+ }
+ Data {
+ PreferredPoolKind: "hdd-1"
+ }
+ External {
+ PreferredPoolKind: "hdd-2"
+ }
+ ExternalThreshold: 5604288
+ }
+ }
+ StorageRooms {}
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+
+ // Drop the table and wait for everytTFamilyDescriptionhing to be cleaned up
+ TestDropTable(runtime, ++txId, "/MyRoot/USER_0", "Table");
+ env.TestWaitNotification(runtime, txId);
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets+2, TTestTxConfig::FakeHiveTablets+10));
- }
+ }
Y_UNIT_TEST(RejectSystemViewPath) {
TTestBasicRuntime runtime;
@@ -9313,11 +9313,11 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
"Name: \".sys\""
"Columns { Name: \"key\" Type: \"Uint32\"}"
"KeyColumnNames: [\"key\"]",
- {NKikimrScheme::StatusSchemeError});
+ {NKikimrScheme::StatusSchemeError});
- TestMkDir(runtime, ++txId, "/MyRoot", ".sys", {NKikimrScheme::StatusSchemeError});
- TestMkDir(runtime, ++txId, "/MyRoot", ".sys/partition_stats", {NKikimrScheme::StatusSchemeError});
- TestMkDir(runtime, ++txId, "/MyRoot", "DirA/.sys/partition_stats", {NKikimrScheme::StatusSchemeError});
+ TestMkDir(runtime, ++txId, "/MyRoot", ".sys", {NKikimrScheme::StatusSchemeError});
+ TestMkDir(runtime, ++txId, "/MyRoot", ".sys/partition_stats", {NKikimrScheme::StatusSchemeError});
+ TestMkDir(runtime, ++txId, "/MyRoot", "DirA/.sys/partition_stats", {NKikimrScheme::StatusSchemeError});
}
Y_UNIT_TEST(DocumentApiVersion) {
@@ -9331,7 +9331,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
"Columns { Name: \"Key\" Type: \"Uint64\"} "
"Columns { Name: \"Value\" Type: \"Uint64\"} "
"KeyColumnNames: [\"Key\"]",
- {NKikimrScheme::StatusInvalidParameter},
+ {NKikimrScheme::StatusInvalidParameter},
AlterUserAttrs({{"__document_api_version", "foo"}}));
// Document api version cannot be zero
@@ -9340,7 +9340,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
"Columns { Name: \"Key\" Type: \"Uint64\"} "
"Columns { Name: \"Value\" Type: \"Uint64\"} "
"KeyColumnNames: [\"Key\"]",
- {NKikimrScheme::StatusInvalidParameter},
+ {NKikimrScheme::StatusInvalidParameter},
AlterUserAttrs({{"__document_api_version", "0"}}));
// Document api version 1 is ok
@@ -9375,7 +9375,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
// Creating other objects (e.g. directories) with document api version is not allowed
TestMkDir(runtime, ++txId, "/MyRoot", "DirA",
- {NKikimrScheme::StatusInvalidParameter},
+ {NKikimrScheme::StatusInvalidParameter},
AlterUserAttrs({{"__document_api_version", "1"}}));
}
@@ -9581,270 +9581,270 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
UNIT_ASSERT_VALUES_EQUAL(splitKey, "(Uint64 : 2, Utf8 : bbb, Uint32 : NULL)");
}
}
-
- Y_UNIT_TEST(ListNotCreatedDirCase) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime, TTestEnvOptions().EnableAsyncIndexes(true));
- ui64 txId = 100;
-
- TVector<THolder<IEventHandle>> supressed;
- auto defOberver = SetSuppressObserver(runtime, supressed, TEvTxProcessing::EvPlanStep);
- TestMkDir(runtime, ++txId, "/MyRoot", "Dir");
- WaitForSuppressed(runtime, supressed, 1, defOberver);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir"),
- {NLs::NotFinished,
- NLs::PathVersionEqual(2),
- NLs::ChildrenCount(0)});
-
- for (auto &msg : supressed) {
- runtime.Send(msg.Release());
- }
- supressed.clear();
-
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir"),
- {NLs::Finished,
- NLs::PathVersionEqual(3),
- NLs::ChildrenCount(0)});
- }
-
- Y_UNIT_TEST(ListNotCreatedIndexCase) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime, TTestEnvOptions().EnableAsyncIndexes(true));
- ui64 txId = 100;
-
- TVector<THolder<IEventHandle>> supressed;
- auto defOberver = SetSuppressObserver(runtime, supressed, TEvTxProcessing::EvPlanStep);
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
- TableDescription {
- Name: "Dir/Table"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "indexed" Type: "Uint64" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndex"
- KeyColumnNames: ["indexed"]
- Type: EIndexTypeGlobalAsync
- }
- )");
- WaitForSuppressed(runtime, supressed, 1, defOberver);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished,
- NLs::ChildrenCount(1),
- NLs::ShardsInsideDomain(2),
- NLs::PathsInsideDomain(4)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir"),
- {NLs::NotFinished,
- NLs::PathVersionEqual(3),
- NLs::ChildrenCount(1)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir/Table"),
- {NLs::NotFinished,
- NLs::PathVersionEqual(1),
- NLs::ChildrenCount(0)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir/Table/UserDefinedIndex", true, true, true),
- {NLs::NotFinished,
- NLs::PathVersionEqual(1),
- NLs::ChildrenCount(1)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir/Table/UserDefinedIndex/indexImplTable", true, true, true),
- {NLs::NotFinished,
- NLs::PathVersionEqual(1),
- NLs::ChildrenCount(0)});
-
- for (auto &msg : supressed) {
- runtime.Send(msg.Release());
- }
- supressed.clear();
-
- env.TestWaitNotification(runtime, txId);
-
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished,
- NLs::ChildrenCount(1),
- NLs::ShardsInsideDomain(2),
- NLs::PathsInsideDomain(4)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir"),
- {NLs::Finished,
- NLs::PathVersionEqual(5),
- NLs::ChildrenCount(1)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir/Table"),
- {NLs::Finished,
- NLs::PathVersionEqual(3),
- NLs::ChildrenCount(0)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir/Table/UserDefinedIndex", true, true, true),
- {NLs::Finished,
- NLs::PathVersionEqual(2),
- NLs::ChildrenCount(1)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir/Table/UserDefinedIndex/indexImplTable", true, true, true),
- {NLs::Finished,
- NLs::PathVersionEqual(3),
- NLs::ChildrenCount(0)});
- }
-
- Y_UNIT_TEST(ConsistentCopyAfterDropIndexes) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime, TTestEnvOptions().EnableAsyncIndexes(true));
- ui64 txId = 100;
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- env.TestWaitNotification(runtime, txId);
-
- {
- auto fnWriteRow = [&] (ui64 tabletId, ui32 key) {
- TString writeQuery = Sprintf(R"(
- (
- (let key '( '('key (Uint64 '%u)) ) )
- (let value '('('value (Utf8 'aaaaaaaa)) ) )
- (return (AsList (UpdateRow '__user__Table1 key value) ))
- )
- )", key);
- NKikimrMiniKQL::TResult result;
- TString err;
- ui32 res = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
- UNIT_ASSERT_VALUES_EQUAL(res, 0);
- };
+
+ Y_UNIT_TEST(ListNotCreatedDirCase) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime, TTestEnvOptions().EnableAsyncIndexes(true));
+ ui64 txId = 100;
+
+ TVector<THolder<IEventHandle>> supressed;
+ auto defOberver = SetSuppressObserver(runtime, supressed, TEvTxProcessing::EvPlanStep);
+ TestMkDir(runtime, ++txId, "/MyRoot", "Dir");
+ WaitForSuppressed(runtime, supressed, 1, defOberver);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir"),
+ {NLs::NotFinished,
+ NLs::PathVersionEqual(2),
+ NLs::ChildrenCount(0)});
+
+ for (auto &msg : supressed) {
+ runtime.Send(msg.Release());
+ }
+ supressed.clear();
+
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(3),
+ NLs::ChildrenCount(0)});
+ }
+
+ Y_UNIT_TEST(ListNotCreatedIndexCase) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime, TTestEnvOptions().EnableAsyncIndexes(true));
+ ui64 txId = 100;
+
+ TVector<THolder<IEventHandle>> supressed;
+ auto defOberver = SetSuppressObserver(runtime, supressed, TEvTxProcessing::EvPlanStep);
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
+ TableDescription {
+ Name: "Dir/Table"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "indexed" Type: "Uint64" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndex"
+ KeyColumnNames: ["indexed"]
+ Type: EIndexTypeGlobalAsync
+ }
+ )");
+ WaitForSuppressed(runtime, supressed, 1, defOberver);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished,
+ NLs::ChildrenCount(1),
+ NLs::ShardsInsideDomain(2),
+ NLs::PathsInsideDomain(4)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir"),
+ {NLs::NotFinished,
+ NLs::PathVersionEqual(3),
+ NLs::ChildrenCount(1)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir/Table"),
+ {NLs::NotFinished,
+ NLs::PathVersionEqual(1),
+ NLs::ChildrenCount(0)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir/Table/UserDefinedIndex", true, true, true),
+ {NLs::NotFinished,
+ NLs::PathVersionEqual(1),
+ NLs::ChildrenCount(1)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir/Table/UserDefinedIndex/indexImplTable", true, true, true),
+ {NLs::NotFinished,
+ NLs::PathVersionEqual(1),
+ NLs::ChildrenCount(0)});
+
+ for (auto &msg : supressed) {
+ runtime.Send(msg.Release());
+ }
+ supressed.clear();
+
+ env.TestWaitNotification(runtime, txId);
+
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished,
+ NLs::ChildrenCount(1),
+ NLs::ShardsInsideDomain(2),
+ NLs::PathsInsideDomain(4)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(5),
+ NLs::ChildrenCount(1)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir/Table"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(3),
+ NLs::ChildrenCount(0)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir/Table/UserDefinedIndex", true, true, true),
+ {NLs::Finished,
+ NLs::PathVersionEqual(2),
+ NLs::ChildrenCount(1)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir/Table/UserDefinedIndex/indexImplTable", true, true, true),
+ {NLs::Finished,
+ NLs::PathVersionEqual(3),
+ NLs::ChildrenCount(0)});
+ }
+
+ Y_UNIT_TEST(ConsistentCopyAfterDropIndexes) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime, TTestEnvOptions().EnableAsyncIndexes(true));
+ ui64 txId = 100;
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ {
+ auto fnWriteRow = [&] (ui64 tabletId, ui32 key) {
+ TString writeQuery = Sprintf(R"(
+ (
+ (let key '( '('key (Uint64 '%u)) ) )
+ (let value '('('value (Utf8 'aaaaaaaa)) ) )
+ (return (AsList (UpdateRow '__user__Table1 key value) ))
+ )
+ )", key);
+ NKikimrMiniKQL::TResult result;
+ TString err;
+ ui32 res = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
+ UNIT_ASSERT_VALUES_EQUAL(res, 0);
+ };
fnWriteRow(TTestTxConfig::FakeHiveTablets, 0);
- }
-
+ }
+
TestBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/Table1", "Sync", {"value"});
env.TestWaitNotification(runtime, txId, TTestTxConfig::SchemeShard);
-
+
auto descr = TestGetBuilIndex(runtime, TTestTxConfig::SchemeShard, "/MyRoot", txId);
- Y_ASSERT(descr.GetIndexBuild().GetState() == Ydb::Table::IndexBuildState::STATE_DONE);
-
- TestCopyTable(runtime, ++txId, "/MyRoot", "Copy1", "/MyRoot/Table1");
- env.TestWaitNotification(runtime, txId);
-
+ Y_ASSERT(descr.GetIndexBuild().GetState() == Ydb::Table::IndexBuildState::STATE_DONE);
+
+ TestCopyTable(runtime, ++txId, "/MyRoot", "Copy1", "/MyRoot/Table1");
+ env.TestWaitNotification(runtime, txId);
+
TestDropTableIndex(runtime, ++txId, "/MyRoot", R"(
TableName: "Table1"
IndexName: "Sync"
)");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(2),
- NLs::PathsInsideDomain(4),
- NLs::ShardsInsideDomain(4)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
- {NLs::IsTable,
- NLs::PathVersionEqual(7),
- NLs::CheckColumns("Table1", {"key", "value"}, {}, {"key"}),
- NLs::IndexesCount(0)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy1"),
- {NLs::IsTable,
- NLs::PathVersionEqual(3),
- NLs::CheckColumns("Copy1", {"key", "value"}, {}, {"key"}),
- NLs::IndexesCount(1)});
-
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(2),
+ NLs::PathsInsideDomain(4),
+ NLs::ShardsInsideDomain(4)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(7),
+ NLs::CheckColumns("Table1", {"key", "value"}, {}, {"key"}),
+ NLs::IndexesCount(0)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy1"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(3),
+ NLs::CheckColumns("Copy1", {"key", "value"}, {}, {"key"}),
+ NLs::IndexesCount(1)});
+
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/Table1"
- DstPath: "/MyRoot/Copy2"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/Copy1"
- DstPath: "/MyRoot/Copy3"
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(4),
- NLs::PathsInsideDomain(8),
- NLs::ShardsInsideDomain(7)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
- {NLs::IsTable,
- NLs::PathVersionEqual(7),
- NLs::IndexesCount(0)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy1"),
- {NLs::IsTable,
- NLs::PathVersionEqual(3),
- NLs::IndexesCount(1)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy2"),
- {NLs::IsTable,
- NLs::PathVersionEqual(3),
- NLs::IndexesCount(0)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy3"),
- {NLs::IsTable,
- NLs::PathVersionEqual(3),
- NLs::IndexesCount(1)});
- }
-
- Y_UNIT_TEST(SplitAlterCopy) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- env.TestWaitNotification(runtime, txId);
-
- {
- TVector<THolder<IEventHandle>> supressed;
- auto defOberver = SetSuppressObserver(runtime, supressed, TEvDataShard::EvInitSplitMergeDestination);
-
- ++txId;
- TestSplitTable(runtime, 103, "/MyRoot/Table", R"(
- SourceTabletId: 9437194
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Uint64: 1000 } }
- }
- })");
- ++txId;
- TestAlterTable(runtime, 102, "/MyRoot",
- R"(Name: "Table"
- Columns { Name: "add_1" Type: "Uint32"}
- )");
-
- WaitForSuppressed(runtime, supressed, 2, defOberver);
- }
-
- {
- TVector<THolder<IEventHandle>> supressed;
- auto defOberver = SetSuppressObserver(runtime, supressed, TEvTxProcessing::EvPlanStep);
-
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/Table1"
+ DstPath: "/MyRoot/Copy2"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/Copy1"
+ DstPath: "/MyRoot/Copy3"
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(4),
+ NLs::PathsInsideDomain(8),
+ NLs::ShardsInsideDomain(7)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(7),
+ NLs::IndexesCount(0)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy1"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(3),
+ NLs::IndexesCount(1)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy2"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(3),
+ NLs::IndexesCount(0)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Copy3"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(3),
+ NLs::IndexesCount(1)});
+ }
+
+ Y_UNIT_TEST(SplitAlterCopy) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ {
+ TVector<THolder<IEventHandle>> supressed;
+ auto defOberver = SetSuppressObserver(runtime, supressed, TEvDataShard::EvInitSplitMergeDestination);
+
+ ++txId;
+ TestSplitTable(runtime, 103, "/MyRoot/Table", R"(
+ SourceTabletId: 9437194
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint64: 1000 } }
+ }
+ })");
+ ++txId;
+ TestAlterTable(runtime, 102, "/MyRoot",
+ R"(Name: "Table"
+ Columns { Name: "add_1" Type: "Uint32"}
+ )");
+
+ WaitForSuppressed(runtime, supressed, 2, defOberver);
+ }
+
+ {
+ TVector<THolder<IEventHandle>> supressed;
+ auto defOberver = SetSuppressObserver(runtime, supressed, TEvTxProcessing::EvPlanStep);
+
RebootTablet(runtime, TTestTxConfig::SchemeShard, runtime.AllocateEdgeActor());
-
- env.TestWaitNotification(runtime, 103);
-
+
+ env.TestWaitNotification(runtime, 103);
+
TestConsistentCopyTables(runtime, ++txId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/Table"
- DstPath: "/MyRoot/copy"
- })", {NKikimrScheme::StatusMultipleModifications});
-
- WaitForSuppressed(runtime, supressed, 3, defOberver);
- }
-
- }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/Table"
+ DstPath: "/MyRoot/copy"
+ })", {NKikimrScheme::StatusMultipleModifications});
+
+ WaitForSuppressed(runtime, supressed, 3, defOberver);
+ }
+
+ }
}
diff --git a/ydb/core/tx/schemeshard/ut_base/ya.make b/ydb/core/tx/schemeshard/ut_base/ya.make
index 1755cc292f4..430ee1310e4 100644
--- a/ydb/core/tx/schemeshard/ut_base/ya.make
+++ b/ydb/core/tx/schemeshard/ut_base/ya.make
@@ -1,11 +1,11 @@
UNITTEST_FOR(ydb/core/tx/schemeshard)
-
+
OWNER(
vvvv
g:kikimr
)
-
-FORK_SUBTESTS()
+
+FORK_SUBTESTS()
IF (WITH_VALGRIND)
SPLIT_FACTOR(40)
@@ -14,8 +14,8 @@ ENDIF()
TIMEOUT(600)
SIZE(MEDIUM)
-
-PEERDIR(
+
+PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
library/cpp/svnversion
@@ -24,13 +24,13 @@ PEERDIR(
ydb/core/tx
ydb/core/tx/schemeshard/ut_helpers
ydb/library/yql/public/udf/service/exception_policy
-)
-
+)
+
YQL_LAST_ABI_VERSION()
-SRCS(
- ut_base.cpp
+SRCS(
+ ut_base.cpp
ut_info_types.cpp
-)
-
-END()
+)
+
+END()
diff --git a/ydb/core/tx/schemeshard/ut_base_reboots.cpp b/ydb/core/tx/schemeshard/ut_base_reboots.cpp
index 209a80e83ab..05fef3170c3 100644
--- a/ydb/core/tx/schemeshard/ut_base_reboots.cpp
+++ b/ydb/core/tx/schemeshard/ut_base_reboots.cpp
@@ -1,957 +1,957 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
-
+
#include <ydb/core/tx/datashard/datashard.h>
#include <ydb/core/protos/flat_scheme_op.pb.h>
-
+
#include <google/protobuf/text_format.h>
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-using namespace NSchemeShardUT_Private;
-
-Y_UNIT_TEST_SUITE(TTablesWithReboots) {
- Y_UNIT_TEST(Fake) { //+
- }
-
- Y_UNIT_TEST(CreateWithRebootsAtCommit) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- t.TestEnv->ReliablePropose(runtime, CreateTableRequest(++t.TxId,
- "/MyRoot",
- "Name: \"Table\""
- "Columns { Name: \"key1\" Type: \"Uint32\"}"
- "Columns { Name: \"key2\" Type: \"Utf8\"}"
- "Columns { Name: \"key3\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
- "UniformPartitionsCount: 2"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+using namespace NSchemeShardUT_Private;
+
+Y_UNIT_TEST_SUITE(TTablesWithReboots) {
+ Y_UNIT_TEST(Fake) { //+
+ }
+
+ Y_UNIT_TEST(CreateWithRebootsAtCommit) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ t.TestEnv->ReliablePropose(runtime, CreateTableRequest(++t.TxId,
+ "/MyRoot",
+ "Name: \"Table\""
+ "Columns { Name: \"key1\" Type: \"Uint32\"}"
+ "Columns { Name: \"key2\" Type: \"Utf8\"}"
+ "Columns { Name: \"key3\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
+ "UniformPartitionsCount: 2"),
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::Finished,
- NLs::IsTable,
- NLs::PartitionCount(2)});
- }
- });
- }
-
- Y_UNIT_TEST(CopyWithRebootsAtCommit) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- t.TestEnv->ReliablePropose(runtime, CreateTableRequest(++t.TxId,
- "/MyRoot",
- "Name: \"Table\""
- "Columns { Name: \"key1\" Type: \"Uint32\"}"
- "Columns { Name: \"key2\" Type: \"Utf8\"}"
- "Columns { Name: \"key3\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
- "UniformPartitionsCount: 2"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- t.TestEnv->ReliablePropose(runtime, CopyTableRequest(++t.TxId, "/MyRoot", "NewTable", "/MyRoot/Table"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(3)});
-
+ {NLs::Finished,
+ NLs::IsTable,
+ NLs::PartitionCount(2)});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(CopyWithRebootsAtCommit) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ t.TestEnv->ReliablePropose(runtime, CreateTableRequest(++t.TxId,
+ "/MyRoot",
+ "Name: \"Table\""
+ "Columns { Name: \"key1\" Type: \"Uint32\"}"
+ "Columns { Name: \"key2\" Type: \"Utf8\"}"
+ "Columns { Name: \"key3\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
+ "UniformPartitionsCount: 2"),
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ t.TestEnv->ReliablePropose(runtime, CopyTableRequest(++t.TxId, "/MyRoot", "NewTable", "/MyRoot/Table"),
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(3)});
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/NewTable", true),
- {NLs::Finished,
- NLs::IsTable,
- NLs::PartitionCount(2),
- NLs::ShardsInsideDomain(4),
- NLs::PathsInsideDomain(3)});
- }
- });
- }
-
- Y_UNIT_TEST(DropCopyWithRebootsAtCommit) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId,
- "/MyRoot",
- "Name: \"Table\""
- "Columns { Name: \"key1\" Type: \"Uint32\"}"
- "Columns { Name: \"key2\" Type: \"Utf8\"}"
- "Columns { Name: \"key3\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
- "UniformPartitionsCount: 1");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestCopyTable(runtime, ++t.TxId, "/MyRoot", "NewTable", "/MyRoot/Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- t.TestEnv->ReliablePropose(runtime, DropTableRequest(++t.TxId, "/MyRoot", "Table"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusPathDoesNotExist, NKikimrScheme::StatusMultipleModifications});
- t.TestEnv->ReliablePropose(runtime, DropTableRequest(++t.TxId, "/MyRoot", "NewTable"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusPathDoesNotExist, NKikimrScheme::StatusMultipleModifications});
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId-1});
-
+ {NLs::Finished,
+ NLs::IsTable,
+ NLs::PartitionCount(2),
+ NLs::ShardsInsideDomain(4),
+ NLs::PathsInsideDomain(3)});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(DropCopyWithRebootsAtCommit) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId,
+ "/MyRoot",
+ "Name: \"Table\""
+ "Columns { Name: \"key1\" Type: \"Uint32\"}"
+ "Columns { Name: \"key2\" Type: \"Utf8\"}"
+ "Columns { Name: \"key3\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
+ "UniformPartitionsCount: 1");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestCopyTable(runtime, ++t.TxId, "/MyRoot", "NewTable", "/MyRoot/Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ t.TestEnv->ReliablePropose(runtime, DropTableRequest(++t.TxId, "/MyRoot", "Table"),
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusPathDoesNotExist, NKikimrScheme::StatusMultipleModifications});
+ t.TestEnv->ReliablePropose(runtime, DropTableRequest(++t.TxId, "/MyRoot", "NewTable"),
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusPathDoesNotExist, NKikimrScheme::StatusMultipleModifications});
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId-1});
+
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+4));
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/NewTable"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathNotExist});
- }
- });
- }
-
- Y_UNIT_TEST(TwiceRmDirWithReboots) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestMkDir(runtime, ++t.TxId, "/MyRoot", "Victim");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- AsyncRmDir(runtime, ++t.TxId, "/MyRoot", "Victim");
- AsyncRmDir(runtime, ++t.TxId, "/MyRoot", "Victim");
- TestModificationResults(runtime, t.TxId, {NKikimrScheme::StatusMultipleModifications});
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Victim"),
- {NLs::PathNotExist});
- }
- });
- }
-
- Y_UNIT_TEST(CreateTableWithReboots) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- AsyncCreateTable(runtime, ++t.TxId, "/MyRoot/DirA",
- "Name: \"Table1\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table1"),
- {NLs::Finished,
- NLs::IsTable});
- }
- });
- }
-
-
- Y_UNIT_TEST(ParallelCreateDrop) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- AsyncCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "DropMe"
- Columns { Name: "RowId" Type: "Uint64" }
- Columns { Name: "Value" Type: "Utf8" }
- KeyColumnNames: ["RowId"]
- UniformPartitionsCount: 2
- )");
- AsyncDropTable(runtime, ++t.TxId, "/MyRoot", "DropMe");
- TestModificationResult(runtime, t.TxId-1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, t.TxId, NKikimrScheme::StatusMultipleModifications);
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
-
- AsyncDropTable(runtime, ++t.TxId, "/MyRoot", "DropMe");
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/NewTable"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathNotExist});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(TwiceRmDirWithReboots) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestMkDir(runtime, ++t.TxId, "/MyRoot", "Victim");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ AsyncRmDir(runtime, ++t.TxId, "/MyRoot", "Victim");
+ AsyncRmDir(runtime, ++t.TxId, "/MyRoot", "Victim");
+ TestModificationResults(runtime, t.TxId, {NKikimrScheme::StatusMultipleModifications});
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Victim"),
+ {NLs::PathNotExist});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(CreateTableWithReboots) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ AsyncCreateTable(runtime, ++t.TxId, "/MyRoot/DirA",
+ "Name: \"Table1\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Table1"),
+ {NLs::Finished,
+ NLs::IsTable});
+ }
+ });
+ }
+
+
+ Y_UNIT_TEST(ParallelCreateDrop) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ AsyncCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "DropMe"
+ Columns { Name: "RowId" Type: "Uint64" }
+ Columns { Name: "Value" Type: "Utf8" }
+ KeyColumnNames: ["RowId"]
+ UniformPartitionsCount: 2
+ )");
+ AsyncDropTable(runtime, ++t.TxId, "/MyRoot", "DropMe");
+ TestModificationResult(runtime, t.TxId-1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, t.TxId, NKikimrScheme::StatusMultipleModifications);
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+
+ AsyncDropTable(runtime, ++t.TxId, "/MyRoot", "DropMe");
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+4));
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DropMe"),
- {NLs::PathNotExist});
- }
- });
- }
-
- Y_UNIT_TEST(SimpleDropTableWithReboots) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot",
- "Name: \"Table\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- "UniformPartitionsCount: 1");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DropMe"),
+ {NLs::PathNotExist});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(SimpleDropTableWithReboots) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"Table\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ "UniformPartitionsCount: 1");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
t.TestEnv->TestWaitTabletDeletion(runtime, TTestTxConfig::FakeHiveTablets);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathNotExist});
- }
- });
- }
-
- Y_UNIT_TEST(SimpleDropTableWithReboots2) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot",
- "Name: \"Table\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- "UniformPartitionsCount: 2");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathNotExist});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(SimpleDropTableWithReboots2) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"Table\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ "UniformPartitionsCount: 2");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
t.TestEnv->TestWaitTabletDeletion(runtime, {TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+1});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathNotExist});
- }
- });
- }
-
- Y_UNIT_TEST(DropTableWithReboots) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, t.TxId, "/MyRoot",
- "Name: \"Table\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- "UniformPartitionsCount: 2");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathNotExist});
-
- TestCreateTable(runtime, ++t.TxId, "/MyRoot",
- "Name: \"Table\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- "UniformPartitionsCount: 3");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathNotExist});
- }
-
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathNotExist});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(DropTableWithReboots) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, t.TxId, "/MyRoot",
+ "Name: \"Table\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ "UniformPartitionsCount: 2");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathNotExist});
+
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"Table\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ "UniformPartitionsCount: 3");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathNotExist});
+ }
+
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 7));
- });
- }
-
- Y_UNIT_TEST(CreateDroppedTableWithReboots) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot",
- "Name: \"Table\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- "UniformPartitionsCount: 2");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- TestCreateTable(runtime, ++t.TxId, "/MyRoot",
- "Name: \"Table\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- "UniformPartitionsCount: 3");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
+ });
+ }
+
+ Y_UNIT_TEST(CreateDroppedTableWithReboots) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"Table\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ "UniformPartitionsCount: 2");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"Table\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ "UniformPartitionsCount: 3");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 7));
- });
- }
-
- Y_UNIT_TEST(CreateDroppedTableAndDropWithReboots) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot",
- "Name: \"Table\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- "UniformPartitionsCount: 2");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestCreateTable(runtime, ++t.TxId, "/MyRoot",
- "Name: \"Table\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- "UniformPartitionsCount: 3");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathNotExist});
- }
-
+ });
+ }
+
+ Y_UNIT_TEST(CreateDroppedTableAndDropWithReboots) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"Table\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ "UniformPartitionsCount: 2");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"Table\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ "UniformPartitionsCount: 3");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathNotExist});
+ }
+
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 7));
- });
- }
-
-
- Y_UNIT_TEST(AlterTableSchemaWithReboots) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- // Prepare the table
-
- TSet<TString> cols = {"key1", "key2", "value"};
- TSet<TString> keyCols = {"key1", "key2"};
- TSet<TString> dropCols;
-
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "key1" Type: "Uint64"}
- Columns { Name: "value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- UniformPartitionsCount: 2
- PartitionConfig {
- TxReadSizeLimit: 100
- ExecutorCacheSize: 42
- }
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- // Start altering the table
-
- cols.erase("value");
- dropCols.insert("value");
- TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- DropColumns { Name: "value" }
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::IsTable,
- NLs::CheckColumns("Table", cols, dropCols, keyCols)});
- }
-
- cols.insert("add_2");
- TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "add_2" Type: "Uint64"}
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::IsTable,
- NLs::CheckColumns("Table", cols, dropCols, keyCols)});
- }
- });
- }
-
- Y_UNIT_TEST(AlterTableSchemaFreezeUnfreezeWithReboots) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "key1" Type: "Uint64"}
- Columns { Name: "value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- UniformPartitionsCount: 2
- PartitionConfig {
- TxReadSizeLimit: 100
- ExecutorCacheSize: 42
- })");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig { FreezeState: Freeze }
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
+ });
+ }
+
+
+ Y_UNIT_TEST(AlterTableSchemaWithReboots) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ // Prepare the table
+
+ TSet<TString> cols = {"key1", "key2", "value"};
+ TSet<TString> keyCols = {"key1", "key2"};
+ TSet<TString> dropCols;
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "key1" Type: "Uint64"}
+ Columns { Name: "value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ UniformPartitionsCount: 2
+ PartitionConfig {
+ TxReadSizeLimit: 100
+ ExecutorCacheSize: 42
+ }
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ // Start altering the table
+
+ cols.erase("value");
+ dropCols.insert("value");
+ TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ DropColumns { Name: "value" }
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::IsTable,
+ NLs::CheckColumns("Table", cols, dropCols, keyCols)});
+ }
+
+ cols.insert("add_2");
+ TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "add_2" Type: "Uint64"}
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::IsTable,
+ NLs::CheckColumns("Table", cols, dropCols, keyCols)});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(AlterTableSchemaFreezeUnfreezeWithReboots) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "key1" Type: "Uint64"}
+ Columns { Name: "value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ UniformPartitionsCount: 2
+ PartitionConfig {
+ TxReadSizeLimit: 100
+ ExecutorCacheSize: 42
+ })");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig { FreezeState: Freeze }
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
TestDescribeResult(DescribePath(runtime, "MyRoot/Table", true),
- {NLs::Finished,
- NLs::FreezeStateEqual(NKikimrSchemeOp::EFreezeState::Freeze)});
- }
-
- TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig { FreezeState: Unfreeze }
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
+ {NLs::Finished,
+ NLs::FreezeStateEqual(NKikimrSchemeOp::EFreezeState::Freeze)});
+ }
+
+ TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig { FreezeState: Unfreeze }
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
TestDescribeResult(DescribePath(runtime, "MyRoot/Table", true),
- {NLs::Finished,
- NLs::FreezeStateEqual(NKikimrSchemeOp::EFreezeState::Unfreeze)});
- }
- });
- }
-
+ {NLs::Finished,
+ NLs::FreezeStateEqual(NKikimrSchemeOp::EFreezeState::Unfreeze)});
+ }
+ });
+ }
+
Y_UNIT_TEST(AlterTableFollowersWithReboots) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint64"}
- Columns { Name: "value" Type: "Utf8"}
- KeyColumnNames: ["key"])");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- // Start altering the table
-
- TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64"}
+ Columns { Name: "value" Type: "Utf8"}
+ KeyColumnNames: ["key"])");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ // Start altering the table
+
+ TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
FollowerCount: 2
AllowFollowerPromotion: true
- }
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
// TODO: check followers
-
- TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
+
+ TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
FollowerCount: 1
AllowFollowerPromotion: false
- }
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
// TODO: check followers
-
- TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
+
+ TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
FollowerCount: 0
AllowFollowerPromotion: true
- }
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
// TODO: check followers
- });
- }
-
- Y_UNIT_TEST(AlterTableConfigWithReboots) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- ui64 datashardTabletId = ui64(InvalidTabletId);
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "key1" Type: "Uint64"}
- Columns { Name: "value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- PartitionConfig {
- TxReadSizeLimit: 100
- ExecutorCacheSize: 42
- })");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
-
+ });
+ }
+
+ Y_UNIT_TEST(AlterTableConfigWithReboots) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ ui64 datashardTabletId = ui64(InvalidTabletId);
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "key1" Type: "Uint64"}
+ Columns { Name: "value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ PartitionConfig {
+ TxReadSizeLimit: 100
+ ExecutorCacheSize: 42
+ })");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+
datashardTabletId = TTestTxConfig::FakeHiveTablets;
- UNIT_ASSERT_VALUES_EQUAL(GetTxReadSizeLimit(runtime, datashardTabletId), 100);
- UNIT_ASSERT_VALUES_EQUAL(GetExecutorCacheSize(runtime, datashardTabletId), 42);
- }
-
-
- // Start altering the table
- TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
- TxReadSizeLimit: 2000
- })");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- UNIT_ASSERT_VALUES_EQUAL(GetTxReadSizeLimit(runtime, datashardTabletId), 2000);
- UNIT_ASSERT_VALUES_EQUAL(GetExecutorCacheSize(runtime, datashardTabletId), 42);
- }
-
- TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "add_2" Type: "Uint64"}
- PartitionConfig {
- ExecutorCacheSize: 100500
- })");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- UNIT_ASSERT_VALUES_EQUAL(GetTxReadSizeLimit(runtime, datashardTabletId), 2000);
- UNIT_ASSERT_VALUES_EQUAL(GetExecutorCacheSize(runtime, datashardTabletId), 100500);
- }
- });
- }
-
- Y_UNIT_TEST(AlterCopyWithReboots) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "key1" Type: "Uint64"}
- Columns { Name: "value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- PartitionConfig {
- TxReadSizeLimit: 100
- ExecutorCacheSize: 42
- })");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- // Start altering the table
- TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
- TxReadSizeLimit: 2000
- })");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestCopyTable(runtime, ++t.TxId, "/MyRoot", "NewTable", "/MyRoot/Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot", "NewTable");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
+ UNIT_ASSERT_VALUES_EQUAL(GetTxReadSizeLimit(runtime, datashardTabletId), 100);
+ UNIT_ASSERT_VALUES_EQUAL(GetExecutorCacheSize(runtime, datashardTabletId), 42);
+ }
+
+
+ // Start altering the table
+ TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
+ TxReadSizeLimit: 2000
+ })");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ UNIT_ASSERT_VALUES_EQUAL(GetTxReadSizeLimit(runtime, datashardTabletId), 2000);
+ UNIT_ASSERT_VALUES_EQUAL(GetExecutorCacheSize(runtime, datashardTabletId), 42);
+ }
+
+ TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "add_2" Type: "Uint64"}
+ PartitionConfig {
+ ExecutorCacheSize: 100500
+ })");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ UNIT_ASSERT_VALUES_EQUAL(GetTxReadSizeLimit(runtime, datashardTabletId), 2000);
+ UNIT_ASSERT_VALUES_EQUAL(GetExecutorCacheSize(runtime, datashardTabletId), 100500);
+ }
+ });
+ }
+
+ Y_UNIT_TEST(AlterCopyWithReboots) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "key1" Type: "Uint64"}
+ Columns { Name: "value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ PartitionConfig {
+ TxReadSizeLimit: 100
+ ExecutorCacheSize: 42
+ })");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ // Start altering the table
+ TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
+ TxReadSizeLimit: 2000
+ })");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestCopyTable(runtime, ++t.TxId, "/MyRoot", "NewTable", "/MyRoot/Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", "NewTable");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 2));
- }
- });
- }
-
- Y_UNIT_TEST(CopyAlterWithReboots) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "key1" Type: "Uint64"}
- Columns { Name: "value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- UniformPartitionsCount: 1
- PartitionConfig {
- TxReadSizeLimit: 100
- ExecutorCacheSize: 42
- })");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- // Start altering the table
- TestCopyTable(runtime, ++t.TxId, "/MyRoot", "NewTable", "/MyRoot/Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "NewTable"
- Columns { Name: "add_2" Type: "Uint64"}
- PartitionConfig {
- ExecutorCacheSize: 100500
- })");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDropTable(runtime, ++t.TxId, "/MyRoot", "NewTable");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
+ }
+ });
+ }
+
+ Y_UNIT_TEST(CopyAlterWithReboots) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "key1" Type: "Uint64"}
+ Columns { Name: "value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ UniformPartitionsCount: 1
+ PartitionConfig {
+ TxReadSizeLimit: 100
+ ExecutorCacheSize: 42
+ })");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ // Start altering the table
+ TestCopyTable(runtime, ++t.TxId, "/MyRoot", "NewTable", "/MyRoot/Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "NewTable"
+ Columns { Name: "add_2" Type: "Uint64"}
+ PartitionConfig {
+ ExecutorCacheSize: 100500
+ })");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", "NewTable");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 4));
- }
- });
- }
-
- Y_UNIT_TEST(AlterAndForceDrop) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathVersion pathVersion;
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirA", R"(
- Name: "Table"
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "key1" Type: "Uint64"}
- Columns { Name: "value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- UniformPartitionsCount: 1
- PartitionConfig {
- TxReadSizeLimit: 100
- ExecutorCacheSize: 42
- })");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA")
- , {NLs::ChildrenCount(1)});
- }
-
- TestAlterTable(runtime, ++t.TxId, "/MyRoot/DirA", R"(
- Name: "Table"
- Columns { Name: "add_2" Type: "Uint64"}
- PartitionConfig {
- ExecutorCacheSize: 100500
- })");
- TestForceDropUnsafe(runtime, ++t.TxId, pathVersion.PathId.LocalPathId);
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId-1});
-
- {
- TInactiveZone inactive(activeZone);
+ }
+ });
+ }
+
+ Y_UNIT_TEST(AlterAndForceDrop) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathVersion pathVersion;
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirA", R"(
+ Name: "Table"
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "key1" Type: "Uint64"}
+ Columns { Name: "value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ UniformPartitionsCount: 1
+ PartitionConfig {
+ TxReadSizeLimit: 100
+ ExecutorCacheSize: 42
+ })");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA")
+ , {NLs::ChildrenCount(1)});
+ }
+
+ TestAlterTable(runtime, ++t.TxId, "/MyRoot/DirA", R"(
+ Name: "Table"
+ Columns { Name: "add_2" Type: "Uint64"}
+ PartitionConfig {
+ ExecutorCacheSize: 100500
+ })");
+ TestForceDropUnsafe(runtime, ++t.TxId, pathVersion.PathId.LocalPathId);
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId-1});
+
+ {
+ TInactiveZone inactive(activeZone);
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 1));
- TestDescribeResult(DescribePath(runtime, "/MyRoot")
- , {NLs::NoChildren});
- }
- });
- }
-
- Y_UNIT_TEST(CopyTableWithReboots) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Uint32"}
- Columns { Name: "key2" Type: "Utf8"}
- Columns { Name: "key3" Type: "Uint64"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2", "key3"]
- UniformPartitionsCount: 2)");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestCopyTable(runtime, ++t.TxId, "/MyRoot", "NewTable1", "/MyRoot/Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
-
- TestCopyTable(runtime, ++t.TxId, "/MyRoot", "NewTable2", "/MyRoot/NewTable1");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "MyRoot"),
- {NLs::ChildrenCount(4)});
- TestDescribeResult(DescribePath(runtime, "MyRoot/Table"),
- {NLs::PathExist});
- TestDescribeResult(DescribePath(runtime, "MyRoot/NewTable1"),
- {NLs::PathExist});
- TestDescribeResult(DescribePath(runtime, "MyRoot/NewTable2"),
- {NLs::PathExist});
- }
- });
- }
-
-
- Y_UNIT_TEST(CopyTableAndDropWithReboots) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot",
- "Name: \"Table\""
- "Columns { Name: \"key1\" Type: \"Uint32\"}"
- "Columns { Name: \"key2\" Type: \"Utf8\"}"
- "Columns { Name: \"key3\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
- );
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- TestCopyTable(runtime, ++t.TxId, "/MyRoot", "NewTable", "/MyRoot/Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot", "NewTable");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot")
+ , {NLs::NoChildren});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(CopyTableWithReboots) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Uint32"}
+ Columns { Name: "key2" Type: "Utf8"}
+ Columns { Name: "key3" Type: "Uint64"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2", "key3"]
+ UniformPartitionsCount: 2)");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestCopyTable(runtime, ++t.TxId, "/MyRoot", "NewTable1", "/MyRoot/Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+
+ TestCopyTable(runtime, ++t.TxId, "/MyRoot", "NewTable2", "/MyRoot/NewTable1");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "MyRoot"),
+ {NLs::ChildrenCount(4)});
+ TestDescribeResult(DescribePath(runtime, "MyRoot/Table"),
+ {NLs::PathExist});
+ TestDescribeResult(DescribePath(runtime, "MyRoot/NewTable1"),
+ {NLs::PathExist});
+ TestDescribeResult(DescribePath(runtime, "MyRoot/NewTable2"),
+ {NLs::PathExist});
+ }
+ });
+ }
+
+
+ Y_UNIT_TEST(CopyTableAndDropWithReboots) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"Table\""
+ "Columns { Name: \"key1\" Type: \"Uint32\"}"
+ "Columns { Name: \"key2\" Type: \"Utf8\"}"
+ "Columns { Name: \"key3\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
+ );
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ TestCopyTable(runtime, ++t.TxId, "/MyRoot", "NewTable", "/MyRoot/Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", "NewTable");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 4));
- });
- }
-
- Y_UNIT_TEST(CopyTableAndDropWithReboots2) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot",
- "Name: \"Table\""
- "Columns { Name: \"key1\" Type: \"Uint32\"}"
- "Columns { Name: \"key2\" Type: \"Utf8\"}"
- "Columns { Name: \"key3\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
- );
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- // Write some data to the user table
- auto fnWriteRow = [&] (ui64 tabletId) {
- TString writeQuery = R"(
- (
- (let key '( '('key1 (Uint32 '0)) '('key2 (Utf8 'aaaa)) '('key3 (Uint64 '0)) ) )
- (let value '('('Value (Utf8 '281474980010683)) ) )
- (return (AsList (UpdateRow '__user__Table key value) ))
- ))";
- NKikimrMiniKQL::TResult result;
- TString err;
+ });
+ }
+
+ Y_UNIT_TEST(CopyTableAndDropWithReboots2) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"Table\""
+ "Columns { Name: \"key1\" Type: \"Uint32\"}"
+ "Columns { Name: \"key2\" Type: \"Utf8\"}"
+ "Columns { Name: \"key3\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
+ );
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ // Write some data to the user table
+ auto fnWriteRow = [&] (ui64 tabletId) {
+ TString writeQuery = R"(
+ (
+ (let key '( '('key1 (Uint32 '0)) '('key2 (Utf8 'aaaa)) '('key3 (Uint64 '0)) ) )
+ (let value '('('Value (Utf8 '281474980010683)) ) )
+ (return (AsList (UpdateRow '__user__Table key value) ))
+ ))";
+ NKikimrMiniKQL::TResult result;
+ TString err;
NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);
- };
+ };
fnWriteRow(TTestTxConfig::FakeHiveTablets);
- }
-
- TestCopyTable(runtime, ++t.TxId, "/MyRoot", "NewTable", "/MyRoot/Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- AsyncDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
- AsyncDropTable(runtime, ++t.TxId, "/MyRoot", "NewTable");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
-
- {
- TInactiveZone inactive(activeZone);
+ }
+
+ TestCopyTable(runtime, ++t.TxId, "/MyRoot", "NewTable", "/MyRoot/Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ AsyncDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
+ AsyncDropTable(runtime, ++t.TxId, "/MyRoot", "NewTable");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
+
+ {
+ TInactiveZone inactive(activeZone);
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 2));
- }
- });
- }
-
- Y_UNIT_TEST(ChainedCopyTableAndDropWithReboots) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- const int maxTableIdx = 4;
-
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot",
- "Name: \"Table1\""
- "Columns { Name: \"key1\" Type: \"Uint32\"}"
- "Columns { Name: \"key2\" Type: \"Utf8\"}"
- "Columns { Name: \"key3\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
- );
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- // Write some data to the user table
- auto fnWriteRow = [&] (ui64 tabletId) {
- TString writeQuery = R"(
- (
- (let key '( '('key1 (Uint32 '0)) '('key2 (Utf8 'aaaa)) '('key3 (Uint64 '0)) ) )
- (let value '('('Value (Utf8 '281474980010683)) ) )
- (return (AsList (UpdateRow '__user__Table1 key value) ))
- )
- )";
- NKikimrMiniKQL::TResult result;
- TString err;
+ }
+ });
+ }
+
+ Y_UNIT_TEST(ChainedCopyTableAndDropWithReboots) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ const int maxTableIdx = 4;
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"Table1\""
+ "Columns { Name: \"key1\" Type: \"Uint32\"}"
+ "Columns { Name: \"key2\" Type: \"Utf8\"}"
+ "Columns { Name: \"key3\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
+ );
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ // Write some data to the user table
+ auto fnWriteRow = [&] (ui64 tabletId) {
+ TString writeQuery = R"(
+ (
+ (let key '( '('key1 (Uint32 '0)) '('key2 (Utf8 'aaaa)) '('key3 (Uint64 '0)) ) )
+ (let value '('('Value (Utf8 '281474980010683)) ) )
+ (return (AsList (UpdateRow '__user__Table1 key value) ))
+ )
+ )";
+ NKikimrMiniKQL::TResult result;
+ TString err;
NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);
- };
+ };
fnWriteRow(TTestTxConfig::FakeHiveTablets);
-
- // Make a chain of copy-of-copy
- for (int i = 2; i <= maxTableIdx; ++i) {
- TestCopyTable(runtime, ++t.TxId, "/MyRoot", Sprintf("Table%d", i), Sprintf("/MyRoot/Table%d", i-1));
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- // Drop all intermediate copies
- for (int i = 1; i < maxTableIdx; ++i) {
- TestDropTable(runtime, ++t.TxId, "/MyRoot", Sprintf("Table%d", i));
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
- }
-
- // Drop the last table to trigger chained parts return
- TestDropTable(runtime, ++t.TxId, "/MyRoot", Sprintf("Table%d", maxTableIdx));
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
+
+ // Make a chain of copy-of-copy
+ for (int i = 2; i <= maxTableIdx; ++i) {
+ TestCopyTable(runtime, ++t.TxId, "/MyRoot", Sprintf("Table%d", i), Sprintf("/MyRoot/Table%d", i-1));
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ // Drop all intermediate copies
+ for (int i = 1; i < maxTableIdx; ++i) {
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", Sprintf("Table%d", i));
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+ }
+
+ // Drop the last table to trigger chained parts return
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", Sprintf("Table%d", maxTableIdx));
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 9));
- }
- });
- }
-
- Y_UNIT_TEST(LostBorrowAckWithReboots) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot",
- "Name: \"Table1\""
- "Columns { Name: \"key1\" Type: \"Uint32\"}"
- "Columns { Name: \"key2\" Type: \"Utf8\"}"
- "Columns { Name: \"key3\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
- );
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- // Write some data to the user table
- auto fnWriteRow = [&] (ui64 tabletId) {
- TString writeQuery = R"(
- (
- (let key '( '('key1 (Uint32 '0)) '('key2 (Utf8 'aaaa)) '('key3 (Uint64 '0)) ) )
- (let value '('('Value (Utf8 '281474980010683)) ) )
- (return (AsList (UpdateRow '__user__Table1 key value) ))
- )
- )";
- NKikimrMiniKQL::TResult result;
- TString err;
+ }
+ });
+ }
+
+ Y_UNIT_TEST(LostBorrowAckWithReboots) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"Table1\""
+ "Columns { Name: \"key1\" Type: \"Uint32\"}"
+ "Columns { Name: \"key2\" Type: \"Utf8\"}"
+ "Columns { Name: \"key3\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
+ );
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ // Write some data to the user table
+ auto fnWriteRow = [&] (ui64 tabletId) {
+ TString writeQuery = R"(
+ (
+ (let key '( '('key1 (Uint32 '0)) '('key2 (Utf8 'aaaa)) '('key3 (Uint64 '0)) ) )
+ (let value '('('Value (Utf8 '281474980010683)) ) )
+ (return (AsList (UpdateRow '__user__Table1 key value) ))
+ )
+ )";
+ NKikimrMiniKQL::TResult result;
+ TString err;
NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);
- };
+ };
fnWriteRow(TTestTxConfig::FakeHiveTablets);
-
- TestCopyTable(runtime, ++t.TxId, "/MyRoot", "Table2", "/MyRoot/Table1");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table1");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- // Drop BorrowAcks events
- auto prevFilter = runtime.SetEventFilter(nullptr);
- auto borrowAckFilter = [prevFilter](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event) -> bool {
- if (event->Type == TEvDataShard::EvReturnBorrowedPartAck &&
- event->Sender != event->Recipient) // only allow the event from Self that are used for auto-Ack
- {
- // Cerr << " DROPPED BORROW ACK\n";
- return true;
- }
- return prevFilter(runtime, event);
- };
- runtime.SetEventFilter(borrowAckFilter);
-
- // Drop the last table to trigger parts return
- TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table2");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
+
+ TestCopyTable(runtime, ++t.TxId, "/MyRoot", "Table2", "/MyRoot/Table1");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table1");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ // Drop BorrowAcks events
+ auto prevFilter = runtime.SetEventFilter(nullptr);
+ auto borrowAckFilter = [prevFilter](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event) -> bool {
+ if (event->Type == TEvDataShard::EvReturnBorrowedPartAck &&
+ event->Sender != event->Recipient) // only allow the event from Self that are used for auto-Ack
+ {
+ // Cerr << " DROPPED BORROW ACK\n";
+ return true;
+ }
+ return prevFilter(runtime, event);
+ };
+ runtime.SetEventFilter(borrowAckFilter);
+
+ // Drop the last table to trigger parts return
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table2");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 2));
- });
- }
-
- Y_UNIT_TEST(SimultaneousDropFroceDrop) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::ChildrenCount(2)});
- auto pathVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
- {NLs::PathExist,
- NLs::PathVersionEqual(3)});
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table1");
-
- AsyncForceDropUnsafe(runtime, ++t.TxId, pathVer.PathId.LocalPathId);
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
+ });
+ }
+
+ Y_UNIT_TEST(SimultaneousDropFroceDrop) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::ChildrenCount(2)});
+ auto pathVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(3)});
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table1");
+
+ AsyncForceDropUnsafe(runtime, ++t.TxId, pathVer.PathId.LocalPathId);
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 2));
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(1),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomainOneOf({0,1})});
- }
- });
- }
-}
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(1),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomainOneOf({0,1})});
+ }
+ });
+ }
+}
diff --git a/ydb/core/tx/schemeshard/ut_base_reboots/ya.make b/ydb/core/tx/schemeshard/ut_base_reboots/ya.make
index d37d2dc8bd7..8216b574576 100644
--- a/ydb/core/tx/schemeshard/ut_base_reboots/ya.make
+++ b/ydb/core/tx/schemeshard/ut_base_reboots/ya.make
@@ -1,15 +1,15 @@
IF (NOT WITH_VALGRIND)
UNITTEST_FOR(ydb/core/tx/schemeshard)
-
+
OWNER(
vvvv
g:kikimr
)
-
+
FORK_SUBTESTS()
-
+
SPLIT_FACTOR(60)
-
+
IF (SANITIZER_TYPE OR WITH_VALGRIND)
TIMEOUT(3600)
SIZE(LARGE)
@@ -19,7 +19,7 @@ IF (NOT WITH_VALGRIND)
SIZE(LARGE)
TAG(ya:fat)
ENDIF()
-
+
PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
diff --git a/ydb/core/tx/schemeshard/ut_bsvolume.cpp b/ydb/core/tx/schemeshard/ut_bsvolume.cpp
index 0869b8d2f77..c5824e6a640 100644
--- a/ydb/core/tx/schemeshard/ut_bsvolume.cpp
+++ b/ydb/core/tx/schemeshard/ut_bsvolume.cpp
@@ -2,7 +2,7 @@
#include <ydb/core/tx/schemeshard/schemeshard_utils.h>
using namespace NKikimr;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NSchemeShardUT_Private;
Y_UNIT_TEST_SUITE(TBSV) {
@@ -13,7 +13,7 @@ Y_UNIT_TEST_SUITE(TBSV) {
runtime.GetAppData().DisableSchemeShardCleanupOnDropForTest = true;
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
vdescr.SetName("BSVolume");
auto& vc = *vdescr.MutableVolumeConfig();
vc.SetBlockSize(4096);
diff --git a/ydb/core/tx/schemeshard/ut_bsvolume/ya.make b/ydb/core/tx/schemeshard/ut_bsvolume/ya.make
index 68bf8c9c1ff..005d942ac4a 100644
--- a/ydb/core/tx/schemeshard/ut_bsvolume/ya.make
+++ b/ydb/core/tx/schemeshard/ut_bsvolume/ya.make
@@ -26,7 +26,7 @@ PEERDIR(
YQL_LAST_ABI_VERSION()
SRCS(
- ut_bsvolume.cpp
+ ut_bsvolume.cpp
)
END()
diff --git a/ydb/core/tx/schemeshard/ut_bsvolume_reboots.cpp b/ydb/core/tx/schemeshard/ut_bsvolume_reboots.cpp
index d384af8604f..5dbdecf8e6d 100644
--- a/ydb/core/tx/schemeshard/ut_bsvolume_reboots.cpp
+++ b/ydb/core/tx/schemeshard/ut_bsvolume_reboots.cpp
@@ -1,19 +1,19 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
-
+
#include <ydb/core/tx/datashard/datashard.h>
#include <ydb/core/protos/flat_scheme_op.pb.h>
-
+
#include <google/protobuf/text_format.h>
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-using namespace NSchemeShardUT_Private;
-
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+using namespace NSchemeShardUT_Private;
+
namespace {
auto& InitCreateVolumeConfig(
const TString& name,
- NKikimrSchemeOp::TBlockStoreVolumeDescription& vdescr)
+ NKikimrSchemeOp::TBlockStoreVolumeDescription& vdescr)
{
vdescr.SetName(name);
auto& vc = *vdescr.MutableVolumeConfig();
@@ -37,243 +37,243 @@ void InitAlterVolumeConfig(NKikimrBlockStore::TVolumeConfig& vc)
} // namespace
-Y_UNIT_TEST_SUITE(TBSVWithReboots) {
- Y_UNIT_TEST(AlterAssignDrop) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+Y_UNIT_TEST_SUITE(TBSVWithReboots) {
+ Y_UNIT_TEST(AlterAssignDrop) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
auto& vc = InitCreateVolumeConfig("BSVolume", vdescr);
- {
- TInactiveZone inactive(activeZone);
- t.RestoreLogging();
+ {
+ TInactiveZone inactive(activeZone);
+ t.RestoreLogging();
TestCreateBlockStoreVolume(runtime, ++t.TxId, "/MyRoot", vdescr.DebugString());
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
InitAlterVolumeConfig(vc);
AsyncAlterBlockStoreVolume(runtime, ++t.TxId, "/MyRoot", vdescr.DebugString());
-
- AsyncAssignBlockStoreVolume(runtime, ++t.TxId, "/MyRoot", "BSVolume", "Owner123");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDropBlockStoreVolume(runtime, ++t.TxId, "/MyRoot", "BSVolume", {NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusAccepted});
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId - 2); // wait Alter
-
- {
- TInactiveZone inactive(activeZone);
- TestDropBlockStoreVolume(runtime, ++t.TxId, "/MyRoot", "BSVolume", {NKikimrScheme::StatusPathDoesNotExist, NKikimrScheme::StatusAccepted});
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
- {NLs::PathNotExist});
+
+ AsyncAssignBlockStoreVolume(runtime, ++t.TxId, "/MyRoot", "BSVolume", "Owner123");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDropBlockStoreVolume(runtime, ++t.TxId, "/MyRoot", "BSVolume", {NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusAccepted});
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId - 2); // wait Alter
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDropBlockStoreVolume(runtime, ++t.TxId, "/MyRoot", "BSVolume", {NKikimrScheme::StatusPathDoesNotExist, NKikimrScheme::StatusAccepted});
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/BSVolume"),
+ {NLs::PathNotExist});
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+5));
- }
- });
- }
-
- Y_UNIT_TEST(Create) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- t.RestoreLogging();
-
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ }
+ });
+ }
+
+ Y_UNIT_TEST(Create) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ t.RestoreLogging();
+
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
InitCreateVolumeConfig("BSVolume_1", vdescr);
TestCreateBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", vdescr.DebugString());
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
-
- activeZone = false;
- TestLs(runtime, "/MyRoot/DirA/BSVolume_1", false, NLs::Finished);
- });
- }
-
- Y_UNIT_TEST(CreateAlter) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- t.RestoreLogging();
-
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+
+ activeZone = false;
+ TestLs(runtime, "/MyRoot/DirA/BSVolume_1", false, NLs::Finished);
+ });
+ }
+
+ Y_UNIT_TEST(CreateAlter) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ t.RestoreLogging();
+
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
auto& vc = InitCreateVolumeConfig("BSVolume_2", vdescr);
TestCreateBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", vdescr.DebugString());
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
-
- TestLs(runtime, "/MyRoot/DirA/BSVolume_2", false, NLs::Finished);
-
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+
+ TestLs(runtime, "/MyRoot/DirA/BSVolume_2", false, NLs::Finished);
+
InitAlterVolumeConfig(vc);
TestAlterBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", vdescr.DebugString());
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
-
- activeZone = false;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/BSVolume_2"),
- {NLs::PathExist,
- NLs::Finished,
- NLs::PathVersionEqual(3)});
- });
- }
-
- Y_UNIT_TEST(CreateAlterNoVersion) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- t.RestoreLogging();
-
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+
+ activeZone = false;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/BSVolume_2"),
+ {NLs::PathExist,
+ NLs::Finished,
+ NLs::PathVersionEqual(3)});
+ });
+ }
+
+ Y_UNIT_TEST(CreateAlterNoVersion) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ t.RestoreLogging();
+
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
auto& vc = InitCreateVolumeConfig("BSVolume_2", vdescr);
TestCreateBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", vdescr.DebugString());
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
- TestLs(runtime, "/MyRoot/DirA/BSVolume_2", false, NLs::Finished);
-
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+ TestLs(runtime, "/MyRoot/DirA/BSVolume_2", false, NLs::Finished);
+
InitAlterVolumeConfig(vc);
TestAlterBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", vdescr.DebugString());
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
-
- activeZone = false;
- TestLs(runtime, "/MyRoot/DirA/BSVolume_2", false, NLs::PathExist);
- });
- }
-
- Y_UNIT_TEST(CreateDrop) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- t.RestoreLogging();
-
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+
+ activeZone = false;
+ TestLs(runtime, "/MyRoot/DirA/BSVolume_2", false, NLs::PathExist);
+ });
+ }
+
+ Y_UNIT_TEST(CreateDrop) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ t.RestoreLogging();
+
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
InitCreateVolumeConfig("BSVolume_3", vdescr);
TestCreateBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", vdescr.DebugString());
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
- TestLs(runtime, "/MyRoot/DirA/BSVolume_3", false, NLs::Finished);
-
- TestDropBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", "BSVolume_3");
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
-
- activeZone = false;
- TestLs(runtime, "/MyRoot/DirA/BSVolume_3", false, NLs::PathNotExist);
- });
- }
-
- Y_UNIT_TEST(CreateAssignAlterIsAllowed) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- t.RestoreLogging();
-
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+ TestLs(runtime, "/MyRoot/DirA/BSVolume_3", false, NLs::Finished);
+
+ TestDropBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", "BSVolume_3");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+
+ activeZone = false;
+ TestLs(runtime, "/MyRoot/DirA/BSVolume_3", false, NLs::PathNotExist);
+ });
+ }
+
+ Y_UNIT_TEST(CreateAssignAlterIsAllowed) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ t.RestoreLogging();
+
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
auto& vc = InitCreateVolumeConfig("BSVolume_4", vdescr);
TestCreateBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", vdescr.DebugString());
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
- TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::Finished);
-
- TestAssignBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", "BSVolume_4", "Owner123");
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
- TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::CheckMountToken("BSVolume_4", "Owner123"));
-
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+ TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::Finished);
+
+ TestAssignBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", "BSVolume_4", "Owner123");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+ TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::CheckMountToken("BSVolume_4", "Owner123"));
+
InitAlterVolumeConfig(vc);
TestAlterBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", vdescr.DebugString());
-
- activeZone = false;
- TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::PathExist);
- });
- }
-
- Y_UNIT_TEST(CreateAssignAlterIsAllowedNoVersion) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- t.RestoreLogging();
-
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+
+ activeZone = false;
+ TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::PathExist);
+ });
+ }
+
+ Y_UNIT_TEST(CreateAssignAlterIsAllowedNoVersion) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ t.RestoreLogging();
+
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
auto& vc = InitCreateVolumeConfig("BSVolume_4", vdescr);
TestCreateBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", vdescr.DebugString());
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
- TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::Finished);
-
- TestAssignBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", "BSVolume_4", "Owner123");
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
- TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::CheckMountToken("BSVolume_4", "Owner123"));
-
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+ TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::Finished);
+
+ TestAssignBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", "BSVolume_4", "Owner123");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+ TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::CheckMountToken("BSVolume_4", "Owner123"));
+
InitAlterVolumeConfig(vc);
TestAlterBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", vdescr.DebugString());
-
- activeZone = false;
- TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::PathExist);
- });
- }
-
- Y_UNIT_TEST(CreateAssignDropIsAllowed) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- t.RestoreLogging();
-
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+
+ activeZone = false;
+ TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::PathExist);
+ });
+ }
+
+ Y_UNIT_TEST(CreateAssignDropIsAllowed) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ t.RestoreLogging();
+
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
InitCreateVolumeConfig("BSVolume_4", vdescr);
TestCreateBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", vdescr.DebugString());
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
- TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::Finished);
-
- TestAssignBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", "BSVolume_4", "Owner123");
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
- TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::CheckMountToken("BSVolume_4", "Owner123"));
-
- TestDropBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", "BSVolume_4");
-
- activeZone = false;
- TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::PathNotExist);
- });
- }
-
- Y_UNIT_TEST(CreateAssignUnassignDrop) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- t.RestoreLogging();
-
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+ TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::Finished);
+
+ TestAssignBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", "BSVolume_4", "Owner123");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+ TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::CheckMountToken("BSVolume_4", "Owner123"));
+
+ TestDropBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", "BSVolume_4");
+
+ activeZone = false;
+ TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::PathNotExist);
+ });
+ }
+
+ Y_UNIT_TEST(CreateAssignUnassignDrop) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ t.RestoreLogging();
+
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
InitCreateVolumeConfig("BSVolume_4", vdescr);
TestCreateBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", vdescr.DebugString());
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
- TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::Finished);
-
- TestAssignBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", "BSVolume_4", "Owner123");
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
- TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::CheckMountToken("BSVolume_4", "Owner123"));
-
- TestAssignBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", "BSVolume_4", "");
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
- TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::CheckMountToken("BSVolume_4", ""));
-
- TestDropBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", "BSVolume_4");
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
-
- activeZone = false;
- TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::PathNotExist);
- });
- }
-
- Y_UNIT_TEST(SimultaneousCreateDropNbs) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\""
- "StoragePools {"
- " Name: \"name_USER_0_kind_hdd-1\""
- " Kind: \"storage-pool-number-1\""
- "}"
- "StoragePools {"
- " Name: \"name_USER_0_kind_hdd-2\""
- " Kind: \"storage-pool-number-2\""
- "}");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+ TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::Finished);
+
+ TestAssignBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", "BSVolume_4", "Owner123");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+ TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::CheckMountToken("BSVolume_4", "Owner123"));
+
+ TestAssignBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", "BSVolume_4", "");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+ TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::CheckMountToken("BSVolume_4", ""));
+
+ TestDropBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", "BSVolume_4");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+
+ activeZone = false;
+ TestLs(runtime, "/MyRoot/DirA/BSVolume_4", false, NLs::PathNotExist);
+ });
+ }
+
+ Y_UNIT_TEST(SimultaneousCreateDropNbs) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\""
+ "StoragePools {"
+ " Name: \"name_USER_0_kind_hdd-1\""
+ " Kind: \"storage-pool-number-1\""
+ "}"
+ "StoragePools {"
+ " Name: \"name_USER_0_kind_hdd-2\""
+ " Kind: \"storage-pool-number-2\""
+ "}");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
auto& vc = InitCreateVolumeConfig("BSVolume", vdescr);
vc.ClearExplicitChannelProfiles();
vc.AddExplicitChannelProfiles()->SetPoolKind("storage-pool-number-1");
@@ -281,47 +281,47 @@ Y_UNIT_TEST_SUITE(TBSVWithReboots) {
vc.AddExplicitChannelProfiles()->SetPoolKind("storage-pool-number-1");
vc.AddExplicitChannelProfiles()->SetPoolKind("storage-pool-number-2");
TestCreateBlockStoreVolume(runtime, ++t.TxId, "/MyRoot/DirA/USER_0", vdescr.DebugString());
-
- TestForceDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId-1});
+
+ TestForceDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId-1});
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 3));
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(7),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
- }
- });
- }
-
- Y_UNIT_TEST(CreateWithIntermediateDirs) {
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(7),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(CreateWithIntermediateDirs) {
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
InitCreateVolumeConfig("Valid/x/y/z", vdescr);
const auto validScheme = vdescr.DebugString();
vdescr.Clear();
InitCreateVolumeConfig("Invalid/wr0ng n@me", vdescr);
const auto invalidScheme = vdescr.DebugString();
- const auto validStatus = NKikimrScheme::StatusAccepted;
- const auto invalidStatus = NKikimrScheme::StatusSchemeError;
-
- CreateWithIntermediateDirs([&](TTestActorRuntime& runtime, ui64 txId, const TString& root, bool valid) {
- TestCreateBlockStoreVolume(runtime, txId, root, valid ? validScheme : invalidScheme, {valid ? validStatus : invalidStatus});
- });
- }
-
- Y_UNIT_TEST(CreateWithIntermediateDirsForceDrop) {
- CreateWithIntermediateDirsForceDrop([](TTestActorRuntime& runtime, ui64 txId, const TString& root) {
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ const auto validStatus = NKikimrScheme::StatusAccepted;
+ const auto invalidStatus = NKikimrScheme::StatusSchemeError;
+
+ CreateWithIntermediateDirs([&](TTestActorRuntime& runtime, ui64 txId, const TString& root, bool valid) {
+ TestCreateBlockStoreVolume(runtime, txId, root, valid ? validScheme : invalidScheme, {valid ? validStatus : invalidStatus});
+ });
+ }
+
+ Y_UNIT_TEST(CreateWithIntermediateDirsForceDrop) {
+ CreateWithIntermediateDirsForceDrop([](TTestActorRuntime& runtime, ui64 txId, const TString& root) {
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
InitCreateVolumeConfig("x/y/z", vdescr);
AsyncCreateBlockStoreVolume(runtime, txId, root, vdescr.DebugString());
- });
- }
+ });
+ }
Y_UNIT_TEST(CreateAssignWithVersion) {
@@ -331,7 +331,7 @@ Y_UNIT_TEST_SUITE(TBSVWithReboots) {
t.RestoreLogging();
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
InitCreateVolumeConfig("BSVolume_4", vdescr);
TestCreateBlockStoreVolume(runtime, t.TxId++, "/MyRoot/DirA", vdescr.DebugString());
@@ -349,4 +349,4 @@ Y_UNIT_TEST_SUITE(TBSVWithReboots) {
});
}
-}
+}
diff --git a/ydb/core/tx/schemeshard/ut_bsvolume_reboots/ya.make b/ydb/core/tx/schemeshard/ut_bsvolume_reboots/ya.make
index 7309cc53078..45a84bd0cef 100644
--- a/ydb/core/tx/schemeshard/ut_bsvolume_reboots/ya.make
+++ b/ydb/core/tx/schemeshard/ut_bsvolume_reboots/ya.make
@@ -1,15 +1,15 @@
IF (NOT WITH_VALGRIND)
UNITTEST_FOR(ydb/core/tx/schemeshard)
-
+
OWNER(
vvvv
g:kikimr
)
-
+
FORK_SUBTESTS()
-
+
SPLIT_FACTOR(60)
-
+
IF (SANITIZER_TYPE OR WITH_VALGRIND)
TIMEOUT(3600)
SIZE(LARGE)
@@ -18,7 +18,7 @@ IF (NOT WITH_VALGRIND)
TIMEOUT(600)
SIZE(MEDIUM)
ENDIF()
-
+
PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
diff --git a/ydb/core/tx/schemeshard/ut_cdc_stream.cpp b/ydb/core/tx/schemeshard/ut_cdc_stream.cpp
index 66d54a04295..5090fe7df6a 100644
--- a/ydb/core/tx/schemeshard/ut_cdc_stream.cpp
+++ b/ydb/core/tx/schemeshard/ut_cdc_stream.cpp
@@ -1,7 +1,7 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
using namespace NKikimr;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NSchemeShardUT_Private;
Y_UNIT_TEST_SUITE(TCdcStreamTests) {
@@ -58,7 +58,7 @@ Y_UNIT_TEST_SUITE(TCdcStreamTests) {
Name: "Stream"
Mode: ECdcStreamModeKeysOnly
}
- )", {NKikimrScheme::StatusNameConflict});
+ )", {NKikimrScheme::StatusNameConflict});
TestCreateCdcStream(runtime, ++txId, "/MyRoot", R"(
TableName: "UnknownTable"
@@ -66,7 +66,7 @@ Y_UNIT_TEST_SUITE(TCdcStreamTests) {
Name: "Stream"
Mode: ECdcStreamModeKeysOnly
}
- )", {NKikimrScheme::StatusPathDoesNotExist});
+ )", {NKikimrScheme::StatusPathDoesNotExist});
TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
TableDescription {
@@ -88,7 +88,7 @@ Y_UNIT_TEST_SUITE(TCdcStreamTests) {
Name: "Index"
Mode: ECdcStreamModeKeysOnly
}
- )", {NKikimrScheme::StatusNameConflict});
+ )", {NKikimrScheme::StatusNameConflict});
TestCreateCdcStream(runtime, ++txId, "/MyRoot/Table/Index", R"(
TableName: "indexImplTable"
@@ -96,14 +96,14 @@ Y_UNIT_TEST_SUITE(TCdcStreamTests) {
Name: "Stream"
Mode: ECdcStreamModeKeysOnly
}
- )", {NKikimrScheme::StatusNameConflict});
+ )", {NKikimrScheme::StatusNameConflict});
TestCreateCdcStream(runtime, ++txId, "/MyRoot", R"(
TableName: "Table"
StreamDescription {
Name: "Stream"
}
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
TestCreateCdcStream(runtime, ++txId, "/MyRoot", R"(
TableName: "Table"
@@ -123,7 +123,7 @@ Y_UNIT_TEST_SUITE(TCdcStreamTests) {
Name: "Stream"
Mode: ECdcStreamModeKeysOnly
}
- )", {NKikimrScheme::StatusPathDoesNotExist});
+ )", {NKikimrScheme::StatusPathDoesNotExist});
}
Y_UNIT_TEST(AlterStream) {
@@ -135,13 +135,13 @@ Y_UNIT_TEST_SUITE(TCdcStreamTests) {
TableName: "MyRoot"
StreamName: "Stream"
Disable {}
- )", {NKikimrScheme::StatusNameConflict});
+ )", {NKikimrScheme::StatusNameConflict});
TestAlterCdcStream(runtime, ++txId, "/MyRoot", R"(
TableName: "UnknownTable"
StreamName: "Stream"
Disable {}
- )", {NKikimrScheme::StatusPathDoesNotExist});
+ )", {NKikimrScheme::StatusPathDoesNotExist});
TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
TableDescription {
@@ -161,7 +161,7 @@ Y_UNIT_TEST_SUITE(TCdcStreamTests) {
TableName: "Table"
StreamName: "Index"
Disable {}
- )", {NKikimrScheme::StatusNameConflict});
+ )", {NKikimrScheme::StatusNameConflict});
TestCreateCdcStream(runtime, ++txId, "/MyRoot", R"(
TableName: "Table"
@@ -175,7 +175,7 @@ Y_UNIT_TEST_SUITE(TCdcStreamTests) {
TestAlterCdcStream(runtime, ++txId, "/MyRoot", R"(
TableName: "Table"
StreamName: "Stream"
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
}
Y_UNIT_TEST(DropStream) {
diff --git a/ydb/core/tx/schemeshard/ut_export.cpp b/ydb/core/tx/schemeshard/ut_export.cpp
index 82344b681e7..20c5353befc 100644
--- a/ydb/core/tx/schemeshard/ut_export.cpp
+++ b/ydb/core/tx/schemeshard/ut_export.cpp
@@ -70,14 +70,14 @@ namespace {
ExternalSchemeShard: true
ExternalHive: false
Name: "%s"
- StoragePools {
- Name: "name_User_kind_hdd-1"
- Kind: "common"
- }
- StoragePools {
- Name: "name_User_kind_hdd-2"
- Kind: "external"
- }
+ StoragePools {
+ Name: "name_User_kind_hdd-1"
+ Kind: "common"
+ }
+ StoragePools {
+ Name: "name_User_kind_hdd-2"
+ Kind: "external"
+ }
)", TStringBuf(dbName).RNextTok('/').data()));
env.TestWaitNotification(runtime, txId);
}
@@ -276,23 +276,23 @@ Y_UNIT_TEST_SUITE(TExportToS3Tests) {
Y_UNIT_TEST(CancelUponCreatingExportDirShouldSucceed) {
CancelShouldSucceed([](TAutoPtr<IEventHandle>& ev) {
- if (ev->GetTypeRewrite() != TEvSchemeShard::EvModifySchemeTransaction) {
+ if (ev->GetTypeRewrite() != TEvSchemeShard::EvModifySchemeTransaction) {
return false;
}
- return ev->Get<TEvSchemeShard::TEvModifySchemeTransaction>()->Record
- .GetTransaction(0).GetOperationType() == NKikimrSchemeOp::ESchemeOpMkDir;
+ return ev->Get<TEvSchemeShard::TEvModifySchemeTransaction>()->Record
+ .GetTransaction(0).GetOperationType() == NKikimrSchemeOp::ESchemeOpMkDir;
});
}
Y_UNIT_TEST(CancelUponCopyingTablesShouldSucceed) {
CancelShouldSucceed([](TAutoPtr<IEventHandle>& ev) {
- if (ev->GetTypeRewrite() != TEvSchemeShard::EvModifySchemeTransaction) {
+ if (ev->GetTypeRewrite() != TEvSchemeShard::EvModifySchemeTransaction) {
return false;
}
- return ev->Get<TEvSchemeShard::TEvModifySchemeTransaction>()->Record
- .GetTransaction(0).GetOperationType() == NKikimrSchemeOp::ESchemeOpCreateConsistentCopyTables;
+ return ev->Get<TEvSchemeShard::TEvModifySchemeTransaction>()->Record
+ .GetTransaction(0).GetOperationType() == NKikimrSchemeOp::ESchemeOpCreateConsistentCopyTables;
});
}
@@ -304,12 +304,12 @@ Y_UNIT_TEST_SUITE(TExportToS3Tests) {
UNIT_ASSERT(s3Mock.Start());
Cancel(tables, Sprintf(request.c_str(), port), [](TAutoPtr<IEventHandle>& ev) {
- if (ev->GetTypeRewrite() != TEvSchemeShard::EvModifySchemeTransaction) {
+ if (ev->GetTypeRewrite() != TEvSchemeShard::EvModifySchemeTransaction) {
return false;
}
- return ev->Get<TEvSchemeShard::TEvModifySchemeTransaction>()->Record
- .GetTransaction(0).GetOperationType() == NKikimrSchemeOp::ESchemeOpBackup;
+ return ev->Get<TEvSchemeShard::TEvModifySchemeTransaction>()->Record
+ .GetTransaction(0).GetOperationType() == NKikimrSchemeOp::ESchemeOpBackup;
});
}
@@ -408,9 +408,9 @@ Y_UNIT_TEST_SUITE(TExportToS3Tests) {
THolder<IEventHandle> delayed;
auto prevObserver = runtime.SetObserverFunc([&](TTestActorRuntimeBase&, TAutoPtr<IEventHandle>& ev) {
switch (ev->GetTypeRewrite()) {
- case TEvSchemeShard::EvModifySchemeTransaction:
+ case TEvSchemeShard::EvModifySchemeTransaction:
break;
- case TEvSchemeShard::EvNotifyTxCompletionResult:
+ case TEvSchemeShard::EvNotifyTxCompletionResult:
if (dropNotification) {
delayed.Reset(ev.Release());
return TTestActorRuntime::EEventAction::DROP;
@@ -420,8 +420,8 @@ Y_UNIT_TEST_SUITE(TExportToS3Tests) {
return TTestActorRuntime::EEventAction::PROCESS;
}
- const auto* msg = ev->Get<TEvSchemeShard::TEvModifySchemeTransaction>();
- if (msg->Record.GetTransaction(0).GetOperationType() == NKikimrSchemeOp::ESchemeOpCreateConsistentCopyTables) {
+ const auto* msg = ev->Get<TEvSchemeShard::TEvModifySchemeTransaction>();
+ if (msg->Record.GetTransaction(0).GetOperationType() == NKikimrSchemeOp::ESchemeOpCreateConsistentCopyTables) {
dropNotification = true;
}
@@ -492,9 +492,9 @@ Y_UNIT_TEST_SUITE(TExportToS3Tests) {
THolder<IEventHandle> delayed;
auto prevObserver = runtime.SetObserverFunc([&](TTestActorRuntimeBase&, TAutoPtr<IEventHandle>& ev) {
switch (ev->GetTypeRewrite()) {
- case TEvSchemeShard::EvModifySchemeTransaction:
+ case TEvSchemeShard::EvModifySchemeTransaction:
break;
- case TEvSchemeShard::EvNotifyTxCompletionResult:
+ case TEvSchemeShard::EvNotifyTxCompletionResult:
if (dropNotification) {
delayed.Reset(ev.Release());
return TTestActorRuntime::EEventAction::DROP;
@@ -504,8 +504,8 @@ Y_UNIT_TEST_SUITE(TExportToS3Tests) {
return TTestActorRuntime::EEventAction::PROCESS;
}
- const auto* msg = ev->Get<TEvSchemeShard::TEvModifySchemeTransaction>();
- if (msg->Record.GetTransaction(0).GetOperationType() == NKikimrSchemeOp::ESchemeOpCreateConsistentCopyTables) {
+ const auto* msg = ev->Get<TEvSchemeShard::TEvModifySchemeTransaction>();
+ if (msg->Record.GetTransaction(0).GetOperationType() == NKikimrSchemeOp::ESchemeOpCreateConsistentCopyTables) {
dropNotification = true;
}
diff --git a/ydb/core/tx/schemeshard/ut_export_reboots_s3.cpp b/ydb/core/tx/schemeshard/ut_export_reboots_s3.cpp
index 90ec5a9b847..5e1e42d17ce 100644
--- a/ydb/core/tx/schemeshard/ut_export_reboots_s3.cpp
+++ b/ydb/core/tx/schemeshard/ut_export_reboots_s3.cpp
@@ -1,261 +1,261 @@
#include <ydb/core/tx/schemeshard/ut_helpers/export_reboots_common.h>
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
#include <ydb/core/wrappers/ut_helpers/s3_mock.h>
-
-#include <util/string/printf.h>
-
-using namespace NSchemeShardUT_Private;
+
+#include <util/string/printf.h>
+
+using namespace NSchemeShardUT_Private;
using namespace NSchemeShardUT_Private::NExportReboots;
-using namespace NKikimr::NWrappers::NTestHelpers;
-
-Y_UNIT_TEST_SUITE(TExportToS3WithRebootsTests) {
+using namespace NKikimr::NWrappers::NTestHelpers;
+
+Y_UNIT_TEST_SUITE(TExportToS3WithRebootsTests) {
using TUnderlying = std::function<void(const TVector<TString>&, const TString&, TTestWithReboots&)>;
-
- void Decorate(const TVector<TString>& tables, const TString& request, TUnderlying func) {
- TPortManager portManager;
- const ui16 port = portManager.GetPort();
-
+
+ void Decorate(const TVector<TString>& tables, const TString& request, TUnderlying func) {
+ TPortManager portManager;
+ const ui16 port = portManager.GetPort();
+
TTestWithReboots t;
- TS3Mock s3Mock({}, TS3Mock::TSettings(port));
- UNIT_ASSERT(s3Mock.Start());
-
+ TS3Mock s3Mock({}, TS3Mock::TSettings(port));
+ UNIT_ASSERT(s3Mock.Start());
+
func(tables, Sprintf(request.c_str(), port), t);
- }
-
- void RunS3(const TVector<TString>& tables, const TString& request) {
- Decorate(tables, request, &Run);
- }
-
- void CancelS3(const TVector<TString>& tables, const TString& request) {
- Decorate(tables, request, &Cancel);
- }
-
- void ForgetS3(const TVector<TString>& tables, const TString& request) {
- Decorate(tables, request, &Forget);
- }
-
- Y_UNIT_TEST(ShouldSucceedOnSingleShardTable) {
- RunS3({
- R"(
- Name: "Table"
- Columns { Name: "key" Type: "Utf8" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )",
- }, R"(
- ExportToS3Settings {
- endpoint: "localhost:%d"
- scheme: HTTP
- items {
- source_path: "/MyRoot/Table"
- destination_prefix: ""
- }
- }
- )");
- }
-
- Y_UNIT_TEST(ShouldSucceedOnMultiShardTable) {
- RunS3({
- R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint32" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- UniformPartitionsCount: 2
- )",
- }, R"(
- ExportToS3Settings {
- endpoint: "localhost:%d"
- scheme: HTTP
- items {
- source_path: "/MyRoot/Table"
- destination_prefix: ""
- }
- }
- )");
- }
-
- Y_UNIT_TEST(ShouldSucceedOnSingleTable) {
- // same as ShouldSucceedOnSingleShardTable
- }
-
- Y_UNIT_TEST(ShouldSucceedOnManyTables) {
- RunS3({
- R"(
- Name: "Table1"
- Columns { Name: "key" Type: "Utf8" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )",
- R"(
- Name: "Table2"
- Columns { Name: "key" Type: "Utf8" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )",
- }, R"(
- ExportToS3Settings {
- endpoint: "localhost:%d"
- scheme: HTTP
- items {
- source_path: "/MyRoot/Table1"
- destination_prefix: "table1"
- }
- items {
- source_path: "/MyRoot/Table2"
- destination_prefix: "table2"
- }
- }
- )");
- }
-
- Y_UNIT_TEST(CancelShouldSucceedOnSingleShardTable) {
- CancelS3({
- R"(
- Name: "Table"
- Columns { Name: "key" Type: "Utf8" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )",
- }, R"(
- ExportToS3Settings {
- endpoint: "localhost:%d"
- scheme: HTTP
- items {
- source_path: "/MyRoot/Table"
- destination_prefix: ""
- }
- }
- )");
- }
-
- Y_UNIT_TEST(CancelShouldSucceedOnMultiShardTable) {
- CancelS3({
- R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint32" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- UniformPartitionsCount: 2
- )",
- }, R"(
- ExportToS3Settings {
- endpoint: "localhost:%d"
- scheme: HTTP
- items {
- source_path: "/MyRoot/Table"
- destination_prefix: ""
- }
- }
- )");
- }
-
- Y_UNIT_TEST(CancelShouldSucceedOnSingleTable) {
- // same as CancelShouldSucceedOnSingleShardTable
- }
-
- Y_UNIT_TEST(CancelShouldSucceedOnManyTables) {
- CancelS3({
- R"(
- Name: "Table1"
- Columns { Name: "key" Type: "Utf8" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )",
- R"(
- Name: "Table2"
- Columns { Name: "key" Type: "Utf8" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )",
- }, R"(
- ExportToS3Settings {
- endpoint: "localhost:%d"
- scheme: HTTP
- items {
- source_path: "/MyRoot/Table1"
- destination_prefix: "table1"
- }
- items {
- source_path: "/MyRoot/Table2"
- destination_prefix: "table2"
- }
- }
- )");
- }
-
- Y_UNIT_TEST(ForgetShouldSucceedOnSingleShardTable) {
- ForgetS3({
- R"(
- Name: "Table"
- Columns { Name: "key" Type: "Utf8" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )",
- }, R"(
- ExportToS3Settings {
- endpoint: "localhost:%d"
- scheme: HTTP
- items {
- source_path: "/MyRoot/Table"
- destination_prefix: ""
- }
- }
- )");
- }
-
- Y_UNIT_TEST(ForgetShouldSucceedOnMultiShardTable) {
- ForgetS3({
- R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint32" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- UniformPartitionsCount: 2
- )",
- }, R"(
- ExportToS3Settings {
- endpoint: "localhost:%d"
- scheme: HTTP
- items {
- source_path: "/MyRoot/Table"
- destination_prefix: ""
- }
- }
- )");
- }
-
- Y_UNIT_TEST(ForgetShouldSucceedOnSingleTable) {
- // same as ForgetShouldSucceedOnSingleShardTable
- }
-
- Y_UNIT_TEST(ForgetShouldSucceedOnManyTables) {
- ForgetS3({
- R"(
- Name: "Table1"
- Columns { Name: "key" Type: "Utf8" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )",
- R"(
- Name: "Table2"
- Columns { Name: "key" Type: "Utf8" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )",
- }, R"(
- ExportToS3Settings {
- endpoint: "localhost:%d"
- scheme: HTTP
- items {
- source_path: "/MyRoot/Table1"
- destination_prefix: "table1"
- }
- items {
- source_path: "/MyRoot/Table2"
- destination_prefix: "table2"
- }
- }
- )");
- }
-}
+ }
+
+ void RunS3(const TVector<TString>& tables, const TString& request) {
+ Decorate(tables, request, &Run);
+ }
+
+ void CancelS3(const TVector<TString>& tables, const TString& request) {
+ Decorate(tables, request, &Cancel);
+ }
+
+ void ForgetS3(const TVector<TString>& tables, const TString& request) {
+ Decorate(tables, request, &Forget);
+ }
+
+ Y_UNIT_TEST(ShouldSucceedOnSingleShardTable) {
+ RunS3({
+ R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Utf8" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )",
+ }, R"(
+ ExportToS3Settings {
+ endpoint: "localhost:%d"
+ scheme: HTTP
+ items {
+ source_path: "/MyRoot/Table"
+ destination_prefix: ""
+ }
+ }
+ )");
+ }
+
+ Y_UNIT_TEST(ShouldSucceedOnMultiShardTable) {
+ RunS3({
+ R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint32" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ UniformPartitionsCount: 2
+ )",
+ }, R"(
+ ExportToS3Settings {
+ endpoint: "localhost:%d"
+ scheme: HTTP
+ items {
+ source_path: "/MyRoot/Table"
+ destination_prefix: ""
+ }
+ }
+ )");
+ }
+
+ Y_UNIT_TEST(ShouldSucceedOnSingleTable) {
+ // same as ShouldSucceedOnSingleShardTable
+ }
+
+ Y_UNIT_TEST(ShouldSucceedOnManyTables) {
+ RunS3({
+ R"(
+ Name: "Table1"
+ Columns { Name: "key" Type: "Utf8" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )",
+ R"(
+ Name: "Table2"
+ Columns { Name: "key" Type: "Utf8" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )",
+ }, R"(
+ ExportToS3Settings {
+ endpoint: "localhost:%d"
+ scheme: HTTP
+ items {
+ source_path: "/MyRoot/Table1"
+ destination_prefix: "table1"
+ }
+ items {
+ source_path: "/MyRoot/Table2"
+ destination_prefix: "table2"
+ }
+ }
+ )");
+ }
+
+ Y_UNIT_TEST(CancelShouldSucceedOnSingleShardTable) {
+ CancelS3({
+ R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Utf8" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )",
+ }, R"(
+ ExportToS3Settings {
+ endpoint: "localhost:%d"
+ scheme: HTTP
+ items {
+ source_path: "/MyRoot/Table"
+ destination_prefix: ""
+ }
+ }
+ )");
+ }
+
+ Y_UNIT_TEST(CancelShouldSucceedOnMultiShardTable) {
+ CancelS3({
+ R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint32" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ UniformPartitionsCount: 2
+ )",
+ }, R"(
+ ExportToS3Settings {
+ endpoint: "localhost:%d"
+ scheme: HTTP
+ items {
+ source_path: "/MyRoot/Table"
+ destination_prefix: ""
+ }
+ }
+ )");
+ }
+
+ Y_UNIT_TEST(CancelShouldSucceedOnSingleTable) {
+ // same as CancelShouldSucceedOnSingleShardTable
+ }
+
+ Y_UNIT_TEST(CancelShouldSucceedOnManyTables) {
+ CancelS3({
+ R"(
+ Name: "Table1"
+ Columns { Name: "key" Type: "Utf8" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )",
+ R"(
+ Name: "Table2"
+ Columns { Name: "key" Type: "Utf8" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )",
+ }, R"(
+ ExportToS3Settings {
+ endpoint: "localhost:%d"
+ scheme: HTTP
+ items {
+ source_path: "/MyRoot/Table1"
+ destination_prefix: "table1"
+ }
+ items {
+ source_path: "/MyRoot/Table2"
+ destination_prefix: "table2"
+ }
+ }
+ )");
+ }
+
+ Y_UNIT_TEST(ForgetShouldSucceedOnSingleShardTable) {
+ ForgetS3({
+ R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Utf8" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )",
+ }, R"(
+ ExportToS3Settings {
+ endpoint: "localhost:%d"
+ scheme: HTTP
+ items {
+ source_path: "/MyRoot/Table"
+ destination_prefix: ""
+ }
+ }
+ )");
+ }
+
+ Y_UNIT_TEST(ForgetShouldSucceedOnMultiShardTable) {
+ ForgetS3({
+ R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint32" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ UniformPartitionsCount: 2
+ )",
+ }, R"(
+ ExportToS3Settings {
+ endpoint: "localhost:%d"
+ scheme: HTTP
+ items {
+ source_path: "/MyRoot/Table"
+ destination_prefix: ""
+ }
+ }
+ )");
+ }
+
+ Y_UNIT_TEST(ForgetShouldSucceedOnSingleTable) {
+ // same as ForgetShouldSucceedOnSingleShardTable
+ }
+
+ Y_UNIT_TEST(ForgetShouldSucceedOnManyTables) {
+ ForgetS3({
+ R"(
+ Name: "Table1"
+ Columns { Name: "key" Type: "Utf8" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )",
+ R"(
+ Name: "Table2"
+ Columns { Name: "key" Type: "Utf8" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )",
+ }, R"(
+ ExportToS3Settings {
+ endpoint: "localhost:%d"
+ scheme: HTTP
+ items {
+ source_path: "/MyRoot/Table1"
+ destination_prefix: "table1"
+ }
+ items {
+ source_path: "/MyRoot/Table2"
+ destination_prefix: "table2"
+ }
+ }
+ )");
+ }
+}
diff --git a/ydb/core/tx/schemeshard/ut_export_reboots_s3/ya.make b/ydb/core/tx/schemeshard/ut_export_reboots_s3/ya.make
index 6d0ddd02334..d46c77ae5b7 100644
--- a/ydb/core/tx/schemeshard/ut_export_reboots_s3/ya.make
+++ b/ydb/core/tx/schemeshard/ut_export_reboots_s3/ya.make
@@ -1,40 +1,40 @@
UNITTEST_FOR(ydb/core/tx/schemeshard)
-
-OWNER(
- ilnaz
- g:kikimr
-)
-
-FORK_SUBTESTS()
-
-SPLIT_FACTOR(12)
-
-IF (SANITIZER_TYPE OR WITH_VALGRIND)
- TIMEOUT(3600)
- SIZE(LARGE)
- TAG(ya:fat)
-ELSE()
- TIMEOUT(600)
- SIZE(MEDIUM)
-ENDIF()
-
+
+OWNER(
+ ilnaz
+ g:kikimr
+)
+
+FORK_SUBTESTS()
+
+SPLIT_FACTOR(12)
+
+IF (SANITIZER_TYPE OR WITH_VALGRIND)
+ TIMEOUT(3600)
+ SIZE(LARGE)
+ TAG(ya:fat)
+ELSE()
+ TIMEOUT(600)
+ SIZE(MEDIUM)
+ENDIF()
+
INCLUDE(${ARCADIA_ROOT}/ydb/tests/supp/ubsan_supp.inc)
-
-PEERDIR(
+
+PEERDIR(
library/cpp/getopt
- library/cpp/regex/pcre
- library/cpp/svnversion
+ library/cpp/regex/pcre
+ library/cpp/svnversion
ydb/core/testlib
ydb/core/tx
ydb/core/tx/schemeshard/ut_helpers
ydb/core/wrappers/ut_helpers
ydb/library/yql/public/udf/service/exception_policy
-)
-
-SRCS(
- ut_export_reboots_s3.cpp
-)
-
-YQL_LAST_ABI_VERSION()
-
-END()
+)
+
+SRCS(
+ ut_export_reboots_s3.cpp
+)
+
+YQL_LAST_ABI_VERSION()
+
+END()
diff --git a/ydb/core/tx/schemeshard/ut_extsubdomain.cpp b/ydb/core/tx/schemeshard/ut_extsubdomain.cpp
index f07bef30712..0fa6a27bce0 100644
--- a/ydb/core/tx/schemeshard/ut_extsubdomain.cpp
+++ b/ydb/core/tx/schemeshard/ut_extsubdomain.cpp
@@ -1,151 +1,151 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-using namespace NSchemeShardUT_Private;
-
-Y_UNIT_TEST_SUITE(TSchemeShardExtSubDomainTest) {
- Y_UNIT_TEST(Fake) {
- }
-
- Y_UNIT_TEST(Create) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 3 "
- "Mediators: 3 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"",
- {NKikimrScheme::StatusInvalidParameter});
-
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
- "StoragePools { "
- " Name: \"/dc-1/users/tenant-1:hdd\" "
- " Kind: \"hdd\" "
- "} "
- "StoragePools { "
- " Name: \"/dc-1/users/tenant-1:hdd-1\" "
- " Kind: \"hdd-1\" "
- "} "
- "Name: \"USER_0\"",
- {NKikimrScheme::StatusInvalidParameter});
-
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\"");
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist});
- TestDescribeResult(DescribePath(runtime, "MyRoot/USER_0"),
- {NLs::PathExist});
- }
-
- Y_UNIT_TEST(CreateAndWait) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
- AsyncMkDir(runtime, ++txId, "MyRoot", "dir");
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot/dir",
- "Name: \"USER_0\"");
-
- env.TestWaitNotification(runtime, {txId, txId - 1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/USER_0"),
- {NLs::PathExist,
- NLs::PathVersionEqual(3),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(0)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/dir"),
- {NLs::PathExist,
- NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(0)});
- }
-
- Y_UNIT_TEST(CreateItemsInsideExtSubdomainAtGSSwithoutTSS) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\"");
-
-
- TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "dir_0",
- {NKikimrScheme::StatusRedirectDomain});
-
- TestCreateTable(runtime, ++txId, "/MyRoot/USER_0/dir_0",
- "Name: \"table_1\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]",
- {NKikimrScheme::StatusRedirectDomain});
-
- TestCreateTable(runtime, ++txId, "/MyRoot/USER_0",
- "Name: \"table_0\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]",
- {NKikimrScheme::StatusRedirectDomain});
-
- env.TestWaitNotification(runtime, {txId, txId - 1, txId - 2, txId -3});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::IsExternalSubDomain("USER_0"),
- NLs::PathVersionEqual(3),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(0)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table_0"),
- {NLs::InExternalSubdomain});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dir_0"),
- {NLs::InExternalSubdomain});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dir_0/table_1"),
- {NLs::InExternalSubdomain});
- }
-
- Y_UNIT_TEST(CreateAndAlterWithoutTx) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestMkDir(runtime, ++txId, "/MyRoot", "dir");
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot/dir",
- "Name: \"USER_0\"");
- TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/USER_0"),
- {NLs::PathExist,
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+using namespace NSchemeShardUT_Private;
+
+Y_UNIT_TEST_SUITE(TSchemeShardExtSubDomainTest) {
+ Y_UNIT_TEST(Fake) {
+ }
+
+ Y_UNIT_TEST(Create) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 3 "
+ "Mediators: 3 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"",
+ {NKikimrScheme::StatusInvalidParameter});
+
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
+ "StoragePools { "
+ " Name: \"/dc-1/users/tenant-1:hdd\" "
+ " Kind: \"hdd\" "
+ "} "
+ "StoragePools { "
+ " Name: \"/dc-1/users/tenant-1:hdd-1\" "
+ " Kind: \"hdd-1\" "
+ "} "
+ "Name: \"USER_0\"",
+ {NKikimrScheme::StatusInvalidParameter});
+
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\"");
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist});
+ TestDescribeResult(DescribePath(runtime, "MyRoot/USER_0"),
+ {NLs::PathExist});
+ }
+
+ Y_UNIT_TEST(CreateAndWait) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+ AsyncMkDir(runtime, ++txId, "MyRoot", "dir");
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot/dir",
+ "Name: \"USER_0\"");
+
+ env.TestWaitNotification(runtime, {txId, txId - 1});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/USER_0"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(3),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(0)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/dir"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(0)});
+ }
+
+ Y_UNIT_TEST(CreateItemsInsideExtSubdomainAtGSSwithoutTSS) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\"");
+
+
+ TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "dir_0",
+ {NKikimrScheme::StatusRedirectDomain});
+
+ TestCreateTable(runtime, ++txId, "/MyRoot/USER_0/dir_0",
+ "Name: \"table_1\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]",
+ {NKikimrScheme::StatusRedirectDomain});
+
+ TestCreateTable(runtime, ++txId, "/MyRoot/USER_0",
+ "Name: \"table_0\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]",
+ {NKikimrScheme::StatusRedirectDomain});
+
+ env.TestWaitNotification(runtime, {txId, txId - 1, txId - 2, txId -3});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::IsExternalSubDomain("USER_0"),
+ NLs::PathVersionEqual(3),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(0)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table_0"),
+ {NLs::InExternalSubdomain});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dir_0"),
+ {NLs::InExternalSubdomain});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dir_0/table_1"),
+ {NLs::InExternalSubdomain});
+ }
+
+ Y_UNIT_TEST(CreateAndAlterWithoutTx) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestMkDir(runtime, ++txId, "/MyRoot", "dir");
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot/dir",
+ "Name: \"USER_0\"");
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/USER_0"),
+ {NLs::PathExist,
NLs::DomainKey(3, TTestTxConfig::SchemeShard),
- NLs::DomainCoordinators({}),
- NLs::DomainMediators({}),
- NLs::DomainSchemeshard(0)});
- env.TestWaitNotification(runtime, {txId, txId - 1});
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot/dir",
- "ExternalSchemeShard: true "
- "Name: \"USER_0\"",
- {NKikimrScheme::StatusInvalidParameter});
- }
-
- Y_UNIT_TEST(CreateAndAlter) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
-
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\"");
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\" "
- "PlanResolution: 50 "
- "Coordinators: 3 "
- "Mediators: 3 "
- "TimeCastBucketsPerMediator: 2",
- {NKikimrScheme::StatusInvalidParameter});
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "StoragePools { "
+ NLs::DomainCoordinators({}),
+ NLs::DomainMediators({}),
+ NLs::DomainSchemeshard(0)});
+ env.TestWaitNotification(runtime, {txId, txId - 1});
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot/dir",
+ "ExternalSchemeShard: true "
+ "Name: \"USER_0\"",
+ {NKikimrScheme::StatusInvalidParameter});
+ }
+
+ Y_UNIT_TEST(CreateAndAlter) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\"");
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "PlanResolution: 50 "
+ "Coordinators: 3 "
+ "Mediators: 3 "
+ "TimeCastBucketsPerMediator: 2",
+ {NKikimrScheme::StatusInvalidParameter});
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "StoragePools { "
" Name: \"pool-1\" "
" Kind: \"pool-kind-1\" "
"} "
@@ -154,567 +154,567 @@ Y_UNIT_TEST_SUITE(TSchemeShardExtSubDomainTest) {
" Kind: \"pool-kind-2\" "
"} "
"StoragePools { "
- " Name: \"/dc-1/users/tenant-1:hdd\" "
- " Kind: \"hdd\" "
- "} "
- "StoragePools { "
- " Name: \"/dc-1/users/tenant-1:hdd-1\" "
- " Kind: \"hdd-1\" "
- "} "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "ExternalSchemeShard: true "
- "Name: \"USER_0\"");
-
- env.TestWaitNotification(runtime, {txId, txId - 1, txId - 2});
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
-
- UNIT_ASSERT(tenantSchemeShard != 0
- && tenantSchemeShard != (ui64)-1
+ " Name: \"/dc-1/users/tenant-1:hdd\" "
+ " Kind: \"hdd\" "
+ "} "
+ "StoragePools { "
+ " Name: \"/dc-1/users/tenant-1:hdd-1\" "
+ " Kind: \"hdd-1\" "
+ "} "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "ExternalSchemeShard: true "
+ "Name: \"USER_0\"");
+
+ env.TestWaitNotification(runtime, {txId, txId - 1, txId - 2});
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
+
+ UNIT_ASSERT(tenantSchemeShard != 0
+ && tenantSchemeShard != (ui64)-1
&& tenantSchemeShard != TTestTxConfig::SchemeShard);
-
- ui64 tenantSchemeShard2 = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table"),
- {NLs::InExternalSubdomain,
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard2)});
-
- UNIT_ASSERT(tenantSchemeShard == tenantSchemeShard2);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
- {NLs::PathExist});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/dir"),
- {NLs::PathNotExist});
-
- TestMkDir(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0", "dir");
- env.TestWaitNotification(runtime, txId, tenantSchemeShard);
-
+
+ ui64 tenantSchemeShard2 = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table"),
+ {NLs::InExternalSubdomain,
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard2)});
+
+ UNIT_ASSERT(tenantSchemeShard == tenantSchemeShard2);
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
+ {NLs::PathExist});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/dir"),
+ {NLs::PathNotExist});
+
+ TestMkDir(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0", "dir");
+ env.TestWaitNotification(runtime, txId, tenantSchemeShard);
+
TestDescribeResult(DescribePath(runtime, TTestTxConfig::SchemeShard, "/MyRoot/USER_0/dir"),
- {NLs::PathRedirected});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/dir"),
- {NLs::PathExist,
- NLs::Finished});
-
- TestCreateTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0/dir",
- "Name: \"table_1\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]");
-
- env.TestWaitNotification(runtime, txId, tenantSchemeShard);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dir/table_1"),
- {NLs::PathRedirected});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/dir/table_1"),
- {NLs::PathExist,
- NLs::Finished});
- }
-
- Y_UNIT_TEST(CreateAndAlterAfter) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
-
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\"");
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\" "
- "ExternalSchemeShard: true "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "StoragePools { "
- " Name: \"pool-1\" "
- " Kind: \"hdd\" "
- "} ");
-
- env.TestWaitNotification(runtime, {txId, txId - 1});
-
- TestAlterSubDomain(runtime, ++txId, "/MyRoot",
+ {NLs::PathRedirected});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/dir"),
+ {NLs::PathExist,
+ NLs::Finished});
+
+ TestCreateTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0/dir",
+ "Name: \"table_1\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]");
+
+ env.TestWaitNotification(runtime, txId, tenantSchemeShard);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dir/table_1"),
+ {NLs::PathRedirected});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/dir/table_1"),
+ {NLs::PathExist,
+ NLs::Finished});
+ }
+
+ Y_UNIT_TEST(CreateAndAlterAfter) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\"");
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "ExternalSchemeShard: true "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "StoragePools { "
+ " Name: \"pool-1\" "
+ " Kind: \"hdd\" "
+ "} ");
+
+ env.TestWaitNotification(runtime, {txId, txId - 1});
+
+ TestAlterSubDomain(runtime, ++txId, "/MyRoot",
"Name: \"USER_0\" "
- "StoragePools { "
- " Name: \"pool-1\" "
- " Kind: \"hdd\" "
- "} "
- "StoragePools { "
- " Name: \"pool-2\" "
- " Kind: \"hdd-1\" "
- "} ");
- env.TestWaitNotification(runtime, txId);
-
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
-
- UNIT_ASSERT(tenantSchemeShard != 0
- && tenantSchemeShard != (ui64)-1
+ "StoragePools { "
+ " Name: \"pool-1\" "
+ " Kind: \"hdd\" "
+ "} "
+ "StoragePools { "
+ " Name: \"pool-2\" "
+ " Kind: \"hdd-1\" "
+ "} ");
+ env.TestWaitNotification(runtime, txId);
+
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
+
+ UNIT_ASSERT(tenantSchemeShard != 0
+ && tenantSchemeShard != (ui64)-1
&& tenantSchemeShard != TTestTxConfig::SchemeShard);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::StoragePoolsEqual({"pool-1", "pool-2"})});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::StoragePoolsEqual({"pool-1", "pool-2"})});
-
- TestUserAttrs(runtime, ++txId, "/MyRoot", "USER_0", AlterUserAttrs({{"user__attr_1", "value"}}));
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::UserAttrsEqual({{"user__attr_1", "value"}})});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::UserAttrsEqual({{"user__attr_1", "value"}})});
- }
-
- Y_UNIT_TEST(CreateWithExtraPathSymbolsAllowed) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TSchemeLimits lowLimits;
- lowLimits.MaxPathElementLength = 10;
- lowLimits.ExtraPathSymbolsAllowed = ".-";
-
- TestUserAttrs(runtime, ++txId, "/", "MyRoot", AlterUserAttrs({{"__extra_path_symbols_allowed", lowLimits.ExtraPathSymbolsAllowed}}));
- env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::StoragePoolsEqual({"pool-1", "pool-2"})});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::StoragePoolsEqual({"pool-1", "pool-2"})});
+
+ TestUserAttrs(runtime, ++txId, "/MyRoot", "USER_0", AlterUserAttrs({{"user__attr_1", "value"}}));
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::UserAttrsEqual({{"user__attr_1", "value"}})});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::UserAttrsEqual({{"user__attr_1", "value"}})});
+ }
+
+ Y_UNIT_TEST(CreateWithExtraPathSymbolsAllowed) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TSchemeLimits lowLimits;
+ lowLimits.MaxPathElementLength = 10;
+ lowLimits.ExtraPathSymbolsAllowed = ".-";
+
+ TestUserAttrs(runtime, ++txId, "/", "MyRoot", AlterUserAttrs({{"__extra_path_symbols_allowed", lowLimits.ExtraPathSymbolsAllowed}}));
+ env.TestWaitNotification(runtime, txId);
RebootTablet(runtime, TTestTxConfig::SchemeShard, runtime.AllocateEdgeActor());
-
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER+0\"",
- {NKikimrScheme::StatusSchemeError});
- env.TestWaitNotification(runtime, txId);
-
- lowLimits.ExtraPathSymbolsAllowed = ".-+";
- SetSchemeshardSchemaLimits(runtime, lowLimits);
-
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER+0\"");
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER+0\" "
- "ExternalSchemeShard: true "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "StoragePools { "
- " Name: \"pool-1\" "
- " Kind: \"hdd\" "
- "} ");
-
- env.TestWaitNotification(runtime, {txId, txId - 1});
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER+0\" "
- "ExternalSchemeShard: true "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "StoragePools { "
- " Name: \"pool-1\" "
- " Kind: \"hdd\" "
- "} ");
- env.TestWaitNotification(runtime, txId);
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER+0\" "
- "ExternalSchemeShard: false "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "StoragePools { "
- " Name: \"pool-1\" "
- " Kind: \"hdd\" "
- "} ",
- {NKikimrScheme::StatusInvalidParameter});
- env.TestWaitNotification(runtime, txId);
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER+0\" "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "StoragePools { "
- " Name: \"pool-1\" "
- " Kind: \"hdd\" "
- "} ");
- env.TestWaitNotification(runtime, txId);
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER+0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER+0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
-
- TestMkDir(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER+0", "Dir__!", {NKikimrScheme::StatusSchemeError});
- env.TestWaitNotification(runtime, txId, tenantSchemeShard);
-
- lowLimits.ExtraPathSymbolsAllowed = ".-+!";
- SetSchemeshardSchemaLimits(runtime, lowLimits, tenantSchemeShard);
-
- TestMkDir(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER+0", "Dir__!");
- env.TestWaitNotification(runtime, txId, tenantSchemeShard);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER+0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER+0")});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER+0"),
- {NLs::PathExist,
- NLs::ChildrenCount(1)});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER+0/Dir__!"),
- {NLs::PathExist,
- NLs::Finished});
- }
-
- Y_UNIT_TEST(AlterWithWrongParams) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, txId);
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\" "
- "ExternalSchemeShard: true "
- "PlanResolution: 0 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2",
- {NKikimrScheme::StatusInvalidParameter});
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\" "
- "ExternalSchemeShard: true "
- "PlanResolution: 50 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2",
- {NKikimrScheme::StatusInvalidParameter});
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\" "
- "ExternalSchemeShard: true "
- "PlanResolution: 50 "
- "Coordinators: 0 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2",
- {NKikimrScheme::StatusInvalidParameter});
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\" "
- "ExternalSchemeShard: true "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 0 "
- "TimeCastBucketsPerMediator: 2",
- {NKikimrScheme::StatusInvalidParameter});
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\" "
- "ExternalSchemeShard: true "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "TimeCastBucketsPerMediator: 2",
- {NKikimrScheme::StatusInvalidParameter});
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\" "
- "ExternalSchemeShard: false "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 ",
- {NKikimrScheme::StatusInvalidParameter});
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\" "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 ",
- {NKikimrScheme::StatusInvalidParameter});
-
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_1\" "
- "ExternalSchemeShard: true "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 ",
- {NKikimrScheme::StatusPathDoesNotExist});
-
- TestMkDir(runtime, ++txId, "/MyRoot", "Dir");
- env.TestWaitNotification(runtime, txId);
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"Dir\"",
- {NKikimrScheme::StatusNameConflict});
-
- TestCreateTable(runtime, ++txId, "/MyRoot",
- "Name: \"table\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- );
- env.TestWaitNotification(runtime, txId);
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"table\"",
- {NKikimrScheme::StatusNameConflict});
-
- TestCreateSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"subdomain\"");
- env.TestWaitNotification(runtime, txId);
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"subdomain\"",
- {NKikimrScheme::StatusNameConflict});
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"subdomain\" "
- "ExternalSchemeShard: true "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2",
- {NKikimrScheme::StatusNameConflict});
-
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"extSubdomain\"");
- env.TestWaitNotification(runtime, txId);
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"extSubdomain\"",
- {NKikimrScheme::StatusAlreadyExists});
- }
-
- Y_UNIT_TEST(NothingInsideGSS) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, txId);
-
- auto testCreations = [&] () {
- //dir
- TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA", {NKikimrScheme::StatusRedirectDomain});
-
- //table
- TestCreateTable(runtime, ++txId, "/MyRoot/USER_0", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusRedirectDomain});
-
- //bsv
- TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot/USER_0", R"(
- Name: "BSVolume"
- VolumeConfig: {
- NumChannels: 1
- ChannelProfileId: 2
- BlockSize: 4096
- Partitions { BlockCount: 16 }
- }
- )", {NKikimrScheme::StatusRedirectDomain});
-
- //extSub
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot/USER_0", R"(
- Name: "ExtSubDomain"
- )", {NKikimrScheme::StatusRedirectDomain});
-
- //sub
- TestCreateSubDomain(runtime, ++txId, "/MyRoot/USER_0", R"(
- Name: "SubDomain"
- )", {NKikimrScheme::StatusRedirectDomain});
-
- //kesus
- TestCreateKesus(runtime, ++txId, "/MyRoot/USER_0", R"(
- Name: "Kesus"
- )", {NKikimrScheme::StatusRedirectDomain});
-
- //rtmr
- TestCreateRtmrVolume(runtime, ++txId, "/MyRoot/USER_0", R"(
- Name: "rtmr1"
- PartitionsCount: 0
- )", {NKikimrScheme::StatusRedirectDomain});
-
- //solomon
- TestCreateSolomon(runtime, ++txId, "/MyRoot/USER_0", R"(
- Name: "Solomon"
- PartitionCount: 40
- )", {NKikimrScheme::StatusRedirectDomain});
-
- //pq
- TestCreatePQGroup(runtime, ++txId, "/MyRoot/USER_0", R"(
- Name: "PQGroup"
- TotalGroupCount: 2
- PartitionPerTablet: 1
- PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10 } }
- )", {NKikimrScheme::StatusRedirectDomain});
- };
-
- testCreations();
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\" "
- "ExternalSchemeShard: true "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "StoragePools { "
- " Name: \"pool-1\" "
- " Kind: \"hdd\" "
- "} ");
- env.TestWaitNotification(runtime, txId);
-
- testCreations();
- }
-
- Y_UNIT_TEST(Drop) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
-
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\"");
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\" "
- "ExternalSchemeShard: true "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "StoragePools { "
- " Name: \"pool-1\" "
- " Kind: \"hdd\" "
- "} ");
-
- env.TestWaitNotification(runtime, {txId, txId - 1});
+
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER+0\"",
+ {NKikimrScheme::StatusSchemeError});
+ env.TestWaitNotification(runtime, txId);
+
+ lowLimits.ExtraPathSymbolsAllowed = ".-+";
+ SetSchemeshardSchemaLimits(runtime, lowLimits);
+
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER+0\"");
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER+0\" "
+ "ExternalSchemeShard: true "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "StoragePools { "
+ " Name: \"pool-1\" "
+ " Kind: \"hdd\" "
+ "} ");
+
+ env.TestWaitNotification(runtime, {txId, txId - 1});
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER+0\" "
+ "ExternalSchemeShard: true "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "StoragePools { "
+ " Name: \"pool-1\" "
+ " Kind: \"hdd\" "
+ "} ");
+ env.TestWaitNotification(runtime, txId);
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER+0\" "
+ "ExternalSchemeShard: false "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "StoragePools { "
+ " Name: \"pool-1\" "
+ " Kind: \"hdd\" "
+ "} ",
+ {NKikimrScheme::StatusInvalidParameter});
+ env.TestWaitNotification(runtime, txId);
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER+0\" "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "StoragePools { "
+ " Name: \"pool-1\" "
+ " Kind: \"hdd\" "
+ "} ");
+ env.TestWaitNotification(runtime, txId);
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER+0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER+0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
+
+ TestMkDir(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER+0", "Dir__!", {NKikimrScheme::StatusSchemeError});
+ env.TestWaitNotification(runtime, txId, tenantSchemeShard);
+
+ lowLimits.ExtraPathSymbolsAllowed = ".-+!";
+ SetSchemeshardSchemaLimits(runtime, lowLimits, tenantSchemeShard);
+
+ TestMkDir(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER+0", "Dir__!");
+ env.TestWaitNotification(runtime, txId, tenantSchemeShard);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER+0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER+0")});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER+0"),
+ {NLs::PathExist,
+ NLs::ChildrenCount(1)});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER+0/Dir__!"),
+ {NLs::PathExist,
+ NLs::Finished});
+ }
+
+ Y_UNIT_TEST(AlterWithWrongParams) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, txId);
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "ExternalSchemeShard: true "
+ "PlanResolution: 0 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2",
+ {NKikimrScheme::StatusInvalidParameter});
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "ExternalSchemeShard: true "
+ "PlanResolution: 50 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2",
+ {NKikimrScheme::StatusInvalidParameter});
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "ExternalSchemeShard: true "
+ "PlanResolution: 50 "
+ "Coordinators: 0 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2",
+ {NKikimrScheme::StatusInvalidParameter});
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "ExternalSchemeShard: true "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 0 "
+ "TimeCastBucketsPerMediator: 2",
+ {NKikimrScheme::StatusInvalidParameter});
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "ExternalSchemeShard: true "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "TimeCastBucketsPerMediator: 2",
+ {NKikimrScheme::StatusInvalidParameter});
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "ExternalSchemeShard: false "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 ",
+ {NKikimrScheme::StatusInvalidParameter});
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 ",
+ {NKikimrScheme::StatusInvalidParameter});
+
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_1\" "
+ "ExternalSchemeShard: true "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 ",
+ {NKikimrScheme::StatusPathDoesNotExist});
+
+ TestMkDir(runtime, ++txId, "/MyRoot", "Dir");
+ env.TestWaitNotification(runtime, txId);
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"Dir\"",
+ {NKikimrScheme::StatusNameConflict});
+
+ TestCreateTable(runtime, ++txId, "/MyRoot",
+ "Name: \"table\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ );
+ env.TestWaitNotification(runtime, txId);
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"table\"",
+ {NKikimrScheme::StatusNameConflict});
+
+ TestCreateSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"subdomain\"");
+ env.TestWaitNotification(runtime, txId);
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"subdomain\"",
+ {NKikimrScheme::StatusNameConflict});
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"subdomain\" "
+ "ExternalSchemeShard: true "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2",
+ {NKikimrScheme::StatusNameConflict});
+
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"extSubdomain\"");
+ env.TestWaitNotification(runtime, txId);
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"extSubdomain\"",
+ {NKikimrScheme::StatusAlreadyExists});
+ }
+
+ Y_UNIT_TEST(NothingInsideGSS) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, txId);
+
+ auto testCreations = [&] () {
+ //dir
+ TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA", {NKikimrScheme::StatusRedirectDomain});
+
+ //table
+ TestCreateTable(runtime, ++txId, "/MyRoot/USER_0", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )", {NKikimrScheme::StatusRedirectDomain});
+
+ //bsv
+ TestCreateBlockStoreVolume(runtime, ++txId, "/MyRoot/USER_0", R"(
+ Name: "BSVolume"
+ VolumeConfig: {
+ NumChannels: 1
+ ChannelProfileId: 2
+ BlockSize: 4096
+ Partitions { BlockCount: 16 }
+ }
+ )", {NKikimrScheme::StatusRedirectDomain});
+
+ //extSub
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot/USER_0", R"(
+ Name: "ExtSubDomain"
+ )", {NKikimrScheme::StatusRedirectDomain});
+
+ //sub
+ TestCreateSubDomain(runtime, ++txId, "/MyRoot/USER_0", R"(
+ Name: "SubDomain"
+ )", {NKikimrScheme::StatusRedirectDomain});
+
+ //kesus
+ TestCreateKesus(runtime, ++txId, "/MyRoot/USER_0", R"(
+ Name: "Kesus"
+ )", {NKikimrScheme::StatusRedirectDomain});
+
+ //rtmr
+ TestCreateRtmrVolume(runtime, ++txId, "/MyRoot/USER_0", R"(
+ Name: "rtmr1"
+ PartitionsCount: 0
+ )", {NKikimrScheme::StatusRedirectDomain});
+
+ //solomon
+ TestCreateSolomon(runtime, ++txId, "/MyRoot/USER_0", R"(
+ Name: "Solomon"
+ PartitionCount: 40
+ )", {NKikimrScheme::StatusRedirectDomain});
+
+ //pq
+ TestCreatePQGroup(runtime, ++txId, "/MyRoot/USER_0", R"(
+ Name: "PQGroup"
+ TotalGroupCount: 2
+ PartitionPerTablet: 1
+ PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10 } }
+ )", {NKikimrScheme::StatusRedirectDomain});
+ };
+
+ testCreations();
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "ExternalSchemeShard: true "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "StoragePools { "
+ " Name: \"pool-1\" "
+ " Kind: \"hdd\" "
+ "} ");
+ env.TestWaitNotification(runtime, txId);
+
+ testCreations();
+ }
+
+ Y_UNIT_TEST(Drop) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\"");
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "ExternalSchemeShard: true "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "StoragePools { "
+ " Name: \"pool-1\" "
+ " Kind: \"hdd\" "
+ "} ");
+
+ env.TestWaitNotification(runtime, {txId, txId - 1});
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 2));
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 2));
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
-
- UNIT_ASSERT(tenantSchemeShard != 0
- && tenantSchemeShard != (ui64)-1
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
+
+ UNIT_ASSERT(tenantSchemeShard != 0
+ && tenantSchemeShard != (ui64)-1
&& tenantSchemeShard != TTestTxConfig::SchemeShard);
-
- TestMkDir(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0", "dir");
- TestCreateTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0/dir",
- "Name: \"table_1\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- "UniformPartitionsCount: 2");
-
- env.TestWaitNotification(runtime, {txId, txId -1}, tenantSchemeShard);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot" ),
- {NLs::PathExist,
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dir/table_1"),
- {NLs::PathRedirected,
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(3)});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/dir/table_1"),
- {NLs::PathExist,
- NLs::Finished,
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(5)});
-
- TestForceDropExtSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dir/table_1"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(0)});
-
+
+ TestMkDir(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0", "dir");
+ TestCreateTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0/dir",
+ "Name: \"table_1\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ "UniformPartitionsCount: 2");
+
+ env.TestWaitNotification(runtime, {txId, txId -1}, tenantSchemeShard);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot" ),
+ {NLs::PathExist,
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dir/table_1"),
+ {NLs::PathRedirected,
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(3)});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/dir/table_1"),
+ {NLs::PathExist,
+ NLs::Finished,
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(5)});
+
+ TestForceDropExtSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dir/table_1"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(0)});
+
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 5));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 2));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 2));
- }
+ }
Y_UNIT_TEST(SysViewProcessorSync) {
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
- NSchemeShard::TSchemeLimits lowLimits;
- lowLimits.MaxShardsInPath = 3;
- SetSchemeshardSchemaLimits(runtime, lowLimits);
-
+ NSchemeShard::TSchemeLimits lowLimits;
+ lowLimits.MaxShardsInPath = 3;
+ SetSchemeshardSchemaLimits(runtime, lowLimits);
+
TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
"Name: \"USER_0\"");
- // check that limits have a power, try create 4 shards
+ // check that limits have a power, try create 4 shards
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "PlanResolution: 50 "
+ "Coordinators: 2 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "ExternalSchemeShard: true "
+ , {NKikimrScheme::StatusResourceExhausted});
+
+ // create 3 shards
TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
"Name: \"USER_0\" "
"PlanResolution: 50 "
- "Coordinators: 2 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "ExternalSchemeShard: true "
- , {NKikimrScheme::StatusResourceExhausted});
-
- // create 3 shards
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\" "
- "PlanResolution: 50 "
"Coordinators: 1 "
"Mediators: 1 "
"TimeCastBucketsPerMediator: 2 "
- "ExternalSchemeShard: true "
- "StoragePools { "
- " Name: \"/dc-1/users/tenant-1:hdd\" "
- " Kind: \"hdd\" "
- "} ");
+ "ExternalSchemeShard: true "
+ "StoragePools { "
+ " Name: \"/dc-1/users/tenant-1:hdd\" "
+ " Kind: \"hdd\" "
+ "} ");
env.TestWaitNotification(runtime, {txId, txId - 1});
- lowLimits.MaxShardsInPath = 2;
- SetSchemeshardSchemaLimits(runtime, lowLimits);
-
- // one more, but for free
+ lowLimits.MaxShardsInPath = 2;
+ SetSchemeshardSchemaLimits(runtime, lowLimits);
+
+ // one more, but for free
TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
"Name: \"USER_0\" "
"ExternalSysViewProcessor: true ");
@@ -779,10 +779,10 @@ Y_UNIT_TEST_SUITE(TSchemeShardExtSubDomainTest) {
Coordinators: 1
Mediators: 1
TimeCastBucketsPerMediator: 2
- StoragePools {
- Name: "/dc-1/users/tenant-1:hdd"
- Kind: "hdd"
- }
+ StoragePools {
+ Name: "/dc-1/users/tenant-1:hdd"
+ Kind: "hdd"
+ }
DeclaredSchemeQuotas {
SchemeQuotas {
BucketSize: 1
@@ -808,7 +808,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardExtSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
// Second table should fail (out of per-minute quota)
TestCreateTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0", R"(
@@ -816,7 +816,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardExtSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusQuotaExceeded});
+ )", {NKikimrScheme::StatusQuotaExceeded});
// After a minute we should be able to create one more table
runtime.AdvanceCurrentTime(TDuration::Minutes(1));
@@ -825,13 +825,13 @@ Y_UNIT_TEST_SUITE(TSchemeShardExtSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
TestCreateTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0", R"(
Name: "Table4"
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusQuotaExceeded});
+ )", {NKikimrScheme::StatusQuotaExceeded});
// After 1 more minute we should still fail because of per 10 minute quota
runtime.AdvanceCurrentTime(TDuration::Minutes(1));
@@ -840,7 +840,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardExtSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusQuotaExceeded});
+ )", {NKikimrScheme::StatusQuotaExceeded});
// After 3 more minutes we should succeed, because enough per 10 minute quota regenerates
runtime.AdvanceCurrentTime(TDuration::Minutes(3));
@@ -849,7 +849,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardExtSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
// Quotas consuption is persistent, on reboot they should stay consumed
{
@@ -861,7 +861,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardExtSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusQuotaExceeded});
+ )", {NKikimrScheme::StatusQuotaExceeded});
// Need 5 more minutes to create a table
runtime.AdvanceCurrentTime(TDuration::Minutes(5));
@@ -870,7 +870,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardExtSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
// Change quotas to 2 per minute, use ext alter for that
TestAlterExtSubDomain(runtime, ++txId, "/MyRoot", R"(
@@ -889,19 +889,19 @@ Y_UNIT_TEST_SUITE(TSchemeShardExtSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
TestCreateTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0", R"(
Name: "Table9"
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
TestCreateTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0", R"(
Name: "Table10"
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusQuotaExceeded});
+ )", {NKikimrScheme::StatusQuotaExceeded});
// After 1 minute we should be able to create more tables
runtime.AdvanceCurrentTime(TDuration::Minutes(1));
@@ -910,18 +910,18 @@ Y_UNIT_TEST_SUITE(TSchemeShardExtSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
TestCreateTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0", R"(
Name: "Table11"
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
TestCreateTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0", R"(
Name: "Table12"
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusQuotaExceeded});
+ )", {NKikimrScheme::StatusQuotaExceeded});
}
-}
+}
diff --git a/ydb/core/tx/schemeshard/ut_extsubdomain/ya.make b/ydb/core/tx/schemeshard/ut_extsubdomain/ya.make
index bce23302d47..09a86b1e7ea 100644
--- a/ydb/core/tx/schemeshard/ut_extsubdomain/ya.make
+++ b/ydb/core/tx/schemeshard/ut_extsubdomain/ya.make
@@ -1,19 +1,19 @@
UNITTEST_FOR(ydb/core/tx/schemeshard)
-
-OWNER(g:kikimr)
-
-FORK_SUBTESTS()
-IF (SANITIZER_TYPE OR WITH_VALGRIND)
- TIMEOUT(3600)
- SIZE(LARGE)
- TAG(ya:fat)
-ELSE()
- TIMEOUT(600)
- SIZE(MEDIUM)
-ENDIF()
-
-PEERDIR(
+OWNER(g:kikimr)
+
+FORK_SUBTESTS()
+
+IF (SANITIZER_TYPE OR WITH_VALGRIND)
+ TIMEOUT(3600)
+ SIZE(LARGE)
+ TAG(ya:fat)
+ELSE()
+ TIMEOUT(600)
+ SIZE(MEDIUM)
+ENDIF()
+
+PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
library/cpp/svnversion
@@ -21,12 +21,12 @@ PEERDIR(
ydb/core/tx
ydb/core/tx/schemeshard/ut_helpers
ydb/library/yql/public/udf/service/exception_policy
-)
-
+)
+
YQL_LAST_ABI_VERSION()
-SRCS(
- ut_extsubdomain.cpp
-)
-
-END()
+SRCS(
+ ut_extsubdomain.cpp
+)
+
+END()
diff --git a/ydb/core/tx/schemeshard/ut_extsubdomain_reboots.cpp b/ydb/core/tx/schemeshard/ut_extsubdomain_reboots.cpp
index 309fd9fff06..cf819403e8f 100644
--- a/ydb/core/tx/schemeshard/ut_extsubdomain_reboots.cpp
+++ b/ydb/core/tx/schemeshard/ut_extsubdomain_reboots.cpp
@@ -1,210 +1,210 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
-
+
#include <ydb/core/tx/datashard/datashard.h>
#include <ydb/core/protos/flat_scheme_op.pb.h>
-
+
#include <google/protobuf/text_format.h>
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-using namespace NSchemeShardUT_Private;
-
-Y_UNIT_TEST_SUITE(TSchemeShardTestExtSubdomainReboots) {
- Y_UNIT_TEST(Fake) {
- }
-
- Y_UNIT_TEST(CreateExternalSubdomain) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
-
- TestCreateExtSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+using namespace NSchemeShardUT_Private;
+
+Y_UNIT_TEST_SUITE(TSchemeShardTestExtSubdomainReboots) {
+ Y_UNIT_TEST(Fake) {
+ }
+
+ Y_UNIT_TEST(CreateExternalSubdomain) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+
+ TestCreateExtSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
NLs::DomainKey(3, TTestTxConfig::SchemeShard),
- NLs::DomainCoordinators({}),
- NLs::DomainMediators({}),
- NLs::DomainSchemeshard(0)
- });
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(2)});
+ NLs::DomainCoordinators({}),
+ NLs::DomainMediators({}),
+ NLs::DomainSchemeshard(0)
+ });
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(2)});
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 3));
- }
-
- TestAlterExtSubDomain(runtime, ++t.TxId, "/MyRoot",
- "StoragePools { "
- " Name: \"tenant-1:hdd\" "
- " Kind: \"hdd\" "
- "} "
- "PlanResolution: 50 "
- "Coordinators: 3 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "ExternalSchemeShard: true "
- "Name: \"USER_0\"");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
+ }
+
+ TestAlterExtSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "StoragePools { "
+ " Name: \"tenant-1:hdd\" "
+ " Kind: \"hdd\" "
+ "} "
+ "PlanResolution: 50 "
+ "Coordinators: 3 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "ExternalSchemeShard: true "
+ "Name: \"USER_0\"");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
NLs::DomainKey(3, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+1, TTestTxConfig::FakeHiveTablets+2}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets+3, TTestTxConfig::FakeHiveTablets+4}),
NLs::DomainSchemeshard(TTestTxConfig::FakeHiveTablets+5)
- });
-
+ });
+
TestDescribeResult(DescribePath(runtime, TTestTxConfig::FakeHiveTablets+5, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsSubDomain("MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsSubDomain("MyRoot/USER_0"),
NLs::DomainKey(3, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+1, TTestTxConfig::FakeHiveTablets+2}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets+3, TTestTxConfig::FakeHiveTablets+4}),
NLs::DomainSchemeshard(TTestTxConfig::FakeHiveTablets+5)
- });
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(2)});
- }
-
- });
- }
-
- Y_UNIT_TEST(CreateForceDrop) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
-
- AsyncCreateExtSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- t.TestEnv->ReliablePropose(runtime, ForceDropExtSubDomainRequest(++t.TxId, "/MyRoot", "USER_0"),
- {NKikimrScheme::StatusAccepted});
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId-1});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(1)});
+ });
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(2)});
+ }
+
+ });
+ }
+
+ Y_UNIT_TEST(CreateForceDrop) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+
+ AsyncCreateExtSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ t.TestEnv->ReliablePropose(runtime, ForceDropExtSubDomainRequest(++t.TxId, "/MyRoot", "USER_0"),
+ {NKikimrScheme::StatusAccepted});
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId-1});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(1)});
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 3));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
- }
- });
- }
-
- Y_UNIT_TEST(AlterForceDrop) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateExtSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId-1});
- }
-
- AsyncAlterExtSubDomain(runtime, ++t.TxId, "/MyRoot",
- "StoragePools { "
- " Name: \"tenant-1:hdd\" "
- " Kind: \"hdd\" "
- "} "
- "PlanResolution: 50 "
- "Coordinators: 3 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "ExternalSchemeShard: true "
- "Name: \"USER_0\"");
- t.TestEnv->ReliablePropose(runtime, ForceDropExtSubDomainRequest(++t.TxId, "/MyRoot", "USER_0"),
- {NKikimrScheme::StatusAccepted});
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId-1});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(AlterForceDrop) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateExtSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId-1});
+ }
+
+ AsyncAlterExtSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "StoragePools { "
+ " Name: \"tenant-1:hdd\" "
+ " Kind: \"hdd\" "
+ "} "
+ "PlanResolution: 50 "
+ "Coordinators: 3 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "ExternalSchemeShard: true "
+ "Name: \"USER_0\"");
+ t.TestEnv->ReliablePropose(runtime, ForceDropExtSubDomainRequest(++t.TxId, "/MyRoot", "USER_0"),
+ {NKikimrScheme::StatusAccepted});
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId-1});
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+6));
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(1)});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(1)});
t.TestEnv->TestWaitShardDeletion(runtime, {1, 2, 3, 4, 5, 6});
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 3));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
- }
- });
- }
-
-
- Y_UNIT_TEST(SchemeLimits) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TSchemeLimits limits;
- limits.MaxDepth = 2;
- limits.MaxShards = 3;
- limits.MaxPaths = 2;
-
- {
- TInactiveZone inactive(activeZone);
-
- SetSchemeshardSchemaLimits(runtime, limits);
-
- TestCreateExtSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- TestAlterExtSubDomain(runtime, ++t.TxId, "/MyRoot",
- "StoragePools { "
- " Name: \"tenant-1:hdd\" "
- " Kind: \"hdd\" "
- "} "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "ExternalSchemeShard: true "
- "Name: \"USER_0\"");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::DomainLimitsIs(limits.MaxPaths, limits.MaxShards)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(2),
- NLs::DomainLimitsIs(limits.MaxPaths, limits.MaxShards)});
-
+ }
+ });
+ }
+
+
+ Y_UNIT_TEST(SchemeLimits) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TSchemeLimits limits;
+ limits.MaxDepth = 2;
+ limits.MaxShards = 3;
+ limits.MaxPaths = 2;
+
+ {
+ TInactiveZone inactive(activeZone);
+
+ SetSchemeshardSchemaLimits(runtime, limits);
+
+ TestCreateExtSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ TestAlterExtSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "StoragePools { "
+ " Name: \"tenant-1:hdd\" "
+ " Kind: \"hdd\" "
+ "} "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "ExternalSchemeShard: true "
+ "Name: \"USER_0\"");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::DomainLimitsIs(limits.MaxPaths, limits.MaxShards)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(2),
+ NLs::DomainLimitsIs(limits.MaxPaths, limits.MaxShards)});
+
ui64 extSchemeSahrd = TTestTxConfig::FakeHiveTablets+2;
-
+
TestDescribeResult(DescribePath(runtime, TTestTxConfig::FakeHiveTablets+2, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsSubDomain("MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsSubDomain("MyRoot/USER_0"),
NLs::DomainKey(3, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets+1}),
- NLs::DomainSchemeshard(extSchemeSahrd),
- NLs::DomainLimitsIs(limits.MaxPaths, limits.MaxShards),
- NLs::ShardsInsideDomain(3),
- NLs::PathsInsideDomain(0)
- });
-
- TestCreateTable(runtime, extSchemeSahrd, ++t.TxId, "/MyRoot/USER_0", R"(
- Name: "Table"
- Columns { Name: "Id" Type: "Uint32" }
- KeyColumnNames: ["Id"]
- )", {NKikimrScheme::StatusResourceExhausted});
-
- TestMkDir(runtime, extSchemeSahrd, ++t.TxId, "/MyRoot/USER_0", "A");
- TestMkDir(runtime, extSchemeSahrd, ++t.TxId, "/MyRoot/USER_0", "B");
- TestMkDir(runtime, extSchemeSahrd, ++t.TxId, "/MyRoot/USER_0", "C", {NKikimrScheme::StatusResourceExhausted});
- }
- });
- }
-}
+ NLs::DomainSchemeshard(extSchemeSahrd),
+ NLs::DomainLimitsIs(limits.MaxPaths, limits.MaxShards),
+ NLs::ShardsInsideDomain(3),
+ NLs::PathsInsideDomain(0)
+ });
+
+ TestCreateTable(runtime, extSchemeSahrd, ++t.TxId, "/MyRoot/USER_0", R"(
+ Name: "Table"
+ Columns { Name: "Id" Type: "Uint32" }
+ KeyColumnNames: ["Id"]
+ )", {NKikimrScheme::StatusResourceExhausted});
+
+ TestMkDir(runtime, extSchemeSahrd, ++t.TxId, "/MyRoot/USER_0", "A");
+ TestMkDir(runtime, extSchemeSahrd, ++t.TxId, "/MyRoot/USER_0", "B");
+ TestMkDir(runtime, extSchemeSahrd, ++t.TxId, "/MyRoot/USER_0", "C", {NKikimrScheme::StatusResourceExhausted});
+ }
+ });
+ }
+}
diff --git a/ydb/core/tx/schemeshard/ut_extsubdomain_reboots/ya.make b/ydb/core/tx/schemeshard/ut_extsubdomain_reboots/ya.make
index 71db0961160..9f21c87c92c 100644
--- a/ydb/core/tx/schemeshard/ut_extsubdomain_reboots/ya.make
+++ b/ydb/core/tx/schemeshard/ut_extsubdomain_reboots/ya.make
@@ -1,13 +1,13 @@
IF (NOT WITH_VALGRIND)
UNITTEST_FOR(ydb/core/tx/schemeshard)
-
+
OWNER(
vvvv
g:kikimr
)
-
+
FORK_SUBTESTS()
-
+
IF (SANITIZER_TYPE OR WITH_VALGRIND)
TIMEOUT(3600)
SIZE(LARGE)
@@ -16,7 +16,7 @@ IF (NOT WITH_VALGRIND)
TIMEOUT(600)
SIZE(MEDIUM)
ENDIF()
-
+
PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
diff --git a/ydb/core/tx/schemeshard/ut_filestore_reboots.cpp b/ydb/core/tx/schemeshard/ut_filestore_reboots.cpp
index 8314e8102e8..0fdfd871de2 100644
--- a/ydb/core/tx/schemeshard/ut_filestore_reboots.cpp
+++ b/ydb/core/tx/schemeshard/ut_filestore_reboots.cpp
@@ -5,14 +5,14 @@
#include <google/protobuf/text_format.h>
using namespace NKikimr;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NSchemeShardUT_Private;
namespace {
auto& InitCreateFileStoreConfig(
const TString& name,
- NKikimrSchemeOp::TFileStoreDescription& vdescr)
+ NKikimrSchemeOp::TFileStoreDescription& vdescr)
{
vdescr.SetName(name);
auto& vc = *vdescr.MutableConfig();
@@ -54,7 +54,7 @@ Y_UNIT_TEST_SUITE(TFileStoreWithReboots) {
t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
t.RestoreLogging();
- NKikimrSchemeOp::TFileStoreDescription vdescr;
+ NKikimrSchemeOp::TFileStoreDescription vdescr;
InitCreateFileStoreConfig("FS_1", vdescr);
TestCreateFileStore(runtime, t.TxId++, "/MyRoot/DirA", vdescr.DebugString());
t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
@@ -69,7 +69,7 @@ Y_UNIT_TEST_SUITE(TFileStoreWithReboots) {
t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
t.RestoreLogging();
- NKikimrSchemeOp::TFileStoreDescription vdescr;
+ NKikimrSchemeOp::TFileStoreDescription vdescr;
auto& vc = InitCreateFileStoreConfig("FS_2", vdescr);
TestCreateFileStore(runtime, t.TxId++, "/MyRoot/DirA", vdescr.DebugString());
t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
@@ -93,7 +93,7 @@ Y_UNIT_TEST_SUITE(TFileStoreWithReboots) {
t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
t.RestoreLogging();
- NKikimrSchemeOp::TFileStoreDescription vdescr;
+ NKikimrSchemeOp::TFileStoreDescription vdescr;
auto& vc = InitCreateFileStoreConfig("FS_2", vdescr);
TestCreateFileStore(runtime, t.TxId++, "/MyRoot/DirA", vdescr.DebugString());
t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
@@ -113,7 +113,7 @@ Y_UNIT_TEST_SUITE(TFileStoreWithReboots) {
t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
t.RestoreLogging();
- NKikimrSchemeOp::TFileStoreDescription vdescr;
+ NKikimrSchemeOp::TFileStoreDescription vdescr;
InitCreateFileStoreConfig("FS_3", vdescr);
TestCreateFileStore(runtime, t.TxId++, "/MyRoot/DirA", vdescr.DebugString());
@@ -130,14 +130,14 @@ Y_UNIT_TEST_SUITE(TFileStoreWithReboots) {
Y_UNIT_TEST(CreateWithIntermediateDirs) {
- NKikimrSchemeOp::TFileStoreDescription vdescr;
+ NKikimrSchemeOp::TFileStoreDescription vdescr;
InitCreateFileStoreConfig("Valid/x/y/z", vdescr);
const auto validScheme = vdescr.DebugString();
vdescr.Clear();
InitCreateFileStoreConfig("Invalid/wr0ng n@me", vdescr);
const auto invalidScheme = vdescr.DebugString();
- const auto validStatus = NKikimrScheme::StatusAccepted;
- const auto invalidStatus = NKikimrScheme::StatusSchemeError;
+ const auto validStatus = NKikimrScheme::StatusAccepted;
+ const auto invalidStatus = NKikimrScheme::StatusSchemeError;
CreateWithIntermediateDirs([&](TTestActorRuntime& runtime, ui64 txId, const TString& root, bool valid) {
TestCreateFileStore(runtime, txId, root, valid ? validScheme : invalidScheme, {valid ? validStatus : invalidStatus});
@@ -147,7 +147,7 @@ Y_UNIT_TEST_SUITE(TFileStoreWithReboots) {
Y_UNIT_TEST(CreateWithIntermediateDirsForceDrop) {
CreateWithIntermediateDirsForceDrop(
[](TTestActorRuntime& runtime, ui64 txId, const TString& root) {
- NKikimrSchemeOp::TFileStoreDescription vdescr;
+ NKikimrSchemeOp::TFileStoreDescription vdescr;
InitCreateFileStoreConfig("x/y/z", vdescr);
AsyncCreateFileStore(runtime, txId, root, vdescr.DebugString());
});
@@ -175,7 +175,7 @@ Y_UNIT_TEST_SUITE(TFileStoreWithReboots) {
t.TestEnv->TestWaitNotification(runtime, t.TxId);
}
- NKikimrSchemeOp::TFileStoreDescription vdescr;
+ NKikimrSchemeOp::TFileStoreDescription vdescr;
InitCreateFileStoreConfig("FS_1", vdescr);
TestCreateFileStore(runtime, ++t.TxId, "/MyRoot/DirA/USER_0", vdescr.DebugString());
@@ -200,7 +200,7 @@ Y_UNIT_TEST_SUITE(TFileStoreWithReboots) {
Y_UNIT_TEST(AlterAssignDrop) {
TTestWithReboots t;
t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- NKikimrSchemeOp::TFileStoreDescription vdescr;
+ NKikimrSchemeOp::TFileStoreDescription vdescr;
auto& vc = InitCreateFileStoreConfig("FS", vdescr);
{
@@ -213,14 +213,14 @@ Y_UNIT_TEST_SUITE(TFileStoreWithReboots) {
InitAlterFileStoreConfig(vc);
AsyncAlterFileStore(runtime, ++t.TxId, "/MyRoot", vdescr.DebugString());
- TestDropFileStore(runtime, ++t.TxId, "/MyRoot", "FS", {NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusAccepted});
+ TestDropFileStore(runtime, ++t.TxId, "/MyRoot", "FS", {NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusAccepted});
t.TestEnv->TestWaitNotification(runtime, t.TxId);
t.TestEnv->TestWaitNotification(runtime, t.TxId - 1); // wait Alter
{
TInactiveZone inactive(activeZone);
- TestDropFileStore(runtime, ++t.TxId, "/MyRoot", "FS", {NKikimrScheme::StatusPathDoesNotExist, NKikimrScheme::StatusAccepted});
+ TestDropFileStore(runtime, ++t.TxId, "/MyRoot", "FS", {NKikimrScheme::StatusPathDoesNotExist, NKikimrScheme::StatusAccepted});
t.TestEnv->TestWaitNotification(runtime, t.TxId);
TestDescribeResult(DescribePath(runtime, "/MyRoot/FS"),
{NLs::PathNotExist});
@@ -234,7 +234,7 @@ Y_UNIT_TEST_SUITE(TFileStoreWithReboots) {
t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
t.RestoreLogging();
- NKikimrSchemeOp::TFileStoreDescription vdescr;
+ NKikimrSchemeOp::TFileStoreDescription vdescr;
auto& vc = InitCreateFileStoreConfig("FS_2", vdescr);
TestCreateFileStore(runtime, t.TxId++, "/MyRoot/DirA", vdescr.DebugString());
t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
diff --git a/ydb/core/tx/schemeshard/ut_helpers/failing_mtpq.cpp b/ydb/core/tx/schemeshard/ut_helpers/failing_mtpq.cpp
index 1b54a5eded5..d4ccfa4aa73 100644
--- a/ydb/core/tx/schemeshard/ut_helpers/failing_mtpq.cpp
+++ b/ydb/core/tx/schemeshard/ut_helpers/failing_mtpq.cpp
@@ -1,33 +1,33 @@
-#include "helpers.h"
-
-class TFailingMtpQueue: public TSimpleThreadPool {
-private:
- bool FailOnAdd_ = false;
-public:
- void SetFailOnAdd(bool fail = true) {
- FailOnAdd_ = fail;
- }
- bool Add(IObjectInQueue* pObj) override Y_WARN_UNUSED_RESULT {
- if (FailOnAdd_) {
- return false;
- }
-
- return TSimpleThreadPool::Add(pObj);
- }
- TFailingMtpQueue() = default;
- TFailingMtpQueue(IThreadFactory* pool)
- : TSimpleThreadPool(pool)
- {
- }
-};
-
-using TFailingServerMtpQueue =
- TThreadPoolBinder<TFailingMtpQueue, THttpServer::ICallBack>;
-
-namespace NSchemeShardUT_Private {
-
-TSimpleSharedPtr<IThreadPool> CreateFailingServerMtpQueue(THttpServer::ICallBack* serverCB) {
- return new TFailingServerMtpQueue(serverCB, SystemThreadFactory());
-}
-
-}
+#include "helpers.h"
+
+class TFailingMtpQueue: public TSimpleThreadPool {
+private:
+ bool FailOnAdd_ = false;
+public:
+ void SetFailOnAdd(bool fail = true) {
+ FailOnAdd_ = fail;
+ }
+ bool Add(IObjectInQueue* pObj) override Y_WARN_UNUSED_RESULT {
+ if (FailOnAdd_) {
+ return false;
+ }
+
+ return TSimpleThreadPool::Add(pObj);
+ }
+ TFailingMtpQueue() = default;
+ TFailingMtpQueue(IThreadFactory* pool)
+ : TSimpleThreadPool(pool)
+ {
+ }
+};
+
+using TFailingServerMtpQueue =
+ TThreadPoolBinder<TFailingMtpQueue, THttpServer::ICallBack>;
+
+namespace NSchemeShardUT_Private {
+
+TSimpleSharedPtr<IThreadPool> CreateFailingServerMtpQueue(THttpServer::ICallBack* serverCB) {
+ return new TFailingServerMtpQueue(serverCB, SystemThreadFactory());
+}
+
+}
diff --git a/ydb/core/tx/schemeshard/ut_helpers/helpers.cpp b/ydb/core/tx/schemeshard/ut_helpers/helpers.cpp
index 13d4a33de9f..6f999b268bb 100644
--- a/ydb/core/tx/schemeshard/ut_helpers/helpers.cpp
+++ b/ydb/core/tx/schemeshard/ut_helpers/helpers.cpp
@@ -1,70 +1,70 @@
-#include "helpers.h"
+#include "helpers.h"
#include <ydb/core/engine/mkql_proto.h>
#include <ydb/core/engine/minikql/flat_local_tx_factory.h>
#include <ydb/core/tx/schemeshard/schemeshard.h>
#include <ydb/core/tx/tx_proxy/proxy.h>
-
+
#include <ydb/core/blockstore/core/blockstore.h>
-
+
#include <ydb/library/yql/public/issue/yql_issue_message.h>
-
+
#include <ydb/core/util/pb.h>
#include <library/cpp/testing/unittest/registar.h>
#include <util/generic/maybe.h>
-#include <util/generic/ptr.h>
+#include <util/generic/ptr.h>
#include <util/string/split.h>
#include <util/system/env.h>
-namespace NSchemeShardUT_Private {
- using namespace NKikimr;
+namespace NSchemeShardUT_Private {
+ using namespace NKikimr;
template <typename TEvResponse, typename TEvRequest, typename TStatus>
static ui32 ReliableProposeImpl(
NActors::TTestActorRuntime& runtime, const TActorId& proposer,
TEvRequest* evRequest, const TVector<TStatus>& expectedStatuses)
- {
+ {
TActorId sender = runtime.AllocateEdgeActor();
ui64 txId = evRequest->Record.GetTxId();
runtime.Send(new IEventHandle(proposer, sender, evRequest));
-
+
auto evResponse = runtime.GrabEdgeEvent<TEvResponse>(sender);
UNIT_ASSERT(evResponse);
-
+
const auto& record = evResponse->Get()->Record;
UNIT_ASSERT(record.GetTxId() == txId);
-
+
ui32 result = 0;
-
- if constexpr (std::is_same_v<TEvSchemeShard::TEvModifySchemeTransactionResult, TEvResponse>) {
+
+ if constexpr (std::is_same_v<TEvSchemeShard::TEvModifySchemeTransactionResult, TEvResponse>) {
result = record.GetStatus();
CheckExpected(expectedStatuses, record.GetStatus(), record.GetReason());
- } else if constexpr (std::is_same_v<TEvSchemeShard::TEvCancelTxResult, TEvResponse>) {
+ } else if constexpr (std::is_same_v<TEvSchemeShard::TEvCancelTxResult, TEvResponse>) {
result = record.GetStatus();
CheckExpected(expectedStatuses, record.GetStatus(), record.GetResult());
} else {
result = record.GetResponse().GetStatus();
CheckExpected(expectedStatuses, record.GetResponse().GetStatus(), "unexpected");
}
-
+
return result;
- }
-
+ }
+
ui32 NSchemeShardUT_Private::TTestEnv::ReliablePropose(
- NActors::TTestActorRuntime& runtime, TEvSchemeShard::TEvModifySchemeTransaction* evTx,
- const TVector<TEvSchemeShard::EStatus>& expectedResults)
+ NActors::TTestActorRuntime& runtime, TEvSchemeShard::TEvModifySchemeTransaction* evTx,
+ const TVector<TEvSchemeShard::EStatus>& expectedResults)
{
- return ReliableProposeImpl<TEvSchemeShard::TEvModifySchemeTransactionResult>(
+ return ReliableProposeImpl<TEvSchemeShard::TEvModifySchemeTransactionResult>(
runtime, TxReliablePropose, evTx, expectedResults);
}
ui32 NSchemeShardUT_Private::TTestEnv::ReliablePropose(
- NActors::TTestActorRuntime& runtime, TEvSchemeShard::TEvCancelTx* evTx,
- const TVector<TEvSchemeShard::EStatus>& expectedResults)
+ NActors::TTestActorRuntime& runtime, TEvSchemeShard::TEvCancelTx* evTx,
+ const TVector<TEvSchemeShard::EStatus>& expectedResults)
{
- return ReliableProposeImpl<TEvSchemeShard::TEvCancelTxResult>(
+ return ReliableProposeImpl<TEvSchemeShard::TEvCancelTxResult>(
runtime, TxReliablePropose, evTx, expectedResults);
}
@@ -92,51 +92,51 @@ namespace NSchemeShardUT_Private {
runtime, TxReliablePropose, ev, expectedStatuses);
}
- NKikimrSchemeOp::TAlterUserAttributes AlterUserAttrs(const TVector<std::pair<TString, TString>>& add, const TVector<TString>& drop) {
- NKikimrSchemeOp::TAlterUserAttributes result;
- for (const auto& item: add) {
- auto attr = result.AddUserAttributes();
- attr->SetKey(item.first);
- attr->SetValue(item.second);
- }
- for (const auto& item: drop) {
- auto attr = result.AddUserAttributes();
- attr->SetKey(item);
- }
- return result;
- }
-
- void CheckExpected(const TVector<TEvSchemeShard::EStatus>& expected, TEvSchemeShard::EStatus result, const TString& reason)
+ NKikimrSchemeOp::TAlterUserAttributes AlterUserAttrs(const TVector<std::pair<TString, TString>>& add, const TVector<TString>& drop) {
+ NKikimrSchemeOp::TAlterUserAttributes result;
+ for (const auto& item: add) {
+ auto attr = result.AddUserAttributes();
+ attr->SetKey(item.first);
+ attr->SetValue(item.second);
+ }
+ for (const auto& item: drop) {
+ auto attr = result.AddUserAttributes();
+ attr->SetKey(item);
+ }
+ return result;
+ }
+
+ void CheckExpected(const TVector<TEvSchemeShard::EStatus>& expected, TEvSchemeShard::EStatus result, const TString& reason)
{
- for (TEvSchemeShard::EStatus exp : expected) {
+ for (TEvSchemeShard::EStatus exp : expected) {
if (result == exp) {
return;
}
}
- Cdbg << "Unexpected status: " << NKikimrScheme::EStatus_Name(result) << ": " << reason << Endl;
- UNIT_FAIL("Unexpected status: " << NKikimrScheme::EStatus_Name(result) << ": " << reason);
+ Cdbg << "Unexpected status: " << NKikimrScheme::EStatus_Name(result) << ": " << reason << Endl;
+ UNIT_FAIL("Unexpected status: " << NKikimrScheme::EStatus_Name(result) << ": " << reason);
}
void SkipModificationReply(TTestActorRuntime& runtime, ui32 num) {
TAutoPtr<IEventHandle> handle;
for (ui32 i = 0; i < num; ++i)
- runtime.GrabEdgeEvent<TEvSchemeShard::TEvModifySchemeTransactionResult>(handle);
+ runtime.GrabEdgeEvent<TEvSchemeShard::TEvModifySchemeTransactionResult>(handle);
}
void TestModificationResult(TTestActorRuntime& runtime, ui64 txId,
- TEvSchemeShard::EStatus expectedResult) {
+ TEvSchemeShard::EStatus expectedResult) {
TestModificationResults(runtime, txId, {expectedResult});
}
ui64 TestModificationResults(TTestActorRuntime& runtime, ui64 txId,
- const TVector<TEvSchemeShard::EStatus>& expectedResults) {
+ const TVector<TEvSchemeShard::EStatus>& expectedResults) {
TAutoPtr<IEventHandle> handle;
- TEvSchemeShard::TEvModifySchemeTransactionResult* event;
+ TEvSchemeShard::TEvModifySchemeTransactionResult* event;
do {
- Cerr << "TestModificationResults wait txId: " << txId << "\n";
- event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvModifySchemeTransactionResult>(handle);
+ Cerr << "TestModificationResults wait txId: " << txId << "\n";
+ event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvModifySchemeTransactionResult>(handle);
UNIT_ASSERT(event);
- Cerr << "TestModificationResult got TxId: " << event->Record.GetTxId() << ", wait until txId: " << txId << "\n";
+ Cerr << "TestModificationResult got TxId: " << event->Record.GetTxId() << ", wait until txId: " << txId << "\n";
} while(event->Record.GetTxId() < txId);
UNIT_ASSERT_VALUES_EQUAL(event->Record.GetTxId(), txId);
@@ -144,85 +144,85 @@ namespace NSchemeShardUT_Private {
return event->Record.GetStatus();
}
- void SetApplyIf(NKikimrSchemeOp::TModifyScheme& transaction, const TApplyIf& applyIf) {
- for (auto& pathVersion: applyIf) {
- auto condition = transaction.AddApplyIf();
- condition->SetPathId(pathVersion.PathId.LocalPathId);
- condition->SetPathVersion(pathVersion.Version);
- }
- }
-
- TEvSchemeShard::TEvModifySchemeTransaction* CreateModifyACLRequest(ui64 txId, ui64 schemeshard, TString parentPath, TString name, const TString& diffAcl, const TString& newOwner) {
- auto evTx = new TEvSchemeShard::TEvModifySchemeTransaction(txId, schemeshard);
- auto transaction = evTx->Record.AddTransaction();
- transaction->SetWorkingDir(parentPath);
- transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL);
-
- auto op = transaction->MutableModifyACL();
- op->SetName(name);
+ void SetApplyIf(NKikimrSchemeOp::TModifyScheme& transaction, const TApplyIf& applyIf) {
+ for (auto& pathVersion: applyIf) {
+ auto condition = transaction.AddApplyIf();
+ condition->SetPathId(pathVersion.PathId.LocalPathId);
+ condition->SetPathVersion(pathVersion.Version);
+ }
+ }
+
+ TEvSchemeShard::TEvModifySchemeTransaction* CreateModifyACLRequest(ui64 txId, ui64 schemeshard, TString parentPath, TString name, const TString& diffAcl, const TString& newOwner) {
+ auto evTx = new TEvSchemeShard::TEvModifySchemeTransaction(txId, schemeshard);
+ auto transaction = evTx->Record.AddTransaction();
+ transaction->SetWorkingDir(parentPath);
+ transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL);
+
+ auto op = transaction->MutableModifyACL();
+ op->SetName(name);
if (diffAcl) {
op->SetDiffACL(diffAcl);
}
- if (newOwner) {
- op->SetNewOwner(newOwner);
- }
-
- return evTx;
- }
-
- void AsyncModifyACL(TTestActorRuntime& runtime, ui64 schemeShardId, ui64 txId, TString parentPath, TString name, const TString& diffAcl, const TString& newOwner) {
- AsyncSendTransaction(runtime, schemeShardId, CreateModifyACLRequest(txId, schemeShardId, parentPath, name, diffAcl, newOwner));
- }
-
- void AsyncModifyACL(TTestActorRuntime& runtime, ui64 txId, TString parentPath, TString name, const TString& diffAcl, const TString& newOwner) {
+ if (newOwner) {
+ op->SetNewOwner(newOwner);
+ }
+
+ return evTx;
+ }
+
+ void AsyncModifyACL(TTestActorRuntime& runtime, ui64 schemeShardId, ui64 txId, TString parentPath, TString name, const TString& diffAcl, const TString& newOwner) {
+ AsyncSendTransaction(runtime, schemeShardId, CreateModifyACLRequest(txId, schemeShardId, parentPath, name, diffAcl, newOwner));
+ }
+
+ void AsyncModifyACL(TTestActorRuntime& runtime, ui64 txId, TString parentPath, TString name, const TString& diffAcl, const TString& newOwner) {
return AsyncModifyACL(runtime, TTestTxConfig::SchemeShard, txId, parentPath, name, diffAcl, newOwner);
- }
-
- void TestModifyACL(TTestActorRuntime& runtime, ui64 schemeShardId, ui64 txId, TString parentPath, TString name,
- const TString& diffAcl, const TString& newOwner,
- TEvSchemeShard::EStatus expectedResult) {
- AsyncModifyACL(runtime, schemeShardId, txId, parentPath, name, diffAcl, newOwner);
- TestModificationResult(runtime, txId, expectedResult);
- }
-
- void TestModifyACL(TTestActorRuntime& runtime, ui64 txId, TString parentPath, TString name,
- const TString& diffAcl, const TString& newOwner,
- TEvSchemeShard::EStatus expectedResult) {
+ }
+
+ void TestModifyACL(TTestActorRuntime& runtime, ui64 schemeShardId, ui64 txId, TString parentPath, TString name,
+ const TString& diffAcl, const TString& newOwner,
+ TEvSchemeShard::EStatus expectedResult) {
+ AsyncModifyACL(runtime, schemeShardId, txId, parentPath, name, diffAcl, newOwner);
+ TestModificationResult(runtime, txId, expectedResult);
+ }
+
+ void TestModifyACL(TTestActorRuntime& runtime, ui64 txId, TString parentPath, TString name,
+ const TString& diffAcl, const TString& newOwner,
+ TEvSchemeShard::EStatus expectedResult) {
TestModifyACL(runtime, TTestTxConfig::SchemeShard, txId, parentPath, name, diffAcl, newOwner, expectedResult);
- }
-
-
+ }
+
+
//
- NKikimrScheme::TEvDescribeSchemeResult DescribePath(TTestActorRuntime& runtime, ui64 schemeShard, const TString& path, const NKikimrSchemeOp::TDescribeOptions& opts) {
+ NKikimrScheme::TEvDescribeSchemeResult DescribePath(TTestActorRuntime& runtime, ui64 schemeShard, const TString& path, const NKikimrSchemeOp::TDescribeOptions& opts) {
TActorId sender = runtime.AllocateEdgeActor();
- auto evLs = new TEvSchemeShard::TEvDescribeScheme(path);
+ auto evLs = new TEvSchemeShard::TEvDescribeScheme(path);
evLs->Record.MutableOptions()->CopyFrom(opts);
ForwardToTablet(runtime, schemeShard, sender, evLs);
TAutoPtr<IEventHandle> handle;
- auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvDescribeSchemeResult>(handle);
+ auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvDescribeSchemeResult>(handle);
UNIT_ASSERT(event);
- return event->GetRecord();
+ return event->GetRecord();
}
- NKikimrScheme::TEvDescribeSchemeResult DescribePathId(TTestActorRuntime& runtime, ui64 schemeShard, ui64 pathId, const NKikimrSchemeOp::TDescribeOptions& opts = { }) {
+ NKikimrScheme::TEvDescribeSchemeResult DescribePathId(TTestActorRuntime& runtime, ui64 schemeShard, ui64 pathId, const NKikimrSchemeOp::TDescribeOptions& opts = { }) {
TActorId sender = runtime.AllocateEdgeActor();
- auto evLs = new TEvSchemeShard::TEvDescribeScheme(schemeShard, pathId);
+ auto evLs = new TEvSchemeShard::TEvDescribeScheme(schemeShard, pathId);
evLs->Record.MutableOptions()->CopyFrom(opts);
ForwardToTablet(runtime, schemeShard, sender, evLs);
TAutoPtr<IEventHandle> handle;
- auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvDescribeSchemeResult>(handle);
+ auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvDescribeSchemeResult>(handle);
UNIT_ASSERT(event);
return event->GetRecord();
}
- NKikimrScheme::TEvDescribeSchemeResult DescribePath(TTestActorRuntime& runtime, const TString& path, const NKikimrSchemeOp::TDescribeOptions& opts) {
+ NKikimrScheme::TEvDescribeSchemeResult DescribePath(TTestActorRuntime& runtime, const TString& path, const NKikimrSchemeOp::TDescribeOptions& opts) {
return DescribePath(runtime, TTestTxConfig::SchemeShard, path, opts);
}
- NKikimrScheme::TEvDescribeSchemeResult DescribePathId(TTestActorRuntime& runtime, ui64 pathId, const NKikimrSchemeOp::TDescribeOptions& opts = { }) {
+ NKikimrScheme::TEvDescribeSchemeResult DescribePathId(TTestActorRuntime& runtime, ui64 pathId, const NKikimrSchemeOp::TDescribeOptions& opts = { }) {
return DescribePathId(runtime, TTestTxConfig::SchemeShard, pathId, opts);
}
@@ -231,7 +231,7 @@ namespace NSchemeShardUT_Private {
}
NKikimrScheme::TEvDescribeSchemeResult DescribePath(TTestActorRuntime& runtime, ui64 schemeShard, const TString& path, bool returnPartitioning, bool returnBoundaries, bool showPrivate, bool returnBackups) {
- NKikimrSchemeOp::TDescribeOptions opts;
+ NKikimrSchemeOp::TDescribeOptions opts;
opts.SetReturnPartitioningInfo(returnPartitioning);
opts.SetReturnPartitionConfig(returnPartitioning);
opts.SetBackupInfo(returnBackups);
@@ -243,39 +243,39 @@ namespace NSchemeShardUT_Private {
NKikimrScheme::TEvDescribeSchemeResult DescribePrivatePath(TTestActorRuntime& runtime, const TString& path, bool returnPartitioning, bool returnBoundaries) {
return DescribePath(runtime, TTestTxConfig::SchemeShard, path, returnPartitioning, returnBoundaries, true);
- }
-
+ }
+
NKikimrScheme::TEvDescribeSchemeResult DescribePath(TTestActorRuntime& runtime, const TString& path, bool returnPartitioning, bool returnBoundaries, bool showPrivate, bool returnBackups) {
return DescribePath(runtime, TTestTxConfig::SchemeShard, path, returnPartitioning, returnBoundaries, showPrivate, returnBackups);
- }
-
- TPathVersion ExtructPathVersion(const NKikimrScheme::TEvDescribeSchemeResult& describe) {
- TPathVersion result;
- result.PathId = TPathId(describe.GetPathDescription().GetSelf().GetSchemeshardId(), describe.GetPathDescription().GetSelf().GetPathId());
- result.Version = describe.GetPathDescription().GetSelf().GetPathVersion();
- return result;
- }
-
- TPathVersion TestDescribeResult(const NKikimrScheme::TEvDescribeSchemeResult& describe, TVector<NLs::TCheckFunc> checks) {
- for (const auto& check: checks) {
- if (check) {
- check(describe);
- }
- }
- return ExtructPathVersion(describe);
- }
-
- TString TestLs(TTestActorRuntime& runtime, const TString& path, bool returnPartitioningInfo,
- NLs::TCheckFunc check) {
- auto record = DescribePath(runtime, path, returnPartitioningInfo);
-
- if (check) {
- check(record);
- }
- return record.DebugString();
- }
-
- TString TestLs(TTestActorRuntime& runtime, const TString& path, const NKikimrSchemeOp::TDescribeOptions& opts,
+ }
+
+ TPathVersion ExtructPathVersion(const NKikimrScheme::TEvDescribeSchemeResult& describe) {
+ TPathVersion result;
+ result.PathId = TPathId(describe.GetPathDescription().GetSelf().GetSchemeshardId(), describe.GetPathDescription().GetSelf().GetPathId());
+ result.Version = describe.GetPathDescription().GetSelf().GetPathVersion();
+ return result;
+ }
+
+ TPathVersion TestDescribeResult(const NKikimrScheme::TEvDescribeSchemeResult& describe, TVector<NLs::TCheckFunc> checks) {
+ for (const auto& check: checks) {
+ if (check) {
+ check(describe);
+ }
+ }
+ return ExtructPathVersion(describe);
+ }
+
+ TString TestLs(TTestActorRuntime& runtime, const TString& path, bool returnPartitioningInfo,
+ NLs::TCheckFunc check) {
+ auto record = DescribePath(runtime, path, returnPartitioningInfo);
+
+ if (check) {
+ check(record);
+ }
+ return record.DebugString();
+ }
+
+ TString TestLs(TTestActorRuntime& runtime, const TString& path, const NKikimrSchemeOp::TDescribeOptions& opts,
NLs::TCheckFunc check) {
auto record = DescribePath(runtime, path, opts);
@@ -294,139 +294,139 @@ namespace NSchemeShardUT_Private {
return record.DebugString();
}
- TEvSchemeShard::TEvModifySchemeTransaction* CopyTableRequest(ui64 txId, const TString& dstPath, const TString& dstName, const TString& srcFullName, TApplyIf applyIf) {
+ TEvSchemeShard::TEvModifySchemeTransaction* CopyTableRequest(ui64 txId, const TString& dstPath, const TString& dstName, const TString& srcFullName, TApplyIf applyIf) {
auto evTx = new TEvSchemeShard::TEvModifySchemeTransaction(txId, TTestTxConfig::SchemeShard);
- auto transaction = evTx->Record.AddTransaction();
- transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
- transaction->SetWorkingDir(dstPath);
-
- auto op = transaction->MutableCreateTable();
+ auto transaction = evTx->Record.AddTransaction();
+ transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateTable);
+ transaction->SetWorkingDir(dstPath);
+
+ auto op = transaction->MutableCreateTable();
op->SetName(dstName);
op->SetCopyFromTable(srcFullName);
-
- SetApplyIf(*transaction, applyIf);
- return evTx;
+
+ SetApplyIf(*transaction, applyIf);
+ return evTx;
}
- void AsyncCopyTable(TTestActorRuntime& runtime, ui64 schemeShardId, ui64 txId,
- const TString& dstPath, const TString& dstName, const TString& srcFullName) {
+ void AsyncCopyTable(TTestActorRuntime& runtime, ui64 schemeShardId, ui64 txId,
+ const TString& dstPath, const TString& dstName, const TString& srcFullName) {
TActorId sender = runtime.AllocateEdgeActor();
ForwardToTablet(runtime, schemeShardId, sender, CopyTableRequest(txId, dstPath, dstName, srcFullName));
- }
-
- void AsyncCopyTable(TTestActorRuntime& runtime, ui64 txId,
- const TString& dstPath, const TString& dstName, const TString& srcFullName) {
+ }
+
+ void AsyncCopyTable(TTestActorRuntime& runtime, ui64 txId,
+ const TString& dstPath, const TString& dstName, const TString& srcFullName) {
AsyncCopyTable(runtime, TTestTxConfig::SchemeShard, txId, dstPath, dstName, srcFullName);
- }
-
- void TestCopyTable(TTestActorRuntime& runtime, ui64 schemeShardId, ui64 txId,
+ }
+
+ void TestCopyTable(TTestActorRuntime& runtime, ui64 schemeShardId, ui64 txId,
const TString& dstPath, const TString& dstName, const TString& srcFullName,
- TEvSchemeShard::EStatus expectedResult) {
- AsyncCopyTable(runtime, schemeShardId, txId, dstPath, dstName, srcFullName);
+ TEvSchemeShard::EStatus expectedResult) {
+ AsyncCopyTable(runtime, schemeShardId, txId, dstPath, dstName, srcFullName);
TestModificationResult(runtime, txId, expectedResult);
}
- void TestCopyTable(TTestActorRuntime& runtime, ui64 txId,
- const TString& dstPath, const TString& dstName, const TString& srcFullName,
- TEvSchemeShard::EStatus expectedResult) {
+ void TestCopyTable(TTestActorRuntime& runtime, ui64 txId,
+ const TString& dstPath, const TString& dstName, const TString& srcFullName,
+ TEvSchemeShard::EStatus expectedResult) {
TestCopyTable(runtime, TTestTxConfig::SchemeShard, txId, dstPath, dstName, srcFullName, expectedResult);
- }
-
+ }
+
TString TestDescribe(TTestActorRuntime& runtime, const TString& path) {
return TestLs(runtime, path, true);
}
- TEvSchemeShard::TEvModifySchemeTransaction* MoveTableRequest(ui64 txId, const TString& srcPath, const TString& dstPath, ui64 schemeShard, const TApplyIf& applyIf) {
- THolder<TEvSchemeShard::TEvModifySchemeTransaction> evTx = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(txId, schemeShard);
- auto transaction = evTx->Record.AddTransaction();
- transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpMoveTable);
- SetApplyIf(*transaction, applyIf);
-
- auto descr = transaction->MutableMoveTable();
- descr->SetSrcPath(srcPath);
- descr->SetDstPath(dstPath);
-
-
- return evTx.Release();
- }
-
- void AsyncMoveTable(TTestActorRuntime& runtime, ui64 txId, const TString& srcPath, const TString& dstPath, ui64 schemeShard) {
- TActorId sender = runtime.AllocateEdgeActor();
+ TEvSchemeShard::TEvModifySchemeTransaction* MoveTableRequest(ui64 txId, const TString& srcPath, const TString& dstPath, ui64 schemeShard, const TApplyIf& applyIf) {
+ THolder<TEvSchemeShard::TEvModifySchemeTransaction> evTx = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(txId, schemeShard);
+ auto transaction = evTx->Record.AddTransaction();
+ transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpMoveTable);
+ SetApplyIf(*transaction, applyIf);
+
+ auto descr = transaction->MutableMoveTable();
+ descr->SetSrcPath(srcPath);
+ descr->SetDstPath(dstPath);
+
+
+ return evTx.Release();
+ }
+
+ void AsyncMoveTable(TTestActorRuntime& runtime, ui64 txId, const TString& srcPath, const TString& dstPath, ui64 schemeShard) {
+ TActorId sender = runtime.AllocateEdgeActor();
ForwardToTablet(runtime, schemeShard, sender, MoveTableRequest(txId, srcPath, dstPath, schemeShard));
- }
-
- void TestMoveTable(TTestActorRuntime& runtime, ui64 txId, const TString& src, const TString& dst, const TVector<TEvSchemeShard::EStatus>& expectedResults) {
+ }
+
+ void TestMoveTable(TTestActorRuntime& runtime, ui64 txId, const TString& src, const TString& dst, const TVector<TEvSchemeShard::EStatus>& expectedResults) {
TestMoveTable(runtime, TTestTxConfig::SchemeShard, txId, src, dst, expectedResults);
- }
-
- void TestMoveTable(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, const TString& src, const TString& dst, const TVector<TEvSchemeShard::EStatus>& expectedResults) {
- AsyncMoveTable(runtime, txId, src, dst, schemeShard);
- TestModificationResults(runtime, txId, expectedResults);
- }
-
-
- TEvSchemeShard::TEvModifySchemeTransaction* LockRequest(ui64 txId, const TString &parentPath, const TString& name) {
+ }
+
+ void TestMoveTable(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, const TString& src, const TString& dst, const TVector<TEvSchemeShard::EStatus>& expectedResults) {
+ AsyncMoveTable(runtime, txId, src, dst, schemeShard);
+ TestModificationResults(runtime, txId, expectedResults);
+ }
+
+
+ TEvSchemeShard::TEvModifySchemeTransaction* LockRequest(ui64 txId, const TString &parentPath, const TString& name) {
THolder<TEvSchemeShard::TEvModifySchemeTransaction> evTx = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(txId, TTestTxConfig::SchemeShard);
- auto transaction = evTx->Record.AddTransaction();
- transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateLockForIndexBuild);
- transaction->SetWorkingDir(parentPath);
- auto op = transaction->MutableLockConfig();
- op->SetName(name);
- return evTx.Release();
- }
-
- void AsyncLock(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, const TString& parentPath, const TString& name) {
+ auto transaction = evTx->Record.AddTransaction();
+ transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateLockForIndexBuild);
+ transaction->SetWorkingDir(parentPath);
+ auto op = transaction->MutableLockConfig();
+ op->SetName(name);
+ return evTx.Release();
+ }
+
+ void AsyncLock(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, const TString& parentPath, const TString& name) {
TActorId sender = runtime.AllocateEdgeActor();
ForwardToTablet(runtime, schemeShard, sender, LockRequest(txId, parentPath, name));
- }
-
- void AsyncLock(TTestActorRuntime& runtime, ui64 txId, const TString& parentPath, const TString& name) {
+ }
+
+ void AsyncLock(TTestActorRuntime& runtime, ui64 txId, const TString& parentPath, const TString& name) {
AsyncLock(runtime, TTestTxConfig::SchemeShard, txId, parentPath, name);
- }
-
- void TestLock(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, const TString& parentPath, const TString& name,
- const TVector<TEvSchemeShard::EStatus> expectedResults) {
- AsyncLock(runtime, schemeShard, txId, parentPath, name);
- TestModificationResults(runtime, txId, expectedResults);
- }
-
- void TestLock(TTestActorRuntime& runtime, ui64 txId, const TString& parentPath, const TString& name,
- const TVector<TEvSchemeShard::EStatus> expectedResults) {
+ }
+
+ void TestLock(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, const TString& parentPath, const TString& name,
+ const TVector<TEvSchemeShard::EStatus> expectedResults) {
+ AsyncLock(runtime, schemeShard, txId, parentPath, name);
+ TestModificationResults(runtime, txId, expectedResults);
+ }
+
+ void TestLock(TTestActorRuntime& runtime, ui64 txId, const TString& parentPath, const TString& name,
+ const TVector<TEvSchemeShard::EStatus> expectedResults) {
TestLock(runtime, TTestTxConfig::SchemeShard, txId, parentPath, name, expectedResults);
- }
-
- TEvSchemeShard::TEvModifySchemeTransaction* UnlockRequest(ui64 txId, ui64 lockId, const TString &parentPath, const TString& name) {
+ }
+
+ TEvSchemeShard::TEvModifySchemeTransaction* UnlockRequest(ui64 txId, ui64 lockId, const TString &parentPath, const TString& name) {
THolder<TEvSchemeShard::TEvModifySchemeTransaction> evTx = MakeHolder<TEvSchemeShard::TEvModifySchemeTransaction>(txId, TTestTxConfig::SchemeShard);
- auto transaction = evTx->Record.AddTransaction();
- transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropLock);
- transaction->SetWorkingDir(parentPath);
- auto op = transaction->MutableLockConfig();
- op->SetName(name);
- auto guard = transaction->MutableLockGuard();
- guard->SetOwnerTxId(lockId);
- return evTx.Release();
- }
-
- void AsyncUnlock(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, ui64 lockId, const TString& parentPath, const TString& name) {
+ auto transaction = evTx->Record.AddTransaction();
+ transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropLock);
+ transaction->SetWorkingDir(parentPath);
+ auto op = transaction->MutableLockConfig();
+ op->SetName(name);
+ auto guard = transaction->MutableLockGuard();
+ guard->SetOwnerTxId(lockId);
+ return evTx.Release();
+ }
+
+ void AsyncUnlock(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, ui64 lockId, const TString& parentPath, const TString& name) {
TActorId sender = runtime.AllocateEdgeActor();
ForwardToTablet(runtime, schemeShard, sender, UnlockRequest(txId, lockId, parentPath, name));
- }
-
- void AsyncUnlock(TTestActorRuntime& runtime, ui64 txId, ui64 lockId,const TString& parentPath, const TString& name) {
+ }
+
+ void AsyncUnlock(TTestActorRuntime& runtime, ui64 txId, ui64 lockId,const TString& parentPath, const TString& name) {
AsyncUnlock(runtime, TTestTxConfig::SchemeShard, txId, lockId, parentPath, name);
- }
-
- void TestUnlock(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, ui64 lockId, const TString& parentPath, const TString& name,
- const TVector<TEvSchemeShard::EStatus> expectedResults) {
- AsyncUnlock(runtime, schemeShard, txId, lockId, parentPath, name);
- TestModificationResults(runtime, txId, expectedResults);
- }
-
- void TestUnlock(TTestActorRuntime& runtime, ui64 txId, ui64 lockId, const TString& parentPath, const TString& name,
- const TVector<TEvSchemeShard::EStatus> expectedResults) {
+ }
+
+ void TestUnlock(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, ui64 lockId, const TString& parentPath, const TString& name,
+ const TVector<TEvSchemeShard::EStatus> expectedResults) {
+ AsyncUnlock(runtime, schemeShard, txId, lockId, parentPath, name);
+ TestModificationResults(runtime, txId, expectedResults);
+ }
+
+ void TestUnlock(TTestActorRuntime& runtime, ui64 txId, ui64 lockId, const TString& parentPath, const TString& name,
+ const TVector<TEvSchemeShard::EStatus> expectedResults) {
TestUnlock(runtime, TTestTxConfig::SchemeShard, txId, lockId, parentPath, name, expectedResults);
- }
-
+ }
+
template <typename T>
using TModifySchemeFunc = T*(NKikimrSchemeOp::TModifyScheme::*)();
@@ -476,7 +476,7 @@ namespace NSchemeShardUT_Private {
SetApplyIf(tx, applyIf);
std::apply(func, std::tie(tx))->SetName(name);
-
+
return tx;
}
@@ -492,7 +492,7 @@ namespace NSchemeShardUT_Private {
SetApplyIf(tx, applyIf);
auto task = std::apply(func, std::tie(tx));
-
+
task->SetTableName(tableName);
auto& settings = *task->MutableYTSettings();
@@ -544,7 +544,7 @@ namespace NSchemeShardUT_Private {
SetApplyIf(tx, applyIf);
std::apply(func, std::tie(tx))->SetName(name);
-
+
return tx;
}
@@ -720,7 +720,7 @@ namespace NSchemeShardUT_Private {
GENERIC_HELPERS(DropTable, NKikimrSchemeOp::EOperationType::ESchemeOpDropTable, &NKikimrSchemeOp::TModifyScheme::MutableDrop)
DROP_BY_PATH_ID_HELPERS(DropTable, NKikimrSchemeOp::EOperationType::ESchemeOpDropTable)
GENERIC_HELPERS(DropTableIndex, NKikimrSchemeOp::EOperationType::ESchemeOpDropIndex, &NKikimrSchemeOp::TModifyScheme::MutableDropIndex)
-
+
// backup & restore
GENERIC_HELPERS(BackupTable, NKikimrSchemeOp::EOperationType::ESchemeOpBackup, &NKikimrSchemeOp::TModifyScheme::MutableBackup)
GENERIC_HELPERS(Restore, NKikimrSchemeOp::EOperationType::ESchemeOpRestore, &NKikimrSchemeOp::TModifyScheme::MutableRestore)
@@ -788,7 +788,7 @@ namespace NSchemeShardUT_Private {
#undef DROP_BY_PATH_ID_HELPERS
#undef GENERIC_WITH_ATTRS_HELPERS
#undef GENERIC_HELPERS
-
+
ui64 TestCreateSubDomain(TTestActorRuntime& runtime, ui64 txId, const TString& parentPath, const TString& scheme,
const NKikimrSchemeOp::TAlterUserAttributes& userAttrs)
{
@@ -812,52 +812,52 @@ namespace NSchemeShardUT_Private {
{
TActorId sender = runtime.AllocateEdgeActor();
auto evTx = new TEvSchemeShard::TEvModifySchemeTransaction(txId, TTestTxConfig::SchemeShard);
- auto transaction = evTx->Record.AddTransaction();
- transaction->SetWorkingDir(parentPath);
- transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAssignBlockStoreVolume);
-
- transaction->MutableAssignBlockStoreVolume()->SetName(name);
- transaction->MutableAssignBlockStoreVolume()->SetNewMountToken(mountToken);
- transaction->MutableAssignBlockStoreVolume()->SetTokenVersion(tokenVersion);
-
+ auto transaction = evTx->Record.AddTransaction();
+ transaction->SetWorkingDir(parentPath);
+ transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAssignBlockStoreVolume);
+
+ transaction->MutableAssignBlockStoreVolume()->SetName(name);
+ transaction->MutableAssignBlockStoreVolume()->SetNewMountToken(mountToken);
+ transaction->MutableAssignBlockStoreVolume()->SetTokenVersion(tokenVersion);
+
ForwardToTablet(runtime, TTestTxConfig::SchemeShard, sender, evTx);
}
void TestAssignBlockStoreVolume(TTestActorRuntime& runtime, ui64 txId, const TString& parentPath, const TString& name,
- const TString& mountToken, ui64 tokenVersion, const TVector<TEvSchemeShard::EStatus>& expectedResults)
+ const TString& mountToken, ui64 tokenVersion, const TVector<TEvSchemeShard::EStatus>& expectedResults)
{
AsyncAssignBlockStoreVolume(runtime, txId, parentPath, name, mountToken, tokenVersion);
TestModificationResults(runtime, txId, expectedResults);
}
- TEvSchemeShard::TEvCancelTx *CancelTxRequest(ui64 txId, ui64 targetTxId) {
- auto evTx = new TEvSchemeShard::TEvCancelTx();
- evTx->Record.SetTxId(txId);
+ TEvSchemeShard::TEvCancelTx *CancelTxRequest(ui64 txId, ui64 targetTxId) {
+ auto evTx = new TEvSchemeShard::TEvCancelTx();
+ evTx->Record.SetTxId(txId);
evTx->Record.SetTargetTxId(targetTxId);
- return evTx;
- }
-
+ return evTx;
+ }
+
void AsyncCancelTxTable(TTestActorRuntime& runtime, ui64 txId, ui64 targetTxId) {
TActorId sender = runtime.AllocateEdgeActor();
ForwardToTablet(runtime, TTestTxConfig::SchemeShard, sender, CancelTxRequest(txId, targetTxId));
- }
-
+ }
+
void TestCancelTxTable(TTestActorRuntime& runtime, ui64 txId, ui64 targetTxId,
- const TVector<TEvSchemeShard::EStatus>& expectedResults) {
+ const TVector<TEvSchemeShard::EStatus>& expectedResults) {
AsyncCancelTxTable(runtime, txId, targetTxId);
-
- TAutoPtr<IEventHandle> handle;
- TEvSchemeShard::TEvCancelTxResult* event;
- do {
- event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvCancelTxResult>(handle);
- UNIT_ASSERT(event);
+
+ TAutoPtr<IEventHandle> handle;
+ TEvSchemeShard::TEvCancelTxResult* event;
+ do {
+ event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvCancelTxResult>(handle);
+ UNIT_ASSERT(event);
Cerr << "TEvCancelTxResult for TargetTxId: " << event->Record.GetTargetTxId() << ", wait until TargetTxId: " << targetTxId << "\n";
} while(event->Record.GetTargetTxId() < targetTxId);
UNIT_ASSERT_VALUES_EQUAL(event->Record.GetTargetTxId(), targetTxId);
-
- CheckExpected(expectedResults, event->Record.GetStatus(), event->Record.GetResult());
- }
-
+
+ CheckExpected(expectedResults, event->Record.GetStatus(), event->Record.GetResult());
+ }
+
void AsyncExport(TTestActorRuntime& runtime, ui64 schemeshardId, ui64 id, const TString& dbName, const TString& requestStr, const TString& userSID) {
NKikimrExport::TCreateExportRequest request;
UNIT_ASSERT(google::protobuf::TextFormat::ParseFromString(requestStr, &request));
@@ -1067,30 +1067,30 @@ namespace NSchemeShardUT_Private {
return TestCancelImport(runtime, TTestTxConfig::SchemeShard, txId, dbName, importId, expectedStatus);
}
- NKikimrSchemeOp::TCreateSolomonVolume TakeTabletsFromAnotherSolomonVol(TString name, TString ls, ui32 count) {
- NKikimrSchemeOp::TCreateSolomonVolume volume;
-
- NKikimrScheme::TEvDescribeSchemeResult describe;
- bool parseResult = ::google::protobuf::TextFormat::ParseFromString(ls, &describe);
- Y_ASSERT(parseResult);
-
- auto& partitions = describe.GetPathDescription().GetSolomonDescription().GetPartitions();
- if (count == 0) {
- count = partitions.size();
- }
-
-
- for (auto it = partitions.begin(); it != partitions.end() && count != 0; --count, ++it) {
- NKikimrSchemeOp::TCreateSolomonVolume::TAdoptedPartition* part = volume.AddAdoptedPartitions();
- part->SetOwnerId(describe.GetPathDescription().GetSelf().GetSchemeshardId());
- part->SetShardIdx(it->GetShardIdx());
- part->SetTabletId(it->GetTabletId());
- }
-
- volume.SetName(name);
- return volume;
- }
-
+ NKikimrSchemeOp::TCreateSolomonVolume TakeTabletsFromAnotherSolomonVol(TString name, TString ls, ui32 count) {
+ NKikimrSchemeOp::TCreateSolomonVolume volume;
+
+ NKikimrScheme::TEvDescribeSchemeResult describe;
+ bool parseResult = ::google::protobuf::TextFormat::ParseFromString(ls, &describe);
+ Y_ASSERT(parseResult);
+
+ auto& partitions = describe.GetPathDescription().GetSolomonDescription().GetPartitions();
+ if (count == 0) {
+ count = partitions.size();
+ }
+
+
+ for (auto it = partitions.begin(); it != partitions.end() && count != 0; --count, ++it) {
+ NKikimrSchemeOp::TCreateSolomonVolume::TAdoptedPartition* part = volume.AddAdoptedPartitions();
+ part->SetOwnerId(describe.GetPathDescription().GetSelf().GetSchemeshardId());
+ part->SetShardIdx(it->GetShardIdx());
+ part->SetTabletId(it->GetTabletId());
+ }
+
+ volume.SetName(name);
+ return volume;
+ }
+
NKikimrProto::EReplyStatus LocalMiniKQL(TTestActorRuntime& runtime, ui64 tabletId, const TString& query, NKikimrMiniKQL::TResult& result, TString& err) {
TActorId sender = runtime.AllocateEdgeActor();
@@ -1185,16 +1185,16 @@ namespace NSchemeShardUT_Private {
return result.GetValue().GetStruct(0).GetOptional().GetOptional().GetStruct(0).GetOptional().GetUint64();
}
- NLs::TCheckFunc ShardsIsReady(TTestActorRuntime& runtime) {
- return [&] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- TVector<ui64> datashards;
- for (const auto& partition: record.GetPathDescription().GetTablePartitions()) {
- ui64 dataShardId = partition.GetDatashardId();
- UNIT_ASSERT_VALUES_EQUAL(GetDatashardState(runtime, dataShardId), (ui64)NKikimrTxDataShard::Ready);
- }
- };
- }
-
+ NLs::TCheckFunc ShardsIsReady(TTestActorRuntime& runtime) {
+ return [&] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ TVector<ui64> datashards;
+ for (const auto& partition: record.GetPathDescription().GetTablePartitions()) {
+ ui64 dataShardId = partition.GetDatashardId();
+ UNIT_ASSERT_VALUES_EQUAL(GetDatashardState(runtime, dataShardId), (ui64)NKikimrTxDataShard::Ready);
+ }
+ };
+ }
+
TString SetAllowLogBatching(TTestActorRuntime& runtime, ui64 tabletId, bool v) {
NTabletFlatScheme::TSchemeChanges scheme;
TString errStr;
@@ -1203,196 +1203,196 @@ namespace NSchemeShardUT_Private {
false, scheme, errStr);
return errStr;
}
-
- ui64 GetDatashardSysTableValue(TTestActorRuntime& runtime, ui64 tabletId, ui64 sysKey) {
- NKikimrMiniKQL::TResult result;
- TString err;
+
+ ui64 GetDatashardSysTableValue(TTestActorRuntime& runtime, ui64 tabletId, ui64 sysKey) {
+ NKikimrMiniKQL::TResult result;
+ TString err;
NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, Sprintf(R"((
- (let Sys_ValueKey '%ld)
- (let row '('('Id (Uint64 Sys_ValueKey))))
- (let select '('Uint64))
- (let ret(AsList(SetResult 'Value (SelectRow 'Sys row select))))
- (return ret)
- ))", sysKey), result, err);
- // Cdbg << result << "\n";
+ (let Sys_ValueKey '%ld)
+ (let row '('('Id (Uint64 Sys_ValueKey))))
+ (let select '('Uint64))
+ (let ret(AsList(SetResult 'Value (SelectRow 'Sys row select))))
+ (return ret)
+ ))", sysKey), result, err);
+ // Cdbg << result << "\n";
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);
- // Value { Struct { Optional { Optional { Struct { Optional { Uint64: 100 } } } } } } }
- return result.GetValue().GetStruct(0).GetOptional().GetOptional().GetStruct(0).GetOptional().GetUint64();
- }
-
- ui64 GetTxReadSizeLimit(TTestActorRuntime& runtime, ui64 tabletId) {
- return GetDatashardSysTableValue(runtime, tabletId, 18);
- }
-
- ui64 GetStatDisabled(TTestActorRuntime& runtime, ui64 tabletId) {
- return GetDatashardSysTableValue(runtime, tabletId, 20);
- }
-
- ui64 GetExecutorCacheSize(TTestActorRuntime& runtime, ui64 tabletId) {
- NTabletFlatScheme::TSchemeChanges scheme;
- TString err;
+ // Value { Struct { Optional { Optional { Struct { Optional { Uint64: 100 } } } } } } }
+ return result.GetValue().GetStruct(0).GetOptional().GetOptional().GetStruct(0).GetOptional().GetUint64();
+ }
+
+ ui64 GetTxReadSizeLimit(TTestActorRuntime& runtime, ui64 tabletId) {
+ return GetDatashardSysTableValue(runtime, tabletId, 18);
+ }
+
+ ui64 GetStatDisabled(TTestActorRuntime& runtime, ui64 tabletId) {
+ return GetDatashardSysTableValue(runtime, tabletId, 20);
+ }
+
+ ui64 GetExecutorCacheSize(TTestActorRuntime& runtime, ui64 tabletId) {
+ NTabletFlatScheme::TSchemeChanges scheme;
+ TString err;
NKikimrProto::EReplyStatus status = LocalSchemeTx(runtime, tabletId, "", true, scheme, err);
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);
- //Cdbg << scheme << "\n";
- // looking for "Delta { DeltaType: UpdateExecutorInfo ExecutorCacheSize: 33554432 }"
- for (ui32 i = 0; i < scheme.DeltaSize(); ++i) {
- const auto& d = scheme.GetDelta(i);
- if (d.GetDeltaType() == NTabletFlatScheme::TAlterRecord::UpdateExecutorInfo) {
- return d.GetExecutorCacheSize();
- }
- }
- UNIT_ASSERT_C(false, "UpdateExecutorInfo delta record not found");
- return -1;
- }
-
-
- bool GetFastLogPolicy(TTestActorRuntime& runtime, ui64 tabletId) {
- NTabletFlatScheme::TSchemeChanges scheme;
- TString err;
+ //Cdbg << scheme << "\n";
+ // looking for "Delta { DeltaType: UpdateExecutorInfo ExecutorCacheSize: 33554432 }"
+ for (ui32 i = 0; i < scheme.DeltaSize(); ++i) {
+ const auto& d = scheme.GetDelta(i);
+ if (d.GetDeltaType() == NTabletFlatScheme::TAlterRecord::UpdateExecutorInfo) {
+ return d.GetExecutorCacheSize();
+ }
+ }
+ UNIT_ASSERT_C(false, "UpdateExecutorInfo delta record not found");
+ return -1;
+ }
+
+
+ bool GetFastLogPolicy(TTestActorRuntime& runtime, ui64 tabletId) {
+ NTabletFlatScheme::TSchemeChanges scheme;
+ TString err;
NKikimrProto::EReplyStatus status = LocalSchemeTx(runtime, tabletId, "", true, scheme, err);
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);
- //Cdbg << scheme << "\n";
- for (ui32 i = 0; i < scheme.DeltaSize(); ++i) {
- const auto& d = scheme.GetDelta(i);
- if (d.GetDeltaType() == NTabletFlatScheme::TAlterRecord::UpdateExecutorInfo &&
- d.HasExecutorLogFastCommitTactic())
- {
- return d.GetExecutorLogFastCommitTactic();
- }
- }
- UNIT_ASSERT_C(false, "ExecutorLogFastCommitTactic delta record not found");
- return false;
- }
-
- bool GetByKeyFilterEnabled(TTestActorRuntime& runtime, ui64 tabletId, ui32 table) {
- NTabletFlatScheme::TSchemeChanges scheme;
- TString err;
+ //Cdbg << scheme << "\n";
+ for (ui32 i = 0; i < scheme.DeltaSize(); ++i) {
+ const auto& d = scheme.GetDelta(i);
+ if (d.GetDeltaType() == NTabletFlatScheme::TAlterRecord::UpdateExecutorInfo &&
+ d.HasExecutorLogFastCommitTactic())
+ {
+ return d.GetExecutorLogFastCommitTactic();
+ }
+ }
+ UNIT_ASSERT_C(false, "ExecutorLogFastCommitTactic delta record not found");
+ return false;
+ }
+
+ bool GetByKeyFilterEnabled(TTestActorRuntime& runtime, ui64 tabletId, ui32 table) {
+ NTabletFlatScheme::TSchemeChanges scheme;
+ TString err;
NKikimrProto::EReplyStatus status = LocalSchemeTx(runtime, tabletId, "", true, scheme, err);
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);
- //Cdbg << scheme << "\n";
- for (ui32 i = 0; i < scheme.DeltaSize(); ++i) {
- const auto& d = scheme.GetDelta(i);
- if (d.GetDeltaType() == NTabletFlatScheme::TAlterRecord::SetTable &&
- d.GetTableId() == table &&
- d.HasByKeyFilter())
- {
- return d.GetByKeyFilter();
- }
- }
- UNIT_ASSERT_C(false, "ByKeyFilte delta record not found");
- return false;
- }
-
- bool GetEraseCacheEnabled(TTestActorRuntime& runtime, ui64 tabletId, ui32 table) {
- NTabletFlatScheme::TSchemeChanges scheme;
- TString err;
+ //Cdbg << scheme << "\n";
+ for (ui32 i = 0; i < scheme.DeltaSize(); ++i) {
+ const auto& d = scheme.GetDelta(i);
+ if (d.GetDeltaType() == NTabletFlatScheme::TAlterRecord::SetTable &&
+ d.GetTableId() == table &&
+ d.HasByKeyFilter())
+ {
+ return d.GetByKeyFilter();
+ }
+ }
+ UNIT_ASSERT_C(false, "ByKeyFilte delta record not found");
+ return false;
+ }
+
+ bool GetEraseCacheEnabled(TTestActorRuntime& runtime, ui64 tabletId, ui32 table) {
+ NTabletFlatScheme::TSchemeChanges scheme;
+ TString err;
NKikimrProto::EReplyStatus status = LocalSchemeTx(runtime, tabletId, "", true, scheme, err);
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);
- //Cdbg << scheme << "\n";
- bool found = false;
- bool enabled = false;
- for (ui32 i = 0; i < scheme.DeltaSize(); ++i) {
- const auto& d = scheme.GetDelta(i);
- if (d.GetDeltaType() == NTabletFlatScheme::TAlterRecord::SetTable &&
- d.GetTableId() == table &&
- d.HasEraseCacheEnabled())
- {
- found = true;
- enabled = d.GetEraseCacheEnabled();
- }
- }
- UNIT_ASSERT_C(found, "EraseCacheEnabled delta record not found");
- return enabled;
- }
-
- NKikimr::NLocalDb::TCompactionPolicyPtr GetCompactionPolicy(TTestActorRuntime& runtime, ui64 tabletId, ui32 localTableId) {
- NTabletFlatScheme::TSchemeChanges scheme;
- TString err;
+ //Cdbg << scheme << "\n";
+ bool found = false;
+ bool enabled = false;
+ for (ui32 i = 0; i < scheme.DeltaSize(); ++i) {
+ const auto& d = scheme.GetDelta(i);
+ if (d.GetDeltaType() == NTabletFlatScheme::TAlterRecord::SetTable &&
+ d.GetTableId() == table &&
+ d.HasEraseCacheEnabled())
+ {
+ found = true;
+ enabled = d.GetEraseCacheEnabled();
+ }
+ }
+ UNIT_ASSERT_C(found, "EraseCacheEnabled delta record not found");
+ return enabled;
+ }
+
+ NKikimr::NLocalDb::TCompactionPolicyPtr GetCompactionPolicy(TTestActorRuntime& runtime, ui64 tabletId, ui32 localTableId) {
+ NTabletFlatScheme::TSchemeChanges scheme;
+ TString err;
NKikimrProto::EReplyStatus status = LocalSchemeTx(runtime, tabletId, "", true, scheme, err);
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);
- Cdbg << scheme << "\n";
- // looking for "Delta { DeltaType: SetCompactionPolicy TableId: 1001 CompactionPolicy { ... } }"
- for (ui32 i = 0; i < scheme.DeltaSize(); ++i) {
- const auto& d = scheme.GetDelta(i);
- if (d.GetDeltaType() == NTabletFlatScheme::TAlterRecord::SetCompactionPolicy && d.GetTableId() == localTableId) {
- return new NKikimr::NLocalDb::TCompactionPolicy(d.GetCompactionPolicy());
- }
- }
- UNIT_ASSERT_C(false, "SetCompactionPolicy delta record not found");
- return nullptr;
- }
-
- void SetSchemeshardReadOnlyMode(TTestActorRuntime& runtime, bool isReadOnly) {
+ Cdbg << scheme << "\n";
+ // looking for "Delta { DeltaType: SetCompactionPolicy TableId: 1001 CompactionPolicy { ... } }"
+ for (ui32 i = 0; i < scheme.DeltaSize(); ++i) {
+ const auto& d = scheme.GetDelta(i);
+ if (d.GetDeltaType() == NTabletFlatScheme::TAlterRecord::SetCompactionPolicy && d.GetTableId() == localTableId) {
+ return new NKikimr::NLocalDb::TCompactionPolicy(d.GetCompactionPolicy());
+ }
+ }
+ UNIT_ASSERT_C(false, "SetCompactionPolicy delta record not found");
+ return nullptr;
+ }
+
+ void SetSchemeshardReadOnlyMode(TTestActorRuntime& runtime, bool isReadOnly) {
ui64 schemeshardTabletId = TTestTxConfig::SchemeShard;
- NKikimrMiniKQL::TResult result;
- TString err;
+ NKikimrMiniKQL::TResult result;
+ TString err;
NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, schemeshardTabletId,
- Sprintf(R"(
- (
- (let key '('('Id (Uint64 '3)))) # SysParam_IsReadOnlyMode
- (let value '('('Value (Utf8 '"%s"))))
- (let ret (AsList (UpdateRow 'SysParams key value)))
- (return ret)
- ))", (isReadOnly ? "1" : "0")), result, err);
- Cdbg << result << "\n";
+ Sprintf(R"(
+ (
+ (let key '('('Id (Uint64 '3)))) # SysParam_IsReadOnlyMode
+ (let value '('('Value (Utf8 '"%s"))))
+ (let ret (AsList (UpdateRow 'SysParams key value)))
+ (return ret)
+ ))", (isReadOnly ? "1" : "0")), result, err);
+ Cdbg << result << "\n";
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);
- }
-
- void SetSchemeshardSchemaLimits(TTestActorRuntime& runtime, NSchemeShard::TSchemeLimits limits) {
+ }
+
+ void SetSchemeshardSchemaLimits(TTestActorRuntime& runtime, NSchemeShard::TSchemeLimits limits) {
SetSchemeshardSchemaLimits(runtime, limits, TTestTxConfig::SchemeShard);
- }
-
-
- TString EscapedDoubleQoute(const TString src) {
- auto result = src;
-
- auto pos = src.find('"');
- if (pos == src.npos) {
- return result;
- }
-
- result.replace(pos, pos + 1, "\\\"");
- return result;
- }
-
- void SetSchemeshardSchemaLimits(TTestActorRuntime &runtime, TSchemeLimits limits, ui64 schemeShard) {
- const ui64 domainId = 1;
- NKikimrMiniKQL::TResult result;
- TString err;
- auto escapedStr = EscapedDoubleQoute(limits.ExtraPathSymbolsAllowed);
- TString prog = Sprintf(R"(
- (
- (let key '('('PathId (Uint64 '%lu)))) # RootPathId
- (let depth '('DepthLimit (Uint64 '%lu)))
- (let paths '('PathsLimit (Uint64 '%lu)))
- (let child '('ChildrenLimit (Uint64 '%lu)))
+ }
+
+
+ TString EscapedDoubleQoute(const TString src) {
+ auto result = src;
+
+ auto pos = src.find('"');
+ if (pos == src.npos) {
+ return result;
+ }
+
+ result.replace(pos, pos + 1, "\\\"");
+ return result;
+ }
+
+ void SetSchemeshardSchemaLimits(TTestActorRuntime &runtime, TSchemeLimits limits, ui64 schemeShard) {
+ const ui64 domainId = 1;
+ NKikimrMiniKQL::TResult result;
+ TString err;
+ auto escapedStr = EscapedDoubleQoute(limits.ExtraPathSymbolsAllowed);
+ TString prog = Sprintf(R"(
+ (
+ (let key '('('PathId (Uint64 '%lu)))) # RootPathId
+ (let depth '('DepthLimit (Uint64 '%lu)))
+ (let paths '('PathsLimit (Uint64 '%lu)))
+ (let child '('ChildrenLimit (Uint64 '%lu)))
(let acl '('AclByteSizeLimit (Uint64 '%lu)))
(let columns '('TableColumnsLimit (Uint64 '%lu)))
(let colName '('TableColumnNameLengthLimit (Uint64 '%lu)))
(let keyCols '('TableKeyColumnsLimit (Uint64 '%lu)))
(let indices '('TableIndicesLimit (Uint64 '%lu)))
- (let shards '('ShardsLimit (Uint64 '%lu)))
- (let pathShards '('PathShardsLimit (Uint64 '%lu)))
+ (let shards '('ShardsLimit (Uint64 '%lu)))
+ (let pathShards '('PathShardsLimit (Uint64 '%lu)))
(let consCopy '('ConsistentCopyingTargetsLimit (Uint64 '%lu)))
- (let maxPathLength '('PathElementLength (Uint64 '%lu)))
- (let extraSymbols '('ExtraPathSymbolsAllowed (Utf8 '"%s")))
+ (let maxPathLength '('PathElementLength (Uint64 '%lu)))
+ (let extraSymbols '('ExtraPathSymbolsAllowed (Utf8 '"%s")))
(let pqPartitions '('PQPartitionsLimit (Uint64 '%lu)))
(let ret (AsList (UpdateRow 'SubDomains key '(depth paths child acl columns colName keyCols indices shards pathShards consCopy maxPathLength extraSymbols pqPartitions))))
- (return ret)
- )
- )", domainId, limits.MaxDepth, limits.MaxPaths, limits.MaxChildrenInDir, limits.MaxAclBytesSize,
- limits.MaxTableColumns, limits.MaxTableColumnNameLength, limits.MaxTableKeyColumns, limits.MaxTableIndices,
- limits.MaxShards, limits.MaxShardsInPath, limits.MaxConsistentCopyTargets,
+ (return ret)
+ )
+ )", domainId, limits.MaxDepth, limits.MaxPaths, limits.MaxChildrenInDir, limits.MaxAclBytesSize,
+ limits.MaxTableColumns, limits.MaxTableColumnNameLength, limits.MaxTableKeyColumns, limits.MaxTableIndices,
+ limits.MaxShards, limits.MaxShardsInPath, limits.MaxConsistentCopyTargets,
limits.MaxPathElementLength, escapedStr.c_str(), limits.MaxPQPartitions);
- Cdbg << prog << "\n";
+ Cdbg << prog << "\n";
NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, schemeShard, prog, result, err);
- Cdbg << result << "\n";
+ Cdbg << result << "\n";
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);
-
+
TActorId sender = runtime.AllocateEdgeActor();
RebootTablet(runtime, schemeShard, sender);
- }
-
+ }
+
void SetSchemeshardDatabaseQuotas(TTestActorRuntime& runtime, Ydb::Cms::DatabaseQuotas databaseQuotas, ui64 domainId) {
SetSchemeshardDatabaseQuotas(runtime, databaseQuotas, domainId, TTestTxConfig::SchemeShard);
@@ -1424,635 +1424,635 @@ namespace NSchemeShardUT_Private {
}
- NKikimrSchemeOp::TTableDescription GetDatashardSchema(TTestActorRuntime& runtime, ui64 tabletId, ui64 tid) {
- NKikimrMiniKQL::TResult result;
- TString err;
+ NKikimrSchemeOp::TTableDescription GetDatashardSchema(TTestActorRuntime& runtime, ui64 tabletId, ui64 tid) {
+ NKikimrMiniKQL::TResult result;
+ TString err;
NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, Sprintf(R"(
- (
- (let sel_ (SelectRow 'UserTables '('('Tid (Uint64 '%lu))) '('Schema)))
- (let schema_ (Coalesce (FlatMap sel_ (lambda '(x) (Member x 'Schema))) (String '"")))
- (return (AsList (SetResult 'Result schema_)))
- ))", tid), result, err);
-
+ (
+ (let sel_ (SelectRow 'UserTables '('('Tid (Uint64 '%lu))) '('Schema)))
+ (let schema_ (Coalesce (FlatMap sel_ (lambda '(x) (Member x 'Schema))) (String '"")))
+ (return (AsList (SetResult 'Result schema_)))
+ ))", tid), result, err);
+
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);
- //Cerr << result.GetType() << ' ' << result.GetValue() << Endl;
- TString schema = result.GetValue().GetStruct(0).GetOptional().GetBytes();
- NKikimrSchemeOp::TTableDescription tableDescription;
- bool parseOk = ParseFromStringNoSizeLimit(tableDescription, schema);
- UNIT_ASSERT(parseOk);
- return tableDescription;
- }
-
- TEvSchemeShard::TEvModifySchemeTransaction *UpgradeSubDomainRequest(ui64 txId, const TString &parentPath, const TString &name) {
+ //Cerr << result.GetType() << ' ' << result.GetValue() << Endl;
+ TString schema = result.GetValue().GetStruct(0).GetOptional().GetBytes();
+ NKikimrSchemeOp::TTableDescription tableDescription;
+ bool parseOk = ParseFromStringNoSizeLimit(tableDescription, schema);
+ UNIT_ASSERT(parseOk);
+ return tableDescription;
+ }
+
+ TEvSchemeShard::TEvModifySchemeTransaction *UpgradeSubDomainRequest(ui64 txId, const TString &parentPath, const TString &name) {
auto evTx = new TEvSchemeShard::TEvModifySchemeTransaction(txId, TTestTxConfig::SchemeShard);
- auto transaction = evTx->Record.AddTransaction();
- transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpUpgradeSubDomain);
- transaction->SetWorkingDir(parentPath);
- transaction->MutableUpgradeSubDomain()->SetName(name);
- return evTx;
- }
-
- void AsyncUpgradeSubDomain(TTestActorRuntime &runtime, ui64 txId, const TString &parentPath, const TString &name) {
+ auto transaction = evTx->Record.AddTransaction();
+ transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpUpgradeSubDomain);
+ transaction->SetWorkingDir(parentPath);
+ transaction->MutableUpgradeSubDomain()->SetName(name);
+ return evTx;
+ }
+
+ void AsyncUpgradeSubDomain(TTestActorRuntime &runtime, ui64 txId, const TString &parentPath, const TString &name) {
TActorId sender = runtime.AllocateEdgeActor();
- auto evTx = UpgradeSubDomainRequest(txId, parentPath, name);
+ auto evTx = UpgradeSubDomainRequest(txId, parentPath, name);
ForwardToTablet(runtime, TTestTxConfig::SchemeShard, sender, evTx);
- }
-
- void TestUpgradeSubDomain(TTestActorRuntime &runtime, ui64 txId, const TString &parentPath, const TString &name, const TVector<TEvSchemeShard::EStatus> &expectedResults) {
- AsyncUpgradeSubDomain(runtime, txId, parentPath, name);
- TestModificationResults(runtime, txId, expectedResults);
- }
-
- void TestUpgradeSubDomain(TTestActorRuntime &runtime, ui64 txId, const TString &parentPath, const TString &name) {
- AsyncUpgradeSubDomain(runtime, txId, parentPath, name);
- TestModificationResults(runtime, txId, {TEvSchemeShard::EStatus::StatusAccepted});
- }
-
- TEvSchemeShard::TEvModifySchemeTransaction *UpgradeSubDomainDecisionRequest(ui64 txId, const TString &parentPath, const TString &name, NKikimrSchemeOp::TUpgradeSubDomain::EDecision decision) {
+ }
+
+ void TestUpgradeSubDomain(TTestActorRuntime &runtime, ui64 txId, const TString &parentPath, const TString &name, const TVector<TEvSchemeShard::EStatus> &expectedResults) {
+ AsyncUpgradeSubDomain(runtime, txId, parentPath, name);
+ TestModificationResults(runtime, txId, expectedResults);
+ }
+
+ void TestUpgradeSubDomain(TTestActorRuntime &runtime, ui64 txId, const TString &parentPath, const TString &name) {
+ AsyncUpgradeSubDomain(runtime, txId, parentPath, name);
+ TestModificationResults(runtime, txId, {TEvSchemeShard::EStatus::StatusAccepted});
+ }
+
+ TEvSchemeShard::TEvModifySchemeTransaction *UpgradeSubDomainDecisionRequest(ui64 txId, const TString &parentPath, const TString &name, NKikimrSchemeOp::TUpgradeSubDomain::EDecision decision) {
auto evTx = new TEvSchemeShard::TEvModifySchemeTransaction(txId, TTestTxConfig::SchemeShard);
- auto transaction = evTx->Record.AddTransaction();
- transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpUpgradeSubDomainDecision);
- transaction->SetWorkingDir(parentPath);
- transaction->MutableUpgradeSubDomain()->SetName(name);
- transaction->MutableUpgradeSubDomain()->SetDecision(decision);
- return evTx;
- }
-
- void AsyncUpgradeSubDomainDecision(TTestActorRuntime &runtime, ui64 txId, const TString &parentPath, const TString &name, NKikimrSchemeOp::TUpgradeSubDomain::EDecision decision) {
+ auto transaction = evTx->Record.AddTransaction();
+ transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpUpgradeSubDomainDecision);
+ transaction->SetWorkingDir(parentPath);
+ transaction->MutableUpgradeSubDomain()->SetName(name);
+ transaction->MutableUpgradeSubDomain()->SetDecision(decision);
+ return evTx;
+ }
+
+ void AsyncUpgradeSubDomainDecision(TTestActorRuntime &runtime, ui64 txId, const TString &parentPath, const TString &name, NKikimrSchemeOp::TUpgradeSubDomain::EDecision decision) {
TActorId sender = runtime.AllocateEdgeActor();
- auto evTx = UpgradeSubDomainDecisionRequest(txId, parentPath, name, decision);
+ auto evTx = UpgradeSubDomainDecisionRequest(txId, parentPath, name, decision);
ForwardToTablet(runtime, TTestTxConfig::SchemeShard, sender, evTx);
- }
-
- void TestUpgradeSubDomainDecision(TTestActorRuntime &runtime, ui64 txId, const TString &parentPath, const TString &name, const TVector<TEvSchemeShard::EStatus> &expectedResults, NKikimrSchemeOp::TUpgradeSubDomain::EDecision decision) {
- AsyncUpgradeSubDomainDecision(runtime, txId, parentPath, name, decision);
- TestModificationResults(runtime, txId, expectedResults);
- }
-
- void TestUpgradeSubDomainDecision(TTestActorRuntime &runtime, ui64 txId, const TString &parentPath, const TString &name, NKikimrSchemeOp::TUpgradeSubDomain::EDecision decision) {
- AsyncUpgradeSubDomainDecision(runtime, txId, parentPath, name, decision);
- TestModificationResults(runtime, txId, {TEvSchemeShard::EStatus::StatusAccepted});
- }
+ }
+
+ void TestUpgradeSubDomainDecision(TTestActorRuntime &runtime, ui64 txId, const TString &parentPath, const TString &name, const TVector<TEvSchemeShard::EStatus> &expectedResults, NKikimrSchemeOp::TUpgradeSubDomain::EDecision decision) {
+ AsyncUpgradeSubDomainDecision(runtime, txId, parentPath, name, decision);
+ TestModificationResults(runtime, txId, expectedResults);
+ }
+
+ void TestUpgradeSubDomainDecision(TTestActorRuntime &runtime, ui64 txId, const TString &parentPath, const TString &name, NKikimrSchemeOp::TUpgradeSubDomain::EDecision decision) {
+ AsyncUpgradeSubDomainDecision(runtime, txId, parentPath, name, decision);
+ TestModificationResults(runtime, txId, {TEvSchemeShard::EStatus::StatusAccepted});
+ }
TRowVersion CreateVolatileSnapshot(
TTestActorRuntime& runtime,
const TVector<TString>& tables,
- TDuration timeout)
- {
+ TDuration timeout)
+ {
TActorId sender = runtime.AllocateEdgeActor();
- {
- auto request = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
- auto* tx = request->Record.MutableTransaction()->MutableCreateVolatileSnapshot();
- for (const auto& path : tables) {
- tx->AddTables()->SetTablePath(path);
- }
- tx->SetTimeoutMs(timeout.MilliSeconds());
- runtime.Send(new IEventHandle(MakeTxProxyID(), sender, request.Release()));
+ {
+ auto request = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
+ auto* tx = request->Record.MutableTransaction()->MutableCreateVolatileSnapshot();
+ for (const auto& path : tables) {
+ tx->AddTables()->SetTablePath(path);
+ }
+ tx->SetTimeoutMs(timeout.MilliSeconds());
+ runtime.Send(new IEventHandle(MakeTxProxyID(), sender, request.Release()));
}
-
- auto ev = runtime.GrabEdgeEventRethrow<TEvTxUserProxy::TEvProposeTransactionStatus>(sender);
- const auto& record = ev->Get()->Record;
- auto status = static_cast<TEvTxUserProxy::TEvProposeTransactionStatus::EStatus>(record.GetStatus());
- Y_VERIFY_S(status == TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecComplete,
- "Unexpected status " << status);
-
- auto step = record.GetStep();
- auto txId = record.GetTxId();
- Y_VERIFY_S(step != 0 && txId != 0,
- "Unexpected step " << step << " and txId " << txId);
-
- return { step, txId };
+
+ auto ev = runtime.GrabEdgeEventRethrow<TEvTxUserProxy::TEvProposeTransactionStatus>(sender);
+ const auto& record = ev->Get()->Record;
+ auto status = static_cast<TEvTxUserProxy::TEvProposeTransactionStatus::EStatus>(record.GetStatus());
+ Y_VERIFY_S(status == TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecComplete,
+ "Unexpected status " << status);
+
+ auto step = record.GetStep();
+ auto txId = record.GetTxId();
+ Y_VERIFY_S(step != 0 && txId != 0,
+ "Unexpected step " << step << " and txId " << txId);
+
+ return { step, txId };
}
TEvIndexBuilder::TEvCreateRequest* CreateBuildIndexRequest(ui64 id, const TString& dbName, const TString& src, const TBuildIndexConfig& cfg) {
- NKikimrIndexBuilder::TIndexBuildSettings settings;
- settings.set_source_path(src);
- settings.set_max_batch_rows(2);
- settings.set_max_shards_in_flight(2);
-
- Ydb::Table::TableIndex& index = *settings.mutable_index();
+ NKikimrIndexBuilder::TIndexBuildSettings settings;
+ settings.set_source_path(src);
+ settings.set_max_batch_rows(2);
+ settings.set_max_shards_in_flight(2);
+
+ Ydb::Table::TableIndex& index = *settings.mutable_index();
index.set_name(cfg.IndexName);
*index.mutable_index_columns() = {cfg.IndexColumns.begin(), cfg.IndexColumns.end()};
*index.mutable_data_columns() = {cfg.DataColumns.begin(), cfg.DataColumns.end()};
switch (cfg.IndexType) {
- case NKikimrSchemeOp::EIndexTypeGlobal:
+ case NKikimrSchemeOp::EIndexTypeGlobal:
*index.mutable_global_index() = Ydb::Table::GlobalIndex();
break;
- case NKikimrSchemeOp::EIndexTypeGlobalAsync:
+ case NKikimrSchemeOp::EIndexTypeGlobalAsync:
*index.mutable_global_async_index() = Ydb::Table::GlobalAsyncIndex();
break;
default:
UNIT_ASSERT_C(false, "Unknown index type: " << static_cast<ui32>(cfg.IndexType));
}
-
- return new TEvIndexBuilder::TEvCreateRequest(id, dbName, std::move(settings));
- }
-
- TStringBuilder PrintIssues(const ::google::protobuf::RepeatedPtrField< ::Ydb::Issue::IssueMessage >& issues) {
- TStringBuilder result;
- for (const auto& x: issues) {
- result << "ISSUE( severity: " << x.severity() << "; message: " << x.message() << ") ";
- }
- return result;
- }
-
+
+ return new TEvIndexBuilder::TEvCreateRequest(id, dbName, std::move(settings));
+ }
+
+ TStringBuilder PrintIssues(const ::google::protobuf::RepeatedPtrField< ::Ydb::Issue::IssueMessage >& issues) {
+ TStringBuilder result;
+ for (const auto& x: issues) {
+ result << "ISSUE( severity: " << x.severity() << "; message: " << x.message() << ") ";
+ }
+ return result;
+ }
+
void AsyncBuilIndex(TTestActorRuntime& runtime, ui64 id, ui64 schemeShard, const TString &dbName, const TString &src, const TBuildIndexConfig &cfg) {
- auto sender = runtime.AllocateEdgeActor();
+ auto sender = runtime.AllocateEdgeActor();
auto request = CreateBuildIndexRequest(id, dbName, src, cfg);
-
+
ForwardToTablet(runtime, schemeShard, sender, request);
- }
-
+ }
+
void AsyncBuilIndex(TTestActorRuntime& runtime, ui64 id, ui64 schemeShard, const TString &dbName,
const TString &src, const TString &name, TVector<TString> columns, TVector<TString> dataColumns)
{
AsyncBuilIndex(runtime, id, schemeShard, dbName, src, TBuildIndexConfig{
- name, NKikimrSchemeOp::EIndexTypeGlobal, columns, dataColumns
+ name, NKikimrSchemeOp::EIndexTypeGlobal, columns, dataColumns
});
}
- void TestBuilIndex(TTestActorRuntime& runtime, ui64 id, ui64 schemeShard, const TString &dbName,
+ void TestBuilIndex(TTestActorRuntime& runtime, ui64 id, ui64 schemeShard, const TString &dbName,
const TString &src, const TBuildIndexConfig& cfg, Ydb::StatusIds::StatusCode expectedStatus)
- {
+ {
AsyncBuilIndex(runtime, id, schemeShard, dbName, src, cfg);
-
- TAutoPtr<IEventHandle> handle;
- TEvIndexBuilder::TEvCreateResponse* event = runtime.GrabEdgeEvent<TEvIndexBuilder::TEvCreateResponse>(handle);
- UNIT_ASSERT(event);
-
- Cerr << "BUILDINDEX RESPONSE CREATE: " << event->ToString() << Endl;
- UNIT_ASSERT_EQUAL_C(event->Record.GetStatus(), expectedStatus,
- "status mismatch"
- << " got " << Ydb::StatusIds::StatusCode_Name(event->Record.GetStatus())
- << " expected " << Ydb::StatusIds::StatusCode_Name(expectedStatus)
- << " issues was " << PrintIssues(event->Record.GetIssues()));
- }
-
+
+ TAutoPtr<IEventHandle> handle;
+ TEvIndexBuilder::TEvCreateResponse* event = runtime.GrabEdgeEvent<TEvIndexBuilder::TEvCreateResponse>(handle);
+ UNIT_ASSERT(event);
+
+ Cerr << "BUILDINDEX RESPONSE CREATE: " << event->ToString() << Endl;
+ UNIT_ASSERT_EQUAL_C(event->Record.GetStatus(), expectedStatus,
+ "status mismatch"
+ << " got " << Ydb::StatusIds::StatusCode_Name(event->Record.GetStatus())
+ << " expected " << Ydb::StatusIds::StatusCode_Name(expectedStatus)
+ << " issues was " << PrintIssues(event->Record.GetIssues()));
+ }
+
void TestBuilIndex(TTestActorRuntime& runtime, ui64 id, ui64 schemeShard, const TString &dbName,
const TString &src, const TString &name, TVector<TString> columns,
Ydb::StatusIds::StatusCode expectedStatus)
{
TestBuilIndex(runtime, id, schemeShard, dbName, src, TBuildIndexConfig{
- name, NKikimrSchemeOp::EIndexTypeGlobal, columns, {}
+ name, NKikimrSchemeOp::EIndexTypeGlobal, columns, {}
}, expectedStatus);
}
- TEvIndexBuilder::TEvCancelRequest* CreateCancelBuildIndexRequest(
- const ui64 id, const TString& dbName, const ui64 buildIndexId)
- {
- return new TEvIndexBuilder::TEvCancelRequest(id, dbName, buildIndexId);
- }
-
- void CheckExpected(const TVector<Ydb::StatusIds::StatusCode>& expected, Ydb::StatusIds_StatusCode result, const TString& reason)
- {
- bool isExpectedStatus = false;
- for (Ydb::StatusIds::StatusCode exp : expected) {
- if (result == exp) {
- isExpectedStatus = true;
- break;
- }
- }
- if (!isExpectedStatus)
- Cdbg << "Unexpected status: " << Ydb::StatusIds::StatusCode_Name(result) << ": " << reason << Endl;
- UNIT_ASSERT_C(isExpectedStatus, "Unexpected status: " << Ydb::StatusIds::StatusCode_Name(result) << ": " << reason);
- }
-
- NKikimrIndexBuilder::TEvCancelResponse TestCancelBuildIndex(TTestActorRuntime& runtime, const ui64 id, const ui64 schemeShard, const TString &dbName,
- const ui64 buildIndexId,
- const TVector<Ydb::StatusIds::StatusCode>& expectedStatuses)
- {
- auto sender = runtime.AllocateEdgeActor();
- auto request = CreateCancelBuildIndexRequest(id, dbName, buildIndexId);
-
+ TEvIndexBuilder::TEvCancelRequest* CreateCancelBuildIndexRequest(
+ const ui64 id, const TString& dbName, const ui64 buildIndexId)
+ {
+ return new TEvIndexBuilder::TEvCancelRequest(id, dbName, buildIndexId);
+ }
+
+ void CheckExpected(const TVector<Ydb::StatusIds::StatusCode>& expected, Ydb::StatusIds_StatusCode result, const TString& reason)
+ {
+ bool isExpectedStatus = false;
+ for (Ydb::StatusIds::StatusCode exp : expected) {
+ if (result == exp) {
+ isExpectedStatus = true;
+ break;
+ }
+ }
+ if (!isExpectedStatus)
+ Cdbg << "Unexpected status: " << Ydb::StatusIds::StatusCode_Name(result) << ": " << reason << Endl;
+ UNIT_ASSERT_C(isExpectedStatus, "Unexpected status: " << Ydb::StatusIds::StatusCode_Name(result) << ": " << reason);
+ }
+
+ NKikimrIndexBuilder::TEvCancelResponse TestCancelBuildIndex(TTestActorRuntime& runtime, const ui64 id, const ui64 schemeShard, const TString &dbName,
+ const ui64 buildIndexId,
+ const TVector<Ydb::StatusIds::StatusCode>& expectedStatuses)
+ {
+ auto sender = runtime.AllocateEdgeActor();
+ auto request = CreateCancelBuildIndexRequest(id, dbName, buildIndexId);
+
ForwardToTablet(runtime, schemeShard, sender, request);
-
- TAutoPtr<IEventHandle> handle;
- TEvIndexBuilder::TEvCancelResponse* event = runtime.GrabEdgeEvent<TEvIndexBuilder::TEvCancelResponse>(handle);
- UNIT_ASSERT(event);
-
- Cerr << "BUILDINDEX RESPONSE CANCEL: " << event->ToString() << Endl;
- CheckExpected(expectedStatuses, event->Record.GetStatus(), PrintIssues(event->Record.GetIssues()));
-
- return event->Record;
- }
-
-
- TEvIndexBuilder::TEvListRequest* ListBuildIndexRequest(const TString& dbName) {
- return new TEvIndexBuilder::TEvListRequest(dbName, 100, "");
- }
-
- NKikimrIndexBuilder::TEvListResponse TestListBuilIndex(TTestActorRuntime& runtime, ui64 schemeShard, const TString &dbName) {
- auto sender = runtime.AllocateEdgeActor();
- auto request = ListBuildIndexRequest(dbName);
-
+
+ TAutoPtr<IEventHandle> handle;
+ TEvIndexBuilder::TEvCancelResponse* event = runtime.GrabEdgeEvent<TEvIndexBuilder::TEvCancelResponse>(handle);
+ UNIT_ASSERT(event);
+
+ Cerr << "BUILDINDEX RESPONSE CANCEL: " << event->ToString() << Endl;
+ CheckExpected(expectedStatuses, event->Record.GetStatus(), PrintIssues(event->Record.GetIssues()));
+
+ return event->Record;
+ }
+
+
+ TEvIndexBuilder::TEvListRequest* ListBuildIndexRequest(const TString& dbName) {
+ return new TEvIndexBuilder::TEvListRequest(dbName, 100, "");
+ }
+
+ NKikimrIndexBuilder::TEvListResponse TestListBuilIndex(TTestActorRuntime& runtime, ui64 schemeShard, const TString &dbName) {
+ auto sender = runtime.AllocateEdgeActor();
+ auto request = ListBuildIndexRequest(dbName);
+
ForwardToTablet(runtime, schemeShard, sender, request);
-
- TAutoPtr<IEventHandle> handle;
- TEvIndexBuilder::TEvListResponse* event = runtime.GrabEdgeEvent<TEvIndexBuilder::TEvListResponse>(handle);
- UNIT_ASSERT(event);
-
- Cerr << "BUILDINDEX RESPONSE LIST: " << event->ToString() << Endl;
- UNIT_ASSERT_EQUAL_C(event->Record.GetStatus(), 400000, PrintIssues(event->Record.GetIssues()));
- return event->Record;
- }
-
- TEvIndexBuilder::TEvGetRequest* GetBuildIndexRequest(const TString& dbName, ui64 id) {
- return new TEvIndexBuilder::TEvGetRequest(dbName, id);
- }
-
- NKikimrIndexBuilder::TEvGetResponse TestGetBuilIndex(TTestActorRuntime& runtime, ui64 schemeShard, const TString &dbName, ui64 id) {
- auto sender = runtime.AllocateEdgeActor();
- auto request = GetBuildIndexRequest(dbName, id);
-
+
+ TAutoPtr<IEventHandle> handle;
+ TEvIndexBuilder::TEvListResponse* event = runtime.GrabEdgeEvent<TEvIndexBuilder::TEvListResponse>(handle);
+ UNIT_ASSERT(event);
+
+ Cerr << "BUILDINDEX RESPONSE LIST: " << event->ToString() << Endl;
+ UNIT_ASSERT_EQUAL_C(event->Record.GetStatus(), 400000, PrintIssues(event->Record.GetIssues()));
+ return event->Record;
+ }
+
+ TEvIndexBuilder::TEvGetRequest* GetBuildIndexRequest(const TString& dbName, ui64 id) {
+ return new TEvIndexBuilder::TEvGetRequest(dbName, id);
+ }
+
+ NKikimrIndexBuilder::TEvGetResponse TestGetBuilIndex(TTestActorRuntime& runtime, ui64 schemeShard, const TString &dbName, ui64 id) {
+ auto sender = runtime.AllocateEdgeActor();
+ auto request = GetBuildIndexRequest(dbName, id);
+
ForwardToTablet(runtime, schemeShard, sender, request);
-
- TAutoPtr<IEventHandle> handle;
- TEvIndexBuilder::TEvGetResponse* event = runtime.GrabEdgeEvent<TEvIndexBuilder::TEvGetResponse>(handle);
- UNIT_ASSERT(event);
-
- Cerr << "BUILDINDEX RESPONSE Get: " << event->ToString() << Endl;
- UNIT_ASSERT_EQUAL_C(event->Record.GetStatus(), 400000, PrintIssues(event->Record.GetIssues()));
- return event->Record;
- }
-
- TEvIndexBuilder::TEvForgetRequest* ForgetBuildIndexRequest(const ui64 id, const TString &dbName, const ui64 buildIndexId) {
- return new TEvIndexBuilder::TEvForgetRequest(id, dbName, buildIndexId);
- }
-
- NKikimrIndexBuilder::TEvForgetResponse TestForgetBuilIndex(
- TTestActorRuntime& runtime,
- const ui64 id,
- const ui64 schemeShard,
- const TString &dbName,
- const ui64 buildIndexId,
- Ydb::StatusIds::StatusCode expectedStatus)
- {
- auto sender = runtime.AllocateEdgeActor();
- auto request = ForgetBuildIndexRequest(id, dbName, buildIndexId);
-
+
+ TAutoPtr<IEventHandle> handle;
+ TEvIndexBuilder::TEvGetResponse* event = runtime.GrabEdgeEvent<TEvIndexBuilder::TEvGetResponse>(handle);
+ UNIT_ASSERT(event);
+
+ Cerr << "BUILDINDEX RESPONSE Get: " << event->ToString() << Endl;
+ UNIT_ASSERT_EQUAL_C(event->Record.GetStatus(), 400000, PrintIssues(event->Record.GetIssues()));
+ return event->Record;
+ }
+
+ TEvIndexBuilder::TEvForgetRequest* ForgetBuildIndexRequest(const ui64 id, const TString &dbName, const ui64 buildIndexId) {
+ return new TEvIndexBuilder::TEvForgetRequest(id, dbName, buildIndexId);
+ }
+
+ NKikimrIndexBuilder::TEvForgetResponse TestForgetBuilIndex(
+ TTestActorRuntime& runtime,
+ const ui64 id,
+ const ui64 schemeShard,
+ const TString &dbName,
+ const ui64 buildIndexId,
+ Ydb::StatusIds::StatusCode expectedStatus)
+ {
+ auto sender = runtime.AllocateEdgeActor();
+ auto request = ForgetBuildIndexRequest(id, dbName, buildIndexId);
+
ForwardToTablet(runtime, schemeShard, sender, request);
-
- TAutoPtr<IEventHandle> handle;
- TEvIndexBuilder::TEvForgetResponse* event = runtime.GrabEdgeEvent<TEvIndexBuilder::TEvForgetResponse>(handle);
- UNIT_ASSERT(event);
-
- Cerr << "BUILDINDEX RESPONSE Forget: " << event->ToString() << Endl;
- UNIT_ASSERT_EQUAL_C(event->Record.GetStatus(), expectedStatus, PrintIssues(event->Record.GetIssues()));
-
- return event->Record;
- }
-
+
+ TAutoPtr<IEventHandle> handle;
+ TEvIndexBuilder::TEvForgetResponse* event = runtime.GrabEdgeEvent<TEvIndexBuilder::TEvForgetResponse>(handle);
+ UNIT_ASSERT(event);
+
+ Cerr << "BUILDINDEX RESPONSE Forget: " << event->ToString() << Endl;
+ UNIT_ASSERT_EQUAL_C(event->Record.GetStatus(), expectedStatus, PrintIssues(event->Record.GetIssues()));
+
+ return event->Record;
+ }
+
TPathId TestFindTabletSubDomainPathId(
TTestActorRuntime& runtime, ui64 tabletId,
- NKikimrScheme::TEvFindTabletSubDomainPathIdResult::EStatus expected)
+ NKikimrScheme::TEvFindTabletSubDomainPathIdResult::EStatus expected)
{
return TestFindTabletSubDomainPathId(runtime, TTestTxConfig::SchemeShard, tabletId, expected);
}
TPathId TestFindTabletSubDomainPathId(
TTestActorRuntime& runtime, ui64 schemeShard, ui64 tabletId,
- NKikimrScheme::TEvFindTabletSubDomainPathIdResult::EStatus expected)
+ NKikimrScheme::TEvFindTabletSubDomainPathIdResult::EStatus expected)
{
auto sender = runtime.AllocateEdgeActor();
ForwardToTablet(runtime, schemeShard, sender, new TEvSchemeShard::TEvFindTabletSubDomainPathId(tabletId));
- auto ev = runtime.GrabEdgeEvent<TEvSchemeShard::TEvFindTabletSubDomainPathIdResult>(sender);
+ auto ev = runtime.GrabEdgeEvent<TEvSchemeShard::TEvFindTabletSubDomainPathIdResult>(sender);
UNIT_ASSERT(ev);
const auto& record = ev->Get()->Record;
UNIT_ASSERT_EQUAL_C(record.GetStatus(), expected,
"Unexpected status "
- << NKikimrScheme::TEvFindTabletSubDomainPathIdResult::EStatus_Name(record.GetStatus())
+ << NKikimrScheme::TEvFindTabletSubDomainPathIdResult::EStatus_Name(record.GetStatus())
<< " (expected status "
- << NKikimrScheme::TEvFindTabletSubDomainPathIdResult::EStatus_Name(record.GetStatus())
+ << NKikimrScheme::TEvFindTabletSubDomainPathIdResult::EStatus_Name(record.GetStatus())
<< ")");
return TPathId(record.GetSchemeShardId(), record.GetSubDomainPathId());
}
- TEvSchemeShard::TEvModifySchemeTransaction* CreateAlterLoginCreateUser(ui64 txId, const TString& user, const TString& password) {
+ TEvSchemeShard::TEvModifySchemeTransaction* CreateAlterLoginCreateUser(ui64 txId, const TString& user, const TString& password) {
auto evTx = new TEvSchemeShard::TEvModifySchemeTransaction(txId, TTestTxConfig::SchemeShard);
- auto transaction = evTx->Record.AddTransaction();
- transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterLogin);
+ auto transaction = evTx->Record.AddTransaction();
+ transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterLogin);
auto createUser = transaction->MutableAlterLogin()->MutableCreateUser();
createUser->SetUser(user);
createUser->SetPassword(password);
return evTx;
}
- NKikimrScheme::TEvLoginResult Login(TTestActorRuntime& runtime, const TString& user, const TString& password) {
+ NKikimrScheme::TEvLoginResult Login(TTestActorRuntime& runtime, const TString& user, const TString& password) {
TActorId sender = runtime.AllocateEdgeActor();
- auto evLogin = new TEvSchemeShard::TEvLogin();
+ auto evLogin = new TEvSchemeShard::TEvLogin();
evLogin->Record.SetUser(user);
evLogin->Record.SetPassword(password);
ForwardToTablet(runtime, TTestTxConfig::SchemeShard, sender, evLogin);
TAutoPtr<IEventHandle> handle;
- auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvLoginResult>(handle);
+ auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvLoginResult>(handle);
UNIT_ASSERT(event);
return event->Record;
}
- // class TFakeDataReq {
- TFakeDataReq::TFakeDataReq(NActors::TTestActorRuntime &runtime, ui64 txId, const TString &table, const TString &query)
- : Runtime(runtime)
- , Env(Alloc)
- , TxId(txId)
- , Table(table)
- , Query(query)
- {
- Alloc.Release();
- }
-
- TFakeDataReq::~TFakeDataReq() {
- Engine.Destroy();
- Alloc.Acquire();
- }
-
- NMiniKQL::IEngineFlat::EStatus TFakeDataReq::Propose(bool immediate, bool &activeZone, ui32 txFlags) {
- NMiniKQL::TRuntimeNode pgm = ProgramText2Bin(Query);
-
- NMiniKQL::TEngineFlatSettings settings(NMiniKQL::IEngineFlat::EProtocol::V1,
- Runtime.GetAppData().FunctionRegistry,
- *TAppData::RandomProvider, *TAppData::TimeProvider);
- settings.BacktraceWriter = [](const char* operation, ui32 line, const TBackTrace* backtrace) {
- Cerr << "\nEngine backtrace, operation: " << operation << " (" << line << ")\n";
- if (backtrace) {
- backtrace->PrintTo(Cerr);
- }
- };
-
- NKikimrTxDataShard::ETransactionKind kind = NKikimrTxDataShard::TX_KIND_DATA;
- Engine = CreateEngineFlat(settings);
- auto result = Engine->SetProgram(SerializeRuntimeNode(pgm, Env));
- UNIT_ASSERT_EQUAL_C(result, NMiniKQL::IEngineFlat::EResult::Ok, Engine->GetErrors());
- auto& dbKeys = Engine->GetDbKeys();
- TSet<ui64> resolvedShards;
- for (auto& dbKey : dbKeys) {
- ResolveKey(*dbKey);
- UNIT_ASSERT(dbKey->Status == TKeyDesc::EStatus::Ok);
- for (auto& partition : dbKey->Partitions) {
- resolvedShards.insert(partition.ShardId);
- }
- }
-
- result = Engine->PrepareShardPrograms();
- if (result != NMiniKQL::IEngineFlat::EResult::Ok) {
- Cerr << Engine->GetErrors() << Endl;
- return NMiniKQL::IEngineFlat::EStatus::Error;
- }
-
- const ui32 shardsCount = Engine->GetAffectedShardCount();
- UNIT_ASSERT_VALUES_EQUAL(shardsCount, resolvedShards.size());
- bool hasErrors = false;
- for (ui32 i = 0; i < shardsCount; ++i) {
- NMiniKQL::IEngineFlat::TShardData shardData;
- result = Engine->GetAffectedShard(i, shardData);
- UNIT_ASSERT_EQUAL_C(result, NMiniKQL::IEngineFlat::EResult::Ok, Engine->GetErrors());
- NKikimrTxDataShard::TDataTransaction tx;
- tx.SetMiniKQL(shardData.Program);
- tx.SetImmediate(immediate && shardData.Immediate);
- auto txBody = tx.SerializeAsString();
-
- TActorId sender = Runtime.AllocateEdgeActor();
- for (;;) {
- auto proposal = new TEvDataShard::TEvProposeTransaction(kind, sender, TxId, txBody, txFlags);
-
- activeZone = false;
- Runtime.SendToPipe(shardData.ShardId, sender, proposal);
- TAutoPtr<IEventHandle> handle;
- auto event = Runtime.GrabEdgeEventIf<TEvDataShard::TEvProposeTransactionResult>(handle,
- [=](const TEvDataShard::TEvProposeTransactionResult& event) {
- return event.GetTxId() == TxId && event.GetOrigin() == shardData.ShardId;
- });
- activeZone = true;
-
- UNIT_ASSERT(event);
- UNIT_ASSERT_EQUAL(event->GetTxKind(), kind);
- if (event->GetStatus() == NKikimrTxDataShard::TEvProposeTransactionResult::TRY_LATER)
- continue;
-
- if (event->GetStatus() == NKikimrTxDataShard::TEvProposeTransactionResult::ERROR ||
- event->GetStatus() == NKikimrTxDataShard::TEvProposeTransactionResult::OVERLOADED)
- {
- hasErrors = true;
- for (auto err : event->Record.GetError()) {
- Cerr << "DataShard error: " << shardData.ShardId << ", kind: " <<
- NKikimrTxDataShard::TError::EKind_Name(err.GetKind()) << ", reason: " << err.GetReason() << Endl;
- Errors[shardData.ShardId].push_back(err);
- }
-
- break;
- }
-
- if (event->GetStatus() == NKikimrTxDataShard::TEvProposeTransactionResult::COMPLETE) {
- Engine->AddShardReply(event->GetOrigin(), event->Record.GetTxResult());
- Engine->FinalizeOriginReplies(shardData.ShardId);
- break;
- }
-
- UNIT_ASSERT_VALUES_EQUAL_C(event->GetStatus(), NKikimrTxDataShard::TEvProposeTransactionResult::PREPARED, "Unexpected Propose result");
- AffectedShards.push_back(shardData.ShardId);
- break;
- }
- }
-
- if (hasErrors) {
- return NMiniKQL::IEngineFlat::EStatus::Error;
- }
-
- Engine->AfterShardProgramsExtracted();
- if (!AffectedShards.empty())
- return NMiniKQL::IEngineFlat::EStatus::Unknown;
-
- Engine->BuildResult();
- if (Engine->GetStatus() == NMiniKQL::IEngineFlat::EStatus::Error) {
- Cerr << Engine->GetErrors() << Endl;
- }
-
- return Engine->GetStatus();
- }
-
- void TFakeDataReq::Plan(ui64 coordinatorId) {
- TActorId sender = Runtime.AllocateEdgeActor();
-
- ui64 minStep = 0;
- ui64 maxStep = Max<ui64>(); // unlimited
- ui8 execLevel = 0;
-
- THolder<TEvTxProxy::TEvProposeTransaction> ex(
- new TEvTxProxy::TEvProposeTransaction(coordinatorId, TxId, execLevel, minStep, maxStep));
-
- auto *reqAffectedSet = ex->Record.MutableTransaction()->MutableAffectedSet();
- reqAffectedSet->Reserve(AffectedShards.size());
- for (auto affectedTablet : AffectedShards) {
- auto *x = reqAffectedSet->Add();
- x->SetTabletId(affectedTablet);
- x->SetFlags(2 /*todo: use generic enum*/);
- }
-
- Runtime.SendToPipe(coordinatorId, sender, ex.Release());
- }
-
- NMiniKQL::TRuntimeNode TFakeDataReq::ProgramText2Bin(const TString &query) {
- auto expr = NYql::ParseText(query);
-
- TMockDbSchemeResolver dbSchemeResolver;
- FillTableInfo(dbSchemeResolver);
-
- auto resFuture = NYql::ConvertToMiniKQL(
- expr, Runtime.GetAppData().FunctionRegistry,
- &Env, &dbSchemeResolver
- );
-
- const TDuration TIME_LIMIT = TDuration::Seconds(60);
- NYql::TConvertResult res = resFuture.GetValue(TIME_LIMIT);
- res.Errors.PrintTo(Cerr);
- UNIT_ASSERT(res.Node.GetNode());
- return res.Node;
- }
-
- void TFakeDataReq::FillTableInfo(TMockDbSchemeResolver &dbSchemeResolver) const {
- // Synchronously get table description from SS
- auto fnFIllInfo = [this, &dbSchemeResolver] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
-
- using namespace NYql;
- using TColumn = IDbSchemeResolver::TTableResult::TColumn;
-
- const auto& pathDesc = record.GetPathDescription();
- const auto& tdesc = pathDesc.GetTable();
-
- IDbSchemeResolver::TTableResult table(IDbSchemeResolver::TTableResult::Ok);
- table.Table.TableName = Table;
- table.TableId.Reset(new TTableId(pathDesc.GetSelf().GetSchemeshardId(), pathDesc.GetSelf().GetPathId()));
- table.KeyColumnCount = tdesc.KeyColumnIdsSize();
- for (size_t i = 0; i < tdesc.ColumnsSize(); i++) {
- auto& c = tdesc.GetColumns(i);
- table.Table.ColumnNames.insert(c.GetName());
- i32 keyIdx = -1;
- for (size_t ki = 0; ki < tdesc.KeyColumnIdsSize(); ki++) {
- if (tdesc.GetKeyColumnIds(ki) == c.GetId()) {
- keyIdx = ki;
- }
- }
- table.Columns.insert(std::make_pair(c.GetName(), TColumn{c.GetId(), keyIdx, c.GetTypeId(), 0}));
- }
- dbSchemeResolver.AddTable(table);
- };
-
- TestLs(Runtime, Table, true, fnFIllInfo);
- }
-
- void TFakeDataReq::FillTablePartitioningInfo() {
- auto fnFillInfo = [this] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
-
- const auto& pathDesc = record.GetPathDescription();
- const auto& tdesc = pathDesc.GetTable();
-
- // Cout << pathDesc << Endl;
- std::unordered_map<ui32, NScheme::TTypeId> columnId2Type;
- for (size_t i = 0; i < tdesc.ColumnsSize(); ++i) {
- ui32 id = tdesc.GetColumns(i).GetId();
- ui16 typeId = tdesc.GetColumns(i).GetTypeId();
- columnId2Type[id] = typeId;
- }
-
- for (size_t i = 0; i < tdesc.KeyColumnIdsSize(); ++i) {
- ui32 id = tdesc.GetKeyColumnIds(i);
- NScheme::TTypeId typeId = columnId2Type[id];
- TablePartitioningInfo.KeyColumnTypes.push_back(typeId);
- }
-
- for (size_t i = 0; i < pathDesc.TablePartitionsSize(); ++i) {
- const auto& pi = pathDesc.GetTablePartitions(i);
- TablePartitioningInfo.Partitioning.push_back(TTablePartitioningInfo::TBorder());
- TablePartitioningInfo.Partitioning.back().KeyTuple = TSerializedCellVec(pi.GetEndOfRangeKeyPrefix());
- TablePartitioningInfo.Partitioning.back().Inclusive = pi.GetIsInclusive();
- TablePartitioningInfo.Partitioning.back().Point = pi.GetIsPoint();
- TablePartitioningInfo.Partitioning.back().Defined = true;
- TablePartitioningInfo.Partitioning.back().Datashard = pi.GetDatashardId();
- }
- };
-
- TestLs(Runtime, Table, true, fnFillInfo);
- }
-
- void TFakeDataReq::TTablePartitioningInfo::ResolveKey(const TTableRange &range, TVector<TKeyDesc::TPartitionInfo> &partitions) const {
- Y_VERIFY(!Partitioning.empty());
-
- partitions.clear();
-
- // Temporary fix: for an empty range we need to return some datashard so that it can handle readset logic (
- // send empty result to other tx participants etc.)
- if (range.IsEmptyRange(KeyColumnTypes)) {
- partitions.push_back(TKeyDesc::TPartitionInfo(Partitioning.begin()->Datashard));
- return;
- }
-
- TVector<TBorder>::const_iterator low = LowerBound(Partitioning.begin(), Partitioning.end(), true,
- [&](const TBorder &left, bool) {
- const int compares = CompareBorders<true, false>(left.KeyTuple.GetCells(), range.From, left.Inclusive || left.Point, range.InclusiveFrom || range.Point, KeyColumnTypes);
- return (compares < 0);
- });
-
- Y_VERIFY(low != Partitioning.end(), "last key must be (inf)");
- do {
- partitions.push_back(TKeyDesc::TPartitionInfo(low->Datashard));
-
- if (range.Point)
- return;
-
- int prevComp = CompareBorders<true, true>(low->KeyTuple.GetCells(), range.To, low->Point || low->Inclusive, range.InclusiveTo, KeyColumnTypes);
- if (prevComp >= 0)
- return;
- } while (++low != Partitioning.end());
- }
-
- TEvSchemeShard::TEvModifySchemeTransaction* CombineSchemeTransactions(const TVector<TEvSchemeShard::TEvModifySchemeTransaction*>& transactions) {
- ui64 txId = 0;
- ui64 tabletId = 0;
- if (transactions) {
- txId = transactions.front()->Record.GetTxId();
- tabletId = transactions.front()->Record.GetTabletId();
- }
- TEvSchemeShard::TEvModifySchemeTransaction* combination = new TEvSchemeShard::TEvModifySchemeTransaction(txId, tabletId);
- for ( auto& modifyTx: transactions) {
- for (const auto& tx: modifyTx->Record.GetTransaction()) {
- *combination->Record.AddTransaction() = tx;
- }
- delete modifyTx;
- }
- return combination;
- }
-
- void AsyncSendTransaction(TTestActorRuntime &runtime, ui64 schemeShard, TEvSchemeShard::TEvModifySchemeTransaction *evTx) {
+ // class TFakeDataReq {
+ TFakeDataReq::TFakeDataReq(NActors::TTestActorRuntime &runtime, ui64 txId, const TString &table, const TString &query)
+ : Runtime(runtime)
+ , Env(Alloc)
+ , TxId(txId)
+ , Table(table)
+ , Query(query)
+ {
+ Alloc.Release();
+ }
+
+ TFakeDataReq::~TFakeDataReq() {
+ Engine.Destroy();
+ Alloc.Acquire();
+ }
+
+ NMiniKQL::IEngineFlat::EStatus TFakeDataReq::Propose(bool immediate, bool &activeZone, ui32 txFlags) {
+ NMiniKQL::TRuntimeNode pgm = ProgramText2Bin(Query);
+
+ NMiniKQL::TEngineFlatSettings settings(NMiniKQL::IEngineFlat::EProtocol::V1,
+ Runtime.GetAppData().FunctionRegistry,
+ *TAppData::RandomProvider, *TAppData::TimeProvider);
+ settings.BacktraceWriter = [](const char* operation, ui32 line, const TBackTrace* backtrace) {
+ Cerr << "\nEngine backtrace, operation: " << operation << " (" << line << ")\n";
+ if (backtrace) {
+ backtrace->PrintTo(Cerr);
+ }
+ };
+
+ NKikimrTxDataShard::ETransactionKind kind = NKikimrTxDataShard::TX_KIND_DATA;
+ Engine = CreateEngineFlat(settings);
+ auto result = Engine->SetProgram(SerializeRuntimeNode(pgm, Env));
+ UNIT_ASSERT_EQUAL_C(result, NMiniKQL::IEngineFlat::EResult::Ok, Engine->GetErrors());
+ auto& dbKeys = Engine->GetDbKeys();
+ TSet<ui64> resolvedShards;
+ for (auto& dbKey : dbKeys) {
+ ResolveKey(*dbKey);
+ UNIT_ASSERT(dbKey->Status == TKeyDesc::EStatus::Ok);
+ for (auto& partition : dbKey->Partitions) {
+ resolvedShards.insert(partition.ShardId);
+ }
+ }
+
+ result = Engine->PrepareShardPrograms();
+ if (result != NMiniKQL::IEngineFlat::EResult::Ok) {
+ Cerr << Engine->GetErrors() << Endl;
+ return NMiniKQL::IEngineFlat::EStatus::Error;
+ }
+
+ const ui32 shardsCount = Engine->GetAffectedShardCount();
+ UNIT_ASSERT_VALUES_EQUAL(shardsCount, resolvedShards.size());
+ bool hasErrors = false;
+ for (ui32 i = 0; i < shardsCount; ++i) {
+ NMiniKQL::IEngineFlat::TShardData shardData;
+ result = Engine->GetAffectedShard(i, shardData);
+ UNIT_ASSERT_EQUAL_C(result, NMiniKQL::IEngineFlat::EResult::Ok, Engine->GetErrors());
+ NKikimrTxDataShard::TDataTransaction tx;
+ tx.SetMiniKQL(shardData.Program);
+ tx.SetImmediate(immediate && shardData.Immediate);
+ auto txBody = tx.SerializeAsString();
+
+ TActorId sender = Runtime.AllocateEdgeActor();
+ for (;;) {
+ auto proposal = new TEvDataShard::TEvProposeTransaction(kind, sender, TxId, txBody, txFlags);
+
+ activeZone = false;
+ Runtime.SendToPipe(shardData.ShardId, sender, proposal);
+ TAutoPtr<IEventHandle> handle;
+ auto event = Runtime.GrabEdgeEventIf<TEvDataShard::TEvProposeTransactionResult>(handle,
+ [=](const TEvDataShard::TEvProposeTransactionResult& event) {
+ return event.GetTxId() == TxId && event.GetOrigin() == shardData.ShardId;
+ });
+ activeZone = true;
+
+ UNIT_ASSERT(event);
+ UNIT_ASSERT_EQUAL(event->GetTxKind(), kind);
+ if (event->GetStatus() == NKikimrTxDataShard::TEvProposeTransactionResult::TRY_LATER)
+ continue;
+
+ if (event->GetStatus() == NKikimrTxDataShard::TEvProposeTransactionResult::ERROR ||
+ event->GetStatus() == NKikimrTxDataShard::TEvProposeTransactionResult::OVERLOADED)
+ {
+ hasErrors = true;
+ for (auto err : event->Record.GetError()) {
+ Cerr << "DataShard error: " << shardData.ShardId << ", kind: " <<
+ NKikimrTxDataShard::TError::EKind_Name(err.GetKind()) << ", reason: " << err.GetReason() << Endl;
+ Errors[shardData.ShardId].push_back(err);
+ }
+
+ break;
+ }
+
+ if (event->GetStatus() == NKikimrTxDataShard::TEvProposeTransactionResult::COMPLETE) {
+ Engine->AddShardReply(event->GetOrigin(), event->Record.GetTxResult());
+ Engine->FinalizeOriginReplies(shardData.ShardId);
+ break;
+ }
+
+ UNIT_ASSERT_VALUES_EQUAL_C(event->GetStatus(), NKikimrTxDataShard::TEvProposeTransactionResult::PREPARED, "Unexpected Propose result");
+ AffectedShards.push_back(shardData.ShardId);
+ break;
+ }
+ }
+
+ if (hasErrors) {
+ return NMiniKQL::IEngineFlat::EStatus::Error;
+ }
+
+ Engine->AfterShardProgramsExtracted();
+ if (!AffectedShards.empty())
+ return NMiniKQL::IEngineFlat::EStatus::Unknown;
+
+ Engine->BuildResult();
+ if (Engine->GetStatus() == NMiniKQL::IEngineFlat::EStatus::Error) {
+ Cerr << Engine->GetErrors() << Endl;
+ }
+
+ return Engine->GetStatus();
+ }
+
+ void TFakeDataReq::Plan(ui64 coordinatorId) {
+ TActorId sender = Runtime.AllocateEdgeActor();
+
+ ui64 minStep = 0;
+ ui64 maxStep = Max<ui64>(); // unlimited
+ ui8 execLevel = 0;
+
+ THolder<TEvTxProxy::TEvProposeTransaction> ex(
+ new TEvTxProxy::TEvProposeTransaction(coordinatorId, TxId, execLevel, minStep, maxStep));
+
+ auto *reqAffectedSet = ex->Record.MutableTransaction()->MutableAffectedSet();
+ reqAffectedSet->Reserve(AffectedShards.size());
+ for (auto affectedTablet : AffectedShards) {
+ auto *x = reqAffectedSet->Add();
+ x->SetTabletId(affectedTablet);
+ x->SetFlags(2 /*todo: use generic enum*/);
+ }
+
+ Runtime.SendToPipe(coordinatorId, sender, ex.Release());
+ }
+
+ NMiniKQL::TRuntimeNode TFakeDataReq::ProgramText2Bin(const TString &query) {
+ auto expr = NYql::ParseText(query);
+
+ TMockDbSchemeResolver dbSchemeResolver;
+ FillTableInfo(dbSchemeResolver);
+
+ auto resFuture = NYql::ConvertToMiniKQL(
+ expr, Runtime.GetAppData().FunctionRegistry,
+ &Env, &dbSchemeResolver
+ );
+
+ const TDuration TIME_LIMIT = TDuration::Seconds(60);
+ NYql::TConvertResult res = resFuture.GetValue(TIME_LIMIT);
+ res.Errors.PrintTo(Cerr);
+ UNIT_ASSERT(res.Node.GetNode());
+ return res.Node;
+ }
+
+ void TFakeDataReq::FillTableInfo(TMockDbSchemeResolver &dbSchemeResolver) const {
+ // Synchronously get table description from SS
+ auto fnFIllInfo = [this, &dbSchemeResolver] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
+
+ using namespace NYql;
+ using TColumn = IDbSchemeResolver::TTableResult::TColumn;
+
+ const auto& pathDesc = record.GetPathDescription();
+ const auto& tdesc = pathDesc.GetTable();
+
+ IDbSchemeResolver::TTableResult table(IDbSchemeResolver::TTableResult::Ok);
+ table.Table.TableName = Table;
+ table.TableId.Reset(new TTableId(pathDesc.GetSelf().GetSchemeshardId(), pathDesc.GetSelf().GetPathId()));
+ table.KeyColumnCount = tdesc.KeyColumnIdsSize();
+ for (size_t i = 0; i < tdesc.ColumnsSize(); i++) {
+ auto& c = tdesc.GetColumns(i);
+ table.Table.ColumnNames.insert(c.GetName());
+ i32 keyIdx = -1;
+ for (size_t ki = 0; ki < tdesc.KeyColumnIdsSize(); ki++) {
+ if (tdesc.GetKeyColumnIds(ki) == c.GetId()) {
+ keyIdx = ki;
+ }
+ }
+ table.Columns.insert(std::make_pair(c.GetName(), TColumn{c.GetId(), keyIdx, c.GetTypeId(), 0}));
+ }
+ dbSchemeResolver.AddTable(table);
+ };
+
+ TestLs(Runtime, Table, true, fnFIllInfo);
+ }
+
+ void TFakeDataReq::FillTablePartitioningInfo() {
+ auto fnFillInfo = [this] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
+
+ const auto& pathDesc = record.GetPathDescription();
+ const auto& tdesc = pathDesc.GetTable();
+
+ // Cout << pathDesc << Endl;
+ std::unordered_map<ui32, NScheme::TTypeId> columnId2Type;
+ for (size_t i = 0; i < tdesc.ColumnsSize(); ++i) {
+ ui32 id = tdesc.GetColumns(i).GetId();
+ ui16 typeId = tdesc.GetColumns(i).GetTypeId();
+ columnId2Type[id] = typeId;
+ }
+
+ for (size_t i = 0; i < tdesc.KeyColumnIdsSize(); ++i) {
+ ui32 id = tdesc.GetKeyColumnIds(i);
+ NScheme::TTypeId typeId = columnId2Type[id];
+ TablePartitioningInfo.KeyColumnTypes.push_back(typeId);
+ }
+
+ for (size_t i = 0; i < pathDesc.TablePartitionsSize(); ++i) {
+ const auto& pi = pathDesc.GetTablePartitions(i);
+ TablePartitioningInfo.Partitioning.push_back(TTablePartitioningInfo::TBorder());
+ TablePartitioningInfo.Partitioning.back().KeyTuple = TSerializedCellVec(pi.GetEndOfRangeKeyPrefix());
+ TablePartitioningInfo.Partitioning.back().Inclusive = pi.GetIsInclusive();
+ TablePartitioningInfo.Partitioning.back().Point = pi.GetIsPoint();
+ TablePartitioningInfo.Partitioning.back().Defined = true;
+ TablePartitioningInfo.Partitioning.back().Datashard = pi.GetDatashardId();
+ }
+ };
+
+ TestLs(Runtime, Table, true, fnFillInfo);
+ }
+
+ void TFakeDataReq::TTablePartitioningInfo::ResolveKey(const TTableRange &range, TVector<TKeyDesc::TPartitionInfo> &partitions) const {
+ Y_VERIFY(!Partitioning.empty());
+
+ partitions.clear();
+
+ // Temporary fix: for an empty range we need to return some datashard so that it can handle readset logic (
+ // send empty result to other tx participants etc.)
+ if (range.IsEmptyRange(KeyColumnTypes)) {
+ partitions.push_back(TKeyDesc::TPartitionInfo(Partitioning.begin()->Datashard));
+ return;
+ }
+
+ TVector<TBorder>::const_iterator low = LowerBound(Partitioning.begin(), Partitioning.end(), true,
+ [&](const TBorder &left, bool) {
+ const int compares = CompareBorders<true, false>(left.KeyTuple.GetCells(), range.From, left.Inclusive || left.Point, range.InclusiveFrom || range.Point, KeyColumnTypes);
+ return (compares < 0);
+ });
+
+ Y_VERIFY(low != Partitioning.end(), "last key must be (inf)");
+ do {
+ partitions.push_back(TKeyDesc::TPartitionInfo(low->Datashard));
+
+ if (range.Point)
+ return;
+
+ int prevComp = CompareBorders<true, true>(low->KeyTuple.GetCells(), range.To, low->Point || low->Inclusive, range.InclusiveTo, KeyColumnTypes);
+ if (prevComp >= 0)
+ return;
+ } while (++low != Partitioning.end());
+ }
+
+ TEvSchemeShard::TEvModifySchemeTransaction* CombineSchemeTransactions(const TVector<TEvSchemeShard::TEvModifySchemeTransaction*>& transactions) {
+ ui64 txId = 0;
+ ui64 tabletId = 0;
+ if (transactions) {
+ txId = transactions.front()->Record.GetTxId();
+ tabletId = transactions.front()->Record.GetTabletId();
+ }
+ TEvSchemeShard::TEvModifySchemeTransaction* combination = new TEvSchemeShard::TEvModifySchemeTransaction(txId, tabletId);
+ for ( auto& modifyTx: transactions) {
+ for (const auto& tx: modifyTx->Record.GetTransaction()) {
+ *combination->Record.AddTransaction() = tx;
+ }
+ delete modifyTx;
+ }
+ return combination;
+ }
+
+ void AsyncSendTransaction(TTestActorRuntime &runtime, ui64 schemeShard, TEvSchemeShard::TEvModifySchemeTransaction *evTx) {
ForwardToTablet(runtime, schemeShard, runtime.AllocateEdgeActor(), evTx);
- }
-
- TTestActorRuntimeBase::TEventObserver SetSuppressObserver(TTestActorRuntime &runtime, TVector<THolder<IEventHandle> > &suppressed, ui32 type) {
- return runtime.SetObserverFunc([&suppressed, type](TTestActorRuntimeBase&, TAutoPtr<IEventHandle>& ev) {
- if (ev->GetTypeRewrite() == type) {
+ }
+
+ TTestActorRuntimeBase::TEventObserver SetSuppressObserver(TTestActorRuntime &runtime, TVector<THolder<IEventHandle> > &suppressed, ui32 type) {
+ return runtime.SetObserverFunc([&suppressed, type](TTestActorRuntimeBase&, TAutoPtr<IEventHandle>& ev) {
+ if (ev->GetTypeRewrite() == type) {
suppressed.push_back(std::move(ev));
- return TTestActorRuntime::EEventAction::DROP;
- }
- return TTestActorRuntime::EEventAction::PROCESS;
- });
- }
-
- void WaitForSuppressed(TTestActorRuntime &runtime, TVector<THolder<IEventHandle> > &suppressed, ui32 count, TTestActorRuntimeBase::TEventObserver prevObserver) {
- Y_VERIFY_S(suppressed.size() <= count, "suppressed.size(): " << suppressed.size() << " expected " << count);
-
- if (suppressed.size() < count) {
- TDispatchOptions opts;
- opts.FinalEvents.emplace_back(TDispatchOptions::TFinalEventCondition([&](IEventHandle&) -> bool {
- return suppressed.size() >= count;
- }));
- runtime.DispatchEvents(opts);
- }
-
- runtime.SetObserverFunc(prevObserver);
- }
+ return TTestActorRuntime::EEventAction::DROP;
+ }
+ return TTestActorRuntime::EEventAction::PROCESS;
+ });
+ }
+
+ void WaitForSuppressed(TTestActorRuntime &runtime, TVector<THolder<IEventHandle> > &suppressed, ui32 count, TTestActorRuntimeBase::TEventObserver prevObserver) {
+ Y_VERIFY_S(suppressed.size() <= count, "suppressed.size(): " << suppressed.size() << " expected " << count);
+
+ if (suppressed.size() < count) {
+ TDispatchOptions opts;
+ opts.FinalEvents.emplace_back(TDispatchOptions::TFinalEventCondition([&](IEventHandle&) -> bool {
+ return suppressed.size() >= count;
+ }));
+ runtime.DispatchEvents(opts);
+ }
+
+ runtime.SetObserverFunc(prevObserver);
+ }
}
diff --git a/ydb/core/tx/schemeshard/ut_helpers/helpers.h b/ydb/core/tx/schemeshard/ut_helpers/helpers.h
index 27f9def5497..6b12c25534a 100644
--- a/ydb/core/tx/schemeshard/ut_helpers/helpers.h
+++ b/ydb/core/tx/schemeshard/ut_helpers/helpers.h
@@ -1,7 +1,7 @@
#pragma once
#include "ls_checks.h"
-#include "test_env.h"
+#include "test_env.h"
#include <library/cpp/testing/unittest/registar.h>
@@ -15,7 +15,7 @@
#include <ydb/core/tx/schemeshard/schemeshard_types.h>
#include <ydb/library/yql/minikql/mkql_alloc.h>
#include <ydb/library/yql/minikql/mkql_node_serialization.h>
-
+
#include <util/stream/null.h>
#include <functional>
@@ -28,11 +28,11 @@
#endif
namespace NSchemeShardUT_Private {
- using namespace NKikimr;
+ using namespace NKikimr;
using TEvTx = TEvSchemeShard::TEvModifySchemeTransaction;
- ////////// tablet
+ ////////// tablet
NKikimrProto::EReplyStatus LocalMiniKQL(TTestActorRuntime& runtime, ui64 tabletId, const TString& query, NKikimrMiniKQL::TResult& result, TString& err);
NKikimrMiniKQL::TResult LocalMiniKQL(TTestActorRuntime& runtime, ui64 tabletId, const TString& query);
NKikimrProto::EReplyStatus LocalSchemeTx(TTestActorRuntime& runtime, ui64 tabletId, const TString& schemeChangesStr, bool dryRun, NTabletFlatScheme::TSchemeChanges& scheme, TString& err);
@@ -40,7 +40,7 @@ namespace NSchemeShardUT_Private {
bool CheckLocalRowExists(TTestActorRuntime& runtime, ui64 tabletId, const TString& tableName, const TString& keyColumn, ui64 keyValue);
////////// describe options
- struct TDescribeOptionsBuilder : public NKikimrSchemeOp::TDescribeOptions {
+ struct TDescribeOptionsBuilder : public NKikimrSchemeOp::TDescribeOptions {
TDescribeOptionsBuilder& SetReturnPartitioningInfo(bool value) { TDescribeOptions::SetReturnPartitioningInfo(value); return *this; }
TDescribeOptionsBuilder& SetReturnPartitionConfig(bool value) { TDescribeOptions::SetReturnPartitionConfig(value); return *this; }
TDescribeOptionsBuilder& SetBackupInfo(bool value) { TDescribeOptions::SetBackupInfo(value); return *this; }
@@ -48,33 +48,33 @@ namespace NSchemeShardUT_Private {
TDescribeOptionsBuilder& SetShowPrivateTable(bool value) { TDescribeOptions::SetShowPrivateTable(value); return *this; }
};
- ////////// describe
- NKikimrScheme::TEvDescribeSchemeResult DescribePath(TTestActorRuntime& runtime, ui64 schemeShard, const TString& path, const NKikimrSchemeOp::TDescribeOptions& opts);
- NKikimrScheme::TEvDescribeSchemeResult DescribePath(TTestActorRuntime& runtime, const TString& path, const NKikimrSchemeOp::TDescribeOptions& opts);
+ ////////// describe
+ NKikimrScheme::TEvDescribeSchemeResult DescribePath(TTestActorRuntime& runtime, ui64 schemeShard, const TString& path, const NKikimrSchemeOp::TDescribeOptions& opts);
+ NKikimrScheme::TEvDescribeSchemeResult DescribePath(TTestActorRuntime& runtime, const TString& path, const NKikimrSchemeOp::TDescribeOptions& opts);
NKikimrScheme::TEvDescribeSchemeResult DescribePrivatePath(TTestActorRuntime& runtime, ui64 schemeShard, const TString& path, bool returnPartitioning = false, bool returnBoundaries = false);
NKikimrScheme::TEvDescribeSchemeResult DescribePrivatePath(TTestActorRuntime& runtime, const TString& path, bool returnPartitioning = false, bool returnBoundaries = false);
NKikimrScheme::TEvDescribeSchemeResult DescribePath(TTestActorRuntime& runtime, ui64 schemeShard, const TString& path, bool returnPartitioning = false, bool returnBoundaries = false, bool showPrivate = false, bool returnBackups = false);
NKikimrScheme::TEvDescribeSchemeResult DescribePath(TTestActorRuntime& runtime, const TString& path, bool returnPartitioning = false, bool returnBoundaries = false, bool showPrivate = false, bool returnBackups = false);
- TPathVersion ExtructPathVersion(const NKikimrScheme::TEvDescribeSchemeResult& describe);
- TPathVersion TestDescribeResult(const NKikimrScheme::TEvDescribeSchemeResult& describe, TVector<NLs::TCheckFunc> checks = {});
-
- TString TestDescribe(TTestActorRuntime& runtime, const TString& path);
- TString TestLs(TTestActorRuntime& runtime, const TString& path, bool returnPartitioningInfo = false, NLs::TCheckFunc check = nullptr);
- TString TestLs(TTestActorRuntime& runtime, const TString& path, const NKikimrSchemeOp::TDescribeOptions& opts, NLs::TCheckFunc check = nullptr);
+ TPathVersion ExtructPathVersion(const NKikimrScheme::TEvDescribeSchemeResult& describe);
+ TPathVersion TestDescribeResult(const NKikimrScheme::TEvDescribeSchemeResult& describe, TVector<NLs::TCheckFunc> checks = {});
+
+ TString TestDescribe(TTestActorRuntime& runtime, const TString& path);
+ TString TestLs(TTestActorRuntime& runtime, const TString& path, bool returnPartitioningInfo = false, NLs::TCheckFunc check = nullptr);
+ TString TestLs(TTestActorRuntime& runtime, const TString& path, const NKikimrSchemeOp::TDescribeOptions& opts, NLs::TCheckFunc check = nullptr);
TString TestLsPathId(TTestActorRuntime& runtime, ui64 pathId, NLs::TCheckFunc check = nullptr);
- ////////// modification results
- void CheckExpected(const TVector<TEvSchemeShard::EStatus>& expected, TEvSchemeShard::EStatus result, const TString& reason);
+ ////////// modification results
+ void CheckExpected(const TVector<TEvSchemeShard::EStatus>& expected, TEvSchemeShard::EStatus result, const TString& reason);
void CheckExpected(const TVector<Ydb::StatusIds::StatusCode>& expected, Ydb::StatusIds::StatusCode result, const TString& reason);
- void TestModificationResult(TTestActorRuntime& runtime, ui64 txId,TEvSchemeShard::EStatus expectedResult = NKikimrScheme::StatusAccepted);
- ui64 TestModificationResults(TTestActorRuntime& runtime, ui64 txId, const TVector<TEvSchemeShard::EStatus>& expectedResults);
- void SkipModificationReply(TTestActorRuntime& runtime, ui32 num = 1);
+ void TestModificationResult(TTestActorRuntime& runtime, ui64 txId,TEvSchemeShard::EStatus expectedResult = NKikimrScheme::StatusAccepted);
+ ui64 TestModificationResults(TTestActorRuntime& runtime, ui64 txId, const TVector<TEvSchemeShard::EStatus>& expectedResults);
+ void SkipModificationReply(TTestActorRuntime& runtime, ui32 num = 1);
TEvTx* CombineSchemeTransactions(const TVector<TEvTx*>& transactions);
void AsyncSendTransaction(TTestActorRuntime& runtime, ui64 schemeShard, TEvTx* evTx);
-
+
////////// generic
-
+
#define UT_GENERIC_PARAMS \
const TString& parentPath, const TString& scheme
#define UT_PARAMS_BY_PATH_ID \
@@ -89,11 +89,11 @@ namespace NSchemeShardUT_Private {
const TVector<TEvSchemeShard::EStatus>& expectedResults = {NKikimrScheme::StatusAccepted}, __VA_ARGS__); \
ui64 Test##name(TTestActorRuntime& runtime, ui64 txId, params, \
const TVector<TEvSchemeShard::EStatus>& expectedResults = {NKikimrScheme::StatusAccepted}, __VA_ARGS__)
-
+
#define GENERIC_HELPERS(name) DEFINE_HELPERS(name, UT_GENERIC_PARAMS, const TApplyIf& applyIf = {})
#define GENERIC_WITH_ATTRS_HELPERS(name) DEFINE_HELPERS(name, UT_GENERIC_PARAMS, const NKikimrSchemeOp::TAlterUserAttributes& userAttrs = {}, const TApplyIf& applyIf = {})
#define DROP_BY_PATH_ID_HELPERS(name) DEFINE_HELPERS(name, UT_PARAMS_BY_PATH_ID, const TApplyIf& applyIf = {})
-
+
// subdomain
GENERIC_WITH_ATTRS_HELPERS(CreateSubDomain);
GENERIC_HELPERS(AlterSubDomain);
@@ -116,10 +116,10 @@ namespace NSchemeShardUT_Private {
// user attrs
GENERIC_WITH_ATTRS_HELPERS(UserAttrs);
- NKikimrSchemeOp::TAlterUserAttributes AlterUserAttrs(const TVector<std::pair<TString, TString>>& add, const TVector<TString>& drop = {});
+ NKikimrSchemeOp::TAlterUserAttributes AlterUserAttrs(const TVector<std::pair<TString, TString>>& add, const TVector<TString>& drop = {});
ui64 TestUserAttrs(TTestActorRuntime& runtime, ui64 txId, const TString& parentPath, const TString& name,
const NKikimrSchemeOp::TAlterUserAttributes& userAttrs);
-
+
// table
GENERIC_WITH_ATTRS_HELPERS(CreateTable);
GENERIC_HELPERS(CreateIndexedTable);
@@ -129,33 +129,33 @@ namespace NSchemeShardUT_Private {
GENERIC_HELPERS(DropTable);
DROP_BY_PATH_ID_HELPERS(DropTable);
GENERIC_HELPERS(DropTableIndex);
-
+
// backup & restore
GENERIC_HELPERS(BackupTable);
GENERIC_HELPERS(Restore);
-
+
// cdc stream
GENERIC_HELPERS(CreateCdcStream);
GENERIC_HELPERS(AlterCdcStream);
GENERIC_HELPERS(DropCdcStream);
-
+
// olap store
GENERIC_HELPERS(CreateOlapStore);
GENERIC_HELPERS(AlterOlapStore);
GENERIC_HELPERS(DropOlapStore);
DROP_BY_PATH_ID_HELPERS(DropOlapStore);
-
+
// olap table
GENERIC_HELPERS(CreateOlapTable);
GENERIC_HELPERS(AlterOlapTable);
GENERIC_HELPERS(DropOlapTable);
DROP_BY_PATH_ID_HELPERS(DropOlapTable);
-
+
// sequence
GENERIC_HELPERS(CreateSequence);
GENERIC_HELPERS(DropSequence);
DROP_BY_PATH_ID_HELPERS(DropSequence);
-
+
// replication
GENERIC_HELPERS(CreateReplication);
GENERIC_HELPERS(DropReplication);
@@ -166,7 +166,7 @@ namespace NSchemeShardUT_Private {
GENERIC_HELPERS(AlterPQGroup);
GENERIC_HELPERS(DropPQGroup);
DROP_BY_PATH_ID_HELPERS(DropPQGroup);
-
+
// rtmr
GENERIC_HELPERS(CreateRtmrVolume);
@@ -188,7 +188,7 @@ namespace NSchemeShardUT_Private {
GENERIC_HELPERS(AlterFileStore);
GENERIC_HELPERS(DropFileStore);
DROP_BY_PATH_ID_HELPERS(DropFileStore);
-
+
// nbs
GENERIC_HELPERS(CreateBlockStoreVolume);
GENERIC_HELPERS(AlterBlockStoreVolume);
@@ -232,32 +232,32 @@ namespace NSchemeShardUT_Private {
// copy table
TEvTx* CopyTableRequest(ui64 txId, const TString& dstPath, const TString& dstName, const TString& srcFullName, TApplyIf applyIf = {});
- void AsyncCopyTable(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, const TString& dstPath, const TString& dstName, const TString& srcFullName);
- void AsyncCopyTable(TTestActorRuntime& runtime, ui64 txId, const TString& dstPath, const TString& dstName, const TString& srcFullName);
- void TestCopyTable(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, const TString& dstPath, const TString& dstName, const TString& srcFullName, TEvSchemeShard::EStatus expectedResult = NKikimrScheme::StatusAccepted);
- void TestCopyTable(TTestActorRuntime& runtime, ui64 txId, const TString& dstPath, const TString& dstName, const TString& srcFullName, TEvSchemeShard::EStatus expectedResult = NKikimrScheme::StatusAccepted);
-
+ void AsyncCopyTable(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, const TString& dstPath, const TString& dstName, const TString& srcFullName);
+ void AsyncCopyTable(TTestActorRuntime& runtime, ui64 txId, const TString& dstPath, const TString& dstName, const TString& srcFullName);
+ void TestCopyTable(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, const TString& dstPath, const TString& dstName, const TString& srcFullName, TEvSchemeShard::EStatus expectedResult = NKikimrScheme::StatusAccepted);
+ void TestCopyTable(TTestActorRuntime& runtime, ui64 txId, const TString& dstPath, const TString& dstName, const TString& srcFullName, TEvSchemeShard::EStatus expectedResult = NKikimrScheme::StatusAccepted);
+
// move table
TEvTx* MoveTableRequest(ui64 txId, const TString& srcPath, const TString& dstPath, ui64 schemeShard = TTestTxConfig::SchemeShard, const TApplyIf& applyIf = {});
void AsyncMoveTable(TTestActorRuntime& runtime, ui64 txId, const TString& srcPath, const TString& dstPath, ui64 schemeShard = TTestTxConfig::SchemeShard);
- void TestMoveTable(TTestActorRuntime& runtime, ui64 txId, const TString& srcMove, const TString& dstMove, const TVector<TEvSchemeShard::EStatus>& expectedResults = {NKikimrScheme::StatusAccepted});
- void TestMoveTable(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, const TString& srcMove, const TString& dstMove, const TVector<TEvSchemeShard::EStatus>& expectedResults = {NKikimrScheme::StatusAccepted});
-
+ void TestMoveTable(TTestActorRuntime& runtime, ui64 txId, const TString& srcMove, const TString& dstMove, const TVector<TEvSchemeShard::EStatus>& expectedResults = {NKikimrScheme::StatusAccepted});
+ void TestMoveTable(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, const TString& srcMove, const TString& dstMove, const TVector<TEvSchemeShard::EStatus>& expectedResults = {NKikimrScheme::StatusAccepted});
+
// locks
TEvTx* LockRequest(ui64 txId, const TString &parentPath, const TString& name);
- void AsyncLock(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, const TString& parentPath, const TString& name);
- void AsyncLock(TTestActorRuntime& runtime, ui64 txId, const TString& parentPath, const TString& name);
- void TestLock(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, const TString& parentPath, const TString& name,
- const TVector<TEvSchemeShard::EStatus> expectedResults = {NKikimrScheme::StatusAccepted});
- void TestLock(TTestActorRuntime& runtime, ui64 txId, const TString& parentPath, const TString& name,
- const TVector<TEvSchemeShard::EStatus> expectedResults = {NKikimrScheme::StatusAccepted});
- void AsyncUnkock(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, ui64 lockId, const TString& parentPath, const TString& name);
- void AsyncUnkock(TTestActorRuntime& runtime, ui64 txId, ui64 lockId, const TString& parentPath, const TString& name);
- void TestUnlock(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, ui64 lockId, const TString& parentPath, const TString& name,
- const TVector<TEvSchemeShard::EStatus> expectedResults = {NKikimrScheme::StatusAccepted});
- void TestUnlock(TTestActorRuntime& runtime, ui64 txId, ui64 lockId, const TString& parentPath, const TString& name,
- const TVector<TEvSchemeShard::EStatus> expectedResults = {NKikimrScheme::StatusAccepted});
-
+ void AsyncLock(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, const TString& parentPath, const TString& name);
+ void AsyncLock(TTestActorRuntime& runtime, ui64 txId, const TString& parentPath, const TString& name);
+ void TestLock(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, const TString& parentPath, const TString& name,
+ const TVector<TEvSchemeShard::EStatus> expectedResults = {NKikimrScheme::StatusAccepted});
+ void TestLock(TTestActorRuntime& runtime, ui64 txId, const TString& parentPath, const TString& name,
+ const TVector<TEvSchemeShard::EStatus> expectedResults = {NKikimrScheme::StatusAccepted});
+ void AsyncUnkock(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, ui64 lockId, const TString& parentPath, const TString& name);
+ void AsyncUnkock(TTestActorRuntime& runtime, ui64 txId, ui64 lockId, const TString& parentPath, const TString& name);
+ void TestUnlock(TTestActorRuntime& runtime, ui64 schemeShard, ui64 txId, ui64 lockId, const TString& parentPath, const TString& name,
+ const TVector<TEvSchemeShard::EStatus> expectedResults = {NKikimrScheme::StatusAccepted});
+ void TestUnlock(TTestActorRuntime& runtime, ui64 txId, ui64 lockId, const TString& parentPath, const TString& name,
+ const TVector<TEvSchemeShard::EStatus> expectedResults = {NKikimrScheme::StatusAccepted});
+
// index build
struct TBuildIndexConfig {
TString IndexName;
@@ -279,7 +279,7 @@ namespace NSchemeShardUT_Private {
NKikimrIndexBuilder::TEvGetResponse TestGetBuilIndex(TTestActorRuntime& runtime, ui64 schemeShard, const TString &dbName, ui64 id);
TEvIndexBuilder::TEvForgetRequest* ForgetBuildIndexRequest(const ui64 id, const TString &dbName, const ui64 buildIndexId);
NKikimrIndexBuilder::TEvForgetResponse TestForgetBuilIndex(TTestActorRuntime& runtime, const ui64 id, const ui64 schemeShard, const TString &dbName, const ui64 buildIndexId, Ydb::StatusIds::StatusCode expectedStatus = Ydb::StatusIds::SUCCESS);
-
+
////////// export
void AsyncExport(TTestActorRuntime& runtime, ui64 schemeshardId, ui64 id, const TString& dbName, const TString& requestStr, const TString& userSID = "");
void AsyncExport(TTestActorRuntime& runtime, ui64 id, const TString& dbName, const TString& requestStr, const TString& userSID = "");
@@ -329,29 +329,29 @@ namespace NSchemeShardUT_Private {
NKikimrImport::TEvCancelImportResponse TestCancelImport(TTestActorRuntime& runtime, ui64 txId, const TString& dbName, ui64 importId,
Ydb::StatusIds::StatusCode expectedStatus = Ydb::StatusIds::SUCCESS);
- ////////// datashard
+ ////////// datashard
ui64 GetDatashardState(TTestActorRuntime& runtime, ui64 tabletId);
TString SetAllowLogBatching(TTestActorRuntime& runtime, ui64 tabletId, bool v);
- ui64 GetDatashardSysTableValue(TTestActorRuntime& runtime, ui64 tabletId, ui64 sysKey);
- ui64 GetTxReadSizeLimit(TTestActorRuntime& runtime, ui64 tabletId);
- ui64 GetStatDisabled(TTestActorRuntime& runtime, ui64 tabletId);
-
- ui64 GetExecutorCacheSize(TTestActorRuntime& runtime, ui64 tabletId);
- bool GetFastLogPolicy(TTestActorRuntime& runtime, ui64 tabletId);
- bool GetByKeyFilterEnabled(TTestActorRuntime& runtime, ui64 tabletId, ui32 table);
- bool GetEraseCacheEnabled(TTestActorRuntime& runtime, ui64 tabletId, ui32 table);
- NKikimr::NLocalDb::TCompactionPolicyPtr GetCompactionPolicy(TTestActorRuntime& runtime, ui64 tabletId, ui32 localTableId);
- void SetSchemeshardReadOnlyMode(TTestActorRuntime& runtime, bool isReadOnly);
- void SetSchemeshardSchemaLimits(TTestActorRuntime& runtime, NSchemeShard::TSchemeLimits limits);
- void SetSchemeshardSchemaLimits(TTestActorRuntime& runtime, NSchemeShard::TSchemeLimits limits, ui64 schemeShard);
+ ui64 GetDatashardSysTableValue(TTestActorRuntime& runtime, ui64 tabletId, ui64 sysKey);
+ ui64 GetTxReadSizeLimit(TTestActorRuntime& runtime, ui64 tabletId);
+ ui64 GetStatDisabled(TTestActorRuntime& runtime, ui64 tabletId);
+
+ ui64 GetExecutorCacheSize(TTestActorRuntime& runtime, ui64 tabletId);
+ bool GetFastLogPolicy(TTestActorRuntime& runtime, ui64 tabletId);
+ bool GetByKeyFilterEnabled(TTestActorRuntime& runtime, ui64 tabletId, ui32 table);
+ bool GetEraseCacheEnabled(TTestActorRuntime& runtime, ui64 tabletId, ui32 table);
+ NKikimr::NLocalDb::TCompactionPolicyPtr GetCompactionPolicy(TTestActorRuntime& runtime, ui64 tabletId, ui32 localTableId);
+ void SetSchemeshardReadOnlyMode(TTestActorRuntime& runtime, bool isReadOnly);
+ void SetSchemeshardSchemaLimits(TTestActorRuntime& runtime, NSchemeShard::TSchemeLimits limits);
+ void SetSchemeshardSchemaLimits(TTestActorRuntime& runtime, NSchemeShard::TSchemeLimits limits, ui64 schemeShard);
void SetSchemeshardDatabaseQuotas(TTestActorRuntime& runtime, Ydb::Cms::DatabaseQuotas databaseQuotas, ui64 domainId);
void SetSchemeshardDatabaseQuotas(TTestActorRuntime& runtime, Ydb::Cms::DatabaseQuotas databaseQuotas, ui64 dimainId, ui64 schemeShard);
-
- NKikimrSchemeOp::TTableDescription GetDatashardSchema(TTestActorRuntime& runtime, ui64 tabletId, ui64 tid);
- NLs::TCheckFunc ShardsIsReady(TTestActorRuntime& runtime);
-
+ NKikimrSchemeOp::TTableDescription GetDatashardSchema(TTestActorRuntime& runtime, ui64 tabletId, ui64 tid);
+
+ NLs::TCheckFunc ShardsIsReady(TTestActorRuntime& runtime);
+
template <typename TCreateFunc>
void CreateWithIntermediateDirs(TCreateFunc func) {
TTestWithReboots t;
@@ -393,76 +393,76 @@ namespace NSchemeShardUT_Private {
TPathId TestFindTabletSubDomainPathId(
TTestActorRuntime& runtime, ui64 tabletId,
- NKikimrScheme::TEvFindTabletSubDomainPathIdResult::EStatus expected = NKikimrScheme::TEvFindTabletSubDomainPathIdResult::SUCCESS);
+ NKikimrScheme::TEvFindTabletSubDomainPathIdResult::EStatus expected = NKikimrScheme::TEvFindTabletSubDomainPathIdResult::SUCCESS);
TPathId TestFindTabletSubDomainPathId(
TTestActorRuntime& runtime, ui64 schemeShard, ui64 tabletId,
- NKikimrScheme::TEvFindTabletSubDomainPathIdResult::EStatus expected = NKikimrScheme::TEvFindTabletSubDomainPathIdResult::SUCCESS);
+ NKikimrScheme::TEvFindTabletSubDomainPathIdResult::EStatus expected = NKikimrScheme::TEvFindTabletSubDomainPathIdResult::SUCCESS);
// Login
TEvTx* CreateAlterLoginCreateUser(ui64 txId, const TString& user, const TString& password);
- NKikimrScheme::TEvLoginResult Login(TTestActorRuntime& runtime, const TString& user, const TString& password);
-
- // Mimics data query to a single table with multiple partitions
- class TFakeDataReq {
- public:
- TFakeDataReq(TTestActorRuntime& runtime, ui64 txId, const TString& table, const TString& query);
- ~TFakeDataReq();
-
- // returns Unknown if plan is required, Error/Complete/Abort otherwise
+ NKikimrScheme::TEvLoginResult Login(TTestActorRuntime& runtime, const TString& user, const TString& password);
+
+ // Mimics data query to a single table with multiple partitions
+ class TFakeDataReq {
+ public:
+ TFakeDataReq(TTestActorRuntime& runtime, ui64 txId, const TString& table, const TString& query);
+ ~TFakeDataReq();
+
+ // returns Unknown if plan is required, Error/Complete/Abort otherwise
NMiniKQL::IEngineFlat::EStatus Propose(bool immediate, bool& activeZone, ui32 txFlags = NDataShard::TTxFlags::Default);
-
- // Propose to coordinator
- void Plan(ui64 coordinatorId);
-
- TMap<ui64, TVector<NKikimrTxDataShard::TError>> GetErrors() const {
- return Errors;
- }
-
- private:
- NMiniKQL::TRuntimeNode ProgramText2Bin(const TString& query);
-
- void FillTableInfo(TMockDbSchemeResolver& dbSchemeResolver) const;
-
- struct TTablePartitioningInfo {
- struct TBorder {
- TSerializedCellVec KeyTuple;
- bool Inclusive = false;
- bool Point = false;
- bool Defined = false;
- ui64 Datashard = 0;
- };
-
- TVector<NScheme::TTypeId> KeyColumnTypes;
- TVector<TBorder> Partitioning;
-
- void ResolveKey(const TTableRange& range, TVector<TKeyDesc::TPartitionInfo>& partitions) const;
- };
-
- void FillTablePartitioningInfo();
-
- void ResolveKey(TKeyDesc& dbKey) {
- if (TablePartitioningInfo.Partitioning.empty()) {
- FillTablePartitioningInfo();
- }
-
- TablePartitioningInfo.ResolveKey(dbKey.Range, dbKey.Partitions);
- dbKey.Status = TKeyDesc::EStatus::Ok;
- }
-
- private:
- TTestActorRuntime& Runtime;
- NMiniKQL::TScopedAlloc Alloc;
- NMiniKQL::TTypeEnvironment Env;
- ui64 TxId;
- const TString Table;
- const TString Query;
- TAutoPtr<NMiniKQL::IEngineFlat> Engine;
- TVector<ui64> AffectedShards;
- TMap<ui64, TVector<NKikimrTxDataShard::TError>> Errors;
- TTablePartitioningInfo TablePartitioningInfo;
- };
-
- TTestActorRuntimeBase::TEventObserver SetSuppressObserver(TTestActorRuntime& runtime, TVector<THolder<IEventHandle>>& suppressed, ui32 type);
- void WaitForSuppressed(TTestActorRuntime& runtime, TVector<THolder<IEventHandle>>& suppressed, ui32 count, TTestActorRuntime::TEventObserver prevObserver);
-
+
+ // Propose to coordinator
+ void Plan(ui64 coordinatorId);
+
+ TMap<ui64, TVector<NKikimrTxDataShard::TError>> GetErrors() const {
+ return Errors;
+ }
+
+ private:
+ NMiniKQL::TRuntimeNode ProgramText2Bin(const TString& query);
+
+ void FillTableInfo(TMockDbSchemeResolver& dbSchemeResolver) const;
+
+ struct TTablePartitioningInfo {
+ struct TBorder {
+ TSerializedCellVec KeyTuple;
+ bool Inclusive = false;
+ bool Point = false;
+ bool Defined = false;
+ ui64 Datashard = 0;
+ };
+
+ TVector<NScheme::TTypeId> KeyColumnTypes;
+ TVector<TBorder> Partitioning;
+
+ void ResolveKey(const TTableRange& range, TVector<TKeyDesc::TPartitionInfo>& partitions) const;
+ };
+
+ void FillTablePartitioningInfo();
+
+ void ResolveKey(TKeyDesc& dbKey) {
+ if (TablePartitioningInfo.Partitioning.empty()) {
+ FillTablePartitioningInfo();
+ }
+
+ TablePartitioningInfo.ResolveKey(dbKey.Range, dbKey.Partitions);
+ dbKey.Status = TKeyDesc::EStatus::Ok;
+ }
+
+ private:
+ TTestActorRuntime& Runtime;
+ NMiniKQL::TScopedAlloc Alloc;
+ NMiniKQL::TTypeEnvironment Env;
+ ui64 TxId;
+ const TString Table;
+ const TString Query;
+ TAutoPtr<NMiniKQL::IEngineFlat> Engine;
+ TVector<ui64> AffectedShards;
+ TMap<ui64, TVector<NKikimrTxDataShard::TError>> Errors;
+ TTablePartitioningInfo TablePartitioningInfo;
+ };
+
+ TTestActorRuntimeBase::TEventObserver SetSuppressObserver(TTestActorRuntime& runtime, TVector<THolder<IEventHandle>>& suppressed, ui32 type);
+ void WaitForSuppressed(TTestActorRuntime& runtime, TVector<THolder<IEventHandle>>& suppressed, ui32 count, TTestActorRuntime::TEventObserver prevObserver);
+
} //NSchemeShardUT_Private
diff --git a/ydb/core/tx/schemeshard/ut_helpers/ls_checks.cpp b/ydb/core/tx/schemeshard/ut_helpers/ls_checks.cpp
index b244bbaa40b..c5d6c5a973a 100644
--- a/ydb/core/tx/schemeshard/ut_helpers/ls_checks.cpp
+++ b/ydb/core/tx/schemeshard/ut_helpers/ls_checks.cpp
@@ -1,67 +1,67 @@
-#include "ls_checks.h"
-
+#include "ls_checks.h"
+
#include <ydb/core/engine/mkql_proto.h>
#include <ydb/core/scheme/scheme_tablecell.h>
#include <ydb/core/scheme/scheme_tabledefs.h>
#include <ydb/public/lib/scheme_types/scheme_type_id.h>
-
+
#include <library/cpp/testing/unittest/registar.h>
-
-namespace NSchemeShardUT_Private {
-namespace NLs {
-
-using namespace NKikimr;
-
-void NotInSubdomain(const NKikimrScheme::TEvDescribeSchemeResult& record) {
- UNIT_ASSERT(record.HasPathDescription());
- NKikimrSchemeOp::TPathDescription descr = record.GetPathDescription();
- UNIT_ASSERT(descr.HasSelf());
- UNIT_ASSERT(descr.HasDomainDescription());
- UNIT_ASSERT(descr.GetDomainDescription().HasDomainKey());
- UNIT_ASSERT_VALUES_EQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), 1);
-}
-
-void InSubdomain(const NKikimrScheme::TEvDescribeSchemeResult& record) {
- PathExist(record);
-
- UNIT_ASSERT(record.HasPathDescription());
- const auto& descr = record.GetPathDescription();
- UNIT_ASSERT(descr.HasSelf());
- UNIT_ASSERT(descr.HasDomainDescription());
- UNIT_ASSERT(descr.GetDomainDescription().GetProcessingParams().CoordinatorsSize() > 0);
- UNIT_ASSERT(descr.GetDomainDescription().GetProcessingParams().MediatorsSize() > 0);
- UNIT_ASSERT(descr.GetDomainDescription().GetProcessingParams().GetPlanResolution() > 0);
- UNIT_ASSERT(descr.GetDomainDescription().GetProcessingParams().GetTimeCastBucketsPerMediator() > 0);
- UNIT_ASSERT(descr.GetDomainDescription().HasDomainKey());
- UNIT_ASSERT(descr.GetDomainDescription().GetDomainKey().HasPathId());
- UNIT_ASSERT_VALUES_UNEQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), 1);
- UNIT_ASSERT(descr.GetDomainDescription().GetDomainKey().HasSchemeShard());
-
- if (descr.GetSelf().GetPathType() == NKikimrSchemeOp::EPathTypeSubDomain) {
- UNIT_ASSERT_VALUES_EQUAL(descr.GetSelf().GetPathId(), descr.GetDomainDescription().GetDomainKey().GetPathId());
- }
-}
-
+
+namespace NSchemeShardUT_Private {
+namespace NLs {
+
+using namespace NKikimr;
+
+void NotInSubdomain(const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ UNIT_ASSERT(record.HasPathDescription());
+ NKikimrSchemeOp::TPathDescription descr = record.GetPathDescription();
+ UNIT_ASSERT(descr.HasSelf());
+ UNIT_ASSERT(descr.HasDomainDescription());
+ UNIT_ASSERT(descr.GetDomainDescription().HasDomainKey());
+ UNIT_ASSERT_VALUES_EQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), 1);
+}
+
+void InSubdomain(const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ PathExist(record);
+
+ UNIT_ASSERT(record.HasPathDescription());
+ const auto& descr = record.GetPathDescription();
+ UNIT_ASSERT(descr.HasSelf());
+ UNIT_ASSERT(descr.HasDomainDescription());
+ UNIT_ASSERT(descr.GetDomainDescription().GetProcessingParams().CoordinatorsSize() > 0);
+ UNIT_ASSERT(descr.GetDomainDescription().GetProcessingParams().MediatorsSize() > 0);
+ UNIT_ASSERT(descr.GetDomainDescription().GetProcessingParams().GetPlanResolution() > 0);
+ UNIT_ASSERT(descr.GetDomainDescription().GetProcessingParams().GetTimeCastBucketsPerMediator() > 0);
+ UNIT_ASSERT(descr.GetDomainDescription().HasDomainKey());
+ UNIT_ASSERT(descr.GetDomainDescription().GetDomainKey().HasPathId());
+ UNIT_ASSERT_VALUES_UNEQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), 1);
+ UNIT_ASSERT(descr.GetDomainDescription().GetDomainKey().HasSchemeShard());
+
+ if (descr.GetSelf().GetPathType() == NKikimrSchemeOp::EPathTypeSubDomain) {
+ UNIT_ASSERT_VALUES_EQUAL(descr.GetSelf().GetPathId(), descr.GetDomainDescription().GetDomainKey().GetPathId());
+ }
+}
+
TCheckFunc IsSubDomain(const TString& name) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
- const auto& pathDescr = record.GetPathDescription();
- const auto& selfPath = pathDescr.GetSelf();
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& selfPath = pathDescr.GetSelf();
UNIT_ASSERT_VALUES_EQUAL(selfPath.GetName(), name);
UNIT_ASSERT_VALUES_EQUAL(selfPath.GetPathType(), NKikimrSchemeOp::EPathTypeSubDomain);
- };
-}
-
+ };
+}
+
TCheckFunc IsExternalSubDomain(const TString& name) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
- const auto& pathDescr = record.GetPathDescription();
- const auto& selfPath = pathDescr.GetSelf();
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& selfPath = pathDescr.GetSelf();
UNIT_ASSERT_VALUES_EQUAL(selfPath.GetName(), name);
UNIT_ASSERT_VALUES_EQUAL(selfPath.GetPathType(), NKikimrSchemeOp::EPathTypeExtSubDomain);
- };
-}
-
+ };
+}
+
bool IsGoodDomainStatus(NKikimrScheme::EStatus status) {
switch (status) {
case NKikimrScheme::StatusSuccess:
@@ -73,31 +73,31 @@ bool IsGoodDomainStatus(NKikimrScheme::EStatus status) {
}
TCheckFunc ExtractTenantSchemeshard(ui64* tenantSchemeShardId) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_C(IsGoodDomainStatus(record.GetStatus()), "Unexpected status: " << record.GetStatus());
-
- if (record.GetStatus() == NKikimrScheme::StatusSuccess) {
- const auto& pathDescr = record.GetPathDescription();
- const auto& selfPath = pathDescr.GetSelf();
+
+ if (record.GetStatus() == NKikimrScheme::StatusSuccess) {
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& selfPath = pathDescr.GetSelf();
UNIT_ASSERT_VALUES_EQUAL(selfPath.GetPathType(), NKikimrSchemeOp::EPathTypeExtSubDomain);
- UNIT_ASSERT(pathDescr.HasDomainDescription());
- const auto& domainDesc = pathDescr.GetDomainDescription();
- UNIT_ASSERT(domainDesc.HasProcessingParams());
- const auto& procParams = domainDesc.GetProcessingParams();
- *tenantSchemeShardId = procParams.GetSchemeShard();
- } else if (record.GetStatus() == NKikimrScheme::StatusRedirectDomain) {
- const auto& pathDescr = record.GetPathDescription();
- UNIT_ASSERT(pathDescr.HasDomainDescription());
- const auto& domainDesc = pathDescr.GetDomainDescription();
- UNIT_ASSERT(domainDesc.HasProcessingParams());
- const auto& procParams = domainDesc.GetProcessingParams();
- *tenantSchemeShardId = procParams.GetSchemeShard();
- }
- };
-}
-
+ UNIT_ASSERT(pathDescr.HasDomainDescription());
+ const auto& domainDesc = pathDescr.GetDomainDescription();
+ UNIT_ASSERT(domainDesc.HasProcessingParams());
+ const auto& procParams = domainDesc.GetProcessingParams();
+ *tenantSchemeShardId = procParams.GetSchemeShard();
+ } else if (record.GetStatus() == NKikimrScheme::StatusRedirectDomain) {
+ const auto& pathDescr = record.GetPathDescription();
+ UNIT_ASSERT(pathDescr.HasDomainDescription());
+ const auto& domainDesc = pathDescr.GetDomainDescription();
+ UNIT_ASSERT(domainDesc.HasProcessingParams());
+ const auto& procParams = domainDesc.GetProcessingParams();
+ *tenantSchemeShardId = procParams.GetSchemeShard();
+ }
+ };
+}
+
TCheckFunc ExtractTenantSysViewProcessor(ui64* tenantSVPId) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
const auto& pathDescr = record.GetPathDescription();
UNIT_ASSERT(pathDescr.HasDomainDescription());
@@ -108,440 +108,440 @@ TCheckFunc ExtractTenantSysViewProcessor(ui64* tenantSVPId) {
};
}
-void InExternalSubdomain(const NKikimrScheme::TEvDescribeSchemeResult& record) {
- PathRedirected(record);
-
- UNIT_ASSERT(record.HasLastExistedPrefixDescription());
- UNIT_ASSERT(record.HasPathDescription());
- const auto& descr = record.GetPathDescription();
- UNIT_ASSERT(descr.HasDomainDescription());
- const auto& domain = descr.GetDomainDescription();
- UNIT_ASSERT(domain.HasDomainKey());
- UNIT_ASSERT(domain.GetDomainKey().HasPathId());
- UNIT_ASSERT_VALUES_UNEQUAL(domain.GetDomainKey().GetPathId(), 1);
- UNIT_ASSERT(domain.GetDomainKey().HasSchemeShard());
-
+void InExternalSubdomain(const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ PathRedirected(record);
+
+ UNIT_ASSERT(record.HasLastExistedPrefixDescription());
+ UNIT_ASSERT(record.HasPathDescription());
+ const auto& descr = record.GetPathDescription();
+ UNIT_ASSERT(descr.HasDomainDescription());
+ const auto& domain = descr.GetDomainDescription();
+ UNIT_ASSERT(domain.HasDomainKey());
+ UNIT_ASSERT(domain.GetDomainKey().HasPathId());
+ UNIT_ASSERT_VALUES_UNEQUAL(domain.GetDomainKey().GetPathId(), 1);
+ UNIT_ASSERT(domain.GetDomainKey().HasSchemeShard());
+
const auto& extDomainPath = record.GetLastExistedPrefixDescription();
UNIT_ASSERT_VALUES_EQUAL(extDomainPath.GetSelf().GetPathType(), NKikimrSchemeOp::EPathTypeExtSubDomain);
-}
-
+}
+
TCheckFunc SubDomainVersion(ui64 descrVersion) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
- const auto& pathDescr = record.GetPathDescription();
- const auto& processingParams = pathDescr.GetDomainDescription().GetProcessingParams();
- UNIT_ASSERT_EQUAL_C(processingParams.GetVersion(), descrVersion,
- "subdomain version mistmach"
- << ", path id " << pathDescr.GetSelf().GetPathId()
- << ", domain id " << pathDescr.GetDomainDescription().GetDomainKey().GetPathId()
- << ", has version " << processingParams.GetVersion()
- << ", but expected " << descrVersion);
- };
-}
-
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& processingParams = pathDescr.GetDomainDescription().GetProcessingParams();
+ UNIT_ASSERT_EQUAL_C(processingParams.GetVersion(), descrVersion,
+ "subdomain version mistmach"
+ << ", path id " << pathDescr.GetSelf().GetPathId()
+ << ", domain id " << pathDescr.GetDomainDescription().GetDomainKey().GetPathId()
+ << ", has version " << processingParams.GetVersion()
+ << ", but expected " << descrVersion);
+ };
+}
+
TCheckFunc DomainKey(ui64 pathId, ui64 schemeshardId) {
- return DomainKey(TPathId(schemeshardId, pathId));
-}
-
+ return DomainKey(TPathId(schemeshardId, pathId));
+}
+
TCheckFunc DomainKey(TPathId pathId) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_C(IsGoodDomainStatus(record.GetStatus()), "Unexpected status: " << record.GetStatus());
-
- const auto& pathDescr = record.GetPathDescription();
+
+ const auto& pathDescr = record.GetPathDescription();
const auto& domainKey = pathDescr.GetDomainDescription().GetDomainKey();
-
+
UNIT_ASSERT_VALUES_EQUAL(domainKey.GetPathId(), pathId.LocalPathId);
UNIT_ASSERT_VALUES_EQUAL(domainKey.GetSchemeShard(), pathId.OwnerId);
- };
-}
-
+ };
+}
+
TCheckFunc StoragePoolsEqual(TSet<TString> poolNames) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
- const auto& pathDescr = record.GetPathDescription();
-
- TSet<TString> presentPools;
- for (auto& stPool: pathDescr.GetDomainDescription().GetStoragePools()) {
- presentPools.insert(stPool.GetName());
- }
-
- UNIT_ASSERT_VALUES_EQUAL(presentPools.size(), poolNames.size());
- UNIT_ASSERT_VALUES_EQUAL(presentPools, poolNames);
- };
-}
-
+ const auto& pathDescr = record.GetPathDescription();
+
+ TSet<TString> presentPools;
+ for (auto& stPool: pathDescr.GetDomainDescription().GetStoragePools()) {
+ presentPools.insert(stPool.GetName());
+ }
+
+ UNIT_ASSERT_VALUES_EQUAL(presentPools.size(), poolNames.size());
+ UNIT_ASSERT_VALUES_EQUAL(presentPools, poolNames);
+ };
+}
+
TCheckFunc DomainCoordinators(TVector<ui64> coordinators) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_C(IsGoodDomainStatus(record.GetStatus()), "Unexpected status: " << record.GetStatus());
-
- const auto& pathDescr = record.GetPathDescription();
- const auto& processingParams = pathDescr.GetDomainDescription().GetProcessingParams();
-
+
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& processingParams = pathDescr.GetDomainDescription().GetProcessingParams();
+
UNIT_ASSERT_VALUES_EQUAL(processingParams.CoordinatorsSize(), coordinators.size());
- TVector<ui64> actual(processingParams.GetCoordinators().begin(),processingParams.GetCoordinators().end());
- UNIT_ASSERT_EQUAL(actual, coordinators);
- };
-}
-
+ TVector<ui64> actual(processingParams.GetCoordinators().begin(),processingParams.GetCoordinators().end());
+ UNIT_ASSERT_EQUAL(actual, coordinators);
+ };
+}
+
TCheckFunc DomainMediators(TVector<ui64> mediators) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_C(IsGoodDomainStatus(record.GetStatus()), "Unexpected status: " << record.GetStatus());
-
- const auto& pathDescr = record.GetPathDescription();
- const auto& processingParams = pathDescr.GetDomainDescription().GetProcessingParams();
-
+
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& processingParams = pathDescr.GetDomainDescription().GetProcessingParams();
+
UNIT_ASSERT_VALUES_EQUAL(processingParams.MediatorsSize(), mediators.size());
- TVector<ui64> actual(processingParams.GetMediators().begin(), processingParams.GetMediators().end());
- UNIT_ASSERT_EQUAL(actual, mediators);
- };
-}
-
+ TVector<ui64> actual(processingParams.GetMediators().begin(), processingParams.GetMediators().end());
+ UNIT_ASSERT_EQUAL(actual, mediators);
+ };
+}
+
TCheckFunc DomainSchemeshard(ui64 schemeshard) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_C(IsGoodDomainStatus(record.GetStatus()), "Unexpected status: " << record.GetStatus());
-
- const auto& pathDescr = record.GetPathDescription();
- const auto& processingParams = pathDescr.GetDomainDescription().GetProcessingParams();
-
- if (schemeshard) {
+
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& processingParams = pathDescr.GetDomainDescription().GetProcessingParams();
+
+ if (schemeshard) {
UNIT_ASSERT_VALUES_EQUAL(processingParams.GetSchemeShard(), schemeshard);
- } else {
- UNIT_ASSERT(!processingParams.HasSchemeShard());
- }
- };
-}
-
+ } else {
+ UNIT_ASSERT(!processingParams.HasSchemeShard());
+ }
+ };
+}
+
TCheckFunc DomainSettings(ui32 planResolution, ui32 timeCastBucketsPerMediator) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
-
- const auto& pathDescr = record.GetPathDescription();
- const auto& processingParams = pathDescr.GetDomainDescription().GetProcessingParams();
-
+
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& processingParams = pathDescr.GetDomainDescription().GetProcessingParams();
+
UNIT_ASSERT_VALUES_EQUAL(processingParams.GetPlanResolution(), planResolution);
UNIT_ASSERT_VALUES_EQUAL(processingParams.GetTimeCastBucketsPerMediator(), timeCastBucketsPerMediator);
- };
-}
-
-TCheckFunc DatabaseSizeIs(ui64 bytes) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
-
- const auto& pathDescr = record.GetPathDescription();
- const auto& totalSize = pathDescr.GetDomainDescription().GetDiskSpaceUsage().GetTables().GetTotalSize();
-
- UNIT_ASSERT_VALUES_EQUAL(totalSize, bytes);
- };
-}
-
-void SubdomainWithNoEmptyStoragePools(const NKikimrScheme::TEvDescribeSchemeResult& record) {
- const auto& descr = record.GetPathDescription();
- UNIT_ASSERT(descr.GetDomainDescription().StoragePoolsSize() > 0);
-}
-
-void NotFinished(const NKikimrScheme::TEvDescribeSchemeResult& record) {
- PathExist(record);
-
- if (record.HasPathDescription()) {
- NKikimrSchemeOp::TPathDescription descr = record.GetPathDescription();
- if (descr.HasSelf()) {
- UNIT_ASSERT(!descr.GetSelf().GetCreateFinished());
- }
- }
-}
-
-void Finished(const NKikimrScheme::TEvDescribeSchemeResult& record) {
- PathExist(record);
-
- if (record.HasPathDescription()) {
- NKikimrSchemeOp::TPathDescription descr = record.GetPathDescription();
- if (descr.HasSelf()) {
- UNIT_ASSERT(descr.GetSelf().GetCreateFinished());
- }
- }
-}
-
-TCheckFunc ExtractVolumeConfig(NKikimrBlockStore::TVolumeConfig* config) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ };
+}
+
+TCheckFunc DatabaseSizeIs(ui64 bytes) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
+
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& totalSize = pathDescr.GetDomainDescription().GetDiskSpaceUsage().GetTables().GetTotalSize();
+
+ UNIT_ASSERT_VALUES_EQUAL(totalSize, bytes);
+ };
+}
+
+void SubdomainWithNoEmptyStoragePools(const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ const auto& descr = record.GetPathDescription();
+ UNIT_ASSERT(descr.GetDomainDescription().StoragePoolsSize() > 0);
+}
+
+void NotFinished(const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ PathExist(record);
+
+ if (record.HasPathDescription()) {
+ NKikimrSchemeOp::TPathDescription descr = record.GetPathDescription();
+ if (descr.HasSelf()) {
+ UNIT_ASSERT(!descr.GetSelf().GetCreateFinished());
+ }
+ }
+}
+
+void Finished(const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ PathExist(record);
+
+ if (record.HasPathDescription()) {
+ NKikimrSchemeOp::TPathDescription descr = record.GetPathDescription();
+ if (descr.HasSelf()) {
+ UNIT_ASSERT(descr.GetSelf().GetCreateFinished());
+ }
+ }
+}
+
+TCheckFunc ExtractVolumeConfig(NKikimrBlockStore::TVolumeConfig* config) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
-
- UNIT_ASSERT(record.HasPathDescription());
- const auto& descr = record.GetPathDescription();
-
- UNIT_ASSERT(descr.HasBlockStoreVolumeDescription());
- const auto& volume = descr.GetBlockStoreVolumeDescription();
- UNIT_ASSERT(volume.HasVolumeConfig());
- config->CopyFrom(volume.GetVolumeConfig());
- };
-}
-
-TCheckFunc CheckMountToken(const TString& name, const TString& expectedOwner) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+
+ UNIT_ASSERT(record.HasPathDescription());
+ const auto& descr = record.GetPathDescription();
+
+ UNIT_ASSERT(descr.HasBlockStoreVolumeDescription());
+ const auto& volume = descr.GetBlockStoreVolumeDescription();
+ UNIT_ASSERT(volume.HasVolumeConfig());
+ config->CopyFrom(volume.GetVolumeConfig());
+ };
+}
+
+TCheckFunc CheckMountToken(const TString& name, const TString& expectedOwner) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
-
- UNIT_ASSERT(record.HasPathDescription());
- const auto& descr = record.GetPathDescription();
-
- UNIT_ASSERT(descr.HasSelf());
- const auto& self = descr.GetSelf();
- UNIT_ASSERT_STRINGS_EQUAL(self.GetName(), name);
-
- UNIT_ASSERT(descr.HasBlockStoreVolumeDescription());
- const auto& volume = descr.GetBlockStoreVolumeDescription();
- UNIT_ASSERT_STRINGS_EQUAL(volume.GetName(), name);
- UNIT_ASSERT_STRINGS_EQUAL(volume.GetMountToken(), expectedOwner);
- };
-}
-
-TCheckFunc UserAttrsEqual(TUserAttrs attrs) {
+
+ UNIT_ASSERT(record.HasPathDescription());
+ const auto& descr = record.GetPathDescription();
+
+ UNIT_ASSERT(descr.HasSelf());
+ const auto& self = descr.GetSelf();
+ UNIT_ASSERT_STRINGS_EQUAL(self.GetName(), name);
+
+ UNIT_ASSERT(descr.HasBlockStoreVolumeDescription());
+ const auto& volume = descr.GetBlockStoreVolumeDescription();
+ UNIT_ASSERT_STRINGS_EQUAL(volume.GetName(), name);
+ UNIT_ASSERT_STRINGS_EQUAL(volume.GetMountToken(), expectedOwner);
+ };
+}
+
+TCheckFunc UserAttrsEqual(TUserAttrs attrs) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
- const auto& pathDescr = record.GetPathDescription();
-
- TUserAttrs requered = attrs;
- std::sort(requered.begin(), requered.end());
-
- TUserAttrs present;
- for (const auto& item: pathDescr.GetUserAttributes()) {
- present.emplace_back(item.GetKey(), item.GetValue());
- }
- std::sort(present.begin(), present.end());
-
- TUserAttrs diff;
- std::set_difference(present.begin(), present.end(),
- requered.begin(), requered.end(),
- std::back_inserter(diff));
- UNIT_ASSERT_C(diff.empty(),
- diff.size() << " items are different, for example" <<
- " name# '" << diff.front().first << "'" <<
- " value# '" << diff.front().second << "'" <<
- " the item is extra or has a different value in listing");
-
- diff.clear();
- std::set_difference(requered.begin(), requered.end(),
- present.begin(), present.end(),
- std::back_inserter(diff));
- UNIT_ASSERT_C(diff.empty(),
- diff.size() << " items are different, for example" <<
- " name# '" << diff.front().first << "' " <<
- " value# '" << diff.front().second << "' " <<
- " the item is missed");
- };
-}
-
-TCheckFunc UserAttrsHas(TUserAttrs attrs) {
+ const auto& pathDescr = record.GetPathDescription();
+
+ TUserAttrs requered = attrs;
+ std::sort(requered.begin(), requered.end());
+
+ TUserAttrs present;
+ for (const auto& item: pathDescr.GetUserAttributes()) {
+ present.emplace_back(item.GetKey(), item.GetValue());
+ }
+ std::sort(present.begin(), present.end());
+
+ TUserAttrs diff;
+ std::set_difference(present.begin(), present.end(),
+ requered.begin(), requered.end(),
+ std::back_inserter(diff));
+ UNIT_ASSERT_C(diff.empty(),
+ diff.size() << " items are different, for example" <<
+ " name# '" << diff.front().first << "'" <<
+ " value# '" << diff.front().second << "'" <<
+ " the item is extra or has a different value in listing");
+
+ diff.clear();
+ std::set_difference(requered.begin(), requered.end(),
+ present.begin(), present.end(),
+ std::back_inserter(diff));
+ UNIT_ASSERT_C(diff.empty(),
+ diff.size() << " items are different, for example" <<
+ " name# '" << diff.front().first << "' " <<
+ " value# '" << diff.front().second << "' " <<
+ " the item is missed");
+ };
+}
+
+TCheckFunc UserAttrsHas(TUserAttrs attrs) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
- const auto& pathDescr = record.GetPathDescription();
-
- TUserAttrs requered = attrs;
- std::sort(requered.begin(), requered.end());
-
- TUserAttrs present;
- for (const auto& item: pathDescr.GetUserAttributes()) {
- present.emplace_back(item.GetKey(), item.GetValue());
- }
- std::sort(present.begin(), present.end());
-
- TUserAttrs diff;
- std::set_difference(requered.begin(), requered.end(),
- present.begin(), present.end(),
- std::back_inserter(diff));
- UNIT_ASSERT_C(diff.empty(),
- diff.size() << " items are different, for example missed in listing " <<
- "name# '" << diff.front().first << "' " <<
- "value# '" << diff.front().second << "'");
- };
-}
-
-void IsTable(const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ const auto& pathDescr = record.GetPathDescription();
+
+ TUserAttrs requered = attrs;
+ std::sort(requered.begin(), requered.end());
+
+ TUserAttrs present;
+ for (const auto& item: pathDescr.GetUserAttributes()) {
+ present.emplace_back(item.GetKey(), item.GetValue());
+ }
+ std::sort(present.begin(), present.end());
+
+ TUserAttrs diff;
+ std::set_difference(requered.begin(), requered.end(),
+ present.begin(), present.end(),
+ std::back_inserter(diff));
+ UNIT_ASSERT_C(diff.empty(),
+ diff.size() << " items are different, for example missed in listing " <<
+ "name# '" << diff.front().first << "' " <<
+ "value# '" << diff.front().second << "'");
+ };
+}
+
+void IsTable(const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
- const auto& pathDescr = record.GetPathDescription();
- const auto& selfPath = pathDescr.GetSelf();
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& selfPath = pathDescr.GetSelf();
UNIT_ASSERT_VALUES_EQUAL(selfPath.GetPathType(), NKikimrSchemeOp::EPathTypeTable);
-}
-
-TCheckFunc CheckColumns(const TString& name, const TSet<TString>& columns, const TSet<TString>& droppedColumns, const TSet<TString> keyColumns,
- NKikimrSchemeOp::EPathState pathState) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- UNIT_ASSERT(record.HasPathDescription());
- NKikimrSchemeOp::TPathDescription descr = record.GetPathDescription();
-
- UNIT_ASSERT(descr.HasSelf());
- auto self = descr.GetSelf();
- UNIT_ASSERT(self.HasCreateFinished());
- TString curName = self.GetName();
- ui32 curPathState = self.GetPathState();
- UNIT_ASSERT_STRINGS_EQUAL(curName, name);
- UNIT_ASSERT_VALUES_EQUAL(curPathState, (ui32)pathState);
-
- UNIT_ASSERT(descr.HasTable());
- NKikimrSchemeOp::TTableDescription table = descr.GetTable();
- UNIT_ASSERT(table.ColumnsSize());
-
- for (auto& col : table.GetColumns()) {
- UNIT_ASSERT(col.HasName());
- UNIT_ASSERT(col.HasId());
- UNIT_ASSERT(col.HasTypeId());
-
- TString name = col.GetName();
- UNIT_ASSERT(columns.contains(name));
- UNIT_ASSERT(!droppedColumns.contains(name));
- }
-
- for (auto& keyName : table.GetKeyColumnNames()) {
- UNIT_ASSERT(keyColumns.contains(keyName));
- }
- };
-}
-
-void CheckBoundaries(const NKikimrScheme::TEvDescribeSchemeResult &record) {
- const NKikimrSchemeOp::TPathDescription& descr = record.GetPathDescription();
- THashMap<ui32, NScheme::TTypeId> colTypes;
- for (const auto& col : descr.GetTable().GetColumns()) {
- colTypes[col.GetId()] = col.GetTypeId();
- }
- TVector<NScheme::TTypeId> keyColTypes;
- for (const auto& ki : descr.GetTable().GetKeyColumnIds()) {
- keyColTypes.push_back(colTypes[ki]);
- }
-
- UNIT_ASSERT_VALUES_EQUAL(descr.GetTable().SplitBoundarySize() + 1, descr.TablePartitionsSize());
- TString errStr;
- for (ui32 i = 0; i < descr.GetTable().SplitBoundarySize(); ++i) {
- const auto& b = descr.GetTable().GetSplitBoundary(i);
- TVector<TCell> cells;
- NMiniKQL::CellsFromTuple(nullptr, b.GetKeyPrefix(), keyColTypes, false, cells, errStr);
- UNIT_ASSERT_VALUES_EQUAL(errStr, "");
-
- TString serialized = TSerializedCellVec::Serialize(cells);
- UNIT_ASSERT_NO_DIFF(serialized, descr.GetTablePartitions(i).GetEndOfRangeKeyPrefix());
- }
-}
-
-TCheckFunc CheckPartCount(const TString& name, ui32 partCount, ui32 maxParts, ui32 tabletCount, ui32 groupCount,
- NKikimrSchemeOp::EPathState pathState) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- UNIT_ASSERT(record.HasPathDescription());
- NKikimrSchemeOp::TPathDescription descr = record.GetPathDescription();
-
- UNIT_ASSERT(descr.HasSelf());
- auto self = descr.GetSelf();
- UNIT_ASSERT(self.HasCreateFinished());
- TString curName = self.GetName();
- ui32 curPathState = self.GetPathState();
- UNIT_ASSERT_STRINGS_EQUAL(curName, name);
- UNIT_ASSERT_VALUES_EQUAL(curPathState, (ui32)pathState);
-
- UNIT_ASSERT(descr.HasPersQueueGroup());
- NKikimrSchemeOp::TPersQueueGroupDescription pqGroup = descr.GetPersQueueGroup();
-
- UNIT_ASSERT(pqGroup.HasNextPartitionId());
- UNIT_ASSERT(pqGroup.HasTotalGroupCount());
- UNIT_ASSERT(pqGroup.GetTotalGroupCount() <= pqGroup.GetNextPartitionId());
- ui64 totalGroupCount = pqGroup.GetTotalGroupCount();
- ui32 curMaxParts = pqGroup.GetPartitionPerTablet();
- ui32 curPartsCount = pqGroup.PartitionsSize();
- ui32 nextPartId = pqGroup.GetNextPartitionId();
-
- UNIT_ASSERT_VALUES_EQUAL(curPartsCount, partCount);
- UNIT_ASSERT_VALUES_EQUAL(totalGroupCount, groupCount);
- UNIT_ASSERT_VALUES_EQUAL(curMaxParts, maxParts);
- UNIT_ASSERT_VALUES_EQUAL(nextPartId, partCount);
-
- TSet<ui32> pqs;
- TSet<ui32> tablets;
- for (size_t i = 0; i < curPartsCount; ++i) {
- auto& part = pqGroup.GetPartitions(i);
- UNIT_ASSERT(part.HasPartitionId());
- UNIT_ASSERT(part.HasTabletId());
-
- ui32 pq = pqGroup.GetPartitions(i).GetPartitionId();
- ui32 tabletId = pqGroup.GetPartitions(i).GetTabletId();
-
- pqs.insert(pq);
- tablets.insert(tabletId);
- }
-
- UNIT_ASSERT_VALUES_EQUAL(partCount, pqs.size());
- UNIT_ASSERT_VALUES_EQUAL(tabletCount, tablets.size());
-
+}
+
+TCheckFunc CheckColumns(const TString& name, const TSet<TString>& columns, const TSet<TString>& droppedColumns, const TSet<TString> keyColumns,
+ NKikimrSchemeOp::EPathState pathState) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ UNIT_ASSERT(record.HasPathDescription());
+ NKikimrSchemeOp::TPathDescription descr = record.GetPathDescription();
+
+ UNIT_ASSERT(descr.HasSelf());
+ auto self = descr.GetSelf();
+ UNIT_ASSERT(self.HasCreateFinished());
+ TString curName = self.GetName();
+ ui32 curPathState = self.GetPathState();
+ UNIT_ASSERT_STRINGS_EQUAL(curName, name);
+ UNIT_ASSERT_VALUES_EQUAL(curPathState, (ui32)pathState);
+
+ UNIT_ASSERT(descr.HasTable());
+ NKikimrSchemeOp::TTableDescription table = descr.GetTable();
+ UNIT_ASSERT(table.ColumnsSize());
+
+ for (auto& col : table.GetColumns()) {
+ UNIT_ASSERT(col.HasName());
+ UNIT_ASSERT(col.HasId());
+ UNIT_ASSERT(col.HasTypeId());
+
+ TString name = col.GetName();
+ UNIT_ASSERT(columns.contains(name));
+ UNIT_ASSERT(!droppedColumns.contains(name));
+ }
+
+ for (auto& keyName : table.GetKeyColumnNames()) {
+ UNIT_ASSERT(keyColumns.contains(keyName));
+ }
+ };
+}
+
+void CheckBoundaries(const NKikimrScheme::TEvDescribeSchemeResult &record) {
+ const NKikimrSchemeOp::TPathDescription& descr = record.GetPathDescription();
+ THashMap<ui32, NScheme::TTypeId> colTypes;
+ for (const auto& col : descr.GetTable().GetColumns()) {
+ colTypes[col.GetId()] = col.GetTypeId();
+ }
+ TVector<NScheme::TTypeId> keyColTypes;
+ for (const auto& ki : descr.GetTable().GetKeyColumnIds()) {
+ keyColTypes.push_back(colTypes[ki]);
+ }
+
+ UNIT_ASSERT_VALUES_EQUAL(descr.GetTable().SplitBoundarySize() + 1, descr.TablePartitionsSize());
+ TString errStr;
+ for (ui32 i = 0; i < descr.GetTable().SplitBoundarySize(); ++i) {
+ const auto& b = descr.GetTable().GetSplitBoundary(i);
+ TVector<TCell> cells;
+ NMiniKQL::CellsFromTuple(nullptr, b.GetKeyPrefix(), keyColTypes, false, cells, errStr);
+ UNIT_ASSERT_VALUES_EQUAL(errStr, "");
+
+ TString serialized = TSerializedCellVec::Serialize(cells);
+ UNIT_ASSERT_NO_DIFF(serialized, descr.GetTablePartitions(i).GetEndOfRangeKeyPrefix());
+ }
+}
+
+TCheckFunc CheckPartCount(const TString& name, ui32 partCount, ui32 maxParts, ui32 tabletCount, ui32 groupCount,
+ NKikimrSchemeOp::EPathState pathState) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ UNIT_ASSERT(record.HasPathDescription());
+ NKikimrSchemeOp::TPathDescription descr = record.GetPathDescription();
+
+ UNIT_ASSERT(descr.HasSelf());
+ auto self = descr.GetSelf();
+ UNIT_ASSERT(self.HasCreateFinished());
+ TString curName = self.GetName();
+ ui32 curPathState = self.GetPathState();
+ UNIT_ASSERT_STRINGS_EQUAL(curName, name);
+ UNIT_ASSERT_VALUES_EQUAL(curPathState, (ui32)pathState);
+
+ UNIT_ASSERT(descr.HasPersQueueGroup());
+ NKikimrSchemeOp::TPersQueueGroupDescription pqGroup = descr.GetPersQueueGroup();
+
+ UNIT_ASSERT(pqGroup.HasNextPartitionId());
+ UNIT_ASSERT(pqGroup.HasTotalGroupCount());
+ UNIT_ASSERT(pqGroup.GetTotalGroupCount() <= pqGroup.GetNextPartitionId());
+ ui64 totalGroupCount = pqGroup.GetTotalGroupCount();
+ ui32 curMaxParts = pqGroup.GetPartitionPerTablet();
+ ui32 curPartsCount = pqGroup.PartitionsSize();
+ ui32 nextPartId = pqGroup.GetNextPartitionId();
+
+ UNIT_ASSERT_VALUES_EQUAL(curPartsCount, partCount);
+ UNIT_ASSERT_VALUES_EQUAL(totalGroupCount, groupCount);
+ UNIT_ASSERT_VALUES_EQUAL(curMaxParts, maxParts);
+ UNIT_ASSERT_VALUES_EQUAL(nextPartId, partCount);
+
+ TSet<ui32> pqs;
+ TSet<ui32> tablets;
+ for (size_t i = 0; i < curPartsCount; ++i) {
+ auto& part = pqGroup.GetPartitions(i);
+ UNIT_ASSERT(part.HasPartitionId());
+ UNIT_ASSERT(part.HasTabletId());
+
+ ui32 pq = pqGroup.GetPartitions(i).GetPartitionId();
+ ui32 tabletId = pqGroup.GetPartitions(i).GetTabletId();
+
+ pqs.insert(pq);
+ tablets.insert(tabletId);
+ }
+
+ UNIT_ASSERT_VALUES_EQUAL(partCount, pqs.size());
+ UNIT_ASSERT_VALUES_EQUAL(tabletCount, tablets.size());
+
if (!pqs.empty()) {
- UNIT_ASSERT_VALUES_EQUAL(*pqs.begin(), 0);
+ UNIT_ASSERT_VALUES_EQUAL(*pqs.begin(), 0);
UNIT_ASSERT_VALUES_EQUAL(*pqs.rbegin(), partCount - 1);
- }
- };
-}
-
-TCheckFunc PathVersionEqual(ui64 version) {
+ }
+ };
+}
+
+TCheckFunc PathVersionEqual(ui64 version) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
- const auto& pathDescr = record.GetPathDescription();
- const auto& self = pathDescr.GetSelf();
- const auto& curVersion = self.GetPathVersion();
-
- UNIT_ASSERT_EQUAL_C(curVersion, version,
- "path version mistmach, path with id " << self.GetPathId() <<
- " has version " << curVersion <<
- " but expected " << version);
- };
-}
-
-TCheckFunc PathVersionOneOf(TSet<ui64> versions) {
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& self = pathDescr.GetSelf();
+ const auto& curVersion = self.GetPathVersion();
+
+ UNIT_ASSERT_EQUAL_C(curVersion, version,
+ "path version mistmach, path with id " << self.GetPathId() <<
+ " has version " << curVersion <<
+ " but expected " << version);
+ };
+}
+
+TCheckFunc PathVersionOneOf(TSet<ui64> versions) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
- const auto& pathDescr = record.GetPathDescription();
- const auto& self = pathDescr.GetSelf();
- const auto& curVersion = self.GetPathVersion();
-
- UNIT_ASSERT_C(versions.count(curVersion) > 0,
- "path version mistmach, path with id " << self.GetPathId() <<
- " has version " << curVersion <<
- " but expected one of set");
- };
-}
-
-TCheckFunc PathIdEqual(ui64 pathId) {
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& self = pathDescr.GetSelf();
+ const auto& curVersion = self.GetPathVersion();
+
+ UNIT_ASSERT_C(versions.count(curVersion) > 0,
+ "path version mistmach, path with id " << self.GetPathId() <<
+ " has version " << curVersion <<
+ " but expected one of set");
+ };
+}
+
+TCheckFunc PathIdEqual(ui64 pathId) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
- const auto& pathDescr = record.GetPathDescription();
- const auto& self = pathDescr.GetSelf();
- const auto& curId = self.GetPathId();
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& self = pathDescr.GetSelf();
+ const auto& curId = self.GetPathId();
UNIT_ASSERT_VALUES_EQUAL(curId, pathId);
- };
-}
-
-TCheckFunc PathIdEqual(TPathId pathId) {
+ };
+}
+
+TCheckFunc PathIdEqual(TPathId pathId) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
- const auto& pathDescr = record.GetPathDescription();
- const auto& self = pathDescr.GetSelf();
- const auto& curId = TPathId(self.GetSchemeshardId(), self.GetPathId());
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& self = pathDescr.GetSelf();
+ const auto& curId = TPathId(self.GetSchemeshardId(), self.GetPathId());
UNIT_ASSERT_VALUES_EQUAL(curId, pathId);
- };
-}
-
+ };
+}
+
TCheckFunc PathStringEqual(const TString& expected) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPath(), expected);
};
}
-TCheckFunc PathsInsideDomain(ui64 count) {
+TCheckFunc PathsInsideDomain(ui64 count) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_C(IsGoodDomainStatus(record.GetStatus()), "Unexpected status: " << record.GetStatus());
- const auto& pathDescr = record.GetPathDescription();
- const auto& domain = pathDescr.GetDomainDescription();
- const auto& curCount = domain.GetPathsInside();
-
- UNIT_ASSERT_EQUAL_C(curCount, count,
- "paths inside domain count mistmach, domain with id " << domain.GetDomainKey().GetPathId() <<
- " has count " << curCount <<
- " but expected " << count);
- };
-}
-
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& domain = pathDescr.GetDomainDescription();
+ const auto& curCount = domain.GetPathsInside();
+
+ UNIT_ASSERT_EQUAL_C(curCount, count,
+ "paths inside domain count mistmach, domain with id " << domain.GetDomainKey().GetPathId() <<
+ " has count " << curCount <<
+ " but expected " << count);
+ };
+}
+
TCheckFunc PQPartitionsInsideDomain(ui64 count) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_C(IsGoodDomainStatus(record.GetStatus()), "Unexpected status: " << record.GetStatus());
@@ -561,117 +561,117 @@ TCheckFunc PathsInsideDomainOneOf(TSet<ui64> variants) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_C(IsGoodDomainStatus(record.GetStatus()), "Unexpected status: " << record.GetStatus());
- const auto& pathDescr = record.GetPathDescription();
- const auto& domain = pathDescr.GetDomainDescription();
- const auto& curCount = domain.GetPathsInside();
-
- UNIT_ASSERT_C(variants.count(curCount) > 0,
- "paths inside domain count mistmach, domain with id " << domain.GetDomainKey().GetPathId() <<
- " has version " << curCount <<
- " but expected one of set");
- };
-}
-
-TCheckFunc ShardsInsideDomain(ui64 count) {
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& domain = pathDescr.GetDomainDescription();
+ const auto& curCount = domain.GetPathsInside();
+
+ UNIT_ASSERT_C(variants.count(curCount) > 0,
+ "paths inside domain count mistmach, domain with id " << domain.GetDomainKey().GetPathId() <<
+ " has version " << curCount <<
+ " but expected one of set");
+ };
+}
+
+TCheckFunc ShardsInsideDomain(ui64 count) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_C(IsGoodDomainStatus(record.GetStatus()), "Unexpected status: " << record.GetStatus());
- const auto& pathDescr = record.GetPathDescription();
- const auto& domain = pathDescr.GetDomainDescription();
- const auto& curCount = domain.GetShardsInside();
-
- UNIT_ASSERT_C(count == curCount,
- "shards inside domain count mistmach, domain with id " << domain.GetDomainKey().GetPathId() <<
- " has shardsInsize " << curCount <<
- " but expected " << count);
- };
-}
-
-TCheckFunc ShardsInsideDomainOneOf(TSet<ui64> variants) {
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& domain = pathDescr.GetDomainDescription();
+ const auto& curCount = domain.GetShardsInside();
+
+ UNIT_ASSERT_C(count == curCount,
+ "shards inside domain count mistmach, domain with id " << domain.GetDomainKey().GetPathId() <<
+ " has shardsInsize " << curCount <<
+ " but expected " << count);
+ };
+}
+
+TCheckFunc ShardsInsideDomainOneOf(TSet<ui64> variants) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_C(IsGoodDomainStatus(record.GetStatus()), "Unexpected status: " << record.GetStatus());
- const auto& pathDescr = record.GetPathDescription();
- const auto& domain = pathDescr.GetDomainDescription();
- const auto& curCount = domain.GetShardsInside();
-
- UNIT_ASSERT_C(variants.count(curCount) > 0,
- "paths inside domain count mistmach, domain with id " << domain.GetDomainKey().GetPathId() <<
- " has shards " << curCount <<
- " but expected one of set");
- };
-}
-
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& domain = pathDescr.GetDomainDescription();
+ const auto& curCount = domain.GetShardsInside();
+
+ UNIT_ASSERT_C(variants.count(curCount) > 0,
+ "paths inside domain count mistmach, domain with id " << domain.GetDomainKey().GetPathId() <<
+ " has shards " << curCount <<
+ " but expected one of set");
+ };
+}
+
TCheckFunc DomainLimitsIs(ui64 maxPaths, ui64 maxShards, ui64 maxPQPartitions) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
- const auto& pathDescr = record.GetPathDescription();
- const auto& domain = pathDescr.GetDomainDescription();
- const auto& pathLimit = domain.GetPathsLimit();
- const auto& shardsLimit = domain.GetShardsLimit();
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& domain = pathDescr.GetDomainDescription();
+ const auto& pathLimit = domain.GetPathsLimit();
+ const auto& shardsLimit = domain.GetShardsLimit();
const auto& pqPartitionsLimit = domain.GetPQPartitionsLimit();
-
- UNIT_ASSERT_C(pathLimit == maxPaths,
- "paths limit mistmach, domain with id " << domain.GetDomainKey().GetPathId() <<
+
+ UNIT_ASSERT_C(pathLimit == maxPaths,
+ "paths limit mistmach, domain with id " << domain.GetDomainKey().GetPathId() <<
" has limit " << pathLimit <<
- " but expected " << maxPaths);
-
- UNIT_ASSERT_C(shardsLimit == maxShards,
- "shards limit mistmach, domain with id " << domain.GetDomainKey().GetPathId() <<
+ " but expected " << maxPaths);
+
+ UNIT_ASSERT_C(shardsLimit == maxShards,
+ "shards limit mistmach, domain with id " << domain.GetDomainKey().GetPathId() <<
" has limit " << shardsLimit <<
- " but expected " << maxShards);
+ " but expected " << maxShards);
UNIT_ASSERT_C(!maxPQPartitions || pqPartitionsLimit == maxPQPartitions,
"pq partitions limit mistmach, domain with id " << domain.GetDomainKey().GetPathId() <<
" has limit " << pqPartitionsLimit <<
" but expected " << maxPQPartitions);
- };
-}
-
-TCheckFunc FreezeStateEqual(NKikimrSchemeOp::EFreezeState expectedState) {
+ };
+}
+
+TCheckFunc FreezeStateEqual(NKikimrSchemeOp::EFreezeState expectedState) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
- UNIT_ASSERT(record.HasPathDescription());
- UNIT_ASSERT(record.GetPathDescription().HasTable());
- UNIT_ASSERT(record.GetPathDescription().GetTable().HasPartitionConfig());
- UNIT_ASSERT(record.GetPathDescription().GetTable().GetPartitionConfig().HasFreezeState());
+ UNIT_ASSERT(record.HasPathDescription());
+ UNIT_ASSERT(record.GetPathDescription().HasTable());
+ UNIT_ASSERT(record.GetPathDescription().GetTable().HasPartitionConfig());
+ UNIT_ASSERT(record.GetPathDescription().GetTable().GetPartitionConfig().HasFreezeState());
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetTable().GetPartitionConfig().GetFreezeState(), expectedState);
- };
-}
-
-TCheckFunc ChildrenCount(ui32 count) {
+ };
+}
+
+TCheckFunc ChildrenCount(ui32 count) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().ChildrenSize(), count);
- };
-}
-
+ };
+}
+
TCheckFunc IndexesCount(ui32 count) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetTable().TableIndexesSize(), count);
- };
-}
-
+ };
+}
+
TCheckFunc IndexType(NKikimrSchemeOp::EIndexType type) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetTableIndex().GetType(), type);
- };
-}
-
+ };
+}
+
TCheckFunc IndexState(NKikimrSchemeOp::EIndexState state) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetTableIndex().GetState(), state);
- };
-}
-
+ };
+}
+
TCheckFunc IndexKeys(const TVector<TString>& keyNames) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetTableIndex().KeyColumnNamesSize(), keyNames.size());
- for (ui32 keyId = 0; keyId < keyNames.size(); ++keyId) {
+ for (ui32 keyId = 0; keyId < keyNames.size(); ++keyId) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetTableIndex().GetKeyColumnNames(keyId), keyNames.at(keyId));
- }
- };
-}
-
+ }
+ };
+}
+
TCheckFunc IndexDataColumns(const TVector<TString>& dataColumnNames) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetTableIndex().DataColumnNamesSize(), dataColumnNames.size());
@@ -681,160 +681,160 @@ TCheckFunc IndexDataColumns(const TVector<TString>& dataColumnNames) {
};
}
-void NoChildren(const NKikimrScheme::TEvDescribeSchemeResult& record) {
- ChildrenCount(0)(record);
-}
-
-void PathNotExist(const NKikimrScheme::TEvDescribeSchemeResult& record) {
+void NoChildren(const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ ChildrenCount(0)(record);
+}
+
+void PathNotExist(const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusPathDoesNotExist);
-}
-
-void PathExist(const NKikimrScheme::TEvDescribeSchemeResult& record) {
+}
+
+void PathExist(const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
-}
-
-void PathRedirected(const NKikimrScheme::TEvDescribeSchemeResult& record) {
+}
+
+void PathRedirected(const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NKikimrScheme::StatusRedirectDomain);
-}
-
-TCheckFunc CreatedAt(ui64 txId) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+}
+
+TCheckFunc CreatedAt(ui64 txId) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetSelf().GetCreateTxId(), txId);
- };
-}
-
-TCheckFunc PartitionCount(ui32 count) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ };
+}
+
+TCheckFunc PartitionCount(ui32 count) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().TablePartitionsSize(), count);
- };
-}
-
+ };
+}
+
TCheckFunc FollowerCount(ui32 count) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetTable().GetPartitionConfig().GetFollowerCount(), count);
};
}
TCheckFunc CrossDataCenterFollowerCount(ui32 count) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetTable().GetPartitionConfig().GetCrossDataCenterFollowerCount(), count);
- };
-}
-
+ };
+}
+
TCheckFunc AllowFollowerPromotion(bool val) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetTable().GetPartitionConfig().GetAllowFollowerPromotion(), val);
- };
-}
-
+ };
+}
+
TCheckFunc FollowerGroups(const TVector<NKikimrHive::TFollowerGroup>& followerGroups) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetTable().GetPartitionConfig().FollowerGroupsSize(), followerGroups.size());
for (size_t i = 0; i < followerGroups.size(); ++i) {
const auto& srcSG = record.GetPathDescription().GetTable().GetPartitionConfig().GetFollowerGroups(i);
const auto& dstSG = followerGroups[i];
-
+
UNIT_ASSERT_VALUES_EQUAL(srcSG.GetFollowerCount(), dstSG.GetFollowerCount());
UNIT_ASSERT_VALUES_EQUAL(srcSG.GetAllowLeaderPromotion(), dstSG.GetAllowLeaderPromotion());
- UNIT_ASSERT_VALUES_EQUAL(srcSG.GetAllowClientRead(), dstSG.GetAllowClientRead());
-
- UNIT_ASSERT_VALUES_EQUAL(srcSG.AllowedNodeIDsSize(), dstSG.AllowedNodeIDsSize());
- for(ui32 i = 0; i < srcSG.AllowedNodeIDsSize(); ++i) {
- UNIT_ASSERT_VALUES_EQUAL(srcSG.GetAllowedNodeIDs(i), dstSG.GetAllowedNodeIDs(i));
- }
-
+ UNIT_ASSERT_VALUES_EQUAL(srcSG.GetAllowClientRead(), dstSG.GetAllowClientRead());
+
+ UNIT_ASSERT_VALUES_EQUAL(srcSG.AllowedNodeIDsSize(), dstSG.AllowedNodeIDsSize());
+ for(ui32 i = 0; i < srcSG.AllowedNodeIDsSize(); ++i) {
+ UNIT_ASSERT_VALUES_EQUAL(srcSG.GetAllowedNodeIDs(i), dstSG.GetAllowedNodeIDs(i));
+ }
+
UNIT_ASSERT_VALUES_EQUAL(srcSG.AllowedDataCentersSize(), dstSG.AllowedDataCentersSize());
for(ui32 i = 0; i < srcSG.AllowedDataCentersSize(); ++i) {
UNIT_ASSERT_VALUES_EQUAL(srcSG.GetAllowedDataCenters(i), dstSG.GetAllowedDataCenters(i));
- }
- UNIT_ASSERT_VALUES_EQUAL(srcSG.GetRequireAllDataCenters(), dstSG.GetRequireAllDataCenters());
- UNIT_ASSERT_VALUES_EQUAL(srcSG.GetLocalNodeOnly(), dstSG.GetLocalNodeOnly());
- UNIT_ASSERT_VALUES_EQUAL(srcSG.GetRequireDifferentNodes(), dstSG.GetRequireDifferentNodes());
- }
- };
-}
-
-TCheckFunc SizeToSplitEqual(ui32 size) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetTable().GetPartitionConfig().GetPartitioningPolicy().GetSizeToSplit(), size);
- };
-}
-
+ }
+ UNIT_ASSERT_VALUES_EQUAL(srcSG.GetRequireAllDataCenters(), dstSG.GetRequireAllDataCenters());
+ UNIT_ASSERT_VALUES_EQUAL(srcSG.GetLocalNodeOnly(), dstSG.GetLocalNodeOnly());
+ UNIT_ASSERT_VALUES_EQUAL(srcSG.GetRequireDifferentNodes(), dstSG.GetRequireDifferentNodes());
+ }
+ };
+}
+
+TCheckFunc SizeToSplitEqual(ui32 size) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetTable().GetPartitionConfig().GetPartitioningPolicy().GetSizeToSplit(), size);
+ };
+}
+
TCheckFunc MinPartitionsCountEqual(ui32 count) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetTable().GetPartitionConfig().GetPartitioningPolicy().GetMinPartitionsCount(), count);
};
}
TCheckFunc MaxPartitionsCountEqual(ui32 count) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetTable().GetPartitionConfig().GetPartitioningPolicy().GetMaxPartitionsCount(), count);
};
}
TCheckFunc PartitioningByLoadStatus(bool status) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetTable().GetPartitionConfig().GetPartitioningPolicy().GetSplitByLoadSettings().GetEnabled(), status);
};
}
-void NoBackupInFly(const NKikimrScheme::TEvDescribeSchemeResult &record) {
- UNIT_ASSERT(!record.GetPathDescription().HasBackupProgress());
-}
-
-TCheckFunc HasBackupInFly(ui64 txId) {
+void NoBackupInFly(const NKikimrScheme::TEvDescribeSchemeResult &record) {
+ UNIT_ASSERT(!record.GetPathDescription().HasBackupProgress());
+}
+
+TCheckFunc HasBackupInFly(ui64 txId) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- UNIT_ASSERT(record.GetPathDescription().HasBackupProgress());
+ UNIT_ASSERT(record.GetPathDescription().HasBackupProgress());
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetBackupProgress().GetTxId(), txId);
- };
-}
-
-TCheckFunc BackupHistoryCount(ui64 count) {
+ };
+}
+
+TCheckFunc BackupHistoryCount(ui64 count) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().LastBackupResultSize(), count);
- };
-}
-
-TCheckFunc ColumnFamiliesCount(ui32 size) {
+ };
+}
+
+TCheckFunc ColumnFamiliesCount(ui32 size) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetTable().GetPartitionConfig().ColumnFamiliesSize(), size);
- };
-}
-
-TCheckFunc ColumnFamiliesHas(ui32 familyId) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- bool has = false;
- for (const auto& x: record.GetPathDescription().GetTable().GetPartitionConfig().GetColumnFamilies()) {
- if (x.GetId() == familyId) {
- has = true;
- break;
- }
- }
- UNIT_ASSERT(has);
- };
-}
-
-TCheckFunc ColumnFamiliesHas(ui32 familyId, const TString& familyName) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- bool has = false;
- for (const auto& x: record.GetPathDescription().GetTable().GetPartitionConfig().GetColumnFamilies()) {
- if (x.GetId() == familyId && x.GetName() == familyName) {
- has = true;
- break;
- }
- }
- UNIT_ASSERT(has);
- };
-}
-
+ };
+}
+
+TCheckFunc ColumnFamiliesHas(ui32 familyId) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ bool has = false;
+ for (const auto& x: record.GetPathDescription().GetTable().GetPartitionConfig().GetColumnFamilies()) {
+ if (x.GetId() == familyId) {
+ has = true;
+ break;
+ }
+ }
+ UNIT_ASSERT(has);
+ };
+}
+
+TCheckFunc ColumnFamiliesHas(ui32 familyId, const TString& familyName) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ bool has = false;
+ for (const auto& x: record.GetPathDescription().GetTable().GetPartitionConfig().GetColumnFamilies()) {
+ if (x.GetId() == familyId && x.GetName() == familyName) {
+ has = true;
+ break;
+ }
+ }
+ UNIT_ASSERT(has);
+ };
+}
+
TCheckFunc KeyBloomFilterStatus(bool status) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetTable().GetPartitionConfig().GetEnableFilterByKey(), status);
};
}
-TCheckFunc HasTtlEnabled(const TString& columnName, const TDuration& expireAfter, NKikimrSchemeOp::TTTLSettings::EUnit columnUnit) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+TCheckFunc HasTtlEnabled(const TString& columnName, const TDuration& expireAfter, NKikimrSchemeOp::TTTLSettings::EUnit columnUnit) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
const auto& ttl = record.GetPathDescription().GetTable().GetTTLSettings();
UNIT_ASSERT(ttl.HasEnabled());
UNIT_ASSERT_VALUES_EQUAL(ttl.GetEnabled().GetColumnName(), columnName);
@@ -844,41 +844,41 @@ TCheckFunc HasTtlEnabled(const TString& columnName, const TDuration& expireAfter
}
TCheckFunc HasTtlDisabled() {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
const auto& ttl = record.GetPathDescription().GetTable().GetTTLSettings();
UNIT_ASSERT(ttl.HasDisabled());
};
}
TCheckFunc IsBackupTable(bool value) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_VALUES_EQUAL(value, record.GetPathDescription().GetTable().GetIsBackup());
};
}
TCheckFunc HasOlapTableSchemaPreset(const TString& presetName) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
const auto& table = record.GetPathDescription().GetColumnTableDescription();
UNIT_ASSERT_VALUES_EQUAL(table.GetSchemaPresetName(), presetName);
};
}
TCheckFunc HasOlapTableSchemaVersion(ui64 schemaVersion) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
const auto& table = record.GetPathDescription().GetColumnTableDescription();
UNIT_ASSERT_VALUES_EQUAL(table.GetSchema().GetVersion(), schemaVersion);
};
}
TCheckFunc HasOlapTableTtlSettingsVersion(ui64 ttlSettingsVersion) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
const auto& table = record.GetPathDescription().GetColumnTableDescription();
UNIT_ASSERT_VALUES_EQUAL(table.GetTtlSettings().GetVersion(), ttlSettingsVersion);
};
}
TCheckFunc HasOlapTableTtlSettingsEnabled(const TString& columnName, const TDuration& expireAfter) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
const auto& table = record.GetPathDescription().GetColumnTableDescription();
UNIT_ASSERT(table.HasTtlSettings());
const auto& ttl = table.GetTtlSettings();
@@ -889,7 +889,7 @@ TCheckFunc HasOlapTableTtlSettingsEnabled(const TString& columnName, const TDura
}
TCheckFunc HasOlapTableTtlSettingsDisabled() {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
const auto& table = record.GetPathDescription().GetColumnTableDescription();
UNIT_ASSERT(table.HasTtlSettings());
const auto& ttl = table.GetTtlSettings();
@@ -916,13 +916,13 @@ TCheckFunc HasOlapTableTtlSettingsTiering(ui32 tierNo, const TString& tierName,
void CheckEffectiveRight(const NKikimrScheme::TEvDescribeSchemeResult& record, const TString& right, bool mustHave) {
const auto& self = record.GetPathDescription().GetSelf();
TSecurityObject src(self.GetOwner(), self.GetEffectiveACL(), false);
-
+
NACLib::TSecurityObject required;
required.FromString(right);
-
+
for (const auto& requeriedAce : required.GetACL().GetACE()) {
bool has = false;
-
+
for (const auto& srcAce: src.GetACL().GetACE()) {
if (srcAce.GetAccessType() == requeriedAce.GetAccessType() &&
srcAce.GetAccessRight() == requeriedAce.GetAccessRight() &&
@@ -930,9 +930,9 @@ void CheckEffectiveRight(const NKikimrScheme::TEvDescribeSchemeResult& record, c
srcAce.GetInheritanceType() == requeriedAce.GetInheritanceType())
{
has = true;
- }
- }
-
+ }
+ }
+
UNIT_ASSERT_C(!(has ^ mustHave), "" << (mustHave ? "no " : "") << "ace found"
<< ", got " << src.ShortDebugString()
<< ", required " << required.ShortDebugString());
@@ -942,25 +942,25 @@ void CheckEffectiveRight(const NKikimrScheme::TEvDescribeSchemeResult& record, c
TCheckFunc HasEffectiveRight(const TString& right) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
CheckEffectiveRight(record, right, true);
- };
-}
-
-TCheckFunc HasNotEffectiveRight(const TString& right) {
+ };
+}
+
+TCheckFunc HasNotEffectiveRight(const TString& right) {
return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
CheckEffectiveRight(record, right, false);
- };
-}
-
-TCheckFunc KesusConfigIs(ui64 self_check_period_millis, ui64 session_grace_period_millis) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- const auto& config = record.GetPathDescription().GetKesus().GetConfig();
+ };
+}
+
+TCheckFunc KesusConfigIs(ui64 self_check_period_millis, ui64 session_grace_period_millis) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ const auto& config = record.GetPathDescription().GetKesus().GetConfig();
UNIT_ASSERT_VALUES_EQUAL(config.self_check_period_millis(), self_check_period_millis);
UNIT_ASSERT_VALUES_EQUAL(config.session_grace_period_millis(), session_grace_period_millis);
- };
-}
-
+ };
+}
+
TCheckFunc DatabaseQuotas(ui64 dataStreamShards) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
UNIT_ASSERT_C(IsGoodDomainStatus(record.GetStatus()), "Unexpected status: " << record.GetStatus());
const auto& pathDescr = record.GetPathDescription();
@@ -972,23 +972,23 @@ TCheckFunc DatabaseQuotas(ui64 dataStreamShards) {
" has data stream shards " << count <<
" but expected " << dataStreamShards);
};
-}
+}
-TCheckFunc PartitionKeys(TVector<TString> lastShardKeys) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+TCheckFunc PartitionKeys(TVector<TString> lastShardKeys) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
const auto& pathDescr = record.GetPathDescription();
UNIT_ASSERT_VALUES_EQUAL(lastShardKeys.size(), pathDescr.TablePartitionsSize());
- for (size_t i = 0; i < lastShardKeys.size(); ++i) {
+ for (size_t i = 0; i < lastShardKeys.size(); ++i) {
UNIT_ASSERT_STRING_CONTAINS(pathDescr.GetTablePartitions(i).GetEndOfRangeKeyPrefix(), lastShardKeys[i]);
- }
- };
-}
-
+ }
+ };
+}
+
} // NLs
} // NSchemeShardUT_Private
-Y_DECLARE_OUT_SPEC(inline, NKikimrSchemeOp::TTTLSettings::EUnit, o, x) {
- o << NKikimrSchemeOp::TTTLSettings::EUnit_Name(x);
+Y_DECLARE_OUT_SPEC(inline, NKikimrSchemeOp::TTTLSettings::EUnit, o, x) {
+ o << NKikimrSchemeOp::TTTLSettings::EUnit_Name(x);
}
Y_DECLARE_OUT_SPEC(inline, NKikimrScheme::EStatus, o, x) {
diff --git a/ydb/core/tx/schemeshard/ut_helpers/ls_checks.h b/ydb/core/tx/schemeshard/ut_helpers/ls_checks.h
index f544e9aee85..33022e42576 100644
--- a/ydb/core/tx/schemeshard/ut_helpers/ls_checks.h
+++ b/ydb/core/tx/schemeshard/ut_helpers/ls_checks.h
@@ -1,105 +1,105 @@
-#pragma once
-
+#pragma once
+
#include <ydb/core/protos/flat_tx_scheme.pb.h>
-
+
#include <ydb/core/testlib/actors/test_runtime.h>
#include <ydb/core/base/pathid.h>
-
-#include <functional>
-
-namespace NSchemeShardUT_Private {
-
-using NKikimr::TOwnerId;
-using NKikimr::TLocalPathId;
-using NKikimr::TPathId;
-
-struct TPathVersion {
- TPathId PathId = TPathId();
- ui64 Version = Max<ui64>();
-};
-using TApplyIf = TVector<TPathVersion>;
-
-using TUserAttrs = TVector<std::pair<TString, TString>>;
-
-namespace NLs {
- using TCheckFunc = std::function<void (const NKikimrScheme::TEvDescribeSchemeResult&)>;
-
- TCheckFunc ExtractVolumeConfig(NKikimrBlockStore::TVolumeConfig* config);
- TCheckFunc CheckMountToken(const TString& name, const TString& expectedOwner);
-
- TCheckFunc UserAttrsEqual(TUserAttrs attrs);
- TCheckFunc UserAttrsHas(TUserAttrs attrs);
- TCheckFunc PathVersionEqual(ui64 expectedVersion);
- TCheckFunc PathVersionOneOf(TSet<ui64> versions);
-
- TCheckFunc PathsInsideDomain(ui64 count);
+
+#include <functional>
+
+namespace NSchemeShardUT_Private {
+
+using NKikimr::TOwnerId;
+using NKikimr::TLocalPathId;
+using NKikimr::TPathId;
+
+struct TPathVersion {
+ TPathId PathId = TPathId();
+ ui64 Version = Max<ui64>();
+};
+using TApplyIf = TVector<TPathVersion>;
+
+using TUserAttrs = TVector<std::pair<TString, TString>>;
+
+namespace NLs {
+ using TCheckFunc = std::function<void (const NKikimrScheme::TEvDescribeSchemeResult&)>;
+
+ TCheckFunc ExtractVolumeConfig(NKikimrBlockStore::TVolumeConfig* config);
+ TCheckFunc CheckMountToken(const TString& name, const TString& expectedOwner);
+
+ TCheckFunc UserAttrsEqual(TUserAttrs attrs);
+ TCheckFunc UserAttrsHas(TUserAttrs attrs);
+ TCheckFunc PathVersionEqual(ui64 expectedVersion);
+ TCheckFunc PathVersionOneOf(TSet<ui64> versions);
+
+ TCheckFunc PathsInsideDomain(ui64 count);
TCheckFunc PQPartitionsInsideDomain(ui64 count);
- TCheckFunc PathsInsideDomainOneOf(TSet<ui64> variants);
- TCheckFunc ShardsInsideDomain(ui64 count);
- TCheckFunc ShardsInsideDomainOneOf(TSet<ui64> variants);
+ TCheckFunc PathsInsideDomainOneOf(TSet<ui64> variants);
+ TCheckFunc ShardsInsideDomain(ui64 count);
+ TCheckFunc ShardsInsideDomainOneOf(TSet<ui64> variants);
TCheckFunc DomainLimitsIs(ui64 maxPaths, ui64 maxShards, ui64 maxPQPartitions = 0);
-
- TCheckFunc FreezeStateEqual(NKikimrSchemeOp::EFreezeState expectedState);
-
-
- void NotInSubdomain(const NKikimrScheme::TEvDescribeSchemeResult& record);
- void InSubdomain(const NKikimrScheme::TEvDescribeSchemeResult& record);
- void SubdomainWithNoEmptyStoragePools(const NKikimrScheme::TEvDescribeSchemeResult& record);
-
- TCheckFunc IsSubDomain(const TString& name);
- TCheckFunc SubDomainVersion(ui64 descrVersion);
- TCheckFunc StoragePoolsEqual(TSet<TString> poolNames);
- TCheckFunc DomainCoordinators(TVector<ui64> coordinators);
- TCheckFunc DomainMediators(TVector<ui64> mediators);
- TCheckFunc DomainSchemeshard(ui64 schemeshard);
- TCheckFunc DomainKey(ui64 pathId, ui64 schemeshardId);
- TCheckFunc DomainKey(TPathId pathId);
- TCheckFunc DomainSettings(ui32 planResolution, ui32 timeCastBucketsPerMediator);
- TCheckFunc DatabaseSizeIs(ui64 bytes);
-
- TCheckFunc IsExternalSubDomain(const TString& name);
- void InExternalSubdomain(const NKikimrScheme::TEvDescribeSchemeResult& record);
- TCheckFunc ExtractTenantSchemeshard(ui64* tenantSchemeShard);
+
+ TCheckFunc FreezeStateEqual(NKikimrSchemeOp::EFreezeState expectedState);
+
+
+ void NotInSubdomain(const NKikimrScheme::TEvDescribeSchemeResult& record);
+ void InSubdomain(const NKikimrScheme::TEvDescribeSchemeResult& record);
+ void SubdomainWithNoEmptyStoragePools(const NKikimrScheme::TEvDescribeSchemeResult& record);
+
+ TCheckFunc IsSubDomain(const TString& name);
+ TCheckFunc SubDomainVersion(ui64 descrVersion);
+ TCheckFunc StoragePoolsEqual(TSet<TString> poolNames);
+ TCheckFunc DomainCoordinators(TVector<ui64> coordinators);
+ TCheckFunc DomainMediators(TVector<ui64> mediators);
+ TCheckFunc DomainSchemeshard(ui64 schemeshard);
+ TCheckFunc DomainKey(ui64 pathId, ui64 schemeshardId);
+ TCheckFunc DomainKey(TPathId pathId);
+ TCheckFunc DomainSettings(ui32 planResolution, ui32 timeCastBucketsPerMediator);
+ TCheckFunc DatabaseSizeIs(ui64 bytes);
+
+ TCheckFunc IsExternalSubDomain(const TString& name);
+ void InExternalSubdomain(const NKikimrScheme::TEvDescribeSchemeResult& record);
+ TCheckFunc ExtractTenantSchemeshard(ui64* tenantSchemeShard);
TCheckFunc ExtractTenantSysViewProcessor(ui64* tenantSVP);
-
- void NotFinished(const NKikimrScheme::TEvDescribeSchemeResult& record);
- void Finished(const NKikimrScheme::TEvDescribeSchemeResult& record);
- TCheckFunc CreatedAt(ui64 txId);
-
-
- TCheckFunc PathIdEqual(TPathId pathId);
- TCheckFunc PathIdEqual(ui64 pathId);
+
+ void NotFinished(const NKikimrScheme::TEvDescribeSchemeResult& record);
+ void Finished(const NKikimrScheme::TEvDescribeSchemeResult& record);
+ TCheckFunc CreatedAt(ui64 txId);
+
+
+ TCheckFunc PathIdEqual(TPathId pathId);
+ TCheckFunc PathIdEqual(ui64 pathId);
TCheckFunc PathStringEqual(const TString& path);
- void NoChildren(const NKikimrScheme::TEvDescribeSchemeResult& record);
- TCheckFunc ChildrenCount(ui32 count);
- void PathNotExist(const NKikimrScheme::TEvDescribeSchemeResult& record);
- void PathExist(const NKikimrScheme::TEvDescribeSchemeResult& record);
- void PathRedirected(const NKikimrScheme::TEvDescribeSchemeResult& record);
-
-
- void IsTable(const NKikimrScheme::TEvDescribeSchemeResult& record);
- TCheckFunc CheckColumns(const TString& name, const TSet<TString>& columns, const TSet<TString>& droppedColumns, const TSet<TString> keyColumns,
- NKikimrSchemeOp::EPathState pathState = NKikimrSchemeOp::EPathState::EPathStateNoChanges);
- void CheckBoundaries(const NKikimrScheme::TEvDescribeSchemeResult& record);
- TCheckFunc PartitionCount(ui32 count);
- TCheckFunc PartitionKeys(TVector<TString> lastShardKeys);
+ void NoChildren(const NKikimrScheme::TEvDescribeSchemeResult& record);
+ TCheckFunc ChildrenCount(ui32 count);
+ void PathNotExist(const NKikimrScheme::TEvDescribeSchemeResult& record);
+ void PathExist(const NKikimrScheme::TEvDescribeSchemeResult& record);
+ void PathRedirected(const NKikimrScheme::TEvDescribeSchemeResult& record);
+
+
+ void IsTable(const NKikimrScheme::TEvDescribeSchemeResult& record);
+ TCheckFunc CheckColumns(const TString& name, const TSet<TString>& columns, const TSet<TString>& droppedColumns, const TSet<TString> keyColumns,
+ NKikimrSchemeOp::EPathState pathState = NKikimrSchemeOp::EPathState::EPathStateNoChanges);
+ void CheckBoundaries(const NKikimrScheme::TEvDescribeSchemeResult& record);
+ TCheckFunc PartitionCount(ui32 count);
+ TCheckFunc PartitionKeys(TVector<TString> lastShardKeys);
TCheckFunc FollowerCount(ui32 count);
TCheckFunc CrossDataCenterFollowerCount(ui32 count);
TCheckFunc AllowFollowerPromotion(bool val);
TCheckFunc FollowerGroups(const TVector<NKikimrHive::TFollowerGroup>& followerGroup = TVector<NKikimrHive::TFollowerGroup>{});
- TCheckFunc SizeToSplitEqual(ui32 size);
+ TCheckFunc SizeToSplitEqual(ui32 size);
TCheckFunc MinPartitionsCountEqual(ui32 count);
TCheckFunc MaxPartitionsCountEqual(ui32 count);
TCheckFunc PartitioningByLoadStatus(bool status);
- TCheckFunc ColumnFamiliesCount(ui32 size);
- TCheckFunc ColumnFamiliesHas(ui32 familyId);
- TCheckFunc ColumnFamiliesHas(ui32 familyId, const TString& familyName);
+ TCheckFunc ColumnFamiliesCount(ui32 size);
+ TCheckFunc ColumnFamiliesHas(ui32 familyId);
+ TCheckFunc ColumnFamiliesHas(ui32 familyId, const TString& familyName);
TCheckFunc KeyBloomFilterStatus(bool status);
TCheckFunc HasTtlEnabled(const TString& columnName, const TDuration& expireAfter,
- NKikimrSchemeOp::TTTLSettings::EUnit columnUnit = NKikimrSchemeOp::TTTLSettings::UNIT_AUTO);
+ NKikimrSchemeOp::TTTLSettings::EUnit columnUnit = NKikimrSchemeOp::TTTLSettings::UNIT_AUTO);
TCheckFunc HasTtlDisabled();
TCheckFunc IsBackupTable(bool value);
-
+
TCheckFunc HasOlapTableSchemaPreset(const TString& presetName);
TCheckFunc HasOlapTableSchemaVersion(ui64 schemaVersion);
TCheckFunc HasOlapTableTtlSettingsVersion(ui64 ttlSettingsVersion);
@@ -108,42 +108,42 @@ namespace NLs {
TCheckFunc HasOlapTableTtlSettingsTiering(ui32 tierNo, const TString& tierName, const TString& columnName,
const TDuration& evictAfter);
- TCheckFunc CheckPartCount(const TString& name, ui32 partCount, ui32 maxParts, ui32 tabletCount, ui32 groupCount,
- NKikimrSchemeOp::EPathState pathState = NKikimrSchemeOp::EPathState::EPathStateNoChanges);
- TCheckFunc IndexesCount(ui32 count);
-
- TCheckFunc IndexType(NKikimrSchemeOp::EIndexType type);
- TCheckFunc IndexState(NKikimrSchemeOp::EIndexState state);
- TCheckFunc IndexKeys(const TVector<TString>& keyNames);
+ TCheckFunc CheckPartCount(const TString& name, ui32 partCount, ui32 maxParts, ui32 tabletCount, ui32 groupCount,
+ NKikimrSchemeOp::EPathState pathState = NKikimrSchemeOp::EPathState::EPathStateNoChanges);
+ TCheckFunc IndexesCount(ui32 count);
+
+ TCheckFunc IndexType(NKikimrSchemeOp::EIndexType type);
+ TCheckFunc IndexState(NKikimrSchemeOp::EIndexState state);
+ TCheckFunc IndexKeys(const TVector<TString>& keyNames);
TCheckFunc IndexDataColumns(const TVector<TString>& dataColumnNames);
-
- TCheckFunc HasBackupInFly(ui64 txId);
- void NoBackupInFly(const NKikimrScheme::TEvDescribeSchemeResult& record);
- TCheckFunc BackupHistoryCount(ui64 count);
-
- TCheckFunc HasEffectiveRight(const TString& right);
- TCheckFunc HasNotEffectiveRight(const TString& right);
-
- TCheckFunc KesusConfigIs(ui64 self_check_period_millis, ui64 session_grace_period_millis);
+
+ TCheckFunc HasBackupInFly(ui64 txId);
+ void NoBackupInFly(const NKikimrScheme::TEvDescribeSchemeResult& record);
+ TCheckFunc BackupHistoryCount(ui64 count);
+
+ TCheckFunc HasEffectiveRight(const TString& right);
+ TCheckFunc HasNotEffectiveRight(const TString& right);
+
+ TCheckFunc KesusConfigIs(ui64 self_check_period_millis, ui64 session_grace_period_millis);
TCheckFunc DatabaseQuotas(ui64 dataStreamShards);
template<class TCheck>
- void PerformAllChecks(const NKikimrScheme::TEvDescribeSchemeResult& result, TCheck&& check) {
+ void PerformAllChecks(const NKikimrScheme::TEvDescribeSchemeResult& result, TCheck&& check) {
check(result);
}
template<class TCheck, class... TArgs>
- void PerformAllChecks(const NKikimrScheme::TEvDescribeSchemeResult& result, TCheck&& check, TArgs&&... args) {
+ void PerformAllChecks(const NKikimrScheme::TEvDescribeSchemeResult& result, TCheck&& check, TArgs&&... args) {
check(result);
PerformAllChecks(result, args...);
}
template<class... TArgs>
TCheckFunc All(TArgs&&... args) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& result) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& result) {
return PerformAllChecks(result, args...);
};
}
-}
-}
+}
+}
diff --git a/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp b/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp
index 1aa40ba55e5..9cfd8037b7e 100644
--- a/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp
+++ b/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp
@@ -1,6 +1,6 @@
-#include "test_env.h"
-#include "helpers.h"
-
+#include "test_env.h"
+#include "helpers.h"
+
#include <ydb/core/blockstore/core/blockstore.h>
#include <ydb/core/base/tablet_resolver.h>
#include <ydb/core/metering/metering.h>
@@ -10,91 +10,91 @@
#include <ydb/core/tx/tx_allocator/txallocator.h>
#include <ydb/core/tx/tx_proxy/proxy.h>
#include <ydb/core/filestore/core/filestore.h>
-
+
#include <library/cpp/testing/unittest/registar.h>
-
-
-static const bool ENABLE_SCHEMESHARD_LOG = true;
-static const bool ENABLE_DATASHARD_LOG = false;
-static const bool ENABLE_COORDINATOR_MEDIATOR_LOG = false;
-static const bool ENABLE_SCHEMEBOARD_LOG = false;
+
+
+static const bool ENABLE_SCHEMESHARD_LOG = true;
+static const bool ENABLE_DATASHARD_LOG = false;
+static const bool ENABLE_COORDINATOR_MEDIATOR_LOG = false;
+static const bool ENABLE_SCHEMEBOARD_LOG = false;
static const bool ENABLE_OLAP_LOG = false;
-static const bool ENABLE_EXPORT_LOG = false;
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-
-// BlockStoreVolume mock for testing schemeshard
-class TFakeBlockStoreVolume : public TActor<TFakeBlockStoreVolume>, public NTabletFlatExecutor::TTabletExecutedFlat {
-public:
+static const bool ENABLE_EXPORT_LOG = false;
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+
+// BlockStoreVolume mock for testing schemeshard
+class TFakeBlockStoreVolume : public TActor<TFakeBlockStoreVolume>, public NTabletFlatExecutor::TTabletExecutedFlat {
+public:
TFakeBlockStoreVolume(const TActorId& tablet, TTabletStorageInfo* info)
- : TActor(&TThis::StateInit)
- , TTabletExecutedFlat(info, tablet, new NMiniKQL::TMiniKQLFactory)
- {}
-
- void OnActivateExecutor(const TActorContext& ctx) override {
- Become(&TThis::StateWork);
-
- while (!InitialEventsQueue.empty()) {
- TAutoPtr<IEventHandle>& ev = InitialEventsQueue.front();
- ctx.ExecutorThread.Send(ev.Release());
- InitialEventsQueue.pop_front();
- }
- }
-
- void OnDetach(const TActorContext& ctx) override {
- Die(ctx);
- }
-
- void OnTabletDead(TEvTablet::TEvTabletDead::TPtr& ev, const TActorContext& ctx) override {
- Y_UNUSED(ev);
- Die(ctx);
- }
-
- void Enqueue(STFUNC_SIG) override {
- Y_UNUSED(ctx);
- InitialEventsQueue.push_back(ev);
- }
-
- STFUNC(StateInit) {
- StateInitImpl(ev, ctx);
- }
-
- STFUNC(StateWork) {
- switch (ev->GetTypeRewrite()) {
- HFunc(TEvTablet::TEvTabletDead, HandleTabletDead);
- HFunc(TEvBlockStore::TEvUpdateVolumeConfig, Handle);
- HFunc(TEvents::TEvPoisonPill, Handle);
- }
- }
-
- STFUNC(StateBroken) {
- switch (ev->GetTypeRewrite()) {
- HFunc(TEvTablet::TEvTabletDead, HandleTabletDead);
- }
- }
-
-private:
- void Handle(TEvBlockStore::TEvUpdateVolumeConfig::TPtr& ev, const TActorContext& ctx) {
- const auto& request = ev->Get()->Record;
- TAutoPtr<TEvBlockStore::TEvUpdateVolumeConfigResponse> response =
- new TEvBlockStore::TEvUpdateVolumeConfigResponse();
- response->Record.SetTxId(request.GetTxId());
- response->Record.SetOrigin(TabletID());
- response->Record.SetStatus(NKikimrBlockStore::OK);
- ctx.Send(ev->Sender, response.Release());
- }
-
- void Handle(TEvents::TEvPoisonPill::TPtr& ev, const TActorContext& ctx) {
- Y_UNUSED(ev);
- Become(&TThis::StateBroken);
- ctx.Send(Tablet(), new TEvents::TEvPoisonPill());
- }
-
-private:
- TDeque<TAutoPtr<IEventHandle>> InitialEventsQueue;
-};
-
+ : TActor(&TThis::StateInit)
+ , TTabletExecutedFlat(info, tablet, new NMiniKQL::TMiniKQLFactory)
+ {}
+
+ void OnActivateExecutor(const TActorContext& ctx) override {
+ Become(&TThis::StateWork);
+
+ while (!InitialEventsQueue.empty()) {
+ TAutoPtr<IEventHandle>& ev = InitialEventsQueue.front();
+ ctx.ExecutorThread.Send(ev.Release());
+ InitialEventsQueue.pop_front();
+ }
+ }
+
+ void OnDetach(const TActorContext& ctx) override {
+ Die(ctx);
+ }
+
+ void OnTabletDead(TEvTablet::TEvTabletDead::TPtr& ev, const TActorContext& ctx) override {
+ Y_UNUSED(ev);
+ Die(ctx);
+ }
+
+ void Enqueue(STFUNC_SIG) override {
+ Y_UNUSED(ctx);
+ InitialEventsQueue.push_back(ev);
+ }
+
+ STFUNC(StateInit) {
+ StateInitImpl(ev, ctx);
+ }
+
+ STFUNC(StateWork) {
+ switch (ev->GetTypeRewrite()) {
+ HFunc(TEvTablet::TEvTabletDead, HandleTabletDead);
+ HFunc(TEvBlockStore::TEvUpdateVolumeConfig, Handle);
+ HFunc(TEvents::TEvPoisonPill, Handle);
+ }
+ }
+
+ STFUNC(StateBroken) {
+ switch (ev->GetTypeRewrite()) {
+ HFunc(TEvTablet::TEvTabletDead, HandleTabletDead);
+ }
+ }
+
+private:
+ void Handle(TEvBlockStore::TEvUpdateVolumeConfig::TPtr& ev, const TActorContext& ctx) {
+ const auto& request = ev->Get()->Record;
+ TAutoPtr<TEvBlockStore::TEvUpdateVolumeConfigResponse> response =
+ new TEvBlockStore::TEvUpdateVolumeConfigResponse();
+ response->Record.SetTxId(request.GetTxId());
+ response->Record.SetOrigin(TabletID());
+ response->Record.SetStatus(NKikimrBlockStore::OK);
+ ctx.Send(ev->Sender, response.Release());
+ }
+
+ void Handle(TEvents::TEvPoisonPill::TPtr& ev, const TActorContext& ctx) {
+ Y_UNUSED(ev);
+ Become(&TThis::StateBroken);
+ ctx.Send(Tablet(), new TEvents::TEvPoisonPill());
+ }
+
+private:
+ TDeque<TAutoPtr<IEventHandle>> InitialEventsQueue;
+};
+
class TFakeFileStore : public TActor<TFakeFileStore>, public NTabletFlatExecutor::TTabletExecutedFlat {
public:
TFakeFileStore(const TActorId& tablet, TTabletStorageInfo* info)
@@ -165,178 +165,178 @@ private:
TDeque<TAutoPtr<IEventHandle>> InitialEventsQueue;
};
-// Automatically resend notification requests to Schemeshard if it gets restarted
-class TTxNotificationSubscriber : public TActor<TTxNotificationSubscriber> {
-public:
- explicit TTxNotificationSubscriber(ui64 schemeshardTabletId)
- : TActor<TTxNotificationSubscriber>(&TTxNotificationSubscriber::StateWork)
- , SchemeshardTabletId(schemeshardTabletId)
- {}
-
-private:
- void StateWork(TAutoPtr<NActors::IEventHandle> &ev, const NActors::TActorContext &ctx) {
- switch (ev->GetTypeRewrite()) {
- HFunc(TEvTabletPipe::TEvClientConnected, Handle);
- HFunc(TEvTabletPipe::TEvClientDestroyed, Handle);
- HFunc(TEvSchemeShard::TEvNotifyTxCompletion, Handle);
- HFunc(TEvSchemeShard::TEvNotifyTxCompletionResult, Handle);
- };
- }
-
- void Handle(TEvTabletPipe::TEvClientConnected::TPtr &ev, const TActorContext &ctx) {
- TEvTabletPipe::TEvClientConnected *msg = ev->Get();
- if (msg->Status == NKikimrProto::OK)
- return;
-
- DoHandleDisconnect(ev->Get()->ClientId, ctx);
- }
-
- void Handle(TEvTabletPipe::TEvClientDestroyed::TPtr &ev, const TActorContext &ctx) {
- DoHandleDisconnect(ev->Get()->ClientId, ctx);
- }
-
+// Automatically resend notification requests to Schemeshard if it gets restarted
+class TTxNotificationSubscriber : public TActor<TTxNotificationSubscriber> {
+public:
+ explicit TTxNotificationSubscriber(ui64 schemeshardTabletId)
+ : TActor<TTxNotificationSubscriber>(&TTxNotificationSubscriber::StateWork)
+ , SchemeshardTabletId(schemeshardTabletId)
+ {}
+
+private:
+ void StateWork(TAutoPtr<NActors::IEventHandle> &ev, const NActors::TActorContext &ctx) {
+ switch (ev->GetTypeRewrite()) {
+ HFunc(TEvTabletPipe::TEvClientConnected, Handle);
+ HFunc(TEvTabletPipe::TEvClientDestroyed, Handle);
+ HFunc(TEvSchemeShard::TEvNotifyTxCompletion, Handle);
+ HFunc(TEvSchemeShard::TEvNotifyTxCompletionResult, Handle);
+ };
+ }
+
+ void Handle(TEvTabletPipe::TEvClientConnected::TPtr &ev, const TActorContext &ctx) {
+ TEvTabletPipe::TEvClientConnected *msg = ev->Get();
+ if (msg->Status == NKikimrProto::OK)
+ return;
+
+ DoHandleDisconnect(ev->Get()->ClientId, ctx);
+ }
+
+ void Handle(TEvTabletPipe::TEvClientDestroyed::TPtr &ev, const TActorContext &ctx) {
+ DoHandleDisconnect(ev->Get()->ClientId, ctx);
+ }
+
void DoHandleDisconnect(TActorId pipeClient, const TActorContext &ctx) {
- if (pipeClient == SchemeShardPipe) {
+ if (pipeClient == SchemeShardPipe) {
SchemeShardPipe = TActorId();
- // Resend all
- for (const auto& w : SchemeTxWaiters) {
- SendToSchemeshard(w.first, ctx);
- }
- }
- }
-
- void Handle(TEvSchemeShard::TEvNotifyTxCompletion::TPtr &ev, const TActorContext &ctx) {
- ui64 txId = ev->Get()->Record.GetTxId();
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "tests -- TTxNotificationSubscriber got TEvNotifyTxCompletion"
- << ", txId: " << txId);
-
- if (SchemeTxWaiters.contains(txId)) {
- return;
- }
-
- // Save TxId, forward to schemeshard
- SchemeTxWaiters[txId].insert(ev->Sender);
- SendToSchemeshard(txId, ctx);
- }
-
- void Handle(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr &ev, const TActorContext &ctx) {
- ui64 txId = ev->Get()->Record.GetTxId();
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "tests -- TTxNotificationSubscriber got TEvNotifyTxCompletionResult"
- << ", txId: " << txId);
-
- if (!SchemeTxWaiters.contains(txId))
- return;
-
- // Notifify all waiters and forget TxId
+ // Resend all
+ for (const auto& w : SchemeTxWaiters) {
+ SendToSchemeshard(w.first, ctx);
+ }
+ }
+ }
+
+ void Handle(TEvSchemeShard::TEvNotifyTxCompletion::TPtr &ev, const TActorContext &ctx) {
+ ui64 txId = ev->Get()->Record.GetTxId();
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "tests -- TTxNotificationSubscriber got TEvNotifyTxCompletion"
+ << ", txId: " << txId);
+
+ if (SchemeTxWaiters.contains(txId)) {
+ return;
+ }
+
+ // Save TxId, forward to schemeshard
+ SchemeTxWaiters[txId].insert(ev->Sender);
+ SendToSchemeshard(txId, ctx);
+ }
+
+ void Handle(TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr &ev, const TActorContext &ctx) {
+ ui64 txId = ev->Get()->Record.GetTxId();
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "tests -- TTxNotificationSubscriber got TEvNotifyTxCompletionResult"
+ << ", txId: " << txId);
+
+ if (!SchemeTxWaiters.contains(txId))
+ return;
+
+ // Notifify all waiters and forget TxId
for (TActorId waiter : SchemeTxWaiters[txId]) {
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "tests -- TTxNotificationSubscriber satisfy subsriber"
- << ", waiter: " << waiter
- << ", txId: " << txId);
- ctx.Send(waiter, new TEvSchemeShard::TEvNotifyTxCompletionResult(txId));
- }
- SchemeTxWaiters.erase(txId);
- }
-
- void SendToSchemeshard(ui64 txId, const TActorContext &ctx) {
- if (!SchemeShardPipe) {
- SchemeShardPipe = ctx.Register(NTabletPipe::CreateClient(ctx.SelfID, SchemeshardTabletId, GetPipeConfigWithRetries()));
- }
- NTabletPipe::SendData(ctx, SchemeShardPipe, new TEvSchemeShard::TEvNotifyTxCompletion(txId));
- }
-
- void Handle(TEvents::TEvPoisonPill::TPtr, const TActorContext &ctx) {
- if (SchemeShardPipe) {
- NTabletPipe::CloseClient(ctx, SchemeShardPipe);
- }
- Die(ctx);
- }
-
-private:
- ui64 SchemeshardTabletId;
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "tests -- TTxNotificationSubscriber satisfy subsriber"
+ << ", waiter: " << waiter
+ << ", txId: " << txId);
+ ctx.Send(waiter, new TEvSchemeShard::TEvNotifyTxCompletionResult(txId));
+ }
+ SchemeTxWaiters.erase(txId);
+ }
+
+ void SendToSchemeshard(ui64 txId, const TActorContext &ctx) {
+ if (!SchemeShardPipe) {
+ SchemeShardPipe = ctx.Register(NTabletPipe::CreateClient(ctx.SelfID, SchemeshardTabletId, GetPipeConfigWithRetries()));
+ }
+ NTabletPipe::SendData(ctx, SchemeShardPipe, new TEvSchemeShard::TEvNotifyTxCompletion(txId));
+ }
+
+ void Handle(TEvents::TEvPoisonPill::TPtr, const TActorContext &ctx) {
+ if (SchemeShardPipe) {
+ NTabletPipe::CloseClient(ctx, SchemeShardPipe);
+ }
+ Die(ctx);
+ }
+
+private:
+ ui64 SchemeshardTabletId;
TActorId SchemeShardPipe;
THashMap<ui64, THashSet<TActorId>> SchemeTxWaiters;
-};
-
-
-// Automatically resend notification requests to Schemeshard if it gets restarted
-class TFakeMetering : public TActor<TFakeMetering> {
- TVector<TString> Jsons;
-
-public:
- explicit TFakeMetering()
- : TActor<TFakeMetering>(&TFakeMetering::StateWork)
- {}
-
-private:
- STFUNC(StateWork) {
- switch (ev->GetTypeRewrite()) {
- HFunc(TEvents::TEvPoisonPill, HandlePoisonPill);
- HFunc(NMetering::TEvMetering::TEvWriteMeteringJson, HandleWriteMeteringJson);
- default:
- HandleUnexpectedEvent(ev, ctx);
- break;
- }
- }
-
- void HandlePoisonPill(const TEvents::TEvPoisonPill::TPtr& ev, const TActorContext& ctx) {
- Y_UNUSED(ev);
- Die(ctx);
- }
-
- void HandleWriteMeteringJson(
- const NMetering::TEvMetering::TEvWriteMeteringJson::TPtr& ev,
- const TActorContext& ctx)
- {
- Y_UNUSED(ctx);
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "tests -- TFakeMetering got TEvMetering::TEvWriteMeteringJson");
-
- const auto* msg = ev->Get();
-
- Jsons.push_back(msg->MeteringJson);
- }
-
- void HandleUnexpectedEvent(STFUNC_SIG)
- {
- Y_UNUSED(ctx);
-
- LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
- "TFakeMetering:"
- << " unhandled event type: " << ev->GetTypeRewrite()
- << " event: " << (ev->HasEvent() ? ev->GetBase()->ToString().data() : "serialized?"));
- }
-
-private:
-};
-
-
-// Automatically resend transaction requests to Schemeshard if it gets restarted
-class TTxReliablePropose : public TActor<TTxReliablePropose> {
-public:
- explicit TTxReliablePropose(ui64 schemeshardTabletId)
- : TActor<TTxReliablePropose>(&TTxReliablePropose::StateWork)
- , SchemeshardTabletId(schemeshardTabletId)
- {}
-
-private:
- using TPreSerialisedMessage = std::pair<ui32, TIntrusivePtr<TEventSerializedData>>; // ui32 it's a type
-
-private:
- void StateWork(TAutoPtr<NActors::IEventHandle> &ev, const NActors::TActorContext &ctx) {
- switch (ev->GetTypeRewrite()) {
- HFunc(TEvTabletPipe::TEvClientConnected, Handle);
- HFunc(TEvTabletPipe::TEvClientDestroyed, Handle);
-
- HFunc(TEvSchemeShard::TEvModifySchemeTransaction, Handle);
- HFunc(TEvSchemeShard::TEvModifySchemeTransactionResult, Handle);
-
- HFunc(TEvSchemeShard::TEvCancelTx, Handle);
- HFunc(TEvSchemeShard::TEvCancelTxResult, Handle);
+};
+
+
+// Automatically resend notification requests to Schemeshard if it gets restarted
+class TFakeMetering : public TActor<TFakeMetering> {
+ TVector<TString> Jsons;
+
+public:
+ explicit TFakeMetering()
+ : TActor<TFakeMetering>(&TFakeMetering::StateWork)
+ {}
+
+private:
+ STFUNC(StateWork) {
+ switch (ev->GetTypeRewrite()) {
+ HFunc(TEvents::TEvPoisonPill, HandlePoisonPill);
+ HFunc(NMetering::TEvMetering::TEvWriteMeteringJson, HandleWriteMeteringJson);
+ default:
+ HandleUnexpectedEvent(ev, ctx);
+ break;
+ }
+ }
+
+ void HandlePoisonPill(const TEvents::TEvPoisonPill::TPtr& ev, const TActorContext& ctx) {
+ Y_UNUSED(ev);
+ Die(ctx);
+ }
+
+ void HandleWriteMeteringJson(
+ const NMetering::TEvMetering::TEvWriteMeteringJson::TPtr& ev,
+ const TActorContext& ctx)
+ {
+ Y_UNUSED(ctx);
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "tests -- TFakeMetering got TEvMetering::TEvWriteMeteringJson");
+
+ const auto* msg = ev->Get();
+
+ Jsons.push_back(msg->MeteringJson);
+ }
+
+ void HandleUnexpectedEvent(STFUNC_SIG)
+ {
+ Y_UNUSED(ctx);
+
+ LOG_DEBUG_S(ctx, NKikimrServices::FLAT_TX_SCHEMESHARD,
+ "TFakeMetering:"
+ << " unhandled event type: " << ev->GetTypeRewrite()
+ << " event: " << (ev->HasEvent() ? ev->GetBase()->ToString().data() : "serialized?"));
+ }
+
+private:
+};
+
+
+// Automatically resend transaction requests to Schemeshard if it gets restarted
+class TTxReliablePropose : public TActor<TTxReliablePropose> {
+public:
+ explicit TTxReliablePropose(ui64 schemeshardTabletId)
+ : TActor<TTxReliablePropose>(&TTxReliablePropose::StateWork)
+ , SchemeshardTabletId(schemeshardTabletId)
+ {}
+
+private:
+ using TPreSerialisedMessage = std::pair<ui32, TIntrusivePtr<TEventSerializedData>>; // ui32 it's a type
+
+private:
+ void StateWork(TAutoPtr<NActors::IEventHandle> &ev, const NActors::TActorContext &ctx) {
+ switch (ev->GetTypeRewrite()) {
+ HFunc(TEvTabletPipe::TEvClientConnected, Handle);
+ HFunc(TEvTabletPipe::TEvClientDestroyed, Handle);
+
+ HFunc(TEvSchemeShard::TEvModifySchemeTransaction, Handle);
+ HFunc(TEvSchemeShard::TEvModifySchemeTransactionResult, Handle);
+
+ HFunc(TEvSchemeShard::TEvCancelTx, Handle);
+ HFunc(TEvSchemeShard::TEvCancelTxResult, Handle);
HFunc(TEvExport::TEvCancelExportRequest, Handle);
HFunc(TEvExport::TEvCancelExportResponse, Handle);
@@ -346,51 +346,51 @@ private:
HFunc(TEvImport::TEvCancelImportRequest, Handle);
HFunc(TEvImport::TEvCancelImportResponse, Handle);
- };
- }
-
- void Handle(TEvTabletPipe::TEvClientConnected::TPtr &ev, const TActorContext &ctx) {
- TEvTabletPipe::TEvClientConnected *msg = ev->Get();
- if (msg->Status == NKikimrProto::OK)
- return;
-
- DoHandleDisconnect(ev->Get()->ClientId, ctx);
- }
-
- void Handle(TEvTabletPipe::TEvClientDestroyed::TPtr &ev, const TActorContext &ctx) {
- DoHandleDisconnect(ev->Get()->ClientId, ctx);
- }
-
+ };
+ }
+
+ void Handle(TEvTabletPipe::TEvClientConnected::TPtr &ev, const TActorContext &ctx) {
+ TEvTabletPipe::TEvClientConnected *msg = ev->Get();
+ if (msg->Status == NKikimrProto::OK)
+ return;
+
+ DoHandleDisconnect(ev->Get()->ClientId, ctx);
+ }
+
+ void Handle(TEvTabletPipe::TEvClientDestroyed::TPtr &ev, const TActorContext &ctx) {
+ DoHandleDisconnect(ev->Get()->ClientId, ctx);
+ }
+
void DoHandleDisconnect(TActorId pipeClient, const TActorContext &ctx) {
- if (pipeClient == SchemeShardPipe) {
+ if (pipeClient == SchemeShardPipe) {
SchemeShardPipe = TActorId();
- // Resend all
- for (const auto& w : SchemeTxWaiters) {
- SendToSchemeshard(w.first, ctx);
- }
- }
- }
-
- template<class TEventPtr>
- void HandleRequest(TEventPtr &ev, const TActorContext &ctx) {
- ui64 txId = ev->Get()->Record.GetTxId();
- if (SchemeTxWaiters.contains(txId))
- return;
-
- // Save TxId, forward to schemeshard
- SchemeTxWaiters[txId] = ev->Sender;
- OnlineRequests[txId] = GetSerialisedMessage(ev->ReleaseBase());
- SendToSchemeshard(txId, ctx);
- }
-
- void Handle(TEvSchemeShard::TEvModifySchemeTransaction::TPtr &ev, const TActorContext &ctx) {
- HandleRequest(ev, ctx);
- }
-
- void Handle(TEvSchemeShard::TEvCancelTx::TPtr &ev, const TActorContext &ctx) {
- HandleRequest(ev, ctx);
- }
-
+ // Resend all
+ for (const auto& w : SchemeTxWaiters) {
+ SendToSchemeshard(w.first, ctx);
+ }
+ }
+ }
+
+ template<class TEventPtr>
+ void HandleRequest(TEventPtr &ev, const TActorContext &ctx) {
+ ui64 txId = ev->Get()->Record.GetTxId();
+ if (SchemeTxWaiters.contains(txId))
+ return;
+
+ // Save TxId, forward to schemeshard
+ SchemeTxWaiters[txId] = ev->Sender;
+ OnlineRequests[txId] = GetSerialisedMessage(ev->ReleaseBase());
+ SendToSchemeshard(txId, ctx);
+ }
+
+ void Handle(TEvSchemeShard::TEvModifySchemeTransaction::TPtr &ev, const TActorContext &ctx) {
+ HandleRequest(ev, ctx);
+ }
+
+ void Handle(TEvSchemeShard::TEvCancelTx::TPtr &ev, const TActorContext &ctx) {
+ HandleRequest(ev, ctx);
+ }
+
void Handle(TEvExport::TEvCancelExportRequest::TPtr &ev, const TActorContext &ctx) {
HandleRequest(ev, ctx);
}
@@ -403,26 +403,26 @@ private:
HandleRequest(ev, ctx);
}
- template<class TEventPtr>
- void HandleResponse(TEventPtr &ev, const TActorContext &ctx) {
- ui64 txId = ev->Get()->Record.GetTxId();
- if (!SchemeTxWaiters.contains(txId))
- return;
-
- ctx.Send(SchemeTxWaiters[txId], ev->ReleaseBase().Release());
-
- SchemeTxWaiters.erase(txId);
- OnlineRequests.erase(txId);
- }
-
- void Handle(TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr &ev, const TActorContext &ctx) {
- HandleResponse(ev, ctx);
- }
-
- void Handle(TEvSchemeShard::TEvCancelTxResult::TPtr &ev, const TActorContext &ctx) {
- HandleResponse(ev, ctx);
- }
-
+ template<class TEventPtr>
+ void HandleResponse(TEventPtr &ev, const TActorContext &ctx) {
+ ui64 txId = ev->Get()->Record.GetTxId();
+ if (!SchemeTxWaiters.contains(txId))
+ return;
+
+ ctx.Send(SchemeTxWaiters[txId], ev->ReleaseBase().Release());
+
+ SchemeTxWaiters.erase(txId);
+ OnlineRequests.erase(txId);
+ }
+
+ void Handle(TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr &ev, const TActorContext &ctx) {
+ HandleResponse(ev, ctx);
+ }
+
+ void Handle(TEvSchemeShard::TEvCancelTxResult::TPtr &ev, const TActorContext &ctx) {
+ HandleResponse(ev, ctx);
+ }
+
void Handle(TEvExport::TEvCancelExportResponse::TPtr &ev, const TActorContext &ctx) {
HandleResponse(ev, ctx);
}
@@ -435,65 +435,65 @@ private:
HandleResponse(ev, ctx);
}
- void SendToSchemeshard(ui64 txId, const TActorContext &ctx) {
- if (!SchemeShardPipe) {
- SchemeShardPipe = ctx.Register(NTabletPipe::CreateClient(ctx.SelfID, SchemeshardTabletId, GetPipeConfigWithRetries()));
- }
-
- TPreSerialisedMessage& preSerialisedMessages = OnlineRequests[txId];
- NTabletPipe::SendData(ctx, SchemeShardPipe, preSerialisedMessages.first, preSerialisedMessages.second, 0);
- }
-
- void Handle(TEvents::TEvPoisonPill::TPtr, const TActorContext &ctx) {
- if (SchemeShardPipe) {
- NTabletPipe::CloseClient(ctx, SchemeShardPipe);
- }
- Die(ctx);
- }
-
- TPreSerialisedMessage GetSerialisedMessage(TAutoPtr<IEventBase> message) {
- TAllocChunkSerializer serializer;
+ void SendToSchemeshard(ui64 txId, const TActorContext &ctx) {
+ if (!SchemeShardPipe) {
+ SchemeShardPipe = ctx.Register(NTabletPipe::CreateClient(ctx.SelfID, SchemeshardTabletId, GetPipeConfigWithRetries()));
+ }
+
+ TPreSerialisedMessage& preSerialisedMessages = OnlineRequests[txId];
+ NTabletPipe::SendData(ctx, SchemeShardPipe, preSerialisedMessages.first, preSerialisedMessages.second, 0);
+ }
+
+ void Handle(TEvents::TEvPoisonPill::TPtr, const TActorContext &ctx) {
+ if (SchemeShardPipe) {
+ NTabletPipe::CloseClient(ctx, SchemeShardPipe);
+ }
+ Die(ctx);
+ }
+
+ TPreSerialisedMessage GetSerialisedMessage(TAutoPtr<IEventBase> message) {
+ TAllocChunkSerializer serializer;
const bool success = message->SerializeToArcadiaStream(&serializer);
- Y_VERIFY(success);
- TIntrusivePtr<TEventSerializedData> data = serializer.Release(message->IsExtendedFormat());
- return TPreSerialisedMessage(message->Type(), data);
- }
-
-private:
- ui64 SchemeshardTabletId;
+ Y_VERIFY(success);
+ TIntrusivePtr<TEventSerializedData> data = serializer.Release(message->IsExtendedFormat());
+ return TPreSerialisedMessage(message->Type(), data);
+ }
+
+private:
+ ui64 SchemeshardTabletId;
TActorId SchemeShardPipe;
- THashMap<ui64, TPreSerialisedMessage> OnlineRequests;
+ THashMap<ui64, TPreSerialisedMessage> OnlineRequests;
THashMap<ui64, TActorId> SchemeTxWaiters;
-};
-
-
-// Globally enable/disable log batching at datashard creation time in test
-struct TDatashardLogBatchingSwitch {
- explicit TDatashardLogBatchingSwitch(bool newVal) {
+};
+
+
+// Globally enable/disable log batching at datashard creation time in test
+struct TDatashardLogBatchingSwitch {
+ explicit TDatashardLogBatchingSwitch(bool newVal) {
PrevVal = NKikimr::NDataShard::gAllowLogBatchingDefaultValue;
NKikimr::NDataShard::gAllowLogBatchingDefaultValue = newVal;
- }
-
- ~TDatashardLogBatchingSwitch() {
+ }
+
+ ~TDatashardLogBatchingSwitch() {
NKikimr::NDataShard::gAllowLogBatchingDefaultValue = PrevVal;
- }
-private:
- bool PrevVal;
-};
-
+ }
+private:
+ bool PrevVal;
+};
+
NSchemeShardUT_Private::TTestEnv::TTestEnv(TTestActorRuntime& runtime, const TTestEnvOptions& opts, TSchemeShardFactory ssFactory, std::shared_ptr<NKikimr::NDataShard::IExportFactory> dsExportFactory)
- : SchemeShardFactory(ssFactory)
- , HiveState(new TFakeHiveState)
- , CoordinatorState(new TFakeCoordinator::TState)
+ : SchemeShardFactory(ssFactory)
+ , HiveState(new TFakeHiveState)
+ , CoordinatorState(new TFakeCoordinator::TState)
, ChannelsCount(opts.NChannels_)
-{
+{
ui64 hive = TTestTxConfig::Hive;
ui64 schemeRoot = TTestTxConfig::SchemeShard;
ui64 coordinator = TTestTxConfig::Coordinator;
ui64 txAllocator = TTestTxConfig::TxAllocator;
-
+
TAppPrepare app(dsExportFactory ? dsExportFactory : static_cast<std::shared_ptr<NKikimr::NDataShard::IExportFactory>>(std::make_shared<TDataShardExportFactory>()));
-
+
app.SetEnableDataColumnForIndexTable(true);
app.SetEnableSystemViews(opts.EnableSystemViews_);
app.SetEnablePersistentPartitionStats(opts.EnablePersistentPartitionStats_);
@@ -501,10 +501,10 @@ NSchemeShardUT_Private::TTestEnv::TTestEnv(TTestActorRuntime& runtime, const TTe
app.SetAllowUpdateChannelsBindingOfSolomonPartitions(opts.AllowUpdateChannelsBindingOfSolomonPartitions_);
app.SetEnableAsyncIndexes(opts.EnableAsyncIndexes_);
app.SetEnableNotNullColumns(opts.EnableNotNullColumns_);
- app.SetEnableSchemeTransactionsAtSchemeShard(opts.EnableSchemeTransactionsAtSchemeShard_);
+ app.SetEnableSchemeTransactionsAtSchemeShard(opts.EnableSchemeTransactionsAtSchemeShard_);
app.SetEnableOlapSchemaOperations(opts.EnableOlapSchemaOperations_);
app.SetEnableProtoSourceIdInfo(opts.EnableProtoSourceIdInfo_);
- app.SetEnableBackgroundCompaction(opts.EnableBackgroundCompaction_);
+ app.SetEnableBackgroundCompaction(opts.EnableBackgroundCompaction_);
app.FeatureFlags.SetEnablePublicApiExternalBlobs(true);
for (const auto& sid : opts.SystemBackupSIDs_) {
@@ -512,28 +512,28 @@ NSchemeShardUT_Private::TTestEnv::TTestEnv(TTestActorRuntime& runtime, const TTe
}
AddDomain(runtime, app, TTestTxConfig::DomainUid, 0, hive, schemeRoot);
-
- SetupLogging(runtime);
+
+ SetupLogging(runtime);
SetupChannelProfiles(app, TTestTxConfig::DomainUid, ChannelsCount);
for (ui32 node = 0; node < runtime.GetNodeCount(); ++node) {
SetupSchemeCache(runtime, node, app.Domains->GetDomain(TTestTxConfig::DomainUid).Name);
}
- SetupTabletServices(runtime, &app);
+ SetupTabletServices(runtime, &app);
if (opts.EnablePipeRetries_) {
- EnableSchemeshardPipeRetriesGuard = EnableSchemeshardPipeRetries(runtime);
- }
-
+ EnableSchemeshardPipeRetriesGuard = EnableSchemeshardPipeRetries(runtime);
+ }
+
TActorId sender = runtime.AllocateEdgeActor();
//CreateTestBootstrapper(runtime, CreateTestTabletInfo(MakeBSControllerID(TTestTxConfig::DomainUid), TTabletTypes::FLAT_BS_CONTROLLER), &CreateFlatBsController);
- BootSchemeShard(runtime, schemeRoot);
- BootTxAllocator(runtime, txAllocator);
- BootFakeCoordinator(runtime, coordinator, CoordinatorState);
- BootFakeHive(runtime, hive, HiveState, &GetTabletCreationFunc);
-
+ BootSchemeShard(runtime, schemeRoot);
+ BootTxAllocator(runtime, txAllocator);
+ BootFakeCoordinator(runtime, coordinator, CoordinatorState);
+ BootFakeHive(runtime, hive, HiveState, &GetTabletCreationFunc);
+
InitRootStoragePools(runtime, schemeRoot, sender, TTestTxConfig::DomainUid);
-
+
for (ui32 node = 0; node < runtime.GetNodeCount(); ++node) {
IActor* txProxy = CreateTxProxy(runtime.GetTxAllocatorTabletIds());
TActorId txProxyId = runtime.Register(txProxy, node);
@@ -541,13 +541,13 @@ NSchemeShardUT_Private::TTestEnv::TTestEnv(TTestActorRuntime& runtime, const TTe
}
//SetupBoxAndStoragePool(runtime, sender, TTestTxConfig::DomainUid);
-
- TxReliablePropose = runtime.Register(new TTxReliablePropose(schemeRoot));
- CreateFakeMetering(runtime);
-
- SetSplitMergePartCountLimit(&runtime, -1);
-}
-
+
+ TxReliablePropose = runtime.Register(new TTxReliablePropose(schemeRoot));
+ CreateFakeMetering(runtime);
+
+ SetSplitMergePartCountLimit(&runtime, -1);
+}
+
NSchemeShardUT_Private::TTestEnv::TTestEnv(TTestActorRuntime &runtime, ui32 nchannels, bool enablePipeRetries,
NSchemeShardUT_Private::TTestEnv::TSchemeShardFactory ssFactory, bool enableSystemViews)
: TTestEnv(runtime, TTestEnvOptions()
@@ -557,59 +557,59 @@ NSchemeShardUT_Private::TTestEnv::TTestEnv(TTestActorRuntime &runtime, ui32 ncha
{
}
-void NSchemeShardUT_Private::TTestEnv::SetupLogging(TTestActorRuntime &runtime) {
- runtime.SetLogPriority(NKikimrServices::PERSQUEUE, NActors::NLog::PRI_ERROR);
- runtime.SetLogPriority(NKikimrServices::BS_CONTROLLER, NActors::NLog::PRI_ERROR);
- runtime.SetLogPriority(NKikimrServices::PIPE_CLIENT, NActors::NLog::PRI_ERROR);
- runtime.SetLogPriority(NKikimrServices::PIPE_SERVER, NActors::NLog::PRI_ERROR);
- runtime.SetLogPriority(NKikimrServices::TABLET_MAIN, NActors::NLog::PRI_ERROR);
- runtime.SetLogPriority(NKikimrServices::TABLET_RESOLVER, NActors::NLog::PRI_ERROR);
- runtime.SetLogPriority(NKikimrServices::TX_PROXY, NActors::NLog::PRI_DEBUG);
- runtime.SetLogPriority(NKikimrServices::HIVE, NActors::NLog::PRI_ERROR);
- runtime.SetLogPriority(NKikimrServices::SCHEME_BOARD_POPULATOR, NActors::NLog::PRI_ERROR);
- runtime.SetLogPriority(NKikimrServices::SCHEME_BOARD_REPLICA, NActors::NLog::PRI_ERROR);
-
-
- runtime.SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_NOTICE);
- runtime.SetLogPriority(NKikimrServices::SCHEMESHARD_DESCRIBE, NActors::NLog::PRI_NOTICE);
- runtime.SetLogPriority(NKikimrServices::BUILD_INDEX, NActors::NLog::PRI_NOTICE);
- if (ENABLE_SCHEMESHARD_LOG) {
- runtime.SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_DEBUG);
- runtime.SetLogPriority(NKikimrServices::SCHEMESHARD_DESCRIBE, NActors::NLog::PRI_DEBUG);
- runtime.SetLogPriority(NKikimrServices::BUILD_INDEX, NActors::NLog::PRI_TRACE);
- runtime.SetLogPriority(NKikimrServices::HIVE, NActors::NLog::PRI_DEBUG);
- }
-
- runtime.SetLogPriority(NKikimrServices::EXPORT, NActors::NLog::PRI_NOTICE);
- runtime.SetLogPriority(NKikimrServices::DATASHARD_BACKUP, NActors::NLog::PRI_NOTICE);
- if (ENABLE_EXPORT_LOG) {
- runtime.SetLogPriority(NKikimrServices::EXPORT, NActors::NLog::PRI_TRACE);
- runtime.SetLogPriority(NKikimrServices::DATASHARD_BACKUP, NActors::NLog::PRI_TRACE);
- }
-
- if (ENABLE_SCHEMEBOARD_LOG) {
- runtime.SetLogPriority(NKikimrServices::SCHEME_BOARD_POPULATOR, NActors::NLog::PRI_TRACE);
- runtime.SetLogPriority(NKikimrServices::SCHEME_BOARD_REPLICA, NActors::NLog::PRI_TRACE);
- }
-
- runtime.SetLogPriority(NKikimrServices::CHANGE_EXCHANGE, NActors::NLog::PRI_ERROR);
- runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_ERROR);
- if (ENABLE_DATASHARD_LOG) {
- runtime.SetLogPriority(NKikimrServices::CHANGE_EXCHANGE, NActors::NLog::PRI_DEBUG);
- runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_DEBUG);
- runtime.SetLogPriority(NKikimrServices::HIVE, NActors::NLog::PRI_DEBUG);
- }
-
- runtime.SetLogPriority(NKikimrServices::TX_COORDINATOR, NActors::NLog::PRI_ERROR);
- runtime.SetLogPriority(NKikimrServices::TX_MEDIATOR, NActors::NLog::PRI_ERROR);
- runtime.SetLogPriority(NKikimrServices::TX_MEDIATOR_TIMECAST, NActors::NLog::PRI_ERROR);
+void NSchemeShardUT_Private::TTestEnv::SetupLogging(TTestActorRuntime &runtime) {
+ runtime.SetLogPriority(NKikimrServices::PERSQUEUE, NActors::NLog::PRI_ERROR);
+ runtime.SetLogPriority(NKikimrServices::BS_CONTROLLER, NActors::NLog::PRI_ERROR);
+ runtime.SetLogPriority(NKikimrServices::PIPE_CLIENT, NActors::NLog::PRI_ERROR);
+ runtime.SetLogPriority(NKikimrServices::PIPE_SERVER, NActors::NLog::PRI_ERROR);
+ runtime.SetLogPriority(NKikimrServices::TABLET_MAIN, NActors::NLog::PRI_ERROR);
+ runtime.SetLogPriority(NKikimrServices::TABLET_RESOLVER, NActors::NLog::PRI_ERROR);
+ runtime.SetLogPriority(NKikimrServices::TX_PROXY, NActors::NLog::PRI_DEBUG);
+ runtime.SetLogPriority(NKikimrServices::HIVE, NActors::NLog::PRI_ERROR);
+ runtime.SetLogPriority(NKikimrServices::SCHEME_BOARD_POPULATOR, NActors::NLog::PRI_ERROR);
+ runtime.SetLogPriority(NKikimrServices::SCHEME_BOARD_REPLICA, NActors::NLog::PRI_ERROR);
+
+
+ runtime.SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_NOTICE);
+ runtime.SetLogPriority(NKikimrServices::SCHEMESHARD_DESCRIBE, NActors::NLog::PRI_NOTICE);
+ runtime.SetLogPriority(NKikimrServices::BUILD_INDEX, NActors::NLog::PRI_NOTICE);
+ if (ENABLE_SCHEMESHARD_LOG) {
+ runtime.SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_DEBUG);
+ runtime.SetLogPriority(NKikimrServices::SCHEMESHARD_DESCRIBE, NActors::NLog::PRI_DEBUG);
+ runtime.SetLogPriority(NKikimrServices::BUILD_INDEX, NActors::NLog::PRI_TRACE);
+ runtime.SetLogPriority(NKikimrServices::HIVE, NActors::NLog::PRI_DEBUG);
+ }
+
+ runtime.SetLogPriority(NKikimrServices::EXPORT, NActors::NLog::PRI_NOTICE);
+ runtime.SetLogPriority(NKikimrServices::DATASHARD_BACKUP, NActors::NLog::PRI_NOTICE);
+ if (ENABLE_EXPORT_LOG) {
+ runtime.SetLogPriority(NKikimrServices::EXPORT, NActors::NLog::PRI_TRACE);
+ runtime.SetLogPriority(NKikimrServices::DATASHARD_BACKUP, NActors::NLog::PRI_TRACE);
+ }
+
+ if (ENABLE_SCHEMEBOARD_LOG) {
+ runtime.SetLogPriority(NKikimrServices::SCHEME_BOARD_POPULATOR, NActors::NLog::PRI_TRACE);
+ runtime.SetLogPriority(NKikimrServices::SCHEME_BOARD_REPLICA, NActors::NLog::PRI_TRACE);
+ }
+
+ runtime.SetLogPriority(NKikimrServices::CHANGE_EXCHANGE, NActors::NLog::PRI_ERROR);
+ runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_ERROR);
+ if (ENABLE_DATASHARD_LOG) {
+ runtime.SetLogPriority(NKikimrServices::CHANGE_EXCHANGE, NActors::NLog::PRI_DEBUG);
+ runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_DEBUG);
+ runtime.SetLogPriority(NKikimrServices::HIVE, NActors::NLog::PRI_DEBUG);
+ }
+
+ runtime.SetLogPriority(NKikimrServices::TX_COORDINATOR, NActors::NLog::PRI_ERROR);
+ runtime.SetLogPriority(NKikimrServices::TX_MEDIATOR, NActors::NLog::PRI_ERROR);
+ runtime.SetLogPriority(NKikimrServices::TX_MEDIATOR_TIMECAST, NActors::NLog::PRI_ERROR);
runtime.SetLogPriority(NKikimrServices::TX_MEDIATOR_TABLETQUEUE, NActors::NLog::PRI_ERROR);
- if (ENABLE_COORDINATOR_MEDIATOR_LOG) {
- runtime.SetLogPriority(NKikimrServices::TX_COORDINATOR, NActors::NLog::PRI_DEBUG);
- runtime.SetLogPriority(NKikimrServices::TX_MEDIATOR, NActors::NLog::PRI_DEBUG);
- runtime.SetLogPriority(NKikimrServices::TX_MEDIATOR_TIMECAST, NActors::NLog::PRI_DEBUG);
+ if (ENABLE_COORDINATOR_MEDIATOR_LOG) {
+ runtime.SetLogPriority(NKikimrServices::TX_COORDINATOR, NActors::NLog::PRI_DEBUG);
+ runtime.SetLogPriority(NKikimrServices::TX_MEDIATOR, NActors::NLog::PRI_DEBUG);
+ runtime.SetLogPriority(NKikimrServices::TX_MEDIATOR_TIMECAST, NActors::NLog::PRI_DEBUG);
runtime.SetLogPriority(NKikimrServices::TX_MEDIATOR_TABLETQUEUE, NActors::NLog::PRI_DEBUG);
- }
+ }
runtime.SetLogPriority(NKikimrServices::TX_OLAPSHARD, NActors::NLog::PRI_NOTICE);
runtime.SetLogPriority(NKikimrServices::TX_COLUMNSHARD, NActors::NLog::PRI_NOTICE);
@@ -617,72 +617,72 @@ void NSchemeShardUT_Private::TTestEnv::SetupLogging(TTestActorRuntime &runtime)
runtime.SetLogPriority(NKikimrServices::TX_OLAPSHARD, NActors::NLog::PRI_DEBUG);
runtime.SetLogPriority(NKikimrServices::TX_COLUMNSHARD, NActors::NLog::PRI_DEBUG);
}
-}
-
-void NSchemeShardUT_Private::TTestEnv::AddDomain(TTestActorRuntime &runtime, TAppPrepare &app, ui32 domainUid, ui32 ssId, ui64 hive, ui64 schemeRoot) {
- app.ClearDomainsAndHive();
- ui32 planResolution = 50;
- auto domain = TDomainsInfo::TDomain::ConstructDomainWithExplicitTabletIds(
- "MyRoot", domainUid, schemeRoot,
+}
+
+void NSchemeShardUT_Private::TTestEnv::AddDomain(TTestActorRuntime &runtime, TAppPrepare &app, ui32 domainUid, ui32 ssId, ui64 hive, ui64 schemeRoot) {
+ app.ClearDomainsAndHive();
+ ui32 planResolution = 50;
+ auto domain = TDomainsInfo::TDomain::ConstructDomainWithExplicitTabletIds(
+ "MyRoot", domainUid, schemeRoot,
ssId, ssId, TVector<ui32>{ssId},
- domainUid, TVector<ui32>{domainUid},
- planResolution,
- TVector<ui64>{TDomainsInfo::MakeTxCoordinatorIDFixed(domainUid, 1)},
- TVector<ui64>{},
- TVector<ui64>{TDomainsInfo::MakeTxAllocatorIDFixed(domainUid, 1)},
- DefaultPoolKinds(2));
-
- TVector<ui64> ids = runtime.GetTxAllocatorTabletIds();
- ids.insert(ids.end(), domain->TxAllocators.begin(), domain->TxAllocators.end());
- runtime.SetTxAllocatorTabletIds(ids);
-
- app.AddDomain(domain.Release());
- app.AddHive(domainUid, hive);
-}
-
-TFakeHiveState::TPtr NSchemeShardUT_Private::TTestEnv::GetHiveState() const {
- return HiveState;
-}
-
-TAutoPtr<ITabletScheduledEventsGuard> NSchemeShardUT_Private::TTestEnv::EnableSchemeshardPipeRetries(TTestActorRuntime &runtime) {
+ domainUid, TVector<ui32>{domainUid},
+ planResolution,
+ TVector<ui64>{TDomainsInfo::MakeTxCoordinatorIDFixed(domainUid, 1)},
+ TVector<ui64>{},
+ TVector<ui64>{TDomainsInfo::MakeTxAllocatorIDFixed(domainUid, 1)},
+ DefaultPoolKinds(2));
+
+ TVector<ui64> ids = runtime.GetTxAllocatorTabletIds();
+ ids.insert(ids.end(), domain->TxAllocators.begin(), domain->TxAllocators.end());
+ runtime.SetTxAllocatorTabletIds(ids);
+
+ app.AddDomain(domain.Release());
+ app.AddHive(domainUid, hive);
+}
+
+TFakeHiveState::TPtr NSchemeShardUT_Private::TTestEnv::GetHiveState() const {
+ return HiveState;
+}
+
+TAutoPtr<ITabletScheduledEventsGuard> NSchemeShardUT_Private::TTestEnv::EnableSchemeshardPipeRetries(TTestActorRuntime &runtime) {
TActorId sender = runtime.AllocateEdgeActor();
- TVector<ui64> tabletIds;
- // Add schemeshard tabletId to white list
+ TVector<ui64> tabletIds;
+ // Add schemeshard tabletId to white list
tabletIds.push_back((ui64)TTestTxConfig::SchemeShard);
- return CreateTabletScheduledEventsGuard(tabletIds, runtime, sender);
-}
-
+ return CreateTabletScheduledEventsGuard(tabletIds, runtime, sender);
+}
+
NActors::TActorId NSchemeShardUT_Private::CreateNotificationSubscriber(NActors::TTestActorRuntime &runtime, ui64 schemeshardId) {
return runtime.Register(new TTxNotificationSubscriber(schemeshardId));
}
-
-NActors::TActorId NSchemeShardUT_Private::CreateFakeMetering(NActors::TTestActorRuntime &runtime) {
- NActors::TActorId actorId = runtime.Register(new TFakeMetering());
- runtime.RegisterService(NMetering::MakeMeteringServiceID(), actorId);
- return NMetering::MakeMeteringServiceID();
-}
-
+
+NActors::TActorId NSchemeShardUT_Private::CreateFakeMetering(NActors::TTestActorRuntime &runtime) {
+ NActors::TActorId actorId = runtime.Register(new TFakeMetering());
+ runtime.RegisterService(NMetering::MakeMeteringServiceID(), actorId);
+ return NMetering::MakeMeteringServiceID();
+}
+
void NSchemeShardUT_Private::TestWaitNotification(NActors::TTestActorRuntime &runtime, TSet<ui64> txIds, TActorId subscriberActorId) {
TActorId sender = runtime.AllocateEdgeActor();
-
- for (ui64 txId : txIds) {
- Cerr << Endl << "TestWaitNotification wait txId: " << txId << Endl;
- auto ev = new TEvSchemeShard::TEvNotifyTxCompletion(txId);
+
+ for (ui64 txId : txIds) {
+ Cerr << Endl << "TestWaitNotification wait txId: " << txId << Endl;
+ auto ev = new TEvSchemeShard::TEvNotifyTxCompletion(txId);
runtime.Send(new IEventHandle(subscriberActorId, sender, ev));
- }
-
- TAutoPtr<IEventHandle> handle;
- while (txIds.size()) {
- auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvNotifyTxCompletionResult>(handle);
- UNIT_ASSERT(event);
- ui64 eventTxId = event->Record.GetTxId();
- Cerr << Endl << "TestWaitNotification: OK eventTxId " << eventTxId << Endl;
- UNIT_ASSERT(txIds.find(eventTxId) != txIds.end());
- txIds.erase(eventTxId);
- }
-}
-
+ }
+
+ TAutoPtr<IEventHandle> handle;
+ while (txIds.size()) {
+ auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvNotifyTxCompletionResult>(handle);
+ UNIT_ASSERT(event);
+ ui64 eventTxId = event->Record.GetTxId();
+ Cerr << Endl << "TestWaitNotification: OK eventTxId " << eventTxId << Endl;
+ UNIT_ASSERT(txIds.find(eventTxId) != txIds.end());
+ txIds.erase(eventTxId);
+ }
+}
+
void NSchemeShardUT_Private::TTestEnv::TestWaitNotification(NActors::TTestActorRuntime &runtime, TSet<ui64> txIds, ui64 schemeshardId) {
if (!TxNotificationSubcribers.contains(schemeshardId)) {
TxNotificationSubcribers[schemeshardId] = CreateNotificationSubscriber(runtime, schemeshardId);
@@ -691,42 +691,42 @@ void NSchemeShardUT_Private::TTestEnv::TestWaitNotification(NActors::TTestActorR
NSchemeShardUT_Private::TestWaitNotification(runtime, txIds, TxNotificationSubcribers.at(schemeshardId));
}
-void NSchemeShardUT_Private::TTestEnv::TestWaitNotification(TTestActorRuntime &runtime, int txId, ui64 schemeshardId) {
- TestWaitNotification(runtime, (ui64)txId, schemeshardId);
-}
-
-void NSchemeShardUT_Private::TTestEnv::TestWaitNotification(NActors::TTestActorRuntime &runtime, ui64 txId, ui64 schemeshardId) {
- TSet<ui64> ids;
- ids.insert(txId);
- TestWaitNotification(runtime, ids, schemeshardId);
-}
-
-void NSchemeShardUT_Private::TTestEnv::TestWaitTabletDeletion(NActors::TTestActorRuntime &runtime, TSet<ui64> tabletIds) {
+void NSchemeShardUT_Private::TTestEnv::TestWaitNotification(TTestActorRuntime &runtime, int txId, ui64 schemeshardId) {
+ TestWaitNotification(runtime, (ui64)txId, schemeshardId);
+}
+
+void NSchemeShardUT_Private::TTestEnv::TestWaitNotification(NActors::TTestActorRuntime &runtime, ui64 txId, ui64 schemeshardId) {
+ TSet<ui64> ids;
+ ids.insert(txId);
+ TestWaitNotification(runtime, ids, schemeshardId);
+}
+
+void NSchemeShardUT_Private::TTestEnv::TestWaitTabletDeletion(NActors::TTestActorRuntime &runtime, TSet<ui64> tabletIds) {
TActorId sender = runtime.AllocateEdgeActor();
-
- for (ui64 tabletId : tabletIds) {
- Cerr << "wait until " << tabletId << " is deleted" << Endl;
- auto ev = new TEvFakeHive::TEvSubscribeToTabletDeletion(tabletId);
+
+ for (ui64 tabletId : tabletIds) {
+ Cerr << "wait until " << tabletId << " is deleted" << Endl;
+ auto ev = new TEvFakeHive::TEvSubscribeToTabletDeletion(tabletId);
ForwardToTablet(runtime, TTestTxConfig::Hive, sender, ev);
- }
-
- TAutoPtr<IEventHandle> handle;
- while (tabletIds.size()) {
- auto event = runtime.GrabEdgeEvent<TEvHive::TEvResponseHiveInfo>(handle);
- UNIT_ASSERT(event);
- UNIT_ASSERT_VALUES_EQUAL(event->Record.TabletsSize(), 1);
-
- ui64 tabletId = event->Record.GetTablets(0).GetTabletID();
- Cerr << Endl << "Deleted tabletId " << tabletId << Endl;
- UNIT_ASSERT(tabletIds.find(tabletId) != tabletIds.end());
- tabletIds.erase(tabletId);
- }
-}
-
-void NSchemeShardUT_Private::TTestEnv::TestWaitTabletDeletion(NActors::TTestActorRuntime &runtime, ui64 tabletId) {
- TestWaitTabletDeletion(runtime, TSet<ui64>{tabletId});
-}
-
+ }
+
+ TAutoPtr<IEventHandle> handle;
+ while (tabletIds.size()) {
+ auto event = runtime.GrabEdgeEvent<TEvHive::TEvResponseHiveInfo>(handle);
+ UNIT_ASSERT(event);
+ UNIT_ASSERT_VALUES_EQUAL(event->Record.TabletsSize(), 1);
+
+ ui64 tabletId = event->Record.GetTablets(0).GetTabletID();
+ Cerr << Endl << "Deleted tabletId " << tabletId << Endl;
+ UNIT_ASSERT(tabletIds.find(tabletId) != tabletIds.end());
+ tabletIds.erase(tabletId);
+ }
+}
+
+void NSchemeShardUT_Private::TTestEnv::TestWaitTabletDeletion(NActors::TTestActorRuntime &runtime, ui64 tabletId) {
+ TestWaitTabletDeletion(runtime, TSet<ui64>{tabletId});
+}
+
void NSchemeShardUT_Private::TTestEnv::TestWaitShardDeletion(NActors::TTestActorRuntime &runtime, ui64 schemeShard, TSet<TShardIdx> shardIds) {
TActorId sender = runtime.AllocateEdgeActor();
@@ -763,251 +763,251 @@ void NSchemeShardUT_Private::TTestEnv::SimulateSleep(NActors::TTestActorRuntime
}
std::function<NActors::IActor *(const NActors::TActorId &, NKikimr::TTabletStorageInfo *)> NSchemeShardUT_Private::TTestEnv::GetTabletCreationFunc(ui32 type) {
- switch (type) {
- case TTabletTypes::BlockStoreVolume:
+ switch (type) {
+ case TTabletTypes::BlockStoreVolume:
return [](const TActorId& tablet, TTabletStorageInfo* info) {
- return new TFakeBlockStoreVolume(tablet, info);
- };
+ return new TFakeBlockStoreVolume(tablet, info);
+ };
case TTabletTypes::FileStore:
return [](const TActorId& tablet, TTabletStorageInfo* info) {
return new TFakeFileStore(tablet, info);
};
- default:
- return nullptr;
- }
-}
-
-TEvSchemeShard::TEvInitRootShardResult::EStatus NSchemeShardUT_Private::TTestEnv::InitRoot(NActors::TTestActorRuntime &runtime, ui64 schemeRoot, const NActors::TActorId &sender, const TString& domainName, const TDomainsInfo::TDomain::TStoragePoolKinds& StoragePoolTypes, const TString& owner) {
- auto ev = new TEvSchemeShard::TEvInitRootShard(sender, 32, domainName);
- for (const auto& [kind, pool] : StoragePoolTypes) {
- auto* p = ev->Record.AddStoragePools();
- p->SetKind(kind);
- p->SetName(pool.GetName());
- }
- if (owner) {
- ev->Record.SetOwner(owner);
- }
-
- runtime.SendToPipe(schemeRoot, sender, ev, 0, GetPipeConfigWithRetries());
-
- TAutoPtr<IEventHandle> handle;
- auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvInitRootShardResult>(handle);
- UNIT_ASSERT_VALUES_EQUAL(event->Record.GetOrigin(), schemeRoot);
- UNIT_ASSERT_VALUES_EQUAL(event->Record.GetOrigin(), schemeRoot);
-
- return (TEvSchemeShard::TEvInitRootShardResult::EStatus)event->Record.GetStatus();
-}
-
-void NSchemeShardUT_Private::TTestEnv::InitRootStoragePools(NActors::TTestActorRuntime &runtime, ui64 schemeRoot, const NActors::TActorId &sender, ui64 domainUid) {
- const TDomainsInfo::TDomain& domain = runtime.GetAppData().DomainsInfo->GetDomain(domainUid);
-
+ default:
+ return nullptr;
+ }
+}
+
+TEvSchemeShard::TEvInitRootShardResult::EStatus NSchemeShardUT_Private::TTestEnv::InitRoot(NActors::TTestActorRuntime &runtime, ui64 schemeRoot, const NActors::TActorId &sender, const TString& domainName, const TDomainsInfo::TDomain::TStoragePoolKinds& StoragePoolTypes, const TString& owner) {
+ auto ev = new TEvSchemeShard::TEvInitRootShard(sender, 32, domainName);
+ for (const auto& [kind, pool] : StoragePoolTypes) {
+ auto* p = ev->Record.AddStoragePools();
+ p->SetKind(kind);
+ p->SetName(pool.GetName());
+ }
+ if (owner) {
+ ev->Record.SetOwner(owner);
+ }
+
+ runtime.SendToPipe(schemeRoot, sender, ev, 0, GetPipeConfigWithRetries());
+
+ TAutoPtr<IEventHandle> handle;
+ auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvInitRootShardResult>(handle);
+ UNIT_ASSERT_VALUES_EQUAL(event->Record.GetOrigin(), schemeRoot);
+ UNIT_ASSERT_VALUES_EQUAL(event->Record.GetOrigin(), schemeRoot);
+
+ return (TEvSchemeShard::TEvInitRootShardResult::EStatus)event->Record.GetStatus();
+}
+
+void NSchemeShardUT_Private::TTestEnv::InitRootStoragePools(NActors::TTestActorRuntime &runtime, ui64 schemeRoot, const NActors::TActorId &sender, ui64 domainUid) {
+ const TDomainsInfo::TDomain& domain = runtime.GetAppData().DomainsInfo->GetDomain(domainUid);
+
auto evTx = new TEvSchemeShard::TEvModifySchemeTransaction(1, TTestTxConfig::SchemeShard);
- auto transaction = evTx->Record.AddTransaction();
- transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain);
- transaction->SetWorkingDir("/");
- auto op = transaction->MutableSubDomain();
- op->SetName(domain.Name);
-
- for (const auto& [kind, pool] : domain.StoragePoolTypes) {
- auto* p = op->AddStoragePools();
- p->SetKind(kind);
- p->SetName(pool.GetName());
- }
-
- runtime.SendToPipe(schemeRoot, sender, evTx, 0, GetPipeConfigWithRetries());
-
- {
- TAutoPtr<IEventHandle> handle;
- auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvModifySchemeTransactionResult>(handle);
- UNIT_ASSERT_VALUES_EQUAL(event->Record.GetSchemeshardId(), schemeRoot);
- UNIT_ASSERT_VALUES_EQUAL(event->Record.GetStatus(), NKikimrScheme::EStatus::StatusAccepted);
- }
-
- auto evSubscribe = new TEvSchemeShard::TEvNotifyTxCompletion(1);
- runtime.SendToPipe(schemeRoot, sender, evSubscribe, 0, GetPipeConfigWithRetries());
-
- {
- TAutoPtr<IEventHandle> handle;
- auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvNotifyTxCompletionResult>(handle);
- UNIT_ASSERT_VALUES_EQUAL(event->Record.GetTxId(), 1);
- }
-}
-
-
-void NSchemeShardUT_Private::TTestEnv::BootSchemeShard(NActors::TTestActorRuntime &runtime, ui64 schemeRoot) {
+ auto transaction = evTx->Record.AddTransaction();
+ transaction->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterSubDomain);
+ transaction->SetWorkingDir("/");
+ auto op = transaction->MutableSubDomain();
+ op->SetName(domain.Name);
+
+ for (const auto& [kind, pool] : domain.StoragePoolTypes) {
+ auto* p = op->AddStoragePools();
+ p->SetKind(kind);
+ p->SetName(pool.GetName());
+ }
+
+ runtime.SendToPipe(schemeRoot, sender, evTx, 0, GetPipeConfigWithRetries());
+
+ {
+ TAutoPtr<IEventHandle> handle;
+ auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvModifySchemeTransactionResult>(handle);
+ UNIT_ASSERT_VALUES_EQUAL(event->Record.GetSchemeshardId(), schemeRoot);
+ UNIT_ASSERT_VALUES_EQUAL(event->Record.GetStatus(), NKikimrScheme::EStatus::StatusAccepted);
+ }
+
+ auto evSubscribe = new TEvSchemeShard::TEvNotifyTxCompletion(1);
+ runtime.SendToPipe(schemeRoot, sender, evSubscribe, 0, GetPipeConfigWithRetries());
+
+ {
+ TAutoPtr<IEventHandle> handle;
+ auto event = runtime.GrabEdgeEvent<TEvSchemeShard::TEvNotifyTxCompletionResult>(handle);
+ UNIT_ASSERT_VALUES_EQUAL(event->Record.GetTxId(), 1);
+ }
+}
+
+
+void NSchemeShardUT_Private::TTestEnv::BootSchemeShard(NActors::TTestActorRuntime &runtime, ui64 schemeRoot) {
CreateTestBootstrapper(runtime, CreateTestTabletInfo(schemeRoot, TTabletTypes::FLAT_SCHEMESHARD), SchemeShardFactory);
-}
-
-void NSchemeShardUT_Private::TTestEnv::BootTxAllocator(NActors::TTestActorRuntime &runtime, ui64 tabletId) {
+}
+
+void NSchemeShardUT_Private::TTestEnv::BootTxAllocator(NActors::TTestActorRuntime &runtime, ui64 tabletId) {
CreateTestBootstrapper(runtime, CreateTestTabletInfo(tabletId, TTabletTypes::TX_ALLOCATOR), &CreateTxAllocator);
-}
-
-NSchemeShardUT_Private::TTestWithReboots::TTestWithReboots(bool killOnCommit, NSchemeShardUT_Private::TTestEnv::TSchemeShardFactory ssFactory)
- : EnvOpts(GetDefaultTestEnvOptions())
- , SchemeShardFactory(ssFactory)
+}
+
+NSchemeShardUT_Private::TTestWithReboots::TTestWithReboots(bool killOnCommit, NSchemeShardUT_Private::TTestEnv::TSchemeShardFactory ssFactory)
+ : EnvOpts(GetDefaultTestEnvOptions())
+ , SchemeShardFactory(ssFactory)
, HiveTabletId(TTestTxConfig::Hive)
, SchemeShardTabletId(TTestTxConfig::SchemeShard)
, CoordinatorTabletId(TTestTxConfig::Coordinator)
, TxAllocatorId(TTestTxConfig::TxAllocator)
- , KillOnCommit(killOnCommit)
-{
- TabletIds.push_back(HiveTabletId);
- TabletIds.push_back(CoordinatorTabletId);
- TabletIds.push_back(SchemeShardTabletId);
- TabletIds.push_back(TxAllocatorId);
-
+ , KillOnCommit(killOnCommit)
+{
+ TabletIds.push_back(HiveTabletId);
+ TabletIds.push_back(CoordinatorTabletId);
+ TabletIds.push_back(SchemeShardTabletId);
+ TabletIds.push_back(TxAllocatorId);
+
ui64 datashard = TTestTxConfig::FakeHiveTablets;
- TabletIds.push_back(datashard+0);
- TabletIds.push_back(datashard+1);
- TabletIds.push_back(datashard+2);
- TabletIds.push_back(datashard+3);
- TabletIds.push_back(datashard+4);
- TabletIds.push_back(datashard+5);
- TabletIds.push_back(datashard+6);
- TabletIds.push_back(datashard+7);
- TabletIds.push_back(datashard+8);
-}
-
-void NSchemeShardUT_Private::TTestWithReboots::Run(std::function<void (TTestActorRuntime &, bool &)> testScenario) {
- Run(testScenario, true);
- Run(testScenario, false);
-}
-
-void NSchemeShardUT_Private::TTestWithReboots::Run(std::function<void (TTestActorRuntime &, bool &)> testScenario, bool allowLogBatching) {
- TDatashardLogBatchingSwitch logBatchingSwitch(allowLogBatching);
-
- RunWithTabletReboots(testScenario);
- RunWithPipeResets(testScenario);
- //RunWithDelays(testScenario);
-}
-
-struct NSchemeShardUT_Private::TTestWithReboots::TFinalizer {
- NSchemeShardUT_Private::TTestWithReboots& TestWithReboots;
-
- explicit TFinalizer(NSchemeShardUT_Private::TTestWithReboots& testContext)
- : TestWithReboots(testContext)
- {}
-
- ~TFinalizer() {
- TestWithReboots.Finalize();
- }
-};
-
-void NSchemeShardUT_Private::TTestWithReboots::RunWithTabletReboots(std::function<void (TTestActorRuntime &, bool &)> testScenario) {
- RunTestWithReboots(TabletIds,
- [&]() {
- return PassUserRequests;
- },
- [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) {
- TFinalizer finalizer(*this);
- Prepare(dispatchName, setup, activeZone);
-
- activeZone = true;
- testScenario(*Runtime, activeZone);
- }, Max<ui32>(), Max<ui64>(), 0, 0, KillOnCommit);
-}
-
-void NSchemeShardUT_Private::TTestWithReboots::RunWithPipeResets(std::function<void (TTestActorRuntime &, bool &)> testScenario) {
- RunTestWithPipeResets(TabletIds,
- [&]() {
- return PassUserRequests;
- },
- [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) {
- TFinalizer finalizer(*this);
- Prepare(dispatchName, setup, activeZone);
-
- activeZone = true;
- testScenario(*Runtime, activeZone);
- });
-}
-
-void NSchemeShardUT_Private::TTestWithReboots::RunWithDelays(std::function<void (TTestActorRuntime &, bool &)> testScenario) {
- RunTestWithDelays(TRunWithDelaysConfig(), TabletIds,
- [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) {
- TFinalizer finalizer(*this);
- Prepare(dispatchName, setup, activeZone);
-
- activeZone = true;
- testScenario(*Runtime, activeZone);
- });
-}
-
-void NSchemeShardUT_Private::TTestWithReboots::RestoreLogging() {
- TestEnv->SetupLogging(*Runtime);
-}
-
+ TabletIds.push_back(datashard+0);
+ TabletIds.push_back(datashard+1);
+ TabletIds.push_back(datashard+2);
+ TabletIds.push_back(datashard+3);
+ TabletIds.push_back(datashard+4);
+ TabletIds.push_back(datashard+5);
+ TabletIds.push_back(datashard+6);
+ TabletIds.push_back(datashard+7);
+ TabletIds.push_back(datashard+8);
+}
+
+void NSchemeShardUT_Private::TTestWithReboots::Run(std::function<void (TTestActorRuntime &, bool &)> testScenario) {
+ Run(testScenario, true);
+ Run(testScenario, false);
+}
+
+void NSchemeShardUT_Private::TTestWithReboots::Run(std::function<void (TTestActorRuntime &, bool &)> testScenario, bool allowLogBatching) {
+ TDatashardLogBatchingSwitch logBatchingSwitch(allowLogBatching);
+
+ RunWithTabletReboots(testScenario);
+ RunWithPipeResets(testScenario);
+ //RunWithDelays(testScenario);
+}
+
+struct NSchemeShardUT_Private::TTestWithReboots::TFinalizer {
+ NSchemeShardUT_Private::TTestWithReboots& TestWithReboots;
+
+ explicit TFinalizer(NSchemeShardUT_Private::TTestWithReboots& testContext)
+ : TestWithReboots(testContext)
+ {}
+
+ ~TFinalizer() {
+ TestWithReboots.Finalize();
+ }
+};
+
+void NSchemeShardUT_Private::TTestWithReboots::RunWithTabletReboots(std::function<void (TTestActorRuntime &, bool &)> testScenario) {
+ RunTestWithReboots(TabletIds,
+ [&]() {
+ return PassUserRequests;
+ },
+ [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) {
+ TFinalizer finalizer(*this);
+ Prepare(dispatchName, setup, activeZone);
+
+ activeZone = true;
+ testScenario(*Runtime, activeZone);
+ }, Max<ui32>(), Max<ui64>(), 0, 0, KillOnCommit);
+}
+
+void NSchemeShardUT_Private::TTestWithReboots::RunWithPipeResets(std::function<void (TTestActorRuntime &, bool &)> testScenario) {
+ RunTestWithPipeResets(TabletIds,
+ [&]() {
+ return PassUserRequests;
+ },
+ [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) {
+ TFinalizer finalizer(*this);
+ Prepare(dispatchName, setup, activeZone);
+
+ activeZone = true;
+ testScenario(*Runtime, activeZone);
+ });
+}
+
+void NSchemeShardUT_Private::TTestWithReboots::RunWithDelays(std::function<void (TTestActorRuntime &, bool &)> testScenario) {
+ RunTestWithDelays(TRunWithDelaysConfig(), TabletIds,
+ [&](const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& activeZone) {
+ TFinalizer finalizer(*this);
+ Prepare(dispatchName, setup, activeZone);
+
+ activeZone = true;
+ testScenario(*Runtime, activeZone);
+ });
+}
+
+void NSchemeShardUT_Private::TTestWithReboots::RestoreLogging() {
+ TestEnv->SetupLogging(*Runtime);
+}
+
NSchemeShardUT_Private::TTestEnv* NSchemeShardUT_Private::TTestWithReboots::CreateTestEnv() {
- return new TTestEnv(*Runtime, GetTestEnvOptions());
-}
-
-
-
-void NSchemeShardUT_Private::TTestWithReboots::Prepare(const TString &dispatchName, std::function<void (TTestActorRuntime &)> setup, bool &outActiveZone) {
- Cdbg << Endl << "=========== RUN: "<< dispatchName << " ===========" << Endl;
-
- outActiveZone = false;
-
- Runtime.Reset(new TTestBasicRuntime);
- setup(*Runtime);
-
- //TestEnv.Reset(new TTestEnv(*Runtime, 4, false, SchemeShardFactory));
-
+ return new TTestEnv(*Runtime, GetTestEnvOptions());
+}
+
+
+
+void NSchemeShardUT_Private::TTestWithReboots::Prepare(const TString &dispatchName, std::function<void (TTestActorRuntime &)> setup, bool &outActiveZone) {
+ Cdbg << Endl << "=========== RUN: "<< dispatchName << " ===========" << Endl;
+
+ outActiveZone = false;
+
+ Runtime.Reset(new TTestBasicRuntime);
+ setup(*Runtime);
+
+ //TestEnv.Reset(new TTestEnv(*Runtime, 4, false, SchemeShardFactory));
+
TestEnv.Reset(CreateTestEnv());
-
- RestoreLogging();
-
- TxId = 1000;
-
- TestMkDir(*Runtime, TxId++, "/MyRoot", "DirA");
-
- // This allows tablet resolver to detect deleted tablets
- EnableTabletResolverScheduling();
-
- outActiveZone = true;
-}
-
-void NSchemeShardUT_Private::TTestWithReboots::EnableTabletResolverScheduling(ui32 nodeIdx) {
- auto actorId = Runtime->GetLocalServiceId(MakeTabletResolverID(), nodeIdx);
- Y_VERIFY(actorId);
- Runtime->EnableScheduleForActor(actorId);
-}
-
-void NSchemeShardUT_Private::TTestWithReboots::Finalize() {
- TestEnv.Reset();
- Runtime.Reset();
-}
-
-bool NSchemeShardUT_Private::TTestWithReboots::PassUserRequests(TTestActorRuntimeBase &runtime, TAutoPtr<IEventHandle> &event) {
- Y_UNUSED(runtime);
- return event->Type == TEvSchemeShard::EvModifySchemeTransaction ||
- event->Type == TEvSchemeShard::EvDescribeScheme ||
- event->Type == TEvSchemeShard::EvNotifyTxCompletion ||
- event->Type == TEvSchemeShard::EvMeasureSelfResponseTime ||
- event->Type == TEvSchemeShard::EvWakeupToMeasureSelfResponseTime ||
- event->Type == TEvTablet::EvLocalMKQL ||
- event->Type == TEvFakeHive::EvSubscribeToTabletDeletion ||
- event->Type == TEvSchemeShard::EvCancelTx ||
- event->Type == TEvExport::EvCreateExportRequest ||
- event->Type == TEvIndexBuilder::EvCreateRequest ||
- event->Type == TEvIndexBuilder::EvGetRequest ||
- event->Type == TEvIndexBuilder::EvCancelRequest ||
- event->Type == TEvIndexBuilder::EvForgetRequest
- ;
-}
-
-NSchemeShardUT_Private::TTestEnvOptions& NSchemeShardUT_Private::TTestWithReboots::GetTestEnvOptions() {
- return EnvOpts;
-}
-
-const NSchemeShardUT_Private::TTestEnvOptions& NSchemeShardUT_Private::TTestWithReboots::GetTestEnvOptions() const {
- return EnvOpts;
-}
-
-NSchemeShardUT_Private::TTestEnvOptions NSchemeShardUT_Private::TTestWithReboots::GetDefaultTestEnvOptions() {
- return TTestEnvOptions()
- .EnablePipeRetries(false)
- .EnableAsyncIndexes(true)
- .EnableNotNullColumns(true)
- .EnableSchemeTransactionsAtSchemeShard(true)
- .EnableProtoSourceIdInfo(true);
-}
+
+ RestoreLogging();
+
+ TxId = 1000;
+
+ TestMkDir(*Runtime, TxId++, "/MyRoot", "DirA");
+
+ // This allows tablet resolver to detect deleted tablets
+ EnableTabletResolverScheduling();
+
+ outActiveZone = true;
+}
+
+void NSchemeShardUT_Private::TTestWithReboots::EnableTabletResolverScheduling(ui32 nodeIdx) {
+ auto actorId = Runtime->GetLocalServiceId(MakeTabletResolverID(), nodeIdx);
+ Y_VERIFY(actorId);
+ Runtime->EnableScheduleForActor(actorId);
+}
+
+void NSchemeShardUT_Private::TTestWithReboots::Finalize() {
+ TestEnv.Reset();
+ Runtime.Reset();
+}
+
+bool NSchemeShardUT_Private::TTestWithReboots::PassUserRequests(TTestActorRuntimeBase &runtime, TAutoPtr<IEventHandle> &event) {
+ Y_UNUSED(runtime);
+ return event->Type == TEvSchemeShard::EvModifySchemeTransaction ||
+ event->Type == TEvSchemeShard::EvDescribeScheme ||
+ event->Type == TEvSchemeShard::EvNotifyTxCompletion ||
+ event->Type == TEvSchemeShard::EvMeasureSelfResponseTime ||
+ event->Type == TEvSchemeShard::EvWakeupToMeasureSelfResponseTime ||
+ event->Type == TEvTablet::EvLocalMKQL ||
+ event->Type == TEvFakeHive::EvSubscribeToTabletDeletion ||
+ event->Type == TEvSchemeShard::EvCancelTx ||
+ event->Type == TEvExport::EvCreateExportRequest ||
+ event->Type == TEvIndexBuilder::EvCreateRequest ||
+ event->Type == TEvIndexBuilder::EvGetRequest ||
+ event->Type == TEvIndexBuilder::EvCancelRequest ||
+ event->Type == TEvIndexBuilder::EvForgetRequest
+ ;
+}
+
+NSchemeShardUT_Private::TTestEnvOptions& NSchemeShardUT_Private::TTestWithReboots::GetTestEnvOptions() {
+ return EnvOpts;
+}
+
+const NSchemeShardUT_Private::TTestEnvOptions& NSchemeShardUT_Private::TTestWithReboots::GetTestEnvOptions() const {
+ return EnvOpts;
+}
+
+NSchemeShardUT_Private::TTestEnvOptions NSchemeShardUT_Private::TTestWithReboots::GetDefaultTestEnvOptions() {
+ return TTestEnvOptions()
+ .EnablePipeRetries(false)
+ .EnableAsyncIndexes(true)
+ .EnableNotNullColumns(true)
+ .EnableSchemeTransactionsAtSchemeShard(true)
+ .EnableProtoSourceIdInfo(true);
+}
diff --git a/ydb/core/tx/schemeshard/ut_helpers/test_env.h b/ydb/core/tx/schemeshard/ut_helpers/test_env.h
index 1352fcc6ff1..72b934c570d 100644
--- a/ydb/core/tx/schemeshard/ut_helpers/test_env.h
+++ b/ydb/core/tx/schemeshard/ut_helpers/test_env.h
@@ -1,24 +1,24 @@
-#pragma once
-
-
+#pragma once
+
+
#include <ydb/core/testlib/tablet_helpers.h>
#include <ydb/core/testlib/fake_coordinator.h>
-
+
#include <ydb/core/base/blobstorage.h>
#include <ydb/core/tx/schemeshard/schemeshard.h>
#include <ydb/core/tx/schemeshard/schemeshard_export.h>
#include <ydb/core/tx/schemeshard/schemeshard_identificators.h>
#include <ydb/core/tx/schemeshard/schemeshard_import.h>
-
-#include <functional>
-
-namespace NSchemeShardUT_Private {
- using namespace NKikimr;
- using namespace NSchemeShard;
-
+
+#include <functional>
+
+namespace NSchemeShardUT_Private {
+ using namespace NKikimr;
+ using namespace NSchemeShard;
+
void TestWaitNotification(NActors::TTestActorRuntime &runtime, TSet<ui64> txIds, TActorId subscriberActorId);
NActors::TActorId CreateNotificationSubscriber(NActors::TTestActorRuntime &runtime, ui64 schemeshardId);
- NActors::TActorId CreateFakeMetering(NActors::TTestActorRuntime &runtime);
+ NActors::TActorId CreateFakeMetering(NActors::TTestActorRuntime &runtime);
struct TTestEnvOptions {
using TSelf = TTestEnvOptions;
@@ -38,133 +38,133 @@ namespace NSchemeShardUT_Private {
OPTION(std::optional<bool>, AllowUpdateChannelsBindingOfSolomonPartitions, std::nullopt);
OPTION(std::optional<bool>, EnableAsyncIndexes, std::nullopt);
OPTION(std::optional<bool>, EnableNotNullColumns, std::nullopt);
- OPTION(std::optional<bool>, EnableSchemeTransactionsAtSchemeShard, std::nullopt);
+ OPTION(std::optional<bool>, EnableSchemeTransactionsAtSchemeShard, std::nullopt);
OPTION(std::optional<bool>, EnableOlapSchemaOperations, std::nullopt);
OPTION(std::optional<bool>, EnableProtoSourceIdInfo, std::nullopt);
- OPTION(std::optional<bool>, EnableBackgroundCompaction, std::nullopt);
+ OPTION(std::optional<bool>, EnableBackgroundCompaction, std::nullopt);
OPTION(THashSet<TString>, SystemBackupSIDs, {});
#undef OPTION
};
- class TTestEnv {
- public:
+ class TTestEnv {
+ public:
using TSchemeShardFactory = std::function<IActor* (const TActorId &, TTabletStorageInfo *)>;
-
- private:
- TSchemeShardFactory SchemeShardFactory;
- TFakeHiveState::TPtr HiveState;
- TFakeCoordinator::TState::TPtr CoordinatorState;
- TAutoPtr<ITabletScheduledEventsGuard> EnableSchemeshardPipeRetriesGuard;
+
+ private:
+ TSchemeShardFactory SchemeShardFactory;
+ TFakeHiveState::TPtr HiveState;
+ TFakeCoordinator::TState::TPtr CoordinatorState;
+ TAutoPtr<ITabletScheduledEventsGuard> EnableSchemeshardPipeRetriesGuard;
TMap<ui64, TActorId> TxNotificationSubcribers;
TActorId TxReliablePropose;
- ui32 ChannelsCount;
- TActorId MeteringFake;
-
- public:
+ ui32 ChannelsCount;
+ TActorId MeteringFake;
+
+ public:
TTestEnv(TTestActorRuntime& runtime, ui32 nchannels = 4, bool enablePipeRetries = true,
TSchemeShardFactory ssFactory = &CreateFlatTxSchemeShard, bool enableSystemViews = false);
TTestEnv(TTestActorRuntime& runtime, const TTestEnvOptions& opts,
TSchemeShardFactory ssFactory = &CreateFlatTxSchemeShard, std::shared_ptr<NKikimr::NDataShard::IExportFactory> dsExportFactory = {});
-
- TFakeHiveState::TPtr GetHiveState() const;
- TAutoPtr<ITabletScheduledEventsGuard> EnableSchemeshardPipeRetries(TTestActorRuntime& runtime);
- ui32 ReliablePropose(TTestActorRuntime& runtime, TEvSchemeShard::TEvModifySchemeTransaction* evTx, const TVector<TEvSchemeShard::EStatus>& expectedResults = {NKikimrScheme::StatusAccepted});
- ui32 ReliablePropose(TTestActorRuntime& runtime, TEvSchemeShard::TEvCancelTx* evTx, const TVector<TEvSchemeShard::EStatus>& expectedResults = {NKikimrScheme::StatusAccepted});
+
+ TFakeHiveState::TPtr GetHiveState() const;
+ TAutoPtr<ITabletScheduledEventsGuard> EnableSchemeshardPipeRetries(TTestActorRuntime& runtime);
+ ui32 ReliablePropose(TTestActorRuntime& runtime, TEvSchemeShard::TEvModifySchemeTransaction* evTx, const TVector<TEvSchemeShard::EStatus>& expectedResults = {NKikimrScheme::StatusAccepted});
+ ui32 ReliablePropose(TTestActorRuntime& runtime, TEvSchemeShard::TEvCancelTx* evTx, const TVector<TEvSchemeShard::EStatus>& expectedResults = {NKikimrScheme::StatusAccepted});
ui32 ReliablePropose(TTestActorRuntime& runtime, TEvExport::TEvCancelExportRequest* ev, const TVector<Ydb::StatusIds::StatusCode>& expectedStatuses = {Ydb::StatusIds::SUCCESS});
ui32 ReliablePropose(TTestActorRuntime& runtime, TEvExport::TEvForgetExportRequest* ev, const TVector<Ydb::StatusIds::StatusCode>& expectedStatuses = {Ydb::StatusIds::SUCCESS});
ui32 ReliablePropose(TTestActorRuntime& runtime, TEvImport::TEvCancelImportRequest* ev, const TVector<Ydb::StatusIds::StatusCode>& expectedStatuses = {Ydb::StatusIds::SUCCESS});
- template <class TContainer>
+ template <class TContainer>
void TestWaitNotification(TTestActorRuntime& runtime, TContainer txs, ui64 schemeshardId = TTestTxConfig::SchemeShard) {
- TSet<ui64> set(txs.begin(), txs.end());
- TestWaitNotification(runtime, std::move(set), schemeshardId);
- }
+ TSet<ui64> set(txs.begin(), txs.end());
+ TestWaitNotification(runtime, std::move(set), schemeshardId);
+ }
void TestWaitNotification(TTestActorRuntime& runtime, TSet<ui64> txIds, ui64 schemeshardId = TTestTxConfig::SchemeShard);
void TestWaitNotification(TTestActorRuntime& runtime, int txId, ui64 schemeshardId = TTestTxConfig::SchemeShard);
void TestWaitNotification(TTestActorRuntime& runtime, ui64 txId, ui64 schemeshardId = TTestTxConfig::SchemeShard);
-
- template <class TContainer>
- void TestWaitTabletDeletion(TTestActorRuntime& runtime, TContainer tabletIds) {
- TSet<ui64> set(tabletIds.begin(), tabletIds.end());
- TestWaitTabletDeletion(runtime, std::move(set));
- }
- void TestWaitTabletDeletion(TTestActorRuntime& runtime, TSet<ui64> tabletIds);
- void TestWaitTabletDeletion(TTestActorRuntime& runtime, ui64 tabletId);
-
+
+ template <class TContainer>
+ void TestWaitTabletDeletion(TTestActorRuntime& runtime, TContainer tabletIds) {
+ TSet<ui64> set(tabletIds.begin(), tabletIds.end());
+ TestWaitTabletDeletion(runtime, std::move(set));
+ }
+ void TestWaitTabletDeletion(TTestActorRuntime& runtime, TSet<ui64> tabletIds);
+ void TestWaitTabletDeletion(TTestActorRuntime& runtime, ui64 tabletId);
+
void TestWaitShardDeletion(TTestActorRuntime& runtime, TSet<ui64> localIds);
void TestWaitShardDeletion(TTestActorRuntime& runtime, ui64 schemeShard, TSet<ui64> localIds);
void TestWaitShardDeletion(TTestActorRuntime& runtime, ui64 schemeShard, TSet<TShardIdx> shardIds);
void SimulateSleep(TTestActorRuntime& runtime, TDuration duration);
- TEvSchemeShard::TEvInitRootShardResult::EStatus InitRoot(TTestActorRuntime& runtime, ui64 schemeRoot, const TActorId& sender, const TString& domainName, const TDomainsInfo::TDomain::TStoragePoolKinds& StoragePoolTypes = {}, const TString& owner = {});
- void InitRootStoragePools(TTestActorRuntime& runtime, ui64 schemeRoot, const TActorId& sender, ui64 domainUid);
-
- void SetupLogging(TTestActorRuntime& runtime);
-
- private:
+ TEvSchemeShard::TEvInitRootShardResult::EStatus InitRoot(TTestActorRuntime& runtime, ui64 schemeRoot, const TActorId& sender, const TString& domainName, const TDomainsInfo::TDomain::TStoragePoolKinds& StoragePoolTypes = {}, const TString& owner = {});
+ void InitRootStoragePools(TTestActorRuntime& runtime, ui64 schemeRoot, const TActorId& sender, ui64 domainUid);
+
+ void SetupLogging(TTestActorRuntime& runtime);
+
+ private:
static std::function<IActor*(const TActorId&, TTabletStorageInfo*)> GetTabletCreationFunc(ui32 type);
- void AddDomain(TTestActorRuntime& runtime, TAppPrepare& app, ui32 domainUid, ui32 ssId, ui64 hive, ui64 schemeRoot);
-
- void BootSchemeShard(TTestActorRuntime& runtime, ui64 schemeRoot);
- void BootTxAllocator(TTestActorRuntime& runtime, ui64 tabletId);
- };
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // A wrapper to run test scenarios with reboots of schemeshard, hive and coordinator
+ void AddDomain(TTestActorRuntime& runtime, TAppPrepare& app, ui32 domainUid, ui32 ssId, ui64 hive, ui64 schemeRoot);
+
+ void BootSchemeShard(TTestActorRuntime& runtime, ui64 schemeRoot);
+ void BootTxAllocator(TTestActorRuntime& runtime, ui64 tabletId);
+ };
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // A wrapper to run test scenarios with reboots of schemeshard, hive and coordinator
class TTestWithReboots {
public:
- TVector<ui64> TabletIds;
- THolder<TTestActorRuntime> Runtime;
- TTestEnvOptions EnvOpts;
- THolder<TTestEnv> TestEnv;
- TTestEnv::TSchemeShardFactory SchemeShardFactory;
- ui64 TxId;
- const ui64 HiveTabletId;
- const ui64 SchemeShardTabletId;
- const ui64 CoordinatorTabletId;
- const ui64 TxAllocatorId;
- const bool KillOnCommit;
-
- explicit TTestWithReboots(bool killOnCommit = false, TTestEnv::TSchemeShardFactory ssFactory = &CreateFlatTxSchemeShard);
+ TVector<ui64> TabletIds;
+ THolder<TTestActorRuntime> Runtime;
+ TTestEnvOptions EnvOpts;
+ THolder<TTestEnv> TestEnv;
+ TTestEnv::TSchemeShardFactory SchemeShardFactory;
+ ui64 TxId;
+ const ui64 HiveTabletId;
+ const ui64 SchemeShardTabletId;
+ const ui64 CoordinatorTabletId;
+ const ui64 TxAllocatorId;
+ const bool KillOnCommit;
+
+ explicit TTestWithReboots(bool killOnCommit = false, TTestEnv::TSchemeShardFactory ssFactory = &CreateFlatTxSchemeShard);
virtual ~TTestWithReboots() = default;
-
- void Run(std::function<void(TTestActorRuntime& runtime, bool& activeZone)> testScenario);
- void Run(std::function<void(TTestActorRuntime& runtime, bool& activeZone)> testScenario, bool allowLogBatching);
- void RunWithTabletReboots(std::function<void(TTestActorRuntime& runtime, bool& activeZone)> testScenario);
- void RunWithPipeResets(std::function<void(TTestActorRuntime& runtime, bool& activeZone)> testScenario);
- void RunWithDelays(std::function<void(TTestActorRuntime& runtime, bool& activeZone)> testScenario);
- void RestoreLogging();
-
- static TTestEnvOptions GetDefaultTestEnvOptions();
-
- TTestEnvOptions& GetTestEnvOptions();
- const TTestEnvOptions& GetTestEnvOptions() const;
-
- private:
- void Prepare(const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& outActiveZone);
- void EnableTabletResolverScheduling(ui32 nodeIdx = 0);
- void Finalize();
+
+ void Run(std::function<void(TTestActorRuntime& runtime, bool& activeZone)> testScenario);
+ void Run(std::function<void(TTestActorRuntime& runtime, bool& activeZone)> testScenario, bool allowLogBatching);
+ void RunWithTabletReboots(std::function<void(TTestActorRuntime& runtime, bool& activeZone)> testScenario);
+ void RunWithPipeResets(std::function<void(TTestActorRuntime& runtime, bool& activeZone)> testScenario);
+ void RunWithDelays(std::function<void(TTestActorRuntime& runtime, bool& activeZone)> testScenario);
+ void RestoreLogging();
+
+ static TTestEnvOptions GetDefaultTestEnvOptions();
+
+ TTestEnvOptions& GetTestEnvOptions();
+ const TTestEnvOptions& GetTestEnvOptions() const;
+
+ private:
+ void Prepare(const TString& dispatchName, std::function<void(TTestActorRuntime&)> setup, bool& outActiveZone);
+ void EnableTabletResolverScheduling(ui32 nodeIdx = 0);
+ void Finalize();
private:
virtual TTestEnv* CreateTestEnv();
- // Make sure that user requests are not dropped
- static bool PassUserRequests(TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event);
-
- private:
- struct TFinalizer;
- };
-
- struct TInactiveZone {
- bool& ActiveZone;
-
- explicit TInactiveZone(bool& activeZone)
- : ActiveZone(activeZone)
- {
- ActiveZone = false;
- }
-
- ~TInactiveZone() {
- ActiveZone = true;
- }
- };
-}
+ // Make sure that user requests are not dropped
+ static bool PassUserRequests(TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle>& event);
+
+ private:
+ struct TFinalizer;
+ };
+
+ struct TInactiveZone {
+ bool& ActiveZone;
+
+ explicit TInactiveZone(bool& activeZone)
+ : ActiveZone(activeZone)
+ {
+ ActiveZone = false;
+ }
+
+ ~TInactiveZone() {
+ ActiveZone = true;
+ }
+ };
+}
diff --git a/ydb/core/tx/schemeshard/ut_helpers/ya.make b/ydb/core/tx/schemeshard/ut_helpers/ya.make
index 0b45cf72f1d..b66d799ec0c 100644
--- a/ydb/core/tx/schemeshard/ut_helpers/ya.make
+++ b/ydb/core/tx/schemeshard/ut_helpers/ya.make
@@ -24,13 +24,13 @@ PEERDIR(
SRCS(
export_reboots_common.cpp
- failing_mtpq.cpp
- test_env.cpp
- test_env.h
- ls_checks.cpp
- ls_checks.h
- helpers.cpp
- helpers.h
+ failing_mtpq.cpp
+ test_env.cpp
+ test_env.h
+ ls_checks.cpp
+ ls_checks.h
+ helpers.cpp
+ helpers.h
)
YQL_LAST_ABI_VERSION()
diff --git a/ydb/core/tx/schemeshard/ut_index_build.cpp b/ydb/core/tx/schemeshard/ut_index_build.cpp
index 47329db284b..88860481cc5 100644
--- a/ydb/core/tx/schemeshard/ut_index_build.cpp
+++ b/ydb/core/tx/schemeshard/ut_index_build.cpp
@@ -4,88 +4,88 @@
#include <ydb/core/tx/datashard/datashard.h>
#include <ydb/core/metering/metering.h>
-
+
using namespace NKikimr;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NSchemeShardUT_Private;
Y_UNIT_TEST_SUITE(IndexBuildTest) {
- Y_UNIT_TEST(ShadowDataNotAllowedByDefault) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "IndexTable"
- Columns { Name: "index" Type: "Uint32" }
- Columns { Name: "key" Type: "Uint32" }
- KeyColumnNames: ["index", "key"]
- PartitionConfig {
- CompactionPolicy {
- KeepEraseMarkers: true
- }
- ShadowData: true
- }
- )", {NKikimrScheme::StatusInvalidParameter});
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "IndexTable"
- Columns { Name: "index" Type: "Uint32" }
- Columns { Name: "key" Type: "Uint32" }
- KeyColumnNames: ["index", "key"]
- PartitionConfig {
- CompactionPolicy {
- KeepEraseMarkers: true
- }
- ShadowData: false
- }
- )", {NKikimrScheme::StatusInvalidParameter});
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "IndexTable"
- Columns { Name: "index" Type: "Uint32" }
- Columns { Name: "key" Type: "Uint32" }
- KeyColumnNames: ["index", "key"]
- PartitionConfig {
- CompactionPolicy {
- KeepEraseMarkers: true
- }
- }
- )");
- env.TestWaitNotification(runtime, txId);
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "IndexTable"
- PartitionConfig {
- ShadowData: false
- }
- )", {NKikimrScheme::StatusInvalidParameter});
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "IndexTable"
- PartitionConfig {
- ShadowData: true
- }
- )", {NKikimrScheme::StatusInvalidParameter});
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "CopyTable"
- CopyFromTable: "/MyRoot/IndexTable"
- PartitionConfig {
- ShadowData: true
- }
- )", {NKikimrScheme::StatusInvalidParameter});
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "CopyTable"
- CopyFromTable: "/MyRoot/IndexTable"
- PartitionConfig {
- ShadowData: false
- }
- )", {NKikimrScheme::StatusInvalidParameter});
- }
-
+ Y_UNIT_TEST(ShadowDataNotAllowedByDefault) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "IndexTable"
+ Columns { Name: "index" Type: "Uint32" }
+ Columns { Name: "key" Type: "Uint32" }
+ KeyColumnNames: ["index", "key"]
+ PartitionConfig {
+ CompactionPolicy {
+ KeepEraseMarkers: true
+ }
+ ShadowData: true
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "IndexTable"
+ Columns { Name: "index" Type: "Uint32" }
+ Columns { Name: "key" Type: "Uint32" }
+ KeyColumnNames: ["index", "key"]
+ PartitionConfig {
+ CompactionPolicy {
+ KeepEraseMarkers: true
+ }
+ ShadowData: false
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "IndexTable"
+ Columns { Name: "index" Type: "Uint32" }
+ Columns { Name: "key" Type: "Uint32" }
+ KeyColumnNames: ["index", "key"]
+ PartitionConfig {
+ CompactionPolicy {
+ KeepEraseMarkers: true
+ }
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "IndexTable"
+ PartitionConfig {
+ ShadowData: false
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "IndexTable"
+ PartitionConfig {
+ ShadowData: true
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "CopyTable"
+ CopyFromTable: "/MyRoot/IndexTable"
+ PartitionConfig {
+ ShadowData: true
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "CopyTable"
+ CopyFromTable: "/MyRoot/IndexTable"
+ PartitionConfig {
+ ShadowData: false
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+ }
+
Y_UNIT_TEST(ShadowDataEdgeCases) {
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
- // Allow manipulating shadow data using normal schemeshard operations
- runtime.GetAppData().AllowShadowDataInSchemeShardForTests = true;
-
+ // Allow manipulating shadow data using normal schemeshard operations
+ runtime.GetAppData().AllowShadowDataInSchemeShardForTests = true;
+
TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "IndexTable"
Columns { Name: "index" Type: "Uint32" }
@@ -103,7 +103,7 @@ Y_UNIT_TEST_SUITE(IndexBuildTest) {
TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "CopyTable"
CopyFromTable: "/MyRoot/IndexTable"
- )", {NKikimrScheme::StatusPreconditionFailed});
+ )", {NKikimrScheme::StatusPreconditionFailed});
// This is basically a no-op alter, not filtered at the moment
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
@@ -129,7 +129,7 @@ Y_UNIT_TEST_SUITE(IndexBuildTest) {
PartitionConfig {
ShadowData: true
}
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
// This is basically a no-op alter, not filtered at the moment
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
@@ -168,33 +168,33 @@ Y_UNIT_TEST_SUITE(IndexBuildTest) {
env.TestWaitNotification(runtime, txId);
}
-
- Y_UNIT_TEST(BaseCase) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"ResourceDB\"");
- env.TestWaitNotification(runtime, txId);
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "StoragePools { "
- " Name: \"pool-1\" "
- " Kind: \"pool-kind-1\" "
- "} "
- "StoragePools { "
- " Name: \"pool-2\" "
- " Kind: \"pool-kind-2\" "
- "} "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "ExternalSchemeShard: true "
- "Name: \"ResourceDB\"");
- env.TestWaitNotification(runtime, txId);
-
+
+ Y_UNIT_TEST(BaseCase) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"ResourceDB\"");
+ env.TestWaitNotification(runtime, txId);
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "StoragePools { "
+ " Name: \"pool-1\" "
+ " Kind: \"pool-kind-1\" "
+ "} "
+ "StoragePools { "
+ " Name: \"pool-2\" "
+ " Kind: \"pool-kind-2\" "
+ "} "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "ExternalSchemeShard: true "
+ "Name: \"ResourceDB\"");
+ env.TestWaitNotification(runtime, txId);
+
const auto attrs = AlterUserAttrs({
{"cloud_id", "CLOUD_ID_VAL"},
{"folder_id", "FOLDER_ID_VAL"},
@@ -208,118 +208,118 @@ Y_UNIT_TEST_SUITE(IndexBuildTest) {
PathId: 2
}
)", TTestTxConfig::SchemeShard), attrs);
- env.TestWaitNotification(runtime, txId);
-
- TString alterData = TStringBuilder()
- << "PlanResolution: 50 "
- << "Coordinators: 1 "
- << "Mediators: 1 "
- << "TimeCastBucketsPerMediator: 2 "
- << "ExternalSchemeShard: true "
- << "ExternalHive: false "
- << "Name: \"ServerLessDB\" "
- << "StoragePools { "
- << " Name: \"pool-1\" "
- << " Kind: \"pool-kind-1\" "
- << "} ";
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot", alterData);
- env.TestWaitNotification(runtime, txId);
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/ServerLessDB"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("ServerLessDB"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
-
- // Just create main table
- TestCreateTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/ServerLessDB", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint32" }
- Columns { Name: "index" Type: "Uint32" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- env.TestWaitNotification(runtime, txId, tenantSchemeShard);
-
- auto fnWriteRow = [&] (ui64 tabletId, ui32 key, ui32 index, TString value, const char* table) {
- TString writeQuery = Sprintf(R"(
- (
- (let key '( '('key (Uint32 '%u ) ) ) )
- (let row '( '('index (Uint32 '%u ) ) '('value (Utf8 '%s) ) ) )
- (return (AsList (UpdateRow '__user__%s key row) ))
- )
- )", key, index, value.c_str(), table);
- NKikimrMiniKQL::TResult result;
- TString err;
+ env.TestWaitNotification(runtime, txId);
+
+ TString alterData = TStringBuilder()
+ << "PlanResolution: 50 "
+ << "Coordinators: 1 "
+ << "Mediators: 1 "
+ << "TimeCastBucketsPerMediator: 2 "
+ << "ExternalSchemeShard: true "
+ << "ExternalHive: false "
+ << "Name: \"ServerLessDB\" "
+ << "StoragePools { "
+ << " Name: \"pool-1\" "
+ << " Kind: \"pool-kind-1\" "
+ << "} ";
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot", alterData);
+ env.TestWaitNotification(runtime, txId);
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/ServerLessDB"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("ServerLessDB"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
+
+ // Just create main table
+ TestCreateTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/ServerLessDB", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint32" }
+ Columns { Name: "index" Type: "Uint32" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ env.TestWaitNotification(runtime, txId, tenantSchemeShard);
+
+ auto fnWriteRow = [&] (ui64 tabletId, ui32 key, ui32 index, TString value, const char* table) {
+ TString writeQuery = Sprintf(R"(
+ (
+ (let key '( '('key (Uint32 '%u ) ) ) )
+ (let row '( '('index (Uint32 '%u ) ) '('value (Utf8 '%s) ) ) )
+ (return (AsList (UpdateRow '__user__%s key row) ))
+ )
+ )", key, index, value.c_str(), table);
+ NKikimrMiniKQL::TResult result;
+ TString err;
NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
- };
- for (ui32 delta = 0; delta < 101; ++delta) {
+ };
+ for (ui32 delta = 0; delta < 101; ++delta) {
fnWriteRow(TTestTxConfig::FakeHiveTablets + 6, 1 + delta, 1000 + delta, "aaaa", "Table");
- }
-
- runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_TRACE);
+ }
+
+ runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_TRACE);
runtime.SetLogPriority(NKikimrServices::BUILD_INDEX, NLog::PRI_TRACE);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/ServerLessDB/Table"),
- {NLs::PathExist,
- NLs::IndexesCount(0),
- NLs::PathVersionEqual(3)});
-
- TStringBuilder meteringMessages;
- auto grabMeteringMessage = [&meteringMessages](TTestActorRuntimeBase&, TAutoPtr<IEventHandle> &ev) -> auto {
- if (ev->Type == NMetering::TEvMetering::TEvWriteMeteringJson::EventType) {
- auto *msg = ev->Get<NMetering::TEvMetering::TEvWriteMeteringJson>();
- Cerr << "grabMeteringMessage has happend" << Endl;
- meteringMessages << msg->MeteringJson;
- }
-
- return TTestActorRuntime::EEventAction::PROCESS;
- };
-
- runtime.SetObserverFunc(grabMeteringMessage);
-
- TestBuilIndex(runtime, ++txId, tenantSchemeShard, "/MyRoot/ServerLessDB", "/MyRoot/ServerLessDB/Table", "index1", {"index"});
- ui64 builIndexId = txId;
-
- auto listing = TestListBuilIndex(runtime, tenantSchemeShard, "/MyRoot/ServerLessDB");
- Y_ASSERT(listing.EntriesSize() == 1);
-
- env.TestWaitNotification(runtime, txId, tenantSchemeShard);
-
- auto descr = TestGetBuilIndex(runtime, tenantSchemeShard, "/MyRoot/ServerLessDB", txId);
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/ServerLessDB/Table"),
+ {NLs::PathExist,
+ NLs::IndexesCount(0),
+ NLs::PathVersionEqual(3)});
+
+ TStringBuilder meteringMessages;
+ auto grabMeteringMessage = [&meteringMessages](TTestActorRuntimeBase&, TAutoPtr<IEventHandle> &ev) -> auto {
+ if (ev->Type == NMetering::TEvMetering::TEvWriteMeteringJson::EventType) {
+ auto *msg = ev->Get<NMetering::TEvMetering::TEvWriteMeteringJson>();
+ Cerr << "grabMeteringMessage has happend" << Endl;
+ meteringMessages << msg->MeteringJson;
+ }
+
+ return TTestActorRuntime::EEventAction::PROCESS;
+ };
+
+ runtime.SetObserverFunc(grabMeteringMessage);
+
+ TestBuilIndex(runtime, ++txId, tenantSchemeShard, "/MyRoot/ServerLessDB", "/MyRoot/ServerLessDB/Table", "index1", {"index"});
+ ui64 builIndexId = txId;
+
+ auto listing = TestListBuilIndex(runtime, tenantSchemeShard, "/MyRoot/ServerLessDB");
+ Y_ASSERT(listing.EntriesSize() == 1);
+
+ env.TestWaitNotification(runtime, txId, tenantSchemeShard);
+
+ auto descr = TestGetBuilIndex(runtime, tenantSchemeShard, "/MyRoot/ServerLessDB", txId);
Y_ASSERT(descr.GetIndexBuild().GetState() == Ydb::Table::IndexBuildState::STATE_DONE);
-
+
const TString meteringData = R"({"usage":{"start":0,"quantity":179,"finish":0,"unit":"request_unit","type":"delta"},"tags":{},"id":"106-9437199-2-101-1818-101-1818","cloud_id":"CLOUD_ID_VAL","source_wt":0,"source_id":"sless-docapi-ydb-ss","resource_id":"DATABASE_ID_VAL","schema":"ydb.serverless.requests.v1","folder_id":"FOLDER_ID_VAL","version":"1.0.0"})";
UNIT_ASSERT_NO_DIFF(meteringMessages, meteringData + "\n");
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/ServerLessDB/Table"),
- {NLs::PathExist,
- NLs::IndexesCount(1),
- NLs::PathVersionEqual(5)});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/ServerLessDB/Table/index1", true, true, true),
- {NLs::PathExist,
- NLs::IndexState(NKikimrSchemeOp::EIndexState::EIndexStateReady)});
-
- TestForgetBuilIndex(runtime, ++txId, tenantSchemeShard, "/MyRoot/ServerLessDB", builIndexId);
- listing = TestListBuilIndex(runtime, tenantSchemeShard, "/MyRoot/ServerLessDB");
- Y_ASSERT(listing.EntriesSize() == 0);
-
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/ServerLessDB/Table"),
+ {NLs::PathExist,
+ NLs::IndexesCount(1),
+ NLs::PathVersionEqual(5)});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/ServerLessDB/Table/index1", true, true, true),
+ {NLs::PathExist,
+ NLs::IndexState(NKikimrSchemeOp::EIndexState::EIndexStateReady)});
+
+ TestForgetBuilIndex(runtime, ++txId, tenantSchemeShard, "/MyRoot/ServerLessDB", builIndexId);
+ listing = TestListBuilIndex(runtime, tenantSchemeShard, "/MyRoot/ServerLessDB");
+ Y_ASSERT(listing.EntriesSize() == 0);
+
TestDropTableIndex(runtime, tenantSchemeShard, ++txId, "/MyRoot/ServerLessDB", R"(
TableName: "Table"
IndexName: "index1"
)");
- env.TestWaitNotification(runtime, txId, tenantSchemeShard);
-
+ env.TestWaitNotification(runtime, txId, tenantSchemeShard);
+
RebootTablet(runtime, tenantSchemeShard, runtime.AllocateEdgeActor());
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/ServerLessDB/Table"),
- {NLs::PathExist,
- NLs::IndexesCount(0),
- NLs::PathVersionEqual(7)});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/ServerLessDB/Table"),
+ {NLs::PathExist,
+ NLs::IndexesCount(0),
+ NLs::PathVersionEqual(7)});
// Test that index build succeeds on recreated columns
@@ -396,451 +396,451 @@ Y_UNIT_TEST_SUITE(IndexBuildTest) {
Y_ASSERT(descr.GetIndexBuild().GetState() == Ydb::Table::IndexBuildState::STATE_DONE);
UNIT_ASSERT(billRecords.empty());
- }
-
- Y_UNIT_TEST(CancellationNotEnoughRetries) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- SetSplitMergePartCountLimit(&runtime, -1);
-
- // Just create main table
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint32" }
- Columns { Name: "value" Type: "Utf8" }
- Columns { Name: "index" Type: "Uint32" }
- KeyColumnNames: ["key", "value"]
- )");
- env.TestWaitNotification(runtime, txId);
-
- auto fnWriteRow = [&](ui64 tabletId, ui32 key, ui32 index, const TString& value, const char *table) {
- TString writeQuery = Sprintf(R"(
- (
- (let key '( '('key (Uint32 '%u ) ) '('value (Utf8 '%s) ) ) )
- (let row '( '('index (Uint32 '%u ) ) ) )
- (return (AsList (UpdateRow '__user__%s key row) ))
- )
- )", key, value.c_str(), index, table);
- NKikimrMiniKQL::TResult result;
- TString err;
+ }
+
+ Y_UNIT_TEST(CancellationNotEnoughRetries) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ SetSplitMergePartCountLimit(&runtime, -1);
+
+ // Just create main table
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint32" }
+ Columns { Name: "value" Type: "Utf8" }
+ Columns { Name: "index" Type: "Uint32" }
+ KeyColumnNames: ["key", "value"]
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ auto fnWriteRow = [&](ui64 tabletId, ui32 key, ui32 index, const TString& value, const char *table) {
+ TString writeQuery = Sprintf(R"(
+ (
+ (let key '( '('key (Uint32 '%u ) ) '('value (Utf8 '%s) ) ) )
+ (let row '( '('index (Uint32 '%u ) ) ) )
+ (return (AsList (UpdateRow '__user__%s key row) ))
+ )
+ )", key, value.c_str(), index, table);
+ NKikimrMiniKQL::TResult result;
+ TString err;
NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
- };
- TVector<char> longStrData(100000, 'a');
- TString longString(longStrData.begin(), longStrData.end());
- for (ui32 delta = 0; delta < 1000; ++delta) {
+ };
+ TVector<char> longStrData(100000, 'a');
+ TString longString(longStrData.begin(), longStrData.end());
+ for (ui32 delta = 0; delta < 1000; ++delta) {
fnWriteRow(TTestTxConfig::FakeHiveTablets, 1 + delta, 1000 + delta, longString, "Table");
- }
-
- runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_DEBUG);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathExist,
- NLs::IndexesCount(0),
- NLs::PathVersionEqual(3)});
-
- // Force stats reporting without delays
+ }
+
+ runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_DEBUG);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathExist,
+ NLs::IndexesCount(0),
+ NLs::PathVersionEqual(3)});
+
+ // Force stats reporting without delays
NDataShard::gDbStatsReportInterval = TDuration::Seconds(0);
NDataShard::gDbStatsDataSizeResolution = 80000;
-
- auto upgradeEvent = [&](TTestActorRuntimeBase&, TAutoPtr<IEventHandle> &ev) -> auto {
- if (ev->Type == TEvSchemeShard::EvModifySchemeTransaction) {
- auto *msg = ev->Get<TEvSchemeShard::TEvModifySchemeTransaction>();
- if (msg->Record.GetTransaction(0).GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexBuild) {
- auto& tx = *msg->Record.MutableTransaction(0);
- auto& config = *tx.MutableInitiateIndexBuild();
- NKikimrSchemeOp::TIndexCreationConfig& indexConfig = *config.MutableIndex();
- NKikimrSchemeOp::TTableDescription& indexTableDescr = *indexConfig.MutableIndexImplTableDescription();
-
- indexTableDescr.MutablePartitionConfig()->MutablePartitioningPolicy()->SetSizeToSplit(10);
- indexTableDescr.MutablePartitionConfig()->MutablePartitioningPolicy()->SetMaxPartitionsCount(10);
-
- Cerr << "upgradeEvent has happend" << Endl;
- }
- }
-
- return TTestActorRuntime::EEventAction::PROCESS;
- };
-
- runtime.SetObserverFunc(upgradeEvent);
-
- {
- NKikimrIndexBuilder::TIndexBuildSettings settings;
- settings.set_source_path("/MyRoot/Table");
- settings.set_max_batch_rows(1);
- settings.set_max_batch_bytes(1<<10);
- settings.set_max_shards_in_flight(1);
- settings.set_max_retries_upload_batch(0);
-
- Ydb::Table::TableIndex& index = *settings.mutable_index();
- index.set_name("index1");
- index.add_index_columns("index");
- *index.mutable_global_index() = Ydb::Table::GlobalIndex();
-
- auto request = new TEvIndexBuilder::TEvCreateRequest(++txId, "/MyRoot", std::move(settings));
- auto sender = runtime.AllocateEdgeActor();
-
+
+ auto upgradeEvent = [&](TTestActorRuntimeBase&, TAutoPtr<IEventHandle> &ev) -> auto {
+ if (ev->Type == TEvSchemeShard::EvModifySchemeTransaction) {
+ auto *msg = ev->Get<TEvSchemeShard::TEvModifySchemeTransaction>();
+ if (msg->Record.GetTransaction(0).GetOperationType() == NKikimrSchemeOp::EOperationType::ESchemeOpCreateIndexBuild) {
+ auto& tx = *msg->Record.MutableTransaction(0);
+ auto& config = *tx.MutableInitiateIndexBuild();
+ NKikimrSchemeOp::TIndexCreationConfig& indexConfig = *config.MutableIndex();
+ NKikimrSchemeOp::TTableDescription& indexTableDescr = *indexConfig.MutableIndexImplTableDescription();
+
+ indexTableDescr.MutablePartitionConfig()->MutablePartitioningPolicy()->SetSizeToSplit(10);
+ indexTableDescr.MutablePartitionConfig()->MutablePartitioningPolicy()->SetMaxPartitionsCount(10);
+
+ Cerr << "upgradeEvent has happend" << Endl;
+ }
+ }
+
+ return TTestActorRuntime::EEventAction::PROCESS;
+ };
+
+ runtime.SetObserverFunc(upgradeEvent);
+
+ {
+ NKikimrIndexBuilder::TIndexBuildSettings settings;
+ settings.set_source_path("/MyRoot/Table");
+ settings.set_max_batch_rows(1);
+ settings.set_max_batch_bytes(1<<10);
+ settings.set_max_shards_in_flight(1);
+ settings.set_max_retries_upload_batch(0);
+
+ Ydb::Table::TableIndex& index = *settings.mutable_index();
+ index.set_name("index1");
+ index.add_index_columns("index");
+ *index.mutable_global_index() = Ydb::Table::GlobalIndex();
+
+ auto request = new TEvIndexBuilder::TEvCreateRequest(++txId, "/MyRoot", std::move(settings));
+ auto sender = runtime.AllocateEdgeActor();
+
ForwardToTablet(runtime, TTestTxConfig::SchemeShard, sender, request);
-
- TAutoPtr<IEventHandle> handle;
- TEvIndexBuilder::TEvCreateResponse* event = runtime.GrabEdgeEvent<TEvIndexBuilder::TEvCreateResponse>(handle);
- UNIT_ASSERT(event);
-
- Cerr << "BUILDINDEX RESPONSE CREATE: " << event->ToString() << Endl;
- UNIT_ASSERT_EQUAL_C(event->Record.GetStatus(), Ydb::StatusIds::SUCCESS,
- "status mismatch"
- << " got " << Ydb::StatusIds::StatusCode_Name(event->Record.GetStatus())
- << " expected " << Ydb::StatusIds::StatusCode_Name(Ydb::StatusIds::SUCCESS));
- }
- ui64 builIndexId = txId;
-
+
+ TAutoPtr<IEventHandle> handle;
+ TEvIndexBuilder::TEvCreateResponse* event = runtime.GrabEdgeEvent<TEvIndexBuilder::TEvCreateResponse>(handle);
+ UNIT_ASSERT(event);
+
+ Cerr << "BUILDINDEX RESPONSE CREATE: " << event->ToString() << Endl;
+ UNIT_ASSERT_EQUAL_C(event->Record.GetStatus(), Ydb::StatusIds::SUCCESS,
+ "status mismatch"
+ << " got " << Ydb::StatusIds::StatusCode_Name(event->Record.GetStatus())
+ << " expected " << Ydb::StatusIds::StatusCode_Name(Ydb::StatusIds::SUCCESS));
+ }
+ ui64 builIndexId = txId;
+
auto listing = TestListBuilIndex(runtime, TTestTxConfig::SchemeShard, "/MyRoot");
- Y_ASSERT(listing.EntriesSize() == 1);
-
- env.TestWaitNotification(runtime, txId);
-
+ Y_ASSERT(listing.EntriesSize() == 1);
+
+ env.TestWaitNotification(runtime, txId);
+
auto descr = TestGetBuilIndex(runtime, TTestTxConfig::SchemeShard, "/MyRoot", txId);
- UNIT_ASSERT_EQUAL(descr.GetIndexBuild().GetState(),Ydb::Table::IndexBuildState::STATE_REJECTED);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathExist,
- NLs::IndexesCount(0),
- NLs::PathVersionEqual(6)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table/index1", true, true, true),
- {NLs::PathNotExist});
-
+ UNIT_ASSERT_EQUAL(descr.GetIndexBuild().GetState(),Ydb::Table::IndexBuildState::STATE_REJECTED);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathExist,
+ NLs::IndexesCount(0),
+ NLs::PathVersionEqual(6)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table/index1", true, true, true),
+ {NLs::PathNotExist});
+
TestForgetBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", builIndexId);
listing = TestListBuilIndex(runtime, TTestTxConfig::SchemeShard, "/MyRoot");
- Y_ASSERT(listing.EntriesSize() == 0);
- }
-
- Y_UNIT_TEST(CancelationNoTable) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
+ Y_ASSERT(listing.EntriesSize() == 0);
+ }
+
+ Y_UNIT_TEST(CancelationNoTable) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
TestBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/Table", "index1", {"index"}, Ydb::StatusIds::BAD_REQUEST);
- env.TestWaitNotification(runtime, txId);
-
+ env.TestWaitNotification(runtime, txId);
+
NKikimrIndexBuilder::TEvListResponse listing = TestListBuilIndex(runtime, TTestTxConfig::SchemeShard, "/MyRoot");
- Y_ASSERT(listing.EntriesSize() == 0);
- }
-
+ Y_ASSERT(listing.EntriesSize() == 0);
+ }
+
Y_UNIT_TEST(WithFollowers) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
Name: "WithFollowers"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- Columns { Name: "valueFloat" Type: "Float" }
- KeyColumnNames: ["key"]
- PartitionConfig {
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ Columns { Name: "valueFloat" Type: "Float" }
+ KeyColumnNames: ["key"]
+ PartitionConfig {
FollowerGroups {
FollowerCount: 1
- }
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
+ }
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
TestBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/WithFollowers", "UserDefinedIndexByValue0", {"value0"});
- env.TestWaitNotification(runtime, txId);
-
- ui64 buildId = txId;
-
+ env.TestWaitNotification(runtime, txId);
+
+ ui64 buildId = txId;
+
auto descr = TestGetBuilIndex(runtime, TTestTxConfig::SchemeShard, "/MyRoot", buildId);
- Y_ASSERT(descr.GetIndexBuild().GetState() == Ydb::Table::IndexBuildState::STATE_DONE);
-
+ Y_ASSERT(descr.GetIndexBuild().GetState() == Ydb::Table::IndexBuildState::STATE_DONE);
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/WithFollowers"),
- {NLs::PathExist,
- NLs::IndexesCount(1),
- NLs::PathVersionEqual(5)});
-
+ {NLs::PathExist,
+ NLs::IndexesCount(1),
+ NLs::PathVersionEqual(5)});
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/WithFollowers/UserDefinedIndexByValue0", true, true, true),
- {NLs::PathExist,
- NLs::IndexState(NKikimrSchemeOp::EIndexState::EIndexStateReady)});
-
+ {NLs::PathExist,
+ NLs::IndexState(NKikimrSchemeOp::EIndexState::EIndexStateReady)});
+
TestForgetBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", buildId);
auto listing = TestListBuilIndex(runtime, TTestTxConfig::SchemeShard, "/MyRoot");
- Y_ASSERT(listing.EntriesSize() == 0);
-
+ Y_ASSERT(listing.EntriesSize() == 0);
+
TestDropTableIndex(runtime, ++txId, "/MyRoot", R"(
TableName: "WithFollowers"
IndexName: "UserDefinedIndexByValue0"
)");
- env.TestWaitNotification(runtime, txId);
-
+ env.TestWaitNotification(runtime, txId);
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/WithFollowers"),
- {NLs::PathExist,
- NLs::IndexesCount(0),
- NLs::PathVersionEqual(7)});
- }
-
- Y_UNIT_TEST(RejectsCreate) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
+ {NLs::PathExist,
+ NLs::IndexesCount(0),
+ NLs::PathVersionEqual(7)});
+ }
+
+ Y_UNIT_TEST(RejectsCreate) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
TestBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/NotExist", "index1", {"index"}, Ydb::StatusIds::BAD_REQUEST);
- env.TestWaitNotification(runtime, txId);
-
+ env.TestWaitNotification(runtime, txId);
+
TestMkDir(runtime, TTestTxConfig::SchemeShard, ++txId, "/MyRoot", "DIR");
- env.TestWaitNotification(runtime, txId);
-
+ env.TestWaitNotification(runtime, txId);
+
TestBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/DIR", "index1", {"index"}, Ydb::StatusIds::BAD_REQUEST);
- env.TestWaitNotification(runtime, txId);
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
- TableDescription {
- Name: "Table"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- Columns { Name: "valueFloat" Type: "Float" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue1"
- KeyColumnNames: ["value1"]
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
+ env.TestWaitNotification(runtime, txId);
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
+ TableDescription {
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ Columns { Name: "valueFloat" Type: "Float" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue1"
+ KeyColumnNames: ["value1"]
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
TestBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/Table", "UserDefinedIndexByValue0", {"value0"}, Ydb::StatusIds::BAD_REQUEST);
- env.TestWaitNotification(runtime, txId);
-
+ env.TestWaitNotification(runtime, txId);
+
TestBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/Table", "UserDefinedIndexByValue0", {"value1"}, Ydb::StatusIds::BAD_REQUEST);
- env.TestWaitNotification(runtime, txId);
-
+ env.TestWaitNotification(runtime, txId);
+
TestBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/Table", "nameOK", {"NotExist"}, Ydb::StatusIds::BAD_REQUEST);
- env.TestWaitNotification(runtime, txId);
-
+ env.TestWaitNotification(runtime, txId);
+
TestBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/Table", "nameOK", {"valueFloat"}, Ydb::StatusIds::BAD_REQUEST);
- env.TestWaitNotification(runtime, txId);
-
- TSchemeLimits lowLimits;
-
- lowLimits.ExtraPathSymbolsAllowed = "_-.";
- lowLimits.MaxTableIndices = 2;
- SetSchemeshardSchemaLimits(runtime, lowLimits);
+ env.TestWaitNotification(runtime, txId);
+
+ TSchemeLimits lowLimits;
+
+ lowLimits.ExtraPathSymbolsAllowed = "_-.";
+ lowLimits.MaxTableIndices = 2;
+ SetSchemeshardSchemaLimits(runtime, lowLimits);
TestBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/Table", "!name!", {"value0"}, Ydb::StatusIds::BAD_REQUEST);
- env.TestWaitNotification(runtime, txId);
-
- lowLimits.MaxTableIndices = 2;
- SetSchemeshardSchemaLimits(runtime, lowLimits);
+ env.TestWaitNotification(runtime, txId);
+
+ lowLimits.MaxTableIndices = 2;
+ SetSchemeshardSchemaLimits(runtime, lowLimits);
TestBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/Table", "nameOK", {"value0", "value1"}, Ydb::StatusIds::PRECONDITION_FAILED);
- env.TestWaitNotification(runtime, txId);
-
- lowLimits.MaxTableIndices = 3;
- lowLimits.MaxChildrenInDir = 2;
- SetSchemeshardSchemaLimits(runtime, lowLimits);
+ env.TestWaitNotification(runtime, txId);
+
+ lowLimits.MaxTableIndices = 3;
+ lowLimits.MaxChildrenInDir = 2;
+ SetSchemeshardSchemaLimits(runtime, lowLimits);
TestBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/Table", "nameOK", {"value0", "value1"}, Ydb::StatusIds::PRECONDITION_FAILED);
- env.TestWaitNotification(runtime, txId);
-
- lowLimits.MaxTableIndices = 3;
- lowLimits.MaxChildrenInDir = 3;
- SetSchemeshardSchemaLimits(runtime, lowLimits);
+ env.TestWaitNotification(runtime, txId);
+
+ lowLimits.MaxTableIndices = 3;
+ lowLimits.MaxChildrenInDir = 3;
+ SetSchemeshardSchemaLimits(runtime, lowLimits);
TestBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/Table", "nameOK", {"value0", "value1"}, Ydb::StatusIds::SUCCESS);
TestBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/Table", "nameOK", {"value0", "value1"}, Ydb::StatusIds::OVERLOADED);
- env.TestWaitNotification(runtime, {txId, txId - 1});
- }
-
- Y_UNIT_TEST(Lock) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- // Just create main table
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint32" }
- Columns { Name: "index" Type: "Uint32" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- env.TestWaitNotification(runtime, txId);
-
+ env.TestWaitNotification(runtime, {txId, txId - 1});
+ }
+
+ Y_UNIT_TEST(Lock) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ // Just create main table
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint32" }
+ Columns { Name: "index" Type: "Uint32" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ env.TestWaitNotification(runtime, txId);
+
TestBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/Table", "nameOK", {"index"});
- ui64 builIndexId = txId;
-
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- DropColumns { Name: "index" }
- )",
- {NKikimrScheme::StatusMultipleModifications});
- env.TestWaitNotification(runtime, txId);
-
+ ui64 builIndexId = txId;
+
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ DropColumns { Name: "index" }
+ )",
+ {NKikimrScheme::StatusMultipleModifications});
+ env.TestWaitNotification(runtime, txId);
+
TestDropTableIndex(runtime, ++txId, "/MyRoot", R"(
TableName: "Table"
IndexName: "nameOK"
)", {NKikimrScheme::StatusMultipleModifications});
- env.TestWaitNotification(runtime, txId);
-
- TestDropTable(runtime, ++txId, "/MyRoot", "Table",
- {NKikimrScheme::StatusMultipleModifications});
- env.TestWaitNotification(runtime, txId);
-
-
- env.TestWaitNotification(runtime, builIndexId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathExist,
- NLs::IndexesCount(1)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table/nameOK", true, true, true),
- {NLs::PathExist,
- NLs::IndexState(NKikimrSchemeOp::EIndexState::EIndexStateReady)});
-
+ env.TestWaitNotification(runtime, txId);
+
+ TestDropTable(runtime, ++txId, "/MyRoot", "Table",
+ {NKikimrScheme::StatusMultipleModifications});
+ env.TestWaitNotification(runtime, txId);
+
+
+ env.TestWaitNotification(runtime, builIndexId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathExist,
+ NLs::IndexesCount(1)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table/nameOK", true, true, true),
+ {NLs::PathExist,
+ NLs::IndexState(NKikimrSchemeOp::EIndexState::EIndexStateReady)});
+
NKikimrIndexBuilder::TEvGetResponse descr = TestGetBuilIndex(runtime, TTestTxConfig::SchemeShard, "/MyRoot", builIndexId);
Y_ASSERT(descr.GetIndexBuild().GetState() == Ydb::Table::IndexBuildState::STATE_DONE);
-
-// KIKIMR-9945
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- DropColumns { Name: "index" }
- )",
- {NKikimrScheme::StatusPreconditionFailed});
- env.TestWaitNotification(runtime, txId);
-
- TestDropTable(runtime, ++txId, "/MyRoot", "Table");
- env.TestWaitNotification(runtime, txId);
-
- }
-
- Y_UNIT_TEST(DropIndex) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
- TableDescription {
- Name: "Table"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue1"
- KeyColumnNames: ["value1"]
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::Finished,
- NLs::PathVersionEqual(3),
- NLs::IndexesCount(2)});
+
+// KIKIMR-9945
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ DropColumns { Name: "index" }
+ )",
+ {NKikimrScheme::StatusPreconditionFailed});
+ env.TestWaitNotification(runtime, txId);
+
+ TestDropTable(runtime, ++txId, "/MyRoot", "Table");
+ env.TestWaitNotification(runtime, txId);
+
+ }
+
+ Y_UNIT_TEST(DropIndex) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
+ TableDescription {
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue1"
+ KeyColumnNames: ["value1"]
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(3),
+ NLs::IndexesCount(2)});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/Table/UserDefinedIndexByValue0"),
- {NLs::Finished,
- NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
- NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
- NLs::IndexKeys({"value0"})});
+ {NLs::Finished,
+ NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
+ NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
+ NLs::IndexKeys({"value0"})});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/Table/UserDefinedIndexByValue0/indexImplTable"),
- {NLs::Finished,
- NLs::PathVersionEqual(3)});
-
+ {NLs::Finished,
+ NLs::PathVersionEqual(3)});
+
TestDropTableIndex(runtime, ++txId, "/MyRoot", R"(
TableName: "Table"
IndexName: "UserDefinedIndexByValue0"
)");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::Finished,
- NLs::PathVersionEqual(5),
- NLs::IndexesCount(1)});
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(5),
+ NLs::IndexesCount(1)});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/Table/UserDefinedIndexByValue0"),
- {NLs::PathNotExist});
+ {NLs::PathNotExist});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/Table/UserDefinedIndexByValue0/indexImplTable"),
- {NLs::PathNotExist});
-
- TestCopyTable(runtime, ++txId, "/MyRoot", "Copy", "/MyRoot/Table");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::Finished,
- NLs::PathVersionEqual(5),
- NLs::IndexesCount(1)});
+ {NLs::PathNotExist});
+
+ TestCopyTable(runtime, ++txId, "/MyRoot", "Copy", "/MyRoot/Table");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(5),
+ NLs::IndexesCount(1)});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/Table/UserDefinedIndexByValue1"),
- {NLs::PathExist});
+ {NLs::PathExist});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/Table/UserDefinedIndexByValue1/indexImplTable"),
- {NLs::PathExist});
-
-
- TestDropTable(runtime, ++txId, "/MyRoot", "Table");
- env.TestWaitNotification(runtime, txId);
-
- TestDropTable(runtime, ++txId, "/MyRoot", "Copy");
- env.TestWaitNotification(runtime, txId);
- }
-
- Y_UNIT_TEST(RejectsDropIndex) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
- TableDescription {
- Name: "Table"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::Finished,
- NLs::PathVersionEqual(3),
- NLs::IndexesCount(1)});
+ {NLs::PathExist});
+
+
+ TestDropTable(runtime, ++txId, "/MyRoot", "Table");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDropTable(runtime, ++txId, "/MyRoot", "Copy");
+ env.TestWaitNotification(runtime, txId);
+ }
+
+ Y_UNIT_TEST(RejectsDropIndex) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
+ TableDescription {
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(3),
+ NLs::IndexesCount(1)});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/Table/UserDefinedIndexByValue0"),
- {NLs::Finished,
- NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
- NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
- NLs::IndexKeys({"value0"})});
+ {NLs::Finished,
+ NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
+ NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
+ NLs::IndexKeys({"value0"})});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/Table/UserDefinedIndexByValue0/indexImplTable"),
- {NLs::Finished,
- NLs::PathVersionEqual(3)});
-
+ {NLs::Finished,
+ NLs::PathVersionEqual(3)});
+
TestDropTableIndex(runtime, ++txId, "/MyRoot/NotExist", R"(
TableName: "Table"
IndexName: "UserDefinedIndexByValue0"
)", {NKikimrScheme::StatusPathDoesNotExist});
- env.TestWaitNotification(runtime, txId);
-
+ env.TestWaitNotification(runtime, txId);
+
TestDropTableIndex(runtime, ++txId, "/MyRoot", R"(
TableName: "NotExist"
IndexName: "UserDefinedIndexByValue0"
)", {NKikimrScheme::StatusPathDoesNotExist});
- env.TestWaitNotification(runtime, txId);
-
+ env.TestWaitNotification(runtime, txId);
+
TestDropTableIndex(runtime, ++txId, "/MyRoot", R"(
TableName: "Table"
IndexName: "NotExist"
)", {NKikimrScheme::StatusPathDoesNotExist});
- env.TestWaitNotification(runtime, txId);
-
+ env.TestWaitNotification(runtime, txId);
+
TestDropTableIndex(runtime, ++txId, "/MyRoot", R"(
TableName: "Table"
IndexName: "UserDefinedIndexByValue0"
@@ -849,152 +849,152 @@ Y_UNIT_TEST_SUITE(IndexBuildTest) {
TableName: "Table"
IndexName: "UserDefinedIndexByValue0"
)", {NKikimrScheme::StatusMultipleModifications});
- env.TestWaitNotification(runtime, {txId, txId - 1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::Finished,
- NLs::PathVersionEqual(5),
- NLs::IndexesCount(0)});
+ env.TestWaitNotification(runtime, {txId, txId - 1});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(5),
+ NLs::IndexesCount(0)});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/Table/UserDefinedIndexByValue0"),
- {NLs::PathNotExist});
+ {NLs::PathNotExist});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/Table/UserDefinedIndexByValue0/indexImplTable"),
- {NLs::PathNotExist});
-
- TestDropTable(runtime, ++txId, "/MyRoot", "Table");
- env.TestWaitNotification(runtime, txId);
- }
-
- Y_UNIT_TEST(CancelBuild) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- // Just create main table
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint32" }
- Columns { Name: "index" Type: "Uint32" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- UniformPartitionsCount: 10
- )");
- env.TestWaitNotification(runtime, txId);
-
- auto fnWriteRow = [&] (ui64 tabletId, ui32 key, ui32 index, TString value, const char* table) {
- TString writeQuery = Sprintf(R"(
- (
- (let key '( '('key (Uint32 '%u ) ) ) )
- (let row '( '('index (Uint32 '%u ) ) '('value (Utf8 '%s) ) ) )
- (return (AsList (UpdateRow '__user__%s key row) ))
- )
- )", key, index, value.c_str(), table);
- NKikimrMiniKQL::TResult result;
- TString err;
+ {NLs::PathNotExist});
+
+ TestDropTable(runtime, ++txId, "/MyRoot", "Table");
+ env.TestWaitNotification(runtime, txId);
+ }
+
+ Y_UNIT_TEST(CancelBuild) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ // Just create main table
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint32" }
+ Columns { Name: "index" Type: "Uint32" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ UniformPartitionsCount: 10
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ auto fnWriteRow = [&] (ui64 tabletId, ui32 key, ui32 index, TString value, const char* table) {
+ TString writeQuery = Sprintf(R"(
+ (
+ (let key '( '('key (Uint32 '%u ) ) ) )
+ (let row '( '('index (Uint32 '%u ) ) '('value (Utf8 '%s) ) ) )
+ (return (AsList (UpdateRow '__user__%s key row) ))
+ )
+ )", key, index, value.c_str(), table);
+ NKikimrMiniKQL::TResult result;
+ TString err;
NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
- };
- for (ui32 delta = 0; delta < 101; ++delta) {
+ };
+ for (ui32 delta = 0; delta < 101; ++delta) {
fnWriteRow(TTestTxConfig::FakeHiveTablets, 1 + delta, 1000 + delta, "aaaa", "Table");
- }
-
- runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_TRACE);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathExist,
- NLs::IndexesCount(0),
- NLs::PathVersionEqual(3)});
-
+ }
+
+ runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_TRACE);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathExist,
+ NLs::IndexesCount(0),
+ NLs::PathVersionEqual(3)});
+
TestBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/Table", "index1", {"index"});
- ui64 buildIndexId = txId;
-
+ ui64 buildIndexId = txId;
+
auto listing = TestListBuilIndex(runtime, TTestTxConfig::SchemeShard, "/MyRoot");
- Y_ASSERT(listing.EntriesSize() == 1);
-
+ Y_ASSERT(listing.EntriesSize() == 1);
+
TestCancelBuildIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", buildIndexId);
-
- env.TestWaitNotification(runtime, buildIndexId);
-
+
+ env.TestWaitNotification(runtime, buildIndexId);
+
auto descr = TestGetBuilIndex(runtime, TTestTxConfig::SchemeShard, "/MyRoot", buildIndexId);
Y_ASSERT(descr.GetIndexBuild().GetState() == Ydb::Table::IndexBuildState::STATE_CANCELLED);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathExist,
- NLs::IndexesCount(0),
- NLs::PathVersionEqual(6)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table/index1", true, true, true),
- {NLs::PathNotExist});
- }
-
- Y_UNIT_TEST(RejectsCancel) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- // Just create main table
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint32" }
- Columns { Name: "index" Type: "Uint32" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- UniformPartitionsCount: 10
- )");
- env.TestWaitNotification(runtime, txId);
-
- auto fnWriteRow = [&] (ui64 tabletId, ui32 key, ui32 index, TString value, const char* table) {
- TString writeQuery = Sprintf(R"(
- (
- (let key '( '('key (Uint32 '%u ) ) ) )
- (let row '( '('index (Uint32 '%u ) ) '('value (Utf8 '%s) ) ) )
- (return (AsList (UpdateRow '__user__%s key row) ))
- )
- )", key, index, value.c_str(), table);
- NKikimrMiniKQL::TResult result;
- TString err;
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathExist,
+ NLs::IndexesCount(0),
+ NLs::PathVersionEqual(6)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table/index1", true, true, true),
+ {NLs::PathNotExist});
+ }
+
+ Y_UNIT_TEST(RejectsCancel) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ // Just create main table
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint32" }
+ Columns { Name: "index" Type: "Uint32" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ UniformPartitionsCount: 10
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ auto fnWriteRow = [&] (ui64 tabletId, ui32 key, ui32 index, TString value, const char* table) {
+ TString writeQuery = Sprintf(R"(
+ (
+ (let key '( '('key (Uint32 '%u ) ) ) )
+ (let row '( '('index (Uint32 '%u ) ) '('value (Utf8 '%s) ) ) )
+ (return (AsList (UpdateRow '__user__%s key row) ))
+ )
+ )", key, index, value.c_str(), table);
+ NKikimrMiniKQL::TResult result;
+ TString err;
NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);
- };
- for (ui32 delta = 0; delta < 101; ++delta) {
+ };
+ for (ui32 delta = 0; delta < 101; ++delta) {
fnWriteRow(TTestTxConfig::FakeHiveTablets, 1 + delta, 1000 + delta, "aaaa", "Table");
- }
-
- runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_TRACE);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathExist,
- NLs::IndexesCount(0),
- NLs::PathVersionEqual(3)});
-
+ }
+
+ runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NLog::PRI_TRACE);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathExist,
+ NLs::IndexesCount(0),
+ NLs::PathVersionEqual(3)});
+
TestBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/Table", "index1", {"index"});
- ui64 buildIndexId = txId;
-
- {
+ ui64 buildIndexId = txId;
+
+ {
auto descr = TestGetBuilIndex(runtime, TTestTxConfig::SchemeShard, "/MyRoot", buildIndexId);
Y_ASSERT(descr.GetIndexBuild().GetState() == Ydb::Table::IndexBuildState::STATE_PREPARING);
- }
-
- //
+ }
+
+ //
TestCancelBuildIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", buildIndexId + 1, TVector<Ydb::StatusIds::StatusCode>{Ydb::StatusIds::NOT_FOUND});
TestCancelBuildIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot/DirNoExist", buildIndexId, TVector<Ydb::StatusIds::StatusCode>{Ydb::StatusIds::NOT_FOUND});
-
- env.TestWaitNotification(runtime, buildIndexId);
-
+
+ env.TestWaitNotification(runtime, buildIndexId);
+
TestCancelBuildIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", buildIndexId, TVector<Ydb::StatusIds::StatusCode>{Ydb::StatusIds::PRECONDITION_FAILED});
-
- {
+
+ {
auto descr = TestGetBuilIndex(runtime, TTestTxConfig::SchemeShard, "/MyRoot", buildIndexId);
Y_ASSERT(descr.GetIndexBuild().GetState() == Ydb::Table::IndexBuildState::STATE_DONE);
- }
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathExist,
- NLs::IndexesCount(1),
- NLs::PathVersionEqual(5)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table/index1", true, true, true),
- {NLs::PathExist});
- }
+ }
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathExist,
+ NLs::IndexesCount(1),
+ NLs::PathVersionEqual(5)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table/index1", true, true, true),
+ {NLs::PathExist});
+ }
}
diff --git a/ydb/core/tx/schemeshard/ut_index_build_reboots.cpp b/ydb/core/tx/schemeshard/ut_index_build_reboots.cpp
index e142ac09c2c..d270fd87e67 100644
--- a/ydb/core/tx/schemeshard/ut_index_build_reboots.cpp
+++ b/ydb/core/tx/schemeshard/ut_index_build_reboots.cpp
@@ -1,11 +1,11 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
-
+
#include <ydb/core/kqp/ut/common/kqp_ut_common.h>
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-using namespace NSchemeShardUT_Private;
-
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+using namespace NSchemeShardUT_Private;
+
static void WriteRows(TTestActorRuntime& runtime, ui64 tabletId, ui32 key, ui32 index) {
TString writeQuery = Sprintf(R"(
(
@@ -63,78 +63,78 @@ static void WriteRows(TTestActorRuntime& runtime, ui64 tabletId, ui32 key, ui32
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
}
-Y_UNIT_TEST_SUITE(IndexBuildTestReboots) {
-
- Y_UNIT_TEST(BaseCase) {
- TTestWithReboots t(false);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
-
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "dir/Table"
- Columns { Name: "key" Type: "Uint32" }
- Columns { Name: "index" Type: "Uint32" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- UniformPartitionsCount: 2
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- for (ui32 delta = 0; delta < 2; ++delta) {
+Y_UNIT_TEST_SUITE(IndexBuildTestReboots) {
+
+ Y_UNIT_TEST(BaseCase) {
+ TTestWithReboots t(false);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "dir/Table"
+ Columns { Name: "key" Type: "Uint32" }
+ Columns { Name: "index" Type: "Uint32" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ UniformPartitionsCount: 2
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ for (ui32 delta = 0; delta < 2; ++delta) {
WriteRows(runtime, TTestTxConfig::FakeHiveTablets, 1 + delta, 100 + delta);
- }
- }
-
+ }
+ }
+
AsyncBuilIndex(runtime, ++t.TxId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/dir/Table", "index1", {"index"});
- ui64 buildIndexId = t.TxId;
-
- {
+ ui64 buildIndexId = t.TxId;
+
+ {
auto descr = TestGetBuilIndex(runtime, TTestTxConfig::SchemeShard, "/MyRoot", buildIndexId);
- UNIT_ASSERT_VALUES_EQUAL((ui64)descr.GetIndexBuild().GetState(), (ui64)Ydb::Table::IndexBuildState::STATE_PREPARING);
- }
-
- t.TestEnv->TestWaitNotification(runtime, buildIndexId);
-
- {
+ UNIT_ASSERT_VALUES_EQUAL((ui64)descr.GetIndexBuild().GetState(), (ui64)Ydb::Table::IndexBuildState::STATE_PREPARING);
+ }
+
+ t.TestEnv->TestWaitNotification(runtime, buildIndexId);
+
+ {
auto descr = TestGetBuilIndex(runtime, TTestTxConfig::SchemeShard, "/MyRoot", buildIndexId);
- UNIT_ASSERT_VALUES_EQUAL((ui64)descr.GetIndexBuild().GetState(), (ui64)Ydb::Table::IndexBuildState::STATE_DONE);
- }
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/Table"),
- {NLs::PathExist,
- NLs::IndexesCount(1)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/Table/index1", true, true, true),
- {NLs::PathExist,
- NLs::IndexState(NKikimrSchemeOp::EIndexState::EIndexStateReady)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/Table/index1/indexImplTable", true, true, true),
- {NLs::PathExist});
-
- // Check result
- {
- TInactiveZone inactive(activeZone);
-
- NKikimrMiniKQL::TResult result;
- TString err;
+ UNIT_ASSERT_VALUES_EQUAL((ui64)descr.GetIndexBuild().GetState(), (ui64)Ydb::Table::IndexBuildState::STATE_DONE);
+ }
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/Table"),
+ {NLs::PathExist,
+ NLs::IndexesCount(1)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/Table/index1", true, true, true),
+ {NLs::PathExist,
+ NLs::IndexState(NKikimrSchemeOp::EIndexState::EIndexStateReady)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/Table/index1/indexImplTable", true, true, true),
+ {NLs::PathExist});
+
+ // Check result
+ {
+ TInactiveZone inactive(activeZone);
+
+ NKikimrMiniKQL::TResult result;
+ TString err;
ui32 status = LocalMiniKQL(runtime, TTestTxConfig::FakeHiveTablets+2, R"(
- (
- (let range '( '('index (Uint32 '0) (Void) ) '('key (Uint32 '0) (Void) )))
- (let columns '('key 'index) )
- (let result (SelectRange '__user__indexImplTable range columns '()))
- (return (AsList (SetResult 'Result result) ))
- )
- )", result, err);
-
- UNIT_ASSERT_VALUES_EQUAL_C(status, NKikimrProto::OK, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
-
+ (
+ (let range '( '('index (Uint32 '0) (Void) ) '('key (Uint32 '0) (Void) )))
+ (let columns '('key 'index) )
+ (let result (SelectRange '__user__indexImplTable range columns '()))
+ (return (AsList (SetResult 'Result result) ))
+ )
+ )", result, err);
+
+ UNIT_ASSERT_VALUES_EQUAL_C(status, NKikimrProto::OK, err);
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
+
NKqp::CompareYson(R"([[[[[["100000"];["1000"]];[["100001"];["1001"]];[["100002"];["1002"]];[["100003"];["1003"]];[["100004"];["1004"]];[["100005"];["1005"]];[["100006"];["1006"]];[["100007"];["1007"]];[["100008"];["1008"]];[["100009"];["1009"]];[["101000"];["2000"]];[["101001"];["2001"]];[["101002"];["2002"]];[["101003"];["2003"]];[["101004"];["2004"]];[["101005"];["2005"]];[["101006"];["2006"]];[["101007"];["2007"]];[["101008"];["2008"]];[["101009"];["2009"]]];%false]]])", result);
- }
- });
- }
-
+ }
+ });
+ }
+
Y_UNIT_TEST(BaseCaseWithDataColumns) {
TTestWithReboots t(false);
t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
@@ -177,7 +177,7 @@ Y_UNIT_TEST_SUITE(IndexBuildTestReboots) {
TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/Table/index1", true, true, true),
{NLs::PathExist,
- NLs::IndexState(NKikimrSchemeOp::EIndexState::EIndexStateReady)});
+ NLs::IndexState(NKikimrSchemeOp::EIndexState::EIndexStateReady)});
TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/Table/index1/indexImplTable", true, true, true),
{NLs::PathExist});
@@ -205,58 +205,58 @@ Y_UNIT_TEST_SUITE(IndexBuildTestReboots) {
});
}
- Y_UNIT_TEST(DropIndex) {
- TTestWithReboots t(false);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
-
- TestCreateIndexedTable(runtime, ++t.TxId, "/MyRoot", R"(
- TableDescription {
- Name: "Table"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::Finished,
- NLs::PathVersionEqual(3),
- NLs::IndexesCount(1)});
+ Y_UNIT_TEST(DropIndex) {
+ TTestWithReboots t(false);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+
+ TestCreateIndexedTable(runtime, ++t.TxId, "/MyRoot", R"(
+ TableDescription {
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(3),
+ NLs::IndexesCount(1)});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/Table/UserDefinedIndexByValue0"),
- {NLs::Finished,
- NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
- NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
- NLs::IndexKeys({"value0"})});
+ {NLs::Finished,
+ NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
+ NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
+ NLs::IndexKeys({"value0"})});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/Table/UserDefinedIndexByValue0/indexImplTable"),
- {NLs::Finished,
- NLs::PathVersionEqual(3)});
- }
-
+ {NLs::Finished,
+ NLs::PathVersionEqual(3)});
+ }
+
TestDropTableIndex(runtime, ++t.TxId, "/MyRoot", R"(
TableName: "Table"
IndexName: "UserDefinedIndexByValue0"
)");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::Finished,
- NLs::PathVersionEqual(5),
- NLs::IndexesCount(0)});
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(5),
+ NLs::IndexesCount(0)});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/Table/UserDefinedIndexByValue0"),
- {NLs::PathNotExist});
+ {NLs::PathNotExist});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/Table/UserDefinedIndexByValue0/indexImplTable"),
- {NLs::PathNotExist});
- });
- }
-
+ {NLs::PathNotExist});
+ });
+ }
+
Y_UNIT_TEST(DropIndexWithDataColumns) {
TTestWithReboots t(false);
t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
@@ -285,8 +285,8 @@ Y_UNIT_TEST_SUITE(IndexBuildTestReboots) {
NLs::IndexesCount(1)});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/Table/UserDefinedIndexByValue0"),
{NLs::Finished,
- NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
- NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
+ NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
+ NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
NLs::IndexKeys({"value0"})});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/Table/UserDefinedIndexByValue0/indexImplTable"),
{NLs::Finished,
@@ -301,7 +301,7 @@ Y_UNIT_TEST_SUITE(IndexBuildTestReboots) {
TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
{NLs::Finished,
- NLs::PathVersionEqual(5),
+ NLs::PathVersionEqual(5),
NLs::IndexesCount(0)});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/Table/UserDefinedIndexByValue0"),
{NLs::PathNotExist});
@@ -310,119 +310,119 @@ Y_UNIT_TEST_SUITE(IndexBuildTestReboots) {
});
}
- Y_UNIT_TEST(CancelBuild) {
- TTestWithReboots t(false);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
-
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "dir/Table"
- Columns { Name: "key" Type: "Uint32" }
- Columns { Name: "index" Type: "Uint32" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- UniformPartitionsCount: 2
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- auto fnWriteRow = [&] (ui64 tabletId, ui32 key, ui32 index) {
- TString writeQuery = Sprintf(R"(
- (
- (let key0 '( '('key (Uint32 '%u ) ) ) )
- (let row0 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
- (let key1 '( '('key (Uint32 '%u ) ) ) )
- (let row1 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
- (let key2 '( '('key (Uint32 '%u ) ) ) )
- (let row2 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
- (let key3 '( '('key (Uint32 '%u ) ) ) )
- (let row3 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
- (let key4 '( '('key (Uint32 '%u ) ) ) )
- (let row4 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
- (let key5 '( '('key (Uint32 '%u ) ) ) )
- (let row5 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
- (let key6 '( '('key (Uint32 '%u ) ) ) )
- (let row6 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
- (let key7 '( '('key (Uint32 '%u ) ) ) )
- (let row7 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
- (let key8 '( '('key (Uint32 '%u ) ) ) )
- (let row8 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
- (let key9 '( '('key (Uint32 '%u ) ) ) )
- (let row9 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
-
- (return (AsList
- (UpdateRow '__user__Table key0 row0)
- (UpdateRow '__user__Table key1 row1)
- (UpdateRow '__user__Table key2 row2)
- (UpdateRow '__user__Table key3 row3)
- (UpdateRow '__user__Table key4 row4)
- (UpdateRow '__user__Table key5 row5)
- (UpdateRow '__user__Table key6 row6)
- (UpdateRow '__user__Table key7 row7)
- (UpdateRow '__user__Table key8 row8)
- (UpdateRow '__user__Table key9 row9)
- )
- )
- )
- )",
- 1000*key + 0, 1000*index + 0,
- 1000*key + 1, 1000*index + 1,
- 1000*key + 2, 1000*index + 2,
- 1000*key + 3, 1000*index + 3,
- 1000*key + 4, 1000*index + 4,
- 1000*key + 5, 1000*index + 5,
- 1000*key + 6, 1000*index + 6,
- 1000*key + 7, 1000*index + 7,
- 1000*key + 8, 1000*index + 8,
- 1000*key + 9, 1000*index + 9);
-
- NKikimrMiniKQL::TResult result;
- TString err;
+ Y_UNIT_TEST(CancelBuild) {
+ TTestWithReboots t(false);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "dir/Table"
+ Columns { Name: "key" Type: "Uint32" }
+ Columns { Name: "index" Type: "Uint32" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ UniformPartitionsCount: 2
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ auto fnWriteRow = [&] (ui64 tabletId, ui32 key, ui32 index) {
+ TString writeQuery = Sprintf(R"(
+ (
+ (let key0 '( '('key (Uint32 '%u ) ) ) )
+ (let row0 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
+ (let key1 '( '('key (Uint32 '%u ) ) ) )
+ (let row1 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
+ (let key2 '( '('key (Uint32 '%u ) ) ) )
+ (let row2 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
+ (let key3 '( '('key (Uint32 '%u ) ) ) )
+ (let row3 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
+ (let key4 '( '('key (Uint32 '%u ) ) ) )
+ (let row4 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
+ (let key5 '( '('key (Uint32 '%u ) ) ) )
+ (let row5 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
+ (let key6 '( '('key (Uint32 '%u ) ) ) )
+ (let row6 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
+ (let key7 '( '('key (Uint32 '%u ) ) ) )
+ (let row7 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
+ (let key8 '( '('key (Uint32 '%u ) ) ) )
+ (let row8 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
+ (let key9 '( '('key (Uint32 '%u ) ) ) )
+ (let row9 '( '('index (Uint32 '%u ) ) '('value (Utf8 'aaaa) ) ) )
+
+ (return (AsList
+ (UpdateRow '__user__Table key0 row0)
+ (UpdateRow '__user__Table key1 row1)
+ (UpdateRow '__user__Table key2 row2)
+ (UpdateRow '__user__Table key3 row3)
+ (UpdateRow '__user__Table key4 row4)
+ (UpdateRow '__user__Table key5 row5)
+ (UpdateRow '__user__Table key6 row6)
+ (UpdateRow '__user__Table key7 row7)
+ (UpdateRow '__user__Table key8 row8)
+ (UpdateRow '__user__Table key9 row9)
+ )
+ )
+ )
+ )",
+ 1000*key + 0, 1000*index + 0,
+ 1000*key + 1, 1000*index + 1,
+ 1000*key + 2, 1000*index + 2,
+ 1000*key + 3, 1000*index + 3,
+ 1000*key + 4, 1000*index + 4,
+ 1000*key + 5, 1000*index + 5,
+ 1000*key + 6, 1000*index + 6,
+ 1000*key + 7, 1000*index + 7,
+ 1000*key + 8, 1000*index + 8,
+ 1000*key + 9, 1000*index + 9);
+
+ NKikimrMiniKQL::TResult result;
+ TString err;
NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
- };
- for (ui32 delta = 0; delta < 1; ++delta) {
+ };
+ for (ui32 delta = 0; delta < 1; ++delta) {
fnWriteRow(TTestTxConfig::FakeHiveTablets, 1 + delta, 100 + delta);
- }
-
+ }
+
TestBuilIndex(runtime, ++t.TxId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/dir/Table", "index1", {"index"});
- }
-
- ui64 buildId = t.TxId;
-
+ }
+
+ ui64 buildId = t.TxId;
+
auto response = TestCancelBuildIndex(runtime, ++t.TxId, TTestTxConfig::SchemeShard, "/MyRoot", buildId,
- TVector<Ydb::StatusIds::StatusCode>{Ydb::StatusIds::SUCCESS, Ydb::StatusIds::PRECONDITION_FAILED});
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- t.TestEnv->TestWaitNotification(runtime, buildId);
-
+ TVector<Ydb::StatusIds::StatusCode>{Ydb::StatusIds::SUCCESS, Ydb::StatusIds::PRECONDITION_FAILED});
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ t.TestEnv->TestWaitNotification(runtime, buildId);
+
auto descr = TestGetBuilIndex(runtime, TTestTxConfig::SchemeShard, "/MyRoot", buildId);
-
- if (response.GetStatus() == Ydb::StatusIds::SUCCESS) {
+
+ if (response.GetStatus() == Ydb::StatusIds::SUCCESS) {
Y_ASSERT(descr.GetIndexBuild().GetState() == Ydb::Table::IndexBuildState::STATE_CANCELLED);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/Table"),
- {NLs::PathExist,
- NLs::IndexesCount(0),
- NLs::PathVersionEqual(6)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/Table/index1", true, true, true),
- {NLs::PathNotExist});
- } else {
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/Table"),
+ {NLs::PathExist,
+ NLs::IndexesCount(0),
+ NLs::PathVersionEqual(6)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/Table/index1", true, true, true),
+ {NLs::PathNotExist});
+ } else {
Y_ASSERT(descr.GetIndexBuild().GetState() == Ydb::Table::IndexBuildState::STATE_DONE);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/Table"),
- {NLs::PathExist,
- NLs::IndexesCount(1),
- NLs::PathVersionEqual(5)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/Table/index1", true, true, true),
- {NLs::PathExist});
- }
-
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/Table"),
+ {NLs::PathExist,
+ NLs::IndexesCount(1),
+ NLs::PathVersionEqual(5)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/Table/index1", true, true, true),
+ {NLs::PathExist});
+ }
+
TestForgetBuilIndex(runtime, ++t.TxId, TTestTxConfig::SchemeShard, "/MyRoot", buildId);
-
- });
- }
-}
+
+ });
+ }
+}
diff --git a/ydb/core/tx/schemeshard/ut_index_build_reboots/ya.make b/ydb/core/tx/schemeshard/ut_index_build_reboots/ya.make
index 49d7048f037..33907508db1 100644
--- a/ydb/core/tx/schemeshard/ut_index_build_reboots/ya.make
+++ b/ydb/core/tx/schemeshard/ut_index_build_reboots/ya.make
@@ -1,23 +1,23 @@
UNITTEST_FOR(ydb/core/tx/schemeshard)
-
+
OWNER(
vvvv
g:kikimr
)
-
-FORK_SUBTESTS()
-IF (WITH_VALGRIND)
- SPLIT_FACTOR(40)
-ENDIF()
+FORK_SUBTESTS()
+
+IF (WITH_VALGRIND)
+ SPLIT_FACTOR(40)
+ENDIF()
TIMEOUT(2400)
-TAG(ya:fat)
+TAG(ya:fat)
-SIZE(LARGE)
-
-PEERDIR(
+SIZE(LARGE)
+
+PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
library/cpp/svnversion
@@ -26,12 +26,12 @@ PEERDIR(
ydb/core/tx
ydb/core/tx/schemeshard/ut_helpers
ydb/library/yql/public/udf/service/exception_policy
-)
-
-SRCS(
- ut_index_build_reboots.cpp
-)
-
+)
+
+SRCS(
+ ut_index_build_reboots.cpp
+)
+
YQL_LAST_ABI_VERSION()
-END()
+END()
diff --git a/ydb/core/tx/schemeshard/ut_info_types.cpp b/ydb/core/tx/schemeshard/ut_info_types.cpp
index d87545c4bff..9eaf3a7796c 100644
--- a/ydb/core/tx/schemeshard/ut_info_types.cpp
+++ b/ydb/core/tx/schemeshard/ut_info_types.cpp
@@ -6,7 +6,7 @@
#include <util/string/strip.h>
using namespace NKikimr;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NSchemeShardUT_Private;
Y_UNIT_TEST_SUITE(TSchemeShardInfoTypesTest) {
@@ -16,11 +16,11 @@ Y_UNIT_TEST_SUITE(TSchemeShardInfoTypesTest) {
const TString& dstProtoText,
const TString& posMapExpected)
{
- NKikimrSchemeOp::TPartitionConfig config;
+ NKikimrSchemeOp::TPartitionConfig config;
bool parseOk = ::google::protobuf::TextFormat::ParseFromString(srcProtoText, &config);
UNIT_ASSERT_C(parseOk, "Failed to parse TPartitionConfig:\n" << srcProtoText);
- auto posById = TPartitionConfigMerger::DeduplicateColumnFamiliesById(config);
+ auto posById = TPartitionConfigMerger::DeduplicateColumnFamiliesById(config);
TString result;
::google::protobuf::TextFormat::PrintToString(config, &result);
diff --git a/ydb/core/tx/schemeshard/ut_login.cpp b/ydb/core/tx/schemeshard/ut_login.cpp
index 0facf9f6b74..1a46fafeb1d 100644
--- a/ydb/core/tx/schemeshard/ut_login.cpp
+++ b/ydb/core/tx/schemeshard/ut_login.cpp
@@ -2,7 +2,7 @@
#include <ydb/library/login/login.h>
using namespace NKikimr;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NSchemeShardUT_Private;
Y_UNIT_TEST_SUITE(TSchemeShardLoginTest) {
diff --git a/ydb/core/tx/schemeshard/ut_move.cpp b/ydb/core/tx/schemeshard/ut_move.cpp
index 2a38fac2241..bb20b599583 100644
--- a/ydb/core/tx/schemeshard/ut_move.cpp
+++ b/ydb/core/tx/schemeshard/ut_move.cpp
@@ -4,851 +4,851 @@
#include <ydb/core/base/compile_time_flags.h>
#include <ydb/core/kqp/ut/common/kqp_ut_common.h>
#include <ydb/core/tx/datashard/change_exchange.h>
-
-#include <util/generic/size_literals.h>
-#include <util/string/cast.h>
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-using namespace NSchemeShardUT_Private;
-
-Y_UNIT_TEST_SUITE(TSchemeShardMoveTest) {
- Y_UNIT_TEST(Boot) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- }
-
- Y_UNIT_TEST(FeatureFlagReject) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime,
- TTestEnvOptions()
- .EnableAsyncIndexes(true));
- ui64 txId = 100;
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table2"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- env.TestWaitNotification(runtime, txId);
-
- {
- ++txId;
- auto first = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Moved1");
- auto second = MoveTableRequest(txId, "/MyRoot/Table2", "/MyRoot/Moved2");
- auto combination = CombineSchemeTransactions({first, second});
-
+
+#include <util/generic/size_literals.h>
+#include <util/string/cast.h>
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+using namespace NSchemeShardUT_Private;
+
+Y_UNIT_TEST_SUITE(TSchemeShardMoveTest) {
+ Y_UNIT_TEST(Boot) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ }
+
+ Y_UNIT_TEST(FeatureFlagReject) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime,
+ TTestEnvOptions()
+ .EnableAsyncIndexes(true));
+ ui64 txId = 100;
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table2"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ {
+ ++txId;
+ auto first = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Moved1");
+ auto second = MoveTableRequest(txId, "/MyRoot/Table2", "/MyRoot/Moved2");
+ auto combination = CombineSchemeTransactions({first, second});
+
AsyncSendTransaction(runtime, TTestTxConfig::SchemeShard, combination);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusInvalidParameter);
- }
- }
-
- Y_UNIT_TEST(Reject) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime,
- TTestEnvOptions()
- .EnableAsyncIndexes(true)
- .EnableSchemeTransactionsAtSchemeShard(true));
- ui64 txId = 100;
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
- TableDescription {
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "Sync"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "Async"
- KeyColumnNames: ["value1"]
- Type: EIndexTypeGlobalAsync
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
- TableDescription {
- Name: "Table2"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "Sync"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "Async"
- KeyColumnNames: ["value1"]
- Type: EIndexTypeGlobalAsync
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(2),
- NLs::PathsInsideDomain(10),
- NLs::ShardsInsideDomain(6)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
- {NLs::IsTable,
- NLs::PathVersionEqual(3),
- NLs::CheckColumns("Table1", {"key", "value0", "value1"}, {}, {"key"}),
- NLs::IndexesCount(2)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table2"),
- {NLs::IsTable,
- NLs::PathVersionEqual(3),
- NLs::CheckColumns("Table2", {"key", "value0", "value1"}, {}, {"key"}),
- NLs::IndexesCount(2)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Moved1"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Moved2"),
- {NLs::PathNotExist});
-
- {
- ++txId;
- auto op = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Table2");
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusInvalidParameter);
+ }
+ }
+
+ Y_UNIT_TEST(Reject) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime,
+ TTestEnvOptions()
+ .EnableAsyncIndexes(true)
+ .EnableSchemeTransactionsAtSchemeShard(true));
+ ui64 txId = 100;
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
+ TableDescription {
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "Sync"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "Async"
+ KeyColumnNames: ["value1"]
+ Type: EIndexTypeGlobalAsync
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
+ TableDescription {
+ Name: "Table2"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "Sync"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "Async"
+ KeyColumnNames: ["value1"]
+ Type: EIndexTypeGlobalAsync
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(2),
+ NLs::PathsInsideDomain(10),
+ NLs::ShardsInsideDomain(6)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(3),
+ NLs::CheckColumns("Table1", {"key", "value0", "value1"}, {}, {"key"}),
+ NLs::IndexesCount(2)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table2"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(3),
+ NLs::CheckColumns("Table2", {"key", "value0", "value1"}, {}, {"key"}),
+ NLs::IndexesCount(2)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Moved1"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Moved2"),
+ {NLs::PathNotExist});
+
+ {
+ ++txId;
+ auto op = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Table2");
AsyncSendTransaction(runtime, TTestTxConfig::SchemeShard, op);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusSchemeError);
- }
-
- {
- ++txId;
- auto op = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Table1");
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusSchemeError);
+ }
+
+ {
+ ++txId;
+ auto op = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Table1");
AsyncSendTransaction(runtime, TTestTxConfig::SchemeShard, op);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusSchemeError);
- }
-
- {
- ++txId;
- auto first = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Moved1");
- auto second = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Moved2");
- auto combination = CombineSchemeTransactions({first, second});
-
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusSchemeError);
+ }
+
+ {
+ ++txId;
+ auto first = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Moved1");
+ auto second = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Moved2");
+ auto combination = CombineSchemeTransactions({first, second});
+
AsyncSendTransaction(runtime, TTestTxConfig::SchemeShard, combination);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusInvalidParameter);
- }
-
- {
- ++txId;
- auto first = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Moved1");
- auto second = MoveTableRequest(txId, "/MyRoot/Table2", "/MyRoot/Moved1");
- auto combination = CombineSchemeTransactions({first, second});
-
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusInvalidParameter);
+ }
+
+ {
+ ++txId;
+ auto first = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Moved1");
+ auto second = MoveTableRequest(txId, "/MyRoot/Table2", "/MyRoot/Moved1");
+ auto combination = CombineSchemeTransactions({first, second});
+
AsyncSendTransaction(runtime, TTestTxConfig::SchemeShard, combination);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusInvalidParameter);
- }
-
- {
- ++txId;
- auto first = DropTableRequest(txId, "/MyRoot", "Table1");
- auto second = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Table1");
- auto combination = CombineSchemeTransactions({first, second});
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusInvalidParameter);
+ }
+
+ {
+ ++txId;
+ auto first = DropTableRequest(txId, "/MyRoot", "Table1");
+ auto second = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Table1");
+ auto combination = CombineSchemeTransactions({first, second});
AsyncSendTransaction(runtime, TTestTxConfig::SchemeShard, combination);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusInvalidParameter);
- }
-
- {
- ++txId;
- auto first = DropTableRequest(txId, "/MyRoot", "Table2");
- auto second = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Moved1");
- auto third = MoveTableRequest(txId, "/MyRoot/Table2", "/MyRoot/Moved1");
- auto combination = CombineSchemeTransactions({first, second, third});
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusInvalidParameter);
+ }
+
+ {
+ ++txId;
+ auto first = DropTableRequest(txId, "/MyRoot", "Table2");
+ auto second = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Moved1");
+ auto third = MoveTableRequest(txId, "/MyRoot/Table2", "/MyRoot/Moved1");
+ auto combination = CombineSchemeTransactions({first, second, third});
AsyncSendTransaction(runtime, TTestTxConfig::SchemeShard, combination);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusInvalidParameter);
- }
-
- {
- ++txId;
- auto first = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Table2");
- auto second = MoveTableRequest(txId, "/MyRoot/Table2", "/MyRoot/Table1");
- auto combination = CombineSchemeTransactions({first, second});
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusInvalidParameter);
+ }
+
+ {
+ ++txId;
+ auto first = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Table2");
+ auto second = MoveTableRequest(txId, "/MyRoot/Table2", "/MyRoot/Table1");
+ auto combination = CombineSchemeTransactions({first, second});
AsyncSendTransaction(runtime, TTestTxConfig::SchemeShard, combination);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusSchemeError);
- }
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(2),
- NLs::PathsInsideDomain(10),
- NLs::ShardsInsideDomain(6)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
- {NLs::IsTable,
- NLs::PathVersionEqual(3),
- NLs::CheckColumns("Table1", {"key", "value0", "value1"}, {}, {"key"}),
- NLs::IndexesCount(2)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table2"),
- {NLs::IsTable,
- NLs::PathVersionEqual(3),
- NLs::CheckColumns("Table2", {"key", "value0", "value1"}, {}, {"key"}),
- NLs::IndexesCount(2)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Moved1"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Moved2"),
- {NLs::PathNotExist});
-
- {
- //seccess op
- ++txId;
- auto first = MoveTableRequest(txId, "/MyRoot/Table2", "/MyRoot/Moved2");
- auto second = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Table2");
- auto combination = CombineSchemeTransactions({first, second});
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusSchemeError);
+ }
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(2),
+ NLs::PathsInsideDomain(10),
+ NLs::ShardsInsideDomain(6)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(3),
+ NLs::CheckColumns("Table1", {"key", "value0", "value1"}, {}, {"key"}),
+ NLs::IndexesCount(2)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table2"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(3),
+ NLs::CheckColumns("Table2", {"key", "value0", "value1"}, {}, {"key"}),
+ NLs::IndexesCount(2)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Moved1"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Moved2"),
+ {NLs::PathNotExist});
+
+ {
+ //seccess op
+ ++txId;
+ auto first = MoveTableRequest(txId, "/MyRoot/Table2", "/MyRoot/Moved2");
+ auto second = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/Table2");
+ auto combination = CombineSchemeTransactions({first, second});
AsyncSendTransaction(runtime, TTestTxConfig::SchemeShard, combination);
- TestModificationResult(runtime, txId);
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table2"),
- {NLs::IsTable,
- NLs::PathVersionEqual(6),
- NLs::CheckColumns("Table2", {"key", "value0", "value1"}, {}, {"key"})});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Moved2"),
- {NLs::IsTable,
- NLs::PathVersionEqual(6),
- NLs::CheckColumns("Moved2", {"key", "value0", "value1"}, {}, {"key"})});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(2),
- NLs::PathsInsideDomain(10),
- NLs::ShardsInsideDomain(6)});
- }
- }
-
- Y_UNIT_TEST(MoveTableForBackup) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime,
- TTestEnvOptions()
- .EnableSchemeTransactionsAtSchemeShard(true));
-
- ui64 txId = 100;
-
- // create src table
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint32"}
- Columns { Name: "value" Type: "Utf8"}
- KeyColumnNames: ["key"]
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true), {
- NLs::IsBackupTable(false),
- });
-
- // simple copy table
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "IsBackupTable"
- CopyFromTable: "/MyRoot/Table"
- IsBackup: true
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/IsBackupTable", true), {
- NLs::IsBackupTable(true),
- });
-
- {
- ++txId;
- auto op = MoveTableRequest(txId, "/MyRoot/IsBackupTable","/MyRoot/IsBackupTableMoved");
- AsyncSendTransaction(runtime, TTestTxConfig::SchemeShard, op);
- TestModificationResult(runtime, txId, NKikimrScheme::StatusSchemeError);
- }
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/IsBackupTableMoved", true), {
- NLs::PathNotExist
- });
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/IsBackupTable", true), {
- NLs::IsBackupTable(true),
- });
-
- TestDropTable(runtime, ++txId, "/MyRoot", "IsBackupTable");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/IsBackupTable", true), {
- NLs::PathNotExist
- });
- }
-
-
- Y_UNIT_TEST(TwoTables) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime,
- TTestEnvOptions()
- .EnableSchemeTransactionsAtSchemeShard(true));
- ui64 txId = 100;
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table2"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(2),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(2)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
- {NLs::IsTable,
- NLs::PathVersionEqual(3),
- NLs::CheckColumns("Table1", {"key", "value"}, {}, {"key"})});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table2"),
- {NLs::IsTable,
- NLs::PathVersionEqual(3),
- NLs::CheckColumns("Table2", {"key", "value"}, {}, {"key"})});
-
- ++txId;
- auto first = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/TableMove1");
- auto second = MoveTableRequest(txId, "/MyRoot/Table2", "/MyRoot/TableMove2");
- auto combination = CombineSchemeTransactions({first, second});
+ TestModificationResult(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table2"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(6),
+ NLs::CheckColumns("Table2", {"key", "value0", "value1"}, {}, {"key"})});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Moved2"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(6),
+ NLs::CheckColumns("Moved2", {"key", "value0", "value1"}, {}, {"key"})});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(2),
+ NLs::PathsInsideDomain(10),
+ NLs::ShardsInsideDomain(6)});
+ }
+ }
+
+ Y_UNIT_TEST(MoveTableForBackup) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime,
+ TTestEnvOptions()
+ .EnableSchemeTransactionsAtSchemeShard(true));
+
+ ui64 txId = 100;
+
+ // create src table
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint32"}
+ Columns { Name: "value" Type: "Utf8"}
+ KeyColumnNames: ["key"]
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true), {
+ NLs::IsBackupTable(false),
+ });
+
+ // simple copy table
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "IsBackupTable"
+ CopyFromTable: "/MyRoot/Table"
+ IsBackup: true
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/IsBackupTable", true), {
+ NLs::IsBackupTable(true),
+ });
+
+ {
+ ++txId;
+ auto op = MoveTableRequest(txId, "/MyRoot/IsBackupTable","/MyRoot/IsBackupTableMoved");
+ AsyncSendTransaction(runtime, TTestTxConfig::SchemeShard, op);
+ TestModificationResult(runtime, txId, NKikimrScheme::StatusSchemeError);
+ }
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/IsBackupTableMoved", true), {
+ NLs::PathNotExist
+ });
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/IsBackupTable", true), {
+ NLs::IsBackupTable(true),
+ });
+
+ TestDropTable(runtime, ++txId, "/MyRoot", "IsBackupTable");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/IsBackupTable", true), {
+ NLs::PathNotExist
+ });
+ }
+
+
+ Y_UNIT_TEST(TwoTables) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime,
+ TTestEnvOptions()
+ .EnableSchemeTransactionsAtSchemeShard(true));
+ ui64 txId = 100;
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table2"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(2),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(2)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(3),
+ NLs::CheckColumns("Table1", {"key", "value"}, {}, {"key"})});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table2"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(3),
+ NLs::CheckColumns("Table2", {"key", "value"}, {}, {"key"})});
+
+ ++txId;
+ auto first = MoveTableRequest(txId, "/MyRoot/Table1", "/MyRoot/TableMove1");
+ auto second = MoveTableRequest(txId, "/MyRoot/Table2", "/MyRoot/TableMove2");
+ auto combination = CombineSchemeTransactions({first, second});
AsyncSendTransaction(runtime, TTestTxConfig::SchemeShard, combination);
- TestModificationResult(runtime, txId);
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove1"),
- {NLs::IsTable,
- NLs::PathVersionEqual(6),
- NLs::CheckColumns("TableMove1", {"key", "value"}, {}, {"key"})});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table2"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove2"),
- {NLs::IsTable,
- NLs::PathVersionEqual(6),
- NLs::CheckColumns("TableMove2", {"key", "value"}, {}, {"key"})});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(2),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(2)});
- }
-
- Y_UNIT_TEST(Replace) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime,
- TTestEnvOptions()
- .EnableAsyncIndexes(true)
- .EnableSchemeTransactionsAtSchemeShard(true));
- ui64 txId = 100;
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
- TableDescription {
- Name: "Src"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "Sync"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "Async"
- KeyColumnNames: ["value1"]
- Type: EIndexTypeGlobalAsync
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
- TableDescription {
- Name: "Dst"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "Sync"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "Async"
- KeyColumnNames: ["value1"]
- Type: EIndexTypeGlobalAsync
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(2),
- NLs::PathsInsideDomain(10),
- NLs::ShardsInsideDomain(6)});
-
- {
- ++txId;
- auto first = DropTableRequest(txId, "/MyRoot", "Dst");
- auto second = MoveTableRequest(txId, "/MyRoot/Src", "/MyRoot/Dst");
- auto combination = CombineSchemeTransactions({first, second});
+ TestModificationResult(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table1"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove1"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(6),
+ NLs::CheckColumns("TableMove1", {"key", "value"}, {}, {"key"})});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table2"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove2"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(6),
+ NLs::CheckColumns("TableMove2", {"key", "value"}, {}, {"key"})});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(2),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(2)});
+ }
+
+ Y_UNIT_TEST(Replace) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime,
+ TTestEnvOptions()
+ .EnableAsyncIndexes(true)
+ .EnableSchemeTransactionsAtSchemeShard(true));
+ ui64 txId = 100;
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
+ TableDescription {
+ Name: "Src"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "Sync"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "Async"
+ KeyColumnNames: ["value1"]
+ Type: EIndexTypeGlobalAsync
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
+ TableDescription {
+ Name: "Dst"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "Sync"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "Async"
+ KeyColumnNames: ["value1"]
+ Type: EIndexTypeGlobalAsync
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(2),
+ NLs::PathsInsideDomain(10),
+ NLs::ShardsInsideDomain(6)});
+
+ {
+ ++txId;
+ auto first = DropTableRequest(txId, "/MyRoot", "Dst");
+ auto second = MoveTableRequest(txId, "/MyRoot/Src", "/MyRoot/Dst");
+ auto combination = CombineSchemeTransactions({first, second});
AsyncSendTransaction(runtime, TTestTxConfig::SchemeShard, combination);
- TestModificationResult(runtime, txId);
- env.TestWaitNotification(runtime, txId);
- }
-
+ TestModificationResult(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
+ }
+
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets+3, TTestTxConfig::FakeHiveTablets+6));
-
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Src"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Dst"),
- {NLs::IsTable,
- NLs::PathIdEqual(12),
- NLs::PathVersionEqual(6),
- NLs::CheckColumns("Dst", {"key", "value0", "value1"}, {}, {"key"}),
- NLs::IndexesCount(2)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(1),
- NLs::PathsInsideDomain(5),
- NLs::ShardsInsideDomain(3)});
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
- TableDescription {
- Name: "Src"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "Sync"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "Async"
- KeyColumnNames: ["value1"]
- Type: EIndexTypeGlobalAsync
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- {
- ++txId;
- auto first = DropTableRequest(txId, "/MyRoot", "Dst");
- auto second = MoveTableRequest(txId, "/MyRoot/Src", "/MyRoot/Dst");
- auto combination = CombineSchemeTransactions({first, second});
+
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Src"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Dst"),
+ {NLs::IsTable,
+ NLs::PathIdEqual(12),
+ NLs::PathVersionEqual(6),
+ NLs::CheckColumns("Dst", {"key", "value0", "value1"}, {}, {"key"}),
+ NLs::IndexesCount(2)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(1),
+ NLs::PathsInsideDomain(5),
+ NLs::ShardsInsideDomain(3)});
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
+ TableDescription {
+ Name: "Src"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "Sync"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "Async"
+ KeyColumnNames: ["value1"]
+ Type: EIndexTypeGlobalAsync
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ {
+ ++txId;
+ auto first = DropTableRequest(txId, "/MyRoot", "Dst");
+ auto second = MoveTableRequest(txId, "/MyRoot/Src", "/MyRoot/Dst");
+ auto combination = CombineSchemeTransactions({first, second});
AsyncSendTransaction(runtime, TTestTxConfig::SchemeShard, combination);
- TestModificationResult(runtime, txId);
- env.TestWaitNotification(runtime, txId);
- }
-
+ TestModificationResult(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
+ }
+
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+3));
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Src"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Dst"),
- {NLs::IsTable,
- NLs::PathIdEqual(22),
- NLs::PathVersionEqual(6),
- NLs::CheckColumns("Dst", {"key", "value0", "value1"}, {}, {"key"}),
- NLs::IndexesCount(2)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(1),
- NLs::PathsInsideDomain(5),
- NLs::ShardsInsideDomain(3)});
- }
-
- Y_UNIT_TEST(Chain) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime,
- TTestEnvOptions()
- .EnableAsyncIndexes(true)
- .EnableSchemeTransactionsAtSchemeShard(true));
- ui64 txId = 100;
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
- TableDescription {
- Name: "table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "Sync"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "Async"
- KeyColumnNames: ["value1"]
- Type: EIndexTypeGlobalAsync
- }
-
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
- TableDescription {
- Name: "table2"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "Sync"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "Async"
- KeyColumnNames: ["value1"]
- Type: EIndexTypeGlobalAsync
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(2),
- NLs::PathsInsideDomain(10),
- NLs::ShardsInsideDomain(6)});
-
- ++txId;
- auto first = MoveTableRequest(txId, "/MyRoot/table2", "/MyRoot/table3");
- auto second = MoveTableRequest(txId, "/MyRoot/table1", "/MyRoot/table2");
- auto combination = CombineSchemeTransactions({first, second});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Src"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Dst"),
+ {NLs::IsTable,
+ NLs::PathIdEqual(22),
+ NLs::PathVersionEqual(6),
+ NLs::CheckColumns("Dst", {"key", "value0", "value1"}, {}, {"key"}),
+ NLs::IndexesCount(2)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(1),
+ NLs::PathsInsideDomain(5),
+ NLs::ShardsInsideDomain(3)});
+ }
+
+ Y_UNIT_TEST(Chain) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime,
+ TTestEnvOptions()
+ .EnableAsyncIndexes(true)
+ .EnableSchemeTransactionsAtSchemeShard(true));
+ ui64 txId = 100;
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
+ TableDescription {
+ Name: "table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "Sync"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "Async"
+ KeyColumnNames: ["value1"]
+ Type: EIndexTypeGlobalAsync
+ }
+
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
+ TableDescription {
+ Name: "table2"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "Sync"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "Async"
+ KeyColumnNames: ["value1"]
+ Type: EIndexTypeGlobalAsync
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(2),
+ NLs::PathsInsideDomain(10),
+ NLs::ShardsInsideDomain(6)});
+
+ ++txId;
+ auto first = MoveTableRequest(txId, "/MyRoot/table2", "/MyRoot/table3");
+ auto second = MoveTableRequest(txId, "/MyRoot/table1", "/MyRoot/table2");
+ auto combination = CombineSchemeTransactions({first, second});
AsyncSendTransaction(runtime, TTestTxConfig::SchemeShard, combination);
- TestModificationResult(runtime, txId);
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/table1"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/table2"),
- {NLs::IsTable,
- NLs::PathVersionEqual(6),
- NLs::CheckColumns("table2", {"key", "value0", "value1"}, {}, {"key"})});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/table3"),
- {NLs::IsTable,
- NLs::PathVersionEqual(6),
- NLs::CheckColumns("table3", {"key", "value0", "value1"}, {}, {"key"})});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(2),
- NLs::PathsInsideDomain(10),
- NLs::ShardsInsideDomain(6)});
- }
-
- Y_UNIT_TEST(OneTable) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime,
- TTestEnvOptions()
- .EnableAsyncIndexes(true)
- .EnableSchemeTransactionsAtSchemeShard(true));
- ui64 txId = 100;
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
-
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(1),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(1)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::IsTable,
- NLs::PathVersionEqual(3),
- NLs::CheckColumns("Table", {"key", "value"}, {}, {"key"}),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(1)});
-
-
- TestMoveTable(runtime, ++txId, "/MyRoot/Table", "/MyRoot/TableMove");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove"),
- {NLs::IsTable,
- NLs::PathVersionEqual(6),
- NLs::CheckColumns("TableMove", {"key", "value"}, {}, {"key"}),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(1)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(1),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(1)});
-
- TestAlterTable(runtime, ++txId, "/MyRoot",
- R"(Name: "TableMove" Columns { Name: "add" Type: "Utf8" })");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove"),
- {NLs::IsTable,
- NLs::PathVersionEqual(7),
- NLs::CheckColumns("TableMove", {"key", "value", "add"}, {}, {"key"}),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(1)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(1),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(1)});
-
- TestMoveTable(runtime, ++txId, "/MyRoot/TableMove", "/MyRoot/TableMoveTwice");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMoveTwice"),
- {NLs::IsTable,
- NLs::PathVersionEqual(10),
- NLs::CheckColumns("TableMoveTwice", {"key", "value", "add"}, {}, {"key"}),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(1)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(1),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(1)});
-
- TestCopyTable(runtime, ++txId, "/MyRoot", "TableCopy", "/MyRoot/TableMoveTwice");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TableCopy"),
- {NLs::IsTable,
- NLs::PathVersionEqual(3),
- NLs::CheckColumns("TableCopy", {"key", "value", "add"}, {}, {"key"}),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(2)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(2),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(2)});
-
- TestMoveTable(runtime, ++txId, "/MyRoot/TableCopy", "/MyRoot/TableCopyMove");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TableCopyMove"),
- {NLs::IsTable,
- NLs::PathVersionEqual(6),
- NLs::CheckColumns("TableCopyMove", {"key", "value", "add"}, {}, {"key"}),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(2)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(2),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(2)});
-
- TestDropTable(runtime, ++txId, "/MyRoot", "TableCopyMove");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(1),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomainOneOf({1, 2})});
-
- TestDropTable(runtime, ++txId, "/MyRoot", "TableMoveTwice");
- env.TestWaitNotification(runtime, txId);
-
- env.TestWaitTabletDeletion(runtime, {9437194, 9437195});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(0),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(0)});
- }
-
- Y_UNIT_TEST(Index) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime,
- TTestEnvOptions()
- .EnableAsyncIndexes(true)
- .EnableSchemeTransactionsAtSchemeShard(true));
- ui64 txId = 100;
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
- TableDescription {
- Name: "Table"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "Sync"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "Async"
- KeyColumnNames: ["value1"]
- Type: EIndexTypeGlobalAsync
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(1),
- NLs::PathsInsideDomain(5),
- NLs::ShardsInsideDomain(3)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::IsTable,
- NLs::PathVersionEqual(3),
- NLs::CheckColumns("Table", {"key", "value0", "value1", "valueFloat"}, {}, {"key"}),
- NLs::IndexesCount(2)});
-
- TestMoveTable(runtime, ++txId, "/MyRoot/Table", "/MyRoot/TableMove");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove"),
- {NLs::IsTable,
- NLs::PathVersionEqual(6),
- NLs::CheckColumns("TableMove", {"key", "value0", "value1", "valueFloat"}, {}, {"key"})});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(1),
- NLs::PathsInsideDomain(5),
- NLs::ShardsInsideDomain(3)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove/Sync", true, true, true),
- {NLs::PathExist,
- NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
- NLs::IndexKeys({"value0"}),
- NLs::IndexState(NKikimrSchemeOp::EIndexState::EIndexStateReady)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove/Async", true, true, true),
- {NLs::PathExist,
- NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobalAsync),
- NLs::IndexKeys({"value1"}),
- NLs::IndexState(NKikimrSchemeOp::EIndexState::EIndexStateReady)});
- }
-
- Y_UNIT_TEST(AsyncIndexWithSyncInFly) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime,
- TTestEnvOptions()
- .EnableAsyncIndexes(true)
- .EnableSchemeTransactionsAtSchemeShard(true));
- ui64 txId = 100;
-
- TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
- TableDescription {
- Name: "Table"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "indexed" Type: "Uint64" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndex"
- KeyColumnNames: ["indexed"]
- Type: EIndexTypeGlobalAsync
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- using namespace NKikimr::NMiniKQL;
-
- bool NoActiveZone = false;
- TFakeDataReq req1(runtime, ++txId, "/MyRoot/Table",
- R"(
- (
- (let row1 '( '('key (Uint64 '1)) ))
- (let myUpd '( '('indexed (Uint64 '111)) ))
- (let ret (AsList
- (UpdateRow '/MyRoot/Table row1 myUpd)
- ))
- (return ret)
- )
- )");
- IEngineFlat::EStatus status1 = req1.Propose(false, NoActiveZone);
- UNIT_ASSERT_VALUES_EQUAL_C(status1, IEngineFlat::EStatus::Unknown, "This Tx should be accepted and wait for Plan");
- UNIT_ASSERT(req1.GetErrors().empty());
-
- {
- TVector<THolder<IEventHandle>> supressed;
+ TestModificationResult(runtime, txId);
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/table1"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/table2"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(6),
+ NLs::CheckColumns("table2", {"key", "value0", "value1"}, {}, {"key"})});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/table3"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(6),
+ NLs::CheckColumns("table3", {"key", "value0", "value1"}, {}, {"key"})});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(2),
+ NLs::PathsInsideDomain(10),
+ NLs::ShardsInsideDomain(6)});
+ }
+
+ Y_UNIT_TEST(OneTable) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime,
+ TTestEnvOptions()
+ .EnableAsyncIndexes(true)
+ .EnableSchemeTransactionsAtSchemeShard(true));
+ ui64 txId = 100;
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(1),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(1)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(3),
+ NLs::CheckColumns("Table", {"key", "value"}, {}, {"key"}),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(1)});
+
+
+ TestMoveTable(runtime, ++txId, "/MyRoot/Table", "/MyRoot/TableMove");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(6),
+ NLs::CheckColumns("TableMove", {"key", "value"}, {}, {"key"}),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(1)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(1),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(1)});
+
+ TestAlterTable(runtime, ++txId, "/MyRoot",
+ R"(Name: "TableMove" Columns { Name: "add" Type: "Utf8" })");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(7),
+ NLs::CheckColumns("TableMove", {"key", "value", "add"}, {}, {"key"}),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(1)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(1),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(1)});
+
+ TestMoveTable(runtime, ++txId, "/MyRoot/TableMove", "/MyRoot/TableMoveTwice");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMoveTwice"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(10),
+ NLs::CheckColumns("TableMoveTwice", {"key", "value", "add"}, {}, {"key"}),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(1)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(1),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(1)});
+
+ TestCopyTable(runtime, ++txId, "/MyRoot", "TableCopy", "/MyRoot/TableMoveTwice");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TableCopy"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(3),
+ NLs::CheckColumns("TableCopy", {"key", "value", "add"}, {}, {"key"}),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(2)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(2),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(2)});
+
+ TestMoveTable(runtime, ++txId, "/MyRoot/TableCopy", "/MyRoot/TableCopyMove");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TableCopyMove"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(6),
+ NLs::CheckColumns("TableCopyMove", {"key", "value", "add"}, {}, {"key"}),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(2)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(2),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(2)});
+
+ TestDropTable(runtime, ++txId, "/MyRoot", "TableCopyMove");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(1),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomainOneOf({1, 2})});
+
+ TestDropTable(runtime, ++txId, "/MyRoot", "TableMoveTwice");
+ env.TestWaitNotification(runtime, txId);
+
+ env.TestWaitTabletDeletion(runtime, {9437194, 9437195});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(0),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(0)});
+ }
+
+ Y_UNIT_TEST(Index) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime,
+ TTestEnvOptions()
+ .EnableAsyncIndexes(true)
+ .EnableSchemeTransactionsAtSchemeShard(true));
+ ui64 txId = 100;
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
+ TableDescription {
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "Sync"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "Async"
+ KeyColumnNames: ["value1"]
+ Type: EIndexTypeGlobalAsync
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(1),
+ NLs::PathsInsideDomain(5),
+ NLs::ShardsInsideDomain(3)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(3),
+ NLs::CheckColumns("Table", {"key", "value0", "value1", "valueFloat"}, {}, {"key"}),
+ NLs::IndexesCount(2)});
+
+ TestMoveTable(runtime, ++txId, "/MyRoot/Table", "/MyRoot/TableMove");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove"),
+ {NLs::IsTable,
+ NLs::PathVersionEqual(6),
+ NLs::CheckColumns("TableMove", {"key", "value0", "value1", "valueFloat"}, {}, {"key"})});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(1),
+ NLs::PathsInsideDomain(5),
+ NLs::ShardsInsideDomain(3)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove/Sync", true, true, true),
+ {NLs::PathExist,
+ NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
+ NLs::IndexKeys({"value0"}),
+ NLs::IndexState(NKikimrSchemeOp::EIndexState::EIndexStateReady)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove/Async", true, true, true),
+ {NLs::PathExist,
+ NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobalAsync),
+ NLs::IndexKeys({"value1"}),
+ NLs::IndexState(NKikimrSchemeOp::EIndexState::EIndexStateReady)});
+ }
+
+ Y_UNIT_TEST(AsyncIndexWithSyncInFly) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime,
+ TTestEnvOptions()
+ .EnableAsyncIndexes(true)
+ .EnableSchemeTransactionsAtSchemeShard(true));
+ ui64 txId = 100;
+
+ TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
+ TableDescription {
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "indexed" Type: "Uint64" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndex"
+ KeyColumnNames: ["indexed"]
+ Type: EIndexTypeGlobalAsync
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ using namespace NKikimr::NMiniKQL;
+
+ bool NoActiveZone = false;
+ TFakeDataReq req1(runtime, ++txId, "/MyRoot/Table",
+ R"(
+ (
+ (let row1 '( '('key (Uint64 '1)) ))
+ (let myUpd '( '('indexed (Uint64 '111)) ))
+ (let ret (AsList
+ (UpdateRow '/MyRoot/Table row1 myUpd)
+ ))
+ (return ret)
+ )
+ )");
+ IEngineFlat::EStatus status1 = req1.Propose(false, NoActiveZone);
+ UNIT_ASSERT_VALUES_EQUAL_C(status1, IEngineFlat::EStatus::Unknown, "This Tx should be accepted and wait for Plan");
+ UNIT_ASSERT(req1.GetErrors().empty());
+
+ {
+ TVector<THolder<IEventHandle>> supressed;
auto defOberver = SetSuppressObserver(runtime, supressed, NDataShard::TEvChangeExchange::EvApplyRecords);
-
+
req1.Plan(TTestTxConfig::Coordinator);
-
- WaitForSuppressed(runtime, supressed, 1, defOberver);
- UNIT_ASSERT(supressed.size() == 1);
- }
-
- {
- AsyncMoveTable(runtime, ++txId, "/MyRoot/Table", "/MyRoot/TableMove");
-
- TDispatchOptions opts;
+
+ WaitForSuppressed(runtime, supressed, 1, defOberver);
+ UNIT_ASSERT(supressed.size() == 1);
+ }
+
+ {
+ AsyncMoveTable(runtime, ++txId, "/MyRoot/Table", "/MyRoot/TableMove");
+
+ TDispatchOptions opts;
opts.FinalEvents.emplace_back(TDispatchOptions::TFinalEventCondition(NDataShard::TEvChangeExchange::EvStatus, 2));
- runtime.DispatchEvents(opts);
-
- env.TestWaitNotification(runtime, txId);
- }
-
- // Check result
- {
- NKikimrMiniKQL::TResult result;
- TString err;
+ runtime.DispatchEvents(opts);
+
+ env.TestWaitNotification(runtime, txId);
+ }
+
+ // Check result
+ {
+ NKikimrMiniKQL::TResult result;
+ TString err;
ui32 status = LocalMiniKQL(runtime, TTestTxConfig::FakeHiveTablets, R"(
- (
- (let range '( '('indexed (Uint64 '0) (Void) ) '('key (Uint64 '0) (Void) )))
- (let columns '('key 'indexed) )
- (let result (SelectRange '__user__indexImplTable range columns '()))
- (return (AsList (SetResult 'Result result) ))
- )
- )", result, err);
-
- UNIT_ASSERT_VALUES_EQUAL_C(status, NKikimrProto::OK, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
-
- NKqp::CompareYson(R"([[[[[["111"];["1"]]];%false]]])", result);
- }
- }
-}
+ (
+ (let range '( '('indexed (Uint64 '0) (Void) ) '('key (Uint64 '0) (Void) )))
+ (let columns '('key 'indexed) )
+ (let result (SelectRange '__user__indexImplTable range columns '()))
+ (return (AsList (SetResult 'Result result) ))
+ )
+ )", result, err);
+
+ UNIT_ASSERT_VALUES_EQUAL_C(status, NKikimrProto::OK, err);
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
+
+ NKqp::CompareYson(R"([[[[[["111"];["1"]]];%false]]])", result);
+ }
+ }
+}
diff --git a/ydb/core/tx/schemeshard/ut_move/ya.make b/ydb/core/tx/schemeshard/ut_move/ya.make
index 0a126e52604..1f5a9f2de1b 100644
--- a/ydb/core/tx/schemeshard/ut_move/ya.make
+++ b/ydb/core/tx/schemeshard/ut_move/ya.make
@@ -1,35 +1,35 @@
UNITTEST_FOR(ydb/core/tx/schemeshard)
-
+
OWNER(
vvvv
g:kikimr
)
-
-FORK_SUBTESTS()
-IF (WITH_VALGRIND)
- SPLIT_FACTOR(40)
-ENDIF()
+FORK_SUBTESTS()
+
+IF (WITH_VALGRIND)
+ SPLIT_FACTOR(40)
+ENDIF()
-TIMEOUT(600)
+TIMEOUT(600)
-SIZE(MEDIUM)
-
-PEERDIR(
+SIZE(MEDIUM)
+
+PEERDIR(
library/cpp/getopt
- library/cpp/regex/pcre
- library/cpp/svnversion
+ library/cpp/regex/pcre
+ library/cpp/svnversion
ydb/core/kqp/ut/common
ydb/core/testlib
ydb/core/tx
ydb/core/tx/schemeshard/ut_helpers
ydb/library/yql/public/udf/service/exception_policy
-)
-
+)
+
YQL_LAST_ABI_VERSION()
-
-SRCS(
- ut_move.cpp
-)
-
-END()
+
+SRCS(
+ ut_move.cpp
+)
+
+END()
diff --git a/ydb/core/tx/schemeshard/ut_move_reboots.cpp b/ydb/core/tx/schemeshard/ut_move_reboots.cpp
index 0cd29fbdabb..58e9bebd9ba 100644
--- a/ydb/core/tx/schemeshard/ut_move_reboots.cpp
+++ b/ydb/core/tx/schemeshard/ut_move_reboots.cpp
@@ -4,317 +4,317 @@
#include <ydb/core/base/compile_time_flags.h>
#include <ydb/core/kqp/ut/common/kqp_ut_common.h>
#include <ydb/core/tx/datashard/change_exchange.h>
-
-#include <util/generic/size_literals.h>
-#include <util/string/cast.h>
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-using namespace NSchemeShardUT_Private;
-
-Y_UNIT_TEST_SUITE(TSchemeShardMoveRebootsTest) {
- Y_UNIT_TEST(Boot) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- }
- Y_UNIT_TEST(WithData) {
- TTestWithReboots t;
-
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathVersion pathVersion;
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- // Write some data to the user table
- auto fnWriteRow = [&] (ui64 tabletId) {
- TString writeQuery = R"(
- (
- (let key '( '('key (Uint64 '0)) ) )
- (let value '('('value (Utf8 '281474980010683)) ) )
- (return (AsList (UpdateRow '__user__Table key value) ))
- )
- )";
- NKikimrMiniKQL::TResult result;
- TString err;
- NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
- UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
- };
+
+#include <util/generic/size_literals.h>
+#include <util/string/cast.h>
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+using namespace NSchemeShardUT_Private;
+
+Y_UNIT_TEST_SUITE(TSchemeShardMoveRebootsTest) {
+ Y_UNIT_TEST(Boot) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ }
+ Y_UNIT_TEST(WithData) {
+ TTestWithReboots t;
+
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathVersion pathVersion;
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ // Write some data to the user table
+ auto fnWriteRow = [&] (ui64 tabletId) {
+ TString writeQuery = R"(
+ (
+ (let key '( '('key (Uint64 '0)) ) )
+ (let value '('('value (Utf8 '281474980010683)) ) )
+ (return (AsList (UpdateRow '__user__Table key value) ))
+ )
+ )";
+ NKikimrMiniKQL::TResult result;
+ TString err;
+ NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
+ UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
+ };
fnWriteRow(TTestTxConfig::FakeHiveTablets);
-
- pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::ChildrenCount(2),
- NLs::ShardsInsideDomain(1)});
-
- { //wait stats
- TVector<THolder<IEventHandle>> suppressed;
- auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType);
-
- WaitForSuppressed(runtime, suppressed, 1, prevObserver);
- for (auto &msg : suppressed) {
- runtime.Send(msg.Release());
- }
- suppressed.clear();
- }
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::DatabaseSizeIs(624)});
-
- }
-
+
+ pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::ChildrenCount(2),
+ NLs::ShardsInsideDomain(1)});
+
+ { //wait stats
+ TVector<THolder<IEventHandle>> suppressed;
+ auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType);
+
+ WaitForSuppressed(runtime, suppressed, 1, prevObserver);
+ for (auto &msg : suppressed) {
+ runtime.Send(msg.Release());
+ }
+ suppressed.clear();
+ }
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::DatabaseSizeIs(624)});
+
+ }
+
t.TestEnv->ReliablePropose(runtime, MoveTableRequest(++t.TxId, "/MyRoot/Table", "/MyRoot/TableMove", TTestTxConfig::SchemeShard, {pathVersion}),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(2),
- NLs::ShardsInsideDomain(1)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove"),
- {NLs::PathVersionEqual(6),
- NLs::IsTable});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathNotExist});
-
- { //wait stats
- TVector<THolder<IEventHandle>> suppressed;
- auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType);
-
- WaitForSuppressed(runtime, suppressed, 1, prevObserver);
- for (auto &msg : suppressed) {
- runtime.Send(msg.Release());
- }
- suppressed.clear();
- }
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::DatabaseSizeIs(624)});
- }
- });
- }
-
- Y_UNIT_TEST(WithDataAndPersistentPartitionStats) {
- TTestWithReboots t;
- t.GetTestEnvOptions().EnablePersistentPartitionStats(true);
-
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathVersion pathVersion;
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- // Write some data to the user table
- auto fnWriteRow = [&] (ui64 tabletId) {
- TString writeQuery = R"(
- (
- (let key '( '('key (Uint64 '0)) ) )
- (let value '('('value (Utf8 '281474980010683)) ) )
- (return (AsList (UpdateRow '__user__Table key value) ))
- )
- )";
- NKikimrMiniKQL::TResult result;
- TString err;
- NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
- UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
- };
- fnWriteRow(TTestTxConfig::FakeHiveTablets);
-
- pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::ChildrenCount(2),
- NLs::ShardsInsideDomain(1)});
-
- { //wait stats
- TVector<THolder<IEventHandle>> suppressed;
- auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType);
-
- WaitForSuppressed(runtime, suppressed, 1, prevObserver);
- for (auto &msg : suppressed) {
- runtime.Send(msg.Release());
- }
- suppressed.clear();
- }
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::DatabaseSizeIs(624)});
-
- }
-
- t.TestEnv->ReliablePropose(runtime, MoveTableRequest(++t.TxId, "/MyRoot/Table", "/MyRoot/TableMove", TTestTxConfig::SchemeShard, {pathVersion}),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::DatabaseSizeIs(624)});
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(2),
- NLs::ShardsInsideDomain(1)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove"),
- {NLs::PathVersionEqual(6),
- NLs::IsTable});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathNotExist});
-
- { //wait stats
- TVector<THolder<IEventHandle>> suppressed;
- auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType);
-
- WaitForSuppressed(runtime, suppressed, 1, prevObserver);
- for (auto &msg : suppressed) {
- runtime.Send(msg.Release());
- }
- suppressed.clear();
- }
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::DatabaseSizeIs(624)});
- }
- });
- }
-
- Y_UNIT_TEST(Replace) {
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathVersion pathVersion;
- {
- TInactiveZone inactive(activeZone);
- TestCreateIndexedTable(runtime, ++t.TxId, "/MyRoot", R"(
- TableDescription {
- Name: "Table"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "Sync"
- KeyColumnNames: ["value"]
- }
- )");
- TestCreateIndexedTable(runtime, ++t.TxId, "/MyRoot", R"(
- TableDescription {
- Name: "tmp"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "Sync"
- KeyColumnNames: ["value"]
- }
- )");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
-
-
- pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist});
- }
-
- ++t.TxId;
- auto first = DropTableRequest(t.TxId, "/MyRoot", "Table");
- ++pathVersion.Version;
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(2),
+ NLs::ShardsInsideDomain(1)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove"),
+ {NLs::PathVersionEqual(6),
+ NLs::IsTable});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathNotExist});
+
+ { //wait stats
+ TVector<THolder<IEventHandle>> suppressed;
+ auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType);
+
+ WaitForSuppressed(runtime, suppressed, 1, prevObserver);
+ for (auto &msg : suppressed) {
+ runtime.Send(msg.Release());
+ }
+ suppressed.clear();
+ }
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::DatabaseSizeIs(624)});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(WithDataAndPersistentPartitionStats) {
+ TTestWithReboots t;
+ t.GetTestEnvOptions().EnablePersistentPartitionStats(true);
+
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathVersion pathVersion;
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ // Write some data to the user table
+ auto fnWriteRow = [&] (ui64 tabletId) {
+ TString writeQuery = R"(
+ (
+ (let key '( '('key (Uint64 '0)) ) )
+ (let value '('('value (Utf8 '281474980010683)) ) )
+ (return (AsList (UpdateRow '__user__Table key value) ))
+ )
+ )";
+ NKikimrMiniKQL::TResult result;
+ TString err;
+ NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
+ UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
+ };
+ fnWriteRow(TTestTxConfig::FakeHiveTablets);
+
+ pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::ChildrenCount(2),
+ NLs::ShardsInsideDomain(1)});
+
+ { //wait stats
+ TVector<THolder<IEventHandle>> suppressed;
+ auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType);
+
+ WaitForSuppressed(runtime, suppressed, 1, prevObserver);
+ for (auto &msg : suppressed) {
+ runtime.Send(msg.Release());
+ }
+ suppressed.clear();
+ }
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::DatabaseSizeIs(624)});
+
+ }
+
+ t.TestEnv->ReliablePropose(runtime, MoveTableRequest(++t.TxId, "/MyRoot/Table", "/MyRoot/TableMove", TTestTxConfig::SchemeShard, {pathVersion}),
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::DatabaseSizeIs(624)});
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(2),
+ NLs::ShardsInsideDomain(1)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TableMove"),
+ {NLs::PathVersionEqual(6),
+ NLs::IsTable});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathNotExist});
+
+ { //wait stats
+ TVector<THolder<IEventHandle>> suppressed;
+ auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType);
+
+ WaitForSuppressed(runtime, suppressed, 1, prevObserver);
+ for (auto &msg : suppressed) {
+ runtime.Send(msg.Release());
+ }
+ suppressed.clear();
+ }
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::DatabaseSizeIs(624)});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(Replace) {
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathVersion pathVersion;
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateIndexedTable(runtime, ++t.TxId, "/MyRoot", R"(
+ TableDescription {
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "Sync"
+ KeyColumnNames: ["value"]
+ }
+ )");
+ TestCreateIndexedTable(runtime, ++t.TxId, "/MyRoot", R"(
+ TableDescription {
+ Name: "tmp"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "Sync"
+ KeyColumnNames: ["value"]
+ }
+ )");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
+
+
+ pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist});
+ }
+
+ ++t.TxId;
+ auto first = DropTableRequest(t.TxId, "/MyRoot", "Table");
+ ++pathVersion.Version;
auto second = MoveTableRequest(t.TxId, "/MyRoot/tmp", "/MyRoot/Table", TTestTxConfig::SchemeShard, {pathVersion});
- auto combination = CombineSchemeTransactions({first, second});
-
- t.TestEnv->ReliablePropose(runtime, combination,
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(2),
- NLs::ShardsInsideDomainOneOf({1,2,3,4})});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathVersionEqual(6),
- NLs::IsTable});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/tmp"),
- {NLs::PathNotExist});
- }
- });
- }
-
- Y_UNIT_TEST(Chain) {
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathVersion pathVersion;
- {
- TInactiveZone inactive(activeZone);
- TestCreateIndexedTable(runtime, ++t.TxId, "/MyRoot", R"(
- TableDescription {
- Name: "Table"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "Sync"
- KeyColumnNames: ["value"]
- }
- )");
- TestCreateIndexedTable(runtime, ++t.TxId, "/MyRoot", R"(
- TableDescription {
- Name: "tmp"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "Sync"
- KeyColumnNames: ["value"]
- }
- )");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
-
-
- pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist});
- }
-
- ++t.TxId;
+ auto combination = CombineSchemeTransactions({first, second});
+
+ t.TestEnv->ReliablePropose(runtime, combination,
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(2),
+ NLs::ShardsInsideDomainOneOf({1,2,3,4})});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathVersionEqual(6),
+ NLs::IsTable});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/tmp"),
+ {NLs::PathNotExist});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(Chain) {
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathVersion pathVersion;
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateIndexedTable(runtime, ++t.TxId, "/MyRoot", R"(
+ TableDescription {
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "Sync"
+ KeyColumnNames: ["value"]
+ }
+ )");
+ TestCreateIndexedTable(runtime, ++t.TxId, "/MyRoot", R"(
+ TableDescription {
+ Name: "tmp"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "Sync"
+ KeyColumnNames: ["value"]
+ }
+ )");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
+
+
+ pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist});
+ }
+
+ ++t.TxId;
auto first = MoveTableRequest(t.TxId, "/MyRoot/Table", "/MyRoot/backup", TTestTxConfig::SchemeShard, {pathVersion});
auto second = MoveTableRequest(t.TxId, "/MyRoot/tmp", "/MyRoot/Table", TTestTxConfig::SchemeShard);
- auto combination = CombineSchemeTransactions({first, second});
-
- t.TestEnv->ReliablePropose(runtime, combination,
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::ChildrenCount(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/backup"),
- {NLs::PathVersionEqual(6),
- NLs::IsTable});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathVersionEqual(6),
- NLs::IsTable});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/tmp"),
- {NLs::PathNotExist});
- }
- });
- }
-}
-
+ auto combination = CombineSchemeTransactions({first, second});
+
+ t.TestEnv->ReliablePropose(runtime, combination,
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::ChildrenCount(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/backup"),
+ {NLs::PathVersionEqual(6),
+ NLs::IsTable});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathVersionEqual(6),
+ NLs::IsTable});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/tmp"),
+ {NLs::PathNotExist});
+ }
+ });
+ }
+}
+
diff --git a/ydb/core/tx/schemeshard/ut_move_reboots/ya.make b/ydb/core/tx/schemeshard/ut_move_reboots/ya.make
index 3e4fd38d05b..691c49d5dc7 100644
--- a/ydb/core/tx/schemeshard/ut_move_reboots/ya.make
+++ b/ydb/core/tx/schemeshard/ut_move_reboots/ya.make
@@ -1,15 +1,15 @@
-IF (NOT WITH_VALGRIND)
+IF (NOT WITH_VALGRIND)
UNITTEST_FOR(ydb/core/tx/schemeshard)
-
+
OWNER(
vvvv
g:kikimr
)
-
+
FORK_SUBTESTS()
-
+
SPLIT_FACTOR(60)
-
+
IF (SANITIZER_TYPE OR WITH_VALGRIND)
TIMEOUT(3600)
SIZE(LARGE)
@@ -19,7 +19,7 @@ IF (NOT WITH_VALGRIND)
SIZE(LARGE)
TAG(ya:fat)
ENDIF()
-
+
PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
@@ -29,12 +29,12 @@ IF (NOT WITH_VALGRIND)
ydb/core/tx/schemeshard/ut_helpers
ydb/library/yql/public/udf/service/exception_policy
)
-
+
YQL_LAST_ABI_VERSION()
-
+
SRCS(
ut_move_reboots.cpp
)
-
+
END()
-ENDIF()
+ENDIF()
diff --git a/ydb/core/tx/schemeshard/ut_olap.cpp b/ydb/core/tx/schemeshard/ut_olap.cpp
index bedc8d77c97..b3aea0b90f9 100644
--- a/ydb/core/tx/schemeshard/ut_olap.cpp
+++ b/ydb/core/tx/schemeshard/ut_olap.cpp
@@ -1,8 +1,8 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
-using namespace NKikimr::NSchemeShard;
+using namespace NKikimr::NSchemeShard;
using namespace NKikimr;
-using namespace NKikimrSchemeOp;
+using namespace NKikimrSchemeOp;
using namespace NSchemeShardUT_Private;
@@ -121,7 +121,7 @@ Y_UNIT_TEST_SUITE(TOlap) {
KeyColumnNames: "timestamp"
Engine: COLUMN_ENGINE_REPLACING_TIMESERIES
}
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
// Extra column not in schema preset
TestCreateOlapTable(runtime, ++txId, "/MyRoot/OlapStore/MyDir", R"(
@@ -133,7 +133,7 @@ Y_UNIT_TEST_SUITE(TOlap) {
KeyColumnNames: "timestamp"
Engine: COLUMN_ENGINE_REPLACING_TIMESERIES
}
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
// Different column order
TestCreateOlapTable(runtime, ++txId, "/MyRoot/OlapStore/MyDir", R"(
@@ -144,7 +144,7 @@ Y_UNIT_TEST_SUITE(TOlap) {
KeyColumnNames: "timestamp"
Engine: COLUMN_ENGINE_REPLACING_TIMESERIES
}
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
// Extra key column
TestCreateOlapTable(runtime, ++txId, "/MyRoot/OlapStore/MyDir", R"(
@@ -156,7 +156,7 @@ Y_UNIT_TEST_SUITE(TOlap) {
KeyColumnNames: "data"
Engine: COLUMN_ENGINE_REPLACING_TIMESERIES
}
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
// Unknown key column
TestCreateOlapTable(runtime, ++txId, "/MyRoot/OlapStore/MyDir", R"(
@@ -167,7 +167,7 @@ Y_UNIT_TEST_SUITE(TOlap) {
KeyColumnNames: "nottimestamp"
Engine: COLUMN_ENGINE_REPLACING_TIMESERIES
}
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
// Different data column type
TestCreateOlapTable(runtime, ++txId, "/MyRoot/OlapStore/MyDir", R"(
@@ -178,7 +178,7 @@ Y_UNIT_TEST_SUITE(TOlap) {
KeyColumnNames: "timestamp"
Engine: COLUMN_ENGINE_REPLACING_TIMESERIES
}
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
// Repeating preset schema should succeed
TestCreateOlapTable(runtime, ++txId, "/MyRoot/OlapStore/MyDir", R"(
@@ -289,7 +289,7 @@ Y_UNIT_TEST_SUITE(TOlap) {
TestLs(runtime, "/MyRoot/OlapStore/MyDir/OlapTable", false, NLs::PathNotExist);
TestLsPathId(runtime, 4, NLs::PathStringEqual(""));
- TestDropOlapStore(runtime, ++txId, "/MyRoot", "OlapStore", {NKikimrScheme::StatusNameConflict});
+ TestDropOlapStore(runtime, ++txId, "/MyRoot", "OlapStore", {NKikimrScheme::StatusNameConflict});
TestRmDir(runtime, ++txId, "/MyRoot/OlapStore", "MyDir");
env.TestWaitNotification(runtime, txId);
@@ -452,7 +452,7 @@ Y_UNIT_TEST_SUITE(TOlap) {
AddColumns { Name: "comment" Type: "Utf8" }
}
}
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
}
Y_UNIT_TEST(AlterTtl) {
diff --git a/ydb/core/tx/schemeshard/ut_olap_reboots.cpp b/ydb/core/tx/schemeshard/ut_olap_reboots.cpp
index 15c8f5103bf..c7369d4a4e4 100644
--- a/ydb/core/tx/schemeshard/ut_olap_reboots.cpp
+++ b/ydb/core/tx/schemeshard/ut_olap_reboots.cpp
@@ -1,8 +1,8 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
-using namespace NKikimr::NSchemeShard;
+using namespace NKikimr::NSchemeShard;
using namespace NKikimr;
-using namespace NKikimrSchemeOp;
+using namespace NKikimrSchemeOp;
using namespace NSchemeShardUT_Private;
Y_UNIT_TEST_SUITE(TOlapReboots) {
@@ -150,12 +150,12 @@ Y_UNIT_TEST_SUITE(TOlapReboots) {
CreateOlapTableRequest(t.TxId += 2, "/MyRoot/OlapStore", R"(
Name: "OlapTable1"
)"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
t.TestEnv->ReliablePropose(runtime,
CreateOlapTableRequest(t.TxId - 1, "/MyRoot/OlapStore", R"(
Name: "OlapTable2"
)"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
{
@@ -203,10 +203,10 @@ Y_UNIT_TEST_SUITE(TOlapReboots) {
t.TestEnv->ReliablePropose(runtime,
DropOlapTableRequest(t.TxId += 2, "/MyRoot/OlapStore", "OlapTable1"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
t.TestEnv->ReliablePropose(runtime,
DropOlapTableRequest(t.TxId - 1, "/MyRoot/OlapStore", "OlapTable2"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
{
@@ -244,12 +244,12 @@ Y_UNIT_TEST_SUITE(TOlapReboots) {
t.TestEnv->ReliablePropose(runtime,
CreateOlapStoreRequest(++t.TxId, "/MyRoot", olapSchema),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
t.TestEnv->TestWaitNotification(runtime, t.TxId);
t.TestEnv->ReliablePropose(runtime,
DropOlapStoreRequest(++t.TxId, "/MyRoot", "OlapStore"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
t.TestEnv->TestWaitNotification(runtime, t.TxId);
{
@@ -291,12 +291,12 @@ Y_UNIT_TEST_SUITE(TOlapReboots) {
t.TestEnv->ReliablePropose(runtime,
DropOlapTableRequest(++t.TxId, "/MyRoot/OlapStore", "OlapTable"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
t.TestEnv->TestWaitNotification(runtime, t.TxId);
t.TestEnv->ReliablePropose(runtime,
DropOlapStoreRequest(++t.TxId, "/MyRoot", "OlapStore"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
t.TestEnv->TestWaitNotification(runtime, t.TxId);
{
@@ -358,7 +358,7 @@ Y_UNIT_TEST_SUITE(TOlapReboots) {
}
}
)"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
t.TestEnv->TestWaitNotification(runtime, t.TxId);
{
@@ -376,7 +376,7 @@ Y_UNIT_TEST_SUITE(TOlapReboots) {
Disabled {}
}
)"),
- {NKikimrScheme::StatusInvalidParameter, NKikimrScheme::StatusMultipleModifications});
+ {NKikimrScheme::StatusInvalidParameter, NKikimrScheme::StatusMultipleModifications});
t.TestEnv->TestWaitNotification(runtime, t.TxId);
{
diff --git a/ydb/core/tx/schemeshard/ut_pq/ya.make b/ydb/core/tx/schemeshard/ut_pq/ya.make
index 508a4ccd301..fe304ef882b 100644
--- a/ydb/core/tx/schemeshard/ut_pq/ya.make
+++ b/ydb/core/tx/schemeshard/ut_pq/ya.make
@@ -8,7 +8,7 @@ OWNER(
FORK_SUBTESTS()
SPLIT_FACTOR(10)
-
+
IF (SANITIZER_TYPE OR WITH_VALGRIND)
TIMEOUT(3600)
SIZE(LARGE)
@@ -29,7 +29,7 @@ PEERDIR(
)
SRCS(
- ut_pq.cpp
+ ut_pq.cpp
)
END()
diff --git a/ydb/core/tx/schemeshard/ut_pq_reboots.cpp b/ydb/core/tx/schemeshard/ut_pq_reboots.cpp
index bd93bf73e1b..86278552974 100644
--- a/ydb/core/tx/schemeshard/ut_pq_reboots.cpp
+++ b/ydb/core/tx/schemeshard/ut_pq_reboots.cpp
@@ -1,42 +1,42 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-using namespace NSchemeShardUT_Private;
-
-Y_UNIT_TEST_SUITE(TPqGroupTestReboots) {
- using ESts = NKikimrScheme::EStatus;
-
- const TString GroupConfig = "Name: \"Isolda\""
- "TotalGroupCount: 4 "
- "PartitionPerTablet: 2 "
- "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}";
-
- const TString GroupAlter = "Name: \"Isolda\""
- "TotalGroupCount: 5 ";
-
- const TString GroupAlter2 = "Name: \"Isolda\""
- "TotalGroupCount: 8 ";
-
- Y_UNIT_TEST(Create) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TestCreatePQGroup(runtime, ++t.TxId, "/MyRoot/DirA",
- "Name: \"PQGroup_2\""
- "TotalGroupCount: 10 "
- "PartitionPerTablet: 10 "
- "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}"
- );
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup_2"),
- {NLs::Finished,
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+using namespace NSchemeShardUT_Private;
+
+Y_UNIT_TEST_SUITE(TPqGroupTestReboots) {
+ using ESts = NKikimrScheme::EStatus;
+
+ const TString GroupConfig = "Name: \"Isolda\""
+ "TotalGroupCount: 4 "
+ "PartitionPerTablet: 2 "
+ "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}";
+
+ const TString GroupAlter = "Name: \"Isolda\""
+ "TotalGroupCount: 5 ";
+
+ const TString GroupAlter2 = "Name: \"Isolda\""
+ "TotalGroupCount: 8 ";
+
+ Y_UNIT_TEST(Create) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TestCreatePQGroup(runtime, ++t.TxId, "/MyRoot/DirA",
+ "Name: \"PQGroup_2\""
+ "TotalGroupCount: 10 "
+ "PartitionPerTablet: 10 "
+ "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}"
+ );
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup_2"),
+ {NLs::Finished,
NLs::PathVersionEqual(2),
NLs::PQPartitionsInsideDomain(10)});
- }
+ }
TestCreatePQGroup(runtime, ++t.TxId, "/MyRoot/DirA/NotExistingDir",
"Name: \"PQGroup_2\""
@@ -46,30 +46,30 @@ Y_UNIT_TEST_SUITE(TPqGroupTestReboots) {
{ESts::StatusPathDoesNotExist}
);
- });
- }
-
- Y_UNIT_TEST(CreateMultiplePqTablets) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TestCreatePQGroup(runtime, ++t.TxId, "/MyRoot/DirA",
- "Name: \"PQGroup_2\""
- "TotalGroupCount: 2 "
- "PartitionPerTablet: 1 "
- "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}"
- );
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup_2"),
- {NLs::Finished,
+ });
+ }
+
+ Y_UNIT_TEST(CreateMultiplePqTablets) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TestCreatePQGroup(runtime, ++t.TxId, "/MyRoot/DirA",
+ "Name: \"PQGroup_2\""
+ "TotalGroupCount: 2 "
+ "PartitionPerTablet: 1 "
+ "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}"
+ );
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup_2"),
+ {NLs::Finished,
NLs::PathVersionEqual(2),
NLs::PQPartitionsInsideDomain(2)});
- }
- });
- }
-
+ }
+ });
+ }
+
Y_UNIT_TEST(AlterWithProfileChange) {
TTestBasicRuntime runtime;
TTestEnv env(runtime);
@@ -77,7 +77,7 @@ Y_UNIT_TEST_SUITE(TPqGroupTestReboots) {
TPathVersion pqVer;
TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::NoChildren});
+ {NLs::NoChildren});
AsyncMkDir(runtime, ++txId, "/MyRoot", "DirA");
@@ -119,7 +119,7 @@ Y_UNIT_TEST_SUITE(TPqGroupTestReboots) {
"TotalGroupCount: 10 "
"PartitionPerTablet: 10 "
"PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}",
- {NKikimrScheme::StatusAccepted}, {pqVer});
+ {NKikimrScheme::StatusAccepted}, {pqVer});
env.TestWaitNotification(runtime, txId);
@@ -139,287 +139,287 @@ Y_UNIT_TEST_SUITE(TPqGroupTestReboots) {
}
Y_UNIT_TEST(AlterWithReboots) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathVersion pqVer;
- {
- TInactiveZone inactive(activeZone);
- TestCreatePQGroup(runtime, ++t.TxId, "/MyRoot/DirA",
- "Name: \"PQGroup\""
- "TotalGroupCount: 10 "
- "PartitionPerTablet: 10 "
- "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}"
- );
-
- TestAlterPQGroup(runtime, ++t.TxId, "/MyRoot/DirA",
- "Name: \"PQGroup\""
- "TotalGroupCount: 9 "
- "PartitionPerTablet: 10 ",
- {NKikimrScheme::StatusMultipleModifications});
-
- TestAlterPQGroup(runtime, ++t.TxId, "/MyRoot/DirA",
- "Name: \"PQGroup\""
- "TotalGroupCount: 10 "
- "PartitionPerTablet: 9 ",
- {NKikimrScheme::StatusMultipleModifications});
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-2, t.TxId-1, t.TxId});
-
- pqVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup", true),
- {NLs::Finished,
- NLs::CheckPartCount("PQGroup", 10, 10, 1, 10),
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathVersion pqVer;
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreatePQGroup(runtime, ++t.TxId, "/MyRoot/DirA",
+ "Name: \"PQGroup\""
+ "TotalGroupCount: 10 "
+ "PartitionPerTablet: 10 "
+ "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}"
+ );
+
+ TestAlterPQGroup(runtime, ++t.TxId, "/MyRoot/DirA",
+ "Name: \"PQGroup\""
+ "TotalGroupCount: 9 "
+ "PartitionPerTablet: 10 ",
+ {NKikimrScheme::StatusMultipleModifications});
+
+ TestAlterPQGroup(runtime, ++t.TxId, "/MyRoot/DirA",
+ "Name: \"PQGroup\""
+ "TotalGroupCount: 10 "
+ "PartitionPerTablet: 9 ",
+ {NKikimrScheme::StatusMultipleModifications});
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-2, t.TxId-1, t.TxId});
+
+ pqVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup", true),
+ {NLs::Finished,
+ NLs::CheckPartCount("PQGroup", 10, 10, 1, 10),
NLs::PQPartitionsInsideDomain(10),
- NLs::PathVersionEqual(2)});
- }
-
- TestAlterPQGroup(runtime, ++t.TxId, "/MyRoot/DirA",
- "Name: \"PQGroup\""
- "TotalGroupCount: 11 "
- "PartitionPerTablet: 11 "
- "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}",
- {NKikimrScheme::StatusAccepted}, {pqVer});
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestAlterPQGroup(runtime, ++t.TxId, "/MyRoot/DirA",
- "Name: \"PQGroup\""
- "TotalGroupCount: 12 "
- "PartitionPerTablet: 12 "
- "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}",
- {NKikimrScheme::StatusPreconditionFailed}, {pqVer});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup", true),
- {NLs::Finished,
- NLs::CheckPartCount("PQGroup", 11, 11, 1, 11),
+ NLs::PathVersionEqual(2)});
+ }
+
+ TestAlterPQGroup(runtime, ++t.TxId, "/MyRoot/DirA",
+ "Name: \"PQGroup\""
+ "TotalGroupCount: 11 "
+ "PartitionPerTablet: 11 "
+ "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}",
+ {NKikimrScheme::StatusAccepted}, {pqVer});
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestAlterPQGroup(runtime, ++t.TxId, "/MyRoot/DirA",
+ "Name: \"PQGroup\""
+ "TotalGroupCount: 12 "
+ "PartitionPerTablet: 12 "
+ "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}",
+ {NKikimrScheme::StatusPreconditionFailed}, {pqVer});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup", true),
+ {NLs::Finished,
+ NLs::CheckPartCount("PQGroup", 11, 11, 1, 11),
NLs::PathVersionEqual(3),
NLs::PQPartitionsInsideDomain(11)});
- }
- });
- }
-
- Y_UNIT_TEST(CreateAlter) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- t.RestoreLogging();
-
- AsyncCreatePQGroup(runtime, t.TxId++, "/MyRoot/DirA",
- "Name: \"PQGroup_2\""
- "TotalGroupCount: 2 "
- "PartitionPerTablet: 10 "
- "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}"
- );
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup_2"),
- {NLs::Finished,
+ }
+ });
+ }
+
+ Y_UNIT_TEST(CreateAlter) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ t.RestoreLogging();
+
+ AsyncCreatePQGroup(runtime, t.TxId++, "/MyRoot/DirA",
+ "Name: \"PQGroup_2\""
+ "TotalGroupCount: 2 "
+ "PartitionPerTablet: 10 "
+ "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}"
+ );
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup_2"),
+ {NLs::Finished,
NLs::PathVersionEqual(2),
NLs::PQPartitionsInsideDomain(2)});
-
- AsyncAlterPQGroup(runtime, t.TxId++, "/MyRoot/DirA",
- "Name: \"PQGroup_2\""
- "TotalGroupCount: 8 "
- "PartitionPerTablet: 10 ");
-
- TestLs(runtime, "/MyRoot/DirA/PQGroup_2");
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup_2"),
- {NLs::Finished,
+
+ AsyncAlterPQGroup(runtime, t.TxId++, "/MyRoot/DirA",
+ "Name: \"PQGroup_2\""
+ "TotalGroupCount: 8 "
+ "PartitionPerTablet: 10 ");
+
+ TestLs(runtime, "/MyRoot/DirA/PQGroup_2");
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup_2"),
+ {NLs::Finished,
NLs::PathVersionEqual(3),
NLs::PQPartitionsInsideDomain(8)});
-
- AsyncAlterPQGroup(runtime, t.TxId++, "/MyRoot/DirA",
- "Name: \"PQGroup_2\""
- "TotalGroupCount: 20 "
- "PartitionPerTablet: 12 ");
-
- TestLs(runtime, "/MyRoot/DirA/PQGroup_2");
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup_2"),
- {NLs::Finished,
+
+ AsyncAlterPQGroup(runtime, t.TxId++, "/MyRoot/DirA",
+ "Name: \"PQGroup_2\""
+ "TotalGroupCount: 20 "
+ "PartitionPerTablet: 12 ");
+
+ TestLs(runtime, "/MyRoot/DirA/PQGroup_2");
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/PQGroup_2"),
+ {NLs::Finished,
NLs::PathVersionEqual(4),
NLs::PQPartitionsInsideDomain(20)});
-
- activeZone = false;
- });
- }
-
- Y_UNIT_TEST(CreateDrop) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& /*activeZone*/) {
- t.RestoreLogging();
-
- TestCreatePQGroup(runtime, t.TxId++, "/MyRoot/DirA", GroupConfig);
- auto status = TestDropPQGroup(runtime, t.TxId++, "/MyRoot/DirA", "Isolda", {ESts::StatusMultipleModifications, ESts::StatusAccepted});
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId-2});
-
- if (status == ESts::StatusAccepted) {
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Isolda"),
- {NLs::PathNotExist});
- } else {
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Isolda"),
- {NLs::Finished,
- NLs::PathVersionEqual(2)});
- }
-
- TestDropPQGroup(runtime, t.TxId++, "/MyRoot/DirA", "Isolda", {ESts::StatusAccepted, ESts::StatusPathDoesNotExist});
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
-
+
+ activeZone = false;
+ });
+ }
+
+ Y_UNIT_TEST(CreateDrop) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& /*activeZone*/) {
+ t.RestoreLogging();
+
+ TestCreatePQGroup(runtime, t.TxId++, "/MyRoot/DirA", GroupConfig);
+ auto status = TestDropPQGroup(runtime, t.TxId++, "/MyRoot/DirA", "Isolda", {ESts::StatusMultipleModifications, ESts::StatusAccepted});
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId-2});
+
+ if (status == ESts::StatusAccepted) {
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Isolda"),
+ {NLs::PathNotExist});
+ } else {
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/Isolda"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(2)});
+ }
+
+ TestDropPQGroup(runtime, t.TxId++, "/MyRoot/DirA", "Isolda", {ESts::StatusAccepted, ESts::StatusPathDoesNotExist});
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+
t.TestEnv->TestWaitTabletDeletion(runtime, {TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 1, TTestTxConfig::FakeHiveTablets + 2});
-
- TestLs(runtime, "/MyRoot/DirA/Isolda", true, NLs::PathNotExist);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathExist,
- NLs::PathVersionEqual(7),
- NLs::ChildrenCount(0),
- NLs::PathsInsideDomain(1),
+
+ TestLs(runtime, "/MyRoot/DirA/Isolda", true, NLs::PathNotExist);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(7),
+ NLs::ChildrenCount(0),
+ NLs::PathsInsideDomain(1),
NLs::ShardsInsideDomainOneOf({0, 1, 2, 3}),
NLs::PQPartitionsInsideDomain(0)});
- });
- }
-
- Y_UNIT_TEST(CreateDropAbort) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& /*activeZone*/) {
- t.RestoreLogging();
- ui64& txId = t.TxId;
-
- TestCreatePQGroup(runtime, txId++, "/MyRoot", GroupConfig);
- TestForceDropUnsafe(runtime, txId++, 3);
- t.TestEnv->TestWaitNotification(runtime, {txId-2, txId-1});
-
+ });
+ }
+
+ Y_UNIT_TEST(CreateDropAbort) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& /*activeZone*/) {
+ t.RestoreLogging();
+ ui64& txId = t.TxId;
+
+ TestCreatePQGroup(runtime, txId++, "/MyRoot", GroupConfig);
+ TestForceDropUnsafe(runtime, txId++, 3);
+ t.TestEnv->TestWaitNotification(runtime, {txId-2, txId-1});
+
t.TestEnv->TestWaitTabletDeletion(runtime, {TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 1, TTestTxConfig::FakeHiveTablets + 2});
-
- TestLs(runtime, "/MyRoot/Isolda", true, NLs::PathNotExist);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::ChildrenCount(1),
- NLs::PathsInsideDomain(1),
+
+ TestLs(runtime, "/MyRoot/Isolda", true, NLs::PathNotExist);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::ChildrenCount(1),
+ NLs::PathsInsideDomain(1),
NLs::ShardsInsideDomainOneOf({0, 1, 2, 3}),
});
- });
- }
-
- //RUN: Reboot tablet 9437195 (#44)
- //VERIFY failed:
+ });
+ }
+
+ //RUN: Reboot tablet 9437195 (#44)
+ //VERIFY failed:
//ydb/core/blobstorage/dsproxy/mock/dsproxy_mock.cpp:289
- //Handle(): requirement std::make_pair(msg->CollectGeneration, msg->CollectStep) >= barrier.MakeCollectPair() failed
- /*Y_UNIT_TEST(CreateAlterAlterDrop) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- t.RestoreLogging();
- ui64& txId = t.TxId;
-
- TestCreatePQGroup(runtime, txId++, "/MyRoot", GroupConfig);
- t.TestEnv->TestWaitNotification(runtime, txId-1);
- TestLs(runtime, "/MyRoot/Isolda", true, NLs::PathExist);
-
- TestAlterPQGroup(runtime, txId++, "/MyRoot", GroupAlter);
- t.TestEnv->TestWaitNotification(runtime, txId-1);
- TestLs(runtime, "/MyRoot/Isolda", true, NLs::PathExist);
-
- TestAlterPQGroup(runtime, txId++, "/MyRoot", GroupAlter2);
- t.TestEnv->TestWaitNotification(runtime, txId-1);
- TestLs(runtime, "/MyRoot/Isolda", true, NLs::CheckPartCount("Isolda", 8, 2, 4, 8));
-
- TestDropPQGroup(runtime, txId++, "/MyRoot", "Isolda", {ESts::StatusAccepted}, NKikimrSchemeOp::EDropWaitChanges);
- t.TestEnv->TestWaitNotification(runtime, txId-1);
-
- activeZone = false;
- TestLs(runtime, "/MyRoot/Isolda", true, NLs::PathNotExist);
- });
- }*/
-
-
- Y_UNIT_TEST(CreateAlterDropPqGroupWithReboots) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& /*activeZone*/) {
- using ESts = NKikimrScheme::EStatus;
-
- t.RestoreLogging();
-
- TString pqGroupConfig = "Name: \"Isolda\""
- "TotalGroupCount: 4 "
- "PartitionPerTablet: 2 "
- "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}";
-
- TString pqGroupAlter = "Name: \"Isolda\""
- "TotalGroupCount: 5 ";
-
- TString pqGroupAlter2 = "Name: \"Isolda\""
- "TotalGroupCount: 8 ";
-
- TAutoPtr<IEventHandle> handle;
- ui64& txId = t.TxId;
-
- // Create, Alter, Alter
- TestCreatePQGroup(runtime, txId++, "/MyRoot", pqGroupConfig);
- t.TestEnv->TestWaitNotification(runtime, txId-1);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Isolda"),
- {NLs::PathExist,
- NLs::Finished,
+ //Handle(): requirement std::make_pair(msg->CollectGeneration, msg->CollectStep) >= barrier.MakeCollectPair() failed
+ /*Y_UNIT_TEST(CreateAlterAlterDrop) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ t.RestoreLogging();
+ ui64& txId = t.TxId;
+
+ TestCreatePQGroup(runtime, txId++, "/MyRoot", GroupConfig);
+ t.TestEnv->TestWaitNotification(runtime, txId-1);
+ TestLs(runtime, "/MyRoot/Isolda", true, NLs::PathExist);
+
+ TestAlterPQGroup(runtime, txId++, "/MyRoot", GroupAlter);
+ t.TestEnv->TestWaitNotification(runtime, txId-1);
+ TestLs(runtime, "/MyRoot/Isolda", true, NLs::PathExist);
+
+ TestAlterPQGroup(runtime, txId++, "/MyRoot", GroupAlter2);
+ t.TestEnv->TestWaitNotification(runtime, txId-1);
+ TestLs(runtime, "/MyRoot/Isolda", true, NLs::CheckPartCount("Isolda", 8, 2, 4, 8));
+
+ TestDropPQGroup(runtime, txId++, "/MyRoot", "Isolda", {ESts::StatusAccepted}, NKikimrSchemeOp::EDropWaitChanges);
+ t.TestEnv->TestWaitNotification(runtime, txId-1);
+
+ activeZone = false;
+ TestLs(runtime, "/MyRoot/Isolda", true, NLs::PathNotExist);
+ });
+ }*/
+
+
+ Y_UNIT_TEST(CreateAlterDropPqGroupWithReboots) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& /*activeZone*/) {
+ using ESts = NKikimrScheme::EStatus;
+
+ t.RestoreLogging();
+
+ TString pqGroupConfig = "Name: \"Isolda\""
+ "TotalGroupCount: 4 "
+ "PartitionPerTablet: 2 "
+ "PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}";
+
+ TString pqGroupAlter = "Name: \"Isolda\""
+ "TotalGroupCount: 5 ";
+
+ TString pqGroupAlter2 = "Name: \"Isolda\""
+ "TotalGroupCount: 8 ";
+
+ TAutoPtr<IEventHandle> handle;
+ ui64& txId = t.TxId;
+
+ // Create, Alter, Alter
+ TestCreatePQGroup(runtime, txId++, "/MyRoot", pqGroupConfig);
+ t.TestEnv->TestWaitNotification(runtime, txId-1);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Isolda"),
+ {NLs::PathExist,
+ NLs::Finished,
NLs::PathVersionEqual(2),
NLs::PQPartitionsInsideDomain(4)});
-
- TestAlterPQGroup(runtime, txId++, "/MyRoot", pqGroupAlter);
- t.TestEnv->TestWaitNotification(runtime, txId-1);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Isolda"),
- {NLs::PathExist,
- NLs::Finished,
+
+ TestAlterPQGroup(runtime, txId++, "/MyRoot", pqGroupAlter);
+ t.TestEnv->TestWaitNotification(runtime, txId-1);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Isolda"),
+ {NLs::PathExist,
+ NLs::Finished,
NLs::PathVersionEqual(3),
NLs::PQPartitionsInsideDomain(5)});
-
- TestAlterPQGroup(runtime, txId++, "/MyRoot", pqGroupAlter2);
- t.TestEnv->TestWaitNotification(runtime, txId-1);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Isolda", true),
- {NLs::PathExist,
- NLs::Finished,
- NLs::PathVersionEqual(4),
+
+ TestAlterPQGroup(runtime, txId++, "/MyRoot", pqGroupAlter2);
+ t.TestEnv->TestWaitNotification(runtime, txId-1);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Isolda", true),
+ {NLs::PathExist,
+ NLs::Finished,
+ NLs::PathVersionEqual(4),
NLs::CheckPartCount("Isolda", 8, 2, 4, 8),
NLs::PQPartitionsInsideDomain(8)});
-
- TestDropPQGroup(runtime, txId++, "/MyRoot", "Isolda", {ESts::StatusAccepted});
- t.TestEnv->TestWaitNotification(runtime, txId-1);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Isolda"),
- {NLs::PathNotExist});
+
+ TestDropPQGroup(runtime, txId++, "/MyRoot", "Isolda", {ESts::StatusAccepted});
+ t.TestEnv->TestWaitNotification(runtime, txId-1);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Isolda"),
+ {NLs::PathNotExist});
TestDescribeResult(DescribePath(runtime, "/MyRoot", true),
{NLs::PathExist,
NLs::PQPartitionsInsideDomain(0)});
- }, true);
- }
-
- Y_UNIT_TEST(CreateWithIntermediateDirs) {
- const TString validScheme = R"(
- Name: "Valid/x/y/z"
- TotalGroupCount: 10
- PartitionPerTablet: 10
- PQTabletConfig: { PartitionConfig { LifetimeSeconds : 10 } }
- )";
- const TString invalidScheme = R"(
- Name: "Invalid/wr0ng n@me"
- )";
- const auto validStatus = NKikimrScheme::StatusAccepted;
- const auto invalidStatus = NKikimrScheme::StatusSchemeError;
-
- CreateWithIntermediateDirs([&](TTestActorRuntime& runtime, ui64 txId, const TString& root, bool valid) {
- TestCreatePQGroup(runtime, txId, root, valid ? validScheme : invalidScheme, {valid ? validStatus : invalidStatus});
- });
- }
-
- Y_UNIT_TEST(CreateWithIntermediateDirsForceDrop) {
- CreateWithIntermediateDirsForceDrop([](TTestActorRuntime& runtime, ui64 txId, const TString& root) {
- AsyncCreatePQGroup(runtime, txId, root, R"(
- Name: "x/y/z"
- TotalGroupCount: 10
- PartitionPerTablet: 10
- PQTabletConfig: { PartitionConfig { LifetimeSeconds : 10 } }
- )");
- });
- }
-}
+ }, true);
+ }
+
+ Y_UNIT_TEST(CreateWithIntermediateDirs) {
+ const TString validScheme = R"(
+ Name: "Valid/x/y/z"
+ TotalGroupCount: 10
+ PartitionPerTablet: 10
+ PQTabletConfig: { PartitionConfig { LifetimeSeconds : 10 } }
+ )";
+ const TString invalidScheme = R"(
+ Name: "Invalid/wr0ng n@me"
+ )";
+ const auto validStatus = NKikimrScheme::StatusAccepted;
+ const auto invalidStatus = NKikimrScheme::StatusSchemeError;
+
+ CreateWithIntermediateDirs([&](TTestActorRuntime& runtime, ui64 txId, const TString& root, bool valid) {
+ TestCreatePQGroup(runtime, txId, root, valid ? validScheme : invalidScheme, {valid ? validStatus : invalidStatus});
+ });
+ }
+
+ Y_UNIT_TEST(CreateWithIntermediateDirsForceDrop) {
+ CreateWithIntermediateDirsForceDrop([](TTestActorRuntime& runtime, ui64 txId, const TString& root) {
+ AsyncCreatePQGroup(runtime, txId, root, R"(
+ Name: "x/y/z"
+ TotalGroupCount: 10
+ PartitionPerTablet: 10
+ PQTabletConfig: { PartitionConfig { LifetimeSeconds : 10 } }
+ )");
+ });
+ }
+}
diff --git a/ydb/core/tx/schemeshard/ut_pq_reboots/ya.make b/ydb/core/tx/schemeshard/ut_pq_reboots/ya.make
index f14979ce4c7..a223f86717c 100644
--- a/ydb/core/tx/schemeshard/ut_pq_reboots/ya.make
+++ b/ydb/core/tx/schemeshard/ut_pq_reboots/ya.make
@@ -1,15 +1,15 @@
IF (NOT WITH_VALGRIND)
UNITTEST_FOR(ydb/core/tx/schemeshard)
-
+
OWNER(
vvvv
g:kikimr
)
-
+
FORK_SUBTESTS()
-
+
SPLIT_FACTOR(60)
-
+
IF (SANITIZER_TYPE OR WITH_VALGRIND)
TIMEOUT(3600)
SIZE(LARGE)
@@ -19,7 +19,7 @@ IF (NOT WITH_VALGRIND)
SIZE(LARGE)
TAG(ya:fat)
ENDIF()
-
+
PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
diff --git a/ydb/core/tx/schemeshard/ut_reboots.cpp b/ydb/core/tx/schemeshard/ut_reboots.cpp
index da576e2e632..dce2c127122 100644
--- a/ydb/core/tx/schemeshard/ut_reboots.cpp
+++ b/ydb/core/tx/schemeshard/ut_reboots.cpp
@@ -3,569 +3,569 @@
#include <ydb/core/tx/datashard/datashard.h>
#include <ydb/core/protos/flat_scheme_op.pb.h>
-
+
#include <google/protobuf/text_format.h>
-
+
using namespace NKikimr;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NSchemeShardUT_Private;
-Y_UNIT_TEST_SUITE(IntermediateDirsReboots) {
- Y_UNIT_TEST(Fake) {
- }
- Y_UNIT_TEST(CreateDirWithIntermediateDirs) {
- const TString validScheme = "Valid/x/y/z";
- const TString invalidScheme = "Invalid/wr0ng n@me";
- const auto validStatus = NKikimrScheme::StatusAccepted;
- const auto invalidStatus = NKikimrScheme::StatusSchemeError;
-
- CreateWithIntermediateDirs([&](TTestActorRuntime& runtime, ui64 txId, const TString& root, bool valid) {
- TestMkDir(runtime, txId, root, valid ? validScheme : invalidScheme, {valid ? validStatus : invalidStatus});
- });
- }
-
- Y_UNIT_TEST(CreateTableWithIntermediateDirs) {
- const TString validScheme = R"(
- Name: "Valid/x/y/z"
- Columns { Name: "RowId" Type: "Uint64" }
- KeyColumnNames: ["RowId"]
- )";
- const TString invalidScheme = R"(
- Name: "Invalid/wr0ng n@me"
- Columns { Name: "RowId" Type: "Uint64" }
- KeyColumnNames: ["WrongRowId"]
- )";
- const auto validStatus = NKikimrScheme::StatusAccepted;
- const auto invalidStatus = NKikimrScheme::StatusSchemeError;
-
- CreateWithIntermediateDirs([&](TTestActorRuntime& runtime, ui64 txId, const TString& root, bool valid) {
- TestCreateTable(runtime, txId, root, valid ? validScheme : invalidScheme, {valid ? validStatus : invalidStatus});
- });
- }
-
- Y_UNIT_TEST(CreateKesusWithIntermediateDirs) {
- const TString validScheme = R"(
- Name: "Valid/x/y/z"
- )";
- const TString invalidScheme = R"(
- Name: "Invalid/wr0ng n@me"
- )";
- const auto validStatus = NKikimrScheme::StatusAccepted;
- const auto invalidStatus = NKikimrScheme::StatusSchemeError;
-
- CreateWithIntermediateDirs([&](TTestActorRuntime& runtime, ui64 txId, const TString& root, bool valid) {
- TestCreateKesus(runtime, txId, root, valid ? validScheme : invalidScheme, {valid ? validStatus : invalidStatus});
- });
- }
-
- Y_UNIT_TEST(CreateSolomonWithIntermediateDirs) {
- const TString validScheme = R"(
- Name: "Valid/x/y/z"
- PartitionCount: 2
- )";
- const TString invalidScheme = R"(
- Name: "Invalid/wr0ng n@me"
- )";
- const auto validStatus = NKikimrScheme::StatusAccepted;
- const auto invalidStatus = NKikimrScheme::StatusSchemeError;
-
- CreateWithIntermediateDirs([&](TTestActorRuntime& runtime, ui64 txId, const TString& root, bool valid) {
- TestCreateSolomon(runtime, txId, root, valid ? validScheme : invalidScheme, {valid ? validStatus : invalidStatus});
+Y_UNIT_TEST_SUITE(IntermediateDirsReboots) {
+ Y_UNIT_TEST(Fake) {
+ }
+ Y_UNIT_TEST(CreateDirWithIntermediateDirs) {
+ const TString validScheme = "Valid/x/y/z";
+ const TString invalidScheme = "Invalid/wr0ng n@me";
+ const auto validStatus = NKikimrScheme::StatusAccepted;
+ const auto invalidStatus = NKikimrScheme::StatusSchemeError;
+
+ CreateWithIntermediateDirs([&](TTestActorRuntime& runtime, ui64 txId, const TString& root, bool valid) {
+ TestMkDir(runtime, txId, root, valid ? validScheme : invalidScheme, {valid ? validStatus : invalidStatus});
+ });
+ }
+
+ Y_UNIT_TEST(CreateTableWithIntermediateDirs) {
+ const TString validScheme = R"(
+ Name: "Valid/x/y/z"
+ Columns { Name: "RowId" Type: "Uint64" }
+ KeyColumnNames: ["RowId"]
+ )";
+ const TString invalidScheme = R"(
+ Name: "Invalid/wr0ng n@me"
+ Columns { Name: "RowId" Type: "Uint64" }
+ KeyColumnNames: ["WrongRowId"]
+ )";
+ const auto validStatus = NKikimrScheme::StatusAccepted;
+ const auto invalidStatus = NKikimrScheme::StatusSchemeError;
+
+ CreateWithIntermediateDirs([&](TTestActorRuntime& runtime, ui64 txId, const TString& root, bool valid) {
+ TestCreateTable(runtime, txId, root, valid ? validScheme : invalidScheme, {valid ? validStatus : invalidStatus});
+ });
+ }
+
+ Y_UNIT_TEST(CreateKesusWithIntermediateDirs) {
+ const TString validScheme = R"(
+ Name: "Valid/x/y/z"
+ )";
+ const TString invalidScheme = R"(
+ Name: "Invalid/wr0ng n@me"
+ )";
+ const auto validStatus = NKikimrScheme::StatusAccepted;
+ const auto invalidStatus = NKikimrScheme::StatusSchemeError;
+
+ CreateWithIntermediateDirs([&](TTestActorRuntime& runtime, ui64 txId, const TString& root, bool valid) {
+ TestCreateKesus(runtime, txId, root, valid ? validScheme : invalidScheme, {valid ? validStatus : invalidStatus});
+ });
+ }
+
+ Y_UNIT_TEST(CreateSolomonWithIntermediateDirs) {
+ const TString validScheme = R"(
+ Name: "Valid/x/y/z"
+ PartitionCount: 2
+ )";
+ const TString invalidScheme = R"(
+ Name: "Invalid/wr0ng n@me"
+ )";
+ const auto validStatus = NKikimrScheme::StatusAccepted;
+ const auto invalidStatus = NKikimrScheme::StatusSchemeError;
+
+ CreateWithIntermediateDirs([&](TTestActorRuntime& runtime, ui64 txId, const TString& root, bool valid) {
+ TestCreateSolomon(runtime, txId, root, valid ? validScheme : invalidScheme, {valid ? validStatus : invalidStatus});
});
}
- Y_UNIT_TEST(CreateDirWithIntermediateDirsForceDrop) {
- CreateWithIntermediateDirsForceDrop([](TTestActorRuntime& runtime, ui64 txId, const TString& root) {
- AsyncMkDir(runtime, txId, root, "x/y/z");
+ Y_UNIT_TEST(CreateDirWithIntermediateDirsForceDrop) {
+ CreateWithIntermediateDirsForceDrop([](TTestActorRuntime& runtime, ui64 txId, const TString& root) {
+ AsyncMkDir(runtime, txId, root, "x/y/z");
});
}
- Y_UNIT_TEST(CreateTableWithIntermediateDirsForceDrop) {
- CreateWithIntermediateDirsForceDrop([](TTestActorRuntime& runtime, ui64 txId, const TString& root) {
- AsyncCreateTable(runtime, txId, root, R"(
- Name: "x/y/z"
- Columns { Name: "RowId" Type: "Uint64" }
- KeyColumnNames: ["RowId"]
- )");
+ Y_UNIT_TEST(CreateTableWithIntermediateDirsForceDrop) {
+ CreateWithIntermediateDirsForceDrop([](TTestActorRuntime& runtime, ui64 txId, const TString& root) {
+ AsyncCreateTable(runtime, txId, root, R"(
+ Name: "x/y/z"
+ Columns { Name: "RowId" Type: "Uint64" }
+ KeyColumnNames: ["RowId"]
+ )");
});
}
- Y_UNIT_TEST(CreateKesusWithIntermediateDirsForceDrop) {
- CreateWithIntermediateDirsForceDrop([](TTestActorRuntime& runtime, ui64 txId, const TString& root) {
- AsyncCreateKesus(runtime, txId, root, R"(
- Name: "x/y/z"
- )");
+ Y_UNIT_TEST(CreateKesusWithIntermediateDirsForceDrop) {
+ CreateWithIntermediateDirsForceDrop([](TTestActorRuntime& runtime, ui64 txId, const TString& root) {
+ AsyncCreateKesus(runtime, txId, root, R"(
+ Name: "x/y/z"
+ )");
});
}
- Y_UNIT_TEST(CreateSolomonWithIntermediateDirsForceDrop) {
- CreateWithIntermediateDirsForceDrop([](TTestActorRuntime& runtime, ui64 txId, const TString& root) {
- AsyncCreateSolomon(runtime, txId, root, R"(
- Name: "x/y/z"
- PartitionCount: 2
- )");
+ Y_UNIT_TEST(CreateSolomonWithIntermediateDirsForceDrop) {
+ CreateWithIntermediateDirsForceDrop([](TTestActorRuntime& runtime, ui64 txId, const TString& root) {
+ AsyncCreateSolomon(runtime, txId, root, R"(
+ Name: "x/y/z"
+ PartitionCount: 2
+ )");
});
}
- Y_UNIT_TEST(CreateDirWithIntermediateDirsForceDropMiddle) {
+ Y_UNIT_TEST(CreateDirWithIntermediateDirsForceDropMiddle) {
TTestWithReboots t;
t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- AsyncMkDir(runtime, ++t.TxId, "/MyRoot", "x/y/z");
+ AsyncMkDir(runtime, ++t.TxId, "/MyRoot", "x/y/z");
TestForceDropUnsafe(runtime, ++t.TxId, 4, TVector<NKikimrScheme::EStatus>{NKikimrScheme::StatusMultipleModifications});
- t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/x/y/z"),
+ {NLs::PathExist});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(CreateSubDomainWithIntermediateDirs) {
+ const TString validScheme = R"(
+ Name: "Valid/x/y/z"
+ PlanResolution: 50
+ Coordinators: 1
+ Mediators: 1
+ TimeCastBucketsPerMediator: 2
+ )";
+ const TString invalidScheme = R"(
+ Name: "Invalid/wr0ng n@me"
+ )";
+ const auto validStatus = NKikimrScheme::StatusAccepted;
+ const auto invalidStatus = NKikimrScheme::StatusSchemeError;
+
+ CreateWithIntermediateDirs([&](TTestActorRuntime& runtime, ui64 txId, const TString& root, bool valid) {
+ TestCreateSubDomain(runtime, txId, root, valid ? validScheme : invalidScheme, {valid ? validStatus : invalidStatus});
+ });
+ }
+
+ Y_UNIT_TEST(CreateWithIntermediateDirs) {
+ const TString validScheme = R"(
+ Name: "Valid/x/y/z"
+ PartitionsCount: 0
+ )";
+ const TString invalidScheme = R"(
+ Name: "Invalid/wr0ng n@me"
+ )";
+ const auto validStatus = NKikimrScheme::StatusAccepted;
+ const auto invalidStatus = NKikimrScheme::StatusSchemeError;
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/x/y/z"),
- {NLs::PathExist});
- }
+ CreateWithIntermediateDirs([&](TTestActorRuntime& runtime, ui64 txId, const TString& root, bool valid) {
+ TestCreateRtmrVolume(runtime, txId, root, valid ? validScheme : invalidScheme, {valid ? validStatus : invalidStatus});
});
}
- Y_UNIT_TEST(CreateSubDomainWithIntermediateDirs) {
- const TString validScheme = R"(
- Name: "Valid/x/y/z"
- PlanResolution: 50
- Coordinators: 1
- Mediators: 1
- TimeCastBucketsPerMediator: 2
- )";
- const TString invalidScheme = R"(
- Name: "Invalid/wr0ng n@me"
- )";
- const auto validStatus = NKikimrScheme::StatusAccepted;
- const auto invalidStatus = NKikimrScheme::StatusSchemeError;
-
- CreateWithIntermediateDirs([&](TTestActorRuntime& runtime, ui64 txId, const TString& root, bool valid) {
- TestCreateSubDomain(runtime, txId, root, valid ? validScheme : invalidScheme, {valid ? validStatus : invalidStatus});
- });
- }
-
- Y_UNIT_TEST(CreateWithIntermediateDirs) {
- const TString validScheme = R"(
- Name: "Valid/x/y/z"
- PartitionsCount: 0
- )";
- const TString invalidScheme = R"(
- Name: "Invalid/wr0ng n@me"
- )";
- const auto validStatus = NKikimrScheme::StatusAccepted;
- const auto invalidStatus = NKikimrScheme::StatusSchemeError;
-
- CreateWithIntermediateDirs([&](TTestActorRuntime& runtime, ui64 txId, const TString& root, bool valid) {
- TestCreateRtmrVolume(runtime, txId, root, valid ? validScheme : invalidScheme, {valid ? validStatus : invalidStatus});
- });
- }
-
- Y_UNIT_TEST(CreateWithIntermediateDirsForceDrop) {
- CreateWithIntermediateDirsForceDrop([](TTestActorRuntime& runtime, ui64 txId, const TString& root) {
- AsyncCreateRtmrVolume(runtime, txId, root, R"(
- Name: "x/y/z"
- PartitionsCount: 0
- )");
+ Y_UNIT_TEST(CreateWithIntermediateDirsForceDrop) {
+ CreateWithIntermediateDirsForceDrop([](TTestActorRuntime& runtime, ui64 txId, const TString& root) {
+ AsyncCreateRtmrVolume(runtime, txId, root, R"(
+ Name: "x/y/z"
+ PartitionsCount: 0
+ )");
});
}
-}
+}
-Y_UNIT_TEST_SUITE(TConsistentOpsWithReboots) {
- Y_UNIT_TEST(Fake) {
+Y_UNIT_TEST_SUITE(TConsistentOpsWithReboots) {
+ Y_UNIT_TEST(Fake) {
}
- Y_UNIT_TEST(CopyWithData) {
+ Y_UNIT_TEST(CopyWithData) {
TTestWithReboots t;
t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathVersion pathVersion;
- {
- TInactiveZone inactive(activeZone);
- TestMkDir(runtime, ++t.TxId, "/MyRoot", "DirB");
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirB",
- "Name: \"src1\""
+ TPathVersion pathVersion;
+ {
+ TInactiveZone inactive(activeZone);
+ TestMkDir(runtime, ++t.TxId, "/MyRoot", "DirB");
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirB",
+ "Name: \"src1\""
+ "Columns { Name: \"key1\" Type: \"Uint32\"}"
+ "Columns { Name: \"key2\" Type: \"Utf8\"}"
+ "Columns { Name: \"key3\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
+ "UniformPartitionsCount: 1"
+ );
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirB",
+ "Name: \"src2\""
"Columns { Name: \"key1\" Type: \"Uint32\"}"
"Columns { Name: \"key2\" Type: \"Utf8\"}"
"Columns { Name: \"key3\" Type: \"Uint64\"}"
"Columns { Name: \"Value\" Type: \"Utf8\"}"
"KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
- "UniformPartitionsCount: 1"
- );
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirB",
- "Name: \"src2\""
- "Columns { Name: \"key1\" Type: \"Uint32\"}"
- "Columns { Name: \"key2\" Type: \"Utf8\"}"
- "Columns { Name: \"key3\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
- "UniformPartitionsCount: 1"
- );
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-2, t.TxId-1, t.TxId});
-
- // Write some data to the user table
- auto fnWriteRow = [&] (ui64 tabletId) {
- TString writeQuery = R"(
- (
- (let key '( '('key1 (Uint32 '0)) '('key2 (Utf8 'aaaa)) '('key3 (Uint64 '0)) ) )
- (let value '('('Value (Utf8 '281474980010683)) ) )
- (return (AsList (UpdateRow '__user__src1 key value) ))
- )
- )";
- NKikimrMiniKQL::TResult result;
- TString err;
+ "UniformPartitionsCount: 1"
+ );
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-2, t.TxId-1, t.TxId});
+
+ // Write some data to the user table
+ auto fnWriteRow = [&] (ui64 tabletId) {
+ TString writeQuery = R"(
+ (
+ (let key '( '('key1 (Uint32 '0)) '('key2 (Utf8 'aaaa)) '('key3 (Uint64 '0)) ) )
+ (let value '('('Value (Utf8 '281474980010683)) ) )
+ (return (AsList (UpdateRow '__user__src1 key value) ))
+ )
+ )";
+ NKikimrMiniKQL::TResult result;
+ TString err;
NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
- };
+ };
fnWriteRow(TTestTxConfig::FakeHiveTablets);
- pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- {NLs::PathVersionEqual(7)});
+ pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ {NLs::PathVersionEqual(7)});
}
t.TestEnv->ReliablePropose(runtime, ConsistentCopyTablesRequest(++t.TxId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirB/src1"
- DstPath: "/MyRoot/DirB/dst1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirB/src2"
- DstPath: "/MyRoot/DirB/dst2"
- }
- )", {pathVersion}),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirB/src1"
+ DstPath: "/MyRoot/DirB/dst1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirB/src2"
+ DstPath: "/MyRoot/DirB/dst2"
+ }
+ )", {pathVersion}),
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
t.TestEnv->TestWaitNotification(runtime, t.TxId);
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- {NLs::PathVersionEqual(11),
- NLs::ChildrenCount(4)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/src1"),
- {NLs::PathVersionEqual(3),
- NLs::IsTable});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/src2"),
- {NLs::PathVersionEqual(3),
- NLs::IsTable});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/dst1"),
- {NLs::PathVersionEqual(3),
- NLs::IsTable});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/dst2"),
- {NLs::PathVersionEqual(3),
- NLs::IsTable});
- }
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ {NLs::PathVersionEqual(11),
+ NLs::ChildrenCount(4)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/src1"),
+ {NLs::PathVersionEqual(3),
+ NLs::IsTable});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/src2"),
+ {NLs::PathVersionEqual(3),
+ NLs::IsTable});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/dst1"),
+ {NLs::PathVersionEqual(3),
+ NLs::IsTable});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/dst2"),
+ {NLs::PathVersionEqual(3),
+ NLs::IsTable});
+ }
});
}
- Y_UNIT_TEST(DropWithData) {
+ Y_UNIT_TEST(DropWithData) {
TTestWithReboots t;
t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestMkDir(runtime, ++t.TxId, "/MyRoot", "DirB");
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirB",
- "Name: \"src1\""
- "Columns { Name: \"key1\" Type: \"Uint32\"}"
- "Columns { Name: \"key2\" Type: \"Utf8\"}"
- "Columns { Name: \"key3\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
- "UniformPartitionsCount: 1"
- );
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirB",
- "Name: \"src2\""
- "Columns { Name: \"key1\" Type: \"Uint32\"}"
- "Columns { Name: \"key2\" Type: \"Utf8\"}"
- "Columns { Name: \"key3\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
- "UniformPartitionsCount: 1"
- );
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-2, t.TxId-1, t.TxId});
-
- // Write some data to the user table
- auto fnWriteRow = [&] (ui64 tabletId) {
- TString writeQuery = R"(
- (
- (let key '( '('key1 (Uint32 '0)) '('key2 (Utf8 'aaaa)) '('key3 (Uint64 '0)) ) )
- (let value '('('Value (Utf8 '281474980010683)) ) )
- (return (AsList (UpdateRow '__user__src1 key value) ))
- )
- )";
- NKikimrMiniKQL::TResult result;
- TString err;
+ {
+ TInactiveZone inactive(activeZone);
+ TestMkDir(runtime, ++t.TxId, "/MyRoot", "DirB");
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirB",
+ "Name: \"src1\""
+ "Columns { Name: \"key1\" Type: \"Uint32\"}"
+ "Columns { Name: \"key2\" Type: \"Utf8\"}"
+ "Columns { Name: \"key3\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
+ "UniformPartitionsCount: 1"
+ );
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirB",
+ "Name: \"src2\""
+ "Columns { Name: \"key1\" Type: \"Uint32\"}"
+ "Columns { Name: \"key2\" Type: \"Utf8\"}"
+ "Columns { Name: \"key3\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
+ "UniformPartitionsCount: 1"
+ );
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-2, t.TxId-1, t.TxId});
+
+ // Write some data to the user table
+ auto fnWriteRow = [&] (ui64 tabletId) {
+ TString writeQuery = R"(
+ (
+ (let key '( '('key1 (Uint32 '0)) '('key2 (Utf8 'aaaa)) '('key3 (Uint64 '0)) ) )
+ (let value '('('Value (Utf8 '281474980010683)) ) )
+ (return (AsList (UpdateRow '__user__src1 key value) ))
+ )
+ )";
+ NKikimrMiniKQL::TResult result;
+ TString err;
NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
- };
+ };
fnWriteRow(TTestTxConfig::FakeHiveTablets);
-
+
TestConsistentCopyTables(runtime, ++t.TxId, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirB/src1"
- DstPath: "/MyRoot/DirB/dst1"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/DirB/src2"
- DstPath: "/MyRoot/DirB/dst2"
- }
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- AsyncDropTable(runtime, ++t.TxId, "/MyRoot/DirB", "src1");
- AsyncDropTable(runtime, ++t.TxId, "/MyRoot/DirB", "dst1");
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirB/src1"
+ DstPath: "/MyRoot/DirB/dst1"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/DirB/src2"
+ DstPath: "/MyRoot/DirB/dst2"
+ }
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ AsyncDropTable(runtime, ++t.TxId, "/MyRoot/DirB", "src1");
+ AsyncDropTable(runtime, ++t.TxId, "/MyRoot/DirB", "dst1");
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
t.TestEnv->TestWaitTabletDeletion(runtime, {TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 2});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- {NLs::PathVersionEqual(15),
- NLs::ChildrenCount(2)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/src1"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/src2"),
- {NLs::PathVersionEqual(3),
- NLs::IsTable});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/dst1"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/dst2"),
- {NLs::PathVersionEqual(3),
- NLs::IsTable});
- }
- });
- }
-
- Y_UNIT_TEST(CreateIndexedTableWithReboots) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- AsyncMkDir(runtime, ++t.TxId, "/MyRoot", "DirB");
- AsyncCreateIndexedTable(runtime, ++t.TxId, "/MyRoot/DirB", R"(
- TableDescription {
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValues"
- KeyColumnNames: ["value0", "value1"]
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ {NLs::PathVersionEqual(15),
+ NLs::ChildrenCount(2)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/src1"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/src2"),
+ {NLs::PathVersionEqual(3),
+ NLs::IsTable});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/dst1"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/dst2"),
+ {NLs::PathVersionEqual(3),
+ NLs::IsTable});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(CreateIndexedTableWithReboots) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ AsyncMkDir(runtime, ++t.TxId, "/MyRoot", "DirB");
+ AsyncCreateIndexedTable(runtime, ++t.TxId, "/MyRoot/DirB", R"(
+ TableDescription {
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValues"
+ KeyColumnNames: ["value0", "value1"]
State: EIndexStateNotReady
- }
+ }
IndexDescription {
Name: "UserDefinedIndexByValue0CoveringValue1"
KeyColumnNames: ["value0"]
DataColumnNames: ["value1"]
}
- )");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- { NLs::Finished,
- NLs::PathVersionEqual(5),
- NLs::ChildrenCount(1)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/Table1"),
- { NLs::Finished,
- NLs::PathVersionEqual(3),
+ )");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ { NLs::Finished,
+ NLs::PathVersionEqual(5),
+ NLs::ChildrenCount(1)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/Table1"),
+ { NLs::Finished,
+ NLs::PathVersionEqual(3),
NLs::IndexesCount(3)});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirB/Table1/UserDefinedIndexByValue0"),
- {NLs::Finished,
- NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
- NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
- NLs::IndexKeys({"value0"})});
+ {NLs::Finished,
+ NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
+ NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
+ NLs::IndexKeys({"value0"})});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirB/Table1/UserDefinedIndexByValue0/indexImplTable"),
- {NLs::Finished});
+ {NLs::Finished});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirB/Table1/UserDefinedIndexByValues"),
- {NLs::Finished,
- NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
- NLs::IndexState(NKikimrSchemeOp::EIndexStateNotReady),
- NLs::IndexKeys({"value0", "value1"})});
+ {NLs::Finished,
+ NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
+ NLs::IndexState(NKikimrSchemeOp::EIndexStateNotReady),
+ NLs::IndexKeys({"value0", "value1"})});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirB/Table1/UserDefinedIndexByValues/indexImplTable"),
- {NLs::Finished});
+ {NLs::Finished});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirB/Table1/UserDefinedIndexByValue0CoveringValue1"),
{NLs::Finished,
- NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
- NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
+ NLs::IndexType(NKikimrSchemeOp::EIndexTypeGlobal),
+ NLs::IndexState(NKikimrSchemeOp::EIndexStateReady),
NLs::IndexKeys({"value0"}),
NLs::IndexDataColumns({"value1"})});
TestDescribeResult(DescribePrivatePath(runtime, "/MyRoot/DirB/Table1/UserDefinedIndexByValue0CoveringValue1/indexImplTable"),
{NLs::Finished});
-
- }
-
- });
- }
-
- Y_UNIT_TEST(DropIndexedTableWithReboots) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
-
- AsyncMkDir(runtime, ++t.TxId, "/MyRoot", "DirB");
- AsyncCreateIndexedTable(runtime, ++t.TxId, "/MyRoot/DirB", R"(
- TableDescription {
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValues"
- KeyColumnNames: ["value0", "value1"]
- }
+
+ }
+
+ });
+ }
+
+ Y_UNIT_TEST(DropIndexedTableWithReboots) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+
+ AsyncMkDir(runtime, ++t.TxId, "/MyRoot", "DirB");
+ AsyncCreateIndexedTable(runtime, ++t.TxId, "/MyRoot/DirB", R"(
+ TableDescription {
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValues"
+ KeyColumnNames: ["value0", "value1"]
+ }
IndexDescription {
Name: "UserDefinedIndexByValue0CoveringValue1"
KeyColumnNames: ["value0"]
DataColumnNames: ["value1"]
}
- )");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
- }
-
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot/DirB", "Table1");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- {NLs::Finished,
- NLs::PathVersionEqual(7),
- NLs::ChildrenCount(0)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/Table1"),
- {NLs::PathNotExist});
+ )");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
+ }
+
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot/DirB", "Table1");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(7),
+ NLs::ChildrenCount(0)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/Table1"),
+ {NLs::PathNotExist});
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 3));
- }
- });
- }
-
- Y_UNIT_TEST(CreateIndexedTableAndForceDrop) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathVersion dirAVersion;
-
- {
- TInactiveZone inactive(activeZone);
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot", "DirB");
- TestCreateIndexedTable(runtime, ++t.TxId, "/MyRoot/DirB", R"(
- TableDescription {
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue1"
- KeyColumnNames: ["value1"]
- }
- )");
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId - 2, t.TxId - 1, t.TxId});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished,
- NLs::ChildrenCount(2)});
-
- dirAVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- {NLs::Finished,
- NLs::PathVersionEqual(5),
- NLs::ChildrenCount(1)});
- }
-
- TestForceDropUnsafe(runtime, ++t.TxId, dirAVersion.PathId.LocalPathId);
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+ });
+ }
+
+ Y_UNIT_TEST(CreateIndexedTableAndForceDrop) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathVersion dirAVersion;
+
+ {
+ TInactiveZone inactive(activeZone);
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot", "DirB");
+ TestCreateIndexedTable(runtime, ++t.TxId, "/MyRoot/DirB", R"(
+ TableDescription {
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue1"
+ KeyColumnNames: ["value1"]
+ }
+ )");
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId - 2, t.TxId - 1, t.TxId});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished,
+ NLs::ChildrenCount(2)});
+
+ dirAVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(5),
+ NLs::ChildrenCount(1)});
+ }
+
+ TestForceDropUnsafe(runtime, ++t.TxId, dirAVersion.PathId.LocalPathId);
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 10));
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished,
- NLs::ChildrenCount(1)});
- }
- });
- }
-
- Y_UNIT_TEST(CreateIndexedTableAndForceDropSimonteniously) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathVersion dirAVersion;
- {
- TInactiveZone inactive(activeZone);
- dirAVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::Finished,
- NLs::PathVersionEqual(3),
- NLs::ChildrenCount(0)});
- }
-
- AsyncCreateIndexedTable(runtime, ++t.TxId, "/MyRoot/DirA", R"(
- TableDescription {
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue1"
- KeyColumnNames: ["value1"]
- })");
- AsyncForceDropUnsafe(runtime, ++t.TxId, dirAVersion.PathId.LocalPathId);
- t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished,
+ NLs::ChildrenCount(1)});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(CreateIndexedTableAndForceDropSimonteniously) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathVersion dirAVersion;
+ {
+ TInactiveZone inactive(activeZone);
+ dirAVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(3),
+ NLs::ChildrenCount(0)});
+ }
+
+ AsyncCreateIndexedTable(runtime, ++t.TxId, "/MyRoot/DirA", R"(
+ TableDescription {
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue1"
+ KeyColumnNames: ["value1"]
+ })");
+ AsyncForceDropUnsafe(runtime, ++t.TxId, dirAVersion.PathId.LocalPathId);
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 10));
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished,
- NLs::ChildrenCount(0)});
- }
- });
- }
-
- Y_UNIT_TEST(DropIndexedTableAndForceDropSimonteniously) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathVersion dirAVersion;
-
- {
- TInactiveZone inactive(activeZone);
- AsyncMkDir(runtime, ++t.TxId, "/MyRoot", "DirB");
- AsyncCreateIndexedTable(runtime, ++t.TxId, "/MyRoot/DirB", R"(
- TableDescription {
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue1"
- KeyColumnNames: ["value1"]
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished,
+ NLs::ChildrenCount(0)});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(DropIndexedTableAndForceDropSimonteniously) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathVersion dirAVersion;
+
+ {
+ TInactiveZone inactive(activeZone);
+ AsyncMkDir(runtime, ++t.TxId, "/MyRoot", "DirB");
+ AsyncCreateIndexedTable(runtime, ++t.TxId, "/MyRoot/DirB", R"(
+ TableDescription {
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue1"
+ KeyColumnNames: ["value1"]
}
IndexDescription {
Name: "UserDefinedIndexByValue0CoveringValue1"
@@ -573,32 +573,32 @@ Y_UNIT_TEST_SUITE(TConsistentOpsWithReboots) {
DataColumnNames: ["value1"]
}
)");
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId - 2, t.TxId - 1, t.TxId});
-
- dirAVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- {NLs::Finished,
- NLs::PathVersionEqual(5),
- NLs::ChildrenCount(1)});
- }
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot/DirB", "Table1");
-
- TestForceDropUnsafe(runtime, ++t.TxId, dirAVersion.PathId.LocalPathId);
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
-
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId - 2, t.TxId - 1, t.TxId});
+
+ dirAVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(5),
+ NLs::ChildrenCount(1)});
+ }
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot/DirB", "Table1");
+
+ TestForceDropUnsafe(runtime, ++t.TxId, dirAVersion.PathId.LocalPathId);
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
+
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 10));
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished,
- NLs::PathVersionOneOf({8, 9}),
- NLs::ChildrenCount(1)});
- }
- });
- }
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished,
+ NLs::PathVersionOneOf({8, 9}),
+ NLs::ChildrenCount(1)});
+ }
+ });
+ }
Y_UNIT_TEST(CreateNotNullColumnTableWithReboots) {
TTestWithReboots t;
@@ -655,111 +655,111 @@ Y_UNIT_TEST_SUITE(TConsistentOpsWithReboots) {
});
}
}
-
-Y_UNIT_TEST_SUITE(TSolomonReboots) {
- Y_UNIT_TEST(CreateDropSolomonWithReboots) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TestCreateSolomon(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Solomon"
- PartitionCount: 2)");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "MyRoot/Solomon"),
- {NLs::Finished,
- NLs::PathExist});
- }
-
- ++t.TxId;
- TestDropSolomon(runtime, ++t.TxId, "/MyRoot", "Solomon");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+Y_UNIT_TEST_SUITE(TSolomonReboots) {
+ Y_UNIT_TEST(CreateDropSolomonWithReboots) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TestCreateSolomon(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Solomon"
+ PartitionCount: 2)");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "MyRoot/Solomon"),
+ {NLs::Finished,
+ NLs::PathExist});
+ }
+
+ ++t.TxId;
+ TestDropSolomon(runtime, ++t.TxId, "/MyRoot", "Solomon");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
t.TestEnv->TestWaitTabletDeletion(runtime, {TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 1});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "MyRoot/Solomon"),
- {NLs::PathNotExist});
- }
- });
- }
-
- Y_UNIT_TEST(AdoptDropSolomonWithReboots) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- NKikimrSchemeOp::TCreateSolomonVolume volumeDescr;
- {
- TInactiveZone inactive(activeZone);
- TestCreateSolomon(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "JunkSolomon"
- PartitionCount: 2)");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- auto descr = DescribePath(runtime, "/MyRoot/JunkSolomon");
- TestDescribeResult(descr,
- {NLs::PathExist});
- volumeDescr = TakeTabletsFromAnotherSolomonVol("Solomon", descr.DebugString());
- }
-
- TestCreateSolomon(runtime, ++t.TxId, "/MyRoot", volumeDescr.DebugString());
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "MyRoot/Solomon"),
- {NLs::Finished,
- NLs::PathExist});
- }
-
- TestDropSolomon(runtime, ++t.TxId, "/MyRoot", "Solomon");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "MyRoot/Solomon"),
+ {NLs::PathNotExist});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(AdoptDropSolomonWithReboots) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ NKikimrSchemeOp::TCreateSolomonVolume volumeDescr;
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSolomon(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "JunkSolomon"
+ PartitionCount: 2)");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ auto descr = DescribePath(runtime, "/MyRoot/JunkSolomon");
+ TestDescribeResult(descr,
+ {NLs::PathExist});
+ volumeDescr = TakeTabletsFromAnotherSolomonVol("Solomon", descr.DebugString());
+ }
+
+ TestCreateSolomon(runtime, ++t.TxId, "/MyRoot", volumeDescr.DebugString());
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "MyRoot/Solomon"),
+ {NLs::Finished,
+ NLs::PathExist});
+ }
+
+ TestDropSolomon(runtime, ++t.TxId, "/MyRoot", "Solomon");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
t.TestEnv->TestWaitTabletDeletion(runtime, {TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 1});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "MyRoot/Solomon"),
- {NLs::PathNotExist});
- }
- });
- }
-
- Y_UNIT_TEST(CreateAlterSolomonWithReboots) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- NKikimrSchemeOp::TCreateSolomonVolume volumeDescr;
- {
- TestCreateSolomon(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Solomon"
- PartitionCount: 2)");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- ++t.TxId;
- TestAlterSolomon(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Solomon"
- PartitionCount: 4
- ChannelProfileId: 0)");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "MyRoot/Solomon"),
- {NLs::Finished,
- NLs::PathExist,
- NLs::ShardsInsideDomain(4)});
- }
-
- ++t.TxId;
- TestDropSolomon(runtime, ++t.TxId, "/MyRoot", "Solomon");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "MyRoot/Solomon"),
+ {NLs::PathNotExist});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(CreateAlterSolomonWithReboots) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ NKikimrSchemeOp::TCreateSolomonVolume volumeDescr;
+ {
+ TestCreateSolomon(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Solomon"
+ PartitionCount: 2)");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ ++t.TxId;
+ TestAlterSolomon(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Solomon"
+ PartitionCount: 4
+ ChannelProfileId: 0)");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "MyRoot/Solomon"),
+ {NLs::Finished,
+ NLs::PathExist,
+ NLs::ShardsInsideDomain(4)});
+ }
+
+ ++t.TxId;
+ TestDropSolomon(runtime, ++t.TxId, "/MyRoot", "Solomon");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 4));
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "MyRoot/Solomon"),
- {NLs::PathNotExist});
- }
- });
- }
-}
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "MyRoot/Solomon"),
+ {NLs::PathNotExist});
+ }
+ });
+ }
+}
diff --git a/ydb/core/tx/schemeshard/ut_restore.cpp b/ydb/core/tx/schemeshard/ut_restore.cpp
index f468ec8ab68..a8b33dcbdce 100644
--- a/ydb/core/tx/schemeshard/ut_restore.cpp
+++ b/ydb/core/tx/schemeshard/ut_restore.cpp
@@ -20,14 +20,14 @@
using namespace NKikimr;
using namespace NSchemeShardUT_Private;
-using namespace NKikimr::NSchemeShard;
+using namespace NKikimr::NSchemeShard;
using namespace NKikimr::NWrappers::NTestHelpers;
namespace {
const TString EmptyYsonStr = R"([[[[];%false]]])";
- TString GenerateScheme(const NKikimrSchemeOp::TPathDescription& pathDesc) {
+ TString GenerateScheme(const NKikimrSchemeOp::TPathDescription& pathDesc) {
UNIT_ASSERT(pathDesc.HasTable());
const auto& tableDesc = pathDesc.GetTable();
@@ -51,17 +51,17 @@ namespace {
return result;
}
- TString GenerateScheme(const NKikimrScheme::TEvDescribeSchemeResult& describeResult) {
+ TString GenerateScheme(const NKikimrScheme::TEvDescribeSchemeResult& describeResult) {
UNIT_ASSERT(describeResult.HasPathDescription());
return GenerateScheme(describeResult.GetPathDescription());
}
- TString GenerateTableDescription(const NKikimrScheme::TEvDescribeSchemeResult& describeResult) {
+ TString GenerateTableDescription(const NKikimrScheme::TEvDescribeSchemeResult& describeResult) {
UNIT_ASSERT(describeResult.HasPathDescription());
UNIT_ASSERT(describeResult.GetPathDescription().HasTable());
const auto& tableDesc = describeResult.GetPathDescription().GetTable();
- NKikimrSchemeOp::TTableDescription scheme;
+ NKikimrSchemeOp::TTableDescription scheme;
scheme.MutableColumns()->CopyFrom(tableDesc.GetColumns());
scheme.MutableKeyColumnNames()->CopyFrom(tableDesc.GetKeyColumnNames());
@@ -224,7 +224,7 @@ Y_UNIT_TEST_SUITE(TRestoreTests) {
ui16 port, THolder<TS3Mock>& s3Mock, TVector<TTestData>&& data, ui32 readBatchSize = 128) {
const auto desc = DescribePath(runtime, "/MyRoot/Table", true, true);
- UNIT_ASSERT_VALUES_EQUAL(desc.GetStatus(), NKikimrScheme::StatusSuccess);
+ UNIT_ASSERT_VALUES_EQUAL(desc.GetStatus(), NKikimrScheme::StatusSuccess);
s3Mock.Reset(new TS3Mock(ConvertTestData({GenerateScheme(desc), std::move(data)}), TS3Mock::TSettings(port)));
UNIT_ASSERT(s3Mock->Start());
@@ -613,7 +613,7 @@ Y_UNIT_TEST_SUITE(TRestoreTests) {
}
void TestRestoreNegative(TTestActorRuntime& runtime, ui64 txId, const TString& parentPath, const TString& name,
- const TVector<TEvSchemeShard::EStatus>& expectedResults) {
+ const TVector<TEvSchemeShard::EStatus>& expectedResults) {
TestRestore(runtime, ++txId, parentPath, Sprintf(R"(
TableName: "%s"
@@ -635,25 +635,25 @@ Y_UNIT_TEST_SUITE(TRestoreTests) {
Columns { Name: "value" Type: "Utf8" }
KeyColumnNames: ["key"]
)");
- TestRestoreNegative(runtime, ++txId, "/MyRoot", "Table", {NKikimrScheme::StatusMultipleModifications});
+ TestRestoreNegative(runtime, ++txId, "/MyRoot", "Table", {NKikimrScheme::StatusMultipleModifications});
env.TestWaitNotification(runtime, {txId - 1, txId});
TestMkDir(runtime, ++txId, "/MyRoot", "Dir");
- TestRestoreNegative(runtime, ++txId, "/MyRoot", "Dir", {NKikimrScheme::StatusNameConflict});
+ TestRestoreNegative(runtime, ++txId, "/MyRoot", "Dir", {NKikimrScheme::StatusNameConflict});
env.TestWaitNotification(runtime, {txId - 1, txId});
- TestRestoreNegative(runtime, ++txId, "/MyRoot", "Dir", {NKikimrScheme::StatusNameConflict});
- TestRestoreNegative(runtime, ++txId, "/MyRoot", "NotExist", {NKikimrScheme::StatusPathDoesNotExist});
+ TestRestoreNegative(runtime, ++txId, "/MyRoot", "Dir", {NKikimrScheme::StatusNameConflict});
+ TestRestoreNegative(runtime, ++txId, "/MyRoot", "NotExist", {NKikimrScheme::StatusPathDoesNotExist});
TestAlterTable(runtime, ++txId, "/MyRoot",R"(
Name: "Table"
Columns { Name: "extra" Type: "Utf8"}
)");
- TestRestoreNegative(runtime, ++txId, "/MyRoot", "Table", {NKikimrScheme::StatusMultipleModifications});
+ TestRestoreNegative(runtime, ++txId, "/MyRoot", "Table", {NKikimrScheme::StatusMultipleModifications});
env.TestWaitNotification(runtime, {txId - 1, txId});
TestDropTable(runtime, ++txId, "/MyRoot", "Table");
- TestRestoreNegative(runtime, ++txId, "/MyRoot", "Table", {NKikimrScheme::StatusMultipleModifications});
+ TestRestoreNegative(runtime, ++txId, "/MyRoot", "Table", {NKikimrScheme::StatusMultipleModifications});
env.TestWaitNotification(runtime, {txId - 1, txId});
TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
@@ -668,10 +668,10 @@ Y_UNIT_TEST_SUITE(TRestoreTests) {
KeyColumnNames: ["value"]
}
)");
- TestRestoreNegative(runtime, ++txId, "/MyRoot", "IndexedTable", {NKikimrScheme::StatusMultipleModifications});
+ TestRestoreNegative(runtime, ++txId, "/MyRoot", "IndexedTable", {NKikimrScheme::StatusMultipleModifications});
env.TestWaitNotification(runtime, {txId - 1, txId});
- TestRestoreNegative(runtime, ++txId, "/MyRoot", "IndexedTable", {NKikimrScheme::StatusInvalidParameter});
+ TestRestoreNegative(runtime, ++txId, "/MyRoot", "IndexedTable", {NKikimrScheme::StatusInvalidParameter});
}
template <typename TEvToDelay>
@@ -795,7 +795,7 @@ Y_UNIT_TEST_SUITE(TRestoreWithRebootsTests) {
t.TestEnv->TestWaitNotification(runtime, t.TxId);
const auto desc = DescribePath(runtime, "/MyRoot/Table", true, true);
- UNIT_ASSERT_VALUES_EQUAL(desc.GetStatus(), NKikimrScheme::StatusSuccess);
+ UNIT_ASSERT_VALUES_EQUAL(desc.GetStatus(), NKikimrScheme::StatusSuccess);
s3Mock.Reset(new TS3Mock(ConvertTestData({GenerateScheme(desc), std::move(data)}), TS3Mock::TSettings(port)));
UNIT_ASSERT(s3Mock->Start());
@@ -1085,7 +1085,7 @@ Y_UNIT_TEST_SUITE(TRestoreWithRebootsTests) {
t.TestEnv->TestWaitNotification(runtime, t.TxId);
const auto desc = DescribePath(runtime, "/MyRoot/Table", true, true);
- UNIT_ASSERT_VALUES_EQUAL(desc.GetStatus(), NKikimrScheme::StatusSuccess);
+ UNIT_ASSERT_VALUES_EQUAL(desc.GetStatus(), NKikimrScheme::StatusSuccess);
s3Mock.Reset(new TS3Mock(ConvertTestData({GenerateScheme(desc), {data}}), TS3Mock::TSettings(port)));
UNIT_ASSERT(s3Mock->Start());
@@ -1110,8 +1110,8 @@ Y_UNIT_TEST_SUITE(TRestoreWithRebootsTests) {
const ui64 restoreTxId = t.TxId;
t.TestEnv->ReliablePropose(runtime, CancelTxRequest(++t.TxId, restoreTxId), {
- NKikimrScheme::StatusAccepted,
- NKikimrScheme::StatusTxIdNotExists
+ NKikimrScheme::StatusAccepted,
+ NKikimrScheme::StatusTxIdNotExists
});
t.TestEnv->TestWaitNotification(runtime, {restoreTxId, t.TxId});
});
@@ -1181,14 +1181,14 @@ Y_UNIT_TEST_SUITE(TImportTests) {
ExternalSchemeShard: true
ExternalHive: false
Name: "%s"
- StoragePools {
- Name: "name_User_kind_hdd-1"
- Kind: "common"
- }
- StoragePools {
- Name: "name_User_kind_hdd-2"
- Kind: "external"
- }
+ StoragePools {
+ Name: "name_User_kind_hdd-1"
+ Kind: "common"
+ }
+ StoragePools {
+ Name: "name_User_kind_hdd-2"
+ Kind: "external"
+ }
)", TStringBuf(dbName).RNextTok('/').data()));
env.TestWaitNotification(runtime, id);
}
@@ -1212,7 +1212,7 @@ Y_UNIT_TEST_SUITE(TImportTests) {
Ydb::StatusIds::StatusCode expectedStatus = Ydb::StatusIds::SUCCESS,
const TString& dbName = "/MyRoot", bool serverless = false) {
- TTestEnv env(runtime, TTestEnvOptions());
+ TTestEnv env(runtime, TTestEnvOptions());
Run(runtime, env, std::move(data), request, expectedStatus, dbName, serverless);
}
@@ -1447,7 +1447,7 @@ Y_UNIT_TEST_SUITE(TImportTests) {
runtime.DispatchEvents(opts);
}
- const TString expectedBillRecord = R"({"usage":{"start":0,"quantity":50,"finish":0,"unit":"request_unit","type":"delta"},"tags":{},"id":"281474976725758-9437199-2-9437199-4","cloud_id":"CLOUD_ID_VAL","source_wt":0,"source_id":"sless-docapi-ydb-ss","resource_id":"DATABASE_ID_VAL","schema":"ydb.serverless.requests.v1","folder_id":"FOLDER_ID_VAL","version":"1.0.0"})";
+ const TString expectedBillRecord = R"({"usage":{"start":0,"quantity":50,"finish":0,"unit":"request_unit","type":"delta"},"tags":{},"id":"281474976725758-9437199-2-9437199-4","cloud_id":"CLOUD_ID_VAL","source_wt":0,"source_id":"sless-docapi-ydb-ss","resource_id":"DATABASE_ID_VAL","schema":"ydb.serverless.requests.v1","folder_id":"FOLDER_ID_VAL","version":"1.0.0"})";
UNIT_ASSERT_VALUES_EQUAL(billRecords.size(), 1);
UNIT_ASSERT_NO_DIFF(billRecords[0], expectedBillRecord + "\n");
@@ -1560,12 +1560,12 @@ Y_UNIT_TEST_SUITE(TImportTests) {
}
}
)", {
- NLs::HasTtlEnabled("modified_at", TDuration::Hours(2), NKikimrSchemeOp::TTTLSettings::UNIT_SECONDS),
+ NLs::HasTtlEnabled("modified_at", TDuration::Hours(2), NKikimrSchemeOp::TTTLSettings::UNIT_SECONDS),
});
}
Y_UNIT_TEST(ShouldRestoreStorageSettings) {
- auto check = [](const NKikimrScheme::TEvDescribeSchemeResult& desc) {
+ auto check = [](const NKikimrScheme::TEvDescribeSchemeResult& desc) {
const auto& config = desc.GetPathDescription().GetTable().GetPartitionConfig().GetColumnFamilies(0).GetStorageConfig();
UNIT_ASSERT_VALUES_EQUAL(config.GetSysLog().GetPreferredPoolKind(), "common");
@@ -1844,7 +1844,7 @@ Y_UNIT_TEST_SUITE(TImportTests) {
void CancelShouldSucceed(TDelayFunc delayFunc) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime, TTestEnvOptions());
+ TTestEnv env(runtime, TTestEnvOptions());
ui64 txId = 100;
const auto data = GenerateTestData(R"(
@@ -1905,34 +1905,34 @@ Y_UNIT_TEST_SUITE(TImportTests) {
Y_UNIT_TEST(CancelUponCreatingTableShouldSucceed) {
CancelShouldSucceed([](TAutoPtr<IEventHandle>& ev) {
- if (ev->GetTypeRewrite() != TEvSchemeShard::EvModifySchemeTransaction) {
+ if (ev->GetTypeRewrite() != TEvSchemeShard::EvModifySchemeTransaction) {
return false;
}
- return ev->Get<TEvSchemeShard::TEvModifySchemeTransaction>()->Record
- .GetTransaction(0).GetOperationType() == NKikimrSchemeOp::ESchemeOpCreateTable;
+ return ev->Get<TEvSchemeShard::TEvModifySchemeTransaction>()->Record
+ .GetTransaction(0).GetOperationType() == NKikimrSchemeOp::ESchemeOpCreateTable;
});
}
Y_UNIT_TEST(CancelUponTransferringShouldSucceed) {
CancelShouldSucceed([](TAutoPtr<IEventHandle>& ev) {
- if (ev->GetTypeRewrite() != TEvSchemeShard::EvModifySchemeTransaction) {
+ if (ev->GetTypeRewrite() != TEvSchemeShard::EvModifySchemeTransaction) {
return false;
}
- return ev->Get<TEvSchemeShard::TEvModifySchemeTransaction>()->Record
- .GetTransaction(0).GetOperationType() == NKikimrSchemeOp::ESchemeOpRestore;
+ return ev->Get<TEvSchemeShard::TEvModifySchemeTransaction>()->Record
+ .GetTransaction(0).GetOperationType() == NKikimrSchemeOp::ESchemeOpRestore;
});
}
Y_UNIT_TEST(CancelUponBuildingIndicesShouldSucceed) {
CancelShouldSucceed([](TAutoPtr<IEventHandle>& ev) {
- if (ev->GetTypeRewrite() != TEvSchemeShard::EvModifySchemeTransaction) {
+ if (ev->GetTypeRewrite() != TEvSchemeShard::EvModifySchemeTransaction) {
return false;
}
- return ev->Get<TEvSchemeShard::TEvModifySchemeTransaction>()->Record
- .GetTransaction(0).GetOperationType() == NKikimrSchemeOp::ESchemeOpApplyIndexBuild;
+ return ev->Get<TEvSchemeShard::TEvModifySchemeTransaction>()->Record
+ .GetTransaction(0).GetOperationType() == NKikimrSchemeOp::ESchemeOpApplyIndexBuild;
});
}
}
diff --git a/ydb/core/tx/schemeshard/ut_rtmr.cpp b/ydb/core/tx/schemeshard/ut_rtmr.cpp
index 6d4458249a8..8ecff10e02a 100644
--- a/ydb/core/tx/schemeshard/ut_rtmr.cpp
+++ b/ydb/core/tx/schemeshard/ut_rtmr.cpp
@@ -1,23 +1,23 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
-using namespace NKikimr::NSchemeShard;
+using namespace NKikimr::NSchemeShard;
using namespace NKikimr;
-using namespace NKikimrSchemeOp;
+using namespace NKikimrSchemeOp;
using namespace NSchemeShardUT_Private;
-Y_UNIT_TEST_SUITE(TRtmrTest) {
- Y_UNIT_TEST(CreataWithoutTimeCastBuckets) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateRtmrVolume(runtime, txId++, "/MyRoot",
- "Name: \"rtmr1\" "
- "PartitionsCount: 0",
- {NKikimrScheme::StatusAccepted});
-
- env.TestWaitNotification(runtime, 100);
-
- TestLs(runtime, "/MyRoot/rtmr1", false, NLs::PathExist);
- }
-}
+Y_UNIT_TEST_SUITE(TRtmrTest) {
+ Y_UNIT_TEST(CreataWithoutTimeCastBuckets) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateRtmrVolume(runtime, txId++, "/MyRoot",
+ "Name: \"rtmr1\" "
+ "PartitionsCount: 0",
+ {NKikimrScheme::StatusAccepted});
+
+ env.TestWaitNotification(runtime, 100);
+
+ TestLs(runtime, "/MyRoot/rtmr1", false, NLs::PathExist);
+ }
+}
diff --git a/ydb/core/tx/schemeshard/ut_rtmr/ya.make b/ydb/core/tx/schemeshard/ut_rtmr/ya.make
index d34fc2db5b5..43ff241e878 100644
--- a/ydb/core/tx/schemeshard/ut_rtmr/ya.make
+++ b/ydb/core/tx/schemeshard/ut_rtmr/ya.make
@@ -29,7 +29,7 @@ PEERDIR(
YQL_LAST_ABI_VERSION()
SRCS(
- ut_rtmr.cpp
+ ut_rtmr.cpp
)
END()
diff --git a/ydb/core/tx/schemeshard/ut_rtmr_reboots.cpp b/ydb/core/tx/schemeshard/ut_rtmr_reboots.cpp
index d915abe9042..ae094c8d8b0 100644
--- a/ydb/core/tx/schemeshard/ut_rtmr_reboots.cpp
+++ b/ydb/core/tx/schemeshard/ut_rtmr_reboots.cpp
@@ -1,57 +1,57 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
-
+
#include <ydb/core/tx/datashard/datashard.h>
#include <ydb/core/protos/flat_scheme_op.pb.h>
-
+
#include <google/protobuf/text_format.h>
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-using namespace NSchemeShardUT_Private;
-
-Y_UNIT_TEST_SUITE(TRtmrTestReboots) {
- Y_UNIT_TEST(CreateRtmrVolumeWithReboots) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
-
-
- AsyncMkDir(runtime, ++t.TxId, "/MyRoot", "DirRtmr");
-
- const ui64 partitionsCount = 42;
- NKikimrSchemeOp::TRtmrVolumeDescription description;
- description.SetName("rtmr1");
- description.SetPartitionsCount(partitionsCount);
- for (ui64 i = 0; i < description.GetPartitionsCount(); ++i) {
- TGUID partitionId;
- CreateGuid(&partitionId);
- auto& part = *description.AddPartitions();
- part.SetBusKey(i);
- part.SetPartitionId((char*)partitionId.dw, sizeof(TGUID));
- }
-
- TString textDescription;
- ::google::protobuf::TextFormat::PrintToString(description, &textDescription);
- AsyncCreateRtmrVolume(runtime, ++t.TxId, "/MyRoot/DirRtmr", textDescription);
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId-1});
-
- {
- TInactiveZone inactive(activeZone);
- auto describeResult = DescribePath(runtime, "/MyRoot/DirRtmr/rtmr1");
- TestDescribeResult(describeResult,
- {NLs::Finished});
-
- UNIT_ASSERT(describeResult.GetPathDescription().HasRtmrVolumeDescription());
- const auto& volumeDescription = describeResult.GetPathDescription().GetRtmrVolumeDescription();
- UNIT_ASSERT_EQUAL(partitionsCount, volumeDescription.GetPartitionsCount());
- UNIT_ASSERT_VALUES_EQUAL(volumeDescription.GetName(), "rtmr1");
- for (ui64 i = 0; i < partitionsCount; ++i) {
- UNIT_ASSERT_VALUES_EQUAL(volumeDescription.GetPartitions(i).GetPartitionId(), description.GetPartitions(i).GetPartitionId());
- UNIT_ASSERT_EQUAL(volumeDescription.GetPartitions(i).GetBusKey(), description.GetPartitions(i).GetBusKey());
- UNIT_ASSERT(volumeDescription.GetPartitions(i).HasTabletId());
- UNIT_ASSERT(volumeDescription.GetPartitions(i).GetTabletId() != (ui64)-1);
- }
- }
- });
- }
-}
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+using namespace NSchemeShardUT_Private;
+
+Y_UNIT_TEST_SUITE(TRtmrTestReboots) {
+ Y_UNIT_TEST(CreateRtmrVolumeWithReboots) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+
+
+ AsyncMkDir(runtime, ++t.TxId, "/MyRoot", "DirRtmr");
+
+ const ui64 partitionsCount = 42;
+ NKikimrSchemeOp::TRtmrVolumeDescription description;
+ description.SetName("rtmr1");
+ description.SetPartitionsCount(partitionsCount);
+ for (ui64 i = 0; i < description.GetPartitionsCount(); ++i) {
+ TGUID partitionId;
+ CreateGuid(&partitionId);
+ auto& part = *description.AddPartitions();
+ part.SetBusKey(i);
+ part.SetPartitionId((char*)partitionId.dw, sizeof(TGUID));
+ }
+
+ TString textDescription;
+ ::google::protobuf::TextFormat::PrintToString(description, &textDescription);
+ AsyncCreateRtmrVolume(runtime, ++t.TxId, "/MyRoot/DirRtmr", textDescription);
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId-1});
+
+ {
+ TInactiveZone inactive(activeZone);
+ auto describeResult = DescribePath(runtime, "/MyRoot/DirRtmr/rtmr1");
+ TestDescribeResult(describeResult,
+ {NLs::Finished});
+
+ UNIT_ASSERT(describeResult.GetPathDescription().HasRtmrVolumeDescription());
+ const auto& volumeDescription = describeResult.GetPathDescription().GetRtmrVolumeDescription();
+ UNIT_ASSERT_EQUAL(partitionsCount, volumeDescription.GetPartitionsCount());
+ UNIT_ASSERT_VALUES_EQUAL(volumeDescription.GetName(), "rtmr1");
+ for (ui64 i = 0; i < partitionsCount; ++i) {
+ UNIT_ASSERT_VALUES_EQUAL(volumeDescription.GetPartitions(i).GetPartitionId(), description.GetPartitions(i).GetPartitionId());
+ UNIT_ASSERT_EQUAL(volumeDescription.GetPartitions(i).GetBusKey(), description.GetPartitions(i).GetBusKey());
+ UNIT_ASSERT(volumeDescription.GetPartitions(i).HasTabletId());
+ UNIT_ASSERT(volumeDescription.GetPartitions(i).GetTabletId() != (ui64)-1);
+ }
+ }
+ });
+ }
+}
diff --git a/ydb/core/tx/schemeshard/ut_rtmr_reboots/ya.make b/ydb/core/tx/schemeshard/ut_rtmr_reboots/ya.make
index 2538036dc91..1bd93f0d144 100644
--- a/ydb/core/tx/schemeshard/ut_rtmr_reboots/ya.make
+++ b/ydb/core/tx/schemeshard/ut_rtmr_reboots/ya.make
@@ -1,15 +1,15 @@
IF (NOT WITH_VALGRIND)
UNITTEST_FOR(ydb/core/tx/schemeshard)
-
+
OWNER(
vvvv
g:kikimr
)
-
+
FORK_SUBTESTS()
-
+
SPLIT_FACTOR(60)
-
+
IF (SANITIZER_TYPE OR WITH_VALGRIND)
TIMEOUT(3600)
SIZE(LARGE)
@@ -18,7 +18,7 @@ IF (NOT WITH_VALGRIND)
TIMEOUT(600)
SIZE(MEDIUM)
ENDIF()
-
+
PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
diff --git a/ydb/core/tx/schemeshard/ut_ru_calculator.cpp b/ydb/core/tx/schemeshard/ut_ru_calculator.cpp
index e1ab10f47ed..bb0e37459ac 100644
--- a/ydb/core/tx/schemeshard/ut_ru_calculator.cpp
+++ b/ydb/core/tx/schemeshard/ut_ru_calculator.cpp
@@ -7,7 +7,7 @@
namespace NKikimr {
Y_UNIT_TEST_SUITE(TRUCalculatorTests) {
- using TRUCalculator = NSchemeShard::TRUCalculator;
+ using TRUCalculator = NSchemeShard::TRUCalculator;
Y_UNIT_TEST(TestReadTable) {
const ui64 costPerMB = 128; // 1 MB = 128 RU
diff --git a/ydb/core/tx/schemeshard/ut_sequence.cpp b/ydb/core/tx/schemeshard/ut_sequence.cpp
index 1efb082eaad..5997244e6b0 100644
--- a/ydb/core/tx/schemeshard/ut_sequence.cpp
+++ b/ydb/core/tx/schemeshard/ut_sequence.cpp
@@ -1,8 +1,8 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
-using namespace NKikimr::NSchemeShard;
+using namespace NKikimr::NSchemeShard;
using namespace NKikimr;
-using namespace NKikimrSchemeOp;
+using namespace NKikimrSchemeOp;
using namespace NSchemeShardUT_Private;
Y_UNIT_TEST_SUITE(TSequence) {
@@ -108,7 +108,7 @@ Y_UNIT_TEST_SUITE(TSequence) {
TestCreateSequence(runtime, ++txId, "/MyRoot/seq", R"(
Name: "seq"
- )", {NKikimrScheme::StatusPathIsNotDirectory});
+ )", {NKikimrScheme::StatusPathIsNotDirectory});
}
Y_UNIT_TEST(CreateSequenceInsideTableThenDropSequence) {
@@ -193,7 +193,7 @@ Y_UNIT_TEST_SUITE(TSequence) {
TestCreateSequence(runtime, ++txId, "/MyRoot/Table/ValueIndex/indexImplTable", R"(
Name: "seq"
- )", {NKikimrScheme::StatusNameConflict});
+ )", {NKikimrScheme::StatusNameConflict});
}
Y_UNIT_TEST(CreateSequencesWithIndexedTable) {
@@ -249,7 +249,7 @@ Y_UNIT_TEST_SUITE(TSequence) {
Columns { Name: "value" Type: "Utf8" }
KeyColumnNames: ["key"]
}
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
// Cannot use default from sequence that doesn't match local sequences
TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
@@ -262,7 +262,7 @@ Y_UNIT_TEST_SUITE(TSequence) {
SequenceDescription {
Name: "someseq"
}
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
// Cannot use default from sequence for a non-key column
TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
@@ -275,7 +275,7 @@ Y_UNIT_TEST_SUITE(TSequence) {
SequenceDescription {
Name: "myseq"
}
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
TableDescription {
@@ -294,7 +294,7 @@ Y_UNIT_TEST_SUITE(TSequence) {
// Cannot drop sequence used by a column
TestDropSequence(runtime, ++txId, "/MyRoot/Table", "myseq",
- {NKikimrScheme::StatusNameConflict});
+ {NKikimrScheme::StatusNameConflict});
TestDropTable(runtime, ++txId, "/MyRoot", "Table");
env.TestWaitNotification(runtime, txId);
diff --git a/ydb/core/tx/schemeshard/ut_sequence_reboots.cpp b/ydb/core/tx/schemeshard/ut_sequence_reboots.cpp
index a54f5627315..d0553d6ad40 100644
--- a/ydb/core/tx/schemeshard/ut_sequence_reboots.cpp
+++ b/ydb/core/tx/schemeshard/ut_sequence_reboots.cpp
@@ -1,8 +1,8 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
-using namespace NKikimr::NSchemeShard;
+using namespace NKikimr::NSchemeShard;
using namespace NKikimr;
-using namespace NKikimrSchemeOp;
+using namespace NKikimrSchemeOp;
using namespace NSchemeShardUT_Private;
Y_UNIT_TEST_SUITE(TSequenceReboots) {
@@ -56,17 +56,17 @@ Y_UNIT_TEST_SUITE(TSequenceReboots) {
CreateSequenceRequest(t.TxId += 3, "/MyRoot", R"(
Name: "seq1"
)"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
t.TestEnv->ReliablePropose(runtime,
CreateSequenceRequest(t.TxId - 1, "/MyRoot", R"(
Name: "seq2"
)"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
t.TestEnv->ReliablePropose(runtime,
CreateSequenceRequest(t.TxId - 2, "/MyRoot", R"(
Name: "seq3"
)"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
t.TestEnv->TestWaitNotification(runtime, {t.TxId - 2, t.TxId - 1, t.TxId});
{
@@ -102,14 +102,14 @@ Y_UNIT_TEST_SUITE(TSequenceReboots) {
CreateSequenceRequest(++t.TxId, "/MyRoot", R"(
Name: "seq"
)"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
t.TestEnv->TestWaitNotification(runtime, t.TxId);
TestLs(runtime, "/MyRoot/seq", false, NLs::PathExist);
t.TestEnv->ReliablePropose(runtime,
DropSequenceRequest(++t.TxId, "/MyRoot", "seq"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
t.TestEnv->TestWaitNotification(runtime, t.TxId);
TestLs(runtime, "/MyRoot/seq", false, NLs::PathNotExist);
@@ -118,7 +118,7 @@ Y_UNIT_TEST_SUITE(TSequenceReboots) {
CreateSequenceRequest(++t.TxId, "/MyRoot", R"(
Name: "seq"
)"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
t.TestEnv->TestWaitNotification(runtime, t.TxId);
TestLs(runtime, "/MyRoot/seq", false, NLs::PathExist);
@@ -160,7 +160,7 @@ Y_UNIT_TEST_SUITE(TSequenceReboots) {
Name: "seq2"
}
)"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
t.TestEnv->TestWaitNotification(runtime, t.TxId);
TestLs(runtime, "/MyRoot/Table/seq1", TDescribeOptionsBuilder().SetShowPrivateTable(true), NLs::PathExist);
@@ -168,7 +168,7 @@ Y_UNIT_TEST_SUITE(TSequenceReboots) {
t.TestEnv->ReliablePropose(runtime,
DropTableRequest(++t.TxId, "/MyRoot", "Table"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusPathDoesNotExist, NKikimrScheme::StatusMultipleModifications});
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusPathDoesNotExist, NKikimrScheme::StatusMultipleModifications});
t.TestEnv->TestWaitNotification(runtime, t.TxId);
TestLs(runtime, "/MyRoot/Table", false, NLs::PathNotExist);
diff --git a/ydb/core/tx/schemeshard/ut_serverless.cpp b/ydb/core/tx/schemeshard/ut_serverless.cpp
index 08fd22df4b4..4bc3a6207a7 100644
--- a/ydb/core/tx/schemeshard/ut_serverless.cpp
+++ b/ydb/core/tx/schemeshard/ut_serverless.cpp
@@ -1,239 +1,239 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
#include <ydb/core/tx/schemeshard/schemeshard_private.h>
-
+
#include <ydb/core/metering/metering.h>
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-using namespace NSchemeShardUT_Private;
-
-Y_UNIT_TEST_SUITE(TSchemeShardServerLess) {
- Y_UNIT_TEST(Fake) {
- }
-
- Y_UNIT_TEST(BaseCase) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"SharedDB\"");
- env.TestWaitNotification(runtime, txId);
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "StoragePools { "
- " Name: \"pool-1\" "
- " Kind: \"pool-kind-1\" "
- "} "
- "StoragePools { "
- " Name: \"pool-2\" "
- " Kind: \"pool-kind-2\" "
- "} "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "ExternalSchemeShard: true "
- "ExternalHive: false " // ExternalHive is imposible in that enviroment yet
- "Name: \"SharedDB\"");
- env.TestWaitNotification(runtime, txId);
-
- TString createData = TStringBuilder()
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+using namespace NSchemeShardUT_Private;
+
+Y_UNIT_TEST_SUITE(TSchemeShardServerLess) {
+ Y_UNIT_TEST(Fake) {
+ }
+
+ Y_UNIT_TEST(BaseCase) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"SharedDB\"");
+ env.TestWaitNotification(runtime, txId);
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "StoragePools { "
+ " Name: \"pool-1\" "
+ " Kind: \"pool-kind-1\" "
+ "} "
+ "StoragePools { "
+ " Name: \"pool-2\" "
+ " Kind: \"pool-kind-2\" "
+ "} "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "ExternalSchemeShard: true "
+ "ExternalHive: false " // ExternalHive is imposible in that enviroment yet
+ "Name: \"SharedDB\"");
+ env.TestWaitNotification(runtime, txId);
+
+ TString createData = TStringBuilder()
<< "ResourcesDomainKey { SchemeShard: " << TTestTxConfig::SchemeShard << " PathId: " << 2 << " } "
- << "Name: \"ServerLess0\"";
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot", createData);
- env.TestWaitNotification(runtime, txId);
-
- TString alterData = TStringBuilder()
- << "PlanResolution: 50 "
- << "Coordinators: 1 "
- << "Mediators: 1 "
- << "TimeCastBucketsPerMediator: 2 "
- << "ExternalSchemeShard: true "
- << "ExternalHive: false "
- << "StoragePools { "
- << " Name: \"pool-1\" "
- << " Kind: \"pool-kind-1\" "
- << "} "
- << "Name: \"ServerLess0\"";
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot", alterData);
- env.TestWaitNotification(runtime, txId);
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/ServerLess0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("ServerLess0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
-
- UNIT_ASSERT(tenantSchemeShard != 0
- && tenantSchemeShard != (ui64)-1
+ << "Name: \"ServerLess0\"";
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot", createData);
+ env.TestWaitNotification(runtime, txId);
+
+ TString alterData = TStringBuilder()
+ << "PlanResolution: 50 "
+ << "Coordinators: 1 "
+ << "Mediators: 1 "
+ << "TimeCastBucketsPerMediator: 2 "
+ << "ExternalSchemeShard: true "
+ << "ExternalHive: false "
+ << "StoragePools { "
+ << " Name: \"pool-1\" "
+ << " Kind: \"pool-kind-1\" "
+ << "} "
+ << "Name: \"ServerLess0\"";
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot", alterData);
+ env.TestWaitNotification(runtime, txId);
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/ServerLess0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("ServerLess0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
+
+ UNIT_ASSERT(tenantSchemeShard != 0
+ && tenantSchemeShard != (ui64)-1
&& tenantSchemeShard != TTestTxConfig::SchemeShard);
-
- TestCreateTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/ServerLess0",
- "Name: \"dir/table0\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]");
- env.TestWaitNotification(runtime, txId, tenantSchemeShard);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/ServerLess0/dir/table0"),
- {NLs::PathExist,
- NLs::Finished});
-
- TestForceDropExtSubDomain(runtime, ++txId, "/MyRoot", "ServerLess0");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/ServerLess0/dir/table0"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/ServerLess0"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
-
+
+ TestCreateTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/ServerLess0",
+ "Name: \"dir/table0\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]");
+ env.TestWaitNotification(runtime, txId, tenantSchemeShard);
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/ServerLess0/dir/table0"),
+ {NLs::PathExist,
+ NLs::Finished});
+
+ TestForceDropExtSubDomain(runtime, ++txId, "/MyRoot", "ServerLess0");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/ServerLess0/dir/table0"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/ServerLess0"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets + 3, TTestTxConfig::FakeHiveTablets + 10));
- }
-
- Y_UNIT_TEST(StorageBilling) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- SetAllowServerlessStorageBilling(&runtime, true);
-
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"ResourceDB\"");
- env.TestWaitNotification(runtime, txId);
-
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
- "StoragePools { "
- " Name: \"pool-1\" "
- " Kind: \"pool-kind-1\" "
- "} "
- "StoragePools { "
- " Name: \"pool-2\" "
- " Kind: \"pool-kind-2\" "
- "} "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "ExternalSchemeShard: true "
- "Name: \"ResourceDB\"");
- env.TestWaitNotification(runtime, txId);
-
- const TInstant now = TInstant::ParseIso8601("2020-09-18T18:00:00.000000Z");
- runtime.UpdateCurrentTime(now);
-
- TString createData = TStringBuilder()
+ }
+
+ Y_UNIT_TEST(StorageBilling) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ SetAllowServerlessStorageBilling(&runtime, true);
+
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"ResourceDB\"");
+ env.TestWaitNotification(runtime, txId);
+
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot",
+ "StoragePools { "
+ " Name: \"pool-1\" "
+ " Kind: \"pool-kind-1\" "
+ "} "
+ "StoragePools { "
+ " Name: \"pool-2\" "
+ " Kind: \"pool-kind-2\" "
+ "} "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "ExternalSchemeShard: true "
+ "Name: \"ResourceDB\"");
+ env.TestWaitNotification(runtime, txId);
+
+ const TInstant now = TInstant::ParseIso8601("2020-09-18T18:00:00.000000Z");
+ runtime.UpdateCurrentTime(now);
+
+ TString createData = TStringBuilder()
<< "ResourcesDomainKey { SchemeShard: " << TTestTxConfig::SchemeShard << " PathId: " << 2 << " } "
- << "Name: \"ServerLessDB\"";
- TestCreateExtSubDomain(runtime, ++txId, "/MyRoot", createData);
- env.TestWaitNotification(runtime, txId);
-
- TString alterData = TStringBuilder()
- << "PlanResolution: 50 "
- << "Coordinators: 1 "
- << "Mediators: 1 "
- << "TimeCastBucketsPerMediator: 2 "
- << "ExternalSchemeShard: true "
- << "ExternalHive: false "
- << "StoragePools { "
- << " Name: \"pool-1\" "
- << " Kind: \"pool-kind-1\" "
- << "} "
- << "Name: \"ServerLessDB\"";
- TestAlterExtSubDomain(runtime, ++txId, "/MyRoot", alterData);
- env.TestWaitNotification(runtime, txId);
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/ServerLessDB"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("ServerLessDB"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
-
- TestUserAttrs(runtime, ++txId, "/MyRoot", "ServerLessDB", AlterUserAttrs({{"cloud_id", "CLOUD_ID_VAL"}, {"folder_id", "FOLDER_ID_VAL"}, {"database_id", "DATABASE_ID_VAL"}}));
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/ServerLessDB"),
- {NLs::UserAttrsHas({{"cloud_id", "CLOUD_ID_VAL"}, {"folder_id", "FOLDER_ID_VAL"}, {"database_id", "DATABASE_ID_VAL"}})});
-
- // Just create main table
- TestCreateTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/ServerLessDB", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint32" }
- Columns { Name: "index" Type: "Uint32" }
- Columns { Name: "value" Type: "Utf8" }
- KeyColumnNames: ["key"]
- )");
- env.TestWaitNotification(runtime, txId, tenantSchemeShard);
-
- auto fnWriteRow = [&] (ui64 tabletId, ui32 key, ui32 index, TString value, const char* table) {
- TString writeQuery = Sprintf(R"(
- (
- (let key '( '('key (Uint32 '%u ) ) ) )
- (let row '( '('index (Uint32 '%u ) ) '('value (Utf8 '%s) ) ) )
- (return (AsList (UpdateRow '__user__%s key row) ))
- )
- )", key, index, value.c_str(), table);
- NKikimrMiniKQL::TResult result;
- TString err;
+ << "Name: \"ServerLessDB\"";
+ TestCreateExtSubDomain(runtime, ++txId, "/MyRoot", createData);
+ env.TestWaitNotification(runtime, txId);
+
+ TString alterData = TStringBuilder()
+ << "PlanResolution: 50 "
+ << "Coordinators: 1 "
+ << "Mediators: 1 "
+ << "TimeCastBucketsPerMediator: 2 "
+ << "ExternalSchemeShard: true "
+ << "ExternalHive: false "
+ << "StoragePools { "
+ << " Name: \"pool-1\" "
+ << " Kind: \"pool-kind-1\" "
+ << "} "
+ << "Name: \"ServerLessDB\"";
+ TestAlterExtSubDomain(runtime, ++txId, "/MyRoot", alterData);
+ env.TestWaitNotification(runtime, txId);
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/ServerLessDB"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("ServerLessDB"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
+
+ TestUserAttrs(runtime, ++txId, "/MyRoot", "ServerLessDB", AlterUserAttrs({{"cloud_id", "CLOUD_ID_VAL"}, {"folder_id", "FOLDER_ID_VAL"}, {"database_id", "DATABASE_ID_VAL"}}));
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/ServerLessDB"),
+ {NLs::UserAttrsHas({{"cloud_id", "CLOUD_ID_VAL"}, {"folder_id", "FOLDER_ID_VAL"}, {"database_id", "DATABASE_ID_VAL"}})});
+
+ // Just create main table
+ TestCreateTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/ServerLessDB", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint32" }
+ Columns { Name: "index" Type: "Uint32" }
+ Columns { Name: "value" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ )");
+ env.TestWaitNotification(runtime, txId, tenantSchemeShard);
+
+ auto fnWriteRow = [&] (ui64 tabletId, ui32 key, ui32 index, TString value, const char* table) {
+ TString writeQuery = Sprintf(R"(
+ (
+ (let key '( '('key (Uint32 '%u ) ) ) )
+ (let row '( '('index (Uint32 '%u ) ) '('value (Utf8 '%s) ) ) )
+ (return (AsList (UpdateRow '__user__%s key row) ))
+ )
+ )", key, index, value.c_str(), table);
+ NKikimrMiniKQL::TResult result;
+ TString err;
NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
- };
- for (ui32 delta = 0; delta < 101; ++delta) {
+ };
+ for (ui32 delta = 0; delta < 101; ++delta) {
fnWriteRow(TTestTxConfig::FakeHiveTablets + 6, 1 + delta, 1000 + delta, "aaaa", "Table");
- }
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/ServerLessDB/Table"),
- {NLs::PathExist,
- NLs::IndexesCount(0),
- NLs::PathVersionEqual(3)});
-
- TStringBuilder meteringMessages;
- auto grabMeteringMessage = [&meteringMessages](TTestActorRuntimeBase&, TAutoPtr<IEventHandle> &ev) -> auto {
- if (ev->Type == NMetering::TEvMetering::TEvWriteMeteringJson::EventType) {
- auto *msg = ev->Get<NMetering::TEvMetering::TEvWriteMeteringJson>();
- Cerr << "grabMeteringMessage has happend" << Endl;
- meteringMessages << msg->MeteringJson;
- }
-
- return TTestActorRuntime::EEventAction::PROCESS;
- };
-
- auto waitMeteringMessage = [&]() {
- TDispatchOptions options;
- options.FinalEvents.push_back(TDispatchOptions::TFinalEventCondition(NMetering::TEvMetering::TEvWriteMeteringJson::EventType));
- runtime.DispatchEvents(options);
- };
-
- auto prevObserver = runtime.SetObserverFunc(grabMeteringMessage);
- runtime.AdvanceCurrentTime(TDuration::Minutes(1));
- waitMeteringMessage();
-
- {
- TString meteringData = R"({"usage":{"start":1600452120,"quantity":59,"finish":1600452179,"type":"delta","unit":"byte*second"},"tags":{"ydb_size":11728},"id":"8751008-3-1600452120-1600452179-11728","cloud_id":"CLOUD_ID_VAL","source_wt":1600452180,"source_id":"sless-docapi-ydb-storage","resource_id":"DATABASE_ID_VAL","schema":"ydb.serverless.v1","folder_id":"FOLDER_ID_VAL","version":"1.0.0"})";
- meteringData += "\n";
- UNIT_ASSERT_NO_DIFF(meteringMessages, meteringData);
- }
-
- runtime.SetObserverFunc(prevObserver);
-
- TestDropTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/ServerLessDB", "Table");
- env.TestWaitNotification(runtime, txId, tenantSchemeShard);
-
- meteringMessages.clear();
- runtime.SetObserverFunc(grabMeteringMessage);
- runtime.AdvanceCurrentTime(TDuration::Minutes(1));
- waitMeteringMessage();
-
- {
- TString meteringData = R"({"usage":{"start":1600452180,"quantity":59,"finish":1600452239,"type":"delta","unit":"byte*second"},"tags":{"ydb_size":0},"id":"8751008-3-1600452180-1600452239-0","cloud_id":"CLOUD_ID_VAL","source_wt":1600452240,"source_id":"sless-docapi-ydb-storage","resource_id":"DATABASE_ID_VAL","schema":"ydb.serverless.v1","folder_id":"FOLDER_ID_VAL","version":"1.0.0"})";
- meteringData += "\n";
- UNIT_ASSERT_NO_DIFF(meteringMessages, meteringData);
- }
- }
-}
+ }
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/ServerLessDB/Table"),
+ {NLs::PathExist,
+ NLs::IndexesCount(0),
+ NLs::PathVersionEqual(3)});
+
+ TStringBuilder meteringMessages;
+ auto grabMeteringMessage = [&meteringMessages](TTestActorRuntimeBase&, TAutoPtr<IEventHandle> &ev) -> auto {
+ if (ev->Type == NMetering::TEvMetering::TEvWriteMeteringJson::EventType) {
+ auto *msg = ev->Get<NMetering::TEvMetering::TEvWriteMeteringJson>();
+ Cerr << "grabMeteringMessage has happend" << Endl;
+ meteringMessages << msg->MeteringJson;
+ }
+
+ return TTestActorRuntime::EEventAction::PROCESS;
+ };
+
+ auto waitMeteringMessage = [&]() {
+ TDispatchOptions options;
+ options.FinalEvents.push_back(TDispatchOptions::TFinalEventCondition(NMetering::TEvMetering::TEvWriteMeteringJson::EventType));
+ runtime.DispatchEvents(options);
+ };
+
+ auto prevObserver = runtime.SetObserverFunc(grabMeteringMessage);
+ runtime.AdvanceCurrentTime(TDuration::Minutes(1));
+ waitMeteringMessage();
+
+ {
+ TString meteringData = R"({"usage":{"start":1600452120,"quantity":59,"finish":1600452179,"type":"delta","unit":"byte*second"},"tags":{"ydb_size":11728},"id":"8751008-3-1600452120-1600452179-11728","cloud_id":"CLOUD_ID_VAL","source_wt":1600452180,"source_id":"sless-docapi-ydb-storage","resource_id":"DATABASE_ID_VAL","schema":"ydb.serverless.v1","folder_id":"FOLDER_ID_VAL","version":"1.0.0"})";
+ meteringData += "\n";
+ UNIT_ASSERT_NO_DIFF(meteringMessages, meteringData);
+ }
+
+ runtime.SetObserverFunc(prevObserver);
+
+ TestDropTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/ServerLessDB", "Table");
+ env.TestWaitNotification(runtime, txId, tenantSchemeShard);
+
+ meteringMessages.clear();
+ runtime.SetObserverFunc(grabMeteringMessage);
+ runtime.AdvanceCurrentTime(TDuration::Minutes(1));
+ waitMeteringMessage();
+
+ {
+ TString meteringData = R"({"usage":{"start":1600452180,"quantity":59,"finish":1600452239,"type":"delta","unit":"byte*second"},"tags":{"ydb_size":0},"id":"8751008-3-1600452180-1600452239-0","cloud_id":"CLOUD_ID_VAL","source_wt":1600452240,"source_id":"sless-docapi-ydb-storage","resource_id":"DATABASE_ID_VAL","schema":"ydb.serverless.v1","folder_id":"FOLDER_ID_VAL","version":"1.0.0"})";
+ meteringData += "\n";
+ UNIT_ASSERT_NO_DIFF(meteringMessages, meteringData);
+ }
+ }
+}
diff --git a/ydb/core/tx/schemeshard/ut_serverless/ya.make b/ydb/core/tx/schemeshard/ut_serverless/ya.make
index 53fc131e989..984f9983e8f 100644
--- a/ydb/core/tx/schemeshard/ut_serverless/ya.make
+++ b/ydb/core/tx/schemeshard/ut_serverless/ya.make
@@ -1,27 +1,27 @@
UNITTEST_FOR(ydb/core/tx/schemeshard)
-
-OWNER(g:kikimr)
-
-FORK_SUBTESTS()
-TIMEOUT(600)
+OWNER(g:kikimr)
-SIZE(MEDIUM)
-
-PEERDIR(
+FORK_SUBTESTS()
+
+TIMEOUT(600)
+
+SIZE(MEDIUM)
+
+PEERDIR(
library/cpp/getopt
- library/cpp/regex/pcre
- library/cpp/svnversion
+ library/cpp/regex/pcre
+ library/cpp/svnversion
ydb/core/testlib
ydb/core/tx
ydb/core/tx/schemeshard/ut_helpers
ydb/core/yql_testlib
-)
-
+)
+
YQL_LAST_ABI_VERSION()
-SRCS(
- ut_serverless.cpp
-)
-
-END()
+SRCS(
+ ut_serverless.cpp
+)
+
+END()
diff --git a/ydb/core/tx/schemeshard/ut_split_merge.cpp b/ydb/core/tx/schemeshard/ut_split_merge.cpp
index c1b6082a192..7d91e7ae317 100644
--- a/ydb/core/tx/schemeshard/ut_split_merge.cpp
+++ b/ydb/core/tx/schemeshard/ut_split_merge.cpp
@@ -4,271 +4,271 @@
using namespace NKikimr;
using namespace NKikimr::NMiniKQL;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NSchemeShardUT_Private;
-Y_UNIT_TEST_SUITE(TSchemeShardSplitTest) {
- Y_UNIT_TEST(Test) {
- }
-
- Y_UNIT_TEST(Split10Shards) {
- TTestBasicRuntime runtime;
-
- TTestEnvOptions opts;
- opts.EnableBackgroundCompaction(false);
-
- TTestEnv env(runtime, opts);
-
- ui64 txId = 100;
-
- NDataShard::gDbStatsReportInterval = TDuration::Seconds(1);
- NDataShard::gDbStatsDataSizeResolution = 10;
- NDataShard::gDbStatsRowCountResolution = 10;
-
- //runtime.SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_CRIT);
-
- runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_CRIT);
-
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint64"}
- Columns { Name: "value" Type: "Utf8"}
- KeyColumnNames: ["key"]
- UniformPartitionsCount: 1
- )");
- env.TestWaitNotification(runtime, txId);
-
- auto fnWriteRow = [&] (ui64 tabletId, ui64 key) {
- TString writeQuery = Sprintf(R"(
- (
- (let key '( '('key (Uint64 '%lu)) ) )
- (let value '('('value (Utf8 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)) ) )
- (return (AsList (UpdateRow '__user__Table key value) ))
- )
- )", key);;
- NKikimrMiniKQL::TResult result;
- TString err;
- NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
- UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
- };
- for (ui64 key = 0; key < 1000; ++key) {
+Y_UNIT_TEST_SUITE(TSchemeShardSplitTest) {
+ Y_UNIT_TEST(Test) {
+ }
+
+ Y_UNIT_TEST(Split10Shards) {
+ TTestBasicRuntime runtime;
+
+ TTestEnvOptions opts;
+ opts.EnableBackgroundCompaction(false);
+
+ TTestEnv env(runtime, opts);
+
+ ui64 txId = 100;
+
+ NDataShard::gDbStatsReportInterval = TDuration::Seconds(1);
+ NDataShard::gDbStatsDataSizeResolution = 10;
+ NDataShard::gDbStatsRowCountResolution = 10;
+
+ //runtime.SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_CRIT);
+
+ runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_CRIT);
+
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64"}
+ Columns { Name: "value" Type: "Utf8"}
+ KeyColumnNames: ["key"]
+ UniformPartitionsCount: 1
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ auto fnWriteRow = [&] (ui64 tabletId, ui64 key) {
+ TString writeQuery = Sprintf(R"(
+ (
+ (let key '( '('key (Uint64 '%lu)) ) )
+ (let value '('('value (Utf8 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA)) ) )
+ (return (AsList (UpdateRow '__user__Table key value) ))
+ )
+ )", key);;
+ NKikimrMiniKQL::TResult result;
+ TString err;
+ NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
+ UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
+ };
+ for (ui64 key = 0; key < 1000; ++key) {
fnWriteRow(TTestTxConfig::FakeHiveTablets, key* 1'000'000);
- }
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionCount(1)});
-
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
- PartitioningPolicy {
- MinPartitionsCount: 100
- MaxPartitionsCount: 100
- SizeToSplit: 1
- FastSplitSettings {
- SizeThreshold: 10
- RowCountThreshold: 10
- }
- }
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- while (true) {
- TVector<THolder<IEventHandle>> suppressed;
- auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvGetTableStatsResult::EventType);
-
- WaitForSuppressed(runtime, suppressed, 1, prevObserver);
- for (auto &msg : suppressed) {
- runtime.Send(msg.Release());
- }
- suppressed.clear();
-
- bool itIsEnough = false;
-
- NLs::TCheckFunc checkPartitionCount = [&] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- if (record.GetPathDescription().TablePartitionsSize() >= 10) {
- itIsEnough = true;
- }
- };
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {checkPartitionCount});
-
- if (itIsEnough) {
- return;
- }
- }
- }
-
- Y_UNIT_TEST(Merge1KShards) {
- TTestBasicRuntime runtime;
-
- TTestEnvOptions opts;
- opts.EnableBackgroundCompaction(false);
-
- TTestEnv env(runtime, opts);
-
- ui64 txId = 100;
- runtime.SetDispatchedEventsLimit(10'000'000);
-
- NDataShard::gDbStatsReportInterval = TDuration::MilliSeconds(1);
-
- //runtime.SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_CRIT);
-
- runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_CRIT);
-
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint64"}
- Columns { Name: "value" Type: "Utf8"}
- KeyColumnNames: ["key"]
- UniformPartitionsCount: 1000
- )");
- env.TestWaitNotification(runtime, txId);
-
- {
- TVector<THolder<IEventHandle>> suppressed;
- auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType);
-
- WaitForSuppressed(runtime, suppressed, 1000, prevObserver);
- for (auto &msg : suppressed) {
- runtime.Send(msg.Release());
- }
- suppressed.clear();
- }
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionCount(1000)});
-
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
- PartitioningPolicy {
- MinPartitionsCount: 1
- SizeToSplit: 100500
- }
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- {
- TVector<THolder<IEventHandle>> suppressed;
- auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType);
-
- WaitForSuppressed(runtime, suppressed, 5*1000, prevObserver);
- for (auto &msg : suppressed) {
- runtime.Send(msg.Release());
- }
- suppressed.clear();
- }
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionCount(1000)});
-
-
+ }
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionCount(1)});
+
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
+ PartitioningPolicy {
+ MinPartitionsCount: 100
+ MaxPartitionsCount: 100
+ SizeToSplit: 1
+ FastSplitSettings {
+ SizeThreshold: 10
+ RowCountThreshold: 10
+ }
+ }
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ while (true) {
+ TVector<THolder<IEventHandle>> suppressed;
+ auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvGetTableStatsResult::EventType);
+
+ WaitForSuppressed(runtime, suppressed, 1, prevObserver);
+ for (auto &msg : suppressed) {
+ runtime.Send(msg.Release());
+ }
+ suppressed.clear();
+
+ bool itIsEnough = false;
+
+ NLs::TCheckFunc checkPartitionCount = [&] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ if (record.GetPathDescription().TablePartitionsSize() >= 10) {
+ itIsEnough = true;
+ }
+ };
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {checkPartitionCount});
+
+ if (itIsEnough) {
+ return;
+ }
+ }
+ }
+
+ Y_UNIT_TEST(Merge1KShards) {
+ TTestBasicRuntime runtime;
+
+ TTestEnvOptions opts;
+ opts.EnableBackgroundCompaction(false);
+
+ TTestEnv env(runtime, opts);
+
+ ui64 txId = 100;
+ runtime.SetDispatchedEventsLimit(10'000'000);
+
+ NDataShard::gDbStatsReportInterval = TDuration::MilliSeconds(1);
+
+ //runtime.SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_CRIT);
+
+ runtime.SetLogPriority(NKikimrServices::TX_DATASHARD, NActors::NLog::PRI_CRIT);
+
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64"}
+ Columns { Name: "value" Type: "Utf8"}
+ KeyColumnNames: ["key"]
+ UniformPartitionsCount: 1000
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ {
+ TVector<THolder<IEventHandle>> suppressed;
+ auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType);
+
+ WaitForSuppressed(runtime, suppressed, 1000, prevObserver);
+ for (auto &msg : suppressed) {
+ runtime.Send(msg.Release());
+ }
+ suppressed.clear();
+ }
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionCount(1000)});
+
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
+ PartitioningPolicy {
+ MinPartitionsCount: 1
+ SizeToSplit: 100500
+ }
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ {
+ TVector<THolder<IEventHandle>> suppressed;
+ auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType);
+
+ WaitForSuppressed(runtime, suppressed, 5*1000, prevObserver);
+ for (auto &msg : suppressed) {
+ runtime.Send(msg.Release());
+ }
+ suppressed.clear();
+ }
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionCount(1000)});
+
+
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+1000));
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionCount(1)});
- }
-
- Y_UNIT_TEST(Merge111Shards) {
- TTestBasicRuntime runtime;
-
- TTestEnvOptions opts;
- opts.EnableBackgroundCompaction(false);
-
- TTestEnv env(runtime, opts);
-
- ui64 txId = 100;
-
- TVector<THolder<IEventHandle>> suppressed;
- auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType);
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key" Type: "Uint64"}
- Columns { Name: "value" Type: "Utf8"}
- KeyColumnNames: ["key"]
- UniformPartitionsCount: 111
- )");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionCount(111)});
-
- TestAlterTable(runtime, ++txId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
- PartitioningPolicy {
- MinPartitionsCount: 1
- SizeToSplit: 100500
- }
- }
- )");
- env.TestWaitNotification(runtime, txId);
-
- WaitForSuppressed(runtime, suppressed, suppressed.size(), prevObserver);
- for (auto &msg : suppressed) {
- runtime.Send(msg.Release());
- }
- suppressed.clear();
-
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionCount(1)});
+ }
+
+ Y_UNIT_TEST(Merge111Shards) {
+ TTestBasicRuntime runtime;
+
+ TTestEnvOptions opts;
+ opts.EnableBackgroundCompaction(false);
+
+ TTestEnv env(runtime, opts);
+
+ ui64 txId = 100;
+
+ TVector<THolder<IEventHandle>> suppressed;
+ auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType);
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key" Type: "Uint64"}
+ Columns { Name: "value" Type: "Utf8"}
+ KeyColumnNames: ["key"]
+ UniformPartitionsCount: 111
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionCount(111)});
+
+ TestAlterTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
+ PartitioningPolicy {
+ MinPartitionsCount: 1
+ SizeToSplit: 100500
+ }
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+
+ WaitForSuppressed(runtime, suppressed, suppressed.size(), prevObserver);
+ for (auto &msg : suppressed) {
+ runtime.Send(msg.Release());
+ }
+ suppressed.clear();
+
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+111));
- // test requeres more txids than cached at start
- }
-
- Y_UNIT_TEST(AutoMergeInOne) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"A", ""})});
- }
-
- TVector<THolder<IEventHandle>> suppressed;
- auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType);
-
- {
- TInactiveZone inactive(activeZone);
- TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- PartitionConfig {
- PartitioningPolicy {
- MinPartitionsCount: 1
- SizeToSplit: 100500
+ // test requeres more txids than cached at start
+ }
+
+ Y_UNIT_TEST(AutoMergeInOne) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"A", ""})});
+ }
+
+ TVector<THolder<IEventHandle>> suppressed;
+ auto prevObserver = SetSuppressObserver(runtime, suppressed, TEvDataShard::TEvPeriodicTableStats::EventType);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ PartitionConfig {
+ PartitioningPolicy {
+ MinPartitionsCount: 1
+ SizeToSplit: 100500
}
}
)");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"A", ""})});
-
- WaitForSuppressed(runtime, suppressed, 1, prevObserver);
-
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"A", ""})});
+
+ WaitForSuppressed(runtime, suppressed, 1, prevObserver);
+
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+1));
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({""})});
-
- }, true);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({""})});
+
+ }, true);
}
}
diff --git a/ydb/core/tx/schemeshard/ut_split_merge/ya.make b/ydb/core/tx/schemeshard/ut_split_merge/ya.make
index 74acde63e41..df02fbd44f7 100644
--- a/ydb/core/tx/schemeshard/ut_split_merge/ya.make
+++ b/ydb/core/tx/schemeshard/ut_split_merge/ya.make
@@ -4,7 +4,7 @@ IF (NOT WITH_VALGRIND)
OWNER(g:kikimr)
FORK_SUBTESTS()
-
+
SPLIT_FACTOR(20)
IF (SANITIZER_TYPE OR WITH_VALGRIND)
diff --git a/ydb/core/tx/schemeshard/ut_split_merge_reboots.cpp b/ydb/core/tx/schemeshard/ut_split_merge_reboots.cpp
index 91cf68367cf..4118f3c01cd 100644
--- a/ydb/core/tx/schemeshard/ut_split_merge_reboots.cpp
+++ b/ydb/core/tx/schemeshard/ut_split_merge_reboots.cpp
@@ -1,1146 +1,1146 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
-
+
#include <ydb/library/yql/minikql/mkql_node.h>
-
-using namespace NKikimr;
-using namespace NKikimr::NMiniKQL;
-using namespace NSchemeShard;
-using namespace NSchemeShardUT_Private;
-
-Y_UNIT_TEST_SUITE(TSchemeShardSplitTestReboots) {
-
- void CheckTablePartitions(TTestActorRuntime& runtime, const TString& tablePath, const TVector<TString>& partitionPrefixes) {
- TString tableDescr = TestDescribe(runtime, tablePath);
- NKikimrScheme::TEvDescribeSchemeResult pbDescr;
- UNIT_ASSERT(::google::protobuf::TextFormat::ParseFromString(tableDescr, &pbDescr));
- UNIT_ASSERT_VALUES_EQUAL(partitionPrefixes.size(), pbDescr.GetPathDescription().TablePartitionsSize());
- TVector<ui64> datashards;
- for (size_t i = 0; i < partitionPrefixes.size(); ++i) {
- datashards.push_back(pbDescr.GetPathDescription().GetTablePartitions(i).GetDatashardId());
- UNIT_ASSERT_STRING_CONTAINS(pbDescr.GetPathDescription().GetTablePartitions(i).GetEndOfRangeKeyPrefix(),
- partitionPrefixes[i]);
- }
- for (ui64 tabletId : datashards) {
- UNIT_ASSERT_VALUES_EQUAL(GetDatashardState(runtime, tabletId), (ui64)NKikimrTxDataShard::Ready);
- }
- }
-
- Y_UNIT_TEST(ReTryMerge) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"A", ""})});
- }
-
- auto defObserver = [&](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle> &ev) -> auto {
- return TTestActorRuntime::DefaultObserverFunc(runtime, ev);
- };
-
- auto prevObserver = runtime.SetObserverFunc(defObserver);
-
- TVector<THolder<IEventHandle>> supressed;
- auto supressEvent = [&](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle> &ev) -> auto {
- if (ev->GetTypeRewrite() == TEvDataShard::TEvStateChanged::EventType) {
- auto *msg = ev->Get<TEvDataShard::TEvStateChanged>();
- auto state = msg->Record.GetState();
- Cerr << "TEvStateChanged has happend " << state << Endl;
-
- if (state == NDataShard::TShardState::Offline) {
- Cerr << "supressEvent has happend" << Endl;
- supressed.push_back(std::move(ev));
- return TTestActorRuntime::EEventAction::DROP;
- }
- }
-
- return prevObserver(runtime, ev);
- };
-
- runtime.SetObserverFunc(supressEvent);
-
- TestSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437194
- SourceTabletId: 9437195
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437194
- SourceTabletId: 9437195
- )",
- {NKikimrScheme::StatusInvalidParameter});
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- runtime.SetObserverFunc(prevObserver);
- for (auto& ev : supressed) {
- runtime.Send(ev.Release(), 0, /* via actor system */ true);
- }
- supressed.clear();
-
+
+using namespace NKikimr;
+using namespace NKikimr::NMiniKQL;
+using namespace NSchemeShard;
+using namespace NSchemeShardUT_Private;
+
+Y_UNIT_TEST_SUITE(TSchemeShardSplitTestReboots) {
+
+ void CheckTablePartitions(TTestActorRuntime& runtime, const TString& tablePath, const TVector<TString>& partitionPrefixes) {
+ TString tableDescr = TestDescribe(runtime, tablePath);
+ NKikimrScheme::TEvDescribeSchemeResult pbDescr;
+ UNIT_ASSERT(::google::protobuf::TextFormat::ParseFromString(tableDescr, &pbDescr));
+ UNIT_ASSERT_VALUES_EQUAL(partitionPrefixes.size(), pbDescr.GetPathDescription().TablePartitionsSize());
+ TVector<ui64> datashards;
+ for (size_t i = 0; i < partitionPrefixes.size(); ++i) {
+ datashards.push_back(pbDescr.GetPathDescription().GetTablePartitions(i).GetDatashardId());
+ UNIT_ASSERT_STRING_CONTAINS(pbDescr.GetPathDescription().GetTablePartitions(i).GetEndOfRangeKeyPrefix(),
+ partitionPrefixes[i]);
+ }
+ for (ui64 tabletId : datashards) {
+ UNIT_ASSERT_VALUES_EQUAL(GetDatashardState(runtime, tabletId), (ui64)NKikimrTxDataShard::Ready);
+ }
+ }
+
+ Y_UNIT_TEST(ReTryMerge) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"A", ""})});
+ }
+
+ auto defObserver = [&](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle> &ev) -> auto {
+ return TTestActorRuntime::DefaultObserverFunc(runtime, ev);
+ };
+
+ auto prevObserver = runtime.SetObserverFunc(defObserver);
+
+ TVector<THolder<IEventHandle>> supressed;
+ auto supressEvent = [&](TTestActorRuntimeBase& runtime, TAutoPtr<IEventHandle> &ev) -> auto {
+ if (ev->GetTypeRewrite() == TEvDataShard::TEvStateChanged::EventType) {
+ auto *msg = ev->Get<TEvDataShard::TEvStateChanged>();
+ auto state = msg->Record.GetState();
+ Cerr << "TEvStateChanged has happend " << state << Endl;
+
+ if (state == NDataShard::TShardState::Offline) {
+ Cerr << "supressEvent has happend" << Endl;
+ supressed.push_back(std::move(ev));
+ return TTestActorRuntime::EEventAction::DROP;
+ }
+ }
+
+ return prevObserver(runtime, ev);
+ };
+
+ runtime.SetObserverFunc(supressEvent);
+
+ TestSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437194
+ SourceTabletId: 9437195
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437194
+ SourceTabletId: 9437195
+ )",
+ {NKikimrScheme::StatusInvalidParameter});
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ runtime.SetObserverFunc(prevObserver);
+ for (auto& ev : supressed) {
+ runtime.Send(ev.Release(), 0, /* via actor system */ true);
+ }
+ supressed.clear();
+
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+1));
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::CheckColumns("Table", {"key1", "key2", "Value", "add_1", "add_2"}, {}, {"key1", "key2"}),
- NLs::PartitionKeys({""}),
- ShardsIsReady(runtime)});
- }
-
- {
- TInactiveZone inactive(activeZone);
- // make sure that merge has finished
- TestCopyTable(runtime, ++t.TxId, "/MyRoot", "Copy", "/MyRoot/Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
- }, true);
- }
-
- Y_UNIT_TEST(MergeMergeAlterParallel) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "B" } }}}
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"A", "B", "C", ""}),
- ShardsIsReady(runtime)});
- }
-
- TestSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437194
- SourceTabletId: 9437195
- )");
- AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437196
- SourceTabletId: 9437197
- )");
-
- AsyncAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "add_1" Type: "Uint32"}
- Columns { Name: "add_2" Type: "Uint64"}
- )");
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId -2, t.TxId-1, t.TxId});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::CheckColumns("Table", {"key1", "key2", "Value", "add_1", "add_2"}, {}, {"key1", "key2"}),
+ NLs::PartitionKeys({""}),
+ ShardsIsReady(runtime)});
+ }
+
+ {
+ TInactiveZone inactive(activeZone);
+ // make sure that merge has finished
+ TestCopyTable(runtime, ++t.TxId, "/MyRoot", "Copy", "/MyRoot/Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+ }, true);
+ }
+
+ Y_UNIT_TEST(MergeMergeAlterParallel) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "B" } }}}
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"A", "B", "C", ""}),
+ ShardsIsReady(runtime)});
+ }
+
+ TestSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437194
+ SourceTabletId: 9437195
+ )");
+ AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437196
+ SourceTabletId: 9437197
+ )");
+
+ AsyncAlterTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "add_1" Type: "Uint32"}
+ Columns { Name: "add_2" Type: "Uint64"}
+ )");
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId -2, t.TxId-1, t.TxId});
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+4));
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::CheckColumns("Table", {"key1", "key2", "Value", "add_1", "add_2"}, {}, {"key1", "key2"}),
- NLs::PartitionKeys({"B", ""})});
- }
- }, true);
- }
-
- auto MergeMergeCopyParallelScenario = [] (TTestWithReboots& t) {
- return [&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "B" } }}}
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"A", "B", "C", ""})});
- }
-
- TestSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437194
- SourceTabletId: 9437195
- )");
- AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437196
- SourceTabletId: 9437197
- )");
- t.TestEnv->ReliablePropose(runtime, CopyTableRequest(++t.TxId, "/MyRoot", "NewTable", "/MyRoot/Table"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
-
- AsyncCopyTable(runtime, ++t.TxId, "/MyRoot", "NewTable", "/MyRoot/Table");
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId -2, t.TxId-1, t.TxId});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::CheckColumns("Table", {"key1", "key2", "Value", "add_1", "add_2"}, {}, {"key1", "key2"}),
- NLs::PartitionKeys({"B", ""})});
- }
- };
- };
-
- Y_UNIT_TEST(MergeMergeCopyParallelReboots) { //+
- TTestWithReboots t;
- t.RunWithTabletReboots(MergeMergeCopyParallelScenario(t));
- }
-
- Y_UNIT_TEST(MergeMergeCopyParallelPipeResets) { //+
- TTestWithReboots t;
- t.RunWithPipeResets(MergeMergeCopyParallelScenario(t));
- }
-
- Y_UNIT_TEST(MergeMergeDropParallel) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "B" } }}}
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"A", "B", "C", ""})});
- }
-
- TestSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437194
- SourceTabletId: 9437195
- )");
- AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437196
- SourceTabletId: 9437197
- )");
- AsyncDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId -2, t.TxId-1, t.TxId});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::CheckColumns("Table", {"key1", "key2", "Value", "add_1", "add_2"}, {}, {"key1", "key2"}),
+ NLs::PartitionKeys({"B", ""})});
+ }
+ }, true);
+ }
+
+ auto MergeMergeCopyParallelScenario = [] (TTestWithReboots& t) {
+ return [&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "B" } }}}
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"A", "B", "C", ""})});
+ }
+
+ TestSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437194
+ SourceTabletId: 9437195
+ )");
+ AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437196
+ SourceTabletId: 9437197
+ )");
+ t.TestEnv->ReliablePropose(runtime, CopyTableRequest(++t.TxId, "/MyRoot", "NewTable", "/MyRoot/Table"),
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
+
+ AsyncCopyTable(runtime, ++t.TxId, "/MyRoot", "NewTable", "/MyRoot/Table");
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId -2, t.TxId-1, t.TxId});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::CheckColumns("Table", {"key1", "key2", "Value", "add_1", "add_2"}, {}, {"key1", "key2"}),
+ NLs::PartitionKeys({"B", ""})});
+ }
+ };
+ };
+
+ Y_UNIT_TEST(MergeMergeCopyParallelReboots) { //+
+ TTestWithReboots t;
+ t.RunWithTabletReboots(MergeMergeCopyParallelScenario(t));
+ }
+
+ Y_UNIT_TEST(MergeMergeCopyParallelPipeResets) { //+
+ TTestWithReboots t;
+ t.RunWithPipeResets(MergeMergeCopyParallelScenario(t));
+ }
+
+ Y_UNIT_TEST(MergeMergeDropParallel) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "B" } }}}
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"A", "B", "C", ""})});
+ }
+
+ TestSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437194
+ SourceTabletId: 9437195
+ )");
+ AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437196
+ SourceTabletId: 9437197
+ )");
+ AsyncDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId -2, t.TxId-1, t.TxId});
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+6));
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathNotExist});
- }
- }, true);
- }
-
- Y_UNIT_TEST(SplitSameShardTwice) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "Jack" } }
- }
- })");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"Jack", ""})});
- }
-
- AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437195
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "Marla" } }
- }
- }
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "Robert" } }
- }
- })");
-
- // Second split request must be rejected
- AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437195
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "Marla Singer" } }
- }
- }
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "Robert Paulson" } }
- }
- })");
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId-1});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathNotExist});
+ }
+ }, true);
+ }
+
+ Y_UNIT_TEST(SplitSameShardTwice) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "Jack" } }
+ }
+ })");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"Jack", ""})});
+ }
+
+ AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437195
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "Marla" } }
+ }
+ }
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "Robert" } }
+ }
+ })");
+
+ // Second split request must be rejected
+ AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437195
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "Marla Singer" } }
+ }
+ }
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "Robert Paulson" } }
+ }
+ })");
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId-1});
t.TestEnv->TestWaitTabletDeletion(runtime, TTestTxConfig::FakeHiveTablets+1); //delete src
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"Jack", "Marla", "Robert", ""})});
- }
- });
- }
-
-
- Y_UNIT_TEST(SplitTableWithReboots) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "Jack" } }
- }
- })");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"Jack", ""})});
-
- TestSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437195
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "Marla" } }
- }
- }
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "Robert" } }
- }
- })");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"Jack", "Marla", "Robert", ""})});
- }
-
- AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437197
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "Marla Singer" } }
- Tuple { Optional { Uint32: 20 } }
- }
- })");
- AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437198
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "Robert Paulson" } }
- Tuple { Optional { Uint32: 300 } }
- }
- }
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "Tyler Durden" } }
- }
- })");
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
- t.TestEnv->TestWaitTabletDeletion(runtime, {9437197, 9437198}); //delete src
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"Jack", "Marla", "Marla Singer", "Robert", "Robert Paulson", "Tyler Durden", ""})});
- }
- });
- }
-
- Y_UNIT_TEST(MergeTableWithReboots) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "Jack" } }}}
- )");
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"Jack", ""})});
- }
-
- // Merge 2 partitions into 1
- AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table",
- R"(
- SourceTabletId: 9437194
- SourceTabletId: 9437195
- )");
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- t.TestEnv->TestWaitTabletDeletion(runtime, {9437194, 9437195}); //delete src
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({""})});
- }
- });
- }
-
- Y_UNIT_TEST(MergeTableWithRebootsAndDropAfter) { //+
- TTestWithReboots t(false);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "B" } }}}
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
- )");
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"B", "C", ""})});
-
- {
- // Write some data to the user table
- auto fnWriteRow = [&] (ui64 tabletId, TString key) {
- TString writeQuery = Sprintf( R"(
- (
- (let key '( '('key1 (Utf8 '%s)) '('key2 (Uint32 '0)) ) )
- (let value '('('Value (Utf8 '281474980010683)) ) )
- (return (AsList (UpdateRow '__user__Table key value) ))
- )
- )", key.c_str());
- NKikimrMiniKQL::TResult result;
- TString err;
- NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
- UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
- };
-
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"Jack", "Marla", "Robert", ""})});
+ }
+ });
+ }
+
+
+ Y_UNIT_TEST(SplitTableWithReboots) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "Jack" } }
+ }
+ })");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"Jack", ""})});
+
+ TestSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437195
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "Marla" } }
+ }
+ }
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "Robert" } }
+ }
+ })");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"Jack", "Marla", "Robert", ""})});
+ }
+
+ AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437197
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "Marla Singer" } }
+ Tuple { Optional { Uint32: 20 } }
+ }
+ })");
+ AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437198
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "Robert Paulson" } }
+ Tuple { Optional { Uint32: 300 } }
+ }
+ }
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "Tyler Durden" } }
+ }
+ })");
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
+ t.TestEnv->TestWaitTabletDeletion(runtime, {9437197, 9437198}); //delete src
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"Jack", "Marla", "Marla Singer", "Robert", "Robert Paulson", "Tyler Durden", ""})});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(MergeTableWithReboots) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "Jack" } }}}
+ )");
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"Jack", ""})});
+ }
+
+ // Merge 2 partitions into 1
+ AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table",
+ R"(
+ SourceTabletId: 9437194
+ SourceTabletId: 9437195
+ )");
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ t.TestEnv->TestWaitTabletDeletion(runtime, {9437194, 9437195}); //delete src
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({""})});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(MergeTableWithRebootsAndDropAfter) { //+
+ TTestWithReboots t(false);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "B" } }}}
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
+ )");
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"B", "C", ""})});
+
+ {
+ // Write some data to the user table
+ auto fnWriteRow = [&] (ui64 tabletId, TString key) {
+ TString writeQuery = Sprintf( R"(
+ (
+ (let key '( '('key1 (Utf8 '%s)) '('key2 (Uint32 '0)) ) )
+ (let value '('('Value (Utf8 '281474980010683)) ) )
+ (return (AsList (UpdateRow '__user__Table key value) ))
+ )
+ )", key.c_str());
+ NKikimrMiniKQL::TResult result;
+ TString err;
+ NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
+ UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
+ };
+
//fnWriteRow(TTestTxConfig::FakeHiveTablets, "AAA"); //we need to make a mix of shards which have shared blobs and don't
fnWriteRow(TTestTxConfig::FakeHiveTablets + 1, "BBB");
fnWriteRow(TTestTxConfig::FakeHiveTablets + 2, "CCC");
- }
-
-
- TestCopyTable(runtime, ++t.TxId, "/MyRoot", "Copy", "/MyRoot/Table");
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"B", "C", ""})});
- }
-
- // Merge 2 partitions into 1
- TestSplitTable(runtime, ++t.TxId, "/MyRoot/Table",
- R"(
- SourceTabletId: 9437194
- SourceTabletId: 9437195
- )");
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"C", ""})});
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDropTable(runtime, ++t.TxId, "/MyRoot", "Copy");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+
+ TestCopyTable(runtime, ++t.TxId, "/MyRoot", "Copy", "/MyRoot/Table");
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"B", "C", ""})});
+ }
+
+ // Merge 2 partitions into 1
+ TestSplitTable(runtime, ++t.TxId, "/MyRoot/Table",
+ R"(
+ SourceTabletId: 9437194
+ SourceTabletId: 9437195
+ )");
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"C", ""})});
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDropTable(runtime, ++t.TxId, "/MyRoot", "Copy");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+10));
- }
- }, true);
- }
-
- Y_UNIT_TEST(MergeSplitParallel) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "B" } }}}
- )");
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"A", "B", ""})});
-
+ }
+ }, true);
+ }
+
+ Y_UNIT_TEST(MergeSplitParallel) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "B" } }}}
+ )");
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"A", "B", ""})});
+
SetAllowLogBatching(runtime, TTestTxConfig::FakeHiveTablets+1, false);
- }
-
- AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437194
- SourceTabletId: 9437195
- )");
- AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437196
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "C" } }
- }
- })");
-
+ }
+
+ AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437194
+ SourceTabletId: 9437195
+ )");
+ AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437196
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "C" } }
+ }
+ })");
+
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+3));
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"B", "C", ""})});
- }
- }, true);
- }
-
- Y_UNIT_TEST(SplitAlterParallel) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"A", ""})});
-
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"B", "C", ""})});
+ }
+ }, true);
+ }
+
+ Y_UNIT_TEST(SplitAlterParallel) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"A", ""})});
+
SetAllowLogBatching(runtime, TTestTxConfig::FakeHiveTablets+1, false);
- }
-
- AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437195
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "D" } }
- }
- })");
-
- AsyncAlterTable(runtime, ++t.TxId, "/MyRoot",
- R"(Name: "Table"
- Columns { Name: "add_1" Type: "Uint32"}
- Columns { Name: "add_2" Type: "Uint64"}
- )");
-
+ }
+
+ AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437195
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "D" } }
+ }
+ })");
+
+ AsyncAlterTable(runtime, ++t.TxId, "/MyRoot",
+ R"(Name: "Table"
+ Columns { Name: "add_1" Type: "Uint32"}
+ Columns { Name: "add_2" Type: "Uint64"}
+ )");
+
t.TestEnv->TestWaitTabletDeletion(runtime, TTestTxConfig::FakeHiveTablets+1);
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::CheckColumns("Table", {"key1", "key2", "Value", "add_1", "add_2"}, {}, {"key1", "key2"}),
- NLs::PartitionKeys({"A", "D", ""})});
- }
- });
- }
-
- Y_UNIT_TEST(MergeAlterSplitParallel) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathVersion pathVersion;
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathVersionEqual(3)});
- }
-
- AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437194
- SourceTabletId: 9437195
- )");
- t.TestEnv->ReliablePropose(runtime, AlterTableRequest(++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "add_1" Type: "Uint32"}
- Columns { Name: "add_2" Type: "Uint64"}
- )", {pathVersion}),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
-
- {
- TInactiveZone inactive(activeZone);
- pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathVersionEqual(5)});
- }
-
- t.TestEnv->ReliablePropose(runtime, SplitTableRequest(++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437196
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "B" } }
- }
- })", {pathVersion}),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionCount(2),
- NLs::CheckColumns("Table", {"key1", "key2", "Value", "add_1", "add_2"}, {}, {"key1", "key2"}),
- NLs::PartitionKeys({"B", ""})});
- }
- }, true);
- }
-
- Y_UNIT_TEST(MergeAlterAlterParallel) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathVersion pathVersion;
-
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PathVersionEqual(3),
- NLs::PartitionKeys({"A", ""})});
- }
-
- AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437194
- SourceTabletId: 9437195
- )");
- t.TestEnv->ReliablePropose(runtime, AlterTableRequest(++t.TxId, "/MyRoot",
- R"(Name: "Table"
- Columns { Name: "add_1" Type: "Uint32"}
- Columns { Name: "add_2" Type: "Uint64"}
- )"),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
-
- {
- TInactiveZone inactive(activeZone);
- pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathVersionEqual(5)});
- }
-
- t.TestEnv->ReliablePropose(runtime, AlterTableRequest(++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "add_3" Type: "String"}
- )", {pathVersion}),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::CheckColumns("Table", {"key1", "key2", "Value", "add_1", "add_2", "add_3"}, {}, {"key1", "key2"}),
- NLs::PartitionKeys({""})});
- }
- }, true);
- }
-
- Y_UNIT_TEST(SplitDropParallel) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
-
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
- )");
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"A", ""})});
-
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::CheckColumns("Table", {"key1", "key2", "Value", "add_1", "add_2"}, {}, {"key1", "key2"}),
+ NLs::PartitionKeys({"A", "D", ""})});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(MergeAlterSplitParallel) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathVersion pathVersion;
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathVersionEqual(3)});
+ }
+
+ AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437194
+ SourceTabletId: 9437195
+ )");
+ t.TestEnv->ReliablePropose(runtime, AlterTableRequest(++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "add_1" Type: "Uint32"}
+ Columns { Name: "add_2" Type: "Uint64"}
+ )", {pathVersion}),
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
+
+ {
+ TInactiveZone inactive(activeZone);
+ pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathVersionEqual(5)});
+ }
+
+ t.TestEnv->ReliablePropose(runtime, SplitTableRequest(++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437196
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "B" } }
+ }
+ })", {pathVersion}),
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionCount(2),
+ NLs::CheckColumns("Table", {"key1", "key2", "Value", "add_1", "add_2"}, {}, {"key1", "key2"}),
+ NLs::PartitionKeys({"B", ""})});
+ }
+ }, true);
+ }
+
+ Y_UNIT_TEST(MergeAlterAlterParallel) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathVersion pathVersion;
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PathVersionEqual(3),
+ NLs::PartitionKeys({"A", ""})});
+ }
+
+ AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437194
+ SourceTabletId: 9437195
+ )");
+ t.TestEnv->ReliablePropose(runtime, AlterTableRequest(++t.TxId, "/MyRoot",
+ R"(Name: "Table"
+ Columns { Name: "add_1" Type: "Uint32"}
+ Columns { Name: "add_2" Type: "Uint64"}
+ )"),
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
+
+ {
+ TInactiveZone inactive(activeZone);
+ pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathVersionEqual(5)});
+ }
+
+ t.TestEnv->ReliablePropose(runtime, AlterTableRequest(++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "add_3" Type: "String"}
+ )", {pathVersion}),
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::CheckColumns("Table", {"key1", "key2", "Value", "add_1", "add_2", "add_3"}, {}, {"key1", "key2"}),
+ NLs::PartitionKeys({""})});
+ }
+ }, true);
+ }
+
+ Y_UNIT_TEST(SplitDropParallel) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
+ )");
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"A", ""})});
+
SetAllowLogBatching(runtime, TTestTxConfig::FakeHiveTablets+1, false);
- }
-
- AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table",
- R"(
- SourceTabletId: 9437195
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "D" } }
- }
- }
- )");
-
- AsyncDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
+ }
+
+ AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table",
+ R"(
+ SourceTabletId: 9437195
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "D" } }
+ }
+ }
+ )");
+
+ AsyncDropTable(runtime, ++t.TxId, "/MyRoot", "Table");
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+4));
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathNotExist});
- }
- }, true);
- }
-
- Y_UNIT_TEST(MergeCopyParallelWithChannelsBindings) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathVersion pathVersion;
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, t.TxId, "/MyRoot/DirA", //1001
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\""
- "StoragePools {"
- " Name: \"name_USER_0_kind_hdd-1\""
- " Kind: \"storage-pool-number-1\""
- "}"
- "StoragePools {"
- " Name: \"name_USER_0_kind_hdd-2\""
- " Kind: \"storage-pool-number-2\""
- "}");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(0)});
-
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0/Table", true),
- {NLs::PathVersionEqual(3),
- NLs::PartitionKeys({"A", ""})});
-
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathNotExist});
+ }
+ }, true);
+ }
+
+ Y_UNIT_TEST(MergeCopyParallelWithChannelsBindings) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathVersion pathVersion;
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, t.TxId, "/MyRoot/DirA", //1001
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\""
+ "StoragePools {"
+ " Name: \"name_USER_0_kind_hdd-1\""
+ " Kind: \"storage-pool-number-1\""
+ "}"
+ "StoragePools {"
+ " Name: \"name_USER_0_kind_hdd-2\""
+ " Kind: \"storage-pool-number-2\""
+ "}");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(0)});
+
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0/Table", true),
+ {NLs::PathVersionEqual(3),
+ NLs::PartitionKeys({"A", ""})});
+
SetAllowLogBatching(runtime, TTestTxConfig::FakeHiveTablets+2, false);
- }
-
- AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0/Table",
- R"(
- SourceTabletId: 9437196
- SourceTabletId: 9437197
- )");
-
- t.TestEnv->ReliablePropose(runtime, CopyTableRequest(++t.TxId, "/MyRoot/DirA/USER_0", "TableCopy", "/MyRoot/DirA/USER_0/Table",
- {pathVersion}),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0/Table", true),
- {NLs::PartitionKeys({""})});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0/TableCopy", true),
- {NLs::PartitionKeys({""})});
- }
- }, false);
- }
-
- Y_UNIT_TEST(ForceDropAndCopyInParallelAllPathesAreLocked) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirA", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
+ }
+
+ AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0/Table",
+ R"(
+ SourceTabletId: 9437196
+ SourceTabletId: 9437197
+ )");
+
+ t.TestEnv->ReliablePropose(runtime, CopyTableRequest(++t.TxId, "/MyRoot/DirA/USER_0", "TableCopy", "/MyRoot/DirA/USER_0/Table",
+ {pathVersion}),
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0/Table", true),
+ {NLs::PartitionKeys({""})});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0/TableCopy", true),
+ {NLs::PartitionKeys({""})});
+ }
+ }, false);
+ }
+
+ Y_UNIT_TEST(ForceDropAndCopyInParallelAllPathesAreLocked) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirA", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
SetAllowLogBatching(runtime, TTestTxConfig::FakeHiveTablets, false);
- }
-
- AsyncCopyTable(runtime, ++t.TxId, "/MyRoot/DirA", "TableCopy", "/MyRoot/DirA/Table");
-
- AsyncForceDropUnsafe(runtime, ++t.TxId, 2);
-
- AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/DirA/Table", R"(
- SourceTabletId: 9437194
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "AA" } }
- }
- }
- )");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-2, t.TxId-1, t.TxId});
-
- t.TestEnv->TestWaitTabletDeletion(runtime,
+ }
+
+ AsyncCopyTable(runtime, ++t.TxId, "/MyRoot/DirA", "TableCopy", "/MyRoot/DirA/Table");
+
+ AsyncForceDropUnsafe(runtime, ++t.TxId, 2);
+
+ AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/DirA/Table", R"(
+ SourceTabletId: 9437194
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "AA" } }
+ }
+ }
+ )");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-2, t.TxId-1, t.TxId});
+
+ t.TestEnv->TestWaitTabletDeletion(runtime,
{TTestTxConfig::FakeHiveTablets //Ds
, TTestTxConfig::FakeHiveTablets+1 //CopyDS
, TTestTxConfig::FakeHiveTablets+2 //FirstSplit
, TTestTxConfig::FakeHiveTablets+3 //FirstSplit
- });
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::NoChildren});
- }
- });
- }
-
- Y_UNIT_TEST(MergeCopyParallelAndSplitCopyAfter) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathVersion pathVersion;
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
+ });
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::NoChildren});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(MergeCopyParallelAndSplitCopyAfter) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathVersion pathVersion;
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
SetAllowLogBatching(runtime, TTestTxConfig::FakeHiveTablets, false);
SetAllowLogBatching(runtime, TTestTxConfig::FakeHiveTablets+1, false);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"A", ""})});
-
- pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot", true),
- {NLs::Finished,
- NLs::ShardsInsideDomain(2)});
- }
-
-
- AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table",
- R"(
- SourceTabletId: 9437194
- SourceTabletId: 9437195
- )");
-
- t.TestEnv->ReliablePropose(runtime, CopyTableRequest(++t.TxId, "/MyRoot", "TableCopy", "/MyRoot/Table", {pathVersion}),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
-
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true), {NLs::PartitionKeys({""})});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TableCopy", true), {NLs::PartitionKeys({""})});
-
- pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished,
- NLs::ShardsInsideDomainOneOf({2, 3, 4})});
- }
-
- t.TestEnv->ReliablePropose(runtime, SplitTableRequest(++t.TxId, "/MyRoot/TableCopy", R"(
- SourceTabletId: 9437197
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "E" } }
- }
- }
- )", {pathVersion}),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true), {NLs::PartitionKeys({""})});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/TableCopy", true), {NLs::PartitionKeys({"E", ""})});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished,
- NLs::ShardsInsideDomainOneOf({2, 3, 4, 5})});
- }
- }, true);
- }
-
-
- Y_UNIT_TEST(SplitThenMerge) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathVersion pathVersion;
- {
- TInactiveZone inactive(activeZone);
- SetAllowLogBatching(runtime, t.SchemeShardTabletId, false);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "AAAA" } }}}
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "BBBB" } }}}
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "CCCC" } }}}
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "FFFF" } }}}
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "GGGG" } }}}
- )");
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"AAAA", "BBBB", "CCCC", "FFFF", "GGGG", ""})});
-
- pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathVersionEqual(3)});
- }
-
- t.TestEnv->ReliablePropose(runtime, SplitTableRequest(++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437197
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "DDDD" } }
- }
- }
- )", {pathVersion}), // 9437197 -> 9437200, 9437201
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
- {NLs::PathVersionEqual(4)});
- }
-
- t.TestEnv->ReliablePropose(runtime, SplitTableRequest(++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437196
- SourceTabletId: 9437200
- )", {pathVersion}),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"AAAA", "BBBB", "DDDD", "FFFF", "GGGG", ""})});
-
- }
- }, true);
- }
-
- Y_UNIT_TEST(MergeThenSplit) {
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathVersion pathVersion;
- {
- TInactiveZone inactive(activeZone);
- SetAllowLogBatching(runtime, t.SchemeShardTabletId, false);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "AAAA" } }}}
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "CCCC" } }}}
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "DDDD" } }}}
- )");
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PathVersionEqual(3),
- NLs::PartitionKeys({"AAAA", "CCCC", "DDDD", ""})});
- }
-
- t.TestEnv->ReliablePropose(runtime, SplitTableRequest(++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437195
- SourceTabletId: 9437196
- )", {pathVersion}), // -> 9437198
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PathVersionEqual(4),
- NLs::PartitionCount(3)});
- }
-
- t.TestEnv->ReliablePropose(runtime, SplitTableRequest(++t.TxId, "/MyRoot/Table", R"(
- SourceTabletId: 9437198
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "BBBBB" } }
- }
- }
- )", {pathVersion}),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"AAAA", "BBBB", "DDDD", ""})});
- }
- }, true);
- }
-
- Y_UNIT_TEST(SplitWithTxInFlightWithReboots) { //+
- TTestWithReboots t(true);
-
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "Jack" } }}}
- )");
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"Jack", ""})});
- }
-
-
- ui64 dataTxId = 20000;
-
- // Propose cross-shard write Tx1
- ++dataTxId;
- TFakeDataReq req1(runtime, dataTxId, "/MyRoot/Table",
- R"(
- (
- (let row1 '('('key1 (Utf8 'AAA)) '('key2 (Uint32 '111))))
- (let row2 '('('key1 (Utf8 'KKK)) '('key2 (Uint32 '222))))
- (let myUpd '())
- (let ret (AsList
- (UpdateRow '/MyRoot/Table row1 myUpd)
- (UpdateRow '/MyRoot/Table row2 myUpd)
- ))
- (return ret)
- )
- )");
- IEngineFlat::EStatus status1 = req1.Propose(false, activeZone);
- UNIT_ASSERT_VALUES_EQUAL_C(status1, IEngineFlat::EStatus::Unknown, "This Tx should be accepted and wait for Plan");
- UNIT_ASSERT(req1.GetErrors().empty());
-
- // Split partition #2 into 2
- AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table",
- R"(
- SourceTabletId: 9437195
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "Marla" } }
- }
- }
- )");
-
- // Wait for split to reach src DS
- int retries = 3;
- while (retries--) {
- {
- TDispatchOptions opts;
- opts.FinalEvents.emplace_back(TEvDataShard::EvSplit);
- runtime.DispatchEvents(opts);
- }
-
- ++dataTxId;
- TFakeDataReq req2(runtime, dataTxId, "/MyRoot/Table",
- R"(
- (
- (let row1 '('('key1 (Utf8 'AAA)) '('key2 (Uint32 '333))))
- (let row2 '('('key1 (Utf8 'KKK)) '('key2 (Uint32 '444))))
- (let myUpd '())
- (let ret (AsList
- (UpdateRow '/MyRoot/Table row1 myUpd)
- (UpdateRow '/MyRoot/Table row2 myUpd)
- ))
- (return ret)
- )
- )");
-
- IEngineFlat::EStatus status2 = req2.Propose(false, activeZone);
-
- if (status2 == IEngineFlat::EStatus::Unknown) {
- req2.Plan(t.CoordinatorTabletId);
- continue;
- }
-
- UNIT_ASSERT_VALUES_EQUAL_C(status2, IEngineFlat::EStatus::Error, "Write Tx should be rejected while split is pending");
- break;
- }
- UNIT_ASSERT_C(retries >= 0, "New Tx wasn't rejected by splitting datashard");
-
- // Plan Tx1
- {
- TInactiveZone inactive(activeZone);
- req1.Plan(t.CoordinatorTabletId);
- // Split should now proceed
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
- {NLs::PartitionKeys({"Jack", "Marla", ""})});
- }
- });
- }
-
-}
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"A", ""})});
+
+ pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot", true),
+ {NLs::Finished,
+ NLs::ShardsInsideDomain(2)});
+ }
+
+
+ AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table",
+ R"(
+ SourceTabletId: 9437194
+ SourceTabletId: 9437195
+ )");
+
+ t.TestEnv->ReliablePropose(runtime, CopyTableRequest(++t.TxId, "/MyRoot", "TableCopy", "/MyRoot/Table", {pathVersion}),
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
+
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true), {NLs::PartitionKeys({""})});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TableCopy", true), {NLs::PartitionKeys({""})});
+
+ pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished,
+ NLs::ShardsInsideDomainOneOf({2, 3, 4})});
+ }
+
+ t.TestEnv->ReliablePropose(runtime, SplitTableRequest(++t.TxId, "/MyRoot/TableCopy", R"(
+ SourceTabletId: 9437197
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "E" } }
+ }
+ }
+ )", {pathVersion}),
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true), {NLs::PartitionKeys({""})});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/TableCopy", true), {NLs::PartitionKeys({"E", ""})});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished,
+ NLs::ShardsInsideDomainOneOf({2, 3, 4, 5})});
+ }
+ }, true);
+ }
+
+
+ Y_UNIT_TEST(SplitThenMerge) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathVersion pathVersion;
+ {
+ TInactiveZone inactive(activeZone);
+ SetAllowLogBatching(runtime, t.SchemeShardTabletId, false);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "AAAA" } }}}
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "BBBB" } }}}
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "CCCC" } }}}
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "FFFF" } }}}
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "GGGG" } }}}
+ )");
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"AAAA", "BBBB", "CCCC", "FFFF", "GGGG", ""})});
+
+ pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathVersionEqual(3)});
+ }
+
+ t.TestEnv->ReliablePropose(runtime, SplitTableRequest(++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437197
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "DDDD" } }
+ }
+ }
+ )", {pathVersion}), // 9437197 -> 9437200, 9437201
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table"),
+ {NLs::PathVersionEqual(4)});
+ }
+
+ t.TestEnv->ReliablePropose(runtime, SplitTableRequest(++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437196
+ SourceTabletId: 9437200
+ )", {pathVersion}),
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"AAAA", "BBBB", "DDDD", "FFFF", "GGGG", ""})});
+
+ }
+ }, true);
+ }
+
+ Y_UNIT_TEST(MergeThenSplit) {
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathVersion pathVersion;
+ {
+ TInactiveZone inactive(activeZone);
+ SetAllowLogBatching(runtime, t.SchemeShardTabletId, false);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "AAAA" } }}}
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "CCCC" } }}}
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "DDDD" } }}}
+ )");
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PathVersionEqual(3),
+ NLs::PartitionKeys({"AAAA", "CCCC", "DDDD", ""})});
+ }
+
+ t.TestEnv->ReliablePropose(runtime, SplitTableRequest(++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437195
+ SourceTabletId: 9437196
+ )", {pathVersion}), // -> 9437198
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PathVersionEqual(4),
+ NLs::PartitionCount(3)});
+ }
+
+ t.TestEnv->ReliablePropose(runtime, SplitTableRequest(++t.TxId, "/MyRoot/Table", R"(
+ SourceTabletId: 9437198
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "BBBBB" } }
+ }
+ }
+ )", {pathVersion}),
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"AAAA", "BBBB", "DDDD", ""})});
+ }
+ }, true);
+ }
+
+ Y_UNIT_TEST(SplitWithTxInFlightWithReboots) { //+
+ TTestWithReboots t(true);
+
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "Jack" } }}}
+ )");
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"Jack", ""})});
+ }
+
+
+ ui64 dataTxId = 20000;
+
+ // Propose cross-shard write Tx1
+ ++dataTxId;
+ TFakeDataReq req1(runtime, dataTxId, "/MyRoot/Table",
+ R"(
+ (
+ (let row1 '('('key1 (Utf8 'AAA)) '('key2 (Uint32 '111))))
+ (let row2 '('('key1 (Utf8 'KKK)) '('key2 (Uint32 '222))))
+ (let myUpd '())
+ (let ret (AsList
+ (UpdateRow '/MyRoot/Table row1 myUpd)
+ (UpdateRow '/MyRoot/Table row2 myUpd)
+ ))
+ (return ret)
+ )
+ )");
+ IEngineFlat::EStatus status1 = req1.Propose(false, activeZone);
+ UNIT_ASSERT_VALUES_EQUAL_C(status1, IEngineFlat::EStatus::Unknown, "This Tx should be accepted and wait for Plan");
+ UNIT_ASSERT(req1.GetErrors().empty());
+
+ // Split partition #2 into 2
+ AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/Table",
+ R"(
+ SourceTabletId: 9437195
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "Marla" } }
+ }
+ }
+ )");
+
+ // Wait for split to reach src DS
+ int retries = 3;
+ while (retries--) {
+ {
+ TDispatchOptions opts;
+ opts.FinalEvents.emplace_back(TEvDataShard::EvSplit);
+ runtime.DispatchEvents(opts);
+ }
+
+ ++dataTxId;
+ TFakeDataReq req2(runtime, dataTxId, "/MyRoot/Table",
+ R"(
+ (
+ (let row1 '('('key1 (Utf8 'AAA)) '('key2 (Uint32 '333))))
+ (let row2 '('('key1 (Utf8 'KKK)) '('key2 (Uint32 '444))))
+ (let myUpd '())
+ (let ret (AsList
+ (UpdateRow '/MyRoot/Table row1 myUpd)
+ (UpdateRow '/MyRoot/Table row2 myUpd)
+ ))
+ (return ret)
+ )
+ )");
+
+ IEngineFlat::EStatus status2 = req2.Propose(false, activeZone);
+
+ if (status2 == IEngineFlat::EStatus::Unknown) {
+ req2.Plan(t.CoordinatorTabletId);
+ continue;
+ }
+
+ UNIT_ASSERT_VALUES_EQUAL_C(status2, IEngineFlat::EStatus::Error, "Write Tx should be rejected while split is pending");
+ break;
+ }
+ UNIT_ASSERT_C(retries >= 0, "New Tx wasn't rejected by splitting datashard");
+
+ // Plan Tx1
+ {
+ TInactiveZone inactive(activeZone);
+ req1.Plan(t.CoordinatorTabletId);
+ // Split should now proceed
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Table", true),
+ {NLs::PartitionKeys({"Jack", "Marla", ""})});
+ }
+ });
+ }
+
+}
diff --git a/ydb/core/tx/schemeshard/ut_split_merge_reboots/ya.make b/ydb/core/tx/schemeshard/ut_split_merge_reboots/ya.make
index 628e3b55e0d..c32acb44746 100644
--- a/ydb/core/tx/schemeshard/ut_split_merge_reboots/ya.make
+++ b/ydb/core/tx/schemeshard/ut_split_merge_reboots/ya.make
@@ -1,12 +1,12 @@
-IF (NOT WITH_VALGRIND)
+IF (NOT WITH_VALGRIND)
UNITTEST_FOR(ydb/core/tx/schemeshard)
-
+
OWNER(g:kikimr)
-
+
FORK_SUBTESTS()
-
+
SPLIT_FACTOR(20)
-
+
IF (SANITIZER_TYPE OR WITH_VALGRIND)
TIMEOUT(3600)
SIZE(LARGE)
@@ -16,7 +16,7 @@ IF (NOT WITH_VALGRIND)
SIZE(LARGE)
TAG(ya:fat)
ENDIF()
-
+
PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
@@ -26,12 +26,12 @@ IF (NOT WITH_VALGRIND)
ydb/core/tx/schemeshard/ut_helpers
ydb/library/yql/public/udf/service/exception_policy
)
-
+
YQL_LAST_ABI_VERSION()
-
+
SRCS(
ut_split_merge_reboots.cpp
)
-
+
END()
-ENDIF()
+ENDIF()
diff --git a/ydb/core/tx/schemeshard/ut_subdomain.cpp b/ydb/core/tx/schemeshard/ut_subdomain.cpp
index 8a8baf64758..d0d30bf7da8 100644
--- a/ydb/core/tx/schemeshard/ut_subdomain.cpp
+++ b/ydb/core/tx/schemeshard/ut_subdomain.cpp
@@ -1,77 +1,77 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
#include <ydb/core/tx/datashard/datashard.h>
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-using namespace NSchemeShardUT_Private;
-
-NLs::TCheckFunc LsCheckSubDomainParamsAfterAlter(const TString name,
- ui64 descrVersion = 2,
- ui64 pathId = 2,
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+using namespace NSchemeShardUT_Private;
+
+NLs::TCheckFunc LsCheckSubDomainParamsAfterAlter(const TString name,
+ ui64 descrVersion = 2,
+ ui64 pathId = 2,
TVector<ui64> coordinators = {TTestTxConfig::FakeHiveTablets},
TVector<ui64> mediators = {TTestTxConfig::FakeHiveTablets+1, TTestTxConfig::FakeHiveTablets+2})
-{
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- NLs::PathExist(record);
- NLs::PathIdEqual(pathId)(record);
- NLs::IsSubDomain(name)(record);
- NLs::SubDomainVersion(descrVersion)(record);
+{
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ NLs::PathExist(record);
+ NLs::PathIdEqual(pathId)(record);
+ NLs::IsSubDomain(name)(record);
+ NLs::SubDomainVersion(descrVersion)(record);
NLs::DomainKey(pathId, TTestTxConfig::SchemeShard)(record);
- NLs::DomainCoordinators(coordinators)(record);
- NLs::DomainMediators(mediators)(record);
- };
-}
-
-NLs::TCheckFunc LsCheckSubDomainParamsInCommonCase(const TString name,
+ NLs::DomainCoordinators(coordinators)(record);
+ NLs::DomainMediators(mediators)(record);
+ };
+}
+
+NLs::TCheckFunc LsCheckSubDomainParamsInCommonCase(const TString name,
ui64 pathId = 2, ui64 schemeshardId = TTestTxConfig::SchemeShard,
- ui64 createTxId = 100, ui64 createStep = 5000001,
- ui64 parentPathId = 1, ui64 descrVersion = 1,
- ui32 planResolution = 50, ui32 timeCastBucketsPerMediator = 2,
+ ui64 createTxId = 100, ui64 createStep = 5000001,
+ ui64 parentPathId = 1, ui64 descrVersion = 1,
+ ui32 planResolution = 50, ui32 timeCastBucketsPerMediator = 2,
TVector<ui64> coordinators = {TTestTxConfig::FakeHiveTablets},
TVector<ui64> mediators = {TTestTxConfig::FakeHiveTablets+1, TTestTxConfig::FakeHiveTablets+2})
-{
- Y_UNUSED(createTxId);
- Y_UNUSED(schemeshardId);
- Y_UNUSED(createStep);
- Y_UNUSED(parentPathId);
-
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- NLs::PathExist(record);
- NLs::IsSubDomain(name)(record);
- NLs::SubDomainVersion(descrVersion)(record);
- NLs::DomainSettings(planResolution, timeCastBucketsPerMediator)(record);
+{
+ Y_UNUSED(createTxId);
+ Y_UNUSED(schemeshardId);
+ Y_UNUSED(createStep);
+ Y_UNUSED(parentPathId);
+
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ NLs::PathExist(record);
+ NLs::IsSubDomain(name)(record);
+ NLs::SubDomainVersion(descrVersion)(record);
+ NLs::DomainSettings(planResolution, timeCastBucketsPerMediator)(record);
NLs::DomainKey(pathId, TTestTxConfig::SchemeShard)(record);
- NLs::DomainCoordinators(coordinators)(record);
- NLs::DomainMediators(mediators)(record);
- };
-}
-
-NLs::TCheckFunc LsCheckSubDomainParamsInMassiveCase(const TString name = "",
+ NLs::DomainCoordinators(coordinators)(record);
+ NLs::DomainMediators(mediators)(record);
+ };
+}
+
+NLs::TCheckFunc LsCheckSubDomainParamsInMassiveCase(const TString name = "",
ui64 pathId = 2, ui64 schemeshardId = TTestTxConfig::SchemeShard,
- ui64 createTxId = 100, ui64 createStep = 5000001,
- ui64 parentPathId = 1, ui64 descrVersion = 1,
- ui32 planResolution = 10, ui32 timeCastBucketsPerMediator = 2,
+ ui64 createTxId = 100, ui64 createStep = 5000001,
+ ui64 parentPathId = 1, ui64 descrVersion = 1,
+ ui32 planResolution = 10, ui32 timeCastBucketsPerMediator = 2,
TVector<ui64> coordinators = {TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 1, TTestTxConfig::FakeHiveTablets + 2},
TVector<ui64> mediators = {TTestTxConfig::FakeHiveTablets + 3, TTestTxConfig::FakeHiveTablets + 4, TTestTxConfig::FakeHiveTablets + 5}) {
-
- Y_UNUSED(createTxId);
- Y_UNUSED(schemeshardId);
- Y_UNUSED(createStep);
- Y_UNUSED(parentPathId);
-
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- NLs::PathExist(record);
- NLs::IsSubDomain(name)(record);
- NLs::SubDomainVersion(descrVersion)(record);
- NLs::DomainSettings(planResolution, timeCastBucketsPerMediator)(record);
+
+ Y_UNUSED(createTxId);
+ Y_UNUSED(schemeshardId);
+ Y_UNUSED(createStep);
+ Y_UNUSED(parentPathId);
+
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ NLs::PathExist(record);
+ NLs::IsSubDomain(name)(record);
+ NLs::SubDomainVersion(descrVersion)(record);
+ NLs::DomainSettings(planResolution, timeCastBucketsPerMediator)(record);
NLs::DomainKey(pathId, TTestTxConfig::SchemeShard)(record);
- NLs::DomainCoordinators(coordinators)(record);
- NLs::DomainMediators(mediators)(record);
- };
-}
-
+ NLs::DomainCoordinators(coordinators)(record);
+ NLs::DomainMediators(mediators)(record);
+ };
+}
+
NLs::TCheckFunc LsCheckDiskQuotaExceeded(bool value = true) {
- return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ return [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
auto& desc = record.GetPathDescription().GetDomainDescription();
UNIT_ASSERT_VALUES_EQUAL(desc.GetDomainState().GetDiskQuotaExceeded(), value);
};
@@ -80,351 +80,351 @@ NLs::TCheckFunc LsCheckDiskQuotaExceeded(bool value = true) {
Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Y_UNIT_TEST(Create) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 3 "
- "Mediators: 3 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist});
- }
-
- Y_UNIT_TEST(RmDir) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 3 "
- "Mediators: 3 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, {100, 101});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist});
-
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 3 "
+ "Mediators: 3 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist});
+ }
+
+ Y_UNIT_TEST(RmDir) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 3 "
+ "Mediators: 3 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, {100, 101});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist});
+
TestRmDir(runtime, txId++, "/MyRoot", "USER_0", {NKikimrScheme::StatusPathIsNotDirectory});
- }
-
- Y_UNIT_TEST(CreateAndWait) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
- AsyncMkDir(runtime, txId++, "MyRoot", "dir");
- TestCreateSubDomain(runtime, txId++, "/MyRoot/dir",
- "StoragePools { "
- " Name: \"/dc-1/users/tenant-1:hdd\" "
- " Kind: \"hdd\" "
- "} "
- "StoragePools { "
- " Name: \"/dc-1/users/tenant-1:hdd-1\" "
- " Kind: \"hdd-1\" "
- "} "
- "Name: \"USER_0\"");
-
- env.TestWaitNotification(runtime, {100, 101});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/USER_0"),
- {NLs::PathExist,
- NLs::PathVersionEqual(3),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(0)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/dir"),
- {NLs::PathExist,
- NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(0)});
- }
-
+ }
+
+ Y_UNIT_TEST(CreateAndWait) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+ AsyncMkDir(runtime, txId++, "MyRoot", "dir");
+ TestCreateSubDomain(runtime, txId++, "/MyRoot/dir",
+ "StoragePools { "
+ " Name: \"/dc-1/users/tenant-1:hdd\" "
+ " Kind: \"hdd\" "
+ "} "
+ "StoragePools { "
+ " Name: \"/dc-1/users/tenant-1:hdd-1\" "
+ " Kind: \"hdd-1\" "
+ "} "
+ "Name: \"USER_0\"");
+
+ env.TestWaitNotification(runtime, {100, 101});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/dir/USER_0"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(3),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(0)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/dir"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(0)});
+ }
+
Y_UNIT_TEST(LS) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
-
- env.TestWaitNotification(runtime, 100);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {LsCheckSubDomainParamsInCommonCase("USER_0"),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(3)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
- }
-
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+
+ env.TestWaitNotification(runtime, 100);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {LsCheckSubDomainParamsInCommonCase("USER_0"),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(3)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+ }
+
Y_UNIT_TEST(ConcurrentCreateSubDomainAndDescribe) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- AsyncCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 10 "
- "Coordinators: 3 "
- "Mediators: 3 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathVersionOneOf({2, 3}),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(6)});
-
- env.TestWaitNotification(runtime, txId - 1);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {LsCheckSubDomainParamsInMassiveCase("USER_0"),
- NLs::PathVersionEqual(3)});
- }
-
-
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ AsyncCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 10 "
+ "Coordinators: 3 "
+ "Mediators: 3 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathVersionOneOf({2, 3}),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(6)});
+
+ env.TestWaitNotification(runtime, txId - 1);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {LsCheckSubDomainParamsInMassiveCase("USER_0"),
+ NLs::PathVersionEqual(3)});
+ }
+
+
Y_UNIT_TEST(CreataWithoutPlanResolution) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"",
- {NKikimrScheme::StatusInvalidParameter});
-
- env.TestWaitNotification(runtime, 100);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathNotExist});
- }
-
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"",
+ {NKikimrScheme::StatusInvalidParameter});
+
+ env.TestWaitNotification(runtime, 100);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathNotExist});
+ }
+
Y_UNIT_TEST(CreataWithoutTimeCastBuckets) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "Name: \"USER_0\"",
- {NKikimrScheme::StatusInvalidParameter});
-
- env.TestWaitNotification(runtime, 100);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathNotExist});
- }
-
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "Name: \"USER_0\"",
+ {NKikimrScheme::StatusInvalidParameter});
+
+ env.TestWaitNotification(runtime, 100);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathNotExist});
+ }
+
Y_UNIT_TEST(CreateWithNoEqualName) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist, NLs::IsSubDomain("USER_0")});
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"",
- {NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
-
- //########
-
- TestCreateTable(runtime, txId++, "/MyRoot",
- "Name: \"USER_1\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- );
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_1\"",
- {NKikimrScheme::StatusNameConflict});
-
- //########
-
- TestMkDir(runtime, txId++, "/MyRoot", "USER_2");
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_2\"",
- {NKikimrScheme::StatusNameConflict});
-
- //########
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_3\"");
-
- TestMkDir(runtime, txId++, "/MyRoot", "USER_3", {NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusAlreadyExists});
-
- env.TestWaitNotification(runtime, {100, 101, 102, 103, 104, 105, 106, 107});
-
- TestMkDir(runtime, txId++, "/MyRoot", "USER_3", {NKikimrScheme::StatusAlreadyExists});
-
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::IsSubDomain("USER_0")});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_1"),
- {NLs::PathExist, NLs::Finished, NLs::NotInSubdomain});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_2"),
- {NLs::PathExist, NLs::Finished, NLs::NotInSubdomain});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_3"),
- {NLs::IsSubDomain("USER_3")});
- }
-
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist, NLs::IsSubDomain("USER_0")});
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"",
+ {NKikimrScheme::StatusAlreadyExists, NKikimrScheme::StatusMultipleModifications});
+
+ //########
+
+ TestCreateTable(runtime, txId++, "/MyRoot",
+ "Name: \"USER_1\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ );
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_1\"",
+ {NKikimrScheme::StatusNameConflict});
+
+ //########
+
+ TestMkDir(runtime, txId++, "/MyRoot", "USER_2");
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_2\"",
+ {NKikimrScheme::StatusNameConflict});
+
+ //########
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_3\"");
+
+ TestMkDir(runtime, txId++, "/MyRoot", "USER_3", {NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusAlreadyExists});
+
+ env.TestWaitNotification(runtime, {100, 101, 102, 103, 104, 105, 106, 107});
+
+ TestMkDir(runtime, txId++, "/MyRoot", "USER_3", {NKikimrScheme::StatusAlreadyExists});
+
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::IsSubDomain("USER_0")});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_1"),
+ {NLs::PathExist, NLs::Finished, NLs::NotInSubdomain});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_2"),
+ {NLs::PathExist, NLs::Finished, NLs::NotInSubdomain});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_3"),
+ {NLs::IsSubDomain("USER_3")});
+ }
+
Y_UNIT_TEST(CreateItemsInsideSubdomain) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
-
- TestCreateTable(runtime, txId++, "/MyRoot/USER_0",
- "Name: \"table_0\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- );
-
- TestMkDir(runtime, txId++, "/MyRoot/USER_0", "dir_0");
-
- TestCreateTable(runtime, txId++, "/MyRoot/USER_0/dir_0",
- "Name: \"table_1\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- );
-
- env.TestWaitNotification(runtime, {100, 101, 102, 103});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::IsSubDomain("USER_0"),
- NLs::PathVersionEqual(7),
- NLs::PathsInsideDomain(3),
- NLs::ShardsInsideDomain(4)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table_0"),
- {NLs::InSubdomain,
- NLs::PathVersionEqual(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dir_0"),
- {NLs::InSubdomain,
- NLs::PathVersionEqual(5)});
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+
+ TestCreateTable(runtime, txId++, "/MyRoot/USER_0",
+ "Name: \"table_0\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ );
+
+ TestMkDir(runtime, txId++, "/MyRoot/USER_0", "dir_0");
+
+ TestCreateTable(runtime, txId++, "/MyRoot/USER_0/dir_0",
+ "Name: \"table_1\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ );
+
+ env.TestWaitNotification(runtime, {100, 101, 102, 103});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::IsSubDomain("USER_0"),
+ NLs::PathVersionEqual(7),
+ NLs::PathsInsideDomain(3),
+ NLs::ShardsInsideDomain(4)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table_0"),
+ {NLs::InSubdomain,
+ NLs::PathVersionEqual(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dir_0"),
+ {NLs::InSubdomain,
+ NLs::PathVersionEqual(5)});
TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dir_0/table_1"),
- {NLs::InSubdomain,
- NLs::PathVersionEqual(3)});
- }
-
+ {NLs::InSubdomain,
+ NLs::PathVersionEqual(3)});
+ }
+
Y_UNIT_TEST(CreateItemsInsideSubdomainWithStoragePools) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\""
- "StoragePools {"
- " Name: \"name_USER_0_kind_hdd-1\""
- " Kind: \"hdd-1\""
- "}"
- "StoragePools {"
- " Name: \"name_USER_0_kind_hdd-2\""
- " Kind: \"hdd-2\""
- "}");
-
- TestCreateTable(runtime, txId++, "/MyRoot/USER_0",
- "Name: \"table_0\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- );
-
- TestMkDir(runtime, txId++, "/MyRoot/USER_0", "dir_0");
-
- TestCreateTable(runtime, txId++, "/MyRoot/USER_0/dir_0",
- "Name: \"table_1\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- );
-
- env.TestWaitNotification(runtime, {100, 101, 102, 103});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::IsSubDomain("USER_0"),
- NLs::SubdomainWithNoEmptyStoragePools,
- NLs::PathsInsideDomain(3),
- NLs::ShardsInsideDomain(4)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table_0"),
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\""
+ "StoragePools {"
+ " Name: \"name_USER_0_kind_hdd-1\""
+ " Kind: \"hdd-1\""
+ "}"
+ "StoragePools {"
+ " Name: \"name_USER_0_kind_hdd-2\""
+ " Kind: \"hdd-2\""
+ "}");
+
+ TestCreateTable(runtime, txId++, "/MyRoot/USER_0",
+ "Name: \"table_0\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ );
+
+ TestMkDir(runtime, txId++, "/MyRoot/USER_0", "dir_0");
+
+ TestCreateTable(runtime, txId++, "/MyRoot/USER_0/dir_0",
+ "Name: \"table_1\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ );
+
+ env.TestWaitNotification(runtime, {100, 101, 102, 103});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::IsSubDomain("USER_0"),
+ NLs::SubdomainWithNoEmptyStoragePools,
+ NLs::PathsInsideDomain(3),
+ NLs::ShardsInsideDomain(4)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table_0"),
{NLs::InSubdomain});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dir_0"),
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dir_0"),
{NLs::InSubdomain});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dir_0/table_1"),
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dir_0/table_1"),
{NLs::InSubdomain});
- }
-
+ }
+
Y_UNIT_TEST(CreateSubDomainWithoutTablets) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "TimeCastBucketsPerMediator: 2 "
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "TimeCastBucketsPerMediator: 2 "
"Name: \"USER_0\"");
-
+
env.TestWaitNotification(runtime, 100);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist, NLs::PathsInsideDomain(0), NLs::ShardsInsideDomain(0)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(0)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist, NLs::PathsInsideDomain(0), NLs::ShardsInsideDomain(0)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(0)});
}
Y_UNIT_TEST(CreateSubDomainWithoutSomeTablets) {
@@ -432,28 +432,28 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
TTestEnv env(runtime);
ui64 txId = 100;
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "TimeCastBucketsPerMediator: 2 "
- "Coordinators: 1 "
- "Name: \"USER_1\"",
- {NKikimrScheme::StatusInvalidParameter});
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "TimeCastBucketsPerMediator: 2 "
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Coordinators: 1 "
+ "Name: \"USER_1\"",
+ {NKikimrScheme::StatusInvalidParameter});
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "TimeCastBucketsPerMediator: 2 "
"Mediators: 1 "
- "Name: \"USER_2\"",
- {NKikimrScheme::StatusInvalidParameter});
-
+ "Name: \"USER_2\"",
+ {NKikimrScheme::StatusInvalidParameter});
+
env.TestWaitNotification(runtime, {100, 101});
-
- TestLs(runtime, "/MyRoot/USER_1", false, NLs::PathNotExist);
- TestLs(runtime, "/MyRoot/USER_2", false, NLs::PathNotExist);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist, NLs::PathsInsideDomain(0), NLs::ShardsInsideDomain(0)});
- }
-
+
+ TestLs(runtime, "/MyRoot/USER_1", false, NLs::PathNotExist);
+ TestLs(runtime, "/MyRoot/USER_2", false, NLs::PathNotExist);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist, NLs::PathsInsideDomain(0), NLs::ShardsInsideDomain(0)});
+ }
+
Y_UNIT_TEST(CreateSubDomainWithoutTabletsThenMkDir) {
TTestBasicRuntime runtime;
TTestEnv env(runtime);
@@ -470,12 +470,12 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
env.TestWaitNotification(runtime, 101);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(0)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(0)});
- TestLs(runtime, "/MyRoot/USER_0/MyDir", false, NLs::PathExist);
-
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(0)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(0)});
+ TestLs(runtime, "/MyRoot/USER_0/MyDir", false, NLs::PathExist);
+
}
Y_UNIT_TEST(CreateSubDomainWithoutTabletsThenDrop) {
@@ -496,200 +496,200 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
env.TestWaitNotification(runtime, 101);
- TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathNotExist);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist, NLs::PathsInsideDomain(0), NLs::ShardsInsideDomain(0)});
+ TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathNotExist);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist, NLs::PathsInsideDomain(0), NLs::ShardsInsideDomain(0)});
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 2));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 2));
}
- Y_UNIT_TEST(CreateSubDomainWithoutTabletsThenForceDrop) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
-
- env.TestWaitNotification(runtime, 100);
+ Y_UNIT_TEST(CreateSubDomainWithoutTabletsThenForceDrop) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+
+ env.TestWaitNotification(runtime, 100);
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 2));
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 2));
-
- TestForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
-
- env.TestWaitNotification(runtime, 101);
-
- TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathNotExist);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist, NLs::PathsInsideDomain(0), NLs::ShardsInsideDomain(0)});
+
+ TestForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
+
+ env.TestWaitNotification(runtime, 101);
+
+ TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathNotExist);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist, NLs::PathsInsideDomain(0), NLs::ShardsInsideDomain(0)});
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 2));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 2));
- }
-
+ }
+
Y_UNIT_TEST(CreateSubDomainsInSeparateDir) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestMkDir(runtime, txId++, "/MyRoot", "SubDomains");
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot/SubDomains",
- "PlanResolution: 50 "
- "Coordinators: 3 "
- "Mediators: 3 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot/SubDomains",
- "PlanResolution: 50 "
- "Coordinators: 3 "
- "Mediators: 3 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_1\"");
-
- env.TestWaitNotification(runtime, {100, 101, 102});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/SubDomains/USER_0"),
- {NLs::PathExist,
- NLs::InSubdomain,
- NLs::PathVersionEqual(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/SubDomains/USER_1"),
- {NLs::PathExist,
- NLs::InSubdomain,
- NLs::PathVersionEqual(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/SubDomains"),
- {NLs::PathExist,
- NLs::NotInSubdomain,
- NLs::PathVersionEqual(7),
- NLs::PathsInsideDomain(3),
- NLs::ShardsInsideDomain(0)});
- }
-
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestMkDir(runtime, txId++, "/MyRoot", "SubDomains");
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot/SubDomains",
+ "PlanResolution: 50 "
+ "Coordinators: 3 "
+ "Mediators: 3 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot/SubDomains",
+ "PlanResolution: 50 "
+ "Coordinators: 3 "
+ "Mediators: 3 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_1\"");
+
+ env.TestWaitNotification(runtime, {100, 101, 102});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/SubDomains/USER_0"),
+ {NLs::PathExist,
+ NLs::InSubdomain,
+ NLs::PathVersionEqual(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/SubDomains/USER_1"),
+ {NLs::PathExist,
+ NLs::InSubdomain,
+ NLs::PathVersionEqual(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/SubDomains"),
+ {NLs::PathExist,
+ NLs::NotInSubdomain,
+ NLs::PathVersionEqual(7),
+ NLs::PathsInsideDomain(3),
+ NLs::ShardsInsideDomain(0)});
+ }
+
Y_UNIT_TEST(SimultaneousCreateDelete) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- AsyncCreateSubDomain(runtime, ++txId, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 3 "
- "Mediators: 3 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- AsyncDropSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
- TestModificationResult(runtime, txId-1);
- ui64 whatHappened = TestModificationResults(runtime, txId, {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
- env.TestWaitNotification(runtime, {txId, txId-1});
-
- if (whatHappened == NKikimrScheme::StatusAccepted) {
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::NotInSubdomain,
- NLs::PathsInsideDomain(0),
- NLs::NoChildren});
- } else {
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::NotInSubdomain,
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
- }
- }
-
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ AsyncCreateSubDomain(runtime, ++txId, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 3 "
+ "Mediators: 3 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ AsyncDropSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
+ TestModificationResult(runtime, txId-1);
+ ui64 whatHappened = TestModificationResults(runtime, txId, {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
+ env.TestWaitNotification(runtime, {txId, txId-1});
+
+ if (whatHappened == NKikimrScheme::StatusAccepted) {
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::NotInSubdomain,
+ NLs::PathsInsideDomain(0),
+ NLs::NoChildren});
+ } else {
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::NotInSubdomain,
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+ }
+ }
+
Y_UNIT_TEST(SimultaneousCreateForceDrop) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 3 "
- "Mediators: 3 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
-
- TestForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
-
- env.TestWaitNotification(runtime, {100, 101});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::Finished,
- NLs::NotInSubdomain,
- NLs::PathVersionEqual(7), // it is 6 if drop simultaneous with create
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomainOneOf({0, 1, 2, 3})});
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 3 "
+ "Mediators: 3 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+
+ TestForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
+
+ env.TestWaitNotification(runtime, {100, 101});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::Finished,
+ NLs::NotInSubdomain,
+ NLs::PathVersionEqual(7), // it is 6 if drop simultaneous with create
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomainOneOf({0, 1, 2, 3})});
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 2));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 2));
- }
-
+ }
+
Y_UNIT_TEST(ForceDropTwice) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, ++txId, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 3 "
- "Mediators: 3 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
-
- env.TestWaitNotification(runtime, txId);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist});
-
-
- AsyncForceDropSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
- AsyncForceDropSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
-
- SkipModificationReply(runtime, 2);
- env.TestWaitNotification(runtime, {txId-1, txId});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::NoChildren,
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(0)});
- }
-
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, ++txId, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 3 "
+ "Mediators: 3 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+
+ env.TestWaitNotification(runtime, txId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist});
+
+
+ AsyncForceDropSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
+ AsyncForceDropSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
+
+ SkipModificationReply(runtime, 2);
+ env.TestWaitNotification(runtime, {txId-1, txId});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::NoChildren,
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(0)});
+ }
+
Y_UNIT_TEST(SimultaneousCreateForceDropTwice) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- AsyncCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 3 "
- "Mediators: 3 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
-
- AsyncForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
- AsyncForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
-
- env.TestWaitNotification(runtime, {100, 101, 102});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::NoChildren,
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomainOneOf({0, 1, 2, 3, 4, 5, 6})});
- }
-
- Y_UNIT_TEST(CopyRejects) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ AsyncCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 3 "
+ "Mediators: 3 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+
+ AsyncForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
+ AsyncForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
+
+ env.TestWaitNotification(runtime, {100, 101, 102});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::NoChildren,
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomainOneOf({0, 1, 2, 3, 4, 5, 6})});
+ }
+
+ Y_UNIT_TEST(CopyRejects) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
TestCreateSubDomain(runtime, ++txId, "/MyRoot", R"(
StoragePools {
Name: "/dc-1/users/tenant-1:hdd"
@@ -701,20 +701,20 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
TimeCastBucketsPerMediator: 2
Name: "USER_0"
)");
-
- TestCreateSubDomain(runtime, ++txId, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_1\"");
-
- TestCreateTable(runtime, ++txId, "/MyRoot/USER_0",
- "Name: \"src\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]");
-
+
+ TestCreateSubDomain(runtime, ++txId, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_1\"");
+
+ TestCreateTable(runtime, ++txId, "/MyRoot/USER_0",
+ "Name: \"src\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]");
+
TestCreateTable(runtime, ++txId, "/MyRoot/USER_0", R"(
Name: "ex_blobs"
Columns { Name: "key" Type: "Uint64" }
@@ -741,459 +741,459 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
}
}
)");
-
+
env.TestWaitNotification(runtime, {100, 101, 102, 103, 104});
- TestCopyTable(runtime, ++txId, "/MyRoot/USER_1", "dst", "/MyRoot/USER_0/src", NKikimrScheme::StatusInvalidParameter);
- TestCopyTable(runtime, ++txId, "/MyRoot", "dst", "/MyRoot/USER_0/src", NKikimrScheme::StatusInvalidParameter);
- TestCopyTable(runtime, ++txId, "/MyRoot/USER_0", "ex_blobs_copy", "/MyRoot/USER_0/ex_blobs", NKikimrScheme::StatusPreconditionFailed);
- }
-
- Y_UNIT_TEST(ConsistentCopyRejects) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
-
- TestCreateTable(runtime, txId++, "/MyRoot/USER_0",
- "Name: \"table\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- );
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_1\"");
-
- TestCreateTable(runtime, txId++, "/MyRoot/USER_1",
- "Name: \"table\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- );
-
- env.TestWaitNotification(runtime, {100, 101, 102, 103});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::InSubdomain,
- NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(3)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table"),
- {NLs::PathExist,
- NLs::InSubdomain,
- NLs::PathVersionEqual(3)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_1"),
- {NLs::PathExist,
- NLs::InSubdomain,
- NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(3)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_1/table"),
- {NLs::PathExist,
- NLs::InSubdomain,
- NLs::PathVersionEqual(3)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::NotInSubdomain,
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(0)});
-
+ TestCopyTable(runtime, ++txId, "/MyRoot/USER_1", "dst", "/MyRoot/USER_0/src", NKikimrScheme::StatusInvalidParameter);
+ TestCopyTable(runtime, ++txId, "/MyRoot", "dst", "/MyRoot/USER_0/src", NKikimrScheme::StatusInvalidParameter);
+ TestCopyTable(runtime, ++txId, "/MyRoot/USER_0", "ex_blobs_copy", "/MyRoot/USER_0/ex_blobs", NKikimrScheme::StatusPreconditionFailed);
+ }
+
+ Y_UNIT_TEST(ConsistentCopyRejects) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+
+ TestCreateTable(runtime, txId++, "/MyRoot/USER_0",
+ "Name: \"table\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ );
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_1\"");
+
+ TestCreateTable(runtime, txId++, "/MyRoot/USER_1",
+ "Name: \"table\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ );
+
+ env.TestWaitNotification(runtime, {100, 101, 102, 103});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::InSubdomain,
+ NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(3)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table"),
+ {NLs::PathExist,
+ NLs::InSubdomain,
+ NLs::PathVersionEqual(3)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_1"),
+ {NLs::PathExist,
+ NLs::InSubdomain,
+ NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(3)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_1/table"),
+ {NLs::PathExist,
+ NLs::InSubdomain,
+ NLs::PathVersionEqual(3)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::NotInSubdomain,
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(0)});
+
TestConsistentCopyTables(runtime, txId++, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/USER_0/table"
- DstPath: "/MyRoot/USER_1/dst"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/USER_1/table"
- DstPath: "/MyRoot/USER_0/dst"
- })", {NKikimrScheme::StatusInvalidParameter});
-
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/USER_0/table"
+ DstPath: "/MyRoot/USER_1/dst"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/USER_1/table"
+ DstPath: "/MyRoot/USER_0/dst"
+ })", {NKikimrScheme::StatusInvalidParameter});
+
TestConsistentCopyTables(runtime, txId++, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/USER_0/table"
- DstPath: "/MyRoot/USER_0/dst"
- }
- CopyTableDescriptions {
- SrcPath: "/MyRoot/USER_1/table"
- DstPath: "/MyRoot/USER_1/dst"
- })", {NKikimrScheme::StatusInvalidParameter});
-
-
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/USER_0/table"
+ DstPath: "/MyRoot/USER_0/dst"
+ }
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/USER_1/table"
+ DstPath: "/MyRoot/USER_1/dst"
+ })", {NKikimrScheme::StatusInvalidParameter});
+
+
TestConsistentCopyTables(runtime, txId++, "/", R"(
- CopyTableDescriptions {
- SrcPath: "/MyRoot/USER_0/table"
- DstPath: "/MyRoot/USER_0/dst"
- })");
-
- env.TestWaitNotification(runtime, txId-1);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table"),
- {NLs::PathExist,
- NLs::InSubdomain,
- NLs::PathVersionEqual(3)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dst"),
- {NLs::PathExist,
- NLs::InSubdomain,
- NLs::PathVersionEqual(3)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::InSubdomain,
- NLs::PathVersionEqual(7),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(4)});
- }
-
-
- Y_UNIT_TEST(SimultaneousCreateTableFroceDrop) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 10 "
- "Coordinators: 3 "
- "Mediators: 3 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, 100);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathVersionEqual(3)});
-
- TestCreateTable(runtime, txId++, "/MyRoot/USER_0",
- "Name: \"table_0\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- );
- TestForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
- env.TestWaitNotification(runtime, {101, 102});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table_0"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomainOneOf({0, 1, 2, 3, 4, 5, 6})});
+ CopyTableDescriptions {
+ SrcPath: "/MyRoot/USER_0/table"
+ DstPath: "/MyRoot/USER_0/dst"
+ })");
+
+ env.TestWaitNotification(runtime, txId-1);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table"),
+ {NLs::PathExist,
+ NLs::InSubdomain,
+ NLs::PathVersionEqual(3)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dst"),
+ {NLs::PathExist,
+ NLs::InSubdomain,
+ NLs::PathVersionEqual(3)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::InSubdomain,
+ NLs::PathVersionEqual(7),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(4)});
+ }
+
+
+ Y_UNIT_TEST(SimultaneousCreateTableFroceDrop) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 10 "
+ "Coordinators: 3 "
+ "Mediators: 3 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, 100);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(3)});
+
+ TestCreateTable(runtime, txId++, "/MyRoot/USER_0",
+ "Name: \"table_0\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ );
+ TestForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
+ env.TestWaitNotification(runtime, {101, 102});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table_0"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomainOneOf({0, 1, 2, 3, 4, 5, 6})});
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 2));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 2));
- }
-
- Y_UNIT_TEST(SimultaneousCreateTenantTableFroceDrop) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 10 "
- "Coordinators: 3 "
- "Mediators: 3 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
-
- TestCreateTable(runtime, txId++, "/MyRoot/USER_0",
- "Name: \"table_0\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- );
-
- TestForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
-
- env.TestWaitNotification(runtime, {100, 101, 102});
- TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathNotExist);
- TestLs(runtime, "/MyRoot/USER_0/table_0", false, NLs::PathNotExist);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::PathVersionEqual(7), // version 6 if deletion is simultaneous with creation
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(0)});
+ }
+
+ Y_UNIT_TEST(SimultaneousCreateTenantTableFroceDrop) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 10 "
+ "Coordinators: 3 "
+ "Mediators: 3 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+
+ TestCreateTable(runtime, txId++, "/MyRoot/USER_0",
+ "Name: \"table_0\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ );
+
+ TestForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
+
+ env.TestWaitNotification(runtime, {100, 101, 102});
+ TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathNotExist);
+ TestLs(runtime, "/MyRoot/USER_0/table_0", false, NLs::PathNotExist);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(7), // version 6 if deletion is simultaneous with creation
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(0)});
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 2));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 2));
- }
-
+ }
+
Y_UNIT_TEST(SimultaneousCreateTenantTable) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- AsyncCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 10 "
- "Coordinators: 3 "
- "Mediators: 3 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
-
- AsyncCreateTable(runtime, txId++, "/MyRoot/USER_0",
- "Name: \"table_0\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- );
-
- env.TestWaitNotification(runtime, {100, 101});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {LsCheckSubDomainParamsInMassiveCase("USER_0"),
- NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(7)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table_0"),
- {NLs::InSubdomain});
- }
-
- Y_UNIT_TEST(SimultaneousDeclareAndCreateTable) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- AsyncCreateSubDomain(runtime, txId++, "/MyRoot",
- "Name: \"USER_0\"");
-
- AsyncCreateTable(runtime, txId++, "/MyRoot/USER_0",
- "Name: \"table_0\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- );
- TestModificationResult(runtime, txId - 2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId - 1, NKikimrScheme::StatusNameConflict);
-
- env.TestWaitNotification(runtime, {txId - 2, txId - 1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathVersionEqual(3),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(0)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table_0"),
- {NLs::PathNotExist});
- }
-
- Y_UNIT_TEST(SimultaneousDefineAndCreateTable) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, txId - 1);
-
- AsyncAlterSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 10 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
-
- AsyncCreateTable(runtime, txId++, "/MyRoot/USER_0",
- "Name: \"table_0\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- );
- TestModificationResult(runtime, txId - 2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId - 1, NKikimrScheme::StatusAccepted);
-
- env.TestWaitNotification(runtime, {txId - 2, txId - 1});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {LsCheckSubDomainParamsAfterAlter("USER_0"),
- NLs::PathVersionEqual(6),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(4)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table_0"),
- {NLs::PathExist});
- }
-
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ AsyncCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 10 "
+ "Coordinators: 3 "
+ "Mediators: 3 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+
+ AsyncCreateTable(runtime, txId++, "/MyRoot/USER_0",
+ "Name: \"table_0\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ );
+
+ env.TestWaitNotification(runtime, {100, 101});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {LsCheckSubDomainParamsInMassiveCase("USER_0"),
+ NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(7)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table_0"),
+ {NLs::InSubdomain});
+ }
+
+ Y_UNIT_TEST(SimultaneousDeclareAndCreateTable) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ AsyncCreateSubDomain(runtime, txId++, "/MyRoot",
+ "Name: \"USER_0\"");
+
+ AsyncCreateTable(runtime, txId++, "/MyRoot/USER_0",
+ "Name: \"table_0\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ );
+ TestModificationResult(runtime, txId - 2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId - 1, NKikimrScheme::StatusNameConflict);
+
+ env.TestWaitNotification(runtime, {txId - 2, txId - 1});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathVersionEqual(3),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(0)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table_0"),
+ {NLs::PathNotExist});
+ }
+
+ Y_UNIT_TEST(SimultaneousDefineAndCreateTable) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, txId - 1);
+
+ AsyncAlterSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 10 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+
+ AsyncCreateTable(runtime, txId++, "/MyRoot/USER_0",
+ "Name: \"table_0\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ );
+ TestModificationResult(runtime, txId - 2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId - 1, NKikimrScheme::StatusAccepted);
+
+ env.TestWaitNotification(runtime, {txId - 2, txId - 1});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {LsCheckSubDomainParamsAfterAlter("USER_0"),
+ NLs::PathVersionEqual(6),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(4)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/table_0"),
+ {NLs::PathExist});
+ }
+
Y_UNIT_TEST(SimultaneousCreateTenantDirTable) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- AsyncCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 10 "
- "Coordinators: 3 "
- "Mediators: 3 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
-
- AsyncMkDir(runtime, txId++, "/MyRoot/USER_0", "dir");
-
- AsyncCreateTable(runtime, txId++, "/MyRoot/USER_0/dir",
- "Name: \"table_0\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- );
-
- env.TestWaitNotification(runtime, {100, 101, 102});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {LsCheckSubDomainParamsInMassiveCase("USER_0"),
- NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(7)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dir/table_0"),
- {NLs::InSubdomain});
-
- TestForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
- env.TestWaitNotification(runtime, 103);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::NoChildren,
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(0)});
- }
-
- Y_UNIT_TEST(CreateForceDropSolomon) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot", "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\" ");
-
- TestCreateSolomon(runtime, txId++, "/MyRoot/USER_0", "Name: \"Solomon\" "
- "PartitionCount: 40 ");
- env.TestWaitNotification(runtime, {txId-2, txId-1});
-
- TestLs(runtime, "/MyRoot/USER_0/Solomon", false, NLs::InSubdomain);
-
- // Already exists
- TestCreateSolomon(runtime, txId++, "/MyRoot/USER_0", "Name: \"Solomon\" "
- "PartitionCount: 40 ",
- {NKikimrScheme::StatusAlreadyExists});
-
- TestForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
- env.TestWaitNotification(runtime, txId-1);
-
- TestLs(runtime, "/MyRoot/USER_0/Solomon", false, NLs::PathNotExist);
- TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathNotExist);
- }
-
- Y_UNIT_TEST(CreateDropSolomon) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot", "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\" ");
-
- TestCreateSolomon(runtime, txId++, "/MyRoot/USER_0", "Name: \"Solomon\" "
- "PartitionCount: 40 ");
- env.TestWaitNotification(runtime, {txId-2, txId-1});
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ AsyncCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 10 "
+ "Coordinators: 3 "
+ "Mediators: 3 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+
+ AsyncMkDir(runtime, txId++, "/MyRoot/USER_0", "dir");
+
+ AsyncCreateTable(runtime, txId++, "/MyRoot/USER_0/dir",
+ "Name: \"table_0\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ );
+
+ env.TestWaitNotification(runtime, {100, 101, 102});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {LsCheckSubDomainParamsInMassiveCase("USER_0"),
+ NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(7)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/dir/table_0"),
+ {NLs::InSubdomain});
+
+ TestForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
+ env.TestWaitNotification(runtime, 103);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::NoChildren,
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(0)});
+ }
+
+ Y_UNIT_TEST(CreateForceDropSolomon) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot", "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\" ");
+
+ TestCreateSolomon(runtime, txId++, "/MyRoot/USER_0", "Name: \"Solomon\" "
+ "PartitionCount: 40 ");
+ env.TestWaitNotification(runtime, {txId-2, txId-1});
+
+ TestLs(runtime, "/MyRoot/USER_0/Solomon", false, NLs::InSubdomain);
+
+ // Already exists
+ TestCreateSolomon(runtime, txId++, "/MyRoot/USER_0", "Name: \"Solomon\" "
+ "PartitionCount: 40 ",
+ {NKikimrScheme::StatusAlreadyExists});
+
+ TestForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
+ env.TestWaitNotification(runtime, txId-1);
+
+ TestLs(runtime, "/MyRoot/USER_0/Solomon", false, NLs::PathNotExist);
+ TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathNotExist);
+ }
+
+ Y_UNIT_TEST(CreateDropSolomon) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot", "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\" ");
+
+ TestCreateSolomon(runtime, txId++, "/MyRoot/USER_0", "Name: \"Solomon\" "
+ "PartitionCount: 40 ");
+ env.TestWaitNotification(runtime, {txId-2, txId-1});
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 2));
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 2));
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SolomonVolumes", "PathId", 3));
-
- TestLs(runtime, "/MyRoot", false);
- TestLs(runtime, "/MyRoot/USER_0", false, NLs::InSubdomain);
- TestLs(runtime, "/MyRoot/USER_0/Solomon", false, NLs::InSubdomain);
-
- // Already exists
- TestCreateSolomon(runtime, txId++, "/MyRoot/USER_0", "Name: \"Solomon\" "
- "PartitionCount: 40 ",
- {NKikimrScheme::StatusAlreadyExists});
-
- TestDropSolomon(runtime, txId++, "/MyRoot/USER_0", "Solomon");
- env.TestWaitNotification(runtime, txId-1);
+
+ TestLs(runtime, "/MyRoot", false);
+ TestLs(runtime, "/MyRoot/USER_0", false, NLs::InSubdomain);
+ TestLs(runtime, "/MyRoot/USER_0/Solomon", false, NLs::InSubdomain);
+
+ // Already exists
+ TestCreateSolomon(runtime, txId++, "/MyRoot/USER_0", "Name: \"Solomon\" "
+ "PartitionCount: 40 ",
+ {NKikimrScheme::StatusAlreadyExists});
+
+ TestDropSolomon(runtime, txId++, "/MyRoot/USER_0", "Solomon");
+ env.TestWaitNotification(runtime, txId-1);
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SolomonVolumes", "PathId", 3));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
-
- TestForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
- env.TestWaitNotification(runtime, txId-1);
+
+ TestForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
+ env.TestWaitNotification(runtime, txId-1);
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 2));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 2));
-
- TestLs(runtime, "/MyRoot/USER_0/Solomon", false, NLs::PathNotExist);
- TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathNotExist);
- }
-
- Y_UNIT_TEST(CreateDropNbs) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\" "
- "StoragePools {"
- " Name: \"name_USER_0_kind_hdd-1\""
- " Kind: \"storage-pool-number-1\""
- "}"
- "StoragePools {"
- " Name: \"name_USER_0_kind_hdd-2\""
- " Kind: \"storage-pool-number-2\""
- "}");
-
- TestCreateBlockStoreVolume(runtime, txId++, "/MyRoot/USER_0",
- "Name: \"BSVolume\" "
+
+ TestLs(runtime, "/MyRoot/USER_0/Solomon", false, NLs::PathNotExist);
+ TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathNotExist);
+ }
+
+ Y_UNIT_TEST(CreateDropNbs) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\" "
+ "StoragePools {"
+ " Name: \"name_USER_0_kind_hdd-1\""
+ " Kind: \"storage-pool-number-1\""
+ "}"
+ "StoragePools {"
+ " Name: \"name_USER_0_kind_hdd-2\""
+ " Kind: \"storage-pool-number-2\""
+ "}");
+
+ TestCreateBlockStoreVolume(runtime, txId++, "/MyRoot/USER_0",
+ "Name: \"BSVolume\" "
"VolumeConfig: { "
" ExplicitChannelProfiles { PoolKind: \"storage-pool-number-1\"}"
" ExplicitChannelProfiles { PoolKind: \"storage-pool-number-1\"}"
" ExplicitChannelProfiles { PoolKind: \"storage-pool-number-1\"}"
" ExplicitChannelProfiles { PoolKind: \"storage-pool-number-2\"}"
" BlockSize: 4096 Partitions { BlockCount: 16 } } ");
-
- env.TestWaitNotification(runtime, {txId-2, txId-1});
+
+ env.TestWaitNotification(runtime, {txId-2, txId-1});
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 2));
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 2));
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "BlockStoreVolumes", "PathId", 3));
-
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
{NLs::SubdomainWithNoEmptyStoragePools});
TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/BSVolume"),
{NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(4)});
-
- TestForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
- env.TestWaitNotification(runtime, txId-1);
+ NLs::ShardsInsideDomain(4)});
+
+ TestForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
+ env.TestWaitNotification(runtime, txId-1);
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "BlockStoreVolumes", "PathId", 3));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 2));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 2));
-
- TestLs(runtime, "/MyRoot/USER_0/BSVolume", false, NLs::PathNotExist);
- TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathNotExist);
- }
-
+
+ TestLs(runtime, "/MyRoot/USER_0/BSVolume", false, NLs::PathNotExist);
+ TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathNotExist);
+ }
+
Y_UNIT_TEST(CreateAlterNbsChannels) {
TTestBasicRuntime runtime;
TTestEnv env(runtime, /* nchannels */ 3 + 4);
@@ -1214,7 +1214,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
" Kind: \"storage-pool-number-2\""
"}");
- NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
+ NKikimrSchemeOp::TBlockStoreVolumeDescription vdescr;
vdescr.SetName("BSVolume");
auto& vc = *vdescr.MutableVolumeConfig();
vc.SetBlockSize(4096);
@@ -1330,237 +1330,237 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Y_UNIT_TEST(Restart) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, 100);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathVersionEqual(3),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(3)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
-
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, 100);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(3),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(3)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+
TActorId sender = runtime.AllocateEdgeActor();
RebootTablet(runtime, TTestTxConfig::SchemeShard, sender);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathVersionEqual(3),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(3)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
- }
-
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(3),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(3)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+ }
+
Y_UNIT_TEST(RestartAtInFly) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
-
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+
TActorId sender = runtime.AllocateEdgeActor();
RebootTablet(runtime, TTestTxConfig::SchemeShard, sender);
-
- env.TestWaitNotification(runtime, 100);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathVersionEqual(3),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(3)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
- }
-
+
+ env.TestWaitNotification(runtime, 100);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(3),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(3)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+ }
+
Y_UNIT_TEST(Delete) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
-
- env.TestWaitNotification(runtime, txId - 1);
-
- TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathExist);
-
- TestDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
-
- env.TestWaitNotification(runtime, txId - 1);
- TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathNotExist);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomainOneOf({0, 1, 2, 3})});
-
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+
+ env.TestWaitNotification(runtime, txId - 1);
+
+ TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathExist);
+
+ TestDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
+
+ env.TestWaitNotification(runtime, txId - 1);
+ TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathNotExist);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomainOneOf({0, 1, 2, 3})});
+
env.TestWaitTabletDeletion(runtime, {TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+1, TTestTxConfig::FakeHiveTablets+2});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(0)});
-
- }
-
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(0)});
+
+ }
+
Y_UNIT_TEST(DeleteAdd) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 3 "
- "Mediators: 3 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, 100);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist});
-
- TestDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
- env.TestWaitNotification(runtime, 101);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathNotExist});
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 3 "
- "Mediators: 3 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, 102);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathVersionEqual(3),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(6)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
- }
-
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 3 "
+ "Mediators: 3 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, 100);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist});
+
+ TestDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
+ env.TestWaitNotification(runtime, 101);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathNotExist});
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 3 "
+ "Mediators: 3 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, 102);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(3),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(6)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+ }
+
Y_UNIT_TEST(DeleteAndRestart) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 2 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
-
- env.TestWaitNotification(runtime, 100);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(4)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
-
- TestDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
-
- {
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 2 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+
+ env.TestWaitNotification(runtime, 100);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(4)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+
+ TestDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
+
+ {
TActorId sender = runtime.AllocateEdgeActor();
RebootTablet(runtime, TTestTxConfig::SchemeShard, sender);
- }
-
- env.TestWaitNotification(runtime, 101);
- TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathNotExist);
-
- {
+ }
+
+ env.TestWaitNotification(runtime, 101);
+ TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathNotExist);
+
+ {
TActorId sender = runtime.AllocateEdgeActor();
RebootTablet(runtime, TTestTxConfig::SchemeShard, sender);
- }
-
- TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathNotExist);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(0)});
- }
-
- Y_UNIT_TEST(RedefineErrors) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, 100);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {LsCheckSubDomainParamsInCommonCase("USER_0"),
- NLs::PathVersionEqual(3)});
-
- TestAlterSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 2 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"",
- {NKikimrScheme::StatusInvalidParameter});
-
- TestAlterSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, 102);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {LsCheckSubDomainParamsAfterAlter("USER_0", 2),
- NLs::PathVersionEqual(4)});
-
- TestAlterSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 10 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"",
- {NKikimrScheme::StatusInvalidParameter});
-
- TestAlterSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
+ }
+
+ TestLs(runtime, "/MyRoot/USER_0", false, NLs::PathNotExist);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(0)});
+ }
+
+ Y_UNIT_TEST(RedefineErrors) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, 100);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {LsCheckSubDomainParamsInCommonCase("USER_0"),
+ NLs::PathVersionEqual(3)});
+
+ TestAlterSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 2 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"",
+ {NKikimrScheme::StatusInvalidParameter});
+
+ TestAlterSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, 102);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {LsCheckSubDomainParamsAfterAlter("USER_0", 2),
+ NLs::PathVersionEqual(4)});
+
+ TestAlterSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 10 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"",
+ {NKikimrScheme::StatusInvalidParameter});
+
+ TestAlterSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
"StoragePools { "
" Name: \"pool-1\" "
" Kind: \"pool-kind-1\" "
@@ -1569,22 +1569,22 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
" Name: \"pool-2\" "
" Kind: \"pool-kind-2\" "
"} "
- "StoragePools {"
- " Name: \"pool-hdd-1\""
- " Kind: \"hdd-1\""
- "}"
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, 104);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::StoragePoolsEqual({"pool-1", "pool-2", "pool-hdd-1"}),
- NLs::PathVersionEqual(5)});
-
- TestAlterSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
+ "StoragePools {"
+ " Name: \"pool-hdd-1\""
+ " Kind: \"hdd-1\""
+ "}"
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, 104);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::StoragePoolsEqual({"pool-1", "pool-2", "pool-hdd-1"}),
+ NLs::PathVersionEqual(5)});
+
+ TestAlterSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
"StoragePools { "
" Name: \"pool-1\" "
" Kind: \"pool-kind-1\" "
@@ -1593,18 +1593,18 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
" Name: \"pool-2\" "
" Kind: \"pool-kind-2\" "
"} "
- "StoragePools {"
- " Name: \"pool-hdd-2\""
- " Kind: \"hdd-1\""
- "}"
- "Name: \"USER_0\"",
- {NKikimrScheme::StatusInvalidParameter});
-
- TestAlterSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
+ "StoragePools {"
+ " Name: \"pool-hdd-2\""
+ " Kind: \"hdd-1\""
+ "}"
+ "Name: \"USER_0\"",
+ {NKikimrScheme::StatusInvalidParameter});
+
+ TestAlterSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
"StoragePools { "
" Name: \"pool-1\" "
" Kind: \"pool-kind-1\" "
@@ -1613,34 +1613,34 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
" Name: \"pool-2\" "
" Kind: \"pool-kind-2\" "
"} "
- "StoragePools {"
- " Name: \"pool-hdd-1\""
- " Kind: \"hdd-1\""
- "}"
- "StoragePools {"
- " Name: \"pool-hdd-2\""
- " Kind: \"hdd-1\""
- "}"
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, 106);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::StoragePoolsEqual({"pool-1", "pool-2", "pool-hdd-1", "pool-hdd-2"}),
- NLs::PathVersionEqual(6)});
-
- TestAlterSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, 107);
-
- TestAlterSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
+ "StoragePools {"
+ " Name: \"pool-hdd-1\""
+ " Kind: \"hdd-1\""
+ "}"
+ "StoragePools {"
+ " Name: \"pool-hdd-2\""
+ " Kind: \"hdd-1\""
+ "}"
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, 106);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::StoragePoolsEqual({"pool-1", "pool-2", "pool-hdd-1", "pool-hdd-2"}),
+ NLs::PathVersionEqual(6)});
+
+ TestAlterSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, 107);
+
+ TestAlterSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
"StoragePools { "
" Name: \"pool-1\" "
" Kind: \"pool-kind-1\" "
@@ -1649,191 +1649,191 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
" Name: \"pool-2\" "
" Kind: \"pool-kind-2\" "
"} "
- "StoragePools {"
- " Name: \"pool-hdd-1\""
- " Kind: \"hdd-1\""
- "}"
- "StoragePools {"
- " Name: \"pool-hdd-2\""
- " Kind: \"hdd-1\""
- "}"
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, 108);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::StoragePoolsEqual({"pool-1", "pool-2", "pool-hdd-1", "pool-hdd-2"}),
- NLs::PathVersionEqual(8)});
- }
-
- Y_UNIT_TEST(SimultaneousDeclare) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- AsyncCreateSubDomain(runtime, txId++, "/MyRoot",
- "Name: \"USER_0\"");
- AsyncCreateSubDomain(runtime, txId++, "/MyRoot",
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, {100, 101});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::Finished, NLs::PathVersionEqual(3)});
- }
-
-
+ "StoragePools {"
+ " Name: \"pool-hdd-1\""
+ " Kind: \"hdd-1\""
+ "}"
+ "StoragePools {"
+ " Name: \"pool-hdd-2\""
+ " Kind: \"hdd-1\""
+ "}"
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, 108);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::StoragePoolsEqual({"pool-1", "pool-2", "pool-hdd-1", "pool-hdd-2"}),
+ NLs::PathVersionEqual(8)});
+ }
+
+ Y_UNIT_TEST(SimultaneousDeclare) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ AsyncCreateSubDomain(runtime, txId++, "/MyRoot",
+ "Name: \"USER_0\"");
+ AsyncCreateSubDomain(runtime, txId++, "/MyRoot",
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, {100, 101});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::Finished, NLs::PathVersionEqual(3)});
+ }
+
+
Y_UNIT_TEST(SimultaneousDefine) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, 100);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathVersionEqual(3)});
-
- AsyncAlterSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- AsyncAlterSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, {100, 101});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::SubDomainVersion(2), NLs::PathVersionEqual(4)});
- }
-
- Y_UNIT_TEST(SimultaneousDeclareAndDefine) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- AsyncCreateSubDomain(runtime, txId++, "/MyRoot",
- "Name: \"USER_0\"");
- AsyncAlterSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- TestModificationResult(runtime, 100, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, 101, NKikimrScheme::StatusMultipleModifications);
-
- env.TestWaitNotification(runtime, {100, 101});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::IsSubDomain("USER_0")});
- }
-
- Y_UNIT_TEST(DeclareAndDelete) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, 100);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::IsSubDomain("USER_0")});
-
- TestDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
- env.TestWaitNotification(runtime, 101);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathNotExist});
- }
-
- Y_UNIT_TEST(DeclareAndForbidTableInside) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, 100);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::IsSubDomain("USER_0")});
-
- TestMkDir(runtime, txId++, "/MyRoot/USER_0", "dir");
-
- TestCreateTable(runtime, txId++, "/MyRoot/USER_0/dir",
- "Name: \"table_0\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]",
- {NKikimrScheme::StatusNameConflict});
- }
-
- Y_UNIT_TEST(DeclareDefineAndDelete) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, 100);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::IsSubDomain("USER_0")});
- TestLs(runtime, "/MyRoot", false);
-
- TestAlterSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, 101);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {LsCheckSubDomainParamsAfterAlter("USER_0")});
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist});
-
- TestDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
- env.TestWaitNotification(runtime, 102);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathNotExist});
- }
-
- Y_UNIT_TEST(Redefine) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, 100);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::IsSubDomain("USER_0"),
- NLs::PathVersionEqual(3),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(0)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
-
- TestAlterSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, 101);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {LsCheckSubDomainParamsAfterAlter("USER_0", 2),
- NLs::PathVersionEqual(4),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(3)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
-
- TestAlterSubDomain(runtime, txId++, "/MyRoot",
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, 100);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathVersionEqual(3)});
+
+ AsyncAlterSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ AsyncAlterSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, {100, 101});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::SubDomainVersion(2), NLs::PathVersionEqual(4)});
+ }
+
+ Y_UNIT_TEST(SimultaneousDeclareAndDefine) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ AsyncCreateSubDomain(runtime, txId++, "/MyRoot",
+ "Name: \"USER_0\"");
+ AsyncAlterSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ TestModificationResult(runtime, 100, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, 101, NKikimrScheme::StatusMultipleModifications);
+
+ env.TestWaitNotification(runtime, {100, 101});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::IsSubDomain("USER_0")});
+ }
+
+ Y_UNIT_TEST(DeclareAndDelete) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, 100);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::IsSubDomain("USER_0")});
+
+ TestDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
+ env.TestWaitNotification(runtime, 101);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathNotExist});
+ }
+
+ Y_UNIT_TEST(DeclareAndForbidTableInside) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, 100);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::IsSubDomain("USER_0")});
+
+ TestMkDir(runtime, txId++, "/MyRoot/USER_0", "dir");
+
+ TestCreateTable(runtime, txId++, "/MyRoot/USER_0/dir",
+ "Name: \"table_0\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]",
+ {NKikimrScheme::StatusNameConflict});
+ }
+
+ Y_UNIT_TEST(DeclareDefineAndDelete) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, 100);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::IsSubDomain("USER_0")});
+ TestLs(runtime, "/MyRoot", false);
+
+ TestAlterSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, 101);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {LsCheckSubDomainParamsAfterAlter("USER_0")});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist});
+
+ TestDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
+ env.TestWaitNotification(runtime, 102);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathNotExist});
+ }
+
+ Y_UNIT_TEST(Redefine) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, 100);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::IsSubDomain("USER_0"),
+ NLs::PathVersionEqual(3),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(0)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+
+ TestAlterSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, 101);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {LsCheckSubDomainParamsAfterAlter("USER_0", 2),
+ NLs::PathVersionEqual(4),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(3)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+
+ TestAlterSubDomain(runtime, txId++, "/MyRoot",
"StoragePools { "
" Name: \"pool-1\" "
" Kind: \"pool-kind-1\" "
@@ -1842,26 +1842,26 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
" Name: \"pool-2\" "
" Kind: \"pool-kind-2\" "
"} "
- "StoragePools {"
- " Name: \"pool-hdd-1\""
- " Kind: \"hdd-1\""
- "}"
- "StoragePools {"
- " Name: \"pool-hdd-2\""
- " Kind: \"hdd-2\""
- "}"
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, 102);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::StoragePoolsEqual({"pool-1", "pool-2", "pool-hdd-1", "pool-hdd-2"}),
- NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
-
- TestAlterSubDomain(runtime, txId++, "/MyRoot",
+ "StoragePools {"
+ " Name: \"pool-hdd-1\""
+ " Kind: \"hdd-1\""
+ "}"
+ "StoragePools {"
+ " Name: \"pool-hdd-2\""
+ " Kind: \"hdd-2\""
+ "}"
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, 102);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::StoragePoolsEqual({"pool-1", "pool-2", "pool-hdd-1", "pool-hdd-2"}),
+ NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+
+ TestAlterSubDomain(runtime, txId++, "/MyRoot",
"StoragePools { "
" Name: \"pool-1\" "
" Kind: \"pool-kind-1\" "
@@ -1870,86 +1870,86 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
" Name: \"pool-2\" "
" Kind: \"pool-kind-2\" "
"} "
- "StoragePools {"
- " Name: \"pool-hdd-1\""
- " Kind: \"hdd-1\""
- "}"
- "StoragePools {"
- " Name: \"pool-hdd-2\""
- " Kind: \"hdd-2\""
- "}"
- "StoragePools {"
- " Name: \"pool-hdd-3\""
- " Kind: \"hdd-2\""
- "}"
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, 103);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::StoragePoolsEqual({"pool-1", "pool-2", "pool-hdd-1", "pool-hdd-2", "pool-hdd-3"}),
- NLs::PathVersionEqual(6),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
-
- TestDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
- env.TestWaitNotification(runtime, 104);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(0)});
- }
-
- Y_UNIT_TEST(SetSchemeLimits) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
+ "StoragePools {"
+ " Name: \"pool-hdd-1\""
+ " Kind: \"hdd-1\""
+ "}"
+ "StoragePools {"
+ " Name: \"pool-hdd-2\""
+ " Kind: \"hdd-2\""
+ "}"
+ "StoragePools {"
+ " Name: \"pool-hdd-3\""
+ " Kind: \"hdd-2\""
+ "}"
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, 103);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::StoragePoolsEqual({"pool-1", "pool-2", "pool-hdd-1", "pool-hdd-2", "pool-hdd-3"}),
+ NLs::PathVersionEqual(6),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+
+ TestDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
+ env.TestWaitNotification(runtime, 104);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(0)});
+ }
+
+ Y_UNIT_TEST(SetSchemeLimits) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
TSchemeLimits lowLimits;
lowLimits.MaxPaths = 3;
lowLimits.MaxShards = 3;
lowLimits.MaxPQPartitions = 300;
- SetSchemeshardSchemaLimits(runtime, lowLimits);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist
- , NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards)});
-
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
+ SetSchemeshardSchemaLimits(runtime, lowLimits);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist
+ , NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards)});
+
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
"Name: \"USER_0\""
" DatabaseQuotas {"
" data_stream_shards_quota: 3"
"}");
- env.TestWaitNotification(runtime, 100);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist
- , NLs::PathVersionEqual(3)
+ env.TestWaitNotification(runtime, 100);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist
+ , NLs::PathVersionEqual(3)
, NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards, lowLimits.MaxPQPartitions)
- , NLs::PathsInsideDomain(0)
+ , NLs::PathsInsideDomain(0)
, NLs::ShardsInsideDomain(2)
, NLs::DatabaseQuotas(3)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist
, NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards, lowLimits.MaxPQPartitions)
- , NLs::PathsInsideDomain(1)
+ , NLs::PathsInsideDomain(1)
, NLs::ShardsInsideDomain(0)
, NLs::DatabaseQuotas(0)});
- }
-
- Y_UNIT_TEST(SchemeLimitsRejects) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
+ }
+
+ Y_UNIT_TEST(SchemeLimitsRejects) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
TSchemeLimits lowLimits;
lowLimits.MaxDepth = 4;
lowLimits.MaxPaths = 3;
@@ -1958,232 +1958,232 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
lowLimits.MaxTableColumns = 3;
lowLimits.MaxTableColumnNameLength = 10;
lowLimits.MaxTableKeyColumns = 1;
- lowLimits.MaxShards = 6;
+ lowLimits.MaxShards = 6;
lowLimits.MaxShardsInPath = 4;
lowLimits.MaxPQPartitions = 20;
- //lowLimits.ExtraPathSymbolsAllowed = "!\"#$%&'()*+,-.:;<=>?@[\\]^_`{|}~";
- SetSchemeshardSchemaLimits(runtime, lowLimits);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
+ //lowLimits.ExtraPathSymbolsAllowed = "!\"#$%&'()*+,-.:;<=>?@[\\]^_`{|}~";
+ SetSchemeshardSchemaLimits(runtime, lowLimits);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards, lowLimits.MaxPQPartitions)});
-
- //create subdomain
- {
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
+
+ //create subdomain
+ {
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
"Name: \"USER_0\""
" DatabaseQuotas {"
" data_stream_shards_quota: 2"
" data_stream_reserved_storage_quota: 200000"
"}");
- env.TestWaitNotification(runtime, txId - 1);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathVersionEqual(3),
+ env.TestWaitNotification(runtime, txId - 1);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(3),
NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards, lowLimits.MaxPQPartitions),
- NLs::PathsInsideDomain(0),
+ NLs::PathsInsideDomain(0),
NLs::ShardsInsideDomain(2),
NLs::DatabaseQuotas(2)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
- }
-
- //create nodes inside, depth limit
- {
- TestMkDir(runtime, txId++, "/MyRoot/USER_0", "1");
- TestMkDir(runtime, txId++, "/MyRoot/USER_0/1", "2");
- TestMkDir(runtime, txId++, "/MyRoot/USER_0/1/2", "3", {NKikimrScheme::StatusSchemeError});
- env.TestWaitNotification(runtime, {txId - 1, txId - 2, txId -3});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathVersionEqual(5),
- NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(2)});
-
- //create nodes inside, paths limit
- TestMkDir(runtime, txId++, "/MyRoot/USER_0/1", "3");
- TestMkDir(runtime, txId++, "/MyRoot/USER_0/1", "4", {NKikimrScheme::StatusResourceExhausted});
- env.TestWaitNotification(runtime, {txId - 1, txId - 2});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathVersionEqual(5),
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+ }
+
+ //create nodes inside, depth limit
+ {
+ TestMkDir(runtime, txId++, "/MyRoot/USER_0", "1");
+ TestMkDir(runtime, txId++, "/MyRoot/USER_0/1", "2");
+ TestMkDir(runtime, txId++, "/MyRoot/USER_0/1/2", "3", {NKikimrScheme::StatusSchemeError});
+ env.TestWaitNotification(runtime, {txId - 1, txId - 2, txId -3});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(5),
+ NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(2)});
+
+ //create nodes inside, paths limit
+ TestMkDir(runtime, txId++, "/MyRoot/USER_0/1", "3");
+ TestMkDir(runtime, txId++, "/MyRoot/USER_0/1", "4", {NKikimrScheme::StatusResourceExhausted});
+ env.TestWaitNotification(runtime, {txId - 1, txId - 2});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(5),
NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards, lowLimits.MaxPQPartitions),
- NLs::PathsInsideDomain(3),
+ NLs::PathsInsideDomain(3),
NLs::ShardsInsideDomain(2),
NLs::DatabaseQuotas(2)});
- }
-
- //clean
- {
- auto dirVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/1"));
- TestForceDropUnsafe(runtime, txId++, dirVer.PathId.LocalPathId);
- env.TestWaitNotification(runtime, txId - 1);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathVersionEqual(7),
- NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(2)});
- }
-
- //create tables, shards limit
- {
- TestMkDir(runtime, txId++, "/MyRoot/USER_0", "1");
- TestCreateTable(runtime, txId++, "/MyRoot/USER_0/1", R"(
- Name: "2"
- Columns { Name: "RowId" Type: "Uint64" }
- Columns { Name: "Value" Type: "Utf8" }
- KeyColumnNames: ["RowId"]
- UniformPartitionsCount: 3
- )");
- TestCreateTable(runtime, txId++, "/MyRoot/USER_0/1", R"(
- Name: "3"
- Columns { Name: "RowId" Type: "Uint64" }
- Columns { Name: "Value" Type: "Utf8" }
- KeyColumnNames: ["RowId"]
- UniformPartitionsCount: 2
- )", {NKikimrScheme::StatusResourceExhausted});
- TestCreateTable(runtime, txId++, "/MyRoot/USER_0/1", R"(
- Name: "4"
- Columns { Name: "RowId" Type: "Uint64" }
- Columns { Name: "Value" Type: "Utf8" }
- KeyColumnNames: ["RowId"]
- UniformPartitionsCount: 1
- )");
- TestCreateTable(runtime, txId++, "/MyRoot/USER_0/1", R"(
- Name: "5"
- Columns { Name: "RowId" Type: "Uint64" }
- Columns { Name: "Value" Type: "Utf8" }
- KeyColumnNames: ["RowId"]
- UniformPartitionsCount: 1
- )", {NKikimrScheme::StatusResourceExhausted});
- }
-
+ }
+
//clean
- {
- auto dirVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/1"));
- TestForceDropUnsafe(runtime, txId++, dirVer.PathId.LocalPathId);
- env.TestWaitNotification(runtime, txId - 1);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
+ {
+ auto dirVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/1"));
+ TestForceDropUnsafe(runtime, txId++, dirVer.PathId.LocalPathId);
+ env.TestWaitNotification(runtime, txId - 1);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(7),
+ NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(2)});
+ }
+
+ //create tables, shards limit
+ {
+ TestMkDir(runtime, txId++, "/MyRoot/USER_0", "1");
+ TestCreateTable(runtime, txId++, "/MyRoot/USER_0/1", R"(
+ Name: "2"
+ Columns { Name: "RowId" Type: "Uint64" }
+ Columns { Name: "Value" Type: "Utf8" }
+ KeyColumnNames: ["RowId"]
+ UniformPartitionsCount: 3
+ )");
+ TestCreateTable(runtime, txId++, "/MyRoot/USER_0/1", R"(
+ Name: "3"
+ Columns { Name: "RowId" Type: "Uint64" }
+ Columns { Name: "Value" Type: "Utf8" }
+ KeyColumnNames: ["RowId"]
+ UniformPartitionsCount: 2
+ )", {NKikimrScheme::StatusResourceExhausted});
+ TestCreateTable(runtime, txId++, "/MyRoot/USER_0/1", R"(
+ Name: "4"
+ Columns { Name: "RowId" Type: "Uint64" }
+ Columns { Name: "Value" Type: "Utf8" }
+ KeyColumnNames: ["RowId"]
+ UniformPartitionsCount: 1
+ )");
+ TestCreateTable(runtime, txId++, "/MyRoot/USER_0/1", R"(
+ Name: "5"
+ Columns { Name: "RowId" Type: "Uint64" }
+ Columns { Name: "Value" Type: "Utf8" }
+ KeyColumnNames: ["RowId"]
+ UniformPartitionsCount: 1
+ )", {NKikimrScheme::StatusResourceExhausted});
+ }
+
+ //clean
+ {
+ auto dirVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/1"));
+ TestForceDropUnsafe(runtime, txId++, dirVer.PathId.LocalPathId);
+ env.TestWaitNotification(runtime, txId - 1);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
NLs::PathVersionEqual(10),
- NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
- NLs::PathsInsideDomain(0),
+ NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
+ NLs::PathsInsideDomain(0),
NLs::ShardsInsideDomain(2)});
- }
-
-
- //create tables, paths shards limit
- {
- TestMkDir(runtime, txId++, "/MyRoot/USER_0", "1");
- TestCreateTable(runtime, txId++, "/MyRoot/USER_0/1", R"(
- Name: "2"
- Columns { Name: "RowId" Type: "Uint64" }
- Columns { Name: "Value" Type: "Utf8" }
- KeyColumnNames: ["RowId"]
- UniformPartitionsCount: 1
- )");
- env.TestWaitNotification(runtime, {txId - 1, txId - 2});
-
- ui64 dataShardId = (ui64) -1;
- auto extractShards = [&dataShardId] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
- UNIT_ASSERT_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
- const auto& pathDescr = record.GetPathDescription();
- const auto& tableDest = pathDescr.GetTablePartitions();
- UNIT_ASSERT_EQUAL(tableDest.size(), 1);
- dataShardId = tableDest.begin()->GetDatashardId();
- };
+ }
+
+
+ //create tables, paths shards limit
+ {
+ TestMkDir(runtime, txId++, "/MyRoot/USER_0", "1");
+ TestCreateTable(runtime, txId++, "/MyRoot/USER_0/1", R"(
+ Name: "2"
+ Columns { Name: "RowId" Type: "Uint64" }
+ Columns { Name: "Value" Type: "Utf8" }
+ KeyColumnNames: ["RowId"]
+ UniformPartitionsCount: 1
+ )");
+ env.TestWaitNotification(runtime, {txId - 1, txId - 2});
+
+ ui64 dataShardId = (ui64) -1;
+ auto extractShards = [&dataShardId] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ UNIT_ASSERT_EQUAL(record.GetStatus(), NKikimrScheme::StatusSuccess);
+ const auto& pathDescr = record.GetPathDescription();
+ const auto& tableDest = pathDescr.GetTablePartitions();
+ UNIT_ASSERT_EQUAL(tableDest.size(), 1);
+ dataShardId = tableDest.begin()->GetDatashardId();
+ };
TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/1/2", true),
- {NLs::PathExist,
- NLs::PathVersionEqual(3),
- NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(3),
- extractShards});
-
- TestSplitTable(runtime, txId++, "/MyRoot/USER_0/1/2", Sprintf(R"(
- SourceTabletId: %lu
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Uint64: 1000000 } }
- }
- } )", dataShardId));
-
- env.TestWaitNotification(runtime, txId - 1);
-
- env.TestWaitTabletDeletion(runtime, dataShardId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/1/2"),
- {NLs::PathExist,
- NLs::PathVersionEqual(4),
- NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(4)});
-
- TestSplitTable(runtime, txId++, "/MyRoot/USER_0/1/2", Sprintf(R"(
- SourceTabletId: %lu
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Uint64: 500000 } }
- }
- } )", dataShardId + 1));
- TestSplitTable(runtime, txId++, "/MyRoot/USER_0/1/2", Sprintf(R"(
- SourceTabletId: %lu
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Uint64: 2000000 } }
- }
- } )", dataShardId + 2), {NKikimrScheme::StatusResourceExhausted});
- env.TestWaitNotification(runtime, txId - 1);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/1/2"),
- {NLs::PathExist,
- NLs::PathVersionEqual(4),
- NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomainOneOf({5, 6})});
-
- env.TestWaitTabletDeletion(runtime, dataShardId + 1);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/1/2"),
- {NLs::PathExist,
- NLs::PathVersionEqual(5),
- NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(5)});
-
- TestCreateTable(runtime, txId++, "/MyRoot/USER_0/1", R"(
- Name: "3"
- Columns { Name: "RowId" Type: "Uint64" }
- Columns { Name: "Value" Type: "Utf8" }
- KeyColumnNames: ["RowId"]
- UniformPartitionsCount: 2
- )", {NKikimrScheme::StatusResourceExhausted});
- }
-
- //clear
- {
- auto dirVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/1"));
- TestForceDropUnsafe(runtime, txId++, dirVer.PathId.LocalPathId);
- env.TestWaitNotification(runtime, txId - 1);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
+ {NLs::PathExist,
+ NLs::PathVersionEqual(3),
+ NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(3),
+ extractShards});
+
+ TestSplitTable(runtime, txId++, "/MyRoot/USER_0/1/2", Sprintf(R"(
+ SourceTabletId: %lu
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint64: 1000000 } }
+ }
+ } )", dataShardId));
+
+ env.TestWaitNotification(runtime, txId - 1);
+
+ env.TestWaitTabletDeletion(runtime, dataShardId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/1/2"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(4),
+ NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(4)});
+
+ TestSplitTable(runtime, txId++, "/MyRoot/USER_0/1/2", Sprintf(R"(
+ SourceTabletId: %lu
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint64: 500000 } }
+ }
+ } )", dataShardId + 1));
+ TestSplitTable(runtime, txId++, "/MyRoot/USER_0/1/2", Sprintf(R"(
+ SourceTabletId: %lu
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint64: 2000000 } }
+ }
+ } )", dataShardId + 2), {NKikimrScheme::StatusResourceExhausted});
+ env.TestWaitNotification(runtime, txId - 1);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/1/2"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(4),
+ NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomainOneOf({5, 6})});
+
+ env.TestWaitTabletDeletion(runtime, dataShardId + 1);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/1/2"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(5),
+ NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(5)});
+
+ TestCreateTable(runtime, txId++, "/MyRoot/USER_0/1", R"(
+ Name: "3"
+ Columns { Name: "RowId" Type: "Uint64" }
+ Columns { Name: "Value" Type: "Utf8" }
+ KeyColumnNames: ["RowId"]
+ UniformPartitionsCount: 2
+ )", {NKikimrScheme::StatusResourceExhausted});
+ }
+
+ //clear
+ {
+ auto dirVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/1"));
+ TestForceDropUnsafe(runtime, txId++, dirVer.PathId.LocalPathId);
+ env.TestWaitNotification(runtime, txId - 1);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
NLs::PathVersionEqual(14),
- NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(2)});
- }
-
+ NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(2)});
+ }
+
//create tables, column limits
{
TestMkDir(runtime, txId++, "/MyRoot/USER_0", "1");
@@ -2197,7 +2197,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Columns { Name: "Value1" Type: "Utf8" }
Columns { Name: "Value2" Type: "Utf8" }
KeyColumnNames: ["RowId"]
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
// MaxTableColumnNameLength
TestCreateTable(runtime, txId++, "/MyRoot/USER_0/1", R"(
@@ -2205,7 +2205,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Columns { Name: "RowId" Type: "Uint64" }
Columns { Name: "VeryLongColumnName" Type: "Utf8" }
KeyColumnNames: ["RowId"]
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
// MaxTableKeyColumns
TestCreateTable(runtime, txId++, "/MyRoot/USER_0/1", R"(
@@ -2214,20 +2214,20 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Columns { Name: "RowId1" Type: "Uint64" }
Columns { Name: "Value" Type: "Utf8" }
KeyColumnNames: ["RowId0", "RowId1"]
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
}
//clear
{
auto dirVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/1"));
- TestForceDropUnsafe(runtime, txId++, dirVer.PathId.LocalPathId);
+ TestForceDropUnsafe(runtime, txId++, dirVer.PathId.LocalPathId);
env.TestWaitNotification(runtime, txId - 1);
TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
{NLs::PathExist,
NLs::PathVersionEqual(18),
NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(2)});
+ NLs::ShardsInsideDomain(2)});
}
//create dirs, acl size limit
@@ -2244,20 +2244,20 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
hugeACL.AddAccess(NACLib::EAccessType::Allow, NACLib::GenericUse, Sprintf("user%" PRIu32 "@builtin", i));
}
TestModifyACL(runtime, txId++, "/MyRoot/USER_0", "1", hugeACL.SerializeAsString(), "user0@builtin",
- NKikimrScheme::StatusInvalidParameter);
+ NKikimrScheme::StatusInvalidParameter);
}
//clear
{
auto dirVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/1"));
- TestForceDropUnsafe(runtime, txId++, dirVer.PathId.LocalPathId);
+ TestForceDropUnsafe(runtime, txId++, dirVer.PathId.LocalPathId);
env.TestWaitNotification(runtime, txId - 1);
TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
{NLs::PathExist,
NLs::PathVersionEqual(24),
NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(2)});
+ NLs::ShardsInsideDomain(2)});
}
//create tables, consistent copy targets limit
@@ -2291,20 +2291,20 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
CopyTableDescriptions {
SrcPath: "/MyRoot/USER_0/1/3"
DstPath: "/MyRoot/USER_0/1/13"
- })", {NKikimrScheme::StatusInvalidParameter});
+ })", {NKikimrScheme::StatusInvalidParameter});
}
//clear
{
auto dirVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/1"));
- TestForceDropUnsafe(runtime, txId++, dirVer.PathId.LocalPathId);
+ TestForceDropUnsafe(runtime, txId++, dirVer.PathId.LocalPathId);
env.TestWaitNotification(runtime, txId - 1);
TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
{NLs::PathExist,
NLs::PathVersionEqual(28),
NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(2)});
+ NLs::ShardsInsideDomain(2)});
}
@@ -2316,7 +2316,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
TotalGroupCount: 3
PartitionPerTablet: 2
PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10 WriteSpeedInBytesPerSecond : 1000}}
- )", {NKikimrScheme::StatusResourceExhausted});
+ )", {NKikimrScheme::StatusResourceExhausted});
env.TestWaitNotification(runtime, txId - 1);
@@ -2399,180 +2399,180 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
}
- //clear subdomain
- {
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
- TestForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
- env.TestWaitNotification(runtime, txId - 1);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(0)});
- }
- }
-
- Y_UNIT_TEST(SchemeLimitsRejectsWithIndexedTables) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
+ //clear subdomain
+ {
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+ TestForceDropSubDomain(runtime, txId++, "/MyRoot", "USER_0");
+ env.TestWaitNotification(runtime, txId - 1);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(0)});
+ }
+ }
+
+ Y_UNIT_TEST(SchemeLimitsRejectsWithIndexedTables) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
TSchemeLimits lowLimits;
lowLimits.MaxDepth = 4;
lowLimits.MaxPaths = 5;
lowLimits.MaxChildrenInDir = 3;
lowLimits.MaxTableIndices = 4;
- lowLimits.MaxShards = 7;
+ lowLimits.MaxShards = 7;
lowLimits.MaxShardsInPath = 4;
- lowLimits.ExtraPathSymbolsAllowed = "_.-";
- SetSchemeshardSchemaLimits(runtime, lowLimits);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards)});
-
- //create subdomain
- {
- TestCreateSubDomain(runtime, txId++, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- env.TestWaitNotification(runtime, txId - 1);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathVersionEqual(3),
- NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(2)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
- }
-
- //path inside limit
- {
- TestCreateIndexedTable(runtime, txId++, "/MyRoot/USER_0", R"(
- TableDescription {
- Name: "Table1"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Utf8" }
- Columns { Name: "value1" Type: "Utf8" }
- Columns { Name: "value2" Type: "Utf8" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue1"
- KeyColumnNames: ["value1"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValues"
- KeyColumnNames: ["value2"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0", "value1"]
- }
- )", {NKikimrScheme::StatusResourceExhausted});
-
- TestCreateIndexedTable(runtime, txId++, "/MyRoot/USER_0", R"(
- TableDescription {
- Name: "Table2"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Uint64" }
- Columns { Name: "value1" Type: "Uint64" }
- Columns { Name: "value2" Type: "Uint64" }
- KeyColumnNames: ["key"]
- UniformPartitionsCount: 4
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue1"
- KeyColumnNames: ["value1"]
- }
- )", {NKikimrScheme::StatusResourceExhausted});
-
- TestCreateIndexedTable(runtime, txId++, "/MyRoot/USER_0", R"(
- TableDescription {
- Name: "Table3"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Uint64" }
- Columns { Name: "value1" Type: "Uint64" }
- Columns { Name: "value2" Type: "Uint64" }
- KeyColumnNames: ["key"]
- UniformPartitionsCount: 6
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue1"
- KeyColumnNames: ["value1"]
- }
- )", {NKikimrScheme::StatusResourceExhausted});
-
- TestCreateIndexedTable(runtime, txId++, "/MyRoot/USER_0", R"(
- TableDescription {
- Name: "Table4"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Uint64" }
- Columns { Name: "value1" Type: "Uint64" }
- Columns { Name: "value2" Type: "Uint64" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- }
- )", {NKikimrScheme::StatusInvalidParameter});
-
- TestCreateIndexedTable(runtime, txId++, "/MyRoot/USER_0", R"(
- TableDescription {
- Name: "Table5"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Uint64" }
- Columns { Name: "value1" Type: "Uint64" }
- Columns { Name: "value2" Type: "Uint64" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "Index_@"
- KeyColumnNames: ["value1"]
- }
- )", {NKikimrScheme::StatusSchemeError});
-
- TestMkDir(runtime, txId++, "/MyRoot/USER_0", "1");
- TestCreateIndexedTable(runtime, txId++, "/MyRoot/USER_0/1", R"(
- TableDescription {
- Name: "Table6"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value0" Type: "Uint64" }
- Columns { Name: "value1" Type: "Uint64" }
- Columns { Name: "value2" Type: "Uint64" }
- KeyColumnNames: ["key"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- )", {NKikimrScheme::StatusAccepted});
-
- env.TestWaitNotification(runtime, {txId - 1, txId - 2, txId - 3, txId - 4, txId - 5, txId - 6});
- }
+ lowLimits.ExtraPathSymbolsAllowed = "_.-";
+ SetSchemeshardSchemaLimits(runtime, lowLimits);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards)});
+
+ //create subdomain
+ {
+ TestCreateSubDomain(runtime, txId++, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ env.TestWaitNotification(runtime, txId - 1);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(3),
+ NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(2)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::DomainLimitsIs(lowLimits.MaxPaths, lowLimits.MaxShards),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+ }
+
+ //path inside limit
+ {
+ TestCreateIndexedTable(runtime, txId++, "/MyRoot/USER_0", R"(
+ TableDescription {
+ Name: "Table1"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Utf8" }
+ Columns { Name: "value1" Type: "Utf8" }
+ Columns { Name: "value2" Type: "Utf8" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue1"
+ KeyColumnNames: ["value1"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValues"
+ KeyColumnNames: ["value2"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0", "value1"]
+ }
+ )", {NKikimrScheme::StatusResourceExhausted});
+
+ TestCreateIndexedTable(runtime, txId++, "/MyRoot/USER_0", R"(
+ TableDescription {
+ Name: "Table2"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Uint64" }
+ Columns { Name: "value1" Type: "Uint64" }
+ Columns { Name: "value2" Type: "Uint64" }
+ KeyColumnNames: ["key"]
+ UniformPartitionsCount: 4
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue1"
+ KeyColumnNames: ["value1"]
+ }
+ )", {NKikimrScheme::StatusResourceExhausted});
+
+ TestCreateIndexedTable(runtime, txId++, "/MyRoot/USER_0", R"(
+ TableDescription {
+ Name: "Table3"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Uint64" }
+ Columns { Name: "value1" Type: "Uint64" }
+ Columns { Name: "value2" Type: "Uint64" }
+ KeyColumnNames: ["key"]
+ UniformPartitionsCount: 6
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue1"
+ KeyColumnNames: ["value1"]
+ }
+ )", {NKikimrScheme::StatusResourceExhausted});
+
+ TestCreateIndexedTable(runtime, txId++, "/MyRoot/USER_0", R"(
+ TableDescription {
+ Name: "Table4"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Uint64" }
+ Columns { Name: "value1" Type: "Uint64" }
+ Columns { Name: "value2" Type: "Uint64" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ }
+ )", {NKikimrScheme::StatusInvalidParameter});
+
+ TestCreateIndexedTable(runtime, txId++, "/MyRoot/USER_0", R"(
+ TableDescription {
+ Name: "Table5"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Uint64" }
+ Columns { Name: "value1" Type: "Uint64" }
+ Columns { Name: "value2" Type: "Uint64" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "Index_@"
+ KeyColumnNames: ["value1"]
+ }
+ )", {NKikimrScheme::StatusSchemeError});
+
+ TestMkDir(runtime, txId++, "/MyRoot/USER_0", "1");
+ TestCreateIndexedTable(runtime, txId++, "/MyRoot/USER_0/1", R"(
+ TableDescription {
+ Name: "Table6"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value0" Type: "Uint64" }
+ Columns { Name: "value1" Type: "Uint64" }
+ Columns { Name: "value2" Type: "Uint64" }
+ KeyColumnNames: ["key"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ )", {NKikimrScheme::StatusAccepted});
+
+ env.TestWaitNotification(runtime, {txId - 1, txId - 2, txId - 3, txId - 4, txId - 5, txId - 6});
+ }
// MaxTableIndices
{
@@ -2607,11 +2607,11 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Name: "UserDefinedIndexByValue4"
KeyColumnNames: ["Value4"]
}
- )", {NKikimrScheme::StatusResourceExhausted});
+ )", {NKikimrScheme::StatusResourceExhausted});
env.TestWaitNotification(runtime, txId - 1);
}
- }
+ }
Y_UNIT_TEST(SchemeLimitsCreatePq) {
TTestBasicRuntime runtime;
@@ -2638,7 +2638,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
"TotalGroupCount: 40 "
"PartitionPerTablet: 10 "
"PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}",
- {NKikimrScheme::StatusResourceExhausted});
+ {NKikimrScheme::StatusResourceExhausted});
// 1 balancer + 3 partitions = 4 (within path limit)
TestCreatePQGroup(runtime, ++txId, "/MyRoot",
@@ -2653,7 +2653,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
"TotalGroupCount: 30 "
"PartitionPerTablet: 10 "
"PQTabletConfig: {PartitionConfig { LifetimeSeconds : 10}}",
- {NKikimrScheme::StatusResourceExhausted});
+ {NKikimrScheme::StatusResourceExhausted});
// 1 balancer + 2 partitions = 3 (within tenant limit)
TestCreatePQGroup(runtime, ++txId, "/MyRoot",
@@ -2702,7 +2702,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
// Second table should fail (out of per-minute quota)
TestCreateTable(runtime, ++txId, "/MyRoot/USER_0", R"(
@@ -2710,7 +2710,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusQuotaExceeded});
+ )", {NKikimrScheme::StatusQuotaExceeded});
// After a minute we should be able to create one more table
runtime.AdvanceCurrentTime(TDuration::Minutes(1));
@@ -2719,13 +2719,13 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
TestCreateTable(runtime, ++txId, "/MyRoot/USER_0", R"(
Name: "Table4"
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusQuotaExceeded});
+ )", {NKikimrScheme::StatusQuotaExceeded});
// After 1 more minute we should still fail because of per 10 minute quota
runtime.AdvanceCurrentTime(TDuration::Minutes(1));
@@ -2734,7 +2734,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusQuotaExceeded});
+ )", {NKikimrScheme::StatusQuotaExceeded});
// After 3 more minutes we should succeed, because enough per 10 minute quota regenerates
runtime.AdvanceCurrentTime(TDuration::Minutes(3));
@@ -2743,7 +2743,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
// Quotas consuption is persistent, on reboot they should stay consumed
{
@@ -2755,7 +2755,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusQuotaExceeded});
+ )", {NKikimrScheme::StatusQuotaExceeded});
// Need 5 more minutes to create a table
runtime.AdvanceCurrentTime(TDuration::Minutes(5));
@@ -2764,7 +2764,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
// Reset quotas for the subdomain
TestAlterSubDomain(runtime, ++txId, "/MyRoot", R"(
@@ -2780,13 +2780,13 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
TestCreateTable(runtime, ++txId, "/MyRoot/USER_0", R"(
Name: "Table9"
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
// Quotas removal is persistent, on reboot they should not reactivate
{
@@ -2798,13 +2798,13 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
TestCreateTable(runtime, ++txId, "/MyRoot/USER_0", R"(
Name: "Table11"
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "Value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
}
Y_UNIT_TEST(DiskSpaceUsage) {
@@ -2839,7 +2839,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
TestDescribeResult(
DescribePath(runtime, "/MyRoot"), {
NLs::PathExist,
- NLs::Finished, [&result] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ NLs::Finished, [&result] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
result = record.GetPathDescription().GetDomainDescription().GetDiskSpaceUsage();
}
}
@@ -2858,7 +2858,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
env.TestWaitNotification(runtime, txId);
writeRow(tabletId, 1, "value1", "Table1");
@@ -2881,7 +2881,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Columns { Name: "value" Type: "Utf8"}
KeyColumnNames: ["key"]
UniformPartitionsCount: 2
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
env.TestWaitNotification(runtime, txId);
writeRow(tabletId + 0, 1, "value1", "Table2");
@@ -2960,7 +2960,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
Columns { Name: "key" Type: "Uint32"}
Columns { Name: "value" Type: "Utf8"}
KeyColumnNames: ["key"]
- )", {NKikimrScheme::StatusAccepted});
+ )", {NKikimrScheme::StatusAccepted});
env.TestWaitNotification(runtime, txId);
writeRow(tabletId, 1, "value1", "Table1");
@@ -3106,5 +3106,5 @@ Y_UNIT_TEST_SUITE(TSchemeShardSubDomainTest) {
NLs::ShardsInsideDomain(0)});
}
}
-}
+}
diff --git a/ydb/core/tx/schemeshard/ut_subdomain/ya.make b/ydb/core/tx/schemeshard/ut_subdomain/ya.make
index 25cf0fde817..aaa80b70904 100644
--- a/ydb/core/tx/schemeshard/ut_subdomain/ya.make
+++ b/ydb/core/tx/schemeshard/ut_subdomain/ya.make
@@ -7,8 +7,8 @@ OWNER(
FORK_SUBTESTS()
-SPLIT_FACTOR(60)
-
+SPLIT_FACTOR(60)
+
IF (SANITIZER_TYPE OR WITH_VALGRIND)
TIMEOUT(3600)
SIZE(LARGE)
@@ -31,7 +31,7 @@ PEERDIR(
YQL_LAST_ABI_VERSION()
SRCS(
- ut_subdomain.cpp
+ ut_subdomain.cpp
)
END()
diff --git a/ydb/core/tx/schemeshard/ut_subdomain_reboots.cpp b/ydb/core/tx/schemeshard/ut_subdomain_reboots.cpp
index 82a00a45b21..8d867909d90 100644
--- a/ydb/core/tx/schemeshard/ut_subdomain_reboots.cpp
+++ b/ydb/core/tx/schemeshard/ut_subdomain_reboots.cpp
@@ -1,899 +1,899 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
-
+
#include <ydb/core/tx/datashard/datashard.h>
#include <ydb/core/protos/flat_scheme_op.pb.h>
-
+
#include <google/protobuf/text_format.h>
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-using namespace NSchemeShardUT_Private;
-
-Y_UNIT_TEST_SUITE(SubDomainWithReboots) {
- Y_UNIT_TEST(Fake) {
- }
-
- Y_UNIT_TEST(Create) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TVector<TString> userAttrsKeys{"AttrA1", "AttrA2"};
- TUserAttrs userAttrs{{"AttrA1", "ValA1"}, {"AttrA2", "ValA2"}};
-
- AsyncCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"",
- AlterUserAttrs(userAttrs));
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::Finished,
- NLs::IsSubDomain("USER_0"),
- NLs::PathVersionEqual(3),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(2),
- NLs::UserAttrsEqual(userAttrs)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathExist,
- NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(0)});
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+using namespace NSchemeShardUT_Private;
+
+Y_UNIT_TEST_SUITE(SubDomainWithReboots) {
+ Y_UNIT_TEST(Fake) {
+ }
+
+ Y_UNIT_TEST(Create) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TVector<TString> userAttrsKeys{"AttrA1", "AttrA2"};
+ TUserAttrs userAttrs{{"AttrA1", "ValA1"}, {"AttrA2", "ValA2"}};
+
+ AsyncCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"",
+ AlterUserAttrs(userAttrs));
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::Finished,
+ NLs::IsSubDomain("USER_0"),
+ NLs::PathVersionEqual(3),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(2),
+ NLs::UserAttrsEqual(userAttrs)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(0)});
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 3));
- }
- });
- }
-
- Y_UNIT_TEST(DeclareAndDefine) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TVector<TString> userAttrsKeys{"AttrA1", "AttrA2"};
- TUserAttrs userAttrs{{"AttrA1", "ValA1"}, {"AttrA2", "ValA2"}};
-
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId,
- "/MyRoot/DirA",
- "Name: \"USER_0\"",
- AlterUserAttrs(userAttrs));
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone guard(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::Finished,
- NLs::IsSubDomain("USER_0"),
- NLs::PathVersionEqual(4),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(3),
- NLs::UserAttrsEqual(userAttrs)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(0)});
- }
- });
- }
-
- Y_UNIT_TEST(CreateWithStoragePools) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- AsyncCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\" "
- "StoragePools { "
- " Name: \"name_USER_0_kind_hdd-1\" "
- " Kind: \"hdd-1\" "
- "} "
- "StoragePools { "
- " Name: \"name_USER_0_kind_hdd-2\" "
- " Kind: \"hdd-2\" "
- "}");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::Finished,
- NLs::SubdomainWithNoEmptyStoragePools,
- NLs::PathVersionEqual(3),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(2)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(0)});
- }
- });
- }
-
- Y_UNIT_TEST(RootWithStoragePools) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::StoragePoolsEqual({"pool-1", "pool-2"}),
+ }
+ });
+ }
+
+ Y_UNIT_TEST(DeclareAndDefine) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TVector<TString> userAttrsKeys{"AttrA1", "AttrA2"};
+ TUserAttrs userAttrs{{"AttrA1", "ValA1"}, {"AttrA2", "ValA2"}};
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId,
+ "/MyRoot/DirA",
+ "Name: \"USER_0\"",
+ AlterUserAttrs(userAttrs));
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone guard(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::Finished,
+ NLs::IsSubDomain("USER_0"),
+ NLs::PathVersionEqual(4),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(3),
+ NLs::UserAttrsEqual(userAttrs)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(0)});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(CreateWithStoragePools) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ AsyncCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\" "
+ "StoragePools { "
+ " Name: \"name_USER_0_kind_hdd-1\" "
+ " Kind: \"hdd-1\" "
+ "} "
+ "StoragePools { "
+ " Name: \"name_USER_0_kind_hdd-2\" "
+ " Kind: \"hdd-2\" "
+ "}");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::Finished,
+ NLs::SubdomainWithNoEmptyStoragePools,
+ NLs::PathVersionEqual(3),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(2)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(0)});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(RootWithStoragePools) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::StoragePoolsEqual({"pool-1", "pool-2"}),
NLs::DomainCoordinators(TVector<ui64>{TTestTxConfig::Coordinator})});
- }
-
- AsyncAlterSubDomain(runtime, ++t.TxId, "/",
- "StoragePools { "
- " Name: \"pool-1\" "
- " Kind: \"pool-kind-1\" "
- "} "
- "StoragePools { "
- " Name: \"pool-2\" "
- " Kind: \"pool-kind-2\" "
- "} "
- "StoragePools { "
- " Name: \"name_USER_0_kind_hdd-1\" "
- " Kind: \"hdd-1\" "
- "} "
- "StoragePools { "
- " Name: \"name_USER_0_kind_hdd-2\" "
- " Kind: \"hdd-2\" "
- "} "
- "Name: \"MyRoot\"");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::StoragePoolsEqual({"pool-1", "pool-2", "name_USER_0_kind_hdd-1", "name_USER_0_kind_hdd-2"})});
- }
- });
- }
-
- Y_UNIT_TEST(RootWithStoragePoolsAndTable) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestAlterSubDomain(runtime, ++t.TxId, "/",
- "StoragePools { "
- " Name: \"pool-1\" "
- " Kind: \"pool-kind-1\" "
- "} "
- "StoragePools { "
- " Name: \"pool-2\" "
- " Kind: \"pool-kind-2\" "
- "} "
- "StoragePools { "
- " Name: \"name_USER_0_kind_hdd-1\" "
- " Kind: \"hdd-1\" "
- "} "
- "StoragePools { "
- " Name: \"name_USER_0_kind_hdd-2\" "
- " Kind: \"hdd-2\" "
- "} "
- "Name: \"MyRoot\"");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::StoragePoolsEqual({"pool-1", "pool-2", "name_USER_0_kind_hdd-1", "name_USER_0_kind_hdd-2"})});
- }
-
-
- TestCreateTable(runtime, ++t.TxId, "/MyRoot",
- "Name: \"table_0\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::StoragePoolsEqual({"pool-1", "pool-2", "name_USER_0_kind_hdd-1", "name_USER_0_kind_hdd-2"})});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/table_0"),
- {NLs::PathExist,
- NLs::PathVersionEqual(3)});
- }
-
- });
- }
-
- Y_UNIT_TEST(Delete) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- AsyncDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ AsyncAlterSubDomain(runtime, ++t.TxId, "/",
+ "StoragePools { "
+ " Name: \"pool-1\" "
+ " Kind: \"pool-kind-1\" "
+ "} "
+ "StoragePools { "
+ " Name: \"pool-2\" "
+ " Kind: \"pool-kind-2\" "
+ "} "
+ "StoragePools { "
+ " Name: \"name_USER_0_kind_hdd-1\" "
+ " Kind: \"hdd-1\" "
+ "} "
+ "StoragePools { "
+ " Name: \"name_USER_0_kind_hdd-2\" "
+ " Kind: \"hdd-2\" "
+ "} "
+ "Name: \"MyRoot\"");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::StoragePoolsEqual({"pool-1", "pool-2", "name_USER_0_kind_hdd-1", "name_USER_0_kind_hdd-2"})});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(RootWithStoragePoolsAndTable) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestAlterSubDomain(runtime, ++t.TxId, "/",
+ "StoragePools { "
+ " Name: \"pool-1\" "
+ " Kind: \"pool-kind-1\" "
+ "} "
+ "StoragePools { "
+ " Name: \"pool-2\" "
+ " Kind: \"pool-kind-2\" "
+ "} "
+ "StoragePools { "
+ " Name: \"name_USER_0_kind_hdd-1\" "
+ " Kind: \"hdd-1\" "
+ "} "
+ "StoragePools { "
+ " Name: \"name_USER_0_kind_hdd-2\" "
+ " Kind: \"hdd-2\" "
+ "} "
+ "Name: \"MyRoot\"");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::StoragePoolsEqual({"pool-1", "pool-2", "name_USER_0_kind_hdd-1", "name_USER_0_kind_hdd-2"})});
+ }
+
+
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"table_0\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::StoragePoolsEqual({"pool-1", "pool-2", "name_USER_0_kind_hdd-1", "name_USER_0_kind_hdd-2"})});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/table_0"),
+ {NLs::PathExist,
+ NLs::PathVersionEqual(3)});
+ }
+
+ });
+ }
+
+ Y_UNIT_TEST(Delete) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ AsyncDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
t.TestEnv->TestWaitTabletDeletion(runtime, {TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+1});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(7),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(7),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
t.TestEnv->TestWaitShardDeletion(runtime, {1, 2});
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 3));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
- }
- });
- }
-
- Y_UNIT_TEST(DeleteWithStoragePools) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\""
- "StoragePools {"
- " Name: \"name_USER_0_kind_hdd-1\""
- " Kind: \"hdd-1\""
- "}"
- "StoragePools {"
- " Name: \"name_USER_0_kind_hdd-2\""
- " Kind: \"hdd-2\""
- "}");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- TestDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+ });
+ }
+
+ Y_UNIT_TEST(DeleteWithStoragePools) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\""
+ "StoragePools {"
+ " Name: \"name_USER_0_kind_hdd-1\""
+ " Kind: \"hdd-1\""
+ "}"
+ "StoragePools {"
+ " Name: \"name_USER_0_kind_hdd-2\""
+ " Kind: \"hdd-2\""
+ "}");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ TestDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
t.TestEnv->TestWaitTabletDeletion(runtime, {TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+1});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(7),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(7),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
t.TestEnv->TestWaitShardDeletion(runtime, {1, 2});
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 3));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
- }
- });
- }
-
- Y_UNIT_TEST(DropSplittedTabletInsideWithStoragePools) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\""
- "StoragePools {"
- " Name: \"name_USER_0_kind_hdd-1\""
- " Kind: \"storage-pool-number-1\""
- "}"
- "StoragePools {"
- " Name: \"name_USER_0_kind_hdd-2\""
- " Kind: \"storage-pool-number-2\""
- "}");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(0)});
-
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0",
- "Name: \"table_0\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- );
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(0)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(3)});
-
- TestSplitTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0/table_0",
- R"(
- SourceTabletId: 9437196
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Uint64: 300 } }
- }
- }
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Uint64: 600 } }
- }
- }
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+ });
+ }
+
+ Y_UNIT_TEST(DropSplittedTabletInsideWithStoragePools) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\""
+ "StoragePools {"
+ " Name: \"name_USER_0_kind_hdd-1\""
+ " Kind: \"storage-pool-number-1\""
+ "}"
+ "StoragePools {"
+ " Name: \"name_USER_0_kind_hdd-2\""
+ " Kind: \"storage-pool-number-2\""
+ "}");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(0)});
+
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0",
+ "Name: \"table_0\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ );
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(0)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(3)});
+
+ TestSplitTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0/table_0",
+ R"(
+ SourceTabletId: 9437196
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint64: 300 } }
+ }
+ }
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint64: 600 } }
+ }
+ }
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
t.TestEnv->TestWaitTabletDeletion(runtime, TTestTxConfig::FakeHiveTablets+2); //delete src
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(5)});
-
- }
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0", "table_0");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestForceDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(5)});
+
+ }
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0", "table_0");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestForceDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 5));
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(7),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(7),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
// FIXME: DropTable breaks down during ForceDropSubDomain and leaves table half-dropped
// an additional reboot "fixes" the half-dropped table
RebootTablet(runtime, TTestTxConfig::SchemeShard, runtime.AllocateEdgeActor());
t.TestEnv->TestWaitShardDeletion(runtime, {1, 2, 3, 4, 5});
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 3));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
- }
- });
- }
-
- Y_UNIT_TEST(SplitTabletInsideWithStoragePools) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\""
- "StoragePools {"
- " Name: \"name_USER_0_kind_hdd-1\""
- " Kind: \"storage-pool-number-1\""
- "}"
- "StoragePools {"
- " Name: \"name_USER_0_kind_hdd-2\""
- " Kind: \"storage-pool-number-2\""
- "}");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(0)});
-
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0",
- "Name: \"table_0\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- );
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(0)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(3)});
- }
-
- TestSplitTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0/table_0",
- R"(
- SourceTabletId: 9437196
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Uint64: 300 } }
- }
- }
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Uint64: 600 } }
- }
- }
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomainOneOf({5, 6})});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(SplitTabletInsideWithStoragePools) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\""
+ "StoragePools {"
+ " Name: \"name_USER_0_kind_hdd-1\""
+ " Kind: \"storage-pool-number-1\""
+ "}"
+ "StoragePools {"
+ " Name: \"name_USER_0_kind_hdd-2\""
+ " Kind: \"storage-pool-number-2\""
+ "}");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(0)});
+
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0",
+ "Name: \"table_0\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ );
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(0)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(3)});
+ }
+
+ TestSplitTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0/table_0",
+ R"(
+ SourceTabletId: 9437196
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint64: 300 } }
+ }
+ }
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint64: 600 } }
+ }
+ }
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomainOneOf({5, 6})});
t.TestEnv->TestWaitTabletDeletion(runtime, TTestTxConfig::FakeHiveTablets+2); //delete src
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(5)});
- }
- });
- }
-
- Y_UNIT_TEST(CreateTabletInsideWithStoragePools) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\""
- "StoragePools {"
- " Name: \"name_USER_0_kind_hdd-1\""
- " Kind: \"storage-pool-number-1\""
- "}"
- "StoragePools {"
- " Name: \"name_USER_0_kind_hdd-2\""
- " Kind: \"storage-pool-number-2\""
- "}");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(0)});
- }
-
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0",
- "Name: \"table_0\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- );
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(0)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(3)});
- }
- });
- }
-
-}
-
-Y_UNIT_TEST_SUITE(ForceDropWithReboots) {
- Y_UNIT_TEST(Fake) {
- }
-
- Y_UNIT_TEST(ForceDelete) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, t.TxId, "/MyRoot/DirA",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(5)});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(CreateTabletInsideWithStoragePools) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\""
+ "StoragePools {"
+ " Name: \"name_USER_0_kind_hdd-1\""
+ " Kind: \"storage-pool-number-1\""
+ "}"
+ "StoragePools {"
+ " Name: \"name_USER_0_kind_hdd-2\""
+ " Kind: \"storage-pool-number-2\""
+ "}");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(0)});
+ }
+
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0",
+ "Name: \"table_0\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ );
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(0)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(3)});
+ }
+ });
+ }
+
+}
+
+Y_UNIT_TEST_SUITE(ForceDropWithReboots) {
+ Y_UNIT_TEST(Fake) {
+ }
+
+ Y_UNIT_TEST(ForceDelete) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, t.TxId, "/MyRoot/DirA",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 3));
- }
-
- AsyncForceDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ AsyncForceDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
t.TestEnv->TestWaitTabletDeletion(runtime, {TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+1});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::PathNotExist});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::PathNotExist});
t.TestEnv->TestWaitShardDeletion(runtime, {1, 2});
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 3));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
- }
- });
- }
-
- Y_UNIT_TEST(ForceDeleteCreateSubdomainInfly) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
-
- AsyncCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- AsyncForceDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId} );
+ }
+ });
+ }
+
+ Y_UNIT_TEST(ForceDeleteCreateSubdomainInfly) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+
+ AsyncCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ AsyncForceDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId} );
t.TestEnv->TestWaitTabletDeletion(runtime, {TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+1});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::PathNotExist});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::PathNotExist});
t.TestEnv->TestWaitShardDeletion(runtime, {1, 2});
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 3));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
- }
- });
- }
-
- Y_UNIT_TEST(ForceDeleteCreateTableInFlyWithRebootAtCommit) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- AsyncCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- AsyncMkDir(runtime, ++t.TxId, "/MyRoot/DirA/USER_0", "dir");
- AsyncCreateTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0/dir",
- "Name: \"table_0\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]");
-
- AsyncForceDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
-
- Cerr << Endl << "Wait notification " << Endl;
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-3, t.TxId-2, t.TxId-1, t.TxId} );
- Cerr << Endl << "Ok notification " << Endl;
-
+ }
+ });
+ }
+
+ Y_UNIT_TEST(ForceDeleteCreateTableInFlyWithRebootAtCommit) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ AsyncCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ AsyncMkDir(runtime, ++t.TxId, "/MyRoot/DirA/USER_0", "dir");
+ AsyncCreateTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0/dir",
+ "Name: \"table_0\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]");
+
+ AsyncForceDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
+
+ Cerr << Endl << "Wait notification " << Endl;
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-3, t.TxId-2, t.TxId-1, t.TxId} );
+ Cerr << Endl << "Ok notification " << Endl;
+
t.TestEnv->TestWaitTabletDeletion(runtime, {TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+1, TTestTxConfig::FakeHiveTablets+2});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionOneOf({5, 6}),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionOneOf({5, 6}),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
t.TestEnv->TestWaitShardDeletion(runtime, {1, 2, 3});
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 3));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
- }
- });
- }
-
- Y_UNIT_TEST(ForceDeleteCreateTableInFly) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- TestMkDir(runtime, ++t.TxId, "/MyRoot/DirA/USER_0", "dir");
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0/dir",
- "Name: \"table_0\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]");
-
- AsyncForceDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
-
- Cerr << Endl << "Wait notification " << Endl;
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-3, t.TxId-2, t.TxId-1, t.TxId} );
- Cerr << Endl << "Ok notification " << Endl;
-
+ }
+ });
+ }
+
+ Y_UNIT_TEST(ForceDeleteCreateTableInFly) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/DirA/USER_0", "dir");
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0/dir",
+ "Name: \"table_0\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]");
+
+ AsyncForceDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
+
+ Cerr << Endl << "Wait notification " << Endl;
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-3, t.TxId-2, t.TxId-1, t.TxId} );
+ Cerr << Endl << "Ok notification " << Endl;
+
t.TestEnv->TestWaitTabletDeletion(runtime, {TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+1, TTestTxConfig::FakeHiveTablets+2});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionOneOf({6, 7}),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionOneOf({6, 7}),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
t.TestEnv->TestWaitShardDeletion(runtime, {1, 2, 3});
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 3));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
- }
- });
- }
-
- Y_UNIT_TEST(ForceDeleteSplitInFly) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- TestMkDir(runtime, ++t.TxId, "/MyRoot/DirA/USER_0", "dir");
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0/dir",
- "Name: \"table_0\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-2, t.TxId-1, t.TxId} );
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(0)});
- }
-
- AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0/dir/table_0", R"(
- SourceTabletId: 9437196
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Uint64: 3000000000 } }
- }
- })");
-
- AsyncForceDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(ForceDeleteSplitInFly) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/DirA/USER_0", "dir");
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0/dir",
+ "Name: \"table_0\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-2, t.TxId-1, t.TxId} );
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(0)});
+ }
+
+ AsyncSplitTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0/dir/table_0", R"(
+ SourceTabletId: 9437196
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Uint64: 3000000000 } }
+ }
+ })");
+
+ AsyncForceDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 5));
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(7),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(7),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
t.TestEnv->TestWaitShardDeletion(runtime, {1, 2, 3, 4, 5});
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 3));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
- }
- });
- }
-
- Y_UNIT_TEST(ForceDropDeleteInFly) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
-
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0",
- "Name: \"table_0\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]"
- );
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(5),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(0)});
- }
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0", "table_0");
- AsyncForceDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(ForceDropDeleteInFly) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0",
+ "Name: \"table_0\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]"
+ );
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(5),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(0)});
+ }
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot/DirA/USER_0", "table_0");
+ AsyncForceDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
t.TestEnv->TestWaitTabletDeletion(runtime, {TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+1, TTestTxConfig::FakeHiveTablets+2});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::PathVersionEqual(7),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::PathVersionEqual(7),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
// FIXME: DropTable breaks down during ForceDropSubDomain and leaves table half-dropped
// an additional reboot "fixes" the half-dropped table
RebootTablet(runtime, TTestTxConfig::SchemeShard, runtime.AllocateEdgeActor());
t.TestEnv->TestWaitShardDeletion(runtime, {1, 2, 3});
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 3));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
- }
- });
- }
-
- Y_UNIT_TEST(DoNotLostDeletedTablets) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathVersion pathVersion;
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist});
-
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0",
- "Name: \"Table1\""
- "Columns { Name: \"key1\" Type: \"Uint32\"}"
- "Columns { Name: \"key2\" Type: \"Utf8\"}"
- "Columns { Name: \"key3\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
- "UniformPartitionsCount: 2"
- );
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- // Write some data to the user table
- auto fnWriteRow = [&] (ui64 tabletId) {
- TString writeQuery = R"(
- (
- (let key '( '('key1 (Uint32 '0)) '('key2 (Utf8 'aaaa)) '('key3 (Uint64 '0)) ) )
- (let value '('('Value (Utf8 '281474980010683)) ) )
- (return (AsList (UpdateRow '__user__Table1 key value) ))
- )
- )";
- NKikimrMiniKQL::TResult result;
- TString err;
+ }
+ });
+ }
+
+ Y_UNIT_TEST(DoNotLostDeletedTablets) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathVersion pathVersion;
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ pathVersion = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist});
+
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0",
+ "Name: \"Table1\""
+ "Columns { Name: \"key1\" Type: \"Uint32\"}"
+ "Columns { Name: \"key2\" Type: \"Utf8\"}"
+ "Columns { Name: \"key3\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
+ "UniformPartitionsCount: 2"
+ );
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ // Write some data to the user table
+ auto fnWriteRow = [&] (ui64 tabletId) {
+ TString writeQuery = R"(
+ (
+ (let key '( '('key1 (Uint32 '0)) '('key2 (Utf8 'aaaa)) '('key3 (Uint64 '0)) ) )
+ (let value '('('Value (Utf8 '281474980010683)) ) )
+ (return (AsList (UpdateRow '__user__Table1 key value) ))
+ )
+ )";
+ NKikimrMiniKQL::TResult result;
+ TString err;
NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
- };
-
+ };
+
fnWriteRow(TTestTxConfig::FakeHiveTablets+2);
SetAllowLogBatching(runtime, TTestTxConfig::FakeHiveTablets+2, false);
-
+
fnWriteRow(TTestTxConfig::FakeHiveTablets+3);
SetAllowLogBatching(runtime, TTestTxConfig::FakeHiveTablets+3, true);
-
- TestCopyTable(runtime, ++t.TxId, "/MyRoot/USER_0", "Table2", "/MyRoot/USER_0/Table1");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDropTable(runtime, ++t.TxId, "/MyRoot/USER_0", "Table1");
-
- TDispatchOptions opts;
- opts.FinalEvents.push_back(TDispatchOptions::TFinalEventCondition(TEvDataShard::EvSchemaChangedResult, 2));
- runtime.DispatchEvents(opts);
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- // Drop the last table to trigger parts return
- TestForceDropUnsafe(runtime, ++t.TxId, pathVersion.PathId.LocalPathId);
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
+
+ TestCopyTable(runtime, ++t.TxId, "/MyRoot/USER_0", "Table2", "/MyRoot/USER_0/Table1");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDropTable(runtime, ++t.TxId, "/MyRoot/USER_0", "Table1");
+
+ TDispatchOptions opts;
+ opts.FinalEvents.push_back(TDispatchOptions::TFinalEventCondition(TEvDataShard::EvSchemaChangedResult, 2));
+ runtime.DispatchEvents(opts);
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ // Drop the last table to trigger parts return
+ TestForceDropUnsafe(runtime, ++t.TxId, pathVersion.PathId.LocalPathId);
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets + 6));
-
- });
- }
-
- Y_UNIT_TEST(PathesAndShardsCountersSimultaneousAlterSubDomain) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0",
- "Name: \"Table1\""
- "Columns { Name: \"key1\" Type: \"Uint32\"}"
- "Columns { Name: \"key2\" Type: \"Utf8\"}"
- "Columns { Name: \"key3\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
- "UniformPartitionsCount: 1"
- );
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- AsyncMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "dir");
- AsyncCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0",
- "Name: \"Table2\""
- "Columns { Name: \"key1\" Type: \"Uint32\"}"
- "Columns { Name: \"key2\" Type: \"Utf8\"}"
- "Columns { Name: \"key3\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
- "UniformPartitionsCount: 1"
- );
- t.TestEnv->ReliablePropose(runtime, AlterSubDomainRequest(++t.TxId, "/",
- "StoragePools { "
- " Name: \"pool-1\" "
- " Kind: \"pool-kind-1\" "
- "} "
- "StoragePools { "
- " Name: \"pool-2\" "
- " Kind: \"pool-kind-2\" "
- "} "
- "StoragePools { "
- " Name: \"name_USER_0_kind_hdd-1\" "
- " Kind: \"hdd-1\" "
- "} "
- "StoragePools { "
- " Name: \"name_USER_0_kind_hdd-2\" "
- " Kind: \"hdd-2\" "
- "} "
- "Name: \"MyRoot\""),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1, t.TxId - 2});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathsInsideDomain(3),
- NLs::ShardsInsideDomain(4)});
- }
- });
- }
-}
+
+ });
+ }
+
+ Y_UNIT_TEST(PathesAndShardsCountersSimultaneousAlterSubDomain) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0",
+ "Name: \"Table1\""
+ "Columns { Name: \"key1\" Type: \"Uint32\"}"
+ "Columns { Name: \"key2\" Type: \"Utf8\"}"
+ "Columns { Name: \"key3\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
+ "UniformPartitionsCount: 1"
+ );
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ AsyncMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "dir");
+ AsyncCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0",
+ "Name: \"Table2\""
+ "Columns { Name: \"key1\" Type: \"Uint32\"}"
+ "Columns { Name: \"key2\" Type: \"Utf8\"}"
+ "Columns { Name: \"key3\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"key1\", \"key2\", \"key3\"]"
+ "UniformPartitionsCount: 1"
+ );
+ t.TestEnv->ReliablePropose(runtime, AlterSubDomainRequest(++t.TxId, "/",
+ "StoragePools { "
+ " Name: \"pool-1\" "
+ " Kind: \"pool-kind-1\" "
+ "} "
+ "StoragePools { "
+ " Name: \"pool-2\" "
+ " Kind: \"pool-kind-2\" "
+ "} "
+ "StoragePools { "
+ " Name: \"name_USER_0_kind_hdd-1\" "
+ " Kind: \"hdd-1\" "
+ "} "
+ "StoragePools { "
+ " Name: \"name_USER_0_kind_hdd-2\" "
+ " Kind: \"hdd-2\" "
+ "} "
+ "Name: \"MyRoot\""),
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications});
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1, t.TxId - 2});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathsInsideDomain(3),
+ NLs::ShardsInsideDomain(4)});
+ }
+ });
+ }
+}
diff --git a/ydb/core/tx/schemeshard/ut_subdomain_reboots/ya.make b/ydb/core/tx/schemeshard/ut_subdomain_reboots/ya.make
index 4be42d5316a..bbfc0f75690 100644
--- a/ydb/core/tx/schemeshard/ut_subdomain_reboots/ya.make
+++ b/ydb/core/tx/schemeshard/ut_subdomain_reboots/ya.make
@@ -1,15 +1,15 @@
IF (NOT WITH_VALGRIND)
UNITTEST_FOR(ydb/core/tx/schemeshard)
-
+
OWNER(
vvvv
g:kikimr
)
-
+
FORK_SUBTESTS()
-
+
SPLIT_FACTOR(60)
-
+
IF (SANITIZER_TYPE OR WITH_VALGRIND)
TIMEOUT(3600)
SIZE(LARGE)
@@ -18,7 +18,7 @@ IF (NOT WITH_VALGRIND)
TIMEOUT(600)
SIZE(MEDIUM)
ENDIF()
-
+
PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
diff --git a/ydb/core/tx/schemeshard/ut_ttl.cpp b/ydb/core/tx/schemeshard/ut_ttl.cpp
index cfa95e2700b..d512ad0033c 100644
--- a/ydb/core/tx/schemeshard/ut_ttl.cpp
+++ b/ydb/core/tx/schemeshard/ut_ttl.cpp
@@ -4,14 +4,14 @@
#include <ydb/core/tx/datashard/datashard.h>
using namespace NKikimr;
-using namespace NSchemeShard;
+using namespace NSchemeShard;
using namespace NSchemeShardUT_Private;
static void CheckTTLSettings(TTestActorRuntime& runtime, const char* tableName = "TTLEnabledTable") {
TestDescribeResult(
DescribePath(runtime, Sprintf("/MyRoot/%s", tableName)), {
NLs::PathExist,
- NLs::Finished, [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ NLs::Finished, [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
const auto& table = record.GetPathDescription().GetTable();
UNIT_ASSERT(table.HasTTLSettings());
@@ -74,7 +74,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTTLTests) {
ColumnName: "created_at"
}
}
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
}
Y_UNIT_TEST(CreateTableShouldFailOnWrongColumnType) {
@@ -92,7 +92,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTTLTests) {
ColumnName: "modified_at"
}
}
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
}
void CreateTableShouldFailOnWrongUnit(const char* ttlColumnType, const char* unit) {
@@ -111,7 +111,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTTLTests) {
ColumnUnit: %s
}
}
- )", ttlColumnType, unit), {NKikimrScheme::StatusSchemeError});
+ )", ttlColumnType, unit), {NKikimrScheme::StatusSchemeError});
}
Y_UNIT_TEST(CreateTableShouldFailOnWrongUnit) {
@@ -138,7 +138,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTTLTests) {
KeyColumnNames: ["key"]
TTLSettings {
}
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
}
void CreateTableOnIndexedTable(NKikimrSchemeOp::EIndexType indexType, bool enableTtlOnAsyncIndexedTables = false) {
@@ -152,8 +152,8 @@ Y_UNIT_TEST_SUITE(TSchemeShardTTLTests) {
const bool shouldSucceed = (indexType != NKikimrSchemeOp::EIndexTypeGlobalAsync || enableTtlOnAsyncIndexedTables);
const auto status = shouldSucceed
- ? NKikimrScheme::StatusAccepted
- : NKikimrScheme::StatusPreconditionFailed;
+ ? NKikimrScheme::StatusAccepted
+ : NKikimrScheme::StatusPreconditionFailed;
TestCreateIndexedTable(runtime, ++txId, "/MyRoot", Sprintf(R"(
TableDescription {
@@ -221,7 +221,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTTLTests) {
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "TTLEnabledTable"
DropColumns { Name: "modified_at" }
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "TTLEnabledTable"
@@ -234,7 +234,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTTLTests) {
TestDescribeResult(
DescribePath(runtime, "/MyRoot/TTLEnabledTable"), {
NLs::PathExist,
- NLs::Finished, [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
+ NLs::Finished, [=] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
const auto& table = record.GetPathDescription().GetTable();
UNIT_ASSERT(table.HasTTLSettings());
UNIT_ASSERT(table.GetTTLSettings().HasDisabled());
@@ -290,7 +290,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTTLTests) {
ColumnName: "modified_at"
}
}
- )", {NKikimrScheme::StatusInvalidParameter});
+ )", {NKikimrScheme::StatusInvalidParameter});
}
void AlterTableOnIndexedTable(NKikimrSchemeOp::EIndexType indexType, bool enableTtlOnAsyncIndexedTables = false) {
@@ -319,8 +319,8 @@ Y_UNIT_TEST_SUITE(TSchemeShardTTLTests) {
const bool shouldSucceed = (indexType != NKikimrSchemeOp::EIndexTypeGlobalAsync || enableTtlOnAsyncIndexedTables);
const auto status = shouldSucceed
- ? NKikimrScheme::StatusAccepted
- : NKikimrScheme::StatusPreconditionFailed;
+ ? NKikimrScheme::StatusAccepted
+ : NKikimrScheme::StatusPreconditionFailed;
TestAlterTable(runtime, ++txId, "/MyRoot", R"(
Name: "TTLEnabledTable"
@@ -355,43 +355,43 @@ Y_UNIT_TEST_SUITE(TSchemeShardTTLTests) {
.EnableAsyncIndexes(true)
.EnableTtlOnAsyncIndexedTables(enableTtlOnAsyncIndexedTables);
- TTestBasicRuntime runtime;
+ TTestBasicRuntime runtime;
TTestEnv env(runtime, opts);
- ui64 txId = 100;
-
- TestCreateTable(runtime, ++txId, "/MyRoot", R"(
- Name: "TTLEnabledTable"
- Columns { Name: "key" Type: "Uint64" }
- Columns { Name: "value" Type: "Uint64" }
- Columns { Name: "modified_at" Type: "Timestamp" }
- KeyColumnNames: ["key"]
- TTLSettings {
- Enabled {
- ColumnName: "modified_at"
- ExpireAfterSeconds: 3600
- }
- }
- )");
- env.TestWaitNotification(runtime, txId);
- CheckTTLSettings(runtime);
-
+ ui64 txId = 100;
+
+ TestCreateTable(runtime, ++txId, "/MyRoot", R"(
+ Name: "TTLEnabledTable"
+ Columns { Name: "key" Type: "Uint64" }
+ Columns { Name: "value" Type: "Uint64" }
+ Columns { Name: "modified_at" Type: "Timestamp" }
+ KeyColumnNames: ["key"]
+ TTLSettings {
+ Enabled {
+ ColumnName: "modified_at"
+ ExpireAfterSeconds: 3600
+ }
+ }
+ )");
+ env.TestWaitNotification(runtime, txId);
+ CheckTTLSettings(runtime);
+
const bool shouldSucceed = (indexType != NKikimrSchemeOp::EIndexTypeGlobalAsync || enableTtlOnAsyncIndexedTables);
const auto status = shouldSucceed
? Ydb::StatusIds::SUCCESS
: Ydb::StatusIds::PRECONDITION_FAILED;
-
+
TestBuilIndex(runtime, ++txId, TTestTxConfig::SchemeShard, "/MyRoot", "/MyRoot/TTLEnabledTable",
TBuildIndexConfig{"UserDefinedIndexByValue", indexType, {"value"}, {}}, status);
if (shouldSucceed) {
env.TestWaitNotification(runtime, txId);
TestDescribeResult(DescribePath(runtime, "/MyRoot/TTLEnabledTable"), {
- NLs::PathExist,
- NLs::Finished,
+ NLs::PathExist,
+ NLs::Finished,
NLs::IndexesCount(1),
});
}
- }
+ }
Y_UNIT_TEST(BuildIndexShouldSucceed) {
BuildIndex(NKikimrSchemeOp::EIndexTypeGlobal);
@@ -739,7 +739,7 @@ Y_UNIT_TEST_SUITE(TSchemeShardTTLTests) {
}
}
}
- )", {NKikimrScheme::StatusSchemeError});
+ )", {NKikimrScheme::StatusSchemeError});
}
Y_UNIT_TEST(ShouldSkipDroppedColumn) {
diff --git a/ydb/core/tx/schemeshard/ut_upgradesubdomain.cpp b/ydb/core/tx/schemeshard/ut_upgradesubdomain.cpp
index b77a5159183..1ee6456acb1 100644
--- a/ydb/core/tx/schemeshard/ut_upgradesubdomain.cpp
+++ b/ydb/core/tx/schemeshard/ut_upgradesubdomain.cpp
@@ -1,841 +1,841 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
-
+
#include <util/system/env.h>
-using namespace NKikimr;
-using namespace NSchemeShard;
-using namespace NSchemeShardUT_Private;
-
-Y_UNIT_TEST_SUITE(TSchemeShardUpgradeSubDomainTest) {
- Y_UNIT_TEST(Fake) {
- }
-
- Y_UNIT_TEST(UpgradeEmptyDomainCommit) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\" "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2");
- env.TestWaitNotification(runtime, {txId, txId - 1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsSubDomain("USER_0"),
+using namespace NKikimr;
+using namespace NSchemeShard;
+using namespace NSchemeShardUT_Private;
+
+Y_UNIT_TEST_SUITE(TSchemeShardUpgradeSubDomainTest) {
+ Y_UNIT_TEST(Fake) {
+ }
+
+ Y_UNIT_TEST(UpgradeEmptyDomainCommit) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2");
+ env.TestWaitNotification(runtime, {txId, txId - 1});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsSubDomain("USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::PathVersionEqual(4)});
-
- TestUpgradeSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
- env.TestWaitNotification(runtime, txId);
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
+ NLs::PathVersionEqual(4)});
+
+ TestUpgradeSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
+ env.TestWaitNotification(runtime, txId);
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::PathVersionEqual(5)});
-
+ NLs::PathVersionEqual(5)});
+
UNIT_ASSERT(tenantSchemeShard == TTestTxConfig::FakeHiveTablets + 2);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathIdEqual(1),
- NLs::IsSubDomain("MyRoot/USER_0"),
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathIdEqual(1),
+ NLs::IsSubDomain("MyRoot/USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
-
- TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA", {NKikimrScheme::StatusMultipleModifications});
- TestMkDir(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0", "DirA", {NKikimrScheme::StatusReadOnly});
-
-
- TestUpgradeSubDomainDecision(runtime, ++txId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
+
+ TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA", {NKikimrScheme::StatusMultipleModifications});
+ TestMkDir(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0", "DirA", {NKikimrScheme::StatusReadOnly});
+
+
+ TestUpgradeSubDomainDecision(runtime, ++txId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::PathVersionEqual(6)});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathIdEqual(1),
- NLs::IsSubDomain("MyRoot/USER_0"),
+ NLs::PathVersionEqual(6)});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathIdEqual(1),
+ NLs::IsSubDomain("MyRoot/USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
-
- TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA", {NKikimrScheme::StatusRedirectDomain});
- TestMkDir(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0", "DirA");
- env.TestWaitNotification(runtime, txId);
-
- }
-
- Y_UNIT_TEST(UpgradeEmptyDomainUndo) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\" "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2");
- env.TestWaitNotification(runtime, {txId, txId - 1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsSubDomain("USER_0"),
+
+ TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA", {NKikimrScheme::StatusRedirectDomain});
+ TestMkDir(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0", "DirA");
+ env.TestWaitNotification(runtime, txId);
+
+ }
+
+ Y_UNIT_TEST(UpgradeEmptyDomainUndo) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2");
+ env.TestWaitNotification(runtime, {txId, txId - 1});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsSubDomain("USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::PathVersionEqual(4)});
-
- TestUpgradeSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
- env.TestWaitNotification(runtime, txId);
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
+ NLs::PathVersionEqual(4)});
+
+ TestUpgradeSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
+ env.TestWaitNotification(runtime, txId);
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
NLs::DomainSchemeshard(TTestTxConfig::FakeHiveTablets + 2),
- NLs::PathVersionEqual(5)});
-
+ NLs::PathVersionEqual(5)});
+
UNIT_ASSERT(tenantSchemeShard == TTestTxConfig::FakeHiveTablets + 2);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathIdEqual(1),
- NLs::IsSubDomain("MyRoot/USER_0"),
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathIdEqual(1),
+ NLs::IsSubDomain("MyRoot/USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
-
- TestUpgradeSubDomainDecision(runtime, ++txId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Undo); // 104
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsSubDomain("USER_0"),
+
+ TestUpgradeSubDomainDecision(runtime, ++txId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Undo); // 104
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsSubDomain("USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::DomainSchemeshard(0),
- NLs::PathVersionEqual(105)});
-
- TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA");
- env.TestWaitNotification(runtime, txId);
-
+ NLs::DomainSchemeshard(0),
+ NLs::PathVersionEqual(105)});
+
+ TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA");
+ env.TestWaitNotification(runtime, txId);
+
env.TestWaitTabletDeletion(runtime, TTestTxConfig::FakeHiveTablets + 2);
-
- }
-
- Y_UNIT_TEST(UpgradeDomainWithDirsCommit) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\" "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2");
- env.TestWaitNotification(runtime, {txId, txId - 1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsSubDomain("USER_0"),
+
+ }
+
+ Y_UNIT_TEST(UpgradeDomainWithDirsCommit) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2");
+ env.TestWaitNotification(runtime, {txId, txId - 1});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsSubDomain("USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::PathVersionEqual(4),
- NLs::NoChildren});
-
- TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA");
- env.TestWaitNotification(runtime, txId);
- TUserAttrs userAttrs({{"ATTR1", "VALUE1"}, {"ATTR2", "VALUE2"}});
- TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirB", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(userAttrs));
- env.TestWaitNotification(runtime, txId);
- TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA/DirC");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA"),
- {NLs::PathExist,
- NLs::Finished,
+ NLs::PathVersionEqual(4),
+ NLs::NoChildren});
+
+ TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA");
+ env.TestWaitNotification(runtime, txId);
+ TUserAttrs userAttrs({{"ATTR1", "VALUE1"}, {"ATTR2", "VALUE2"}});
+ TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirB", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(userAttrs));
+ env.TestWaitNotification(runtime, txId);
+ TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA/DirC");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA"),
+ {NLs::PathExist,
+ NLs::Finished,
NLs::PathIdEqual(NKikimr::TPathId(TTestTxConfig::SchemeShard, 3)),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::ChildrenCount(1)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirB"),
- {NLs::PathExist,
- NLs::Finished,
+ NLs::ChildrenCount(1)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirB"),
+ {NLs::PathExist,
+ NLs::Finished,
NLs::PathIdEqual(NKikimr::TPathId(TTestTxConfig::SchemeShard, 4)),
- NLs::NoChildren});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA/DirC"),
- {NLs::PathExist,
- NLs::Finished,
+ NLs::NoChildren});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA/DirC"),
+ {NLs::PathExist,
+ NLs::Finished,
NLs::PathIdEqual(NKikimr::TPathId(TTestTxConfig::SchemeShard, 5)),
- NLs::NoChildren});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsSubDomain("USER_0"),
- NLs::PathVersionEqual(8),
- NLs::ChildrenCount(2)});
-
- TestUpgradeSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
- env.TestWaitNotification(runtime, txId);
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
+ NLs::NoChildren});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsSubDomain("USER_0"),
+ NLs::PathVersionEqual(8),
+ NLs::ChildrenCount(2)});
+
+ TestUpgradeSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
+ env.TestWaitNotification(runtime, txId);
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
NLs::DomainSchemeshard(TTestTxConfig::FakeHiveTablets + 2),
- NLs::PathVersionEqual(9)});
+ NLs::PathVersionEqual(9)});
UNIT_ASSERT(tenantSchemeShard == TTestTxConfig::FakeHiveTablets + 2);
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathIdEqual(1),
- NLs::IsSubDomain("MyRoot/USER_0"),
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathIdEqual(1),
+ NLs::IsSubDomain("MyRoot/USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
-
- TestUpgradeSubDomainDecision(runtime, ++txId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
+
+ TestUpgradeSubDomainDecision(runtime, ++txId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::DomainSchemeshard(tenantSchemeShard),
- NLs::PathVersionEqual(10),
- NLs::NoChildren});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA"),
- {NLs::PathRedirected});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathIdEqual(NKikimr::TPathId(tenantSchemeShard, 1)),
- NLs::IsSubDomain("MyRoot/USER_0"),
+ NLs::DomainSchemeshard(tenantSchemeShard),
+ NLs::PathVersionEqual(10),
+ NLs::NoChildren});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA"),
+ {NLs::PathRedirected});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathIdEqual(NKikimr::TPathId(tenantSchemeShard, 1)),
+ NLs::IsSubDomain("MyRoot/USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::ChildrenCount(2)});
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
- {NLs::PathExist,
- NLs::Finished,
+ NLs::ChildrenCount(2)});
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
+ {NLs::PathExist,
+ NLs::Finished,
NLs::PathIdEqual(NKikimr::TPathId(TTestTxConfig::SchemeShard, 3)),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::ChildrenCount(1)});
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirB"),
- {NLs::PathExist,
- NLs::Finished,
+ NLs::ChildrenCount(1)});
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirB"),
+ {NLs::PathExist,
+ NLs::Finished,
NLs::PathIdEqual(NKikimr::TPathId(TTestTxConfig::SchemeShard, 4)),
- NLs::NoChildren,
- NLs::UserAttrsEqual(userAttrs)});
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/DirC"),
- {NLs::PathExist,
- NLs::Finished,
+ NLs::NoChildren,
+ NLs::UserAttrsEqual(userAttrs)});
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/DirC"),
+ {NLs::PathExist,
+ NLs::Finished,
NLs::PathIdEqual(NKikimr::TPathId(TTestTxConfig::SchemeShard, 5)),
- NLs::NoChildren});
- }
-
- Y_UNIT_TEST(UpgradeDomainWithDirsUndo) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\" "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2");
- env.TestWaitNotification(runtime, {txId, txId - 1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsSubDomain("USER_0"),
+ NLs::NoChildren});
+ }
+
+ Y_UNIT_TEST(UpgradeDomainWithDirsUndo) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2");
+ env.TestWaitNotification(runtime, {txId, txId - 1});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsSubDomain("USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::PathVersionEqual(4),
- NLs::NoChildren});
-
- TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA");
- env.TestWaitNotification(runtime, txId);
- TUserAttrs userAttrs({{"ATTR1", "VALUE1"}, {"ATTR2", "VALUE2"}});
- TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirB", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(userAttrs));
- env.TestWaitNotification(runtime, txId);
- TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA/DirC");
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA"),
- {NLs::PathExist,
- NLs::Finished,
+ NLs::PathVersionEqual(4),
+ NLs::NoChildren});
+
+ TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA");
+ env.TestWaitNotification(runtime, txId);
+ TUserAttrs userAttrs({{"ATTR1", "VALUE1"}, {"ATTR2", "VALUE2"}});
+ TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirB", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(userAttrs));
+ env.TestWaitNotification(runtime, txId);
+ TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA/DirC");
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA"),
+ {NLs::PathExist,
+ NLs::Finished,
NLs::PathIdEqual(NKikimr::TPathId(TTestTxConfig::SchemeShard, 3)),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::ChildrenCount(1)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirB"),
- {NLs::PathExist,
- NLs::Finished,
+ NLs::ChildrenCount(1)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirB"),
+ {NLs::PathExist,
+ NLs::Finished,
NLs::PathIdEqual(NKikimr::TPathId(TTestTxConfig::SchemeShard, 4)),
- NLs::NoChildren});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA/DirC"),
- {NLs::PathExist,
- NLs::Finished,
+ NLs::NoChildren});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA/DirC"),
+ {NLs::PathExist,
+ NLs::Finished,
NLs::PathIdEqual(NKikimr::TPathId(TTestTxConfig::SchemeShard, 5)),
- NLs::NoChildren});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsSubDomain("USER_0"),
- NLs::PathVersionEqual(8),
- NLs::ChildrenCount(2),
- NLs::PathsInsideDomain(3)});
-
- TestUpgradeSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
- env.TestWaitNotification(runtime, txId);
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
+ NLs::NoChildren});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsSubDomain("USER_0"),
+ NLs::PathVersionEqual(8),
+ NLs::ChildrenCount(2),
+ NLs::PathsInsideDomain(3)});
+
+ TestUpgradeSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
+ env.TestWaitNotification(runtime, txId);
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
NLs::DomainSchemeshard(TTestTxConfig::FakeHiveTablets + 2),
- NLs::PathVersionEqual(9)});
+ NLs::PathVersionEqual(9)});
UNIT_ASSERT(tenantSchemeShard == TTestTxConfig::FakeHiveTablets + 2);
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathIdEqual(1),
- NLs::IsSubDomain("MyRoot/USER_0"),
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathIdEqual(1),
+ NLs::IsSubDomain("MyRoot/USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
-
- TestUpgradeSubDomainDecision(runtime, ++txId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Undo);
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsSubDomain("USER_0"),
+
+ TestUpgradeSubDomainDecision(runtime, ++txId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Undo);
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsSubDomain("USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::DomainSchemeshard(0),
- NLs::PathVersionEqual(109),
- NLs::ChildrenCount(2),
- NLs::PathsInsideDomain(3)});
-
+ NLs::DomainSchemeshard(0),
+ NLs::PathVersionEqual(109),
+ NLs::ChildrenCount(2),
+ NLs::PathsInsideDomain(3)});
+
env.TestWaitTabletDeletion(runtime, TTestTxConfig::FakeHiveTablets + 2);
- }
-
- Y_UNIT_TEST(UpgradeDomainWithTablesCommit) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\" "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2");
- env.TestWaitNotification(runtime, {txId, txId - 1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsSubDomain("USER_0"),
+ }
+
+ Y_UNIT_TEST(UpgradeDomainWithTablesCommit) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2");
+ env.TestWaitNotification(runtime, {txId, txId - 1});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsSubDomain("USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::PathVersionEqual(4),
- NLs::NoChildren,
- NLs::ShardsInsideDomain(2)});
-
- TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA");
- TUserAttrs userAttrs({{"ATTR1", "VALUE1"}, {"ATTR2", "VALUE2"}});
- TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirB", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(userAttrs));
- TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA/DirC");
-
- TestCreateTable(runtime, ++txId, "/MyRoot/USER_0/DirA",
- "Name: \"table_1\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]");
- TestCreateTable(runtime, ++txId, "/MyRoot/USER_0/DirB",
- "Name: \"table_2\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]");
- TestCreateTable(runtime, ++txId, "/MyRoot/USER_0/DirA/DirC",
- "Name: \"table_3\""
- "Columns { Name: \"RowId\" Type: \"Uint64\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]");
- env.TestWaitNotification(runtime, {txId-5, txId-4, txId-3, txId-2, txId -1, txId});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA"),
- {NLs::PathExist,
- NLs::Finished,
- NLs::ChildrenCount(2),
- NLs::PathsInsideDomain(6),
- NLs::ShardsInsideDomain(5)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA/table_1"),
- {NLs::PathExist,
- NLs::Finished,
- NLs::IsTable,
+ NLs::PathVersionEqual(4),
+ NLs::NoChildren,
+ NLs::ShardsInsideDomain(2)});
+
+ TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA");
+ TUserAttrs userAttrs({{"ATTR1", "VALUE1"}, {"ATTR2", "VALUE2"}});
+ TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirB", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(userAttrs));
+ TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA/DirC");
+
+ TestCreateTable(runtime, ++txId, "/MyRoot/USER_0/DirA",
+ "Name: \"table_1\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]");
+ TestCreateTable(runtime, ++txId, "/MyRoot/USER_0/DirB",
+ "Name: \"table_2\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]");
+ TestCreateTable(runtime, ++txId, "/MyRoot/USER_0/DirA/DirC",
+ "Name: \"table_3\""
+ "Columns { Name: \"RowId\" Type: \"Uint64\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]");
+ env.TestWaitNotification(runtime, {txId-5, txId-4, txId-3, txId-2, txId -1, txId});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA"),
+ {NLs::PathExist,
+ NLs::Finished,
+ NLs::ChildrenCount(2),
+ NLs::PathsInsideDomain(6),
+ NLs::ShardsInsideDomain(5)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA/table_1"),
+ {NLs::PathExist,
+ NLs::Finished,
+ NLs::IsTable,
NLs::PathIdEqual(NKikimr::TPathId(TTestTxConfig::SchemeShard, 6)),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirB/table_2"),
- {NLs::PathExist,
- NLs::Finished,
- NLs::IsTable,
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirB/table_2"),
+ {NLs::PathExist,
+ NLs::Finished,
+ NLs::IsTable,
NLs::PathIdEqual(NKikimr::TPathId(TTestTxConfig::SchemeShard, 7)),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA/DirC"),
- {NLs::PathExist,
- NLs::Finished,
- NLs::ChildrenCount(1)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA/DirC/table_3"),
- {NLs::PathExist,
- NLs::Finished,
- NLs::IsTable,
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA/DirC"),
+ {NLs::PathExist,
+ NLs::Finished,
+ NLs::ChildrenCount(1)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA/DirC/table_3"),
+ {NLs::PathExist,
+ NLs::Finished,
+ NLs::IsTable,
NLs::PathIdEqual(NKikimr::TPathId(TTestTxConfig::SchemeShard, 8)),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsSubDomain("USER_0"),
- NLs::PathVersionEqual(8),
- NLs::ChildrenCount(2)});
-
- TestUpgradeSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
- env.TestWaitNotification(runtime, txId);
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsSubDomain("USER_0"),
+ NLs::PathVersionEqual(8),
+ NLs::ChildrenCount(2)});
+
+ TestUpgradeSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
+ env.TestWaitNotification(runtime, txId);
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
NLs::DomainSchemeshard(TTestTxConfig::FakeHiveTablets + 5),
- NLs::NoChildren,
- NLs::PathVersionEqual(9)});
-
+ NLs::NoChildren,
+ NLs::PathVersionEqual(9)});
+
UNIT_ASSERT(tenantSchemeShard == TTestTxConfig::FakeHiveTablets + 5);
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathIdEqual(1),
- NLs::IsSubDomain("MyRoot/USER_0"),
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathIdEqual(1),
+ NLs::IsSubDomain("MyRoot/USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA"),
- {NLs::PathRedirected,
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA"),
+ {NLs::PathRedirected,
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
NLs::DomainSchemeshard(TTestTxConfig::FakeHiveTablets + 5)});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
- {NLs::PathExist,
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
+ {NLs::PathExist,
NLs::PathIdEqual(TPathId(TTestTxConfig::SchemeShard, 3)),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/table_1"),
- {NLs::PathExist,
- NLs::IsTable,
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/table_1"),
+ {NLs::PathExist,
+ NLs::IsTable,
NLs::PathIdEqual(TPathId(TTestTxConfig::SchemeShard, 6)),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
-
- TestUpgradeSubDomainDecision(runtime, ++txId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
+
+ TestUpgradeSubDomainDecision(runtime, ++txId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::DomainSchemeshard(tenantSchemeShard),
- NLs::PathVersionEqual(10),
- NLs::NoChildren});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathIdEqual(NKikimr::TPathId(tenantSchemeShard, 1)),
- NLs::IsSubDomain("MyRoot/USER_0"),
+ NLs::DomainSchemeshard(tenantSchemeShard),
+ NLs::PathVersionEqual(10),
+ NLs::NoChildren});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathIdEqual(NKikimr::TPathId(tenantSchemeShard, 1)),
+ NLs::IsSubDomain("MyRoot/USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::ChildrenCount(2),
- NLs::PathsInsideDomain(6),
- NLs::ShardsInsideDomain(6)});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
- {NLs::PathExist,
- NLs::Finished,
+ NLs::ChildrenCount(2),
+ NLs::PathsInsideDomain(6),
+ NLs::ShardsInsideDomain(6)});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
+ {NLs::PathExist,
+ NLs::Finished,
NLs::PathIdEqual(NKikimr::TPathId(TTestTxConfig::SchemeShard, 3)),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::ChildrenCount(2)});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/table_1"),
- {NLs::PathExist,
- NLs::IsTable,
+ NLs::ChildrenCount(2)});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/table_1"),
+ {NLs::PathExist,
+ NLs::IsTable,
NLs::PathIdEqual(TPathId(TTestTxConfig::SchemeShard, 6)),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
- }
-
- Y_UNIT_TEST(UpgradeDomainCommitDelete) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++txId, "/MyRoot",R"(
- Name: "USER_0"
- PlanResolution: 50
- Coordinators: 1
- Mediators: 1
- TimeCastBucketsPerMediator: 2
- )");
- env.TestWaitNotification(runtime, {txId, txId - 1});
+ }
+
+ Y_UNIT_TEST(UpgradeDomainCommitDelete) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++txId, "/MyRoot",R"(
+ Name: "USER_0"
+ PlanResolution: 50
+ Coordinators: 1
+ Mediators: 1
+ TimeCastBucketsPerMediator: 2
+ )");
+ env.TestWaitNotification(runtime, {txId, txId - 1});
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 2));
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 2));
-
- TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA");
- TestCreateTable(runtime, ++txId, "/MyRoot/USER_0/DirA",R"(
- Name: "Table1"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
- )");
- TestCreateTable(runtime, ++txId, "/MyRoot/USER_0/",R"(
- Name: "Table2"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
- )");
- env.TestWaitNotification(runtime, {txId-2, txId -1, txId});
-
- TestUpgradeSubDomain(runtime, ++txId, "/MyRoot", "USER_0"); //106
- env.TestWaitNotification(runtime, txId);
-
- TestUpgradeSubDomainDecision(runtime, ++txId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit); //107
- env.TestWaitNotification(runtime, txId);
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
+
+ TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA");
+ TestCreateTable(runtime, ++txId, "/MyRoot/USER_0/DirA",R"(
+ Name: "Table1"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
+ )");
+ TestCreateTable(runtime, ++txId, "/MyRoot/USER_0/",R"(
+ Name: "Table2"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
+ )");
+ env.TestWaitNotification(runtime, {txId-2, txId -1, txId});
+
+ TestUpgradeSubDomain(runtime, ++txId, "/MyRoot", "USER_0"); //106
+ env.TestWaitNotification(runtime, txId);
+
+ TestUpgradeSubDomainDecision(runtime, ++txId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit); //107
+ env.TestWaitNotification(runtime, txId);
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 2));
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 2));
- TestMkDir(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0", "DirB");
- TestCreateTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0/DirB",R"(
- Name: "Table3"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
- )");
- env.TestWaitNotification(runtime, {txId-1, txId}, tenantSchemeShard);
-
- TestForceDropExtSubDomain(runtime, ++txId, "/MyRoot", "USER_0"); //110
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::NoChildren,
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(0)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/Table2"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA/Table1"),
- {NLs::PathNotExist});
-
+ TestMkDir(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0", "DirB");
+ TestCreateTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0/DirB",R"(
+ Name: "Table3"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
+ )");
+ env.TestWaitNotification(runtime, {txId-1, txId}, tenantSchemeShard);
+
+ TestForceDropExtSubDomain(runtime, ++txId, "/MyRoot", "USER_0"); //110
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::NoChildren,
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(0)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/Table2"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA/Table1"),
+ {NLs::PathNotExist});
+
env.TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+9));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 2));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 2));
- }
-
- Y_UNIT_TEST(UpgradeDomainCommitRecreateShard) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++txId, "/MyRoot",R"(
- Name: "USER_0"
- PlanResolution: 50
- Coordinators: 1
- Mediators: 1
- TimeCastBucketsPerMediator: 2
- )");
- env.TestWaitNotification(runtime, {txId, txId - 1});
-
- TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA");
- TestCreateTable(runtime, ++txId, "/MyRoot/USER_0/DirA", R"(
- Name: "Table1"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
- )");
-
- env.TestWaitNotification(runtime, {txId -1, txId});
-
- TestUpgradeSubDomain(runtime, ++txId, "/MyRoot", "USER_0"); //106
- env.TestWaitNotification(runtime, txId);
-
- TestUpgradeSubDomainDecision(runtime, ++txId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit); //107
- env.TestWaitNotification(runtime, txId);
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
-
- TestAlterTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0/DirA",R"(
- Name: "Table1"
- PartitionConfig {
+ }
+
+ Y_UNIT_TEST(UpgradeDomainCommitRecreateShard) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++txId, "/MyRoot",R"(
+ Name: "USER_0"
+ PlanResolution: 50
+ Coordinators: 1
+ Mediators: 1
+ TimeCastBucketsPerMediator: 2
+ )");
+ env.TestWaitNotification(runtime, {txId, txId - 1});
+
+ TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA");
+ TestCreateTable(runtime, ++txId, "/MyRoot/USER_0/DirA", R"(
+ Name: "Table1"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
+ )");
+
+ env.TestWaitNotification(runtime, {txId -1, txId});
+
+ TestUpgradeSubDomain(runtime, ++txId, "/MyRoot", "USER_0"); //106
+ env.TestWaitNotification(runtime, txId);
+
+ TestUpgradeSubDomainDecision(runtime, ++txId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit); //107
+ env.TestWaitNotification(runtime, txId);
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
+
+ TestAlterTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0/DirA",R"(
+ Name: "Table1"
+ PartitionConfig {
CrossDataCenterFollowerCount: 1
- }
- )");
- env.TestWaitNotification(runtime, txId, tenantSchemeShard);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table1"),
- {NLs::PathExist,
- NLs::IsTable});
- }
-
- Y_UNIT_TEST(UpgradeDomainWithInactiveShards) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\" "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2");
- env.TestWaitNotification(runtime, {txId, txId - 1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsSubDomain("USER_0"),
+ }
+ )");
+ env.TestWaitNotification(runtime, txId, tenantSchemeShard);
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table1"),
+ {NLs::PathExist,
+ NLs::IsTable});
+ }
+
+ Y_UNIT_TEST(UpgradeDomainWithInactiveShards) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2");
+ env.TestWaitNotification(runtime, {txId, txId - 1});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsSubDomain("USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::PathVersionEqual(4),
- NLs::NoChildren,
- NLs::ShardsInsideDomain(2)});
-
- TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA");
- env.TestWaitNotification(runtime, txId);
-
- TestCreateTable(runtime, ++txId, "/MyRoot/USER_0/DirA",
- "Name: \"table_1\""
- "Columns { Name: \"RowId\" Type: \"Utf8\"}"
- "Columns { Name: \"Value\" Type: \"Utf8\"}"
- "KeyColumnNames: [\"RowId\"]");
- env.TestWaitNotification(runtime, txId);
-
- {
- // Write some data to the user table
- auto fnWriteRow = [&] (ui64 tabletId, TString key) {
- TString writeQuery = Sprintf( R"(
- (
- (let key '( '('RowId (Utf8 '%s)) ) )
- (let value '('('Value (Utf8 '281474980010683)) ) )
- (return (AsList (UpdateRow '__user__table_1 key value) ))
- )
- )", key.c_str());
- NKikimrMiniKQL::TResult result;
- TString err;
+ NLs::PathVersionEqual(4),
+ NLs::NoChildren,
+ NLs::ShardsInsideDomain(2)});
+
+ TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA");
+ env.TestWaitNotification(runtime, txId);
+
+ TestCreateTable(runtime, ++txId, "/MyRoot/USER_0/DirA",
+ "Name: \"table_1\""
+ "Columns { Name: \"RowId\" Type: \"Utf8\"}"
+ "Columns { Name: \"Value\" Type: \"Utf8\"}"
+ "KeyColumnNames: [\"RowId\"]");
+ env.TestWaitNotification(runtime, txId);
+
+ {
+ // Write some data to the user table
+ auto fnWriteRow = [&] (ui64 tabletId, TString key) {
+ TString writeQuery = Sprintf( R"(
+ (
+ (let key '( '('RowId (Utf8 '%s)) ) )
+ (let value '('('Value (Utf8 '281474980010683)) ) )
+ (return (AsList (UpdateRow '__user__table_1 key value) ))
+ )
+ )", key.c_str());
+ NKikimrMiniKQL::TResult result;
+ TString err;
NKikimrProto::EReplyStatus status = LocalMiniKQL(runtime, tabletId, writeQuery, result, err);
- UNIT_ASSERT_VALUES_EQUAL(err, "");
+ UNIT_ASSERT_VALUES_EQUAL(err, "");
UNIT_ASSERT_VALUES_EQUAL(status, NKikimrProto::EReplyStatus::OK);;
- };
-
+ };
+
fnWriteRow(TTestTxConfig::FakeHiveTablets + 2, "AAA");
fnWriteRow(TTestTxConfig::FakeHiveTablets + 2, "ZZZ");
- }
-
- TestSplitTable(runtime, ++txId, "/MyRoot/USER_0/DirA/table_1", R"(
- SourceTabletId: 9437196
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "BBB" } }
- }
- })");
- env.TestWaitNotification(runtime, txId);
-
+ }
+
+ TestSplitTable(runtime, ++txId, "/MyRoot/USER_0/DirA/table_1", R"(
+ SourceTabletId: 9437196
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "BBB" } }
+ }
+ })");
+ env.TestWaitNotification(runtime, txId);
+
for (ui32 index = 2; index <= 4; ++index) {
auto subDomainPathId = TestFindTabletSubDomainPathId(runtime, TTestTxConfig::FakeHiveTablets + 2);
UNIT_ASSERT_VALUES_EQUAL(subDomainPathId, TPathId(TTestTxConfig::SchemeShard, 2));
}
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA"),
- {NLs::PathExist,
- NLs::Finished,
- NLs::ChildrenCount(1),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(5)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA/table_1"),
- {NLs::PathExist,
- NLs::Finished,
- NLs::IsTable,
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA"),
+ {NLs::PathExist,
+ NLs::Finished,
+ NLs::ChildrenCount(1),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(5)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA/table_1"),
+ {NLs::PathExist,
+ NLs::Finished,
+ NLs::IsTable,
NLs::PathIdEqual(NKikimr::TPathId(TTestTxConfig::SchemeShard, 4)),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsSubDomain("USER_0"),
- NLs::PathVersionEqual(6),
- NLs::ChildrenCount(1)});
-
- TestUpgradeSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
- env.TestWaitNotification(runtime, txId);
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsSubDomain("USER_0"),
+ NLs::PathVersionEqual(6),
+ NLs::ChildrenCount(1)});
+
+ TestUpgradeSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
+ env.TestWaitNotification(runtime, txId);
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
NLs::DomainSchemeshard(TTestTxConfig::FakeHiveTablets + 5),
- NLs::NoChildren,
- NLs::PathVersionEqual(7)});
-
- TestUpgradeSubDomainDecision(runtime, ++txId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
- env.TestWaitNotification(runtime, txId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
+ NLs::NoChildren,
+ NLs::PathVersionEqual(7)});
+
+ TestUpgradeSubDomainDecision(runtime, ++txId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
+ env.TestWaitNotification(runtime, txId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::DomainSchemeshard(tenantSchemeShard),
- NLs::PathVersionEqual(8),
- NLs::NoChildren});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathIdEqual(NKikimr::TPathId(tenantSchemeShard, 1)),
- NLs::IsSubDomain("MyRoot/USER_0"),
+ NLs::DomainSchemeshard(tenantSchemeShard),
+ NLs::PathVersionEqual(8),
+ NLs::NoChildren});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathIdEqual(NKikimr::TPathId(tenantSchemeShard, 1)),
+ NLs::IsSubDomain("MyRoot/USER_0"),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::ChildrenCount(1),
- NLs::PathsInsideDomain(2),
- NLs::ShardsInsideDomain(5)});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
- {NLs::PathExist,
- NLs::Finished,
+ NLs::ChildrenCount(1),
+ NLs::PathsInsideDomain(2),
+ NLs::ShardsInsideDomain(5)});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
+ {NLs::PathExist,
+ NLs::Finished,
NLs::PathIdEqual(NKikimr::TPathId(TTestTxConfig::SchemeShard, 3)),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::ChildrenCount(1)});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/table_1"),
- {NLs::PathExist,
- NLs::IsTable,
+ NLs::ChildrenCount(1)});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/table_1"),
+ {NLs::PathExist,
+ NLs::IsTable,
NLs::PathIdEqual(TPathId(TTestTxConfig::SchemeShard, 4)),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
-
+
// Inactive shard is not migrated
TestFindTabletSubDomainPathId(runtime, tenantSchemeShard, TTestTxConfig::FakeHiveTablets + 2,
- NKikimrScheme::TEvFindTabletSubDomainPathIdResult::SHARD_NOT_FOUND);
+ NKikimrScheme::TEvFindTabletSubDomainPathIdResult::SHARD_NOT_FOUND);
for (ui32 index = 3; index <= 4; ++index) {
auto subDomainPathId = TestFindTabletSubDomainPathId(runtime, tenantSchemeShard, TTestTxConfig::FakeHiveTablets + index);
@@ -874,94 +874,94 @@ Y_UNIT_TEST_SUITE(TSchemeShardUpgradeSubDomainTest) {
UNIT_ASSERT_VALUES_EQUAL(value1, 1);
}
- TestDropTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0/DirA", "table_1");
- env.TestWaitNotification(runtime, txId, tenantSchemeShard);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/table_1"),
- {NLs::PathNotExist});
-
+ TestDropTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0/DirA", "table_1");
+ env.TestWaitNotification(runtime, txId, tenantSchemeShard);
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/table_1"),
+ {NLs::PathNotExist});
+
env.TestWaitTabletDeletion(runtime, { TTestTxConfig::FakeHiveTablets + 2, TTestTxConfig::FakeHiveTablets + 3, TTestTxConfig::FakeHiveTablets + 4});
-
+
TActorId sender = runtime.AllocateEdgeActor();
RebootTablet(runtime, TTestTxConfig::SchemeShard, sender);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
NLs::DomainKey(2, TTestTxConfig::SchemeShard),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
NLs::DomainSchemeshard(TTestTxConfig::FakeHiveTablets + 5),
- NLs::NoChildren,
- NLs::PathVersionEqual(8)});
-
- TestForceDropExtSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
- env.TestWaitNotification(runtime, txId);
- }
-
- Y_UNIT_TEST(UpgradeDomainCommitAlterTable) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestCreateSubDomain(runtime, ++txId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++txId, "/MyRoot",R"(
- Name: "USER_0"
- PlanResolution: 50
- Coordinators: 1
- Mediators: 1
- TimeCastBucketsPerMediator: 2
- )");
- env.TestWaitNotification(runtime, {txId, txId - 1});
-
- TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA");
- TestCreateTable(runtime, ++txId, "/MyRoot/USER_0/DirA", R"(
- Name: "Table1"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "Value1" Type: "Utf8"}
- KeyColumnNames: ["key1"]
- PartitionConfig {
- ColumnFamilies {
- Id: 0
- StorageConfig {
- SysLog {
- PreferredPoolKind: "hdd"
- }
- Log {
- PreferredPoolKind: "hdd"
- }
- Data {
- PreferredPoolKind: "hdd"
- }
- }
- }
- }
- )");
-
- env.TestWaitNotification(runtime, {txId -1, txId});
-
- TestUpgradeSubDomain(runtime, ++txId, "/MyRoot", "USER_0"); //106
- env.TestWaitNotification(runtime, txId);
-
- TestUpgradeSubDomainDecision(runtime, ++txId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit); //107
- env.TestWaitNotification(runtime, txId);
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
-
- TestAlterTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0/DirA",R"(
- Name: "Table1"
- Columns { Name: "Value2" Type: "Utf8"}
- )");
- env.TestWaitNotification(runtime, txId, tenantSchemeShard);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table1"),
- {NLs::PathExist,
- NLs::IsTable});
- }
-}
+ NLs::NoChildren,
+ NLs::PathVersionEqual(8)});
+
+ TestForceDropExtSubDomain(runtime, ++txId, "/MyRoot", "USER_0");
+ env.TestWaitNotification(runtime, txId);
+ }
+
+ Y_UNIT_TEST(UpgradeDomainCommitAlterTable) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestCreateSubDomain(runtime, ++txId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++txId, "/MyRoot",R"(
+ Name: "USER_0"
+ PlanResolution: 50
+ Coordinators: 1
+ Mediators: 1
+ TimeCastBucketsPerMediator: 2
+ )");
+ env.TestWaitNotification(runtime, {txId, txId - 1});
+
+ TestMkDir(runtime, ++txId, "/MyRoot/USER_0", "DirA");
+ TestCreateTable(runtime, ++txId, "/MyRoot/USER_0/DirA", R"(
+ Name: "Table1"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "Value1" Type: "Utf8"}
+ KeyColumnNames: ["key1"]
+ PartitionConfig {
+ ColumnFamilies {
+ Id: 0
+ StorageConfig {
+ SysLog {
+ PreferredPoolKind: "hdd"
+ }
+ Log {
+ PreferredPoolKind: "hdd"
+ }
+ Data {
+ PreferredPoolKind: "hdd"
+ }
+ }
+ }
+ }
+ )");
+
+ env.TestWaitNotification(runtime, {txId -1, txId});
+
+ TestUpgradeSubDomain(runtime, ++txId, "/MyRoot", "USER_0"); //106
+ env.TestWaitNotification(runtime, txId);
+
+ TestUpgradeSubDomainDecision(runtime, ++txId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit); //107
+ env.TestWaitNotification(runtime, txId);
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
+
+ TestAlterTable(runtime, tenantSchemeShard, ++txId, "/MyRoot/USER_0/DirA",R"(
+ Name: "Table1"
+ Columns { Name: "Value2" Type: "Utf8"}
+ )");
+ env.TestWaitNotification(runtime, txId, tenantSchemeShard);
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table1"),
+ {NLs::PathExist,
+ NLs::IsTable});
+ }
+}
diff --git a/ydb/core/tx/schemeshard/ut_upgradesubdomain/ya.make b/ydb/core/tx/schemeshard/ut_upgradesubdomain/ya.make
index 3918919127c..7759750ff30 100644
--- a/ydb/core/tx/schemeshard/ut_upgradesubdomain/ya.make
+++ b/ydb/core/tx/schemeshard/ut_upgradesubdomain/ya.make
@@ -1,14 +1,14 @@
IF (NOT WITH_VALGRIND)
UNITTEST_FOR(ydb/core/tx/schemeshard)
-
+
OWNER(g:kikimr)
-
+
TIMEOUT(600)
-
+
SIZE(MEDIUM)
INCLUDE(${ARCADIA_ROOT}/ydb/tests/supp/ubsan_supp.inc)
-
+
PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
diff --git a/ydb/core/tx/schemeshard/ut_upgradesubdomain_reboots.cpp b/ydb/core/tx/schemeshard/ut_upgradesubdomain_reboots.cpp
index eb7f3dc67dd..d1a4a4020b0 100644
--- a/ydb/core/tx/schemeshard/ut_upgradesubdomain_reboots.cpp
+++ b/ydb/core/tx/schemeshard/ut_upgradesubdomain_reboots.cpp
@@ -1,572 +1,572 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
-
+
#include <util/system/env.h>
-using namespace NKikimr;
-using namespace NSchemeShard;
-using namespace NSchemeShardUT_Private;
-
-Y_UNIT_TEST_SUITE(TSchemeShardUpgradeSubDomainWithOutDesicion) {
- Y_UNIT_TEST(Fake) {
- }
-
- Y_UNIT_TEST(Common) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathId pathId;
-
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\" "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
+using namespace NKikimr;
+using namespace NSchemeShard;
+using namespace NSchemeShardUT_Private;
+
+Y_UNIT_TEST_SUITE(TSchemeShardUpgradeSubDomainWithOutDesicion) {
+ Y_UNIT_TEST(Fake) {
+ }
+
+ Y_UNIT_TEST(Common) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathId pathId;
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
UNIT_ASSERT(CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 3));
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirB",
- {NKikimrScheme::StatusAccepted}, AlterUserAttrs({{"AttrA1", "ValA1"}}));
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirB", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- pathId = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::IsSubDomain("USER_0")}).PathId;
- }
-
- TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
- NLs::DomainKey(pathId)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirB"),
- {NLs::PathRedirected});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathIdEqual(TPathId(tenantSchemeShard, 1)),
- NLs::IsSubDomain("MyRoot/USER_0"),
- NLs::DomainKey(pathId),
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirB",
+ {NKikimrScheme::StatusAccepted}, AlterUserAttrs({{"AttrA1", "ValA1"}}));
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirB", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ pathId = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::IsSubDomain("USER_0")}).PathId;
+ }
+
+ TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
+ NLs::DomainKey(pathId)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirB"),
+ {NLs::PathRedirected});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathIdEqual(TPathId(tenantSchemeShard, 1)),
+ NLs::IsSubDomain("MyRoot/USER_0"),
+ NLs::DomainKey(pathId),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirB"),
- {NLs::PathExist});
- });
- }
-
- Y_UNIT_TEST(WaitCreationDirAndTable) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathId pathId;
-
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\" "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA",
- {NKikimrScheme::StatusAccepted}, AlterUserAttrs({{"AttrA1", "ValA1"}}));
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- pathId = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::IsSubDomain("USER_0")}).PathId;
-
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirA", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- )");
- TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirB");
- // No wait finish /MyRoot/USER_0/DirB /MyRoot/USER_0/DirA/Table
- }
-
- TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0/DirB", "DirC",
- {NKikimrScheme::StatusMultipleModifications}); //creation doesn't chain, they see upgrade operation
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirB", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- )",
- {NKikimrScheme::StatusMultipleModifications});
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-2, t.TxId-1, t.TxId});
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-4, t.TxId-3});
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
- NLs::DomainKey(pathId)});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathIdEqual(TPathId(tenantSchemeShard, 1)),
- NLs::IsSubDomain("MyRoot/USER_0"),
- NLs::DomainKey(pathId),
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirB"),
+ {NLs::PathExist});
+ });
+ }
+
+ Y_UNIT_TEST(WaitCreationDirAndTable) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathId pathId;
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA",
+ {NKikimrScheme::StatusAccepted}, AlterUserAttrs({{"AttrA1", "ValA1"}}));
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ pathId = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::IsSubDomain("USER_0")}).PathId;
+
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirA", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ )");
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirB");
+ // No wait finish /MyRoot/USER_0/DirB /MyRoot/USER_0/DirA/Table
+ }
+
+ TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0/DirB", "DirC",
+ {NKikimrScheme::StatusMultipleModifications}); //creation doesn't chain, they see upgrade operation
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirB", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ )",
+ {NKikimrScheme::StatusMultipleModifications});
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-2, t.TxId-1, t.TxId});
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-4, t.TxId-3});
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
+ NLs::DomainKey(pathId)});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathIdEqual(TPathId(tenantSchemeShard, 1)),
+ NLs::IsSubDomain("MyRoot/USER_0"),
+ NLs::DomainKey(pathId),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
- });
- }
-
- Y_UNIT_TEST(UpgradeRejectNewAlters) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathId pathId;
-
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\" "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
-
- pathId = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::IsSubDomain("USER_0")}).PathId;
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
- )");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
- }
-
- TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0"); //1008
-
- TestAlterTable(runtime, ++t.TxId, "/MyRoot/USER_0", R"(
- Name: "Table"
- Columns { Name: "addColumn2" Type: "Uint64"}
- )",
- {TEvSchemeShard::EStatus::StatusMultipleModifications});
+ });
+ }
+
+ Y_UNIT_TEST(UpgradeRejectNewAlters) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathId pathId;
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
+
+ pathId = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::IsSubDomain("USER_0")}).PathId;
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
+ )");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
+ }
+
+ TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0"); //1008
+
+ TestAlterTable(runtime, ++t.TxId, "/MyRoot/USER_0", R"(
+ Name: "Table"
+ Columns { Name: "addColumn2" Type: "Uint64"}
+ )",
+ {TEvSchemeShard::EStatus::StatusMultipleModifications});
TestUserAttrs(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA",
{TEvSchemeShard::EStatus::StatusMultipleModifications},
AlterUserAttrs({{"AttrA2", "ValA2"}}));
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-2, t.TxId-1, t.TxId});
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
- NLs::DomainKey(pathId)});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathIdEqual(TPathId(tenantSchemeShard, 1)),
- NLs::IsSubDomain("MyRoot/USER_0"),
- NLs::DomainKey(pathId),
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-2, t.TxId-1, t.TxId});
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
+ NLs::DomainKey(pathId)});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathIdEqual(TPathId(tenantSchemeShard, 1)),
+ NLs::IsSubDomain("MyRoot/USER_0"),
+ NLs::DomainKey(pathId),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
- });
- }
-
- Y_UNIT_TEST(UpgradeWaitOldAltersAndRejectNewAlters) {
- TTestWithReboots t;
-
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathId pathId;
-
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\" "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
-
- pathId = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::IsSubDomain("USER_0")}).PathId;
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- )");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
-
- TestAlterTable(runtime, ++t.TxId, "/MyRoot/USER_0", R"(
- Name: "Table"
- Columns { Name: "addColumn1" Type: "Uint64"}
- )"); //1006
- TestUserAttrs(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA", AlterUserAttrs({{"AttrA1", "ValA1"}})); //1007
- }
-
- TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0"); //1008
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-2, t.TxId-1});
-
- TestAlterTable(runtime, ++t.TxId, "/MyRoot/USER_0", R"(
- Name: "Table"
- Columns { Name: "addColumn2" Type: "Uint64"}
- )",
- {TEvSchemeShard::EStatus::StatusMultipleModifications});
+ });
+ }
+
+ Y_UNIT_TEST(UpgradeWaitOldAltersAndRejectNewAlters) {
+ TTestWithReboots t;
+
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathId pathId;
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
+
+ pathId = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::IsSubDomain("USER_0")}).PathId;
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ )");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
+
+ TestAlterTable(runtime, ++t.TxId, "/MyRoot/USER_0", R"(
+ Name: "Table"
+ Columns { Name: "addColumn1" Type: "Uint64"}
+ )"); //1006
+ TestUserAttrs(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA", AlterUserAttrs({{"AttrA1", "ValA1"}})); //1007
+ }
+
+ TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0"); //1008
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-2, t.TxId-1});
+
+ TestAlterTable(runtime, ++t.TxId, "/MyRoot/USER_0", R"(
+ Name: "Table"
+ Columns { Name: "addColumn2" Type: "Uint64"}
+ )",
+ {TEvSchemeShard::EStatus::StatusMultipleModifications});
TestUserAttrs(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA",
{TEvSchemeShard::EStatus::StatusMultipleModifications},
AlterUserAttrs({{"AttrA2", "ValA2"}}));
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-2, t.TxId-1, t.TxId});
-
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-4, t.TxId-3});
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
- NLs::DomainKey(pathId)});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathIdEqual(TPathId(tenantSchemeShard, 1)),
- NLs::IsSubDomain("MyRoot/USER_0"),
- NLs::DomainKey(pathId),
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-2, t.TxId-1, t.TxId});
+
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-4, t.TxId-3});
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
+ NLs::DomainKey(pathId)});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathIdEqual(TPathId(tenantSchemeShard, 1)),
+ NLs::IsSubDomain("MyRoot/USER_0"),
+ NLs::DomainKey(pathId),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
- });
- }
-
- Y_UNIT_TEST(UpgradeWaitOldSplitAndRejectNewSplit) {
- TTestWithReboots t;
-
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathId pathId;
-
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\" "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
-
- pathId = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::IsSubDomain("USER_0")}).PathId;
-
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestSplitTable(runtime, ++t.TxId, "/MyRoot/USER_0/Table", R"(
- SourceTabletId: 9437196
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "B" } }
- }
- }
- )");
- }
-
- TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0"); //1008
-
- t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
- TestSplitTable(runtime, ++t.TxId, "/MyRoot/USER_0/Table", R"(
- SourceTabletId: 9437197
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "D" } }
- }
- }
- )",
- {TEvSchemeShard::EStatus::StatusMultipleModifications});
-
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
- NLs::DomainKey(pathId)});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathIdEqual(TPathId(tenantSchemeShard, 1)),
- NLs::IsSubDomain("MyRoot/USER_0"),
- NLs::DomainKey(pathId),
+ });
+ }
+
+ Y_UNIT_TEST(UpgradeWaitOldSplitAndRejectNewSplit) {
+ TTestWithReboots t;
+
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathId pathId;
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
+
+ pathId = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::IsSubDomain("USER_0")}).PathId;
+
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestSplitTable(runtime, ++t.TxId, "/MyRoot/USER_0/Table", R"(
+ SourceTabletId: 9437196
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "B" } }
+ }
+ }
+ )");
+ }
+
+ TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0"); //1008
+
+ t.TestEnv->TestWaitNotification(runtime, t.TxId-1);
+ TestSplitTable(runtime, ++t.TxId, "/MyRoot/USER_0/Table", R"(
+ SourceTabletId: 9437197
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "D" } }
+ }
+ }
+ )",
+ {TEvSchemeShard::EStatus::StatusMultipleModifications});
+
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId});
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
+ NLs::DomainKey(pathId)});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathIdEqual(TPathId(tenantSchemeShard, 1)),
+ NLs::IsSubDomain("MyRoot/USER_0"),
+ NLs::DomainKey(pathId),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1}),
- NLs::ShardsInsideDomain(6)});
- });
- }
-}
-
-Y_UNIT_TEST_SUITE(TSchemeShardUpgradeSubDomainUndo) {
- Y_UNIT_TEST(Fake) {
- }
-
- Y_UNIT_TEST(Common) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathId pathId;
-
- ui64 tenantSchemeShard = 0;
-
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\" "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirB",
- {NKikimrScheme::StatusAccepted}, AlterUserAttrs({{"AttrA1", "ValA1"}}));
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirB", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- pathId = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::IsSubDomain("USER_0")}).PathId;
-
- TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
- NLs::DomainKey(pathId)});
-
- UNIT_ASSERT_UNEQUAL(tenantSchemeShard, 0);
- }
-
-
- TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Undo);
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsSubDomain("USER_0"),
- NLs::DomainKey(pathId)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirB"),
- {NLs::PathExist});
-
- t.TestEnv->TestWaitTabletDeletion(runtime, tenantSchemeShard);
- });
- }
-}
-
-
-Y_UNIT_TEST_SUITE(TSchemeShardUpgradeSubDomainCommit) {
- Y_UNIT_TEST(Kesus) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathId pathId;
-
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\" "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirB",
- {NKikimrScheme::StatusAccepted}, AlterUserAttrs({{"AttrA1", "ValA1"}}));
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestCreateKesus(runtime, ++t.TxId, "/MyRoot/USER_0",
- "Name: \"Kesus1\" "
- "Config: { self_check_period_millis: 1234 session_grace_period_millis: 5678 }");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/Kesus1"),
- {NLs::Finished, NLs::KesusConfigIs(1234, 5678)});
-
- pathId = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::IsSubDomain("USER_0")}).PathId;
- }
-
- TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
- NLs::DomainKey(pathId)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/Kesus1"),
- {NLs::PathRedirected});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/Kesus1"),
- {NLs::Finished, NLs::KesusConfigIs(1234, 5678)});
-
- TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirB"),
- {NLs::PathRedirected});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathIdEqual(TPathId(tenantSchemeShard, 1)),
- NLs::IsSubDomain("MyRoot/USER_0"),
- NLs::DomainKey(pathId),
+ NLs::ShardsInsideDomain(6)});
+ });
+ }
+}
+
+Y_UNIT_TEST_SUITE(TSchemeShardUpgradeSubDomainUndo) {
+ Y_UNIT_TEST(Fake) {
+ }
+
+ Y_UNIT_TEST(Common) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathId pathId;
+
+ ui64 tenantSchemeShard = 0;
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirB",
+ {NKikimrScheme::StatusAccepted}, AlterUserAttrs({{"AttrA1", "ValA1"}}));
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirB", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ pathId = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::IsSubDomain("USER_0")}).PathId;
+
+ TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
+ NLs::DomainKey(pathId)});
+
+ UNIT_ASSERT_UNEQUAL(tenantSchemeShard, 0);
+ }
+
+
+ TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Undo);
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsSubDomain("USER_0"),
+ NLs::DomainKey(pathId)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirB"),
+ {NLs::PathExist});
+
+ t.TestEnv->TestWaitTabletDeletion(runtime, tenantSchemeShard);
+ });
+ }
+}
+
+
+Y_UNIT_TEST_SUITE(TSchemeShardUpgradeSubDomainCommit) {
+ Y_UNIT_TEST(Kesus) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathId pathId;
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirB",
+ {NKikimrScheme::StatusAccepted}, AlterUserAttrs({{"AttrA1", "ValA1"}}));
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestCreateKesus(runtime, ++t.TxId, "/MyRoot/USER_0",
+ "Name: \"Kesus1\" "
+ "Config: { self_check_period_millis: 1234 session_grace_period_millis: 5678 }");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/Kesus1"),
+ {NLs::Finished, NLs::KesusConfigIs(1234, 5678)});
+
+ pathId = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::IsSubDomain("USER_0")}).PathId;
+ }
+
+ TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
+ NLs::DomainKey(pathId)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/Kesus1"),
+ {NLs::PathRedirected});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/Kesus1"),
+ {NLs::Finished, NLs::KesusConfigIs(1234, 5678)});
+
+ TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirB"),
+ {NLs::PathRedirected});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathIdEqual(TPathId(tenantSchemeShard, 1)),
+ NLs::IsSubDomain("MyRoot/USER_0"),
+ NLs::DomainKey(pathId),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirB"),
- {NLs::PathExist});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/Kesus1"),
- {NLs::Finished, NLs::KesusConfigIs(1234, 5678)});
-
- TestAlterKesus(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0",
- "Name: \"Kesus1\" "
- "Config: { self_check_period_millis: 2345 }");
- t.TestEnv-> TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/Kesus1"),
- {NLs::Finished, NLs::KesusConfigIs(2345, 5678)});
-
- TestDropKesus(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0", "Kesus1");
- t.TestEnv-> TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/Kesus1"),
- {NLs::PathNotExist});
- });
- }
-
- Y_UNIT_TEST(DeleteAfter) {
- TTestWithReboots t;
-
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot", "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot", R"(
- Name: "USER_0"
- PlanResolution: 50
- Coordinators: 1
- Mediators: 1
- TimeCastBucketsPerMediator: 2
- )");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirA",R"(
- Name: "Table1"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
- )");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId -1, t.TxId});
-
- TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
- TestCreateTable(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0",R"(
- Name: "Table3"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
-
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirB"),
+ {NLs::PathExist});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/Kesus1"),
+ {NLs::Finished, NLs::KesusConfigIs(1234, 5678)});
+
+ TestAlterKesus(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0",
+ "Name: \"Kesus1\" "
+ "Config: { self_check_period_millis: 2345 }");
+ t.TestEnv-> TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/Kesus1"),
+ {NLs::Finished, NLs::KesusConfigIs(2345, 5678)});
+
+ TestDropKesus(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0", "Kesus1");
+ t.TestEnv-> TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/Kesus1"),
+ {NLs::PathNotExist});
+ });
+ }
+
+ Y_UNIT_TEST(DeleteAfter) {
+ TTestWithReboots t;
+
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot", "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot", R"(
+ Name: "USER_0"
+ PlanResolution: 50
+ Coordinators: 1
+ Mediators: 1
+ TimeCastBucketsPerMediator: 2
+ )");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirA",R"(
+ Name: "Table1"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
+ )");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId -1, t.TxId});
+
+ TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
+ TestCreateTable(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0",R"(
+ Name: "Table3"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
+
RebootTablet(runtime, TTestTxConfig::SchemeShard, runtime.AllocateEdgeActor()); // one more reboot before propose deletion
- }
-
- TestForceDropExtSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0"); //110
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathExist,
- NLs::ChildrenCount(1),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
-
+ }
+
+ TestForceDropExtSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0"); //110
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathExist,
+ NLs::ChildrenCount(1),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+
t.TestEnv->TestWaitTabletDeletion(runtime, xrange(TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+6));
{
TInactiveZone inactive(activeZone);
@@ -574,554 +574,554 @@ Y_UNIT_TEST_SUITE(TSchemeShardUpgradeSubDomainCommit) {
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "SubDomains", "PathId", 3));
UNIT_ASSERT(!CheckLocalRowExists(runtime, TTestTxConfig::SchemeShard, "Paths", "Id", 3));
}
- });
- }
-
- Y_UNIT_TEST(Common) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TPathId pathId;
-
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\" "
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 1 "
- "TimeCastBucketsPerMediator: 2");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirB",
- {NKikimrScheme::StatusAccepted}, AlterUserAttrs({{"AttrA1", "ValA1"}}));
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirB", R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- pathId = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::IsSubDomain("USER_0")}).PathId;
-
- TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
- NLs::DomainKey(pathId)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirB"),
- {NLs::PathRedirected});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::PathIdEqual(TPathId(tenantSchemeShard, 1)),
- NLs::IsSubDomain("MyRoot/USER_0"),
- NLs::DomainKey(pathId),
+ });
+ }
+
+ Y_UNIT_TEST(Common) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TPathId pathId;
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\" "
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 1 "
+ "TimeCastBucketsPerMediator: 2");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirB",
+ {NKikimrScheme::StatusAccepted}, AlterUserAttrs({{"AttrA1", "ValA1"}}));
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirB", R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "A" } }}}
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ pathId = TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::IsSubDomain("USER_0")}).PathId;
+
+ TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard),
+ NLs::DomainKey(pathId)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirB"),
+ {NLs::PathRedirected});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::PathIdEqual(TPathId(tenantSchemeShard, 1)),
+ NLs::IsSubDomain("MyRoot/USER_0"),
+ NLs::DomainKey(pathId),
NLs::DomainCoordinators({TTestTxConfig::FakeHiveTablets}),
NLs::DomainMediators({TTestTxConfig::FakeHiveTablets + 1})});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirB"),
- {NLs::PathExist});
- });
- }
-
- Y_UNIT_TEST(ChangeACLRmDir) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
-
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",R"(
- Name: "USER_0"
- PlanResolution: 50
- Coordinators: 1
- Mediators: 1
- TimeCastBucketsPerMediator: 2
- )");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
- TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0/DirA", "DirB");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
-
- TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
-
- TestModifyACL(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0", "DirA", "", "svc@staff");
- TestModifyACL(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA", "DirB", "", "svc@staff");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId}, tenantSchemeShard);
-
- TestRmDir(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA", "DirB");
- t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
-
- TestRmDir(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0", "DirA");
- t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
- {NLs::PathNotExist});
- });
-
- }
-
- Y_UNIT_TEST(DropTable) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
-
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",R"(
- Name: "USER_0"
- PlanResolution: 50
- Coordinators: 1
- Mediators: 1
- TimeCastBucketsPerMediator: 2
- )");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirA",R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
- )");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
-
- TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0"); //106
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit); //107
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table"),
- {NLs::PathExist,
- NLs::IsTable});
-
- TestDropTable(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA", "Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
- {NLs::PathExist,
- NLs::ChildrenCount(0)});
-
- TestRmDir(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0", "DirA");
- t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
- {NLs::PathNotExist});
- });
-
- }
-
- Y_UNIT_TEST(CreateAndDropInsideMigrated) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
-
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",R"(
- Name: "USER_0"
- PlanResolution: 50
- Coordinators: 1
- Mediators: 1
- TimeCastBucketsPerMediator: 2
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
-
- TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0"); //106
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit); //107
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
-
- TestCreateTable(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA",R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table"),
- {NLs::PathExist,
- NLs::IsTable});
-
- TestDropTable(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA", "Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
- {NLs::PathExist,
- NLs::ChildrenCount(0)});
-
- TestRmDir(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0", "DirA");
- t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
- {NLs::PathNotExist});
- });
-
- }
-
- Y_UNIT_TEST(ChangeUserAttrs) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TUserAttrs attrs1({{"Name1", "Val1"}});
- TUserAttrs attrs2({{"Name2", "Val2"}});
-
- {
- TInactiveZone inactive(activeZone);
-
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",R"(
- Name: "USER_0"
- PlanResolution: 50
- Coordinators: 1
- Mediators: 1
- TimeCastBucketsPerMediator: 2
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(attrs1));
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
-
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirB"),
+ {NLs::PathExist});
+ });
+ }
+
+ Y_UNIT_TEST(ChangeACLRmDir) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",R"(
+ Name: "USER_0"
+ PlanResolution: 50
+ Coordinators: 1
+ Mediators: 1
+ TimeCastBucketsPerMediator: 2
+ )");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0/DirA", "DirB");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
+
+ TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
+
+ TestModifyACL(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0", "DirA", "", "svc@staff");
+ TestModifyACL(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA", "DirB", "", "svc@staff");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId-1, t.TxId}, tenantSchemeShard);
+
+ TestRmDir(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA", "DirB");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
+
+ TestRmDir(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0", "DirA");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
+ {NLs::PathNotExist});
+ });
+
+ }
+
+ Y_UNIT_TEST(DropTable) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",R"(
+ Name: "USER_0"
+ PlanResolution: 50
+ Coordinators: 1
+ Mediators: 1
+ TimeCastBucketsPerMediator: 2
+ )");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirA",R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ SplitBoundary { KeyPrefix { Tuple { Optional { Text: "C" } }}}
+ )");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
+
+ TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0"); //106
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit); //107
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table"),
+ {NLs::PathExist,
+ NLs::IsTable});
+
+ TestDropTable(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA", "Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
+ {NLs::PathExist,
+ NLs::ChildrenCount(0)});
+
+ TestRmDir(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0", "DirA");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
+ {NLs::PathNotExist});
+ });
+
+ }
+
+ Y_UNIT_TEST(CreateAndDropInsideMigrated) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",R"(
+ Name: "USER_0"
+ PlanResolution: 50
+ Coordinators: 1
+ Mediators: 1
+ TimeCastBucketsPerMediator: 2
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
+
+ TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0"); //106
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit); //107
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
+
+ TestCreateTable(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA",R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table"),
+ {NLs::PathExist,
+ NLs::IsTable});
+
+ TestDropTable(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA", "Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
+ {NLs::PathExist,
+ NLs::ChildrenCount(0)});
+
+ TestRmDir(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0", "DirA");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
+ {NLs::PathNotExist});
+ });
+
+ }
+
+ Y_UNIT_TEST(ChangeUserAttrs) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TUserAttrs attrs1({{"Name1", "Val1"}});
+ TUserAttrs attrs2({{"Name2", "Val2"}});
+
+ {
+ TInactiveZone inactive(activeZone);
+
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",R"(
+ Name: "USER_0"
+ PlanResolution: 50
+ Coordinators: 1
+ Mediators: 1
+ TimeCastBucketsPerMediator: 2
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(attrs1));
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
+
TestUserAttrs(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0", "DirA",
{NKikimrScheme::StatusAccepted}, AlterUserAttrs(attrs2, {"Name1"}));
- t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
- {NLs::PathExist,
- NLs::UserAttrsEqual(attrs2)});
-
- TestRmDir(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0", "DirA");
- t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
- {NLs::PathNotExist});
- });
-
- }
-
- Y_UNIT_TEST(CommitSplit) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
-
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",R"(
- Name: "USER_0"
- PlanResolution: 50
- Coordinators: 1
- Mediators: 1
- TimeCastBucketsPerMediator: 2
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirA",R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "key2" Type: "Uint32"}
- Columns { Name: "Value" Type: "Utf8"}
- KeyColumnNames: ["key1", "key2"]
- )");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
-
- TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
-
+ t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
+ {NLs::PathExist,
+ NLs::UserAttrsEqual(attrs2)});
+
+ TestRmDir(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0", "DirA");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA"),
+ {NLs::PathNotExist});
+ });
+
+ }
+
+ Y_UNIT_TEST(CommitSplit) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",R"(
+ Name: "USER_0"
+ PlanResolution: 50
+ Coordinators: 1
+ Mediators: 1
+ TimeCastBucketsPerMediator: 2
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirA",R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "key2" Type: "Uint32"}
+ Columns { Name: "Value" Type: "Utf8"}
+ KeyColumnNames: ["key1", "key2"]
+ )");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
+
+ TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
+
TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table", true),
- {NLs::PathExist,
- NLs::PartitionCount(1)});
-
- TestSplitTable(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA/Table", R"(
- SourceTabletId: 9437196
- SplitBoundary {
- KeyPrefix {
- Tuple { Optional { Text: "Marla" } }
- }
- }
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
-
+ {NLs::PathExist,
+ NLs::PartitionCount(1)});
+
+ TestSplitTable(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA/Table", R"(
+ SourceTabletId: 9437196
+ SplitBoundary {
+ KeyPrefix {
+ Tuple { Optional { Text: "Marla" } }
+ }
+ }
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
+
TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table", true),
- {NLs::PathExist,
- NLs::PartitionCount(2)});
-
- t.TestEnv->TestWaitTabletDeletion(runtime, ui64{9437196});
-
- {
- TInactiveZone inactive(activeZone);
-
- TestDropTable(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA", "Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
- }
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table"),
- {NLs::PathNotExist});
-
- t.TestEnv->TestWaitTabletDeletion(runtime, {9437198, 9437199});
-
- });
-
- }
-
- Y_UNIT_TEST(AlterMigratedTable) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
-
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",R"(
- Name: "USER_0"
- PlanResolution: 50
- Coordinators: 1
- Mediators: 1
- TimeCastBucketsPerMediator: 2
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirA",R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "val1" Type: "Utf8"}
- KeyColumnNames: ["key1"]
- )");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
-
- TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
-
+ {NLs::PathExist,
+ NLs::PartitionCount(2)});
+
+ t.TestEnv->TestWaitTabletDeletion(runtime, ui64{9437196});
+
+ {
+ TInactiveZone inactive(activeZone);
+
+ TestDropTable(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA", "Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
+ }
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table"),
+ {NLs::PathNotExist});
+
+ t.TestEnv->TestWaitTabletDeletion(runtime, {9437198, 9437199});
+
+ });
+
+ }
+
+ Y_UNIT_TEST(AlterMigratedTable) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",R"(
+ Name: "USER_0"
+ PlanResolution: 50
+ Coordinators: 1
+ Mediators: 1
+ TimeCastBucketsPerMediator: 2
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirA",R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "val1" Type: "Utf8"}
+ KeyColumnNames: ["key1"]
+ )");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
+
+ TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
+
TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table", true),
- {NLs::PathExist,
- NLs::PartitionCount(1)});
-
- TestAlterTable(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA", R"(
- Name: "Table"
- Columns { Name: "add" Type: "Uint64"}
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table"),
- {NLs::PathExist,
- NLs::CheckColumns("Table", {"key1", "val1", "add"}, {}, {"key1"})});
- });
-
- }
-
- Y_UNIT_TEST(CopyMigratedTable) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
-
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",R"(
- Name: "USER_0"
- PlanResolution: 50
- Coordinators: 1
- Mediators: 1
- TimeCastBucketsPerMediator: 2
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
- TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirA",R"(
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "val1" Type: "Utf8"}
- KeyColumnNames: ["key1"]
- )");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
-
- TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- }
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
- {NLs::PathExist,
- NLs::IsExternalSubDomain("USER_0"),
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
-
+ {NLs::PathExist,
+ NLs::PartitionCount(1)});
+
+ TestAlterTable(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA", R"(
+ Name: "Table"
+ Columns { Name: "add" Type: "Uint64"}
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table"),
+ {NLs::PathExist,
+ NLs::CheckColumns("Table", {"key1", "val1", "add"}, {}, {"key1"})});
+ });
+
+ }
+
+ Y_UNIT_TEST(CopyMigratedTable) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",R"(
+ Name: "USER_0"
+ PlanResolution: 50
+ Coordinators: 1
+ Mediators: 1
+ TimeCastBucketsPerMediator: 2
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
+ TestCreateTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirA",R"(
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "val1" Type: "Utf8"}
+ KeyColumnNames: ["key1"]
+ )");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
+
+ TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ }
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0"),
+ {NLs::PathExist,
+ NLs::IsExternalSubDomain("USER_0"),
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
+
TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table", true),
- {NLs::PathExist,
- NLs::PartitionCount(1)});
-
- TestCopyTable(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA", "Copy", "/MyRoot/USER_0/DirA/Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
-
+ {NLs::PathExist,
+ NLs::PartitionCount(1)});
+
+ TestCopyTable(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA", "Copy", "/MyRoot/USER_0/DirA/Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
+
TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Copy", true),
- {NLs::PathExist,
- NLs::PartitionCount(1)});
- });
- }
-
- Y_UNIT_TEST(WithIndexes) {
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- {
- TInactiveZone inactive(activeZone);
-
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
- "Name: \"USER_0\"");
- TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",R"(
- Name: "USER_0"
- PlanResolution: 50
- Coordinators: 1
- Mediators: 1
- TimeCastBucketsPerMediator: 2
- )");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
- TestCreateIndexedTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirA", R"(
- TableDescription {
- Name: "Table"
- Columns { Name: "key1" Type: "Utf8"}
- Columns { Name: "value0" Type: "Utf8"}
- KeyColumnNames: ["key1"]
- }
- IndexDescription {
- Name: "UserDefinedIndexByValue0"
- KeyColumnNames: ["value0"]
- }
- )");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
-
+ {NLs::PathExist,
+ NLs::PartitionCount(1)});
+ });
+ }
+
+ Y_UNIT_TEST(WithIndexes) {
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ {
+ TInactiveZone inactive(activeZone);
+
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot",
+ "Name: \"USER_0\"");
+ TestAlterSubDomain(runtime, ++t.TxId, "/MyRoot",R"(
+ Name: "USER_0"
+ PlanResolution: 50
+ Coordinators: 1
+ Mediators: 1
+ TimeCastBucketsPerMediator: 2
+ )");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/USER_0", "DirA");
+ TestCreateIndexedTable(runtime, ++t.TxId, "/MyRoot/USER_0/DirA", R"(
+ TableDescription {
+ Name: "Table"
+ Columns { Name: "key1" Type: "Utf8"}
+ Columns { Name: "value0" Type: "Utf8"}
+ KeyColumnNames: ["key1"]
+ }
+ IndexDescription {
+ Name: "UserDefinedIndexByValue0"
+ KeyColumnNames: ["value0"]
+ }
+ )");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId - 1, t.TxId});
+
TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA/Table", true),
- {NLs::PathExist,
- NLs::PartitionCount(1),
- NLs::IndexesCount(1)});
- }
-
- TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- ui64 tenantSchemeShard = 0;
- TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA/Table"),
- {NLs::PathRedirected,
- NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
-
+ {NLs::PathExist,
+ NLs::PartitionCount(1),
+ NLs::IndexesCount(1)});
+ }
+
+ TestUpgradeSubDomain(runtime, ++t.TxId, "/MyRoot", "USER_0");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ TestUpgradeSubDomainDecision(runtime, ++t.TxId, "/MyRoot", "USER_0", NKikimrSchemeOp::TUpgradeSubDomain::Commit);
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ ui64 tenantSchemeShard = 0;
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/USER_0/DirA/Table"),
+ {NLs::PathRedirected,
+ NLs::ExtractTenantSchemeshard(&tenantSchemeShard)});
+
TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table", true),
- {NLs::PathExist,
- NLs::PartitionCount(1),
- NLs::IndexesCount(1)});
-
- TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table/UserDefinedIndexByValue0/indexImplTable", true, true, true),
- {NLs::PathExist,
- NLs::IsTable,
- NLs::PartitionCount(1)});
-
- {
- TInactiveZone inactive(activeZone);
-
- TestDropTable(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA", "Table");
- t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
-
+ {NLs::PathExist,
+ NLs::PartitionCount(1),
+ NLs::IndexesCount(1)});
+
+ TestDescribeResult(DescribePath(runtime, tenantSchemeShard, "/MyRoot/USER_0/DirA/Table/UserDefinedIndexByValue0/indexImplTable", true, true, true),
+ {NLs::PathExist,
+ NLs::IsTable,
+ NLs::PartitionCount(1)});
+
+ {
+ TInactiveZone inactive(activeZone);
+
+ TestDropTable(runtime, tenantSchemeShard, ++t.TxId, "/MyRoot/USER_0/DirA", "Table");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId, tenantSchemeShard);
+
t.TestEnv->TestWaitTabletDeletion(runtime, {TTestTxConfig::FakeHiveTablets + 2, TTestTxConfig::FakeHiveTablets + 3});
- }
- });
- }
-}
+ }
+ });
+ }
+}
diff --git a/ydb/core/tx/schemeshard/ut_upgradesubdomain_reboots/ya.make b/ydb/core/tx/schemeshard/ut_upgradesubdomain_reboots/ya.make
index 742555211f7..fd956b39819 100644
--- a/ydb/core/tx/schemeshard/ut_upgradesubdomain_reboots/ya.make
+++ b/ydb/core/tx/schemeshard/ut_upgradesubdomain_reboots/ya.make
@@ -1,22 +1,22 @@
UNITTEST_FOR(ydb/core/tx/schemeshard)
-
-OWNER(g:kikimr)
-
-FORK_SUBTESTS()
+
+OWNER(g:kikimr)
+
+FORK_SUBTESTS()
SPLIT_FACTOR(20)
-
-IF (SANITIZER_TYPE OR WITH_VALGRIND)
- TIMEOUT(3600)
- SIZE(LARGE)
- TAG(ya:fat)
-ELSE()
- TIMEOUT(1800)
- SIZE(LARGE)
- TAG(ya:fat)
-ENDIF()
-
-PEERDIR(
+
+IF (SANITIZER_TYPE OR WITH_VALGRIND)
+ TIMEOUT(3600)
+ SIZE(LARGE)
+ TAG(ya:fat)
+ELSE()
+ TIMEOUT(1800)
+ SIZE(LARGE)
+ TAG(ya:fat)
+ENDIF()
+
+PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
library/cpp/svnversion
@@ -24,12 +24,12 @@ PEERDIR(
ydb/core/tx
ydb/core/tx/schemeshard/ut_helpers
ydb/library/yql/public/udf/service/exception_policy
-)
-
+)
+
YQL_LAST_ABI_VERSION()
-SRCS(
- ut_upgradesubdomain_reboots.cpp
-)
-
-END()
+SRCS(
+ ut_upgradesubdomain_reboots.cpp
+)
+
+END()
diff --git a/ydb/core/tx/schemeshard/ut_user_attributes.cpp b/ydb/core/tx/schemeshard/ut_user_attributes.cpp
index 820d4427c85..48a63f877e3 100644
--- a/ydb/core/tx/schemeshard/ut_user_attributes.cpp
+++ b/ydb/core/tx/schemeshard/ut_user_attributes.cpp
@@ -1,238 +1,238 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-using namespace NSchemeShardUT_Private;
-
-Y_UNIT_TEST_SUITE(TSchemeShardUserAttrsTest) {
- Y_UNIT_TEST(Boot) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- }
-
- Y_UNIT_TEST(MkDir) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TUserAttrs dirAAttrs{{"AttrA1", "ValA1"}, {"AttrA2", "ValA2"}};
- TestMkDir(runtime, txId++, "/MyRoot", "DirA", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(dirAAttrs));
- TUserAttrs dirBAttrs{{"AttrB1", "ValB1"}, {"AttrB2", "ValB2"}};
- TestMkDir(runtime, txId++, "/MyRoot", "DirB", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(dirBAttrs));
- TUserAttrs subdirAAttrs{{"AttrAA1", "ValAA1"}, {"AttrAA2", "ValAA2"}};
- TestMkDir(runtime, txId++, "/MyRoot/DirA", "SubDirA", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(subdirAAttrs));
- TUserAttrs subdirBAttrs{{"AttrAB1", "ValAB1"}, {"AttrAB2", "ValAB2"}};
- TestMkDir(runtime, txId++, "/MyRoot/DirA/SubDirA", "DirB", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(subdirBAttrs));
-
- env.TestWaitNotification(runtime, {100, 101, 102, 103});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::Finished, NLs::UserAttrsEqual(dirAAttrs), NLs::PathVersionEqual(5)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- {NLs::Finished, NLs::UserAttrsEqual(dirBAttrs), NLs::PathVersionEqual(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA"),
- {NLs::Finished, NLs::UserAttrsEqual(subdirAAttrs), NLs::PathVersionEqual(5)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA/DirB"),
- {NLs::Finished
- , NLs::UserAttrsEqual(subdirBAttrs)
- , NLs::UserAttrsHas({{"AttrAB1", "ValAB1"}})
- , NLs::UserAttrsHas({{"AttrAB2", "ValAB2"}})
- , NLs::PathVersionEqual(3)});
- }
-
- Y_UNIT_TEST(SetAttrs) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestMkDir(runtime, txId++, "/MyRoot", "DirA");
-
- AsyncUserAttrs(runtime, txId++, "/MyRoot", "DirA", AlterUserAttrs({{"AttrA1", "ValA1"}}));
- AsyncUserAttrs(runtime, txId++, "/MyRoot", "DirA", AlterUserAttrs({{"AttrAX", "ValAX"}}));
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
-
- env.TestWaitNotification(runtime, {txId-2, txId-1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::UserAttrsEqual({{"AttrA1", "ValA1"}}), NLs::PathVersionEqual(4)});
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+using namespace NSchemeShardUT_Private;
+
+Y_UNIT_TEST_SUITE(TSchemeShardUserAttrsTest) {
+ Y_UNIT_TEST(Boot) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ }
+
+ Y_UNIT_TEST(MkDir) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TUserAttrs dirAAttrs{{"AttrA1", "ValA1"}, {"AttrA2", "ValA2"}};
+ TestMkDir(runtime, txId++, "/MyRoot", "DirA", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(dirAAttrs));
+ TUserAttrs dirBAttrs{{"AttrB1", "ValB1"}, {"AttrB2", "ValB2"}};
+ TestMkDir(runtime, txId++, "/MyRoot", "DirB", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(dirBAttrs));
+ TUserAttrs subdirAAttrs{{"AttrAA1", "ValAA1"}, {"AttrAA2", "ValAA2"}};
+ TestMkDir(runtime, txId++, "/MyRoot/DirA", "SubDirA", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(subdirAAttrs));
+ TUserAttrs subdirBAttrs{{"AttrAB1", "ValAB1"}, {"AttrAB2", "ValAB2"}};
+ TestMkDir(runtime, txId++, "/MyRoot/DirA/SubDirA", "DirB", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(subdirBAttrs));
+
+ env.TestWaitNotification(runtime, {100, 101, 102, 103});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::Finished, NLs::UserAttrsEqual(dirAAttrs), NLs::PathVersionEqual(5)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ {NLs::Finished, NLs::UserAttrsEqual(dirBAttrs), NLs::PathVersionEqual(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA"),
+ {NLs::Finished, NLs::UserAttrsEqual(subdirAAttrs), NLs::PathVersionEqual(5)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/SubDirA/DirB"),
+ {NLs::Finished
+ , NLs::UserAttrsEqual(subdirBAttrs)
+ , NLs::UserAttrsHas({{"AttrAB1", "ValAB1"}})
+ , NLs::UserAttrsHas({{"AttrAB2", "ValAB2"}})
+ , NLs::PathVersionEqual(3)});
+ }
+
+ Y_UNIT_TEST(SetAttrs) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestMkDir(runtime, txId++, "/MyRoot", "DirA");
+
+ AsyncUserAttrs(runtime, txId++, "/MyRoot", "DirA", AlterUserAttrs({{"AttrA1", "ValA1"}}));
+ AsyncUserAttrs(runtime, txId++, "/MyRoot", "DirA", AlterUserAttrs({{"AttrAX", "ValAX"}}));
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
+
+ env.TestWaitNotification(runtime, {txId-2, txId-1});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::UserAttrsEqual({{"AttrA1", "ValA1"}}), NLs::PathVersionEqual(4)});
TestUserAttrs(runtime, txId++, "", "MyRoot", AlterUserAttrs({{"AttrRoot", "ValRoot"}}));
env.TestWaitNotification(runtime, txId-1);
TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::UserAttrsEqual({{"AttrRoot", "ValRoot"}})});
- }
-
- Y_UNIT_TEST(UserConditionsAtAlter) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestMkDir(runtime, txId++, "/MyRoot", "DirA", {NKikimrScheme::StatusAccepted}, AlterUserAttrs({{"AttrA1", "ValA1"}}));
- env.TestWaitNotification(runtime, {txId-2, txId-1});
-
- auto dirVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::UserAttrsEqual({{"AttrA1", "ValA1"}}), NLs::PathVersionEqual(3)});
-
+ {NLs::UserAttrsEqual({{"AttrRoot", "ValRoot"}})});
+ }
+
+ Y_UNIT_TEST(UserConditionsAtAlter) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestMkDir(runtime, txId++, "/MyRoot", "DirA", {NKikimrScheme::StatusAccepted}, AlterUserAttrs({{"AttrA1", "ValA1"}}));
+ env.TestWaitNotification(runtime, {txId-2, txId-1});
+
+ auto dirVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::UserAttrsEqual({{"AttrA1", "ValA1"}}), NLs::PathVersionEqual(3)});
+
TestUserAttrs(runtime, txId++, "/MyRoot", "DirA", {NKikimrScheme::StatusAccepted},
AlterUserAttrs({}, {"AttrA1"}), {dirVer});
- env.TestWaitNotification(runtime, txId-1);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::UserAttrsEqual({}), NLs::PathVersionEqual(4)});
-
+ env.TestWaitNotification(runtime, txId-1);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::UserAttrsEqual({}), NLs::PathVersionEqual(4)});
+
TestUserAttrs(runtime, txId++, "/MyRoot", "DirA", {NKikimrScheme::StatusPreconditionFailed},
AlterUserAttrs({{"AttrA2", "ValA2"}}), {dirVer});
- env.TestWaitNotification(runtime, txId-1);
- dirVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::UserAttrsEqual({}), NLs::PathVersionEqual(4)});
-
+ env.TestWaitNotification(runtime, txId-1);
+ dirVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::UserAttrsEqual({}), NLs::PathVersionEqual(4)});
+
TestUserAttrs(runtime, txId++, "/MyRoot", "DirA", {NKikimrScheme::StatusAccepted},
AlterUserAttrs({{"AttrA2", "ValA2"}}), {dirVer});
- env.TestWaitNotification(runtime, txId-1);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::UserAttrsEqual({{"AttrA2", "ValA2"}}), NLs::PathVersionEqual(5)});
- }
-
- Y_UNIT_TEST(UserConditionsAtCreateDropOps) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestMkDir(runtime, txId++, "/MyRoot", "DirA", {NKikimrScheme::StatusAccepted}, AlterUserAttrs({{"AttrA1", "ValA1"}}));
- env.TestWaitNotification(runtime, {txId-2, txId-1});
-
- auto dirAVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::UserAttrsEqual({{"AttrA1", "ValA1"}}), NLs::PathVersionEqual(3)});
- auto rootVer = TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished});
-
- TestMkDir(runtime, txId++, "/MyRoot", "DirB", {NKikimrScheme::StatusAccepted}, {}, {dirAVer, rootVer});
-
- auto dirBVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- {NLs::Finished, NLs::PathVersionEqual(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::Finished, NLs::PathVersionEqual(3)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished});
-
- TestMkDir(runtime, txId++, "/MyRoot", "DirC", {NKikimrScheme::StatusPreconditionFailed}, {}, {dirBVer, dirAVer, rootVer});
- rootVer = TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished});
- TestMkDir(runtime, txId++, "/MyRoot", "DirC", {NKikimrScheme::StatusAccepted}, {}, {dirBVer, dirAVer, rootVer});
- env.TestWaitNotification(runtime, txId-1);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished});
- auto dirCVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirC"),
- {NLs::Finished, NLs::PathVersionEqual(3)});
-
+ env.TestWaitNotification(runtime, txId-1);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::UserAttrsEqual({{"AttrA2", "ValA2"}}), NLs::PathVersionEqual(5)});
+ }
+
+ Y_UNIT_TEST(UserConditionsAtCreateDropOps) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestMkDir(runtime, txId++, "/MyRoot", "DirA", {NKikimrScheme::StatusAccepted}, AlterUserAttrs({{"AttrA1", "ValA1"}}));
+ env.TestWaitNotification(runtime, {txId-2, txId-1});
+
+ auto dirAVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::UserAttrsEqual({{"AttrA1", "ValA1"}}), NLs::PathVersionEqual(3)});
+ auto rootVer = TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished});
+
+ TestMkDir(runtime, txId++, "/MyRoot", "DirB", {NKikimrScheme::StatusAccepted}, {}, {dirAVer, rootVer});
+
+ auto dirBVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ {NLs::Finished, NLs::PathVersionEqual(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::Finished, NLs::PathVersionEqual(3)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished});
+
+ TestMkDir(runtime, txId++, "/MyRoot", "DirC", {NKikimrScheme::StatusPreconditionFailed}, {}, {dirBVer, dirAVer, rootVer});
+ rootVer = TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished});
+ TestMkDir(runtime, txId++, "/MyRoot", "DirC", {NKikimrScheme::StatusAccepted}, {}, {dirBVer, dirAVer, rootVer});
+ env.TestWaitNotification(runtime, txId-1);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished});
+ auto dirCVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirC"),
+ {NLs::Finished, NLs::PathVersionEqual(3)});
+
TestRmDir(runtime, txId++, "/MyRoot", "DirC", {NKikimrScheme::StatusPreconditionFailed}, {dirCVer, dirBVer, dirAVer, rootVer});
- rootVer = TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished});
+ rootVer = TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished});
TestRmDir(runtime, txId++, "/MyRoot", "DirC", {NKikimrScheme::StatusAccepted}, {dirCVer, dirBVer, dirAVer, rootVer});
- env.TestWaitNotification(runtime, txId-1);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirC"),
- {NLs::PathNotExist});
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::Finished});
- }
-
- Y_UNIT_TEST(VariousUse) {
- TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- ui64 txId = 100;
-
- TestMkDir(runtime, txId++, "/MyRoot", "DirA", {NKikimrScheme::StatusAccepted});
-
- env.TestWaitNotification(runtime, txId-1);
-
- AsyncUserAttrs(runtime, txId++, "/MyRoot", "DirA", AlterUserAttrs({{"AttrA1", "ValA1"}}));
- AsyncUserAttrs(runtime, txId++, "/MyRoot", "DirA", AlterUserAttrs({{"AttrA2", "ValA2"}}));
- TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
-
- env.TestWaitNotification(runtime, {txId-2, txId-1});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::UserAttrsEqual({{"AttrA1", "ValA1"}}), NLs::PathVersionEqual(4)});
-
- TestUserAttrs(runtime, txId++, "/MyRoot", "DirA", AlterUserAttrs({{"AttrA3", "ValA3"}}, {"AttrA1"}));
- env.TestWaitNotification(runtime, txId-1);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::UserAttrsEqual({{"AttrA3", "ValA3"}}), NLs::PathVersionEqual(5)});
-
- TestUserAttrs(runtime, txId++, "/MyRoot", "DirA", AlterUserAttrs({}, {"AttrA3"}));
- env.TestWaitNotification(runtime, txId-1);
- auto dirAVer =TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::UserAttrsEqual({}), NLs::PathVersionEqual(6)});
-
+ env.TestWaitNotification(runtime, txId-1);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirC"),
+ {NLs::PathNotExist});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::Finished});
+ }
+
+ Y_UNIT_TEST(VariousUse) {
+ TTestBasicRuntime runtime;
+ TTestEnv env(runtime);
+ ui64 txId = 100;
+
+ TestMkDir(runtime, txId++, "/MyRoot", "DirA", {NKikimrScheme::StatusAccepted});
+
+ env.TestWaitNotification(runtime, txId-1);
+
+ AsyncUserAttrs(runtime, txId++, "/MyRoot", "DirA", AlterUserAttrs({{"AttrA1", "ValA1"}}));
+ AsyncUserAttrs(runtime, txId++, "/MyRoot", "DirA", AlterUserAttrs({{"AttrA2", "ValA2"}}));
+ TestModificationResult(runtime, txId-2, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, txId-1, NKikimrScheme::StatusMultipleModifications);
+
+ env.TestWaitNotification(runtime, {txId-2, txId-1});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::UserAttrsEqual({{"AttrA1", "ValA1"}}), NLs::PathVersionEqual(4)});
+
+ TestUserAttrs(runtime, txId++, "/MyRoot", "DirA", AlterUserAttrs({{"AttrA3", "ValA3"}}, {"AttrA1"}));
+ env.TestWaitNotification(runtime, txId-1);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::UserAttrsEqual({{"AttrA3", "ValA3"}}), NLs::PathVersionEqual(5)});
+
+ TestUserAttrs(runtime, txId++, "/MyRoot", "DirA", AlterUserAttrs({}, {"AttrA3"}));
+ env.TestWaitNotification(runtime, txId-1);
+ auto dirAVer =TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::UserAttrsEqual({}), NLs::PathVersionEqual(6)});
+
TestUserAttrs(runtime, txId++, "/MyRoot", "DirA", {NKikimrScheme::StatusAccepted},
- AlterUserAttrs({{"AttrA6", "ValA6"}}), {dirAVer});
- env.TestWaitNotification(runtime, txId-1);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::Finished, NLs::UserAttrsEqual({{"AttrA6", "ValA6"}}), NLs::PathVersionEqual(7)});
-
+ AlterUserAttrs({{"AttrA6", "ValA6"}}), {dirAVer});
+ env.TestWaitNotification(runtime, txId-1);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::Finished, NLs::UserAttrsEqual({{"AttrA6", "ValA6"}}), NLs::PathVersionEqual(7)});
+
TestUserAttrs(runtime, txId++, "/MyRoot", "DirA", {NKikimrScheme::StatusPreconditionFailed},
AlterUserAttrs({}, {"AttrA6"}), {dirAVer});
-
- dirAVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::Finished, NLs::UserAttrsEqual({{"AttrA6", "ValA6"}}), NLs::PathVersionEqual(7)});
-
+
+ dirAVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::Finished, NLs::UserAttrsEqual({{"AttrA6", "ValA6"}}), NLs::PathVersionEqual(7)});
+
TestUserAttrs(runtime, txId++, "/MyRoot", "DirA", {NKikimrScheme::StatusAccepted},
- AlterUserAttrs({}, {"AttrA6"}), {dirAVer});
- env.TestWaitNotification(runtime, txId-1);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::Finished, NLs::UserAttrsEqual({}), NLs::PathVersionEqual(8)});
-
- TUserAttrs dirAAttrs{{"AttrB1", "ValB1"}};
- TestMkDir(runtime, txId++, "/MyRoot", "DirB", {NKikimrScheme::StatusPreconditionFailed}, AlterUserAttrs(dirAAttrs), {dirAVer});
-
- ++dirAVer.Version;
- TestMkDir(runtime, txId++, "/MyRoot", "DirB", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(dirAAttrs), {dirAVer});
- env.TestWaitNotification(runtime, txId-1);
- auto dirBVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- {NLs::Finished, NLs::UserAttrsEqual(dirAAttrs), NLs::PathVersionEqual(3)});
-
- TestMkDir(runtime, txId++, "/MyRoot/DirB", "DirBB", {NKikimrScheme::StatusAccepted}, {}, {dirAVer, dirBVer});
- env.TestWaitNotification(runtime, txId-1);
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- {NLs::Finished, NLs::PathVersionEqual(5)});
- auto dirBBVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/DirBB"),
- {NLs::Finished, NLs::PathVersionEqual(3)});
-
+ AlterUserAttrs({}, {"AttrA6"}), {dirAVer});
+ env.TestWaitNotification(runtime, txId-1);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::Finished, NLs::UserAttrsEqual({}), NLs::PathVersionEqual(8)});
+
+ TUserAttrs dirAAttrs{{"AttrB1", "ValB1"}};
+ TestMkDir(runtime, txId++, "/MyRoot", "DirB", {NKikimrScheme::StatusPreconditionFailed}, AlterUserAttrs(dirAAttrs), {dirAVer});
+
+ ++dirAVer.Version;
+ TestMkDir(runtime, txId++, "/MyRoot", "DirB", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(dirAAttrs), {dirAVer});
+ env.TestWaitNotification(runtime, txId-1);
+ auto dirBVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ {NLs::Finished, NLs::UserAttrsEqual(dirAAttrs), NLs::PathVersionEqual(3)});
+
+ TestMkDir(runtime, txId++, "/MyRoot/DirB", "DirBB", {NKikimrScheme::StatusAccepted}, {}, {dirAVer, dirBVer});
+ env.TestWaitNotification(runtime, txId-1);
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ {NLs::Finished, NLs::PathVersionEqual(5)});
+ auto dirBBVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB/DirBB"),
+ {NLs::Finished, NLs::PathVersionEqual(3)});
+
TestRmDir(runtime, txId++, "/MyRoot/DirB", "DirBB", {NKikimrScheme::StatusPreconditionFailed}, {dirAVer, dirBVer});
- dirBVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- {NLs::Finished, NLs::PathVersionEqual(5)});
+ dirBVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ {NLs::Finished, NLs::PathVersionEqual(5)});
TestRmDir(runtime, txId++, "/MyRoot/DirB", "DirBB", {NKikimrScheme::StatusAccepted}, {dirAVer, dirBVer});
- env.TestWaitNotification(runtime, txId-1);
- dirBVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- {NLs::Finished, NLs::NoChildren, NLs::PathVersionEqual(7)});
-
+ env.TestWaitNotification(runtime, txId-1);
+ dirBVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ {NLs::Finished, NLs::NoChildren, NLs::PathVersionEqual(7)});
+
TestRmDir(runtime, txId++, "/MyRoot", "DirB", {NKikimrScheme::StatusPreconditionFailed}, {dirAVer, dirBVer, dirBBVer});
- }
-
+ }
+
Y_UNIT_TEST(SpecialAttributes) {
TTestBasicRuntime runtime;
TTestEnv env(runtime);
ui64 txId = 100;
TUserAttrs dirAAttrs{{"__reserved_attribute", "Val1"}};
- TestMkDir(runtime, txId++, "/MyRoot", "DirA", {NKikimrScheme::StatusInvalidParameter}, AlterUserAttrs(dirAAttrs));
+ TestMkDir(runtime, txId++, "/MyRoot", "DirA", {NKikimrScheme::StatusInvalidParameter}, AlterUserAttrs(dirAAttrs));
TUserAttrs dirBAttrs{{"__volume_space_limit", "not a number"}};
- TestMkDir(runtime, txId++, "/MyRoot", "DirB", {NKikimrScheme::StatusInvalidParameter}, AlterUserAttrs(dirBAttrs));
+ TestMkDir(runtime, txId++, "/MyRoot", "DirB", {NKikimrScheme::StatusInvalidParameter}, AlterUserAttrs(dirBAttrs));
TUserAttrs dirCAttrs{{"__volume_space_limit", "4096"}};
- TestMkDir(runtime, txId++, "/MyRoot", "DirC", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(dirCAttrs));
-
- TUserAttrs dirDAttrs{{"__extra_path_symbols_allowed", "./_"}};
- TestMkDir(runtime, txId++, "/MyRoot", "DirD", {NKikimrScheme::StatusInvalidParameter}, AlterUserAttrs(dirDAttrs));
+ TestMkDir(runtime, txId++, "/MyRoot", "DirC", {NKikimrScheme::StatusAccepted}, AlterUserAttrs(dirCAttrs));
+
+ TUserAttrs dirDAttrs{{"__extra_path_symbols_allowed", "./_"}};
+ TestMkDir(runtime, txId++, "/MyRoot", "DirD", {NKikimrScheme::StatusInvalidParameter}, AlterUserAttrs(dirDAttrs));
}
-}
+}
diff --git a/ydb/core/tx/schemeshard/ut_user_attributes/ya.make b/ydb/core/tx/schemeshard/ut_user_attributes/ya.make
index 51bc09bdcea..6162927aa94 100644
--- a/ydb/core/tx/schemeshard/ut_user_attributes/ya.make
+++ b/ydb/core/tx/schemeshard/ut_user_attributes/ya.make
@@ -1,17 +1,17 @@
UNITTEST_FOR(ydb/core/tx/schemeshard)
-
+
OWNER(
svc
g:kikimr
)
-
-FORK_SUBTESTS()
+
+FORK_SUBTESTS()
TIMEOUT(600)
SIZE(MEDIUM)
-
-PEERDIR(
+
+PEERDIR(
library/cpp/http/io
library/cpp/http/server
library/cpp/svnversion
@@ -30,12 +30,12 @@ PEERDIR(
ydb/core/tx/schemeshard/ut_helpers
ydb/core/util
ydb/library/yql/public/issue
-)
-
+)
+
YQL_LAST_ABI_VERSION()
-SRCS(
- ut_user_attributes.cpp
-)
-
-END()
+SRCS(
+ ut_user_attributes.cpp
+)
+
+END()
diff --git a/ydb/core/tx/schemeshard/ut_user_attributes_reboots.cpp b/ydb/core/tx/schemeshard/ut_user_attributes_reboots.cpp
index dbcf8a85a30..8b58b94b0d7 100644
--- a/ydb/core/tx/schemeshard/ut_user_attributes_reboots.cpp
+++ b/ydb/core/tx/schemeshard/ut_user_attributes_reboots.cpp
@@ -1,152 +1,152 @@
#include <ydb/core/tx/schemeshard/ut_helpers/helpers.h>
-
+
#include <ydb/core/tx/datashard/datashard.h>
#include <ydb/core/protos/flat_scheme_op.pb.h>
-
+
#include <google/protobuf/text_format.h>
-
-using namespace NKikimr;
-using namespace NSchemeShard;
-using namespace NSchemeShardUT_Private;
-
-Y_UNIT_TEST_SUITE(TUserAttrsTestWithReboots) {
- Y_UNIT_TEST(InSubdomain) { //+
- TTestWithReboots t(true);
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TVector<TString> userAttrsKeys{"AttrA1", "AttrA2"};
- TUserAttrs userAttrs{{"AttrA1", "ValA1"}, {"AttrA2", "ValA2"}};
- TPathVersion pathVer;
-
- {
- TInactiveZone inactive(activeZone);
- TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
- "PlanResolution: 50 "
- "Coordinators: 1 "
- "Mediators: 2 "
- "TimeCastBucketsPerMediator: 2 "
- "Name: \"USER_0\"",
- AlterUserAttrs(userAttrs));
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- pathVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::Finished,
- NLs::PathVersionEqual(3),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(3),
- NLs::UserAttrsEqual(userAttrs)});
- }
-
+
+using namespace NKikimr;
+using namespace NSchemeShard;
+using namespace NSchemeShardUT_Private;
+
+Y_UNIT_TEST_SUITE(TUserAttrsTestWithReboots) {
+ Y_UNIT_TEST(InSubdomain) { //+
+ TTestWithReboots t(true);
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TVector<TString> userAttrsKeys{"AttrA1", "AttrA2"};
+ TUserAttrs userAttrs{{"AttrA1", "ValA1"}, {"AttrA2", "ValA2"}};
+ TPathVersion pathVer;
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestCreateSubDomain(runtime, ++t.TxId, "/MyRoot/DirA",
+ "PlanResolution: 50 "
+ "Coordinators: 1 "
+ "Mediators: 2 "
+ "TimeCastBucketsPerMediator: 2 "
+ "Name: \"USER_0\"",
+ AlterUserAttrs(userAttrs));
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ pathVer = TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(3),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(3),
+ NLs::UserAttrsEqual(userAttrs)});
+ }
+
t.TestEnv->ReliablePropose(runtime, UserAttrsRequest(++t.TxId, "/MyRoot/DirA", "USER_0",
AlterUserAttrs({}, userAttrsKeys), {pathVer}),
- {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone guard(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::Finished,
- NLs::PathVersionEqual(4),
- NLs::PathsInsideDomain(0),
- NLs::ShardsInsideDomain(3),
- NLs::UserAttrsEqual({})});
- }
-
- AsyncDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
+ {NKikimrScheme::StatusAccepted, NKikimrScheme::StatusMultipleModifications, NKikimrScheme::StatusPreconditionFailed});
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone guard(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::Finished,
+ NLs::PathVersionEqual(4),
+ NLs::PathsInsideDomain(0),
+ NLs::ShardsInsideDomain(3),
+ NLs::UserAttrsEqual({})});
+ }
+
+ AsyncDropSubDomain(runtime, ++t.TxId, "/MyRoot/DirA", "USER_0");
t.TestEnv->TestWaitTabletDeletion(runtime, {TTestTxConfig::FakeHiveTablets, TTestTxConfig::FakeHiveTablets+1, TTestTxConfig::FakeHiveTablets+2});
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
- {NLs::PathNotExist});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
- {NLs::NoChildren,
- NLs::PathVersionEqual(7),
- NLs::PathsInsideDomain(1),
- NLs::ShardsInsideDomain(0)});
- }
- });
- }
-
- Y_UNIT_TEST(Reboots) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- TestMkDir(runtime, ++t.TxId, "/MyRoot", "DirB",
- {NKikimrScheme::StatusAccepted}, AlterUserAttrs({{"AttrA1", "ValA1"}}));
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- {NLs::PathVersionEqual(3)});
- }
-
- {
- TInactiveZone inactive(activeZone);
- AsyncUserAttrs(runtime, ++t.TxId, "/MyRoot", "DirB", AlterUserAttrs({{"AttrA", "ValA"}}));
- AsyncUserAttrs(runtime, ++t.TxId, "/MyRoot", "DirB", AlterUserAttrs({{"AttrA2", "ValA2"}}));
- TestModificationResult(runtime, t.TxId - 1, NKikimrScheme::StatusAccepted);
- TestModificationResult(runtime, t.TxId , NKikimrScheme::StatusMultipleModifications);
- }
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- {NLs::UserAttrsEqual({{"AttrA", "ValA"}, {"AttrA1", "ValA1"}}), NLs::PathVersionEqual(4)});
- }
-
- TestUserAttrs(runtime, ++t.TxId, "/MyRoot", "DirB", AlterUserAttrs({{"AttrA3", "ValA3"}}, {"AttrA"}));
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- {NLs::UserAttrsEqual({{"AttrA3", "ValA3"}, {"AttrA1", "ValA1"}}), NLs::PathVersionEqual(5)});
- }
-
- TestUserAttrs(runtime, ++t.TxId, "/MyRoot", "DirB", AlterUserAttrs({}, {"AttrA3", "AttrA1"}));
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
- {NLs::UserAttrsEqual({}), NLs::PathVersionEqual(6)});
- }
- });
- }
-
- Y_UNIT_TEST(AllowedSymbolsReboots) { //+
- TTestWithReboots t;
- t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
- AsyncMkDir(runtime, ++t.TxId, "/MyRoot", "Dir0:");
- t.TestEnv->TestWaitNotification(runtime, t.TxId);
- TSchemeLimits limits;
- limits.ExtraPathSymbolsAllowed = "!?@";
- SetSchemeshardSchemaLimits(runtime, limits);
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot", "Dir1:", {NKikimrScheme::StatusSchemeError});
- TestMkDir(runtime, ++t.TxId, "/MyRoot", "Dir!");
- TestMkDir(runtime, ++t.TxId, "/MyRoot", "Dir@");
- t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId-1, t.TxId-2});
- limits.ExtraPathSymbolsAllowed = "!";
- SetSchemeshardSchemaLimits(runtime, limits);
-
- TestMkDir(runtime, ++t.TxId, "/MyRoot/Dir@", "Dir!");
- TestMkDir(runtime, ++t.TxId, "/MyRoot/Dir@", "Dir@", {NKikimrScheme::StatusSchemeError});
- t.TestEnv->TestWaitNotification(runtime, t.TxId - 1);
-
- {
- TInactiveZone inactive(activeZone);
- TestDescribeResult(DescribePath(runtime, "/MyRoot"),
- {NLs::PathVersionEqual(11)});
-
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir@"),
- {NLs::Finished, NLs::PathVersionEqual(5)});
- TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir!"),
- {NLs::Finished, NLs::NoChildren, NLs::PathVersionEqual(3)});
- }
- });
- }
-}
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA/USER_0"),
+ {NLs::PathNotExist});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirA"),
+ {NLs::NoChildren,
+ NLs::PathVersionEqual(7),
+ NLs::PathsInsideDomain(1),
+ NLs::ShardsInsideDomain(0)});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(Reboots) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ TestMkDir(runtime, ++t.TxId, "/MyRoot", "DirB",
+ {NKikimrScheme::StatusAccepted}, AlterUserAttrs({{"AttrA1", "ValA1"}}));
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ {NLs::PathVersionEqual(3)});
+ }
+
+ {
+ TInactiveZone inactive(activeZone);
+ AsyncUserAttrs(runtime, ++t.TxId, "/MyRoot", "DirB", AlterUserAttrs({{"AttrA", "ValA"}}));
+ AsyncUserAttrs(runtime, ++t.TxId, "/MyRoot", "DirB", AlterUserAttrs({{"AttrA2", "ValA2"}}));
+ TestModificationResult(runtime, t.TxId - 1, NKikimrScheme::StatusAccepted);
+ TestModificationResult(runtime, t.TxId , NKikimrScheme::StatusMultipleModifications);
+ }
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId - 1});
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ {NLs::UserAttrsEqual({{"AttrA", "ValA"}, {"AttrA1", "ValA1"}}), NLs::PathVersionEqual(4)});
+ }
+
+ TestUserAttrs(runtime, ++t.TxId, "/MyRoot", "DirB", AlterUserAttrs({{"AttrA3", "ValA3"}}, {"AttrA"}));
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ {NLs::UserAttrsEqual({{"AttrA3", "ValA3"}, {"AttrA1", "ValA1"}}), NLs::PathVersionEqual(5)});
+ }
+
+ TestUserAttrs(runtime, ++t.TxId, "/MyRoot", "DirB", AlterUserAttrs({}, {"AttrA3", "AttrA1"}));
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/DirB"),
+ {NLs::UserAttrsEqual({}), NLs::PathVersionEqual(6)});
+ }
+ });
+ }
+
+ Y_UNIT_TEST(AllowedSymbolsReboots) { //+
+ TTestWithReboots t;
+ t.Run([&](TTestActorRuntime& runtime, bool& activeZone) {
+ AsyncMkDir(runtime, ++t.TxId, "/MyRoot", "Dir0:");
+ t.TestEnv->TestWaitNotification(runtime, t.TxId);
+ TSchemeLimits limits;
+ limits.ExtraPathSymbolsAllowed = "!?@";
+ SetSchemeshardSchemaLimits(runtime, limits);
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot", "Dir1:", {NKikimrScheme::StatusSchemeError});
+ TestMkDir(runtime, ++t.TxId, "/MyRoot", "Dir!");
+ TestMkDir(runtime, ++t.TxId, "/MyRoot", "Dir@");
+ t.TestEnv->TestWaitNotification(runtime, {t.TxId, t.TxId-1, t.TxId-2});
+ limits.ExtraPathSymbolsAllowed = "!";
+ SetSchemeshardSchemaLimits(runtime, limits);
+
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/Dir@", "Dir!");
+ TestMkDir(runtime, ++t.TxId, "/MyRoot/Dir@", "Dir@", {NKikimrScheme::StatusSchemeError});
+ t.TestEnv->TestWaitNotification(runtime, t.TxId - 1);
+
+ {
+ TInactiveZone inactive(activeZone);
+ TestDescribeResult(DescribePath(runtime, "/MyRoot"),
+ {NLs::PathVersionEqual(11)});
+
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir@"),
+ {NLs::Finished, NLs::PathVersionEqual(5)});
+ TestDescribeResult(DescribePath(runtime, "/MyRoot/Dir!"),
+ {NLs::Finished, NLs::NoChildren, NLs::PathVersionEqual(3)});
+ }
+ });
+ }
+}
diff --git a/ydb/core/tx/schemeshard/ut_user_attributes_reboots/ya.make b/ydb/core/tx/schemeshard/ut_user_attributes_reboots/ya.make
index 8b37c106375..c9d8bb03b43 100644
--- a/ydb/core/tx/schemeshard/ut_user_attributes_reboots/ya.make
+++ b/ydb/core/tx/schemeshard/ut_user_attributes_reboots/ya.make
@@ -1,15 +1,15 @@
IF (NOT WITH_VALGRIND)
UNITTEST_FOR(ydb/core/tx/schemeshard)
-
+
OWNER(
vvvv
g:kikimr
)
-
+
FORK_SUBTESTS()
-
+
SPLIT_FACTOR(60)
-
+
IF (SANITIZER_TYPE OR WITH_VALGRIND)
TIMEOUT(3600)
SIZE(LARGE)
@@ -18,7 +18,7 @@ IF (NOT WITH_VALGRIND)
TIMEOUT(600)
SIZE(MEDIUM)
ENDIF()
-
+
PEERDIR(
library/cpp/getopt
library/cpp/regex/pcre
diff --git a/ydb/core/tx/schemeshard/ya.make b/ydb/core/tx/schemeshard/ya.make
index 7848e1fc61b..ceb87ce3883 100644
--- a/ydb/core/tx/schemeshard/ya.make
+++ b/ydb/core/tx/schemeshard/ya.make
@@ -15,8 +15,8 @@ RECURSE_FOR_TESTS(
ut_index_build
ut_index_build_reboots
ut_login
- ut_move
- ut_move_reboots
+ ut_move
+ ut_move_reboots
ut_olap
ut_olap_reboots
ut_pq
@@ -44,10 +44,10 @@ RECURSE_FOR_TESTS(
LIBRARY()
-OWNER(
- ddoarn
+OWNER(
+ ddoarn
g:kikimr
-)
+)
IF (KIKIMR_ALLOW_SHARDED_COMPACTION)
CFLAGS(
@@ -58,130 +58,130 @@ ENDIF()
SRCS(
defs.h
schemeshard.h
- schemeshard.cpp
+ schemeshard.cpp
schemeshard__compaction.cpp
- schemeshard__clean_pathes.cpp
+ schemeshard__clean_pathes.cpp
schemeshard__conditional_erase.cpp
- schemeshard__describe_scheme.cpp
- schemeshard__delete_tablet_reply.cpp
+ schemeshard__describe_scheme.cpp
+ schemeshard__delete_tablet_reply.cpp
schemeshard__find_subdomain_path_id.cpp
schemeshard__fix_bad_paths.cpp
schemeshard__init.cpp
schemeshard__init_populator.cpp
- schemeshard__init_root.cpp
- schemeshard__init_schema.cpp
- schemeshard__serverless_storage_billing.cpp
- schemeshard__sync_update_tenants.cpp
+ schemeshard__init_root.cpp
+ schemeshard__init_schema.cpp
+ schemeshard__serverless_storage_billing.cpp
+ schemeshard__sync_update_tenants.cpp
schemeshard__login.cpp
schemeshard__monitoring.cpp
- schemeshard__notify.cpp
- schemeshard__operation.cpp
- schemeshard__operation.h
- schemeshard__operation_side_effects.cpp
- schemeshard__operation_side_effects.h
- schemeshard__operation_memory_changes.cpp
- schemeshard__operation_db_changes.cpp
- schemeshard__operation_alter_bsv.cpp
- schemeshard__operation_alter_extsubdomain.cpp
+ schemeshard__notify.cpp
+ schemeshard__operation.cpp
+ schemeshard__operation.h
+ schemeshard__operation_side_effects.cpp
+ schemeshard__operation_side_effects.h
+ schemeshard__operation_memory_changes.cpp
+ schemeshard__operation_db_changes.cpp
+ schemeshard__operation_alter_bsv.cpp
+ schemeshard__operation_alter_extsubdomain.cpp
schemeshard__operation_alter_fs.cpp
schemeshard__operation_alter_index.cpp
- schemeshard__operation_alter_kesus.cpp
+ schemeshard__operation_alter_kesus.cpp
schemeshard__operation_alter_login.cpp
schemeshard__operation_alter_olap_store.cpp
schemeshard__operation_alter_olap_table.cpp
- schemeshard__operation_alter_pq.cpp
+ schemeshard__operation_alter_pq.cpp
schemeshard__operation_alter_solomon.cpp
- schemeshard__operation_alter_subdomain.cpp
- schemeshard__operation_alter_table.cpp
- schemeshard__operation_alter_user_attrs.cpp
- schemeshard__operation_assign_bsv.cpp
+ schemeshard__operation_alter_subdomain.cpp
+ schemeshard__operation_alter_table.cpp
+ schemeshard__operation_alter_user_attrs.cpp
+ schemeshard__operation_assign_bsv.cpp
schemeshard__operation_cancel_tx.cpp
- schemeshard__operation_common.cpp
- schemeshard__operation_common.h
- schemeshard__operation_consistent_copy_tables.cpp
- schemeshard__operation_copy_table.cpp
- schemeshard__operation_create_backup.cpp
- schemeshard__operation_create_bsv.cpp
- schemeshard__operation_create_extsubdomain.cpp
+ schemeshard__operation_common.cpp
+ schemeshard__operation_common.h
+ schemeshard__operation_consistent_copy_tables.cpp
+ schemeshard__operation_copy_table.cpp
+ schemeshard__operation_create_backup.cpp
+ schemeshard__operation_create_bsv.cpp
+ schemeshard__operation_create_extsubdomain.cpp
schemeshard__operation_create_fs.cpp
schemeshard__operation_create_index.cpp
schemeshard__operation_create_indexed_table.cpp
- schemeshard__operation_create_kesus.cpp
- schemeshard__operation_create_lock.cpp
+ schemeshard__operation_create_kesus.cpp
+ schemeshard__operation_create_lock.cpp
schemeshard__operation_create_olap_store.cpp
schemeshard__operation_create_olap_table.cpp
- schemeshard__operation_create_pq.cpp
+ schemeshard__operation_create_pq.cpp
schemeshard__operation_create_replication.cpp
schemeshard__operation_create_restore.cpp
- schemeshard__operation_create_rtmr.cpp
+ schemeshard__operation_create_rtmr.cpp
schemeshard__operation_create_sequence.cpp
- schemeshard__operation_create_solomon.cpp
- schemeshard__operation_create_subdomain.cpp
- schemeshard__operation_create_table.cpp
- schemeshard__operation_drop_bsv.cpp
- schemeshard__operation_drop_extsubdomain.cpp
+ schemeshard__operation_create_solomon.cpp
+ schemeshard__operation_create_subdomain.cpp
+ schemeshard__operation_create_table.cpp
+ schemeshard__operation_drop_bsv.cpp
+ schemeshard__operation_drop_extsubdomain.cpp
schemeshard__operation_drop_fs.cpp
- schemeshard__operation_drop_indexed_table.cpp
- schemeshard__operation_drop_kesus.cpp
+ schemeshard__operation_drop_indexed_table.cpp
+ schemeshard__operation_drop_kesus.cpp
schemeshard__operation_drop_lock.cpp
schemeshard__operation_drop_olap_store.cpp
schemeshard__operation_drop_olap_table.cpp
schemeshard__operation_drop_pq.cpp
schemeshard__operation_drop_replication.cpp
schemeshard__operation_drop_sequence.cpp
- schemeshard__operation_drop_solomon.cpp
- schemeshard__operation_drop_subdomain.cpp
- schemeshard__operation_drop_table.cpp
- schemeshard__operation_drop_unsafe.cpp
- schemeshard__operation_mkdir.cpp
- schemeshard__operation_modify_acl.cpp
- schemeshard__operation_move_table.cpp
- schemeshard__operation_move_tables.cpp
- schemeshard__operation_move_table_index.cpp
- schemeshard__operation_part.cpp
- schemeshard__operation_part.h
- schemeshard__operation_rmdir.cpp
- schemeshard__operation_split_merge.cpp
- schemeshard__operation_just_reject.cpp
- schemeshard__operation_upgrade_subdomain.cpp
- schemeshard__operation_initiate_build_index.cpp
- schemeshard__operation_finalize_build_index.cpp
- schemeshard__operation_create_build_index.cpp
- schemeshard__operation_apply_build_index.cpp
- schemeshard__operation_cansel_build_index.cpp
- schemeshard__operation_drop_index.cpp
+ schemeshard__operation_drop_solomon.cpp
+ schemeshard__operation_drop_subdomain.cpp
+ schemeshard__operation_drop_table.cpp
+ schemeshard__operation_drop_unsafe.cpp
+ schemeshard__operation_mkdir.cpp
+ schemeshard__operation_modify_acl.cpp
+ schemeshard__operation_move_table.cpp
+ schemeshard__operation_move_tables.cpp
+ schemeshard__operation_move_table_index.cpp
+ schemeshard__operation_part.cpp
+ schemeshard__operation_part.h
+ schemeshard__operation_rmdir.cpp
+ schemeshard__operation_split_merge.cpp
+ schemeshard__operation_just_reject.cpp
+ schemeshard__operation_upgrade_subdomain.cpp
+ schemeshard__operation_initiate_build_index.cpp
+ schemeshard__operation_finalize_build_index.cpp
+ schemeshard__operation_create_build_index.cpp
+ schemeshard__operation_apply_build_index.cpp
+ schemeshard__operation_cansel_build_index.cpp
+ schemeshard__operation_drop_index.cpp
schemeshard__operation_create_cdc_stream.cpp
schemeshard__operation_alter_cdc_stream.cpp
schemeshard__operation_drop_cdc_stream.cpp
schemeshard__publish_to_scheme_board.cpp
- schemeshard__state_changed_reply.cpp
+ schemeshard__state_changed_reply.cpp
schemeshard__table_stats.cpp
- schemeshard__table_stats_histogram.cpp
- schemeshard__upgrade_schema.cpp
- schemeshard__upgrade_access_database.cpp
- schemeshard__make_access_database_no_inheritable.cpp
- schemeshard_impl.cpp
- schemeshard_impl.h
+ schemeshard__table_stats_histogram.cpp
+ schemeshard__upgrade_schema.cpp
+ schemeshard__upgrade_access_database.cpp
+ schemeshard__make_access_database_no_inheritable.cpp
+ schemeshard_impl.cpp
+ schemeshard_impl.h
schemeshard_billing_helpers.cpp
- schemeshard_domain_links.h
- schemeshard_domain_links.cpp
- schemeshard_effective_acl.h
- schemeshard_effective_acl.cpp
- schemeshard_identificators.cpp
- schemeshard_info_types.cpp
- schemeshard_info_types.h
+ schemeshard_domain_links.h
+ schemeshard_domain_links.cpp
+ schemeshard_effective_acl.h
+ schemeshard_effective_acl.cpp
+ schemeshard_identificators.cpp
+ schemeshard_info_types.cpp
+ schemeshard_info_types.h
schemeshard_path_describer.cpp
- schemeshard_path_element.h
- schemeshard_path.cpp
- schemeshard_path.h
- schemeshard_schema.h
- schemeshard_tx_infly.h
- schemeshard_types.cpp
- schemeshard_types.h
- schemeshard_ui64id.cpp
+ schemeshard_path_element.h
+ schemeshard_path.cpp
+ schemeshard_path.h
+ schemeshard_schema.h
+ schemeshard_tx_infly.h
+ schemeshard_types.cpp
+ schemeshard_types.h
+ schemeshard_ui64id.cpp
schemeshard_user_attr_limits.h
- schemeshard_utils.cpp
- schemeshard_utils.h
+ schemeshard_utils.cpp
+ schemeshard_utils.h
schemeshard_export__cancel.cpp
schemeshard_export__create.cpp
schemeshard_export__forget.cpp
@@ -196,20 +196,20 @@ SRCS(
schemeshard_import__list.cpp
schemeshard_import_flow_proposals.cpp
schemeshard_import.cpp
- schemeshard_build_index.cpp
- schemeshard_build_index__cancel.cpp
- schemeshard_build_index__forget.cpp
- schemeshard_build_index__list.cpp
- schemeshard_build_index__create.cpp
- schemeshard_build_index__get.cpp
- schemeshard_build_index__progress.cpp
+ schemeshard_build_index.cpp
+ schemeshard_build_index__cancel.cpp
+ schemeshard_build_index__forget.cpp
+ schemeshard_build_index__list.cpp
+ schemeshard_build_index__create.cpp
+ schemeshard_build_index__get.cpp
+ schemeshard_build_index__progress.cpp
schemeshard_validate_ttl.cpp
operation_queue_timer.h
)
GENERATE_ENUM_SERIALIZATION(schemeshard_info_types.h)
-GENERATE_ENUM_SERIALIZATION(schemeshard_types.h)
+GENERATE_ENUM_SERIALIZATION(schemeshard_types.h)
PEERDIR(
contrib/libs/protobuf
diff --git a/ydb/core/tx/sequenceproxy/sequenceproxy_ut.cpp b/ydb/core/tx/sequenceproxy/sequenceproxy_ut.cpp
index 2bf174b09df..f08203fca0e 100644
--- a/ydb/core/tx/sequenceproxy/sequenceproxy_ut.cpp
+++ b/ydb/core/tx/sequenceproxy/sequenceproxy_ut.cpp
@@ -86,7 +86,7 @@ Y_UNIT_TEST_SUITE(SequenceProxy) {
auto edge = runtime.AllocateEdgeActor(0);
auto request = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
auto* tx = request->Record.MutableTransaction()->MutableModifyScheme();
- tx->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateSequence);
+ tx->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpCreateSequence);
tx->SetWorkingDir(workingDir);
auto* op = tx->MutableSequence();
bool parseResult = ::google::protobuf::TextFormat::ParseFromString(scheme, op);
@@ -99,10 +99,10 @@ Y_UNIT_TEST_SUITE(SequenceProxy) {
Y_VERIFY(status == TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecInProgress);
ui64 schemeShardTabletId = msg->Record.GetSchemeShardTabletId();
- auto notifyReq = MakeHolder<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion>();
+ auto notifyReq = MakeHolder<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion>();
notifyReq->Record.SetTxId(msg->Record.GetTxId());
runtime.SendToPipe(schemeShardTabletId, edge, notifyReq.Release());
- runtime.GrabEdgeEventRethrow<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult>(edge);
+ runtime.GrabEdgeEventRethrow<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult>(edge);
}
void SendNextValRequest(TTestActorRuntime& runtime, const TActorId& sender, const TString& path) {
diff --git a/ydb/core/tx/time_cast/defs.h b/ydb/core/tx/time_cast/defs.h
index fac14fc5627..7be3ae0953f 100644
--- a/ydb/core/tx/time_cast/defs.h
+++ b/ydb/core/tx/time_cast/defs.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
// unique tag to fix pragma once gcc glueing: ./ydb/core/tx/defs.h
#include <ydb/core/base/defs.h>
#include <ydb/core/base/events.h>
diff --git a/ydb/core/tx/time_cast/time_cast.cpp b/ydb/core/tx/time_cast/time_cast.cpp
index 3edf534c351..08042194fc5 100644
--- a/ydb/core/tx/time_cast/time_cast.cpp
+++ b/ydb/core/tx/time_cast/time_cast.cpp
@@ -1,5 +1,5 @@
-#include "time_cast.h"
-
+#include "time_cast.h"
+
#include <library/cpp/actors/core/hfunc.h>
#include <library/cpp/actors/core/log.h>
#include <ydb/core/base/tx_processing.h>
@@ -7,7 +7,7 @@
#include <ydb/core/protos/services.pb.h>
#include <ydb/core/tx/tx.h>
#include <ydb/core/tablet/tablet_pipe_client_cache.h>
-
+
#include <util/generic/hash.h>
#include <util/generic/hash_set.h>
@@ -75,11 +75,11 @@ class TMediatorTimecastProxy : public TActor<TMediatorTimecastProxy> {
THashMap<ui64, TMediator> Mediators; // mediator tablet -> info
THashMap<ui64, TTabletInfo> Tablets;
- TMediator& MediatorInfo(ui64 mediator, const NKikimrSubDomains::TProcessingParams &processing) {
+ TMediator& MediatorInfo(ui64 mediator, const NKikimrSubDomains::TProcessingParams &processing) {
auto pr = Mediators.try_emplace(mediator, processing.GetTimeCastBucketsPerMediator());
if (!pr.second) {
Y_VERIFY(pr.first->second.BucketsSz == processing.GetTimeCastBucketsPerMediator());
- }
+ }
return pr.first->second;
}
@@ -165,20 +165,20 @@ void TMediatorTimecastProxy::Handle(TEvMediatorTimecast::TEvRegisterTablet::TPtr
LOG_DEBUG_S(ctx, NKikimrServices::TX_MEDIATOR_TIMECAST, "Actor# " << ctx.SelfID.ToString()
<< " HANDLE " << msg->ToString());
const ui64 tabletId = msg->TabletId;
- const NKikimrSubDomains::TProcessingParams &processingParams = msg->ProcessingParams;
+ const NKikimrSubDomains::TProcessingParams &processingParams = msg->ProcessingParams;
auto& tabletInfo = Tablets[tabletId];
- TMediators mediators(processingParams);
- Y_VERIFY(mediators.List().size());
+ TMediators mediators(processingParams);
+ Y_VERIFY(mediators.List().size());
const ui64 mediatorTabletId = mediators.Select(tabletId);
tabletInfo.MediatorTabletId = mediatorTabletId;
-
- TTimeCastBuckets buckets(processingParams);
- const ui32 bucketId = buckets.Select(tabletId);
+
+ TTimeCastBuckets buckets(processingParams);
+ const ui32 bucketId = buckets.Select(tabletId);
tabletInfo.BucketId = bucketId;
- TMediator &mediator = MediatorInfo(mediatorTabletId, processingParams);
+ TMediator &mediator = MediatorInfo(mediatorTabletId, processingParams);
tabletInfo.Mediator = &mediator;
Y_VERIFY(bucketId < mediator.BucketsSz);
diff --git a/ydb/core/tx/time_cast/time_cast.h b/ydb/core/tx/time_cast/time_cast.h
index 15855c1bd2a..1202d5a7991 100644
--- a/ydb/core/tx/time_cast/time_cast.h
+++ b/ydb/core/tx/time_cast/time_cast.h
@@ -1,7 +1,7 @@
#pragma once
-
+
#include "defs.h"
-
+
#include <ydb/core/protos/subdomains.pb.h>
#include <ydb/core/protos/tx_mediator_timecast.pb.h>
@@ -43,21 +43,21 @@ struct TEvMediatorTimecast {
struct TEvRegisterTablet : public TEventLocal<TEvRegisterTablet, EvRegisterTablet> {
const ui64 TabletId;
- NKikimrSubDomains::TProcessingParams ProcessingParams;
+ NKikimrSubDomains::TProcessingParams ProcessingParams;
-
- TEvRegisterTablet(ui64 tabletId, const NKikimrSubDomains::TProcessingParams &processing)
+
+ TEvRegisterTablet(ui64 tabletId, const NKikimrSubDomains::TProcessingParams &processing)
: TabletId(tabletId)
- , ProcessingParams(processing)
+ , ProcessingParams(processing)
{}
TString ToString() const {
TStringStream str;
str << "{TEvRegisterTablet";
str << " TabletId# " << TabletId;
- if (ProcessingParams.HasVersion()) {
- str << " ProcessingParams { " << ProcessingParams.ShortDebugString() << " }";
- }
+ if (ProcessingParams.HasVersion()) {
+ str << " ProcessingParams { " << ProcessingParams.ShortDebugString() << " }";
+ }
str << "}";
return str.Str();
}
diff --git a/ydb/core/tx/time_cast/ya.make b/ydb/core/tx/time_cast/ya.make
index 420c5d93ab8..9c059ac2b92 100644
--- a/ydb/core/tx/time_cast/ya.make
+++ b/ydb/core/tx/time_cast/ya.make
@@ -1,20 +1,20 @@
-LIBRARY()
-
-OWNER(
- ddoarn
+LIBRARY()
+
+OWNER(
+ ddoarn
g:kikimr
-)
-
-SRCS(
- time_cast.cpp
-)
-
-PEERDIR(
+)
+
+SRCS(
+ time_cast.cpp
+)
+
+PEERDIR(
library/cpp/actors/core
ydb/core/base
ydb/core/protos
ydb/core/tablet
ydb/core/tx
-)
-
-END()
+)
+
+END()
diff --git a/ydb/core/tx/tx.cpp b/ydb/core/tx/tx.cpp
index 9b52b02952b..56b32469ff8 100644
--- a/ydb/core/tx/tx.cpp
+++ b/ydb/core/tx/tx.cpp
@@ -1,45 +1,45 @@
-#include "tx.h"
-
+#include "tx.h"
+
#include <ydb/core/base/tx_processing.h>
-
-namespace NKikimr {
-
+
+namespace NKikimr {
+
TEvTxProxy::TEvProposeTransaction::TEvProposeTransaction(ui64 coordinator, ui64 txId, ui8 execLevel, ui64 minStep, ui64 maxStep) {
- Record.SetCoordinatorID(coordinator);
- NKikimrTx::TProxyTransaction *x = Record.MutableTransaction();
- x->SetTxId(txId);
- x->SetExecLevel(execLevel);
- x->SetMinStep(minStep);
- x->SetMaxStep(maxStep);
-}
-
-TEvTxProxy::TEvProposeTransactionStatus::TEvProposeTransactionStatus(TEvTxProxy::TEvProposeTransactionStatus::EStatus status, ui64 txid, ui64 stepId) {
- Record.SetStatus((ui32)status);
- if (txid)
- Record.SetTxId(txid);
- if (stepId)
- Record.SetStepId(stepId);
-}
-
-TEvSubDomain::TEvConfigure::TEvConfigure(const NKikimrSubDomains::TProcessingParams &processing) {
- Record.CopyFrom(processing);
-}
-
-TEvSubDomain::TEvConfigure::TEvConfigure(NKikimrSubDomains::TProcessingParams &&processing) {
- Record.Swap(&processing);
-}
-
-TEvSubDomain::TEvConfigureStatus::TEvConfigureStatus(NKikimrTx::TEvSubDomainConfigurationAck::EStatus status, ui64 tabletId) {
- Record.SetStatus(status);
- Record.SetOnTabletId(tabletId);
-}
-
-TAutoPtr<TEvSubDomain::TEvConfigure> CreateDomainConfigurationFromStatic(const TAppData *appdata, ui64 tabletId) {
- const ui32 selfDomain = appdata->DomainsInfo->GetDomainUidByTabletId(tabletId);
- Y_VERIFY(selfDomain != appdata->DomainsInfo->BadDomainId);
- const auto& domain = appdata->DomainsInfo->GetDomain(selfDomain);
-
- return new TEvSubDomain::TEvConfigure(ExtractProcessingParams(domain));
-}
-
-}
+ Record.SetCoordinatorID(coordinator);
+ NKikimrTx::TProxyTransaction *x = Record.MutableTransaction();
+ x->SetTxId(txId);
+ x->SetExecLevel(execLevel);
+ x->SetMinStep(minStep);
+ x->SetMaxStep(maxStep);
+}
+
+TEvTxProxy::TEvProposeTransactionStatus::TEvProposeTransactionStatus(TEvTxProxy::TEvProposeTransactionStatus::EStatus status, ui64 txid, ui64 stepId) {
+ Record.SetStatus((ui32)status);
+ if (txid)
+ Record.SetTxId(txid);
+ if (stepId)
+ Record.SetStepId(stepId);
+}
+
+TEvSubDomain::TEvConfigure::TEvConfigure(const NKikimrSubDomains::TProcessingParams &processing) {
+ Record.CopyFrom(processing);
+}
+
+TEvSubDomain::TEvConfigure::TEvConfigure(NKikimrSubDomains::TProcessingParams &&processing) {
+ Record.Swap(&processing);
+}
+
+TEvSubDomain::TEvConfigureStatus::TEvConfigureStatus(NKikimrTx::TEvSubDomainConfigurationAck::EStatus status, ui64 tabletId) {
+ Record.SetStatus(status);
+ Record.SetOnTabletId(tabletId);
+}
+
+TAutoPtr<TEvSubDomain::TEvConfigure> CreateDomainConfigurationFromStatic(const TAppData *appdata, ui64 tabletId) {
+ const ui32 selfDomain = appdata->DomainsInfo->GetDomainUidByTabletId(tabletId);
+ Y_VERIFY(selfDomain != appdata->DomainsInfo->BadDomainId);
+ const auto& domain = appdata->DomainsInfo->GetDomain(selfDomain);
+
+ return new TEvSubDomain::TEvConfigure(ExtractProcessingParams(domain));
+}
+
+}
diff --git a/ydb/core/tx/tx.h b/ydb/core/tx/tx.h
index 7b4c836f1b6..bacde442371 100644
--- a/ydb/core/tx/tx.h
+++ b/ydb/core/tx/tx.h
@@ -6,7 +6,7 @@
#include <ydb/core/protos/subdomains.pb.h>
#include <ydb/core/base/blobstorage.h>
#include <ydb/core/base/appdata.h>
-
+
#include <library/cpp/actors/core/event_pb.h>
namespace NKikimr {
@@ -24,7 +24,7 @@ struct TEvTxProxy {
static_assert(EvEnd < EventSpaceEnd(TKikimrEvents::ES_TX_PROXY), "expect EvEnd < EventSpaceEnd(TKikimrEvents::ES_TX_PROXY)");
struct TEvProposeTransaction : public TEventPB<TEvProposeTransaction, NKikimrTx::TEvProposeTransaction, EvProposeTransaction> {
- TEvProposeTransaction() = default;
+ TEvProposeTransaction() = default;
TEvProposeTransaction(ui64 coordinator, ui64 txId, ui8 execLevel, ui64 minStep, ui64 maxStep);
};
@@ -44,9 +44,9 @@ struct TEvTxProxy {
StatusConfirmed, // execution confirmed by moderator (for synth-exec-level)
};
- TEvProposeTransactionStatus() = default;
+ TEvProposeTransactionStatus() = default;
- TEvProposeTransactionStatus(EStatus status, ui64 txid, ui64 stepId);
+ TEvProposeTransactionStatus(EStatus status, ui64 txid, ui64 stepId);
EStatus GetStatus() const {
Y_VERIFY_DEBUG(Record.HasStatus());
@@ -108,52 +108,52 @@ struct TExecLevelHierarchy {
// one scheme shard (#F0)
struct TTestTxConfig {
- static constexpr ui64 DomainUid = 0;
- static constexpr ui64 Coordinator = 0x0000000000800001;
- static constexpr ui64 Mediator = 0x0000000000810001;
- static constexpr ui64 TxAllocator = 0x0000000000820001;
- static constexpr ui64 Moderator = 0x0000000000830001;
- static constexpr ui64 TxTablet0 = 0x0000000000900000;
- static constexpr ui64 TxTablet1 = 0x0000000000900001;
- static constexpr ui64 TxTablet2 = 0x0000000000900002;
- static constexpr ui64 TxTablet3 = 0x0000000000900003;
- static constexpr ui64 TxTablet4 = 0x0000000000900004;
- static constexpr ui64 TxTablet5 = 0x0000000000900005;
- static constexpr ui64 TxTablet6 = 0x0000000000900006;
- static constexpr ui64 TxTablet7 = 0x0000000000900006;
- static constexpr ui64 FakeHiveTablets = 0x000000000090000a;
- static constexpr ui64 SchemeShard = 0x00000000008587a0;
- static constexpr ui64 Hive = 0x000000000000A001;
- static constexpr ui64 UseLessId = 0xFFFFFFFFFFFFFFF;
+ static constexpr ui64 DomainUid = 0;
+ static constexpr ui64 Coordinator = 0x0000000000800001;
+ static constexpr ui64 Mediator = 0x0000000000810001;
+ static constexpr ui64 TxAllocator = 0x0000000000820001;
+ static constexpr ui64 Moderator = 0x0000000000830001;
+ static constexpr ui64 TxTablet0 = 0x0000000000900000;
+ static constexpr ui64 TxTablet1 = 0x0000000000900001;
+ static constexpr ui64 TxTablet2 = 0x0000000000900002;
+ static constexpr ui64 TxTablet3 = 0x0000000000900003;
+ static constexpr ui64 TxTablet4 = 0x0000000000900004;
+ static constexpr ui64 TxTablet5 = 0x0000000000900005;
+ static constexpr ui64 TxTablet6 = 0x0000000000900006;
+ static constexpr ui64 TxTablet7 = 0x0000000000900006;
+ static constexpr ui64 FakeHiveTablets = 0x000000000090000a;
+ static constexpr ui64 SchemeShard = 0x00000000008587a0;
+ static constexpr ui64 Hive = 0x000000000000A001;
+ static constexpr ui64 UseLessId = 0xFFFFFFFFFFFFFFF;
};
-struct TEvSubDomain {
- enum EEv {
- EvConfigure = EventSpaceBegin(TKikimrEvents::ES_SUB_DOMAIN),
- EvConfigureStatus,
-
- EvEnd
- };
-
- static_assert(EvEnd < EventSpaceEnd(TKikimrEvents::ES_SUB_DOMAIN), "expect EvEnd < EventSpaceEnd(TKikimrEvents::ES_SUB_DOMAIN)");
-
- struct TEvConfigure : public TEventPB<TEvConfigure, NKikimrSubDomains::TProcessingParams, EvConfigure> {
- TEvConfigure() = default;
-
- TEvConfigure(const NKikimrSubDomains::TProcessingParams &processing);
- TEvConfigure(NKikimrSubDomains::TProcessingParams &&processing);
- };
-
- struct TEvConfigureStatus : public TEventPB<TEvConfigureStatus, NKikimrTx::TEvSubDomainConfigurationAck, EvConfigureStatus> {
- TEvConfigureStatus() = default;
-
- TEvConfigureStatus(NKikimrTx::TEvSubDomainConfigurationAck::EStatus status,
- ui64 tabletId);
- };
-};
-
-TAutoPtr<TEvSubDomain::TEvConfigure> CreateDomainConfigurationFromStatic(const TAppData *appdata, ui64 tabletId);
-
+struct TEvSubDomain {
+ enum EEv {
+ EvConfigure = EventSpaceBegin(TKikimrEvents::ES_SUB_DOMAIN),
+ EvConfigureStatus,
+
+ EvEnd
+ };
+
+ static_assert(EvEnd < EventSpaceEnd(TKikimrEvents::ES_SUB_DOMAIN), "expect EvEnd < EventSpaceEnd(TKikimrEvents::ES_SUB_DOMAIN)");
+
+ struct TEvConfigure : public TEventPB<TEvConfigure, NKikimrSubDomains::TProcessingParams, EvConfigure> {
+ TEvConfigure() = default;
+
+ TEvConfigure(const NKikimrSubDomains::TProcessingParams &processing);
+ TEvConfigure(NKikimrSubDomains::TProcessingParams &&processing);
+ };
+
+ struct TEvConfigureStatus : public TEventPB<TEvConfigureStatus, NKikimrTx::TEvSubDomainConfigurationAck, EvConfigureStatus> {
+ TEvConfigureStatus() = default;
+
+ TEvConfigureStatus(NKikimrTx::TEvSubDomainConfigurationAck::EStatus status,
+ ui64 tabletId);
+ };
+};
+
+TAutoPtr<TEvSubDomain::TEvConfigure> CreateDomainConfigurationFromStatic(const TAppData *appdata, ui64 tabletId);
+
}
template<>
@@ -161,5 +161,5 @@ inline void Out<NKikimr::TEvTxProxy::TEvProposeTransactionStatus::EStatus>(IOutp
NKikimr::TEvTxProxy::TEvProposeTransactionStatus::EStatus x) {
o << (ui32)x;
}
-
-
+
+
diff --git a/ydb/core/tx/tx_allocator/defs.h b/ydb/core/tx/tx_allocator/defs.h
index 193336fb8f0..28fa048deb1 100644
--- a/ydb/core/tx/tx_allocator/defs.h
+++ b/ydb/core/tx/tx_allocator/defs.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
// unique tag to fix pragma once gcc glueing: ./ydb/core/tx/tx_allocator/defs.h
#include <ydb/core/base/defs.h>
#include <ydb/core/base/events.h>
diff --git a/ydb/core/tx/tx_allocator/txallocator.cpp b/ydb/core/tx/tx_allocator/txallocator.cpp
index 943c112852a..b9aa9606fb0 100644
--- a/ydb/core/tx/tx_allocator/txallocator.cpp
+++ b/ydb/core/tx/tx_allocator/txallocator.cpp
@@ -1,18 +1,18 @@
-#include "txallocator.h"
-#include "txallocator_impl.h"
-
-namespace NKikimr {
-
+#include "txallocator.h"
+#include "txallocator_impl.h"
+
+namespace NKikimr {
+
IActor* CreateTxAllocator(const TActorId &tablet, TTabletStorageInfo *info) {
- return new NTxAllocator::TTxAllocator(tablet, info);
-}
-
-ui64 TEvTxAllocator::TEvAllocateResult::AllocationMask() {
- return (ui64)0xFFFF << (64 - 16);
-}
-
-ui64 TEvTxAllocator::TEvAllocateResult::ExtractPrivateMarker(ui64 item) {
- return item & AllocationMask();
-}
-
-}
+ return new NTxAllocator::TTxAllocator(tablet, info);
+}
+
+ui64 TEvTxAllocator::TEvAllocateResult::AllocationMask() {
+ return (ui64)0xFFFF << (64 - 16);
+}
+
+ui64 TEvTxAllocator::TEvAllocateResult::ExtractPrivateMarker(ui64 item) {
+ return item & AllocationMask();
+}
+
+}
diff --git a/ydb/core/tx/tx_allocator/txallocator.h b/ydb/core/tx/tx_allocator/txallocator.h
index 5d7399e4409..3080bd0c719 100644
--- a/ydb/core/tx/tx_allocator/txallocator.h
+++ b/ydb/core/tx/tx_allocator/txallocator.h
@@ -1,63 +1,63 @@
-#pragma once
-#include "defs.h"
-
+#pragma once
+#include "defs.h"
+
#include <ydb/core/base/blobstorage.h>
#include <ydb/core/protos/tx.pb.h>
-
-namespace NKikimr {
+
+namespace NKikimr {
IActor* CreateTxAllocator(const TActorId &tablet, TTabletStorageInfo *info);
-}
-
-namespace NKikimr {
-struct TEvTxAllocator {
- enum EEv {
- EvAllocate = EventSpaceBegin(TKikimrEvents::ES_TX_ALLOCATOR),
- EvAllocateResult,
-
- EvEnd
- };
- static_assert(EvEnd < EventSpaceEnd(TKikimrEvents::ES_TX_ALLOCATOR), "expect EvEnd < EventSpaceEnd(TKikimrEvents::ES_TX_ALLOCATOR)");
-
- struct TEvAllocate : public TEventPB<TEvAllocate, NKikimrTx::TEvTxAllocate, EvAllocate> {
- TEvAllocate()
- {}
-
- TEvAllocate(ui64 count)
- {
- Record.SetRangeSize(count);
- }
- };
-
- struct TEvAllocateResult : public TEventPB<TEvAllocateResult, NKikimrTx::TEvTxAllocateResult, EvAllocateResult> {
- TEvAllocateResult()
- {}
-
- TEvAllocateResult(NKikimrTx::TEvTxAllocateResult::EStatus status)
- {
- Y_VERIFY(status != NKikimrTx::TEvTxAllocateResult::SUCCESS);
- Record.SetStatus(status);
- }
-
- TEvAllocateResult(ui64 begin, ui64 end)
- {
- Y_VERIFY(ExtractPrivateMarker(begin) != 0, "privat marker hasn't found in allocation");
- Y_VERIFY(ExtractPrivateMarker(begin) == ExtractPrivateMarker(end), "privat marker incorrect");
-
- Record.SetStatus(NKikimrTx::TEvTxAllocateResult::SUCCESS);
- Record.SetRangeBegin(begin);
- Record.SetRangeEnd(end);
- }
-
- ui64 AllocationMask();
- ui64 ExtractPrivateMarker(ui64 item);
- };
-};
-}
-
-template<>
-inline void Out<NKikimrTx::TEvTxAllocateResult::EStatus>(IOutputStream& o, NKikimrTx::TEvTxAllocateResult::EStatus x) {
+}
+
+namespace NKikimr {
+struct TEvTxAllocator {
+ enum EEv {
+ EvAllocate = EventSpaceBegin(TKikimrEvents::ES_TX_ALLOCATOR),
+ EvAllocateResult,
+
+ EvEnd
+ };
+ static_assert(EvEnd < EventSpaceEnd(TKikimrEvents::ES_TX_ALLOCATOR), "expect EvEnd < EventSpaceEnd(TKikimrEvents::ES_TX_ALLOCATOR)");
+
+ struct TEvAllocate : public TEventPB<TEvAllocate, NKikimrTx::TEvTxAllocate, EvAllocate> {
+ TEvAllocate()
+ {}
+
+ TEvAllocate(ui64 count)
+ {
+ Record.SetRangeSize(count);
+ }
+ };
+
+ struct TEvAllocateResult : public TEventPB<TEvAllocateResult, NKikimrTx::TEvTxAllocateResult, EvAllocateResult> {
+ TEvAllocateResult()
+ {}
+
+ TEvAllocateResult(NKikimrTx::TEvTxAllocateResult::EStatus status)
+ {
+ Y_VERIFY(status != NKikimrTx::TEvTxAllocateResult::SUCCESS);
+ Record.SetStatus(status);
+ }
+
+ TEvAllocateResult(ui64 begin, ui64 end)
+ {
+ Y_VERIFY(ExtractPrivateMarker(begin) != 0, "privat marker hasn't found in allocation");
+ Y_VERIFY(ExtractPrivateMarker(begin) == ExtractPrivateMarker(end), "privat marker incorrect");
+
+ Record.SetStatus(NKikimrTx::TEvTxAllocateResult::SUCCESS);
+ Record.SetRangeBegin(begin);
+ Record.SetRangeEnd(end);
+ }
+
+ ui64 AllocationMask();
+ ui64 ExtractPrivateMarker(ui64 item);
+ };
+};
+}
+
+template<>
+inline void Out<NKikimrTx::TEvTxAllocateResult::EStatus>(IOutputStream& o, NKikimrTx::TEvTxAllocateResult::EStatus x) {
o << NKikimrTx::TEvTxAllocateResult::EStatus_Name(x).data();
- return;
-}
-
-
+ return;
+}
+
+
diff --git a/ydb/core/tx/tx_allocator/txallocator__reserve.cpp b/ydb/core/tx/tx_allocator/txallocator__reserve.cpp
index 49e1e6867c9..69473e0f826 100644
--- a/ydb/core/tx/tx_allocator/txallocator__reserve.cpp
+++ b/ydb/core/tx/tx_allocator/txallocator__reserve.cpp
@@ -1,73 +1,73 @@
-#include "txallocator_impl.h"
-
-namespace NKikimr {
-namespace NTxAllocator {
-
-using NTabletFlatExecutor::TTransactionBase;
-using NTabletFlatExecutor::TTransactionContext;
-
-struct TTxAllocator::TTxReserve: public TTransactionBase<TTxAllocator> {
- TEvTxAllocator::TEvAllocate::TPtr Event;
- ui64 RangeBegin = 0;
- ui64 RangeEnd = 0;
- bool Successed = false;
-
- TTxReserve(TSelf *self, TEvTxAllocator::TEvAllocate::TPtr &ev)
- : TBase(self)
- , Event(ev)
- {}
-
- TTxType GetTxType() const override { return TXTYPE_RESERVE; }
-
- bool IsPosibleToAllocate(const ui64 requestedSize) const {
- return TSelf::MaxCapacity - RangeBegin >= requestedSize;
- }
-
- bool Execute(TTransactionContext &txc, const TActorContext &ctx) override {
- Y_UNUSED(ctx);
-
- NIceDb::TNiceDb db(txc.DB);
-
- auto row = db.Table<Schema::config>().Key(Schema::config::ReservedTo).Select<Schema::config::reservedIds>();
- if (!row.IsReady())
- return false;
-
- if (row.IsValid())
- RangeBegin = row.GetValue<Schema::config::reservedIds>();
-
- const ui64 requestedSize = Event->Get()->Record.GetRangeSize();
-
- if (!IsPosibleToAllocate(requestedSize)) {
- return true;
- }
-
- RangeEnd = RangeBegin + requestedSize;
- db.Table<Schema::config>().Key(Schema::config::ReservedTo).Update(NIceDb::TUpdate<Schema::config::reservedIds>(RangeEnd));
- Successed = true;
- return true;
- }
-
- void Complete(const TActorContext &ctx) override {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_ALLOCATOR,
- "tablet# " << Self->TabletID() <<
- " TTxReserve Complete" <<
- " Successed# " << Successed <<
- " Reserved from# " << RangeBegin <<
- " Reserved to# " << RangeEnd);
-
- if (!Successed) {
- Self->ReplyImposible(Event, ctx);
- return;
- }
-
- Self->Reply(RangeBegin, RangeEnd, Event, ctx);
- }
-};
-
+#include "txallocator_impl.h"
+
+namespace NKikimr {
+namespace NTxAllocator {
+
+using NTabletFlatExecutor::TTransactionBase;
+using NTabletFlatExecutor::TTransactionContext;
+
+struct TTxAllocator::TTxReserve: public TTransactionBase<TTxAllocator> {
+ TEvTxAllocator::TEvAllocate::TPtr Event;
+ ui64 RangeBegin = 0;
+ ui64 RangeEnd = 0;
+ bool Successed = false;
+
+ TTxReserve(TSelf *self, TEvTxAllocator::TEvAllocate::TPtr &ev)
+ : TBase(self)
+ , Event(ev)
+ {}
+
+ TTxType GetTxType() const override { return TXTYPE_RESERVE; }
+
+ bool IsPosibleToAllocate(const ui64 requestedSize) const {
+ return TSelf::MaxCapacity - RangeBegin >= requestedSize;
+ }
+
+ bool Execute(TTransactionContext &txc, const TActorContext &ctx) override {
+ Y_UNUSED(ctx);
+
+ NIceDb::TNiceDb db(txc.DB);
+
+ auto row = db.Table<Schema::config>().Key(Schema::config::ReservedTo).Select<Schema::config::reservedIds>();
+ if (!row.IsReady())
+ return false;
+
+ if (row.IsValid())
+ RangeBegin = row.GetValue<Schema::config::reservedIds>();
+
+ const ui64 requestedSize = Event->Get()->Record.GetRangeSize();
+
+ if (!IsPosibleToAllocate(requestedSize)) {
+ return true;
+ }
+
+ RangeEnd = RangeBegin + requestedSize;
+ db.Table<Schema::config>().Key(Schema::config::ReservedTo).Update(NIceDb::TUpdate<Schema::config::reservedIds>(RangeEnd));
+ Successed = true;
+ return true;
+ }
+
+ void Complete(const TActorContext &ctx) override {
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_ALLOCATOR,
+ "tablet# " << Self->TabletID() <<
+ " TTxReserve Complete" <<
+ " Successed# " << Successed <<
+ " Reserved from# " << RangeBegin <<
+ " Reserved to# " << RangeEnd);
+
+ if (!Successed) {
+ Self->ReplyImposible(Event, ctx);
+ return;
+ }
+
+ Self->Reply(RangeBegin, RangeEnd, Event, ctx);
+ }
+};
+
ITransaction* TTxAllocator::CreateTxReserve(TEvTxAllocator::TEvAllocate::TPtr &ev) {
- return new TTxReserve(this, ev);
-}
-
-}
-}
-
+ return new TTxReserve(this, ev);
+}
+
+}
+}
+
diff --git a/ydb/core/tx/tx_allocator/txallocator__scheme.cpp b/ydb/core/tx/tx_allocator/txallocator__scheme.cpp
index d941fc42321..53e9c11d682 100644
--- a/ydb/core/tx/tx_allocator/txallocator__scheme.cpp
+++ b/ydb/core/tx/tx_allocator/txallocator__scheme.cpp
@@ -1,34 +1,34 @@
-#include "txallocator_impl.h"
-
-namespace NKikimr {
-namespace NTxAllocator {
-
-using NTabletFlatExecutor::TTransactionBase;
-using NTabletFlatExecutor::TTransactionContext;
-
-struct TTxAllocator::TTxSchema: public TTransactionBase<TTxAllocator> {
- TTxSchema(TSelf *allocator)
- : TBase(allocator)
- {}
-
- TTxType GetTxType() const override { return TXTYPE_RESERVE; }
-
- bool Execute(TTransactionContext &txc, const TActorContext&) override {
- NIceDb::TNiceDb(txc.DB).Materialize<Schema>();
- return true;
- }
-
- void Complete(const TActorContext &ctx) override {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_ALLOCATOR, "tablet# " << Self->TabletID() << " TTxSchema Complete");
-
- Self->Become(&TSelf::StateWork);
- Self->SignalTabletActive(ctx);
- }
-};
-
+#include "txallocator_impl.h"
+
+namespace NKikimr {
+namespace NTxAllocator {
+
+using NTabletFlatExecutor::TTransactionBase;
+using NTabletFlatExecutor::TTransactionContext;
+
+struct TTxAllocator::TTxSchema: public TTransactionBase<TTxAllocator> {
+ TTxSchema(TSelf *allocator)
+ : TBase(allocator)
+ {}
+
+ TTxType GetTxType() const override { return TXTYPE_RESERVE; }
+
+ bool Execute(TTransactionContext &txc, const TActorContext&) override {
+ NIceDb::TNiceDb(txc.DB).Materialize<Schema>();
+ return true;
+ }
+
+ void Complete(const TActorContext &ctx) override {
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_ALLOCATOR, "tablet# " << Self->TabletID() << " TTxSchema Complete");
+
+ Self->Become(&TSelf::StateWork);
+ Self->SignalTabletActive(ctx);
+ }
+};
+
ITransaction* TTxAllocator::CreateTxSchema() {
- return new TTxSchema(this);
-}
-
-}
-}
+ return new TTxSchema(this);
+}
+
+}
+}
diff --git a/ydb/core/tx/tx_allocator/txallocator_impl.cpp b/ydb/core/tx/tx_allocator/txallocator_impl.cpp
index ad97588ea83..a4940b8f354 100644
--- a/ydb/core/tx/tx_allocator/txallocator_impl.cpp
+++ b/ydb/core/tx/tx_allocator/txallocator_impl.cpp
@@ -1,97 +1,97 @@
-#include "txallocator_impl.h"
+#include "txallocator_impl.h"
#include <ydb/core/base/counters.h>
#include <ydb/core/engine/minikql/flat_local_tx_factory.h>
#include <ydb/core/tablet/tablet_counters_protobuf.h>
-
-namespace NKikimr {
-namespace NTxAllocator {
-
+
+namespace NKikimr {
+namespace NTxAllocator {
+
TTxAllocator::TTxAllocator(const TActorId &tablet, TTabletStorageInfo *info)
- : TActor(&TThis::StateInit)
+ : TActor(&TThis::StateInit)
, TTabletExecutedFlat(info, tablet, new NMiniKQL::TMiniKQLFactory)
- , PrivateMarker((TabletID() & 0xFFFF) << (64 - 16))
-{
-}
-
-void TTxAllocator::OnActivateExecutor(const TActorContext &ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_ALLOCATOR, "tablet# " << TabletID() << " OnActivateExecutor");
- Executor()->RegisterExternalTabletCounters(new TProtobufTabletCounters<
- ESimpleCounters_descriptor,
- ECumulativeCounters_descriptor,
- EPercentileCounters_descriptor,
- ETxTypes_descriptor
- >());
- InitCounters(ctx);
- Execute(CreateTxSchema(), ctx);
-}
-
-void TTxAllocator::OnDetach(const TActorContext &ctx) {
- return Die(ctx);
-}
-
-void TTxAllocator::OnTabletDead(TEvTablet::TEvTabletDead::TPtr &ev, const TActorContext &ctx) {
- Y_UNUSED(ev);
- return Die(ctx);
-}
-
-void TTxAllocator::DefaultSignalTabletActive(const TActorContext &ctx) {
- Y_UNUSED(ctx);
-}
-
-ui64 TTxAllocator::ApplyPrivateMarker(const ui64 elem) {
- return PrivateMarker | elem;
-}
-
-void TTxAllocator::InitCounters(const TActorContext &ctx) {
- auto &counters = AppData(ctx)->Counters;
+ , PrivateMarker((TabletID() & 0xFFFF) << (64 - 16))
+{
+}
+
+void TTxAllocator::OnActivateExecutor(const TActorContext &ctx) {
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_ALLOCATOR, "tablet# " << TabletID() << " OnActivateExecutor");
+ Executor()->RegisterExternalTabletCounters(new TProtobufTabletCounters<
+ ESimpleCounters_descriptor,
+ ECumulativeCounters_descriptor,
+ EPercentileCounters_descriptor,
+ ETxTypes_descriptor
+ >());
+ InitCounters(ctx);
+ Execute(CreateTxSchema(), ctx);
+}
+
+void TTxAllocator::OnDetach(const TActorContext &ctx) {
+ return Die(ctx);
+}
+
+void TTxAllocator::OnTabletDead(TEvTablet::TEvTabletDead::TPtr &ev, const TActorContext &ctx) {
+ Y_UNUSED(ev);
+ return Die(ctx);
+}
+
+void TTxAllocator::DefaultSignalTabletActive(const TActorContext &ctx) {
+ Y_UNUSED(ctx);
+}
+
+ui64 TTxAllocator::ApplyPrivateMarker(const ui64 elem) {
+ return PrivateMarker | elem;
+}
+
+void TTxAllocator::InitCounters(const TActorContext &ctx) {
+ auto &counters = AppData(ctx)->Counters;
MonCounters.AllocatorCounters = GetServiceCounters(counters, "tablets")->GetSubgroup("type", "TxAllocator");
-
- MonCounters.Allocated = MonCounters.AllocatorCounters->GetCounter("Allocated", true);
- MonCounters.AllocationsPresence = MonCounters.AllocatorCounters->GetCounter("AllocationPresence", true);
-}
-
-void TTxAllocator::Handle(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx) {
- Y_UNUSED(ev);
- LOG_DEBUG_S(ctx, NKikimrServices::TX_ALLOCATOR, "tablet# " << TabletID() << " HANDLE TEvPoisonPill Sender# " << ev->Sender.ToString());
-
- Become(&TThis::StateBroken);
- ctx.Send(Tablet(), new TEvents::TEvPoisonPill);
-}
-
-void TTxAllocator::Handle(TEvTxAllocator::TEvAllocate::TPtr &ev, const TActorContext &ctx) {
- MonCounters.AllocationsPresence->Inc();
-
- const ui64 requestedSize = ev->Get()->Record.GetRangeSize();
- LOG_DEBUG_S(ctx, NKikimrServices::TX_ALLOCATOR,
- "tablet# " << TabletID() <<
- " HANDLE TEvAllocate Sender# " << ev->Sender.ToString() <<
- " requested range size#" << requestedSize);
-
- Execute(CreateTxReserve(ev), ctx);
-}
-
-void TTxAllocator::Reply(const ui64 rangeBegin, const ui64 rangeEnd, const TEvTxAllocator::TEvAllocate::TPtr &ev, const TActorContext &ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_ALLOCATOR,
- "tablet# " << TabletID() <<
- " Send to Sender# " << ev->Sender.ToString() <<
- " TEvAllocateResult from# " << rangeBegin <<
- " to# " << rangeEnd);
- *MonCounters.Allocated += rangeEnd - rangeBegin;
-
- const ui64 begin = ApplyPrivateMarker(rangeBegin);
- const ui64 end = ApplyPrivateMarker(rangeEnd);
-
- ctx.Send(ev->Sender, new TEvTxAllocator::TEvAllocateResult(begin, end), 0, ev->Cookie);
-}
-
-void TTxAllocator::ReplyImposible(const TEvTxAllocator::TEvAllocate::TPtr &ev, const TActorContext &ctx) {
- static const auto status = NKikimrTx::TEvTxAllocateResult::IMPOSIBLE;
- LOG_ERROR_S(ctx, NKikimrServices::TX_ALLOCATOR,
- "tablet# " << TabletID() <<
- " Send to Sender# " << ev->Sender.ToString() <<
- " TEvAllocateResult status# " << status);
- ctx.Send(ev->Sender, new TEvTxAllocator::TEvAllocateResult(status), 0, ev->Cookie);
-}
-
-}
-}
+
+ MonCounters.Allocated = MonCounters.AllocatorCounters->GetCounter("Allocated", true);
+ MonCounters.AllocationsPresence = MonCounters.AllocatorCounters->GetCounter("AllocationPresence", true);
+}
+
+void TTxAllocator::Handle(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx) {
+ Y_UNUSED(ev);
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_ALLOCATOR, "tablet# " << TabletID() << " HANDLE TEvPoisonPill Sender# " << ev->Sender.ToString());
+
+ Become(&TThis::StateBroken);
+ ctx.Send(Tablet(), new TEvents::TEvPoisonPill);
+}
+
+void TTxAllocator::Handle(TEvTxAllocator::TEvAllocate::TPtr &ev, const TActorContext &ctx) {
+ MonCounters.AllocationsPresence->Inc();
+
+ const ui64 requestedSize = ev->Get()->Record.GetRangeSize();
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_ALLOCATOR,
+ "tablet# " << TabletID() <<
+ " HANDLE TEvAllocate Sender# " << ev->Sender.ToString() <<
+ " requested range size#" << requestedSize);
+
+ Execute(CreateTxReserve(ev), ctx);
+}
+
+void TTxAllocator::Reply(const ui64 rangeBegin, const ui64 rangeEnd, const TEvTxAllocator::TEvAllocate::TPtr &ev, const TActorContext &ctx) {
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_ALLOCATOR,
+ "tablet# " << TabletID() <<
+ " Send to Sender# " << ev->Sender.ToString() <<
+ " TEvAllocateResult from# " << rangeBegin <<
+ " to# " << rangeEnd);
+ *MonCounters.Allocated += rangeEnd - rangeBegin;
+
+ const ui64 begin = ApplyPrivateMarker(rangeBegin);
+ const ui64 end = ApplyPrivateMarker(rangeEnd);
+
+ ctx.Send(ev->Sender, new TEvTxAllocator::TEvAllocateResult(begin, end), 0, ev->Cookie);
+}
+
+void TTxAllocator::ReplyImposible(const TEvTxAllocator::TEvAllocate::TPtr &ev, const TActorContext &ctx) {
+ static const auto status = NKikimrTx::TEvTxAllocateResult::IMPOSIBLE;
+ LOG_ERROR_S(ctx, NKikimrServices::TX_ALLOCATOR,
+ "tablet# " << TabletID() <<
+ " Send to Sender# " << ev->Sender.ToString() <<
+ " TEvAllocateResult status# " << status);
+ ctx.Send(ev->Sender, new TEvTxAllocator::TEvAllocateResult(status), 0, ev->Cookie);
+}
+
+}
+}
diff --git a/ydb/core/tx/tx_allocator/txallocator_impl.h b/ydb/core/tx/tx_allocator/txallocator_impl.h
index 67d36a94db2..5a539f9b7bc 100644
--- a/ydb/core/tx/tx_allocator/txallocator_impl.h
+++ b/ydb/core/tx/tx_allocator/txallocator_impl.h
@@ -1,124 +1,124 @@
-#pragma once
-#include "txallocator.h"
+#pragma once
+#include "txallocator.h"
#include <ydb/core/tablet_flat/tablet_flat_executed.h>
#include <ydb/core/tablet_flat/flat_cxx_database.h>
#include <ydb/core/base/tablet_pipe.h>
#include <ydb/core/base/appdata.h>
#include <ydb/core/protos/counters_tx_allocator.pb.h>
#include <ydb/core/protos/services.pb.h>
-
-namespace NKikimr {
-
-using namespace NTabletFlatExecutor;
+
+namespace NKikimr {
+
+using namespace NTabletFlatExecutor;
using NTabletFlatExecutor::ITransaction;
-
-namespace NTxAllocator {
-
-struct TTxAllocatorMonCounters {
- TIntrusivePtr<NMonitoring::TDynamicCounters> AllocatorCounters;
-
- NMonitoring::TDynamicCounters::TCounterPtr Allocated;
- NMonitoring::TDynamicCounters::TCounterPtr AllocationsPresence;
-};
-
-class TTxAllocator : public TActor<TTxAllocator>, public TTabletExecutedFlat {
-public:
- static constexpr ui64 MaxCapacity = 0xFFFFFFFFFFFFull; //48bit
-
-private:
- struct TTxSchema;
- struct TTxReserve;
-
+
+namespace NTxAllocator {
+
+struct TTxAllocatorMonCounters {
+ TIntrusivePtr<NMonitoring::TDynamicCounters> AllocatorCounters;
+
+ NMonitoring::TDynamicCounters::TCounterPtr Allocated;
+ NMonitoring::TDynamicCounters::TCounterPtr AllocationsPresence;
+};
+
+class TTxAllocator : public TActor<TTxAllocator>, public TTabletExecutedFlat {
+public:
+ static constexpr ui64 MaxCapacity = 0xFFFFFFFFFFFFull; //48bit
+
+private:
+ struct TTxSchema;
+ struct TTxReserve;
+
ITransaction* CreateTxSchema();
ITransaction* CreateTxReserve(TEvTxAllocator::TEvAllocate::TPtr &ev);
-
- const ui64 PrivateMarker;
- TTxAllocatorMonCounters MonCounters;
-
- void InitCounters(const TActorContext &ctx);
-
- void OnActivateExecutor(const TActorContext &ctx) override;
- void OnDetach(const TActorContext &ctx) override;
- void OnTabletDead(TEvTablet::TEvTabletDead::TPtr &ev, const TActorContext &ctx) override;
- void DefaultSignalTabletActive(const TActorContext &ctx) override;
-
- ui64 IsAllowedToAllocate(ui64 size) const;
-
- ui64 ApplyPrivateMarker(const ui64 elem);
-
- void Reply(const ui64 rangeBegin, const ui64 rangeEnd, const TEvTxAllocator::TEvAllocate::TPtr &ev, const TActorContext &ctx);
- void ReplyImposible(const TEvTxAllocator::TEvAllocate::TPtr &ev, const TActorContext &ctx);
-
- void Handle(TEvTxAllocator::TEvAllocate::TPtr &ev, const TActorContext &ctx);
- void Handle(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx);
-
-public:
- struct Schema : NIceDb::Schema {
- // for compatible use old names config, dummyKey, reservedIds
- struct config : Table<1> {
+
+ const ui64 PrivateMarker;
+ TTxAllocatorMonCounters MonCounters;
+
+ void InitCounters(const TActorContext &ctx);
+
+ void OnActivateExecutor(const TActorContext &ctx) override;
+ void OnDetach(const TActorContext &ctx) override;
+ void OnTabletDead(TEvTablet::TEvTabletDead::TPtr &ev, const TActorContext &ctx) override;
+ void DefaultSignalTabletActive(const TActorContext &ctx) override;
+
+ ui64 IsAllowedToAllocate(ui64 size) const;
+
+ ui64 ApplyPrivateMarker(const ui64 elem);
+
+ void Reply(const ui64 rangeBegin, const ui64 rangeEnd, const TEvTxAllocator::TEvAllocate::TPtr &ev, const TActorContext &ctx);
+ void ReplyImposible(const TEvTxAllocator::TEvAllocate::TPtr &ev, const TActorContext &ctx);
+
+ void Handle(TEvTxAllocator::TEvAllocate::TPtr &ev, const TActorContext &ctx);
+ void Handle(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx);
+
+public:
+ struct Schema : NIceDb::Schema {
+ // for compatible use old names config, dummyKey, reservedIds
+ struct config : Table<1> {
enum EKeyType : bool {
ReservedTo = true,
- };
-
- // for compatible use old names
- struct dummyKey : Column<1, NScheme::NTypeIds::Bool> { using Type = EKeyType; }; // PK
- struct reservedIds : Column<2, NScheme::NTypeIds::Uint64> {};
-
- // for compatible do not use colum this collum
- //struct ForCompatible : Column<3, NScheme::NTypeIds::String4k> {};
-
- using TKey = TableKey<dummyKey>;
- using TColumns = TableColumns<dummyKey, reservedIds>;
- };
-
- using TTables = SchemaTables<config>;
- };
-
-public:
+ };
+
+ // for compatible use old names
+ struct dummyKey : Column<1, NScheme::NTypeIds::Bool> { using Type = EKeyType; }; // PK
+ struct reservedIds : Column<2, NScheme::NTypeIds::Uint64> {};
+
+ // for compatible do not use colum this collum
+ //struct ForCompatible : Column<3, NScheme::NTypeIds::String4k> {};
+
+ using TKey = TableKey<dummyKey>;
+ using TColumns = TableColumns<dummyKey, reservedIds>;
+ };
+
+ using TTables = SchemaTables<config>;
+ };
+
+public:
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
return NKikimrServices::TActivity::TX_ALLOCATOR_ACTOR;
- }
-
+ }
+
TTxAllocator(const TActorId &tablet, TTabletStorageInfo *info);
-
- STFUNC(StateInit) {
- StateInitImpl(ev, ctx);
- }
-
- void Enqueue(STFUNC_SIG) override {
- LOG_ERROR_S(ctx, NKikimrServices::TX_ALLOCATOR,
- "tablet# " << TabletID() <<
- " IGNORING message type# " << ev->GetTypeRewrite() <<
- " from Sender# " << ev->Sender.ToString() <<
- " at StateInit");
- }
-
- STFUNC(StateWork) {
- switch (ev->GetTypeRewrite()) {
- HFunc(TEvTxAllocator::TEvAllocate, Handle);
- HFunc(TEvents::TEvPoisonPill, Handle);
- IgnoreFunc(TEvTabletPipe::TEvServerConnected);
- IgnoreFunc(TEvTabletPipe::TEvServerDisconnected);
- default:
- if (!HandleDefaultEvents(ev, ctx)) {
- LOG_ERROR_S(ctx, NKikimrServices::TX_ALLOCATOR,
- "tablet# " << TabletID() <<
- " IGNORING message type# " << ev->GetTypeRewrite() <<
- " from Sender# " << ev->Sender.ToString() <<
- " at StateWork");
- }
- }
- }
-
- STFUNC(StateBroken) {
- if (!HandleDefaultEvents(ev, ctx)) {
- LOG_ERROR_S(ctx, NKikimrServices::TX_ALLOCATOR,
- "tablet# " << TabletID() <<
- " IGNORING message type# " << ev->GetTypeRewrite() <<
- " from Sender# " << ev->Sender.ToString() <<
- " at StateBroken");
- }
- }
-};
-}
-}
+
+ STFUNC(StateInit) {
+ StateInitImpl(ev, ctx);
+ }
+
+ void Enqueue(STFUNC_SIG) override {
+ LOG_ERROR_S(ctx, NKikimrServices::TX_ALLOCATOR,
+ "tablet# " << TabletID() <<
+ " IGNORING message type# " << ev->GetTypeRewrite() <<
+ " from Sender# " << ev->Sender.ToString() <<
+ " at StateInit");
+ }
+
+ STFUNC(StateWork) {
+ switch (ev->GetTypeRewrite()) {
+ HFunc(TEvTxAllocator::TEvAllocate, Handle);
+ HFunc(TEvents::TEvPoisonPill, Handle);
+ IgnoreFunc(TEvTabletPipe::TEvServerConnected);
+ IgnoreFunc(TEvTabletPipe::TEvServerDisconnected);
+ default:
+ if (!HandleDefaultEvents(ev, ctx)) {
+ LOG_ERROR_S(ctx, NKikimrServices::TX_ALLOCATOR,
+ "tablet# " << TabletID() <<
+ " IGNORING message type# " << ev->GetTypeRewrite() <<
+ " from Sender# " << ev->Sender.ToString() <<
+ " at StateWork");
+ }
+ }
+ }
+
+ STFUNC(StateBroken) {
+ if (!HandleDefaultEvents(ev, ctx)) {
+ LOG_ERROR_S(ctx, NKikimrServices::TX_ALLOCATOR,
+ "tablet# " << TabletID() <<
+ " IGNORING message type# " << ev->GetTypeRewrite() <<
+ " from Sender# " << ev->Sender.ToString() <<
+ " at StateBroken");
+ }
+ }
+};
+}
+}
diff --git a/ydb/core/tx/tx_allocator/txallocator_ut.cpp b/ydb/core/tx/tx_allocator/txallocator_ut.cpp
index 7afa8c68d50..11efd70cbc7 100644
--- a/ydb/core/tx/tx_allocator/txallocator_ut.cpp
+++ b/ydb/core/tx/tx_allocator/txallocator_ut.cpp
@@ -1,105 +1,105 @@
-#include "txallocator_ut_helpers.h"
-#include "txallocator_impl.h"
+#include "txallocator_ut_helpers.h"
+#include "txallocator_impl.h"
#include <ydb/core/testlib/basics/runtime.h>
-
-#include <util/generic/xrange.h>
-
-using namespace NKikimr;
-using namespace NTxAllocatorUT_Private;
-
+
+#include <util/generic/xrange.h>
+
+using namespace NKikimr;
+using namespace NTxAllocatorUT_Private;
+
Y_UNIT_TEST_SUITE(TTxLocatorTest) {
Y_UNIT_TEST(Boot) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- }
-
+ TTestEnv env(runtime);
+ }
+
Y_UNIT_TEST(TestZeroRange) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- AllocateAndCheck(runtime, 0, NKikimrTx::TEvTxAllocateResult::SUCCESS);
- }
-
+ TTestEnv env(runtime);
+ AllocateAndCheck(runtime, 0, NKikimrTx::TEvTxAllocateResult::SUCCESS);
+ }
+
Y_UNIT_TEST(TestImposibleSize) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- const ui64 capacity = NTxAllocator::TTxAllocator::MaxCapacity;
- const ui64 requestSize = 123456;
-
- AllocateAndCheck(runtime, capacity + 1, NKikimrTx::TEvTxAllocateResult::IMPOSIBLE);
- AllocateAndCheck(runtime, requestSize, NKikimrTx::TEvTxAllocateResult::SUCCESS);
- AllocateAndCheck(runtime, capacity - requestSize + 1, NKikimrTx::TEvTxAllocateResult::IMPOSIBLE);
- AllocateAndCheck(runtime, 2*requestSize, NKikimrTx::TEvTxAllocateResult::SUCCESS);
- AllocateAndCheck(runtime, capacity - 3*requestSize + 1, NKikimrTx::TEvTxAllocateResult::IMPOSIBLE);
- }
-
+ TTestEnv env(runtime);
+ const ui64 capacity = NTxAllocator::TTxAllocator::MaxCapacity;
+ const ui64 requestSize = 123456;
+
+ AllocateAndCheck(runtime, capacity + 1, NKikimrTx::TEvTxAllocateResult::IMPOSIBLE);
+ AllocateAndCheck(runtime, requestSize, NKikimrTx::TEvTxAllocateResult::SUCCESS);
+ AllocateAndCheck(runtime, capacity - requestSize + 1, NKikimrTx::TEvTxAllocateResult::IMPOSIBLE);
+ AllocateAndCheck(runtime, 2*requestSize, NKikimrTx::TEvTxAllocateResult::SUCCESS);
+ AllocateAndCheck(runtime, capacity - 3*requestSize + 1, NKikimrTx::TEvTxAllocateResult::IMPOSIBLE);
+ }
+
Y_UNIT_TEST(TestAllocateAll) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- const ui64 capacity = NTxAllocator::TTxAllocator::MaxCapacity;
- AllocateAndCheck(runtime, capacity, NKikimrTx::TEvTxAllocateResult::SUCCESS);
- AllocateAndCheck(runtime, 1, NKikimrTx::TEvTxAllocateResult::IMPOSIBLE);
- }
-
+ TTestEnv env(runtime);
+ const ui64 capacity = NTxAllocator::TTxAllocator::MaxCapacity;
+ AllocateAndCheck(runtime, capacity, NKikimrTx::TEvTxAllocateResult::SUCCESS);
+ AllocateAndCheck(runtime, 1, NKikimrTx::TEvTxAllocateResult::IMPOSIBLE);
+ }
+
Y_UNIT_TEST(TestAllocateAllByPieces) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
- const ui64 capacity = NTxAllocator::TTxAllocator::MaxCapacity;
- const ui64 pieces = 1u << 5;
- const ui64 requestSize = capacity/pieces;
-
- for (auto round: xrange(pieces)) {
- Y_UNUSED(round);
- AllocateAndCheck(runtime, requestSize, NKikimrTx::TEvTxAllocateResult::SUCCESS);
- }
- AllocateAndCheck(runtime, pieces - 1, NKikimrTx::TEvTxAllocateResult::SUCCESS);
- AllocateAndCheck(runtime, 1, NKikimrTx::TEvTxAllocateResult::IMPOSIBLE);
- }
-
- void DoSignificantRequests(const bool restartsEnable) {
+ TTestEnv env(runtime);
+ const ui64 capacity = NTxAllocator::TTxAllocator::MaxCapacity;
+ const ui64 pieces = 1u << 5;
+ const ui64 requestSize = capacity/pieces;
+
+ for (auto round: xrange(pieces)) {
+ Y_UNUSED(round);
+ AllocateAndCheck(runtime, requestSize, NKikimrTx::TEvTxAllocateResult::SUCCESS);
+ }
+ AllocateAndCheck(runtime, pieces - 1, NKikimrTx::TEvTxAllocateResult::SUCCESS);
+ AllocateAndCheck(runtime, 1, NKikimrTx::TEvTxAllocateResult::IMPOSIBLE);
+ }
+
+ void DoSignificantRequests(const bool restartsEnable) {
TTestBasicRuntime runtime;
- TTestEnv env(runtime);
-
- const ui64 rounds = 10;
- const ui64 useRangePerRound = 1000000;
- const ui64 pieces = 10;
- const ui64 requestSize = useRangePerRound/pieces;
-
- TIntersectionChecker inersections;
-
- for (auto round: xrange(rounds)) {
- Y_UNUSED(round);
- for (auto request: xrange(pieces)) {
- Y_UNUSED(request);
- AsyncAllocate(runtime, requestSize);
- }
-
- for (auto request: xrange(pieces)) {
- Y_UNUSED(request);
- auto result = GrabAnswer(runtime);
- auto &event = result.first;
- CheckExpectedStatus(NKikimrTx::TEvTxAllocateResult::SUCCESS, event.GetStatus());
- ui64 cookie = result.second;
- CheckExpectedCookie(event, cookie);
- inersections.Add(event.GetRangeBegin(), event.GetRangeEnd());
- }
-
- if (restartsEnable) {
- env.Reboot(runtime);
- }
- }
-
- const bool continuesRange = !restartsEnable;
- inersections.AssertIntersection(continuesRange);
- }
-
+ TTestEnv env(runtime);
+
+ const ui64 rounds = 10;
+ const ui64 useRangePerRound = 1000000;
+ const ui64 pieces = 10;
+ const ui64 requestSize = useRangePerRound/pieces;
+
+ TIntersectionChecker inersections;
+
+ for (auto round: xrange(rounds)) {
+ Y_UNUSED(round);
+ for (auto request: xrange(pieces)) {
+ Y_UNUSED(request);
+ AsyncAllocate(runtime, requestSize);
+ }
+
+ for (auto request: xrange(pieces)) {
+ Y_UNUSED(request);
+ auto result = GrabAnswer(runtime);
+ auto &event = result.first;
+ CheckExpectedStatus(NKikimrTx::TEvTxAllocateResult::SUCCESS, event.GetStatus());
+ ui64 cookie = result.second;
+ CheckExpectedCookie(event, cookie);
+ inersections.Add(event.GetRangeBegin(), event.GetRangeEnd());
+ }
+
+ if (restartsEnable) {
+ env.Reboot(runtime);
+ }
+ }
+
+ const bool continuesRange = !restartsEnable;
+ inersections.AssertIntersection(continuesRange);
+ }
+
Y_UNIT_TEST(TestSignificantRequestWhenRunReserveTx) {
- const bool restartsEnable = false;
- DoSignificantRequests(restartsEnable);
- }
-
+ const bool restartsEnable = false;
+ DoSignificantRequests(restartsEnable);
+ }
+
Y_UNIT_TEST(TestWithReboot) {
- const bool restartsEnable = true;
- DoSignificantRequests(restartsEnable);
- }
-
-}
+ const bool restartsEnable = true;
+ DoSignificantRequests(restartsEnable);
+ }
+
+}
diff --git a/ydb/core/tx/tx_allocator/txallocator_ut_helpers.cpp b/ydb/core/tx/tx_allocator/txallocator_ut_helpers.cpp
index 1c2a3b13664..95566493b6f 100644
--- a/ydb/core/tx/tx_allocator/txallocator_ut_helpers.cpp
+++ b/ydb/core/tx/tx_allocator/txallocator_ut_helpers.cpp
@@ -1,79 +1,79 @@
-#include "txallocator_ut_helpers.h"
-
-namespace NTxAllocatorUT_Private {
-
-const TDuration TTestEnv::SimTimeOut = TDuration::Seconds(1u);
-
+#include "txallocator_ut_helpers.h"
+
+namespace NTxAllocatorUT_Private {
+
+const TDuration TTestEnv::SimTimeOut = TDuration::Seconds(1u);
+
void CheckExpectedStatus(const TVector<TResultStatus> &expected, TResultStatus result) {
- bool isExpectedStatus = false;
- for (auto exp : expected) {
- Cerr << "expected " << exp <<'\n';
- if (result == exp)
- isExpectedStatus = true;
- }
- UNIT_ASSERT_C(isExpectedStatus, "Unexpected status: " << result);
-}
-
-void CheckExpectedStatus(TResultStatus expected, TResultStatus result) {
+ bool isExpectedStatus = false;
+ for (auto exp : expected) {
+ Cerr << "expected " << exp <<'\n';
+ if (result == exp)
+ isExpectedStatus = true;
+ }
+ UNIT_ASSERT_C(isExpectedStatus, "Unexpected status: " << result);
+}
+
+void CheckExpectedStatus(TResultStatus expected, TResultStatus result) {
const TVector<TResultStatus> temp = {expected};
- CheckExpectedStatus(temp, result);
-}
-
-ui64 SomeCockie(ui64 size) {
- return size / 2;
-}
-
-void CheckExpectedCookie(NKikimrTx::TEvTxAllocateResult result, ui64 cookie) {
- const ui64 rangeSize = result.GetRangeEnd() - result.GetRangeBegin();
- if (rangeSize > 0) // rangeSize == 0 when status is error
- UNIT_ASSERT_EQUAL(cookie, SomeCockie(rangeSize));
-}
-
-
-
-TAnswerWithCookie GrabAnswer(NActors::TTestActorRuntime &runtime) {
- TAutoPtr<IEventHandle> handle;
- TEvTxAllocator::TEvAllocateResult *event = runtime.GrabEdgeEvent<TEvTxAllocator::TEvAllocateResult>(handle);
- UNIT_ASSERT(event);
- return TAnswerWithCookie(event->Record, handle->Cookie);
-}
-
-void AsyncAllocate(NActors::TTestActorRuntime &runtime, ui64 size) {
+ CheckExpectedStatus(temp, result);
+}
+
+ui64 SomeCockie(ui64 size) {
+ return size / 2;
+}
+
+void CheckExpectedCookie(NKikimrTx::TEvTxAllocateResult result, ui64 cookie) {
+ const ui64 rangeSize = result.GetRangeEnd() - result.GetRangeBegin();
+ if (rangeSize > 0) // rangeSize == 0 when status is error
+ UNIT_ASSERT_EQUAL(cookie, SomeCockie(rangeSize));
+}
+
+
+
+TAnswerWithCookie GrabAnswer(NActors::TTestActorRuntime &runtime) {
+ TAutoPtr<IEventHandle> handle;
+ TEvTxAllocator::TEvAllocateResult *event = runtime.GrabEdgeEvent<TEvTxAllocator::TEvAllocateResult>(handle);
+ UNIT_ASSERT(event);
+ return TAnswerWithCookie(event->Record, handle->Cookie);
+}
+
+void AsyncAllocate(NActors::TTestActorRuntime &runtime, ui64 size) {
TActorId sender = runtime.AllocateEdgeActor();
- TEvTxAllocator::TEvAllocate *ev = new TEvTxAllocator::TEvAllocate(size);
+ TEvTxAllocator::TEvAllocate *ev = new TEvTxAllocator::TEvAllocate(size);
runtime.SendToPipe(TTestEnv::TxAllocatorTablet, sender, ev, 0, NKikimr::NTabletPipe::TClientConfig(), TActorId(), SomeCockie(size));
-}
-
+}
+
void AllocateAndCheck(NActors::TTestActorRuntime &runtime, ui64 size, const TVector<TResultStatus> &expected) {
- AsyncAllocate(runtime, size);
- TAnswerWithCookie result = GrabAnswer(runtime);
- NKikimrTx::TEvTxAllocateResult &event = result.first;
- CheckExpectedStatus(expected, event.GetStatus());
- ui64 cookie = result.second;
- CheckExpectedCookie(event, cookie);
-}
-
-void AllocateAndCheck(NActors::TTestActorRuntime &runtime, ui64 size, TResultStatus expected) {
+ AsyncAllocate(runtime, size);
+ TAnswerWithCookie result = GrabAnswer(runtime);
+ NKikimrTx::TEvTxAllocateResult &event = result.first;
+ CheckExpectedStatus(expected, event.GetStatus());
+ ui64 cookie = result.second;
+ CheckExpectedCookie(event, cookie);
+}
+
+void AllocateAndCheck(NActors::TTestActorRuntime &runtime, ui64 size, TResultStatus expected) {
const TVector<TResultStatus> temp = {expected};
- AllocateAndCheck(runtime, size, temp);
-}
-
-void TTestEnv::Boot(TTestActorRuntime &runtime) {
+ AllocateAndCheck(runtime, size, temp);
+}
+
+void TTestEnv::Boot(TTestActorRuntime &runtime) {
CreateTestBootstrapper(runtime, CreateTestTabletInfo(TxAllocatorTablet, TTabletTypes::TX_ALLOCATOR), &CreateTxAllocator);
-
- TDispatchOptions options;
- options.FinalEvents.push_back(TDispatchOptions::TFinalEventCondition(TEvTablet::EvBoot));
- runtime.DispatchEvents(options, SimTimeOut);
-}
-
-void TTestEnv::SetupLogging(TTestActorRuntime &runtime) {
- runtime.SetLogPriority(NKikimrServices::TX_ALLOCATOR, NActors::NLog::PRI_DEBUG);
- runtime.SetLogPriority(NKikimrServices::TABLET_MAIN, NActors::NLog::PRI_DEBUG);
-}
-
-void TTestEnv::Setup(TTestActorRuntime &runtime) {
+
+ TDispatchOptions options;
+ options.FinalEvents.push_back(TDispatchOptions::TFinalEventCondition(TEvTablet::EvBoot));
+ runtime.DispatchEvents(options, SimTimeOut);
+}
+
+void TTestEnv::SetupLogging(TTestActorRuntime &runtime) {
+ runtime.SetLogPriority(NKikimrServices::TX_ALLOCATOR, NActors::NLog::PRI_DEBUG);
+ runtime.SetLogPriority(NKikimrServices::TABLET_MAIN, NActors::NLog::PRI_DEBUG);
+}
+
+void TTestEnv::Setup(TTestActorRuntime &runtime) {
static constexpr ui32 domainId = 0;
- SetupLogging(runtime);
+ SetupLogging(runtime);
TAppPrepare app;
auto domain = TDomainsInfo::TDomain::ConstructDomainWithExplicitTabletIds("dc-1", domainId, 0,
domainId, domainId, TVector<ui32>{domainId},
@@ -87,24 +87,24 @@ void TTestEnv::Setup(TTestActorRuntime &runtime) {
//app.AddHive(0, 0);
SetupChannelProfiles(app);
SetupTabletServices(runtime, &app, true);
-}
-
-void TTestEnv::Reboot(TTestActorRuntime &runtime) {
+}
+
+void TTestEnv::Reboot(TTestActorRuntime &runtime) {
TActorId sender = runtime.AllocateEdgeActor();
RebootTablet(runtime, TxAllocatorTablet, sender);
-}
-
-void TIntersectionChecker::AssertIntersection(bool continuous) {
- Sort(Responses);
- for (ui32 idx = 1; idx < Responses.size(); ++idx) {
- auto &prev = Responses[idx - 1];
- auto &cur = Responses[idx];
- if (continuous) {
- UNIT_ASSERT_C(prev.second == cur.first, "ranges aren't intersect and don't have gaps");
- } else {
- UNIT_ASSERT_C(prev.second <= cur.first, "ranges aren't intersect");
- }
- }
-}
-
-}
+}
+
+void TIntersectionChecker::AssertIntersection(bool continuous) {
+ Sort(Responses);
+ for (ui32 idx = 1; idx < Responses.size(); ++idx) {
+ auto &prev = Responses[idx - 1];
+ auto &cur = Responses[idx];
+ if (continuous) {
+ UNIT_ASSERT_C(prev.second == cur.first, "ranges aren't intersect and don't have gaps");
+ } else {
+ UNIT_ASSERT_C(prev.second <= cur.first, "ranges aren't intersect");
+ }
+ }
+}
+
+}
diff --git a/ydb/core/tx/tx_allocator/txallocator_ut_helpers.h b/ydb/core/tx/tx_allocator/txallocator_ut_helpers.h
index dd8469953cd..1d90e633760 100644
--- a/ydb/core/tx/tx_allocator/txallocator_ut_helpers.h
+++ b/ydb/core/tx/tx_allocator/txallocator_ut_helpers.h
@@ -1,62 +1,62 @@
-#pragma once
-
+#pragma once
+
#include <ydb/core/tx/tx_allocator/txallocator.h>
#include <ydb/core/tx/tx.h>
-
+
#include <ydb/core/testlib/basics/appdata.h>
#include <ydb/core/testlib/tablet_helpers.h>
-
+
#include <library/cpp/testing/unittest/tests_data.h>
#include <library/cpp/testing/unittest/registar.h>
-
-namespace NTxAllocatorUT_Private {
-
-using namespace NKikimr;
-
-
-// Sets up everything needed for the tests (actually we need only boot txallocator tablet)
-class TTestEnv {
-public:
+
+namespace NTxAllocatorUT_Private {
+
+using namespace NKikimr;
+
+
+// Sets up everything needed for the tests (actually we need only boot txallocator tablet)
+class TTestEnv {
+public:
static constexpr ui64 TxAllocatorTablet = TTestTxConfig::TxAllocator;
- static const TDuration SimTimeOut;
-
-public:
- TTestEnv(TTestActorRuntime &runtime)
- {
- Setup(runtime);
- Boot(runtime);
- }
-
-private:
- void Boot(TTestActorRuntime &runtime);
- void SetupLogging(TTestActorRuntime &runtime);
- void Setup(TTestActorRuntime &runtime);
-
-public:
- void Reboot(TTestActorRuntime &runtime);
-};
-
-class TIntersectionChecker {
-private:
- typedef std::pair<ui64, ui64> TAllocation;
+ static const TDuration SimTimeOut;
+
+public:
+ TTestEnv(TTestActorRuntime &runtime)
+ {
+ Setup(runtime);
+ Boot(runtime);
+ }
+
+private:
+ void Boot(TTestActorRuntime &runtime);
+ void SetupLogging(TTestActorRuntime &runtime);
+ void Setup(TTestActorRuntime &runtime);
+
+public:
+ void Reboot(TTestActorRuntime &runtime);
+};
+
+class TIntersectionChecker {
+private:
+ typedef std::pair<ui64, ui64> TAllocation;
TVector<TAllocation> Responses;
-
-public:
- void Add(ui64 begin, ui64 end) {
- Responses.emplace_back(begin, end);
- }
-
- void AssertIntersection(bool continuous = true);
-};
-
- typedef NKikimrTx::TEvTxAllocateResult::EStatus TResultStatus;
+
+public:
+ void Add(ui64 begin, ui64 end) {
+ Responses.emplace_back(begin, end);
+ }
+
+ void AssertIntersection(bool continuous = true);
+};
+
+ typedef NKikimrTx::TEvTxAllocateResult::EStatus TResultStatus;
void CheckExpectedStatus(const TVector<TResultStatus> &expected, TResultStatus result);
- void CheckExpectedStatus(TResultStatus expected, TResultStatus result);
- void CheckExpectedCookie(NKikimrTx::TEvTxAllocateResult result, ui64 cockie);
-
- typedef std::pair<NKikimrTx::TEvTxAllocateResult, ui64> TAnswerWithCookie;
- TAnswerWithCookie GrabAnswer(TTestActorRuntime &runtime);
+ void CheckExpectedStatus(TResultStatus expected, TResultStatus result);
+ void CheckExpectedCookie(NKikimrTx::TEvTxAllocateResult result, ui64 cockie);
+
+ typedef std::pair<NKikimrTx::TEvTxAllocateResult, ui64> TAnswerWithCookie;
+ TAnswerWithCookie GrabAnswer(TTestActorRuntime &runtime);
void AllocateAndCheck(TTestActorRuntime &runtime, ui64 size, const TVector<TResultStatus> &expected);
- void AllocateAndCheck(TTestActorRuntime &runtime, ui64 size, TResultStatus expected);
- void AsyncAllocate(TTestActorRuntime &runtime, ui64 size);
-}
+ void AllocateAndCheck(TTestActorRuntime &runtime, ui64 size, TResultStatus expected);
+ void AsyncAllocate(TTestActorRuntime &runtime, ui64 size);
+}
diff --git a/ydb/core/tx/tx_allocator/ut/ya.make b/ydb/core/tx/tx_allocator/ut/ya.make
index 4da882307d6..bd583687ab3 100644
--- a/ydb/core/tx/tx_allocator/ut/ya.make
+++ b/ydb/core/tx/tx_allocator/ut/ya.make
@@ -1,29 +1,29 @@
UNITTEST_FOR(ydb/core/tx/tx_allocator)
-
+
OWNER(
svc
g:kikimr
)
-
-FORK_SUBTESTS()
+
+FORK_SUBTESTS()
TIMEOUT(600)
SIZE(MEDIUM)
-
-PEERDIR(
+
+PEERDIR(
library/cpp/testing/unittest
ydb/core/mind
ydb/core/testlib
ydb/core/tx
ydb/core/tx/tx_allocator
-)
-
+)
+
YQL_LAST_ABI_VERSION()
-SRCS(
- txallocator_ut.cpp
- txallocator_ut_helpers.cpp
-)
-
-END()
+SRCS(
+ txallocator_ut.cpp
+ txallocator_ut_helpers.cpp
+)
+
+END()
diff --git a/ydb/core/tx/tx_allocator/ya.make b/ydb/core/tx/tx_allocator/ya.make
index 1930dc5233a..1a9c8ce85a0 100644
--- a/ydb/core/tx/tx_allocator/ya.make
+++ b/ydb/core/tx/tx_allocator/ya.make
@@ -1,18 +1,18 @@
-LIBRARY()
-
-OWNER(
- svc
+LIBRARY()
+
+OWNER(
+ svc
g:kikimr
-)
-
-SRCS(
- txallocator__reserve.cpp
- txallocator__scheme.cpp
- txallocator_impl.cpp
- txallocator.cpp
-)
-
-PEERDIR(
+)
+
+SRCS(
+ txallocator__reserve.cpp
+ txallocator__scheme.cpp
+ txallocator_impl.cpp
+ txallocator.cpp
+)
+
+PEERDIR(
library/cpp/actors/helpers
library/cpp/actors/interconnect
ydb/core/actorlib_impl
@@ -21,9 +21,9 @@ PEERDIR(
ydb/core/protos
ydb/core/tablet
ydb/core/tablet_flat
-)
-
-END()
+)
+
+END()
RECURSE_FOR_TESTS(
ut
diff --git a/ydb/core/tx/tx_allocator_client/actor_client.cpp b/ydb/core/tx/tx_allocator_client/actor_client.cpp
index 720da1784c0..20909a8401f 100644
--- a/ydb/core/tx/tx_allocator_client/actor_client.cpp
+++ b/ydb/core/tx/tx_allocator_client/actor_client.cpp
@@ -14,7 +14,7 @@ class TTxAllocatorClientActor: public TActorBootstrapped<TTxAllocatorClientActor
struct TDelayedRequest {
TActorId Sender;
ui64 Cookie;
- ui64 Count;
+ ui64 Count;
};
static NTabletPipe::TClientConfig InitPipeClientConfig() {
@@ -34,12 +34,12 @@ class TTxAllocatorClientActor: public TActorBootstrapped<TTxAllocatorClientActor
}
void Handle(TEvTxAllocatorClient::TEvAllocate::TPtr& ev, const TActorContext& ctx) {
- TVector<ui64> txIds = TxAllocatorClient.AllocateTxIds(ev->Get()->Count, ctx);
+ TVector<ui64> txIds = TxAllocatorClient.AllocateTxIds(ev->Get()->Count, ctx);
- if (txIds) {
- Send(ev->Sender, new TEvTxAllocatorClient::TEvAllocateResult(std::move(txIds)), 0, ev->Cookie);
+ if (txIds) {
+ Send(ev->Sender, new TEvTxAllocatorClient::TEvAllocateResult(std::move(txIds)), 0, ev->Cookie);
} else {
- DelayedRequests.push_back({ev->Sender, ev->Cookie, ev->Get()->Count});
+ DelayedRequests.push_back({ev->Sender, ev->Cookie, ev->Get()->Count});
}
}
@@ -47,15 +47,15 @@ class TTxAllocatorClientActor: public TActorBootstrapped<TTxAllocatorClientActor
TxAllocatorClient.OnAllocateResult(ev, ctx);
while (!DelayedRequests.empty()) {
- const TDelayedRequest& request = DelayedRequests.front();
+ const TDelayedRequest& request = DelayedRequests.front();
- TVector<ui64> txIds = TxAllocatorClient.AllocateTxIds(request.Count, ctx);
-
- if (!txIds) {
+ TVector<ui64> txIds = TxAllocatorClient.AllocateTxIds(request.Count, ctx);
+
+ if (!txIds) {
break;
}
- Send(request.Sender, new TEvTxAllocatorClient::TEvAllocateResult(std::move(txIds)), 0, request.Cookie);
+ Send(request.Sender, new TEvTxAllocatorClient::TEvAllocateResult(std::move(txIds)), 0, request.Cookie);
DelayedRequests.pop_front();
}
}
diff --git a/ydb/core/tx/tx_allocator_client/actor_client.h b/ydb/core/tx/tx_allocator_client/actor_client.h
index 3eb59bba197..93d7caacce0 100644
--- a/ydb/core/tx/tx_allocator_client/actor_client.h
+++ b/ydb/core/tx/tx_allocator_client/actor_client.h
@@ -20,31 +20,31 @@ struct TEvTxAllocatorClient {
);
struct TEvAllocate: public TEventLocal<TEvAllocate, EvAllocate> {
- const ui32 Count = 1;
-
- TEvAllocate() = default;
-
- explicit TEvAllocate(ui32 count)
- : Count(count)
- {
- Y_VERIFY(count > 0);
- }
+ const ui32 Count = 1;
+
+ TEvAllocate() = default;
+
+ explicit TEvAllocate(ui32 count)
+ : Count(count)
+ {
+ Y_VERIFY(count > 0);
+ }
};
struct TEvAllocateResult: public TEventLocal<TEvAllocateResult, EvAllocateResult> {
- const TVector<ui64> TxIds;
+ const TVector<ui64> TxIds;
TEvAllocateResult() = default;
explicit TEvAllocateResult(ui64 txId)
- : TxIds(1, txId)
+ : TxIds(1, txId)
+ {
+ }
+
+ explicit TEvAllocateResult(TVector<ui64>&& txIds)
+ : TxIds(std::move(txIds))
{
}
-
- explicit TEvAllocateResult(TVector<ui64>&& txIds)
- : TxIds(std::move(txIds))
- {
- }
};
}; // TTxAllocatorClientEvents
diff --git a/ydb/core/tx/tx_allocator_client/client.cpp b/ydb/core/tx/tx_allocator_client/client.cpp
index f5a98d5d6e8..d33144a166b 100644
--- a/ydb/core/tx/tx_allocator_client/client.cpp
+++ b/ydb/core/tx/tx_allocator_client/client.cpp
@@ -1,107 +1,107 @@
#include "client.h"
-
-void NKikimr::TTxAllocatorClient::AddAllocationRange(const NKikimr::TTxAllocatorClient::TTabletId &from, const NKikimrTx::TEvTxAllocateResult &allocation) {
- ReservedRanges.emplace_back(from, allocation.GetRangeBegin(), allocation.GetRangeEnd());
- Capacity += ReservedRanges.back().Capacity();
-}
-
-NKikimr::TTxAllocatorClient::TTxAllocatorClient(NKikimrServices::EServiceKikimr service, NKikimr::NTabletPipe::IClientCache *pipeClientCache, const TVector<NKikimr::TTxAllocatorClient::TTabletId> &txAllocators)
- : Service(service)
- , PipeClientCache(pipeClientCache)
- , TxAllocators(txAllocators)
- , MaxCapacity(TxAllocators.size() * RequestPerAllocator)
-{
- Y_VERIFY(!TxAllocators.empty());
-}
-
-void NKikimr::TTxAllocatorClient::Bootstrap(const NActors::TActorContext &ctx) {
- for (const TTabletId& tabletId : TxAllocators) {
- RegisterRequest(tabletId, ctx);
- }
-}
-
-TVector<ui64> NKikimr::TTxAllocatorClient::AllocateTxIds(ui64 count, const NActors::TActorContext &ctx) {
- Y_VERIFY_S(count < MaxCapacity,
- "AllocateTxIds: requested too many txIds."
- << " Requested: " << count
- << " TxAllocators count: " << TxAllocators.size()
- << " RequestPerAllocator: " << RequestPerAllocator
- << " MaxCapacity: " << MaxCapacity);
-
- if (count >= BatchAllocationWarning) {
- LOG_WARN_S(ctx, Service,
- "AllocateTxIds: requested many txIds. Just a warning, request is processed."
- << " Requested: " << count
- << " TxAllocators count: " << TxAllocators.size()
- << " RequestPerAllocator: " << RequestPerAllocator
- << " MaxCapacity: " << MaxCapacity
- << " BatchAllocationWarning: " << BatchAllocationWarning);
- }
-
- if (count > Capacity) {
- return TVector<ui64>();
- }
-
- TVector<ui64> txIds;
- txIds.reserve(count);
-
- while (count && ReservedRanges) {
- TAllocationRange& head = ReservedRanges.front();
-
- while (count && head.Capacity()) {
- txIds.push_back(head.Allocate());
- --Capacity;
- --count;
- }
-
- if (head.Capacity() <= PreRequestThreshhold) {
- RegisterRequest(head.AllocatedFrom(), ctx);
- }
-
- if (head.Empty()) {
- ReservedRanges.pop_front();
- }
- }
-
- return txIds;
-}
-
-void NKikimr::TTxAllocatorClient::SendRequest(const NKikimr::TTxAllocatorClient::TTabletId &txAllocator, const NActors::TActorContext &ctx) {
- if (!IsActualRequest(txAllocator)) {
- return;
- }
-
- const ui64 cookie = txAllocator;
- PipeClientCache->Send(ctx, txAllocator, new TEvTxAllocator::TEvAllocate(RequestPerAllocator), cookie);
-}
-
-bool NKikimr::TTxAllocatorClient::OnAllocateResult(TEvTxAllocator::TEvAllocateResult::TPtr &ev, const NActors::TActorContext &ctx) {
- const TTabletId txAllocator = ev->Cookie;
- if (!IsActualRequest(txAllocator)) {
- return false;
- }
-
- const NKikimrTx::TEvTxAllocateResult& record = ev->Get()->Record;
- LOG_DEBUG_S(ctx, Service,
- "Handle TEvAllocateResult ACCEPTED " <<
- " RangeBegin# " << record.GetRangeBegin() <<
- " RangeEnd# " << record.GetRangeEnd() <<
- " txAllocator# " << txAllocator);
-
- if (record.GetStatus() == NKikimrTx::TEvTxAllocateResult::IMPOSIBLE) {
- LOG_ERROR_S(ctx, Service,
- "Handle TEvAllocateResult receive IMPOSIBLE status" <<
- " allocator is exhausted " <<
- " txAllocator# " << txAllocator);
- DeregisterRequest(txAllocator);
-
- return false;
- }
-
- Y_VERIFY(record.GetStatus() == NKikimrTx::TEvTxAllocateResult::SUCCESS);
-
- AddAllocationRange(txAllocator, record);
- DeregisterRequest(txAllocator);
-
- return true;
-}
+
+void NKikimr::TTxAllocatorClient::AddAllocationRange(const NKikimr::TTxAllocatorClient::TTabletId &from, const NKikimrTx::TEvTxAllocateResult &allocation) {
+ ReservedRanges.emplace_back(from, allocation.GetRangeBegin(), allocation.GetRangeEnd());
+ Capacity += ReservedRanges.back().Capacity();
+}
+
+NKikimr::TTxAllocatorClient::TTxAllocatorClient(NKikimrServices::EServiceKikimr service, NKikimr::NTabletPipe::IClientCache *pipeClientCache, const TVector<NKikimr::TTxAllocatorClient::TTabletId> &txAllocators)
+ : Service(service)
+ , PipeClientCache(pipeClientCache)
+ , TxAllocators(txAllocators)
+ , MaxCapacity(TxAllocators.size() * RequestPerAllocator)
+{
+ Y_VERIFY(!TxAllocators.empty());
+}
+
+void NKikimr::TTxAllocatorClient::Bootstrap(const NActors::TActorContext &ctx) {
+ for (const TTabletId& tabletId : TxAllocators) {
+ RegisterRequest(tabletId, ctx);
+ }
+}
+
+TVector<ui64> NKikimr::TTxAllocatorClient::AllocateTxIds(ui64 count, const NActors::TActorContext &ctx) {
+ Y_VERIFY_S(count < MaxCapacity,
+ "AllocateTxIds: requested too many txIds."
+ << " Requested: " << count
+ << " TxAllocators count: " << TxAllocators.size()
+ << " RequestPerAllocator: " << RequestPerAllocator
+ << " MaxCapacity: " << MaxCapacity);
+
+ if (count >= BatchAllocationWarning) {
+ LOG_WARN_S(ctx, Service,
+ "AllocateTxIds: requested many txIds. Just a warning, request is processed."
+ << " Requested: " << count
+ << " TxAllocators count: " << TxAllocators.size()
+ << " RequestPerAllocator: " << RequestPerAllocator
+ << " MaxCapacity: " << MaxCapacity
+ << " BatchAllocationWarning: " << BatchAllocationWarning);
+ }
+
+ if (count > Capacity) {
+ return TVector<ui64>();
+ }
+
+ TVector<ui64> txIds;
+ txIds.reserve(count);
+
+ while (count && ReservedRanges) {
+ TAllocationRange& head = ReservedRanges.front();
+
+ while (count && head.Capacity()) {
+ txIds.push_back(head.Allocate());
+ --Capacity;
+ --count;
+ }
+
+ if (head.Capacity() <= PreRequestThreshhold) {
+ RegisterRequest(head.AllocatedFrom(), ctx);
+ }
+
+ if (head.Empty()) {
+ ReservedRanges.pop_front();
+ }
+ }
+
+ return txIds;
+}
+
+void NKikimr::TTxAllocatorClient::SendRequest(const NKikimr::TTxAllocatorClient::TTabletId &txAllocator, const NActors::TActorContext &ctx) {
+ if (!IsActualRequest(txAllocator)) {
+ return;
+ }
+
+ const ui64 cookie = txAllocator;
+ PipeClientCache->Send(ctx, txAllocator, new TEvTxAllocator::TEvAllocate(RequestPerAllocator), cookie);
+}
+
+bool NKikimr::TTxAllocatorClient::OnAllocateResult(TEvTxAllocator::TEvAllocateResult::TPtr &ev, const NActors::TActorContext &ctx) {
+ const TTabletId txAllocator = ev->Cookie;
+ if (!IsActualRequest(txAllocator)) {
+ return false;
+ }
+
+ const NKikimrTx::TEvTxAllocateResult& record = ev->Get()->Record;
+ LOG_DEBUG_S(ctx, Service,
+ "Handle TEvAllocateResult ACCEPTED " <<
+ " RangeBegin# " << record.GetRangeBegin() <<
+ " RangeEnd# " << record.GetRangeEnd() <<
+ " txAllocator# " << txAllocator);
+
+ if (record.GetStatus() == NKikimrTx::TEvTxAllocateResult::IMPOSIBLE) {
+ LOG_ERROR_S(ctx, Service,
+ "Handle TEvAllocateResult receive IMPOSIBLE status" <<
+ " allocator is exhausted " <<
+ " txAllocator# " << txAllocator);
+ DeregisterRequest(txAllocator);
+
+ return false;
+ }
+
+ Y_VERIFY(record.GetStatus() == NKikimrTx::TEvTxAllocateResult::SUCCESS);
+
+ AddAllocationRange(txAllocator, record);
+ DeregisterRequest(txAllocator);
+
+ return true;
+}
diff --git a/ydb/core/tx/tx_allocator_client/client.h b/ydb/core/tx/tx_allocator_client/client.h
index 98d1e1896e6..d316e0eac2a 100644
--- a/ydb/core/tx/tx_allocator_client/client.h
+++ b/ydb/core/tx/tx_allocator_client/client.h
@@ -14,36 +14,36 @@ namespace NKikimr {
class TTxAllocatorClient {
using TTabletId = ui64;
- void RegisterRequest(const TTabletId& from, const TActorContext& ctx) {
- if (AllocationRequestsInFly.insert(from).second) {
- SendRequest(from, ctx);
- }
- }
-
- void DeregisterRequest(const TTabletId& from) {
- AllocationRequestsInFly.erase(from);
- }
-
- bool IsActualRequest(const TTabletId& from) const {
- return AllocationRequestsInFly.contains(from);
- }
-
- void AddAllocationRange(const TTabletId& from, const NKikimrTx::TEvTxAllocateResult& allocation);
-
-public:
- explicit TTxAllocatorClient(
- NKikimrServices::EServiceKikimr service,
- NTabletPipe::IClientCache* pipeClientCache,
- const TVector<TTabletId>& txAllocators);
-
- void Bootstrap(const TActorContext& ctx);
-
- TVector<ui64> AllocateTxIds(ui64 count, const TActorContext& ctx);
-
- void SendRequest(const TTabletId& txAllocator, const TActorContext& ctx);
- bool OnAllocateResult(TEvTxAllocator::TEvAllocateResult::TPtr& ev, const TActorContext& ctx);
-
-private:
+ void RegisterRequest(const TTabletId& from, const TActorContext& ctx) {
+ if (AllocationRequestsInFly.insert(from).second) {
+ SendRequest(from, ctx);
+ }
+ }
+
+ void DeregisterRequest(const TTabletId& from) {
+ AllocationRequestsInFly.erase(from);
+ }
+
+ bool IsActualRequest(const TTabletId& from) const {
+ return AllocationRequestsInFly.contains(from);
+ }
+
+ void AddAllocationRange(const TTabletId& from, const NKikimrTx::TEvTxAllocateResult& allocation);
+
+public:
+ explicit TTxAllocatorClient(
+ NKikimrServices::EServiceKikimr service,
+ NTabletPipe::IClientCache* pipeClientCache,
+ const TVector<TTabletId>& txAllocators);
+
+ void Bootstrap(const TActorContext& ctx);
+
+ TVector<ui64> AllocateTxIds(ui64 count, const TActorContext& ctx);
+
+ void SendRequest(const TTabletId& txAllocator, const TActorContext& ctx);
+ bool OnAllocateResult(TEvTxAllocator::TEvAllocateResult::TPtr& ev, const TActorContext& ctx);
+
+private:
struct TAllocationRange {
TTabletId Source = 0;
ui64 Begin = 0;
@@ -81,13 +81,13 @@ private:
TVector<TTabletId> TxAllocators;
THashSet<TTabletId> AllocationRequestsInFly;
- static constexpr ui64 BatchAllocationWarning = 500;
+ static constexpr ui64 BatchAllocationWarning = 500;
static constexpr ui64 RequestPerAllocator = 5000;
static constexpr ui64 PreRequestThreshhold = RequestPerAllocator / 3;
- const ui64 MaxCapacity = 0;
- ui64 Capacity = 0;
- TDeque<TAllocationRange> ReservedRanges;
+ const ui64 MaxCapacity = 0;
+ ui64 Capacity = 0;
+ TDeque<TAllocationRange> ReservedRanges;
}; // TTxAllocatorClient
diff --git a/ydb/core/tx/tx_processing.h b/ydb/core/tx/tx_processing.h
index ada34d9c01e..72276c1af3d 100644
--- a/ydb/core/tx/tx_processing.h
+++ b/ydb/core/tx/tx_processing.h
@@ -54,13 +54,13 @@ struct TEvTxProcessing {
TEvPlanStepAck()
{}
- TEvPlanStepAck(ui64 tabletId, ui64 step, ui64 txid)
- {
- Record.SetTabletId(tabletId);
- Record.SetStep(step);
- Record.AddTxId(txid);
- }
-
+ TEvPlanStepAck(ui64 tabletId, ui64 step, ui64 txid)
+ {
+ Record.SetTabletId(tabletId);
+ Record.SetStep(step);
+ Record.AddTxId(txid);
+ }
+
template<typename TIterator>
TEvPlanStepAck(ui64 tabletId, ui64 step, TIterator begin, const TIterator &end)
{
@@ -68,7 +68,7 @@ struct TEvTxProcessing {
Record.SetStep(step);
while (begin != end) {
- const ui64 x = ui64(*begin);
+ const ui64 x = ui64(*begin);
Record.AddTxId(x);
++begin;
}
diff --git a/ydb/core/tx/tx_proxy/datareq.cpp b/ydb/core/tx/tx_proxy/datareq.cpp
index 6c2ef3919d4..af48b42d60f 100644
--- a/ydb/core/tx/tx_proxy/datareq.cpp
+++ b/ydb/core/tx/tx_proxy/datareq.cpp
@@ -1,4 +1,4 @@
-#include "proxy.h"
+#include "proxy.h"
#include <ydb/core/tx/scheme_cache/scheme_cache.h>
#include <ydb/core/tx/datashard/datashard.h>
@@ -26,7 +26,7 @@
#include <library/cpp/actors/core/actor_bootstrapped.h>
#include <library/cpp/actors/core/hfunc.h>
-
+
#include <util/generic/hash_set.h>
#include <util/generic/queue.h>
@@ -357,7 +357,7 @@ private:
TDuration CpuTime;
TAutoPtr<TEvTxProxySchemeCache::TEvResolveKeySet> PrepareFlatMKQLRequest(TStringBuf miniKQLProgram, TStringBuf miniKQLParams, const TActorContext &ctx);
- void ProcessFlatMKQLResolve(NSchemeCache::TSchemeCacheRequest *cacheRequest, const TActorContext &ctx);
+ void ProcessFlatMKQLResolve(NSchemeCache::TSchemeCacheRequest *cacheRequest, const TActorContext &ctx);
void ProcessReadTableResolve(NSchemeCache::TSchemeCacheRequest *cacheRequest, const TActorContext &ctx);
TIntrusivePtr<TTxProxyMon> TxProxyMon;
@@ -395,8 +395,8 @@ private:
void FinishShardStream(TEvDataShard::TEvProposeTransactionResult::TPtr &ev, const TActorContext &ctx);
void FinishStreamResponse(const TActorContext &ctx);
- ui64 SelectCoordinator(NSchemeCache::TSchemeCacheRequest &cacheRequest, const TActorContext &ctx);
- const TDomainsInfo::TDomain& SelectDomain(NSchemeCache::TSchemeCacheRequest &cacheRequest, const TActorContext &ctx);
+ ui64 SelectCoordinator(NSchemeCache::TSchemeCacheRequest &cacheRequest, const TActorContext &ctx);
+ const TDomainsInfo::TDomain& SelectDomain(NSchemeCache::TSchemeCacheRequest &cacheRequest, const TActorContext &ctx);
void HandleWatchdog(const TActorContext &ctx);
@@ -439,14 +439,14 @@ private:
void ProcessStreamClearance(bool cleared, const TActorContext &ctx);
bool ParseRangeKey(const NKikimrMiniKQL::TParams &proto,
- TConstArrayRef<NScheme::TTypeId> keyType,
+ TConstArrayRef<NScheme::TTypeId> keyType,
TSerializedCellVec &buf,
EParseRangeKeyExp exp);
- bool CheckDomainLocality(NSchemeCache::TSchemeCacheRequest &cacheRequest);
+ bool CheckDomainLocality(NSchemeCache::TSchemeCacheRequest &cacheRequest);
void BuildTxStats(NKikimrQueryStats::TTxStats& stats);
bool IsReadOnlyRequest() const;
-
+
public:
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
return NKikimrServices::TActivity::TX_REQ_PROXY;
@@ -929,7 +929,7 @@ void TDataReq::BuildTxStats(NKikimrQueryStats::TTxStats& stats) {
stats.SetComputeCpuTimeUsec(CpuTime.MicroSeconds());
}
-void TDataReq::ProcessFlatMKQLResolve(NSchemeCache::TSchemeCacheRequest *cacheRequest, const TActorContext &ctx) {
+void TDataReq::ProcessFlatMKQLResolve(NSchemeCache::TSchemeCacheRequest *cacheRequest, const TActorContext &ctx) {
NMiniKQL::IEngineFlat &engine = *FlatMKQLRequest->Engine;
// Restore DbKeys
@@ -1138,7 +1138,7 @@ void TDataReq::ProcessReadTableResolve(NSchemeCache::TSchemeCacheRequest *cacheR
TAutoPtr<TEvTxProxySchemeCache::TEvResolveKeySet> TDataReq::PrepareFlatMKQLRequest(TStringBuf miniKQLProgram, TStringBuf miniKQLParams, const TActorContext &ctx) {
Y_UNUSED(ctx);
- TAutoPtr<NSchemeCache::TSchemeCacheRequest> request(new NSchemeCache::TSchemeCacheRequest());
+ TAutoPtr<NSchemeCache::TSchemeCacheRequest> request(new NSchemeCache::TSchemeCacheRequest());
*TxProxyMon->MiniKQLParamsSize += miniKQLParams.size();
*TxProxyMon->MiniKQLProgramSize += miniKQLProgram.size();
@@ -1190,7 +1190,7 @@ void TDataReq::MarkShardError(ui64 shardId, TDataReq::TPerTablet &perTablet, boo
if (++TabletErrors == TabletsLeft) {
LOG_ERROR_S_SAMPLED_BY(ctx, NKikimrServices::TX_PROXY, TxId,
"Actor# " << ctx.SelfID.ToString() << " txid# " << TxId
- << " invalidateDistCache: " << invalidateDistCache
+ << " invalidateDistCache: " << invalidateDistCache
<< " DIE TDataReq MarkShardError TabletsLeft# " << TabletsLeft);
TxProxyMon->MarkShardError->Inc();
return Die(ctx);
@@ -1260,7 +1260,7 @@ void TDataReq::Handle(TEvTxProxyReq::TEvMakeRequest::TPtr &ev, const TActorConte
request->DatabaseName = record.GetDatabaseName();
NSchemeCache::TSchemeCacheNavigate::TEntry entry;
- entry.Path = SplitPath(ReadTableRequest->TablePath);
+ entry.Path = SplitPath(ReadTableRequest->TablePath);
entry.Operation = NSchemeCache::TSchemeCacheNavigate::OpTable;
entry.ShowPrivatePath = true;
request->ResultSet.push_back(entry);
@@ -1524,7 +1524,7 @@ void TDataReq::Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr &ev,
void TDataReq::Handle(TEvTxProxySchemeCache::TEvResolveKeySetResult::TPtr &ev, const TActorContext &ctx) {
TEvTxProxySchemeCache::TEvResolveKeySetResult *msg = ev->Get();
- NSchemeCache::TSchemeCacheRequest *request = msg->Request.Get();
+ NSchemeCache::TSchemeCacheRequest *request = msg->Request.Get();
LOG_LOG_S_SAMPLED_BY(ctx, (request->ErrorCount == 0 ? NActors::NLog::PRI_DEBUG : NActors::NLog::PRI_ERROR),
NKikimrServices::TX_PROXY, TxId,
@@ -1537,7 +1537,7 @@ void TDataReq::Handle(TEvTxProxySchemeCache::TEvResolveKeySetResult::TPtr &ev, c
if (request->ErrorCount > 0) {
bool gotHardResolveError = false;
for (const auto &x : request->ResultSet) {
- if ((ui32)x.Status < (ui32) NSchemeCache::TSchemeCacheRequest::EStatus::OkScheme) {
+ if ((ui32)x.Status < (ui32) NSchemeCache::TSchemeCacheRequest::EStatus::OkScheme) {
TryToInvalidateTable(x.KeyDescription->TableId, ctx);
TStringStream ss;
@@ -1570,9 +1570,9 @@ void TDataReq::Handle(TEvTxProxySchemeCache::TEvResolveKeySetResult::TPtr &ev, c
return Die(ctx);
}
- if (ProxyFlags & TEvTxUserProxy::TEvProposeTransaction::ProxyReportResolved)
+ if (ProxyFlags & TEvTxUserProxy::TEvProposeTransaction::ProxyReportResolved)
ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ProxyResolved, NKikimrIssues::TStatusIds::TRANSIENT, false, ctx);
-
+
TxProxyMon->TxPrepareResolveHgram->Collect((WallClockResolved - WallClockResolveStarted).MicroSeconds());
NCpuTime::TCpuTimer timer(CpuTime);
@@ -1627,10 +1627,10 @@ void TDataReq::Handle(TEvTxProxySchemeCache::TEvResolveKeySetResult::TPtr &ev, c
}
}
- if (!CheckDomainLocality(*request)) {
+ if (!CheckDomainLocality(*request)) {
IssueManager.RaiseIssue(MakeIssue(NKikimrIssues::TIssuesIds::DOMAIN_LOCALITY_ERROR));
ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::DomainLocalityError, NKikimrIssues::TStatusIds::BAD_REQUEST, true, ctx);
- TxProxyMon->ResolveKeySetDomainLocalityFail->Inc();
+ TxProxyMon->ResolveKeySetDomainLocalityFail->Inc();
return Die(ctx);
}
@@ -1802,7 +1802,7 @@ void TDataReq::HandlePrepare(TEvDataShard::TEvProposeTransactionResult::TPtr &ev
switch (msg->GetStatus()) {
case NKikimrTxDataShard::TEvProposeTransactionResult::PREPARED:
- {
+ {
perTablet->TabletStatus = TPerTablet::ETabletStatus::StatusPrepared;
perTablet->MinStep = record.GetMinStep();
perTablet->MaxStep = record.GetMaxStep();
@@ -1828,44 +1828,44 @@ void TDataReq::HandlePrepare(TEvDataShard::TEvProposeTransactionResult::TPtr &ev
if (record.HasProposeLatency())
ElapsedPrepareComplete = Max<TDuration>(ElapsedPrepareComplete, TDuration::MilliSeconds(record.GetProposeLatency()));
- ui64 privateCoordinator = TCoordinators(TVector<ui64>(
- record.GetDomainCoordinators().begin(),
- record.GetDomainCoordinators().end()))
- .Select(TxId);
-
- if (!SelectedCoordinator) {
- SelectedCoordinator = privateCoordinator;
- }
-
- if (!SelectedCoordinator || SelectedCoordinator != privateCoordinator) {
- CancelProposal(tabletId);
- TStringBuilder explanation;
- explanation << "tx state canceled, unable to choose coordinator neither by resolved keys nor by TEvProposeTransactionResult from datashard txid#" << TxId;
- IssueManager.RaiseIssue(MakeIssue(NKikimrIssues::TIssuesIds::TX_DECLINED_IMPLICIT_COORDINATOR, explanation));
- auto errorCode =TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::DomainLocalityError;
- if (SelectedCoordinator == 0) {
- errorCode = TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::CoordinatorUnknown;
- }
- ReportStatus(errorCode, NKikimrIssues::TStatusIds::INTERNAL_ERROR, true, ctx);
- TxProxyMon->TxResultAborted->Inc();
- LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY,
- " HANDLE Prepare TEvProposeTransactionResult TDataReq "
- " all DataShards are prepared successful, "
- " but we unable to choose coordinator neither by resolved keys nor by TEvProposeTransactionResult from datashard, "
- " tx canceled"
- << ", actorId: " << ctx.SelfID.ToString()
- << ", txid: " << TxId
- << ", coordinator selected at resolve keys state: " << SelectedCoordinator
- << ", coordinator selected at propose result state: " << privateCoordinator);
-
- return Die(ctx);
- }
-
- if (--TabletsLeft != 0)
- return;
-
- return RegisterPlan(ctx);
- }
+ ui64 privateCoordinator = TCoordinators(TVector<ui64>(
+ record.GetDomainCoordinators().begin(),
+ record.GetDomainCoordinators().end()))
+ .Select(TxId);
+
+ if (!SelectedCoordinator) {
+ SelectedCoordinator = privateCoordinator;
+ }
+
+ if (!SelectedCoordinator || SelectedCoordinator != privateCoordinator) {
+ CancelProposal(tabletId);
+ TStringBuilder explanation;
+ explanation << "tx state canceled, unable to choose coordinator neither by resolved keys nor by TEvProposeTransactionResult from datashard txid#" << TxId;
+ IssueManager.RaiseIssue(MakeIssue(NKikimrIssues::TIssuesIds::TX_DECLINED_IMPLICIT_COORDINATOR, explanation));
+ auto errorCode =TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::DomainLocalityError;
+ if (SelectedCoordinator == 0) {
+ errorCode = TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::CoordinatorUnknown;
+ }
+ ReportStatus(errorCode, NKikimrIssues::TStatusIds::INTERNAL_ERROR, true, ctx);
+ TxProxyMon->TxResultAborted->Inc();
+ LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY,
+ " HANDLE Prepare TEvProposeTransactionResult TDataReq "
+ " all DataShards are prepared successful, "
+ " but we unable to choose coordinator neither by resolved keys nor by TEvProposeTransactionResult from datashard, "
+ " tx canceled"
+ << ", actorId: " << ctx.SelfID.ToString()
+ << ", txid: " << TxId
+ << ", coordinator selected at resolve keys state: " << SelectedCoordinator
+ << ", coordinator selected at propose result state: " << privateCoordinator);
+
+ return Die(ctx);
+ }
+
+ if (--TabletsLeft != 0)
+ return;
+
+ return RegisterPlan(ctx);
+ }
case NKikimrTxDataShard::TEvProposeTransactionResult::COMPLETE:
perTablet->TabletStatus = TPerTablet::ETabletStatus::StatusFinished;
@@ -2698,49 +2698,49 @@ void TDataReq::FinishStreamResponse(const TActorContext &ctx) {
Die(ctx);
}
-NSchemeCache::TDomainInfo::TPtr FindDomainInfo(NSchemeCache::TSchemeCacheRequest &cacheRequest) {
- for (const auto& entry :cacheRequest.ResultSet) {
- if (entry.DomainInfo) {
- return entry.DomainInfo;
- }
- }
- return nullptr;
-}
-
-ui64 GetFirstTablet(NSchemeCache::TSchemeCacheRequest &cacheRequest) {
- Y_VERIFY(!cacheRequest.ResultSet.empty());
-
- NSchemeCache::TSchemeCacheRequest::TEntry& firstEntry= *cacheRequest.ResultSet.begin();
- NKikimr::TKeyDesc& firstKey = *firstEntry.KeyDescription;
+NSchemeCache::TDomainInfo::TPtr FindDomainInfo(NSchemeCache::TSchemeCacheRequest &cacheRequest) {
+ for (const auto& entry :cacheRequest.ResultSet) {
+ if (entry.DomainInfo) {
+ return entry.DomainInfo;
+ }
+ }
+ return nullptr;
+}
+
+ui64 GetFirstTablet(NSchemeCache::TSchemeCacheRequest &cacheRequest) {
+ Y_VERIFY(!cacheRequest.ResultSet.empty());
+
+ NSchemeCache::TSchemeCacheRequest::TEntry& firstEntry= *cacheRequest.ResultSet.begin();
+ NKikimr::TKeyDesc& firstKey = *firstEntry.KeyDescription;
Y_VERIFY(!firstKey.Partitions.empty());
return firstKey.Partitions.begin()->ShardId;
-}
-
-const TDomainsInfo::TDomain& TDataReq::SelectDomain(NSchemeCache::TSchemeCacheRequest &cacheRequest, const TActorContext &ctx) {
- ui64 firstTabletId = GetFirstTablet(cacheRequest);
-
- auto appdata = AppData(ctx);
- const ui32 selfDomain = appdata->DomainsInfo->GetDomainUidByTabletId(firstTabletId);
- Y_VERIFY(selfDomain != appdata->DomainsInfo->BadDomainId);
- return appdata->DomainsInfo->GetDomain(selfDomain);
-}
-
-ui64 TDataReq::SelectCoordinator(NSchemeCache::TSchemeCacheRequest &cacheRequest, const TActorContext &ctx) {
- auto domainInfo = FindDomainInfo(cacheRequest);
- if (domainInfo) {
- return domainInfo->Coordinators.Select(TxId);
- }
-
- // no tablets keys are found in requests keys
- // it take place when a transaction have only checks locks
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
- "Actor# " << ctx.SelfID.ToString() <<
- " txid# " << TxId <<
- " SelectCoordinator unable to choose coordinator from resolved keys," <<
- " will try to pick it from TEvProposeTransactionResult from datashard");
- return 0;
-}
-
+}
+
+const TDomainsInfo::TDomain& TDataReq::SelectDomain(NSchemeCache::TSchemeCacheRequest &cacheRequest, const TActorContext &ctx) {
+ ui64 firstTabletId = GetFirstTablet(cacheRequest);
+
+ auto appdata = AppData(ctx);
+ const ui32 selfDomain = appdata->DomainsInfo->GetDomainUidByTabletId(firstTabletId);
+ Y_VERIFY(selfDomain != appdata->DomainsInfo->BadDomainId);
+ return appdata->DomainsInfo->GetDomain(selfDomain);
+}
+
+ui64 TDataReq::SelectCoordinator(NSchemeCache::TSchemeCacheRequest &cacheRequest, const TActorContext &ctx) {
+ auto domainInfo = FindDomainInfo(cacheRequest);
+ if (domainInfo) {
+ return domainInfo->Coordinators.Select(TxId);
+ }
+
+ // no tablets keys are found in requests keys
+ // it take place when a transaction have only checks locks
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
+ "Actor# " << ctx.SelfID.ToString() <<
+ " txid# " << TxId <<
+ " SelectCoordinator unable to choose coordinator from resolved keys," <<
+ " will try to pick it from TEvProposeTransactionResult from datashard");
+ return 0;
+}
+
void TDataReq::FailProposedRequest(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus status, TString errMsg, const TActorContext &ctx) {
LOG_ERROR_S_SAMPLED_BY(ctx, NKikimrServices::TX_PROXY, TxId,
"Actor# " << ctx.SelfID.ToString() << " txid# " << TxId << " FailProposedRequest: " << errMsg << " Status# " << status);
@@ -2753,28 +2753,28 @@ void TDataReq::FailProposedRequest(TEvTxUserProxy::TEvProposeTransactionStatus::
TxProxyMon->TxResultError->Inc();
}
-bool TDataReq::CheckDomainLocality(NSchemeCache::TSchemeCacheRequest &cacheRequest) {
- NSchemeCache::TDomainInfo::TPtr domainInfo;
- for (const auto& entry :cacheRequest.ResultSet) {
- if (TSysTables::IsSystemTable(entry.KeyDescription->TableId)) {
- continue;
- }
-
- Y_VERIFY(entry.DomainInfo);
-
- if (!domainInfo) {
- domainInfo = entry.DomainInfo;
- continue;
- }
-
- if (domainInfo->DomainKey != entry.DomainInfo->DomainKey) {
- return false;
- }
- }
-
- return true;
-}
-
+bool TDataReq::CheckDomainLocality(NSchemeCache::TSchemeCacheRequest &cacheRequest) {
+ NSchemeCache::TDomainInfo::TPtr domainInfo;
+ for (const auto& entry :cacheRequest.ResultSet) {
+ if (TSysTables::IsSystemTable(entry.KeyDescription->TableId)) {
+ continue;
+ }
+
+ Y_VERIFY(entry.DomainInfo);
+
+ if (!domainInfo) {
+ domainInfo = entry.DomainInfo;
+ continue;
+ }
+
+ if (domainInfo->DomainKey != entry.DomainInfo->DomainKey) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
void TDataReq::RegisterPlan(const TActorContext &ctx) {
WallClockPrepared = Now();
TDomainsInfo *domainsInfo = AppData(ctx)->DomainsInfo.Get();
@@ -2824,7 +2824,7 @@ void TDataReq::RegisterPlan(const TActorContext &ctx) {
if (ProxyFlags & TEvTxUserProxy::TEvProposeTransaction::ProxyReportPrepared)
ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ProxyPrepared, NKikimrIssues::TStatusIds::TRANSIENT, false, ctx);
- Y_VERIFY(SelectedCoordinator, "shouldn't be run with null SelectedCoordinator");
+ Y_VERIFY(SelectedCoordinator, "shouldn't be run with null SelectedCoordinator");
TAutoPtr<TEvTxProxy::TEvProposeTransaction> req(new TEvTxProxy::TEvProposeTransaction(SelectedCoordinator, TxId, 0,
AggrMinStep, AggrMaxStep));
diff --git a/ydb/core/tx/tx_proxy/defs.h b/ydb/core/tx/tx_proxy/defs.h
index be74f0bf20f..6220d95bc3d 100644
--- a/ydb/core/tx/tx_proxy/defs.h
+++ b/ydb/core/tx/tx_proxy/defs.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
// unique tag to fix pragma once gcc glueing: ./ydb/core/tx/proxy/defs.h
#include <ydb/core/base/defs.h>
#include <ydb/core/base/events.h>
diff --git a/ydb/core/tx/tx_proxy/describe.cpp b/ydb/core/tx/tx_proxy/describe.cpp
index 1f19fb4fa40..deb38ca2b7d 100644
--- a/ydb/core/tx/tx_proxy/describe.cpp
+++ b/ydb/core/tx/tx_proxy/describe.cpp
@@ -1,16 +1,16 @@
-#include "proxy.h"
-
+#include "proxy.h"
+
#include <ydb/core/tx/scheme_cache/scheme_cache.h>
#include <ydb/core/tx/schemeshard/schemeshard.h>
#include <ydb/core/scheme/scheme_types_defs.h>
#include <ydb/core/base/tablet_pipecache.h>
#include <ydb/core/base/appdata.h>
#include <ydb/core/sys_view/common/schema.h>
-
+
#include <ydb/library/aclib/aclib.h>
#include <library/cpp/actors/core/hfunc.h>
-
+
namespace NKikimr {
namespace NTxProxy {
@@ -20,8 +20,8 @@ class TDescribeReq : public TActor<TDescribeReq> {
THolder<TEvTxProxyReq::TEvNavigateScheme> SchemeRequest;
TIntrusivePtr<TTxProxyMon> TxProxyMon;
- TInstant WallClockStarted;
-
+ TInstant WallClockStarted;
+
TActorId Source;
ui64 SourceCookie;
@@ -37,9 +37,9 @@ class TDescribeReq : public TActor<TDescribeReq> {
TActor::Die(ctx);
}
- void ReportError(NKikimrScheme::EStatus status, const TString& reason, const TActorContext &ctx) {
- TAutoPtr<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder> result =
- new NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder();
+ void ReportError(NKikimrScheme::EStatus status, const TString& reason, const TActorContext &ctx) {
+ TAutoPtr<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder> result =
+ new NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder();
if (SchemeRequest != nullptr) {
const auto &record = SchemeRequest->Ev->Get()->Record;
@@ -54,11 +54,11 @@ class TDescribeReq : public TActor<TDescribeReq> {
ctx.Send(Source, result.Release(), 0, SourceCookie);
}
- void FillRootDescr(NKikimrSchemeOp::TDirEntry* descr, const TString& name, ui64 schemeRootId) {
- descr->SetPathId(NSchemeShard::RootPathId);
+ void FillRootDescr(NKikimrSchemeOp::TDirEntry* descr, const TString& name, ui64 schemeRootId) {
+ descr->SetPathId(NSchemeShard::RootPathId);
descr->SetName(name);
descr->SetSchemeshardId(schemeRootId);
- descr->SetPathType(NKikimrSchemeOp::EPathType::EPathTypeDir);
+ descr->SetPathType(NKikimrSchemeOp::EPathType::EPathTypeDir);
descr->SetCreateFinished(true);
// TODO(xenoxeno): ?
//descr->SetCreateTxId(0);
@@ -66,7 +66,7 @@ class TDescribeReq : public TActor<TDescribeReq> {
//descr->SetOwner(BUILTIN_ACL_ROOT);
}
- void FillSystemViewDescr(NKikimrSchemeOp::TDirEntry* descr, ui64 schemeShardId) {
+ void FillSystemViewDescr(NKikimrSchemeOp::TDirEntry* descr, ui64 schemeShardId) {
descr->SetSchemeshardId(schemeShardId);
descr->SetPathId(InvalidLocalPathId);
descr->SetParentPathId(InvalidLocalPathId);
@@ -80,7 +80,7 @@ class TDescribeReq : public TActor<TDescribeReq> {
{
auto schemeShardId = entry.DomainInfo->DomainKey.OwnerId;
- auto result = MakeHolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder>(
+ auto result = MakeHolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder>(
path, schemeShardId, TPathId());
auto* pathDescription = result->Record.MutablePathDescription();
@@ -88,7 +88,7 @@ class TDescribeReq : public TActor<TDescribeReq> {
Y_VERIFY(!entry.Path.empty());
self->SetName(entry.Path.back());
- self->SetPathType(NKikimrSchemeOp::EPathTypeTable);
+ self->SetPathType(NKikimrSchemeOp::EPathTypeTable);
FillSystemViewDescr(self, schemeShardId);
auto* table = pathDescription->MutableTable();
@@ -134,7 +134,7 @@ class TDescribeReq : public TActor<TDescribeReq> {
TxProxyMon->NavigateLatency->Collect((ctx.Now() - WallClockStarted).MilliSeconds());
- result->Record.SetStatus(NKikimrScheme::StatusSuccess);
+ result->Record.SetStatus(NKikimrScheme::StatusSuccess);
ctx.Send(Source, result.Release(), 0, SourceCookie);
return Die(ctx);
}
@@ -144,21 +144,21 @@ class TDescribeReq : public TActor<TDescribeReq> {
{
auto schemeShardId = entry.DomainInfo->DomainKey.OwnerId;
- auto result = MakeHolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder>(
+ auto result = MakeHolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder>(
path, schemeShardId, TPathId());
auto* pathDescription = result->Record.MutablePathDescription();
auto* self = pathDescription->MutableSelf();
self->SetName(TString(NSysView::SysPathName));
- self->SetPathType(NKikimrSchemeOp::EPathTypeDir);
+ self->SetPathType(NKikimrSchemeOp::EPathTypeDir);
FillSystemViewDescr(self, schemeShardId);
if (entry.ListNodeEntry) {
for (const auto& child : entry.ListNodeEntry->Children) {
auto descr = pathDescription->AddChildren();
descr->SetName(child.Name);
- descr->SetPathType(NKikimrSchemeOp::EPathTypeTable);
+ descr->SetPathType(NKikimrSchemeOp::EPathTypeTable);
FillSystemViewDescr(descr, schemeShardId);
}
};
@@ -171,7 +171,7 @@ class TDescribeReq : public TActor<TDescribeReq> {
TxProxyMon->NavigateLatency->Collect((ctx.Now() - WallClockStarted).MilliSeconds());
- result->Record.SetStatus(NKikimrScheme::StatusSuccess);
+ result->Record.SetStatus(NKikimrScheme::StatusSuccess);
ctx.Send(Source, result.Release(), 0, SourceCookie);
return Die(ctx);
}
@@ -179,7 +179,7 @@ class TDescribeReq : public TActor<TDescribeReq> {
void Handle(TEvTxProxyReq::TEvNavigateScheme::TPtr &ev, const TActorContext &ctx);
void Handle(TEvPipeCache::TEvDeliveryProblem::TPtr &ev, const TActorContext &ctx);
void Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr &ev, const TActorContext &ctx);
- void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr &ev, const TActorContext &ctx);
+ void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr &ev, const TActorContext &ctx);
public:
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
@@ -208,7 +208,7 @@ public:
STFUNC(StateWaitExec) {
switch (ev->GetTypeRewrite()) {
- HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
HFunc(TEvPipeCache::TEvDeliveryProblem, Handle);
}
}
@@ -217,10 +217,10 @@ public:
void TDescribeReq::Handle(TEvTxProxyReq::TEvNavigateScheme::TPtr &ev, const TActorContext &ctx) {
TEvTxProxyReq::TEvNavigateScheme *msg = ev->Get();
const auto &record = msg->Ev->Get()->Record;
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY, "Actor# " << ctx.SelfID.ToString() << " HANDLE EvNavigateScheme " << record.GetDescribePath().GetPath());
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY, "Actor# " << ctx.SelfID.ToString() << " HANDLE EvNavigateScheme " << record.GetDescribePath().GetPath());
+
+ WallClockStarted = ctx.Now();
- WallClockStarted = ctx.Now();
-
Source = msg->Ev->Sender;
SourceCookie = msg->Ev->Cookie;
@@ -230,10 +230,10 @@ void TDescribeReq::Handle(TEvTxProxyReq::TEvNavigateScheme::TPtr &ev, const TAct
if (record.GetDescribePath().GetPath() == "/") {
// Special handling for enumerating roots
- TAutoPtr<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder> result =
- new NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder("/", NSchemeShard::RootSchemeShardId, TPathId(NSchemeShard::RootSchemeShardId, NSchemeShard::RootPathId));
+ TAutoPtr<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder> result =
+ new NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResultBuilder("/", NSchemeShard::RootSchemeShardId, TPathId(NSchemeShard::RootSchemeShardId, NSchemeShard::RootPathId));
auto descr = result->Record.MutablePathDescription();
- FillRootDescr(descr->MutableSelf(), "/", NSchemeShard::RootSchemeShardId);
+ FillRootDescr(descr->MutableSelf(), "/", NSchemeShard::RootSchemeShardId);
for (const auto& domain : domainsInfo->Domains) {
auto entry = result->Record.MutablePathDescription()->AddChildren();
FillRootDescr(entry, domain.second->Name, domain.second->SchemeRoot);
@@ -249,11 +249,11 @@ void TDescribeReq::Handle(TEvTxProxyReq::TEvNavigateScheme::TPtr &ev, const TAct
}
if (UserToken == nullptr && record.GetDescribePath().HasPathId()) {
- TAutoPtr<NSchemeShard::TEvSchemeShard::TEvDescribeScheme> req =
- new NSchemeShard::TEvSchemeShard::TEvDescribeScheme(
+ TAutoPtr<NSchemeShard::TEvSchemeShard::TEvDescribeScheme> req =
+ new NSchemeShard::TEvSchemeShard::TEvDescribeScheme(
record.GetDescribePath().GetSchemeshardId(),
record.GetDescribePath().GetPathId());
-
+
const ui64 shardToRequest = record.GetDescribePath().GetSchemeshardId();
if (record.GetDescribePath().HasOptions()) {
auto options = req->Record.MutableOptions();
@@ -269,19 +269,19 @@ void TDescribeReq::Handle(TEvTxProxyReq::TEvNavigateScheme::TPtr &ev, const TAct
return;
}
- TAutoPtr<NSchemeCache::TSchemeCacheNavigate> request(new NSchemeCache::TSchemeCacheNavigate());
+ TAutoPtr<NSchemeCache::TSchemeCacheNavigate> request(new NSchemeCache::TSchemeCacheNavigate());
request->DatabaseName = record.GetDatabaseName();
- NSchemeCache::TSchemeCacheNavigate::TEntry entry;
- entry.Operation = NSchemeCache::TSchemeCacheNavigate::OpPath;
+ NSchemeCache::TSchemeCacheNavigate::TEntry entry;
+ entry.Operation = NSchemeCache::TSchemeCacheNavigate::OpPath;
entry.SyncVersion = true;
entry.ShowPrivatePath = record.GetDescribePath().GetOptions().GetShowPrivateTable();
- entry.Path = SplitPath(record.GetDescribePath().GetPath());
+ entry.Path = SplitPath(record.GetDescribePath().GetPath());
if (entry.Path.empty()) {
- ReportError(NKikimrScheme::StatusInvalidParameter, "Invalid path", ctx);
+ ReportError(NKikimrScheme::StatusInvalidParameter, "Invalid path", ctx);
TxProxyMon->ResolveKeySetWrongRequest->Inc();
return Die(ctx);
}
-
+
request->ResultSet.emplace_back(entry);
ctx.Send(Services.SchemeCache, new TEvTxProxySchemeCache::TEvNavigateKeySet(request), 0, SourceCookie);
@@ -292,14 +292,14 @@ void TDescribeReq::Handle(TEvTxProxyReq::TEvNavigateScheme::TPtr &ev, const TAct
void TDescribeReq::Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr &ev, const TActorContext &ctx) {
TEvTxProxySchemeCache::TEvNavigateKeySetResult *msg = ev->Get();
- NSchemeCache::TSchemeCacheNavigate *navigate = msg->Request.Get();
+ NSchemeCache::TSchemeCacheNavigate *navigate = msg->Request.Get();
+
+ TxProxyMon->CacheRequestLatency->Collect((ctx.Now() - WallClockStarted).MilliSeconds());
- TxProxyMon->CacheRequestLatency->Collect((ctx.Now() - WallClockStarted).MilliSeconds());
-
Y_VERIFY(navigate->ResultSet.size() == 1);
const auto& entry = navigate->ResultSet.front();
- LOG_LOG_S(ctx, (navigate->ErrorCount == 0 ? NActors::NLog::PRI_DEBUG : NActors::NLog::PRI_INFO),
+ LOG_LOG_S(ctx, (navigate->ErrorCount == 0 ? NActors::NLog::PRI_DEBUG : NActors::NLog::PRI_INFO),
NKikimrServices::TX_PROXY,
"Actor# " << ctx.SelfID.ToString()
<< " HANDLE EvNavigateKeySetResult TDescribeReq marker# P5 ErrorCount# " << navigate->ErrorCount);
@@ -307,30 +307,30 @@ void TDescribeReq::Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr &
if (navigate->ErrorCount > 0) {
switch (entry.Status) {
case NSchemeCache::TSchemeCacheNavigate::EStatus::PathErrorUnknown:
- if (UserToken != nullptr && entry.SecurityObject != nullptr) {
- ui32 access = NACLib::EAccessRights::DescribeSchema;
- if (!entry.SecurityObject->CheckAccess(access, *UserToken)) {
- LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY,
- "Access denied for " << UserToken->GetUserSID()
- << " with access " << NACLib::AccessRightsToString(access)
- << " to path " << JoinPath(entry.Path) << " because base path");
- ReportError(NKikimrScheme::StatusAccessDenied, "Access denied", ctx);
- break;
- }
- }
-
- ReportError(NKikimrScheme::StatusPathDoesNotExist, "Path not found", ctx);
- break;
+ if (UserToken != nullptr && entry.SecurityObject != nullptr) {
+ ui32 access = NACLib::EAccessRights::DescribeSchema;
+ if (!entry.SecurityObject->CheckAccess(access, *UserToken)) {
+ LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY,
+ "Access denied for " << UserToken->GetUserSID()
+ << " with access " << NACLib::AccessRightsToString(access)
+ << " to path " << JoinPath(entry.Path) << " because base path");
+ ReportError(NKikimrScheme::StatusAccessDenied, "Access denied", ctx);
+ break;
+ }
+ }
+
+ ReportError(NKikimrScheme::StatusPathDoesNotExist, "Path not found", ctx);
+ break;
case NSchemeCache::TSchemeCacheNavigate::EStatus::RootUnknown:
- ReportError(NKikimrScheme::StatusPathDoesNotExist, "Root not found", ctx);
+ ReportError(NKikimrScheme::StatusPathDoesNotExist, "Root not found", ctx);
TxProxyMon->ResolveKeySetWrongRequest->Inc();
break;
- case NSchemeCache::TSchemeCacheNavigate::EStatus::RedirectLookupError:
- ReportError(NKikimrScheme::StatusNotAvailable, "Could not resolve redirected path", ctx);
- TxProxyMon->ResolveKeySetRedirectUnavaible->Inc();
- break;
+ case NSchemeCache::TSchemeCacheNavigate::EStatus::RedirectLookupError:
+ ReportError(NKikimrScheme::StatusNotAvailable, "Could not resolve redirected path", ctx);
+ TxProxyMon->ResolveKeySetRedirectUnavaible->Inc();
+ break;
default:
- ReportError(NKikimrScheme::StatusNotAvailable, "Could not resolve path", ctx);
+ ReportError(NKikimrScheme::StatusNotAvailable, "Could not resolve path", ctx);
TxProxyMon->ResolveKeySetFail->Inc();
break;
}
@@ -344,8 +344,8 @@ void TDescribeReq::Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr &
LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY,
"Access denied for " << UserToken->GetUserSID()
<< " with access " << NACLib::AccessRightsToString(access)
- << " to path " << JoinPath(entry.Path));
- ReportError(NKikimrScheme::StatusAccessDenied, "Access denied", ctx);
+ << " to path " << JoinPath(entry.Path));
+ ReportError(NKikimrScheme::StatusAccessDenied, "Access denied", ctx);
return Die(ctx);
}
}
@@ -365,8 +365,8 @@ void TDescribeReq::Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr &
const ui64 shardToRequest = entry.DomainInfo->ExtractSchemeShard();
- TAutoPtr<NSchemeShard::TEvSchemeShard::TEvDescribeScheme> req(
- new NSchemeShard::TEvSchemeShard::TEvDescribeScheme(describePath));
+ TAutoPtr<NSchemeShard::TEvSchemeShard::TEvDescribeScheme> req(
+ new NSchemeShard::TEvSchemeShard::TEvDescribeScheme(describePath));
LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY, "Actor# " << ctx.SelfID.ToString()
<< " SEND to# " << shardToRequest << " shardToRequest " << req->ToString());
@@ -376,16 +376,16 @@ void TDescribeReq::Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr &
}
-void TDescribeReq::Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr &ev, const TActorContext &ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
- "Actor# " << ctx.SelfID.ToString() <<
- " Handle TEvDescribeSchemeResult" <<
- " Forward to# " << Source.ToString() <<
+void TDescribeReq::Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr &ev, const TActorContext &ctx) {
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
+ "Actor# " << ctx.SelfID.ToString() <<
+ " Handle TEvDescribeSchemeResult" <<
+ " Forward to# " << Source.ToString() <<
" Cookie: " << ev->Cookie <<
- " TEvDescribeSchemeResult: " << ev->Get()->ToString());
-
- TxProxyMon->NavigateLatency->Collect((ctx.Now() - WallClockStarted).MilliSeconds());
-
+ " TEvDescribeSchemeResult: " << ev->Get()->ToString());
+
+ TxProxyMon->NavigateLatency->Collect((ctx.Now() - WallClockStarted).MilliSeconds());
+
if (AppData()->FeatureFlags.GetEnableSystemViews()) {
const auto& pathDescription = ev->Get()->GetRecord().GetPathDescription();
const auto& self = pathDescription.GetSelf();
@@ -394,12 +394,12 @@ void TDescribeReq::Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult:
Y_VERIFY(!domainsInfo->Domains.empty());
bool needSysFolder = false;
- if (self.GetPathType() == NKikimrSchemeOp::EPathType::EPathTypeSubDomain ||
+ if (self.GetPathType() == NKikimrSchemeOp::EPathType::EPathTypeSubDomain ||
self.GetPathType() == NKikimrSchemeOp::EPathType::EPathTypeColumnStore ||
self.GetPathType() == NKikimrSchemeOp::EPathType::EPathTypeColumnTable)
{
needSysFolder = true;
- } else if (self.GetPathId() == NSchemeShard::RootPathId) {
+ } else if (self.GetPathId() == NSchemeShard::RootPathId) {
for (const auto& [_, domain] : domainsInfo->Domains) {
if (domain->SchemeRoot == self.GetSchemeshardId()) {
needSysFolder = true;
@@ -423,7 +423,7 @@ void TDescribeReq::Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult:
auto* record = ev->Get()->MutableRecord();
auto* descr = record->MutablePathDescription()->AddChildren();
descr->SetName(TString(NSysView::SysPathName));
- descr->SetPathType(NKikimrSchemeOp::EPathTypeDir);
+ descr->SetPathType(NKikimrSchemeOp::EPathTypeDir);
FillSystemViewDescr(descr, self.GetSchemeshardId());
}
}
@@ -435,7 +435,7 @@ void TDescribeReq::Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult:
void TDescribeReq::Handle(TEvPipeCache::TEvDeliveryProblem::TPtr &ev, const TActorContext &ctx) {
Y_UNUSED(ev);
- ReportError(NKikimrScheme::StatusNotAvailable, "Schemeshard not available", ctx);
+ ReportError(NKikimrScheme::StatusNotAvailable, "Schemeshard not available", ctx);
return Die(ctx);
}
diff --git a/ydb/core/tx/tx_proxy/encrypted_storage_ut.cpp b/ydb/core/tx/tx_proxy/encrypted_storage_ut.cpp
index 98252346ee6..aee15400043 100644
--- a/ydb/core/tx/tx_proxy/encrypted_storage_ut.cpp
+++ b/ydb/core/tx/tx_proxy/encrypted_storage_ut.cpp
@@ -1,123 +1,123 @@
-#include "proxy_ut_helpers.h"
-
+#include "proxy_ut_helpers.h"
+
#include <library/cpp/actors/interconnect/interconnect.h>
-
+
#include <ydb/core/base/path.h>
#include <ydb/core/tx/schemeshard/schemeshard_impl.h>
#include <ydb/core/blobstorage/base/blobstorage_events.h>
#include <ydb/core/tablet/tablet_impl.h>
-
-
-using namespace NKikimr;
-using namespace NTxProxyUT;
-using namespace NHelpers;
-
+
+
+using namespace NKikimr;
+using namespace NTxProxyUT;
+using namespace NHelpers;
+
class TTestEnvWithEncryptedPoolsSupport: public TBaseTestEnv {
-public:
+public:
TTestEnvWithEncryptedPoolsSupport(ui32 staticNodes = 1, ui32 dynamicNodes = 2)
- {
- Settings = new Tests::TServerSettings(PortManager.GetPort(3534));
- GetSettings().SetEnableMockOnSingleNode(false);
-
- GetSettings().SetNodeCount(staticNodes);
- GetSettings().SetDynamicNodeCount(dynamicNodes);
- ui32 encryptionMode = 1;
+ {
+ Settings = new Tests::TServerSettings(PortManager.GetPort(3534));
+ GetSettings().SetEnableMockOnSingleNode(false);
+
+ GetSettings().SetNodeCount(staticNodes);
+ GetSettings().SetDynamicNodeCount(dynamicNodes);
+ ui32 encryptionMode = 1;
GetSettings().AddStoragePool("encrypted", "", encryptionMode);
-
- for (ui32 nodeIdx = 0; nodeIdx < staticNodes + dynamicNodes; ++nodeIdx) {
- TString key = TStringBuilder() << "node_key_" << nodeIdx;
- GetSettings().SetKeyFor(nodeIdx, key);
- }
-
- Server = new Tests::TServer(Settings);
-
+
+ for (ui32 nodeIdx = 0; nodeIdx < staticNodes + dynamicNodes; ++nodeIdx) {
+ TString key = TStringBuilder() << "node_key_" << nodeIdx;
+ GetSettings().SetKeyFor(nodeIdx, key);
+ }
+
+ Server = new Tests::TServer(Settings);
+
Client = MakeHolder<Tests::TClient>(GetSettings());
Tenants = MakeHolder<Tests::TTenants>(Server);
-
- SetLogging();
- InitRoot();
- }
-
- TStoragePools CreatePoolsForTenant(const TString& tenant) {
- TStoragePools result;
- for (auto& poolType: Settings->StoragePoolTypes) {
- auto& poolKind = poolType.first;
- result.emplace_back(GetClient().CreateStoragePool(poolKind, tenant), poolKind);
- }
- return result;
- }
-};
-
-Y_UNIT_TEST_SUITE(TStorageTenantTest) {
- Y_UNIT_TEST(Empty) {
- }
-
- Y_UNIT_TEST(CreateTableOutsideDatabaseFailToStartTabletsButDropIsOk) {
+
+ SetLogging();
+ InitRoot();
+ }
+
+ TStoragePools CreatePoolsForTenant(const TString& tenant) {
+ TStoragePools result;
+ for (auto& poolType: Settings->StoragePoolTypes) {
+ auto& poolKind = poolType.first;
+ result.emplace_back(GetClient().CreateStoragePool(poolKind, tenant), poolKind);
+ }
+ return result;
+ }
+};
+
+Y_UNIT_TEST_SUITE(TStorageTenantTest) {
+ Y_UNIT_TEST(Empty) {
+ }
+
+ Y_UNIT_TEST(CreateTableOutsideDatabaseFailToStartTabletsButDropIsOk) {
return;
TTestEnvWithEncryptedPoolsSupport env(1, 1);
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
-
- env.GetTenants().Run("/dc-1/USER_0", 1);
- UNIT_ASSERT(env.GetTenants().IsActive("/dc-1/USER_0", 1));
-
- auto storagePool = env.CreatePoolsForTenant("USER_0");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0", storagePool)));
-
- NTestLs::TPathVersion versionBefore = NTestLs::ExtractPathVersion(env.GetClient().Ls("/dc-1/USER_0"));
-
- auto tableDesc = GetTableSimpleDescription("SimpleTable");
- UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
- NMsgBusProxy::MSTATUS_OK);
-
- NTestLs::TPathVersion versionAfter = NTestLs::ExtractPathVersion(env.GetClient().Ls("/dc-1/USER_0"));
-
- UNIT_ASSERT_VALUES_EQUAL(versionBefore.Version + 2, versionAfter.Version);
-
- ui64 maxTableId = 0;
- {
- auto tablePortions = NTestLs::ExtractTablePartitions(env.GetClient().Ls("/dc-1/USER_0/SimpleTable"));
- for (NKikimrSchemeOp::TTablePartition& portion: tablePortions) {
- auto tabletId = portion.GetDatashardId();
- maxTableId = Max(maxTableId, tabletId);
- }
- }
- UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), maxTableId));
-
-
- UNIT_ASSERT_VALUES_EQUAL(env.GetClient().MkDir("/dc-1", "dir"),
- NMsgBusProxy::MSTATUS_OK);
-
- versionBefore = NTestLs::ExtractPathVersion(env.GetClient().Ls("/dc-1/dir"));
-
- //unable to run tablet on storage pools which belong to someone else database due encryption
- UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/dir", tableDesc, TDuration::Seconds(1)),
- NMsgBusProxy::MSTATUS_INPROGRESS);
-
- versionAfter = NTestLs::ExtractPathVersion(env.GetClient().Ls("/dc-1/dir"));
-
- UNIT_ASSERT_VALUES_EQUAL(versionBefore.Version + 1, versionAfter.Version);
-
- UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), maxTableId+1));
- UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), maxTableId+2));
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteUnsafe("/dc-1", "dir"));
-
- //tablet deleted logicaly
- while (env.GetClient().TabletExistsInHive(&env.GetRuntime(), maxTableId+1)) {
- /*no op*/
- }
- UNIT_ASSERT(!env.GetClient().TabletExistsInHive(&env.GetRuntime(), maxTableId+1));
-
- //tablet deleted logicaly
- while (env.GetClient().TabletExistsInHive(&env.GetRuntime(), maxTableId+2)) {
- /*no op*/
- }
- UNIT_ASSERT(!env.GetClient().TabletExistsInHive(&env.GetRuntime(), maxTableId+2));
- }
-
-}
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
+
+ env.GetTenants().Run("/dc-1/USER_0", 1);
+ UNIT_ASSERT(env.GetTenants().IsActive("/dc-1/USER_0", 1));
+
+ auto storagePool = env.CreatePoolsForTenant("USER_0");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0", storagePool)));
+
+ NTestLs::TPathVersion versionBefore = NTestLs::ExtractPathVersion(env.GetClient().Ls("/dc-1/USER_0"));
+
+ auto tableDesc = GetTableSimpleDescription("SimpleTable");
+ UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
+ NMsgBusProxy::MSTATUS_OK);
+
+ NTestLs::TPathVersion versionAfter = NTestLs::ExtractPathVersion(env.GetClient().Ls("/dc-1/USER_0"));
+
+ UNIT_ASSERT_VALUES_EQUAL(versionBefore.Version + 2, versionAfter.Version);
+
+ ui64 maxTableId = 0;
+ {
+ auto tablePortions = NTestLs::ExtractTablePartitions(env.GetClient().Ls("/dc-1/USER_0/SimpleTable"));
+ for (NKikimrSchemeOp::TTablePartition& portion: tablePortions) {
+ auto tabletId = portion.GetDatashardId();
+ maxTableId = Max(maxTableId, tabletId);
+ }
+ }
+ UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), maxTableId));
+
+
+ UNIT_ASSERT_VALUES_EQUAL(env.GetClient().MkDir("/dc-1", "dir"),
+ NMsgBusProxy::MSTATUS_OK);
+
+ versionBefore = NTestLs::ExtractPathVersion(env.GetClient().Ls("/dc-1/dir"));
+
+ //unable to run tablet on storage pools which belong to someone else database due encryption
+ UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/dir", tableDesc, TDuration::Seconds(1)),
+ NMsgBusProxy::MSTATUS_INPROGRESS);
+
+ versionAfter = NTestLs::ExtractPathVersion(env.GetClient().Ls("/dc-1/dir"));
+
+ UNIT_ASSERT_VALUES_EQUAL(versionBefore.Version + 1, versionAfter.Version);
+
+ UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), maxTableId+1));
+ UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), maxTableId+2));
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteUnsafe("/dc-1", "dir"));
+
+ //tablet deleted logicaly
+ while (env.GetClient().TabletExistsInHive(&env.GetRuntime(), maxTableId+1)) {
+ /*no op*/
+ }
+ UNIT_ASSERT(!env.GetClient().TabletExistsInHive(&env.GetRuntime(), maxTableId+1));
+
+ //tablet deleted logicaly
+ while (env.GetClient().TabletExistsInHive(&env.GetRuntime(), maxTableId+2)) {
+ /*no op*/
+ }
+ UNIT_ASSERT(!env.GetClient().TabletExistsInHive(&env.GetRuntime(), maxTableId+2));
+ }
+
+}
diff --git a/ydb/core/tx/tx_proxy/mon.cpp b/ydb/core/tx/tx_proxy/mon.cpp
index 06ae9449df6..14f5d47064e 100644
--- a/ydb/core/tx/tx_proxy/mon.cpp
+++ b/ydb/core/tx/tx_proxy/mon.cpp
@@ -1,4 +1,4 @@
-#include "mon.h"
+#include "mon.h"
#include <ydb/core/base/counters.h>
@@ -11,13 +11,13 @@ TTxProxyMon::TTxProxyMon(const TIntrusivePtr<NMonitoring::TDynamicCounters>& cou
, DataReqGroup(GetServiceCounters(counters, "proxy")->GetSubgroup("subsystem", "datareq"))
, AllocPoolCounters(counters, "tx_proxy")
{
- CacheRequestLatency = TxGroup->GetHistogram("CacheRequest/LatencyMs", NMonitoring::ExponentialHistogram(10, 4, 1));
-
+ CacheRequestLatency = TxGroup->GetHistogram("CacheRequest/LatencyMs", NMonitoring::ExponentialHistogram(10, 4, 1));
+
Navigate = TxGroup->GetCounter("Navigate/Request", true);
- NavigateLatency = TxGroup->GetHistogram("Navigate/LatencyMs", NMonitoring::ExponentialHistogram(10, 4, 1));
+ NavigateLatency = TxGroup->GetHistogram("Navigate/LatencyMs", NMonitoring::ExponentialHistogram(10, 4, 1));
SchemeRequest = TxGroup->GetCounter("Propose/SchemeRequest", true);
- SchemeRequestLatency = TxGroup->GetHistogram("SchemeRequest/LatencyMs", NMonitoring::ExponentialHistogram(10, 4, 1));
+ SchemeRequestLatency = TxGroup->GetHistogram("SchemeRequest/LatencyMs", NMonitoring::ExponentialHistogram(10, 4, 1));
SchemeRequestProxyNotReady = TxGroup->GetCounter("Propose/SchemeRequestProxyNotReady", true);
MakeRequest = TxGroup->GetCounter("Propose/MakeRequest", true);
SnapshotRequest = TxGroup->GetCounter("Propose/SnapshotRequest", true);
@@ -96,10 +96,10 @@ TTxProxyMon::TTxProxyMon(const TIntrusivePtr<NMonitoring::TDynamicCounters>& cou
ResolveKeySetLegacySuccess = DataReqGroup->GetCounter("ResolveKeySet/LegacySuccess", true);
ResolveKeySetMiniKQLSuccess = DataReqGroup->GetCounter("ResolveKeySet/MiniKQLSuccess", true);
ResolveKeySetReadTableSuccess = DataReqGroup->GetCounter("ResolveKeySet/ReadTableSuccess", true);
- ResolveKeySetRedirectUnavaible = DataReqGroup->GetCounter("ResolveKeySet/RedirectUnavaible", true);
+ ResolveKeySetRedirectUnavaible = DataReqGroup->GetCounter("ResolveKeySet/RedirectUnavaible", true);
ResolveKeySetFail = DataReqGroup->GetCounter("ResolveKeySet/Fail", true);
ResolveKeySetWrongRequest = DataReqGroup->GetCounter("ResolveKeySet/WrongRequest", true);
- ResolveKeySetDomainLocalityFail = DataReqGroup->GetCounter("ResolveKeySet/DomainLocalityFail", true);
+ ResolveKeySetDomainLocalityFail = DataReqGroup->GetCounter("ResolveKeySet/DomainLocalityFail", true);
ClientConnectedOk = DataReqGroup->GetCounter("ClientConnected/Ok", true);
ClientConnectedError = DataReqGroup->GetCounter("ClientConnected/Error", true);
diff --git a/ydb/core/tx/tx_proxy/mon.h b/ydb/core/tx/tx_proxy/mon.h
index 3dc6f9e05b5..d747ab4f998 100644
--- a/ydb/core/tx/tx_proxy/mon.h
+++ b/ydb/core/tx/tx_proxy/mon.h
@@ -18,14 +18,14 @@ namespace NTxProxy {
// tx_proxy group
TIntrusivePtr<NMonitoring::TDynamicCounters> TxGroup;
- NMonitoring::THistogramPtr CacheRequestLatency;
-
+ NMonitoring::THistogramPtr CacheRequestLatency;
+
NMonitoring::TDynamicCounters::TCounterPtr Navigate;
- NMonitoring::THistogramPtr NavigateLatency;
- NMonitoring::TDynamicCounters::TCounterPtr SchemeRequest;
- NMonitoring::THistogramPtr SchemeRequestLatency;
- NMonitoring::TDynamicCounters::TCounterPtr MakeRequest;
- //NMonitoring::THistogramPtr MakeRequestLatency;
+ NMonitoring::THistogramPtr NavigateLatency;
+ NMonitoring::TDynamicCounters::TCounterPtr SchemeRequest;
+ NMonitoring::THistogramPtr SchemeRequestLatency;
+ NMonitoring::TDynamicCounters::TCounterPtr MakeRequest;
+ //NMonitoring::THistogramPtr MakeRequestLatency;
NMonitoring::TDynamicCounters::TCounterPtr SnapshotRequest;
NMonitoring::TDynamicCounters::TCounterPtr CommitWritesRequest;
@@ -96,8 +96,8 @@ namespace NTxProxy {
NMonitoring::TDynamicCounters::TCounterPtr ResolveKeySetReadTableSuccess;
NMonitoring::TDynamicCounters::TCounterPtr ResolveKeySetFail;
NMonitoring::TDynamicCounters::TCounterPtr ResolveKeySetWrongRequest;
- NMonitoring::TDynamicCounters::TCounterPtr ResolveKeySetDomainLocalityFail;
- NMonitoring::TDynamicCounters::TCounterPtr ResolveKeySetRedirectUnavaible;
+ NMonitoring::TDynamicCounters::TCounterPtr ResolveKeySetDomainLocalityFail;
+ NMonitoring::TDynamicCounters::TCounterPtr ResolveKeySetRedirectUnavaible;
NMonitoring::TDynamicCounters::TCounterPtr ClientConnectedOk;
NMonitoring::TDynamicCounters::TCounterPtr ClientConnectedError;
diff --git a/ydb/core/tx/tx_proxy/proxy.cpp b/ydb/core/tx/tx_proxy/proxy.cpp
index 422971f5a53..55962e7d06f 100644
--- a/ydb/core/tx/tx_proxy/proxy.cpp
+++ b/ydb/core/tx/tx_proxy/proxy.cpp
@@ -1,11 +1,11 @@
-#include "proxy.h"
+#include "proxy.h"
namespace NKikimr {
TActorId MakeTxProxyID() {
return TActorId(0, TStringBuf("TxProxyServ"));
-}
-
+}
+
}
diff --git a/ydb/core/tx/tx_proxy/proxy.h b/ydb/core/tx/tx_proxy/proxy.h
index a980b6de34b..86d4f1ac79e 100644
--- a/ydb/core/tx/tx_proxy/proxy.h
+++ b/ydb/core/tx/tx_proxy/proxy.h
@@ -1,7 +1,7 @@
#pragma once
#include "defs.h"
-#include "mon.h"
-
+#include "mon.h"
+
#include <ydb/public/lib/base/defs.h>
#include <ydb/public/api/protos/ydb_status_codes.pb.h>
#include <ydb/core/base/kikimr_issue.h>
@@ -11,7 +11,7 @@
#include <ydb/core/scheme/tablet_scheme.h>
#include <ydb/core/scheme/scheme_tabledefs.h>
#include <ydb/core/protos/tx_proxy.pb.h>
-
+
#include <util/generic/set.h>
#include <util/generic/hash.h>
@@ -82,26 +82,26 @@ struct TEvTxUserProxy {
{
Record.SetProxyFlags(proxyFlags);
}
-
- bool HasSchemeProposal() const {
- return HasModifyScheme() || HasTransactionalModification();
- }
-
- bool HasModifyScheme() const {
- const NKikimrTxUserProxy::TTransaction &tx = Record.GetTransaction();
- return tx.HasModifyScheme();
- }
-
- bool HasTransactionalModification() const {
- const NKikimrTxUserProxy::TTransaction &tx = Record.GetTransaction();
- return tx.TransactionalModificationSize();
- }
-
- bool HasMakeProposal() const {
- const NKikimrTxUserProxy::TTransaction &tx = Record.GetTransaction();
+
+ bool HasSchemeProposal() const {
+ return HasModifyScheme() || HasTransactionalModification();
+ }
+
+ bool HasModifyScheme() const {
+ const NKikimrTxUserProxy::TTransaction &tx = Record.GetTransaction();
+ return tx.HasModifyScheme();
+ }
+
+ bool HasTransactionalModification() const {
+ const NKikimrTxUserProxy::TTransaction &tx = Record.GetTransaction();
+ return tx.TransactionalModificationSize();
+ }
+
+ bool HasMakeProposal() const {
+ const NKikimrTxUserProxy::TTransaction &tx = Record.GetTransaction();
return (tx.HasMiniKQLTransaction() && tx.GetMiniKQLTransaction().HasProgram())
|| tx.HasReadTableTransaction();
- }
+ }
bool HasSnapshotProposal() const {
const auto& tx = Record.GetTransaction();
@@ -257,12 +257,12 @@ struct TEvTxProxyReq {
};
};
-namespace NTxProxy {
-
- using TTableColumnInfo = TSysTables::TTableColumnInfo;
-
- struct TSchemeCacheConfig;
-
+namespace NTxProxy {
+
+ using TTableColumnInfo = TSysTables::TTableColumnInfo;
+
+ struct TSchemeCacheConfig;
+
struct TRequestControls {
private:
bool Registered;
@@ -304,12 +304,12 @@ namespace NTxProxy {
};
IActor* CreateTxProxyDataReq(const TTxProxyServices &services, const ui64 txid, const TIntrusivePtr<TTxProxyMon>& txProxyMon, const TRequestControls& requestControls);
- IActor* CreateTxProxyFlatSchemeReq(const TTxProxyServices &services, const ui64 txid, TAutoPtr<TEvTxProxyReq::TEvSchemeRequest> request, const TIntrusivePtr<TTxProxyMon>& txProxyMon);
- IActor* CreateTxProxyDescribeFlatSchemeReq(const TTxProxyServices &services, const TIntrusivePtr<TTxProxyMon>& txProxyMon);
+ IActor* CreateTxProxyFlatSchemeReq(const TTxProxyServices &services, const ui64 txid, TAutoPtr<TEvTxProxyReq::TEvSchemeRequest> request, const TIntrusivePtr<TTxProxyMon>& txProxyMon);
+ IActor* CreateTxProxyDescribeFlatSchemeReq(const TTxProxyServices &services, const TIntrusivePtr<TTxProxyMon>& txProxyMon);
IActor* CreateTxProxySnapshotReq(const TTxProxyServices &services, const ui64 txid, TEvTxUserProxy::TEvProposeTransaction::TPtr&& ev, const TIntrusivePtr<TTxProxyMon>& mon);
IActor* CreateTxProxyCommitWritesReq(const TTxProxyServices &services, const ui64 txid, TEvTxUserProxy::TEvProposeTransaction::TPtr&& ev, const TIntrusivePtr<TTxProxyMon>& mon);
-}
-
+}
+
IActor* CreateTxProxy(const TVector<ui64> &allocators);
TActorId MakeTxProxyID();
diff --git a/ydb/core/tx/tx_proxy/proxy_ext_tenant_ut.cpp b/ydb/core/tx/tx_proxy/proxy_ext_tenant_ut.cpp
index 0792967ca8c..ff7c9579d83 100644
--- a/ydb/core/tx/tx_proxy/proxy_ext_tenant_ut.cpp
+++ b/ydb/core/tx/tx_proxy/proxy_ext_tenant_ut.cpp
@@ -1,306 +1,306 @@
-#include "proxy_ut_helpers.h"
-
+#include "proxy_ut_helpers.h"
+
#include <ydb/core/base/path.h>
#include <ydb/library/aclib/aclib.h>
-
-using namespace NKikimr;
-using namespace NTxProxyUT;
-using namespace NHelpers;
-
-void DeclareAndLs(TTestEnv& env) {
- {
- auto subdomain = GetSubDomainDeclareSetting("USER_0");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateExtSubdomain("/dc-1", subdomain));
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::IsUnavailable(ls);
- }
-
- {
- auto ls = env.GetClient().Ls(env.GetRoot());
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
- }
-}
-
-
-void DeclareAndDrop(TTestEnv& env) {
- {
- auto subdomain = GetSubDomainDeclareSetting("USER_0");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateExtSubdomain("/dc-1", subdomain));
- }
-
- {
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
- }
-
- {
- auto ls = env.GetClient().Ls(env.GetRoot());
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 7);
- }
-
-}
-
+
+using namespace NKikimr;
+using namespace NTxProxyUT;
+using namespace NHelpers;
+
+void DeclareAndLs(TTestEnv& env) {
+ {
+ auto subdomain = GetSubDomainDeclareSetting("USER_0");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateExtSubdomain("/dc-1", subdomain));
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::IsUnavailable(ls);
+ }
+
+ {
+ auto ls = env.GetClient().Ls(env.GetRoot());
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
+ }
+}
+
+
+void DeclareAndDrop(TTestEnv& env) {
+ {
+ auto subdomain = GetSubDomainDeclareSetting("USER_0");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateExtSubdomain("/dc-1", subdomain));
+ }
+
+ {
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
+ }
+
+ {
+ auto ls = env.GetClient().Ls(env.GetRoot());
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 7);
+ }
+
+}
+
void DeclareAndDefineWithoutNodes(TTestEnvWithPoolsSupport& env) {
- {
- auto subdomain = GetSubDomainDeclareSetting("USER_0");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateExtSubdomain("/dc-1", subdomain));
- }
-
- {
+ {
+ auto subdomain = GetSubDomainDeclareSetting("USER_0");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateExtSubdomain("/dc-1", subdomain));
+ }
+
+ {
auto storagePool = env.CreatePoolsForTenant("USER_0");
auto subdomain = GetSubDomainDefaultSetting("USER_0", storagePool);
- subdomain.SetExternalSchemeShard(true);
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS, env.GetClient().AlterExtSubdomain("/dc-1", subdomain, TDuration::MilliSeconds(500)));
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::IsUnavailable(ls);
- }
-
- {
- auto ls = env.GetClient().Ls(env.GetRoot());
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
- }
-}
-
+ subdomain.SetExternalSchemeShard(true);
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS, env.GetClient().AlterExtSubdomain("/dc-1", subdomain, TDuration::MilliSeconds(500)));
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::IsUnavailable(ls);
+ }
+
+ {
+ auto ls = env.GetClient().Ls(env.GetRoot());
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
+ }
+}
+
void DeclareAndDefineWithNodes(TTestEnvWithPoolsSupport& env) {
- {
- auto subdomain = GetSubDomainDeclareSetting("USER_0");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateExtSubdomain("/dc-1", subdomain));
- }
-
- env.GetTenants().Run("/dc-1/USER_0");
-
- {
+ {
+ auto subdomain = GetSubDomainDeclareSetting("USER_0");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateExtSubdomain("/dc-1", subdomain));
+ }
+
+ env.GetTenants().Run("/dc-1/USER_0");
+
+ {
auto storagePool = env.CreatePoolsForTenant("USER_0");
auto subdomain = GetSubDomainDefaultSetting("USER_0", storagePool);
- subdomain.SetExternalSchemeShard(true);
+ subdomain.SetExternalSchemeShard(true);
subdomain.SetExternalHive(true);
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().AlterExtSubdomain("/dc-1", subdomain, WaitTimeOut));
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::IsExtSubdomain(ls); //root TSS
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 4);
- }
-
- {
- auto ls = env.GetClient().Ls(env.GetRoot());
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
- }
-}
-
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().AlterExtSubdomain("/dc-1", subdomain, WaitTimeOut));
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::IsExtSubdomain(ls); //root TSS
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 4);
+ }
+
+ {
+ auto ls = env.GetClient().Ls(env.GetRoot());
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
+ }
+}
+
void CreateTableInsideAndLs(TTestEnvWithPoolsSupport& env) {
- ui64 rootSchemeShard = Tests::ChangeStateStorage(Tests::SchemeRoot, 1);
-
- {
- auto subdomain_0 = GetSubDomainDeclareSetting("USER_0");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateExtSubdomain("/dc-1", subdomain_0));
- }
-
- env.GetTenants().Run("/dc-1/USER_0");
-
- {
+ ui64 rootSchemeShard = Tests::ChangeStateStorage(Tests::SchemeRoot, 1);
+
+ {
+ auto subdomain_0 = GetSubDomainDeclareSetting("USER_0");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateExtSubdomain("/dc-1", subdomain_0));
+ }
+
+ env.GetTenants().Run("/dc-1/USER_0");
+
+ {
auto storagePool = env.CreatePoolsForTenant("USER_0");
auto subdomain = GetSubDomainDefaultSetting("USER_0", storagePool);
- subdomain.SetExternalSchemeShard(true);
+ subdomain.SetExternalSchemeShard(true);
subdomain.SetExternalHive(true);
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().AlterExtSubdomain("/dc-1", subdomain));
-
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::IsExtSubdomain(ls); //root TSS
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_UNEQUAL(ver.OwnerId, rootSchemeShard);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 4);
- }
-
- {
- auto tableDesc = GetTableSimpleDescription("SimpleTable");
- UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
- NMsgBusProxy::MSTATUS_OK);
-
- auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
- NTestLs::IsTable(ls);
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_UNEQUAL(ver.OwnerId, rootSchemeShard);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_UNEQUAL(ver.OwnerId, rootSchemeShard);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 6);
- }
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
-
- {
- auto ls = env.GetClient().Ls("/dc-1");
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.OwnerId, rootSchemeShard);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 7);
- }
-}
-
-void DeclareAndAlterPools(TTestEnvWithPoolsSupport& env) {
- auto storagePool = env.CreatePoolsForTenant("USER_0");
-
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
-
- {
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().CreateExtSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
-
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::IsUnavailable(ls); //root TSS not ready yet
- ls = env.GetClient().Ls("/dc-1");
- NTestLs::HasChild(ls, "USER_0", NKikimrSchemeOp::EPathTypeExtSubDomain);
- }
-
- {
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().AlterExtSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0", storagePool)));
-
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::IsUnavailable(ls); //root TSS not ready yet
- ls = env.GetClient().Ls("/dc-1");
- NTestLs::HasChild(ls, "USER_0", NKikimrSchemeOp::EPathTypeExtSubDomain);
- }
-
- env.GetTenants().Run("/dc-1/USER_0");
-
- {
- auto subdomain = GetSubDomainDefaultSetting("USER_0");
- subdomain.SetExternalSchemeShard(true);
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().AlterExtSubdomain("/dc-1", subdomain));
-
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::IsExtSubdomain(ls); //root TSS ready
- NTestLs::WithPools(ls);
- }
-
- {
- auto tableDesc = GetTableSimpleDescription("SimpleTable");
- UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
- NMsgBusProxy::MSTATUS_OK);
-
- auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
- NTestLs::IsTable(ls);
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
- }
-
- env.GetTenants().Stop("/dc-1/USER_0");
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
-}
-
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().AlterExtSubdomain("/dc-1", subdomain));
+
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::IsExtSubdomain(ls); //root TSS
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_UNEQUAL(ver.OwnerId, rootSchemeShard);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 4);
+ }
+
+ {
+ auto tableDesc = GetTableSimpleDescription("SimpleTable");
+ UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
+ NMsgBusProxy::MSTATUS_OK);
+
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
+ NTestLs::IsTable(ls);
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_UNEQUAL(ver.OwnerId, rootSchemeShard);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_UNEQUAL(ver.OwnerId, rootSchemeShard);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 6);
+ }
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1");
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.OwnerId, rootSchemeShard);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 7);
+ }
+}
+
+void DeclareAndAlterPools(TTestEnvWithPoolsSupport& env) {
+ auto storagePool = env.CreatePoolsForTenant("USER_0");
+
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+
+ {
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().CreateExtSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
+
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::IsUnavailable(ls); //root TSS not ready yet
+ ls = env.GetClient().Ls("/dc-1");
+ NTestLs::HasChild(ls, "USER_0", NKikimrSchemeOp::EPathTypeExtSubDomain);
+ }
+
+ {
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().AlterExtSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0", storagePool)));
+
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::IsUnavailable(ls); //root TSS not ready yet
+ ls = env.GetClient().Ls("/dc-1");
+ NTestLs::HasChild(ls, "USER_0", NKikimrSchemeOp::EPathTypeExtSubDomain);
+ }
+
+ env.GetTenants().Run("/dc-1/USER_0");
+
+ {
+ auto subdomain = GetSubDomainDefaultSetting("USER_0");
+ subdomain.SetExternalSchemeShard(true);
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().AlterExtSubdomain("/dc-1", subdomain));
+
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::IsExtSubdomain(ls); //root TSS ready
+ NTestLs::WithPools(ls);
+ }
+
+ {
+ auto tableDesc = GetTableSimpleDescription("SimpleTable");
+ UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
+ NMsgBusProxy::MSTATUS_OK);
+
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
+ NTestLs::IsTable(ls);
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
+ }
+
+ env.GetTenants().Stop("/dc-1/USER_0");
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
+}
+
void CreateTableInsideThenStopTenantAndForceDeleteSubDomain(TTestEnvWithPoolsSupport& env) {
- ui64 rootSchemeShard = Tests::ChangeStateStorage(Tests::SchemeRoot, 1);
+ ui64 rootSchemeShard = Tests::ChangeStateStorage(Tests::SchemeRoot, 1);
auto storagePool = env.CreatePoolsForTenant("USER_0");
- const ui32 triesNum = 3;
- TVector<ui64> schemeshards(triesNum, 0);
- for (ui32 x = 0; x < triesNum; ++x) {
- {
- auto subdomain_0 = GetSubDomainDeclareSetting("USER_0");
+ const ui32 triesNum = 3;
+ TVector<ui64> schemeshards(triesNum, 0);
+ for (ui32 x = 0; x < triesNum; ++x) {
+ {
+ auto subdomain_0 = GetSubDomainDeclareSetting("USER_0");
subdomain_0.SetExternalHive(true);
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateExtSubdomain("/dc-1", subdomain_0));
-
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::IsUnavailable(ls); //root TSS not ready yet
-
- ls = env.GetClient().Ls("/dc-1");
- NTestLs::ChildrenCount(ls, 1);
- NTestLs::HasChild(ls, "USER_0", NKikimrSchemeOp::EPathTypeExtSubDomain);
- }
-
- env.GetTenants().Run("/dc-1/USER_0");
-
- {
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateExtSubdomain("/dc-1", subdomain_0));
+
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::IsUnavailable(ls); //root TSS not ready yet
+
+ ls = env.GetClient().Ls("/dc-1");
+ NTestLs::ChildrenCount(ls, 1);
+ NTestLs::HasChild(ls, "USER_0", NKikimrSchemeOp::EPathTypeExtSubDomain);
+ }
+
+ env.GetTenants().Run("/dc-1/USER_0");
+
+ {
auto subdomain = GetSubDomainDefaultSetting("USER_0", storagePool);
subdomain.SetExternalHive(true);
- subdomain.SetExternalSchemeShard(true);
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().AlterExtSubdomain("/dc-1", subdomain));
-
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::IsExtSubdomain(ls); //root TSS ready
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_UNEQUAL(ver.OwnerId, rootSchemeShard);
- schemeshards[x] = ver.OwnerId;
- if (x) {
- UNIT_ASSERT_VALUES_UNEQUAL(schemeshards[x], schemeshards[x-1]);
- }
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 4);
- }
-
- {
- auto tableDesc = GetTableSimpleDescription("SimpleTable");
- UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
- NMsgBusProxy::MSTATUS_OK);
-
- env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0/SimpleTable");
- auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
- NTestLs::PathType(ls, NKikimrSchemeOp::EPathTypeTable);
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.OwnerId, schemeshards[x]);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::IsExtSubdomain(ls);
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.OwnerId, schemeshards[x]);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 6);
-
-
- ls = env.GetClient().Ls("/dc-1");
- NTestLs::ChildrenCount(ls, 1);
- NTestLs::HasChild(ls, "USER_0", NKikimrSchemeOp::EPathTypeExtSubDomain);
- }
-
- env.GetTenants().Stop();
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
-
- {
- auto ls = env.GetClient().Ls("/dc-1");
- NTestLs::NoChildren(ls);
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.OwnerId, rootSchemeShard);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 7 + x * 4);
-
- env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0");
- ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::IsDoesNotExist(ls); //root TSS deleted
- }
- }
-}
-
+ subdomain.SetExternalSchemeShard(true);
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().AlterExtSubdomain("/dc-1", subdomain));
+
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::IsExtSubdomain(ls); //root TSS ready
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_UNEQUAL(ver.OwnerId, rootSchemeShard);
+ schemeshards[x] = ver.OwnerId;
+ if (x) {
+ UNIT_ASSERT_VALUES_UNEQUAL(schemeshards[x], schemeshards[x-1]);
+ }
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 4);
+ }
+
+ {
+ auto tableDesc = GetTableSimpleDescription("SimpleTable");
+ UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
+ NMsgBusProxy::MSTATUS_OK);
+
+ env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0/SimpleTable");
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
+ NTestLs::PathType(ls, NKikimrSchemeOp::EPathTypeTable);
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.OwnerId, schemeshards[x]);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::IsExtSubdomain(ls);
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.OwnerId, schemeshards[x]);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 6);
+
+
+ ls = env.GetClient().Ls("/dc-1");
+ NTestLs::ChildrenCount(ls, 1);
+ NTestLs::HasChild(ls, "USER_0", NKikimrSchemeOp::EPathTypeExtSubDomain);
+ }
+
+ env.GetTenants().Stop();
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1");
+ NTestLs::NoChildren(ls);
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.OwnerId, rootSchemeShard);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 7 + x * 4);
+
+ env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0");
+ ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::IsDoesNotExist(ls); //root TSS deleted
+ }
+ }
+}
+
void CreateTableInsideAndDeleteTable(TTestEnvWithPoolsSupport& env) {
ui64 rootSchemeShard = Tests::ChangeStateStorage(Tests::SchemeRoot, 1);
auto storagePool = env.CreatePoolsForTenant("USER_0");
@@ -317,7 +317,7 @@ void CreateTableInsideAndDeleteTable(TTestEnvWithPoolsSupport& env) {
ls = env.GetClient().Ls("/dc-1");
NTestLs::ChildrenCount(ls, 1);
- NTestLs::HasChild(ls, "USER_0", NKikimrSchemeOp::EPathTypeExtSubDomain);
+ NTestLs::HasChild(ls, "USER_0", NKikimrSchemeOp::EPathTypeExtSubDomain);
}
env.GetTenants().Run("/dc-1/USER_0");
@@ -347,7 +347,7 @@ void CreateTableInsideAndDeleteTable(TTestEnvWithPoolsSupport& env) {
env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0/SimpleTable");
auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
- NTestLs::PathType(ls, NKikimrSchemeOp::EPathTypeTable);
+ NTestLs::PathType(ls, NKikimrSchemeOp::EPathTypeTable);
auto ver = NTestLs::ExtractPathVersion(ls);
UNIT_ASSERT_VALUES_EQUAL(ver.OwnerId, schemeshards[x]);
UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
@@ -371,7 +371,7 @@ void CreateTableInsideAndDeleteTable(TTestEnvWithPoolsSupport& env) {
env.GetTenants().Stop();
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
{
auto ls = env.GetClient().Ls("/dc-1");
@@ -379,7 +379,7 @@ void CreateTableInsideAndDeleteTable(TTestEnvWithPoolsSupport& env) {
auto ver = NTestLs::ExtractPathVersion(ls);
UNIT_ASSERT_VALUES_EQUAL(ver.OwnerId, rootSchemeShard);
UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 7 + x * 4);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 7 + x * 4);
env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0");
ls = env.GetClient().Ls("/dc-1/USER_0");
@@ -404,7 +404,7 @@ void CreateTableInsideAndAlterTable(TTestEnvWithPoolsSupport& env) {
ls = env.GetClient().Ls("/dc-1");
NTestLs::ChildrenCount(ls, 1);
- NTestLs::HasChild(ls, "USER_0", NKikimrSchemeOp::EPathTypeExtSubDomain);
+ NTestLs::HasChild(ls, "USER_0", NKikimrSchemeOp::EPathTypeExtSubDomain);
}
env.GetTenants().Run("/dc-1/USER_0");
@@ -434,13 +434,13 @@ void CreateTableInsideAndAlterTable(TTestEnvWithPoolsSupport& env) {
env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0/SimpleTable");
auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
- NTestLs::PathType(ls, NKikimrSchemeOp::EPathTypeTable);
+ NTestLs::PathType(ls, NKikimrSchemeOp::EPathTypeTable);
auto ver = NTestLs::ExtractPathVersion(ls);
UNIT_ASSERT_VALUES_EQUAL(ver.OwnerId, schemeshards[x]);
UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
- NKikimrSchemeOp::TTableDescription description = NTestLs::ExtractTableDescription(ls);
+ NKikimrSchemeOp::TTableDescription description = NTestLs::ExtractTableDescription(ls);
description.ClearColumns();
description.ClearKeyColumnIds();
@@ -455,13 +455,13 @@ void CreateTableInsideAndAlterTable(TTestEnvWithPoolsSupport& env) {
{
env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0/SimpleTable");
auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
- NKikimrSchemeOp::TTableDescription description = NTestLs::ExtractTableDescription(ls);
+ NKikimrSchemeOp::TTableDescription description = NTestLs::ExtractTableDescription(ls);
UNIT_ASSERT_VALUES_EQUAL(description.GetPartitionConfig().GetFollowerCount(), 1);
}
env.GetTenants().Stop();
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
{
auto ls = env.GetClient().Ls("/dc-1");
@@ -469,7 +469,7 @@ void CreateTableInsideAndAlterTable(TTestEnvWithPoolsSupport& env) {
auto ver = NTestLs::ExtractPathVersion(ls);
UNIT_ASSERT_VALUES_EQUAL(ver.OwnerId, rootSchemeShard);
UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 7 + x * 4);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 7 + x * 4);
env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0");
ls = env.GetClient().Ls("/dc-1/USER_0");
@@ -478,270 +478,270 @@ void CreateTableInsideAndAlterTable(TTestEnvWithPoolsSupport& env) {
}
}
-
-void CreateTableInsideAndAlterDomainAndTable(TTestEnvWithPoolsSupport& env) {
- ui64 rootSchemeShard = Tests::ChangeStateStorage(Tests::SchemeRoot, 1);
- auto storagePool = env.CreatePoolsForTenant("USER_0");
- const ui32 triesNum = 3;
- TVector<ui64> schemeshards(triesNum, 0);
- for (ui32 x = 0; x < triesNum; ++x) {
- {
- auto subdomain_0 = GetSubDomainDeclareSetting("USER_0");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateExtSubdomain("/dc-1", subdomain_0));
-
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::IsUnavailable(ls); //root TSS not ready yet
-
- ls = env.GetClient().Ls("/dc-1");
- NTestLs::ChildrenCount(ls, 1);
- NTestLs::HasChild(ls, "USER_0", NKikimrSchemeOp::EPathTypeExtSubDomain);
- }
-
- env.GetTenants().Run("/dc-1/USER_0");
-
- {
- auto subdomain = GetSubDomainDefaultSetting("USER_0", storagePool);
- subdomain.SetExternalSchemeShard(true);
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().AlterExtSubdomain("/dc-1", subdomain));
-
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::IsExtSubdomain(ls); //root TSS ready
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_UNEQUAL(ver.OwnerId, rootSchemeShard);
- schemeshards[x] = ver.OwnerId;
- if (x) {
- UNIT_ASSERT_VALUES_UNEQUAL(schemeshards[x], schemeshards[x-1]);
- }
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 4);
- }
-
- {
- auto tableDesc = GetTableSimpleDescription("SimpleTable");
+
+void CreateTableInsideAndAlterDomainAndTable(TTestEnvWithPoolsSupport& env) {
+ ui64 rootSchemeShard = Tests::ChangeStateStorage(Tests::SchemeRoot, 1);
+ auto storagePool = env.CreatePoolsForTenant("USER_0");
+ const ui32 triesNum = 3;
+ TVector<ui64> schemeshards(triesNum, 0);
+ for (ui32 x = 0; x < triesNum; ++x) {
+ {
+ auto subdomain_0 = GetSubDomainDeclareSetting("USER_0");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateExtSubdomain("/dc-1", subdomain_0));
+
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::IsUnavailable(ls); //root TSS not ready yet
+
+ ls = env.GetClient().Ls("/dc-1");
+ NTestLs::ChildrenCount(ls, 1);
+ NTestLs::HasChild(ls, "USER_0", NKikimrSchemeOp::EPathTypeExtSubDomain);
+ }
+
+ env.GetTenants().Run("/dc-1/USER_0");
+
+ {
+ auto subdomain = GetSubDomainDefaultSetting("USER_0", storagePool);
+ subdomain.SetExternalSchemeShard(true);
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().AlterExtSubdomain("/dc-1", subdomain));
+
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::IsExtSubdomain(ls); //root TSS ready
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_UNEQUAL(ver.OwnerId, rootSchemeShard);
+ schemeshards[x] = ver.OwnerId;
+ if (x) {
+ UNIT_ASSERT_VALUES_UNEQUAL(schemeshards[x], schemeshards[x-1]);
+ }
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 4);
+ }
+
+ {
+ auto tableDesc = GetTableSimpleDescription("SimpleTable");
tableDesc.MutablePartitionConfig()->SetFollowerCount(0);
-
- UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
- NMsgBusProxy::MSTATUS_OK);
-
- env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0/SimpleTable");
- auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
- NTestLs::PathType(ls, NKikimrSchemeOp::EPathTypeTable);
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.OwnerId, schemeshards[x]);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
- }
- {
- env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0/SimpleTable");
- auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
- NKikimrSchemeOp::TTableDescription description = NTestLs::ExtractTableDescription(ls);
+
+ UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
+ NMsgBusProxy::MSTATUS_OK);
+
+ env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0/SimpleTable");
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
+ NTestLs::PathType(ls, NKikimrSchemeOp::EPathTypeTable);
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.OwnerId, schemeshards[x]);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
+ }
+ {
+ env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0/SimpleTable");
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
+ NKikimrSchemeOp::TTableDescription description = NTestLs::ExtractTableDescription(ls);
UNIT_ASSERT_VALUES_EQUAL(description.GetPartitionConfig().GetFollowerCount(), 0);
- }
-
- {
- env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0");
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
-
- NKikimrSubDomains::TDomainDescription description = NTestLs::ExtractDomainDescription(ls);
- UNIT_ASSERT_VALUES_EQUAL(description.GetProcessingParams().GetHive(), 0);
-
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 6);
- }
-
- {
- auto subdomain = GetSubDomainDefaultSetting("USER_0", storagePool);
- subdomain.SetExternalSchemeShard(true);
- subdomain.SetExternalHive(true);
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().AlterExtSubdomain("/dc-1", subdomain));
-
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::IsExtSubdomain(ls); //root TSS ready
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_UNEQUAL(ver.OwnerId, rootSchemeShard);
- schemeshards[x] = ver.OwnerId;
- if (x) {
- UNIT_ASSERT_VALUES_UNEQUAL(schemeshards[x], schemeshards[x-1]);
- }
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 7);
-
- NKikimrSubDomains::TDomainDescription description = NTestLs::ExtractDomainDescription(ls);
- UNIT_ASSERT_VALUES_UNEQUAL(description.GetProcessingParams().GetHive(), 0);
- }
-
- {
- env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0/SimpleTable");
- auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
- NTestLs::PathType(ls, NKikimrSchemeOp::EPathTypeTable);
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.OwnerId, schemeshards[x]);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
-
-
- NKikimrSchemeOp::TTableDescription description = NTestLs::ExtractTableDescription(ls);
-
- description.ClearColumns();
- description.ClearKeyColumnIds();
- description.ClearKeyColumnNames();
- description.ClearSplitBoundary();
- description.ClearTableIndexes();
+ }
+
+ {
+ env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0");
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+
+ NKikimrSubDomains::TDomainDescription description = NTestLs::ExtractDomainDescription(ls);
+ UNIT_ASSERT_VALUES_EQUAL(description.GetProcessingParams().GetHive(), 0);
+
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 6);
+ }
+
+ {
+ auto subdomain = GetSubDomainDefaultSetting("USER_0", storagePool);
+ subdomain.SetExternalSchemeShard(true);
+ subdomain.SetExternalHive(true);
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().AlterExtSubdomain("/dc-1", subdomain));
+
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::IsExtSubdomain(ls); //root TSS ready
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_UNEQUAL(ver.OwnerId, rootSchemeShard);
+ schemeshards[x] = ver.OwnerId;
+ if (x) {
+ UNIT_ASSERT_VALUES_UNEQUAL(schemeshards[x], schemeshards[x-1]);
+ }
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 7);
+
+ NKikimrSubDomains::TDomainDescription description = NTestLs::ExtractDomainDescription(ls);
+ UNIT_ASSERT_VALUES_UNEQUAL(description.GetProcessingParams().GetHive(), 0);
+ }
+
+ {
+ env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0/SimpleTable");
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
+ NTestLs::PathType(ls, NKikimrSchemeOp::EPathTypeTable);
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.OwnerId, schemeshards[x]);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
+
+
+ NKikimrSchemeOp::TTableDescription description = NTestLs::ExtractTableDescription(ls);
+
+ description.ClearColumns();
+ description.ClearKeyColumnIds();
+ description.ClearKeyColumnNames();
+ description.ClearSplitBoundary();
+ description.ClearTableIndexes();
description.MutablePartitionConfig()->SetFollowerCount(1);
-
- UNIT_ASSERT_VALUES_EQUAL(env.GetClient().AlterTable("/dc-1/USER_0", description),
- NMsgBusProxy::MSTATUS_OK);
- }
- {
- env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0/SimpleTable");
- auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
- NKikimrSchemeOp::TTableDescription description = NTestLs::ExtractTableDescription(ls);
+
+ UNIT_ASSERT_VALUES_EQUAL(env.GetClient().AlterTable("/dc-1/USER_0", description),
+ NMsgBusProxy::MSTATUS_OK);
+ }
+ {
+ env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0/SimpleTable");
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
+ NKikimrSchemeOp::TTableDescription description = NTestLs::ExtractTableDescription(ls);
UNIT_ASSERT_VALUES_EQUAL(description.GetPartitionConfig().GetFollowerCount(), 1);
- }
-
- env.GetTenants().Stop();
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
-
- {
- auto ls = env.GetClient().Ls("/dc-1");
- NTestLs::NoChildren(ls);
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.OwnerId, rootSchemeShard);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 7 + x * 4);
-
- env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0");
- ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::IsDoesNotExist(ls); //root TSS deleted
- }
- }
-}
-
+ }
+
+ env.GetTenants().Stop();
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1");
+ NTestLs::NoChildren(ls);
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.OwnerId, rootSchemeShard);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 7 + x * 4);
+
+ env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0");
+ ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::IsDoesNotExist(ls); //root TSS deleted
+ }
+ }
+}
+
void GenericCases(TTestEnvWithPoolsSupport& env) {
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().CreateExtSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
- env.GetTenants().Run("/dc-1/USER_0");
-
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().CreateExtSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
+ env.GetTenants().Run("/dc-1/USER_0");
+
auto storagePools = env.CreatePoolsForTenant("USER_0");
auto alter = GetSubDomainDefaultSetting("USER_0", storagePools);
- alter.SetExternalSchemeShard(true);
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().AlterExtSubdomain("/dc-1", alter, WaitTimeOut));
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::IsExtSubdomain(ls);
- }
-
- {
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0", "dir"));
- auto ls = env.GetClient().Ls("/dc-1/USER_0/dir");
- NTestLs::IsDir(ls);
- }
-
- {
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1", "dir"));
- auto ls = env.GetClient().Ls("/dc-1/dir");
- NTestLs::NotInSubdomain(ls);
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1");
- NTestLs::NotInSubdomain(ls);
- }
-
- {
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0/dir", "dir_0"));
- auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_0");
- NTestLs::IsDir(ls);
- }
-
- {
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0/dir", "dir_1"));
- auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_1");
- NTestLs::IsDir(ls);
- }
-
- {
- auto tableDesc = GetTableSimpleDescription("table");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0/dir/dir_0", tableDesc));
- auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_0/table");
- NTestLs::IsTable(ls);
- }
-
- {
- auto tableDesc = GetTableSimpleDescription("table");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0/dir/dir_1", tableDesc));
- auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_1/table");
- NTestLs::IsTable(ls);
- }
-
- SetRowInSimpletable(env, 42, 111, "/dc-1/USER_0/dir/dir_0/table");
- SetRowInSimpletable(env, 42, 111, "/dc-1/USER_0/dir/dir_1/table");
-
- {
- NKikimrMiniKQL::TResult result;
- env.GetClient().FlatQuery("("
- "(let row0_ '('('key (Uint64 '42))))"
- "(let cols_ '('value))"
- "(let select0_ (SelectRow '/dc-1/USER_0/dir/dir_0/table row0_ cols_))"
- "(let select1_ (SelectRow '/dc-1/USER_0/dir/dir_1/table row0_ cols_))"
- "(let ret_ (AsList"
- " (SetResult 'res0_ select0_)"
- " (SetResult 'res1_ select1_)"
- "))"
- "(return ret_)"
- ")", result);
- }
-}
-
-Y_UNIT_TEST_SUITE(TExtSubDomainTest) {
- Y_UNIT_TEST(DeclareAndLs) {
+ alter.SetExternalSchemeShard(true);
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().AlterExtSubdomain("/dc-1", alter, WaitTimeOut));
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::IsExtSubdomain(ls);
+ }
+
+ {
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0", "dir"));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/dir");
+ NTestLs::IsDir(ls);
+ }
+
+ {
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1", "dir"));
+ auto ls = env.GetClient().Ls("/dc-1/dir");
+ NTestLs::NotInSubdomain(ls);
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1");
+ NTestLs::NotInSubdomain(ls);
+ }
+
+ {
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0/dir", "dir_0"));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_0");
+ NTestLs::IsDir(ls);
+ }
+
+ {
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0/dir", "dir_1"));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_1");
+ NTestLs::IsDir(ls);
+ }
+
+ {
+ auto tableDesc = GetTableSimpleDescription("table");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0/dir/dir_0", tableDesc));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_0/table");
+ NTestLs::IsTable(ls);
+ }
+
+ {
+ auto tableDesc = GetTableSimpleDescription("table");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0/dir/dir_1", tableDesc));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_1/table");
+ NTestLs::IsTable(ls);
+ }
+
+ SetRowInSimpletable(env, 42, 111, "/dc-1/USER_0/dir/dir_0/table");
+ SetRowInSimpletable(env, 42, 111, "/dc-1/USER_0/dir/dir_1/table");
+
+ {
+ NKikimrMiniKQL::TResult result;
+ env.GetClient().FlatQuery("("
+ "(let row0_ '('('key (Uint64 '42))))"
+ "(let cols_ '('value))"
+ "(let select0_ (SelectRow '/dc-1/USER_0/dir/dir_0/table row0_ cols_))"
+ "(let select1_ (SelectRow '/dc-1/USER_0/dir/dir_1/table row0_ cols_))"
+ "(let ret_ (AsList"
+ " (SetResult 'res0_ select0_)"
+ " (SetResult 'res1_ select1_)"
+ "))"
+ "(return ret_)"
+ ")", result);
+ }
+}
+
+Y_UNIT_TEST_SUITE(TExtSubDomainTest) {
+ Y_UNIT_TEST(DeclareAndLs) {
TTestEnv env(1, 0);
- DeclareAndLs(env);
- }
-
- Y_UNIT_TEST(DeclareAndDrop) {
+ DeclareAndLs(env);
+ }
+
+ Y_UNIT_TEST(DeclareAndDrop) {
TTestEnv env(1, 0);
- DeclareAndDrop(env);
- }
-
+ DeclareAndDrop(env);
+ }
+
Y_UNIT_TEST(DeclareAndDefineWithoutNodes) {
TTestEnvWithPoolsSupport env(1, 0, 2);
DeclareAndDefineWithoutNodes(env);
- }
-
- Y_UNIT_TEST(DeclareAndDefineWithNodes) {
+ }
+
+ Y_UNIT_TEST(DeclareAndDefineWithNodes) {
TTestEnvWithPoolsSupport env(1, 1, 2);
- DeclareAndDefineWithNodes(env);
- }
-
- Y_UNIT_TEST(CreateTableInsideAndLs) {
+ DeclareAndDefineWithNodes(env);
+ }
+
+ Y_UNIT_TEST(CreateTableInsideAndLs) {
TTestEnvWithPoolsSupport env(1, 1, 2);
- CreateTableInsideAndLs(env);
- }
-
- Y_UNIT_TEST(DeclareAndAlterPools) {
+ CreateTableInsideAndLs(env);
+ }
+
+ Y_UNIT_TEST(DeclareAndAlterPools) {
TTestEnvWithPoolsSupport env(1, 1, 2);
- DeclareAndAlterPools(env);
- }
-
- Y_UNIT_TEST(CreateTableInsideThenStopTenantAndForceDeleteSubDomain) {
+ DeclareAndAlterPools(env);
+ }
+
+ Y_UNIT_TEST(CreateTableInsideThenStopTenantAndForceDeleteSubDomain) {
TTestEnvWithPoolsSupport env(1, 1, 2);
- CreateTableInsideThenStopTenantAndForceDeleteSubDomain(env);
- }
-
- Y_UNIT_TEST(CreateTableInsideAndAlterDomainAndTable) {
+ CreateTableInsideThenStopTenantAndForceDeleteSubDomain(env);
+ }
+
+ Y_UNIT_TEST(CreateTableInsideAndAlterDomainAndTable) {
TTestEnvWithPoolsSupport env(1, 1, 2);
- CreateTableInsideAndAlterDomainAndTable(env);
- }
-
- Y_UNIT_TEST(GenericCases) {
+ CreateTableInsideAndAlterDomainAndTable(env);
+ }
+
+ Y_UNIT_TEST(GenericCases) {
TTestEnvWithPoolsSupport env(1, 1, 2);
- GenericCases(env);
- }
-}
+ GenericCases(env);
+ }
+}
diff --git a/ydb/core/tx/tx_proxy/proxy_impl.cpp b/ydb/core/tx/tx_proxy/proxy_impl.cpp
index cb4382514fb..20dc8cce176 100644
--- a/ydb/core/tx/tx_proxy/proxy_impl.cpp
+++ b/ydb/core/tx/tx_proxy/proxy_impl.cpp
@@ -1,4 +1,4 @@
-#include "proxy.h"
+#include "proxy.h"
#include <ydb/core/tx/scheme_board/cache.h>
#include <ydb/core/tx/scheme_cache/scheme_cache.h>
#include <ydb/core/tx/tx_allocator/txallocator.h>
@@ -18,45 +18,45 @@ using namespace NTabletFlatExecutor;
namespace NTxProxy {
-template<class EventType>
-struct TDelayedQueue {
- typedef typename EventType::TPtr EventTypePtr;
- struct TRequest : public std::pair<typename EventType::TPtr, TInstant> {
- typedef std::pair<typename EventType::TPtr, TInstant> TBase;
-
- using TBase::TBase; //import constructors
-
- EventTypePtr& GetRequest() {
- return TBase::first;
- }
- TInstant GetExpireMoment() const {
- return TBase::second;
- }
- };
- typedef TAutoPtr<TRequest> TRequestPtr;
+template<class EventType>
+struct TDelayedQueue {
+ typedef typename EventType::TPtr EventTypePtr;
+ struct TRequest : public std::pair<typename EventType::TPtr, TInstant> {
+ typedef std::pair<typename EventType::TPtr, TInstant> TBase;
+
+ using TBase::TBase; //import constructors
+
+ EventTypePtr& GetRequest() {
+ return TBase::first;
+ }
+ TInstant GetExpireMoment() const {
+ return TBase::second;
+ }
+ };
+ typedef TAutoPtr<TRequest> TRequestPtr;
typedef TOneOneQueueInplace<TRequest*, 64> TQueueType;
typedef TAutoPtr<TQueueType, typename TQueueType::TPtrCleanDestructor> TSafeQueue;
- TSafeQueue Queue;
-
- TDelayedQueue()
+ TSafeQueue Queue;
+
+ TDelayedQueue()
: Queue(new TQueueType())
- {}
-};
-
-class TTxProxy : public TActorBootstrapped<TTxProxy> {
+ {}
+};
+
+class TTxProxy : public TActorBootstrapped<TTxProxy> {
TTxProxyServices Services;
- THolder<NTabletPipe::IClientCache> PipeClientCache;
+ THolder<NTabletPipe::IClientCache> PipeClientCache;
TTxAllocatorClient TxAllocatorClient;
- static const TDuration TimeoutDelayedRequest;
- typedef TDelayedQueue<TEvTxUserProxy::TEvProposeTransaction> TDelayedProposal;
- TDelayedProposal DelayedProposal;
+ static const TDuration TimeoutDelayedRequest;
+ typedef TDelayedQueue<TEvTxUserProxy::TEvProposeTransaction> TDelayedProposal;
+ TDelayedProposal DelayedProposal;
typedef TDelayedQueue<TEvTxUserProxy::TEvProposeKqpTransaction> TDelayedKqpProposal;
TDelayedKqpProposal DelayedKqpProposal;
typedef TDelayedQueue<TEvTxUserProxy::TEvAllocateTxId> TDelayedAllocateTxId;
TDelayedAllocateTxId DelayedAllocateTxId;
-
+
TIntrusivePtr<NMonitoring::TDynamicCounters> CacheCounters;
TIntrusivePtr<TTxProxyMon> TxProxyMon;
TRequestControls RequestControls;
@@ -66,73 +66,73 @@ class TTxProxy : public TActorBootstrapped<TTxProxy> {
ctx.Send(Services.LeaderPipeCache, new TEvents::TEvPoisonPill());
ctx.Send(Services.FollowerPipeCache, new TEvents::TEvPoisonPill());
- PipeClientCache->Detach(ctx);
- PipeClientCache.Destroy();
-
- return TActor::Die(ctx);
- }
-
- void Handle(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx) {
- LOG_NOTICE_S(ctx, NKikimrServices::TX_PROXY,
- "actor# " << SelfId() <<
- " HANDLE TEvPoisonPill" <<
- " from Sender# " << ev->Sender.ToString());
- Die(ctx);
- }
-
- void ReplyDecline(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus status, const TEvTxUserProxy::TEvProposeTransaction::TPtr &ev, const TActorContext &ctx) {
- LOG_NOTICE_S(ctx, NKikimrServices::TX_PROXY,
- "actor# " << SelfId() <<
- " DECLINE TEvProposeTransactionStatus " <<
- " reason# " << status <<
- " reply to# " << ev->Sender.ToString());
-
- ctx.Send(ev->Sender, new TEvTxUserProxy::TEvProposeTransactionStatus(status), 0, ev->Cookie);
- }
-
- void ReplyNotImplemented(const TEvTxUserProxy::TEvProposeTransaction::TPtr &ev, const TActorContext &ctx) {
- TxProxyMon->TxNotImplemented->Inc();
- const NKikimrTxUserProxy::TTransaction &tx = ev->Get()->Record.GetTransaction();
- LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY,
- "actor# " << SelfId() <<
- " Cookie# " << (ui64)ev->Cookie <<
- " userReqId# \"" << tx.GetUserRequestId() << "\"" <<
- " RESPONSE Status# NotImplemented Type# Unknown");
- return ReplyDecline(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::NotImplemented, ev, ctx);
- }
-
- void Decline(const TEvTxUserProxy::TEvProposeTransaction::TPtr &ev, const TActorContext &ctx) {
- if (ev->Get()->HasSchemeProposal()) {
- LOG_WARN_S(ctx, NKikimrServices::TX_PROXY,
- "actor# " << SelfId() <<
- " DECLINE TEvProposeTransaction SchemeRequest" <<
- " reason# " << TEvTxUserProxy::TResultStatus::EStatus::ProxyNotReady <<
- " replyto# " << ev->Sender.ToString());
-
- TxProxyMon->SchemeRequestProxyNotReady->Inc();
- return ReplyDecline(TEvTxUserProxy::TResultStatus::EStatus::ProxyNotReady, ev, ctx);
- }
-
- if (ev->Get()->HasMakeProposal()) {
- LOG_WARN_S(ctx, NKikimrServices::TX_PROXY,
- "actor# " << SelfId() <<
- " DECLINE TEvProposeTransaction DataReques" <<
- " reason# " << TEvTxUserProxy::TResultStatus::EStatus::ProxyNotReady <<
- " replyto# " << ev->Sender.ToString());
-
- TxProxyMon->MakeRequestProxyNotReady->Inc();
- return ReplyDecline(TEvTxUserProxy::TResultStatus::EStatus::ProxyNotReady, ev, ctx);
- }
-
- ReplyNotImplemented(ev, ctx);
- }
-
- void DelayRequest(TEvTxUserProxy::TEvProposeTransaction::TPtr &ev, const TActorContext &ctx) {
- auto request = new TDelayedProposal::TRequest(ev, ctx.Now() + TimeoutDelayedRequest);
- DelayedProposal.Queue->Push(request);
-
- }
-
+ PipeClientCache->Detach(ctx);
+ PipeClientCache.Destroy();
+
+ return TActor::Die(ctx);
+ }
+
+ void Handle(TEvents::TEvPoisonPill::TPtr &ev, const TActorContext &ctx) {
+ LOG_NOTICE_S(ctx, NKikimrServices::TX_PROXY,
+ "actor# " << SelfId() <<
+ " HANDLE TEvPoisonPill" <<
+ " from Sender# " << ev->Sender.ToString());
+ Die(ctx);
+ }
+
+ void ReplyDecline(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus status, const TEvTxUserProxy::TEvProposeTransaction::TPtr &ev, const TActorContext &ctx) {
+ LOG_NOTICE_S(ctx, NKikimrServices::TX_PROXY,
+ "actor# " << SelfId() <<
+ " DECLINE TEvProposeTransactionStatus " <<
+ " reason# " << status <<
+ " reply to# " << ev->Sender.ToString());
+
+ ctx.Send(ev->Sender, new TEvTxUserProxy::TEvProposeTransactionStatus(status), 0, ev->Cookie);
+ }
+
+ void ReplyNotImplemented(const TEvTxUserProxy::TEvProposeTransaction::TPtr &ev, const TActorContext &ctx) {
+ TxProxyMon->TxNotImplemented->Inc();
+ const NKikimrTxUserProxy::TTransaction &tx = ev->Get()->Record.GetTransaction();
+ LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY,
+ "actor# " << SelfId() <<
+ " Cookie# " << (ui64)ev->Cookie <<
+ " userReqId# \"" << tx.GetUserRequestId() << "\"" <<
+ " RESPONSE Status# NotImplemented Type# Unknown");
+ return ReplyDecline(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::NotImplemented, ev, ctx);
+ }
+
+ void Decline(const TEvTxUserProxy::TEvProposeTransaction::TPtr &ev, const TActorContext &ctx) {
+ if (ev->Get()->HasSchemeProposal()) {
+ LOG_WARN_S(ctx, NKikimrServices::TX_PROXY,
+ "actor# " << SelfId() <<
+ " DECLINE TEvProposeTransaction SchemeRequest" <<
+ " reason# " << TEvTxUserProxy::TResultStatus::EStatus::ProxyNotReady <<
+ " replyto# " << ev->Sender.ToString());
+
+ TxProxyMon->SchemeRequestProxyNotReady->Inc();
+ return ReplyDecline(TEvTxUserProxy::TResultStatus::EStatus::ProxyNotReady, ev, ctx);
+ }
+
+ if (ev->Get()->HasMakeProposal()) {
+ LOG_WARN_S(ctx, NKikimrServices::TX_PROXY,
+ "actor# " << SelfId() <<
+ " DECLINE TEvProposeTransaction DataReques" <<
+ " reason# " << TEvTxUserProxy::TResultStatus::EStatus::ProxyNotReady <<
+ " replyto# " << ev->Sender.ToString());
+
+ TxProxyMon->MakeRequestProxyNotReady->Inc();
+ return ReplyDecline(TEvTxUserProxy::TResultStatus::EStatus::ProxyNotReady, ev, ctx);
+ }
+
+ ReplyNotImplemented(ev, ctx);
+ }
+
+ void DelayRequest(TEvTxUserProxy::TEvProposeTransaction::TPtr &ev, const TActorContext &ctx) {
+ auto request = new TDelayedProposal::TRequest(ev, ctx.Now() + TimeoutDelayedRequest);
+ DelayedProposal.Queue->Push(request);
+
+ }
+
void DelayRequest(TEvTxUserProxy::TEvProposeKqpTransaction::TPtr &ev, const TActorContext &ctx) {
auto request = new TDelayedKqpProposal::TRequest(ev, ctx.Now() + TimeoutDelayedRequest);
DelayedKqpProposal.Queue->Push(request);
@@ -143,134 +143,134 @@ class TTxProxy : public TActorBootstrapped<TTxProxy> {
DelayedAllocateTxId.Queue->Push(request);
}
- template<class EventType>
- void PlayQueue(TDelayedQueue<EventType> &delayed, const TActorContext &ctx) {
- typedef typename TDelayedQueue<EventType>::TRequestPtr TRequestPtr;
-
- while (delayed.Queue->Head()) {
- TVector<ui64> txIds = TxAllocatorClient.AllocateTxIds(1, ctx);
- if (!txIds) {
- return;
- }
- TRequestPtr extracted = delayed.Queue->Pop();
- ProcessRequest(extracted->GetRequest(), ctx, txIds.front());
- }
- }
-
- void PlayDelayed(const TActorContext &ctx) {
- PlayQueue(DelayedProposal, ctx);
+ template<class EventType>
+ void PlayQueue(TDelayedQueue<EventType> &delayed, const TActorContext &ctx) {
+ typedef typename TDelayedQueue<EventType>::TRequestPtr TRequestPtr;
+
+ while (delayed.Queue->Head()) {
+ TVector<ui64> txIds = TxAllocatorClient.AllocateTxIds(1, ctx);
+ if (!txIds) {
+ return;
+ }
+ TRequestPtr extracted = delayed.Queue->Pop();
+ ProcessRequest(extracted->GetRequest(), ctx, txIds.front());
+ }
+ }
+
+ void PlayDelayed(const TActorContext &ctx) {
+ PlayQueue(DelayedProposal, ctx);
PlayQueue(DelayedKqpProposal, ctx);
PlayQueue(DelayedAllocateTxId, ctx);
- }
-
- template<class EventType>
- void CheckTimeout(TDelayedQueue<EventType> &delayed, const TActorContext &ctx) {
- typedef typename TDelayedQueue<EventType>::TRequestPtr TRequestPtr;
-
- while (const auto head = delayed.Queue->Head()) {
- const TInstant &expireAt = head->GetExpireMoment();
- if (expireAt > ctx.Now()) {
- break;
- }
- TRequestPtr extracted = delayed.Queue->Pop();
- Decline(extracted->GetRequest(), ctx);
- }
- }
-
- void CheckTimeouts(const TActorContext &ctx) {
- CheckTimeout(DelayedProposal, ctx);
- }
-
- static NTabletPipe::TClientConfig InitPipeClientConfig() {
- NTabletPipe::TClientConfig config;
+ }
+
+ template<class EventType>
+ void CheckTimeout(TDelayedQueue<EventType> &delayed, const TActorContext &ctx) {
+ typedef typename TDelayedQueue<EventType>::TRequestPtr TRequestPtr;
+
+ while (const auto head = delayed.Queue->Head()) {
+ const TInstant &expireAt = head->GetExpireMoment();
+ if (expireAt > ctx.Now()) {
+ break;
+ }
+ TRequestPtr extracted = delayed.Queue->Pop();
+ Decline(extracted->GetRequest(), ctx);
+ }
+ }
+
+ void CheckTimeouts(const TActorContext &ctx) {
+ CheckTimeout(DelayedProposal, ctx);
+ }
+
+ static NTabletPipe::TClientConfig InitPipeClientConfig() {
+ NTabletPipe::TClientConfig config;
config.RetryPolicy = {
.RetryLimitCount = 3,
.MinRetryTime = TDuration::MilliSeconds(100),
.MaxRetryTime = TDuration::Seconds(1),
.BackoffMultiplier = 5,
};
- return config;
+ return config;
}
- static const NTabletPipe::TClientConfig& GetPipeClientConfig() {
- static const NTabletPipe::TClientConfig config = InitPipeClientConfig();
- return config;
+ static const NTabletPipe::TClientConfig& GetPipeClientConfig() {
+ static const NTabletPipe::TClientConfig config = InitPipeClientConfig();
+ return config;
}
- void Handle(TEvTxAllocator::TEvAllocateResult::TPtr &ev, const TActorContext &ctx) {
+ void Handle(TEvTxAllocator::TEvAllocateResult::TPtr &ev, const TActorContext &ctx) {
if (!TxAllocatorClient.OnAllocateResult(ev, ctx)) {
- return;
- }
-
- PlayDelayed(ctx);
+ return;
+ }
+
+ PlayDelayed(ctx);
}
- void Handle(TEvTabletPipe::TEvClientConnected::TPtr &ev, const TActorContext &ctx) {
- TEvTabletPipe::TEvClientConnected *msg = ev->Get();
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
- "actor# " << SelfId() <<
- " HANDLE TEvClientConnected " << (PipeClientCache->OnConnect(ev) ? "success connect" : "fail connect") <<
- " from tablet# " << msg->TabletId);
-
- if(!PipeClientCache->OnConnect(ev)) {
- CheckTimeouts(ctx);
+ void Handle(TEvTabletPipe::TEvClientConnected::TPtr &ev, const TActorContext &ctx) {
+ TEvTabletPipe::TEvClientConnected *msg = ev->Get();
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
+ "actor# " << SelfId() <<
+ " HANDLE TEvClientConnected " << (PipeClientCache->OnConnect(ev) ? "success connect" : "fail connect") <<
+ " from tablet# " << msg->TabletId);
+
+ if(!PipeClientCache->OnConnect(ev)) {
+ CheckTimeouts(ctx);
TxAllocatorClient.SendRequest(msg->TabletId, ctx);
- return;
- }
+ return;
+ }
}
- void Handle(TEvTabletPipe::TEvClientDestroyed::TPtr &ev, const TActorContext &ctx) {
- TEvTabletPipe::TEvClientDestroyed *msg = ev->Get();
- LOG_WARN_S(ctx, NKikimrServices::TX_PROXY,
- "actor# " << SelfId() <<
- " HANDLE TEvClientDestroyed" <<
- " from tablet# " << msg->TabletId);
-
- PipeClientCache->OnDisconnect(ev);
- CheckTimeouts(ctx);
+ void Handle(TEvTabletPipe::TEvClientDestroyed::TPtr &ev, const TActorContext &ctx) {
+ TEvTabletPipe::TEvClientDestroyed *msg = ev->Get();
+ LOG_WARN_S(ctx, NKikimrServices::TX_PROXY,
+ "actor# " << SelfId() <<
+ " HANDLE TEvClientDestroyed" <<
+ " from tablet# " << msg->TabletId);
+
+ PipeClientCache->OnDisconnect(ev);
+ CheckTimeouts(ctx);
TxAllocatorClient.SendRequest(msg->TabletId, ctx);
- }
-
- void ProcessRequest(TEvTxUserProxy::TEvProposeTransaction::TPtr &ev, const TActorContext &ctx, ui64 txid) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
- "actor# " << SelfId() <<
- " TxId# " << txid <<
- " ProcessProposeTransaction");
+ }
+
+ void ProcessRequest(TEvTxUserProxy::TEvProposeTransaction::TPtr &ev, const TActorContext &ctx, ui64 txid) {
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
+ "actor# " << SelfId() <<
+ " TxId# " << txid <<
+ " ProcessProposeTransaction");
RequestControls.Reqister(ctx);
// process scheme transactions
- const NKikimrTxUserProxy::TTransaction &tx = ev->Get()->Record.GetTransaction();
- if (ev->Get()->HasSchemeProposal()) {
+ const NKikimrTxUserProxy::TTransaction &tx = ev->Get()->Record.GetTransaction();
+ if (ev->Get()->HasSchemeProposal()) {
// todo: in-fly and shutdown
Y_VERIFY_DEBUG(txid != 0);
- ui64 cookie = ev->Cookie;
- const TString userRequestId = tx.GetUserRequestId();
- TAutoPtr<TEvTxProxyReq::TEvSchemeRequest> request = new TEvTxProxyReq::TEvSchemeRequest(ev);
+ ui64 cookie = ev->Cookie;
+ const TString userRequestId = tx.GetUserRequestId();
+ TAutoPtr<TEvTxProxyReq::TEvSchemeRequest> request = new TEvTxProxyReq::TEvSchemeRequest(ev);
const TActorId reqId = ctx.ExecutorThread.RegisterActor(CreateTxProxyFlatSchemeReq(Services, txid, request, TxProxyMon));
TxProxyMon->SchemeRequest->Inc();
LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
- "actor# " << SelfId() <<
- " Cookie# " << cookie <<
- " userReqId# \"" << userRequestId << "\""
- " txid# " << txid <<
+ "actor# " << SelfId() <<
+ " Cookie# " << cookie <<
+ " userReqId# \"" << userRequestId << "\""
+ " txid# " << txid <<
" SEND to# " << reqId.ToString().data());
return;
}
// otherwise process data transaction
- if (ev->Get()->HasMakeProposal()) {
+ if (ev->Get()->HasMakeProposal()) {
// todo: in-fly and shutdown
Y_VERIFY_DEBUG(txid != 0);
const TActorId reqId = ctx.ExecutorThread.RegisterActor(CreateTxProxyDataReq(Services, txid, TxProxyMon, RequestControls));
TxProxyMon->MakeRequest->Inc();
LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
- "actor# " << SelfId() <<
- " Cookie# " << (ui64)ev->Cookie <<
- " userReqId# \"" << tx.GetUserRequestId() << "\"" <<
- " txid# " << txid <<
+ "actor# " << SelfId() <<
+ " Cookie# " << (ui64)ev->Cookie <<
+ " userReqId# \"" << tx.GetUserRequestId() << "\"" <<
+ " txid# " << txid <<
" SEND to# " << reqId.ToString().data() <<
- " DataReq marker# P0");
+ " DataReq marker# P0");
ctx.Send(reqId, new TEvTxProxyReq::TEvMakeRequest(ev));
return;
}
@@ -305,35 +305,35 @@ class TTxProxy : public TActorBootstrapped<TTxProxy> {
return;
}
- ReplyNotImplemented(ev, ctx);
+ ReplyNotImplemented(ev, ctx);
}
- void Handle(TEvTxUserProxy::TEvProposeTransaction::TPtr &ev, const TActorContext &ctx) {
- const NKikimrTxUserProxy::TTransaction &tx = ev->Get()->Record.GetTransaction();
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
- "actor# " << SelfId() <<
- " Handle TEvProposeTransaction");
-
+ void Handle(TEvTxUserProxy::TEvProposeTransaction::TPtr &ev, const TActorContext &ctx) {
+ const NKikimrTxUserProxy::TTransaction &tx = ev->Get()->Record.GetTransaction();
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
+ "actor# " << SelfId() <<
+ " Handle TEvProposeTransaction");
+
const bool needTxId = ev->Get()->NeedTxId();
-
- if (needTxId) {
- auto txIds = TxAllocatorClient.AllocateTxIds(1, ctx);
- if (!txIds) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
- "actor# " << SelfId() <<
- " Cookie# " << (ui64)ev->Cookie <<
- " userReqId# \"" << tx.GetUserRequestId() << "\""
- " DELAY REQUEST, wait txids from allocator" <<
- " Type# Scheme");
- return DelayRequest(ev, ctx);
- }
-
- return ProcessRequest(ev, ctx, txIds.front());
- }
-
- return ProcessRequest(ev, ctx, 0);
- }
-
+
+ if (needTxId) {
+ auto txIds = TxAllocatorClient.AllocateTxIds(1, ctx);
+ if (!txIds) {
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
+ "actor# " << SelfId() <<
+ " Cookie# " << (ui64)ev->Cookie <<
+ " userReqId# \"" << tx.GetUserRequestId() << "\""
+ " DELAY REQUEST, wait txids from allocator" <<
+ " Type# Scheme");
+ return DelayRequest(ev, ctx);
+ }
+
+ return ProcessRequest(ev, ctx, txIds.front());
+ }
+
+ return ProcessRequest(ev, ctx, 0);
+ }
+
void ProcessRequest(TEvTxUserProxy::TEvProposeKqpTransaction::TPtr& ev, const TActorContext& ctx, ui64 txid) {
TxProxyMon->KqpRequest->Inc();
LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
@@ -352,8 +352,8 @@ class TTxProxy : public TActorBootstrapped<TTxProxy> {
"actor# " << SelfId() <<
" Handle TEvExecuteKqpTransaction");
- auto txIds = TxAllocatorClient.AllocateTxIds(1, ctx);
- if (!txIds) {
+ auto txIds = TxAllocatorClient.AllocateTxIds(1, ctx);
+ if (!txIds) {
LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
"actor# " << SelfId() <<
" Cookie# " << (ui64)ev->Cookie <<
@@ -362,7 +362,7 @@ class TTxProxy : public TActorBootstrapped<TTxProxy> {
return DelayRequest(ev, ctx);
}
- ProcessRequest(ev, ctx, txIds.front());
+ ProcessRequest(ev, ctx, txIds.front());
}
void ProcessRequest(TEvTxUserProxy::TEvAllocateTxId::TPtr &ev, const TActorContext &ctx, ui64 txId) {
@@ -374,8 +374,8 @@ class TTxProxy : public TActorBootstrapped<TTxProxy> {
LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
"actor# " << SelfId() << " Handle TEvAllocateTxId");
- auto txIds = TxAllocatorClient.AllocateTxIds(1, ctx);
- if (!txIds) {
+ auto txIds = TxAllocatorClient.AllocateTxIds(1, ctx);
+ if (!txIds) {
LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
"actor# " << SelfId()
<< " Cookie# " << ev->Cookie
@@ -384,7 +384,7 @@ class TTxProxy : public TActorBootstrapped<TTxProxy> {
return DelayRequest(ev, ctx);
}
- ProcessRequest(ev, ctx, txIds.front());
+ ProcessRequest(ev, ctx, txIds.front());
}
void Handle(TEvTxUserProxy::TEvGetProxyServicesRequest::TPtr &ev, const TActorContext &ctx) {
@@ -397,27 +397,27 @@ class TTxProxy : public TActorBootstrapped<TTxProxy> {
void Handle(TEvTxUserProxy::TEvNavigate::TPtr &ev, const TActorContext &ctx) {
TString path = ev->Get()->Record.GetDescribePath().GetPath();
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
- "actor# " << SelfId() <<
- " Handle TEvNavigate " <<
- " describe path " << path);
-
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
+ "actor# " << SelfId() <<
+ " Handle TEvNavigate " <<
+ " describe path " << path);
+
TxProxyMon->Navigate->Inc();
TActorId reqId = ctx.ExecutorThread.RegisterActor(CreateTxProxyDescribeFlatSchemeReq(Services, TxProxyMon));
ctx.Send(reqId, new TEvTxProxyReq::TEvNavigateScheme(ev));
}
void Handle(TEvTxUserProxy::TEvInvalidateTable::TPtr &ev, const TActorContext &ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
- "actor# " << SelfId() <<
- " HANDLE EvInvalidateTable");
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
+ "actor# " << SelfId() <<
+ " HANDLE EvInvalidateTable");
ctx.Send(Services.SchemeCache, new TEvTxProxySchemeCache::TEvInvalidateTable(TTableId(ev.Get()->Get()->Record.GetSchemeShardId(), ev.Get()->Get()->Record.GetTableId()), ev.Get()->Sender));
}
void Handle(TEvTxProxySchemeCache::TEvInvalidateTableResult::TPtr &ev, const TActorContext &ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
- "actor# " << SelfId() <<
- " HANDLE EvInvalidateTableResult");
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
+ "actor# " << SelfId() <<
+ " HANDLE EvInvalidateTableResult");
ctx.Send(ev.Get()->Get()->Sender, new TEvTxUserProxy::TEvInvalidateTableResult);
}
@@ -425,18 +425,18 @@ public:
TTxProxy(const TVector<ui64> &txAllocators)
: PipeClientCache(NTabletPipe::CreateUnboundedClientCache(GetPipeClientConfig()))
, TxAllocatorClient(NKikimrServices::TX_PROXY, PipeClientCache.Get(), txAllocators)
- {
+ {
}
- void Bootstrap(const TActorContext &ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
- "actor# " << SelfId() <<
- " Bootstrap");
- TxProxyMon = new TTxProxyMon(AppData(ctx)->Counters);
+ void Bootstrap(const TActorContext &ctx) {
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
+ "actor# " << SelfId() <<
+ " Bootstrap");
+ TxProxyMon = new TTxProxyMon(AppData(ctx)->Counters);
CacheCounters = GetServiceCounters(AppData(ctx)->Counters, "proxy")->GetSubgroup("subsystem", "cache");
-
- Services.Proxy = SelfId();
-
+
+ Services.Proxy = SelfId();
+
auto cacheConfig = MakeIntrusive<NSchemeCache::TSchemeCacheConfig>(AppData(ctx), CacheCounters);
Services.SchemeCache = ctx.ExecutorThread.RegisterActor(CreateSchemeBoardSchemeCache(cacheConfig.Get()));
ctx.ExecutorThread.ActorSystem->RegisterLocalService(MakeSchemeCacheID(), Services.SchemeCache);
@@ -444,13 +444,13 @@ public:
// PipePeNodeCaches are an external dependency
Services.LeaderPipeCache = MakePipePeNodeCacheID(false);
Services.FollowerPipeCache = MakePipePeNodeCacheID(true);
-
+
TxAllocatorClient.Bootstrap(ctx);
-
- Become(&TThis::StateWork);
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
- "actor# " << SelfId() <<
- " Become StateWork");
+
+ Become(&TThis::StateWork);
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
+ "actor# " << SelfId() <<
+ " Become StateWork");
}
static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
@@ -459,16 +459,16 @@ public:
STFUNC(StateWork) {
switch (ev->GetTypeRewrite()) {
- HFunc(TEvTabletPipe::TEvClientDestroyed, Handle);
- HFunc(TEvTabletPipe::TEvClientConnected, Handle);
- HFunc(TEvTxAllocator::TEvAllocateResult, Handle);
-
- HFunc(TEvTxUserProxy::TEvNavigate, Handle);
+ HFunc(TEvTabletPipe::TEvClientDestroyed, Handle);
+ HFunc(TEvTabletPipe::TEvClientConnected, Handle);
+ HFunc(TEvTxAllocator::TEvAllocateResult, Handle);
+
+ HFunc(TEvTxUserProxy::TEvNavigate, Handle);
HFunc(TEvTxUserProxy::TEvProposeTransaction, Handle);
-
+
HFunc(TEvTxUserProxy::TEvInvalidateTable, Handle);
- HFunc(TEvTxProxySchemeCache::TEvInvalidateTableResult, Handle);
-
+ HFunc(TEvTxProxySchemeCache::TEvInvalidateTableResult, Handle);
+
HFunc(TEvTxUserProxy::TEvProposeKqpTransaction, Handle);
HFunc(TEvTxUserProxy::TEvAllocateTxId, Handle);
@@ -476,22 +476,22 @@ public:
HFunc(TEvents::TEvPoisonPill, Handle);
default:
- LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY,
- "actor# " << SelfId() <<
- " IGNORING message type# " << ev->GetTypeRewrite() <<
- " from Sender# " << ev->Sender.ToString() <<
- " at StateWork");
+ LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY,
+ "actor# " << SelfId() <<
+ " IGNORING message type# " << ev->GetTypeRewrite() <<
+ " from Sender# " << ev->Sender.ToString() <<
+ " at StateWork");
break;
}
}
};
-const TDuration TTxProxy::TimeoutDelayedRequest = TDuration::Seconds(15);
-
+const TDuration TTxProxy::TimeoutDelayedRequest = TDuration::Seconds(15);
+
}
IActor* CreateTxProxy(const TVector<ui64> &allocators) {
- return new NTxProxy::TTxProxy(allocators);
+ return new NTxProxy::TTxProxy(allocators);
}
}
diff --git a/ydb/core/tx/tx_proxy/proxy_ut.cpp b/ydb/core/tx/tx_proxy/proxy_ut.cpp
index 1ea29692b37..eba78928c5a 100644
--- a/ydb/core/tx/tx_proxy/proxy_ut.cpp
+++ b/ydb/core/tx/tx_proxy/proxy_ut.cpp
@@ -1,966 +1,966 @@
-#include "proxy_ut_helpers.h"
-
+#include "proxy_ut_helpers.h"
+
#include <ydb/core/base/path.h>
#include <ydb/library/aclib/aclib.h>
-
-using namespace NKikimr;
-using namespace NTxProxyUT;
-using namespace NHelpers;
-
+
+using namespace NKikimr;
+using namespace NTxProxyUT;
+using namespace NHelpers;
+
Y_UNIT_TEST_SUITE(TSubDomainTest) {
- NKikimrSchemeOp::TTableDescription GetTableSimpleDescription(const TString &name) {
- NKikimrSchemeOp::TTableDescription tableDescr;
- tableDescr.SetName(name);
- {
- auto *c1 = tableDescr.AddColumns();
- c1->SetName("key");
- c1->SetType("Uint64");
- }
- {
- auto *c2 = tableDescr.AddColumns();
- c2->SetName("value");
- c2->SetType("Uint64");
- }
- tableDescr.SetUniformPartitionsCount(2);
+ NKikimrSchemeOp::TTableDescription GetTableSimpleDescription(const TString &name) {
+ NKikimrSchemeOp::TTableDescription tableDescr;
+ tableDescr.SetName(name);
+ {
+ auto *c1 = tableDescr.AddColumns();
+ c1->SetName("key");
+ c1->SetType("Uint64");
+ }
+ {
+ auto *c2 = tableDescr.AddColumns();
+ c2->SetName("value");
+ c2->SetType("Uint64");
+ }
+ tableDescr.SetUniformPartitionsCount(2);
tableDescr.MutablePartitionConfig()->SetFollowerCount(2);
- *tableDescr.AddKeyColumnNames() = "key";
- return tableDescr;
- }
-
- void SetRowInSimpletable(TTestEnv& env, ui64 key, ui64 value, const TString &path) {
- NKikimrMiniKQL::TResult res;
- TString query = Sprintf("("
- "(let row '('('key (Uint64 '%" PRIu64 "))))"
- "(let myUpd '("
- " '('value (Uint64 '%" PRIu64 "))"
- "))"
- "(let pgmReturn (AsList"
- " (UpdateRow '%s row myUpd)"
- "))"
- "(return pgmReturn)"
- ")", key, value, path.c_str());
-
- env.GetClient().FlatQuery(query, res);
- }
-
+ *tableDescr.AddKeyColumnNames() = "key";
+ return tableDescr;
+ }
+
+ void SetRowInSimpletable(TTestEnv& env, ui64 key, ui64 value, const TString &path) {
+ NKikimrMiniKQL::TResult res;
+ TString query = Sprintf("("
+ "(let row '('('key (Uint64 '%" PRIu64 "))))"
+ "(let myUpd '("
+ " '('value (Uint64 '%" PRIu64 "))"
+ "))"
+ "(let pgmReturn (AsList"
+ " (UpdateRow '%s row myUpd)"
+ "))"
+ "(return pgmReturn)"
+ ")", key, value, path.c_str());
+
+ env.GetClient().FlatQuery(query, res);
+ }
+
Y_UNIT_TEST(Boot) {
- TTestEnv env;
- auto lsroot = env.GetClient().Ls("/");
- Print(lsroot);
-
- {
- auto ls = env.GetClient().Ls(env.GetRoot());
- Print(ls);
- NTestLs::Finished(ls);
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
- }
- }
-
+ TTestEnv env;
+ auto lsroot = env.GetClient().Ls("/");
+ Print(lsroot);
+
+ {
+ auto ls = env.GetClient().Ls(env.GetRoot());
+ Print(ls);
+ NTestLs::Finished(ls);
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
+ }
+ }
+
Y_UNIT_TEST(LsLs) {
- TTestEnv env;
-
- {
+ TTestEnv env;
+
+ {
auto subdomain = GetSubDomainDeclareSetting("USER_0", env.GetPools());
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain));
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::Finished(ls, NKikimrSchemeOp::EPathTypeSubDomain);
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeSubDomain);
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
- }
-
- {
- auto ls = env.GetClient().Ls(env.GetRoot());
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
- }
- }
-
- Y_UNIT_TEST(LsAltered) {
- TTestEnv env;
-
- {
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain));
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::Finished(ls, NKikimrSchemeOp::EPathTypeSubDomain);
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeSubDomain);
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
+ }
+
+ {
+ auto ls = env.GetClient().Ls(env.GetRoot());
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
+ }
+ }
+
+ Y_UNIT_TEST(LsAltered) {
+ TTestEnv env;
+
+ {
auto subdomain = GetSubDomainDeclareSetting("USER_0", env.GetPools());
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain));
- }
-
- {
- auto subdomain = GetSubDomainDefaultSetting("USER_0");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS, env.GetClient().AlterSubdomain("/dc-1", subdomain, TDuration::MilliSeconds(500)));
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeSubDomain);
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3); // alter is in progress and isn't finish yet
- }
-
- {
- auto ls = env.GetClient().Ls(env.GetRoot());
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
- }
- }
-
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain));
+ }
+
+ {
+ auto subdomain = GetSubDomainDefaultSetting("USER_0");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS, env.GetClient().AlterSubdomain("/dc-1", subdomain, TDuration::MilliSeconds(500)));
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeSubDomain);
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3); // alter is in progress and isn't finish yet
+ }
+
+ {
+ auto ls = env.GetClient().Ls(env.GetRoot());
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
+ }
+ }
+
Y_UNIT_TEST(CreateTablet) {
- TTestEnv env(3,2);
-
- ui64 owner = THash<TString>()("CreateTablet");
- ui64 index = 1;
- TAutoPtr<NMsgBusProxy::TBusResponse> resp = env.GetClient().HiveCreateTablet(
+ TTestEnv env(3,2);
+
+ ui64 owner = THash<TString>()("CreateTablet");
+ ui64 index = 1;
+ TAutoPtr<NMsgBusProxy::TBusResponse> resp = env.GetClient().HiveCreateTablet(
env.GetSettings().Domain, owner, index, TTabletTypes::TX_DUMMY, {}, {});
- NKikimrClient::TResponse& record = resp->Record;
-
- UNIT_ASSERT_VALUES_EQUAL(record.CreateTabletResultSize(), 1);
- const auto& result = record.GetCreateTabletResult(0);
-
- UNIT_ASSERT_EQUAL(
- NKikimrProto::OK,
- result.GetStatus());
-
- UNIT_ASSERT(
- env.GetClient().TabletExistsInHive(&env.GetRuntime(), result.GetTabletId()));
-
- UNIT_ASSERT(
- env.GetClient().WaitForTabletAlive(&env.GetRuntime(), result.GetTabletId(), true, WaitTimeOut));
- }
-
+ NKikimrClient::TResponse& record = resp->Record;
+
+ UNIT_ASSERT_VALUES_EQUAL(record.CreateTabletResultSize(), 1);
+ const auto& result = record.GetCreateTabletResult(0);
+
+ UNIT_ASSERT_EQUAL(
+ NKikimrProto::OK,
+ result.GetStatus());
+
+ UNIT_ASSERT(
+ env.GetClient().TabletExistsInHive(&env.GetRuntime(), result.GetTabletId()));
+
+ UNIT_ASSERT(
+ env.GetClient().WaitForTabletAlive(&env.GetRuntime(), result.GetTabletId(), true, WaitTimeOut));
+ }
+
Y_UNIT_TEST(CreateTabletForUnknownDomain) {
- TTestEnv env;
-
- ui64 owner = THash<TString>()("CreateTabletForUnknownDomain");
- ui64 index = 1;
- TVector<TSubDomainKey> allowed_domains;
- allowed_domains.push_back(TSubDomainKey(999, 999));
-
- TAutoPtr<NMsgBusProxy::TBusResponse> resp = env.GetClient().HiveCreateTablet(
+ TTestEnv env;
+
+ ui64 owner = THash<TString>()("CreateTabletForUnknownDomain");
+ ui64 index = 1;
+ TVector<TSubDomainKey> allowed_domains;
+ allowed_domains.push_back(TSubDomainKey(999, 999));
+
+ TAutoPtr<NMsgBusProxy::TBusResponse> resp = env.GetClient().HiveCreateTablet(
env.GetSettings().Domain, owner, index, TTabletTypes::TX_DUMMY, {}, allowed_domains);
- NKikimrClient::TResponse& record = resp->Record;
-
- UNIT_ASSERT_VALUES_EQUAL(record.CreateTabletResultSize(), 1);
- const auto& result = record.GetCreateTabletResult(0);
-
- UNIT_ASSERT_EQUAL(
- NKikimrProto::OK,
- result.GetStatus());
-
- UNIT_ASSERT(
- env.GetClient().TabletExistsInHive(&env.GetRuntime(), result.GetTabletId()));
-
- UNIT_ASSERT(
- env.GetClient().WaitForTabletDown(&env.GetRuntime(), result.GetTabletId(), true, WaitTimeOut));
-
- UNIT_ASSERT_EQUAL(
- Max<ui32>(),
+ NKikimrClient::TResponse& record = resp->Record;
+
+ UNIT_ASSERT_VALUES_EQUAL(record.CreateTabletResultSize(), 1);
+ const auto& result = record.GetCreateTabletResult(0);
+
+ UNIT_ASSERT_EQUAL(
+ NKikimrProto::OK,
+ result.GetStatus());
+
+ UNIT_ASSERT(
+ env.GetClient().TabletExistsInHive(&env.GetRuntime(), result.GetTabletId()));
+
+ UNIT_ASSERT(
+ env.GetClient().WaitForTabletDown(&env.GetRuntime(), result.GetTabletId(), true, WaitTimeOut));
+
+ UNIT_ASSERT_EQUAL(
+ Max<ui32>(),
env.GetClient().GetLeaderNode(&env.GetRuntime(), result.GetTabletId()));
- }
-
+ }
+
Y_UNIT_TEST(CreateDummyTabletsInDifferentDomains) {
- TTestEnv env(1, 2);
-
- ui64 tablet_in_first_domain = CreateSubDomainAndTabletInside(env, "USER_0", 1);
- ui64 tablet_in_second_domain = CreateSubDomainAndTabletInside(env, "USER_1", 2);
-
- CheckTableIsOfline(env, tablet_in_first_domain);
- CheckTableIsOfline(env, tablet_in_second_domain);
-
- env.GetTenants().Run("/dc-1/USER_0");
- CheckTableBecomeAlive(env, tablet_in_first_domain);
- CheckTableRunOnProperTenantNode(env, "/dc-1/USER_0", tablet_in_first_domain);
-
- env.GetTenants().Run("/dc-1/USER_1");
- CheckTableBecomeAlive(env, tablet_in_second_domain);
- CheckTableRunOnProperTenantNode(env, "/dc-1/USER_1", tablet_in_second_domain);
-
- env.GetTenants().Stop("/dc-1/USER_0");
- CheckTableBecomeOfline(env, tablet_in_first_domain);
-
- env.GetTenants().Stop("/dc-1/USER_1");
- CheckTableBecomeOfline(env, tablet_in_second_domain);
-
- env.GetTenants().Run("/dc-1/USER_0");
- env.GetTenants().Run("/dc-1/USER_1");
- CheckTableBecomeAlive(env, tablet_in_first_domain);
- CheckTableBecomeAlive(env, tablet_in_second_domain);
-
- CheckTableRunOnProperTenantNode(env, "/dc-1/USER_0", tablet_in_first_domain);
- CheckTableRunOnProperTenantNode(env, "/dc-1/USER_1", tablet_in_second_domain);
- }
-
+ TTestEnv env(1, 2);
+
+ ui64 tablet_in_first_domain = CreateSubDomainAndTabletInside(env, "USER_0", 1);
+ ui64 tablet_in_second_domain = CreateSubDomainAndTabletInside(env, "USER_1", 2);
+
+ CheckTableIsOfline(env, tablet_in_first_domain);
+ CheckTableIsOfline(env, tablet_in_second_domain);
+
+ env.GetTenants().Run("/dc-1/USER_0");
+ CheckTableBecomeAlive(env, tablet_in_first_domain);
+ CheckTableRunOnProperTenantNode(env, "/dc-1/USER_0", tablet_in_first_domain);
+
+ env.GetTenants().Run("/dc-1/USER_1");
+ CheckTableBecomeAlive(env, tablet_in_second_domain);
+ CheckTableRunOnProperTenantNode(env, "/dc-1/USER_1", tablet_in_second_domain);
+
+ env.GetTenants().Stop("/dc-1/USER_0");
+ CheckTableBecomeOfline(env, tablet_in_first_domain);
+
+ env.GetTenants().Stop("/dc-1/USER_1");
+ CheckTableBecomeOfline(env, tablet_in_second_domain);
+
+ env.GetTenants().Run("/dc-1/USER_0");
+ env.GetTenants().Run("/dc-1/USER_1");
+ CheckTableBecomeAlive(env, tablet_in_first_domain);
+ CheckTableBecomeAlive(env, tablet_in_second_domain);
+
+ CheckTableRunOnProperTenantNode(env, "/dc-1/USER_0", tablet_in_first_domain);
+ CheckTableRunOnProperTenantNode(env, "/dc-1/USER_1", tablet_in_second_domain);
+ }
+
Y_UNIT_TEST(StartAndStopTenanNode) {
- TTestEnv env(1, 1);
-
+ TTestEnv env(1, 1);
+
auto subdomain_0 = GetSubDomainDeclareSetting("USER_0", env.GetPools());
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain_0));
-
- env.GetTenants().Run("/dc-1/USER_0");
- env.GetTenants().Stop();
- }
-
- Y_UNIT_TEST(CreateTableInsideAndForceDeleteSubDomain) {
- TTestEnv env(1, 1);
-
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain_0));
+
+ env.GetTenants().Run("/dc-1/USER_0");
+ env.GetTenants().Stop();
+ }
+
+ Y_UNIT_TEST(CreateTableInsideAndForceDeleteSubDomain) {
+ TTestEnv env(1, 1);
+
auto subdomain_0 = GetSubDomainDeclareSetting("USER_0", env.GetPools());
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain_0));
-
- {
- auto subdomain = GetSubDomainDefaultSetting("USER_0");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS, env.GetClient().AlterSubdomain("/dc-1", subdomain, TDuration::MilliSeconds(500)));
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
- }
- }
-
- env.GetTenants().Run("/dc-1/USER_0");
-
- auto tableDesc = GetTableSimpleDescription("SimpleTable");
- UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
- NMsgBusProxy::MSTATUS_OK);
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 3);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 6);
- }
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
- }
-
- Y_UNIT_TEST(CreateTableInsidetThenStopTenantAndForceDeleteSubDomain) {
- TTestEnv env(1, 1);
-
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain_0));
+
+ {
+ auto subdomain = GetSubDomainDefaultSetting("USER_0");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS, env.GetClient().AlterSubdomain("/dc-1", subdomain, TDuration::MilliSeconds(500)));
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
+ }
+ }
+
+ env.GetTenants().Run("/dc-1/USER_0");
+
+ auto tableDesc = GetTableSimpleDescription("SimpleTable");
+ UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
+ NMsgBusProxy::MSTATUS_OK);
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 3);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 6);
+ }
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
+ }
+
+ Y_UNIT_TEST(CreateTableInsidetThenStopTenantAndForceDeleteSubDomain) {
+ TTestEnv env(1, 1);
+
auto subdomain_0 = GetSubDomainDeclareSetting("USER_0", env.GetPools());
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain_0));
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
- }
-
- env.GetTenants().Run("/dc-1/USER_0");
-
- {
- auto subdomain = GetSubDomainDefaultSetting("USER_0");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().AlterSubdomain("/dc-1", subdomain));
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 4);
- }
-
- auto tableDesc = GetTableSimpleDescription("SimpleTable");
- UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
- NMsgBusProxy::MSTATUS_OK);
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 3);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 6);
- }
-
- env.GetTenants().Stop();
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
- }
-
- Y_UNIT_TEST(DeleteTableAndThenForceDeleteSubDomain) {
- TTestEnv env(1, 1);
-
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain_0));
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
+ }
+
+ env.GetTenants().Run("/dc-1/USER_0");
+
+ {
+ auto subdomain = GetSubDomainDefaultSetting("USER_0");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().AlterSubdomain("/dc-1", subdomain));
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 4);
+ }
+
+ auto tableDesc = GetTableSimpleDescription("SimpleTable");
+ UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
+ NMsgBusProxy::MSTATUS_OK);
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 3);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 6);
+ }
+
+ env.GetTenants().Stop();
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
+ }
+
+ Y_UNIT_TEST(DeleteTableAndThenForceDeleteSubDomain) {
+ TTestEnv env(1, 1);
+
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0", env.GetPools())));
-
- env.GetTenants().Run("/dc-1/USER_0");
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0")));
-
- auto tableDesc = GetTableSimpleDescription("SimpleTable");
- UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
- NMsgBusProxy::MSTATUS_OK);
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
- }
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().DeleteTable("/dc-1/USER_0", "SimpleTable"));
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
- }
-
+
+ env.GetTenants().Run("/dc-1/USER_0");
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0")));
+
+ auto tableDesc = GetTableSimpleDescription("SimpleTable");
+ UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
+ NMsgBusProxy::MSTATUS_OK);
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
+ }
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().DeleteTable("/dc-1/USER_0", "SimpleTable"));
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
+ }
+
Y_UNIT_TEST(StartTenanNodeAndStopAtDestructor) {
- TTestEnv env(1, 1);
-
+ TTestEnv env(1, 1);
+
auto subdomain_0 = GetSubDomainDeclareSetting("USER_0", env.GetPools());
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain_0));
-
- env.GetTenants().Run("/dc-1/USER_0");
- }
-
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain_0));
+
+ env.GetTenants().Run("/dc-1/USER_0");
+ }
+
Y_UNIT_TEST(CreateTableInsideSubDomain) {
- TTestEnv env(1, 1);
-
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ TTestEnv env(1, 1);
+
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0", env.GetPools())));
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
- }
-
- env.GetTenants().Run("/dc-1/USER_0");
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0")));
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 4);
- }
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().CreateTable("/dc-1/USER_0", GetTableSimpleDescription("SimpleTable")));
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 6);
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
- }
- }
-
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
+ }
+
+ env.GetTenants().Run("/dc-1/USER_0");
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0")));
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 4);
+ }
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().CreateTable("/dc-1/USER_0", GetTableSimpleDescription("SimpleTable")));
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 6);
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
+ }
+ }
+
Y_UNIT_TEST(FailIfAffectedSetNotInterior) {
- TTestEnv env(1, 2);
-
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ TTestEnv env(1, 2);
+
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0", env.GetPools())));
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0"), TDuration::MilliSeconds(500)));
- env.GetTenants().Run("/dc-1/USER_0");
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0"), TDuration::MilliSeconds(500)));
+ env.GetTenants().Run("/dc-1/USER_0");
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_1", env.GetPools())));
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_1"), TDuration::MilliSeconds(500)));
- env.GetTenants().Run("/dc-1/USER_1");
-
- auto tableDesc = GetTableSimpleDescription("SimpleTable");
- UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
- NMsgBusProxy::MSTATUS_OK);
-
- UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_1", tableDesc),
- NMsgBusProxy::MSTATUS_OK);
-
- UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1", tableDesc),
- NMsgBusProxy::MSTATUS_OK);
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_1/SimpleTable");
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1/SimpleTable");
- NTestLs::NotInSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
- }
-
- SetRowInSimpletable(env, 42, 111, "/dc-1/USER_0/SimpleTable");
- SetRowInSimpletable(env, 42, 222, "/dc-1/USER_1/SimpleTable");
- SetRowInSimpletable(env, 42, 333, "/dc-1/SimpleTable");
-
- {//transation intersect SubDomain and domain
- NKikimrMiniKQL::TResult res;
- Tests::TClient::TFlatQueryOptions opts;
-
- NKikimrClient::TResponse expectedResponse;
- expectedResponse.SetStatus(NMsgBusProxy::MSTATUS_ERROR);
- expectedResponse.SetProxyErrorCode(NTxProxy::TResultStatus::DomainLocalityError);
-
- env.GetClient().FlatQuery("("
- "(let row0_ '('('key (Uint64 '42))))"
- "(let cols_ '('value))"
- "(let select0_ (SelectRow '/dc-1/SimpleTable row0_ cols_))"
- "(let select1_ (SelectRow '/dc-1/USER_0/SimpleTable row0_ cols_))"
- "(let ret_ (AsList"
- " (SetResult 'res0_ select0_)"
- " (SetResult 'res1_ select1_)"
- "))"
- "(return ret_)"
- ")", opts, res, expectedResponse);
- }
-
- {//transation intersect SubDomain and another SubDomain
- NKikimrMiniKQL::TResult res;
- Tests::TClient::TFlatQueryOptions opts;
-
- NKikimrClient::TResponse expectedResponse;
- expectedResponse.SetStatus(NMsgBusProxy::MSTATUS_ERROR);
- expectedResponse.SetProxyErrorCode(NTxProxy::TResultStatus::DomainLocalityError);
-
- env.GetClient().FlatQuery("("
- "(let row0_ '('('key (Uint64 '42))))"
- "(let cols_ '('value))"
- "(let select0_ (SelectRow '/dc-1/USER_1/SimpleTable row0_ cols_))"
- "(let select1_ (SelectRow '/dc-1/USER_0/SimpleTable row0_ cols_))"
- "(let ret_ (AsList"
- " (SetResult 'res0_ select0_)"
- " (SetResult 'res1_ select1_)"
- "))"
- "(return ret_)"
- ")", opts, res, expectedResponse);
- }
- }
-
-
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_1"), TDuration::MilliSeconds(500)));
+ env.GetTenants().Run("/dc-1/USER_1");
+
+ auto tableDesc = GetTableSimpleDescription("SimpleTable");
+ UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
+ NMsgBusProxy::MSTATUS_OK);
+
+ UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_1", tableDesc),
+ NMsgBusProxy::MSTATUS_OK);
+
+ UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1", tableDesc),
+ NMsgBusProxy::MSTATUS_OK);
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_1/SimpleTable");
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/SimpleTable");
+ NTestLs::NotInSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
+ }
+
+ SetRowInSimpletable(env, 42, 111, "/dc-1/USER_0/SimpleTable");
+ SetRowInSimpletable(env, 42, 222, "/dc-1/USER_1/SimpleTable");
+ SetRowInSimpletable(env, 42, 333, "/dc-1/SimpleTable");
+
+ {//transation intersect SubDomain and domain
+ NKikimrMiniKQL::TResult res;
+ Tests::TClient::TFlatQueryOptions opts;
+
+ NKikimrClient::TResponse expectedResponse;
+ expectedResponse.SetStatus(NMsgBusProxy::MSTATUS_ERROR);
+ expectedResponse.SetProxyErrorCode(NTxProxy::TResultStatus::DomainLocalityError);
+
+ env.GetClient().FlatQuery("("
+ "(let row0_ '('('key (Uint64 '42))))"
+ "(let cols_ '('value))"
+ "(let select0_ (SelectRow '/dc-1/SimpleTable row0_ cols_))"
+ "(let select1_ (SelectRow '/dc-1/USER_0/SimpleTable row0_ cols_))"
+ "(let ret_ (AsList"
+ " (SetResult 'res0_ select0_)"
+ " (SetResult 'res1_ select1_)"
+ "))"
+ "(return ret_)"
+ ")", opts, res, expectedResponse);
+ }
+
+ {//transation intersect SubDomain and another SubDomain
+ NKikimrMiniKQL::TResult res;
+ Tests::TClient::TFlatQueryOptions opts;
+
+ NKikimrClient::TResponse expectedResponse;
+ expectedResponse.SetStatus(NMsgBusProxy::MSTATUS_ERROR);
+ expectedResponse.SetProxyErrorCode(NTxProxy::TResultStatus::DomainLocalityError);
+
+ env.GetClient().FlatQuery("("
+ "(let row0_ '('('key (Uint64 '42))))"
+ "(let cols_ '('value))"
+ "(let select0_ (SelectRow '/dc-1/USER_1/SimpleTable row0_ cols_))"
+ "(let select1_ (SelectRow '/dc-1/USER_0/SimpleTable row0_ cols_))"
+ "(let ret_ (AsList"
+ " (SetResult 'res0_ select0_)"
+ " (SetResult 'res1_ select1_)"
+ "))"
+ "(return ret_)"
+ ")", opts, res, expectedResponse);
+ }
+ }
+
+
Y_UNIT_TEST(GenericCases) {
- TTestEnv env(1, 1);
-
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ TTestEnv env(1, 1);
+
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0", env.GetPools())));
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0"), TDuration::MilliSeconds(500)));
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeSubDomain);
- }
-
- env.GetTenants().Run("/dc-1/USER_0");
-
- {
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0", "dir"));
- auto ls = env.GetClient().Ls("/dc-1/USER_0/dir");
- NTestLs::InSubdomain(ls);
- }
-
- {
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1", "dir"));
- auto ls = env.GetClient().Ls("/dc-1/dir");
- NTestLs::NotInSubdomain(ls);
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1");
- NTestLs::NotInSubdomain(ls);
- }
-
- {
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0/dir", "dir_0"));
- auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_0");
- NTestLs::InSubdomain(ls);
- }
-
- {
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0/dir", "dir_1"));
- auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_1");
- NTestLs::InSubdomain(ls);
- }
-
- {
- auto tableDesc = GetTableSimpleDescription("table");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0/dir/dir_0", tableDesc));
- auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_0/table");
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
- }
-
- {
- auto tableDesc = GetTableSimpleDescription("table");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0/dir/dir_1", tableDesc));
- auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_1/table");
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
- }
-
- SetRowInSimpletable(env, 42, 111, "/dc-1/USER_0/dir/dir_0/table");
- SetRowInSimpletable(env, 42, 111, "/dc-1/USER_0/dir/dir_1/table");
-
- {
- NKikimrMiniKQL::TResult result;
- env.GetClient().FlatQuery("("
- "(let row0_ '('('key (Uint64 '42))))"
- "(let cols_ '('value))"
- "(let select0_ (SelectRow '/dc-1/USER_0/dir/dir_0/table row0_ cols_))"
- "(let select1_ (SelectRow '/dc-1/USER_0/dir/dir_1/table row0_ cols_))"
- "(let ret_ (AsList"
- " (SetResult 'res0_ select0_)"
- " (SetResult 'res1_ select1_)"
- "))"
- "(return ret_)"
- ")", result);
- }
- }
-
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0"), TDuration::MilliSeconds(500)));
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeSubDomain);
+ }
+
+ env.GetTenants().Run("/dc-1/USER_0");
+
+ {
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0", "dir"));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/dir");
+ NTestLs::InSubdomain(ls);
+ }
+
+ {
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1", "dir"));
+ auto ls = env.GetClient().Ls("/dc-1/dir");
+ NTestLs::NotInSubdomain(ls);
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1");
+ NTestLs::NotInSubdomain(ls);
+ }
+
+ {
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0/dir", "dir_0"));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_0");
+ NTestLs::InSubdomain(ls);
+ }
+
+ {
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0/dir", "dir_1"));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_1");
+ NTestLs::InSubdomain(ls);
+ }
+
+ {
+ auto tableDesc = GetTableSimpleDescription("table");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0/dir/dir_0", tableDesc));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_0/table");
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
+ }
+
+ {
+ auto tableDesc = GetTableSimpleDescription("table");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0/dir/dir_1", tableDesc));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_1/table");
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
+ }
+
+ SetRowInSimpletable(env, 42, 111, "/dc-1/USER_0/dir/dir_0/table");
+ SetRowInSimpletable(env, 42, 111, "/dc-1/USER_0/dir/dir_1/table");
+
+ {
+ NKikimrMiniKQL::TResult result;
+ env.GetClient().FlatQuery("("
+ "(let row0_ '('('key (Uint64 '42))))"
+ "(let cols_ '('value))"
+ "(let select0_ (SelectRow '/dc-1/USER_0/dir/dir_0/table row0_ cols_))"
+ "(let select1_ (SelectRow '/dc-1/USER_0/dir/dir_1/table row0_ cols_))"
+ "(let ret_ (AsList"
+ " (SetResult 'res0_ select0_)"
+ " (SetResult 'res1_ select1_)"
+ "))"
+ "(return ret_)"
+ ")", result);
+ }
+ }
+
Y_UNIT_TEST(DatashardNotRunAtAllWhenSubDomainNodesIsStopped) {
- TTestEnv env(1, 1);
-
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ TTestEnv env(1, 1);
+
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0", env.GetPools())));
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0"), TDuration::MilliSeconds(500)));
-
- env.GetTenants().Run("/dc-1/USER_0");
-
- //create table
- auto tableDesc = GetTableSimpleDescription("table");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0", tableDesc));
-
- auto partitions = NTestLs::ExtractTablePartitions(env.GetClient().Ls("/dc-1/USER_0/table"));
- ui64 somedatashard = partitions.back().GetDatashardId();
-
- //datashard run on dynamic node
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0"), TDuration::MilliSeconds(500)));
+
+ env.GetTenants().Run("/dc-1/USER_0");
+
+ //create table
+ auto tableDesc = GetTableSimpleDescription("table");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0", tableDesc));
+
+ auto partitions = NTestLs::ExtractTablePartitions(env.GetClient().Ls("/dc-1/USER_0/table"));
+ ui64 somedatashard = partitions.back().GetDatashardId();
+
+ //datashard run on dynamic node
ui32 nodeId = env.GetClient().GetLeaderNode(&env.GetRuntime(), somedatashard);
- UNIT_ASSERT(env.GetTenants().IsActive("/dc-1/USER_0", nodeId));
-
- env.GetTenants().Stop("/dc-1/USER_0");
- UNIT_ASSERT(env.GetClient().WaitForTabletDown(&env.GetRuntime(), somedatashard, true, WaitTimeOut));
-
- // make sure that hive has seen tablet stopped
+ UNIT_ASSERT(env.GetTenants().IsActive("/dc-1/USER_0", nodeId));
+
+ env.GetTenants().Stop("/dc-1/USER_0");
+ UNIT_ASSERT(env.GetClient().WaitForTabletDown(&env.GetRuntime(), somedatashard, true, WaitTimeOut));
+
+ // make sure that hive has seen tablet stopped
ui32 leaderNodeForDataShard = 1;
while (leaderNodeForDataShard != Max<ui32>()) {
leaderNodeForDataShard = env.GetClient().GetLeaderNode(&env.GetRuntime(), somedatashard);
- }
-
- //datashard is not running
+ }
+
+ //datashard is not running
UNIT_ASSERT_VALUES_EQUAL(Max<ui32>(), env.GetClient().GetLeaderNode(&env.GetRuntime(), somedatashard));
-
- //and there is no hope to run it up
- UNIT_ASSERT(!env.GetClient().WaitForTabletAlive(&env.GetRuntime(), somedatashard, true, WaitTimeOut));
- }
-
+
+ //and there is no hope to run it up
+ UNIT_ASSERT(!env.GetClient().WaitForTabletAlive(&env.GetRuntime(), somedatashard, true, WaitTimeOut));
+ }
+
Y_UNIT_TEST(DatashardRunAtOtherNodeWhenOneNodeIsStopped) {
- TTestEnv env(1, 2);
-
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ TTestEnv env(1, 2);
+
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0", env.GetPools())));
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0"), TDuration::MilliSeconds(500)));
-
- env.GetTenants().Run("/dc-1/USER_0", 2);
- UNIT_ASSERT_VALUES_EQUAL(2, env.GetTenants().Size("/dc-1/USER_0"));
-
- //create table
- auto tableDesc = GetTableSimpleDescription("table");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0", tableDesc));
-
- auto partitions = NTestLs::ExtractTablePartitions(env.GetClient().Ls("/dc-1/USER_0/table"));
- ui64 somedatashard = partitions.back().GetDatashardId();
-
- //datashard run on dynamic node
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0"), TDuration::MilliSeconds(500)));
+
+ env.GetTenants().Run("/dc-1/USER_0", 2);
+ UNIT_ASSERT_VALUES_EQUAL(2, env.GetTenants().Size("/dc-1/USER_0"));
+
+ //create table
+ auto tableDesc = GetTableSimpleDescription("table");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0", tableDesc));
+
+ auto partitions = NTestLs::ExtractTablePartitions(env.GetClient().Ls("/dc-1/USER_0/table"));
+ ui64 somedatashard = partitions.back().GetDatashardId();
+
+ //datashard run on dynamic node
ui32 nodeId = env.GetClient().GetLeaderNode(&env.GetRuntime(), somedatashard);
- UNIT_ASSERT(env.GetTenants().IsActive("/dc-1/USER_0", nodeId));
-
- //switch off the node
- env.GetTenants().FreeNode("/dc-1/USER_0", nodeId);
-
- //wait while datashards shutdown and wake up at second node
- env.GetClient().WaitForTabletDown(&env.GetRuntime(), somedatashard, true, WaitTimeOut);
- UNIT_ASSERT(env.GetClient().WaitForTabletAlive(&env.GetRuntime(), somedatashard, true, WaitTimeOut));
-
+ UNIT_ASSERT(env.GetTenants().IsActive("/dc-1/USER_0", nodeId));
+
+ //switch off the node
+ env.GetTenants().FreeNode("/dc-1/USER_0", nodeId);
+
+ //wait while datashards shutdown and wake up at second node
+ env.GetClient().WaitForTabletDown(&env.GetRuntime(), somedatashard, true, WaitTimeOut);
+ UNIT_ASSERT(env.GetClient().WaitForTabletAlive(&env.GetRuntime(), somedatashard, true, WaitTimeOut));
+
ui32 newNodeId = env.GetClient().GetLeaderNode(&env.GetRuntime(), somedatashard);
- UNIT_ASSERT(env.GetTenants().IsActive("/dc-1/USER_0", newNodeId));
- }
-
- Y_UNIT_TEST(CoordinatorRunAtSubdomainNodeWhenAvailable) {
- TTestEnv env(1, 5);
-
- {
- auto ls = env.GetClient().Ls("/dc-1");
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
- }
-
- {
+ UNIT_ASSERT(env.GetTenants().IsActive("/dc-1/USER_0", newNodeId));
+ }
+
+ Y_UNIT_TEST(CoordinatorRunAtSubdomainNodeWhenAvailable) {
+ TTestEnv env(1, 5);
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1");
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
+ }
+
+ {
auto subdomain = GetSubDomainDeclareSetting("USER_0", env.GetPools());
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain));
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1");
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
- }
-
- env.GetTenants().Run("/dc-1/USER_0", active_tenants_nodes);
-
- {
- auto subdomain = GetSubDomainDefaultSetting("USER_0");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().AlterSubdomain("/dc-1", subdomain));
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 4);
- }
-
- auto domaindescr = NTestLs::ExtractDomainDescription(env.GetClient().Ls("/dc-1/USER_0"));
-
- UNIT_ASSERT_VALUES_UNEQUAL(1, domaindescr.GetDomainKey().GetPathId());
- ui64 coordinator = domaindescr.GetProcessingParams().GetCoordinators(0);
-
- //coordinator runs on dynamic node
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain));
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1");
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
+ }
+
+ env.GetTenants().Run("/dc-1/USER_0", active_tenants_nodes);
+
+ {
+ auto subdomain = GetSubDomainDefaultSetting("USER_0");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().AlterSubdomain("/dc-1", subdomain));
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 4);
+ }
+
+ auto domaindescr = NTestLs::ExtractDomainDescription(env.GetClient().Ls("/dc-1/USER_0"));
+
+ UNIT_ASSERT_VALUES_UNEQUAL(1, domaindescr.GetDomainKey().GetPathId());
+ ui64 coordinator = domaindescr.GetProcessingParams().GetCoordinators(0);
+
+ //coordinator runs on dynamic node
ui32 nodeId = env.GetClient().GetLeaderNode(&env.GetRuntime(), coordinator);
- UNIT_ASSERT_C(env.GetTenants().IsActive("/dc-1/USER_0", nodeId), "assert IsActive nodeId " << nodeId);
-
- //create table, if it is OK then tenant node awakes
- auto tableDesc = GetTableSimpleDescription("table");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0", tableDesc));
-
- env.GetClient().MarkNodeInHive(&env.GetRuntime(), nodeId, false);
- env.GetClient().KickNodeInHive(&env.GetRuntime(), nodeId);
- env.GetClient().MarkNodeInHive(&env.GetRuntime(), nodeId, true);
- UNIT_ASSERT(env.GetClient().WaitForTabletAlive(&env.GetRuntime(), coordinator, true, WaitTimeOut));
-
- //coordinator runs on dynamic node
+ UNIT_ASSERT_C(env.GetTenants().IsActive("/dc-1/USER_0", nodeId), "assert IsActive nodeId " << nodeId);
+
+ //create table, if it is OK then tenant node awakes
+ auto tableDesc = GetTableSimpleDescription("table");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0", tableDesc));
+
+ env.GetClient().MarkNodeInHive(&env.GetRuntime(), nodeId, false);
+ env.GetClient().KickNodeInHive(&env.GetRuntime(), nodeId);
+ env.GetClient().MarkNodeInHive(&env.GetRuntime(), nodeId, true);
+ UNIT_ASSERT(env.GetClient().WaitForTabletAlive(&env.GetRuntime(), coordinator, true, WaitTimeOut));
+
+ //coordinator runs on dynamic node
ui32 newNodeId = env.GetClient().GetLeaderNode(&env.GetRuntime(), coordinator);
- UNIT_ASSERT_C(env.GetTenants().IsActive("/dc-1/USER_0", newNodeId), "assert IsActive nodeId " << nodeId);
-
- //coordinator no runs on static node, when dynamic is offline
- env.GetTenants().Stop("/dc-1/USER_0");
-
- UNIT_ASSERT(env.GetClient().WaitForTabletDown(&env.GetRuntime(), coordinator, true, WaitTimeOut));
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
- UNIT_ASSERT(!env.GetClient().TabletExistsInHive(&env.GetRuntime(), coordinator, false));
- }
-
- Y_UNIT_TEST(CoordinatorRunAtSubdomainNodeWhenAvailable2) {
- TTestEnv env(1, 5);
-
- {
- auto ls = env.GetClient().Ls("/dc-1");
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
- }
-
- {
+ UNIT_ASSERT_C(env.GetTenants().IsActive("/dc-1/USER_0", newNodeId), "assert IsActive nodeId " << nodeId);
+
+ //coordinator no runs on static node, when dynamic is offline
+ env.GetTenants().Stop("/dc-1/USER_0");
+
+ UNIT_ASSERT(env.GetClient().WaitForTabletDown(&env.GetRuntime(), coordinator, true, WaitTimeOut));
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
+ UNIT_ASSERT(!env.GetClient().TabletExistsInHive(&env.GetRuntime(), coordinator, false));
+ }
+
+ Y_UNIT_TEST(CoordinatorRunAtSubdomainNodeWhenAvailable2) {
+ TTestEnv env(1, 5);
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1");
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 3);
+ }
+
+ {
auto subdomain = GetSubDomainDeclareSetting("USER_0", env.GetPools());
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain));
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1");
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
- }
-
- {
- auto subdomain = GetSubDomainDefaultSetting("USER_0");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS, env.GetClient().AlterSubdomain("/dc-1", subdomain, TDuration::MilliSeconds(500)));
- }
-
- {
- auto tableDesc = GetTableSimpleDescription("table");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS, env.GetClient().CreateTable("/dc-1/USER_0", tableDesc, TDuration::Seconds(1)));
- }
-
- env.GetTenants().Run("/dc-1/USER_0", active_tenants_nodes);
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().WaitCreateTx(&env.GetRuntime(), "/dc-1/USER_0/table", WaitTimeOut));
-
- {
- auto ls = env.GetClient().Ls("/dc-1");
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 6);
- }
-
- auto domaindescr = NTestLs::ExtractDomainDescription(env.GetClient().Ls("/dc-1/USER_0"));
-
- UNIT_ASSERT_VALUES_UNEQUAL(1, domaindescr.GetDomainKey().GetPathId());
- ui64 coordinator = domaindescr.GetProcessingParams().GetCoordinators(0);
-
- //coordinator runs on dynamic node
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain));
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1");
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
+ }
+
+ {
+ auto subdomain = GetSubDomainDefaultSetting("USER_0");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS, env.GetClient().AlterSubdomain("/dc-1", subdomain, TDuration::MilliSeconds(500)));
+ }
+
+ {
+ auto tableDesc = GetTableSimpleDescription("table");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS, env.GetClient().CreateTable("/dc-1/USER_0", tableDesc, TDuration::Seconds(1)));
+ }
+
+ env.GetTenants().Run("/dc-1/USER_0", active_tenants_nodes);
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().WaitCreateTx(&env.GetRuntime(), "/dc-1/USER_0/table", WaitTimeOut));
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1");
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 1);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 6);
+ }
+
+ auto domaindescr = NTestLs::ExtractDomainDescription(env.GetClient().Ls("/dc-1/USER_0"));
+
+ UNIT_ASSERT_VALUES_UNEQUAL(1, domaindescr.GetDomainKey().GetPathId());
+ ui64 coordinator = domaindescr.GetProcessingParams().GetCoordinators(0);
+
+ //coordinator runs on dynamic node
ui32 nodeId = env.GetClient().GetLeaderNode(&env.GetRuntime(), coordinator);
- UNIT_ASSERT_C(env.GetTenants().IsActive("/dc-1/USER_0", nodeId), "assert IsActive nodeId " << nodeId);
- }
-
- Y_UNIT_TEST(UserAttributes) {
- TTestEnv env(1, 0);
-
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ UNIT_ASSERT_C(env.GetTenants().IsActive("/dc-1/USER_0", nodeId), "assert IsActive nodeId " << nodeId);
+ }
+
+ Y_UNIT_TEST(UserAttributes) {
+ TTestEnv env(1, 0);
+
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0", env.GetPools())));
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().AlterUserAttributes("/dc-1", "USER_0", {{"AttrA1", "ValA1"}}));
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::HasUserAttributes(ls, {{"AttrA1", "ValA1"}});
- }
- }
-
- Y_UNIT_TEST(UserAttributesApplyIf) {
- TTestEnv env(1, 0);
-
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().AlterUserAttributes("/dc-1", "USER_0", {{"AttrA1", "ValA1"}}));
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::HasUserAttributes(ls, {{"AttrA1", "ValA1"}});
+ }
+ }
+
+ Y_UNIT_TEST(UserAttributesApplyIf) {
+ TTestEnv env(1, 0);
+
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0", env.GetPools())));
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().AlterUserAttributes("/dc-1", "USER_0", {{"AttrA1", "ValA1"}}));
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::HasUserAttributes(ls, {{"AttrA1", "ValA1"}});
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 4);
- }
-
-
- auto pathVer = env.GetClient().ExtractPathVersion(env.GetClient().Ls("/dc-1/USER_0"));
- UNIT_ASSERT_VALUES_EQUAL(pathVer.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(pathVer.Version, 4);
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().AlterUserAttributes("/dc-1", "USER_0", {{"AttrA2", "ValA2"}}, {"AttrA1"}, {pathVer}));
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::HasUserAttributes(ls, {{"AttrA2", "ValA2"}});
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
- }
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_ERROR,
- env.GetClient().AlterUserAttributes("/dc-1", "USER_0", {{"AttrA3", "ValA3"}}, {"AttrA2"}, {pathVer}));
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::HasUserAttributes(ls, {{"AttrA2", "ValA2"}});
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
- }
-
- pathVer = env.GetClient().ExtractPathVersion(env.GetClient().Ls("/dc-1/USER_0"));
- UNIT_ASSERT_VALUES_EQUAL(pathVer.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(pathVer.Version, 5);
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().AlterUserAttributes("/dc-1", "USER_0", {{"AttrA3", "ValA3"}}, {"AttrA2"}, {pathVer}));
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::HasUserAttributes(ls, {{"AttrA3", "ValA3"}});
- auto ver = NTestLs::ExtractPathVersion(ls);
- UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
- UNIT_ASSERT_VALUES_EQUAL(ver.Version, 6);
- }
- }
-
- Y_UNIT_TEST(CheckAccessCopyTable) {
- TTestEnv env(1, 2);
-
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().AlterUserAttributes("/dc-1", "USER_0", {{"AttrA1", "ValA1"}}));
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::HasUserAttributes(ls, {{"AttrA1", "ValA1"}});
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 4);
+ }
+
+
+ auto pathVer = env.GetClient().ExtractPathVersion(env.GetClient().Ls("/dc-1/USER_0"));
+ UNIT_ASSERT_VALUES_EQUAL(pathVer.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(pathVer.Version, 4);
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().AlterUserAttributes("/dc-1", "USER_0", {{"AttrA2", "ValA2"}}, {"AttrA1"}, {pathVer}));
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::HasUserAttributes(ls, {{"AttrA2", "ValA2"}});
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
+ }
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_ERROR,
+ env.GetClient().AlterUserAttributes("/dc-1", "USER_0", {{"AttrA3", "ValA3"}}, {"AttrA2"}, {pathVer}));
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::HasUserAttributes(ls, {{"AttrA2", "ValA2"}});
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 5);
+ }
+
+ pathVer = env.GetClient().ExtractPathVersion(env.GetClient().Ls("/dc-1/USER_0"));
+ UNIT_ASSERT_VALUES_EQUAL(pathVer.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(pathVer.Version, 5);
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().AlterUserAttributes("/dc-1", "USER_0", {{"AttrA3", "ValA3"}}, {"AttrA2"}, {pathVer}));
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::HasUserAttributes(ls, {{"AttrA3", "ValA3"}});
+ auto ver = NTestLs::ExtractPathVersion(ls);
+ UNIT_ASSERT_VALUES_EQUAL(ver.PathId, 2);
+ UNIT_ASSERT_VALUES_EQUAL(ver.Version, 6);
+ }
+ }
+
+ Y_UNIT_TEST(CheckAccessCopyTable) {
+ TTestEnv env(1, 2);
+
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0", env.GetPools())));
- env.GetTenants().Run("/dc-1/USER_0", 1);
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0")));
- env.GetClient().ModifyOwner("/dc-1", "USER_0", "user0@builtin");
- env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0");
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetTenants().Run("/dc-1/USER_0", 1);
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0")));
+ env.GetClient().ModifyOwner("/dc-1", "USER_0", "user0@builtin");
+ env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0");
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_1", env.GetPools())));
- env.GetTenants().Run("/dc-1/USER_1", 1);
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_1")));
- env.GetClient().ModifyOwner("/dc-1", "USER_1", "user1@builtin");
- env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_1");
-
-
- {
- env.GetClient().SetSecurityToken("user0@builtin");
-
- Cerr << NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0")) << "\n";
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0", "a"));
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0/a", "b"));
-
- auto tableDesc = GetTableSimpleDescription("table");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0/a/b", tableDesc));
-
- NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/a"));
- NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/a/b"));
- NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/a/b/table"));
- }
-
- {
- env.GetClient().SetSecurityToken("user0@builtin");
-
- //no rights to create table in /dc-1/USER_1
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_ERROR, env.GetClient().CopyTable("/dc-1/USER_1", "copy", "/dc-1/USER_0/a/b/table"));
- }
-;
- {
- env.GetClient().SetSecurityToken("user1@builtin");
-
- //no rights to read table fom /dc-1/USER_0
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_ERROR, env.GetClient().CopyTable("/dc-1/USER_1", "copy", "/dc-1/USER_0/a/b/table"));
- }
- }
-
- Y_UNIT_TEST(ConsistentCopyTable) {
- TTestEnv env(1, 2);
-
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetTenants().Run("/dc-1/USER_1", 1);
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_1")));
+ env.GetClient().ModifyOwner("/dc-1", "USER_1", "user1@builtin");
+ env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_1");
+
+
+ {
+ env.GetClient().SetSecurityToken("user0@builtin");
+
+ Cerr << NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0")) << "\n";
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0", "a"));
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0/a", "b"));
+
+ auto tableDesc = GetTableSimpleDescription("table");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0/a/b", tableDesc));
+
+ NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/a"));
+ NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/a/b"));
+ NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/a/b/table"));
+ }
+
+ {
+ env.GetClient().SetSecurityToken("user0@builtin");
+
+ //no rights to create table in /dc-1/USER_1
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_ERROR, env.GetClient().CopyTable("/dc-1/USER_1", "copy", "/dc-1/USER_0/a/b/table"));
+ }
+;
+ {
+ env.GetClient().SetSecurityToken("user1@builtin");
+
+ //no rights to read table fom /dc-1/USER_0
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_ERROR, env.GetClient().CopyTable("/dc-1/USER_1", "copy", "/dc-1/USER_0/a/b/table"));
+ }
+ }
+
+ Y_UNIT_TEST(ConsistentCopyTable) {
+ TTestEnv env(1, 2);
+
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0", env.GetPools())));
- env.GetTenants().Run("/dc-1/USER_0", 1);
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0")));
- env.GetClient().ModifyOwner("/dc-1", "USER_0", "user0@builtin");
- env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0");
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetTenants().Run("/dc-1/USER_0", 1);
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0")));
+ env.GetClient().ModifyOwner("/dc-1", "USER_0", "user0@builtin");
+ env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_0");
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_1", env.GetPools())));
- env.GetTenants().Run("/dc-1/USER_1", 1);
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_1")));
- env.GetClient().ModifyOwner("/dc-1", "USER_1", "user1@builtin");
- env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_1");
-
-
- {
- env.GetClient().SetSecurityToken("user0@builtin");
-
- Cerr << NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0")) << "\n";
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0", "a"));
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0/a", "b"));
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().CreateTable("/dc-1/USER_0/", GetTableSimpleDescription("table")));
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().CreateTable("/dc-1/USER_0/a", GetTableSimpleDescription("table")));
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().CreateTable("/dc-1/USER_0/a/b", GetTableSimpleDescription("table")));
-
-
- NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/table"));
- NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/a"));
- NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/a/b/table"));
- NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/a/b"));
- NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/a/b/table"));
- }
-
- {
- env.GetClient().SetSecurityToken("user0@builtin");
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0", "backup"));
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().ConsistentCopyTables(
- {{"/dc-1/USER_0/table", "/dc-1/USER_0/backup/table"},
- {"/dc-1/USER_0/a/table", "/dc-1/USER_0/backup/table_a"},
- {"/dc-1/USER_0/a/b/table", "/dc-1/USER_0/backup/table_a_b"}}));
-
- NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/backup"));
- NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/backup/table"));
- NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/backup/table_a"));
- NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/backup/table_a_b"));
- }
-
- {
- env.GetClient().SetSecurityToken("user0@builtin");
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_ERROR,
- env.GetClient().ConsistentCopyTables(
- {{"/dc-1/USER_0/table", "/dc-1/USER_1/table"},
- {"/dc-1/USER_0/a/table", "/dc-1/USER_1/table_a"}}));
- }
-
- {
- env.GetClient().SetSecurityToken("user1@builtin");
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_ERROR,
- env.GetClient().ConsistentCopyTables(
- {{"/dc-1/USER_0/table", "/dc-1/USER_1/table"},
- {"/dc-1/USER_0/a/table", "/dc-1/USER_1/table_a"}}));
- }
- }
-}
+ env.GetTenants().Run("/dc-1/USER_1", 1);
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_1")));
+ env.GetClient().ModifyOwner("/dc-1", "USER_1", "user1@builtin");
+ env.GetClient().RefreshPathCache(&env.GetRuntime(), "/dc-1/USER_1");
+
+
+ {
+ env.GetClient().SetSecurityToken("user0@builtin");
+
+ Cerr << NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0")) << "\n";
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0", "a"));
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0/a", "b"));
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().CreateTable("/dc-1/USER_0/", GetTableSimpleDescription("table")));
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().CreateTable("/dc-1/USER_0/a", GetTableSimpleDescription("table")));
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().CreateTable("/dc-1/USER_0/a/b", GetTableSimpleDescription("table")));
+
+
+ NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/table"));
+ NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/a"));
+ NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/a/b/table"));
+ NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/a/b"));
+ NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/a/b/table"));
+ }
+
+ {
+ env.GetClient().SetSecurityToken("user0@builtin");
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0", "backup"));
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().ConsistentCopyTables(
+ {{"/dc-1/USER_0/table", "/dc-1/USER_0/backup/table"},
+ {"/dc-1/USER_0/a/table", "/dc-1/USER_0/backup/table_a"},
+ {"/dc-1/USER_0/a/b/table", "/dc-1/USER_0/backup/table_a_b"}}));
+
+ NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/backup"));
+ NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/backup/table"));
+ NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/backup/table_a"));
+ NTestLs::CheckStatus(env.GetClient().Ls("/dc-1/USER_0/backup/table_a_b"));
+ }
+
+ {
+ env.GetClient().SetSecurityToken("user0@builtin");
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_ERROR,
+ env.GetClient().ConsistentCopyTables(
+ {{"/dc-1/USER_0/table", "/dc-1/USER_1/table"},
+ {"/dc-1/USER_0/a/table", "/dc-1/USER_1/table_a"}}));
+ }
+
+ {
+ env.GetClient().SetSecurityToken("user1@builtin");
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_ERROR,
+ env.GetClient().ConsistentCopyTables(
+ {{"/dc-1/USER_0/table", "/dc-1/USER_1/table"},
+ {"/dc-1/USER_0/a/table", "/dc-1/USER_1/table_a"}}));
+ }
+ }
+}
diff --git a/ydb/core/tx/tx_proxy/proxy_ut_helpers.cpp b/ydb/core/tx/tx_proxy/proxy_ut_helpers.cpp
index db8cce515e9..a9becc80d7d 100644
--- a/ydb/core/tx/tx_proxy/proxy_ut_helpers.cpp
+++ b/ydb/core/tx/tx_proxy/proxy_ut_helpers.cpp
@@ -1,485 +1,485 @@
-#include "proxy_ut_helpers.h"
-
+#include "proxy_ut_helpers.h"
+
#include <ydb/core/tx/schemeshard/schemeshard.h>
-
-namespace NKikimr {
-namespace NTxProxyUT {
-
-void Print(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp) {
- TString out;
- ::google::protobuf::TextFormat::PrintToString(resp.Get()->Record, &out);
- Cerr << out << Endl;
-}
-
-namespace NTestLs {
-
-TString IsUnavailable(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp) {
- UNIT_ASSERT(resp.Get());
- auto& record = resp->Record;
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_ERROR);
- UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusNotAvailable);
-
- TString out;
- ::google::protobuf::TextFormat::PrintToString(record, &out);
- return out;
-}
-
-TString Finished(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrSchemeOp::EPathType type) {
- UNIT_ASSERT(resp.Get());
- auto& record = resp->Record;
-
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
- UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
- Y_UNUSED(type);
- UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetSelf().GetPathType(), type);
- UNIT_ASSERT(record.GetPathDescription().GetSelf().GetCreateFinished());
- TString out;
- ::google::protobuf::TextFormat::PrintToString(record, &out);
- return out;
-}
-
-TString NotInSubdomain(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrSchemeOp::EPathType type) {
- UNIT_ASSERT(resp.Get());
- auto& record = resp->Record;
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
- UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
- auto& descr = record.GetPathDescription();
- auto actualType = descr.GetSelf().GetPathType();
- UNIT_ASSERT_VALUES_EQUAL(actualType, type);
- UNIT_ASSERT(descr.GetSelf().GetCreateFinished());
-
- UNIT_ASSERT(descr.HasDomainDescription());
- UNIT_ASSERT_VALUES_EQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), 1);
-
- TString out;
- ::google::protobuf::TextFormat::PrintToString(record, &out);
- return out;
-}
-
-TString HasUserAttributes(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, TVector<std::pair<TString, TString>> attrs) {
- UNIT_ASSERT(resp.Get());
- auto& record = resp->Record;
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
- UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
- auto& descr = record.GetPathDescription();
- UNIT_ASSERT(descr.GetSelf().GetCreateFinished());
-
- std::sort(attrs.begin(), attrs.end());
-
- TVector<std::pair<TString, TString>> present;
- for (const auto& item: descr.GetUserAttributes()) {
- present.emplace_back(item.GetKey(), item.GetValue());
- }
- std::sort(present.begin(), present.end());
-
- TVector<std::pair<TString, TString>> diff;
- std::set_difference(attrs.begin(), attrs.end(),
- present.begin(), present.end(),
- std::back_inserter(diff));
- UNIT_ASSERT_C(diff.size() == 0,
- diff.size() << " attrs not present or has different value, for example name: " << diff.front().first << " value: " << diff.front().second);
-
- TString out;
- ::google::protobuf::TextFormat::PrintToString(record, &out);
- return out;
-}
-
-
-TString IsSubdomain(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp) {
- UNIT_ASSERT(resp.Get());
- auto& record = resp->Record;
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
- UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
- auto& descr = record.GetPathDescription();
- auto actualType = descr.GetSelf().GetPathType();
- UNIT_ASSERT_VALUES_EQUAL(actualType, NKikimrSchemeOp::EPathTypeSubDomain);
- UNIT_ASSERT(descr.GetSelf().GetCreateFinished());
-
- UNIT_ASSERT(descr.HasDomainDescription());
- UNIT_ASSERT_VALUES_UNEQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), 1);
- UNIT_ASSERT_VALUES_EQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), descr.GetSelf().GetPathId());
-
- TString out;
- ::google::protobuf::TextFormat::PrintToString(record, &out);
- return out;
-}
-
-TString IsExtSubdomain(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp) {
- UNIT_ASSERT(resp.Get());
- auto& record = resp->Record;
- UNIT_ASSERT_VALUES_EQUAL_C(record.GetStatus(), NMsgBusProxy::MSTATUS_OK,
- "status was: " << NMsgBusProxy::EResponseStatus(record.GetStatus())
- << " expected: " << NMsgBusProxy::MSTATUS_OK
- << " explain: " << record.GetErrorReason()
- << " message: " << record.ShortDebugString()
- );
- UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
- auto& descr = record.GetPathDescription();
- auto actualType = descr.GetSelf().GetPathType();
- UNIT_ASSERT_VALUES_EQUAL(actualType, NKikimrSchemeOp::EPathTypeSubDomain);
- UNIT_ASSERT(descr.GetSelf().GetCreateFinished());
-
- UNIT_ASSERT(descr.HasDomainDescription());
- UNIT_ASSERT_VALUES_EQUAL(descr.GetSelf().GetPathId(), 1);
- UNIT_ASSERT_VALUES_UNEQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), 1);
- UNIT_ASSERT_VALUES_UNEQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), descr.GetSelf().GetPathId());
-
- TString out;
- ::google::protobuf::TextFormat::PrintToString(record, &out);
- return out;
-}
-
-TString WithPools(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp) {
- UNIT_ASSERT(resp.Get());
- auto& record = resp->Record;
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
- UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
- auto& descr = record.GetPathDescription();
- UNIT_ASSERT(descr.GetSelf().GetCreateFinished());
-
- UNIT_ASSERT(descr.GetDomainDescription().StoragePoolsSize() > 0);
-
- TString out;
- ::google::protobuf::TextFormat::PrintToString(record, &out);
- return out;
-}
-
-
-TString InSubdomain(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrSchemeOp::EPathType type) {
- UNIT_ASSERT(resp.Get());
- auto& record = resp->Record;
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
- UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
- auto& descr = record.GetPathDescription();
- auto actualType = descr.GetSelf().GetPathType();
- UNIT_ASSERT_VALUES_EQUAL(actualType, type);
- UNIT_ASSERT(descr.GetSelf().GetCreateFinished());
-
- UNIT_ASSERT(descr.HasDomainDescription());
-
- if (actualType == NKikimrSchemeOp::EPathTypeSubDomain) {
- UNIT_ASSERT_VALUES_UNEQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), 1);
- UNIT_ASSERT_VALUES_EQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), descr.GetSelf().GetPathId());
- }
-
- TString out;
- ::google::protobuf::TextFormat::PrintToString(record, &out);
- return out;
-}
-
-TString InSubdomainWithPools(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrSchemeOp::EPathType type) {
- UNIT_ASSERT(resp.Get());
- auto& record = resp->Record;
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
- UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
- auto& descr = record.GetPathDescription();
- auto actualType = descr.GetSelf().GetPathType();
- UNIT_ASSERT_VALUES_EQUAL(actualType, type);
- UNIT_ASSERT(descr.GetSelf().GetCreateFinished());
-
- UNIT_ASSERT(descr.HasDomainDescription());
- UNIT_ASSERT_VALUES_UNEQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), 1);
- if (actualType == NKikimrSchemeOp::EPathTypeSubDomain) {
- UNIT_ASSERT_VALUES_EQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), descr.GetSelf().GetPathId());
- }
-
- UNIT_ASSERT(descr.GetDomainDescription().StoragePoolsSize() > 0);
-
- TString out;
- ::google::protobuf::TextFormat::PrintToString(record, &out);
- return out;
-}
-
-NKikimrSubDomains::TDomainDescription ExtractDomainDescription(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp) {
- UNIT_ASSERT(resp.Get());
- auto& record = resp->Record;
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
- UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
- auto& descr = record.GetPathDescription();
- UNIT_ASSERT(descr.HasDomainDescription());
- return descr.GetDomainDescription();
-}
-
-TVector<NKikimrSchemeOp::TTablePartition> ExtractTablePartitions(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp) {
- UNIT_ASSERT(resp.Get());
- auto& record = resp->Record;
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
- UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
- auto& descr = record.GetPathDescription();
- auto actualType = descr.GetSelf().GetPathType();
- UNIT_ASSERT_VALUES_EQUAL(actualType, NKikimrSchemeOp::EPathTypeTable);
-
- auto& parts = descr.GetTablePartitions();
- UNIT_ASSERT_VALUES_UNEQUAL(0, parts.size());
- return TVector<NKikimrSchemeOp::TTablePartition>(parts.begin(), parts.end());
-}
-
-NKikimrSchemeOp::TTableDescription ExtractTableDescription(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp) {
+
+namespace NKikimr {
+namespace NTxProxyUT {
+
+void Print(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp) {
+ TString out;
+ ::google::protobuf::TextFormat::PrintToString(resp.Get()->Record, &out);
+ Cerr << out << Endl;
+}
+
+namespace NTestLs {
+
+TString IsUnavailable(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp) {
+ UNIT_ASSERT(resp.Get());
+ auto& record = resp->Record;
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_ERROR);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusNotAvailable);
+
+ TString out;
+ ::google::protobuf::TextFormat::PrintToString(record, &out);
+ return out;
+}
+
+TString Finished(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrSchemeOp::EPathType type) {
+ UNIT_ASSERT(resp.Get());
+ auto& record = resp->Record;
+
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
+ Y_UNUSED(type);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetPathDescription().GetSelf().GetPathType(), type);
+ UNIT_ASSERT(record.GetPathDescription().GetSelf().GetCreateFinished());
+ TString out;
+ ::google::protobuf::TextFormat::PrintToString(record, &out);
+ return out;
+}
+
+TString NotInSubdomain(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrSchemeOp::EPathType type) {
+ UNIT_ASSERT(resp.Get());
+ auto& record = resp->Record;
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
+ auto& descr = record.GetPathDescription();
+ auto actualType = descr.GetSelf().GetPathType();
+ UNIT_ASSERT_VALUES_EQUAL(actualType, type);
+ UNIT_ASSERT(descr.GetSelf().GetCreateFinished());
+
+ UNIT_ASSERT(descr.HasDomainDescription());
+ UNIT_ASSERT_VALUES_EQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), 1);
+
+ TString out;
+ ::google::protobuf::TextFormat::PrintToString(record, &out);
+ return out;
+}
+
+TString HasUserAttributes(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, TVector<std::pair<TString, TString>> attrs) {
+ UNIT_ASSERT(resp.Get());
+ auto& record = resp->Record;
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
+ auto& descr = record.GetPathDescription();
+ UNIT_ASSERT(descr.GetSelf().GetCreateFinished());
+
+ std::sort(attrs.begin(), attrs.end());
+
+ TVector<std::pair<TString, TString>> present;
+ for (const auto& item: descr.GetUserAttributes()) {
+ present.emplace_back(item.GetKey(), item.GetValue());
+ }
+ std::sort(present.begin(), present.end());
+
+ TVector<std::pair<TString, TString>> diff;
+ std::set_difference(attrs.begin(), attrs.end(),
+ present.begin(), present.end(),
+ std::back_inserter(diff));
+ UNIT_ASSERT_C(diff.size() == 0,
+ diff.size() << " attrs not present or has different value, for example name: " << diff.front().first << " value: " << diff.front().second);
+
+ TString out;
+ ::google::protobuf::TextFormat::PrintToString(record, &out);
+ return out;
+}
+
+
+TString IsSubdomain(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp) {
+ UNIT_ASSERT(resp.Get());
+ auto& record = resp->Record;
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
+ auto& descr = record.GetPathDescription();
+ auto actualType = descr.GetSelf().GetPathType();
+ UNIT_ASSERT_VALUES_EQUAL(actualType, NKikimrSchemeOp::EPathTypeSubDomain);
+ UNIT_ASSERT(descr.GetSelf().GetCreateFinished());
+
+ UNIT_ASSERT(descr.HasDomainDescription());
+ UNIT_ASSERT_VALUES_UNEQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), descr.GetSelf().GetPathId());
+
+ TString out;
+ ::google::protobuf::TextFormat::PrintToString(record, &out);
+ return out;
+}
+
+TString IsExtSubdomain(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp) {
+ UNIT_ASSERT(resp.Get());
+ auto& record = resp->Record;
+ UNIT_ASSERT_VALUES_EQUAL_C(record.GetStatus(), NMsgBusProxy::MSTATUS_OK,
+ "status was: " << NMsgBusProxy::EResponseStatus(record.GetStatus())
+ << " expected: " << NMsgBusProxy::MSTATUS_OK
+ << " explain: " << record.GetErrorReason()
+ << " message: " << record.ShortDebugString()
+ );
+ UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
+ auto& descr = record.GetPathDescription();
+ auto actualType = descr.GetSelf().GetPathType();
+ UNIT_ASSERT_VALUES_EQUAL(actualType, NKikimrSchemeOp::EPathTypeSubDomain);
+ UNIT_ASSERT(descr.GetSelf().GetCreateFinished());
+
+ UNIT_ASSERT(descr.HasDomainDescription());
+ UNIT_ASSERT_VALUES_EQUAL(descr.GetSelf().GetPathId(), 1);
+ UNIT_ASSERT_VALUES_UNEQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), 1);
+ UNIT_ASSERT_VALUES_UNEQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), descr.GetSelf().GetPathId());
+
+ TString out;
+ ::google::protobuf::TextFormat::PrintToString(record, &out);
+ return out;
+}
+
+TString WithPools(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp) {
+ UNIT_ASSERT(resp.Get());
+ auto& record = resp->Record;
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
+ auto& descr = record.GetPathDescription();
+ UNIT_ASSERT(descr.GetSelf().GetCreateFinished());
+
+ UNIT_ASSERT(descr.GetDomainDescription().StoragePoolsSize() > 0);
+
+ TString out;
+ ::google::protobuf::TextFormat::PrintToString(record, &out);
+ return out;
+}
+
+
+TString InSubdomain(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrSchemeOp::EPathType type) {
+ UNIT_ASSERT(resp.Get());
+ auto& record = resp->Record;
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
+ auto& descr = record.GetPathDescription();
+ auto actualType = descr.GetSelf().GetPathType();
+ UNIT_ASSERT_VALUES_EQUAL(actualType, type);
+ UNIT_ASSERT(descr.GetSelf().GetCreateFinished());
+
+ UNIT_ASSERT(descr.HasDomainDescription());
+
+ if (actualType == NKikimrSchemeOp::EPathTypeSubDomain) {
+ UNIT_ASSERT_VALUES_UNEQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), 1);
+ UNIT_ASSERT_VALUES_EQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), descr.GetSelf().GetPathId());
+ }
+
+ TString out;
+ ::google::protobuf::TextFormat::PrintToString(record, &out);
+ return out;
+}
+
+TString InSubdomainWithPools(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrSchemeOp::EPathType type) {
+ UNIT_ASSERT(resp.Get());
+ auto& record = resp->Record;
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
+ auto& descr = record.GetPathDescription();
+ auto actualType = descr.GetSelf().GetPathType();
+ UNIT_ASSERT_VALUES_EQUAL(actualType, type);
+ UNIT_ASSERT(descr.GetSelf().GetCreateFinished());
+
+ UNIT_ASSERT(descr.HasDomainDescription());
+ UNIT_ASSERT_VALUES_UNEQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), 1);
+ if (actualType == NKikimrSchemeOp::EPathTypeSubDomain) {
+ UNIT_ASSERT_VALUES_EQUAL(descr.GetDomainDescription().GetDomainKey().GetPathId(), descr.GetSelf().GetPathId());
+ }
+
+ UNIT_ASSERT(descr.GetDomainDescription().StoragePoolsSize() > 0);
+
+ TString out;
+ ::google::protobuf::TextFormat::PrintToString(record, &out);
+ return out;
+}
+
+NKikimrSubDomains::TDomainDescription ExtractDomainDescription(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp) {
+ UNIT_ASSERT(resp.Get());
+ auto& record = resp->Record;
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
+ auto& descr = record.GetPathDescription();
+ UNIT_ASSERT(descr.HasDomainDescription());
+ return descr.GetDomainDescription();
+}
+
+TVector<NKikimrSchemeOp::TTablePartition> ExtractTablePartitions(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp) {
+ UNIT_ASSERT(resp.Get());
+ auto& record = resp->Record;
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
+ auto& descr = record.GetPathDescription();
+ auto actualType = descr.GetSelf().GetPathType();
+ UNIT_ASSERT_VALUES_EQUAL(actualType, NKikimrSchemeOp::EPathTypeTable);
+
+ auto& parts = descr.GetTablePartitions();
+ UNIT_ASSERT_VALUES_UNEQUAL(0, parts.size());
+ return TVector<NKikimrSchemeOp::TTablePartition>(parts.begin(), parts.end());
+}
+
+NKikimrSchemeOp::TTableDescription ExtractTableDescription(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp) {
UNIT_ASSERT(resp.Get());
auto& record = resp->Record;
UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
- UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
auto& descr = record.GetPathDescription();
auto actualType = descr.GetSelf().GetPathType();
- UNIT_ASSERT_VALUES_EQUAL(actualType, NKikimrSchemeOp::EPathTypeTable);
+ UNIT_ASSERT_VALUES_EQUAL(actualType, NKikimrSchemeOp::EPathTypeTable);
UNIT_ASSERT(descr.HasTable());
return descr.GetTable();
}
-TString CheckStatus(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrScheme::EStatus schemeStatus) {
- UNIT_ASSERT(resp.Get());
- auto& record = resp->Record;
- UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), schemeStatus);
- if (NKikimrScheme::EStatus::StatusSuccess == schemeStatus) {
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
- }
-
- TString out;
- ::google::protobuf::TextFormat::PrintToString(record, &out);
- return out;
-}
-
-TPathVersion ExtractPathVersion(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp) {
- return Tests::TClient::ExtractPathVersion(resp);
-}
-
-TString NoChildren(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp) {
- return ChildrenCount(resp, 0);
-}
-
-TString ChildrenCount(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp, ui64 count) {
- UNIT_ASSERT(resp.Get());
- auto& record = resp->Record;
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
- UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
- auto& descr = record.GetPathDescription();
- auto actualType = descr.GetSelf().GetPathType();
- UNIT_ASSERT_VALUES_EQUAL(actualType, NKikimrSchemeOp::EPathTypeDir);
-
- auto& children = descr.GetChildren();
- UNIT_ASSERT_VALUES_EQUAL(count, children.size());
-
- TString out;
- ::google::protobuf::TextFormat::PrintToString(record, &out);
- return out;
-}
-
-TString HasChild(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp, TString name, NKikimrSchemeOp::EPathType type) {
- UNIT_ASSERT(resp.Get());
- auto& record = resp->Record;
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
- UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
- auto& descr = record.GetPathDescription();
- auto actualType = descr.GetSelf().GetPathType();
- UNIT_ASSERT_VALUES_EQUAL(actualType, NKikimrSchemeOp::EPathTypeDir);
-
- auto& children = descr.GetChildren();
- bool found = false;
- bool correctType = false;
- for (auto& x: children) {
- if (x.GetName() == name) {
- found = true;
- correctType = x.GetPathType() == type;
- break;
- }
- }
-
- UNIT_ASSERT(found);
- UNIT_ASSERT(correctType);
-
- TString out;
- ::google::protobuf::TextFormat::PrintToString(record, &out);
- return out;
-}
-
-TString IsDir(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp) {
- return PathType(resp, NKikimrSchemeOp::EPathTypeDir);
-}
-
-TString IsTable(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp) {
- return PathType(resp, NKikimrSchemeOp::EPathTypeTable);
-}
-
-TString PathType(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp, NKikimrSchemeOp::EPathType type) {
- UNIT_ASSERT(resp.Get());
- auto& record = resp->Record;
- UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
- UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
- auto& descr = record.GetPathDescription();
- auto actualType = descr.GetSelf().GetPathType();
- UNIT_ASSERT_VALUES_EQUAL(actualType, type);
-
- TString out;
- ::google::protobuf::TextFormat::PrintToString(record, &out);
- return out;
-}
-
-TString IsDoesNotExist(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp) {
- UNIT_ASSERT(resp.Get());
- auto& record = resp->Record;
- UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::EStatus::StatusPathDoesNotExist);
-
- TString out;
- ::google::protobuf::TextFormat::PrintToString(record, &out);
- return out;
-}
-
-}
-
-
-namespace NHelpers {
-
+TString CheckStatus(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrScheme::EStatus schemeStatus) {
+ UNIT_ASSERT(resp.Get());
+ auto& record = resp->Record;
+ UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), schemeStatus);
+ if (NKikimrScheme::EStatus::StatusSuccess == schemeStatus) {
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
+ }
+
+ TString out;
+ ::google::protobuf::TextFormat::PrintToString(record, &out);
+ return out;
+}
+
+TPathVersion ExtractPathVersion(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp) {
+ return Tests::TClient::ExtractPathVersion(resp);
+}
+
+TString NoChildren(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp) {
+ return ChildrenCount(resp, 0);
+}
+
+TString ChildrenCount(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp, ui64 count) {
+ UNIT_ASSERT(resp.Get());
+ auto& record = resp->Record;
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
+ auto& descr = record.GetPathDescription();
+ auto actualType = descr.GetSelf().GetPathType();
+ UNIT_ASSERT_VALUES_EQUAL(actualType, NKikimrSchemeOp::EPathTypeDir);
+
+ auto& children = descr.GetChildren();
+ UNIT_ASSERT_VALUES_EQUAL(count, children.size());
+
+ TString out;
+ ::google::protobuf::TextFormat::PrintToString(record, &out);
+ return out;
+}
+
+TString HasChild(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp, TString name, NKikimrSchemeOp::EPathType type) {
+ UNIT_ASSERT(resp.Get());
+ auto& record = resp->Record;
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
+ auto& descr = record.GetPathDescription();
+ auto actualType = descr.GetSelf().GetPathType();
+ UNIT_ASSERT_VALUES_EQUAL(actualType, NKikimrSchemeOp::EPathTypeDir);
+
+ auto& children = descr.GetChildren();
+ bool found = false;
+ bool correctType = false;
+ for (auto& x: children) {
+ if (x.GetName() == name) {
+ found = true;
+ correctType = x.GetPathType() == type;
+ break;
+ }
+ }
+
+ UNIT_ASSERT(found);
+ UNIT_ASSERT(correctType);
+
+ TString out;
+ ::google::protobuf::TextFormat::PrintToString(record, &out);
+ return out;
+}
+
+TString IsDir(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp) {
+ return PathType(resp, NKikimrSchemeOp::EPathTypeDir);
+}
+
+TString IsTable(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp) {
+ return PathType(resp, NKikimrSchemeOp::EPathTypeTable);
+}
+
+TString PathType(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp, NKikimrSchemeOp::EPathType type) {
+ UNIT_ASSERT(resp.Get());
+ auto& record = resp->Record;
+ UNIT_ASSERT_VALUES_EQUAL(record.GetStatus(), NMsgBusProxy::MSTATUS_OK);
+ UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::StatusSuccess);
+ auto& descr = record.GetPathDescription();
+ auto actualType = descr.GetSelf().GetPathType();
+ UNIT_ASSERT_VALUES_EQUAL(actualType, type);
+
+ TString out;
+ ::google::protobuf::TextFormat::PrintToString(record, &out);
+ return out;
+}
+
+TString IsDoesNotExist(const TAutoPtr<NMsgBusProxy::TBusResponse> &resp) {
+ UNIT_ASSERT(resp.Get());
+ auto& record = resp->Record;
+ UNIT_ASSERT_VALUES_EQUAL(record.GetSchemeStatus(), NKikimrScheme::EStatus::StatusPathDoesNotExist);
+
+ TString out;
+ ::google::protobuf::TextFormat::PrintToString(record, &out);
+ return out;
+}
+
+}
+
+
+namespace NHelpers {
+
TChannelBind GetChannelBind(const TString& storagePool) {
TChannelBind bind;
bind.SetStoragePoolName(storagePool);
return bind;
}
-ui64 CreateSubDomainAndTabletInside(TBaseTestEnv &env, const TString &name, ui64 shard_index, const TStoragePools &pools) {
- const ui64 owner = THash<TString>()(name);
-
- //usually (ex for DataShards) SchemeShard proccesses channels binding
- TChannelsBindings channelBindings;
- if (pools) {
- auto poolIt = pools.begin();
+ui64 CreateSubDomainAndTabletInside(TBaseTestEnv &env, const TString &name, ui64 shard_index, const TStoragePools &pools) {
+ const ui64 owner = THash<TString>()(name);
+
+ //usually (ex for DataShards) SchemeShard proccesses channels binding
+ TChannelsBindings channelBindings;
+ if (pools) {
+ auto poolIt = pools.begin();
channelBindings.emplace_back(GetChannelBind(poolIt->GetName()));
-
- if (pools.size() > 1) {
- ++poolIt;
- }
+
+ if (pools.size() > 1) {
+ ++poolIt;
+ }
channelBindings.emplace_back(GetChannelBind(poolIt->GetName()));
-
- if (pools.size() > 2) {
- ++poolIt;
+
+ if (pools.size() > 2) {
+ ++poolIt;
channelBindings.emplace_back(GetChannelBind(poolIt->GetName()));
- }
- }
-
- auto subdomain = GetSubDomainDeclareSetting(name, pools);
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain));
- const TString subdomain_path = JoinPath({"/dc-1", subdomain.GetName()});
- const auto desc = NTestLs::ExtractDomainDescription(
- env.GetClient().Ls(subdomain_path));
- const auto key = TSubDomainKey(desc.GetDomainKey());
-
- TAutoPtr<NMsgBusProxy::TBusResponse> resp = env.GetClient().HiveCreateTablet(
- env.GetSettings().Domain,
- owner, shard_index,
+ }
+ }
+
+ auto subdomain = GetSubDomainDeclareSetting(name, pools);
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain));
+ const TString subdomain_path = JoinPath({"/dc-1", subdomain.GetName()});
+ const auto desc = NTestLs::ExtractDomainDescription(
+ env.GetClient().Ls(subdomain_path));
+ const auto key = TSubDomainKey(desc.GetDomainKey());
+
+ TAutoPtr<NMsgBusProxy::TBusResponse> resp = env.GetClient().HiveCreateTablet(
+ env.GetSettings().Domain,
+ owner, shard_index,
TTabletTypes::TX_DUMMY,
- {},
- {key},
- channelBindings);
-
- const auto& record = resp->Record;
- UNIT_ASSERT_VALUES_EQUAL(record.CreateTabletResultSize(), 1);
-
- const auto& result = record.GetCreateTabletResult(0);
-
- UNIT_ASSERT_EQUAL(
- NKikimrProto::OK,
- result.GetStatus());
-
- const ui64 tablet_id = result.GetTabletId();
-
- UNIT_ASSERT(
- env.GetClient().TabletExistsInHive(&env.GetRuntime(), tablet_id));
-
- return tablet_id;
-}
-
-void CheckTableIsOfline(TBaseTestEnv &env, ui64 tablet_id) {
- UNIT_ASSERT_EQUAL(
- Max<ui32>(),
+ {},
+ {key},
+ channelBindings);
+
+ const auto& record = resp->Record;
+ UNIT_ASSERT_VALUES_EQUAL(record.CreateTabletResultSize(), 1);
+
+ const auto& result = record.GetCreateTabletResult(0);
+
+ UNIT_ASSERT_EQUAL(
+ NKikimrProto::OK,
+ result.GetStatus());
+
+ const ui64 tablet_id = result.GetTabletId();
+
+ UNIT_ASSERT(
+ env.GetClient().TabletExistsInHive(&env.GetRuntime(), tablet_id));
+
+ return tablet_id;
+}
+
+void CheckTableIsOfline(TBaseTestEnv &env, ui64 tablet_id) {
+ UNIT_ASSERT_EQUAL(
+ Max<ui32>(),
env.GetClient().GetLeaderNode(&env.GetRuntime(), tablet_id));
-}
-
-void CheckTableBecomeAlive(TBaseTestEnv &env, ui64 tablet_id) {
- UNIT_ASSERT(
- env.GetClient().WaitForTabletAlive(&env.GetRuntime(), tablet_id, true, WaitTimeOut));
-
-}
-
-void CheckTableBecomeOfline(TBaseTestEnv &env, ui64 tablet_id) {
- UNIT_ASSERT(
- env.GetClient().WaitForTabletDown(&env.GetRuntime(), tablet_id, true, WaitTimeOut));
- //ensure that tablet do not wake up
- UNIT_ASSERT(
- !env.GetClient().WaitForTabletAlive(&env.GetRuntime(), tablet_id, true, WaitTimeOut));
-}
-
-void CheckTableRunOnProperTenantNode(TBaseTestEnv &env, const TString &tenant, ui64 tablet_id) {
- UNIT_ASSERT(
- env.GetTenants().IsActive(tenant,
+}
+
+void CheckTableBecomeAlive(TBaseTestEnv &env, ui64 tablet_id) {
+ UNIT_ASSERT(
+ env.GetClient().WaitForTabletAlive(&env.GetRuntime(), tablet_id, true, WaitTimeOut));
+
+}
+
+void CheckTableBecomeOfline(TBaseTestEnv &env, ui64 tablet_id) {
+ UNIT_ASSERT(
+ env.GetClient().WaitForTabletDown(&env.GetRuntime(), tablet_id, true, WaitTimeOut));
+ //ensure that tablet do not wake up
+ UNIT_ASSERT(
+ !env.GetClient().WaitForTabletAlive(&env.GetRuntime(), tablet_id, true, WaitTimeOut));
+}
+
+void CheckTableRunOnProperTenantNode(TBaseTestEnv &env, const TString &tenant, ui64 tablet_id) {
+ UNIT_ASSERT(
+ env.GetTenants().IsActive(tenant,
env.GetClient().GetLeaderNode(&env.GetRuntime(),
- tablet_id)));
-}
-
-NKikimrSubDomains::TSubDomainSettings GetSubDomainDeclareSetting(const TString &name, const TStoragePools &pools) {
- NKikimrSubDomains::TSubDomainSettings subdomain;
- subdomain.SetName(name);
- for (auto& pool: pools) {
- *subdomain.AddStoragePools() = pool;
- }
- return subdomain;
-}
-
-NKikimrSubDomains::TSubDomainSettings GetSubDomainDefaultSetting(const TString &name, const TStoragePools &pools) {
- NKikimrSubDomains::TSubDomainSettings subdomain;
- subdomain.SetName(name);
- subdomain.SetCoordinators(2);
- subdomain.SetMediators(2);
- subdomain.SetPlanResolution(50);
- subdomain.SetTimeCastBucketsPerMediator(2);
- for (auto& pool: pools) {
- *subdomain.AddStoragePools() = pool;
- }
- return subdomain;
-}
-
-NKikimrSchemeOp::TTableDescription GetTableSimpleDescription(const TString &name) {
- NKikimrSchemeOp::TTableDescription tableDescr;
- tableDescr.SetName(name);
- {
- auto *c1 = tableDescr.AddColumns();
- c1->SetName("key");
- c1->SetType("Uint64");
- }
- {
- auto *c2 = tableDescr.AddColumns();
- c2->SetName("value");
- c2->SetType("Uint64");
- }
- tableDescr.SetUniformPartitionsCount(2);
+ tablet_id)));
+}
+
+NKikimrSubDomains::TSubDomainSettings GetSubDomainDeclareSetting(const TString &name, const TStoragePools &pools) {
+ NKikimrSubDomains::TSubDomainSettings subdomain;
+ subdomain.SetName(name);
+ for (auto& pool: pools) {
+ *subdomain.AddStoragePools() = pool;
+ }
+ return subdomain;
+}
+
+NKikimrSubDomains::TSubDomainSettings GetSubDomainDefaultSetting(const TString &name, const TStoragePools &pools) {
+ NKikimrSubDomains::TSubDomainSettings subdomain;
+ subdomain.SetName(name);
+ subdomain.SetCoordinators(2);
+ subdomain.SetMediators(2);
+ subdomain.SetPlanResolution(50);
+ subdomain.SetTimeCastBucketsPerMediator(2);
+ for (auto& pool: pools) {
+ *subdomain.AddStoragePools() = pool;
+ }
+ return subdomain;
+}
+
+NKikimrSchemeOp::TTableDescription GetTableSimpleDescription(const TString &name) {
+ NKikimrSchemeOp::TTableDescription tableDescr;
+ tableDescr.SetName(name);
+ {
+ auto *c1 = tableDescr.AddColumns();
+ c1->SetName("key");
+ c1->SetType("Uint64");
+ }
+ {
+ auto *c2 = tableDescr.AddColumns();
+ c2->SetName("value");
+ c2->SetType("Uint64");
+ }
+ tableDescr.SetUniformPartitionsCount(2);
tableDescr.MutablePartitionConfig()->SetFollowerCount(2);
- *tableDescr.AddKeyColumnNames() = "key";
- return tableDescr;
-}
-
-void SetRowInSimpletable(TBaseTestEnv &env, ui64 key, ui64 value, const TString &path) {
- NKikimrMiniKQL::TResult res;
- TString query = Sprintf("("
- "(let row '('('key (Uint64 '%" PRIu64 "))))"
- "(let myUpd '("
- " '('value (Uint64 '%" PRIu64 "))"
- "))"
- "(let pgmReturn (AsList"
- " (UpdateRow '%s row myUpd)"
- "))"
- "(return pgmReturn)"
- ")", key, value, path.c_str());
-
- env.GetClient().FlatQuery(query, res);
-}
-
-
-} //NTestLs
-
-} //NTxProxyUT
-
-} //NKikimr
-
-template<>
-inline void Out<NKikimrSchemeOp::EPathType>(IOutputStream& o, NKikimrSchemeOp::EPathType x) {
- o << NKikimrSchemeOp::EPathType_Name(x).data();
- return;
-}
+ *tableDescr.AddKeyColumnNames() = "key";
+ return tableDescr;
+}
+
+void SetRowInSimpletable(TBaseTestEnv &env, ui64 key, ui64 value, const TString &path) {
+ NKikimrMiniKQL::TResult res;
+ TString query = Sprintf("("
+ "(let row '('('key (Uint64 '%" PRIu64 "))))"
+ "(let myUpd '("
+ " '('value (Uint64 '%" PRIu64 "))"
+ "))"
+ "(let pgmReturn (AsList"
+ " (UpdateRow '%s row myUpd)"
+ "))"
+ "(return pgmReturn)"
+ ")", key, value, path.c_str());
+
+ env.GetClient().FlatQuery(query, res);
+}
+
+
+} //NTestLs
+
+} //NTxProxyUT
+
+} //NKikimr
+
+template<>
+inline void Out<NKikimrSchemeOp::EPathType>(IOutputStream& o, NKikimrSchemeOp::EPathType x) {
+ o << NKikimrSchemeOp::EPathType_Name(x).data();
+ return;
+}
diff --git a/ydb/core/tx/tx_proxy/proxy_ut_helpers.h b/ydb/core/tx/tx_proxy/proxy_ut_helpers.h
index 2916a900af9..846b0cf568c 100644
--- a/ydb/core/tx/tx_proxy/proxy_ut_helpers.h
+++ b/ydb/core/tx/tx_proxy/proxy_ut_helpers.h
@@ -1,115 +1,115 @@
-#pragma once
-
+#pragma once
+
#include <ydb/core/protos/flat_scheme_op.pb.h>
#include <ydb/core/protos/flat_tx_scheme.pb.h>
#include <ydb/core/testlib/test_client.h>
-
+
#include <library/cpp/testing/unittest/registar.h>
#include <library/cpp/testing/unittest/tests_data.h>
-
-namespace NKikimr {
-namespace NTxProxyUT {
-
-inline constexpr static bool SanIsOn() noexcept {
- return NSan::PlainOrUnderSanitizer(false, true);
-}
-
-inline constexpr static bool IsFat() noexcept {
- return SanIsOn() || NValgrind::ValgrindIsOn();
-}
-
-template <typename T>
-T ChoiceFastOrFat(T fast, T fat) noexcept {
- if (IsFat()) {
- return fat;
- }
- return fast;
-}
-
-class TBaseTestEnv {
-public:
- virtual ~TBaseTestEnv() {}
-
- const TString& GetRoot() {
- static const TString root = TString("/") + GetSettings().DomainName;
- return root;
- }
-
- Tests::TServerSettings& GetSettings() {
- return *Settings;
- }
-
- Tests::TServer& GetServer() {
- return *Server;
- }
-
- Tests::TClient& GetClient() {
- return *Client;
- }
-
- Tests::TTenants& GetTenants() {
- return *Tenants;
- }
-
- TTestActorRuntime& GetRuntime() {
- return *GetServer().GetRuntime();
- }
-
-protected:
- TPortManager PortManager;
- Tests::TServerSettings::TPtr Settings;
- Tests::TServer::TPtr Server;
- THolder<Tests::TTenants> Tenants;
- THolder<Tests::TClient> Client;
-
- void SetLogging() {
- if (GetSettings().SupportsRedirect && Tests::IsServerRedirected())
- return;
-
+
+namespace NKikimr {
+namespace NTxProxyUT {
+
+inline constexpr static bool SanIsOn() noexcept {
+ return NSan::PlainOrUnderSanitizer(false, true);
+}
+
+inline constexpr static bool IsFat() noexcept {
+ return SanIsOn() || NValgrind::ValgrindIsOn();
+}
+
+template <typename T>
+T ChoiceFastOrFat(T fast, T fat) noexcept {
+ if (IsFat()) {
+ return fat;
+ }
+ return fast;
+}
+
+class TBaseTestEnv {
+public:
+ virtual ~TBaseTestEnv() {}
+
+ const TString& GetRoot() {
+ static const TString root = TString("/") + GetSettings().DomainName;
+ return root;
+ }
+
+ Tests::TServerSettings& GetSettings() {
+ return *Settings;
+ }
+
+ Tests::TServer& GetServer() {
+ return *Server;
+ }
+
+ Tests::TClient& GetClient() {
+ return *Client;
+ }
+
+ Tests::TTenants& GetTenants() {
+ return *Tenants;
+ }
+
+ TTestActorRuntime& GetRuntime() {
+ return *GetServer().GetRuntime();
+ }
+
+protected:
+ TPortManager PortManager;
+ Tests::TServerSettings::TPtr Settings;
+ Tests::TServer::TPtr Server;
+ THolder<Tests::TTenants> Tenants;
+ THolder<Tests::TClient> Client;
+
+ void SetLogging() {
+ if (GetSettings().SupportsRedirect && Tests::IsServerRedirected())
+ return;
+
GetRuntime().SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_DEBUG);
- GetRuntime().SetLogPriority(NKikimrServices::HIVE, NActors::NLog::PRI_NOTICE);
- GetRuntime().SetLogPriority(NKikimrServices::LOCAL, NActors::NLog::PRI_NOTICE);
-
- GetRuntime().SetLogPriority(NKikimrServices::BS_CONTROLLER, NActors::NLog::PRI_NOTICE);
- //GetRuntime().SetLogPriority(NKikimrServices::BS_VDISK_BLOCK, NActors::NLog::PRI_DEBUG);
- //GetRuntime().SetLogPriority(NKikimrServices::BS_PROXY_DISCOVER, NActors::NLog::PRI_DEBUG);
- //GetRuntime().SetLogPriority(NKikimrServices::TABLET_MAIN, NActors::NLog::PRI_DEBUG);
-
- //GetRuntime().SetLogPriority(NKikimrServices::TX_MEDIATOR, NActors::NLog::PRI_DEBUG);
- //GetRuntime().SetLogPriority(NKikimrServices::TX_COORDINATOR, NActors::NLog::PRI_DEBUG);
-
- GetRuntime().SetLogPriority(NKikimrServices::TX_PROXY, NActors::NLog::PRI_TRACE);
- GetRuntime().SetLogPriority(NKikimrServices::TX_PROXY_SCHEME_CACHE, NActors::NLog::PRI_TRACE);
- GetRuntime().SetLogPriority(NKikimrServices::SCHEME_BOARD_REPLICA, NActors::NLog::PRI_DEBUG);
- GetRuntime().SetLogPriority(NKikimrServices::SCHEME_BOARD_POPULATOR, NActors::NLog::PRI_DEBUG);
- GetRuntime().SetLogPriority(NKikimrServices::SCHEME_BOARD_SUBSCRIBER, NActors::NLog::PRI_DEBUG);
- }
-
- void InitRoot() {
- if (GetSettings().SupportsRedirect && Tests::IsServerRedirected())
- return;
-
- GetClient().InitRootScheme();
- }
-};
-
-class TTestEnv: public TBaseTestEnv {
-public:
+ GetRuntime().SetLogPriority(NKikimrServices::HIVE, NActors::NLog::PRI_NOTICE);
+ GetRuntime().SetLogPriority(NKikimrServices::LOCAL, NActors::NLog::PRI_NOTICE);
+
+ GetRuntime().SetLogPriority(NKikimrServices::BS_CONTROLLER, NActors::NLog::PRI_NOTICE);
+ //GetRuntime().SetLogPriority(NKikimrServices::BS_VDISK_BLOCK, NActors::NLog::PRI_DEBUG);
+ //GetRuntime().SetLogPriority(NKikimrServices::BS_PROXY_DISCOVER, NActors::NLog::PRI_DEBUG);
+ //GetRuntime().SetLogPriority(NKikimrServices::TABLET_MAIN, NActors::NLog::PRI_DEBUG);
+
+ //GetRuntime().SetLogPriority(NKikimrServices::TX_MEDIATOR, NActors::NLog::PRI_DEBUG);
+ //GetRuntime().SetLogPriority(NKikimrServices::TX_COORDINATOR, NActors::NLog::PRI_DEBUG);
+
+ GetRuntime().SetLogPriority(NKikimrServices::TX_PROXY, NActors::NLog::PRI_TRACE);
+ GetRuntime().SetLogPriority(NKikimrServices::TX_PROXY_SCHEME_CACHE, NActors::NLog::PRI_TRACE);
+ GetRuntime().SetLogPriority(NKikimrServices::SCHEME_BOARD_REPLICA, NActors::NLog::PRI_DEBUG);
+ GetRuntime().SetLogPriority(NKikimrServices::SCHEME_BOARD_POPULATOR, NActors::NLog::PRI_DEBUG);
+ GetRuntime().SetLogPriority(NKikimrServices::SCHEME_BOARD_SUBSCRIBER, NActors::NLog::PRI_DEBUG);
+ }
+
+ void InitRoot() {
+ if (GetSettings().SupportsRedirect && Tests::IsServerRedirected())
+ return;
+
+ GetClient().InitRootScheme();
+ }
+};
+
+class TTestEnv: public TBaseTestEnv {
+public:
TTestEnv(ui32 staticNodes = 1, ui32 dynamicNodes = 0)
- {
- Settings = new Tests::TServerSettings(PortManager.GetPort(3534));
-
- GetSettings().SetNodeCount(staticNodes);
- GetSettings().SetDynamicNodeCount(dynamicNodes);
-
- Server = new Tests::TServer(Settings);
-
+ {
+ Settings = new Tests::TServerSettings(PortManager.GetPort(3534));
+
+ GetSettings().SetNodeCount(staticNodes);
+ GetSettings().SetDynamicNodeCount(dynamicNodes);
+
+ Server = new Tests::TServer(Settings);
+
Client = MakeHolder<Tests::TClient>(GetSettings());
Tenants = MakeHolder<Tests::TTenants>(Server);
-
- SetLogging();
- InitRoot();
- }
+
+ SetLogging();
+ InitRoot();
+ }
TStoragePools GetPools() {
TStoragePools pools;
@@ -118,106 +118,106 @@ public:
}
return pools;
}
-};
-
-void Print(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
-
-namespace NTestLs {
- TString Finished(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrSchemeOp::EPathType type = NKikimrSchemeOp::EPathTypeDir);
- TString IsUnavailable(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
- TString IsDoesNotExist(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
-
- TString IsSubdomain(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
- TString IsExtSubdomain(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
- TString WithPools(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
-
-
- TString InSubdomain(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrSchemeOp::EPathType type = NKikimrSchemeOp::EPathTypeDir);
- TString InSubdomainWithPools(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrSchemeOp::EPathType type = NKikimrSchemeOp::EPathTypeDir);
- TString NotInSubdomain(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrSchemeOp::EPathType type = NKikimrSchemeOp::EPathTypeDir);
- TString HasUserAttributes(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, TVector<std::pair<TString, TString>> attrs);
- NKikimrSubDomains::TDomainDescription ExtractDomainDescription(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
- TVector<NKikimrSchemeOp::TTablePartition> ExtractTablePartitions(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
- NKikimrSchemeOp::TTableDescription ExtractTableDescription(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
- TString CheckStatus(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrScheme::EStatus schemeStatus = NKikimrScheme::StatusSuccess);
-
- TString ChildrenCount(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, ui64 count);
- TString NoChildren(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
- TString HasChild(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, TString name, NKikimrSchemeOp::EPathType type);
-
- TString PathType(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrSchemeOp::EPathType type);
- TString IsDir(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
- TString IsTable(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
-
-
-
- using TPathVersion = Tests::TClient::TPathVersion;
- TPathVersion ExtractPathVersion(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
+};
+
+void Print(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
+
+namespace NTestLs {
+ TString Finished(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrSchemeOp::EPathType type = NKikimrSchemeOp::EPathTypeDir);
+ TString IsUnavailable(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
+ TString IsDoesNotExist(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
+
+ TString IsSubdomain(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
+ TString IsExtSubdomain(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
+ TString WithPools(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
+
+
+ TString InSubdomain(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrSchemeOp::EPathType type = NKikimrSchemeOp::EPathTypeDir);
+ TString InSubdomainWithPools(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrSchemeOp::EPathType type = NKikimrSchemeOp::EPathTypeDir);
+ TString NotInSubdomain(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrSchemeOp::EPathType type = NKikimrSchemeOp::EPathTypeDir);
+ TString HasUserAttributes(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, TVector<std::pair<TString, TString>> attrs);
+ NKikimrSubDomains::TDomainDescription ExtractDomainDescription(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
+ TVector<NKikimrSchemeOp::TTablePartition> ExtractTablePartitions(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
+ NKikimrSchemeOp::TTableDescription ExtractTableDescription(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
+ TString CheckStatus(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrScheme::EStatus schemeStatus = NKikimrScheme::StatusSuccess);
+
+ TString ChildrenCount(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, ui64 count);
+ TString NoChildren(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
+ TString HasChild(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, TString name, NKikimrSchemeOp::EPathType type);
+
+ TString PathType(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp, NKikimrSchemeOp::EPathType type);
+ TString IsDir(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
+ TString IsTable(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
+
+
+
+ using TPathVersion = Tests::TClient::TPathVersion;
+ TPathVersion ExtractPathVersion(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
TVector<ui64> ExtractTableShards(const TAutoPtr<NMsgBusProxy::TBusResponse>& resp);
-}
-
-namespace NHelpers {
-const TDuration WaitTimeOut = TDuration::Seconds(ChoiceFastOrFat(10, 600));
-
-template <typename T>
-inline constexpr static T ChoiceThreadSanOrDefault(T tsan, T def) noexcept {
-#if defined(_tsan_enabled_)
- Y_UNUSED(def);
- return tsan;
-#else
- Y_UNUSED(tsan);
- return def;
-#endif
-}
-const ui32 active_tenants_nodes = ChoiceThreadSanOrDefault(1, 5);
-
-ui64 CreateSubDomainAndTabletInside(TBaseTestEnv &env, const TString& name, ui64 shard_index, const TStoragePools& pools = {});
-
-void CheckTableIsOfline(TBaseTestEnv &env, ui64 tablet_id);
-void CheckTableBecomeAlive(TBaseTestEnv &env, ui64 tablet_id);
-void CheckTableBecomeOfline(TBaseTestEnv &env, ui64 tablet_id);
-void CheckTableRunOnProperTenantNode(TBaseTestEnv &env, const TString& tenant, ui64 tablet_id);
-
-NKikimrSubDomains::TSubDomainSettings GetSubDomainDeclareSetting(const TString &name, const TStoragePools &pools = {});
-NKikimrSubDomains::TSubDomainSettings GetSubDomainDefaultSetting(const TString &name, const TStoragePools &pools = {});
-
-NKikimrSchemeOp::TTableDescription GetTableSimpleDescription(const TString &name);
-void SetRowInSimpletable(TBaseTestEnv& env, ui64 key, ui64 value, const TString &path);
-}
-
-class TTestEnvWithPoolsSupport: public TBaseTestEnv {
-public:
+}
+
+namespace NHelpers {
+const TDuration WaitTimeOut = TDuration::Seconds(ChoiceFastOrFat(10, 600));
+
+template <typename T>
+inline constexpr static T ChoiceThreadSanOrDefault(T tsan, T def) noexcept {
+#if defined(_tsan_enabled_)
+ Y_UNUSED(def);
+ return tsan;
+#else
+ Y_UNUSED(tsan);
+ return def;
+#endif
+}
+const ui32 active_tenants_nodes = ChoiceThreadSanOrDefault(1, 5);
+
+ui64 CreateSubDomainAndTabletInside(TBaseTestEnv &env, const TString& name, ui64 shard_index, const TStoragePools& pools = {});
+
+void CheckTableIsOfline(TBaseTestEnv &env, ui64 tablet_id);
+void CheckTableBecomeAlive(TBaseTestEnv &env, ui64 tablet_id);
+void CheckTableBecomeOfline(TBaseTestEnv &env, ui64 tablet_id);
+void CheckTableRunOnProperTenantNode(TBaseTestEnv &env, const TString& tenant, ui64 tablet_id);
+
+NKikimrSubDomains::TSubDomainSettings GetSubDomainDeclareSetting(const TString &name, const TStoragePools &pools = {});
+NKikimrSubDomains::TSubDomainSettings GetSubDomainDefaultSetting(const TString &name, const TStoragePools &pools = {});
+
+NKikimrSchemeOp::TTableDescription GetTableSimpleDescription(const TString &name);
+void SetRowInSimpletable(TBaseTestEnv& env, ui64 key, ui64 value, const TString &path);
+}
+
+class TTestEnvWithPoolsSupport: public TBaseTestEnv {
+public:
TTestEnvWithPoolsSupport(ui32 staticNodes = 1, ui32 dynamicNodes = 0, ui32 poolsCount = 2)
- {
- Settings = new Tests::TServerSettings(PortManager.GetPort(3534));
- GetSettings().SetEnableMockOnSingleNode(false);
-
- GetSettings().SetNodeCount(staticNodes);
- GetSettings().SetDynamicNodeCount(dynamicNodes);
+ {
+ Settings = new Tests::TServerSettings(PortManager.GetPort(3534));
+ GetSettings().SetEnableMockOnSingleNode(false);
+
+ GetSettings().SetNodeCount(staticNodes);
+ GetSettings().SetDynamicNodeCount(dynamicNodes);
GetSettings().SetEnableSystemViews(false);
-
- for (ui32 poolNum = 1; poolNum <= poolsCount; ++poolNum) {
- GetSettings().AddStoragePoolType("storage-pool-number-" + ToString(poolNum));
- }
-
- Server = new Tests::TServer(Settings);
-
+
+ for (ui32 poolNum = 1; poolNum <= poolsCount; ++poolNum) {
+ GetSettings().AddStoragePoolType("storage-pool-number-" + ToString(poolNum));
+ }
+
+ Server = new Tests::TServer(Settings);
+
Client = MakeHolder<Tests::TClient>(GetSettings());
Tenants = MakeHolder<Tests::TTenants>(Server);
-
- SetLogging();
- InitRoot();
- }
-
- TStoragePools CreatePoolsForTenant(const TString& tenant) {
- TStoragePools result;
- for (auto& poolType: Settings->StoragePoolTypes) {
- auto& poolKind = poolType.first;
- result.emplace_back(GetClient().CreateStoragePool(poolKind, tenant), poolKind);
- }
- return result;
- }
-};
-
-}}
+
+ SetLogging();
+ InitRoot();
+ }
+
+ TStoragePools CreatePoolsForTenant(const TString& tenant) {
+ TStoragePools result;
+ for (auto& poolType: Settings->StoragePoolTypes) {
+ auto& poolKind = poolType.first;
+ result.emplace_back(GetClient().CreateStoragePool(poolKind, tenant), poolKind);
+ }
+ return result;
+ }
+};
+
+}}
diff --git a/ydb/core/tx/tx_proxy/schemereq.cpp b/ydb/core/tx/tx_proxy/schemereq.cpp
index e032c6e6cea..923fe381ae6 100644
--- a/ydb/core/tx/tx_proxy/schemereq.cpp
+++ b/ydb/core/tx/tx_proxy/schemereq.cpp
@@ -1,5 +1,5 @@
-#include "proxy.h"
-
+#include "proxy.h"
+
#include <ydb/core/tx/schemeshard/schemeshard.h>
#include <ydb/core/protos/flat_scheme_op.pb.h>
#include <ydb/core/base/tablet_pipe.h>
@@ -7,810 +7,810 @@
#include <ydb/core/base/tx_processing.h>
#include <ydb/core/base/kikimr_issue.h>
#include <ydb/core/base/path.h>
-
+
#include <ydb/library/aclib/aclib.h>
#include <library/cpp/actors/core/hfunc.h>
#include <util/string/cast.h>
-
+
namespace NKikimr {
namespace NTxProxy {
static constexpr TStringBuf DocApiRequestType = "_document_api_request";
static constexpr TStringBuf DocApiTableVersionAttribute = "__document_api_version";
-template<typename TDerived>
-struct TBaseSchemeReq: public TActorBootstrapped<TDerived> {
- using TBase = TActorBootstrapped<TDerived>;
+template<typename TDerived>
+struct TBaseSchemeReq: public TActorBootstrapped<TDerived> {
+ using TBase = TActorBootstrapped<TDerived>;
- using TEvSchemeShardPropose = NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction;
+ using TEvSchemeShardPropose = NSchemeShard::TEvSchemeShard::TEvModifySchemeTransaction;
const TTxProxyServices Services;
const ui64 TxId;
THolder<TEvTxProxyReq::TEvSchemeRequest> SchemeRequest;
TIntrusivePtr<TTxProxyMon> TxProxyMon;
- TInstant WallClockStarted;
-
+ TInstant WallClockStarted;
+
TActorId Source;
TActorId PipeClient;
- struct TPathToResolve {
- NKikimrSchemeOp::EOperationType OperationRelated;
+ struct TPathToResolve {
+ NKikimrSchemeOp::EOperationType OperationRelated;
- TVector<TString> Path;
- bool RequiredRedirect = true;
- ui32 RequiredAccess = NACLib::EAccessRights::NoAccess;
+ TVector<TString> Path;
+ bool RequiredRedirect = true;
+ ui32 RequiredAccess = NACLib::EAccessRights::NoAccess;
- std::optional<NKikimrSchemeOp::TModifyACL> RequiredGrandAccess;
+ std::optional<NKikimrSchemeOp::TModifyACL> RequiredGrandAccess;
- TPathToResolve(NKikimrSchemeOp::EOperationType opType)
- : OperationRelated(opType)
- {
+ TPathToResolve(NKikimrSchemeOp::EOperationType opType)
+ : OperationRelated(opType)
+ {
}
- };
+ };
- TVector<TPathToResolve> ResolveForACL;
+ TVector<TPathToResolve> ResolveForACL;
- std::optional<NACLib::TUserToken> UserToken;
+ std::optional<NACLib::TUserToken> UserToken;
- TBaseSchemeReq(const TTxProxyServices &services, ui64 txid, TAutoPtr<TEvTxProxyReq::TEvSchemeRequest> request, const TIntrusivePtr<TTxProxyMon> &txProxyMon)
- : Services(services)
+ TBaseSchemeReq(const TTxProxyServices &services, ui64 txid, TAutoPtr<TEvTxProxyReq::TEvSchemeRequest> request, const TIntrusivePtr<TTxProxyMon> &txProxyMon)
+ : Services(services)
, TxId(txid)
- , SchemeRequest(request)
+ , SchemeRequest(request)
, TxProxyMon(txProxyMon)
- , Source(SchemeRequest->Ev->Sender)
+ , Source(SchemeRequest->Ev->Sender)
{
++*TxProxyMon->SchemeReqInFly;
}
- auto& GetRequestEv() { return *SchemeRequest->Ev->Get(); }
-
- auto& GetRequestProto() { return GetRequestEv().Record; }
-
- auto& GetModifyScheme() { return *GetRequestProto().MutableTransaction()->MutableModifyScheme(); }
-
- auto& GetModifications() { return *GetRequestProto().MutableTransaction()->MutableTransactionalModification(); }
-
-
- void SendPropose(TAutoPtr<TEvSchemeShardPropose> req, ui64 shardToRequest, const TActorContext &ctx) {
- Y_VERIFY(!PipeClient);
-
- if (UserToken) {
- req->Record.SetUserToken(UserToken->SerializeAsString());
+ auto& GetRequestEv() { return *SchemeRequest->Ev->Get(); }
+
+ auto& GetRequestProto() { return GetRequestEv().Record; }
+
+ auto& GetModifyScheme() { return *GetRequestProto().MutableTransaction()->MutableModifyScheme(); }
+
+ auto& GetModifications() { return *GetRequestProto().MutableTransaction()->MutableTransactionalModification(); }
+
+
+ void SendPropose(TAutoPtr<TEvSchemeShardPropose> req, ui64 shardToRequest, const TActorContext &ctx) {
+ Y_VERIFY(!PipeClient);
+
+ if (UserToken) {
+ req->Record.SetUserToken(UserToken->SerializeAsString());
}
-
- NTabletPipe::TClientConfig clientConfig;
- clientConfig.RetryPolicy = {.RetryLimitCount = 3};
- PipeClient = ctx.RegisterWithSameMailbox(NTabletPipe::CreateClient(ctx.SelfID, shardToRequest, clientConfig));
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY, "Actor# " << ctx.SelfID.ToString() << " txid# " << TxId
- << " SEND to# " << shardToRequest << " shardToRequest " << req->ToString());
- NTabletPipe::SendData(ctx, PipeClient, req.Release());
+
+ NTabletPipe::TClientConfig clientConfig;
+ clientConfig.RetryPolicy = {.RetryLimitCount = 3};
+ PipeClient = ctx.RegisterWithSameMailbox(NTabletPipe::CreateClient(ctx.SelfID, shardToRequest, clientConfig));
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY, "Actor# " << ctx.SelfID.ToString() << " txid# " << TxId
+ << " SEND to# " << shardToRequest << " shardToRequest " << req->ToString());
+ NTabletPipe::SendData(ctx, PipeClient, req.Release());
+ }
+
+ static bool IsSplitMergeFromSchemeShard(const NKikimrSchemeOp::TModifyScheme& modifyScheme) {
+ return modifyScheme.GetOperationType() == NKikimrSchemeOp::ESchemeOpSplitMergeTablePartitions
+ && modifyScheme.GetSplitMergeTablePartitions().HasTableLocalId();
+ }
+
+ void SendSplitMergePropose(const TActorContext &ctx) {
+ ui64 shardToRequest = GetModifyScheme().GetSplitMergeTablePartitions().GetSchemeshardId();
+
+ // TODO: Need to check superuser permissions
+
+ auto req = MakeHolder<TEvSchemeShardPropose>(TxId, shardToRequest);
+ req->Record.AddTransaction()->MergeFrom(GetModifyScheme());
+
+ SendPropose(req.Release(), shardToRequest, ctx);
}
- static bool IsSplitMergeFromSchemeShard(const NKikimrSchemeOp::TModifyScheme& modifyScheme) {
- return modifyScheme.GetOperationType() == NKikimrSchemeOp::ESchemeOpSplitMergeTablePartitions
- && modifyScheme.GetSplitMergeTablePartitions().HasTableLocalId();
- }
-
- void SendSplitMergePropose(const TActorContext &ctx) {
- ui64 shardToRequest = GetModifyScheme().GetSplitMergeTablePartitions().GetSchemeshardId();
-
- // TODO: Need to check superuser permissions
-
- auto req = MakeHolder<TEvSchemeShardPropose>(TxId, shardToRequest);
- req->Record.AddTransaction()->MergeFrom(GetModifyScheme());
-
- SendPropose(req.Release(), shardToRequest, ctx);
- }
-
- void ExtractUserToken() {
- if (!GetRequestProto().GetUserToken().empty()) {
- UserToken = NACLib::TUserToken(GetRequestProto().GetUserToken());
+ void ExtractUserToken() {
+ if (!GetRequestProto().GetUserToken().empty()) {
+ UserToken = NACLib::TUserToken(GetRequestProto().GetUserToken());
}
}
- static TVector<TString> Merge(const TVector<TString>& l, TVector<TString>&& r) {
- TVector<TString> result = l;
- std::move(r.begin(), r.end(), std::back_inserter(result));
- return result;
+ static TVector<TString> Merge(const TVector<TString>& l, TVector<TString>&& r) {
+ TVector<TString> result = l;
+ std::move(r.begin(), r.end(), std::back_inserter(result));
+ return result;
}
-
- static TString& GetPathNameForScheme(NKikimrSchemeOp::TModifyScheme& modifyScheme) {
- switch (modifyScheme.GetOperationType()) {
- case NKikimrSchemeOp::ESchemeOpMkDir:
- return *modifyScheme.MutableMkDir()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpCreateTable:
- return *modifyScheme.MutableCreateTable()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpCreatePersQueueGroup:
- return *modifyScheme.MutableCreatePersQueueGroup()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpDropTable:
- case NKikimrSchemeOp::ESchemeOpDropPersQueueGroup:
- case NKikimrSchemeOp::ESchemeOpRmDir:
- case NKikimrSchemeOp::ESchemeOpDropSubDomain:
- case NKikimrSchemeOp::ESchemeOpDropBlockStoreVolume:
- case NKikimrSchemeOp::ESchemeOpDropKesus:
- case NKikimrSchemeOp::ESchemeOpForceDropSubDomain:
- case NKikimrSchemeOp::ESchemeOpDropSolomonVolume:
- case NKikimrSchemeOp::ESchemeOpForceDropUnsafe:
- case NKikimrSchemeOp::ESchemeOpDropTableIndex:
- case NKikimrSchemeOp::ESchemeOpForceDropExtSubDomain:
- case NKikimrSchemeOp::ESchemeOpDropFileStore:
+
+ static TString& GetPathNameForScheme(NKikimrSchemeOp::TModifyScheme& modifyScheme) {
+ switch (modifyScheme.GetOperationType()) {
+ case NKikimrSchemeOp::ESchemeOpMkDir:
+ return *modifyScheme.MutableMkDir()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpCreateTable:
+ return *modifyScheme.MutableCreateTable()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpCreatePersQueueGroup:
+ return *modifyScheme.MutableCreatePersQueueGroup()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpDropTable:
+ case NKikimrSchemeOp::ESchemeOpDropPersQueueGroup:
+ case NKikimrSchemeOp::ESchemeOpRmDir:
+ case NKikimrSchemeOp::ESchemeOpDropSubDomain:
+ case NKikimrSchemeOp::ESchemeOpDropBlockStoreVolume:
+ case NKikimrSchemeOp::ESchemeOpDropKesus:
+ case NKikimrSchemeOp::ESchemeOpForceDropSubDomain:
+ case NKikimrSchemeOp::ESchemeOpDropSolomonVolume:
+ case NKikimrSchemeOp::ESchemeOpForceDropUnsafe:
+ case NKikimrSchemeOp::ESchemeOpDropTableIndex:
+ case NKikimrSchemeOp::ESchemeOpForceDropExtSubDomain:
+ case NKikimrSchemeOp::ESchemeOpDropFileStore:
case NKikimrSchemeOp::ESchemeOpDropColumnStore:
case NKikimrSchemeOp::ESchemeOpDropColumnTable:
- case NKikimrSchemeOp::ESchemeOpDropSequence:
+ case NKikimrSchemeOp::ESchemeOpDropSequence:
case NKikimrSchemeOp::ESchemeOpDropReplication:
- return *modifyScheme.MutableDrop()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpAlterTable:
- return *modifyScheme.MutableAlterTable()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpAlterPersQueueGroup:
- return *modifyScheme.MutableAlterPersQueueGroup()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpModifyACL:
- return *modifyScheme.MutableModifyACL()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpSplitMergeTablePartitions:
- Y_FAIL("no implementation for ESchemeOpSplitMergeTablePartitions");
-
- case NKikimrSchemeOp::ESchemeOpBackup:
- return *modifyScheme.MutableBackup()->MutableTableName();
-
- case NKikimrSchemeOp::ESchemeOpCreateSubDomain:
- case NKikimrSchemeOp::ESchemeOpAlterSubDomain:
- case NKikimrSchemeOp::ESchemeOpCreateExtSubDomain:
- case NKikimrSchemeOp::ESchemeOpAlterExtSubDomain:
- return *modifyScheme.MutableSubDomain()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpCreateRtmrVolume:
- return *modifyScheme.MutableCreateRtmrVolume()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpCreateBlockStoreVolume:
- return *modifyScheme.MutableCreateBlockStoreVolume()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpAlterBlockStoreVolume:
- return *modifyScheme.MutableAlterBlockStoreVolume()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpAssignBlockStoreVolume:
- return *modifyScheme.MutableAssignBlockStoreVolume()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpCreateKesus:
- case NKikimrSchemeOp::ESchemeOpAlterKesus:
- return *modifyScheme.MutableKesus()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpCreateSolomonVolume:
- return *modifyScheme.MutableCreateSolomonVolume()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpAlterUserAttributes:
- return *modifyScheme.MutableAlterUserAttributes()->MutablePathName();
-
- case NKikimrSchemeOp::ESchemeOpCreateIndexedTable:
- return *modifyScheme.MutableCreateIndexedTable()->MutableTableDescription()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpCreateTableIndex:
- return *modifyScheme.MutableCreateTableIndex()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpCreateConsistentCopyTables:
- Y_FAIL("no implementation for ESchemeOpCreateConsistentCopyTables");
-
- case NKikimrSchemeOp::ESchemeOp_DEPRECATED_35:
- Y_FAIL("no implementation for ESchemeOp_DEPRECATED_35");
-
- case NKikimrSchemeOp::ESchemeOpUpgradeSubDomain:
- case NKikimrSchemeOp::ESchemeOpUpgradeSubDomainDecision:
- return *modifyScheme.MutableUpgradeSubDomain()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpCreateIndexBuild:
- Y_FAIL("no implementation for ESchemeOpCreateIndexBuild");
-
- case NKikimrSchemeOp::ESchemeOpInitiateBuildIndexMainTable:
- Y_FAIL("no implementation for ESchemeOpInitiateBuildIndexMainTable");
-
- case NKikimrSchemeOp::ESchemeOpCreateLockForIndexBuild:
- Y_FAIL("no implementation for ESchemeOpCreateLockForIndexBuild");
-
- case NKikimrSchemeOp::ESchemeOpApplyIndexBuild:
- Y_FAIL("no implementation for ESchemeOpApplyIndexBuild");
-
- case NKikimrSchemeOp::ESchemeOpFinalizeBuildIndexMainTable:
- Y_FAIL("no implementation for ESchemeOpFinalizeBuildIndexMainTable");
-
- case NKikimrSchemeOp::ESchemeOpAlterTableIndex:
- return *modifyScheme.MutableAlterTableIndex()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpAlterSolomonVolume:
- return *modifyScheme.MutableAlterSolomonVolume()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpDropLock:
- Y_FAIL("no implementation for ESchemeOpDropLock");
-
- case NKikimrSchemeOp::ESchemeOpFinalizeBuildIndexImplTable:
- Y_FAIL("no implementation for ESchemeOpFinalizeBuildIndexImplTable");
-
- case NKikimrSchemeOp::ESchemeOpInitiateBuildIndexImplTable:
- Y_FAIL("no implementation for ESchemeOpInitiateBuildIndexImplTable");
-
- case NKikimrSchemeOp::ESchemeOpDropIndex:
- return *modifyScheme.MutableDropIndex()->MutableTableName();
-
- case NKikimrSchemeOp::ESchemeOpDropTableIndexAtMainTable:
- Y_FAIL("no implementation for ESchemeOpDropTableIndexAtMainTable");
-
- case NKikimrSchemeOp::ESchemeOpCancelIndexBuild:
- return *modifyScheme.MutableCancelIndexBuild()->MutableTablePath();
-
- case NKikimrSchemeOp::ESchemeOpCreateFileStore:
- return *modifyScheme.MutableCreateFileStore()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpAlterFileStore:
- return *modifyScheme.MutableAlterFileStore()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpRestore:
- return *modifyScheme.MutableRestore()->MutableTableName();
-
+ return *modifyScheme.MutableDrop()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpAlterTable:
+ return *modifyScheme.MutableAlterTable()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpAlterPersQueueGroup:
+ return *modifyScheme.MutableAlterPersQueueGroup()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpModifyACL:
+ return *modifyScheme.MutableModifyACL()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpSplitMergeTablePartitions:
+ Y_FAIL("no implementation for ESchemeOpSplitMergeTablePartitions");
+
+ case NKikimrSchemeOp::ESchemeOpBackup:
+ return *modifyScheme.MutableBackup()->MutableTableName();
+
+ case NKikimrSchemeOp::ESchemeOpCreateSubDomain:
+ case NKikimrSchemeOp::ESchemeOpAlterSubDomain:
+ case NKikimrSchemeOp::ESchemeOpCreateExtSubDomain:
+ case NKikimrSchemeOp::ESchemeOpAlterExtSubDomain:
+ return *modifyScheme.MutableSubDomain()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpCreateRtmrVolume:
+ return *modifyScheme.MutableCreateRtmrVolume()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpCreateBlockStoreVolume:
+ return *modifyScheme.MutableCreateBlockStoreVolume()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpAlterBlockStoreVolume:
+ return *modifyScheme.MutableAlterBlockStoreVolume()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpAssignBlockStoreVolume:
+ return *modifyScheme.MutableAssignBlockStoreVolume()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpCreateKesus:
+ case NKikimrSchemeOp::ESchemeOpAlterKesus:
+ return *modifyScheme.MutableKesus()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpCreateSolomonVolume:
+ return *modifyScheme.MutableCreateSolomonVolume()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpAlterUserAttributes:
+ return *modifyScheme.MutableAlterUserAttributes()->MutablePathName();
+
+ case NKikimrSchemeOp::ESchemeOpCreateIndexedTable:
+ return *modifyScheme.MutableCreateIndexedTable()->MutableTableDescription()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpCreateTableIndex:
+ return *modifyScheme.MutableCreateTableIndex()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpCreateConsistentCopyTables:
+ Y_FAIL("no implementation for ESchemeOpCreateConsistentCopyTables");
+
+ case NKikimrSchemeOp::ESchemeOp_DEPRECATED_35:
+ Y_FAIL("no implementation for ESchemeOp_DEPRECATED_35");
+
+ case NKikimrSchemeOp::ESchemeOpUpgradeSubDomain:
+ case NKikimrSchemeOp::ESchemeOpUpgradeSubDomainDecision:
+ return *modifyScheme.MutableUpgradeSubDomain()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpCreateIndexBuild:
+ Y_FAIL("no implementation for ESchemeOpCreateIndexBuild");
+
+ case NKikimrSchemeOp::ESchemeOpInitiateBuildIndexMainTable:
+ Y_FAIL("no implementation for ESchemeOpInitiateBuildIndexMainTable");
+
+ case NKikimrSchemeOp::ESchemeOpCreateLockForIndexBuild:
+ Y_FAIL("no implementation for ESchemeOpCreateLockForIndexBuild");
+
+ case NKikimrSchemeOp::ESchemeOpApplyIndexBuild:
+ Y_FAIL("no implementation for ESchemeOpApplyIndexBuild");
+
+ case NKikimrSchemeOp::ESchemeOpFinalizeBuildIndexMainTable:
+ Y_FAIL("no implementation for ESchemeOpFinalizeBuildIndexMainTable");
+
+ case NKikimrSchemeOp::ESchemeOpAlterTableIndex:
+ return *modifyScheme.MutableAlterTableIndex()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpAlterSolomonVolume:
+ return *modifyScheme.MutableAlterSolomonVolume()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpDropLock:
+ Y_FAIL("no implementation for ESchemeOpDropLock");
+
+ case NKikimrSchemeOp::ESchemeOpFinalizeBuildIndexImplTable:
+ Y_FAIL("no implementation for ESchemeOpFinalizeBuildIndexImplTable");
+
+ case NKikimrSchemeOp::ESchemeOpInitiateBuildIndexImplTable:
+ Y_FAIL("no implementation for ESchemeOpInitiateBuildIndexImplTable");
+
+ case NKikimrSchemeOp::ESchemeOpDropIndex:
+ return *modifyScheme.MutableDropIndex()->MutableTableName();
+
+ case NKikimrSchemeOp::ESchemeOpDropTableIndexAtMainTable:
+ Y_FAIL("no implementation for ESchemeOpDropTableIndexAtMainTable");
+
+ case NKikimrSchemeOp::ESchemeOpCancelIndexBuild:
+ return *modifyScheme.MutableCancelIndexBuild()->MutableTablePath();
+
+ case NKikimrSchemeOp::ESchemeOpCreateFileStore:
+ return *modifyScheme.MutableCreateFileStore()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpAlterFileStore:
+ return *modifyScheme.MutableAlterFileStore()->MutableName();
+
+ case NKikimrSchemeOp::ESchemeOpRestore:
+ return *modifyScheme.MutableRestore()->MutableTableName();
+
case NKikimrSchemeOp::ESchemeOpCreateColumnStore:
return *modifyScheme.MutableCreateColumnStore()->MutableName();
-
+
case NKikimrSchemeOp::ESchemeOpAlterColumnStore:
return *modifyScheme.MutableAlterColumnStore()->MutableName();
-
+
case NKikimrSchemeOp::ESchemeOpCreateColumnTable:
return *modifyScheme.MutableCreateColumnTable()->MutableName();
-
+
case NKikimrSchemeOp::ESchemeOpAlterColumnTable:
return *modifyScheme.MutableAlterColumnTable()->MutableName();
-
- case NKikimrSchemeOp::ESchemeOpAlterLogin:
- Y_FAIL("no implementation for ESchemeOpAlterLogin");
-
- case NKikimrSchemeOp::ESchemeOpCreateCdcStream:
- return *modifyScheme.MutableCreateCdcStream()->MutableTableName();
-
- case NKikimrSchemeOp::ESchemeOpCreateCdcStreamImpl:
- Y_FAIL("no implementation for ESchemeOpCreateCdcStreamImpl");
-
- case NKikimrSchemeOp::ESchemeOpCreateCdcStreamAtTable:
- return *modifyScheme.MutableCreateCdcStream()->MutableTableName();
-
- case NKikimrSchemeOp::ESchemeOpAlterCdcStream:
- return *modifyScheme.MutableAlterCdcStream()->MutableTableName();
-
- case NKikimrSchemeOp::ESchemeOpAlterCdcStreamImpl:
- Y_FAIL("no implementation for ESchemeOpAlterCdcStreamImpl");
-
- case NKikimrSchemeOp::ESchemeOpAlterCdcStreamAtTable:
- return *modifyScheme.MutableAlterCdcStream()->MutableTableName();
-
- case NKikimrSchemeOp::ESchemeOpDropCdcStream:
- return *modifyScheme.MutableDropCdcStream()->MutableTableName();
-
- case NKikimrSchemeOp::ESchemeOpDropCdcStreamImpl:
- Y_FAIL("no implementation for ESchemeOpDropCdcStreamImpl");
-
- case NKikimrSchemeOp::ESchemeOpDropCdcStreamAtTable:
- return *modifyScheme.MutableDropCdcStream()->MutableTableName();
-
- case NKikimrSchemeOp::ESchemeOpMoveTable:
- Y_FAIL("no implementation for ESchemeOpMoveTable");
-
- case NKikimrSchemeOp::ESchemeOpMoveTableIndex:
- Y_FAIL("no implementation for ESchemeOpMoveTableIndex");
-
- case NKikimrSchemeOp::ESchemeOpCreateSequence:
- case NKikimrSchemeOp::ESchemeOpAlterSequence:
- return *modifyScheme.MutableSequence()->MutableName();
-
+
+ case NKikimrSchemeOp::ESchemeOpAlterLogin:
+ Y_FAIL("no implementation for ESchemeOpAlterLogin");
+
+ case NKikimrSchemeOp::ESchemeOpCreateCdcStream:
+ return *modifyScheme.MutableCreateCdcStream()->MutableTableName();
+
+ case NKikimrSchemeOp::ESchemeOpCreateCdcStreamImpl:
+ Y_FAIL("no implementation for ESchemeOpCreateCdcStreamImpl");
+
+ case NKikimrSchemeOp::ESchemeOpCreateCdcStreamAtTable:
+ return *modifyScheme.MutableCreateCdcStream()->MutableTableName();
+
+ case NKikimrSchemeOp::ESchemeOpAlterCdcStream:
+ return *modifyScheme.MutableAlterCdcStream()->MutableTableName();
+
+ case NKikimrSchemeOp::ESchemeOpAlterCdcStreamImpl:
+ Y_FAIL("no implementation for ESchemeOpAlterCdcStreamImpl");
+
+ case NKikimrSchemeOp::ESchemeOpAlterCdcStreamAtTable:
+ return *modifyScheme.MutableAlterCdcStream()->MutableTableName();
+
+ case NKikimrSchemeOp::ESchemeOpDropCdcStream:
+ return *modifyScheme.MutableDropCdcStream()->MutableTableName();
+
+ case NKikimrSchemeOp::ESchemeOpDropCdcStreamImpl:
+ Y_FAIL("no implementation for ESchemeOpDropCdcStreamImpl");
+
+ case NKikimrSchemeOp::ESchemeOpDropCdcStreamAtTable:
+ return *modifyScheme.MutableDropCdcStream()->MutableTableName();
+
+ case NKikimrSchemeOp::ESchemeOpMoveTable:
+ Y_FAIL("no implementation for ESchemeOpMoveTable");
+
+ case NKikimrSchemeOp::ESchemeOpMoveTableIndex:
+ Y_FAIL("no implementation for ESchemeOpMoveTableIndex");
+
+ case NKikimrSchemeOp::ESchemeOpCreateSequence:
+ case NKikimrSchemeOp::ESchemeOpAlterSequence:
+ return *modifyScheme.MutableSequence()->MutableName();
+
case NKikimrSchemeOp::ESchemeOpCreateReplication:
case NKikimrSchemeOp::ESchemeOpAlterReplication:
return *modifyScheme.MutableReplication()->MutableName();
- }
+ }
}
- static bool IsCreateRequest(const NKikimrSchemeOp::TModifyScheme& modifyScheme) {
- switch (modifyScheme.GetOperationType()) {
- // Tenants are always created using cluster's root as working dir, skip it
- //case NKikimrSchemeOp::ESchemeOpCreateSubDomain:
- //case NKikimrSchemeOp::ESchemeOpCreateExtSubDomain:
- case NKikimrSchemeOp::ESchemeOpMkDir:
- case NKikimrSchemeOp::ESchemeOpCreateTable:
- case NKikimrSchemeOp::ESchemeOpCreateIndexedTable:
- case NKikimrSchemeOp::ESchemeOpCreatePersQueueGroup:
- case NKikimrSchemeOp::ESchemeOpCreateKesus:
- case NKikimrSchemeOp::ESchemeOpCreateBlockStoreVolume:
- case NKikimrSchemeOp::ESchemeOpCreateFileStore:
- case NKikimrSchemeOp::ESchemeOpCreateSolomonVolume:
- case NKikimrSchemeOp::ESchemeOpCreateRtmrVolume:
+ static bool IsCreateRequest(const NKikimrSchemeOp::TModifyScheme& modifyScheme) {
+ switch (modifyScheme.GetOperationType()) {
+ // Tenants are always created using cluster's root as working dir, skip it
+ //case NKikimrSchemeOp::ESchemeOpCreateSubDomain:
+ //case NKikimrSchemeOp::ESchemeOpCreateExtSubDomain:
+ case NKikimrSchemeOp::ESchemeOpMkDir:
+ case NKikimrSchemeOp::ESchemeOpCreateTable:
+ case NKikimrSchemeOp::ESchemeOpCreateIndexedTable:
+ case NKikimrSchemeOp::ESchemeOpCreatePersQueueGroup:
+ case NKikimrSchemeOp::ESchemeOpCreateKesus:
+ case NKikimrSchemeOp::ESchemeOpCreateBlockStoreVolume:
+ case NKikimrSchemeOp::ESchemeOpCreateFileStore:
+ case NKikimrSchemeOp::ESchemeOpCreateSolomonVolume:
+ case NKikimrSchemeOp::ESchemeOpCreateRtmrVolume:
case NKikimrSchemeOp::ESchemeOpCreateColumnStore:
case NKikimrSchemeOp::ESchemeOpCreateColumnTable:
- return true;
- default:
- return false;
- }
- }
-
- static bool NeedAdjustPathNames(const NKikimrSchemeOp::TModifyScheme& modifyScheme) {
- return IsCreateRequest(modifyScheme);
- }
-
- static THolder<NSchemeCache::TSchemeCacheNavigate> ResolveRequestForAdjustPathNames(NKikimrSchemeOp::TModifyScheme& scheme) {
- auto parts = Merge(SplitPath(scheme.GetWorkingDir()), SplitPath(GetPathNameForScheme(scheme)));
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ static bool NeedAdjustPathNames(const NKikimrSchemeOp::TModifyScheme& modifyScheme) {
+ return IsCreateRequest(modifyScheme);
+ }
+
+ static THolder<NSchemeCache::TSchemeCacheNavigate> ResolveRequestForAdjustPathNames(NKikimrSchemeOp::TModifyScheme& scheme) {
+ auto parts = Merge(SplitPath(scheme.GetWorkingDir()), SplitPath(GetPathNameForScheme(scheme)));
if (parts.size() < 2) {
- return {};
+ return {};
}
- auto request = MakeHolder<NSchemeCache::TSchemeCacheNavigate>();
+ auto request = MakeHolder<NSchemeCache::TSchemeCacheNavigate>();
TVector<TString> path;
for (auto it = parts.begin(); it != parts.end() - 1; ++it) {
path.emplace_back(*it);
- NSchemeCache::TSchemeCacheNavigate::TEntry entry;
+ NSchemeCache::TSchemeCacheNavigate::TEntry entry;
entry.Path = path;
- entry.Operation = NSchemeCache::TSchemeCacheNavigate::EOp::OpPath;
+ entry.Operation = NSchemeCache::TSchemeCacheNavigate::EOp::OpPath;
entry.SyncVersion = true;
entry.RedirectRequired = false;
request->ResultSet.emplace_back(entry);
}
- return std::move(request);
+ return std::move(request);
}
- void ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus status,
- const NKikimrScheme::TEvModifySchemeTransactionResult* shardResult,
- const NYql::TIssue* issue,
- const TActorContext& ctx)
- {
- auto *result = new TEvTxUserProxy::TEvProposeTransactionStatus(status);
- if (issue) {
- NYql::IssueToMessage(*issue, result->Record.AddIssues());
- }
- if (shardResult) {
- if (shardResult->HasTxId())
- result->Record.SetTxId(shardResult->GetTxId());
-
- if (shardResult->HasSchemeshardId())
- result->Record.SetSchemeShardTabletId(shardResult->GetSchemeshardId());
-
- result->Record.SetSchemeShardStatus(shardResult->GetStatus());
-
- if (shardResult->HasReason() && !shardResult->GetReason().empty())
- result->Record.SetSchemeShardReason(shardResult->GetReason());
-
- if (shardResult->HasPathId()) {
- result->Record.SetPathId(shardResult->GetPathId());
- }
-
- if (shardResult->HasPathCreateTxId()) {
- result->Record.SetPathCreateTxId(shardResult->GetPathCreateTxId());
- }
-
- if (shardResult->HasPathDropTxId()) {
- result->Record.SetPathDropTxId(shardResult->GetPathDropTxId());
- }
- } else {
- switch (status) {
- case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ResolveError:
- // (xenoxeno) for compatibility with KQP and maybe others...
- result->Record.SetSchemeShardStatus(NKikimrScheme::EStatus::StatusPathDoesNotExist);
- result->Record.SetSchemeShardReason("Path does not exist");
- break;
- case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ProxyShardNotAvailable:
- result->Record.SetSchemeShardStatus(NKikimrScheme::EStatus::StatusNotAvailable);
- result->Record.SetSchemeShardReason("Schemeshard not available");
+ void ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus status,
+ const NKikimrScheme::TEvModifySchemeTransactionResult* shardResult,
+ const NYql::TIssue* issue,
+ const TActorContext& ctx)
+ {
+ auto *result = new TEvTxUserProxy::TEvProposeTransactionStatus(status);
+ if (issue) {
+ NYql::IssueToMessage(*issue, result->Record.AddIssues());
+ }
+ if (shardResult) {
+ if (shardResult->HasTxId())
+ result->Record.SetTxId(shardResult->GetTxId());
+
+ if (shardResult->HasSchemeshardId())
+ result->Record.SetSchemeShardTabletId(shardResult->GetSchemeshardId());
+
+ result->Record.SetSchemeShardStatus(shardResult->GetStatus());
+
+ if (shardResult->HasReason() && !shardResult->GetReason().empty())
+ result->Record.SetSchemeShardReason(shardResult->GetReason());
+
+ if (shardResult->HasPathId()) {
+ result->Record.SetPathId(shardResult->GetPathId());
+ }
+
+ if (shardResult->HasPathCreateTxId()) {
+ result->Record.SetPathCreateTxId(shardResult->GetPathCreateTxId());
+ }
+
+ if (shardResult->HasPathDropTxId()) {
+ result->Record.SetPathDropTxId(shardResult->GetPathDropTxId());
+ }
+ } else {
+ switch (status) {
+ case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ResolveError:
+ // (xenoxeno) for compatibility with KQP and maybe others...
+ result->Record.SetSchemeShardStatus(NKikimrScheme::EStatus::StatusPathDoesNotExist);
+ result->Record.SetSchemeShardReason("Path does not exist");
break;
- default:
- break;
- }
- }
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY, "Actor# " << ctx.SelfID.ToString() << " txid# " << TxId
- << " SEND to# " << Source.ToString() << " Source " << result->ToString());
-
- if (result->Record.GetSchemeShardReason()) {
- auto issue = MakeIssue(NKikimrIssues::TIssuesIds::DEFAULT_ERROR, result->Record.GetSchemeShardReason());
- NYql::IssueToMessage(issue, result->Record.AddIssues());
- }
- ctx.Send(Source, result);
- }
-
- void ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus status, const TActorContext &ctx)
- {
- ReportStatus(status, nullptr, nullptr, ctx);
- }
-
- void Bootstrap(const TActorContext&) {
- ExtractUserToken();
- }
-
- void Die(const TActorContext &ctx) override {
- --*TxProxyMon->SchemeReqInFly;
-
- if (PipeClient) {
- NTabletPipe::CloseClient(ctx, PipeClient);
- PipeClient = TActorId();
- }
-
- TBase::Die(ctx);
- }
-
- // https://st.yandex-team.ru/KIKIMR-12624 move that logic to the schemeshard
- bool CheckTablePrereqs(const NKikimrSchemeOp::TTableDescription &desc, const TString &path, const TActorContext& ctx) {
- // check ad-hoc prereqs for table alter/creation
-
- // 1. split and external blobs must not be used simultaneously
- if (desc.HasPartitionConfig()) {
- const auto &partition = desc.GetPartitionConfig();
- if (partition.HasPartitioningPolicy() && partition.GetPartitioningPolicy().GetSizeToSplit() > 0) {
- if (PartitionConfigHasExternalBlobsEnabled(partition)) {
- LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY, "Actor#" << ctx.SelfID.ToString() << " txid# " << TxId << " must not use auto-split and external blobs simultaneously, path# " << path);
- return false;
- }
- }
- }
-
- return true;
- }
-
- bool ExamineTables(NKikimrSchemeOp::TModifyScheme& pbModifyScheme, const TActorContext& ctx) {
- switch (pbModifyScheme.GetOperationType()) {
- case NKikimrSchemeOp::ESchemeOpAlterTable: {
- auto path = JoinPath({pbModifyScheme.GetWorkingDir(), GetPathNameForScheme(pbModifyScheme)});
- if (!CheckTablePrereqs(pbModifyScheme.GetAlterTable(), path, ctx)) {
- return false;
- }
- break;
- }
- case NKikimrSchemeOp::ESchemeOpCreateTable: {
- auto path = JoinPath({pbModifyScheme.GetWorkingDir(), GetPathNameForScheme(pbModifyScheme)});
- if (!CheckTablePrereqs(pbModifyScheme.GetCreateTable(), path, ctx)) {
- return false;
- }
- break;
- }
- case NKikimrSchemeOp::ESchemeOpCreateIndexedTable: {
- auto path = JoinPath({pbModifyScheme.GetWorkingDir(), GetPathNameForScheme(pbModifyScheme)});
- if (!CheckTablePrereqs(pbModifyScheme.GetCreateIndexedTable().GetTableDescription(), path, ctx)) {
- return false;
- }
- break;
- }
- default:
- break;
- }
-
- return true;
- }
-
- bool ExtractResolveForACL(NKikimrSchemeOp::TModifyScheme& pbModifyScheme) {
- ui32 accessToUserAttrs = pbModifyScheme.HasAlterUserAttributes() ? NACLib::EAccessRights::WriteUserAttributes : NACLib::EAccessRights::NoAccess;
- auto workingDir = SplitPath(pbModifyScheme.GetWorkingDir());
-
- switch (pbModifyScheme.GetOperationType()) {
- case NKikimrSchemeOp::ESchemeOpUpgradeSubDomain:
- case NKikimrSchemeOp::ESchemeOpUpgradeSubDomainDecision:
- case NKikimrSchemeOp::ESchemeOpAlterSubDomain:
- case NKikimrSchemeOp::ESchemeOpAlterExtSubDomain:
- {
- auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
- toResolve.Path = Merge(workingDir, SplitPath(GetPathNameForScheme(pbModifyScheme)));
- toResolve.RequiredAccess = NACLib::EAccessRights::CreateDatabase | NACLib::EAccessRights::AlterSchema | accessToUserAttrs;
- toResolve.RequiredRedirect = false;
- ResolveForACL.push_back(toResolve);
- break;
- }
- case NKikimrSchemeOp::ESchemeOpCreateSubDomain:
- case NKikimrSchemeOp::ESchemeOpCreateExtSubDomain:
- {
- auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
- toResolve.Path = workingDir;
- toResolve.RequiredAccess = NACLib::EAccessRights::CreateDatabase | accessToUserAttrs;
- toResolve.RequiredRedirect = false;
- ResolveForACL.push_back(toResolve);
- break;
- }
- case NKikimrSchemeOp::ESchemeOpAlterUserAttributes:
- {
- auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
- toResolve.Path = Merge(workingDir, SplitPath(GetPathNameForScheme(pbModifyScheme)));
- toResolve.RequiredAccess = NACLib::EAccessRights::WriteUserAttributes | accessToUserAttrs;
- toResolve.RequiredRedirect = false;
- ResolveForACL.push_back(toResolve);
- break;
- }
- case NKikimrSchemeOp::ESchemeOpSplitMergeTablePartitions: {
- auto& path = pbModifyScheme.GetSplitMergeTablePartitions().GetTablePath();
- TString baseDir = ToString(ExtractParent(path)); // why baseDir?
-
- auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
- toResolve.Path = SplitPath(baseDir);
- toResolve.RequiredAccess = NACLib::EAccessRights::NoAccess; // why not?
- ResolveForACL.push_back(toResolve);
+ case TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ProxyShardNotAvailable:
+ result->Record.SetSchemeShardStatus(NKikimrScheme::EStatus::StatusNotAvailable);
+ result->Record.SetSchemeShardReason("Schemeshard not available");
+ break;
+ default:
+ break;
+ }
+ }
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY, "Actor# " << ctx.SelfID.ToString() << " txid# " << TxId
+ << " SEND to# " << Source.ToString() << " Source " << result->ToString());
+
+ if (result->Record.GetSchemeShardReason()) {
+ auto issue = MakeIssue(NKikimrIssues::TIssuesIds::DEFAULT_ERROR, result->Record.GetSchemeShardReason());
+ NYql::IssueToMessage(issue, result->Record.AddIssues());
+ }
+ ctx.Send(Source, result);
+ }
+
+ void ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus status, const TActorContext &ctx)
+ {
+ ReportStatus(status, nullptr, nullptr, ctx);
+ }
+
+ void Bootstrap(const TActorContext&) {
+ ExtractUserToken();
+ }
+
+ void Die(const TActorContext &ctx) override {
+ --*TxProxyMon->SchemeReqInFly;
+
+ if (PipeClient) {
+ NTabletPipe::CloseClient(ctx, PipeClient);
+ PipeClient = TActorId();
+ }
+
+ TBase::Die(ctx);
+ }
+
+ // https://st.yandex-team.ru/KIKIMR-12624 move that logic to the schemeshard
+ bool CheckTablePrereqs(const NKikimrSchemeOp::TTableDescription &desc, const TString &path, const TActorContext& ctx) {
+ // check ad-hoc prereqs for table alter/creation
+
+ // 1. split and external blobs must not be used simultaneously
+ if (desc.HasPartitionConfig()) {
+ const auto &partition = desc.GetPartitionConfig();
+ if (partition.HasPartitioningPolicy() && partition.GetPartitioningPolicy().GetSizeToSplit() > 0) {
+ if (PartitionConfigHasExternalBlobsEnabled(partition)) {
+ LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY, "Actor#" << ctx.SelfID.ToString() << " txid# " << TxId << " must not use auto-split and external blobs simultaneously, path# " << path);
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ bool ExamineTables(NKikimrSchemeOp::TModifyScheme& pbModifyScheme, const TActorContext& ctx) {
+ switch (pbModifyScheme.GetOperationType()) {
+ case NKikimrSchemeOp::ESchemeOpAlterTable: {
+ auto path = JoinPath({pbModifyScheme.GetWorkingDir(), GetPathNameForScheme(pbModifyScheme)});
+ if (!CheckTablePrereqs(pbModifyScheme.GetAlterTable(), path, ctx)) {
+ return false;
+ }
+ break;
+ }
+ case NKikimrSchemeOp::ESchemeOpCreateTable: {
+ auto path = JoinPath({pbModifyScheme.GetWorkingDir(), GetPathNameForScheme(pbModifyScheme)});
+ if (!CheckTablePrereqs(pbModifyScheme.GetCreateTable(), path, ctx)) {
+ return false;
+ }
+ break;
+ }
+ case NKikimrSchemeOp::ESchemeOpCreateIndexedTable: {
+ auto path = JoinPath({pbModifyScheme.GetWorkingDir(), GetPathNameForScheme(pbModifyScheme)});
+ if (!CheckTablePrereqs(pbModifyScheme.GetCreateIndexedTable().GetTableDescription(), path, ctx)) {
+ return false;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ return true;
+ }
+
+ bool ExtractResolveForACL(NKikimrSchemeOp::TModifyScheme& pbModifyScheme) {
+ ui32 accessToUserAttrs = pbModifyScheme.HasAlterUserAttributes() ? NACLib::EAccessRights::WriteUserAttributes : NACLib::EAccessRights::NoAccess;
+ auto workingDir = SplitPath(pbModifyScheme.GetWorkingDir());
+
+ switch (pbModifyScheme.GetOperationType()) {
+ case NKikimrSchemeOp::ESchemeOpUpgradeSubDomain:
+ case NKikimrSchemeOp::ESchemeOpUpgradeSubDomainDecision:
+ case NKikimrSchemeOp::ESchemeOpAlterSubDomain:
+ case NKikimrSchemeOp::ESchemeOpAlterExtSubDomain:
+ {
+ auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
+ toResolve.Path = Merge(workingDir, SplitPath(GetPathNameForScheme(pbModifyScheme)));
+ toResolve.RequiredAccess = NACLib::EAccessRights::CreateDatabase | NACLib::EAccessRights::AlterSchema | accessToUserAttrs;
+ toResolve.RequiredRedirect = false;
+ ResolveForACL.push_back(toResolve);
break;
- }
- case NKikimrSchemeOp::ESchemeOpAlterTable:
- case NKikimrSchemeOp::ESchemeOpDropIndex:
- case NKikimrSchemeOp::ESchemeOpCreateCdcStream:
- case NKikimrSchemeOp::ESchemeOpAlterCdcStream:
- case NKikimrSchemeOp::ESchemeOpDropCdcStream:
- case NKikimrSchemeOp::ESchemeOpAlterPersQueueGroup:
- case NKikimrSchemeOp::ESchemeOpAlterBlockStoreVolume:
- case NKikimrSchemeOp::ESchemeOpAssignBlockStoreVolume:
- case NKikimrSchemeOp::ESchemeOpAlterFileStore:
- case NKikimrSchemeOp::ESchemeOpAlterKesus:
- case NKikimrSchemeOp::ESchemeOpBackup:
- case NKikimrSchemeOp::ESchemeOpAlterSolomonVolume:
+ }
+ case NKikimrSchemeOp::ESchemeOpCreateSubDomain:
+ case NKikimrSchemeOp::ESchemeOpCreateExtSubDomain:
+ {
+ auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
+ toResolve.Path = workingDir;
+ toResolve.RequiredAccess = NACLib::EAccessRights::CreateDatabase | accessToUserAttrs;
+ toResolve.RequiredRedirect = false;
+ ResolveForACL.push_back(toResolve);
+ break;
+ }
+ case NKikimrSchemeOp::ESchemeOpAlterUserAttributes:
+ {
+ auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
+ toResolve.Path = Merge(workingDir, SplitPath(GetPathNameForScheme(pbModifyScheme)));
+ toResolve.RequiredAccess = NACLib::EAccessRights::WriteUserAttributes | accessToUserAttrs;
+ toResolve.RequiredRedirect = false;
+ ResolveForACL.push_back(toResolve);
+ break;
+ }
+ case NKikimrSchemeOp::ESchemeOpSplitMergeTablePartitions: {
+ auto& path = pbModifyScheme.GetSplitMergeTablePartitions().GetTablePath();
+ TString baseDir = ToString(ExtractParent(path)); // why baseDir?
+
+ auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
+ toResolve.Path = SplitPath(baseDir);
+ toResolve.RequiredAccess = NACLib::EAccessRights::NoAccess; // why not?
+ ResolveForACL.push_back(toResolve);
+ break;
+ }
+ case NKikimrSchemeOp::ESchemeOpAlterTable:
+ case NKikimrSchemeOp::ESchemeOpDropIndex:
+ case NKikimrSchemeOp::ESchemeOpCreateCdcStream:
+ case NKikimrSchemeOp::ESchemeOpAlterCdcStream:
+ case NKikimrSchemeOp::ESchemeOpDropCdcStream:
+ case NKikimrSchemeOp::ESchemeOpAlterPersQueueGroup:
+ case NKikimrSchemeOp::ESchemeOpAlterBlockStoreVolume:
+ case NKikimrSchemeOp::ESchemeOpAssignBlockStoreVolume:
+ case NKikimrSchemeOp::ESchemeOpAlterFileStore:
+ case NKikimrSchemeOp::ESchemeOpAlterKesus:
+ case NKikimrSchemeOp::ESchemeOpBackup:
+ case NKikimrSchemeOp::ESchemeOpAlterSolomonVolume:
case NKikimrSchemeOp::ESchemeOpAlterColumnStore:
case NKikimrSchemeOp::ESchemeOpAlterColumnTable:
- case NKikimrSchemeOp::ESchemeOpAlterSequence:
+ case NKikimrSchemeOp::ESchemeOpAlterSequence:
case NKikimrSchemeOp::ESchemeOpAlterReplication:
- {
- auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
- toResolve.Path = Merge(workingDir, SplitPath(GetPathNameForScheme(pbModifyScheme)));
- toResolve.RequiredAccess = NACLib::EAccessRights::AlterSchema | accessToUserAttrs;
- ResolveForACL.push_back(toResolve);
+ {
+ auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
+ toResolve.Path = Merge(workingDir, SplitPath(GetPathNameForScheme(pbModifyScheme)));
+ toResolve.RequiredAccess = NACLib::EAccessRights::AlterSchema | accessToUserAttrs;
+ ResolveForACL.push_back(toResolve);
break;
- }
- case NKikimrSchemeOp::ESchemeOpRmDir:
- case NKikimrSchemeOp::ESchemeOpDropBlockStoreVolume:
- case NKikimrSchemeOp::ESchemeOpDropFileStore:
- case NKikimrSchemeOp::ESchemeOpDropKesus:
- case NKikimrSchemeOp::ESchemeOpDropPersQueueGroup:
- case NKikimrSchemeOp::ESchemeOpDropTable:
- case NKikimrSchemeOp::ESchemeOpDropSolomonVolume:
+ }
+ case NKikimrSchemeOp::ESchemeOpRmDir:
+ case NKikimrSchemeOp::ESchemeOpDropBlockStoreVolume:
+ case NKikimrSchemeOp::ESchemeOpDropFileStore:
+ case NKikimrSchemeOp::ESchemeOpDropKesus:
+ case NKikimrSchemeOp::ESchemeOpDropPersQueueGroup:
+ case NKikimrSchemeOp::ESchemeOpDropTable:
+ case NKikimrSchemeOp::ESchemeOpDropSolomonVolume:
case NKikimrSchemeOp::ESchemeOpDropColumnStore:
case NKikimrSchemeOp::ESchemeOpDropColumnTable:
case NKikimrSchemeOp::ESchemeOpDropSequence:
case NKikimrSchemeOp::ESchemeOpDropReplication: {
- auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
- toResolve.Path = Merge(workingDir, SplitPath(GetPathNameForScheme(pbModifyScheme)));
- toResolve.RequiredAccess = NACLib::EAccessRights::RemoveSchema;
- ResolveForACL.push_back(toResolve);
- break;
- }
- case NKikimrSchemeOp::ESchemeOpDropSubDomain:
- case NKikimrSchemeOp::ESchemeOpForceDropSubDomain:
- case NKikimrSchemeOp::ESchemeOpForceDropExtSubDomain: {
- auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
- toResolve.Path = Merge(workingDir, SplitPath(GetPathNameForScheme(pbModifyScheme)));
- toResolve.RequiredAccess = NACLib::EAccessRights::DropDatabase;
- toResolve.RequiredRedirect = false;
- ResolveForACL.push_back(toResolve);
- break;
- }
- case NKikimrSchemeOp::ESchemeOpForceDropUnsafe: {
- auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
- toResolve.Path = Merge(workingDir, SplitPath(GetPathNameForScheme(pbModifyScheme)));
- toResolve.RequiredAccess = NACLib::EAccessRights::DropDatabase | NACLib::EAccessRights::RemoveSchema;
- toResolve.RequiredRedirect = false;
- ResolveForACL.push_back(toResolve);
+ auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
+ toResolve.Path = Merge(workingDir, SplitPath(GetPathNameForScheme(pbModifyScheme)));
+ toResolve.RequiredAccess = NACLib::EAccessRights::RemoveSchema;
+ ResolveForACL.push_back(toResolve);
+ break;
+ }
+ case NKikimrSchemeOp::ESchemeOpDropSubDomain:
+ case NKikimrSchemeOp::ESchemeOpForceDropSubDomain:
+ case NKikimrSchemeOp::ESchemeOpForceDropExtSubDomain: {
+ auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
+ toResolve.Path = Merge(workingDir, SplitPath(GetPathNameForScheme(pbModifyScheme)));
+ toResolve.RequiredAccess = NACLib::EAccessRights::DropDatabase;
+ toResolve.RequiredRedirect = false;
+ ResolveForACL.push_back(toResolve);
break;
- }
- case NKikimrSchemeOp::ESchemeOpModifyACL: {
- auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
- toResolve.Path = Merge(workingDir, SplitPath(GetPathNameForScheme(pbModifyScheme)));
- toResolve.RequiredAccess = NACLib::EAccessRights::GrantAccessRights | accessToUserAttrs;
- toResolve.RequiredGrandAccess = pbModifyScheme.GetModifyACL();
- ResolveForACL.push_back(toResolve);
+ }
+ case NKikimrSchemeOp::ESchemeOpForceDropUnsafe: {
+ auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
+ toResolve.Path = Merge(workingDir, SplitPath(GetPathNameForScheme(pbModifyScheme)));
+ toResolve.RequiredAccess = NACLib::EAccessRights::DropDatabase | NACLib::EAccessRights::RemoveSchema;
+ toResolve.RequiredRedirect = false;
+ ResolveForACL.push_back(toResolve);
break;
- }
- case NKikimrSchemeOp::ESchemeOpCreateTable: {
- auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
- toResolve.Path = workingDir;
- toResolve.RequiredAccess = NACLib::EAccessRights::CreateTable | accessToUserAttrs;
- ResolveForACL.push_back(toResolve);
-
- if (pbModifyScheme.GetCreateTable().HasCopyFromTable()) {
- auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
- toResolve.Path = SplitPath(pbModifyScheme.GetCreateTable().GetCopyFromTable());
- toResolve.RequiredAccess = NACLib::EAccessRights::SelectRow;
- ResolveForACL.push_back(toResolve);
- }
+ }
+ case NKikimrSchemeOp::ESchemeOpModifyACL: {
+ auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
+ toResolve.Path = Merge(workingDir, SplitPath(GetPathNameForScheme(pbModifyScheme)));
+ toResolve.RequiredAccess = NACLib::EAccessRights::GrantAccessRights | accessToUserAttrs;
+ toResolve.RequiredGrandAccess = pbModifyScheme.GetModifyACL();
+ ResolveForACL.push_back(toResolve);
break;
- }
- case NKikimrSchemeOp::ESchemeOpCreateIndexedTable:
+ }
+ case NKikimrSchemeOp::ESchemeOpCreateTable: {
+ auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
+ toResolve.Path = workingDir;
+ toResolve.RequiredAccess = NACLib::EAccessRights::CreateTable | accessToUserAttrs;
+ ResolveForACL.push_back(toResolve);
+
+ if (pbModifyScheme.GetCreateTable().HasCopyFromTable()) {
+ auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
+ toResolve.Path = SplitPath(pbModifyScheme.GetCreateTable().GetCopyFromTable());
+ toResolve.RequiredAccess = NACLib::EAccessRights::SelectRow;
+ ResolveForACL.push_back(toResolve);
+ }
+ break;
+ }
+ case NKikimrSchemeOp::ESchemeOpCreateIndexedTable:
case NKikimrSchemeOp::ESchemeOpCreateColumnStore:
case NKikimrSchemeOp::ESchemeOpCreateColumnTable:
- case NKikimrSchemeOp::ESchemeOpCreateBlockStoreVolume:
- case NKikimrSchemeOp::ESchemeOpCreateFileStore:
- case NKikimrSchemeOp::ESchemeOpCreateRtmrVolume:
- case NKikimrSchemeOp::ESchemeOpCreateKesus:
- case NKikimrSchemeOp::ESchemeOpCreateSolomonVolume:
- case NKikimrSchemeOp::ESchemeOpCreateSequence:
+ case NKikimrSchemeOp::ESchemeOpCreateBlockStoreVolume:
+ case NKikimrSchemeOp::ESchemeOpCreateFileStore:
+ case NKikimrSchemeOp::ESchemeOpCreateRtmrVolume:
+ case NKikimrSchemeOp::ESchemeOpCreateKesus:
+ case NKikimrSchemeOp::ESchemeOpCreateSolomonVolume:
+ case NKikimrSchemeOp::ESchemeOpCreateSequence:
case NKikimrSchemeOp::ESchemeOpCreateReplication:
- {
- auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
- toResolve.Path = workingDir;
- toResolve.RequiredAccess = NACLib::EAccessRights::CreateTable | accessToUserAttrs;
- ResolveForACL.push_back(toResolve);
+ {
+ auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
+ toResolve.Path = workingDir;
+ toResolve.RequiredAccess = NACLib::EAccessRights::CreateTable | accessToUserAttrs;
+ ResolveForACL.push_back(toResolve);
+ break;
+ }
+ case NKikimrSchemeOp::ESchemeOpCreateConsistentCopyTables: {
+ for (auto& item: pbModifyScheme.GetCreateConsistentCopyTables().GetCopyTableDescriptions()) {
+ {
+ auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
+ toResolve.Path = SplitPath(item.GetSrcPath());
+ toResolve.RequiredAccess = NACLib::EAccessRights::SelectRow;
+ ResolveForACL.push_back(toResolve);
+ }
+ {
+ auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
+ auto dstDir = ToString(ExtractParent(item.GetDstPath()));
+ toResolve.Path = SplitPath(dstDir);
+ toResolve.RequiredAccess = NACLib::EAccessRights::CreateTable;
+ ResolveForACL.push_back(toResolve);
+ }
+ }
+ break;
+ }
+ case NKikimrSchemeOp::ESchemeOpMoveTable: {
+ auto& descr = pbModifyScheme.GetMoveTable();
+ {
+ auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
+ toResolve.Path = SplitPath(descr.GetSrcPath());
+ toResolve.RequiredAccess = NACLib::EAccessRights::SelectRow | NACLib::EAccessRights::RemoveSchema;
+ ResolveForACL.push_back(toResolve);
+ }
+ {
+ auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
+ auto dstDir = ToString(ExtractParent(descr.GetDstPath()));
+ toResolve.Path = SplitPath(dstDir);
+ toResolve.RequiredAccess = NACLib::EAccessRights::CreateTable;
+ ResolveForACL.push_back(toResolve);
+ }
+ break;
+ }
+ case NKikimrSchemeOp::ESchemeOpMkDir:
+ {
+ auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
+ toResolve.Path = workingDir;
+ toResolve.RequiredAccess = NACLib::EAccessRights::CreateDirectory | accessToUserAttrs;
+ ResolveForACL.push_back(toResolve);
break;
- }
- case NKikimrSchemeOp::ESchemeOpCreateConsistentCopyTables: {
- for (auto& item: pbModifyScheme.GetCreateConsistentCopyTables().GetCopyTableDescriptions()) {
- {
- auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
- toResolve.Path = SplitPath(item.GetSrcPath());
- toResolve.RequiredAccess = NACLib::EAccessRights::SelectRow;
- ResolveForACL.push_back(toResolve);
- }
- {
- auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
- auto dstDir = ToString(ExtractParent(item.GetDstPath()));
- toResolve.Path = SplitPath(dstDir);
- toResolve.RequiredAccess = NACLib::EAccessRights::CreateTable;
- ResolveForACL.push_back(toResolve);
- }
- }
- break;
- }
- case NKikimrSchemeOp::ESchemeOpMoveTable: {
- auto& descr = pbModifyScheme.GetMoveTable();
- {
- auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
- toResolve.Path = SplitPath(descr.GetSrcPath());
- toResolve.RequiredAccess = NACLib::EAccessRights::SelectRow | NACLib::EAccessRights::RemoveSchema;
- ResolveForACL.push_back(toResolve);
- }
- {
- auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
- auto dstDir = ToString(ExtractParent(descr.GetDstPath()));
- toResolve.Path = SplitPath(dstDir);
- toResolve.RequiredAccess = NACLib::EAccessRights::CreateTable;
- ResolveForACL.push_back(toResolve);
- }
- break;
- }
- case NKikimrSchemeOp::ESchemeOpMkDir:
- {
- auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
- toResolve.Path = workingDir;
- toResolve.RequiredAccess = NACLib::EAccessRights::CreateDirectory | accessToUserAttrs;
- ResolveForACL.push_back(toResolve);
- break;
- }
- case NKikimrSchemeOp::ESchemeOpCreatePersQueueGroup:
- {
- auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
- toResolve.Path = workingDir;
- toResolve.RequiredAccess = NACLib::EAccessRights::CreateQueue | accessToUserAttrs;
- ResolveForACL.push_back(toResolve);
+ }
+ case NKikimrSchemeOp::ESchemeOpCreatePersQueueGroup:
+ {
+ auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
+ toResolve.Path = workingDir;
+ toResolve.RequiredAccess = NACLib::EAccessRights::CreateQueue | accessToUserAttrs;
+ ResolveForACL.push_back(toResolve);
break;
- }
- case NKikimrSchemeOp::ESchemeOpAlterLogin:
- {
- auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
- toResolve.Path = workingDir;
- toResolve.RequiredAccess = NACLib::EAccessRights::AlterSchema | accessToUserAttrs;
- ResolveForACL.push_back(toResolve);
+ }
+ case NKikimrSchemeOp::ESchemeOpAlterLogin:
+ {
+ auto toResolve = TPathToResolve(pbModifyScheme.GetOperationType());
+ toResolve.Path = workingDir;
+ toResolve.RequiredAccess = NACLib::EAccessRights::AlterSchema | accessToUserAttrs;
+ ResolveForACL.push_back(toResolve);
break;
- }
- case NKikimrSchemeOp::ESchemeOpCreateTableIndex:
- case NKikimrSchemeOp::ESchemeOpDropTableIndex:
- case NKikimrSchemeOp::ESchemeOp_DEPRECATED_35:
- case NKikimrSchemeOp::ESchemeOpCreateIndexBuild:
- case NKikimrSchemeOp::ESchemeOpInitiateBuildIndexMainTable:
- case NKikimrSchemeOp::ESchemeOpCreateLockForIndexBuild:
- case NKikimrSchemeOp::ESchemeOpApplyIndexBuild:
- case NKikimrSchemeOp::ESchemeOpFinalizeBuildIndexMainTable:
- case NKikimrSchemeOp::ESchemeOpAlterTableIndex:
- case NKikimrSchemeOp::ESchemeOpDropLock:
- case NKikimrSchemeOp::ESchemeOpFinalizeBuildIndexImplTable:
- case NKikimrSchemeOp::ESchemeOpInitiateBuildIndexImplTable:
- case NKikimrSchemeOp::ESchemeOpDropTableIndexAtMainTable:
- case NKikimrSchemeOp::ESchemeOpCancelIndexBuild:
- case NKikimrSchemeOp::ESchemeOpRestore:
- case NKikimrSchemeOp::ESchemeOpCreateCdcStreamImpl:
- case NKikimrSchemeOp::ESchemeOpCreateCdcStreamAtTable:
- case NKikimrSchemeOp::ESchemeOpAlterCdcStreamImpl:
- case NKikimrSchemeOp::ESchemeOpAlterCdcStreamAtTable:
- case NKikimrSchemeOp::ESchemeOpDropCdcStreamImpl:
- case NKikimrSchemeOp::ESchemeOpDropCdcStreamAtTable:
- case NKikimrSchemeOp::ESchemeOpMoveTableIndex:
- return false;
- }
- return true;
- }
-
- THolder<NSchemeCache::TSchemeCacheNavigate> ResolveRequestForACL() {
- if (!ResolveForACL) {
- return {};
- }
-
- for(auto& toReq: ResolveForACL) {
- if (toReq.Path.empty()) {
- return {};
- }
- }
-
- TAutoPtr<NSchemeCache::TSchemeCacheNavigate> request(new NSchemeCache::TSchemeCacheNavigate());
- request->DatabaseName = GetRequestProto().GetDatabaseName();
-
- for(auto& toReq: ResolveForACL) {
- NSchemeCache::TSchemeCacheNavigate::TEntry entry;
- entry.Operation = NSchemeCache::TSchemeCacheNavigate::OpPath;
- entry.Path = toReq.Path;
- entry.RedirectRequired = toReq.RequiredRedirect;
- entry.SyncVersion = true;
+ }
+ case NKikimrSchemeOp::ESchemeOpCreateTableIndex:
+ case NKikimrSchemeOp::ESchemeOpDropTableIndex:
+ case NKikimrSchemeOp::ESchemeOp_DEPRECATED_35:
+ case NKikimrSchemeOp::ESchemeOpCreateIndexBuild:
+ case NKikimrSchemeOp::ESchemeOpInitiateBuildIndexMainTable:
+ case NKikimrSchemeOp::ESchemeOpCreateLockForIndexBuild:
+ case NKikimrSchemeOp::ESchemeOpApplyIndexBuild:
+ case NKikimrSchemeOp::ESchemeOpFinalizeBuildIndexMainTable:
+ case NKikimrSchemeOp::ESchemeOpAlterTableIndex:
+ case NKikimrSchemeOp::ESchemeOpDropLock:
+ case NKikimrSchemeOp::ESchemeOpFinalizeBuildIndexImplTable:
+ case NKikimrSchemeOp::ESchemeOpInitiateBuildIndexImplTable:
+ case NKikimrSchemeOp::ESchemeOpDropTableIndexAtMainTable:
+ case NKikimrSchemeOp::ESchemeOpCancelIndexBuild:
+ case NKikimrSchemeOp::ESchemeOpRestore:
+ case NKikimrSchemeOp::ESchemeOpCreateCdcStreamImpl:
+ case NKikimrSchemeOp::ESchemeOpCreateCdcStreamAtTable:
+ case NKikimrSchemeOp::ESchemeOpAlterCdcStreamImpl:
+ case NKikimrSchemeOp::ESchemeOpAlterCdcStreamAtTable:
+ case NKikimrSchemeOp::ESchemeOpDropCdcStreamImpl:
+ case NKikimrSchemeOp::ESchemeOpDropCdcStreamAtTable:
+ case NKikimrSchemeOp::ESchemeOpMoveTableIndex:
+ return false;
+ }
+ return true;
+ }
+
+ THolder<NSchemeCache::TSchemeCacheNavigate> ResolveRequestForACL() {
+ if (!ResolveForACL) {
+ return {};
+ }
+
+ for(auto& toReq: ResolveForACL) {
+ if (toReq.Path.empty()) {
+ return {};
+ }
+ }
+
+ TAutoPtr<NSchemeCache::TSchemeCacheNavigate> request(new NSchemeCache::TSchemeCacheNavigate());
+ request->DatabaseName = GetRequestProto().GetDatabaseName();
+
+ for(auto& toReq: ResolveForACL) {
+ NSchemeCache::TSchemeCacheNavigate::TEntry entry;
+ entry.Operation = NSchemeCache::TSchemeCacheNavigate::OpPath;
+ entry.Path = toReq.Path;
+ entry.RedirectRequired = toReq.RequiredRedirect;
+ entry.SyncVersion = true;
entry.ShowPrivatePath = true;
-
- request->ResultSet.emplace_back(std::move(entry));
- }
-
- return std::move(request);
- }
-
- ui64 GetShardToRequest(NSchemeCache::TSchemeCacheNavigate::TEntry& resolveResult, const TPathToResolve& resolveTask) {
- if (!resolveResult.DomainInfo->Params.HasSchemeShard()) {
- return resolveResult.DomainInfo->DomainKey.OwnerId;
- }
-
- if (resolveTask.OperationRelated == NKikimrSchemeOp::ESchemeOpAlterUserAttributes) {
- // ESchemeOpAlterUserAttributes applies on GSS when path is DB
- // but on GSS in other cases
- if (IsDB(resolveResult)) {
- return resolveResult.DomainInfo->DomainKey.OwnerId;
- } else {
- return resolveResult.DomainInfo->Params.GetSchemeShard();
- }
- }
-
- if (resolveResult.RedirectRequired) {
- return resolveResult.DomainInfo->Params.GetSchemeShard();
- } else {
- return resolveResult.DomainInfo->DomainKey.OwnerId;
- }
- }
-
+
+ request->ResultSet.emplace_back(std::move(entry));
+ }
+
+ return std::move(request);
+ }
+
+ ui64 GetShardToRequest(NSchemeCache::TSchemeCacheNavigate::TEntry& resolveResult, const TPathToResolve& resolveTask) {
+ if (!resolveResult.DomainInfo->Params.HasSchemeShard()) {
+ return resolveResult.DomainInfo->DomainKey.OwnerId;
+ }
+
+ if (resolveTask.OperationRelated == NKikimrSchemeOp::ESchemeOpAlterUserAttributes) {
+ // ESchemeOpAlterUserAttributes applies on GSS when path is DB
+ // but on GSS in other cases
+ if (IsDB(resolveResult)) {
+ return resolveResult.DomainInfo->DomainKey.OwnerId;
+ } else {
+ return resolveResult.DomainInfo->Params.GetSchemeShard();
+ }
+ }
+
+ if (resolveResult.RedirectRequired) {
+ return resolveResult.DomainInfo->Params.GetSchemeShard();
+ } else {
+ return resolveResult.DomainInfo->DomainKey.OwnerId;
+ }
+ }
+
void InterpretResolveError(const NSchemeCache::TSchemeCacheNavigate* navigate, const TActorContext &ctx) {
for (const auto& entry: navigate->ResultSet) {
- switch (entry.Status) {
- case NSchemeCache::TSchemeCacheNavigate::EStatus::Ok:
- continue;
-
- case NSchemeCache::TSchemeCacheNavigate::EStatus::PathErrorUnknown: {
- TxProxyMon->ResolveKeySetWrongRequest->Inc();
-
- ui32 access = NACLib::EAccessRights::DescribeSchema;
- if (UserToken && access != 0 && entry.SecurityObject != nullptr) {
- if (!entry.SecurityObject->CheckAccess(access, *UserToken)) {
- LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY,
- "Access denied for " << UserToken->GetUserSID()
- << " with access " << NACLib::AccessRightsToString(access)
- << " to path " << JoinPath(entry.Path) << " because the base path");
- const TString errString = TStringBuilder()
- << "Access denied for " << UserToken->GetUserSID()
- << " to path " << JoinPath(entry.Path);
- auto issue = MakeIssue(NKikimrIssues::TIssuesIds::ACCESS_DENIED, errString);
- ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::AccessDenied, nullptr, &issue, ctx);
- break;
- }
- }
-
- ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ResolveError, ctx);
- break;
- }
- case NSchemeCache::TSchemeCacheNavigate::EStatus::PathNotPath:
- case NSchemeCache::TSchemeCacheNavigate::EStatus::RootUnknown:
- TxProxyMon->ResolveKeySetWrongRequest->Inc();
- ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ResolveError, ctx);
- break;
- case NSchemeCache::TSchemeCacheNavigate::EStatus::RedirectLookupError:
- TxProxyMon->ResolveKeySetFail->Inc();
- ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ProxyShardNotAvailable, ctx);
- break;
- case NSchemeCache::TSchemeCacheNavigate::EStatus::PathNotTable:
- case NSchemeCache::TSchemeCacheNavigate::EStatus::LookupError:
- case NSchemeCache::TSchemeCacheNavigate::EStatus::TableCreationNotComplete:
- case NSchemeCache::TSchemeCacheNavigate::EStatus::Unknown:
- TxProxyMon->ResolveKeySetFail->Inc();
- ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ResolveError, ctx);
- break;
- }
-
- return;
- }
+ switch (entry.Status) {
+ case NSchemeCache::TSchemeCacheNavigate::EStatus::Ok:
+ continue;
+
+ case NSchemeCache::TSchemeCacheNavigate::EStatus::PathErrorUnknown: {
+ TxProxyMon->ResolveKeySetWrongRequest->Inc();
+
+ ui32 access = NACLib::EAccessRights::DescribeSchema;
+ if (UserToken && access != 0 && entry.SecurityObject != nullptr) {
+ if (!entry.SecurityObject->CheckAccess(access, *UserToken)) {
+ LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY,
+ "Access denied for " << UserToken->GetUserSID()
+ << " with access " << NACLib::AccessRightsToString(access)
+ << " to path " << JoinPath(entry.Path) << " because the base path");
+ const TString errString = TStringBuilder()
+ << "Access denied for " << UserToken->GetUserSID()
+ << " to path " << JoinPath(entry.Path);
+ auto issue = MakeIssue(NKikimrIssues::TIssuesIds::ACCESS_DENIED, errString);
+ ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::AccessDenied, nullptr, &issue, ctx);
+ break;
+ }
+ }
+
+ ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ResolveError, ctx);
+ break;
+ }
+ case NSchemeCache::TSchemeCacheNavigate::EStatus::PathNotPath:
+ case NSchemeCache::TSchemeCacheNavigate::EStatus::RootUnknown:
+ TxProxyMon->ResolveKeySetWrongRequest->Inc();
+ ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ResolveError, ctx);
+ break;
+ case NSchemeCache::TSchemeCacheNavigate::EStatus::RedirectLookupError:
+ TxProxyMon->ResolveKeySetFail->Inc();
+ ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ProxyShardNotAvailable, ctx);
+ break;
+ case NSchemeCache::TSchemeCacheNavigate::EStatus::PathNotTable:
+ case NSchemeCache::TSchemeCacheNavigate::EStatus::LookupError:
+ case NSchemeCache::TSchemeCacheNavigate::EStatus::TableCreationNotComplete:
+ case NSchemeCache::TSchemeCacheNavigate::EStatus::Unknown:
+ TxProxyMon->ResolveKeySetFail->Inc();
+ ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ResolveError, ctx);
+ break;
+ }
+
+ return;
+ }
LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY, "Unexpected response from scheme cache"
<< ": " << navigate->ToString(*AppData()->TypeRegistry));
@@ -818,345 +818,345 @@ struct TBaseSchemeReq: public TActorBootstrapped<TDerived> {
TxProxyMon->ResolveKeySetFail->Inc();
ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ResolveError, ctx);
- }
-
- static bool IsDB(const NSchemeCache::TSchemeCacheNavigate::TEntry& entry) {
- switch (entry.Kind) {
- case NSchemeCache::TSchemeCacheNavigate::KindSubdomain:
- case NSchemeCache::TSchemeCacheNavigate::KindExtSubdomain:
- return true;
+ }
+
+ static bool IsDB(const NSchemeCache::TSchemeCacheNavigate::TEntry& entry) {
+ switch (entry.Kind) {
+ case NSchemeCache::TSchemeCacheNavigate::KindSubdomain:
+ case NSchemeCache::TSchemeCacheNavigate::KindExtSubdomain:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ bool CheckACL(const NSchemeCache::TSchemeCacheNavigate::TResultSet& resolveSet, const TActorContext &ctx) {
+ auto resolveIt = resolveSet.begin();
+ auto requestIt = ResolveForACL.begin();
+
+ while (resolveIt != resolveSet.end() && requestIt != ResolveForACL.end()) {
+ const NSchemeCache::TSchemeCacheNavigate::TEntry& entry = *resolveIt;
+ const TPathToResolve& request = *requestIt;
+
+ ui32 access = requestIt->RequiredAccess;
+
+ // request more rights if dst path is DB
+ if (request.OperationRelated == NKikimrSchemeOp::ESchemeOpAlterUserAttributes) {
+ if (IsDB(entry)) {
+ access |= NACLib::EAccessRights::GenericManage;
+ }
+ }
+
+ if (access == NACLib::EAccessRights::NoAccess || !entry.SecurityObject) {
+ ++resolveIt;
+ ++requestIt;
+ continue;
+ }
+
+ if (!entry.SecurityObject->CheckAccess(access, *UserToken)) {
+ LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY,
+ "Access denied for " << UserToken->GetUserSID()
+ << " with access " << NACLib::AccessRightsToString(access)
+ << " to path " << JoinPath(entry.Path));
+
+ const TString errString = TStringBuilder()
+ << "Access denied for " << UserToken->GetUserSID()
+ << " to path " << JoinPath(entry.Path);
+ auto issue = MakeIssue(NKikimrIssues::TIssuesIds::ACCESS_DENIED, errString);
+ ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::AccessDenied, nullptr, &issue, ctx);
+ return false;
+ }
+
+ if (request.OperationRelated == NKikimrSchemeOp::ESchemeOpModifyACL) {
+ const auto& modifyACL = *request.RequiredGrandAccess;
+ if (UserToken->IsExist(entry.SecurityObject->GetOwnerSID())) {
+ ++resolveIt;
+ ++requestIt;
+ continue;
+ }
+
+ if (!modifyACL.GetNewOwner().empty()) {
+ const TString errString = TStringBuilder()
+ << "Access denied for " << UserToken->GetUserSID()
+ << " to change ownership of " << JoinPath(entry.Path)
+ << " to " << modifyACL.GetNewOwner();
+ LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY, errString);
+
+ auto issue = MakeIssue(NKikimrIssues::TIssuesIds::ACCESS_DENIED, errString);
+ ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::AccessDenied, nullptr, &issue, ctx);
+ return false;
+ }
+
+ NACLib::TDiffACL diffACL(modifyACL.GetDiffACL());
+ if (!entry.SecurityObject->CheckGrantAccess(diffACL, *UserToken)) {
+ LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY,
+ "Access denied for " << UserToken->GetUserSID()
+ << " with diff ACL access " << NACLib::AccessRightsToString(NACLib::EAccessRights::GrantAccessRights)
+ << " to path " << JoinPath(entry.Path));
+
+ const TString errString = TStringBuilder()
+ << "Access denied for " << UserToken->GetUserSID()
+ << " to path " << JoinPath(entry.Path);
+ auto issue = MakeIssue(NKikimrIssues::TIssuesIds::ACCESS_DENIED, errString);
+ ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::AccessDenied, nullptr, &issue, ctx);
+ return false;
+ }
+ }
+
+ ++resolveIt;
+ ++requestIt;
+ }
+
+ return true;
+ }
+
+ static bool IsDocApiRestricted(const NKikimrTxUserProxy::TEvProposeTransaction& tx) {
+ if (tx.GetRequestType() == DocApiRequestType) {
+ return false;
+ }
+
+ switch (tx.GetTransaction().GetModifyScheme().GetOperationType()) {
+ case NKikimrSchemeOp::ESchemeOpCreateTable: // CopyTable
+ case NKikimrSchemeOp::ESchemeOpCreateConsistentCopyTables:
+ case NKikimrSchemeOp::ESchemeOpDropTable:
+ return false;
+ default:
+ return true;
+ }
+ }
+
+ bool CheckDocApi(const NSchemeCache::TSchemeCacheNavigate::TResultSet& resolveSet, const TActorContext &ctx) {
+ for (const auto& entry: resolveSet) {
+ if (entry.Attributes.contains(DocApiTableVersionAttribute)) {
+ auto issue = MakeIssue(NKikimrIssues::TIssuesIds::DEFAULT_ERROR, TStringBuilder()
+ << "Document API table cannot be modified"
+ << ": "<< CanonizePath(entry.Path));
+ ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::WrongRequest, nullptr, &issue, ctx);
+ return false;
+ }
+ }
+ return true;
+ }
+
+
+ void Handle(TEvTabletPipe::TEvClientConnected::TPtr &ev, const TActorContext &ctx) {
+ TEvTabletPipe::TEvClientConnected *msg = ev->Get();
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY, "Actor# " << ctx.SelfID.ToString() << " txid# " << TxId
+ << " HANDLE EvClientConnected");
+ Y_VERIFY(msg->ClientId == PipeClient);
+
+ if (msg->Status != NKikimrProto::OK) {
+ ReportStatus(TEvTxUserProxy::TResultStatus::ProxyShardNotAvailable, ctx);
+ return Die(ctx);
+ }
+ }
+
+ void Handle(TEvTabletPipe::TEvClientDestroyed::TPtr &ev, const TActorContext &ctx) {
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY, "Actor# " << ctx.SelfID.ToString() << " txid# " << TxId
+ << " HANDLE EvClientDestroyed");
+ TEvTabletPipe::TEvClientDestroyed *msg = ev->Get();
+ Y_VERIFY(msg->ClientId == PipeClient);
+
+ ReportStatus(TEvTxUserProxy::TResultStatus::ProxyShardNotAvailable, ctx);
+ return Die(ctx);
+ }
+
+ void Handle(NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr &ev, const TActorContext &ctx) {
+ const NKikimrScheme::TEvModifySchemeTransactionResult &record = ev->Get()->Record;
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY, "Actor# " << ctx.SelfID.ToString() << " txid# " << TxId
+ << " Status " << record.GetStatus() << " HANDLE "<< ev->Get()->ToString());
+
+ TxProxyMon->SchemeRequestLatency->Collect((ctx.Now() - WallClockStarted).MilliSeconds());
+
+ switch (record.GetStatus()) {
+ case NKikimrScheme::EStatus::StatusAlreadyExists:
+ case NKikimrScheme::EStatus::StatusSuccess:
+ ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecComplete, &record, nullptr, ctx);
+ break;
+ case NKikimrScheme::EStatus::StatusAccepted:
+ ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecInProgress, &record, nullptr, ctx);
+ break;
default:
- return false;
- }
- }
-
- bool CheckACL(const NSchemeCache::TSchemeCacheNavigate::TResultSet& resolveSet, const TActorContext &ctx) {
- auto resolveIt = resolveSet.begin();
- auto requestIt = ResolveForACL.begin();
-
- while (resolveIt != resolveSet.end() && requestIt != ResolveForACL.end()) {
- const NSchemeCache::TSchemeCacheNavigate::TEntry& entry = *resolveIt;
- const TPathToResolve& request = *requestIt;
-
- ui32 access = requestIt->RequiredAccess;
-
- // request more rights if dst path is DB
- if (request.OperationRelated == NKikimrSchemeOp::ESchemeOpAlterUserAttributes) {
- if (IsDB(entry)) {
- access |= NACLib::EAccessRights::GenericManage;
- }
- }
-
- if (access == NACLib::EAccessRights::NoAccess || !entry.SecurityObject) {
- ++resolveIt;
- ++requestIt;
- continue;
- }
-
- if (!entry.SecurityObject->CheckAccess(access, *UserToken)) {
- LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY,
- "Access denied for " << UserToken->GetUserSID()
- << " with access " << NACLib::AccessRightsToString(access)
- << " to path " << JoinPath(entry.Path));
-
- const TString errString = TStringBuilder()
- << "Access denied for " << UserToken->GetUserSID()
- << " to path " << JoinPath(entry.Path);
- auto issue = MakeIssue(NKikimrIssues::TIssuesIds::ACCESS_DENIED, errString);
- ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::AccessDenied, nullptr, &issue, ctx);
- return false;
- }
-
- if (request.OperationRelated == NKikimrSchemeOp::ESchemeOpModifyACL) {
- const auto& modifyACL = *request.RequiredGrandAccess;
- if (UserToken->IsExist(entry.SecurityObject->GetOwnerSID())) {
- ++resolveIt;
- ++requestIt;
- continue;
- }
-
- if (!modifyACL.GetNewOwner().empty()) {
- const TString errString = TStringBuilder()
- << "Access denied for " << UserToken->GetUserSID()
- << " to change ownership of " << JoinPath(entry.Path)
- << " to " << modifyACL.GetNewOwner();
- LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY, errString);
-
- auto issue = MakeIssue(NKikimrIssues::TIssuesIds::ACCESS_DENIED, errString);
- ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::AccessDenied, nullptr, &issue, ctx);
- return false;
- }
-
- NACLib::TDiffACL diffACL(modifyACL.GetDiffACL());
- if (!entry.SecurityObject->CheckGrantAccess(diffACL, *UserToken)) {
- LOG_ERROR_S(ctx, NKikimrServices::TX_PROXY,
- "Access denied for " << UserToken->GetUserSID()
- << " with diff ACL access " << NACLib::AccessRightsToString(NACLib::EAccessRights::GrantAccessRights)
- << " to path " << JoinPath(entry.Path));
-
- const TString errString = TStringBuilder()
- << "Access denied for " << UserToken->GetUserSID()
- << " to path " << JoinPath(entry.Path);
- auto issue = MakeIssue(NKikimrIssues::TIssuesIds::ACCESS_DENIED, errString);
- ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::AccessDenied, nullptr, &issue, ctx);
- return false;
- }
- }
-
- ++resolveIt;
- ++requestIt;
- }
-
- return true;
- }
-
- static bool IsDocApiRestricted(const NKikimrTxUserProxy::TEvProposeTransaction& tx) {
- if (tx.GetRequestType() == DocApiRequestType) {
- return false;
- }
-
- switch (tx.GetTransaction().GetModifyScheme().GetOperationType()) {
- case NKikimrSchemeOp::ESchemeOpCreateTable: // CopyTable
- case NKikimrSchemeOp::ESchemeOpCreateConsistentCopyTables:
- case NKikimrSchemeOp::ESchemeOpDropTable:
- return false;
- default:
- return true;
- }
- }
-
- bool CheckDocApi(const NSchemeCache::TSchemeCacheNavigate::TResultSet& resolveSet, const TActorContext &ctx) {
- for (const auto& entry: resolveSet) {
- if (entry.Attributes.contains(DocApiTableVersionAttribute)) {
- auto issue = MakeIssue(NKikimrIssues::TIssuesIds::DEFAULT_ERROR, TStringBuilder()
- << "Document API table cannot be modified"
- << ": "<< CanonizePath(entry.Path));
- ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::WrongRequest, nullptr, &issue, ctx);
- return false;
- }
- }
- return true;
- }
-
-
- void Handle(TEvTabletPipe::TEvClientConnected::TPtr &ev, const TActorContext &ctx) {
- TEvTabletPipe::TEvClientConnected *msg = ev->Get();
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY, "Actor# " << ctx.SelfID.ToString() << " txid# " << TxId
- << " HANDLE EvClientConnected");
- Y_VERIFY(msg->ClientId == PipeClient);
-
- if (msg->Status != NKikimrProto::OK) {
- ReportStatus(TEvTxUserProxy::TResultStatus::ProxyShardNotAvailable, ctx);
- return Die(ctx);
- }
+ ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecError, &record, nullptr, ctx);
+ break;
+ }
+
+ return Die(ctx);
}
-
- void Handle(TEvTabletPipe::TEvClientDestroyed::TPtr &ev, const TActorContext &ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY, "Actor# " << ctx.SelfID.ToString() << " txid# " << TxId
- << " HANDLE EvClientDestroyed");
- TEvTabletPipe::TEvClientDestroyed *msg = ev->Get();
- Y_VERIFY(msg->ClientId == PipeClient);
-
- ReportStatus(TEvTxUserProxy::TResultStatus::ProxyShardNotAvailable, ctx);
- return Die(ctx);
- }
-
- void Handle(NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult::TPtr &ev, const TActorContext &ctx) {
- const NKikimrScheme::TEvModifySchemeTransactionResult &record = ev->Get()->Record;
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY, "Actor# " << ctx.SelfID.ToString() << " txid# " << TxId
- << " Status " << record.GetStatus() << " HANDLE "<< ev->Get()->ToString());
-
- TxProxyMon->SchemeRequestLatency->Collect((ctx.Now() - WallClockStarted).MilliSeconds());
-
- switch (record.GetStatus()) {
- case NKikimrScheme::EStatus::StatusAlreadyExists:
- case NKikimrScheme::EStatus::StatusSuccess:
- ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecComplete, &record, nullptr, ctx);
- break;
- case NKikimrScheme::EStatus::StatusAccepted:
- ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecInProgress, &record, nullptr, ctx);
- break;
- default:
- ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecError, &record, nullptr, ctx);
- break;
- }
-
- return Die(ctx);
- }
-
- void Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr &ev, const TActorContext &ctx) {
- NSchemeCache::TSchemeCacheNavigate *navigate = ev->Get()->Request.Get();
-
- TxProxyMon->CacheRequestLatency->Collect((ctx.Now() - WallClockStarted).MilliSeconds());
-
- LOG_LOG_S_SAMPLED_BY(ctx, (navigate->ErrorCount == 0 ? NActors::NLog::PRI_DEBUG : NActors::NLog::PRI_NOTICE),
- NKikimrServices::TX_PROXY, TxId,
- "Actor# " << ctx.SelfID.ToString() << " txid# " << TxId
- << " HANDLE EvNavigateKeySetResult TFlatSchemeReq marker# P5"
- << " ErrorCount# " << navigate->ErrorCount);
-
- Y_VERIFY(!navigate->ResultSet.empty());
-
- if (navigate->ErrorCount > 0) {
+
+ void Handle(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr &ev, const TActorContext &ctx) {
+ NSchemeCache::TSchemeCacheNavigate *navigate = ev->Get()->Request.Get();
+
+ TxProxyMon->CacheRequestLatency->Collect((ctx.Now() - WallClockStarted).MilliSeconds());
+
+ LOG_LOG_S_SAMPLED_BY(ctx, (navigate->ErrorCount == 0 ? NActors::NLog::PRI_DEBUG : NActors::NLog::PRI_NOTICE),
+ NKikimrServices::TX_PROXY, TxId,
+ "Actor# " << ctx.SelfID.ToString() << " txid# " << TxId
+ << " HANDLE EvNavigateKeySetResult TFlatSchemeReq marker# P5"
+ << " ErrorCount# " << navigate->ErrorCount);
+
+ Y_VERIFY(!navigate->ResultSet.empty());
+
+ if (navigate->ErrorCount > 0) {
InterpretResolveError(navigate, ctx);
- return Die(ctx);
- }
-
- Y_VERIFY(!navigate->ResultSet.empty());
- Y_VERIFY(navigate->ResultSet.size() == ResolveForACL.size());
-
- ui64 shardToRequest = GetShardToRequest(*navigate->ResultSet.begin(), *ResolveForACL.begin());
-
- auto request = MakeHolder<TEvSchemeShardPropose>(TxId, shardToRequest);
- if (UserToken) {
- request->Record.SetOwner(UserToken->GetUserSID());
-
- if (!CheckACL(navigate->ResultSet, ctx)) {
- return Die(ctx);
- }
- }
-
- if (IsDocApiRestricted(SchemeRequest->Ev->Get()->Record)) {
- if (!CheckDocApi(navigate->ResultSet, ctx)) {
- return Die(ctx);
- }
- }
-
- if (GetRequestEv().HasModifyScheme()) {
- request->Record.AddTransaction()->MergeFrom(GetModifyScheme());
- } else {
- request->Record.MutableTransaction()->MergeFrom(GetModifications());
- }
-
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
- "Actor# " << ctx.SelfID.ToString()
- << " HANDLE EvNavigateKeySetResult,"
- << " txid# " << TxId
- << " shardToRequest# " << shardToRequest
- << " DomainKey# " << navigate->ResultSet.begin()->DomainInfo->DomainKey
- << " DomainInfo.Params# " << navigate->ResultSet.begin()->DomainInfo->Params.ShortDebugString()
- << " RedirectRequired# " << (navigate->ResultSet.begin()->RedirectRequired ? "true" : "false"));
-
-
- SendPropose(request.Release(), shardToRequest, ctx);
+ return Die(ctx);
+ }
+
+ Y_VERIFY(!navigate->ResultSet.empty());
+ Y_VERIFY(navigate->ResultSet.size() == ResolveForACL.size());
+
+ ui64 shardToRequest = GetShardToRequest(*navigate->ResultSet.begin(), *ResolveForACL.begin());
+
+ auto request = MakeHolder<TEvSchemeShardPropose>(TxId, shardToRequest);
+ if (UserToken) {
+ request->Record.SetOwner(UserToken->GetUserSID());
+
+ if (!CheckACL(navigate->ResultSet, ctx)) {
+ return Die(ctx);
+ }
+ }
+
+ if (IsDocApiRestricted(SchemeRequest->Ev->Get()->Record)) {
+ if (!CheckDocApi(navigate->ResultSet, ctx)) {
+ return Die(ctx);
+ }
+ }
+
+ if (GetRequestEv().HasModifyScheme()) {
+ request->Record.AddTransaction()->MergeFrom(GetModifyScheme());
+ } else {
+ request->Record.MutableTransaction()->MergeFrom(GetModifications());
+ }
+
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
+ "Actor# " << ctx.SelfID.ToString()
+ << " HANDLE EvNavigateKeySetResult,"
+ << " txid# " << TxId
+ << " shardToRequest# " << shardToRequest
+ << " DomainKey# " << navigate->ResultSet.begin()->DomainInfo->DomainKey
+ << " DomainInfo.Params# " << navigate->ResultSet.begin()->DomainInfo->Params.ShortDebugString()
+ << " RedirectRequired# " << (navigate->ResultSet.begin()->RedirectRequired ? "true" : "false"));
+
+
+ SendPropose(request.Release(), shardToRequest, ctx);
static_cast<TDerived*>(this)->Become(&TDerived::StateWaitPrepare);
- }
-};
-
-//////////////////////////////////////////////////////////////
-/// \brief The TFlatSchemeReq struct
-/// struct for Trasaction with one ModifySchema
-///
-struct TFlatSchemeReq : public TBaseSchemeReq<TFlatSchemeReq> {
- using TBase = TBaseSchemeReq<TFlatSchemeReq>;
-
- void Bootstrap(const TActorContext &ctx);
- void ProcessRequest(const TActorContext &ctx);
-
- void HandleWorkingDir(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr &ev, const TActorContext &ctx);
-
- static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
- return NKikimrServices::TActivity::TX_PROXY_SCHEMEREQ;
- }
-
- TFlatSchemeReq(const TTxProxyServices &services, ui64 txid, TAutoPtr<TEvTxProxyReq::TEvSchemeRequest> request, const TIntrusivePtr<TTxProxyMon> &txProxyMon)
- : TBase(services, txid, request, txProxyMon)
- {}
-
- void Die(const TActorContext &ctx) override {
- TBase::Die(ctx);
- }
-
- STFUNC(StateWaitResolveWorkingDir) {
- switch (ev->GetTypeRewrite()) {
- HFunc(TEvTxProxySchemeCache::TEvNavigateKeySetResult, HandleWorkingDir);
- }
- }
-
- STFUNC(StateWaitResolve) {
- switch (ev->GetTypeRewrite()) {
- HFunc(TEvTxProxySchemeCache::TEvNavigateKeySetResult, Handle);
- }
- }
-
- STFUNC(StateWaitPrepare) {
- switch (ev->GetTypeRewrite()) {
- HFunc(NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult, Handle);
- HFunc(TEvTabletPipe::TEvClientConnected, Handle);
- HFunc(TEvTabletPipe::TEvClientDestroyed, Handle);
- }
- }
-};
-
-void TFlatSchemeReq::Bootstrap(const TActorContext &ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
- "Actor# " << ctx.SelfID.ToString()
- << " txid# " << TxId
- << " Bootstrap EvSchemeRequest"
- << " record: " << GetRequestProto().DebugString());
- Y_VERIFY(GetRequestEv().HasModifyScheme());
- Y_VERIFY(!GetRequestEv().HasTransactionalModification());
-
- WallClockStarted = ctx.Now();
-
- TBase::Bootstrap(ctx);
-
- if (IsSplitMergeFromSchemeShard(GetModifyScheme())) {
- SendSplitMergePropose(ctx);
- Become(&TThis::StateWaitPrepare);
- return;
- }
-
- if (!ExamineTables(GetModifyScheme(), ctx)) {
- ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::NotImplemented, ctx);
- TxProxyMon->ResolveKeySetWrongRequest->Inc();
- return Die(ctx);
- }
-
- if (NeedAdjustPathNames(GetModifyScheme())) {
- auto resolveRequest = ResolveRequestForAdjustPathNames(GetModifyScheme());
- if (!resolveRequest) {
- ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ResolveError, ctx);
- TxProxyMon->ResolveKeySetWrongRequest->Inc();
- return Die(ctx);
- }
-
- ctx.Send(Services.SchemeCache, new TEvTxProxySchemeCache::TEvNavigateKeySet(resolveRequest));
- Become(&TThis::StateWaitResolveWorkingDir);
- return;
}
-
- ProcessRequest(ctx);
- }
-
-void TFlatSchemeReq::ProcessRequest(const TActorContext &ctx) {
- if (!ExtractResolveForACL(GetModifyScheme())) {
- ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::NotImplemented, ctx);
- TxProxyMon->ResolveKeySetWrongRequest->Inc();
- return Die(ctx);
- }
-
- auto resolveRequest = ResolveRequestForACL();
- if (!resolveRequest) {
- ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ResolveError, ctx);
- TxProxyMon->ResolveKeySetWrongRequest->Inc();
- return Die(ctx);
- }
-
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY, "Actor# " << ctx.SelfID.ToString() << " txid# " << TxId << " TEvNavigateKeySet requested from SchemeCache");
- ctx.Send(Services.SchemeCache, new TEvTxProxySchemeCache::TEvNavigateKeySet(resolveRequest));
+};
+
+//////////////////////////////////////////////////////////////
+/// \brief The TFlatSchemeReq struct
+/// struct for Trasaction with one ModifySchema
+///
+struct TFlatSchemeReq : public TBaseSchemeReq<TFlatSchemeReq> {
+ using TBase = TBaseSchemeReq<TFlatSchemeReq>;
+
+ void Bootstrap(const TActorContext &ctx);
+ void ProcessRequest(const TActorContext &ctx);
+
+ void HandleWorkingDir(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr &ev, const TActorContext &ctx);
+
+ static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
+ return NKikimrServices::TActivity::TX_PROXY_SCHEMEREQ;
+ }
+
+ TFlatSchemeReq(const TTxProxyServices &services, ui64 txid, TAutoPtr<TEvTxProxyReq::TEvSchemeRequest> request, const TIntrusivePtr<TTxProxyMon> &txProxyMon)
+ : TBase(services, txid, request, txProxyMon)
+ {}
+
+ void Die(const TActorContext &ctx) override {
+ TBase::Die(ctx);
+ }
+
+ STFUNC(StateWaitResolveWorkingDir) {
+ switch (ev->GetTypeRewrite()) {
+ HFunc(TEvTxProxySchemeCache::TEvNavigateKeySetResult, HandleWorkingDir);
+ }
+ }
+
+ STFUNC(StateWaitResolve) {
+ switch (ev->GetTypeRewrite()) {
+ HFunc(TEvTxProxySchemeCache::TEvNavigateKeySetResult, Handle);
+ }
+ }
+
+ STFUNC(StateWaitPrepare) {
+ switch (ev->GetTypeRewrite()) {
+ HFunc(NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult, Handle);
+ HFunc(TEvTabletPipe::TEvClientConnected, Handle);
+ HFunc(TEvTabletPipe::TEvClientDestroyed, Handle);
+ }
+ }
+};
+
+void TFlatSchemeReq::Bootstrap(const TActorContext &ctx) {
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
+ "Actor# " << ctx.SelfID.ToString()
+ << " txid# " << TxId
+ << " Bootstrap EvSchemeRequest"
+ << " record: " << GetRequestProto().DebugString());
+ Y_VERIFY(GetRequestEv().HasModifyScheme());
+ Y_VERIFY(!GetRequestEv().HasTransactionalModification());
+
+ WallClockStarted = ctx.Now();
+
+ TBase::Bootstrap(ctx);
+
+ if (IsSplitMergeFromSchemeShard(GetModifyScheme())) {
+ SendSplitMergePropose(ctx);
+ Become(&TThis::StateWaitPrepare);
+ return;
+ }
+
+ if (!ExamineTables(GetModifyScheme(), ctx)) {
+ ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::NotImplemented, ctx);
+ TxProxyMon->ResolveKeySetWrongRequest->Inc();
+ return Die(ctx);
+ }
+
+ if (NeedAdjustPathNames(GetModifyScheme())) {
+ auto resolveRequest = ResolveRequestForAdjustPathNames(GetModifyScheme());
+ if (!resolveRequest) {
+ ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ResolveError, ctx);
+ TxProxyMon->ResolveKeySetWrongRequest->Inc();
+ return Die(ctx);
+ }
+
+ ctx.Send(Services.SchemeCache, new TEvTxProxySchemeCache::TEvNavigateKeySet(resolveRequest));
+ Become(&TThis::StateWaitResolveWorkingDir);
+ return;
+ }
+
+ ProcessRequest(ctx);
+ }
+
+void TFlatSchemeReq::ProcessRequest(const TActorContext &ctx) {
+ if (!ExtractResolveForACL(GetModifyScheme())) {
+ ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::NotImplemented, ctx);
+ TxProxyMon->ResolveKeySetWrongRequest->Inc();
+ return Die(ctx);
+ }
+
+ auto resolveRequest = ResolveRequestForACL();
+ if (!resolveRequest) {
+ ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ResolveError, ctx);
+ TxProxyMon->ResolveKeySetWrongRequest->Inc();
+ return Die(ctx);
+ }
+
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY, "Actor# " << ctx.SelfID.ToString() << " txid# " << TxId << " TEvNavigateKeySet requested from SchemeCache");
+ ctx.Send(Services.SchemeCache, new TEvTxProxySchemeCache::TEvNavigateKeySet(resolveRequest));
Become(&TThis::StateWaitResolve);
- return;
+ return;
}
void TFlatSchemeReq::HandleWorkingDir(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr &ev, const TActorContext &ctx) {
LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
- "Actor# " << ctx.SelfID.ToString()
+ "Actor# " << ctx.SelfID.ToString()
<< " txid# " << TxId
<< " HANDLE EvNavigateKeySetResult TFlatSchemeReq marker# P6");
- Y_VERIFY(NeedAdjustPathNames(GetModifyScheme()));
+ Y_VERIFY(NeedAdjustPathNames(GetModifyScheme()));
- const auto& resultSet = ev->Get()->Request->ResultSet;
+ const auto& resultSet = ev->Get()->Request->ResultSet;
const TVector<TString>* workingDir = nullptr;
for (auto it = resultSet.rbegin(); it != resultSet.rend(); ++it) {
@@ -1166,7 +1166,7 @@ void TFlatSchemeReq::HandleWorkingDir(TEvTxProxySchemeCache::TEvNavigateKeySetRe
}
}
- auto parts = Merge(SplitPath(GetModifyScheme().GetWorkingDir()), SplitPath(GetPathNameForScheme(GetModifyScheme())));
+ auto parts = Merge(SplitPath(GetModifyScheme().GetWorkingDir()), SplitPath(GetPathNameForScheme(GetModifyScheme())));
if (!workingDir || workingDir->size() >= parts.size()) {
const TString errText = TStringBuilder()
@@ -1181,96 +1181,96 @@ void TFlatSchemeReq::HandleWorkingDir(TEvTxProxySchemeCache::TEvNavigateKeySetRe
return Die(ctx);
}
- GetModifyScheme().SetWorkingDir(CombinePath(workingDir->begin(), workingDir->end()));
- GetPathNameForScheme(GetModifyScheme()) = CombinePath(parts.begin() + workingDir->size(), parts.end(), false);
-
+ GetModifyScheme().SetWorkingDir(CombinePath(workingDir->begin(), workingDir->end()));
+ GetPathNameForScheme(GetModifyScheme()) = CombinePath(parts.begin() + workingDir->size(), parts.end(), false);
+
ProcessRequest(ctx);
}
-//////////////////////////////////////////////////////////////
-/// \brief The TFlatSchemeTransactionalReq struct
-/// struct for Trasaction with several ModifySchema
-///
-struct TSchemeTransactionalReq : public TBaseSchemeReq<TSchemeTransactionalReq> {
- using TBase = TBaseSchemeReq<TSchemeTransactionalReq>;
-
- void Bootstrap(const TActorContext &ctx);
-
- static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
- return NKikimrServices::TActivity::TX_PROXY_SCHEMEREQ;
- }
-
- TSchemeTransactionalReq(const TTxProxyServices &services, ui64 txid, TAutoPtr<TEvTxProxyReq::TEvSchemeRequest> request, const TIntrusivePtr<TTxProxyMon> &txProxyMon)
- : TBase(services, txid, request, txProxyMon)
- {}
-
- void Die(const TActorContext &ctx) override {
- TBase::Die(ctx);
- }
-
- STFUNC(StateWaitResolve) {
- switch (ev->GetTypeRewrite()) {
- HFunc(TEvTxProxySchemeCache::TEvNavigateKeySetResult, Handle);
- }
+//////////////////////////////////////////////////////////////
+/// \brief The TFlatSchemeTransactionalReq struct
+/// struct for Trasaction with several ModifySchema
+///
+struct TSchemeTransactionalReq : public TBaseSchemeReq<TSchemeTransactionalReq> {
+ using TBase = TBaseSchemeReq<TSchemeTransactionalReq>;
+
+ void Bootstrap(const TActorContext &ctx);
+
+ static constexpr NKikimrServices::TActivity::EType ActorActivityType() {
+ return NKikimrServices::TActivity::TX_PROXY_SCHEMEREQ;
}
- STFUNC(StateWaitPrepare) {
- switch (ev->GetTypeRewrite()) {
- HFunc(NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult, Handle);
- HFunc(TEvTabletPipe::TEvClientConnected, Handle);
- HFunc(TEvTabletPipe::TEvClientDestroyed, Handle);
+ TSchemeTransactionalReq(const TTxProxyServices &services, ui64 txid, TAutoPtr<TEvTxProxyReq::TEvSchemeRequest> request, const TIntrusivePtr<TTxProxyMon> &txProxyMon)
+ : TBase(services, txid, request, txProxyMon)
+ {}
+
+ void Die(const TActorContext &ctx) override {
+ TBase::Die(ctx);
+ }
+
+ STFUNC(StateWaitResolve) {
+ switch (ev->GetTypeRewrite()) {
+ HFunc(TEvTxProxySchemeCache::TEvNavigateKeySetResult, Handle);
+ }
+ }
+
+ STFUNC(StateWaitPrepare) {
+ switch (ev->GetTypeRewrite()) {
+ HFunc(NSchemeShard::TEvSchemeShard::TEvModifySchemeTransactionResult, Handle);
+ HFunc(TEvTabletPipe::TEvClientConnected, Handle);
+ HFunc(TEvTabletPipe::TEvClientDestroyed, Handle);
}
- }
-};
-
-void TSchemeTransactionalReq::Bootstrap(const TActorContext &ctx) {
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
- "Actor# " << ctx.SelfID.ToString()
- << " txid# " << TxId
- << " Bootstrap EvSchemeRequest"
- << " record: " << GetRequestProto().DebugString());
- Y_VERIFY(!GetRequestEv().HasModifyScheme());
- Y_VERIFY(GetRequestEv().HasTransactionalModification());
-
- WallClockStarted = ctx.Now();
-
- TBase::Bootstrap(ctx);
-
- for(auto& scheme: GetModifications()) {
- if (!ExamineTables(scheme, ctx)) {
- ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::NotImplemented, ctx);
- TxProxyMon->ResolveKeySetWrongRequest->Inc();
- return Die(ctx);
+ }
+};
+
+void TSchemeTransactionalReq::Bootstrap(const TActorContext &ctx) {
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY,
+ "Actor# " << ctx.SelfID.ToString()
+ << " txid# " << TxId
+ << " Bootstrap EvSchemeRequest"
+ << " record: " << GetRequestProto().DebugString());
+ Y_VERIFY(!GetRequestEv().HasModifyScheme());
+ Y_VERIFY(GetRequestEv().HasTransactionalModification());
+
+ WallClockStarted = ctx.Now();
+
+ TBase::Bootstrap(ctx);
+
+ for(auto& scheme: GetModifications()) {
+ if (!ExamineTables(scheme, ctx)) {
+ ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::NotImplemented, ctx);
+ TxProxyMon->ResolveKeySetWrongRequest->Inc();
+ return Die(ctx);
}
}
- for(auto& scheme: GetModifications()) {
- if (!ExtractResolveForACL(scheme)) {
- ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::NotImplemented, ctx);
- TxProxyMon->ResolveKeySetWrongRequest->Inc();
- return Die(ctx);
+ for(auto& scheme: GetModifications()) {
+ if (!ExtractResolveForACL(scheme)) {
+ ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::NotImplemented, ctx);
+ TxProxyMon->ResolveKeySetWrongRequest->Inc();
+ return Die(ctx);
}
}
- auto resolveRequest = ResolveRequestForACL();
- if (!resolveRequest) {
- ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ResolveError, ctx);
- TxProxyMon->ResolveKeySetWrongRequest->Inc();
+ auto resolveRequest = ResolveRequestForACL();
+ if (!resolveRequest) {
+ ReportStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ResolveError, ctx);
+ TxProxyMon->ResolveKeySetWrongRequest->Inc();
return Die(ctx);
}
- LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY, "Actor# " << ctx.SelfID.ToString() << " txid# " << TxId << " TEvNavigateKeySet requested from SchemeCache");
- ctx.Send(Services.SchemeCache, new TEvTxProxySchemeCache::TEvNavigateKeySet(resolveRequest));
- Become(&TThis::StateWaitResolve);
- return;
+ LOG_DEBUG_S(ctx, NKikimrServices::TX_PROXY, "Actor# " << ctx.SelfID.ToString() << " txid# " << TxId << " TEvNavigateKeySet requested from SchemeCache");
+ ctx.Send(Services.SchemeCache, new TEvTxProxySchemeCache::TEvNavigateKeySet(resolveRequest));
+ Become(&TThis::StateWaitResolve);
+ return;
}
-IActor* CreateTxProxyFlatSchemeReq(const TTxProxyServices &services, const ui64 txid, TAutoPtr<TEvTxProxyReq::TEvSchemeRequest> request, const TIntrusivePtr<NKikimr::NTxProxy::TTxProxyMon>& mon) {
- if (request->Ev->Get()->HasModifyScheme()) {
- return new TFlatSchemeReq(services, txid, request, mon);
- } else {
- return new TSchemeTransactionalReq(services, txid, request, mon);
- }
+IActor* CreateTxProxyFlatSchemeReq(const TTxProxyServices &services, const ui64 txid, TAutoPtr<TEvTxProxyReq::TEvSchemeRequest> request, const TIntrusivePtr<NKikimr::NTxProxy::TTxProxyMon>& mon) {
+ if (request->Ev->Get()->HasModifyScheme()) {
+ return new TFlatSchemeReq(services, txid, request, mon);
+ } else {
+ return new TSchemeTransactionalReq(services, txid, request, mon);
+ }
}
}
diff --git a/ydb/core/tx/tx_proxy/storage_tenant_ut.cpp b/ydb/core/tx/tx_proxy/storage_tenant_ut.cpp
index fd6b242963e..c3b8e9921a8 100644
--- a/ydb/core/tx/tx_proxy/storage_tenant_ut.cpp
+++ b/ydb/core/tx/tx_proxy/storage_tenant_ut.cpp
@@ -1,567 +1,567 @@
-#include "proxy_ut_helpers.h"
-
+#include "proxy_ut_helpers.h"
+
#include <ydb/core/testlib/tablet_helpers.h>
-
+
#include <library/cpp/actors/interconnect/interconnect.h>
-
+
#include <ydb/core/base/path.h>
#include <ydb/core/tx/schemeshard/schemeshard_impl.h>
#include <ydb/core/blobstorage/base/blobstorage_events.h>
#include <ydb/core/tablet/tablet_impl.h>
-
-
-using namespace NKikimr;
-using namespace NTxProxyUT;
-using namespace NHelpers;
-
+
+
+using namespace NKikimr;
+using namespace NTxProxyUT;
+using namespace NHelpers;
+
Y_UNIT_TEST_SUITE(TStorageTenantTest) {
Y_UNIT_TEST(Boot) {
- TTestEnvWithPoolsSupport env;
- auto lsroot = env.GetClient().Ls("/");
- Print(lsroot);
-
- auto lsdomain = env.GetClient().Ls(env.GetRoot());
- Print(lsdomain);
- NTestLs::Finished(lsdomain);
- }
-
+ TTestEnvWithPoolsSupport env;
+ auto lsroot = env.GetClient().Ls("/");
+ Print(lsroot);
+
+ auto lsdomain = env.GetClient().Ls(env.GetRoot());
+ Print(lsdomain);
+ NTestLs::Finished(lsdomain);
+ }
+
Y_UNIT_TEST(LsLs) {
- TTestEnvWithPoolsSupport env(2, 2);
- auto storagePool = env.CreatePoolsForTenant("USER_0");
-
- {
- auto subdomain = GetSubDomainDeclareSetting("USER_0");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain));
- }
-
- NTestLs::InSubdomain(env.GetClient().Ls("/dc-1/USER_0"), NKikimrSchemeOp::EPathTypeSubDomain);
- }
-
- void CheckThatAllChannelsIsRightStoragePools(const NKikimrHive::TEvGetTabletStorageInfoResult& storageInfo, TStoragePools pools) {
- auto& info = storageInfo.GetInfo();
- for (auto& channel: info.GetChannels()) {
- TString poolName = channel.GetStoragePool();
- auto it = std::find_if(pools.begin(), pools.end(), [&] (const TStoragePool& pool) {return pool.GetName() == poolName;});
- UNIT_ASSERT(it != pools.end());
- }
- }
-
+ TTestEnvWithPoolsSupport env(2, 2);
+ auto storagePool = env.CreatePoolsForTenant("USER_0");
+
+ {
+ auto subdomain = GetSubDomainDeclareSetting("USER_0");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain));
+ }
+
+ NTestLs::InSubdomain(env.GetClient().Ls("/dc-1/USER_0"), NKikimrSchemeOp::EPathTypeSubDomain);
+ }
+
+ void CheckThatAllChannelsIsRightStoragePools(const NKikimrHive::TEvGetTabletStorageInfoResult& storageInfo, TStoragePools pools) {
+ auto& info = storageInfo.GetInfo();
+ for (auto& channel: info.GetChannels()) {
+ TString poolName = channel.GetStoragePool();
+ auto it = std::find_if(pools.begin(), pools.end(), [&] (const TStoragePool& pool) {return pool.GetName() == poolName;});
+ UNIT_ASSERT(it != pools.end());
+ }
+ }
+
Y_UNIT_TEST(CreateDummyTabletsInDifferentDomains) {
- TTestEnvWithPoolsSupport env(2, 2);
-
- auto first_storage_pools = env.CreatePoolsForTenant("USER_0");
- ui64 tablet_in_first_domain = CreateSubDomainAndTabletInside(env, "USER_0", 1, first_storage_pools);
- auto second_storage_pools = env.CreatePoolsForTenant("USER_1");
- ui64 tablet_in_second_domain = CreateSubDomainAndTabletInside(env, "USER_1", 2, second_storage_pools);
-
- CheckTableIsOfline(env, tablet_in_first_domain);
- CheckTableIsOfline(env, tablet_in_second_domain);
-
- env.GetTenants().Run("/dc-1/USER_0");
- CheckTableBecomeAlive(env, tablet_in_first_domain);
- CheckTableRunOnProperTenantNode(env, "/dc-1/USER_0", tablet_in_first_domain);
-
- env.GetTenants().Run("/dc-1/USER_1");
- CheckTableBecomeAlive(env, tablet_in_second_domain);
- CheckTableRunOnProperTenantNode(env, "/dc-1/USER_1", tablet_in_second_domain);
-
- env.GetTenants().Stop("/dc-1/USER_0");
- CheckTableBecomeOfline(env, tablet_in_first_domain);
-
- env.GetTenants().Stop("/dc-1/USER_1");
- CheckTableBecomeOfline(env, tablet_in_second_domain);
-
- env.GetTenants().Run("/dc-1/USER_0");
- env.GetTenants().Run("/dc-1/USER_1");
- CheckTableBecomeAlive(env, tablet_in_first_domain);
- CheckTableBecomeAlive(env, tablet_in_second_domain);
-
- CheckTableRunOnProperTenantNode(env, "/dc-1/USER_0", tablet_in_first_domain);
- CheckTableRunOnProperTenantNode(env, "/dc-1/USER_1", tablet_in_second_domain);
-
- NKikimrHive::TEvGetTabletStorageInfoResult firstStorageInfo;
- env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), tablet_in_first_domain, firstStorageInfo);
- UNIT_ASSERT_VALUES_EQUAL(firstStorageInfo.GetStatus(), NKikimrProto::OK);
- CheckThatAllChannelsIsRightStoragePools(firstStorageInfo, first_storage_pools);
-
- NKikimrHive::TEvGetTabletStorageInfoResult secondStorageInfo;
- env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), tablet_in_second_domain, secondStorageInfo);
- UNIT_ASSERT_VALUES_EQUAL(secondStorageInfo.GetStatus(), NKikimrProto::OK);
- CheckThatAllChannelsIsRightStoragePools(secondStorageInfo, second_storage_pools);
- }
-
+ TTestEnvWithPoolsSupport env(2, 2);
+
+ auto first_storage_pools = env.CreatePoolsForTenant("USER_0");
+ ui64 tablet_in_first_domain = CreateSubDomainAndTabletInside(env, "USER_0", 1, first_storage_pools);
+ auto second_storage_pools = env.CreatePoolsForTenant("USER_1");
+ ui64 tablet_in_second_domain = CreateSubDomainAndTabletInside(env, "USER_1", 2, second_storage_pools);
+
+ CheckTableIsOfline(env, tablet_in_first_domain);
+ CheckTableIsOfline(env, tablet_in_second_domain);
+
+ env.GetTenants().Run("/dc-1/USER_0");
+ CheckTableBecomeAlive(env, tablet_in_first_domain);
+ CheckTableRunOnProperTenantNode(env, "/dc-1/USER_0", tablet_in_first_domain);
+
+ env.GetTenants().Run("/dc-1/USER_1");
+ CheckTableBecomeAlive(env, tablet_in_second_domain);
+ CheckTableRunOnProperTenantNode(env, "/dc-1/USER_1", tablet_in_second_domain);
+
+ env.GetTenants().Stop("/dc-1/USER_0");
+ CheckTableBecomeOfline(env, tablet_in_first_domain);
+
+ env.GetTenants().Stop("/dc-1/USER_1");
+ CheckTableBecomeOfline(env, tablet_in_second_domain);
+
+ env.GetTenants().Run("/dc-1/USER_0");
+ env.GetTenants().Run("/dc-1/USER_1");
+ CheckTableBecomeAlive(env, tablet_in_first_domain);
+ CheckTableBecomeAlive(env, tablet_in_second_domain);
+
+ CheckTableRunOnProperTenantNode(env, "/dc-1/USER_0", tablet_in_first_domain);
+ CheckTableRunOnProperTenantNode(env, "/dc-1/USER_1", tablet_in_second_domain);
+
+ NKikimrHive::TEvGetTabletStorageInfoResult firstStorageInfo;
+ env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), tablet_in_first_domain, firstStorageInfo);
+ UNIT_ASSERT_VALUES_EQUAL(firstStorageInfo.GetStatus(), NKikimrProto::OK);
+ CheckThatAllChannelsIsRightStoragePools(firstStorageInfo, first_storage_pools);
+
+ NKikimrHive::TEvGetTabletStorageInfoResult secondStorageInfo;
+ env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), tablet_in_second_domain, secondStorageInfo);
+ UNIT_ASSERT_VALUES_EQUAL(secondStorageInfo.GetStatus(), NKikimrProto::OK);
+ CheckThatAllChannelsIsRightStoragePools(secondStorageInfo, second_storage_pools);
+ }
+
Y_UNIT_TEST(CreateTableInsideSubDomain) {
- TTestEnvWithPoolsSupport env(1, 2);
- auto storagePool = env.CreatePoolsForTenant("USER_0");
-
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0", storagePool), TDuration::MilliSeconds(500)));
-
- env.GetTenants().Run("/dc-1/USER_0");
-
- auto tableDesc = GetTableSimpleDescription("SimpleTable");
- UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
- NMsgBusProxy::MSTATUS_OK);
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
- }
- }
-
- Y_UNIT_TEST(CreateTableInsideSubDomain2) {
- TTestEnvWithPoolsSupport env(1, 2);
- auto storagePools = env.CreatePoolsForTenant("USER_0");
-
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0", storagePools), TDuration::MilliSeconds(500)));
-
- auto tableDesc = GetTableSimpleDescription("SimpleTable");
- UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc, TDuration::MilliSeconds(500)),
- NMsgBusProxy::MSTATUS_INPROGRESS);
-
- env.GetTenants().Run("/dc-1/USER_0");
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().WaitCreateTx(&env.GetRuntime(), "/dc-1/USER_0/SimpleTable", WaitTimeOut));
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
- }
-
- auto tablePortions = NTestLs::ExtractTablePartitions(env.GetClient().Ls("/dc-1/USER_0/SimpleTable"));
- for (NKikimrSchemeOp::TTablePartition& portion: tablePortions) {
- auto tabletId = portion.GetDatashardId();
-
- UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), tabletId));
-
- NKikimrHive::TEvGetTabletStorageInfoResult storageInfo;
- env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), tabletId, storageInfo);
- UNIT_ASSERT_VALUES_EQUAL(storageInfo.GetStatus(), NKikimrProto::OK);
-
- CheckThatAllChannelsIsRightStoragePools(storageInfo, storagePools);
- }
- }
-
- Y_UNIT_TEST(CreateSolomonInsideSubDomain) {
- TTestEnvWithPoolsSupport env(1, 2);
-
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
-
- auto storagePools = env.CreatePoolsForTenant("USER_0");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0", storagePools), TDuration::MilliSeconds(500)));
-
- env.GetTenants().Run("/dc-1/USER_0");
-
- const ui32 partsCount = 4;
- const ui32 channelProfile = 2;
- UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateSolomon("/dc-1/USER_0", "Solomon", partsCount, channelProfile),
- NMsgBusProxy::MSTATUS_OK);
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0/Solomon");
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeSolomonVolume);
- }
-
- env.GetTenants().Stop();
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
- }
-
- Y_UNIT_TEST(DeclareAndDefine) {
- TTestEnvWithPoolsSupport env(1, 1);
- env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NLog::PRI_DEBUG);
- env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::TX_PROXY, NLog::PRI_DEBUG);
-
- auto storagePool = env.CreatePoolsForTenant("USER_0");
-
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
-
- {
- auto subdomain = GetSubDomainDeclareSetting("USER_0");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain));
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeSubDomain);
- }
-
- {
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0", "dir"));
- auto ls = env.GetClient().Ls("/dc-1/USER_0/dir");
- NTestLs::InSubdomain(ls);
- }
-
- env.GetTenants().Run("/dc-1/USER_0");
-
-
- {
- auto subdomain = GetSubDomainDefaultSetting("USER_0", storagePool);
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().AlterSubdomain("/dc-1", subdomain));
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::InSubdomainWithPools(ls, NKikimrSchemeOp::EPathTypeSubDomain);
- }
-
- {
- auto tableDesc = GetTableSimpleDescription("table1");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0/dir", tableDesc));
- auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/table1");
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
- }
-
- {
- auto tableDesc = GetTableSimpleDescription("table2");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0/dir", tableDesc));
- auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/table2");
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
- }
-
- SetRowInSimpletable(env, 42, 111, "/dc-1/USER_0/dir/table1");
- SetRowInSimpletable(env, 42, 111, "/dc-1/USER_0/dir/table2");
-
- {
- NKikimrMiniKQL::TResult result;
- env.GetClient().FlatQuery("("
- "(let row0_ '('('key (Uint64 '42))))"
- "(let cols_ '('value))"
- "(let select0_ (SelectRow '/dc-1/USER_0/dir/table1 row0_ cols_))"
- "(let select1_ (SelectRow '/dc-1/USER_0/dir/table2 row0_ cols_))"
- "(let ret_ (AsList"
- " (SetResult 'res0_ select0_)"
- " (SetResult 'res1_ select1_)"
- "))"
- "(return ret_)"
- ")", result);
- }
- }
-
+ TTestEnvWithPoolsSupport env(1, 2);
+ auto storagePool = env.CreatePoolsForTenant("USER_0");
+
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0", storagePool), TDuration::MilliSeconds(500)));
+
+ env.GetTenants().Run("/dc-1/USER_0");
+
+ auto tableDesc = GetTableSimpleDescription("SimpleTable");
+ UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc),
+ NMsgBusProxy::MSTATUS_OK);
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
+ }
+ }
+
+ Y_UNIT_TEST(CreateTableInsideSubDomain2) {
+ TTestEnvWithPoolsSupport env(1, 2);
+ auto storagePools = env.CreatePoolsForTenant("USER_0");
+
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0", storagePools), TDuration::MilliSeconds(500)));
+
+ auto tableDesc = GetTableSimpleDescription("SimpleTable");
+ UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateTable("/dc-1/USER_0", tableDesc, TDuration::MilliSeconds(500)),
+ NMsgBusProxy::MSTATUS_INPROGRESS);
+
+ env.GetTenants().Run("/dc-1/USER_0");
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().WaitCreateTx(&env.GetRuntime(), "/dc-1/USER_0/SimpleTable", WaitTimeOut));
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/SimpleTable");
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
+ }
+
+ auto tablePortions = NTestLs::ExtractTablePartitions(env.GetClient().Ls("/dc-1/USER_0/SimpleTable"));
+ for (NKikimrSchemeOp::TTablePartition& portion: tablePortions) {
+ auto tabletId = portion.GetDatashardId();
+
+ UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), tabletId));
+
+ NKikimrHive::TEvGetTabletStorageInfoResult storageInfo;
+ env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), tabletId, storageInfo);
+ UNIT_ASSERT_VALUES_EQUAL(storageInfo.GetStatus(), NKikimrProto::OK);
+
+ CheckThatAllChannelsIsRightStoragePools(storageInfo, storagePools);
+ }
+ }
+
+ Y_UNIT_TEST(CreateSolomonInsideSubDomain) {
+ TTestEnvWithPoolsSupport env(1, 2);
+
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
+
+ auto storagePools = env.CreatePoolsForTenant("USER_0");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0", storagePools), TDuration::MilliSeconds(500)));
+
+ env.GetTenants().Run("/dc-1/USER_0");
+
+ const ui32 partsCount = 4;
+ const ui32 channelProfile = 2;
+ UNIT_ASSERT_VALUES_EQUAL(env.GetClient().CreateSolomon("/dc-1/USER_0", "Solomon", partsCount, channelProfile),
+ NMsgBusProxy::MSTATUS_OK);
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/Solomon");
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeSolomonVolume);
+ }
+
+ env.GetTenants().Stop();
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1", "USER_0"));
+ }
+
+ Y_UNIT_TEST(DeclareAndDefine) {
+ TTestEnvWithPoolsSupport env(1, 1);
+ env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NLog::PRI_DEBUG);
+ env.GetServer().GetRuntime()->SetLogPriority(NKikimrServices::TX_PROXY, NLog::PRI_DEBUG);
+
+ auto storagePool = env.CreatePoolsForTenant("USER_0");
+
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+
+ {
+ auto subdomain = GetSubDomainDeclareSetting("USER_0");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateSubdomain("/dc-1", subdomain));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeSubDomain);
+ }
+
+ {
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0", "dir"));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/dir");
+ NTestLs::InSubdomain(ls);
+ }
+
+ env.GetTenants().Run("/dc-1/USER_0");
+
+
+ {
+ auto subdomain = GetSubDomainDefaultSetting("USER_0", storagePool);
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().AlterSubdomain("/dc-1", subdomain));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::InSubdomainWithPools(ls, NKikimrSchemeOp::EPathTypeSubDomain);
+ }
+
+ {
+ auto tableDesc = GetTableSimpleDescription("table1");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0/dir", tableDesc));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/table1");
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
+ }
+
+ {
+ auto tableDesc = GetTableSimpleDescription("table2");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0/dir", tableDesc));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/table2");
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
+ }
+
+ SetRowInSimpletable(env, 42, 111, "/dc-1/USER_0/dir/table1");
+ SetRowInSimpletable(env, 42, 111, "/dc-1/USER_0/dir/table2");
+
+ {
+ NKikimrMiniKQL::TResult result;
+ env.GetClient().FlatQuery("("
+ "(let row0_ '('('key (Uint64 '42))))"
+ "(let cols_ '('value))"
+ "(let select0_ (SelectRow '/dc-1/USER_0/dir/table1 row0_ cols_))"
+ "(let select1_ (SelectRow '/dc-1/USER_0/dir/table2 row0_ cols_))"
+ "(let ret_ (AsList"
+ " (SetResult 'res0_ select0_)"
+ " (SetResult 'res1_ select1_)"
+ "))"
+ "(return ret_)"
+ ")", result);
+ }
+ }
+
Y_UNIT_TEST(GenericCases) {
- TTestEnvWithPoolsSupport env(1, 1);
- auto storagePool = env.CreatePoolsForTenant("USER_0");
-
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0", storagePool), TDuration::MilliSeconds(500)));
-
- env.GetTenants().Run("/dc-1/USER_0");
-
- {
- auto ls = env.GetClient().Ls("/dc-1/USER_0");
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeSubDomain);
- }
-
- {
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0", "dir"));
- auto ls = env.GetClient().Ls("/dc-1/USER_0/dir");
+ TTestEnvWithPoolsSupport env(1, 1);
+ auto storagePool = env.CreatePoolsForTenant("USER_0");
+
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0", storagePool), TDuration::MilliSeconds(500)));
+
+ env.GetTenants().Run("/dc-1/USER_0");
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1/USER_0");
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeSubDomain);
+ }
+
+ {
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0", "dir"));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/dir");
NTestLs::InSubdomain(ls);
- }
-
- {
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1", "dir"));
- auto ls = env.GetClient().Ls("/dc-1/dir");
- NTestLs::NotInSubdomain(ls);
- }
-
- {
- auto ls = env.GetClient().Ls("/dc-1");
- NTestLs::NotInSubdomain(ls);
- }
-
- {
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0/dir", "dir_0"));
- auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_0");
+ }
+
+ {
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1", "dir"));
+ auto ls = env.GetClient().Ls("/dc-1/dir");
+ NTestLs::NotInSubdomain(ls);
+ }
+
+ {
+ auto ls = env.GetClient().Ls("/dc-1");
+ NTestLs::NotInSubdomain(ls);
+ }
+
+ {
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0/dir", "dir_0"));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_0");
NTestLs::InSubdomain(ls);
- }
-
- {
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0/dir", "dir_1"));
- auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_1");
+ }
+
+ {
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().MkDir("/dc-1/USER_0/dir", "dir_1"));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_1");
NTestLs::InSubdomain(ls);
- }
-
- {
- auto tableDesc = GetTableSimpleDescription("table");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0/dir/dir_0", tableDesc));
- auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_0/table");
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
- }
-
- {
- auto tableDesc = GetTableSimpleDescription("table");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0/dir/dir_1", tableDesc));
- auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_1/table");
- NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
- }
-
- SetRowInSimpletable(env, 42, 111, "/dc-1/USER_0/dir/dir_0/table");
- SetRowInSimpletable(env, 42, 111, "/dc-1/USER_0/dir/dir_1/table");
-
- {
- NKikimrMiniKQL::TResult result;
- env.GetClient().FlatQuery("("
- "(let row0_ '('('key (Uint64 '42))))"
- "(let cols_ '('value))"
- "(let select0_ (SelectRow '/dc-1/USER_0/dir/dir_0/table row0_ cols_))"
- "(let select1_ (SelectRow '/dc-1/USER_0/dir/dir_1/table row0_ cols_))"
- "(let ret_ (AsList"
- " (SetResult 'res0_ select0_)"
- " (SetResult 'res1_ select1_)"
- "))"
- "(return ret_)"
- ")", result);
- }
- }
-
- void CheckThatDSProxyReturnNoGroupIfTryBlock(TTestActorRuntime* runtime,
- const NKikimrHive::TEvGetTabletStorageInfoResult& storageInfo,
- ui32 nodeIdx = 0) {
+ }
+
+ {
+ auto tableDesc = GetTableSimpleDescription("table");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0/dir/dir_0", tableDesc));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_0/table");
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
+ }
+
+ {
+ auto tableDesc = GetTableSimpleDescription("table");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().CreateTable("/dc-1/USER_0/dir/dir_1", tableDesc));
+ auto ls = env.GetClient().Ls("/dc-1/USER_0/dir/dir_1/table");
+ NTestLs::InSubdomain(ls, NKikimrSchemeOp::EPathTypeTable);
+ }
+
+ SetRowInSimpletable(env, 42, 111, "/dc-1/USER_0/dir/dir_0/table");
+ SetRowInSimpletable(env, 42, 111, "/dc-1/USER_0/dir/dir_1/table");
+
+ {
+ NKikimrMiniKQL::TResult result;
+ env.GetClient().FlatQuery("("
+ "(let row0_ '('('key (Uint64 '42))))"
+ "(let cols_ '('value))"
+ "(let select0_ (SelectRow '/dc-1/USER_0/dir/dir_0/table row0_ cols_))"
+ "(let select1_ (SelectRow '/dc-1/USER_0/dir/dir_1/table row0_ cols_))"
+ "(let ret_ (AsList"
+ " (SetResult 'res0_ select0_)"
+ " (SetResult 'res1_ select1_)"
+ "))"
+ "(return ret_)"
+ ")", result);
+ }
+ }
+
+ void CheckThatDSProxyReturnNoGroupIfTryBlock(TTestActorRuntime* runtime,
+ const NKikimrHive::TEvGetTabletStorageInfoResult& storageInfo,
+ ui32 nodeIdx = 0) {
TIntrusivePtr<TTabletStorageInfo> info = TabletStorageInfoFromProto(storageInfo.GetInfo());
-
+
TActorId edge = runtime->AllocateEdgeActor(nodeIdx);
IActor* x = CreateTabletReqBlockBlobStorage(edge, info.Get(), Max<ui32>(), false);
- runtime->Register(x, nodeIdx);
-
-// TAutoPtr<IEventHandle> handle;
- TEvTabletBase::TEvBlockBlobStorageResult::TPtr response = runtime->GrabEdgeEventRethrow<TEvTabletBase::TEvBlockBlobStorageResult>(edge);
- Y_VERIFY(response->Get()->TabletId == storageInfo.GetTabletID());
- UNIT_ASSERT_EQUAL(response->Get()->Status, NKikimrProto::NO_GROUP);
- }
-
- void CheckThatDSProxyReturnNoGroupIfCollect(TTestActorRuntime* runtime,
- const NKikimrHive::TEvGetTabletStorageInfoResult& storageInfo,
- ui32 nodeIdx = 0) {
- auto& info = storageInfo.GetInfo();
- auto& channel = info.GetChannels(0);
- auto& lastEntry = *channel.GetHistory().rbegin();
- ui32 group = lastEntry.GetGroupID();
-
+ runtime->Register(x, nodeIdx);
+
+// TAutoPtr<IEventHandle> handle;
+ TEvTabletBase::TEvBlockBlobStorageResult::TPtr response = runtime->GrabEdgeEventRethrow<TEvTabletBase::TEvBlockBlobStorageResult>(edge);
+ Y_VERIFY(response->Get()->TabletId == storageInfo.GetTabletID());
+ UNIT_ASSERT_EQUAL(response->Get()->Status, NKikimrProto::NO_GROUP);
+ }
+
+ void CheckThatDSProxyReturnNoGroupIfCollect(TTestActorRuntime* runtime,
+ const NKikimrHive::TEvGetTabletStorageInfoResult& storageInfo,
+ ui32 nodeIdx = 0) {
+ auto& info = storageInfo.GetInfo();
+ auto& channel = info.GetChannels(0);
+ auto& lastEntry = *channel.GetHistory().rbegin();
+ ui32 group = lastEntry.GetGroupID();
+
TActorId edge = runtime->AllocateEdgeActor(nodeIdx);
-
- const ui32 generation = Max<ui32>();
- auto event = TEvBlobStorage::TEvCollectGarbage::CreateHardBarrier(
- storageInfo.GetTabletID(), // tabletId
- generation, // recordGeneration
- generation, // perGenerationCounter
- channel.GetChannel(), // channel
- generation, // collectGeneration
- std::numeric_limits<ui32>::max(), // collectStep
- TInstant::Max()); // deadline
-
+
+ const ui32 generation = Max<ui32>();
+ auto event = TEvBlobStorage::TEvCollectGarbage::CreateHardBarrier(
+ storageInfo.GetTabletID(), // tabletId
+ generation, // recordGeneration
+ generation, // perGenerationCounter
+ channel.GetChannel(), // channel
+ generation, // collectGeneration
+ std::numeric_limits<ui32>::max(), // collectStep
+ TInstant::Max()); // deadline
+
TActorId nodeWarden = MakeBlobStorageNodeWardenID(runtime->GetNodeId(nodeIdx));
- runtime->Send(new IEventHandle(MakeBlobStorageProxyID(group), edge, event.Release(),
- IEventHandle::FlagForwardOnNondelivery, 0, &nodeWarden), nodeIdx);
-
- TEvBlobStorage::TEvCollectGarbageResult::TPtr response = runtime->GrabEdgeEventRethrow<TEvBlobStorage::TEvCollectGarbageResult>(edge);
- Y_VERIFY(response->Get()->TabletId == storageInfo.GetTabletID());
- UNIT_ASSERT_EQUAL(response->Get()->Status, NKikimrProto::NO_GROUP);
- }
- ui32 GetNodeIdx(TBaseTestEnv &env, ui32 nodeId) {
- ui32 nodeIdx = 0;
- for (ui32 idx = 0; idx < env.GetRuntime().GetNodeCount(); ++idx) {
- if (env.GetRuntime().GetNodeId(idx) == nodeId) {
- nodeIdx = idx;
- break;
- }
- }
- return nodeIdx;
- }
-
- Y_UNIT_TEST(RemoveStoragePoolBeforeDroppingTablet) {
- TTestEnvWithPoolsSupport env(1, 2);
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
-
- auto storagePools = env.CreatePoolsForTenant("USER_0");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
- env.GetTenants().Run("/dc-1/USER_0", 1);
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0", storagePools)));
- env.GetTenants().Stop("/dc-1/USER_0");
-
- auto domaindescr = NTestLs::ExtractDomainDescription(env.GetClient().Ls("/dc-1/USER_0"));
-
- UNIT_ASSERT_VALUES_UNEQUAL(1, domaindescr.GetDomainKey().GetPathId());
- ui64 coordinator = domaindescr.GetProcessingParams().GetCoordinators(0);
-
- UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), coordinator));
-
- NKikimrHive::TEvGetTabletStorageInfoResult storageInfo;
- env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), coordinator, storageInfo);
- UNIT_ASSERT_VALUES_EQUAL(storageInfo.GetStatus(), NKikimrProto::OK);
-
- CheckThatAllChannelsIsRightStoragePools(storageInfo, storagePools);
-
- for (auto& pool: storagePools) {
- env.GetClient().RemoveStoragePool(pool.GetName());
- }
-
- CheckThatDSProxyReturnNoGroupIfTryBlock(&env.GetRuntime(), storageInfo);
- CheckThatDSProxyReturnNoGroupIfCollect(&env.GetRuntime(), storageInfo);
-
- // there is no chance to run or boot it, no groups
- CheckTableIsOfline(env, coordinator);
-
- //activate dynamic nodes and ask dsproxy from them
- env.GetTenants().Run("/dc-1/USER_0", 1);
-
- //ask another dsproxy
- CheckThatDSProxyReturnNoGroupIfTryBlock(&env.GetRuntime(), storageInfo, 1);
- CheckThatDSProxyReturnNoGroupIfCollect(&env.GetRuntime(), storageInfo, 1);
-
- CheckTableIsOfline(env, coordinator);
-
- env.GetTenants().Stop();
- //delete subdomain with tablets
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1/", "USER_0"));
-
- //tablet deleted logicaly
- while (env.GetClient().TabletExistsInHive(&env.GetRuntime(), coordinator)) {
- /*no op*/
- }
-
- //subscribe untill tablet deleted physically
- env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), coordinator, storageInfo);
- UNIT_ASSERT_VALUES_EQUAL(storageInfo.GetStatus(), NKikimrProto::ERROR);
-
- //check that tablet is deleted physically
- UNIT_ASSERT(!env.GetClient().TabletExistsInHive(&env.GetRuntime(), coordinator, true));
- }
-
- Y_UNIT_TEST(RemoveStoragePoolAndCreateOneMore) {
- TTestEnvWithPoolsSupport env(1, 2);
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
-
- {// run and delete USER_0's pools
- auto storagePools = env.CreatePoolsForTenant("USER_0");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
- env.GetTenants().Run("/dc-1/USER_0", 1);
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0", storagePools)));
- env.GetTenants().Stop("/dc-1/USER_0");
- auto domaindescr = NTestLs::ExtractDomainDescription(env.GetClient().Ls("/dc-1/USER_0"));
-
- UNIT_ASSERT_VALUES_UNEQUAL(1, domaindescr.GetDomainKey().GetPathId());
- ui64 coordinator = domaindescr.GetProcessingParams().GetCoordinators(0);
- UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), coordinator));
-
- NKikimrHive::TEvGetTabletStorageInfoResult storageInfo;
- env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), coordinator, storageInfo);
- UNIT_ASSERT_VALUES_EQUAL(storageInfo.GetStatus(), NKikimrProto::OK);
-
- CheckThatAllChannelsIsRightStoragePools(storageInfo, storagePools);
- env.GetTenants().Run("/dc-1/USER_0", 1);
- CheckTableBecomeAlive(env, coordinator);
-
- for (auto& pool: storagePools) {
- env.GetClient().RemoveStoragePool(pool.GetName());
- }
-
- CheckTableBecomeOfline(env, coordinator);
- }
-
- {// run and check USER_1
- auto storagePools = env.CreatePoolsForTenant("USER_1");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_1")));
- env.GetTenants().Run("/dc-1/USER_1", 1);
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_1", storagePools)));
- env.GetTenants().Stop("/dc-1/USER_1");
- auto domaindescr = NTestLs::ExtractDomainDescription(env.GetClient().Ls("/dc-1/USER_1"));
-
- UNIT_ASSERT_VALUES_UNEQUAL(1, domaindescr.GetDomainKey().GetPathId());
- auto coordinator = domaindescr.GetProcessingParams().GetCoordinators(0);
- UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), coordinator));
-
- NKikimrHive::TEvGetTabletStorageInfoResult storageInfo;
- env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), coordinator, storageInfo);
- UNIT_ASSERT_VALUES_EQUAL(storageInfo.GetStatus(), NKikimrProto::OK);
-
- CheckThatAllChannelsIsRightStoragePools(storageInfo, storagePools);
- env.GetTenants().Run("/dc-1/USER_1", 1);
- CheckTableBecomeAlive(env, coordinator);
- }
- }
-
- Y_UNIT_TEST(CopyTableAndConcurrentSplit) {
- TTestEnvWithPoolsSupport env(1, 2);
-
- SetSplitMergePartCountLimit(env.GetServer().GetRuntime(), -1);
-
- UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
-
- auto storagePools = env.CreatePoolsForTenant("USER_0");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
- env.GetTenants().Run("/dc-1/USER_0", 1);
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0", storagePools)));
-
- auto tableDesc = GetTableSimpleDescription("SimpleTable");
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().CreateTable("/dc-1/USER_0", tableDesc));
-
-
- auto tablePortionsBefireSplit = NTestLs::ExtractTablePartitions(env.GetClient().Ls("/dc-1/USER_0/SimpleTable"));
- auto firstDataShardBefireSplit = tablePortionsBefireSplit.front().GetDatashardId();
-
- {
- UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), firstDataShardBefireSplit));
-
- NKikimrHive::TEvGetTabletStorageInfoResult storageInfo;
- env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), firstDataShardBefireSplit, storageInfo);
- UNIT_ASSERT_VALUES_EQUAL(storageInfo.GetStatus(), NKikimrProto::OK);
-
- CheckThatAllChannelsIsRightStoragePools(storageInfo, storagePools);
- }
-
- env.GetClient().SplitTable("/dc-1/USER_0/SimpleTable", firstDataShardBefireSplit, 1000000, TDuration::MilliSeconds(1));
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- env.GetClient().CopyTable("/dc-1/USER_0/", "copy", "/dc-1/USER_0/SimpleTable"));
-
- auto tablePortionsAfterSplit = NTestLs::ExtractTablePartitions(env.GetClient().Ls("/dc-1/USER_0/SimpleTable"));
- auto firstDataShardAfterSplit = tablePortionsAfterSplit.front().GetDatashardId();
-
- UNIT_ASSERT_VALUES_UNEQUAL(firstDataShardBefireSplit, firstDataShardAfterSplit);
-
- {
- UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), firstDataShardAfterSplit));
-
- NKikimrHive::TEvGetTabletStorageInfoResult storageInfo;
- env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), firstDataShardAfterSplit, storageInfo);
- UNIT_ASSERT_VALUES_EQUAL(storageInfo.GetStatus(), NKikimrProto::OK);
-
- CheckThatAllChannelsIsRightStoragePools(storageInfo, storagePools);
- }
-
- auto copyTablePortions = NTestLs::ExtractTablePartitions(env.GetClient().Ls("/dc-1/USER_0/copy"));
- for (NKikimrSchemeOp::TTablePartition& portion: copyTablePortions) {
- auto tabletId = portion.GetDatashardId();
-
- UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), tabletId));
-
- NKikimrHive::TEvGetTabletStorageInfoResult storageInfo;
- env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), tabletId, storageInfo);
- UNIT_ASSERT_VALUES_EQUAL(storageInfo.GetStatus(), NKikimrProto::OK);
-
- CheckThatAllChannelsIsRightStoragePools(storageInfo, storagePools);
- }
- }
-}
+ runtime->Send(new IEventHandle(MakeBlobStorageProxyID(group), edge, event.Release(),
+ IEventHandle::FlagForwardOnNondelivery, 0, &nodeWarden), nodeIdx);
+
+ TEvBlobStorage::TEvCollectGarbageResult::TPtr response = runtime->GrabEdgeEventRethrow<TEvBlobStorage::TEvCollectGarbageResult>(edge);
+ Y_VERIFY(response->Get()->TabletId == storageInfo.GetTabletID());
+ UNIT_ASSERT_EQUAL(response->Get()->Status, NKikimrProto::NO_GROUP);
+ }
+ ui32 GetNodeIdx(TBaseTestEnv &env, ui32 nodeId) {
+ ui32 nodeIdx = 0;
+ for (ui32 idx = 0; idx < env.GetRuntime().GetNodeCount(); ++idx) {
+ if (env.GetRuntime().GetNodeId(idx) == nodeId) {
+ nodeIdx = idx;
+ break;
+ }
+ }
+ return nodeIdx;
+ }
+
+ Y_UNIT_TEST(RemoveStoragePoolBeforeDroppingTablet) {
+ TTestEnvWithPoolsSupport env(1, 2);
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+
+ auto storagePools = env.CreatePoolsForTenant("USER_0");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
+ env.GetTenants().Run("/dc-1/USER_0", 1);
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0", storagePools)));
+ env.GetTenants().Stop("/dc-1/USER_0");
+
+ auto domaindescr = NTestLs::ExtractDomainDescription(env.GetClient().Ls("/dc-1/USER_0"));
+
+ UNIT_ASSERT_VALUES_UNEQUAL(1, domaindescr.GetDomainKey().GetPathId());
+ ui64 coordinator = domaindescr.GetProcessingParams().GetCoordinators(0);
+
+ UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), coordinator));
+
+ NKikimrHive::TEvGetTabletStorageInfoResult storageInfo;
+ env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), coordinator, storageInfo);
+ UNIT_ASSERT_VALUES_EQUAL(storageInfo.GetStatus(), NKikimrProto::OK);
+
+ CheckThatAllChannelsIsRightStoragePools(storageInfo, storagePools);
+
+ for (auto& pool: storagePools) {
+ env.GetClient().RemoveStoragePool(pool.GetName());
+ }
+
+ CheckThatDSProxyReturnNoGroupIfTryBlock(&env.GetRuntime(), storageInfo);
+ CheckThatDSProxyReturnNoGroupIfCollect(&env.GetRuntime(), storageInfo);
+
+ // there is no chance to run or boot it, no groups
+ CheckTableIsOfline(env, coordinator);
+
+ //activate dynamic nodes and ask dsproxy from them
+ env.GetTenants().Run("/dc-1/USER_0", 1);
+
+ //ask another dsproxy
+ CheckThatDSProxyReturnNoGroupIfTryBlock(&env.GetRuntime(), storageInfo, 1);
+ CheckThatDSProxyReturnNoGroupIfCollect(&env.GetRuntime(), storageInfo, 1);
+
+ CheckTableIsOfline(env, coordinator);
+
+ env.GetTenants().Stop();
+ //delete subdomain with tablets
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK, env.GetClient().ForceDeleteSubdomain("/dc-1/", "USER_0"));
+
+ //tablet deleted logicaly
+ while (env.GetClient().TabletExistsInHive(&env.GetRuntime(), coordinator)) {
+ /*no op*/
+ }
+
+ //subscribe untill tablet deleted physically
+ env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), coordinator, storageInfo);
+ UNIT_ASSERT_VALUES_EQUAL(storageInfo.GetStatus(), NKikimrProto::ERROR);
+
+ //check that tablet is deleted physically
+ UNIT_ASSERT(!env.GetClient().TabletExistsInHive(&env.GetRuntime(), coordinator, true));
+ }
+
+ Y_UNIT_TEST(RemoveStoragePoolAndCreateOneMore) {
+ TTestEnvWithPoolsSupport env(1, 2);
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+
+ {// run and delete USER_0's pools
+ auto storagePools = env.CreatePoolsForTenant("USER_0");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
+ env.GetTenants().Run("/dc-1/USER_0", 1);
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0", storagePools)));
+ env.GetTenants().Stop("/dc-1/USER_0");
+ auto domaindescr = NTestLs::ExtractDomainDescription(env.GetClient().Ls("/dc-1/USER_0"));
+
+ UNIT_ASSERT_VALUES_UNEQUAL(1, domaindescr.GetDomainKey().GetPathId());
+ ui64 coordinator = domaindescr.GetProcessingParams().GetCoordinators(0);
+ UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), coordinator));
+
+ NKikimrHive::TEvGetTabletStorageInfoResult storageInfo;
+ env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), coordinator, storageInfo);
+ UNIT_ASSERT_VALUES_EQUAL(storageInfo.GetStatus(), NKikimrProto::OK);
+
+ CheckThatAllChannelsIsRightStoragePools(storageInfo, storagePools);
+ env.GetTenants().Run("/dc-1/USER_0", 1);
+ CheckTableBecomeAlive(env, coordinator);
+
+ for (auto& pool: storagePools) {
+ env.GetClient().RemoveStoragePool(pool.GetName());
+ }
+
+ CheckTableBecomeOfline(env, coordinator);
+ }
+
+ {// run and check USER_1
+ auto storagePools = env.CreatePoolsForTenant("USER_1");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_1")));
+ env.GetTenants().Run("/dc-1/USER_1", 1);
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_1", storagePools)));
+ env.GetTenants().Stop("/dc-1/USER_1");
+ auto domaindescr = NTestLs::ExtractDomainDescription(env.GetClient().Ls("/dc-1/USER_1"));
+
+ UNIT_ASSERT_VALUES_UNEQUAL(1, domaindescr.GetDomainKey().GetPathId());
+ auto coordinator = domaindescr.GetProcessingParams().GetCoordinators(0);
+ UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), coordinator));
+
+ NKikimrHive::TEvGetTabletStorageInfoResult storageInfo;
+ env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), coordinator, storageInfo);
+ UNIT_ASSERT_VALUES_EQUAL(storageInfo.GetStatus(), NKikimrProto::OK);
+
+ CheckThatAllChannelsIsRightStoragePools(storageInfo, storagePools);
+ env.GetTenants().Run("/dc-1/USER_1", 1);
+ CheckTableBecomeAlive(env, coordinator);
+ }
+ }
+
+ Y_UNIT_TEST(CopyTableAndConcurrentSplit) {
+ TTestEnvWithPoolsSupport env(1, 2);
+
+ SetSplitMergePartCountLimit(env.GetServer().GetRuntime(), -1);
+
+ UNIT_ASSERT_VALUES_EQUAL("/dc-1", env.GetRoot());
+
+ auto storagePools = env.CreatePoolsForTenant("USER_0");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().CreateSubdomain("/dc-1", GetSubDomainDeclareSetting("USER_0")));
+ env.GetTenants().Run("/dc-1/USER_0", 1);
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().AlterSubdomain("/dc-1", GetSubDomainDefaultSetting("USER_0", storagePools)));
+
+ auto tableDesc = GetTableSimpleDescription("SimpleTable");
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().CreateTable("/dc-1/USER_0", tableDesc));
+
+
+ auto tablePortionsBefireSplit = NTestLs::ExtractTablePartitions(env.GetClient().Ls("/dc-1/USER_0/SimpleTable"));
+ auto firstDataShardBefireSplit = tablePortionsBefireSplit.front().GetDatashardId();
+
+ {
+ UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), firstDataShardBefireSplit));
+
+ NKikimrHive::TEvGetTabletStorageInfoResult storageInfo;
+ env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), firstDataShardBefireSplit, storageInfo);
+ UNIT_ASSERT_VALUES_EQUAL(storageInfo.GetStatus(), NKikimrProto::OK);
+
+ CheckThatAllChannelsIsRightStoragePools(storageInfo, storagePools);
+ }
+
+ env.GetClient().SplitTable("/dc-1/USER_0/SimpleTable", firstDataShardBefireSplit, 1000000, TDuration::MilliSeconds(1));
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ env.GetClient().CopyTable("/dc-1/USER_0/", "copy", "/dc-1/USER_0/SimpleTable"));
+
+ auto tablePortionsAfterSplit = NTestLs::ExtractTablePartitions(env.GetClient().Ls("/dc-1/USER_0/SimpleTable"));
+ auto firstDataShardAfterSplit = tablePortionsAfterSplit.front().GetDatashardId();
+
+ UNIT_ASSERT_VALUES_UNEQUAL(firstDataShardBefireSplit, firstDataShardAfterSplit);
+
+ {
+ UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), firstDataShardAfterSplit));
+
+ NKikimrHive::TEvGetTabletStorageInfoResult storageInfo;
+ env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), firstDataShardAfterSplit, storageInfo);
+ UNIT_ASSERT_VALUES_EQUAL(storageInfo.GetStatus(), NKikimrProto::OK);
+
+ CheckThatAllChannelsIsRightStoragePools(storageInfo, storagePools);
+ }
+
+ auto copyTablePortions = NTestLs::ExtractTablePartitions(env.GetClient().Ls("/dc-1/USER_0/copy"));
+ for (NKikimrSchemeOp::TTablePartition& portion: copyTablePortions) {
+ auto tabletId = portion.GetDatashardId();
+
+ UNIT_ASSERT(env.GetClient().TabletExistsInHive(&env.GetRuntime(), tabletId));
+
+ NKikimrHive::TEvGetTabletStorageInfoResult storageInfo;
+ env.GetClient().GetTabletStorageInfoFromHive(&env.GetRuntime(), tabletId, storageInfo);
+ UNIT_ASSERT_VALUES_EQUAL(storageInfo.GetStatus(), NKikimrProto::OK);
+
+ CheckThatAllChannelsIsRightStoragePools(storageInfo, storagePools);
+ }
+ }
+}
diff --git a/ydb/core/tx/tx_proxy/upload_rows.cpp b/ydb/core/tx/tx_proxy/upload_rows.cpp
index ea067ee891b..3c4580a8a86 100644
--- a/ydb/core/tx/tx_proxy/upload_rows.cpp
+++ b/ydb/core/tx/tx_proxy/upload_rows.cpp
@@ -13,14 +13,14 @@ public:
const TString& table,
std::shared_ptr<TVector<std::pair<TString, Ydb::Type>>> types,
std::shared_ptr<TVector<std::pair<TSerializedCellVec, TString>>> rows,
- EUploadRowsMode mode,
- bool writeToPrivateTable)
+ EUploadRowsMode mode,
+ bool writeToPrivateTable)
: Sender(sender)
, Table(table)
, ColumnTypes(types)
, Rows(rows)
{
- AllowWriteToPrivateTable = writeToPrivateTable;
+ AllowWriteToPrivateTable = writeToPrivateTable;
switch (mode) {
case EUploadRowsMode::Normal:
diff --git a/ydb/core/tx/tx_proxy/upload_rows.h b/ydb/core/tx/tx_proxy/upload_rows.h
index 88b055bd632..93d116b04ec 100644
--- a/ydb/core/tx/tx_proxy/upload_rows.h
+++ b/ydb/core/tx/tx_proxy/upload_rows.h
@@ -20,7 +20,7 @@ IActor* CreateUploadRowsInternal(const TActorId& sender,
const TString& table,
std::shared_ptr<TVector<std::pair<TString, Ydb::Type> > > types,
std::shared_ptr<TVector<std::pair<TSerializedCellVec, TString> > > rows,
- EUploadRowsMode mode = EUploadRowsMode::Normal,
- bool writeToPrivateTable = false);
+ EUploadRowsMode mode = EUploadRowsMode::Normal,
+ bool writeToPrivateTable = false);
} // namespace NTxProxy
} // namespace NKikimr
diff --git a/ydb/core/tx/tx_proxy/upload_rows_common_impl.h b/ydb/core/tx/tx_proxy/upload_rows_common_impl.h
index 9e0c8183a2e..0aaee7e7f59 100644
--- a/ydb/core/tx/tx_proxy/upload_rows_common_impl.h
+++ b/ydb/core/tx/tx_proxy/upload_rows_common_impl.h
@@ -149,7 +149,7 @@ protected:
THashMap<ui32, size_t> Id2Position; // columnId -> its position in YdbSchema
bool WriteToTableShadow = false;
- bool AllowWriteToPrivateTable = false;
+ bool AllowWriteToPrivateTable = false;
std::shared_ptr<arrow::RecordBatch> Batch;
float RuCost = 0.0;
diff --git a/ydb/core/tx/tx_proxy/ut_base_tenant/ya.make b/ydb/core/tx/tx_proxy/ut_base_tenant/ya.make
index b450406c047..a07ffd818ad 100644
--- a/ydb/core/tx/tx_proxy/ut_base_tenant/ya.make
+++ b/ydb/core/tx/tx_proxy/ut_base_tenant/ya.make
@@ -1,35 +1,35 @@
UNITTEST_FOR(ydb/core/tx/tx_proxy)
-
+
OWNER(
svc
g:kikimr
)
-
-FORK_SUBTESTS()
-
+
+FORK_SUBTESTS()
+
IF (WITH_VALGRIND)
- TIMEOUT(3600)
- SIZE(LARGE)
+ TIMEOUT(3600)
+ SIZE(LARGE)
TAG(ya:fat)
-ELSE()
- TIMEOUT(600)
- SIZE(MEDIUM)
-ENDIF()
-
-PEERDIR(
+ELSE()
+ TIMEOUT(600)
+ SIZE(MEDIUM)
+ENDIF()
+
+PEERDIR(
library/cpp/getopt
library/cpp/svnversion
library/cpp/testing/unittest
ydb/core/testlib
ydb/core/tx
ydb/library/yql/public/udf/service/exception_policy
-)
-
+)
+
YQL_LAST_ABI_VERSION()
-SRCS(
- proxy_ut.cpp
- proxy_ut_helpers.cpp
-)
-
-END()
+SRCS(
+ proxy_ut.cpp
+ proxy_ut_helpers.cpp
+)
+
+END()
diff --git a/ydb/core/tx/tx_proxy/ut_encrypted_storage/ya.make b/ydb/core/tx/tx_proxy/ut_encrypted_storage/ya.make
index 1daffd58dd3..bc5ef23bd32 100644
--- a/ydb/core/tx/tx_proxy/ut_encrypted_storage/ya.make
+++ b/ydb/core/tx/tx_proxy/ut_encrypted_storage/ya.make
@@ -1,44 +1,44 @@
UNITTEST_FOR(ydb/core/tx/tx_proxy)
-
+
OWNER(
svc
g:kikimr
)
-
-FORK_SUBTESTS()
-
+
+FORK_SUBTESTS()
+
IF (WITH_VALGRIND)
- TIMEOUT(3600)
- SIZE(LARGE)
- TAG(ya:fat)
+ TIMEOUT(3600)
+ SIZE(LARGE)
+ TAG(ya:fat)
REQUIREMENTS(
cpu:4
ram:32
)
-ELSE()
+ELSE()
REQUIREMENTS(
cpu:4
ram:16
)
- TIMEOUT(600)
- SIZE(MEDIUM)
-ENDIF()
-
-PEERDIR(
+ TIMEOUT(600)
+ SIZE(MEDIUM)
+ENDIF()
+
+PEERDIR(
library/cpp/getopt
library/cpp/svnversion
library/cpp/testing/unittest
ydb/core/testlib
ydb/core/tx
ydb/library/yql/public/udf/service/exception_policy
-)
-
+)
+
YQL_LAST_ABI_VERSION()
-SRCS(
- encrypted_storage_ut.cpp
- proxy_ut_helpers.h
- proxy_ut_helpers.cpp
-)
-
-END()
+SRCS(
+ encrypted_storage_ut.cpp
+ proxy_ut_helpers.h
+ proxy_ut_helpers.cpp
+)
+
+END()
diff --git a/ydb/core/tx/tx_proxy/ut_ext_tenant/ya.make b/ydb/core/tx/tx_proxy/ut_ext_tenant/ya.make
index 51f1c107dbf..71efeaaeca0 100644
--- a/ydb/core/tx/tx_proxy/ut_ext_tenant/ya.make
+++ b/ydb/core/tx/tx_proxy/ut_ext_tenant/ya.make
@@ -1,37 +1,37 @@
UNITTEST_FOR(ydb/core/tx/tx_proxy)
-
+
OWNER(
svc
g:kikimr
)
-
-FORK_SUBTESTS()
-
-IF (WITH_VALGRIND)
- TIMEOUT(3600)
- SIZE(LARGE)
- TAG(ya:fat)
-ELSE()
- TIMEOUT(600)
- SIZE(MEDIUM)
-ENDIF()
-
-PEERDIR(
+
+FORK_SUBTESTS()
+
+IF (WITH_VALGRIND)
+ TIMEOUT(3600)
+ SIZE(LARGE)
+ TAG(ya:fat)
+ELSE()
+ TIMEOUT(600)
+ SIZE(MEDIUM)
+ENDIF()
+
+PEERDIR(
library/cpp/getopt
library/cpp/svnversion
library/cpp/testing/unittest
ydb/core/testlib
ydb/core/tx
ydb/library/yql/public/udf/service/exception_policy
-)
-
+)
+
YQL_LAST_ABI_VERSION()
-SRCS(
- proxy_ext_tenant_ut.cpp
- proxy_ut_helpers.cpp
-)
-
+SRCS(
+ proxy_ext_tenant_ut.cpp
+ proxy_ut_helpers.cpp
+)
+
REQUIREMENTS(ram:17)
-END()
+END()
diff --git a/ydb/core/tx/tx_proxy/ut_storage_tenant/ya.make b/ydb/core/tx/tx_proxy/ut_storage_tenant/ya.make
index b8f083dfad4..3192b7f7d22 100644
--- a/ydb/core/tx/tx_proxy/ut_storage_tenant/ya.make
+++ b/ydb/core/tx/tx_proxy/ut_storage_tenant/ya.make
@@ -1,22 +1,22 @@
UNITTEST_FOR(ydb/core/tx/tx_proxy)
-
+
OWNER(
svc
g:kikimr
)
-
-FORK_SUBTESTS()
-
+
+FORK_SUBTESTS()
+
IF (WITH_VALGRIND)
- TIMEOUT(3600)
- SIZE(LARGE)
+ TIMEOUT(3600)
+ SIZE(LARGE)
TAG(ya:fat)
-ELSE()
- TIMEOUT(600)
- SIZE(MEDIUM)
-ENDIF()
-
-PEERDIR(
+ELSE()
+ TIMEOUT(600)
+ SIZE(MEDIUM)
+ENDIF()
+
+PEERDIR(
library/cpp/getopt
library/cpp/svnversion
library/cpp/testing/unittest
@@ -24,16 +24,16 @@ PEERDIR(
ydb/core/testlib
ydb/core/tx
ydb/library/yql/public/udf/service/exception_policy
-)
-
+)
+
YQL_LAST_ABI_VERSION()
-SRCS(
- storage_tenant_ut.cpp
- proxy_ut_helpers.h
- proxy_ut_helpers.cpp
-)
-
+SRCS(
+ storage_tenant_ut.cpp
+ proxy_ut_helpers.h
+ proxy_ut_helpers.cpp
+)
+
REQUIREMENTS(ram:32)
-END()
+END()
diff --git a/ydb/core/tx/tx_proxy/ya.make b/ydb/core/tx/tx_proxy/ya.make
index ae3feca24e7..d412dc8988c 100644
--- a/ydb/core/tx/tx_proxy/ya.make
+++ b/ydb/core/tx/tx_proxy/ya.make
@@ -1,29 +1,29 @@
-LIBRARY()
-
+LIBRARY()
+
OWNER(g:kikimr)
-
-SRCS(
- mon.cpp
- proxy_impl.cpp
- schemereq.cpp
- datareq.cpp
- describe.cpp
- proxy.cpp
+
+SRCS(
+ mon.cpp
+ proxy_impl.cpp
+ schemereq.cpp
+ datareq.cpp
+ describe.cpp
+ proxy.cpp
read_table_impl.cpp
resolvereq.cpp
snapshotreq.cpp
commitreq.cpp
upload_rows_common_impl.cpp
upload_rows.cpp
-)
-
+)
+
GENERATE_ENUM_SERIALIZATION(read_table_impl.h)
-PEERDIR(
+PEERDIR(
library/cpp/actors/core
library/cpp/actors/helpers
library/cpp/actors/interconnect
- util/draft
+ util/draft
ydb/core/actorlib_impl
ydb/core/base
ydb/core/blobstorage/base
@@ -46,8 +46,8 @@ PEERDIR(
ydb/library/aclib
ydb/library/mkql_proto/protos
ydb/public/lib/base
-)
-
+)
+
YQL_LAST_ABI_VERSION()
END()
diff --git a/ydb/core/tx/ya.make b/ydb/core/tx/ya.make
index ba71acadd1d..5bfe4b3b861 100644
--- a/ydb/core/tx/ya.make
+++ b/ydb/core/tx/ya.make
@@ -9,7 +9,7 @@ SRCS(
defs.h
message_seqno.h
tx.h
- tx.cpp
+ tx.cpp
tx_processing.h
tx_proxy_schemereq.cpp
)
diff --git a/ydb/core/util/yverify_stream.h b/ydb/core/util/yverify_stream.h
index 286c49b8d0e..fcbf57f5659 100644
--- a/ydb/core/util/yverify_stream.h
+++ b/ydb/core/util/yverify_stream.h
@@ -5,4 +5,4 @@
#define Y_VERIFY_S(expr, msg) Y_VERIFY(expr, "%s", (TStringBuilder() << msg).c_str())
#define Y_FAIL_S(msg) Y_FAIL("%s", (TStringBuilder() << msg).c_str())
-#define Y_VERIFY_DEBUG_S(expr, msg) Y_VERIFY_DEBUG(expr, "%s", (TStringBuilder() << msg).c_str())
+#define Y_VERIFY_DEBUG_S(expr, msg) Y_VERIFY_DEBUG(expr, "%s", (TStringBuilder() << msg).c_str())
diff --git a/ydb/core/viewer/browse.h b/ydb/core/viewer/browse.h
index dded49363a9..c5716f46a76 100644
--- a/ydb/core/viewer/browse.h
+++ b/ydb/core/viewer/browse.h
@@ -31,7 +31,7 @@ class TBrowse : public TActorBootstrapped<TBrowse> {
NKikimrViewer::TMetaInfo MetaInfo;
TString CurrentPath; // TStringBuf?
NKikimrViewer::EObjectType CurrentType;
- THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult> DescribeResult;
+ THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult> DescribeResult;
THashSet<TActorId> Handlers;
TActorId TxProxy = MakeTxProxyID();
@@ -62,38 +62,38 @@ public:
return clientConfig;
}
- static NKikimrViewer::EObjectType GetPathTypeFromSchemeShardType(NKikimrSchemeOp::EPathType type) {
+ static NKikimrViewer::EObjectType GetPathTypeFromSchemeShardType(NKikimrSchemeOp::EPathType type) {
switch (type) {
- case NKikimrSchemeOp::EPathType::EPathTypeDir:
+ case NKikimrSchemeOp::EPathType::EPathTypeDir:
case NKikimrSchemeOp::EPathType::EPathTypeColumnStore: // TODO
return NKikimrViewer::EObjectType::Directory;
- case NKikimrSchemeOp::EPathType::EPathTypeRtmrVolume:
+ case NKikimrSchemeOp::EPathType::EPathTypeRtmrVolume:
return NKikimrViewer::EObjectType::RtmrVolume;
- case NKikimrSchemeOp::EPathType::EPathTypeTable:
+ case NKikimrSchemeOp::EPathType::EPathTypeTable:
case NKikimrSchemeOp::EPathType::EPathTypeColumnTable: // TODO
return NKikimrViewer::EObjectType::Table;
- case NKikimrSchemeOp::EPathType::EPathTypePersQueueGroup:
+ case NKikimrSchemeOp::EPathType::EPathTypePersQueueGroup:
return NKikimrViewer::EObjectType::Topic;
- case NKikimrSchemeOp::EPathType::EPathTypeSubDomain:
+ case NKikimrSchemeOp::EPathType::EPathTypeSubDomain:
return NKikimrViewer::EObjectType::SubDomain;
- case NKikimrSchemeOp::EPathType::EPathTypeBlockStoreVolume:
+ case NKikimrSchemeOp::EPathType::EPathTypeBlockStoreVolume:
return NKikimrViewer::EObjectType::BlockStoreVolume;
- case NKikimrSchemeOp::EPathType::EPathTypeFileStore:
+ case NKikimrSchemeOp::EPathType::EPathTypeFileStore:
return NKikimrViewer::EObjectType::FileStore;
- case NKikimrSchemeOp::EPathType::EPathTypeKesus:
+ case NKikimrSchemeOp::EPathType::EPathTypeKesus:
return NKikimrViewer::EObjectType::Kesus;
- case NKikimrSchemeOp::EPathType::EPathTypeSolomonVolume:
- return NKikimrViewer::EObjectType::SolomonVolume;
- case NKikimrSchemeOp::EPathType::EPathTypeCdcStream:
+ case NKikimrSchemeOp::EPathType::EPathTypeSolomonVolume:
+ return NKikimrViewer::EObjectType::SolomonVolume;
+ case NKikimrSchemeOp::EPathType::EPathTypeCdcStream:
return NKikimrViewer::EObjectType::CdcStream;
- case NKikimrSchemeOp::EPathType::EPathTypeSequence:
+ case NKikimrSchemeOp::EPathType::EPathTypeSequence:
return NKikimrViewer::EObjectType::Sequence;
case NKikimrSchemeOp::EPathType::EPathTypeReplication:
return NKikimrViewer::EObjectType::Replication;
- case NKikimrSchemeOp::EPathType::EPathTypeExtSubDomain:
- case NKikimrSchemeOp::EPathType::EPathTypeTableIndex:
- case NKikimrSchemeOp::EPathType::EPathTypeInvalid:
- Y_UNREACHABLE();
+ case NKikimrSchemeOp::EPathType::EPathTypeExtSubDomain:
+ case NKikimrSchemeOp::EPathType::EPathTypeTableIndex:
+ case NKikimrSchemeOp::EPathType::EPathTypeInvalid:
+ Y_UNREACHABLE();
}
return NKikimrViewer::EObjectType::Unknown;
}
@@ -222,7 +222,7 @@ public:
if (!BrowseContext.UserToken.empty()) {
request->Record.SetUserToken(BrowseContext.UserToken);
}
- NKikimrSchemeOp::TDescribePath* record = request->Record.MutableDescribePath();
+ NKikimrSchemeOp::TDescribePath* record = request->Record.MutableDescribePath();
record->SetPath(CurrentPath);
ctx.Send(TxProxy, request.Release(), IEventHandle::FlagTrackDelivery);
++Requests;
@@ -272,12 +272,12 @@ public:
return HandleBadRequest(ctx, "The path is not found");
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr &ev, const TActorContext &ctx) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr &ev, const TActorContext &ctx) {
DescribeResult.Reset(ev->Release());
++Responses;
ctx.Send(BrowseContext.Owner, new NViewerEvents::TEvBrowseRequestCompleted(TxProxy, TEvTxUserProxy::EvNavigate));
const auto& pbRecord(DescribeResult->GetRecord());
- if (pbRecord.GetStatus() == NKikimrScheme::EStatus::StatusSuccess) {
+ if (pbRecord.GetStatus() == NKikimrScheme::EStatus::StatusSuccess) {
if (pbRecord.HasPathDescription()) {
const auto& pbPathDescription(pbRecord.GetPathDescription());
if (pbPathDescription.HasSelf()) {
@@ -335,7 +335,7 @@ public:
STFUNC(StateWork) {
switch (ev->GetTypeRewrite()) {
- HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
HFunc(NViewerEvents::TEvBrowseResponse, Handle);
CFunc(TEvents::TSystem::PoisonPill, HandlePoisonPill);
HFunc(TEvents::TEvUndelivered, HandleUndelivered);
@@ -379,7 +379,7 @@ protected:
TVector<ui64> Tablets;
ui32 Requests = 0;
ui32 Responses = 0;
- THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult> DescribeResult;
+ THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult> DescribeResult;
TString Path;
IViewer::TBrowseContext BrowseContext;
TMap<TTabletId, THolder<TEvTablet::TEvGetCountersResponse>> TabletCountersResults;
@@ -396,7 +396,7 @@ public:
}
TBrowseTabletsCommon(const TActorId& owner, const IViewer::TBrowseContext& browseContext)
- : Owner(owner)
+ : Owner(owner)
, Path(browseContext.Path)
, BrowseContext(browseContext)
{}
diff --git a/ydb/core/viewer/browse_db.h b/ydb/core/viewer/browse_db.h
index 2ba6ad44c08..fe7b5d31408 100644
--- a/ydb/core/viewer/browse_db.h
+++ b/ydb/core/viewer/browse_db.h
@@ -27,15 +27,15 @@ protected:
public:
TBrowseTable(const TActorId& owner, const IViewer::TBrowseContext& browseContext)
- : TBrowseTabletsCommon(owner, browseContext)
+ : TBrowseTabletsCommon(owner, browseContext)
{}
- void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr &ev, const TActorContext &ctx) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr &ev, const TActorContext &ctx) {
DescribeResult.Reset(ev->Release());
++Responses;
ctx.Send(BrowseContext.Owner, new NViewerEvents::TEvBrowseRequestCompleted(TxProxy, TEvTxUserProxy::EvNavigate));
const auto& pbRecord(DescribeResult->GetRecord());
- if (pbRecord.GetStatus() == NKikimrScheme::EStatus::StatusSuccess) {
+ if (pbRecord.GetStatus() == NKikimrScheme::EStatus::StatusSuccess) {
if (pbRecord.HasPathDescription()) {
const auto& pbPathDescription(pbRecord.GetPathDescription());
TVector<ui64> tablets;
@@ -52,7 +52,7 @@ public:
}
} else {
switch (DescribeResult->GetRecord().GetStatus()) {
- case NKikimrScheme::EStatus::StatusPathDoesNotExist:
+ case NKikimrScheme::EStatus::StatusPathDoesNotExist:
return HandleBadRequest(ctx, "The path is not found");
default:
return HandleBadRequest(ctx, "Error getting schema information");
@@ -81,7 +81,7 @@ public:
STFUNC(StateWork) {
switch (ev->GetTypeRewrite()) {
- HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
HFunc(TEvTablet::TEvGetCountersResponse, TBase::Handle);
HFunc(TEvHive::TEvChannelInfo, TBase::Handle);
HFunc(TEvBlobStorage::TEvResponseControllerInfo, TBase::Handle);
@@ -115,7 +115,7 @@ public:
if (!BrowseContext.UserToken.empty()) {
request->Record.SetUserToken(BrowseContext.UserToken);
}
- NKikimrSchemeOp::TDescribePath* record = request->Record.MutableDescribePath();
+ NKikimrSchemeOp::TDescribePath* record = request->Record.MutableDescribePath();
record->SetPath(Path);
record->SetBackupInfo(true);
request->Record.SetUserToken(BrowseContext.UserToken);
diff --git a/ydb/core/viewer/browse_pq.h b/ydb/core/viewer/browse_pq.h
index 4d665bcfbc2..3e3b32a21e3 100644
--- a/ydb/core/viewer/browse_pq.h
+++ b/ydb/core/viewer/browse_pq.h
@@ -63,16 +63,16 @@ protected:
public:
TBrowseCommon(const TActorId& owner, const IViewer::TBrowseContext& browseContext)
- : TBrowseTabletsCommon(owner, browseContext)
+ : TBrowseTabletsCommon(owner, browseContext)
, PQ_ROOT_PATH("/Root/PQ") // TODO(xenoxeno)
{}
- void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr &ev, const TActorContext &ctx) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr &ev, const TActorContext &ctx) {
DescribeResult.Reset(ev->Release());
++Responses;
ctx.Send(BrowseContext.Owner, new NViewerEvents::TEvBrowseRequestCompleted(TxProxy, TEvTxUserProxy::EvNavigate));
const auto& pbRecord(DescribeResult->GetRecord());
- if (pbRecord.GetStatus() == NKikimrScheme::EStatus::StatusSuccess) {
+ if (pbRecord.GetStatus() == NKikimrScheme::EStatus::StatusSuccess) {
if (pbRecord.HasPathDescription()) {
const auto& pbPathDescription(pbRecord.GetPathDescription());
TVector<ui64> tablets;
@@ -96,7 +96,7 @@ public:
}
} else {
switch (DescribeResult->GetRecord().GetStatus()) {
- case NKikimrScheme::EStatus::StatusPathDoesNotExist:
+ case NKikimrScheme::EStatus::StatusPathDoesNotExist:
return HandleBadRequest(ctx, "The path is not found");
default:
return HandleBadRequest(ctx, "Error getting schema information");
@@ -108,12 +108,12 @@ public:
if (pbPathDescription.HasSelf()) {
const auto& pbChildren(pbPathDescription.GetChildren());
for (const auto& pbChild : pbChildren) {
- if (pbChild.GetPathType() == NKikimrSchemeOp::EPathType::EPathTypePersQueueGroup) {
+ if (pbChild.GetPathType() == NKikimrSchemeOp::EPathType::EPathTypePersQueueGroup) {
THolder<TEvTxUserProxy::TEvNavigate> request(new TEvTxUserProxy::TEvNavigate());
if (!BrowseContext.UserToken.empty()) {
request->Record.SetUserToken(BrowseContext.UserToken);
}
- NKikimrSchemeOp::TDescribePath* record = request->Record.MutableDescribePath();
+ NKikimrSchemeOp::TDescribePath* record = request->Record.MutableDescribePath();
record->SetPath(pbDescribeResult.GetPath() + "/" + pbChild.GetName());
ctx.Send(TxProxy, request.Release());
++Requests;
@@ -156,7 +156,7 @@ public:
STFUNC(StateWork) {
switch (ev->GetTypeRewrite()) {
- HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
HFunc(TEvTablet::TEvGetCountersResponse, TBase::Handle);
HFunc(TEvPersQueue::TEvPartitionClientInfoResponse, Handle);
HFunc(TEvHive::TEvChannelInfo, TBase::Handle);
@@ -265,7 +265,7 @@ public:
if (!BrowseContext.UserToken.empty()) {
request->Record.SetUserToken(BrowseContext.UserToken);
}
- NKikimrSchemeOp::TDescribePath* record = request->Record.MutableDescribePath();
+ NKikimrSchemeOp::TDescribePath* record = request->Record.MutableDescribePath();
TString path(PQ_ROOT_PATH);
if (!FilterTopic.empty()) {
path += '/';
@@ -288,7 +288,7 @@ public:
}
TBrowseConsumers(const TActorId& owner, const IViewer::TBrowseContext& browseContext)
- : TBrowseCommon(owner, browseContext)
+ : TBrowseCommon(owner, browseContext)
{}
void ReplyAndDie(const TActorContext &ctx) {
@@ -309,7 +309,7 @@ public:
class TBrowseConsumer : public TBrowseCommon {
public:
TBrowseConsumer(const TActorId& owner, const IViewer::TBrowseContext& browseContext)
- : TBrowseCommon(owner, browseContext)
+ : TBrowseCommon(owner, browseContext)
{
FilterConsumer = BrowseContext.GetMyName();
if (BrowseContext.GetParentType() == NKikimrViewer::EObjectType::Topic) {
@@ -357,7 +357,7 @@ public:
class TBrowseTopic : public TBrowseCommon {
public:
TBrowseTopic(const TActorId& owner, const IViewer::TBrowseContext& browseContext)
- : TBrowseCommon(owner, browseContext)
+ : TBrowseCommon(owner, browseContext)
{
FilterTopic = BrowseContext.GetMyName();
if (BrowseContext.GetParentType() == NKikimrViewer::EObjectType::Consumer) {
diff --git a/ydb/core/viewer/content/viewer.js b/ydb/core/viewer/content/viewer.js
index 5042218e228..1108f42278c 100644
--- a/ydb/core/viewer/content/viewer.js
+++ b/ydb/core/viewer/content/viewer.js
@@ -2473,9 +2473,9 @@ function onTreeDataComplete(result, obj, cb) {
child.icon = "glyphicon glyphicon-tasks schema-good";
break;
case 10: // ExtSubDomain
- child.children = true;
- child.icon = "glyphicon glyphicon-asterisk schema-good";
- break;
+ child.children = true;
+ child.icon = "glyphicon glyphicon-asterisk schema-good";
+ break;
case 12: // OlapStore
child.children = true;
child.icon = "glyphicon glyphicon-list schema-good";
@@ -2590,8 +2590,8 @@ function schemaPathTypeToString(pathType) {
return "PersQueueGroup";
case 7:
return "Kesus";
- case 10:
- return "Tenant";
+ case 10:
+ return "Tenant";
case 15:
return "Sequence";
case 16:
@@ -2796,8 +2796,8 @@ function onTreeNodeComplete(result, obj) {
SchemaTabletElements[pqgroup.BalancerTabletID] = null;
}
}
- if (result.PathDescription.Self.PathType === 4 || result.PathDescription.Self.PathType === 10) {
- var subdomain = result.PathDescription.DomainDescription;
+ if (result.PathDescription.Self.PathType === 4 || result.PathDescription.Self.PathType === 10) {
+ var subdomain = result.PathDescription.DomainDescription;
if (subdomain !== undefined) {
var params = subdomain.ProcessingParams;
if (params !== undefined) {
@@ -2815,10 +2815,10 @@ function onTreeNodeComplete(result, obj) {
SchemaTabletElements[tablet] = null;
}
}
- if (params.SchemeShard !== undefined) {
- tablet = String(params.SchemeShard);
- SchemaTabletElements[tablet] = null;
- }
+ if (params.SchemeShard !== undefined) {
+ tablet = String(params.SchemeShard);
+ SchemaTabletElements[tablet] = null;
+ }
}
}
}
@@ -3077,49 +3077,49 @@ function onTreeNodeComplete(result, obj) {
value.innerHTML = partitionConfig.LifetimeSeconds + " seconds";
}
- if ((result.PathDescription.Self.PathType === 10 || result.PathDescription.Self.PathType === 4) && result.PathDescription.DomainDescription !== undefined) {
- if (result.PathDescription.DomainDescription.ProcessingParams !== undefined) {
- if (result.PathDescription.DomainDescription.ProcessingParams.Version !== undefined) {
+ if ((result.PathDescription.Self.PathType === 10 || result.PathDescription.Self.PathType === 4) && result.PathDescription.DomainDescription !== undefined) {
+ if (result.PathDescription.DomainDescription.ProcessingParams !== undefined) {
+ if (result.PathDescription.DomainDescription.ProcessingParams.Version !== undefined) {
row = tab.insertRow();
- row.insertCell(-1).innerHTML = "SubdomainVersion";
- row.insertCell(-1).innerHTML = result.PathDescription.DomainDescription.ProcessingParams.Version;
+ row.insertCell(-1).innerHTML = "SubdomainVersion";
+ row.insertCell(-1).innerHTML = result.PathDescription.DomainDescription.ProcessingParams.Version;
}
- if (result.PathDescription.DomainDescription.ProcessingParams.PlanResolution !== undefined) {
+ if (result.PathDescription.DomainDescription.ProcessingParams.PlanResolution !== undefined) {
row = tab.insertRow();
row.insertCell(-1).innerHTML = "Plan Resolution";
- row.insertCell(-1).innerHTML = result.PathDescription.DomainDescription.ProcessingParams.PlanResolution + "ms";
+ row.insertCell(-1).innerHTML = result.PathDescription.DomainDescription.ProcessingParams.PlanResolution + "ms";
}
}
- if (result.PathDescription.DomainDescription.DomainKey !== undefined) {
- row = tab.insertRow();
- row.insertCell(-1).innerHTML = "DomainKey";
- row.insertCell(-1).innerHTML = result.PathDescription.DomainDescription.DomainKey.SchemeShard + " : " + result.PathDescription.DomainDescription.DomainKey.PathId;
- }
+ if (result.PathDescription.DomainDescription.DomainKey !== undefined) {
+ row = tab.insertRow();
+ row.insertCell(-1).innerHTML = "DomainKey";
+ row.insertCell(-1).innerHTML = result.PathDescription.DomainDescription.DomainKey.SchemeShard + " : " + result.PathDescription.DomainDescription.DomainKey.PathId;
+ }
if (result.PathDescription.DomainDescription.ResourcesDomainKey !== undefined) {
row = tab.insertRow();
row.insertCell(-1).innerHTML = "ResourcesDomainKey";
row.insertCell(-1).innerHTML = result.PathDescription.DomainDescription.ResourcesDomainKey.SchemeShard + " : " + result.PathDescription.DomainDescription.ResourcesDomainKey.PathId;
}
- if (result.PathDescription.DomainDescription.PathsInside !== undefined) {
- row = tab.insertRow();
- row.insertCell(-1).innerHTML = "Pathes inside";
- row.insertCell(-1).innerHTML = result.PathDescription.DomainDescription.PathsInside + " / " + result.PathDescription.DomainDescription.PathsLimit;
- }
- if (result.PathDescription.DomainDescription.ShardsInside !== undefined) {
- row = tab.insertRow();
- row.insertCell(-1).innerHTML = "Shards inside";
- row.insertCell(-1).innerHTML = result.PathDescription.DomainDescription.ShardsInside + " / " + result.PathDescription.DomainDescription.ShardsLimit;
- }
- if (result.PathDescription.DomainDescription.StoragePools !== undefined) {
- var storagePools = result.PathDescription.DomainDescription.StoragePools;
- tabLen = storagePools.length;
- for (var j = 0; j < tabLen; j++) {
- row = tab.insertRow();
- row.insertCell(-1).innerHTML = "Storage pool";
- row.insertCell(-1).innerHTML = storagePools[j].Kind + " -> " + storagePools[j].Name;
-
- }
- }
+ if (result.PathDescription.DomainDescription.PathsInside !== undefined) {
+ row = tab.insertRow();
+ row.insertCell(-1).innerHTML = "Pathes inside";
+ row.insertCell(-1).innerHTML = result.PathDescription.DomainDescription.PathsInside + " / " + result.PathDescription.DomainDescription.PathsLimit;
+ }
+ if (result.PathDescription.DomainDescription.ShardsInside !== undefined) {
+ row = tab.insertRow();
+ row.insertCell(-1).innerHTML = "Shards inside";
+ row.insertCell(-1).innerHTML = result.PathDescription.DomainDescription.ShardsInside + " / " + result.PathDescription.DomainDescription.ShardsLimit;
+ }
+ if (result.PathDescription.DomainDescription.StoragePools !== undefined) {
+ var storagePools = result.PathDescription.DomainDescription.StoragePools;
+ tabLen = storagePools.length;
+ for (var j = 0; j < tabLen; j++) {
+ row = tab.insertRow();
+ row.insertCell(-1).innerHTML = "Storage pool";
+ row.insertCell(-1).innerHTML = storagePools[j].Kind + " -> " + storagePools[j].Name;
+
+ }
+ }
}
if (result.PathDescription.BackupProgress !== undefined) {
diff --git a/ydb/core/viewer/json_cluster.h b/ydb/core/viewer/json_cluster.h
index 31049c1e399..36b5362a452 100644
--- a/ydb/core/viewer/json_cluster.h
+++ b/ydb/core/viewer/json_cluster.h
@@ -29,7 +29,7 @@ class TJsonCluster : public TActorBootstrapped<TJsonCluster> {
TMap<TNodeId, THolder<TEvWhiteboard::TEvPDiskStateResponse>> PDiskInfo;
TMap<TNodeId, THolder<TEvWhiteboard::TEvBSGroupStateResponse>> BSGroupInfo;
TMap<TNodeId, THolder<TEvWhiteboard::TEvTabletStateResponse>> TabletInfo;
- THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult> DescribeResult;
+ THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult> DescribeResult;
TSet<TNodeId> NodesAlive;
TJsonSettings JsonSettings;
ui32 Timeout;
@@ -95,7 +95,7 @@ public:
TIntrusivePtr<TDomainsInfo> domains = AppData(ctx)->DomainsInfo;
TIntrusivePtr<TDomainsInfo::TDomain> domain = domains->Domains.begin()->second;
TString domainPath = "/" + domain->Name;
- NKikimrSchemeOp::TDescribePath* record = request->Record.MutableDescribePath();
+ NKikimrSchemeOp::TDescribePath* record = request->Record.MutableDescribePath();
record->SetPath(domainPath);
record->MutableOptions()->SetReturnPartitioningInfo(false);
record->MutableOptions()->SetReturnPartitionConfig(false);
@@ -203,8 +203,8 @@ public:
RequestDone(ctx);
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev, const TActorContext &ctx) {
- if (ev->Get()->GetRecord().GetStatus() == NKikimrScheme::StatusSuccess) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev, const TActorContext &ctx) {
+ if (ev->Get()->GetRecord().GetStatus() == NKikimrScheme::StatusSuccess) {
DescribeResult = ev->Release();
}
RequestDone(ctx);
@@ -237,7 +237,7 @@ public:
HFunc(TEvWhiteboard::TEvPDiskStateResponse, Handle);
HFunc(TEvWhiteboard::TEvBSGroupStateResponse, Handle);
HFunc(TEvWhiteboard::TEvTabletStateResponse, Handle);
- HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
HFunc(TEvents::TEvUndelivered, Undelivered);
HFunc(TEvInterconnect::TEvNodeDisconnected, Disconnected);
HFunc(TEvTabletPipe::TEvClientConnected, Handle);
@@ -281,7 +281,7 @@ public:
}
if (DescribeResult) {
- const NKikimrSchemeOp::TPathDescription& pathDescription(DescribeResult->GetRecord().GetPathDescription());
+ const NKikimrSchemeOp::TPathDescription& pathDescription(DescribeResult->GetRecord().GetPathDescription());
if (pathDescription.HasDomainDescription()) {
const NKikimrSubDomains::TDomainDescription& domainDescription(pathDescription.GetDomainDescription());
for (TTabletId tabletId : domainDescription.GetProcessingParams().GetCoordinators()) {
diff --git a/ydb/core/viewer/json_config.h b/ydb/core/viewer/json_config.h
index 0861d164012..7e501d5afbf 100644
--- a/ydb/core/viewer/json_config.h
+++ b/ydb/core/viewer/json_config.h
@@ -22,7 +22,7 @@ public:
return NKikimrServices::TActivity::VIEWER_HANDLER;
}
- TJsonConfig(IViewer *viewer, NMon::TEvHttpInfo::TPtr &ev)
+ TJsonConfig(IViewer *viewer, NMon::TEvHttpInfo::TPtr &ev)
: Viewer(viewer)
, Event(ev)
{}
diff --git a/ydb/core/viewer/json_describe.h b/ydb/core/viewer/json_describe.h
index d8e62ed1701..05ef441f8f6 100644
--- a/ydb/core/viewer/json_describe.h
+++ b/ydb/core/viewer/json_describe.h
@@ -12,13 +12,13 @@ namespace NKikimr {
namespace NViewer {
using namespace NActors;
-using NSchemeShard::TEvSchemeShard;
+using NSchemeShard::TEvSchemeShard;
class TJsonDescribe : public TViewerPipeClient<TJsonDescribe> {
using TBase = TViewerPipeClient<TJsonDescribe>;
IViewer* Viewer;
NMon::TEvHttpInfo::TPtr Event;
- TAutoPtr<TEvSchemeShard::TEvDescribeSchemeResult> DescribeResult;
+ TAutoPtr<TEvSchemeShard::TEvDescribeSchemeResult> DescribeResult;
TJsonSettings JsonSettings;
ui32 Timeout = 0;
@@ -32,7 +32,7 @@ public:
, Event(ev)
{}
- void FillParams(NKikimrSchemeOp::TDescribePath* record, const TCgiParameters& params) {
+ void FillParams(NKikimrSchemeOp::TDescribePath* record, const TCgiParameters& params) {
if (params.Has("path")) {
record->SetPath(params.Get("path"));
}
@@ -59,7 +59,7 @@ public:
InitConfig(params);
if (params.Has("schemeshard_id")) {
- THolder<TEvSchemeShard::TEvDescribeScheme> request = MakeHolder<TEvSchemeShard::TEvDescribeScheme>();
+ THolder<TEvSchemeShard::TEvDescribeScheme> request = MakeHolder<TEvSchemeShard::TEvDescribeScheme>();
FillParams(&request->Record, params);
ui64 schemeShardId = FromStringWithDefault<ui64>(params.Get("schemeshard_id"));
SendRequestToPipe(ConnectTabletPipe(schemeShardId), request.Release());
@@ -91,7 +91,7 @@ public:
if (DescribeResult != nullptr) {
TProtoToJson::ProtoToJson(json, DescribeResult->GetRecord(), JsonSettings);
switch (DescribeResult->GetRecord().GetStatus()) {
- case NKikimrScheme::StatusAccessDenied:
+ case NKikimrScheme::StatusAccessDenied:
headers = HTTPFORBIDDENJSON;
break;
default:
@@ -115,7 +115,7 @@ template <>
struct TJsonRequestSchema<TJsonDescribe> {
static TString GetSchema() {
TStringStream stream;
- TProtoToJson::ProtoToJsonSchema<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::ProtoRecordType>(stream);
+ TProtoToJson::ProtoToJsonSchema<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::ProtoRecordType>(stream);
return stream.Str();
}
};
diff --git a/ydb/core/viewer/json_hotkeys.h b/ydb/core/viewer/json_hotkeys.h
index a874ea3bc96..290e385a9bc 100644
--- a/ydb/core/viewer/json_hotkeys.h
+++ b/ydb/core/viewer/json_hotkeys.h
@@ -15,14 +15,14 @@ namespace NKikimr {
namespace NViewer {
using namespace NActors;
-using NSchemeShard::TEvSchemeShard;
+using NSchemeShard::TEvSchemeShard;
class TJsonHotkeys : public TViewerPipeClient<TJsonHotkeys> {
static const bool WithRetry = false;
using TBase = TViewerPipeClient<TJsonHotkeys>;
IViewer* Viewer;
NMon::TEvHttpInfo::TPtr Event;
- TAutoPtr<TEvSchemeShard::TEvDescribeSchemeResult> DescribeResult;
+ TAutoPtr<TEvSchemeShard::TEvDescribeSchemeResult> DescribeResult;
ui32 Timeout = 0;
ui32 Limit = 0;
float PollingFactor = 0.0;
@@ -46,7 +46,7 @@ public:
, Event(ev)
{}
- void FillParams(NKikimrSchemeOp::TDescribePath* record, const TCgiParameters& params) {
+ void FillParams(NKikimrSchemeOp::TDescribePath* record, const TCgiParameters& params) {
if (params.Has("path")) {
record->SetPath(params.Get("path"));
}
@@ -140,7 +140,7 @@ public:
TString headers = Viewer->GetHTTPOKJSON();
if (DescribeResult != nullptr) {
switch (DescribeResult->GetRecord().GetStatus()) {
- case NKikimrScheme::StatusAccessDenied:
+ case NKikimrScheme::StatusAccessDenied:
headers = HTTPFORBIDDENJSON;
break;
default:
diff --git a/ydb/core/viewer/json_nodes.h b/ydb/core/viewer/json_nodes.h
index 2dfdf1e648b..bfc0bae0e2a 100644
--- a/ydb/core/viewer/json_nodes.h
+++ b/ydb/core/viewer/json_nodes.h
@@ -30,7 +30,7 @@ class TJsonNodes : public TViewerPipeClient<TJsonNodes> {
std::unique_ptr<TEvInterconnect::TEvNodesInfo> NodesInfo;
std::unordered_map<TNodeId, THolder<TEvWhiteboard::TEvPDiskStateResponse>> PDiskInfo;
std::unordered_map<TNodeId, THolder<TEvWhiteboard::TEvSystemStateResponse>> SysInfo;
- std::unordered_map<TString, THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>> DescribeResult;
+ std::unordered_map<TString, THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>> DescribeResult;
std::unique_ptr<TEvBlobStorage::TEvControllerConfigResponse> BaseConfig;
TJsonSettings JsonSettings;
ui32 Timeout = 0;
@@ -100,7 +100,7 @@ public:
if (!Event->Get()->UserToken.empty()) {
request->Record.SetUserToken(Event->Get()->UserToken);
}
- NKikimrSchemeOp::TDescribePath* record = request->Record.MutableDescribePath();
+ NKikimrSchemeOp::TDescribePath* record = request->Record.MutableDescribePath();
record->SetPath(path);
request->Record.SetUserToken(Event->Get()->UserToken);
TActorId txproxy = MakeTxProxyID();
@@ -161,10 +161,10 @@ public:
RequestDone();
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
TString path = ev->Get()->GetRecord().GetPath();
- const NKikimrSchemeOp::TPathDescription& pathDescription = ev->Get()->GetRecord().GetPathDescription();
+ const NKikimrSchemeOp::TPathDescription& pathDescription = ev->Get()->GetRecord().GetPathDescription();
TTabletId hiveId = pathDescription.GetDomainDescription().GetProcessingParams().GetHive();
if (hiveId != 0) {
RequestHiveStorageStats(hiveId);
@@ -225,7 +225,7 @@ public:
hFunc(TEvInterconnect::TEvNodesInfo, Handle);
hFunc(TEvWhiteboard::TEvSystemStateResponse, Handle);
hFunc(TEvWhiteboard::TEvPDiskStateResponse, Handle);
- hFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ hFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
hFunc(TEvBlobStorage::TEvControllerSelectGroupsResult, Handle);
hFunc(TEvBlobStorage::TEvControllerConfigResponse, Handle);
hFunc(TEvents::TEvUndelivered, Undelivered);
diff --git a/ydb/core/viewer/json_storage.h b/ydb/core/viewer/json_storage.h
index 54b620fd06b..76e5d2f5e8b 100644
--- a/ydb/core/viewer/json_storage.h
+++ b/ydb/core/viewer/json_storage.h
@@ -31,7 +31,7 @@ class TJsonStorage : public TViewerPipeClient<TJsonStorage> {
TMap<ui32, THolder<TEvWhiteboard::TEvVDiskStateResponse>> VDiskInfo;
TMap<ui32, THolder<TEvWhiteboard::TEvPDiskStateResponse>> PDiskInfo;
TMap<ui32, THolder<TEvWhiteboard::TEvBSGroupStateResponse>> BSGroupInfo;
- THashMap<TString, THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>> DescribeResult;
+ THashMap<TString, THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult>> DescribeResult;
THashMap<TTabletId, THolder<TEvHive::TEvResponseHiveStorageStats>> HiveStorageStats;
THolder<TEvBlobStorage::TEvControllerConfigResponse> BaseConfig;
diff --git a/ydb/core/viewer/json_tabletcounters.h b/ydb/core/viewer/json_tabletcounters.h
index 2cd2aec15d3..7f399104410 100644
--- a/ydb/core/viewer/json_tabletcounters.h
+++ b/ydb/core/viewer/json_tabletcounters.h
@@ -23,7 +23,7 @@ class TJsonTabletCounters : public TActorBootstrapped<TJsonTabletCounters> {
TVector<TActorId> PipeClients;
TVector<ui64> Tablets;
TMap<TTabletId, THolder<TEvTablet::TEvGetCountersResponse>> Results;
- THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult> DescribeResult;
+ THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult> DescribeResult;
TJsonSettings JsonSettings;
ui32 Timeout = 0;
bool Aggregate = false;
@@ -62,13 +62,13 @@ public:
if (!Event->Get()->UserToken.empty()) {
request->Record.SetUserToken(Event->Get()->UserToken);
}
- NKikimrSchemeOp::TDescribePath* record = request->Record.MutableDescribePath();
+ NKikimrSchemeOp::TDescribePath* record = request->Record.MutableDescribePath();
record->SetPath(params.Get("path"));
-
+
TActorId txproxy = MakeTxProxyID();
- ctx.Send(txproxy, request.Release());
+ ctx.Send(txproxy, request.Release());
Become(&TThis::StateRequestedDescribe, ctx, TDuration::MilliSeconds(Timeout), new TEvents::TEvWakeup());
- } else if (params.Has("tablet_id")) {
+ } else if (params.Has("tablet_id")) {
TTabletId tabletId = FromStringWithDefault<TTabletId>(params.Get("tablet_id"), 0);
if (tabletId != 0) {
Tablets.emplace_back(tabletId);
@@ -77,10 +77,10 @@ public:
PipeClients.emplace_back(PipeClient);
Become(&TThis::StateRequestedGetCounters, ctx, TDuration::MilliSeconds(Timeout), new TEvents::TEvWakeup());
}
-
- if (PipeClients.empty()) {
- ReplyAndDie(ctx);
- }
+
+ if (PipeClients.empty()) {
+ ReplyAndDie(ctx);
+ }
}
}
@@ -93,7 +93,7 @@ public:
STFUNC(StateRequestedDescribe) {
switch (ev->GetTypeRewrite()) {
- HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
+ HFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, Handle);
CFunc(TEvents::TSystem::Wakeup, HandleTimeout);
}
}
@@ -105,9 +105,9 @@ public:
}
}
- void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr &ev, const TActorContext &ctx) {
+ void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr &ev, const TActorContext &ctx) {
DescribeResult = ev->Release();
- if (DescribeResult->GetRecord().GetStatus() == NKikimrScheme::EStatus::StatusSuccess) {
+ if (DescribeResult->GetRecord().GetStatus() == NKikimrScheme::EStatus::StatusSuccess) {
Tablets.reserve(DescribeResult->GetRecord().GetPathDescription().TablePartitionsSize());
for (const auto& partition : DescribeResult->GetRecord().GetPathDescription().GetTablePartitions()) {
Tablets.emplace_back(partition.GetDatashardId());
diff --git a/ydb/core/viewer/json_tabletinfo.h b/ydb/core/viewer/json_tabletinfo.h
index 5195eccc774..32546865a15 100644
--- a/ydb/core/viewer/json_tabletinfo.h
+++ b/ydb/core/viewer/json_tabletinfo.h
@@ -80,20 +80,20 @@ public:
if (!Event->Get()->UserToken.empty()) {
request->Record.SetUserToken(Event->Get()->UserToken);
}
- NKikimrSchemeOp::TDescribePath* record = request->Record.MutableDescribePath();
+ NKikimrSchemeOp::TDescribePath* record = request->Record.MutableDescribePath();
record->SetPath(params.Get("path"));
-
+
TActorId txproxy = MakeTxProxyID();
TBase::Send(txproxy, request.Release());
Become(&TThis::StateRequestedDescribe, TDuration::MilliSeconds(Timeout), new TEvents::TEvWakeup());
- } else {
+ } else {
TBase::Bootstrap();
}
}
void Handle(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr &ev) {
- THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult> describeResult = ev->Release();
- if (describeResult->GetRecord().GetStatus() == NKikimrScheme::EStatus::StatusSuccess) {
+ THolder<NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult> describeResult = ev->Release();
+ if (describeResult->GetRecord().GetStatus() == NKikimrScheme::EStatus::StatusSuccess) {
Tablets.reserve(describeResult->GetRecord().GetPathDescription().TablePartitionsSize());
for (const auto& partition : describeResult->GetRecord().GetPathDescription().GetTablePartitions()) {
Tablets.emplace_back(partition.GetDatashardId());
diff --git a/ydb/core/viewer/protos/viewer.proto b/ydb/core/viewer/protos/viewer.proto
index 79fa0b3a723..9f6c822a89f 100644
--- a/ydb/core/viewer/protos/viewer.proto
+++ b/ydb/core/viewer/protos/viewer.proto
@@ -28,7 +28,7 @@ enum EObjectType {
RtmrVolume = 14;
BlockStoreVolume = 15;
Kesus = 16;
- SolomonVolume = 17;
+ SolomonVolume = 17;
SubDomain = 18;
FileStore = 19;
CdcStream = 20;
@@ -45,8 +45,8 @@ message TBrowseInfo {
}
message TBackupInfo {
- NKikimrSchemeOp.TBackupProgress Progress = 1;
- repeated NKikimrSchemeOp.TLastBackupResult LastResults = 2;
+ NKikimrSchemeOp.TBackupProgress Progress = 1;
+ repeated NKikimrSchemeOp.TLastBackupResult LastResults = 2;
}
message TResources {
@@ -178,30 +178,30 @@ message TMetaTopicInfo {
message TMetaRtmrOperationInfo {
message TSettings {
- // Options passed to the operation instance
- string Options = 1;
- // Force pause between operation executions on one key; seconds
- uint32 PostponeTimeout = 2;
+ // Options passed to the operation instance
+ string Options = 1;
+ // Force pause between operation executions on one key; seconds
+ uint32 PostponeTimeout = 2;
// Pacing period for postponed keys (maximum error added to PostponeTimeout); seconds
uint32 PostponePacePeriod = 13;
// Force pause before first operation execution on one key; seconds
uint32 BatchTimeout = 11;
- // Max age of data being read for operation execution; seconds
- uint32 MaxTimeBack = 3;
- // Operation instance recreation period; seconds
- uint32 RecycleTimeout = 4;
- // Importance of operation for scheduling
- uint32 Weight = 5;
- // Max data passed to operation per one execution
- uint32 MaxInputBytes = 6;
- // Discard data if there is too long queue for execution
- uint32 SkipIfMoreThanBytes = 7;
- // desired revision of dynamic library
- uint32 Revision = 8;
- // current working directory
- string WorkingDirectory = 9;
- // Dynamic library name
- string LibraryName = 10;
+ // Max age of data being read for operation execution; seconds
+ uint32 MaxTimeBack = 3;
+ // Operation instance recreation period; seconds
+ uint32 RecycleTimeout = 4;
+ // Importance of operation for scheduling
+ uint32 Weight = 5;
+ // Max data passed to operation per one execution
+ uint32 MaxInputBytes = 6;
+ // Discard data if there is too long queue for execution
+ uint32 SkipIfMoreThanBytes = 7;
+ // desired revision of dynamic library
+ uint32 Revision = 8;
+ // current working directory
+ string WorkingDirectory = 9;
+ // Dynamic library name
+ string LibraryName = 10;
// Tolerance to failures during operation execution
uint32 SuspendThreshold = 12;
};
@@ -221,9 +221,9 @@ message TMetaRtmrOperationInfo {
string Name = 2;
uint32 Lifetime = 3; // Lifetime in seconds
uint64 DataSize = 4; // in bytes
- uint64 Entries = 5;
- uint64 UpdatesCount = 6;
- uint64 UpdateTime = 7; // milliseconds since epoch
+ uint64 Entries = 5;
+ uint64 UpdatesCount = 6;
+ uint64 UpdateTime = 7; // milliseconds since epoch
};
bool Enabled = 1;
diff --git a/ydb/core/viewer/viewer.cpp b/ydb/core/viewer/viewer.cpp
index 44b4cfebd82..f1124115bf7 100644
--- a/ydb/core/viewer/viewer.cpp
+++ b/ydb/core/viewer/viewer.cpp
@@ -129,9 +129,9 @@ public:
return NKikimrServices::TActivity::TABLET_MONITORING_PROXY;
}
- TViewer(const TKikimrRunConfig &kikimrRunConfig)
+ TViewer(const TKikimrRunConfig &kikimrRunConfig)
: KikimrRunConfig(kikimrRunConfig)
- {}
+ {}
void Bootstrap(const TActorContext &ctx) {
Become(&TThis::StateWork);
@@ -488,9 +488,9 @@ TString IViewer::TContentRequestContext::Dump() const
ui32 CurrentMonitoringPort = 8765;
-IActor* CreateViewer(const TKikimrRunConfig &kikimrRunConfig) {
+IActor* CreateViewer(const TKikimrRunConfig &kikimrRunConfig) {
CurrentMonitoringPort = kikimrRunConfig.AppConfig.GetMonitoringConfig().GetMonitoringPort();
- return new TViewer(kikimrRunConfig);
+ return new TViewer(kikimrRunConfig);
}
TString IViewer::GetHTTPOKJSON() {
diff --git a/ydb/core/viewer/viewer.h b/ydb/core/viewer/viewer.h
index 473a8bf8f78..ab34762e3ed 100644
--- a/ydb/core/viewer/viewer.h
+++ b/ydb/core/viewer/viewer.h
@@ -18,7 +18,7 @@ inline TActorId MakeViewerID(ui32 node = 0) {
return TActorId(node, TStringBuf(x, 12));
}
-IActor* CreateViewer(const TKikimrRunConfig &kikimrRunConfig);
+IActor* CreateViewer(const TKikimrRunConfig &kikimrRunConfig);
class IViewer {
public:
diff --git a/ydb/core/ydb_convert/column_families.h b/ydb/core/ydb_convert/column_families.h
index 0f22071cfe4..152e0561bc3 100644
--- a/ydb/core/ydb_convert/column_families.h
+++ b/ydb/core/ydb_convert/column_families.h
@@ -11,11 +11,11 @@ namespace NKikimr {
class TColumnFamilyManager {
public:
- TColumnFamilyManager(NKikimrSchemeOp::TPartitionConfig* partitionConfig)
+ TColumnFamilyManager(NKikimrSchemeOp::TPartitionConfig* partitionConfig)
: PartitionConfig(partitionConfig)
{ }
- const NKikimrSchemeOp::TFamilyDescription* FindDefaultFamily() const {
+ const NKikimrSchemeOp::TFamilyDescription* FindDefaultFamily() const {
if (DefaultFamilyIndex != size_t(-1)) {
return &PartitionConfig->GetColumnFamilies(DefaultFamilyIndex);
}
@@ -30,7 +30,7 @@ namespace NKikimr {
return nullptr;
}
- NKikimrSchemeOp::TFamilyDescription* MutableDefaultFamily() {
+ NKikimrSchemeOp::TFamilyDescription* MutableDefaultFamily() {
Modified = true;
if (DefaultFamilyIndex != size_t(-1)) {
@@ -51,7 +51,7 @@ namespace NKikimr {
return family;
}
- NKikimrSchemeOp::TFamilyDescription* MutableNamedFamily(const TString& name) {
+ NKikimrSchemeOp::TFamilyDescription* MutableNamedFamily(const TString& name) {
Modified = true;
if (name == "default") {
@@ -158,10 +158,10 @@ namespace NKikimr {
case Ydb::Table::ColumnFamily::COMPRESSION_UNSPECIFIED:
break;
case Ydb::Table::ColumnFamily::COMPRESSION_NONE:
- family->SetColumnCodec(NKikimrSchemeOp::ColumnCodecPlain);
+ family->SetColumnCodec(NKikimrSchemeOp::ColumnCodecPlain);
break;
case Ydb::Table::ColumnFamily::COMPRESSION_LZ4:
- family->SetColumnCodec(NKikimrSchemeOp::ColumnCodecLZ4);
+ family->SetColumnCodec(NKikimrSchemeOp::ColumnCodecLZ4);
break;
default:
*code = Ydb::StatusIds::BAD_REQUEST;
@@ -227,7 +227,7 @@ namespace NKikimr {
}
public:
- static bool IsDefaultFamily(const NKikimrSchemeOp::TFamilyDescription& family) {
+ static bool IsDefaultFamily(const NKikimrSchemeOp::TFamilyDescription& family) {
if (family.HasId() && family.GetId() == 0) {
return true; // explicit id 0
}
@@ -238,7 +238,7 @@ namespace NKikimr {
}
public:
- NKikimrSchemeOp::TPartitionConfig* const PartitionConfig;
+ NKikimrSchemeOp::TPartitionConfig* const PartitionConfig;
bool Modified = false;
private:
diff --git a/ydb/core/ydb_convert/table_description.cpp b/ydb/core/ydb_convert/table_description.cpp
index 66c6b17a74f..0d10bb8450b 100644
--- a/ydb/core/ydb_convert/table_description.cpp
+++ b/ydb/core/ydb_convert/table_description.cpp
@@ -21,7 +21,7 @@ static NProtoBuf::Timestamp MillisecToProtoTimeStamp(ui64 ms) {
template <typename TYdbProto>
void FillColumnDescriptionImpl(TYdbProto& out,
- NKikimrMiniKQL::TType& splitKeyType, const NKikimrSchemeOp::TTableDescription& in) {
+ NKikimrMiniKQL::TType& splitKeyType, const NKikimrSchemeOp::TTableDescription& in) {
splitKeyType.SetKind(NKikimrMiniKQL::ETypeKind::Tuple);
splitKeyType.MutableTuple()->MutableElement()->Reserve(in.KeyColumnIdsSize());
@@ -67,17 +67,17 @@ void FillColumnDescriptionImpl(TYdbProto& out,
const auto& inTTL = in.GetTTLSettings().GetEnabled();
switch (inTTL.GetColumnUnit()) {
- case NKikimrSchemeOp::TTTLSettings::UNIT_AUTO: {
+ case NKikimrSchemeOp::TTTLSettings::UNIT_AUTO: {
auto& outTTL = *out.mutable_ttl_settings()->mutable_date_type_column();
outTTL.set_column_name(inTTL.GetColumnName());
outTTL.set_expire_after_seconds(inTTL.GetExpireAfterSeconds());
break;
}
- case NKikimrSchemeOp::TTTLSettings::UNIT_SECONDS:
- case NKikimrSchemeOp::TTTLSettings::UNIT_MILLISECONDS:
- case NKikimrSchemeOp::TTTLSettings::UNIT_MICROSECONDS:
- case NKikimrSchemeOp::TTTLSettings::UNIT_NANOSECONDS: {
+ case NKikimrSchemeOp::TTTLSettings::UNIT_SECONDS:
+ case NKikimrSchemeOp::TTTLSettings::UNIT_MILLISECONDS:
+ case NKikimrSchemeOp::TTTLSettings::UNIT_MICROSECONDS:
+ case NKikimrSchemeOp::TTTLSettings::UNIT_NANOSECONDS: {
auto& outTTL = *out.mutable_ttl_settings()->mutable_value_since_unix_epoch();
outTTL.set_column_name(inTTL.GetColumnName());
outTTL.set_column_unit(static_cast<Ydb::Table::ValueSinceUnixEpochModeSettings::Unit>(inTTL.GetColumnUnit()));
@@ -92,12 +92,12 @@ void FillColumnDescriptionImpl(TYdbProto& out,
}
void FillColumnDescription(Ydb::Table::DescribeTableResult& out,
- NKikimrMiniKQL::TType& splitKeyType, const NKikimrSchemeOp::TTableDescription& in) {
+ NKikimrMiniKQL::TType& splitKeyType, const NKikimrSchemeOp::TTableDescription& in) {
FillColumnDescriptionImpl(out, splitKeyType, in);
}
void FillColumnDescription(Ydb::Table::CreateTableRequest& out,
- NKikimrMiniKQL::TType& splitKeyType, const NKikimrSchemeOp::TTableDescription& in) {
+ NKikimrMiniKQL::TType& splitKeyType, const NKikimrSchemeOp::TTableDescription& in) {
FillColumnDescriptionImpl(out, splitKeyType, in);
}
@@ -146,11 +146,11 @@ bool ExtractColumnTypeId(ui32& outTypeId, const Ydb::Type& inType, Ydb::StatusId
return true;
}
-bool FillColumnDescription(NKikimrSchemeOp::TTableDescription& out,
+bool FillColumnDescription(NKikimrSchemeOp::TTableDescription& out,
const google::protobuf::RepeatedPtrField<Ydb::Table::ColumnMeta>& in, Ydb::StatusIds::StatusCode& status, TString& error) {
for (const auto& column : in) {
- NKikimrSchemeOp:: TColumnDescription* cd = out.AddColumns();
+ NKikimrSchemeOp:: TColumnDescription* cd = out.AddColumns();
cd->SetName(column.name());
if (!column.type().has_optional_type()) {
if (!AppData()->FeatureFlags.GetEnableNotNullColumns()) {
@@ -178,7 +178,7 @@ bool FillColumnDescription(NKikimrSchemeOp::TTableDescription& out,
template <typename TYdbProto>
void FillTableBoundaryImpl(TYdbProto& out,
- const NKikimrSchemeOp::TTableDescription& in, const NKikimrMiniKQL::TType& splitKeyType) {
+ const NKikimrSchemeOp::TTableDescription& in, const NKikimrMiniKQL::TType& splitKeyType) {
for (const auto& boundary : in.GetSplitBoundary()) {
if (boundary.HasSerializedKeyPrefix()) {
@@ -211,18 +211,18 @@ void FillTableBoundaryImpl(TYdbProto& out,
}
void FillTableBoundary(Ydb::Table::DescribeTableResult& out,
- const NKikimrSchemeOp::TTableDescription& in, const NKikimrMiniKQL::TType& splitKeyType) {
+ const NKikimrSchemeOp::TTableDescription& in, const NKikimrMiniKQL::TType& splitKeyType) {
FillTableBoundaryImpl<Ydb::Table::DescribeTableResult>(out, in, splitKeyType);
}
void FillTableBoundary(Ydb::Table::CreateTableRequest& out,
- const NKikimrSchemeOp::TTableDescription& in, const NKikimrMiniKQL::TType& splitKeyType) {
+ const NKikimrSchemeOp::TTableDescription& in, const NKikimrMiniKQL::TType& splitKeyType) {
FillTableBoundaryImpl<Ydb::Table::CreateTableRequest>(out, in, splitKeyType);
}
template <typename TYdbProto>
void FillIndexDescriptionImpl(TYdbProto& out,
- const NKikimrSchemeOp::TTableDescription& in) {
+ const NKikimrSchemeOp::TTableDescription& in) {
for (const auto& tableIndex : in.GetTableIndexes()) {
auto index = out.add_indexes();
@@ -240,10 +240,10 @@ void FillIndexDescriptionImpl(TYdbProto& out,
};
switch (tableIndex.GetType()) {
- case NKikimrSchemeOp::EIndexType::EIndexTypeGlobal:
+ case NKikimrSchemeOp::EIndexType::EIndexTypeGlobal:
*index->mutable_global_index() = Ydb::Table::GlobalIndex();
break;
- case NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync:
+ case NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync:
*index->mutable_global_async_index() = Ydb::Table::GlobalAsyncIndex();
break;
default:
@@ -251,7 +251,7 @@ void FillIndexDescriptionImpl(TYdbProto& out,
};
if constexpr (std::is_same<TYdbProto, Ydb::Table::DescribeTableResult>::value) {
- if (tableIndex.GetState() == NKikimrSchemeOp::EIndexState::EIndexStateReady) {
+ if (tableIndex.GetState() == NKikimrSchemeOp::EIndexState::EIndexStateReady) {
index->set_status(Ydb::Table::TableIndexDescription::STATUS_READY);
} else {
index->set_status(Ydb::Table::TableIndexDescription::STATUS_BUILDING);
@@ -262,16 +262,16 @@ void FillIndexDescriptionImpl(TYdbProto& out,
}
void FillIndexDescription(Ydb::Table::DescribeTableResult& out,
- const NKikimrSchemeOp::TTableDescription& in) {
+ const NKikimrSchemeOp::TTableDescription& in) {
FillIndexDescriptionImpl(out, in);
}
void FillIndexDescription(Ydb::Table::CreateTableRequest& out,
- const NKikimrSchemeOp::TTableDescription& in) {
+ const NKikimrSchemeOp::TTableDescription& in) {
FillIndexDescriptionImpl(out, in);
}
-bool FillIndexDescription(NKikimrSchemeOp::TIndexedTableCreationConfig& out,
+bool FillIndexDescription(NKikimrSchemeOp::TIndexedTableCreationConfig& out,
const Ydb::Table::CreateTableRequest& in, Ydb::StatusIds::StatusCode& status, TString& error) {
auto returnError = [&status, &error](Ydb::StatusIds::StatusCode code, const TString& msg) -> bool {
@@ -301,7 +301,7 @@ bool FillIndexDescription(NKikimrSchemeOp::TIndexedTableCreationConfig& out,
// specific fields
switch (index.type_case()) {
case Ydb::Table::TableIndex::kGlobalIndex:
- indexDesc->SetType(NKikimrSchemeOp::EIndexType::EIndexTypeGlobal);
+ indexDesc->SetType(NKikimrSchemeOp::EIndexType::EIndexTypeGlobal);
break;
case Ydb::Table::TableIndex::kGlobalAsyncIndex:
@@ -309,7 +309,7 @@ bool FillIndexDescription(NKikimrSchemeOp::TIndexedTableCreationConfig& out,
return returnError(Ydb::StatusIds::UNSUPPORTED, "Async indexes are not supported yet");
}
- indexDesc->SetType(NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync);
+ indexDesc->SetType(NKikimrSchemeOp::EIndexType::EIndexTypeGlobalAsync);
break;
default:
@@ -342,7 +342,7 @@ bool FillIndexDescription(NKikimrSchemeOp::TIndexedTableCreationConfig& out,
}
void FillTableStats(Ydb::Table::DescribeTableResult& out,
- const NKikimrSchemeOp::TPathDescription& in, bool withPartitionStatistic) {
+ const NKikimrSchemeOp::TPathDescription& in, bool withPartitionStatistic) {
auto stats = out.mutable_table_stats();
@@ -375,7 +375,7 @@ void FillTableStats(Ydb::Table::DescribeTableResult& out,
}
}
-static bool IsDefaultFamily(const NKikimrSchemeOp::TFamilyDescription& family) {
+static bool IsDefaultFamily(const NKikimrSchemeOp::TFamilyDescription& family) {
if (family.HasId() && family.GetId() == 0) {
return true; // explicit id 0
}
@@ -387,7 +387,7 @@ static bool IsDefaultFamily(const NKikimrSchemeOp::TFamilyDescription& family) {
template <typename TYdbProto>
void FillStorageSettingsImpl(TYdbProto& out,
- const NKikimrSchemeOp::TTableDescription& in) {
+ const NKikimrSchemeOp::TTableDescription& in) {
if (!in.HasPartitionConfig()) {
return;
@@ -424,17 +424,17 @@ void FillStorageSettingsImpl(TYdbProto& out,
// Check legacy settings for enabled external blobs
switch (family.GetStorage()) {
- case NKikimrSchemeOp::ColumnStorage1:
+ case NKikimrSchemeOp::ColumnStorage1:
// default or unset, no legacy external blobs
break;
- case NKikimrSchemeOp::ColumnStorage2:
- case NKikimrSchemeOp::ColumnStorage1Ext1:
- case NKikimrSchemeOp::ColumnStorage1Ext2:
- case NKikimrSchemeOp::ColumnStorage2Ext1:
- case NKikimrSchemeOp::ColumnStorage2Ext2:
- case NKikimrSchemeOp::ColumnStorage1Med2Ext2:
- case NKikimrSchemeOp::ColumnStorage2Med2Ext2:
- case NKikimrSchemeOp::ColumnStorageTest_1_2_1k:
+ case NKikimrSchemeOp::ColumnStorage2:
+ case NKikimrSchemeOp::ColumnStorage1Ext1:
+ case NKikimrSchemeOp::ColumnStorage1Ext2:
+ case NKikimrSchemeOp::ColumnStorage2Ext1:
+ case NKikimrSchemeOp::ColumnStorage2Ext2:
+ case NKikimrSchemeOp::ColumnStorage1Med2Ext2:
+ case NKikimrSchemeOp::ColumnStorage2Med2Ext2:
+ case NKikimrSchemeOp::ColumnStorageTest_1_2_1k:
settings->set_store_external_blobs(Ydb::FeatureFlag::ENABLED);
break;
}
@@ -445,18 +445,18 @@ void FillStorageSettingsImpl(TYdbProto& out,
}
void FillStorageSettings(Ydb::Table::DescribeTableResult& out,
- const NKikimrSchemeOp::TTableDescription& in) {
+ const NKikimrSchemeOp::TTableDescription& in) {
FillStorageSettingsImpl(out, in);
}
void FillStorageSettings(Ydb::Table::CreateTableRequest& out,
- const NKikimrSchemeOp::TTableDescription& in) {
+ const NKikimrSchemeOp::TTableDescription& in) {
FillStorageSettingsImpl(out, in);
}
template <typename TYdbProto>
void FillColumnFamiliesImpl(TYdbProto& out,
- const NKikimrSchemeOp::TTableDescription& in) {
+ const NKikimrSchemeOp::TTableDescription& in) {
if (!in.HasPartitionConfig()) {
return;
@@ -487,13 +487,13 @@ void FillColumnFamiliesImpl(TYdbProto& out,
if (family.HasColumnCodec()) {
switch (family.GetColumnCodec()) {
- case NKikimrSchemeOp::ColumnCodecPlain:
+ case NKikimrSchemeOp::ColumnCodecPlain:
r->set_compression(Ydb::Table::ColumnFamily::COMPRESSION_NONE);
break;
- case NKikimrSchemeOp::ColumnCodecLZ4:
+ case NKikimrSchemeOp::ColumnCodecLZ4:
r->set_compression(Ydb::Table::ColumnFamily::COMPRESSION_LZ4);
break;
- case NKikimrSchemeOp::ColumnCodecZSTD:
+ case NKikimrSchemeOp::ColumnCodecZSTD:
break; // FIXME: not supported
}
} else if (family.GetCodec() == 1) {
@@ -504,25 +504,25 @@ void FillColumnFamiliesImpl(TYdbProto& out,
}
// Check legacy settings for permanent in-memory cache
- if (family.GetInMemory() || family.GetColumnCache() == NKikimrSchemeOp::ColumnCacheEver) {
+ if (family.GetInMemory() || family.GetColumnCache() == NKikimrSchemeOp::ColumnCacheEver) {
r->set_keep_in_memory(Ydb::FeatureFlag::ENABLED);
}
}
}
void FillColumnFamilies(Ydb::Table::DescribeTableResult& out,
- const NKikimrSchemeOp::TTableDescription& in) {
+ const NKikimrSchemeOp::TTableDescription& in) {
FillColumnFamiliesImpl(out, in);
}
void FillColumnFamilies(Ydb::Table::CreateTableRequest& out,
- const NKikimrSchemeOp::TTableDescription& in) {
+ const NKikimrSchemeOp::TTableDescription& in) {
FillColumnFamiliesImpl(out, in);
}
template <typename TYdbProto>
void FillAttributesImpl(TYdbProto& out,
- const NKikimrSchemeOp::TPathDescription& in) {
+ const NKikimrSchemeOp::TPathDescription& in) {
if (!in.UserAttributesSize()) {
return;
@@ -535,12 +535,12 @@ void FillAttributesImpl(TYdbProto& out,
}
void FillAttributes(Ydb::Table::DescribeTableResult& out,
- const NKikimrSchemeOp::TPathDescription& in) {
+ const NKikimrSchemeOp::TPathDescription& in) {
FillAttributesImpl(out, in);
}
void FillAttributes(Ydb::Table::CreateTableRequest& out,
- const NKikimrSchemeOp::TPathDescription& in) {
+ const NKikimrSchemeOp::TPathDescription& in) {
FillAttributesImpl(out, in);
}
@@ -554,7 +554,7 @@ static void FillDefaultPartitioningSettings(TYdbProto& out) {
template <typename TYdbProto>
void FillPartitioningSettingsImpl(TYdbProto& out,
- const NKikimrSchemeOp::TTableDescription& in) {
+ const NKikimrSchemeOp::TTableDescription& in) {
if (!in.HasPartitionConfig()) {
FillDefaultPartitioningSettings(out);
@@ -599,16 +599,16 @@ void FillPartitioningSettingsImpl(TYdbProto& out,
}
void FillPartitioningSettings(Ydb::Table::DescribeTableResult& out,
- const NKikimrSchemeOp::TTableDescription& in) {
+ const NKikimrSchemeOp::TTableDescription& in) {
FillPartitioningSettingsImpl(out, in);
}
void FillPartitioningSettings(Ydb::Table::CreateTableRequest& out,
- const NKikimrSchemeOp::TTableDescription& in) {
+ const NKikimrSchemeOp::TTableDescription& in) {
FillPartitioningSettingsImpl(out, in);
}
-bool CopyExplicitPartitions(NKikimrSchemeOp::TTableDescription& out,
+bool CopyExplicitPartitions(NKikimrSchemeOp::TTableDescription& out,
const Ydb::Table::ExplicitPartitions& in, Ydb::StatusIds::StatusCode& status, TString& error) {
try {
@@ -627,7 +627,7 @@ bool CopyExplicitPartitions(NKikimrSchemeOp::TTableDescription& out,
template <typename TYdbProto>
void FillKeyBloomFilterImpl(TYdbProto& out,
- const NKikimrSchemeOp::TTableDescription& in) {
+ const NKikimrSchemeOp::TTableDescription& in) {
if (!in.HasPartitionConfig()) {
return;
@@ -646,18 +646,18 @@ void FillKeyBloomFilterImpl(TYdbProto& out,
}
void FillKeyBloomFilter(Ydb::Table::DescribeTableResult& out,
- const NKikimrSchemeOp::TTableDescription& in) {
+ const NKikimrSchemeOp::TTableDescription& in) {
FillKeyBloomFilterImpl(out, in);
}
void FillKeyBloomFilter(Ydb::Table::CreateTableRequest& out,
- const NKikimrSchemeOp::TTableDescription& in) {
+ const NKikimrSchemeOp::TTableDescription& in) {
FillKeyBloomFilterImpl(out, in);
}
template <typename TYdbProto>
void FillReadReplicasSettingsImpl(TYdbProto& out,
- const NKikimrSchemeOp::TTableDescription& in) {
+ const NKikimrSchemeOp::TTableDescription& in) {
if (!in.HasPartitionConfig()) {
return;
@@ -687,12 +687,12 @@ void FillReadReplicasSettingsImpl(TYdbProto& out,
}
void FillReadReplicasSettings(Ydb::Table::DescribeTableResult& out,
- const NKikimrSchemeOp::TTableDescription& in) {
+ const NKikimrSchemeOp::TTableDescription& in) {
FillReadReplicasSettingsImpl(out, in);
}
void FillReadReplicasSettings(Ydb::Table::CreateTableRequest& out,
- const NKikimrSchemeOp::TTableDescription& in) {
+ const NKikimrSchemeOp::TTableDescription& in) {
FillReadReplicasSettingsImpl(out, in);
}
diff --git a/ydb/core/ydb_convert/table_description.h b/ydb/core/ydb_convert/table_description.h
index 28d2dfb5f33..af77a93776a 100644
--- a/ydb/core/ydb_convert/table_description.h
+++ b/ydb/core/ydb_convert/table_description.h
@@ -8,72 +8,72 @@ namespace NKikimr {
// out
void FillColumnDescription(Ydb::Table::DescribeTableResult& out,
- NKikimrMiniKQL::TType& splitKeyType, const NKikimrSchemeOp::TTableDescription& in);
+ NKikimrMiniKQL::TType& splitKeyType, const NKikimrSchemeOp::TTableDescription& in);
void FillColumnDescription(Ydb::Table::CreateTableRequest& out,
- NKikimrMiniKQL::TType& splitKeyType, const NKikimrSchemeOp::TTableDescription& in);
+ NKikimrMiniKQL::TType& splitKeyType, const NKikimrSchemeOp::TTableDescription& in);
// in
-bool FillColumnDescription(NKikimrSchemeOp::TTableDescription& out,
+bool FillColumnDescription(NKikimrSchemeOp::TTableDescription& out,
const google::protobuf::RepeatedPtrField<Ydb::Table::ColumnMeta>& in, Ydb::StatusIds::StatusCode& status, TString& error);
bool ExtractColumnTypeId(ui32& outTypeId, const Ydb::Type& inType, Ydb::StatusIds::StatusCode& status, TString& error);
// out
void FillTableBoundary(Ydb::Table::DescribeTableResult& out,
- const NKikimrSchemeOp::TTableDescription& in, const NKikimrMiniKQL::TType& splitKeyType);
+ const NKikimrSchemeOp::TTableDescription& in, const NKikimrMiniKQL::TType& splitKeyType);
void FillTableBoundary(Ydb::Table::CreateTableRequest& out,
- const NKikimrSchemeOp::TTableDescription& in, const NKikimrMiniKQL::TType& splitKeyType);
+ const NKikimrSchemeOp::TTableDescription& in, const NKikimrMiniKQL::TType& splitKeyType);
// out
void FillIndexDescription(Ydb::Table::DescribeTableResult& out,
- const NKikimrSchemeOp::TTableDescription& in);
+ const NKikimrSchemeOp::TTableDescription& in);
void FillIndexDescription(Ydb::Table::CreateTableRequest& out,
- const NKikimrSchemeOp::TTableDescription& in);
+ const NKikimrSchemeOp::TTableDescription& in);
// in
-bool FillIndexDescription(NKikimrSchemeOp::TIndexedTableCreationConfig& out,
+bool FillIndexDescription(NKikimrSchemeOp::TIndexedTableCreationConfig& out,
const Ydb::Table::CreateTableRequest& in, Ydb::StatusIds::StatusCode& status, TString& error);
// out
void FillTableStats(Ydb::Table::DescribeTableResult& out,
- const NKikimrSchemeOp::TPathDescription& in, bool withPartitionStatistic);
+ const NKikimrSchemeOp::TPathDescription& in, bool withPartitionStatistic);
// out
void FillStorageSettings(Ydb::Table::DescribeTableResult& out,
- const NKikimrSchemeOp::TTableDescription& in);
+ const NKikimrSchemeOp::TTableDescription& in);
void FillStorageSettings(Ydb::Table::CreateTableRequest& out,
- const NKikimrSchemeOp::TTableDescription& in);
+ const NKikimrSchemeOp::TTableDescription& in);
// out
void FillColumnFamilies(Ydb::Table::DescribeTableResult& out,
- const NKikimrSchemeOp::TTableDescription& in);
+ const NKikimrSchemeOp::TTableDescription& in);
void FillColumnFamilies(Ydb::Table::CreateTableRequest& out,
- const NKikimrSchemeOp::TTableDescription& in);
+ const NKikimrSchemeOp::TTableDescription& in);
// out
void FillAttributes(Ydb::Table::DescribeTableResult& out,
- const NKikimrSchemeOp::TPathDescription& in);
+ const NKikimrSchemeOp::TPathDescription& in);
void FillAttributes(Ydb::Table::CreateTableRequest& out,
- const NKikimrSchemeOp::TPathDescription& in);
+ const NKikimrSchemeOp::TPathDescription& in);
// out
void FillPartitioningSettings(Ydb::Table::DescribeTableResult& out,
- const NKikimrSchemeOp::TTableDescription& in);
+ const NKikimrSchemeOp::TTableDescription& in);
void FillPartitioningSettings(Ydb::Table::CreateTableRequest& out,
- const NKikimrSchemeOp::TTableDescription& in);
+ const NKikimrSchemeOp::TTableDescription& in);
// in
-bool CopyExplicitPartitions(NKikimrSchemeOp::TTableDescription& out,
+bool CopyExplicitPartitions(NKikimrSchemeOp::TTableDescription& out,
const Ydb::Table::ExplicitPartitions& in, Ydb::StatusIds::StatusCode& status, TString& error);
// out
void FillKeyBloomFilter(Ydb::Table::DescribeTableResult& out,
- const NKikimrSchemeOp::TTableDescription& in);
+ const NKikimrSchemeOp::TTableDescription& in);
void FillKeyBloomFilter(Ydb::Table::CreateTableRequest& out,
- const NKikimrSchemeOp::TTableDescription& in);
+ const NKikimrSchemeOp::TTableDescription& in);
// out
void FillReadReplicasSettings(Ydb::Table::DescribeTableResult& out,
- const NKikimrSchemeOp::TTableDescription& in);
+ const NKikimrSchemeOp::TTableDescription& in);
void FillReadReplicasSettings(Ydb::Table::CreateTableRequest& out,
- const NKikimrSchemeOp::TTableDescription& in);
+ const NKikimrSchemeOp::TTableDescription& in);
// in
bool FillTableDescription(NKikimrSchemeOp::TModifyScheme& out,
diff --git a/ydb/core/ydb_convert/table_settings.cpp b/ydb/core/ydb_convert/table_settings.cpp
index 06123ce1795..3f3547f1f5e 100644
--- a/ydb/core/ydb_convert/table_settings.cpp
+++ b/ydb/core/ydb_convert/table_settings.cpp
@@ -27,7 +27,7 @@ namespace {
}
}
-bool FillCreateTableSettingsDesc(NKikimrSchemeOp::TTableDescription& tableDesc,
+bool FillCreateTableSettingsDesc(NKikimrSchemeOp::TTableDescription& tableDesc,
const Ydb::Table::CreateTableRequest& proto,
Ydb::StatusIds::StatusCode& code, TString& error, TList<TString>& warnings, bool tableProfileSet)
{
@@ -199,7 +199,7 @@ bool FillCreateTableSettingsDesc(NKikimrSchemeOp::TTableDescription& tableDesc,
return true;
}
-bool FillAlterTableSettingsDesc(NKikimrSchemeOp::TTableDescription& tableDesc,
+bool FillAlterTableSettingsDesc(NKikimrSchemeOp::TTableDescription& tableDesc,
const Ydb::Table::AlterTableRequest& proto,
Ydb::StatusIds::StatusCode& code, TString& error, bool changed)
{
diff --git a/ydb/core/ydb_convert/table_settings.h b/ydb/core/ydb_convert/table_settings.h
index f9c758a27b6..cc9b4fc488a 100644
--- a/ydb/core/ydb_convert/table_settings.h
+++ b/ydb/core/ydb_convert/table_settings.h
@@ -10,11 +10,11 @@ namespace NKikimr {
void MEWarning(const TString& settingName, TList<TString>& warnings);
-bool FillCreateTableSettingsDesc(NKikimrSchemeOp::TTableDescription& out,
+bool FillCreateTableSettingsDesc(NKikimrSchemeOp::TTableDescription& out,
const Ydb::Table::CreateTableRequest& in,
Ydb::StatusIds::StatusCode& code, TString& error, TList<TString>& warnings, bool tableProfileSet);
-bool FillAlterTableSettingsDesc(NKikimrSchemeOp::TTableDescription& out,
+bool FillAlterTableSettingsDesc(NKikimrSchemeOp::TTableDescription& out,
const Ydb::Table::AlterTableRequest& in,
Ydb::StatusIds::StatusCode& code, TString& error, bool changed);
@@ -40,7 +40,7 @@ bool FillTtlSettings(TTtlSettingsEnabled& out, const Ydb::Table::TtlSettings& in
#define CASE_UNIT(type) \
case Ydb::Table::ValueSinceUnixEpochModeSettings::type: \
- out.SetColumnUnit(NKikimrSchemeOp::TTTLSettings::type); \
+ out.SetColumnUnit(NKikimrSchemeOp::TTTLSettings::type); \
break
switch (in.value_since_unix_epoch().column_unit()) {
@@ -60,7 +60,7 @@ bool FillTtlSettings(TTtlSettingsEnabled& out, const Ydb::Table::TtlSettings& in
return unsupported("Unsupported ttl settings");
}
- if constexpr (std::is_same_v<TTtlSettingsEnabled, NKikimrSchemeOp::TTTLSettings>) {
+ if constexpr (std::is_same_v<TTtlSettingsEnabled, NKikimrSchemeOp::TTTLSettings>) {
if (in.run_interval_seconds()) {
out.MutableSysSettings()->SetRunInterval(TDuration::Seconds(in.run_interval_seconds()).GetValue());
}
diff --git a/ydb/core/ydb_convert/ydb_convert.cpp b/ydb/core/ydb_convert/ydb_convert.cpp
index f2877b03ded..11c804cff50 100644
--- a/ydb/core/ydb_convert/ydb_convert.cpp
+++ b/ydb/core/ydb_convert/ydb_convert.cpp
@@ -703,11 +703,11 @@ void ConvertAclToYdb(const TString& owner, const TString& acl, bool isContainer,
}
using namespace NACLib;
-
-const THashMap<TString, TACLAttrs> AccessMap_ = {
- { "ydb.database.connect", TACLAttrs(EAccessRights::ConnectDatabase, EInheritanceType::InheritNone) },
- { "ydb.tables.modify", TACLAttrs(EAccessRights(UpdateRow | EraseRow)) },
- { "ydb.tables.read", TACLAttrs(EAccessRights::SelectRow | EAccessRights::ReadAttributes) },
+
+const THashMap<TString, TACLAttrs> AccessMap_ = {
+ { "ydb.database.connect", TACLAttrs(EAccessRights::ConnectDatabase, EInheritanceType::InheritNone) },
+ { "ydb.tables.modify", TACLAttrs(EAccessRights(UpdateRow | EraseRow)) },
+ { "ydb.tables.read", TACLAttrs(EAccessRights::SelectRow | EAccessRights::ReadAttributes) },
{ "ydb.generic.read", EAccessRights::GenericRead },
{ "ydb.generic.write", EAccessRights::GenericWrite },
{ "ydb.generic.use", EAccessRights::GenericUse },
@@ -742,7 +742,7 @@ static ui32 BitCount(ui32 in) {
static TVector<std::pair<ui32, TString>> CalcMaskByPower() {
TVector<std::pair<ui32, TString>> result;
for (const auto& it : AccessMap_) {
- result.push_back({it.second.AccessMask, it.first});
+ result.push_back({it.second.AccessMask, it.first});
}
//Sort this vector by number of set bits in mask
@@ -754,7 +754,7 @@ static TVector<std::pair<ui32, TString>> CalcMaskByPower() {
return result;
}
-TACLAttrs ConvertYdbPermissionNameToACLAttrs(const TString& name) {
+TACLAttrs ConvertYdbPermissionNameToACLAttrs(const TString& name) {
auto it = AccessMap_.find(name);
if (it == AccessMap_.end()) {
throw NYql::TErrorException(NKikimrIssues::TIssuesIds::DEFAULT_ERROR)
@@ -779,37 +779,37 @@ TVector<TString> ConvertACLMaskToYdbPermissionNames(ui32 mask) {
return result;
}
-void ConvertDirectoryEntry(const NKikimrSchemeOp::TDirEntry& from, Ydb::Scheme::Entry* to, bool processAcl) {
+void ConvertDirectoryEntry(const NKikimrSchemeOp::TDirEntry& from, Ydb::Scheme::Entry* to, bool processAcl) {
to->set_name(from.GetName());
to->set_owner(from.GetOwner());
- switch (from.GetPathType()) {
- case NKikimrSchemeOp::EPathTypeExtSubDomain:
- to->set_type(static_cast<Ydb::Scheme::Entry::Type>(NKikimrSchemeOp::EPathTypeSubDomain));
- break;
- default:
- to->set_type(static_cast<Ydb::Scheme::Entry::Type>(from.GetPathType()));
- }
-
+ switch (from.GetPathType()) {
+ case NKikimrSchemeOp::EPathTypeExtSubDomain:
+ to->set_type(static_cast<Ydb::Scheme::Entry::Type>(NKikimrSchemeOp::EPathTypeSubDomain));
+ break;
+ default:
+ to->set_type(static_cast<Ydb::Scheme::Entry::Type>(from.GetPathType()));
+ }
+
if (processAcl) {
- const bool isDir = from.GetPathType() == NKikimrSchemeOp::EPathTypeDir;
+ const bool isDir = from.GetPathType() == NKikimrSchemeOp::EPathTypeDir;
ConvertAclToYdb(from.GetOwner(), from.GetEffectiveACL(), isDir, to->mutable_effective_permissions());
ConvertAclToYdb(from.GetOwner(), from.GetACL(), isDir, to->mutable_permissions());
}
}
-void ConvertDirectoryEntry(const NKikimrSchemeOp::TPathDescription& from, Ydb::Scheme::Entry* to, bool processAcl) {
+void ConvertDirectoryEntry(const NKikimrSchemeOp::TPathDescription& from, Ydb::Scheme::Entry* to, bool processAcl) {
ConvertDirectoryEntry(from.GetSelf(), to, processAcl);
switch (from.GetSelf().GetPathType()) {
- case NKikimrSchemeOp::EPathTypeTable:
+ case NKikimrSchemeOp::EPathTypeTable:
to->set_size_bytes(from.GetTableStats().GetDataSize() + from.GetTableStats().GetIndexSize());
for (const auto& index : from.GetTable().GetTableIndexes()) {
to->set_size_bytes(to->size_bytes() + index.GetDataSize());
}
break;
- case NKikimrSchemeOp::EPathTypeSubDomain:
- case NKikimrSchemeOp::EPathTypeExtSubDomain:
+ case NKikimrSchemeOp::EPathTypeSubDomain:
+ case NKikimrSchemeOp::EPathTypeExtSubDomain:
to->set_size_bytes(from.GetDomainDescription().GetDiskSpaceUsage().GetTables().GetTotalSize());
break;
default:
@@ -853,14 +853,14 @@ void ConvertYdbResultToKqpResult(const Ydb::ResultSet& input, NKikimrMiniKQL::TR
truncatedValue.SetBool(input.truncated());
}
-TACLAttrs::TACLAttrs(ui32 access, ui32 inheritance)
- : AccessMask(access)
- , InheritanceType(inheritance)
-{}
-
-TACLAttrs::TACLAttrs(ui32 access)
- : AccessMask(access)
- , InheritanceType(EInheritanceType::InheritObject | EInheritanceType::InheritContainer)
-{}
-
+TACLAttrs::TACLAttrs(ui32 access, ui32 inheritance)
+ : AccessMask(access)
+ , InheritanceType(inheritance)
+{}
+
+TACLAttrs::TACLAttrs(ui32 access)
+ : AccessMask(access)
+ , InheritanceType(EInheritanceType::InheritObject | EInheritanceType::InheritContainer)
+{}
+
} // namespace NKikimr
diff --git a/ydb/core/ydb_convert/ydb_convert.h b/ydb/core/ydb_convert/ydb_convert.h
index 7ebb2bca654..2cf74135af7 100644
--- a/ydb/core/ydb_convert/ydb_convert.h
+++ b/ydb/core/ydb_convert/ydb_convert.h
@@ -24,20 +24,20 @@ void ConvertYdbParamsToMiniKQLParams(const ::google::protobuf::Map<TString, Ydb:
void ConvertAclToYdb(const TString& owner, const TString& acl, bool isContainer,
google::protobuf::RepeatedPtrField<Ydb::Scheme::Permissions> *permissions);
-
-struct TACLAttrs {
- ui32 AccessMask;
- ui32 InheritanceType;
-
- TACLAttrs(ui32 access, ui32 inheritance);
- TACLAttrs(ui32 access);
-};
-
-TACLAttrs ConvertYdbPermissionNameToACLAttrs(const TString& name);
-
+
+struct TACLAttrs {
+ ui32 AccessMask;
+ ui32 InheritanceType;
+
+ TACLAttrs(ui32 access, ui32 inheritance);
+ TACLAttrs(ui32 access);
+};
+
+TACLAttrs ConvertYdbPermissionNameToACLAttrs(const TString& name);
+
TVector<TString> ConvertACLMaskToYdbPermissionNames(ui32);
-void ConvertDirectoryEntry(const NKikimrSchemeOp::TDirEntry& from, Ydb::Scheme::Entry* to, bool processAcl);
-void ConvertDirectoryEntry(const NKikimrSchemeOp::TPathDescription& from, Ydb::Scheme::Entry* to, bool processAcl);
+void ConvertDirectoryEntry(const NKikimrSchemeOp::TDirEntry& from, Ydb::Scheme::Entry* to, bool processAcl);
+void ConvertDirectoryEntry(const NKikimrSchemeOp::TPathDescription& from, Ydb::Scheme::Entry* to, bool processAcl);
} // namespace NKikimr
diff --git a/ydb/core/ymq/actor/executor.cpp b/ydb/core/ymq/actor/executor.cpp
index 493c20e8082..e17dc68fe95 100644
--- a/ydb/core/ymq/actor/executor.cpp
+++ b/ydb/core/ymq/actor/executor.cpp
@@ -279,7 +279,7 @@ bool TMiniKqlExecutionActor::ShouldRetryOnFail(const TKikimrResultRecord& record
const auto status = NKikimr::NTxProxy::TResultStatus::EStatus(record.GetStatus());
return NTxProxy::TResultStatus::IsSoftErrorWithoutSideEffects(status) ||
RetryOnTimeout_ && record.GetStatusCode() == NKikimrIssues::TStatusIds::TIMEOUT ||
- (record.HasSchemeShardStatus() && record.GetSchemeShardStatus() == NKikimrScheme::EStatus::StatusMultipleModifications); // very rare case in queue creation
+ (record.HasSchemeShardStatus() && record.GetSchemeShardStatus() == NKikimrScheme::EStatus::StatusMultipleModifications); // very rare case in queue creation
}
void TMiniKqlExecutionActor::HandleResponse(TResponse::TPtr& ev) {
@@ -446,14 +446,14 @@ void TMiniKqlExecutionActor::WaitForCompletion(bool retry) {
clientConfig.RetryPolicy = {.RetryLimitCount = 5, .MinRetryTime = TDuration::MilliSeconds(100), .DoFirstRetryInstantly = !retry};
TabletPipeClient_ = RegisterWithSameMailbox(NTabletPipe::CreateClient(SelfId(), schemeShardId, clientConfig));
- TAutoPtr<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion> request(new NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion());
+ TAutoPtr<NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion> request(new NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletion());
request->Record.SetTxId(ResponseEvent_->Get()->Record.GetTxId());
NTabletPipe::SendData(SelfId(), TabletPipeClient_, request.Release());
RLOG_SQS_DEBUG(GetRequestType() << " Queue " << TLogQueueName(QueuePath_) << " Waiting for transaction to complete. TxId: " << ResponseEvent_->Get()->Record.GetTxId() << ". Scheme shard id: " << schemeShardId);
}
-void TMiniKqlExecutionActor::HandleResult(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev) {
+void TMiniKqlExecutionActor::HandleResult(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev) {
Y_VERIFY(ev->Get()->Record.GetTxId() == ResponseEvent_->Get()->Record.GetTxId());
ResponseEvent_->Get()->Record.SetStatus(TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecComplete);
RLOG_SQS_TRACE(GetRequestType() << " Queue " << TLogQueueName(QueuePath_) << " Sending mkql execution result: " << ResponseEvent_->Get()->Record);
diff --git a/ydb/core/ymq/actor/executor.h b/ydb/core/ymq/actor/executor.h
index 041e4fc9cc2..5dd51c6da23 100644
--- a/ydb/core/ymq/actor/executor.h
+++ b/ydb/core/ymq/actor/executor.h
@@ -187,7 +187,7 @@ private:
switch (ev->GetTypeRewrite()) {
hFunc(TEvTxUserProxy::TEvProposeTransactionStatus, HandleResponse);
hFunc(TMiniKQLCompileServiceEvents::TEvCompileStatus, HandleCompile);
- hFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult, HandleResult);
+ hFunc(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult, HandleResult);
hFunc(TEvTabletPipe::TEvClientDestroyed, HandlePipeClientDisconnected);
hFunc(TEvTabletPipe::TEvClientConnected, HandlePipeClientConnected);
hFunc(TEvWakeup, HandleWakeup);
@@ -203,7 +203,7 @@ private:
void HandleResponse(TResponse::TPtr& ev);
void HandleWakeup(TEvWakeup::TPtr& ev);
- void HandleResult(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev);
+ void HandleResult(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev);
void HandlePipeClientConnected(TEvTabletPipe::TEvClientConnected::TPtr& ev);
void HandlePipeClientDisconnected(TEvTabletPipe::TEvClientDestroyed::TPtr& ev);
diff --git a/ydb/core/ymq/actor/garbage_collector.cpp b/ydb/core/ymq/actor/garbage_collector.cpp
index a198a75172b..e82284c020a 100644
--- a/ydb/core/ymq/actor/garbage_collector.cpp
+++ b/ydb/core/ymq/actor/garbage_collector.cpp
@@ -498,9 +498,9 @@ private:
trans->MutableDrop()->SetName(name);
if (CurrentNode.Kind == TSchemeCacheNavigate::EKind::KindPath) {
- trans->SetOperationType(NKikimrSchemeOp::ESchemeOpRmDir);
+ trans->SetOperationType(NKikimrSchemeOp::ESchemeOpRmDir);
} else if (CurrentNode.Kind == TSchemeCacheNavigate::EKind::KindTable) {
- trans->SetOperationType(NKikimrSchemeOp::ESchemeOpDropTable);
+ trans->SetOperationType(NKikimrSchemeOp::ESchemeOpDropTable);
} else {
Y_VERIFY("Unexpected node kind");
}
diff --git a/ydb/core/ymq/actor/list_permissions.cpp b/ydb/core/ymq/actor/list_permissions.cpp
index b5b107fa0e6..93a15e1dbf2 100644
--- a/ydb/core/ymq/actor/list_permissions.cpp
+++ b/ydb/core/ymq/actor/list_permissions.cpp
@@ -61,7 +61,7 @@ private:
void RequestSchemeShard(const TString& path) {
std::unique_ptr<TEvTxUserProxy::TEvNavigate> navigateRequest(new TEvTxUserProxy::TEvNavigate());
- NKikimrSchemeOp::TDescribePath* record = navigateRequest->Record.MutableDescribePath();
+ NKikimrSchemeOp::TDescribePath* record = navigateRequest->Record.MutableDescribePath();
record->SetPath(path);
Send(MakeTxProxyID(), navigateRequest.release());
@@ -75,7 +75,7 @@ private:
STATEFN(WaitSchemeShardResponse) {
switch (ev->GetTypeRewrite()) {
hFunc(TEvWakeup, HandleWakeup);
- hFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, HandleSchemeShardResponse);
+ hFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, HandleSchemeShardResponse);
}
}
@@ -114,13 +114,13 @@ private:
}
}
- void HandleSchemeShardResponse(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
+ void HandleSchemeShardResponse(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
const auto& record = ev->Get()->GetRecord();
const auto status = record.GetStatus();
switch (status) {
- case NKikimrScheme::StatusSuccess: {
+ case NKikimrScheme::StatusSuccess: {
const auto& pathDescription = record.GetPathDescription();
- const NKikimrSchemeOp::TDirEntry& entry = pathDescription.GetSelf();
+ const NKikimrSchemeOp::TDirEntry& entry = pathDescription.GetSelf();
TSecurityObject secObjWithACL(entry.GetOwner(), entry.GetACL(), false);
TSecurityObject secObjWithEffectiveACL(entry.GetOwner(), entry.GetEffectiveACL(), false);
@@ -139,7 +139,7 @@ private:
break;
}
- case NKikimrScheme::StatusPathDoesNotExist: {
+ case NKikimrScheme::StatusPathDoesNotExist: {
MakeError(MutableErrorDesc(), NErrors::INVALID_PARAMETER_VALUE, Sprintf("Path does not exist: %s.", SanitizeNodePath(Path_).c_str()));
break;
}
diff --git a/ydb/core/ymq/actor/list_users.cpp b/ydb/core/ymq/actor/list_users.cpp
index d56198b08d1..d653fc20a38 100644
--- a/ydb/core/ymq/actor/list_users.cpp
+++ b/ydb/core/ymq/actor/list_users.cpp
@@ -40,16 +40,16 @@ private:
void DoAction() override {
Become(&TThis::StateFunc);
- auto proxy = MakeTxProxyID();
+ auto proxy = MakeTxProxyID();
- auto ev = MakeHolder<TEvTxUserProxy::TEvNavigate>();
+ auto ev = MakeHolder<TEvTxUserProxy::TEvNavigate>();
ev->Record.MutableDescribePath()->SetPath(Cfg().GetRoot());
RLOG_SQS_TRACE("TListUsersActor generate request."
<< ". Proxy actor: " << proxy
<< ". TEvNavigate: " << ev->Record.ShortDebugString());
- Send(proxy, ev.Release());
+ Send(proxy, ev.Release());
}
TString DoGetQueueName() const override {
@@ -60,25 +60,25 @@ private:
STATEFN(StateFunc) {
switch (ev->GetTypeRewrite()) {
hFunc(TEvWakeup, HandleWakeup);
- hFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, HandleDescribeSchemeResult);
+ hFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, HandleDescribeSchemeResult);
}
}
- void HandleDescribeSchemeResult(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
+ void HandleDescribeSchemeResult(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
const auto& record = ev->Get()->GetRecord();
const auto& desc = record.GetPathDescription();
-
- if (record.GetStatus() != NKikimrScheme::StatusSuccess) {
+
+ if (record.GetStatus() != NKikimrScheme::StatusSuccess) {
RLOG_SQS_CRIT("No error handler at TListUsersActor in HandleDescribeSchemeResult"
- << ", got msg: " << record.ShortDebugString());
- // status, reason might be useful.
- // The request doesn't have to be seccessfull all the time. StatusNotAvailable for example could occur
- }
-
+ << ", got msg: " << record.ShortDebugString());
+ // status, reason might be useful.
+ // The request doesn't have to be seccessfull all the time. StatusNotAvailable for example could occur
+ }
+
const TString prefix = Request().GetUserNamePrefix();
for (const auto& child : desc.children()) {
- if (child.GetPathType() == NKikimrSchemeOp::EPathTypeDir) {
+ if (child.GetPathType() == NKikimrSchemeOp::EPathTypeDir) {
if (prefix.empty() || AsciiHasPrefix(child.GetName(), prefix)) {
Response_.MutableListUsers()->AddUserNames(child.GetName());
}
diff --git a/ydb/core/ymq/actor/migration.cpp b/ydb/core/ymq/actor/migration.cpp
index 660f4c53eee..e547e975581 100644
--- a/ydb/core/ymq/actor/migration.cpp
+++ b/ydb/core/ymq/actor/migration.cpp
@@ -142,7 +142,7 @@ THolder<TEvTxUserProxy::TEvProposeTransaction> TAddColumnActor::MakeAlterTableEv
auto ev = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
// Transaction info
auto* trans = ev->Record.MutableTransaction()->MutableModifyScheme();
- trans->SetOperationType(NKikimrSchemeOp::ESchemeOpAlterTable);
+ trans->SetOperationType(NKikimrSchemeOp::ESchemeOpAlterTable);
auto* info = trans->MutableAlterTable();
{
diff --git a/ydb/core/ymq/actor/modify_permissions.cpp b/ydb/core/ymq/actor/modify_permissions.cpp
index a8605402e5a..8b9e1cb2d7d 100644
--- a/ydb/core/ymq/actor/modify_permissions.cpp
+++ b/ydb/core/ymq/actor/modify_permissions.cpp
@@ -105,8 +105,8 @@ private:
auto proposeRequest = MakeHolder<TEvTxUserProxy::TEvProposeTransaction>();
NKikimrTxUserProxy::TEvProposeTransaction& record = proposeRequest->Record;
- NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
- modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL);
+ NKikimrSchemeOp::TModifyScheme* modifyScheme = record.MutableTransaction()->MutableModifyScheme();
+ modifyScheme->SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpModifyACL);
modifyScheme->SetWorkingDir(TString(workingDir));
modifyScheme->MutableModifyACL()->SetName(TString(resource));
diff --git a/ydb/core/ymq/actor/queue_schema.cpp b/ydb/core/ymq/actor/queue_schema.cpp
index 12f6fc00cb9..91d3c5d3df4 100644
--- a/ydb/core/ymq/actor/queue_schema.cpp
+++ b/ydb/core/ymq/actor/queue_schema.cpp
@@ -450,7 +450,7 @@ void TCreateQueueSchemaActorV2::RegisterMakeDirActor(const TString& workingDir,
auto* trans = ev->Record.MutableTransaction()->MutableModifyScheme();
trans->SetWorkingDir(workingDir);
- trans->SetOperationType(NKikimrSchemeOp::ESchemeOpMkDir);
+ trans->SetOperationType(NKikimrSchemeOp::ESchemeOpMkDir);
trans->MutableMkDir()->SetName(dirName);
Register(new TMiniKqlExecutionActor(SelfId(), RequestId_, std::move(ev), false, QueuePath_, GetTransactionCounters(UserCounters_)));
@@ -518,7 +518,7 @@ void TCreateQueueSchemaActorV2::CreateComponents() {
STATEFN(TCreateQueueSchemaActorV2::CreateComponentsState) {
switch (ev->GetTypeRewrite()) {
hFunc(TSqsEvents::TEvExecuted, OnExecuted);
- hFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, OnDescribeSchemeResult);
+ hFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, OnDescribeSchemeResult);
hFunc(TEvTxProxySchemeCache::TEvNavigateKeySetResult, HandleTableDescription);
hFunc(NKesus::TEvKesus::TEvAddQuoterResourceResult, HandleAddQuoterResource);
cFunc(TEvPoisonPill::EventType, PassAway);
@@ -642,11 +642,11 @@ void TCreateQueueSchemaActorV2::OnExecuted(TSqsEvents::TEvExecuted::TPtr& ev) {
}
}
-void TCreateQueueSchemaActorV2::OnDescribeSchemeResult(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
+void TCreateQueueSchemaActorV2::OnDescribeSchemeResult(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
RLOG_SQS_TRACE("OnDescribeSchemeResult for leader tablet: " << ev->Get()->GetRecord());
const auto& pathDescription = ev->Get()->GetRecord().GetPathDescription();
- if (ev->Get()->GetRecord().GetStatus() != NKikimrScheme::StatusSuccess || pathDescription.TablePartitionsSize() == 0 || !pathDescription.GetTablePartitions(0).GetDatashardId()) {
+ if (ev->Get()->GetRecord().GetStatus() != NKikimrScheme::StatusSuccess || pathDescription.TablePartitionsSize() == 0 || !pathDescription.GetTablePartitions(0).GetDatashardId()) {
// fail
auto resp = MakeErrorResponse(NErrors::INTERNAL_FAILURE);
resp->State = EQueueState::Creating;
diff --git a/ydb/core/ymq/actor/queue_schema.h b/ydb/core/ymq/actor/queue_schema.h
index 575b573b4ea..793ba1c06ad 100644
--- a/ydb/core/ymq/actor/queue_schema.h
+++ b/ydb/core/ymq/actor/queue_schema.h
@@ -60,7 +60,7 @@ public:
void OnExecuted(TSqsEvents::TEvExecuted::TPtr& ev);
- void OnDescribeSchemeResult(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev);
+ void OnDescribeSchemeResult(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev);
void SendDescribeTable();
void HandleTableDescription(TEvTxProxySchemeCache::TEvNavigateKeySetResult::TPtr& ev);
diff --git a/ydb/core/ymq/actor/schema.cpp b/ydb/core/ymq/actor/schema.cpp
index 34c5e40b8d3..20e84581fe5 100644
--- a/ydb/core/ymq/actor/schema.cpp
+++ b/ydb/core/ymq/actor/schema.cpp
@@ -57,7 +57,7 @@ static bool SuccessStatusCode(ui32 code) {
}
}
-static void SetCompactionPolicyForSmallTable(NKikimrSchemeOp::TPartitionConfig& partitionConfig) {
+static void SetCompactionPolicyForSmallTable(NKikimrSchemeOp::TPartitionConfig& partitionConfig) {
auto& policyPb = *partitionConfig.MutableCompactionPolicy();
policyPb.SetInMemSizeToSnapshot(100000);
policyPb.SetInMemStepsToSnapshot(300);
@@ -69,7 +69,7 @@ static void SetCompactionPolicyForSmallTable(NKikimrSchemeOp::TPartitionConfig&
policyPb.SetMinDataPageSize(7168);
}
-static void SetCompactionPolicyForTimestampOrdering(NKikimrSchemeOp::TPartitionConfig& partitionConfig) {
+static void SetCompactionPolicyForTimestampOrdering(NKikimrSchemeOp::TPartitionConfig& partitionConfig) {
const bool enableCompression = false;
auto& policyPb = *partitionConfig.MutableCompactionPolicy();
@@ -103,9 +103,9 @@ static void SetCompactionPolicyForTimestampOrdering(NKikimrSchemeOp::TPartitionC
g2.SetKeepInCache(false);
}
-static void SetOnePartitionPerShardSettings(NKikimrSchemeOp::TTableDescription& desc, size_t queueShardsCount) {
+static void SetOnePartitionPerShardSettings(NKikimrSchemeOp::TTableDescription& desc, size_t queueShardsCount) {
for (size_t boundary = 1; boundary < queueShardsCount; ++boundary) {
- NKikimrSchemeOp::TSplitBoundary* splitBoundarySetting = desc.AddSplitBoundary();
+ NKikimrSchemeOp::TSplitBoundary* splitBoundarySetting = desc.AddSplitBoundary();
splitBoundarySetting->MutableKeyPrefix()->AddTuple()->MutableOptional()->SetUint64(boundary);
}
}
@@ -138,7 +138,7 @@ THolder<TEvTxUserProxy::TEvProposeTransaction>
} else {
trans->SetWorkingDir(root);
}
- trans->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateTable);
+ trans->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateTable);
// Table info
auto* desc = trans->MutableCreateTable();
desc->SetName(table.Name);
@@ -159,7 +159,7 @@ THolder<TEvTxUserProxy::TEvProposeTransaction>
if (table.InMemory) {
auto* def = desc->MutablePartitionConfig()->AddColumnFamilies();
def->SetId(0);
- def->SetColumnCache(NKikimrSchemeOp::ColumnCacheEver);
+ def->SetColumnCache(NKikimrSchemeOp::ColumnCacheEver);
}
if (table.Sequential) {
@@ -194,7 +194,7 @@ THolder<TEvTxUserProxy::TEvProposeTransaction>
} else {
trans->SetWorkingDir(root + "/" + ToString(table.Shard));
}
- trans->SetOperationType(NKikimrSchemeOp::ESchemeOpDropTable);
+ trans->SetOperationType(NKikimrSchemeOp::ESchemeOpDropTable);
trans->MutableDrop()->SetName(table.Name);
return ev;
@@ -207,7 +207,7 @@ THolder<TEvTxUserProxy::TEvProposeTransaction>
// Transaction info
auto* trans = ev->Record.MutableTransaction()->MutableModifyScheme();
trans->SetWorkingDir(root);
- trans->SetOperationType(NKikimrSchemeOp::ESchemeOpRmDir);
+ trans->SetOperationType(NKikimrSchemeOp::ESchemeOpRmDir);
trans->MutableDrop()->SetName(name);
return ev;
@@ -222,7 +222,7 @@ THolder<TEvTxUserProxy::TEvProposeTransaction>
// Transaction info
auto* trans = ev->Record.MutableTransaction()->MutableModifyScheme();
trans->SetWorkingDir(root);
- trans->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateKesus);
+ trans->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateKesus);
// Kesus info
auto* kesusDesc = trans->MutableKesus();
@@ -240,7 +240,7 @@ THolder<TEvTxUserProxy::TEvProposeTransaction>
// Transaction info
auto* trans = ev->Record.MutableTransaction()->MutableModifyScheme();
trans->SetWorkingDir(root);
- trans->SetOperationType(NKikimrSchemeOp::ESchemeOpDropKesus);
+ trans->SetOperationType(NKikimrSchemeOp::ESchemeOpDropKesus);
auto* drop = trans->MutableDrop();
drop->SetName(kesusName);
@@ -285,7 +285,7 @@ THolder<TEvTxUserProxy::TEvProposeTransaction> TCreateUserSchemaActor::MakeMkDir
auto* trans = ev->Record.MutableTransaction()->MutableModifyScheme();
trans->SetWorkingDir(root);
- trans->SetOperationType(NKikimrSchemeOp::ESchemeOpMkDir);
+ trans->SetOperationType(NKikimrSchemeOp::ESchemeOpMkDir);
trans->MutableMkDir()->SetName(dirName);
RLOG_SQS_INFO("Making directory [" << dirName << "] as subdir of [" << root << "]");
return ev;
@@ -342,7 +342,7 @@ void TCreateUserSchemaActor::HandleExecuted(TSqsEvents::TEvExecuted::TPtr& ev) {
} else {
// Try to create /Root/SQS directory only if error occurs, because this is very rare operation.
if (ECreating(SI_) == ECreating::MakeDirectory
- && record.GetSchemeShardStatus() == NKikimrScheme::EStatus::StatusPathDoesNotExist
+ && record.GetSchemeShardStatus() == NKikimrScheme::EStatus::StatusPathDoesNotExist
&& !CreateRootSqsDirAttemptWasMade_)
{
RLOG_SQS_INFO("Root SQS directory does not exist, making it. Error record: " << record);
@@ -544,10 +544,10 @@ private:
this->Send(MakeTxProxyID(), std::move(request));
}
- void HandleDescribeSchemeResult(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
+ void HandleDescribeSchemeResult(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
RLOG_SQS_TRACE("HandleDescribeSchemeResult for quoter: " << ev->Get()->GetRecord());
const auto& pathDescription = ev->Get()->GetRecord().GetPathDescription();
- if (ev->Get()->GetRecord().GetStatus() != NKikimrScheme::StatusSuccess || !pathDescription.GetKesus().GetKesusTabletId()) {
+ if (ev->Get()->GetRecord().GetStatus() != NKikimrScheme::StatusSuccess || !pathDescription.GetKesus().GetKesusTabletId()) {
RLOG_SQS_ERROR("Describe scheme failed: " << ev->Get()->GetRecord());
SendErrorAndDie("Describe scheme failed.");
return;
@@ -606,7 +606,7 @@ private:
STATEFN(StateFunc) {
switch (ev->GetTypeRewrite()) {
- hFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, HandleDescribeSchemeResult);
+ hFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, HandleDescribeSchemeResult);
hFunc(TEvCmdResult, HandleCmdResult);
hFunc(TEvTabletPipe::TEvClientDestroyed, HandlePipeClientDisconnected);
hFunc(TEvTabletPipe::TEvClientConnected, HandlePipeClientConnected);
diff --git a/ydb/core/ymq/actor/service.cpp b/ydb/core/ymq/actor/service.cpp
index ed2306d2f92..34c9a4ae46b 100644
--- a/ydb/core/ymq/actor/service.cpp
+++ b/ydb/core/ymq/actor/service.cpp
@@ -350,7 +350,7 @@ STATEFN(TSqsService::StateFunc) {
// Details
hFunc(TEvWakeup, HandleWakeup);
- hFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, HandleDescribeSchemeResult);
+ hFunc(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult, HandleDescribeSchemeResult);
hFunc(TSqsEvents::TEvExecuted, HandleExecuted);
hFunc(TEvTabletPipe::TEvClientDestroyed, HandlePipeClientDisconnected);
hFunc(TEvTabletPipe::TEvClientConnected, HandlePipeClientConnected);
@@ -387,7 +387,7 @@ void TSqsService::RequestSqsUsersList() {
RequestingUsersList_ = true;
LOG_SQS_INFO("Request SQS users list");
THolder<TEvTxUserProxy::TEvNavigate> navigateRequest(new TEvTxUserProxy::TEvNavigate());
- NKikimrSchemeOp::TDescribePath* record = navigateRequest->Record.MutableDescribePath();
+ NKikimrSchemeOp::TDescribePath* record = navigateRequest->Record.MutableDescribePath();
record->SetPath(Cfg().GetRoot());
Send(MakeTxProxyID(), navigateRequest.Release());
}
@@ -599,14 +599,14 @@ void TSqsService::ProcessConfigurationRequestForQueue(TSqsEvents::TEvGetConfigur
}
}
-void TSqsService::HandleDescribeSchemeResult(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
+void TSqsService::HandleDescribeSchemeResult(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev) {
RequestingUsersList_ = false;
LastRequestUsersListTime_ = TActivationContext::Now();
const auto& record = ev->Get()->GetRecord();
const auto& desc = record.GetPathDescription();
LOG_SQS_DEBUG("Got info for main folder (user list): " << record);
- if (record.GetStatus() != NKikimrScheme::StatusSuccess) {
+ if (record.GetStatus() != NKikimrScheme::StatusSuccess) {
LOG_SQS_WARN("Failed to get user list: " << record);
AnswerErrorToRequests();
@@ -621,7 +621,7 @@ void TSqsService::HandleDescribeSchemeResult(NSchemeShard::TEvSchemeShard::TEvDe
}
for (const auto& child : desc.children()) {
- if (child.GetPathType() == NKikimrSchemeOp::EPathTypeDir) {
+ if (child.GetPathType() == NKikimrSchemeOp::EPathTypeDir) {
bool moved = false;
TUserInfoPtr user = MutableUser(child.GetName(), true, &moved);
usersNotProcessed.erase(child.GetName());
diff --git a/ydb/core/ymq/actor/service.h b/ydb/core/ymq/actor/service.h
index 6249e064dd6..caf091c24b8 100644
--- a/ydb/core/ymq/actor/service.h
+++ b/ydb/core/ymq/actor/service.h
@@ -45,7 +45,7 @@ private:
void InitSchemeCache();
void HandleWakeup(TEvWakeup::TPtr& ev);
- void HandleDescribeSchemeResult(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev);
+ void HandleDescribeSchemeResult(NSchemeShard::TEvSchemeShard::TEvDescribeSchemeResult::TPtr& ev);
void HandleExecuted(TSqsEvents::TEvExecuted::TPtr& ev);
void HandlePipeClientConnected(TEvTabletPipe::TEvClientConnected::TPtr& ev);
void HandlePipeClientDisconnected(TEvTabletPipe::TEvClientDestroyed::TPtr& ev);
diff --git a/ydb/core/ymq/actor/yc_search_ut/index_events_processor_ut.cpp b/ydb/core/ymq/actor/yc_search_ut/index_events_processor_ut.cpp
index ad4ba813f78..e484f117be1 100644
--- a/ydb/core/ymq/actor/yc_search_ut/index_events_processor_ut.cpp
+++ b/ydb/core/ymq/actor/yc_search_ut/index_events_processor_ut.cpp
@@ -236,7 +236,7 @@ private:
};
void SetUp() override {
TClient client(Server->GetSettings());
- client.InitRootScheme();
+ client.InitRootScheme();
client.MkDir("/Root", "SQS");
}
diff --git a/ydb/core/yql_testlib/yql_testlib.cpp b/ydb/core/yql_testlib/yql_testlib.cpp
index 86534557b67..35838c40f6a 100644
--- a/ydb/core/yql_testlib/yql_testlib.cpp
+++ b/ydb/core/yql_testlib/yql_testlib.cpp
@@ -151,7 +151,7 @@ namespace NKikimr {
namespace Tests {
-void TYqlServer::Initialize() {
+void TYqlServer::Initialize() {
ResumeYqlExecutionPromise = NThreading::NewPromise<void>();
Runtime.Reset(new TTestActorRuntime(StaticNodes() + DynamicNodes(), true));
@@ -164,7 +164,7 @@ void TYqlServer::Initialize() {
SetupDomains(app);
SetupChannelProfiles(app);
- app.AddHive(Settings->Domain, ChangeStateStorage(Hive, Settings->Domain));
+ app.AddHive(Settings->Domain, ChangeStateStorage(Hive, Settings->Domain));
app.SetFnRegistry([this](const NKikimr::NScheme::TTypeRegistry& typeRegistry) -> NKikimr::NMiniKQL::IFunctionRegistry* {
Y_UNUSED(typeRegistry);
// register test UDFs
@@ -181,8 +181,8 @@ void TYqlServer::Initialize() {
CreateBootstrapTablets();
SetupStorage();
- for (ui32 nodeIdx = 0; nodeIdx < GetSettings().NodeCount; ++nodeIdx) {
- SetupDomainLocalService(nodeIdx);
+ for (ui32 nodeIdx = 0; nodeIdx < GetSettings().NodeCount; ++nodeIdx) {
+ SetupDomainLocalService(nodeIdx);
SetupProxies(nodeIdx);
}
SetupLogging();
@@ -205,7 +205,7 @@ void MakeGatewaysConfig(const THashMap<TString, TString>& clusterMapping, NYql::
}
}
-void TYqlServer::ResumeYqlExecutionActor() {
+void TYqlServer::ResumeYqlExecutionActor() {
ResumeYqlExecutionPromise.SetValue();
}
diff --git a/ydb/core/yql_testlib/yql_testlib.h b/ydb/core/yql_testlib/yql_testlib.h
index 6f79adced72..39176df699b 100644
--- a/ydb/core/yql_testlib/yql_testlib.h
+++ b/ydb/core/yql_testlib/yql_testlib.h
@@ -12,8 +12,8 @@ namespace NKikimr {
namespace Tests {
-class TYqlServer : public TServer {
-public:
+class TYqlServer : public TServer {
+public:
TYqlServer(const TServerSettings& settings)
: TServer(settings, false)
{
@@ -26,11 +26,11 @@ public:
Initialize();
}
- TYqlServer& operator=(TYqlServer&& server) = default;
+ TYqlServer& operator=(TYqlServer&& server) = default;
void ResumeYqlExecutionActor();
-protected:
+protected:
void Initialize();
TAutoPtr<IThreadPool> YqlQueue;
diff --git a/ydb/library/aclib/aclib.cpp b/ydb/library/aclib/aclib.cpp
index 388e415946d..946497ea303 100644
--- a/ydb/library/aclib/aclib.cpp
+++ b/ydb/library/aclib/aclib.cpp
@@ -453,8 +453,8 @@ TString TACL::ToString(const NACLibProto::TACE& ace) {
rights.emplace_back("GAR");
if (ar & EAccessRights::WriteUserAttributes)
rights.emplace_back("WUA");
- if (ar & EAccessRights::ConnectDatabase)
- rights.emplace_back("ConnDB");
+ if (ar & EAccessRights::ConnectDatabase)
+ rights.emplace_back("ConnDB");
str << '(';
for (auto jt = rights.begin(); jt != rights.end(); ++jt) {
if (jt != rights.begin()) {
@@ -471,8 +471,8 @@ TString TACL::ToString(const NACLibProto::TACE& ace) {
auto inh = ace.GetInheritanceType();
if (inh != (EInheritanceType::InheritContainer | EInheritanceType::InheritObject)) {
str << ':';
- if (inh == EInheritanceType::InheritNone)
- str << '-';
+ if (inh == EInheritanceType::InheritNone)
+ str << '-';
if (inh & EInheritanceType::InheritContainer)
str << 'C';
if (inh & EInheritanceType::InheritObject)
@@ -541,8 +541,8 @@ ui32 TACL::SpecialRightsFromString(const TString& string) {
result |= EAccessRights::DropDatabase;
if (r == "GAR")
result |= EAccessRights::GrantAccessRights;
- if (r == "ConnDB")
- result |= EAccessRights::ConnectDatabase;
+ if (r == "ConnDB")
+ result |= EAccessRights::ConnectDatabase;
}
return result;
}
@@ -616,9 +616,9 @@ void TACL::FromString(NACLibProto::TACE& ace, const TString& string) {
if (string[end_pos] == ':') {
while (++end_pos < string.size()) {
switch(string[end_pos]) {
- case '-':
- inheritanceType |= EInheritanceType::InheritNone;
- break;
+ case '-':
+ inheritanceType |= EInheritanceType::InheritNone;
+ break;
case 'C':
inheritanceType |= EInheritanceType::InheritContainer;
break;
@@ -736,10 +736,10 @@ TString AccessRightsToString(ui32 accessRights) {
rights.emplace_back("DropDatabase");
if (accessRights & EAccessRights::GrantAccessRights)
rights.emplace_back("GrantAccessRights");
- if (accessRights & EAccessRights::WriteUserAttributes)
- rights.emplace_back("WriteUserAttributes");
- if (accessRights & EAccessRights::ConnectDatabase)
- rights.emplace_back("ConnectDatabase");
+ if (accessRights & EAccessRights::WriteUserAttributes)
+ rights.emplace_back("WriteUserAttributes");
+ if (accessRights & EAccessRights::ConnectDatabase)
+ rights.emplace_back("ConnectDatabase");
TString result;
for (auto it = rights.begin(); it != rights.end(); ++it) {
if (it != rights.begin()) {
diff --git a/ydb/library/aclib/aclib.h b/ydb/library/aclib/aclib.h
index 8a48cfbd3c8..655ca4b6693 100644
--- a/ydb/library/aclib/aclib.h
+++ b/ydb/library/aclib/aclib.h
@@ -26,17 +26,17 @@ enum EAccessRights : ui32 { // bitmask
CreateDatabase = 0x00000800, // create database
DropDatabase = 0x00001000, // drop database
GrantAccessRights = 0x00002000, // grant access rights (only own access rights)
- WriteUserAttributes = 0x00004000, // modify user attributes / KV
- ConnectDatabase = 0x00008000, // any type of request to DB
+ WriteUserAttributes = 0x00004000, // modify user attributes / KV
+ ConnectDatabase = 0x00008000, // any type of request to DB
ReadStream = 0x00010000, // reading streams
WriteStream = 0x00020000, // writing streams
ReadTopic = 0x00040000, // reading topics
WritTopic = 0x00080000, // writing topics
- GenericRead = SelectRow | ReadAttributes | DescribeSchema,
- GenericWrite = UpdateRow | EraseRow | WriteAttributes | CreateDirectory | CreateTable | CreateQueue | RemoveSchema | AlterSchema | WriteUserAttributes,
+ GenericRead = SelectRow | ReadAttributes | DescribeSchema,
+ GenericWrite = UpdateRow | EraseRow | WriteAttributes | CreateDirectory | CreateTable | CreateQueue | RemoveSchema | AlterSchema | WriteUserAttributes,
GenericUse = GenericRead | GenericWrite | GrantAccessRights,
- GenericManage = CreateDatabase | DropDatabase,
+ GenericManage = CreateDatabase | DropDatabase,
GenericFull = GenericUse | GenericManage,
};
@@ -48,7 +48,7 @@ enum class EAccessType : ui32 {
};
enum EInheritanceType : ui32 { // bitmask
- InheritNone = 0x00,
+ InheritNone = 0x00,
InheritObject = 0x01, // this ACE will inherit on child objects
InheritContainer = 0x02, // this ACE will inherit on child containers
InheritOnly = 0x04, // this ACE will not be used for access checking but for inheritance only
diff --git a/ydb/library/backup/query_uploader.cpp b/ydb/library/backup/query_uploader.cpp
index 386ef87353b..c9689c3b2e4 100644
--- a/ydb/library/backup/query_uploader.cpp
+++ b/ydb/library/backup/query_uploader.cpp
@@ -11,15 +11,15 @@ static const char DOC_API_REQUEST_TYPE[] = "_document_api_request";
// TUploader
////////////////////////////////////////////////////////////////////////////////
-ui32 TUploader::TOptions::GetRps() const {
- return Rate * TDuration::Seconds(1).MilliSeconds() / Interval.MilliSeconds();
-}
-
+ui32 TUploader::TOptions::GetRps() const {
+ return Rate * TDuration::Seconds(1).MilliSeconds() / Interval.MilliSeconds();
+}
+
TUploader::TUploader(const TUploader::TOptions &opts, NYdb::NTable::TTableClient& client, const TString &query)
: Opts(opts)
, Query(query)
, ShouldStop(0)
- , RequestLimiter(opts.GetRps(), opts.GetRps())
+ , RequestLimiter(opts.GetRps(), opts.GetRps())
, Client(client)
{
TasksQueue = MakeSimpleShared<TThreadPool>(TThreadPool::TParams().SetBlocking(true).SetCatching(true));
@@ -34,8 +34,8 @@ bool TUploader::Push(const TString& path, TValue&& value) {
auto task = [this, taskValue = std::move(value), &path, retrySleep = BulkUpsertRetryDuration] () mutable {
ui32 retry = 0;
while (true) {
- while (!RequestLimiter.IsAvail()) {
- Sleep(Min(TDuration::MicroSeconds(RequestLimiter.GetWaitTime()), Opts.ReactionTime));
+ while (!RequestLimiter.IsAvail()) {
+ Sleep(Min(TDuration::MicroSeconds(RequestLimiter.GetWaitTime()), Opts.ReactionTime));
if (IsStopped()) {
return;
}
@@ -45,8 +45,8 @@ bool TUploader::Push(const TString& path, TValue&& value) {
return;
}
- RequestLimiter.Use(1);
-
+ RequestLimiter.Use(1);
+
auto upsert = [&] (NYdb::NTable::TSession) -> TStatus {
auto settings = NTable::TBulkUpsertSettings()
.RequestType(DOC_API_REQUEST_TYPE)
@@ -119,8 +119,8 @@ bool TUploader::Push(TParams params) {
};
auto task = [this, upload] () {
- while (!RequestLimiter.IsAvail()) {
- Sleep(Min(TDuration::MilliSeconds(RequestLimiter.GetWaitTime()), Opts.ReactionTime));
+ while (!RequestLimiter.IsAvail()) {
+ Sleep(Min(TDuration::MilliSeconds(RequestLimiter.GetWaitTime()), Opts.ReactionTime));
if (IsStopped()) {
return;
}
@@ -130,8 +130,8 @@ bool TUploader::Push(TParams params) {
return;
}
- RequestLimiter.Use(1);
-
+ RequestLimiter.Use(1);
+
auto settings = NYdb::NTable::TRetryOperationSettings()
.MaxRetries(Opts.RetryOperaionMaxRetries)
.Idempotent(true);
diff --git a/ydb/library/backup/query_uploader.h b/ydb/library/backup/query_uploader.h
index 200022c798f..b72a31cea26 100644
--- a/ydb/library/backup/query_uploader.h
+++ b/ydb/library/backup/query_uploader.h
@@ -2,7 +2,7 @@
#include <ydb/public/sdk/cpp/client/ydb_table/table.h>
-#include <library/cpp/bucket_quoter/bucket_quoter.h>
+#include <library/cpp/bucket_quoter/bucket_quoter.h>
#include <util/thread/pool.h>
#include <util/generic/string.h>
@@ -19,8 +19,8 @@ public:
ui32 RetryOperaionMaxRetries = 30;
ui32 TransportErrorsMaxRetries = 9;
TDuration ReactionTime = TDuration::MilliSeconds(50);
-
- ui32 GetRps() const;
+
+ ui32 GetRps() const;
};
private:
@@ -32,7 +32,7 @@ private:
// Total wait is 1 * (2 ** TransportErrorsMaxRetries - 1), for TransportErrorsMaxRetries == 9 it gives ~8.5 minutes
TDuration BulkUpsertRetryDuration = TDuration::Seconds(1);
- using TRpsLimiter = TBucketQuoter<ui64>;
+ using TRpsLimiter = TBucketQuoter<ui64>;
TRpsLimiter RequestLimiter;
NYdb::NTable::TTableClient& Client;
diff --git a/ydb/library/backup/ya.make b/ydb/library/backup/ya.make
index 321ffac462b..9ea7b93961a 100644
--- a/ydb/library/backup/ya.make
+++ b/ydb/library/backup/ya.make
@@ -6,7 +6,7 @@ OWNER(
)
PEERDIR(
- library/cpp/bucket_quoter
+ library/cpp/bucket_quoter
library/cpp/regex/pcre
library/cpp/string_utils/quote
util
diff --git a/ydb/library/yql/sql/v1/SQLv1.g.in b/ydb/library/yql/sql/v1/SQLv1.g.in
index 9837093d370..ef394c7a009 100644
--- a/ydb/library/yql/sql/v1/SQLv1.g.in
+++ b/ydb/library/yql/sql/v1/SQLv1.g.in
@@ -473,7 +473,7 @@ alter_table_action:
| alter_table_reset_table_setting
| alter_table_add_index
| alter_table_drop_index
- | alter_table_rename_to
+ | alter_table_rename_to
| alter_table_add_changefeed
| alter_table_alter_changefeed
| alter_table_drop_changefeed
@@ -489,7 +489,7 @@ alter_table_set_table_setting_compat: SET LPAREN alter_table_setting_entry (COMM
alter_table_reset_table_setting: RESET LPAREN an_id (COMMA an_id)* RPAREN;
alter_table_add_index: ADD table_index;
alter_table_drop_index: DROP INDEX an_id;
-alter_table_rename_to: RENAME TO an_id_table;
+alter_table_rename_to: RENAME TO an_id_table;
alter_table_add_changefeed: ADD changefeed;
alter_table_alter_changefeed: ALTER CHANGEFEED an_id changefeed_alter_settings;
alter_table_drop_changefeed: DROP CHANGEFEED an_id;
diff --git a/ydb/library/yql/sql/v1/context.cpp b/ydb/library/yql/sql/v1/context.cpp
index 2b4bb20bcd6..c08fe96caeb 100644
--- a/ydb/library/yql/sql/v1/context.cpp
+++ b/ydb/library/yql/sql/v1/context.cpp
@@ -553,7 +553,7 @@ TString TTranslation::AltDescription(const google::protobuf::Message& node, ui32
}
void TTranslation::AltNotImplemented(const TString& ruleName, ui32 altCase, const google::protobuf::Message& node, const google::protobuf::Descriptor* descr) {
- Error() << ruleName << ": alternative is not implemented yet: " << AltDescription(node, altCase, descr);
+ Error() << ruleName << ": alternative is not implemented yet: " << AltDescription(node, altCase, descr);
}
} // namespace NSQLTranslationV1
diff --git a/ydb/library/yql/sql/v1/node.h b/ydb/library/yql/sql/v1/node.h
index c62db5bf09f..de82b45a238 100644
--- a/ydb/library/yql/sql/v1/node.h
+++ b/ydb/library/yql/sql/v1/node.h
@@ -1147,19 +1147,19 @@ namespace NSQLTranslationV1 {
TTableSettings TableSettings;
TVector<TIndexDescription> AddIndexes;
TVector<TIdentifier> DropIndexes;
- TMaybe<TIdentifier> RenameTo;
+ TMaybe<TIdentifier> RenameTo;
TVector<TChangefeedDescription> AddChangefeeds;
TVector<TChangefeedDescription> AlterChangefeeds;
TVector<TIdentifier> DropChangefeeds;
-
- bool IsEmpty() const {
- return AddColumns.empty() && DropColumns.empty() && AlterColumns.empty()
+
+ bool IsEmpty() const {
+ return AddColumns.empty() && DropColumns.empty() && AlterColumns.empty()
&& AddColumnFamilies.empty() && AlterColumnFamilies.empty()
&& !TableSettings.IsSet()
&& AddIndexes.empty() && DropIndexes.empty()
&& !RenameTo.Defined()
&& AddChangefeeds.empty() && AlterChangefeeds.empty() && DropChangefeeds.empty();
- }
+ }
};
struct TRoleParameters {
diff --git a/ydb/library/yql/sql/v1/query.cpp b/ydb/library/yql/sql/v1/query.cpp
index 77d57fd439a..725356b9f57 100644
--- a/ydb/library/yql/sql/v1/query.cpp
+++ b/ydb/library/yql/sql/v1/query.cpp
@@ -968,11 +968,11 @@ public:
}
if (Params.RenameTo) {
- auto destination = ctx.GetPrefixedPath(Scoped->CurrService, Scoped->CurrCluster,
- TDeferredAtom(Params.RenameTo->Pos, Params.RenameTo->Name));
- actions = L(actions, Q(Y(Q("renameTo"), destination)));
- }
-
+ auto destination = ctx.GetPrefixedPath(Scoped->CurrService, Scoped->CurrCluster,
+ TDeferredAtom(Params.RenameTo->Pos, Params.RenameTo->Name));
+ actions = L(actions, Q(Y(Q("renameTo"), destination)));
+ }
+
for (const auto& cf : Params.AddChangefeeds) {
const auto& desc = CreateChangefeedDesc(cf, *this);
actions = L(actions, Q(Y(Q("addChangefeed"), Q(desc))));
diff --git a/ydb/library/yql/sql/v1/sql.cpp b/ydb/library/yql/sql/v1/sql.cpp
index 2bd8f62cb8c..ab5a8647885 100644
--- a/ydb/library/yql/sql/v1/sql.cpp
+++ b/ydb/library/yql/sql/v1/sql.cpp
@@ -8159,7 +8159,7 @@ private:
bool AlterTableResetTableSetting(const TRule_alter_table_reset_table_setting& node, TAlterTableParameters& params);
bool AlterTableAddIndex(const TRule_alter_table_add_index& node, TAlterTableParameters& params);
void AlterTableDropIndex(const TRule_alter_table_drop_index& node, TAlterTableParameters& params);
- void AlterTableRenameTo(const TRule_alter_table_rename_to& node, TAlterTableParameters& params);
+ void AlterTableRenameTo(const TRule_alter_table_rename_to& node, TAlterTableParameters& params);
bool AlterTableAddChangefeed(const TRule_alter_table_add_changefeed& node, TAlterTableParameters& params);
bool AlterTableAlterChangefeed(const TRule_alter_table_alter_changefeed& node, TAlterTableParameters& params);
void AlterTableDropChangefeed(const TRule_alter_table_drop_changefeed& node, TAlterTableParameters& params);
@@ -8312,7 +8312,7 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
Error() << humanStatementName << " statement is not supported in subqueries";
return false;
}
-
+
switch (altCase) {
case TRule_sql_stmt_core::kAltSqlStmtCore1: {
bool success = false;
@@ -8490,12 +8490,12 @@ bool TSqlQuery::Statement(TVector<TNodePtr>& blocks, const TRule_sql_stmt_core&
if (!SimpleTableRefImpl(rule.GetRule_simple_table_ref3(), tr)) {
return false;
}
-
+
TAlterTableParameters params;
if (!AlterTableAction(rule.GetRule_alter_table_action4(), params)) {
return false;
}
-
+
for (auto& block : rule.GetBlock5()) {
if (!AlterTableAction(block.GetRule_alter_table_action2(), params)) {
return false;
@@ -8828,12 +8828,12 @@ bool TSqlQuery::ExportStatement(const TRule_export_stmt& stmt) {
}
bool TSqlQuery::AlterTableAction(const TRule_alter_table_action& node, TAlterTableParameters& params) {
- if (params.RenameTo) {
- // rename action is followed by some other actions
- Error() << "RENAME TO can not be used together with another table action";
- return false;
- }
-
+ if (params.RenameTo) {
+ // rename action is followed by some other actions
+ Error() << "RENAME TO can not be used together with another table action";
+ return false;
+ }
+
switch (node.Alt_case()) {
case TRule_alter_table_action::kAltAlterTableAction1: {
// ADD COLUMN
@@ -8914,18 +8914,18 @@ bool TSqlQuery::AlterTableAction(const TRule_alter_table_action& node, TAlterTab
AlterTableDropIndex(dropIndex, params);
break;
}
- case TRule_alter_table_action::kAltAlterTableAction11: {
- // RENAME TO
- if (!params.IsEmpty()) {
- // rename action follows some other actions
- Error() << "RENAME TO can not be used together with another table action";
- return false;
- }
-
- const auto& renameTo = node.GetAlt_alter_table_action11().GetRule_alter_table_rename_to1();
- AlterTableRenameTo(renameTo, params);
- break;
- }
+ case TRule_alter_table_action::kAltAlterTableAction11: {
+ // RENAME TO
+ if (!params.IsEmpty()) {
+ // rename action follows some other actions
+ Error() << "RENAME TO can not be used together with another table action";
+ return false;
+ }
+
+ const auto& renameTo = node.GetAlt_alter_table_action11().GetRule_alter_table_rename_to1();
+ AlterTableRenameTo(renameTo, params);
+ break;
+ }
case TRule_alter_table_action::kAltAlterTableAction12: {
// ADD CHANGEFEED
const auto& rule = node.GetAlt_alter_table_action12().GetRule_alter_table_add_changefeed1();
@@ -8948,7 +8948,7 @@ bool TSqlQuery::AlterTableAction(const TRule_alter_table_action& node, TAlterTab
AlterTableDropChangefeed(rule, params);
break;
}
-
+
default:
AltNotImplemented("alter_table_action", node);
return false;
@@ -9092,10 +9092,10 @@ void TSqlQuery::AlterTableDropIndex(const TRule_alter_table_drop_index& node, TA
params.DropIndexes.emplace_back(IdEx(node.GetRule_an_id3(), *this));
}
-void TSqlQuery::AlterTableRenameTo(const TRule_alter_table_rename_to& node, TAlterTableParameters& params) {
- params.RenameTo = IdEx(node.GetRule_an_id_table3(), *this);
-}
-
+void TSqlQuery::AlterTableRenameTo(const TRule_alter_table_rename_to& node, TAlterTableParameters& params) {
+ params.RenameTo = IdEx(node.GetRule_an_id_table3(), *this);
+}
+
bool TSqlQuery::AlterTableAddChangefeed(const TRule_alter_table_add_changefeed& node, TAlterTableParameters& params) {
return CreateChangefeed(node.GetRule_changefeed2(), *this, params.AddChangefeeds);
}
diff --git a/ydb/library/yql/sql/v1/sql_ut.cpp b/ydb/library/yql/sql/v1/sql_ut.cpp
index 2ea99f091b8..85b6e0dfcd3 100644
--- a/ydb/library/yql/sql/v1/sql_ut.cpp
+++ b/ydb/library/yql/sql/v1/sql_ut.cpp
@@ -1573,22 +1573,22 @@ Y_UNIT_TEST_SUITE(SqlParsingOnly) {
Y_UNIT_TEST(SmartParenInGroupByClause) {
UNIT_ASSERT(SqlToYql("SELECT * FROM plato.Input GROUP BY (k, v)").IsOk());
}
-
- Y_UNIT_TEST(AlterTableRenameToIsCorrect) {
- UNIT_ASSERT(SqlToYql("USE plato; ALTER TABLE table RENAME TO moved").IsOk());
- }
-
- Y_UNIT_TEST(AlterTableAddDropColumnIsCorrect) {
- UNIT_ASSERT(SqlToYql("USE plato; ALTER TABLE table ADD COLUMN addc uint64, DROP COLUMN dropc, ADD addagain uint64").IsOk());
- }
-
- Y_UNIT_TEST(AlterTableSetTTLIsCorrect) {
- UNIT_ASSERT(SqlToYql("USE plato; ALTER TABLE table SET (TTL = Interval(\"PT3H\") ON column)").IsOk());
- }
-
- Y_UNIT_TEST(AlterTableSetPartitioningIsCorrect) {
- UNIT_ASSERT(SqlToYql("USE plato; ALTER TABLE table SET (AUTO_PARTITIONING_BY_SIZE = DISABLED)").IsOk());
- }
+
+ Y_UNIT_TEST(AlterTableRenameToIsCorrect) {
+ UNIT_ASSERT(SqlToYql("USE plato; ALTER TABLE table RENAME TO moved").IsOk());
+ }
+
+ Y_UNIT_TEST(AlterTableAddDropColumnIsCorrect) {
+ UNIT_ASSERT(SqlToYql("USE plato; ALTER TABLE table ADD COLUMN addc uint64, DROP COLUMN dropc, ADD addagain uint64").IsOk());
+ }
+
+ Y_UNIT_TEST(AlterTableSetTTLIsCorrect) {
+ UNIT_ASSERT(SqlToYql("USE plato; ALTER TABLE table SET (TTL = Interval(\"PT3H\") ON column)").IsOk());
+ }
+
+ Y_UNIT_TEST(AlterTableSetPartitioningIsCorrect) {
+ UNIT_ASSERT(SqlToYql("USE plato; ALTER TABLE table SET (AUTO_PARTITIONING_BY_SIZE = DISABLED)").IsOk());
+ }
Y_UNIT_TEST(OptionalAliases) {
UNIT_ASSERT(SqlToYql("USE plato; SELECT foo FROM (SELECT key foo FROM Input);").IsOk());
@@ -3136,16 +3136,16 @@ select FormatType($f());
"<main>:1:37: Error: Unable to GROUP BY constant expression\n");
}
- Y_UNIT_TEST(ErrRenameWithAddColumn) {
- ExpectFailWithError("USE plato; ALTER TABLE table RENAME TO moved, ADD COLUMN addc uint64",
- "<main>:1:40: Error: RENAME TO can not be used together with another table action\n");
- }
-
- Y_UNIT_TEST(ErrAddColumnAndRename) {
+ Y_UNIT_TEST(ErrRenameWithAddColumn) {
+ ExpectFailWithError("USE plato; ALTER TABLE table RENAME TO moved, ADD COLUMN addc uint64",
+ "<main>:1:40: Error: RENAME TO can not be used together with another table action\n");
+ }
+
+ Y_UNIT_TEST(ErrAddColumnAndRename) {
// FIXME: fix positions in ALTER TABLE
- ExpectFailWithError("USE plato; ALTER TABLE table ADD COLUMN addc uint64, RENAME TO moved",
+ ExpectFailWithError("USE plato; ALTER TABLE table ADD COLUMN addc uint64, RENAME TO moved",
"<main>:1:46: Error: RENAME TO can not be used together with another table action\n");
- }
+ }
Y_UNIT_TEST(InvalidUuidValue) {
ExpectFailWithError("SELECT Uuid('123e4567ae89ba12d3aa456a426614174ab0')",
diff --git a/ydb/public/api/grpc/ydb_table_v1.proto b/ydb/public/api/grpc/ydb_table_v1.proto
index d6e0b8f339e..dbbf62c5c8e 100644
--- a/ydb/public/api/grpc/ydb_table_v1.proto
+++ b/ydb/public/api/grpc/ydb_table_v1.proto
@@ -34,12 +34,12 @@ service TableService {
// Creates copy of given table.
rpc CopyTable(Table.CopyTableRequest) returns (Table.CopyTableResponse);
- // Creates consistent copy of given tables.
- rpc CopyTables(Table.CopyTablesRequest) returns (Table.CopyTablesResponse);
-
- // Creates consistent move of given tables.
- rpc RenameTables(Table.RenameTablesRequest) returns (Table.RenameTablesResponse);
-
+ // Creates consistent copy of given tables.
+ rpc CopyTables(Table.CopyTablesRequest) returns (Table.CopyTablesResponse);
+
+ // Creates consistent move of given tables.
+ rpc RenameTables(Table.RenameTablesRequest) returns (Table.RenameTablesResponse);
+
// Returns information about given table (metadata).
rpc DescribeTable(Table.DescribeTableRequest) returns (Table.DescribeTableResponse);
diff --git a/ydb/public/api/protos/draft/datastreams.proto b/ydb/public/api/protos/draft/datastreams.proto
index 6dcb91ec896..5c1354288af 100644
--- a/ydb/public/api/protos/draft/datastreams.proto
+++ b/ydb/public/api/protos/draft/datastreams.proto
@@ -172,7 +172,7 @@ message ShardFilter {
FROM_TRIM_HORIZON = 3;
// Include only the currently open shards
AT_LATEST = 4;
- // Include all the shards whose start timestamp is <= to the given
+ // Include all the shards whose start timestamp is <= to the given
AT_TIMESTAMP = 5;
// Include all closed shards whose end timestamp >= to the given
FROM_TIMESTAMP = 6;
diff --git a/ydb/public/api/protos/ydb_cms.proto b/ydb/public/api/protos/ydb_cms.proto
index a46c18fc0c8..1a569c70812 100644
--- a/ydb/public/api/protos/ydb_cms.proto
+++ b/ydb/public/api/protos/ydb_cms.proto
@@ -56,8 +56,8 @@ message ServerlessResources {
message DatabaseOptions {
// Do not initialize services required for transactions processing.
bool disable_tx_service = 1;
- // Old-style database, do not create external schemeshard for database
- bool disable_external_subdomain = 2;
+ // Old-style database, do not create external schemeshard for database
+ bool disable_external_subdomain = 2;
// Transaction plan resolution in milliseconds
uint32 plan_resolution = 3;
}
diff --git a/ydb/public/api/protos/ydb_table.proto b/ydb/public/api/protos/ydb_table.proto
index 51f05407af5..c8063d9475c 100644
--- a/ydb/public/api/protos/ydb_table.proto
+++ b/ydb/public/api/protos/ydb_table.proto
@@ -100,8 +100,8 @@ message IndexBuildState {
STATE_DONE = 4;
STATE_CANCELLATION = 5;
STATE_CANCELLED = 6;
- STATE_REJECTION = 7;
- STATE_REJECTED = 8;
+ STATE_REJECTION = 7;
+ STATE_REJECTED = 8;
}
}
@@ -511,50 +511,50 @@ message CopyTableResponse {
Ydb.Operations.Operation operation = 1;
}
-message CopyTableItem {
- // Copy from path
- string source_path = 1;
- // Copy to path
- string destination_path = 2;
- // Copy options
- bool omit_indexes = 3;
+message CopyTableItem {
+ // Copy from path
+ string source_path = 1;
+ // Copy to path
+ string destination_path = 2;
+ // Copy options
+ bool omit_indexes = 3;
+}
+
+// Creates consistent copy of given tables.
+message CopyTablesRequest {
+ Ydb.Operations.OperationParams operation_params = 1;
+ // Session identifier
+ string session_id = 2;
+ // Source and destination paths which describe copies
+ repeated CopyTableItem tables = 3;
+}
+
+message CopyTablesResponse {
+ Ydb.Operations.Operation operation = 1;
+}
+
+message RenameTableItem {
+ // Full path
+ string source_path = 1;
+ // Full path
+ string destination_path = 2;
+ // Move options
+ bool replace_destination = 3;
}
-
-// Creates consistent copy of given tables.
-message CopyTablesRequest {
- Ydb.Operations.OperationParams operation_params = 1;
+
+// Moves given tables
+message RenameTablesRequest {
+ Ydb.Operations.OperationParams operation_params = 1;
// Session identifier
- string session_id = 2;
- // Source and destination paths which describe copies
- repeated CopyTableItem tables = 3;
-}
-
-message CopyTablesResponse {
- Ydb.Operations.Operation operation = 1;
-}
-
-message RenameTableItem {
- // Full path
- string source_path = 1;
- // Full path
- string destination_path = 2;
- // Move options
- bool replace_destination = 3;
-}
-
-// Moves given tables
-message RenameTablesRequest {
- Ydb.Operations.OperationParams operation_params = 1;
- // Session identifier
- string session_id = 2;
- // Source and destination paths inside RenameTableItem describe rename actions
- repeated RenameTableItem tables = 3;
-}
-
-message RenameTablesResponse {
- Ydb.Operations.Operation operation = 1;
-}
-
+ string session_id = 2;
+ // Source and destination paths inside RenameTableItem describe rename actions
+ repeated RenameTableItem tables = 3;
+}
+
+message RenameTablesResponse {
+ Ydb.Operations.Operation operation = 1;
+}
+
// Describe table with given path
message DescribeTableRequest {
// Session identifier
diff --git a/ydb/public/lib/base/defs.h b/ydb/public/lib/base/defs.h
index 0eb2023fcfb..97e933c93ac 100644
--- a/ydb/public/lib/base/defs.h
+++ b/ydb/public/lib/base/defs.h
@@ -45,7 +45,7 @@ namespace NTxProxy {
XX(NotImplemented, 3) \
XX(ResolveError, 4) \
XX(AccessDenied, 5) \
- XX(DomainLocalityError, 6) \
+ XX(DomainLocalityError, 6) \
\
XX(ProxyNotReady, 16) \
XX(ProxyAccepted, 17) \
diff --git a/ydb/public/lib/deprecated/kicli/cpp_ut.cpp b/ydb/public/lib/deprecated/kicli/cpp_ut.cpp
index 35fba2a1a1a..cb7dc3ed6d9 100644
--- a/ydb/public/lib/deprecated/kicli/cpp_ut.cpp
+++ b/ydb/public/lib/deprecated/kicli/cpp_ut.cpp
@@ -19,12 +19,12 @@ Tests::TServer StartupKikimr(NMsgBusProxy::TMsgBusClientConfig& clientConfig,
{
TPortManager pm;
const ui32 port = pm.GetPort(12001);
- auto settings = Tests::TServerSettings(port);
- settings.SetLogBackend(logBackend);
+ auto settings = Tests::TServerSettings(port);
+ settings.SetLogBackend(logBackend);
settings.SetEnableSystemViews(false);
- Tests::TServer Server(settings);
- Tests::TClient Client(settings);
- Client.InitRootScheme();
+ Tests::TServer Server(settings);
+ Tests::TClient Client(settings);
+ Client.InitRootScheme();
clientConfig = Client.GetClientConfig();
return Server;
}
@@ -37,18 +37,18 @@ Tests::TServer StartupKikimr(NGRpcProxy::TGRpcClientConfig& clientConfig,
const ui32 msgbusPort = pm.GetPort(12001);
const ui32 grpcPort = pm.GetPort(12002);
- auto settings = Tests::TServerSettings(msgbusPort);
- settings.SetLogBackend(logBackend);
+ auto settings = Tests::TServerSettings(msgbusPort);
+ settings.SetLogBackend(logBackend);
settings.AppConfig.CopyFrom(config);
settings.SetEnableSystemViews(false);
settings.SetEnableMvcc(false);
- Tests::TServer Server(settings);
+ Tests::TServer Server(settings);
Server.EnableGRpc(grpcPort);
- Tests::TClient Client(settings);
- Client.InitRootScheme();
-
+ Tests::TClient Client(settings);
+ Client.InitRootScheme();
+
clientConfig.Locator = "[::1]:" + ToString(grpcPort);
return Server;
diff --git a/ydb/public/lib/deprecated/kicli/kicli.h b/ydb/public/lib/deprecated/kicli/kicli.h
index 9dae8968977..9dc472d2314 100644
--- a/ydb/public/lib/deprecated/kicli/kicli.h
+++ b/ydb/public/lib/deprecated/kicli/kicli.h
@@ -47,8 +47,8 @@ class TUnbindedQuery;
class TRetryQueue;
class TKikimr;
-using TTablePartitionConfig = NKikimrSchemeOp::TPartitionConfig;
-using TModifyScheme = NKikimrSchemeOp::TModifyScheme;
+using TTablePartitionConfig = NKikimrSchemeOp::TPartitionConfig;
+using TModifyScheme = NKikimrSchemeOp::TModifyScheme;
class TType {
public:
@@ -563,7 +563,7 @@ class TSchemaObject {
// KiKiMR DB schema object, used for schema construction and initialization
friend class TKikimr;
public:
- /// @sa NKikimrSchemeOp::EPathType
+ /// @sa NKikimrSchemeOp::EPathType
enum class EPathType : ui32 {
Unknown = 0,
Directory,
@@ -573,7 +573,7 @@ public:
RtmrVolume,
BlockStoreVolume,
Kesus,
- SolomonVolume,
+ SolomonVolume,
FileStore,
OlapStore,
OlapTable,
diff --git a/ydb/public/lib/deprecated/kicli/kikimr.cpp b/ydb/public/lib/deprecated/kicli/kikimr.cpp
index 0266bd69a07..4156d72d4b3 100644
--- a/ydb/public/lib/deprecated/kicli/kikimr.cpp
+++ b/ydb/public/lib/deprecated/kicli/kikimr.cpp
@@ -517,7 +517,7 @@ NThreading::TFuture<TResult> TKikimr::MakeDirectory(const TSchemaObject& object,
request->Record.MutablePollOptions()->SetTimeout(POLLING_TIMEOUT);
auto* modifyScheme = request->Record.MutableTransaction()->MutableModifyScheme();
modifyScheme->SetWorkingDir(object.GetPath());
- modifyScheme->SetOperationType(NKikimrSchemeOp::ESchemeOpMkDir);
+ modifyScheme->SetOperationType(NKikimrSchemeOp::ESchemeOpMkDir);
auto* makeDirectory = modifyScheme->MutableMkDir();
makeDirectory->SetName(name);
return ExecuteRequest(request.Release());
@@ -530,7 +530,7 @@ NThreading::TFuture<TResult> TKikimr::CreateTable(TSchemaObject& object, const T
request->Record.MutablePollOptions()->SetTimeout(POLLING_TIMEOUT);
auto* modifyScheme = request->Record.MutableTransaction()->MutableModifyScheme();
modifyScheme->SetWorkingDir(object.GetPath());
- modifyScheme->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateTable);
+ modifyScheme->SetOperationType(NKikimrSchemeOp::ESchemeOpCreateTable);
auto* createTable = modifyScheme->MutableCreateTable();
createTable->SetName(name);
for (const TColumn& column : columns) {
diff --git a/ydb/public/lib/deprecated/kicli/schema.cpp b/ydb/public/lib/deprecated/kicli/schema.cpp
index 68ac9965e7d..d1ee0384f8b 100644
--- a/ydb/public/lib/deprecated/kicli/schema.cpp
+++ b/ydb/public/lib/deprecated/kicli/schema.cpp
@@ -71,10 +71,10 @@ TSchemaObject::TSchemaObject(TKikimr& kikimr, const TString& path, const TString
, PathId(pathId)
, PathType(pathType)
{
- static_assert((ui32)NKikimrSchemeOp::EPathTypeDir == (ui32)EPathType::Directory, "EPathType::Directory");
- static_assert((ui32)NKikimrSchemeOp::EPathTypeTable == (ui32)EPathType::Table, "EPathType::Table");
- static_assert((ui32)NKikimrSchemeOp::EPathTypePersQueueGroup == (ui32)EPathType::PersQueueGroup, "EPathType::PersQueueGroup");
- static_assert((ui32)NKikimrSchemeOp::EPathTypeSubDomain == (ui32)EPathType::SubDomain, "EPathType::SubDomain");
+ static_assert((ui32)NKikimrSchemeOp::EPathTypeDir == (ui32)EPathType::Directory, "EPathType::Directory");
+ static_assert((ui32)NKikimrSchemeOp::EPathTypeTable == (ui32)EPathType::Table, "EPathType::Table");
+ static_assert((ui32)NKikimrSchemeOp::EPathTypePersQueueGroup == (ui32)EPathType::PersQueueGroup, "EPathType::PersQueueGroup");
+ static_assert((ui32)NKikimrSchemeOp::EPathTypeSubDomain == (ui32)EPathType::SubDomain, "EPathType::SubDomain");
}
void TSchemaObject::ModifySchema(const TModifyScheme& schema) {
@@ -87,26 +87,26 @@ void TSchemaObject::Drop() {
TModifyScheme drop;
switch (PathType) {
case EPathType::Directory:
- drop.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpRmDir);
+ drop.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpRmDir);
break;
case EPathType::Table:
- drop.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
+ drop.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropTable);
break;
case EPathType::PersQueueGroup:
- drop.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropPersQueueGroup);
+ drop.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropPersQueueGroup);
break;
case EPathType::BlockStoreVolume:
- drop.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropBlockStoreVolume);
+ drop.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropBlockStoreVolume);
break;
case EPathType::FileStore:
- drop.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropFileStore);
+ drop.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropFileStore);
break;
case EPathType::Kesus:
- drop.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropKesus);
+ drop.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropKesus);
+ break;
+ case EPathType::SolomonVolume:
+ drop.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropSolomonVolume);
break;
- case EPathType::SolomonVolume:
- drop.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropSolomonVolume);
- break;
case EPathType::OlapStore:
drop.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropColumnStore);
break;
@@ -114,7 +114,7 @@ void TSchemaObject::Drop() {
drop.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropColumnTable);
break;
case EPathType::Sequence:
- drop.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropSequence);
+ drop.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropSequence);
break;
case EPathType::Replication:
drop.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpDropReplication);
@@ -174,39 +174,39 @@ TSchemaObject TSchemaObject::GetChild(const TString& name) const {
return *child;
}
-static TSchemaObject::EPathType GetType(const NKikimrSchemeOp::TDirEntry& entry) {
+static TSchemaObject::EPathType GetType(const NKikimrSchemeOp::TDirEntry& entry) {
switch (entry.GetPathType()) {
- case NKikimrSchemeOp::EPathTypeDir:
+ case NKikimrSchemeOp::EPathTypeDir:
return TSchemaObject::EPathType::Directory;
- case NKikimrSchemeOp::EPathTypeTable:
+ case NKikimrSchemeOp::EPathTypeTable:
return TSchemaObject::EPathType::Table;
- case NKikimrSchemeOp::EPathTypePersQueueGroup:
+ case NKikimrSchemeOp::EPathTypePersQueueGroup:
return TSchemaObject::EPathType::PersQueueGroup;
- case NKikimrSchemeOp::EPathTypeSubDomain:
+ case NKikimrSchemeOp::EPathTypeSubDomain:
return TSchemaObject::EPathType::SubDomain;
- case NKikimrSchemeOp::EPathTypeRtmrVolume:
+ case NKikimrSchemeOp::EPathTypeRtmrVolume:
return TSchemaObject::EPathType::RtmrVolume;
- case NKikimrSchemeOp::EPathTypeBlockStoreVolume:
+ case NKikimrSchemeOp::EPathTypeBlockStoreVolume:
return TSchemaObject::EPathType::BlockStoreVolume;
- case NKikimrSchemeOp::EPathTypeFileStore:
+ case NKikimrSchemeOp::EPathTypeFileStore:
return TSchemaObject::EPathType::FileStore;
- case NKikimrSchemeOp::EPathTypeKesus:
+ case NKikimrSchemeOp::EPathTypeKesus:
return TSchemaObject::EPathType::Kesus;
- case NKikimrSchemeOp::EPathTypeSolomonVolume:
- return TSchemaObject::EPathType::SolomonVolume;
+ case NKikimrSchemeOp::EPathTypeSolomonVolume:
+ return TSchemaObject::EPathType::SolomonVolume;
case NKikimrSchemeOp::EPathTypeColumnStore:
return TSchemaObject::EPathType::OlapStore;
case NKikimrSchemeOp::EPathTypeColumnTable:
return TSchemaObject::EPathType::OlapTable;
- case NKikimrSchemeOp::EPathTypeSequence:
+ case NKikimrSchemeOp::EPathTypeSequence:
return TSchemaObject::EPathType::Sequence;
case NKikimrSchemeOp::EPathTypeReplication:
return TSchemaObject::EPathType::Replication;
- case NKikimrSchemeOp::EPathTypeTableIndex:
- case NKikimrSchemeOp::EPathTypeExtSubDomain:
- case NKikimrSchemeOp::EPathTypeCdcStream:
- case NKikimrSchemeOp::EPathTypeInvalid:
- return TSchemaObject::EPathType::Unknown;
+ case NKikimrSchemeOp::EPathTypeTableIndex:
+ case NKikimrSchemeOp::EPathTypeExtSubDomain:
+ case NKikimrSchemeOp::EPathTypeCdcStream:
+ case NKikimrSchemeOp::EPathTypeInvalid:
+ return TSchemaObject::EPathType::Unknown;
}
return TSchemaObject::EPathType::Unknown;
}
@@ -232,7 +232,7 @@ TVector<TColumn> TSchemaObject::GetColumns() const {
Y_VERIFY(objects.GetPathDescription().HasTable());
const auto& table = objects.GetPathDescription().GetTable();
- TMap<ui32, NKikimrSchemeOp::TColumnDescription> columnsMap;
+ TMap<ui32, NKikimrSchemeOp::TColumnDescription> columnsMap;
for (const auto& column : table.GetColumns()) {
columnsMap[column.GetId()] = column;
}
diff --git a/ydb/public/lib/ydb_cli/commands/ydb_tools.cpp b/ydb/public/lib/ydb_cli/commands/ydb_tools.cpp
index 88e584d5e92..db4ec14d30c 100644
--- a/ydb/public/lib/ydb_cli/commands/ydb_tools.cpp
+++ b/ydb/public/lib/ydb_cli/commands/ydb_tools.cpp
@@ -282,97 +282,97 @@ int TCommandCopy::Run(TConfig& config) {
return EXIT_SUCCESS;
}
-
-////////////////////////////////////////////////////////////////////////////////
-// Rename
-////////////////////////////////////////////////////////////////////////////////
-
-TCommandRename::TCommandRename()
- : TTableCommand("rename", {}, "Rename or repalce table(s)")
-{
- TItem::DefineFields({
- {"Source", {{"source", "src"}, "Source table path", true}},
- {"Destination", {{"destination", "dst"}, "Destination table path", true}},
- {"Replace", {{"replace", "force"}, "Replace destination table with source table, no replacement by default", false}}
- });
-}
-
-void TCommandRename::Config(TConfig& config) {
- AddExamplesOption(config);
- TTableCommand::Config(config);
-
- config.SetFreeArgsNum(0);
-
- TStringBuilder itemHelp;
- itemHelp << "[At least one] Item specification" << Endl
- << " Possible property names:" << Endl
- << TItem::FormatHelp(2);
- config.Opts->AddLongOption("item", itemHelp)
- .RequiredArgument("PROPERTY=VALUE,...");
-
- AddCommandExamples(
- TExampleSetBuilder()
- .BeginExample()
- .Title("Rename one table")
- .Text("ydb tools rename --item src=table_a,dst=table_b")
- .EndExample()
-
- .BeginExample()
- .Title("Rename using full and relative paths")
- .Text("ydb tools rename --item src=/root/db/dir/table,dst=dir/other_table")
- .EndExample()
-
- .BeginExample()
- .Title("Rename several tables together")
- .Text("ydb tools rename --item src=table_a,dst=table_b --item src=table_c,dst=table_d")
- .EndExample()
-
- .BeginExample()
- .Title("Rename tables as a chain in order to replace a table without loosing it")
- .Text("ydb tools rename --item src=prod_table,dst=backup --item src=test_table,dst=prod_table")
- .EndExample()
-
- .BeginExample()
- .Title("Rename tables as a replacement in order to replace a table with new one and delete older one")
- .Text("ydb tools rename --item src=test_table,dst=prod_table,replace=true")
- .EndExample()
-
- .Build()
- );
-
- CheckExamples(config);
-}
-
-void TCommandRename::Parse(TConfig& config) {
- TClientCommand::Parse(config);
-
- Items = TItem::Parse(config, "item");
- if (Items.empty()) {
- throw TMissUseException() << "At least one item should be provided";
- }
-
- for (auto& item : Items) {
- NConsoleClient::AdjustPath(item.Source, config);
- NConsoleClient::AdjustPath(item.Destination, config);
- }
-}
-
-int TCommandRename::Run(TConfig& config) {
- TVector<NYdb::NTable::TRenameItem> renameItems;
- renameItems.reserve(Items.size());
- for (auto& item : Items) {
- renameItems.emplace_back(item.Source, item.Destination);
- if (item.Replace) {
- renameItems.back().SetReplaceDestination();
- }
- }
- ThrowOnError(
- GetSession(config).RenameTables(
- renameItems,
- FillSettings(NTable::TRenameTablesSettings())
- ).GetValueSync()
- );
- return EXIT_SUCCESS;
-}
-
+
+////////////////////////////////////////////////////////////////////////////////
+// Rename
+////////////////////////////////////////////////////////////////////////////////
+
+TCommandRename::TCommandRename()
+ : TTableCommand("rename", {}, "Rename or repalce table(s)")
+{
+ TItem::DefineFields({
+ {"Source", {{"source", "src"}, "Source table path", true}},
+ {"Destination", {{"destination", "dst"}, "Destination table path", true}},
+ {"Replace", {{"replace", "force"}, "Replace destination table with source table, no replacement by default", false}}
+ });
+}
+
+void TCommandRename::Config(TConfig& config) {
+ AddExamplesOption(config);
+ TTableCommand::Config(config);
+
+ config.SetFreeArgsNum(0);
+
+ TStringBuilder itemHelp;
+ itemHelp << "[At least one] Item specification" << Endl
+ << " Possible property names:" << Endl
+ << TItem::FormatHelp(2);
+ config.Opts->AddLongOption("item", itemHelp)
+ .RequiredArgument("PROPERTY=VALUE,...");
+
+ AddCommandExamples(
+ TExampleSetBuilder()
+ .BeginExample()
+ .Title("Rename one table")
+ .Text("ydb tools rename --item src=table_a,dst=table_b")
+ .EndExample()
+
+ .BeginExample()
+ .Title("Rename using full and relative paths")
+ .Text("ydb tools rename --item src=/root/db/dir/table,dst=dir/other_table")
+ .EndExample()
+
+ .BeginExample()
+ .Title("Rename several tables together")
+ .Text("ydb tools rename --item src=table_a,dst=table_b --item src=table_c,dst=table_d")
+ .EndExample()
+
+ .BeginExample()
+ .Title("Rename tables as a chain in order to replace a table without loosing it")
+ .Text("ydb tools rename --item src=prod_table,dst=backup --item src=test_table,dst=prod_table")
+ .EndExample()
+
+ .BeginExample()
+ .Title("Rename tables as a replacement in order to replace a table with new one and delete older one")
+ .Text("ydb tools rename --item src=test_table,dst=prod_table,replace=true")
+ .EndExample()
+
+ .Build()
+ );
+
+ CheckExamples(config);
+}
+
+void TCommandRename::Parse(TConfig& config) {
+ TClientCommand::Parse(config);
+
+ Items = TItem::Parse(config, "item");
+ if (Items.empty()) {
+ throw TMissUseException() << "At least one item should be provided";
+ }
+
+ for (auto& item : Items) {
+ NConsoleClient::AdjustPath(item.Source, config);
+ NConsoleClient::AdjustPath(item.Destination, config);
+ }
+}
+
+int TCommandRename::Run(TConfig& config) {
+ TVector<NYdb::NTable::TRenameItem> renameItems;
+ renameItems.reserve(Items.size());
+ for (auto& item : Items) {
+ renameItems.emplace_back(item.Source, item.Destination);
+ if (item.Replace) {
+ renameItems.back().SetReplaceDestination();
+ }
+ }
+ ThrowOnError(
+ GetSession(config).RenameTables(
+ renameItems,
+ FillSettings(NTable::TRenameTablesSettings())
+ ).GetValueSync()
+ );
+ return EXIT_SUCCESS;
+}
+
} // NYdb::NConsoleClient
diff --git a/ydb/public/lib/ydb_cli/commands/ydb_tools.h b/ydb/public/lib/ydb_cli/commands/ydb_tools.h
index c5b4533bf4d..3a1218a9816 100644
--- a/ydb/public/lib/ydb_cli/commands/ydb_tools.h
+++ b/ydb/public/lib/ydb_cli/commands/ydb_tools.h
@@ -87,24 +87,24 @@ private:
TString DatabaseName;
};
-class TCommandRename : public TTableCommand, public TCommandWithExamples {
-public:
- TCommandRename();
- virtual void Config(TConfig& config) override;
- virtual void Parse(TConfig& config) override;
- virtual int Run(TConfig& config) override;
-
-private:
- struct TItemFields {
- TString Source;
- TString Destination;
- bool Replace = false;
- };
- DEFINE_PARSEABLE_STRUCT(TItem, TItemFields, Source, Destination, Replace);
-
- TVector<TItem> Items;
- TString DatabaseName;
-};
-
+class TCommandRename : public TTableCommand, public TCommandWithExamples {
+public:
+ TCommandRename();
+ virtual void Config(TConfig& config) override;
+ virtual void Parse(TConfig& config) override;
+ virtual int Run(TConfig& config) override;
+
+private:
+ struct TItemFields {
+ TString Source;
+ TString Destination;
+ bool Replace = false;
+ };
+ DEFINE_PARSEABLE_STRUCT(TItem, TItemFields, Source, Destination, Replace);
+
+ TVector<TItem> Items;
+ TString DatabaseName;
+};
+
}
}
diff --git a/ydb/public/lib/ydb_cli/dump/dump.h b/ydb/public/lib/ydb_cli/dump/dump.h
index ee32170f640..877948d1056 100644
--- a/ydb/public/lib/ydb_cli/dump/dump.h
+++ b/ydb/public/lib/ydb_cli/dump/dump.h
@@ -44,7 +44,7 @@ struct TRateLimiterSettings {
}
ui32 GetRps() const {
- return Max<ui32>(1, Rate_ * TDuration::Seconds(1).MilliSeconds() / Interval_.MilliSeconds());
+ return Max<ui32>(1, Rate_ * TDuration::Seconds(1).MilliSeconds() / Interval_.MilliSeconds());
}
}; // TRateLimiterSettings
diff --git a/ydb/public/lib/ydb_cli/dump/restore_import_data.cpp b/ydb/public/lib/ydb_cli/dump/restore_import_data.cpp
index 71dad7c3047..817aa76eea3 100644
--- a/ydb/public/lib/ydb_cli/dump/restore_import_data.cpp
+++ b/ydb/public/lib/ydb_cli/dump/restore_import_data.cpp
@@ -2,7 +2,7 @@
#include <ydb/public/lib/ydb_cli/dump/util/util.h>
#include <library/cpp/string_utils/quote/quote.h>
-#include <library/cpp/bucket_quoter/bucket_quoter.h>
+#include <library/cpp/bucket_quoter/bucket_quoter.h>
#include <util/datetime/base.h>
#include <util/generic/algorithm.h>
@@ -752,8 +752,8 @@ class TDataWriter: public NPrivate::IDataWriter {
TDuration retrySleep = TDuration::MilliSeconds(500);
for (ui32 retryNumber = 0; retryNumber <= maxRetries; ++retryNumber) {
- while (!RequestLimiter.IsAvail()) {
- Sleep(Min(TDuration::MicroSeconds(RequestLimiter.GetWaitTime()), RateLimiterSettings.ReactionTime_));
+ while (!RequestLimiter.IsAvail()) {
+ Sleep(Min(TDuration::MicroSeconds(RequestLimiter.GetWaitTime()), RateLimiterSettings.ReactionTime_));
if (IsStopped()) {
return false;
}
@@ -763,8 +763,8 @@ class TDataWriter: public NPrivate::IDataWriter {
return false;
}
- RequestLimiter.Use(1);
-
+ RequestLimiter.Use(1);
+
auto importResult = ImportClient.ImportData(Path, data, Settings).GetValueSync();
if (importResult.IsSuccess()) {
@@ -842,7 +842,7 @@ public:
, TableClient(tableClient)
, Accumulator(dynamic_cast<TDataAccumulator*>(accumulator))
, RateLimiterSettings(settings.RateLimiterSettings_)
- , RequestLimiter(RateLimiterSettings.GetRps(), RateLimiterSettings.GetRps())
+ , RequestLimiter(RateLimiterSettings.GetRps(), RateLimiterSettings.GetRps())
{
Y_ENSURE(Accumulator);
@@ -878,8 +878,8 @@ private:
TDataAccumulator* Accumulator;
const TRateLimiterSettings RateLimiterSettings;
-
- using TRpsLimiter = TBucketQuoter<ui64>;
+
+ using TRpsLimiter = TBucketQuoter<ui64>;
TRpsLimiter RequestLimiter;
THolder<IThreadPool> TasksQueue;
diff --git a/ydb/public/sdk/cpp/client/ydb_driver/driver.cpp b/ydb/public/sdk/cpp/client/ydb_driver/driver.cpp
index a475a0faa94..de17c6e679c 100644
--- a/ydb/public/sdk/cpp/client/ydb_driver/driver.cpp
+++ b/ydb/public/sdk/cpp/client/ydb_driver/driver.cpp
@@ -94,7 +94,7 @@ TDriverConfig& TDriverConfig::SetNetworkThreadsNum(size_t sz) {
}
TDriverConfig& TDriverConfig::SetClientThreadsNum(size_t sz) {
- Impl_->ClientThreadsNum = sz;
+ Impl_->ClientThreadsNum = sz;
return *this;
}
diff --git a/ydb/public/sdk/cpp/client/ydb_table/table.cpp b/ydb/public/sdk/cpp/client/ydb_table/table.cpp
index ee7b39ce671..610fec38847 100644
--- a/ydb/public/sdk/cpp/client/ydb_table/table.cpp
+++ b/ydb/public/sdk/cpp/client/ydb_table/table.cpp
@@ -1447,8 +1447,8 @@ NThreading::TFuture<TResponse> InjectSessionStatusInterception(
return promise.GetFuture();
}
-static ui32 CalcBackoffTime(const TBackoffSettings& settings, ui32 retryNumber) {
- ui32 backoffSlots = 1 << std::min(retryNumber, settings.Ceiling_);
+static ui32 CalcBackoffTime(const TBackoffSettings& settings, ui32 retryNumber) {
+ ui32 backoffSlots = 1 << std::min(retryNumber, settings.Ceiling_);
TDuration maxDuration = settings.SlotDuration_ * backoffSlots;
double uncertaintyRatio = std::max(std::min(settings.UncertainRatio_, 1.0), 0.0);
@@ -1551,7 +1551,7 @@ public:
Connections_->ScheduleOneTimeTask(std::move(fn), timeout);
}
- void AsyncBackoff(const TBackoffSettings& settings, ui32 retryNumber, const std::function<void()>& fn) {
+ void AsyncBackoff(const TBackoffSettings& settings, ui32 retryNumber, const std::function<void()>& fn) {
auto durationMs = CalcBackoffTime(settings, retryNumber);
ScheduleTask(fn, TDuration::MilliSeconds(durationMs));
}
@@ -2069,23 +2069,23 @@ public:
}
TFuture<TStatus> CopyTables(Ydb::Table::CopyTablesRequest&& request, const TCopyTablesSettings& settings)
- {
- return RunSimple<Ydb::Table::V1::TableService, Ydb::Table::CopyTablesRequest, Ydb::Table::CopyTablesResponse>(
- std::move(request),
- &Ydb::Table::V1::TableService::Stub::AsyncCopyTables,
+ {
+ return RunSimple<Ydb::Table::V1::TableService, Ydb::Table::CopyTablesRequest, Ydb::Table::CopyTablesResponse>(
+ std::move(request),
+ &Ydb::Table::V1::TableService::Stub::AsyncCopyTables,
+ TRpcRequestSettings::Make(settings),
+ settings.ClientTimeout_);
+ }
+
+ TFuture<TStatus> RenameTables(Ydb::Table::RenameTablesRequest&& request, const TRenameTablesSettings& settings)
+ {
+ return RunSimple<Ydb::Table::V1::TableService, Ydb::Table::RenameTablesRequest, Ydb::Table::RenameTablesResponse>(
+ std::move(request),
+ &Ydb::Table::V1::TableService::Stub::AsyncRenameTables,
TRpcRequestSettings::Make(settings),
settings.ClientTimeout_);
- }
-
- TFuture<TStatus> RenameTables(Ydb::Table::RenameTablesRequest&& request, const TRenameTablesSettings& settings)
- {
- return RunSimple<Ydb::Table::V1::TableService, Ydb::Table::RenameTablesRequest, Ydb::Table::RenameTablesResponse>(
- std::move(request),
- &Ydb::Table::V1::TableService::Stub::AsyncRenameTables,
- TRpcRequestSettings::Make(settings),
- settings.ClientTimeout_);
- }
-
+ }
+
TFuture<TStatus> DropTable(const TString& sessionId, const TString& path, const TDropTableSettings& settings) {
auto request = MakeOperationRequest<Ydb::Table::DropTableRequest>(settings);
request.set_session_id(sessionId);
@@ -3235,7 +3235,7 @@ struct TRetryState {
THandleStatusFunc HandleStatusFunc;
};
-static void Backoff(const TBackoffSettings& settings, ui32 retryNumber) {
+static void Backoff(const TBackoffSettings& settings, ui32 retryNumber) {
auto durationMs = CalcBackoffTime(settings, retryNumber);
Sleep(TDuration::MilliSeconds(durationMs));
}
@@ -3286,7 +3286,7 @@ protected:
if (status.IsSuccess()) {
return self->Promise.SetValue(status);
}
-
+
if (self->RetryNumber >= self->Settings.MaxRetries_) {
return self->Promise.SetValue(status);
}
@@ -3450,15 +3450,15 @@ TStatus TTableClient::RetryOperationSyncHelper(const TOperationWrapperSyncFunc&
case EStatus::OVERLOADED:
case EStatus::CLIENT_RESOURCE_EXHAUSTED: {
- Backoff(settings.SlowBackoffSettings_, retryNumber);
+ Backoff(settings.SlowBackoffSettings_, retryNumber);
+ break;
+ }
+
+ case EStatus::UNAVAILABLE:{
+ Backoff(settings.FastBackoffSettings_, retryNumber);
break;
}
- case EStatus::UNAVAILABLE:{
- Backoff(settings.FastBackoffSettings_, retryNumber);
- break;
- }
-
case EStatus::BAD_SESSION:
case EStatus::SESSION_BUSY:
retryState.Session.Clear();
@@ -3814,42 +3814,42 @@ TAsyncOperation TSession::AlterTableLong(const TString& path, const TAlterTableS
GetMinTimeToTouch(Client_->Settings_.SessionPoolSettings_));
}
-TAsyncStatus TSession::RenameTables(const TVector<TRenameItem>& renameItems, const TRenameTablesSettings& settings) {
- auto request = MakeOperationRequest<Ydb::Table::RenameTablesRequest>(settings);
- request.set_session_id(SessionImpl_->GetId());
-
- for (const auto& item: renameItems) {
- auto add = request.add_tables();
- add->set_source_path(item.SourcePath());
- add->set_destination_path(item.DestinationPath());
- add->set_replace_destination(item.ReplaceDestination());
- }
-
- return InjectSessionStatusInterception(
- SessionImpl_,
- Client_->RenameTables(std::move(request), settings),
- false,
- GetMinTimeToTouch(Client_->Settings_.SessionPoolSettings_));
-}
-
-TAsyncStatus TSession::CopyTables(const TVector<TCopyItem>& copyItems, const TCopyTablesSettings& settings) {
- auto request = MakeOperationRequest<Ydb::Table::CopyTablesRequest>(settings);
- request.set_session_id(SessionImpl_->GetId());
-
- for (const auto& item: copyItems) {
- auto add = request.add_tables();
- add->set_source_path(item.SourcePath());
- add->set_destination_path(item.DestinationPath());
- add->set_omit_indexes(item.OmitIndexes());
- }
-
- return InjectSessionStatusInterception(
- SessionImpl_,
+TAsyncStatus TSession::RenameTables(const TVector<TRenameItem>& renameItems, const TRenameTablesSettings& settings) {
+ auto request = MakeOperationRequest<Ydb::Table::RenameTablesRequest>(settings);
+ request.set_session_id(SessionImpl_->GetId());
+
+ for (const auto& item: renameItems) {
+ auto add = request.add_tables();
+ add->set_source_path(item.SourcePath());
+ add->set_destination_path(item.DestinationPath());
+ add->set_replace_destination(item.ReplaceDestination());
+ }
+
+ return InjectSessionStatusInterception(
+ SessionImpl_,
+ Client_->RenameTables(std::move(request), settings),
+ false,
+ GetMinTimeToTouch(Client_->Settings_.SessionPoolSettings_));
+}
+
+TAsyncStatus TSession::CopyTables(const TVector<TCopyItem>& copyItems, const TCopyTablesSettings& settings) {
+ auto request = MakeOperationRequest<Ydb::Table::CopyTablesRequest>(settings);
+ request.set_session_id(SessionImpl_->GetId());
+
+ for (const auto& item: copyItems) {
+ auto add = request.add_tables();
+ add->set_source_path(item.SourcePath());
+ add->set_destination_path(item.DestinationPath());
+ add->set_omit_indexes(item.OmitIndexes());
+ }
+
+ return InjectSessionStatusInterception(
+ SessionImpl_,
Client_->CopyTables(std::move(request), settings),
- false,
- GetMinTimeToTouch(Client_->Settings_.SessionPoolSettings_));
-}
-
+ false,
+ GetMinTimeToTouch(Client_->Settings_.SessionPoolSettings_));
+}
+
TFuture<TStatus> TSession::CopyTable(const TString& src, const TString& dst, const TCopyTableSettings& settings) {
return InjectSessionStatusInterception(
SessionImpl_,
@@ -4245,58 +4245,58 @@ std::function<void(TSession::TImpl*)> TSession::TImpl::GetSmartDeleter(std::shar
};
}
-////////////////////////////////////////////////////////////////////////////////
-
-TCopyItem::TCopyItem(const TString& source, const TString& destination)
- : Source_(source)
- , Destination_(destination)
- , OmitIndexes_(false) {
-}
-
-const TString& TCopyItem::SourcePath() const {
- return Source_;
-}
-
-const TString& TCopyItem::DestinationPath() const {
- return Destination_;
-}
-
-TCopyItem& TCopyItem::SetOmitIndexes() {
- OmitIndexes_ = true;
- return *this;
-}
-
-bool TCopyItem::OmitIndexes() const {
- return OmitIndexes_;
-}
-
////////////////////////////////////////////////////////////////////////////////
-TRenameItem::TRenameItem(const TString& source, const TString& destination)
- : Source_(source)
- , Destination_(destination)
- , ReplaceDestination_(false) {
-}
-
-const TString& TRenameItem::SourcePath() const {
- return Source_;
-}
-
-const TString& TRenameItem::DestinationPath() const {
- return Destination_;
-}
-
-TRenameItem& TRenameItem::SetReplaceDestination() {
- ReplaceDestination_ = true;
- return *this;
-}
-
-bool TRenameItem::ReplaceDestination() const {
- return ReplaceDestination_;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-
+TCopyItem::TCopyItem(const TString& source, const TString& destination)
+ : Source_(source)
+ , Destination_(destination)
+ , OmitIndexes_(false) {
+}
+
+const TString& TCopyItem::SourcePath() const {
+ return Source_;
+}
+
+const TString& TCopyItem::DestinationPath() const {
+ return Destination_;
+}
+
+TCopyItem& TCopyItem::SetOmitIndexes() {
+ OmitIndexes_ = true;
+ return *this;
+}
+
+bool TCopyItem::OmitIndexes() const {
+ return OmitIndexes_;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
+TRenameItem::TRenameItem(const TString& source, const TString& destination)
+ : Source_(source)
+ , Destination_(destination)
+ , ReplaceDestination_(false) {
+}
+
+const TString& TRenameItem::SourcePath() const {
+ return Source_;
+}
+
+const TString& TRenameItem::DestinationPath() const {
+ return Destination_;
+}
+
+TRenameItem& TRenameItem::SetReplaceDestination() {
+ ReplaceDestination_ = true;
+ return *this;
+}
+
+bool TRenameItem::ReplaceDestination() const {
+ return ReplaceDestination_;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+
TIndexDescription::TIndexDescription(const TString& name, EIndexType type,
const TVector<TString>& indexColumns, const TVector<TString>& dataColumns)
: IndexName_(name)
diff --git a/ydb/public/sdk/cpp/client/ydb_table/table.h b/ydb/public/sdk/cpp/client/ydb_table/table.h
index abdff34d577..42d21d2fec7 100644
--- a/ydb/public/sdk/cpp/client/ydb_table/table.h
+++ b/ydb/public/sdk/cpp/client/ydb_table/table.h
@@ -730,40 +730,40 @@ inline TTableBuilder& TTablePartitioningSettingsBuilder::EndPartitioningSettings
////////////////////////////////////////////////////////////////////////////////
-class TCopyItem {
-public:
- TCopyItem(const TString& source, const TString& destination);
-
- const TString& SourcePath() const;
- const TString& DestinationPath() const;
-
- TCopyItem& SetOmitIndexes();
- bool OmitIndexes() const;
-private:
- TString Source_;
- TString Destination_;
- bool OmitIndexes_;
-};
-
-////////////////////////////////////////////////////////////////////////////////
-
-class TRenameItem {
-public:
- TRenameItem(const TString& source, const TString& destination);
-
- const TString& SourcePath() const;
- const TString& DestinationPath() const;
-
- TRenameItem& SetReplaceDestination();
- bool ReplaceDestination() const;
-private:
- TString Source_;
- TString Destination_;
- bool ReplaceDestination_;
-};
-
-////////////////////////////////////////////////////////////////////////////////
-
+class TCopyItem {
+public:
+ TCopyItem(const TString& source, const TString& destination);
+
+ const TString& SourcePath() const;
+ const TString& DestinationPath() const;
+
+ TCopyItem& SetOmitIndexes();
+ bool OmitIndexes() const;
+private:
+ TString Source_;
+ TString Destination_;
+ bool OmitIndexes_;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+
+class TRenameItem {
+public:
+ TRenameItem(const TString& source, const TString& destination);
+
+ const TString& SourcePath() const;
+ const TString& DestinationPath() const;
+
+ TRenameItem& SetReplaceDestination();
+ bool ReplaceDestination() const;
+private:
+ TString Source_;
+ TString Destination_;
+ bool ReplaceDestination_;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+
class TCreateSessionResult;
class TDataQueryResult;
class TTablePartIterator;
@@ -793,37 +793,37 @@ using TAsyncScanQueryPartIterator = NThreading::TFuture<TScanQueryPartIterator>;
struct TCreateSessionSettings : public TOperationRequestSettings<TCreateSessionSettings> {};
-struct TBackoffSettings {
- using TSelf = TBackoffSettings;
-
- FLUENT_SETTING_DEFAULT(TDuration, SlotDuration, TDuration::Seconds(1));
- FLUENT_SETTING_DEFAULT(ui32, Ceiling, 6);
- FLUENT_SETTING_DEFAULT(double, UncertainRatio, 0.5);
-};
-
+struct TBackoffSettings {
+ using TSelf = TBackoffSettings;
+
+ FLUENT_SETTING_DEFAULT(TDuration, SlotDuration, TDuration::Seconds(1));
+ FLUENT_SETTING_DEFAULT(ui32, Ceiling, 6);
+ FLUENT_SETTING_DEFAULT(double, UncertainRatio, 0.5);
+};
+
struct TRetryOperationSettings {
using TSelf = TRetryOperationSettings;
FLUENT_SETTING_DEFAULT(ui32, MaxRetries, 10);
FLUENT_SETTING_DEFAULT(bool, RetryNotFound, true);
FLUENT_SETTING_DEFAULT(TDuration, GetSessionClientTimeout, TDuration::Seconds(5));
- FLUENT_SETTING_DEFAULT(TBackoffSettings, FastBackoffSettings, DefaultFastBackoffSettings());
- FLUENT_SETTING_DEFAULT(TBackoffSettings, SlowBackoffSettings, DefaultSlowBackoffSettings());
+ FLUENT_SETTING_DEFAULT(TBackoffSettings, FastBackoffSettings, DefaultFastBackoffSettings());
+ FLUENT_SETTING_DEFAULT(TBackoffSettings, SlowBackoffSettings, DefaultSlowBackoffSettings());
FLUENT_SETTING_FLAG(Idempotent);
-
- static TBackoffSettings DefaultFastBackoffSettings() {
- return TBackoffSettings()
- .Ceiling(10)
- .SlotDuration(TDuration::MilliSeconds(5))
- .UncertainRatio(0.5);
- }
-
- static TBackoffSettings DefaultSlowBackoffSettings() {
- return TBackoffSettings()
- .Ceiling(6)
- .SlotDuration(TDuration::Seconds(1))
- .UncertainRatio(0.5);
- }
+
+ static TBackoffSettings DefaultFastBackoffSettings() {
+ return TBackoffSettings()
+ .Ceiling(10)
+ .SlotDuration(TDuration::MilliSeconds(5))
+ .UncertainRatio(0.5);
+ }
+
+ static TBackoffSettings DefaultSlowBackoffSettings() {
+ return TBackoffSettings()
+ .Ceiling(6)
+ .SlotDuration(TDuration::Seconds(1))
+ .UncertainRatio(0.5);
+ }
};
struct TSessionPoolSettings {
@@ -1428,10 +1428,10 @@ inline TAlterTableSettings& TAlterPartitioningSettingsBuilder::EndAlterPartition
struct TCopyTableSettings : public TOperationRequestSettings<TCopyTableSettings> {};
-struct TCopyTablesSettings : public TOperationRequestSettings<TCopyTablesSettings> {};
-
-struct TRenameTablesSettings : public TOperationRequestSettings<TRenameTablesSettings> {};
-
+struct TCopyTablesSettings : public TOperationRequestSettings<TCopyTablesSettings> {};
+
+struct TRenameTablesSettings : public TOperationRequestSettings<TRenameTablesSettings> {};
+
struct TDescribeTableSettings : public TOperationRequestSettings<TDescribeTableSettings> {
FLUENT_SETTING_DEFAULT(bool, WithKeyShardBoundary, false);
FLUENT_SETTING_DEFAULT(bool, WithTableStatistics, false);
@@ -1503,12 +1503,12 @@ public:
TAsyncStatus CopyTable(const TString& src, const TString& dst,
const TCopyTableSettings& settings = TCopyTableSettings());
- TAsyncStatus CopyTables(const TVector<TCopyItem>& copyItems,
- const TCopyTablesSettings& settings = TCopyTablesSettings());
-
- TAsyncStatus RenameTables(const TVector<TRenameItem>& renameItems,
- const TRenameTablesSettings& settings = TRenameTablesSettings());
-
+ TAsyncStatus CopyTables(const TVector<TCopyItem>& copyItems,
+ const TCopyTablesSettings& settings = TCopyTablesSettings());
+
+ TAsyncStatus RenameTables(const TVector<TRenameItem>& renameItems,
+ const TRenameTablesSettings& settings = TRenameTablesSettings());
+
TAsyncDescribeTableResult DescribeTable(const TString& path,
const TDescribeTableSettings& settings = TDescribeTableSettings());
diff --git a/ydb/public/sdk/python/CHANGELOG.md b/ydb/public/sdk/python/CHANGELOG.md
index 6b8f3baad0a..139ce6f71fc 100644
--- a/ydb/public/sdk/python/CHANGELOG.md
+++ b/ydb/public/sdk/python/CHANGELOG.md
@@ -16,12 +16,12 @@
* speedup driver initialization and first driver.wait
-## 1.1.10 ##
+## 1.1.10 ##
+
+ * add methods to request `_apis.TableService.RenameTables` call
+ * by now the call is disabled at the server side
+ * it will be enabled soon
- * add methods to request `_apis.TableService.RenameTables` call
- * by now the call is disabled at the server side
- * it will be enabled soon
-
## 1.1.0 ##
* remove useless `from_bytes` for PY3
diff --git a/ydb/public/sdk/python/ydb/_session_impl.py b/ydb/public/sdk/python/ydb/_session_impl.py
index 71e2cef2273..e1906299ecd 100644
--- a/ydb/public/sdk/python/ydb/_session_impl.py
+++ b/ydb/public/sdk/python/ydb/_session_impl.py
@@ -59,16 +59,16 @@ def copy_tables_request_factory(session_state, source_destination_pairs):
return request
-def rename_tables_request_factory(session_state, rename_items):
- request = session_state.attach_request(_apis.ydb_table.RenameTablesRequest())
- for item in rename_items:
- table_item = request.tables.add()
- table_item.source_path = item.source_path
- table_item.destination_path = item.destination_path
- table_item.replace_destination = item.replace_destination
- return request
-
-
+def rename_tables_request_factory(session_state, rename_items):
+ request = session_state.attach_request(_apis.ydb_table.RenameTablesRequest())
+ for item in rename_items:
+ table_item = request.tables.add()
+ table_item.source_path = item.source_path
+ table_item.destination_path = item.destination_path
+ table_item.replace_destination = item.replace_destination
+ return request
+
+
def explain_data_query_request_factory(session_state, yql_text):
request = session_state.start_query().attach_request(
_apis.ydb_table.ExplainDataQueryRequest()
diff --git a/ydb/public/sdk/python/ydb/aio/table.py b/ydb/public/sdk/python/ydb/aio/table.py
index b02c577a93e..f5e4fd97960 100644
--- a/ydb/public/sdk/python/ydb/aio/table.py
+++ b/ydb/public/sdk/python/ydb/aio/table.py
@@ -136,7 +136,7 @@ class Session(BaseSession):
async def rename_tables(self, rename_items, settings=None): # pylint: disable=W0236
return await super().rename_tables(rename_items, settings)
-
+
class TableClient(BaseTableClient):
def session(self):
return Session(self._driver, self._table_client_settings)
diff --git a/ydb/public/sdk/python/ydb/table.py b/ydb/public/sdk/python/ydb/table.py
index f2d2ab3b5ed..c49c4660c7c 100644
--- a/ydb/public/sdk/python/ydb/table.py
+++ b/ydb/public/sdk/python/ydb/table.py
@@ -833,22 +833,22 @@ class StaleReadOnly(AbstractTransactionModeBuilder):
return self._name
-class BackoffSettings(object):
+class BackoffSettings(object):
def __init__(self, ceiling=6, slot_duration=0.001, uncertain_ratio=0.5):
- self.ceiling = ceiling
- self.slot_duration = slot_duration
- self.uncertain_ratio = uncertain_ratio
-
- def calc_timeout(self, retry_number):
- slots_count = 1 << min(retry_number, self.ceiling)
+ self.ceiling = ceiling
+ self.slot_duration = slot_duration
+ self.uncertain_ratio = uncertain_ratio
+
+ def calc_timeout(self, retry_number):
+ slots_count = 1 << min(retry_number, self.ceiling)
max_duration_ms = slots_count * self.slot_duration * 1000.0
- # duration_ms = random.random() * max_duration_ms * uncertain_ratio) + max_duration_ms * (1 - uncertain_ratio)
+ # duration_ms = random.random() * max_duration_ms * uncertain_ratio) + max_duration_ms * (1 - uncertain_ratio)
duration_ms = max_duration_ms * (
random.random() * self.uncertain_ratio + 1.0 - self.uncertain_ratio
)
return duration_ms / 1000.0
-
-
+
+
class RetrySettings(object):
def __init__(
self,
@@ -887,13 +887,13 @@ class RetrySettings(object):
self.max_session_acquire_timeout, self.get_session_client_timeout
)
- def with_fast_backoff(self, backoff_settings):
- self.fast_backoff = backoff_settings
- return self
+ def with_fast_backoff(self, backoff_settings):
+ self.fast_backoff = backoff_settings
+ return self
- def with_slow_backoff(self, backoff_settings):
- self.slow_backoff = backoff_settings
- return self
+ def with_slow_backoff(self, backoff_settings):
+ self.slow_backoff = backoff_settings
+ return self
class YdbRetryOperationSleepOpt(object):
@@ -951,13 +951,13 @@ def retry_operation_impl(callee, retry_settings=None, *args, **kwargs):
retry_settings.slow_backoff.calc_timeout(attempt)
)
- except issues.Unavailable as e:
- status = e
- retry_settings.on_ydb_error_callback(e)
+ except issues.Unavailable as e:
+ status = e
+ retry_settings.on_ydb_error_callback(e)
yield YdbRetryOperationSleepOpt(
retry_settings.fast_backoff.calc_timeout(attempt)
)
-
+
except issues.Undetermined as e:
status = e
retry_settings.on_ydb_error_callback(e)
@@ -1490,25 +1490,25 @@ class TableSchemeEntry(scheme.SchemeEntry):
self.attributes = attributes
-class RenameItem:
- def __init__(self, source_path, destination_path, replace_destination=False):
- self._source_path = source_path
- self._destination_path = destination_path
- self._replace_destination = replace_destination
-
- @property
- def source_path(self):
- return self._source_path
-
- @property
- def destination_path(self):
- return self._destination_path
-
- @property
- def replace_destination(self):
- return self._replace_destination
-
-
+class RenameItem:
+ def __init__(self, source_path, destination_path, replace_destination=False):
+ self._source_path = source_path
+ self._destination_path = destination_path
+ self._replace_destination = replace_destination
+
+ @property
+ def source_path(self):
+ return self._source_path
+
+ @property
+ def destination_path(self):
+ return self._destination_path
+
+ @property
+ def replace_destination(self):
+ return self._replace_destination
+
+
class BaseSession(ISession):
def __init__(self, driver, table_client_settings):
self._driver = driver
@@ -1787,18 +1787,18 @@ class BaseSession(ISession):
self._state.endpoint,
)
- def rename_tables(self, rename_items, settings=None):
- return self._driver(
- _session_impl.rename_tables_request_factory(self._state, rename_items),
- _apis.TableService.Stub,
- _apis.TableService.RenameTables,
- _session_impl.wrap_operation,
- settings,
- (self._state,),
- self._state.endpoint,
- )
-
-
+ def rename_tables(self, rename_items, settings=None):
+ return self._driver(
+ _session_impl.rename_tables_request_factory(self._state, rename_items),
+ _apis.TableService.Stub,
+ _apis.TableService.RenameTables,
+ _session_impl.wrap_operation,
+ settings,
+ (self._state,),
+ self._state.endpoint,
+ )
+
+
class Session(BaseSession):
def async_read_table(
self,
@@ -2005,18 +2005,18 @@ class Session(BaseSession):
)
@_utilities.wrap_async_call_exceptions
- def async_rename_tables(self, rename_tables, settings=None):
- return self._driver.future(
- _session_impl.rename_tables_request_factory(self._state, rename_tables),
- _apis.TableService.Stub,
- _apis.TableService.RenameTables,
- _session_impl.wrap_operation,
- settings,
- (self._state,),
- self._state.endpoint,
- )
-
- @_utilities.wrap_async_call_exceptions
+ def async_rename_tables(self, rename_tables, settings=None):
+ return self._driver.future(
+ _session_impl.rename_tables_request_factory(self._state, rename_tables),
+ _apis.TableService.Stub,
+ _apis.TableService.RenameTables,
+ _session_impl.wrap_operation,
+ settings,
+ (self._state,),
+ self._state.endpoint,
+ )
+
+ @_utilities.wrap_async_call_exceptions
def async_describe_table(self, path, settings=None):
return self._driver.future(
_session_impl.describe_table_request_factory(self._state, path, settings),
diff --git a/ydb/services/cms/cms_ut.cpp b/ydb/services/cms/cms_ut.cpp
index 8061c264632..7d5234715e0 100644
--- a/ydb/services/cms/cms_ut.cpp
+++ b/ydb/services/cms/cms_ut.cpp
@@ -41,7 +41,7 @@ struct TCmsTestSettingsWithAuth : TCmsTestSettings {
using TKikimrWithGrpcAndRootSchema = NYdb::TBasicKikimrWithGrpcAndRootSchema<TCmsTestSettings>;
-static Ydb::StatusIds::StatusCode WaitForOperationStatus(std::shared_ptr<grpc::Channel> channel, const TString& opId, const TString &token = "") {
+static Ydb::StatusIds::StatusCode WaitForOperationStatus(std::shared_ptr<grpc::Channel> channel, const TString& opId, const TString &token = "") {
std::unique_ptr<Ydb::Operation::V1::OperationService::Stub> stub;
stub = Ydb::Operation::V1::OperationService::NewStub(channel);
Ydb::Operations::GetOperationRequest request;
@@ -63,33 +63,33 @@ static Ydb::StatusIds::StatusCode WaitForOperationStatus(std::shared_ptr<grpc::C
return response.operation().status();
}
-static Ydb::Cms::GetDatabaseStatusResult WaitForTenantState(std::shared_ptr<grpc::Channel> channel, const TString& path, Ydb::Cms::GetDatabaseStatusResult::State state = Ydb::Cms::GetDatabaseStatusResult::RUNNING, const TString &token = "") {
- std::unique_ptr<Ydb::Cms::V1::CmsService::Stub> stub;
- stub = Ydb::Cms::V1::CmsService::NewStub(channel);
- Ydb::Cms::GetDatabaseStatusRequest request;
- request.set_path(path);
- Ydb::Cms::GetDatabaseStatusResponse response;
- while (true) {
- grpc::ClientContext context;
- if (token)
+static Ydb::Cms::GetDatabaseStatusResult WaitForTenantState(std::shared_ptr<grpc::Channel> channel, const TString& path, Ydb::Cms::GetDatabaseStatusResult::State state = Ydb::Cms::GetDatabaseStatusResult::RUNNING, const TString &token = "") {
+ std::unique_ptr<Ydb::Cms::V1::CmsService::Stub> stub;
+ stub = Ydb::Cms::V1::CmsService::NewStub(channel);
+ Ydb::Cms::GetDatabaseStatusRequest request;
+ request.set_path(path);
+ Ydb::Cms::GetDatabaseStatusResponse response;
+ while (true) {
+ grpc::ClientContext context;
+ if (token)
context.AddMetadata(YDB_AUTH_TICKET_HEADER, token);
-
- auto status = stub->GetDatabaseStatus(&context, request, &response);
- UNIT_ASSERT(status.ok());
-
- UNIT_ASSERT(response.operation().ready());
- UNIT_ASSERT(response.operation().status() == Ydb::StatusIds::SUCCESS);
-
- Ydb::Cms::GetDatabaseStatusResult result;
- auto res = response.operation().result().UnpackTo(&result);
- UNIT_ASSERT(res);
- UNIT_ASSERT_VALUES_EQUAL(result.path(), path);
- if (result.state() == state) {
- return result;
- }
- }
-}
-
+
+ auto status = stub->GetDatabaseStatus(&context, request, &response);
+ UNIT_ASSERT(status.ok());
+
+ UNIT_ASSERT(response.operation().ready());
+ UNIT_ASSERT(response.operation().status() == Ydb::StatusIds::SUCCESS);
+
+ Ydb::Cms::GetDatabaseStatusResult result;
+ auto res = response.operation().result().UnpackTo(&result);
+ UNIT_ASSERT(res);
+ UNIT_ASSERT_VALUES_EQUAL(result.path(), path);
+ if (result.state() == state) {
+ return result;
+ }
+ }
+}
+
void InitConsoleConfig(TKikimrWithGrpcAndRootSchema &server)
{
TClient client(*server.ServerSettings);
@@ -165,7 +165,7 @@ static void doSimpleTenantsTest(bool sync) {
id = response.operation().id();
}
}
-
+
if (!sync) {
auto status = WaitForOperationStatus(channel, id);
UNIT_ASSERT_EQUAL(status, Ydb::StatusIds::SUCCESS);
@@ -477,7 +477,7 @@ Y_UNIT_TEST_SUITE(TGRpcCmsTest) {
Y_UNIT_TEST(AlterRemoveTest) {
TKikimrWithGrpcAndRootSchema server;
server.Server_->GetRuntime()->SetLogPriority(NKikimrServices::CMS_TENANTS, NLog::PRI_TRACE);
-
+
ui16 grpc = server.GetPort();
TString id;
diff --git a/ydb/services/datastreams/datastreams_proxy.cpp b/ydb/services/datastreams/datastreams_proxy.cpp
index d8d9ba79c34..03a6d06213b 100644
--- a/ydb/services/datastreams/datastreams_proxy.cpp
+++ b/ydb/services/datastreams/datastreams_proxy.cpp
@@ -38,7 +38,7 @@ namespace NKikimr::NDataStreams::V1 {
}
template<class TRequest>
- bool ValidateRetentionPeriod(const TRequest& req, const NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
+ bool ValidateRetentionPeriod(const TRequest& req, const NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
TMaybe<bool> increase, TString& errorText)
{
if (req.retention_period_hours() > 24) {
@@ -69,7 +69,7 @@ namespace NKikimr::NDataStreams::V1 {
}
template<class TRequest>
- bool ValidateShardsCount(const TRequest& req, const NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig, TString& errorText) {
+ bool ValidateShardsCount(const TRequest& req, const NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig, TString& errorText) {
if (req.target_shard_count() < (i32)groupConfig.GetTotalGroupCount()) {
errorText = TStringBuilder() << "Shard count must be non-decreasing, old value is "
<< groupConfig.GetTotalGroupCount()
@@ -138,7 +138,7 @@ namespace NKikimr::NDataStreams::V1 {
void TCreateStreamActor::FillProposeRequest(TEvTxUserProxy::TEvProposeTransaction& proposal,
const TActorContext& ctx, const TString& workingDir, const TString& name)
{
- NKikimrSchemeOp::TModifyScheme& modifyScheme(*proposal.Record.MutableTransaction()->MutableModifyScheme());
+ NKikimrSchemeOp::TModifyScheme& modifyScheme(*proposal.Record.MutableTransaction()->MutableModifyScheme());
Ydb::PersQueue::V1::TopicSettings topicSettings;
topicSettings.set_partitions_count(GetProtoRequest()->shard_count());
@@ -172,7 +172,7 @@ namespace NKikimr::NDataStreams::V1 {
auto msg = ev->Get();
const auto status = static_cast<TEvTxUserProxy::TEvProposeTransactionStatus::EStatus>(ev->Get()->Record.GetStatus());
if (status == TEvTxUserProxy::TEvProposeTransactionStatus::EStatus::ExecComplete
- && msg->Record.GetSchemeShardStatus() == NKikimrScheme::EStatus::StatusAlreadyExists)
+ && msg->Record.GetSchemeShardStatus() == NKikimrScheme::EStatus::StatusAlreadyExists)
{
return ReplyWithError(Ydb::StatusIds::ALREADY_EXISTS,
Ydb::PersQueue::ErrorCode::ERROR,
@@ -227,9 +227,9 @@ namespace NKikimr::NDataStreams::V1 {
const TString& name)
{
LOG_DEBUG_S(ctx, NKikimrServices::PQ_READ_PROXY, "WorkingDir = " << workingDir << ", name = " << name);
- NKikimrSchemeOp::TModifyScheme& modifyScheme(*proposal.Record.MutableTransaction()->MutableModifyScheme());
+ NKikimrSchemeOp::TModifyScheme& modifyScheme(*proposal.Record.MutableTransaction()->MutableModifyScheme());
modifyScheme.SetWorkingDir(workingDir);
- modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpDropPersQueueGroup);
+ modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpDropPersQueueGroup);
modifyScheme.MutableDrop()->SetName(name);
}
@@ -264,9 +264,9 @@ namespace NKikimr::NDataStreams::V1 {
void Bootstrap(const TActorContext& ctx);
void ModifyPersqueueConfig(const TActorContext& ctx,
- NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
- const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
- const NKikimrSchemeOp::TDirEntry& selfInfo);
+ NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
+ const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
+ const NKikimrSchemeOp::TDirEntry& selfInfo);
};
void TUpdateShardCountActor::Bootstrap(const TActorContext& ctx) {
@@ -277,9 +277,9 @@ namespace NKikimr::NDataStreams::V1 {
void TUpdateShardCountActor::ModifyPersqueueConfig(
const TActorContext& ctx,
- NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
- const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
- const NKikimrSchemeOp::TDirEntry& selfInfo
+ NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
+ const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
+ const NKikimrSchemeOp::TDirEntry& selfInfo
) {
Y_UNUSED(pqGroupDescription);
Y_UNUSED(selfInfo);
@@ -305,9 +305,9 @@ namespace NKikimr::NDataStreams::V1 {
void Bootstrap(const TActorContext& ctx);
void ModifyPersqueueConfig(const TActorContext& ctx,
- NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
- const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
- const NKikimrSchemeOp::TDirEntry& selfInfo);
+ NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
+ const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
+ const NKikimrSchemeOp::TDirEntry& selfInfo);
};
void TUpdateStreamActor::Bootstrap(const TActorContext& ctx) {
@@ -318,9 +318,9 @@ namespace NKikimr::NDataStreams::V1 {
void TUpdateStreamActor::ModifyPersqueueConfig(
const TActorContext& ctx,
- NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
- const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
- const NKikimrSchemeOp::TDirEntry& selfInfo
+ NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
+ const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
+ const NKikimrSchemeOp::TDirEntry& selfInfo
) {
Y_UNUSED(pqGroupDescription);
Y_UNUSED(selfInfo);
@@ -352,9 +352,9 @@ namespace NKikimr::NDataStreams::V1 {
void Bootstrap(const TActorContext& ctx);
void ModifyPersqueueConfig(const TActorContext& ctx,
- NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
- const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
- const NKikimrSchemeOp::TDirEntry& selfInfo);
+ NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
+ const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
+ const NKikimrSchemeOp::TDirEntry& selfInfo);
};
void TSetWriteQuotaActor::Bootstrap(const TActorContext& ctx) {
@@ -365,9 +365,9 @@ namespace NKikimr::NDataStreams::V1 {
void TSetWriteQuotaActor::ModifyPersqueueConfig(
const TActorContext& ctx,
- NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
- const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
- const NKikimrSchemeOp::TDirEntry& selfInfo
+ NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
+ const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
+ const NKikimrSchemeOp::TDirEntry& selfInfo
) {
Y_UNUSED(pqGroupDescription);
Y_UNUSED(selfInfo);
@@ -401,9 +401,9 @@ namespace NKikimr::NDataStreams::V1 {
void ModifyPersqueueConfig(
const TActorContext& ctx,
- NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
- const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
- const NKikimrSchemeOp::TDirEntry& selfInfo
+ NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
+ const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
+ const NKikimrSchemeOp::TDirEntry& selfInfo
) {
Y_UNUSED(pqGroupDescription);
Y_UNUSED(selfInfo);
@@ -465,8 +465,8 @@ namespace NKikimr::NDataStreams::V1 {
private:
void ReplyAndDie(const TActorContext& ctx);
- NKikimrSchemeOp::TDirEntry SelfInfo;
- NKikimrSchemeOp::TPersQueueGroupDescription PQGroup;
+ NKikimrSchemeOp::TDirEntry SelfInfo;
+ NKikimrSchemeOp::TPersQueueGroupDescription PQGroup;
std::vector<TActorId> Pipes;
ui32 RequestsInfly = 0;
std::map<ui64, std::pair<ui64, ui64>> StartEndOffsetsPerPartition;
@@ -873,10 +873,10 @@ namespace NKikimr::NDataStreams::V1 {
void Bootstrap(const NActors::TActorContext& ctx);
void ModifyPersqueueConfig(const TActorContext& ctx,
- NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
- const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
- const NKikimrSchemeOp::TDirEntry& selfInfo);
- void ReplyNotifyTxCompletionResult(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev, const TActorContext& ctx) override;
+ NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
+ const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
+ const NKikimrSchemeOp::TDirEntry& selfInfo);
+ void ReplyNotifyTxCompletionResult(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev, const TActorContext& ctx) override;
private:
TString ConsumerName;
@@ -895,9 +895,9 @@ namespace NKikimr::NDataStreams::V1 {
void TRegisterStreamConsumerActor::ModifyPersqueueConfig(
const TActorContext& ctx,
- NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
- const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
- const NKikimrSchemeOp::TDirEntry& selfInfo
+ NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
+ const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
+ const NKikimrSchemeOp::TDirEntry& selfInfo
) {
Y_UNUSED(pqGroupDescription);
@@ -925,7 +925,7 @@ namespace NKikimr::NDataStreams::V1 {
}
}
- void TRegisterStreamConsumerActor::ReplyNotifyTxCompletionResult(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev, const TActorContext& ctx) {
+ void TRegisterStreamConsumerActor::ReplyNotifyTxCompletionResult(NSchemeShard::TEvSchemeShard::TEvNotifyTxCompletionResult::TPtr& ev, const TActorContext& ctx) {
Y_UNUSED(ev);
Ydb::DataStreams::V1::RegisterStreamConsumerResult result;
auto consumer = result.Mutableconsumer();
@@ -948,9 +948,9 @@ namespace NKikimr::NDataStreams::V1 {
void Bootstrap(const NActors::TActorContext& ctx);
void ModifyPersqueueConfig(const TActorContext& ctx,
- NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
- const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
- const NKikimrSchemeOp::TDirEntry& selfInfo);
+ NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
+ const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
+ const NKikimrSchemeOp::TDirEntry& selfInfo);
private:
TString ConsumerName;
@@ -969,9 +969,9 @@ namespace NKikimr::NDataStreams::V1 {
void TDeregisterStreamConsumerActor::ModifyPersqueueConfig(
const TActorContext& ctx,
- NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
- const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
- const NKikimrSchemeOp::TDirEntry& selfInfo
+ NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
+ const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
+ const NKikimrSchemeOp::TDirEntry& selfInfo
) {
Y_UNUSED(selfInfo);
auto error = RemoveReadRuleFromConfig(
@@ -1235,7 +1235,7 @@ namespace NKikimr::NDataStreams::V1 {
}
- if (response.Self->Info.GetPathType() == NKikimrSchemeOp::EPathTypePersQueueGroup) {
+ if (response.Self->Info.GetPathType() == NKikimrSchemeOp::EPathTypePersQueueGroup) {
const auto& partitions = response.PQGroupInfo->Description.GetPartitions();
for (auto& partition : partitions) {
auto partitionId = partition.GetPartitionId();
@@ -1333,7 +1333,7 @@ namespace NKikimr::NDataStreams::V1 {
TNextToken NextToken;
ui32 MaxResults = DEFAULT_MAX_RESULTS;
std::map<ui64, std::pair<ui64, ui64>> StartEndOffsetsPerPartition;
- std::vector<NKikimrSchemeOp::TPersQueueGroupDescription::TPartition> Shards;
+ std::vector<NKikimrSchemeOp::TPersQueueGroupDescription::TPartition> Shards;
ui32 LeftToRead = 0;
ui32 AllShardsCount = 0;
std::atomic<ui32> GotOffsetResponds;
@@ -1413,7 +1413,7 @@ namespace NKikimr::NDataStreams::V1 {
}
}
- using TPartition = NKikimrSchemeOp::TPersQueueGroupDescription::TPartition;
+ using TPartition = NKikimrSchemeOp::TPersQueueGroupDescription::TPartition;
const auto& partitions = topicInfo.PQGroupInfo->Description.GetPartitions();
TString startingShardId = this->GetProtoRequest()->Getexclusive_start_shard_id();
ui64 startingTimepoint{0};
@@ -1586,8 +1586,8 @@ namespace NKikimr::NDataStreams::V1 {
private:
void SendResponse(const TActorContext& ctx);
- NKikimrSchemeOp::TDirEntry SelfInfo;
- NKikimrSchemeOp::TPersQueueGroupDescription PQGroup;
+ NKikimrSchemeOp::TDirEntry SelfInfo;
+ NKikimrSchemeOp::TPersQueueGroupDescription PQGroup;
};
TDescribeStreamSummaryActor::TDescribeStreamSummaryActor(
diff --git a/ydb/services/lib/actors/pq_schema_actor.cpp b/ydb/services/lib/actors/pq_schema_actor.cpp
index 07d0e3ffd21..f48e3984881 100644
--- a/ydb/services/lib/actors/pq_schema_actor.cpp
+++ b/ydb/services/lib/actors/pq_schema_actor.cpp
@@ -219,9 +219,9 @@ namespace NKikimr::NGRpcProxy::V1 {
}
Ydb::StatusIds::StatusCode FillProposeRequestImpl(const TString& name, const Ydb::PersQueue::V1::TopicSettings& settings,
- NKikimrSchemeOp::TModifyScheme& modifyScheme, const TActorContext& ctx, bool alter, TString& error)
+ NKikimrSchemeOp::TModifyScheme& modifyScheme, const TActorContext& ctx, bool alter, TString& error)
{
- modifyScheme.SetOperationType(alter ? NKikimrSchemeOp::EOperationType::ESchemeOpAlterPersQueueGroup : NKikimrSchemeOp::EOperationType::ESchemeOpCreatePersQueueGroup);
+ modifyScheme.SetOperationType(alter ? NKikimrSchemeOp::EOperationType::ESchemeOpAlterPersQueueGroup : NKikimrSchemeOp::EOperationType::ESchemeOpCreatePersQueueGroup);
auto pqDescr = alter ? modifyScheme.MutableAlterPersQueueGroup() : modifyScheme.MutableCreatePersQueueGroup();
pqDescr->SetName(name);
diff --git a/ydb/services/lib/actors/pq_schema_actor.h b/ydb/services/lib/actors/pq_schema_actor.h
index ad95500cac2..1be2e7fa242 100644
--- a/ydb/services/lib/actors/pq_schema_actor.h
+++ b/ydb/services/lib/actors/pq_schema_actor.h
@@ -15,7 +15,7 @@ namespace NKikimr::NGRpcProxy::V1 {
Ydb::StatusIds::StatusCode FillProposeRequestImpl(
const TString& name,
const Ydb::PersQueue::V1::TopicSettings& settings,
- NKikimrSchemeOp::TModifyScheme& modifyScheme,
+ NKikimrSchemeOp::TModifyScheme& modifyScheme,
const TActorContext& ctx,
bool alter,
TString& error
@@ -257,8 +257,8 @@ namespace NKikimr::NGRpcProxy::V1 {
{
Y_UNUSED(name);
const auto& response = DescribeSchemeResult->Get()->Request.Get()->ResultSet.front();
- NKikimrSchemeOp::TModifyScheme& modifyScheme(*proposal.Record.MutableTransaction()->MutableModifyScheme());
- modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterPersQueueGroup);
+ NKikimrSchemeOp::TModifyScheme& modifyScheme(*proposal.Record.MutableTransaction()->MutableModifyScheme());
+ modifyScheme.SetOperationType(NKikimrSchemeOp::EOperationType::ESchemeOpAlterPersQueueGroup);
modifyScheme.SetWorkingDir(workingDir);
auto* config = modifyScheme.MutableAlterPersQueueGroup();
diff --git a/ydb/services/persqueue_v1/grpc_pq_actor.h b/ydb/services/persqueue_v1/grpc_pq_actor.h
index 8f7eec5824d..65c8aca1db2 100644
--- a/ydb/services/persqueue_v1/grpc_pq_actor.h
+++ b/ydb/services/persqueue_v1/grpc_pq_actor.h
@@ -1164,9 +1164,9 @@ public:
void Bootstrap(const NActors::TActorContext &ctx);
void ModifyPersqueueConfig(const TActorContext& ctx,
- NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
- const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
- const NKikimrSchemeOp::TDirEntry& selfInfo);
+ NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
+ const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
+ const NKikimrSchemeOp::TDirEntry& selfInfo);
};
class TRemoveReadRuleActor : public TUpdateSchemeActor<TRemoveReadRuleActor, TEvPQRemoveReadRuleRequest> {
@@ -1177,9 +1177,9 @@ public:
void Bootstrap(const NActors::TActorContext &ctx);
void ModifyPersqueueConfig(const TActorContext& ctx,
- NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
- const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
- const NKikimrSchemeOp::TDirEntry& selfInfo);
+ NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
+ const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
+ const NKikimrSchemeOp::TDirEntry& selfInfo);
};
diff --git a/ydb/services/persqueue_v1/grpc_pq_schema.cpp b/ydb/services/persqueue_v1/grpc_pq_schema.cpp
index 95f3e952d6d..7756adc797b 100644
--- a/ydb/services/persqueue_v1/grpc_pq_schema.cpp
+++ b/ydb/services/persqueue_v1/grpc_pq_schema.cpp
@@ -103,9 +103,9 @@ void TDropTopicActor::FillProposeRequest(TEvTxUserProxy::TEvProposeTransaction&
const TString& workingDir, const TString& name)
{
Y_UNUSED(ctx);
- NKikimrSchemeOp::TModifyScheme& modifyScheme(*proposal.Record.MutableTransaction()->MutableModifyScheme());
+ NKikimrSchemeOp::TModifyScheme& modifyScheme(*proposal.Record.MutableTransaction()->MutableModifyScheme());
modifyScheme.SetWorkingDir(workingDir);
- modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpDropPersQueueGroup);
+ modifyScheme.SetOperationType(NKikimrSchemeOp::ESchemeOpDropPersQueueGroup);
modifyScheme.MutableDrop()->SetName(name);
}
@@ -281,9 +281,9 @@ void TAddReadRuleActor::Bootstrap(const NActors::TActorContext& ctx) {
void TAddReadRuleActor::ModifyPersqueueConfig(
const TActorContext& ctx,
- NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
- const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
- const NKikimrSchemeOp::TDirEntry& selfInfo
+ NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
+ const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
+ const NKikimrSchemeOp::TDirEntry& selfInfo
) {
Y_UNUSED(pqGroupDescription);
@@ -320,9 +320,9 @@ void TRemoveReadRuleActor::Bootstrap(const NActors::TActorContext& ctx) {
void TRemoveReadRuleActor::ModifyPersqueueConfig(
const TActorContext& ctx,
- NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
- const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
- const NKikimrSchemeOp::TDirEntry& selfInfo
+ NKikimrSchemeOp::TPersQueueGroupDescription& groupConfig,
+ const NKikimrSchemeOp::TPersQueueGroupDescription& pqGroupDescription,
+ const NKikimrSchemeOp::TDirEntry& selfInfo
) {
Y_UNUSED(selfInfo);
@@ -369,7 +369,7 @@ void TAlterTopicActor::Bootstrap(const NActors::TActorContext& ctx)
void TCreateTopicActor::FillProposeRequest(TEvTxUserProxy::TEvProposeTransaction& proposal, const TActorContext& ctx,
const TString& workingDir, const TString& name)
{
- NKikimrSchemeOp::TModifyScheme& modifyScheme(*proposal.Record.MutableTransaction()->MutableModifyScheme());
+ NKikimrSchemeOp::TModifyScheme& modifyScheme(*proposal.Record.MutableTransaction()->MutableModifyScheme());
modifyScheme.SetWorkingDir(workingDir);
{
@@ -398,7 +398,7 @@ void TCreateTopicActor::FillProposeRequest(TEvTxUserProxy::TEvProposeTransaction
void TAlterTopicActor::FillProposeRequest(TEvTxUserProxy::TEvProposeTransaction& proposal, const TActorContext& ctx,
const TString& workingDir, const TString& name) {
- NKikimrSchemeOp::TModifyScheme &modifyScheme(*proposal.Record.MutableTransaction()->MutableModifyScheme());
+ NKikimrSchemeOp::TModifyScheme &modifyScheme(*proposal.Record.MutableTransaction()->MutableModifyScheme());
modifyScheme.SetWorkingDir(workingDir);
TString error;
auto status = FillProposeRequestImpl(name, GetProtoRequest()->settings(), modifyScheme, ctx, true, error);
diff --git a/ydb/services/ydb/ydb_common_ut.h b/ydb/services/ydb/ydb_common_ut.h
index 226569738d8..c067928c785 100644
--- a/ydb/services/ydb/ydb_common_ut.h
+++ b/ydb/services/ydb/ydb_common_ut.h
@@ -56,7 +56,7 @@ public:
ServerSettings->SetGrpcPort(grpc);
ServerSettings->SetLogBackend(logBackend);
ServerSettings->SetDomainName("Root");
- ServerSettings->SetDynamicNodeCount(2);
+ ServerSettings->SetDynamicNodeCount(2);
if (TestSettings::PrecreatePools) {
ServerSettings->AddStoragePool("ssd");
ServerSettings->AddStoragePool("hdd");
@@ -91,12 +91,12 @@ public:
builder(*ServerSettings);;
}
- Server_.Reset(new TServer(*ServerSettings));
- Tenants_.Reset(new Tests::TTenants(Server_));
+ Server_.Reset(new TServer(*ServerSettings));
+ Tenants_.Reset(new Tests::TTenants(Server_));
//Server_->GetRuntime()->SetLogPriority(NKikimrServices::TX_PROXY_SCHEME_CACHE, NActors::NLog::PRI_DEBUG);
//Server_->GetRuntime()->SetLogPriority(NKikimrServices::SCHEME_BOARD_REPLICA, NActors::NLog::PRI_DEBUG);
- Server_->GetRuntime()->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_INFO);
+ Server_->GetRuntime()->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_INFO);
//Server_->GetRuntime()->SetLogPriority(NKikimrServices::TX_PROXY, NActors::NLog::PRI_DEBUG);
//Server_->GetRuntime()->SetLogPriority(NKikimrServices::TX_OLAPSHARD, NActors::NLog::PRI_DEBUG);
//Server_->GetRuntime()->SetLogPriority(NKikimrServices::TX_COLUMNSHARD, NActors::NLog::PRI_DEBUG);
@@ -104,7 +104,7 @@ public:
Server_->GetRuntime()->SetLogPriority(NKikimrServices::YQL_PROXY, NActors::NLog::PRI_DEBUG);
Server_->GetRuntime()->SetLogPriority(NKikimrServices::KQP_COMPUTE, NActors::NLog::PRI_DEBUG);
}
-
+
NGrpc::TServerOptions grpcOption;
if (TestSettings::AUTH) {
grpcOption.SetUseAuth(true);
@@ -117,7 +117,7 @@ public:
grpcOption.SetSslData(sslData);
}
Server_->EnableGRpc(grpcOption);
-
+
TClient annoyingClient(*ServerSettings);
if (ServerSettings->AppConfig.GetDomainsConfig().GetSecurityConfig().GetEnforceUserTokenRequirement()) {
annoyingClient.SetSecurityToken("root@builtin");
@@ -149,8 +149,8 @@ public:
}
TServerSettings::TPtr ServerSettings;
- Tests::TServer::TPtr Server_;
- THolder<Tests::TTenants> Tenants_;
+ Tests::TServer::TPtr Server_;
+ THolder<Tests::TTenants> Tenants_;
private:
TPortManager PortManager;
ui16 GRpcPort_;
diff --git a/ydb/services/ydb/ydb_coordination_ut.cpp b/ydb/services/ydb/ydb_coordination_ut.cpp
index 5eb7ec910f4..54c973a7e85 100644
--- a/ydb/services/ydb/ydb_coordination_ut.cpp
+++ b/ydb/services/ydb/ydb_coordination_ut.cpp
@@ -647,7 +647,7 @@ Y_UNIT_TEST_SUITE(TGRpcNewCoordinationClientAuth) {
{ "ydb.deprecated.create_table" }))
));
- TClient::RefreshPathCache(server.Server_->GetRuntime(), "/Root");
+ TClient::RefreshPathCache(server.Server_->GetRuntime(), "/Root");
}
// Make some requests with user_a
@@ -682,8 +682,8 @@ Y_UNIT_TEST_SUITE(TGRpcNewCoordinationClientAuth) {
.AddGrantPermissions(TPermissions(
"user_b@builtin",
std::move(permissions)))));
-
- TClient::RefreshPathCache(server.Server_->GetRuntime(), path);
+
+ TClient::RefreshPathCache(server.Server_->GetRuntime(), path);
}
}
diff --git a/ydb/services/ydb/ydb_table.cpp b/ydb/services/ydb/ydb_table.cpp
index c7efe016655..7189614b8e8 100644
--- a/ydb/services/ydb/ydb_table.cpp
+++ b/ydb/services/ydb/ydb_table.cpp
@@ -79,12 +79,12 @@ void TGRpcYdbTableService::SetupIncomingRequests(NGrpc::TLoggerPtr logger) {
ADD_REQUEST(CopyTable, CopyTableRequest, CopyTableResponse, {
ActorSystem_->Send(GRpcRequestProxyId_, new TEvCopyTableRequest(ctx));
})
- ADD_REQUEST(CopyTables, CopyTablesRequest, CopyTablesResponse, {
- ActorSystem_->Send(GRpcRequestProxyId_, new TEvCopyTablesRequest(ctx));
- })
- ADD_REQUEST(RenameTables, RenameTablesRequest, RenameTablesResponse, {
- ActorSystem_->Send(GRpcRequestProxyId_, new TEvRenameTablesRequest(ctx));
- })
+ ADD_REQUEST(CopyTables, CopyTablesRequest, CopyTablesResponse, {
+ ActorSystem_->Send(GRpcRequestProxyId_, new TEvCopyTablesRequest(ctx));
+ })
+ ADD_REQUEST(RenameTables, RenameTablesRequest, RenameTablesResponse, {
+ ActorSystem_->Send(GRpcRequestProxyId_, new TEvRenameTablesRequest(ctx));
+ })
ADD_REQUEST(ExplainDataQuery, ExplainDataQueryRequest, ExplainDataQueryResponse, {
ActorSystem_->Send(GRpcRequestProxyId_, new TEvExplainDataQueryRequest(ctx));
})
diff --git a/ydb/services/ydb/ydb_table_ut.cpp b/ydb/services/ydb/ydb_table_ut.cpp
index 2c07ba23382..4861c06b92e 100644
--- a/ydb/services/ydb/ydb_table_ut.cpp
+++ b/ydb/services/ydb/ydb_table_ut.cpp
@@ -974,93 +974,93 @@ Y_UNIT_TEST_SUITE(YdbYqlClient) {
}
}
- Y_UNIT_TEST(ConnectDbAclIsStrictlyChecked) {
+ Y_UNIT_TEST(ConnectDbAclIsStrictlyChecked) {
NKikimrConfig::TAppConfig appConfig;
appConfig.MutableFeatureFlags()->SetCheckDatabaseAccessPermission(true);
- appConfig.MutableFeatureFlags()->SetAllowYdbRequestsWithoutDatabase(false);
- appConfig.MutableDomainsConfig()->MutableSecurityConfig()->SetEnforceUserTokenRequirement(true);
- appConfig.MutableDomainsConfig()->MutableSecurityConfig()->AddDefaultUserSIDs("test_user_no_rights@builtin");
- TKikimrWithGrpcAndRootSchemaWithAuth server(appConfig);
+ appConfig.MutableFeatureFlags()->SetAllowYdbRequestsWithoutDatabase(false);
+ appConfig.MutableDomainsConfig()->MutableSecurityConfig()->SetEnforceUserTokenRequirement(true);
+ appConfig.MutableDomainsConfig()->MutableSecurityConfig()->AddDefaultUserSIDs("test_user_no_rights@builtin");
+ TKikimrWithGrpcAndRootSchemaWithAuth server(appConfig);
+
+ server.Server_->GetRuntime()->SetLogPriority(NKikimrServices::GRPC_PROXY_NO_CONNECT_ACCESS, NActors::NLog::PRI_DEBUG);
- server.Server_->GetRuntime()->SetLogPriority(NKikimrServices::GRPC_PROXY_NO_CONNECT_ACCESS, NActors::NLog::PRI_DEBUG);
-
ui16 grpc = server.GetPort();
-
- { // no db
- TString location = TStringBuilder() << "localhost:" << grpc;
- auto driver = NYdb::TDriver(
- TDriverConfig()
- .SetEndpoint(location));
-
- NYdb::NTable::TClientSettings settings;
- settings.AuthToken("root@builtin");
-
- NYdb::NTable::TTableClient client(driver, settings);
- auto call = [] (NYdb::NTable::TTableClient& client) -> NYdb::TStatus {
- Cerr << "Call\n";
- return client.CreateSession().ExtractValueSync();
- };
- auto status = client.RetryOperationSync(call);
-
- UNIT_ASSERT_VALUES_EQUAL_C(status.GetStatus(), EStatus::CLIENT_UNAUTHENTICATED, status.GetIssues().ToString());
-
- }
+
+ { // no db
+ TString location = TStringBuilder() << "localhost:" << grpc;
+ auto driver = NYdb::TDriver(
+ TDriverConfig()
+ .SetEndpoint(location));
+
+ NYdb::NTable::TClientSettings settings;
+ settings.AuthToken("root@builtin");
+
+ NYdb::NTable::TTableClient client(driver, settings);
+ auto call = [] (NYdb::NTable::TTableClient& client) -> NYdb::TStatus {
+ Cerr << "Call\n";
+ return client.CreateSession().ExtractValueSync();
+ };
+ auto status = client.RetryOperationSync(call);
+
+ UNIT_ASSERT_VALUES_EQUAL_C(status.GetStatus(), EStatus::CLIENT_UNAUTHENTICATED, status.GetIssues().ToString());
+
+ }
TString location = TStringBuilder() << "localhost:" << grpc;
auto driver = NYdb::TDriver(
TDriverConfig()
- .SetEndpoint(location)
- .SetDatabase("/Root"));
+ .SetEndpoint(location)
+ .SetDatabase("/Root"));
+
+ { // no token
+ NYdb::NTable::TClientSettings settings;
+ NYdb::NTable::TTableClient client(driver, settings);
+ auto call = [] (NYdb::NTable::TTableClient& client) -> NYdb::TStatus {
+ Cerr << "Call\n";
+ return client.CreateSession().ExtractValueSync();
+ };
+ auto status = client.RetryOperationSync(call);
+
+ UNIT_ASSERT_VALUES_EQUAL_C(status.GetStatus(), EStatus::CLIENT_UNAUTHENTICATED, status.GetIssues().ToString());
+ }
+
+
+ { // empty token
+ NYdb::NTable::TClientSettings settings;
+ settings.AuthToken("");
+ NYdb::NTable::TTableClient client(driver, settings);
+
+ auto call = [] (NYdb::NTable::TTableClient& client) -> NYdb::TStatus {
+ Cerr << "Call\n";
+ return client.CreateSession().ExtractValueSync();
+ };
+ auto status = client.RetryOperationSync(call);
+
+ UNIT_ASSERT_VALUES_EQUAL_C(status.GetStatus(), EStatus::CLIENT_UNAUTHENTICATED, status.GetIssues().ToString());
+ }
+
+ { // no connect right
+ TString location = TStringBuilder() << "localhost:" << grpc;
+ auto driver = NYdb::TDriver(
+ TDriverConfig()
+ .SetEndpoint(location)
+ .SetDatabase("/Root"));
- { // no token
NYdb::NTable::TClientSettings settings;
- NYdb::NTable::TTableClient client(driver, settings);
- auto call = [] (NYdb::NTable::TTableClient& client) -> NYdb::TStatus {
- Cerr << "Call\n";
- return client.CreateSession().ExtractValueSync();
- };
- auto status = client.RetryOperationSync(call);
-
- UNIT_ASSERT_VALUES_EQUAL_C(status.GetStatus(), EStatus::CLIENT_UNAUTHENTICATED, status.GetIssues().ToString());
- }
-
-
- { // empty token
- NYdb::NTable::TClientSettings settings;
- settings.AuthToken("");
- NYdb::NTable::TTableClient client(driver, settings);
-
- auto call = [] (NYdb::NTable::TTableClient& client) -> NYdb::TStatus {
- Cerr << "Call\n";
- return client.CreateSession().ExtractValueSync();
- };
- auto status = client.RetryOperationSync(call);
-
- UNIT_ASSERT_VALUES_EQUAL_C(status.GetStatus(), EStatus::CLIENT_UNAUTHENTICATED, status.GetIssues().ToString());
- }
-
- { // no connect right
- TString location = TStringBuilder() << "localhost:" << grpc;
- auto driver = NYdb::TDriver(
- TDriverConfig()
- .SetEndpoint(location)
- .SetDatabase("/Root"));
-
- NYdb::NTable::TClientSettings settings;
settings.AuthToken("test_user@builtin");
NYdb::NTable::TTableClient client(driver, settings);
-
- auto call = [] (NYdb::NTable::TTableClient& client) -> NYdb::TStatus {
- return client.CreateSession().ExtractValueSync();
- };
- auto status = client.RetryOperationSync(call);
-
- UNIT_ASSERT_VALUES_EQUAL_C(status.GetStatus(), EStatus::UNAUTHORIZED, status.GetIssues().ToString());
- }
-
- { // set connect
- NYdb::TCommonClientSettings settings;
- settings.AuthToken("root@builtin");
- auto scheme = NYdb::NScheme::TSchemeClient(driver, settings);
+
+ auto call = [] (NYdb::NTable::TTableClient& client) -> NYdb::TStatus {
+ return client.CreateSession().ExtractValueSync();
+ };
+ auto status = client.RetryOperationSync(call);
+
+ UNIT_ASSERT_VALUES_EQUAL_C(status.GetStatus(), EStatus::UNAUTHORIZED, status.GetIssues().ToString());
+ }
+
+ { // set connect
+ NYdb::TCommonClientSettings settings;
+ settings.AuthToken("root@builtin");
+ auto scheme = NYdb::NScheme::TSchemeClient(driver, settings);
auto status = scheme.ModifyPermissions("/Root",
NYdb::NScheme::TModifyPermissionsSettings()
.AddGrantPermissions(
@@ -1068,105 +1068,105 @@ Y_UNIT_TEST_SUITE(YdbYqlClient) {
)
).ExtractValueSync();
UNIT_ASSERT_VALUES_EQUAL_C(status.GetStatus(), EStatus::SUCCESS, status.GetIssues().ToString());
- UNIT_ASSERT_VALUES_EQUAL_C(status.IsTransportError(), false, status.GetIssues().ToString());
- }
-
- ui32 attemps = 2; // system is notified asynchronously, so it may see old acl for awhile
- while (attemps) { // accept connect right
- --attemps;
-
- NYdb::NTable::TClientSettings settings;
- settings.AuthToken("test_user@builtin");
- NYdb::NTable::TTableClient client(driver, settings);
-
- auto call = [] (NYdb::NTable::TTableClient& client) -> NYdb::TStatus {
- return client.CreateSession().ExtractValueSync();
- };
- auto status = client.RetryOperationSync(call);
-
- if (attemps && status.GetStatus() == EStatus::UNAUTHORIZED) {
- continue;
- }
-
- UNIT_ASSERT_VALUES_EQUAL_C(status.GetStatus(), EStatus::SUCCESS, status.GetIssues().ToString());
- }
- }
-
- Y_UNIT_TEST(ConnectDbAclIsOffWhenYdbRequestsWithoutDatabase) {
- NKikimrConfig::TAppConfig appConfig;
- appConfig.MutableFeatureFlags()->SetCheckDatabaseAccessPermission(true);
- appConfig.MutableFeatureFlags()->SetAllowYdbRequestsWithoutDatabase(true);
- appConfig.MutableDomainsConfig()->MutableSecurityConfig()->SetEnforceUserTokenRequirement(false);
- appConfig.MutableDomainsConfig()->MutableSecurityConfig()->AddDefaultUserSIDs("test_user_no_rights@builtin");
- TKikimrWithGrpcAndRootSchema server(appConfig);
-
- ui16 grpc = server.GetPort();
- {
- TString location = TStringBuilder() << "localhost:" << grpc;
- auto driver = NYdb::TDriver(
- TDriverConfig()
- .SetEndpoint(location)
- .SetDatabase("/Root"));
-
- // with db
+ UNIT_ASSERT_VALUES_EQUAL_C(status.IsTransportError(), false, status.GetIssues().ToString());
+ }
+
+ ui32 attemps = 2; // system is notified asynchronously, so it may see old acl for awhile
+ while (attemps) { // accept connect right
+ --attemps;
+
+ NYdb::NTable::TClientSettings settings;
+ settings.AuthToken("test_user@builtin");
+ NYdb::NTable::TTableClient client(driver, settings);
+
+ auto call = [] (NYdb::NTable::TTableClient& client) -> NYdb::TStatus {
+ return client.CreateSession().ExtractValueSync();
+ };
+ auto status = client.RetryOperationSync(call);
+
+ if (attemps && status.GetStatus() == EStatus::UNAUTHORIZED) {
+ continue;
+ }
+
+ UNIT_ASSERT_VALUES_EQUAL_C(status.GetStatus(), EStatus::SUCCESS, status.GetIssues().ToString());
+ }
+ }
+
+ Y_UNIT_TEST(ConnectDbAclIsOffWhenYdbRequestsWithoutDatabase) {
+ NKikimrConfig::TAppConfig appConfig;
+ appConfig.MutableFeatureFlags()->SetCheckDatabaseAccessPermission(true);
+ appConfig.MutableFeatureFlags()->SetAllowYdbRequestsWithoutDatabase(true);
+ appConfig.MutableDomainsConfig()->MutableSecurityConfig()->SetEnforceUserTokenRequirement(false);
+ appConfig.MutableDomainsConfig()->MutableSecurityConfig()->AddDefaultUserSIDs("test_user_no_rights@builtin");
+ TKikimrWithGrpcAndRootSchema server(appConfig);
+
+ ui16 grpc = server.GetPort();
+ {
+ TString location = TStringBuilder() << "localhost:" << grpc;
+ auto driver = NYdb::TDriver(
+ TDriverConfig()
+ .SetEndpoint(location)
+ .SetDatabase("/Root"));
+
+ // with db
+ NYdb::NTable::TClientSettings settings;
+ settings.AuthToken("test_user@builtin");
+ NYdb::NTable::TTableClient client(driver, settings);
+
+ auto call = [] (NYdb::NTable::TTableClient& client) -> NYdb::TStatus {
+ return client.CreateSession().ExtractValueSync();
+ };
+ auto status = client.RetryOperationSync(call);
+
+ UNIT_ASSERT_VALUES_EQUAL_C(status.GetStatus(), EStatus::UNAUTHORIZED, status.GetIssues().ToString());
+ }
+
+ {
+ TString location = TStringBuilder() << "localhost:" << grpc;
+ auto driver = NYdb::TDriver(
+ TDriverConfig()
+ .SetEndpoint(location));
+
+ // without db
NYdb::NTable::TClientSettings settings;
settings.AuthToken("test_user@builtin");
NYdb::NTable::TTableClient client(driver, settings);
-
- auto call = [] (NYdb::NTable::TTableClient& client) -> NYdb::TStatus {
- return client.CreateSession().ExtractValueSync();
- };
- auto status = client.RetryOperationSync(call);
-
- UNIT_ASSERT_VALUES_EQUAL_C(status.GetStatus(), EStatus::UNAUTHORIZED, status.GetIssues().ToString());
- }
-
- {
- TString location = TStringBuilder() << "localhost:" << grpc;
- auto driver = NYdb::TDriver(
- TDriverConfig()
- .SetEndpoint(location));
-
- // without db
- NYdb::NTable::TClientSettings settings;
- settings.AuthToken("test_user@builtin");
- NYdb::NTable::TTableClient client(driver, settings);
-
- auto call = [] (NYdb::NTable::TTableClient& client) -> NYdb::TStatus {
- return client.CreateSession().ExtractValueSync();
- };
- auto status = client.RetryOperationSync(call);
-
- UNIT_ASSERT_VALUES_EQUAL_C(status.GetStatus(), EStatus::SUCCESS, status.GetIssues().ToString());
- }
+
+ auto call = [] (NYdb::NTable::TTableClient& client) -> NYdb::TStatus {
+ return client.CreateSession().ExtractValueSync();
+ };
+ auto status = client.RetryOperationSync(call);
+
+ UNIT_ASSERT_VALUES_EQUAL_C(status.GetStatus(), EStatus::SUCCESS, status.GetIssues().ToString());
+ }
+ }
+
+ Y_UNIT_TEST(ConnectDbAclIsOffWhenTokenIsOptionalAndNull) {
+ NKikimrConfig::TAppConfig appConfig;
+ appConfig.MutableFeatureFlags()->SetCheckDatabaseAccessPermission(true);
+ appConfig.MutableFeatureFlags()->SetAllowYdbRequestsWithoutDatabase(false);
+ appConfig.MutableDomainsConfig()->MutableSecurityConfig()->SetEnforceUserTokenRequirement(false);
+ appConfig.MutableDomainsConfig()->MutableSecurityConfig()->AddDefaultUserSIDs("test_user_no_rights@builtin");
+ TKikimrWithGrpcAndRootSchema server(appConfig);
+
+ ui16 grpc = server.GetPort();
+ TString location = TStringBuilder() << "localhost:" << grpc;
+ auto driver = NYdb::TDriver(
+ TDriverConfig()
+ .SetEndpoint(location));
+
+ { // no token
+ NYdb::NTable::TClientSettings settings;
+ NYdb::NTable::TTableClient client(driver, settings);
+
+ auto call = [] (NYdb::NTable::TTableClient& client) -> NYdb::TStatus {
+ return client.CreateSession().ExtractValueSync();
+ };
+ auto status = client.RetryOperationSync(call);
+
+ UNIT_ASSERT_VALUES_EQUAL_C(status.GetStatus(), EStatus::SUCCESS, status.GetIssues().ToString());
+ }
}
-
- Y_UNIT_TEST(ConnectDbAclIsOffWhenTokenIsOptionalAndNull) {
- NKikimrConfig::TAppConfig appConfig;
- appConfig.MutableFeatureFlags()->SetCheckDatabaseAccessPermission(true);
- appConfig.MutableFeatureFlags()->SetAllowYdbRequestsWithoutDatabase(false);
- appConfig.MutableDomainsConfig()->MutableSecurityConfig()->SetEnforceUserTokenRequirement(false);
- appConfig.MutableDomainsConfig()->MutableSecurityConfig()->AddDefaultUserSIDs("test_user_no_rights@builtin");
- TKikimrWithGrpcAndRootSchema server(appConfig);
-
- ui16 grpc = server.GetPort();
- TString location = TStringBuilder() << "localhost:" << grpc;
- auto driver = NYdb::TDriver(
- TDriverConfig()
- .SetEndpoint(location));
-
- { // no token
- NYdb::NTable::TClientSettings settings;
- NYdb::NTable::TTableClient client(driver, settings);
-
- auto call = [] (NYdb::NTable::TTableClient& client) -> NYdb::TStatus {
- return client.CreateSession().ExtractValueSync();
- };
- auto status = client.RetryOperationSync(call);
-
- UNIT_ASSERT_VALUES_EQUAL_C(status.GetStatus(), EStatus::SUCCESS, status.GetIssues().ToString());
- }
- }
/*
Y_UNIT_TEST(SecurityTokenError) {
NKikimrConfig::TAppConfig appConfig;
@@ -2505,10 +2505,10 @@ R"___(<main>: Error: Transaction not found: , code: 2015
UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
}
- {
- auto result = session.DropTable("Root/Test").ExtractValueSync();
- UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
- }
+ {
+ auto result = session.DropTable("Root/Test").ExtractValueSync();
+ UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString());
+ }
}
Y_UNIT_TEST(AlterTableAddIndex) {
@@ -2959,348 +2959,348 @@ R"___(<main>: Error: Transaction not found: , code: 2015
sessionResult = client.CreateSession().ExtractValueSync();
UNIT_ASSERT_VALUES_EQUAL(sessionResult.GetStatus(), EStatus::SUCCESS);
}
-
- Y_UNIT_TEST(CopyTables) {
+
+ Y_UNIT_TEST(CopyTables) {
+ TKikimrWithGrpcAndRootSchemaNoSystemViews server;
+ server.Server_->GetRuntime()->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_NOTICE);
+
+ auto connection = NYdb::TDriver(
+ TDriverConfig()
+ .SetEndpoint(TStringBuilder() << "localhost:" << server.GetPort()));
+
+ NYdb::NTable::TTableClient client(connection);
+
+ auto sessionResult = client.CreateSession().ExtractValueSync();
+ UNIT_ASSERT_VALUES_EQUAL(sessionResult.GetStatus(), EStatus::SUCCESS);
+ auto session = sessionResult.GetSession();
+
+ {
+ auto tableBuilder = client.GetTableBuilder();
+ tableBuilder
+ .AddNullableColumn("Key", EPrimitiveType::Uint32)
+ .AddNullableColumn("Value", EPrimitiveType::Utf8);
+ tableBuilder.SetPrimaryKeyColumn("Key");
+
+ auto result = session.CreateTable("/Root/Table-1", tableBuilder.Build()).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
+ }
+
+ {
+ auto result = session.CopyTables({{"/Root/Table-1", "/Root/Table-2"}}).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
+ }
+
+ {
+ auto result = session.CopyTables(
+ { {"/Root/Table-1", "/Root/Table-3"}
+ , {"/Root/Table-2", "/Root/Table-4"}}
+ ).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
+ }
+
+ {
+ auto result = session.CopyTables(
+ { {"/Root/Table-1", "/Root/Table-5"}
+ , {"/Root/Table-2", "/Root/Table-6"}
+ , {"/Root/Table-3", "/Root/Table-7"}
+ , {"/Root/Table-4", "/Root/Table-8"}}
+ ).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
+ }
+
+ {
+ auto result = session.CopyTables(
+ { }).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus());
+ }
+
+ {
+ auto result = session.CopyTables(
+ { {"/Root/Table-1", "/Root/Table-1"}
+ , {"/Root/Table-2", "/Root/Table-9"}}
+ ).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus());
+ }
+
+ {
+ auto result = session.CopyTables(
+ { {"/Root/Table-1", "/Root/dir_no_exist/Table-1"}
+ , {"/Root/Table-2", "/Root/Table-9"}}
+ ).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus());
+ }
+
+ {
+ auto result = session.CopyTables(
+ { {"/Root/Table-1", "/Root/Table-2"}
+ , {"/Root/Table-2", "/Root/Table-9"}}
+ ).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus());
+ }
+
+ {
+ auto result = session.CopyTables(
+ { {"/Root/Table-1", "/Root/Table-9"}
+ , {"/Root/Table-1", "/Root/Table-10"}}
+ ).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::GENERIC_ERROR, result.GetStatus());
+ }
+
+ {
+ auto result = session.CopyTables(
+ { {"/Root/Table-1", "/Root/Table-3"}
+ , {"/Root/Table-2", "/Root/Table-4"}}
+ ).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus()); // do not fail on exist
+ }
+
+ {
+ auto tableBuilder = client.GetTableBuilder();
+ tableBuilder
+ .AddNullableColumn("Key", EPrimitiveType::Uint32)
+ .AddNullableColumn("Value", EPrimitiveType::Utf8);
+ tableBuilder.SetPrimaryKeyColumn("Key");
+ tableBuilder.AddSecondaryIndex("user-index", "Value");
+
+ auto result = session.CreateTable("/Root/Indexed-Table-1", tableBuilder.Build()).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
+ }
+
+ {
+ auto result = session.CopyTables(
+ {NYdb::NTable::TCopyItem("/Root/Indexed-Table-1", "/Root/Indexed-Table-2")})
+ .ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
+ }
+
+ {
+ auto result = session.CopyTables(
+ {NYdb::NTable::TCopyItem("/Root/Indexed-Table-1", "/Root/Omited-Indexes-Table-3").SetOmitIndexes()})
+ .ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
+ }
+
+ {
+ auto result = session.CopyTables(
+ {NYdb::NTable::TCopyItem("/Root/Indexed-Table-1", "/Root/Omited-Indexes-Table-4").SetOmitIndexes(),
+ NYdb::NTable::TCopyItem("/Root/Indexed-Table-2", "/Root/Omited-Indexes-Table-5").SetOmitIndexes(),
+ NYdb::NTable::TCopyItem("/Root/Omited-Indexes-Table-3", "/Root/Omited-Indexes-Table-6").SetOmitIndexes()
+ })
+ .ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
+ }
+
+ {
+ auto result = session.CopyTables(
+ {NYdb::NTable::TCopyItem("/Root/Indexed-Table-1", "/Root/Indexed-Table-7"),
+ NYdb::NTable::TCopyItem("/Root/Indexed-Table-2", "/Root/Omited-Indexes-Table-8").SetOmitIndexes()
+ })
+ .ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
+ }
+
+
+ {
+ auto asyncDescDir = NYdb::NScheme::TSchemeClient(connection).ListDirectory("/Root");
+ asyncDescDir.Wait();
+ const auto& val = asyncDescDir.GetValue();
+ auto entry = val.GetEntry();
+ UNIT_ASSERT_EQUAL(entry.Name, "Root");
+ UNIT_ASSERT_EQUAL(entry.Type, NYdb::NScheme::ESchemeEntryType::Directory);
+
+ auto children = val.GetChildren();
+ UNIT_ASSERT_EQUAL(children.size(), 16);
+ for (const auto& child: children) {
+ UNIT_ASSERT_EQUAL(child.Type, NYdb::NScheme::ESchemeEntryType::Table);
+
+ auto result = session.DropTable(TStringBuilder() << "Root" << "/" << child.Name).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
+ }
+ }
+ }
+
+ Y_UNIT_TEST(RenameTables) {
TKikimrWithGrpcAndRootSchemaNoSystemViews server;
- server.Server_->GetRuntime()->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_NOTICE);
-
- auto connection = NYdb::TDriver(
- TDriverConfig()
- .SetEndpoint(TStringBuilder() << "localhost:" << server.GetPort()));
-
- NYdb::NTable::TTableClient client(connection);
-
- auto sessionResult = client.CreateSession().ExtractValueSync();
- UNIT_ASSERT_VALUES_EQUAL(sessionResult.GetStatus(), EStatus::SUCCESS);
- auto session = sessionResult.GetSession();
-
- {
- auto tableBuilder = client.GetTableBuilder();
- tableBuilder
- .AddNullableColumn("Key", EPrimitiveType::Uint32)
- .AddNullableColumn("Value", EPrimitiveType::Utf8);
- tableBuilder.SetPrimaryKeyColumn("Key");
-
- auto result = session.CreateTable("/Root/Table-1", tableBuilder.Build()).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
- }
-
- {
- auto result = session.CopyTables({{"/Root/Table-1", "/Root/Table-2"}}).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
- }
-
- {
- auto result = session.CopyTables(
- { {"/Root/Table-1", "/Root/Table-3"}
- , {"/Root/Table-2", "/Root/Table-4"}}
- ).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
- }
-
- {
- auto result = session.CopyTables(
- { {"/Root/Table-1", "/Root/Table-5"}
- , {"/Root/Table-2", "/Root/Table-6"}
- , {"/Root/Table-3", "/Root/Table-7"}
- , {"/Root/Table-4", "/Root/Table-8"}}
- ).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
- }
-
- {
- auto result = session.CopyTables(
- { }).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus());
- }
-
- {
- auto result = session.CopyTables(
- { {"/Root/Table-1", "/Root/Table-1"}
- , {"/Root/Table-2", "/Root/Table-9"}}
- ).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus());
- }
-
- {
- auto result = session.CopyTables(
- { {"/Root/Table-1", "/Root/dir_no_exist/Table-1"}
- , {"/Root/Table-2", "/Root/Table-9"}}
- ).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus());
- }
-
- {
- auto result = session.CopyTables(
- { {"/Root/Table-1", "/Root/Table-2"}
- , {"/Root/Table-2", "/Root/Table-9"}}
- ).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus());
- }
-
- {
- auto result = session.CopyTables(
- { {"/Root/Table-1", "/Root/Table-9"}
- , {"/Root/Table-1", "/Root/Table-10"}}
- ).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::GENERIC_ERROR, result.GetStatus());
- }
-
- {
- auto result = session.CopyTables(
- { {"/Root/Table-1", "/Root/Table-3"}
- , {"/Root/Table-2", "/Root/Table-4"}}
- ).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ server.Server_->GetRuntime()->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_NOTICE);
+ server.Server_->GetRuntime()->SetLogPriority(NKikimrServices::GRPC_SERVER, NActors::NLog::PRI_DEBUG);
+ server.Server_->GetRuntime()->SetLogPriority(NKikimrServices::TX_PROXY, NActors::NLog::PRI_DEBUG);
+
+ auto connection = NYdb::TDriver(
+ TDriverConfig()
+ .SetEndpoint(TStringBuilder() << "localhost:" << server.GetPort()));
+
+ NYdb::NTable::TTableClient client(connection);
+
+ auto sessionResult = client.CreateSession().ExtractValueSync();
+ UNIT_ASSERT_VALUES_EQUAL(sessionResult.GetStatus(), EStatus::SUCCESS);
+ auto session = sessionResult.GetSession();
+
+ {
+ auto tableBuilder = client.GetTableBuilder();
+ tableBuilder
+ .AddNullableColumn("Key", EPrimitiveType::Uint32)
+ .AddNullableColumn("Value", EPrimitiveType::Utf8);
+ tableBuilder.SetPrimaryKeyColumn("Key");
+
+ auto result = session.CreateTable("/Root/Table-1", tableBuilder.Build()).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
+ }
+
+ {
+ auto result = session.RenameTables({{"/Root/Table-1", "/Root/Table-2"}}).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
+ }
+
+ {
+ auto result = session.CopyTables({{"/Root/Table-2", "/Root/Table-1"}}).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
+ }
+
+ {
+ auto result = session.RenameTables(
+ { {"/Root/Table-1", "/Root/Table-2"} }
+ ).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus());
+ }
+
+ {
+ auto result = session.RenameTables(
+ { {"/Root/Table-1", "/Root/Table-3"}
+ , {"/Root/Table-2", "/Root/Table-4"}}
+ ).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
+ }
+
+ {
+ auto result = session.RenameTables(
+ { }).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::BAD_REQUEST, result.GetStatus());
+ }
+
+ {
+ auto result = session.RenameTables(
+ { {"/Root/Table-1", "/Root/Table-1"}
+ , {"/Root/Table-2", "/Root/Table-9"}}
+ ).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus());
+ }
+
+ {
+ auto result = session.RenameTables(
+ { {"/Root/Table-1", "/Root/dir_no_exist/Table-1"}
+ , {"/Root/Table-2", "/Root/Table-9"}}
+ ).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus());
+ }
+
+ {
+ auto result = session.RenameTables(
+ { {"/Root/Table-1", "/Root/Table-2"}
+ , {"/Root/Table-2", "/Root/Table-9"}}
+ ).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus());
+ }
+
+ {
+ auto result = session.RenameTables(
+ { {"/Root/Table-1", "/Root/Table-9"}
+ , {"/Root/Table-1", "/Root/Table-10"}}
+ ).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus());
+ }
+
+
+ {
+ auto result = session.RenameTables(
+ { {"/Root/Table-1", "/Root/Table-3"}
+ , {"/Root/Table-2", "/Root/Table-4"}}
+ ).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus()); // do not fail on exist
+ }
+
+ {
+ auto result = session.CopyTables(
+ { {"/Root/Table-3", "/Root/Table-1"}
+ , {"/Root/Table-4", "/Root/Table-2"}}
+ ).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
+ }
+
+ {
+ auto result = session.RenameTables(
+ { {"/Root/Table-1", "/Root/Table-3"}
+ , {"/Root/Table-2", "/Root/Table-4"}}
+ ).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus()); // do not fail on exist
- }
-
- {
- auto tableBuilder = client.GetTableBuilder();
- tableBuilder
- .AddNullableColumn("Key", EPrimitiveType::Uint32)
- .AddNullableColumn("Value", EPrimitiveType::Utf8);
- tableBuilder.SetPrimaryKeyColumn("Key");
- tableBuilder.AddSecondaryIndex("user-index", "Value");
-
- auto result = session.CreateTable("/Root/Indexed-Table-1", tableBuilder.Build()).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
- }
-
- {
- auto result = session.CopyTables(
- {NYdb::NTable::TCopyItem("/Root/Indexed-Table-1", "/Root/Indexed-Table-2")})
- .ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
- }
-
- {
- auto result = session.CopyTables(
- {NYdb::NTable::TCopyItem("/Root/Indexed-Table-1", "/Root/Omited-Indexes-Table-3").SetOmitIndexes()})
- .ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
- }
-
- {
- auto result = session.CopyTables(
- {NYdb::NTable::TCopyItem("/Root/Indexed-Table-1", "/Root/Omited-Indexes-Table-4").SetOmitIndexes(),
- NYdb::NTable::TCopyItem("/Root/Indexed-Table-2", "/Root/Omited-Indexes-Table-5").SetOmitIndexes(),
- NYdb::NTable::TCopyItem("/Root/Omited-Indexes-Table-3", "/Root/Omited-Indexes-Table-6").SetOmitIndexes()
- })
- .ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
- }
-
- {
- auto result = session.CopyTables(
- {NYdb::NTable::TCopyItem("/Root/Indexed-Table-1", "/Root/Indexed-Table-7"),
- NYdb::NTable::TCopyItem("/Root/Indexed-Table-2", "/Root/Omited-Indexes-Table-8").SetOmitIndexes()
- })
- .ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
- }
-
-
- {
- auto asyncDescDir = NYdb::NScheme::TSchemeClient(connection).ListDirectory("/Root");
- asyncDescDir.Wait();
- const auto& val = asyncDescDir.GetValue();
- auto entry = val.GetEntry();
- UNIT_ASSERT_EQUAL(entry.Name, "Root");
- UNIT_ASSERT_EQUAL(entry.Type, NYdb::NScheme::ESchemeEntryType::Directory);
-
- auto children = val.GetChildren();
- UNIT_ASSERT_EQUAL(children.size(), 16);
- for (const auto& child: children) {
- UNIT_ASSERT_EQUAL(child.Type, NYdb::NScheme::ESchemeEntryType::Table);
-
- auto result = session.DropTable(TStringBuilder() << "Root" << "/" << child.Name).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
- }
- }
- }
-
- Y_UNIT_TEST(RenameTables) {
- TKikimrWithGrpcAndRootSchemaNoSystemViews server;
- server.Server_->GetRuntime()->SetLogPriority(NKikimrServices::FLAT_TX_SCHEMESHARD, NActors::NLog::PRI_NOTICE);
- server.Server_->GetRuntime()->SetLogPriority(NKikimrServices::GRPC_SERVER, NActors::NLog::PRI_DEBUG);
- server.Server_->GetRuntime()->SetLogPriority(NKikimrServices::TX_PROXY, NActors::NLog::PRI_DEBUG);
-
- auto connection = NYdb::TDriver(
- TDriverConfig()
- .SetEndpoint(TStringBuilder() << "localhost:" << server.GetPort()));
-
- NYdb::NTable::TTableClient client(connection);
-
- auto sessionResult = client.CreateSession().ExtractValueSync();
- UNIT_ASSERT_VALUES_EQUAL(sessionResult.GetStatus(), EStatus::SUCCESS);
- auto session = sessionResult.GetSession();
-
- {
- auto tableBuilder = client.GetTableBuilder();
- tableBuilder
- .AddNullableColumn("Key", EPrimitiveType::Uint32)
- .AddNullableColumn("Value", EPrimitiveType::Utf8);
- tableBuilder.SetPrimaryKeyColumn("Key");
-
- auto result = session.CreateTable("/Root/Table-1", tableBuilder.Build()).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
- }
-
- {
- auto result = session.RenameTables({{"/Root/Table-1", "/Root/Table-2"}}).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
- }
-
- {
- auto result = session.CopyTables({{"/Root/Table-2", "/Root/Table-1"}}).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
- }
-
- {
- auto result = session.RenameTables(
- { {"/Root/Table-1", "/Root/Table-2"} }
- ).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus());
- }
-
- {
- auto result = session.RenameTables(
- { {"/Root/Table-1", "/Root/Table-3"}
- , {"/Root/Table-2", "/Root/Table-4"}}
- ).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
- }
-
- {
- auto result = session.RenameTables(
- { }).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::BAD_REQUEST, result.GetStatus());
- }
-
- {
- auto result = session.RenameTables(
- { {"/Root/Table-1", "/Root/Table-1"}
- , {"/Root/Table-2", "/Root/Table-9"}}
- ).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus());
- }
-
- {
- auto result = session.RenameTables(
- { {"/Root/Table-1", "/Root/dir_no_exist/Table-1"}
- , {"/Root/Table-2", "/Root/Table-9"}}
- ).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus());
- }
-
- {
- auto result = session.RenameTables(
- { {"/Root/Table-1", "/Root/Table-2"}
- , {"/Root/Table-2", "/Root/Table-9"}}
- ).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus());
- }
-
- {
- auto result = session.RenameTables(
- { {"/Root/Table-1", "/Root/Table-9"}
- , {"/Root/Table-1", "/Root/Table-10"}}
- ).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus());
- }
-
-
- {
- auto result = session.RenameTables(
- { {"/Root/Table-1", "/Root/Table-3"}
- , {"/Root/Table-2", "/Root/Table-4"}}
- ).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus()); // do not fail on exist
- }
-
- {
- auto result = session.CopyTables(
- { {"/Root/Table-3", "/Root/Table-1"}
- , {"/Root/Table-4", "/Root/Table-2"}}
- ).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
- }
-
- {
- auto result = session.RenameTables(
- { {"/Root/Table-1", "/Root/Table-3"}
- , {"/Root/Table-2", "/Root/Table-4"}}
- ).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SCHEME_ERROR, result.GetStatus()); // do not fail on exist
- }
-
- {
- auto result = session.RenameTables(
- {NYdb::NTable::TRenameItem("/Root/Table-4", "/Root/Table-1").SetReplaceDestination()})
- .ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
- }
-
- {
- auto result = session.RenameTables(
- {NYdb::NTable::TRenameItem("/Root/Table-2", "/Root/Table-1").SetReplaceDestination(),
- {"/Root/Table-3", "/Root/Table-2"}})
- .ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
- }
-
- {
- auto asyncDescDir = NYdb::NScheme::TSchemeClient(connection).ListDirectory("/Root");
- asyncDescDir.Wait();
- const auto& val = asyncDescDir.GetValue();
- auto entry = val.GetEntry();
- UNIT_ASSERT_EQUAL(entry.Name, "Root");
- UNIT_ASSERT_EQUAL(entry.Type, NYdb::NScheme::ESchemeEntryType::Directory);
-
- auto children = val.GetChildren();
- UNIT_ASSERT_EQUAL_C(children.size(), 2, children.size());
- for (const auto& child: children) {
- UNIT_ASSERT_EQUAL(child.Type, NYdb::NScheme::ESchemeEntryType::Table);
-
- auto result = session.DropTable(TStringBuilder() << "Root" << "/" << child.Name).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetStatus());
- }
- }
- }
-
-
+ }
+
+ {
+ auto result = session.RenameTables(
+ {NYdb::NTable::TRenameItem("/Root/Table-4", "/Root/Table-1").SetReplaceDestination()})
+ .ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
+ }
+
+ {
+ auto result = session.RenameTables(
+ {NYdb::NTable::TRenameItem("/Root/Table-2", "/Root/Table-1").SetReplaceDestination(),
+ {"/Root/Table-3", "/Root/Table-2"}})
+ .ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
+ }
+
+ {
+ auto asyncDescDir = NYdb::NScheme::TSchemeClient(connection).ListDirectory("/Root");
+ asyncDescDir.Wait();
+ const auto& val = asyncDescDir.GetValue();
+ auto entry = val.GetEntry();
+ UNIT_ASSERT_EQUAL(entry.Name, "Root");
+ UNIT_ASSERT_EQUAL(entry.Type, NYdb::NScheme::ESchemeEntryType::Directory);
+
+ auto children = val.GetChildren();
+ UNIT_ASSERT_EQUAL_C(children.size(), 2, children.size());
+ for (const auto& child: children) {
+ UNIT_ASSERT_EQUAL(child.Type, NYdb::NScheme::ESchemeEntryType::Table);
+
+ auto result = session.DropTable(TStringBuilder() << "Root" << "/" << child.Name).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetStatus());
+ }
+ }
+ }
+
+
namespace {
TStoragePools CreatePoolsForTenant(TClient& client, const TDomainsInfo::TDomain::TStoragePoolKinds& pool_types, const TString& tenant)
diff --git a/ydb/services/ydb/ydb_ut.cpp b/ydb/services/ydb/ydb_ut.cpp
index c8ec30c0c28..2d370630799 100644
--- a/ydb/services/ydb/ydb_ut.cpp
+++ b/ydb/services/ydb/ydb_ut.cpp
@@ -1351,36 +1351,36 @@ partitioning_settings {
std::unique_ptr<Ydb::Table::V1::TableService::Stub> Stub_;
Stub_ = Ydb::Table::V1::TableService::NewStub(Channel_);
grpc::ClientContext context;
- Ydb::Table::CopyTablesRequest request;
- TString scheme(R"(
- tables {
- source_path: "/Root/TheTable"
- destination_path: "/Root/TheTable3"
- }
- tables {
- source_path: "/Root/TheTable2"
- destination_path: "/Root/TheTable4"
- }
- )");
- ::google::protobuf::TextFormat::ParseFromString(scheme, &request);
- Ydb::Table::CopyTablesResponse response;
- auto status = Stub_->CopyTables(&context, request, &response);
- auto deferred = response.operation();
- UNIT_ASSERT(status.ok());
- UNIT_ASSERT(deferred.ready() == true);
- //id = deferred.id();
- }
- /*
- {
- auto status = WaitForStatus(Channel_, id);
- UNIT_ASSERT(status == Ydb::StatusIds::SUCCESS);
- }
- */
- id.clear();
- {
- std::unique_ptr<Ydb::Table::V1::TableService::Stub> Stub_;
- Stub_ = Ydb::Table::V1::TableService::NewStub(Channel_);
- grpc::ClientContext context;
+ Ydb::Table::CopyTablesRequest request;
+ TString scheme(R"(
+ tables {
+ source_path: "/Root/TheTable"
+ destination_path: "/Root/TheTable3"
+ }
+ tables {
+ source_path: "/Root/TheTable2"
+ destination_path: "/Root/TheTable4"
+ }
+ )");
+ ::google::protobuf::TextFormat::ParseFromString(scheme, &request);
+ Ydb::Table::CopyTablesResponse response;
+ auto status = Stub_->CopyTables(&context, request, &response);
+ auto deferred = response.operation();
+ UNIT_ASSERT(status.ok());
+ UNIT_ASSERT(deferred.ready() == true);
+ //id = deferred.id();
+ }
+ /*
+ {
+ auto status = WaitForStatus(Channel_, id);
+ UNIT_ASSERT(status == Ydb::StatusIds::SUCCESS);
+ }
+ */
+ id.clear();
+ {
+ std::unique_ptr<Ydb::Table::V1::TableService::Stub> Stub_;
+ Stub_ = Ydb::Table::V1::TableService::NewStub(Channel_);
+ grpc::ClientContext context;
Ydb::Table::DropTableRequest request;
TString scheme(
"path: \"/Root/TheTable\"");
@@ -3181,13 +3181,13 @@ tx_meta {
namespace {
-NKikimrSchemeOp::TCompactionPolicy DEFAULT_COMPACTION_POLICY;
-NKikimrSchemeOp::TCompactionPolicy COMPACTION_POLICY1;
-NKikimrSchemeOp::TCompactionPolicy COMPACTION_POLICY2;
-NKikimrSchemeOp::TPipelineConfig PIPELINE_CONFIG1;
-NKikimrSchemeOp::TPipelineConfig PIPELINE_CONFIG2;
-NKikimrSchemeOp::TStorageConfig STORAGE_CONFIG1;
-NKikimrSchemeOp::TStorageConfig STORAGE_CONFIG2;
+NKikimrSchemeOp::TCompactionPolicy DEFAULT_COMPACTION_POLICY;
+NKikimrSchemeOp::TCompactionPolicy COMPACTION_POLICY1;
+NKikimrSchemeOp::TCompactionPolicy COMPACTION_POLICY2;
+NKikimrSchemeOp::TPipelineConfig PIPELINE_CONFIG1;
+NKikimrSchemeOp::TPipelineConfig PIPELINE_CONFIG2;
+NKikimrSchemeOp::TStorageConfig STORAGE_CONFIG1;
+NKikimrSchemeOp::TStorageConfig STORAGE_CONFIG2;
NKikimrConfig::TExecutionPolicy EXECUTION_POLICY1;
NKikimrConfig::TExecutionPolicy EXECUTION_POLICY2;
NKikimrConfig::TPartitioningPolicy PARTITIONING_POLICY1;
@@ -3205,17 +3205,17 @@ TStoragePools CreatePoolsForTenant(TClient& client, const TDomainsInfo::TDomain:
for (auto& poolType: pool_types) {
auto& poolKind = poolType.first;
result.emplace_back(client.CreateStoragePool(poolKind, tenant), poolKind);
- }
+ }
return result;
}
-
-NKikimrSubDomains::TSubDomainSettings GetSubDomainDeclarationSetting(const TString& name)
-{
- NKikimrSubDomains::TSubDomainSettings subdomain;
- subdomain.SetName(name);
- return subdomain;
-}
-
+
+NKikimrSubDomains::TSubDomainSettings GetSubDomainDeclarationSetting(const TString& name)
+{
+ NKikimrSubDomains::TSubDomainSettings subdomain;
+ subdomain.SetName(name);
+ return subdomain;
+}
+
NKikimrSubDomains::TSubDomainSettings GetSubDomainDefaultSetting(const TString& name, const TStoragePools& pools = {})
{
NKikimrSubDomains::TSubDomainSettings subdomain;
@@ -3226,28 +3226,28 @@ NKikimrSubDomains::TSubDomainSettings GetSubDomainDefaultSetting(const TString&
subdomain.SetTimeCastBucketsPerMediator(2);
for (auto& pool: pools) {
*subdomain.AddStoragePools() = pool;
- }
+ }
return subdomain;
-}
-
+}
+
void InitConfigs(TKikimrWithGrpcAndRootSchema &server) {
{
- TString tenant_name = "ydb_ut_tenant";
- TString tenant = Sprintf("/Root/%s", tenant_name.c_str());
-
- TClient client(*server.ServerSettings);
-
- TStoragePools tenant_pools = CreatePoolsForTenant(client, server.ServerSettings->StoragePoolTypes, tenant_name);
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- client.CreateSubdomain("/Root", GetSubDomainDeclarationSetting(tenant_name)));
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
- client.AlterSubdomain("/Root", GetSubDomainDefaultSetting(tenant_name, tenant_pools), TDuration::MilliSeconds(500)));
-
- server.Tenants_->Run(tenant);
- }
-
- {
+ TString tenant_name = "ydb_ut_tenant";
+ TString tenant = Sprintf("/Root/%s", tenant_name.c_str());
+
+ TClient client(*server.ServerSettings);
+
+ TStoragePools tenant_pools = CreatePoolsForTenant(client, server.ServerSettings->StoragePoolTypes, tenant_name);
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ client.CreateSubdomain("/Root", GetSubDomainDeclarationSetting(tenant_name)));
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
+ client.AlterSubdomain("/Root", GetSubDomainDefaultSetting(tenant_name, tenant_pools), TDuration::MilliSeconds(500)));
+
+ server.Tenants_->Run(tenant);
+ }
+
+ {
NLocalDb::TCompactionPolicyPtr policy = NLocalDb::CreateDefaultUserTablePolicy();
DEFAULT_COMPACTION_POLICY.Clear();
policy->Serialize(DEFAULT_COMPACTION_POLICY);
@@ -3363,7 +3363,7 @@ void InitConfigs(TKikimrWithGrpcAndRootSchema &server) {
STORAGE_POLICY1.Clear();
auto &family = *STORAGE_POLICY1.AddColumnFamilies();
family.SetId(0);
- family.SetColumnCodec(NKikimrSchemeOp::ColumnCodecLZ4);
+ family.SetColumnCodec(NKikimrSchemeOp::ColumnCodecLZ4);
family.MutableStorageConfig()->CopyFrom(STORAGE_CONFIG1);
}
@@ -3371,7 +3371,7 @@ void InitConfigs(TKikimrWithGrpcAndRootSchema &server) {
STORAGE_POLICY2.Clear();
auto &family = *STORAGE_POLICY2.AddColumnFamilies();
family.SetId(0);
- family.SetColumnCache(NKikimrSchemeOp::ColumnCacheEver);
+ family.SetColumnCache(NKikimrSchemeOp::ColumnCacheEver);
family.MutableStorageConfig()->CopyFrom(STORAGE_CONFIG2);
}
@@ -3504,11 +3504,11 @@ void InitConfigs(TKikimrWithGrpcAndRootSchema &server) {
void CheckTableSettings(const TKikimrWithGrpcAndRootSchema &server,
const TString &path,
- NKikimrSchemeOp::TTableDescription expected)
+ NKikimrSchemeOp::TTableDescription expected)
{
TClient client(*server.ServerSettings);
auto desc = client.Ls(path)->Record.GetPathDescription();
- NKikimrSchemeOp::TTableDescription resp = desc.GetTable();
+ NKikimrSchemeOp::TTableDescription resp = desc.GetTable();
// Table profiles affect only few fields. Clear other fields to simplify comparison.
THashSet<ui32> affectedFields = {
7 // PartitionConfig
@@ -3581,14 +3581,14 @@ void CheckTablePartitions(const TKikimrWithGrpcAndRootSchema &server,
}
}
-void Apply(const NKikimrSchemeOp::TCompactionPolicy &policy,
- NKikimrSchemeOp::TTableDescription &description)
+void Apply(const NKikimrSchemeOp::TCompactionPolicy &policy,
+ NKikimrSchemeOp::TTableDescription &description)
{
description.MutablePartitionConfig()->MutableCompactionPolicy()->CopyFrom(policy);
}
void Apply(const NKikimrConfig::TExecutionPolicy &policy,
- NKikimrSchemeOp::TTableDescription &description)
+ NKikimrSchemeOp::TTableDescription &description)
{
auto &partition = *description.MutablePartitionConfig();
@@ -3615,7 +3615,7 @@ void Apply(const NKikimrConfig::TExecutionPolicy &policy,
}
void Apply(const NKikimrConfig::TPartitioningPolicy &policy,
- NKikimrSchemeOp::TTableDescription &description)
+ NKikimrSchemeOp::TTableDescription &description)
{
auto &partition = *description.MutablePartitionConfig();
@@ -3640,7 +3640,7 @@ void Apply(const NKikimrConfig::TPartitioningPolicy &policy,
}
void Apply(const NKikimrConfig::TStoragePolicy &policy,
- NKikimrSchemeOp::TTableDescription &description)
+ NKikimrSchemeOp::TTableDescription &description)
{
auto &partition = *description.MutablePartitionConfig();
@@ -3650,7 +3650,7 @@ void Apply(const NKikimrConfig::TStoragePolicy &policy,
}
void Apply(const NKikimrConfig::TReplicationPolicy &policy,
- NKikimrSchemeOp::TTableDescription &description)
+ NKikimrSchemeOp::TTableDescription &description)
{
auto &partition = *description.MutablePartitionConfig();
@@ -3673,7 +3673,7 @@ void Apply(const NKikimrConfig::TReplicationPolicy &policy,
}
void Apply(const NKikimrConfig::TCachingPolicy &policy,
- NKikimrSchemeOp::TTableDescription &description)
+ NKikimrSchemeOp::TTableDescription &description)
{
auto &partition = *description.MutablePartitionConfig();
@@ -3769,9 +3769,9 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
//server.Server_->GetRuntime()->SetLogPriority(NKikimrServices::CONFIGS_DISPATCHER, NLog::PRI_TRACE);
InitConfigs(server);
- NKikimrSchemeOp::TTableDescription defaultDescription;
+ NKikimrSchemeOp::TTableDescription defaultDescription;
defaultDescription.MutablePartitionConfig()->MutableCompactionPolicy()->CopyFrom(DEFAULT_COMPACTION_POLICY);
- //defaultDescription.MutablePartitionConfig()->SetChannelProfileId(0);
+ //defaultDescription.MutablePartitionConfig()->SetChannelProfileId(0);
{
CreateTable(server, "/Root/table-1");
@@ -3806,9 +3806,9 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
{
Ydb::Table::TableProfile profile;
profile.set_preset_name("profile1");
- CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile);
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY1, description);
Apply(EXECUTION_POLICY1, description);
Apply(PARTITIONING_POLICY1, description);
@@ -3816,15 +3816,15 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
Apply(REPLICATION_POLICY1, description);
Apply(CACHING_POLICY1, description);
- CheckTableSettings(server, "/Root/ydb_ut_tenant/table-1", description);
+ CheckTableSettings(server, "/Root/ydb_ut_tenant/table-1", description);
}
{
Ydb::Table::TableProfile profile;
profile.set_preset_name("profile2");
- CreateTable(server, "/Root/ydb_ut_tenant/table-2", profile);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-2", profile);
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY2, description);
Apply(EXECUTION_POLICY2, description);
Apply(PARTITIONING_POLICY2, description);
@@ -3832,7 +3832,7 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
Apply(REPLICATION_POLICY2, description);
Apply(CACHING_POLICY2, description);
- CheckTableSettings(server, "/Root/ydb_ut_tenant/table-2", description);
+ CheckTableSettings(server, "/Root/ydb_ut_tenant/table-2", description);
}
}
@@ -3855,9 +3855,9 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
.AddNullableColumn("Key", EPrimitiveType::Uint64);
tableBuilder.SetPrimaryKeyColumn("Key");
auto settings = TCreateTableSettings().PresetName("profile1");
- auto res = session.CreateTable("/Root/ydb_ut_tenant/table-1", tableBuilder.Build(), settings).ExtractValueSync();
+ auto res = session.CreateTable("/Root/ydb_ut_tenant/table-1", tableBuilder.Build(), settings).ExtractValueSync();
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY1, description);
Apply(EXECUTION_POLICY1, description);
Apply(PARTITIONING_POLICY1, description);
@@ -3865,7 +3865,7 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
Apply(REPLICATION_POLICY1, description);
Apply(CACHING_POLICY1, description);
- CheckTableSettings(server, "/Root/ydb_ut_tenant/table-1", description);
+ CheckTableSettings(server, "/Root/ydb_ut_tenant/table-1", description);
}
{
@@ -3874,9 +3874,9 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
.AddNullableColumn("Key", EPrimitiveType::Uint64);
tableBuilder.SetPrimaryKeyColumn("Key");
auto settings = TCreateTableSettings().PresetName("profile2");
- auto res = session.CreateTable("/Root/ydb_ut_tenant/table-2", tableBuilder.Build(), settings).ExtractValueSync();
+ auto res = session.CreateTable("/Root/ydb_ut_tenant/table-2", tableBuilder.Build(), settings).ExtractValueSync();
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY2, description);
Apply(EXECUTION_POLICY2, description);
Apply(PARTITIONING_POLICY2, description);
@@ -3884,14 +3884,14 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
Apply(REPLICATION_POLICY2, description);
Apply(CACHING_POLICY2, description);
- CheckTableSettings(server, "/Root/ydb_ut_tenant/table-2", description);
+ CheckTableSettings(server, "/Root/ydb_ut_tenant/table-2", description);
}
{
auto res = session.ExecuteSchemeQuery("CREATE TABLE [/Root/ydb_ut_tenant/table-3] (Key Uint64, Value Utf8, PRIMARY KEY (Key))").ExtractValueSync();
- NKikimrSchemeOp::TTableDescription defaultDescription;
+ NKikimrSchemeOp::TTableDescription defaultDescription;
defaultDescription.MutablePartitionConfig()->MutableCompactionPolicy()->CopyFrom(DEFAULT_COMPACTION_POLICY);
- //defaultDescription.MutablePartitionConfig()->SetChannelProfileId(0);
+ //defaultDescription.MutablePartitionConfig()->SetChannelProfileId(0);
CheckTableSettings(server, "/Root/ydb_ut_tenant/table-3", defaultDescription);
}
@@ -3907,9 +3907,9 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
Ydb::Table::TableProfile profile;
profile.set_preset_name("profile1");
profile.mutable_compaction_policy()->set_preset_name("compaction2");
- CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile);
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY2, description);
Apply(EXECUTION_POLICY1, description);
Apply(PARTITIONING_POLICY1, description);
@@ -3917,16 +3917,16 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
Apply(REPLICATION_POLICY1, description);
Apply(CACHING_POLICY1, description);
- CheckTableSettings(server, "/Root/ydb_ut_tenant/table-1", description);
+ CheckTableSettings(server, "/Root/ydb_ut_tenant/table-1", description);
}
{
Ydb::Table::TableProfile profile;
profile.set_preset_name("profile1");
profile.mutable_compaction_policy()->set_preset_name("default");
- CreateTable(server, "/Root/ydb_ut_tenant/table-2", profile);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-2", profile);
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(DEFAULT_COMPACTION_POLICY, description);
Apply(EXECUTION_POLICY1, description);
Apply(PARTITIONING_POLICY1, description);
@@ -3934,7 +3934,7 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
Apply(REPLICATION_POLICY1, description);
Apply(CACHING_POLICY1, description);
- CheckTableSettings(server, "/Root/ydb_ut_tenant/table-2", description);
+ CheckTableSettings(server, "/Root/ydb_ut_tenant/table-2", description);
}
}
@@ -3947,9 +3947,9 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
Ydb::Table::TableProfile profile;
profile.set_preset_name("profile1");
profile.mutable_execution_policy()->set_preset_name("execution2");
- CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile);
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY1, description);
Apply(EXECUTION_POLICY2, description);
Apply(PARTITIONING_POLICY1, description);
@@ -3957,23 +3957,23 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
Apply(REPLICATION_POLICY1, description);
Apply(CACHING_POLICY1, description);
- CheckTableSettings(server, "/Root/ydb_ut_tenant/table-1", description);
+ CheckTableSettings(server, "/Root/ydb_ut_tenant/table-1", description);
}
{
Ydb::Table::TableProfile profile;
profile.set_preset_name("profile1");
profile.mutable_execution_policy()->set_preset_name("default");
- CreateTable(server, "/Root/ydb_ut_tenant/table-2", profile);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-2", profile);
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY1, description);
Apply(PARTITIONING_POLICY1, description);
Apply(STORAGE_POLICY1, description);
Apply(REPLICATION_POLICY1, description);
Apply(CACHING_POLICY1, description);
- CheckTableSettings(server, "/Root/ydb_ut_tenant/table-2", description);
+ CheckTableSettings(server, "/Root/ydb_ut_tenant/table-2", description);
}
}
@@ -3985,9 +3985,9 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
Ydb::Table::TableProfile profile;
profile.set_preset_name("profile1");
profile.mutable_partitioning_policy()->set_preset_name("partitioning2");
- CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile);
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY1, description);
Apply(EXECUTION_POLICY1, description);
Apply(PARTITIONING_POLICY2, description);
@@ -3995,23 +3995,23 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
Apply(REPLICATION_POLICY1, description);
Apply(CACHING_POLICY1, description);
- CheckTableSettings(server, "/Root/ydb_ut_tenant/table-1", description);
+ CheckTableSettings(server, "/Root/ydb_ut_tenant/table-1", description);
}
{
Ydb::Table::TableProfile profile;
profile.set_preset_name("profile1");
profile.mutable_partitioning_policy()->set_preset_name("default");
- CreateTable(server, "/Root/ydb_ut_tenant/table-2", profile);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-2", profile);
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY1, description);
Apply(EXECUTION_POLICY1, description);
Apply(STORAGE_POLICY1, description);
Apply(REPLICATION_POLICY1, description);
Apply(CACHING_POLICY1, description);
- CheckTableSettings(server, "/Root/ydb_ut_tenant/table-2", description);
+ CheckTableSettings(server, "/Root/ydb_ut_tenant/table-2", description);
}
{
@@ -4019,9 +4019,9 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
profile.set_preset_name("profile1");
profile.mutable_partitioning_policy()->set_auto_partitioning(Ydb::Table::PartitioningPolicy::DISABLED);
profile.mutable_partitioning_policy()->set_uniform_partitions(5);
- CreateTable(server, "/Root/ydb_ut_tenant/table-3", profile);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-3", profile);
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY1, description);
Apply(EXECUTION_POLICY1, description);
Apply(REPLICATION_POLICY1, description);
@@ -4033,7 +4033,7 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
Apply(policy, description);
Apply(STORAGE_POLICY1, description);
- CheckTableSettings(server, "/Root/ydb_ut_tenant/table-3", description);
+ CheckTableSettings(server, "/Root/ydb_ut_tenant/table-3", description);
}
{
@@ -4042,9 +4042,9 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
profile.mutable_partitioning_policy()->set_preset_name("partitioning2");
profile.mutable_partitioning_policy()->set_auto_partitioning(Ydb::Table::PartitioningPolicy::DISABLED);
profile.mutable_partitioning_policy()->set_uniform_partitions(5);
- CreateTable(server, "/Root/ydb_ut_tenant/table-4", profile);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-4", profile);
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY1, description);
Apply(EXECUTION_POLICY1, description);
Apply(REPLICATION_POLICY1, description);
@@ -4056,7 +4056,7 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
Apply(policy, description);
Apply(STORAGE_POLICY1, description);
- CheckTableSettings(server, "/Root/ydb_ut_tenant/table-4", description);
+ CheckTableSettings(server, "/Root/ydb_ut_tenant/table-4", description);
}
{
@@ -4064,9 +4064,9 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
profile.set_preset_name("profile1");
profile.mutable_partitioning_policy()->set_preset_name("default");
profile.mutable_partitioning_policy()->set_auto_partitioning(Ydb::Table::PartitioningPolicy::AUTO_SPLIT);
- CreateTable(server, "/Root/ydb_ut_tenant/table-5", profile);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-5", profile);
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY1, description);
Apply(EXECUTION_POLICY1, description);
Apply(REPLICATION_POLICY1, description);
@@ -4077,7 +4077,7 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
Apply(policy, description);
Apply(STORAGE_POLICY1, description);
- CheckTableSettings(server, "/Root/ydb_ut_tenant/table-5", description);
+ CheckTableSettings(server, "/Root/ydb_ut_tenant/table-5", description);
}
}
@@ -4108,7 +4108,7 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
auto settings = TCreateTableSettings().PresetName("profile1");
auto res = session.CreateTable("/Root/ydb_ut_tenant/table-1", tableBuilder.Build(), settings).ExtractValueSync();
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY1, description);
Apply(EXECUTION_POLICY1, description);
Apply(PARTITIONING_POLICY1, description);
@@ -4180,9 +4180,9 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
Ydb::Table::TableProfile profile;
profile.set_preset_name("profile1");
profile.mutable_storage_policy()->set_preset_name("storage2");
- CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile);
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY1, description);
Apply(EXECUTION_POLICY1, description);
Apply(PARTITIONING_POLICY1, description);
@@ -4190,25 +4190,25 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
Apply(REPLICATION_POLICY1, description);
Apply(CACHING_POLICY1, description);
- CheckTableSettings(server, "/Root/ydb_ut_tenant/table-1", description);
+ CheckTableSettings(server, "/Root/ydb_ut_tenant/table-1", description);
}
{
Ydb::Table::TableProfile profile;
profile.set_preset_name("profile1");
profile.mutable_storage_policy()->set_preset_name("default");
- CreateTable(server, "/Root/ydb_ut_tenant/table-2", profile);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-2", profile);
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY1, description);
Apply(EXECUTION_POLICY1, description);
Apply(PARTITIONING_POLICY1, description);
Apply(REPLICATION_POLICY1, description);
Apply(CACHING_POLICY1, description);
// TODO: remove this line when storage config is supported in SchemeShard.
- //description.MutablePartitionConfig()->SetChannelProfileId(0);
+ //description.MutablePartitionConfig()->SetChannelProfileId(0);
- CheckTableSettings(server, "/Root/ydb_ut_tenant/table-2", description);
+ CheckTableSettings(server, "/Root/ydb_ut_tenant/table-2", description);
}
{
@@ -4217,9 +4217,9 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
profile.mutable_storage_policy()->mutable_syslog()->set_media("ssd");
profile.mutable_storage_policy()->mutable_data()->set_media("ssd");
profile.mutable_storage_policy()->set_keep_in_memory(Ydb::FeatureFlag::ENABLED);
- CreateTable(server, "/Root/ydb_ut_tenant/table-3", profile);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-3", profile);
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY1, description);
Apply(EXECUTION_POLICY1, description);
Apply(PARTITIONING_POLICY1, description);
@@ -4230,10 +4230,10 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
policy.MutableColumnFamilies(0)->MutableStorageConfig()->MutableSysLog()->SetAllowOtherKinds(false);
policy.MutableColumnFamilies(0)->MutableStorageConfig()->MutableData()->SetPreferredPoolKind("ssd");
policy.MutableColumnFamilies(0)->MutableStorageConfig()->MutableData()->SetAllowOtherKinds(false);
- policy.MutableColumnFamilies(0)->SetColumnCache(NKikimrSchemeOp::ColumnCacheEver);
+ policy.MutableColumnFamilies(0)->SetColumnCache(NKikimrSchemeOp::ColumnCacheEver);
Apply(policy, description);
- CheckTableSettings(server, "/Root/ydb_ut_tenant/table-3", description);
+ CheckTableSettings(server, "/Root/ydb_ut_tenant/table-3", description);
}
{
@@ -4243,9 +4243,9 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
profile.mutable_storage_policy()->mutable_log()->set_media("hdd");
profile.mutable_storage_policy()->mutable_external()->set_media("hdd");
profile.mutable_storage_policy()->set_keep_in_memory(Ydb::FeatureFlag::DISABLED);
- CreateTable(server, "/Root/ydb_ut_tenant/table-4", profile);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-4", profile);
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY1, description);
Apply(EXECUTION_POLICY1, description);
Apply(PARTITIONING_POLICY1, description);
@@ -4259,7 +4259,7 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
policy.MutableColumnFamilies(0)->ClearColumnCache();
Apply(policy, description);
- CheckTableSettings(server, "/Root/ydb_ut_tenant/table-4", description);
+ CheckTableSettings(server, "/Root/ydb_ut_tenant/table-4", description);
}
{
@@ -4269,9 +4269,9 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
profile.mutable_storage_policy()->mutable_syslog()->set_media("ssd");
profile.mutable_storage_policy()->mutable_log()->set_media("ssd");
profile.mutable_storage_policy()->set_keep_in_memory(Ydb::FeatureFlag::ENABLED);
- CreateTable(server, "/Root/ydb_ut_tenant/table-5", profile);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-5", profile);
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY1, description);
Apply(EXECUTION_POLICY1, description);
Apply(PARTITIONING_POLICY1, description);
@@ -4283,10 +4283,10 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
policy.MutableColumnFamilies(0)->MutableStorageConfig()->MutableSysLog()->SetAllowOtherKinds(false);
policy.MutableColumnFamilies(0)->MutableStorageConfig()->MutableLog()->SetPreferredPoolKind("ssd");
policy.MutableColumnFamilies(0)->MutableStorageConfig()->MutableLog()->SetAllowOtherKinds(false);
- policy.MutableColumnFamilies(0)->SetColumnCache(NKikimrSchemeOp::ColumnCacheEver);
+ policy.MutableColumnFamilies(0)->SetColumnCache(NKikimrSchemeOp::ColumnCacheEver);
Apply(policy, description);
- CheckTableSettings(server, "/Root/ydb_ut_tenant/table-5", description);
+ CheckTableSettings(server, "/Root/ydb_ut_tenant/table-5", description);
}
}
@@ -4300,7 +4300,7 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
profile.mutable_caching_policy()->set_preset_name("caching2");
CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile);
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY1, description);
Apply(EXECUTION_POLICY1, description);
Apply(PARTITIONING_POLICY1, description);
@@ -4317,7 +4317,7 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
profile.mutable_caching_policy()->set_preset_name("default");
CreateTable(server, "/Root/ydb_ut_tenant/table-2", profile);
- NKikimrSchemeOp::TTableDescription description;
+ NKikimrSchemeOp::TTableDescription description;
Apply(COMPACTION_POLICY1, description);
Apply(EXECUTION_POLICY1, description);
Apply(PARTITIONING_POLICY1, description);
@@ -4335,42 +4335,42 @@ Y_UNIT_TEST_SUITE(TTableProfileTests) {
{
Ydb::Table::TableProfile profile;
profile.set_preset_name("unknown");
- CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile, Ydb::StatusIds::BAD_REQUEST);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile, Ydb::StatusIds::BAD_REQUEST);
}
{
Ydb::Table::TableProfile profile;
profile.set_preset_name("profile1");
profile.mutable_compaction_policy();
- CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile, Ydb::StatusIds::BAD_REQUEST);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile, Ydb::StatusIds::BAD_REQUEST);
}
{
Ydb::Table::TableProfile profile;
profile.set_preset_name("profile1");
profile.mutable_compaction_policy()->set_preset_name("unknown");
- CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile, Ydb::StatusIds::BAD_REQUEST);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile, Ydb::StatusIds::BAD_REQUEST);
}
{
Ydb::Table::TableProfile profile;
profile.set_preset_name("profile1");
profile.mutable_execution_policy();
- CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile, Ydb::StatusIds::BAD_REQUEST);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile, Ydb::StatusIds::BAD_REQUEST);
}
{
Ydb::Table::TableProfile profile;
profile.set_preset_name("profile1");
profile.mutable_execution_policy()->set_preset_name("unknown");
- CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile, Ydb::StatusIds::BAD_REQUEST);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile, Ydb::StatusIds::BAD_REQUEST);
}
{
Ydb::Table::TableProfile profile;
profile.set_preset_name("profile1");
profile.mutable_partitioning_policy()->set_preset_name("unknown");
- CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile, Ydb::StatusIds::BAD_REQUEST);
+ CreateTable(server, "/Root/ydb_ut_tenant/table-1", profile, Ydb::StatusIds::BAD_REQUEST);
}
{
@@ -5279,79 +5279,79 @@ Y_UNIT_TEST_SUITE(TYqlDateTimeTests) {
}
#endif
-Y_UNIT_TEST_SUITE(LocalityOperation) {
-Y_UNIT_TEST(LocksFromAnotherTenants) {
- TKikimrWithGrpcAndRootSchema server;
- //server.Server_->SetupLogging(
-
- auto connection = NYdb::TDriver(
- TDriverConfig()
- .SetEndpoint(TStringBuilder() << "localhost:" << server.GetPort()));
-
- TString first_tenant_name = "ydb_tenant_0";
- TString second_tenant_name = "ydb_tenant_1";
-
- {
- TClient admClient(*server.ServerSettings);
- for (auto& tenant_name: TVector<TString>{first_tenant_name, second_tenant_name}) {
- TString tenant_path = Sprintf("/Root/%s", tenant_name.c_str());
-
- TStoragePools tenant_pools = CreatePoolsForTenant(admClient, server.ServerSettings->StoragePoolTypes, tenant_path);
-
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
- admClient.CreateSubdomain("/Root", GetSubDomainDeclarationSetting(tenant_name)));
- UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
- admClient.AlterSubdomain("/Root", GetSubDomainDefaultSetting(tenant_name, tenant_pools), TDuration::MilliSeconds(500)));
-
- server.Tenants_->Run(tenant_path, 1);
- }
- }
-
- NYdb::NTable::TTableClient client(connection);
-
- auto sessionResult = client.CreateSession().ExtractValueSync();
- UNIT_ASSERT_VALUES_EQUAL(sessionResult.GetStatus(), EStatus::SUCCESS);
- auto session = sessionResult.GetSession();
-
- for (auto& tenant_name: TVector<TString>{first_tenant_name, second_tenant_name}) {
- auto tableBuilder = client.GetTableBuilder();
- tableBuilder
- .AddNullableColumn("Key", EPrimitiveType::Uint32)
- .AddNullableColumn("Value", EPrimitiveType::Utf8);
- tableBuilder.SetPrimaryKeyColumn("Key");
-
- TString table_path = Sprintf("/Root/%s/table", tenant_name.c_str());
-
- auto result = session.CreateTable(table_path, tableBuilder.Build()).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
- }
-
- {
- TString query = Sprintf("UPSERT INTO [Root/%s/table] (Key, Value) VALUES (1u, \"One\");", first_tenant_name.c_str());
- auto result = session.ExecuteDataQuery(query, TTxControl::BeginTx(TTxSettings::SerializableRW()).CommitTx()).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetStatus() << result.GetIssues().ToString());
- }
-
- {
- TString query = Sprintf("UPSERT INTO [Root/%s/table] (Key, Value) VALUES (2u, \"Second\");", second_tenant_name.c_str());
- auto result = session.ExecuteDataQuery(query, TTxControl::BeginTx(TTxSettings::SerializableRW()).CommitTx()).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SUCCESS,
- "Status: " << result.GetStatus()
- << " Issues: " << result.GetIssues().ToString());
- }
-
- {
- TString query = Sprintf("UPSERT INTO [Root/%s/table] (Key, Value) SELECT Key, Value FROM [Root/%s/table];", second_tenant_name.c_str(), first_tenant_name.c_str());
- auto result = session.ExecuteDataQuery(query, TTxControl::BeginTx(TTxSettings::SerializableRW()).CommitTx()).ExtractValueSync();
- UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
- UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::GENERIC_ERROR,
- "Status: " << result.GetStatus()
- << " Issues: " << result.GetIssues().ToString());
- }
-}
-}
-
+Y_UNIT_TEST_SUITE(LocalityOperation) {
+Y_UNIT_TEST(LocksFromAnotherTenants) {
+ TKikimrWithGrpcAndRootSchema server;
+ //server.Server_->SetupLogging(
+
+ auto connection = NYdb::TDriver(
+ TDriverConfig()
+ .SetEndpoint(TStringBuilder() << "localhost:" << server.GetPort()));
+
+ TString first_tenant_name = "ydb_tenant_0";
+ TString second_tenant_name = "ydb_tenant_1";
+
+ {
+ TClient admClient(*server.ServerSettings);
+ for (auto& tenant_name: TVector<TString>{first_tenant_name, second_tenant_name}) {
+ TString tenant_path = Sprintf("/Root/%s", tenant_name.c_str());
+
+ TStoragePools tenant_pools = CreatePoolsForTenant(admClient, server.ServerSettings->StoragePoolTypes, tenant_path);
+
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_OK,
+ admClient.CreateSubdomain("/Root", GetSubDomainDeclarationSetting(tenant_name)));
+ UNIT_ASSERT_VALUES_EQUAL(NMsgBusProxy::MSTATUS_INPROGRESS,
+ admClient.AlterSubdomain("/Root", GetSubDomainDefaultSetting(tenant_name, tenant_pools), TDuration::MilliSeconds(500)));
+
+ server.Tenants_->Run(tenant_path, 1);
+ }
+ }
+
+ NYdb::NTable::TTableClient client(connection);
+
+ auto sessionResult = client.CreateSession().ExtractValueSync();
+ UNIT_ASSERT_VALUES_EQUAL(sessionResult.GetStatus(), EStatus::SUCCESS);
+ auto session = sessionResult.GetSession();
+
+ for (auto& tenant_name: TVector<TString>{first_tenant_name, second_tenant_name}) {
+ auto tableBuilder = client.GetTableBuilder();
+ tableBuilder
+ .AddNullableColumn("Key", EPrimitiveType::Uint32)
+ .AddNullableColumn("Value", EPrimitiveType::Utf8);
+ tableBuilder.SetPrimaryKeyColumn("Key");
+
+ TString table_path = Sprintf("/Root/%s/table", tenant_name.c_str());
+
+ auto result = session.CreateTable(table_path, tableBuilder.Build()).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL(result.GetStatus(), EStatus::SUCCESS);
+ }
+
+ {
+ TString query = Sprintf("UPSERT INTO [Root/%s/table] (Key, Value) VALUES (1u, \"One\");", first_tenant_name.c_str());
+ auto result = session.ExecuteDataQuery(query, TTxControl::BeginTx(TTxSettings::SerializableRW()).CommitTx()).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetStatus() << result.GetIssues().ToString());
+ }
+
+ {
+ TString query = Sprintf("UPSERT INTO [Root/%s/table] (Key, Value) VALUES (2u, \"Second\");", second_tenant_name.c_str());
+ auto result = session.ExecuteDataQuery(query, TTxControl::BeginTx(TTxSettings::SerializableRW()).CommitTx()).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::SUCCESS,
+ "Status: " << result.GetStatus()
+ << " Issues: " << result.GetIssues().ToString());
+ }
+
+ {
+ TString query = Sprintf("UPSERT INTO [Root/%s/table] (Key, Value) SELECT Key, Value FROM [Root/%s/table];", second_tenant_name.c_str(), first_tenant_name.c_str());
+ auto result = session.ExecuteDataQuery(query, TTxControl::BeginTx(TTxSettings::SerializableRW()).CommitTx()).ExtractValueSync();
+ UNIT_ASSERT_EQUAL(result.IsTransportError(), false);
+ UNIT_ASSERT_EQUAL_C(result.GetStatus(), EStatus::GENERIC_ERROR,
+ "Status: " << result.GetStatus()
+ << " Issues: " << result.GetIssues().ToString());
+ }
+}
+}
+
} // namespace NKikimr
diff --git a/ydb/tests/functional/rename/__init__.py b/ydb/tests/functional/rename/__init__.py
index 1ae49cb1d2e..11f255bed76 100644
--- a/ydb/tests/functional/rename/__init__.py
+++ b/ydb/tests/functional/rename/__init__.py
@@ -1,3 +1,3 @@
-# -*- coding: utf-8 -*-
-
-_author__ = 'svc@yandex-team.ru'
+# -*- coding: utf-8 -*-
+
+_author__ = 'svc@yandex-team.ru'
diff --git a/ydb/tests/functional/rename/common.py b/ydb/tests/functional/rename/common.py
index 0aa9953d0e8..13359e31908 100644
--- a/ydb/tests/functional/rename/common.py
+++ b/ydb/tests/functional/rename/common.py
@@ -1,75 +1,75 @@
-# -*- coding: utf-8 -*-
-import logging
-import six
-import ydb
-
-from tornado import gen
+# -*- coding: utf-8 -*-
+import logging
+import six
+import ydb
+
+from tornado import gen
from ydb.tornado import as_tornado_future
-
-
-logger = logging.getLogger(__name__)
-
-
-robust_retries = ydb.RetrySettings() \
- .with_fast_backoff(ydb.BackoffSettings(ceiling=10, slot_duration=0.05, uncertain_ratio=0.1)) \
- .with_slow_backoff(ydb.BackoffSettings(ceiling=10, slot_duration=1.00, uncertain_ratio=0.2))
-
-
-async def async_retry_operation(callee, retry_settings=None, *args, **kwargs):
- opt_generator = ydb.retry_operation_impl(callee, retry_settings, *args, **kwargs)
- for next_opt in opt_generator:
- if isinstance(next_opt, ydb.YdbRetryOperationSleepOpt):
- await gen.sleep(next_opt.timeout)
- else:
- try:
- return await next_opt.result
- except Exception as e:
- next_opt.set_exception(e)
-
-
-async def async_execute_serializable_job(pool: ydb.SessionPool, query, parameters):
- async def calle(pool, query, parameters):
- with pool.async_checkout() as async_session:
- session = await as_tornado_future(async_session)
- prepared_query = await as_tornado_future(session.async_prepare(query))
- with session.transaction(ydb.SerializableReadWrite()) as tx:
- result = await as_tornado_future(
- tx.async_execute(
- prepared_query,
- parameters=parameters,
- commit_tx=True
- )
- )
- return result
- return await async_retry_operation(calle, robust_retries, pool, query, parameters)
-
-
-async def async_execute_stale_ro_job(pool: ydb.SessionPool, query, parameters):
- async def calle(pool, query, parameters):
- with pool.async_checkout() as async_session:
- session = await as_tornado_future(async_session)
- prepared_query = await as_tornado_future(session.async_prepare(query))
- with session.transaction(ydb.StaleReadOnly()) as tx:
- result = await as_tornado_future(
- tx.async_execute(
- prepared_query,
- parameters=parameters,
- commit_tx=True
- )
- )
- return result
- return await async_retry_operation(calle, robust_retries, pool, query, parameters)
-
-
-async def async_scheme_job(pool: ydb.SessionPool, query):
- async def calle(pool, query):
- with pool.async_checkout() as async_session:
- session = await as_tornado_future(async_session)
- result = await as_tornado_future(session.async_execute_scheme(query))
- return result
- return await async_retry_operation(calle, robust_retries, pool, query)
-
-
-async def async_repeat_n_times(calle, count, *args, **kwargs):
- for _ in six.moves.range(count + 1):
- await calle(*args, **kwargs)
+
+
+logger = logging.getLogger(__name__)
+
+
+robust_retries = ydb.RetrySettings() \
+ .with_fast_backoff(ydb.BackoffSettings(ceiling=10, slot_duration=0.05, uncertain_ratio=0.1)) \
+ .with_slow_backoff(ydb.BackoffSettings(ceiling=10, slot_duration=1.00, uncertain_ratio=0.2))
+
+
+async def async_retry_operation(callee, retry_settings=None, *args, **kwargs):
+ opt_generator = ydb.retry_operation_impl(callee, retry_settings, *args, **kwargs)
+ for next_opt in opt_generator:
+ if isinstance(next_opt, ydb.YdbRetryOperationSleepOpt):
+ await gen.sleep(next_opt.timeout)
+ else:
+ try:
+ return await next_opt.result
+ except Exception as e:
+ next_opt.set_exception(e)
+
+
+async def async_execute_serializable_job(pool: ydb.SessionPool, query, parameters):
+ async def calle(pool, query, parameters):
+ with pool.async_checkout() as async_session:
+ session = await as_tornado_future(async_session)
+ prepared_query = await as_tornado_future(session.async_prepare(query))
+ with session.transaction(ydb.SerializableReadWrite()) as tx:
+ result = await as_tornado_future(
+ tx.async_execute(
+ prepared_query,
+ parameters=parameters,
+ commit_tx=True
+ )
+ )
+ return result
+ return await async_retry_operation(calle, robust_retries, pool, query, parameters)
+
+
+async def async_execute_stale_ro_job(pool: ydb.SessionPool, query, parameters):
+ async def calle(pool, query, parameters):
+ with pool.async_checkout() as async_session:
+ session = await as_tornado_future(async_session)
+ prepared_query = await as_tornado_future(session.async_prepare(query))
+ with session.transaction(ydb.StaleReadOnly()) as tx:
+ result = await as_tornado_future(
+ tx.async_execute(
+ prepared_query,
+ parameters=parameters,
+ commit_tx=True
+ )
+ )
+ return result
+ return await async_retry_operation(calle, robust_retries, pool, query, parameters)
+
+
+async def async_scheme_job(pool: ydb.SessionPool, query):
+ async def calle(pool, query):
+ with pool.async_checkout() as async_session:
+ session = await as_tornado_future(async_session)
+ result = await as_tornado_future(session.async_execute_scheme(query))
+ return result
+ return await async_retry_operation(calle, robust_retries, pool, query)
+
+
+async def async_repeat_n_times(calle, count, *args, **kwargs):
+ for _ in six.moves.range(count + 1):
+ await calle(*args, **kwargs)
diff --git a/ydb/tests/functional/rename/conftest.py b/ydb/tests/functional/rename/conftest.py
index 359e1f0c871..660670cb0a6 100644
--- a/ydb/tests/functional/rename/conftest.py
+++ b/ydb/tests/functional/rename/conftest.py
@@ -1,106 +1,106 @@
-# -*- coding: utf-8 -*-
-import os
-import logging
-import pytest
-import contextlib
-
+# -*- coding: utf-8 -*-
+import os
+import logging
+import pytest
+import contextlib
+
from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
from ydb.tests.library.harness.kikimr_config import KikimrConfigGenerator
from ydb.tests.library.common.types import Erasure
-
-
-logger = logging.getLogger(__name__)
-
-
-@pytest.fixture(scope='module')
-def local_cluster_configuration():
- configurator = KikimrConfigGenerator(
- erasure=Erasure.NONE,
- nodes=3,
- n_to_select=1,
- additional_log_configs={
- 'FLAT_TX_SCHEMESHARD': 7,
- 'SCHEME_BOARD_POPULATOR': 4,
- 'SCHEME_BOARD_SUBSCRIBER': 4,
- }
- )
- return configurator
-
-
-@pytest.fixture(scope='module')
-def ydb_cluster(local_cluster_configuration, request):
- module_name = request.module.__name__
-
- logger.info("setup ydb_cluster for %s", module_name)
-
- logger.info("setup ydb_cluster as local")
- cluster = kikimr_cluster_factory(
- configurator=local_cluster_configuration
- )
- cluster.is_local_test = True
-
- cluster.start()
-
- yield cluster
-
- logger.info("destroy ydb_cluster for %s", module_name)
- cluster.stop()
-
-
-@pytest.fixture(scope='module')
-def ydb_root(ydb_cluster):
+
+
+logger = logging.getLogger(__name__)
+
+
+@pytest.fixture(scope='module')
+def local_cluster_configuration():
+ configurator = KikimrConfigGenerator(
+ erasure=Erasure.NONE,
+ nodes=3,
+ n_to_select=1,
+ additional_log_configs={
+ 'FLAT_TX_SCHEMESHARD': 7,
+ 'SCHEME_BOARD_POPULATOR': 4,
+ 'SCHEME_BOARD_SUBSCRIBER': 4,
+ }
+ )
+ return configurator
+
+
+@pytest.fixture(scope='module')
+def ydb_cluster(local_cluster_configuration, request):
+ module_name = request.module.__name__
+
+ logger.info("setup ydb_cluster for %s", module_name)
+
+ logger.info("setup ydb_cluster as local")
+ cluster = kikimr_cluster_factory(
+ configurator=local_cluster_configuration
+ )
+ cluster.is_local_test = True
+
+ cluster.start()
+
+ yield cluster
+
+ logger.info("destroy ydb_cluster for %s", module_name)
+ cluster.stop()
+
+
+@pytest.fixture(scope='module')
+def ydb_root(ydb_cluster):
return os.path.join("/", ydb_cluster.domain_name)
-
-
-@pytest.fixture(scope='module')
-def ydb_private_client(ydb_cluster):
- return ydb_cluster.client
-
-
-@pytest.fixture(scope='module')
-def ydb_endpoint(ydb_cluster):
- return "%s:%s" % (ydb_cluster.nodes[1].host, ydb_cluster.nodes[1].port)
-
-
-@pytest.fixture(scope='function')
-def extended_test_name(request):
- return request.node.name
-
-
-@contextlib.contextmanager
-def ydb_database_ctx(ydb_cluster, database, timeout_seconds=300):
- logger.info("setup ydb_database %s", database)
-
- ydb_cluster.remove_database(
- database,
- timeout_seconds=timeout_seconds
- )
-
- ydb_cluster.create_database(
- database,
- storage_pool_units_count={
- 'hdd': 1
- },
- timeout_seconds=timeout_seconds
- )
+
+
+@pytest.fixture(scope='module')
+def ydb_private_client(ydb_cluster):
+ return ydb_cluster.client
+
+
+@pytest.fixture(scope='module')
+def ydb_endpoint(ydb_cluster):
+ return "%s:%s" % (ydb_cluster.nodes[1].host, ydb_cluster.nodes[1].port)
+
+
+@pytest.fixture(scope='function')
+def extended_test_name(request):
+ return request.node.name
+
+
+@contextlib.contextmanager
+def ydb_database_ctx(ydb_cluster, database, timeout_seconds=300):
+ logger.info("setup ydb_database %s", database)
+
+ ydb_cluster.remove_database(
+ database,
+ timeout_seconds=timeout_seconds
+ )
+
+ ydb_cluster.create_database(
+ database,
+ storage_pool_units_count={
+ 'hdd': 1
+ },
+ timeout_seconds=timeout_seconds
+ )
slots = ydb_cluster.register_and_start_slots(database, count=1)
-
- try:
- yield database
- finally:
- logger.info("destroy ydb_database for %s", database)
+
+ try:
+ yield database
+ finally:
+ logger.info("destroy ydb_database for %s", database)
for slot in slots:
slot.stop()
- ydb_cluster.remove_database(
- database,
- timeout_seconds=timeout_seconds
- )
-
-
-@pytest.fixture(scope='function')
-def ydb_database(ydb_cluster, ydb_root, extended_test_name):
- database = os.path.join(ydb_root, extended_test_name.replace("[", "_").replace("]", "_"))
-
- with ydb_database_ctx(ydb_cluster, database):
- yield database
+ ydb_cluster.remove_database(
+ database,
+ timeout_seconds=timeout_seconds
+ )
+
+
+@pytest.fixture(scope='function')
+def ydb_database(ydb_cluster, ydb_root, extended_test_name):
+ database = os.path.join(ydb_root, extended_test_name.replace("[", "_").replace("]", "_"))
+
+ with ydb_database_ctx(ydb_cluster, database):
+ yield database
diff --git a/ydb/tests/functional/rename/test.py b/ydb/tests/functional/rename/test.py
index eb1f627b2e9..01f5e421b8a 100644
--- a/ydb/tests/functional/rename/test.py
+++ b/ydb/tests/functional/rename/test.py
@@ -1,261 +1,261 @@
-# -*- coding: utf-8 -*-
-import os
-import logging
-import pytest
-import ydb
-
-from tornado import gen
-from tornado.ioloop import IOLoop
-
+# -*- coding: utf-8 -*-
+import os
+import logging
+import pytest
+import ydb
+
+from tornado import gen
+from tornado.ioloop import IOLoop
+
from ydb.tests.library.common.types import from_bytes
from ydb.tornado import as_tornado_future
-from common import (
- async_execute_serializable_job,
- async_execute_stale_ro_job,
- async_scheme_job,
- async_repeat_n_times
-)
-
-logger = logging.getLogger(__name__)
-
-SIMPLE_TABLE_TEMPLATE = (
-"""
-CREATE TABLE `{table}` (
- `id` Uint64,
- `value` Utf8,
- PRIMARY KEY (`id`)
-)
-"""
-)
-
-INDEXED_TABLE_TEMPLATE = (
-"""
-CREATE TABLE `{table}` (
- `id` Uint64,
- `value` Utf8,
- PRIMARY KEY (`id`),
- INDEX value_index GLOBAL ON (`value`)
-)
-"""
-)
-
-INDEXED_ASYNC_TABLE_TEMPLATE = (
-"""
-CREATE TABLE `{table}` (
- `id` Uint64,
- `value` Utf8,
- PRIMARY KEY (`id`),
- INDEX value_index GLOBAL ASYNC ON (`value`)
-)
-"""
-)
-
-DROP_TABLE_TEMPLATE = (
-"""
-DROP TABLE `{table}`
-"""
-)
-
-
-def create_simple_table(pool, path):
- async def async_create():
- await async_scheme_job(pool, SIMPLE_TABLE_TEMPLATE.format(table=path))
-
- return async_create
-
-
-def create_indexed_table(pool, path):
- async def async_create():
- await async_scheme_job(pool, INDEXED_TABLE_TEMPLATE.format(table=path))
-
- return async_create
-
-
-def create_indexed_async_table(pool, path):
- async def async_create():
- await async_scheme_job(pool, INDEXED_ASYNC_TABLE_TEMPLATE.format(table=path))
-
- return async_create
-
-
-def replace_table(pool, src, dst, *args):
- async def async_move():
- with pool.async_checkout() as async_session:
- session = await as_tornado_future(async_session)
- await as_tornado_future(
- session.async_rename_tables(
- [
- ydb.table.RenameItem(
- source_path=src,
- destination_path=dst,
- replace_destination=True,
- )
- ]
- )
- )
- return async_move
-
-
-def substitute_table(pool, src, dst, backup):
- async def async_move():
- try:
- await async_scheme_job(pool, DROP_TABLE_TEMPLATE.format(table=backup))
- except ydb.issues.SchemeError:
- pass
-
- with pool.async_checkout() as async_session:
- session = await as_tornado_future(async_session)
- await as_tornado_future(
- session.async_rename_tables(
- [
- ydb.table.RenameItem(
- source_path=dst,
- destination_path=backup,
- replace_destination=False,
- ),
- ydb.table.RenameItem(
- source_path=src,
- destination_path=dst,
- replace_destination=False,
- )
- ]
- )
- )
- return async_move
-
-
-class Simple:
- def __init__(self, driver_configs, create_method, replace_method, select_from_index=False):
- self._driver_configs = driver_configs
- self._database = driver_configs.database
-
- self._driver = ydb.Driver(self._driver_configs)
- self._driver.wait(timeout=5)
-
- self._pool = ydb.SessionPool(driver=self._driver, size=10)
-
- self._create_method = create_method
- self._replace_method = replace_method
-
- self._select_from_index = select_from_index
-
- upsert_table_template = (
- """
- DECLARE $key AS Uint64;
- DECLARE $value AS Utf8;
-
- UPSERT INTO `{table}`
- (id, value)
- VALUES ($key, $value);
- """
- )
-
- select_table_template = (
- """
- DECLARE $key AS Uint64;
- SELECT value FROM `{table}` WHERE id = $key;
- """
- )
-
- select_index_table_template = (
- """
- DECLARE $value AS Utf8;
- SELECT id FROM `{table}` VIEW `value_index` WHERE value = $value;
- """
- )
-
- tables = ["table_main", "table_tmp", "table_backup"]
-
- def prepare(self):
- IOLoop.current().run_sync(lambda: self.async_prepare("table_main"))
-
- @staticmethod
- def _value_for_table_row(table, key):
- if key % 2 == 0:
- return from_bytes("{table}-{idx}".format(table=table, idx=key))
- else:
- return from_bytes("value-{idx}".format(idx=key))
-
- async def async_prepare(self, table):
- logger.info("begin")
-
- await self._create_method(self._pool, table)()
- logger.info("create_method done")
-
- coros = []
- query = self.upsert_table_template.format(table=table)
- for idx in range(30):
- parameters = {
- '$key': idx,
- '$value': self._value_for_table_row(table, idx)
- }
- coros.append(async_execute_serializable_job(self._pool, query, parameters))
-
- logger.info("wait coros")
- await gen.multi(coros)
-
- def move(self):
- IOLoop.current().run_sync(lambda: self.async_prepare("table_tmp"))
-
- coros = []
-
- write_query = self.upsert_table_template.format(table="table_main")
- for idx in range(20):
- parameters = {
- '$key': idx,
- '$value': self._value_for_table_row("table_main", idx)
- }
- coros.append(async_repeat_n_times(async_execute_serializable_job, 20, self._pool, write_query, parameters))
-
- read_query = self.select_table_template.format(table="table_main")
- for idx in range(20):
- parameters = {
- '$key': 10+idx,
- }
- coros.append(async_repeat_n_times(async_execute_serializable_job, 15, self._pool, read_query, parameters))
-
- if self._select_from_index:
- read_index_query = self.select_index_table_template.format(table="table_main")
- for idx in range(20):
- parameters = {
- '$value': self._value_for_table_row("table_main", idx)
- }
- coros.append(async_repeat_n_times(async_execute_stale_ro_job, 15, self._pool, read_index_query, parameters))
-
- coros.append(
- self._replace_method(
- self._pool,
- os.path.join(self._database, "table_tmp"),
- os.path.join(self._database, "table_main"),
- os.path.join(self._database, "table_backup")
- )()
- )
-
- async def calle():
- await gen.multi(coros)
-
- IOLoop.current().run_sync(lambda: calle())
-
-
-@pytest.mark.parametrize("create_method,select_from_index", [
- (create_simple_table, False), (create_indexed_table, True), (create_indexed_async_table, True)])
-@pytest.mark.parametrize("replace_method", [replace_table, substitute_table])
-def test_client_gets_retriable_errors_when_rename(create_method, select_from_index, replace_method, ydb_database, ydb_endpoint):
- database = ydb_database
- logger.info(" database is %s", database)
-
- driver_configs = ydb.DriverConfig(
- ydb_endpoint,
- database
- )
-
- scenario = Simple(driver_configs, create_method, replace_method, select_from_index)
-
- logger.info(" database is %s: PREPARE", database)
- scenario.prepare()
-
- logger.info(" database is %s: MOVE 1", database)
- scenario.move()
-
- logger.info(" database is %s: MOVE 2", database)
- scenario.move()
+from common import (
+ async_execute_serializable_job,
+ async_execute_stale_ro_job,
+ async_scheme_job,
+ async_repeat_n_times
+)
+
+logger = logging.getLogger(__name__)
+
+SIMPLE_TABLE_TEMPLATE = (
+"""
+CREATE TABLE `{table}` (
+ `id` Uint64,
+ `value` Utf8,
+ PRIMARY KEY (`id`)
+)
+"""
+)
+
+INDEXED_TABLE_TEMPLATE = (
+"""
+CREATE TABLE `{table}` (
+ `id` Uint64,
+ `value` Utf8,
+ PRIMARY KEY (`id`),
+ INDEX value_index GLOBAL ON (`value`)
+)
+"""
+)
+
+INDEXED_ASYNC_TABLE_TEMPLATE = (
+"""
+CREATE TABLE `{table}` (
+ `id` Uint64,
+ `value` Utf8,
+ PRIMARY KEY (`id`),
+ INDEX value_index GLOBAL ASYNC ON (`value`)
+)
+"""
+)
+
+DROP_TABLE_TEMPLATE = (
+"""
+DROP TABLE `{table}`
+"""
+)
+
+
+def create_simple_table(pool, path):
+ async def async_create():
+ await async_scheme_job(pool, SIMPLE_TABLE_TEMPLATE.format(table=path))
+
+ return async_create
+
+
+def create_indexed_table(pool, path):
+ async def async_create():
+ await async_scheme_job(pool, INDEXED_TABLE_TEMPLATE.format(table=path))
+
+ return async_create
+
+
+def create_indexed_async_table(pool, path):
+ async def async_create():
+ await async_scheme_job(pool, INDEXED_ASYNC_TABLE_TEMPLATE.format(table=path))
+
+ return async_create
+
+
+def replace_table(pool, src, dst, *args):
+ async def async_move():
+ with pool.async_checkout() as async_session:
+ session = await as_tornado_future(async_session)
+ await as_tornado_future(
+ session.async_rename_tables(
+ [
+ ydb.table.RenameItem(
+ source_path=src,
+ destination_path=dst,
+ replace_destination=True,
+ )
+ ]
+ )
+ )
+ return async_move
+
+
+def substitute_table(pool, src, dst, backup):
+ async def async_move():
+ try:
+ await async_scheme_job(pool, DROP_TABLE_TEMPLATE.format(table=backup))
+ except ydb.issues.SchemeError:
+ pass
+
+ with pool.async_checkout() as async_session:
+ session = await as_tornado_future(async_session)
+ await as_tornado_future(
+ session.async_rename_tables(
+ [
+ ydb.table.RenameItem(
+ source_path=dst,
+ destination_path=backup,
+ replace_destination=False,
+ ),
+ ydb.table.RenameItem(
+ source_path=src,
+ destination_path=dst,
+ replace_destination=False,
+ )
+ ]
+ )
+ )
+ return async_move
+
+
+class Simple:
+ def __init__(self, driver_configs, create_method, replace_method, select_from_index=False):
+ self._driver_configs = driver_configs
+ self._database = driver_configs.database
+
+ self._driver = ydb.Driver(self._driver_configs)
+ self._driver.wait(timeout=5)
+
+ self._pool = ydb.SessionPool(driver=self._driver, size=10)
+
+ self._create_method = create_method
+ self._replace_method = replace_method
+
+ self._select_from_index = select_from_index
+
+ upsert_table_template = (
+ """
+ DECLARE $key AS Uint64;
+ DECLARE $value AS Utf8;
+
+ UPSERT INTO `{table}`
+ (id, value)
+ VALUES ($key, $value);
+ """
+ )
+
+ select_table_template = (
+ """
+ DECLARE $key AS Uint64;
+ SELECT value FROM `{table}` WHERE id = $key;
+ """
+ )
+
+ select_index_table_template = (
+ """
+ DECLARE $value AS Utf8;
+ SELECT id FROM `{table}` VIEW `value_index` WHERE value = $value;
+ """
+ )
+
+ tables = ["table_main", "table_tmp", "table_backup"]
+
+ def prepare(self):
+ IOLoop.current().run_sync(lambda: self.async_prepare("table_main"))
+
+ @staticmethod
+ def _value_for_table_row(table, key):
+ if key % 2 == 0:
+ return from_bytes("{table}-{idx}".format(table=table, idx=key))
+ else:
+ return from_bytes("value-{idx}".format(idx=key))
+
+ async def async_prepare(self, table):
+ logger.info("begin")
+
+ await self._create_method(self._pool, table)()
+ logger.info("create_method done")
+
+ coros = []
+ query = self.upsert_table_template.format(table=table)
+ for idx in range(30):
+ parameters = {
+ '$key': idx,
+ '$value': self._value_for_table_row(table, idx)
+ }
+ coros.append(async_execute_serializable_job(self._pool, query, parameters))
+
+ logger.info("wait coros")
+ await gen.multi(coros)
+
+ def move(self):
+ IOLoop.current().run_sync(lambda: self.async_prepare("table_tmp"))
+
+ coros = []
+
+ write_query = self.upsert_table_template.format(table="table_main")
+ for idx in range(20):
+ parameters = {
+ '$key': idx,
+ '$value': self._value_for_table_row("table_main", idx)
+ }
+ coros.append(async_repeat_n_times(async_execute_serializable_job, 20, self._pool, write_query, parameters))
+
+ read_query = self.select_table_template.format(table="table_main")
+ for idx in range(20):
+ parameters = {
+ '$key': 10+idx,
+ }
+ coros.append(async_repeat_n_times(async_execute_serializable_job, 15, self._pool, read_query, parameters))
+
+ if self._select_from_index:
+ read_index_query = self.select_index_table_template.format(table="table_main")
+ for idx in range(20):
+ parameters = {
+ '$value': self._value_for_table_row("table_main", idx)
+ }
+ coros.append(async_repeat_n_times(async_execute_stale_ro_job, 15, self._pool, read_index_query, parameters))
+
+ coros.append(
+ self._replace_method(
+ self._pool,
+ os.path.join(self._database, "table_tmp"),
+ os.path.join(self._database, "table_main"),
+ os.path.join(self._database, "table_backup")
+ )()
+ )
+
+ async def calle():
+ await gen.multi(coros)
+
+ IOLoop.current().run_sync(lambda: calle())
+
+
+@pytest.mark.parametrize("create_method,select_from_index", [
+ (create_simple_table, False), (create_indexed_table, True), (create_indexed_async_table, True)])
+@pytest.mark.parametrize("replace_method", [replace_table, substitute_table])
+def test_client_gets_retriable_errors_when_rename(create_method, select_from_index, replace_method, ydb_database, ydb_endpoint):
+ database = ydb_database
+ logger.info(" database is %s", database)
+
+ driver_configs = ydb.DriverConfig(
+ ydb_endpoint,
+ database
+ )
+
+ scenario = Simple(driver_configs, create_method, replace_method, select_from_index)
+
+ logger.info(" database is %s: PREPARE", database)
+ scenario.prepare()
+
+ logger.info(" database is %s: MOVE 1", database)
+ scenario.move()
+
+ logger.info(" database is %s: MOVE 2", database)
+ scenario.move()
diff --git a/ydb/tests/functional/rename/ya.make b/ydb/tests/functional/rename/ya.make
index c21f376f0ee..45d7ea3ba10 100644
--- a/ydb/tests/functional/rename/ya.make
+++ b/ydb/tests/functional/rename/ya.make
@@ -1,41 +1,41 @@
-OWNER(g:kikimr)
-PY3TEST()
-
+OWNER(g:kikimr)
+PY3TEST()
+
ENV(YDB_DRIVER_BINARY="ydb/apps/ydbd/ydbd")
-PY_SRCS (
- conftest.py
- common.py
-)
-
-TEST_SRCS(
- test.py
-)
-
-
-REQUIREMENTS(
- cpu:4
- ram:16
-)
-
-FORK_TEST_FILES()
-
-IF (SANITIZER_TYPE OR WITH_VALGRIND)
- TIMEOUT(3600)
- SIZE(LARGE)
- FORK_SUBTESTS()
- SPLIT_FACTOR(10)
- TAG(ya:fat)
-ELSE()
- TIMEOUT(600)
- SIZE(MEDIUM)
-ENDIF()
-
+PY_SRCS (
+ conftest.py
+ common.py
+)
+
+TEST_SRCS(
+ test.py
+)
+
+
+REQUIREMENTS(
+ cpu:4
+ ram:16
+)
+
+FORK_TEST_FILES()
+
+IF (SANITIZER_TYPE OR WITH_VALGRIND)
+ TIMEOUT(3600)
+ SIZE(LARGE)
+ FORK_SUBTESTS()
+ SPLIT_FACTOR(10)
+ TAG(ya:fat)
+ELSE()
+ TIMEOUT(600)
+ SIZE(MEDIUM)
+ENDIF()
+
DEPENDS(ydb/apps/ydbd)
-
-PEERDIR(
+
+PEERDIR(
ydb/tests/library
ydb/public/sdk/python/ydb
- contrib/python/tornado/tornado-4
-)
-
-END()
+ contrib/python/tornado/tornado-4
+)
+
+END()
diff --git a/ydb/tests/functional/scheme_shard/test_scheme_shard_operations.py b/ydb/tests/functional/scheme_shard/test_scheme_shard_operations.py
index 96bfb4feaad..7c92c832549 100644
--- a/ydb/tests/functional/scheme_shard/test_scheme_shard_operations.py
+++ b/ydb/tests/functional/scheme_shard/test_scheme_shard_operations.py
@@ -192,7 +192,7 @@ class TestSchemeShardSimpleOps(object):
callee,
raises(
ydb.SchemeError,
- 'path has children'
+ 'path has children'
)
)
diff --git a/ydb/tests/functional/scheme_tests/tablet_scheme_tests.py b/ydb/tests/functional/scheme_tests/tablet_scheme_tests.py
index 20170f2031d..a057a6c5d83 100644
--- a/ydb/tests/functional/scheme_tests/tablet_scheme_tests.py
+++ b/ydb/tests/functional/scheme_tests/tablet_scheme_tests.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-import itertools
+import itertools
import os
import pytest
import json
@@ -44,18 +44,18 @@ def get_tablets():
class TestTabletSchemes(object):
@classmethod
- def teardown_class(cls):
+ def teardown_class(cls):
cls.cluster.stop()
-
+
@classmethod
def setup_class(cls):
cls.cluster = kikimr_cluster_factory()
cls.cluster.start()
cls.client = cls.cluster.client
- cls.shard_index = itertools.count(start=1)
+ cls.shard_index = itertools.count(start=1)
cls.to_prepare = (
TabletTypes.PERSQUEUE, TabletTypes.KEYVALUEFLAT, TabletTypes.FLAT_DATASHARD, TabletTypes.KESUS)
-
+
def prepare_tablet(self, tablet_type):
if tablet_type in self.to_prepare:
create_tablets_and_wait_for_start(
@@ -64,15 +64,15 @@ class TestTabletSchemes(object):
owner_id=next(
self.shard_index
)
- )
+ )
return tablet_type
-
- def get_tablet_id(self, tablet_type):
+
+ def get_tablet_id(self, tablet_type):
resp = self.client.tablet_state(tablet_type)
infos = [info for info in resp.TabletStateInfo]
tablet_id = infos[0].TabletId
- return tablet_id
-
+ return tablet_id
+
@pytest.mark.parametrize(['tablet'], get_tablets())
def test_tablet_schemes(self, tablet):
tablet_type = self.prepare_tablet(getattr(TabletTypes, tablet.upper()))
diff --git a/ydb/tests/functional/serverless/conftest.py b/ydb/tests/functional/serverless/conftest.py
index 42f87655fa2..0edf2c4bb73 100644
--- a/ydb/tests/functional/serverless/conftest.py
+++ b/ydb/tests/functional/serverless/conftest.py
@@ -1,213 +1,213 @@
-# -*- coding: utf-8 -*-
-import os
-import logging
-import pytest
-import contextlib
-
+# -*- coding: utf-8 -*-
+import os
+import logging
+import pytest
+import contextlib
+
from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
from ydb.tests.library.harness.kikimr_config import KikimrConfigGenerator
from ydb.tests.library.harness.util import LogLevels
from ydb.tests.library.common.types import Erasure
-
-
-logger = logging.getLogger(__name__)
-
-
-@pytest.fixture(scope='module')
-def local_cluster_configuration():
- configurator = KikimrConfigGenerator(
- erasure=Erasure.NONE,
- nodes=1,
- enable_metering=True,
+
+
+logger = logging.getLogger(__name__)
+
+
+@pytest.fixture(scope='module')
+def local_cluster_configuration():
+ configurator = KikimrConfigGenerator(
+ erasure=Erasure.NONE,
+ nodes=1,
+ enable_metering=True,
disable_mvcc=True,
- additional_log_configs={
- 'TX_PROXY': LogLevels.DEBUG,
- 'KQP_PROXY': LogLevels.DEBUG,
- 'KQP_WORKER': LogLevels.DEBUG,
- 'KQP_GATEWAY': LogLevels.DEBUG,
- 'GRPC_PROXY': LogLevels.TRACE,
- 'KQP_YQL': LogLevels.DEBUG,
- 'TX_DATASHARD': LogLevels.DEBUG,
- 'FLAT_TX_SCHEMESHARD': LogLevels.DEBUG,
- 'SCHEMESHARD_DESCRIBE': LogLevels.DEBUG,
-
- 'SCHEME_BOARD_POPULATOR': LogLevels.DEBUG,
-
- 'SCHEME_BOARD_REPLICA': LogLevels.ERROR,
- 'SCHEME_BOARD_SUBSCRIBER': LogLevels.ERROR,
- 'TX_PROXY_SCHEME_CACHE': LogLevels.ERROR,
-
- 'CMS': LogLevels.DEBUG,
- 'CMS_TENANTS': LogLevels.DEBUG,
-
- }
- )
- return configurator
-
-
-@pytest.fixture(scope='module')
-def metering_file_path(local_cluster_configuration):
- return local_cluster_configuration.metering_file_path
-
-
-@pytest.fixture(scope='module')
-def ydb_cluster(local_cluster_configuration, request):
- module_name = request.module.__name__
-
- logger.info("setup ydb_cluster for %s", module_name)
-
- cluster = kikimr_cluster_factory(
- configurator=local_cluster_configuration
- )
- cluster.is_local_test = True
-
- cluster.start()
-
- yield cluster
-
- logger.info("destroy ydb_cluster for %s", module_name)
- cluster.stop()
-
-
-@pytest.fixture(scope='module')
-def ydb_root(ydb_cluster):
+ additional_log_configs={
+ 'TX_PROXY': LogLevels.DEBUG,
+ 'KQP_PROXY': LogLevels.DEBUG,
+ 'KQP_WORKER': LogLevels.DEBUG,
+ 'KQP_GATEWAY': LogLevels.DEBUG,
+ 'GRPC_PROXY': LogLevels.TRACE,
+ 'KQP_YQL': LogLevels.DEBUG,
+ 'TX_DATASHARD': LogLevels.DEBUG,
+ 'FLAT_TX_SCHEMESHARD': LogLevels.DEBUG,
+ 'SCHEMESHARD_DESCRIBE': LogLevels.DEBUG,
+
+ 'SCHEME_BOARD_POPULATOR': LogLevels.DEBUG,
+
+ 'SCHEME_BOARD_REPLICA': LogLevels.ERROR,
+ 'SCHEME_BOARD_SUBSCRIBER': LogLevels.ERROR,
+ 'TX_PROXY_SCHEME_CACHE': LogLevels.ERROR,
+
+ 'CMS': LogLevels.DEBUG,
+ 'CMS_TENANTS': LogLevels.DEBUG,
+
+ }
+ )
+ return configurator
+
+
+@pytest.fixture(scope='module')
+def metering_file_path(local_cluster_configuration):
+ return local_cluster_configuration.metering_file_path
+
+
+@pytest.fixture(scope='module')
+def ydb_cluster(local_cluster_configuration, request):
+ module_name = request.module.__name__
+
+ logger.info("setup ydb_cluster for %s", module_name)
+
+ cluster = kikimr_cluster_factory(
+ configurator=local_cluster_configuration
+ )
+ cluster.is_local_test = True
+
+ cluster.start()
+
+ yield cluster
+
+ logger.info("destroy ydb_cluster for %s", module_name)
+ cluster.stop()
+
+
+@pytest.fixture(scope='module')
+def ydb_root(ydb_cluster):
return os.path.join("/", ydb_cluster.domain_name)
-
-
-@pytest.fixture(scope='module')
-def ydb_private_client(ydb_cluster):
- return ydb_cluster.client
-
-
-@pytest.fixture(scope='module')
-def ydb_endpoint(ydb_cluster):
- return "%s:%s" % (ydb_cluster.nodes[1].host, ydb_cluster.nodes[1].port)
-
-
-@pytest.fixture(scope='function')
-def extended_test_name(request):
- return request.node.name
-
-
-@contextlib.contextmanager
-def ydb_database_ctx(ydb_cluster, database, timeout_seconds=100):
- logger.info("setup ydb_database %s", database)
-
- ydb_cluster.remove_database(
- database,
- timeout_seconds=timeout_seconds
- )
-
- ydb_cluster.create_database(
- database,
- storage_pool_units_count={
- 'hdd': 1
- },
- timeout_seconds=timeout_seconds
- )
-
+
+
+@pytest.fixture(scope='module')
+def ydb_private_client(ydb_cluster):
+ return ydb_cluster.client
+
+
+@pytest.fixture(scope='module')
+def ydb_endpoint(ydb_cluster):
+ return "%s:%s" % (ydb_cluster.nodes[1].host, ydb_cluster.nodes[1].port)
+
+
+@pytest.fixture(scope='function')
+def extended_test_name(request):
+ return request.node.name
+
+
+@contextlib.contextmanager
+def ydb_database_ctx(ydb_cluster, database, timeout_seconds=100):
+ logger.info("setup ydb_database %s", database)
+
+ ydb_cluster.remove_database(
+ database,
+ timeout_seconds=timeout_seconds
+ )
+
+ ydb_cluster.create_database(
+ database,
+ storage_pool_units_count={
+ 'hdd': 1
+ },
+ timeout_seconds=timeout_seconds
+ )
+
slots = ydb_cluster.register_and_start_slots(database, count=1)
ydb_cluster.wait_tenant_up(database)
- try:
- yield database
- finally:
- logger.info("destroy ydb_database for %s", database)
+ try:
+ yield database
+ finally:
+ logger.info("destroy ydb_database for %s", database)
for slot in slots:
slot.stop()
- ydb_cluster.remove_database(
- database,
- timeout_seconds=timeout_seconds
- )
-
-
-@pytest.fixture(scope='function')
-def ydb_database(ydb_cluster, ydb_root, extended_test_name):
- database = os.path.join(ydb_root, extended_test_name.replace("[", "_").replace("]", "_"))
-
- with ydb_database_ctx(ydb_cluster, database):
- yield database
-
-
-@contextlib.contextmanager
-def ydb_hostel_db_ctx(ydb_cluster, ydb_root, timeout_seconds=100):
- database = os.path.join(ydb_root, "hostel_db")
- logger.info("setup ydb_hostel_db %s", database)
-
- ydb_cluster.remove_database(
- database,
- timeout_seconds=timeout_seconds
- )
-
- ydb_cluster.create_hostel_database(
- database,
- storage_pool_units_count={
- 'hdd': 1
- },
- timeout_seconds=timeout_seconds
- )
-
+ ydb_cluster.remove_database(
+ database,
+ timeout_seconds=timeout_seconds
+ )
+
+
+@pytest.fixture(scope='function')
+def ydb_database(ydb_cluster, ydb_root, extended_test_name):
+ database = os.path.join(ydb_root, extended_test_name.replace("[", "_").replace("]", "_"))
+
+ with ydb_database_ctx(ydb_cluster, database):
+ yield database
+
+
+@contextlib.contextmanager
+def ydb_hostel_db_ctx(ydb_cluster, ydb_root, timeout_seconds=100):
+ database = os.path.join(ydb_root, "hostel_db")
+ logger.info("setup ydb_hostel_db %s", database)
+
+ ydb_cluster.remove_database(
+ database,
+ timeout_seconds=timeout_seconds
+ )
+
+ ydb_cluster.create_hostel_database(
+ database,
+ storage_pool_units_count={
+ 'hdd': 1
+ },
+ timeout_seconds=timeout_seconds
+ )
+
slots = ydb_cluster.register_and_start_slots(database, count=3)
ydb_cluster.wait_tenant_up(database)
- try:
- yield database
- finally:
- logger.info("destroy ydb_hostel_db for %s", database)
+ try:
+ yield database
+ finally:
+ logger.info("destroy ydb_hostel_db for %s", database)
for slot in slots:
slot.stop()
-
- ydb_cluster.remove_database(
- database,
- timeout_seconds=timeout_seconds
- )
-
-
-@pytest.fixture(scope='module')
-def ydb_hostel_db(ydb_cluster, ydb_root):
- with ydb_hostel_db_ctx(ydb_cluster, ydb_root) as db_name:
- yield db_name
-
-
-@contextlib.contextmanager
+
+ ydb_cluster.remove_database(
+ database,
+ timeout_seconds=timeout_seconds
+ )
+
+
+@pytest.fixture(scope='module')
+def ydb_hostel_db(ydb_cluster, ydb_root):
+ with ydb_hostel_db_ctx(ydb_cluster, ydb_root) as db_name:
+ yield db_name
+
+
+@contextlib.contextmanager
def ydb_serverless_db_ctx(ydb_cluster, database, hostel_db, timeout_seconds=100, schema_quotas=None, disk_quotas=None):
logger.info("setup ydb_serverless_db %s over hostel %s with schema_quotas=%r, disk_quotas=%r", database, hostel_db, schema_quotas, disk_quotas)
-
- ydb_cluster.remove_database(
- database,
- timeout_seconds=timeout_seconds
- )
-
- ydb_cluster.create_serverless_database(
- database,
- hostel_db=hostel_db,
+
+ ydb_cluster.remove_database(
+ database,
+ timeout_seconds=timeout_seconds
+ )
+
+ ydb_cluster.create_serverless_database(
+ database,
+ hostel_db=hostel_db,
timeout_seconds=timeout_seconds,
schema_quotas=schema_quotas,
disk_quotas=disk_quotas,
- attributes={
- "cloud_id": "CLOUD_ID_VAL",
- "folder_id": "FOLDER_ID_VAL",
- "database_id": "DATABASE_ID_VAL",
- },
- )
-
- try:
- yield database
- finally:
- logger.info("destroy ydb_serverless_db for %s", database)
- ydb_cluster.remove_database(
- database,
- timeout_seconds=timeout_seconds
- )
-
-
-@pytest.fixture(scope='function')
-def ydb_serverless_db(ydb_cluster, ydb_root, ydb_hostel_db, extended_test_name):
- database_name = os.path.join(ydb_root, "serverless", extended_test_name.replace("[", "_").replace("]", "_"))
-
- with ydb_serverless_db_ctx(ydb_cluster, database_name, ydb_hostel_db):
- yield database_name
+ attributes={
+ "cloud_id": "CLOUD_ID_VAL",
+ "folder_id": "FOLDER_ID_VAL",
+ "database_id": "DATABASE_ID_VAL",
+ },
+ )
+
+ try:
+ yield database
+ finally:
+ logger.info("destroy ydb_serverless_db for %s", database)
+ ydb_cluster.remove_database(
+ database,
+ timeout_seconds=timeout_seconds
+ )
+
+
+@pytest.fixture(scope='function')
+def ydb_serverless_db(ydb_cluster, ydb_root, ydb_hostel_db, extended_test_name):
+ database_name = os.path.join(ydb_root, "serverless", extended_test_name.replace("[", "_").replace("]", "_"))
+
+ with ydb_serverless_db_ctx(ydb_cluster, database_name, ydb_hostel_db):
+ yield database_name
@pytest.fixture(scope='function')
diff --git a/ydb/tests/functional/serverless/test.py b/ydb/tests/functional/serverless/test.py
index d3a07bfbe9a..55e6b5d4e2e 100644
--- a/ydb/tests/functional/serverless/test.py
+++ b/ydb/tests/functional/serverless/test.py
@@ -1,9 +1,9 @@
-# -*- coding: utf-8 -*-
-import logging
-import os
-import time
+# -*- coding: utf-8 -*-
+import logging
+import os
+import time
import functools
-
+
import pytest
from hamcrest import (
assert_that,
@@ -12,139 +12,139 @@ from hamcrest import (
)
import ydb
-
+
from tornado import gen
from tornado.ioloop import IOLoop
-logger = logging.getLogger(__name__)
-
-
-def test_fixtures(ydb_hostel_db, ydb_serverless_db):
- logger.debug(
- "test for serverless db %s over hostel db %s", ydb_serverless_db, ydb_hostel_db
- )
-
-
-def test_create_table(ydb_hostel_db, ydb_serverless_db, ydb_endpoint, metering_file_path, ydb_private_client):
- logger.debug(
- "test for serverless db %s over hostel db %s", ydb_serverless_db, ydb_hostel_db
- )
-
- database = ydb_serverless_db
-
- driver_config = ydb.DriverConfig(
- ydb_endpoint,
- database
- )
- logger.info(" database is %s", database)
-
- driver = ydb.Driver(driver_config)
- driver.wait(120)
-
- driver.scheme_client.make_directory(os.path.join(database, "dirA0"))
-
- driver.scheme_client.make_directory(os.path.join(database, "dirA1"))
- driver.scheme_client.make_directory(os.path.join(database, "dirA1", "dirB1"))
-
- with ydb.SessionPool(driver) as pool:
- def create_table(session, path):
- session.create_table(
- path,
- ydb.TableDescription()
- .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
- .with_column(ydb.Column('value_string', ydb.OptionalType(ydb.DataType.Utf8)))
- .with_column(ydb.Column('value_num', ydb.OptionalType(ydb.DataType.Uint64)))
- .with_primary_key('id')
- )
-
- pool.retry_operation_sync(create_table, None, os.path.join(database, "dirA1", "dirB1", "table"))
- pool.retry_operation_sync(create_table, None, os.path.join(database, "dirA1", "dirB1", "table1"))
-
- def write_some_data(session, path):
- session.transaction().execute(
- """
+logger = logging.getLogger(__name__)
+
+
+def test_fixtures(ydb_hostel_db, ydb_serverless_db):
+ logger.debug(
+ "test for serverless db %s over hostel db %s", ydb_serverless_db, ydb_hostel_db
+ )
+
+
+def test_create_table(ydb_hostel_db, ydb_serverless_db, ydb_endpoint, metering_file_path, ydb_private_client):
+ logger.debug(
+ "test for serverless db %s over hostel db %s", ydb_serverless_db, ydb_hostel_db
+ )
+
+ database = ydb_serverless_db
+
+ driver_config = ydb.DriverConfig(
+ ydb_endpoint,
+ database
+ )
+ logger.info(" database is %s", database)
+
+ driver = ydb.Driver(driver_config)
+ driver.wait(120)
+
+ driver.scheme_client.make_directory(os.path.join(database, "dirA0"))
+
+ driver.scheme_client.make_directory(os.path.join(database, "dirA1"))
+ driver.scheme_client.make_directory(os.path.join(database, "dirA1", "dirB1"))
+
+ with ydb.SessionPool(driver) as pool:
+ def create_table(session, path):
+ session.create_table(
+ path,
+ ydb.TableDescription()
+ .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
+ .with_column(ydb.Column('value_string', ydb.OptionalType(ydb.DataType.Utf8)))
+ .with_column(ydb.Column('value_num', ydb.OptionalType(ydb.DataType.Uint64)))
+ .with_primary_key('id')
+ )
+
+ pool.retry_operation_sync(create_table, None, os.path.join(database, "dirA1", "dirB1", "table"))
+ pool.retry_operation_sync(create_table, None, os.path.join(database, "dirA1", "dirB1", "table1"))
+
+ def write_some_data(session, path):
+ session.transaction().execute(
+ """
UPSERT INTO `{}` (id, value_string, value_num)
- VALUES (1u, "Ok", 0u),
- (2u, "Also_Ok", 0u),
- (3u, "And_Ok_With_Locks", 0u);
- """.format(path),
- commit_tx=True)
-
- pool.retry_operation_sync(write_some_data, None, os.path.join(database, "dirA1", "dirB1", "table"))
-
- def drop_table(session, path):
- session.drop_table(
- path
- )
-
- pool.retry_operation_sync(drop_table, None, os.path.join(database, "dirA1", "dirB1", "table"))
-
-
-def test_turn_on_serverless_storage_billing(ydb_hostel_db, ydb_serverless_db, ydb_endpoint, metering_file_path, ydb_private_client):
- logger.debug(
- "test for serverless db %s over hostel db %s", ydb_serverless_db, ydb_hostel_db
- )
-
- database = ydb_serverless_db
-
- driver_config = ydb.DriverConfig(
- ydb_endpoint,
- database
- )
- logger.info(" database is %s", database)
-
- driver = ydb.Driver(driver_config)
- driver.wait(120)
-
- driver.scheme_client.make_directory(os.path.join(database, "dirA0"))
-
- driver.scheme_client.make_directory(os.path.join(database, "dirA1"))
- driver.scheme_client.make_directory(os.path.join(database, "dirA1", "dirB1"))
-
- with ydb.SessionPool(driver) as pool:
- def create_table(session, path):
- session.create_table(
- path,
- ydb.TableDescription()
- .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
- .with_column(ydb.Column('value_string', ydb.OptionalType(ydb.DataType.Utf8)))
- .with_column(ydb.Column('value_num', ydb.OptionalType(ydb.DataType.Uint64)))
- .with_primary_key('id')
- )
-
- pool.retry_operation_sync(create_table, None, os.path.join(database, "dirA1", "dirB1", "table"))
- pool.retry_operation_sync(create_table, None, os.path.join(database, "dirA1", "dirB1", "table1"))
-
- def write_some_data(session, path):
- session.transaction().execute(
- """
+ VALUES (1u, "Ok", 0u),
+ (2u, "Also_Ok", 0u),
+ (3u, "And_Ok_With_Locks", 0u);
+ """.format(path),
+ commit_tx=True)
+
+ pool.retry_operation_sync(write_some_data, None, os.path.join(database, "dirA1", "dirB1", "table"))
+
+ def drop_table(session, path):
+ session.drop_table(
+ path
+ )
+
+ pool.retry_operation_sync(drop_table, None, os.path.join(database, "dirA1", "dirB1", "table"))
+
+
+def test_turn_on_serverless_storage_billing(ydb_hostel_db, ydb_serverless_db, ydb_endpoint, metering_file_path, ydb_private_client):
+ logger.debug(
+ "test for serverless db %s over hostel db %s", ydb_serverless_db, ydb_hostel_db
+ )
+
+ database = ydb_serverless_db
+
+ driver_config = ydb.DriverConfig(
+ ydb_endpoint,
+ database
+ )
+ logger.info(" database is %s", database)
+
+ driver = ydb.Driver(driver_config)
+ driver.wait(120)
+
+ driver.scheme_client.make_directory(os.path.join(database, "dirA0"))
+
+ driver.scheme_client.make_directory(os.path.join(database, "dirA1"))
+ driver.scheme_client.make_directory(os.path.join(database, "dirA1", "dirB1"))
+
+ with ydb.SessionPool(driver) as pool:
+ def create_table(session, path):
+ session.create_table(
+ path,
+ ydb.TableDescription()
+ .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
+ .with_column(ydb.Column('value_string', ydb.OptionalType(ydb.DataType.Utf8)))
+ .with_column(ydb.Column('value_num', ydb.OptionalType(ydb.DataType.Uint64)))
+ .with_primary_key('id')
+ )
+
+ pool.retry_operation_sync(create_table, None, os.path.join(database, "dirA1", "dirB1", "table"))
+ pool.retry_operation_sync(create_table, None, os.path.join(database, "dirA1", "dirB1", "table1"))
+
+ def write_some_data(session, path):
+ session.transaction().execute(
+ """
UPSERT INTO `{}` (id, value_string, value_num)
- VALUES (1u, "Ok", 0u),
- (2u, "Also_Ok", 0u),
- (3u, "And_Ok_With_Locks", 0u);
- """.format(path),
- commit_tx=True)
-
- pool.retry_operation_sync(write_some_data, None, os.path.join(database, "dirA1", "dirB1", "table"))
-
- ydb_private_client.add_config_item("FeatureFlags { AllowServerlessStorageBillingForSchemeShard: true }")
- while True:
- with open(metering_file_path, 'r') as metering_file:
- lines = metering_file.readlines()
- if lines:
- logger.info(" metering has data %s", lines[-1])
- break
- logger.info(" wait data in metering file %s", metering_file_path)
- time.sleep(15)
-
- def drop_table(session, path):
- session.drop_table(
- path
- )
-
- pool.retry_operation_sync(drop_table, None, os.path.join(database, "dirA1", "dirB1", "table"))
-
-
+ VALUES (1u, "Ok", 0u),
+ (2u, "Also_Ok", 0u),
+ (3u, "And_Ok_With_Locks", 0u);
+ """.format(path),
+ commit_tx=True)
+
+ pool.retry_operation_sync(write_some_data, None, os.path.join(database, "dirA1", "dirB1", "table"))
+
+ ydb_private_client.add_config_item("FeatureFlags { AllowServerlessStorageBillingForSchemeShard: true }")
+ while True:
+ with open(metering_file_path, 'r') as metering_file:
+ lines = metering_file.readlines()
+ if lines:
+ logger.info(" metering has data %s", lines[-1])
+ break
+ logger.info(" wait data in metering file %s", metering_file_path)
+ time.sleep(15)
+
+ def drop_table(session, path):
+ session.drop_table(
+ path
+ )
+
+ pool.retry_operation_sync(drop_table, None, os.path.join(database, "dirA1", "dirB1", "table"))
+
+
def test_create_table_with_quotas(ydb_hostel_db, ydb_quoted_serverless_db, ydb_endpoint, ydb_cluster):
logger.debug(
"test for serverless db %s over hostel db %s", ydb_quoted_serverless_db, ydb_hostel_db
diff --git a/ydb/tests/functional/serverless/ya.make b/ydb/tests/functional/serverless/ya.make
index ceb6ac12c46..5cadd80a0ab 100644
--- a/ydb/tests/functional/serverless/ya.make
+++ b/ydb/tests/functional/serverless/ya.make
@@ -1,24 +1,24 @@
-OWNER(g:kikimr)
+OWNER(g:kikimr)
PY3TEST()
-
-TEST_SRCS(
- conftest.py
- test.py
-)
-
-FORK_TEST_FILES()
-
-TIMEOUT(600)
-
-SIZE(MEDIUM)
-
+
+TEST_SRCS(
+ conftest.py
+ test.py
+)
+
+FORK_TEST_FILES()
+
+TIMEOUT(600)
+
+SIZE(MEDIUM)
+
ENV(YDB_DRIVER_BINARY="ydb/apps/ydbd/ydbd")
DEPENDS(ydb/apps/ydbd)
-
-PEERDIR(
+
+PEERDIR(
contrib/python/tornado/tornado-4
ydb/tests/library
ydb/public/sdk/python/ydb
-)
-
-END()
+)
+
+END()
diff --git a/ydb/tests/functional/tenants/__init__.py b/ydb/tests/functional/tenants/__init__.py
index 8d1c8b69c3f..8b137891791 100644
--- a/ydb/tests/functional/tenants/__init__.py
+++ b/ydb/tests/functional/tenants/__init__.py
@@ -1 +1 @@
-
+
diff --git a/ydb/tests/functional/tenants/common.py b/ydb/tests/functional/tenants/common.py
index 91f234975e6..827005e5aec 100644
--- a/ydb/tests/functional/tenants/common.py
+++ b/ydb/tests/functional/tenants/common.py
@@ -1,150 +1,150 @@
-# -*- coding: utf-8 -*-
-import os
-import logging
-
+# -*- coding: utf-8 -*-
+import os
+import logging
+
from ydb.tests.library.harness.kikimr_http_client import HiveClient
from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
from ydb.tests.library.harness.kikimr_config import KikimrConfigGenerator
-
+
from ydb.tests.library.harness.util import LogLevels
import ydb
-
-
-logger = logging.getLogger(__name__)
-
-
-class Runtime(object):
- def __init__(self, cluster, tenant_affiliation=None, initial_count=1):
- self._cluster = cluster
- self._tenant_affiliation = tenant_affiliation
- self._initial_count = initial_count
-
- # use console features
- self._scheme_root_key = os.path.join(
+
+
+logger = logging.getLogger(__name__)
+
+
+class Runtime(object):
+ def __init__(self, cluster, tenant_affiliation=None, initial_count=1):
+ self._cluster = cluster
+ self._tenant_affiliation = tenant_affiliation
+ self._initial_count = initial_count
+
+ # use console features
+ self._scheme_root_key = os.path.join(
"/",
cluster.domain_name,
- self._tenant_affiliation
- )
-
- self._allocated_slots = self._cluster.register_slots(self._scheme_root_key, self._initial_count)
- for _ in range(self._initial_count):
- self._allocated_slots.append(
- self._cluster.register_slot(
- self._scheme_root_key
- )
- )
-
- @property
- def root_dir(self):
- return self._scheme_root_key
-
- @property
- def slots(self):
- return self._allocated_slots
-
- def __enter__(self):
- for slot in self._allocated_slots:
- slot.start()
-
- return self
-
- def __exit__(self, exc_type, exc_val, exc_tb):
- for slot in self._allocated_slots:
- try:
- slot.stop()
- except Exception:
- logger.exception(
- "failed to stop daemon...."
- )
-
-
-class DBForStaticSlots(object):
- @classmethod
- def setup_class(cls):
- cls.cluster = kikimr_cluster_factory(
- configurator=KikimrConfigGenerator(
- additional_log_configs={
- 'TX_PROXY': LogLevels.DEBUG,
- 'KQP_PROXY': LogLevels.DEBUG,
- 'KQP_WORKER': LogLevels.DEBUG,
- 'KQP_GATEWAY': LogLevels.DEBUG,
- 'GRPC_PROXY': LogLevels.TRACE,
- 'KQP_YQL': LogLevels.DEBUG,
- 'TX_DATASHARD': LogLevels.DEBUG,
- 'FLAT_TX_SCHEMESHARD': LogLevels.DEBUG,
- 'TX_PROXY_SCHEME_CACHE': LogLevels.DEBUG,
+ self._tenant_affiliation
+ )
+
+ self._allocated_slots = self._cluster.register_slots(self._scheme_root_key, self._initial_count)
+ for _ in range(self._initial_count):
+ self._allocated_slots.append(
+ self._cluster.register_slot(
+ self._scheme_root_key
+ )
+ )
+
+ @property
+ def root_dir(self):
+ return self._scheme_root_key
+
+ @property
+ def slots(self):
+ return self._allocated_slots
+
+ def __enter__(self):
+ for slot in self._allocated_slots:
+ slot.start()
+
+ return self
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ for slot in self._allocated_slots:
+ try:
+ slot.stop()
+ except Exception:
+ logger.exception(
+ "failed to stop daemon...."
+ )
+
+
+class DBForStaticSlots(object):
+ @classmethod
+ def setup_class(cls):
+ cls.cluster = kikimr_cluster_factory(
+ configurator=KikimrConfigGenerator(
+ additional_log_configs={
+ 'TX_PROXY': LogLevels.DEBUG,
+ 'KQP_PROXY': LogLevels.DEBUG,
+ 'KQP_WORKER': LogLevels.DEBUG,
+ 'KQP_GATEWAY': LogLevels.DEBUG,
+ 'GRPC_PROXY': LogLevels.TRACE,
+ 'KQP_YQL': LogLevels.DEBUG,
+ 'TX_DATASHARD': LogLevels.DEBUG,
+ 'FLAT_TX_SCHEMESHARD': LogLevels.DEBUG,
+ 'TX_PROXY_SCHEME_CACHE': LogLevels.DEBUG,
'GRPC_SERVER': LogLevels.DEBUG,
- }
- ),
- )
- cls.cluster.start()
- cls.client = cls.cluster.client
+ }
+ ),
+ )
+ cls.cluster.start()
+ cls.client = cls.cluster.client
cls.root_dir = os.path.join("/", cls.cluster.domain_name)
- first_node = cls.cluster.nodes[1]
- cls.boot_per_node = 1
- cls.boot_batch_size = 5
- hive_cli = HiveClient(first_node.host, first_node.mon_port)
- hive_cli.set_max_scheduled_tablets(cls.boot_per_node)
- hive_cli.set_max_boot_batch_size(cls.boot_batch_size)
- cls.database_name = None
-
- cls.robust_retries = ydb.RetrySettings().with_fast_backoff(
- ydb.BackoffSettings(ceiling=10, slot_duration=0.05, uncertain_ratio=0.1)
- )
-
- @classmethod
- def teardown_class(cls):
- logger.info("teardown class")
- if hasattr(cls, 'cluster'):
- cls.cluster.stop()
-
- def setup_method(self, method=None):
- self.database_name = "/Root/users/{class_name}_{method_name}".format(
+ first_node = cls.cluster.nodes[1]
+ cls.boot_per_node = 1
+ cls.boot_batch_size = 5
+ hive_cli = HiveClient(first_node.host, first_node.mon_port)
+ hive_cli.set_max_scheduled_tablets(cls.boot_per_node)
+ hive_cli.set_max_boot_batch_size(cls.boot_batch_size)
+ cls.database_name = None
+
+ cls.robust_retries = ydb.RetrySettings().with_fast_backoff(
+ ydb.BackoffSettings(ceiling=10, slot_duration=0.05, uncertain_ratio=0.1)
+ )
+
+ @classmethod
+ def teardown_class(cls):
+ logger.info("teardown class")
+ if hasattr(cls, 'cluster'):
+ cls.cluster.stop()
+
+ def setup_method(self, method=None):
+ self.database_name = "/Root/users/{class_name}_{method_name}".format(
class_name=self.__class__.__name__,
method_name=method.__name__,
- )
- self.cluster.create_database(
- self.database_name,
- storage_pool_units_count={
- 'hdd': 1
- }
- )
- self.driver_config = ydb.DriverConfig(
- "%s:%s" % (self.cluster.nodes[1].host, self.cluster.nodes[1].port),
- self.database_name
- )
-
- def teardown_method(self, method=None):
- self.cluster.remove_database(self.database_name)
- self.database_name = None
-
-
-class DBWithDynamicSlot(object):
+ )
+ self.cluster.create_database(
+ self.database_name,
+ storage_pool_units_count={
+ 'hdd': 1
+ }
+ )
+ self.driver_config = ydb.DriverConfig(
+ "%s:%s" % (self.cluster.nodes[1].host, self.cluster.nodes[1].port),
+ self.database_name
+ )
+
+ def teardown_method(self, method=None):
+ self.cluster.remove_database(self.database_name)
+ self.database_name = None
+
+
+class DBWithDynamicSlot(object):
SLOT_COUNT = 1
- @classmethod
- def setup_class(cls):
- cls.cluster = kikimr_cluster_factory(
- KikimrConfigGenerator(
- additional_log_configs={
- 'CMS_TENANTS': LogLevels.TRACE,
- 'TENANT_SLOT_BROKER': LogLevels.DEBUG,
- 'TENANT_POOL': LogLevels.DEBUG,
- 'LOCAL': LogLevels.DEBUG,
- 'NODE_BROKER': LogLevels.DEBUG,
- 'TX_DATASHARD': LogLevels.DEBUG,
- 'TX_PROXY': LogLevels.DEBUG,
+ @classmethod
+ def setup_class(cls):
+ cls.cluster = kikimr_cluster_factory(
+ KikimrConfigGenerator(
+ additional_log_configs={
+ 'CMS_TENANTS': LogLevels.TRACE,
+ 'TENANT_SLOT_BROKER': LogLevels.DEBUG,
+ 'TENANT_POOL': LogLevels.DEBUG,
+ 'LOCAL': LogLevels.DEBUG,
+ 'NODE_BROKER': LogLevels.DEBUG,
+ 'TX_DATASHARD': LogLevels.DEBUG,
+ 'TX_PROXY': LogLevels.DEBUG,
'GRPC_SERVER': LogLevels.DEBUG,
- }
- )
- )
- cls.cluster.start()
-
- cls.robust_retries = ydb.RetrySettings(max_retries=20).with_fast_backoff(
- ydb.BackoffSettings(ceiling=10, slot_duration=0.05, uncertain_ratio=0.1)
- )
-
- @classmethod
- def teardown_class(cls):
- if hasattr(cls, 'cluster'):
- cls.cluster.stop()
+ }
+ )
+ )
+ cls.cluster.start()
+
+ cls.robust_retries = ydb.RetrySettings(max_retries=20).with_fast_backoff(
+ ydb.BackoffSettings(ceiling=10, slot_duration=0.05, uncertain_ratio=0.1)
+ )
+
+ @classmethod
+ def teardown_class(cls):
+ if hasattr(cls, 'cluster'):
+ cls.cluster.stop()
diff --git a/ydb/tests/functional/tenants/test_dynamic_tenants.py b/ydb/tests/functional/tenants/test_dynamic_tenants.py
index 476a3bda8c6..bdf7d597824 100644
--- a/ydb/tests/functional/tenants/test_dynamic_tenants.py
+++ b/ydb/tests/functional/tenants/test_dynamic_tenants.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
-import os
+import os
import logging
-import time
+import time
from hamcrest import (
any_of,
@@ -10,40 +10,40 @@ from hamcrest import (
equal_to,
raises,
)
-
+
import ydb
-from common import DBWithDynamicSlot, DBForStaticSlots, Runtime
+from common import DBWithDynamicSlot, DBForStaticSlots, Runtime
logger = logging.getLogger(__name__)
-class TestCreateTenantNoCPU(DBWithDynamicSlot):
- def test_case(self):
- database = '/Root/users/database'
- self.cluster.create_database(
- database,
- storage_pool_units_count={
- 'hdd': 1
- }
+class TestCreateTenantNoCPU(DBWithDynamicSlot):
+ def test_case(self):
+ database = '/Root/users/database'
+ self.cluster.create_database(
+ database,
+ storage_pool_units_count={
+ 'hdd': 1
+ }
+ )
+ self.cluster.remove_database(database)
+
+
+class TestCreateTenantWithCPU(DBWithDynamicSlot):
+ def test_case(self):
+ database = '/Root/users/database'
+ self.cluster.create_database(
+ database,
+ storage_pool_units_count={
+ 'hdd': 1
+ }
)
- self.cluster.remove_database(database)
-
-
-class TestCreateTenantWithCPU(DBWithDynamicSlot):
- def test_case(self):
- database = '/Root/users/database'
- self.cluster.create_database(
- database,
- storage_pool_units_count={
- 'hdd': 1
- }
- )
self.cluster.register_and_start_slots(database, count=1)
self.cluster.wait_tenant_up(database)
- self.cluster.remove_database(database)
-
-
+ self.cluster.remove_database(database)
+
+
class TestCreateTenantThenExecYQLEmptyDatabaseHeader(DBWithDynamicSlot):
def test_case(self):
database = '/Root/users/database'
@@ -96,8 +96,8 @@ class TestCreateTenantThenExecYQLEmptyDatabaseHeader(DBWithDynamicSlot):
session.transaction().execute("select key from `{}`;".format(table_path), commit_tx=True)
-class TestCreateTenantThenExecYQL(DBWithDynamicSlot):
- def test_case(self):
+class TestCreateTenantThenExecYQL(DBWithDynamicSlot):
+ def test_case(self):
database = '/Root/users/database'
driver_config = ydb.DriverConfig(
@@ -110,11 +110,11 @@ class TestCreateTenantThenExecYQL(DBWithDynamicSlot):
database + "/"
)
- self.cluster.create_database(
- database,
- storage_pool_units_count={
- 'hdd': 1
- }
+ self.cluster.create_database(
+ database,
+ storage_pool_units_count={
+ 'hdd': 1
+ }
)
self.cluster.register_and_start_slots(database, count=1)
self.cluster.wait_tenant_up(database)
@@ -137,167 +137,167 @@ class TestCreateTenantThenExecYQL(DBWithDynamicSlot):
)
session.transaction().execute("select key from `{}`;".format(table_path), commit_tx=True)
-
-
-class TestCreateAndDropTenants(DBWithDynamicSlot):
- def test_case(self):
- for iNo in range(10):
- database = '/Root/users/database_%d' % iNo
-
- driver_config = ydb.DriverConfig(
- "%s:%s" % (self.cluster.nodes[1].host, self.cluster.nodes[1].port),
- database
- )
-
- self.cluster.create_database(
- database,
- storage_pool_units_count={
- 'hdd': 1
- }
- )
+
+
+class TestCreateAndDropTenants(DBWithDynamicSlot):
+ def test_case(self):
+ for iNo in range(10):
+ database = '/Root/users/database_%d' % iNo
+
+ driver_config = ydb.DriverConfig(
+ "%s:%s" % (self.cluster.nodes[1].host, self.cluster.nodes[1].port),
+ database
+ )
+
+ self.cluster.create_database(
+ database,
+ storage_pool_units_count={
+ 'hdd': 1
+ }
+ )
self.cluster.register_and_start_slots(database, count=1)
self.cluster.wait_tenant_up(database)
-
- with ydb.Driver(driver_config) as driver:
- with ydb.SessionPool(driver) as pool:
- def create_table(session, table):
- session.create_table(
- os.path.join(database, table),
- ydb.TableDescription()
- .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
- .with_column(ydb.Column('value', ydb.OptionalType(ydb.DataType.Utf8)))
- .with_primary_key('id')
- )
-
- pool.retry_operation_sync(create_table, self.robust_retries, "table")
- pool.retry_operation_sync(create_table, self.robust_retries, "table_for_rm")
-
- def write_some_data(session, table_one, table_two, value):
- session.transaction().execute(
- "upsert into {table_one} (id, value) "
- "values (1u, \"{val_one}\");"
- "upsert into {table_two} (id, value) "
+
+ with ydb.Driver(driver_config) as driver:
+ with ydb.SessionPool(driver) as pool:
+ def create_table(session, table):
+ session.create_table(
+ os.path.join(database, table),
+ ydb.TableDescription()
+ .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
+ .with_column(ydb.Column('value', ydb.OptionalType(ydb.DataType.Utf8)))
+ .with_primary_key('id')
+ )
+
+ pool.retry_operation_sync(create_table, self.robust_retries, "table")
+ pool.retry_operation_sync(create_table, self.robust_retries, "table_for_rm")
+
+ def write_some_data(session, table_one, table_two, value):
+ session.transaction().execute(
+ "upsert into {table_one} (id, value) "
+ "values (1u, \"{val_one}\");"
+ "upsert into {table_two} (id, value) "
"values (2u, \"{val_two}\");"
- "".format(table_one=table_one, val_one=value,
- table_two=table_two, val_two=value),
- commit_tx=True,
- )
- pool.retry_operation_sync(write_some_data, self.robust_retries, "table", "table_for_rm", database)
-
- def read_some_data(session, table_one, table_two):
- result = session.transaction().execute(
- "select id, value FROM {table_one};"
- "select id, value FROM {table_two};"
- "".format(table_one=table_one, table_two=table_two),
- commit_tx=True,
- )
- return result
-
- result = pool.retry_operation_sync(read_some_data, self.robust_retries, "table", "table_for_rm")
-
- assert len(result) == 2
-
- for lineNo in range(2):
- assert_that(
- (1 + lineNo, database),
- equal_to(
- (result[lineNo].rows[0].id, result[lineNo].rows[0].value)
- )
- )
-
- def drop_table(session, table):
- session.drop_table(
- os.path.join(database, table)
- )
- pool.retry_operation_sync(drop_table, self.robust_retries, "table_for_rm")
-
- self.cluster.remove_database(database)
-
-
-class TestCreateAndDropTheSameTenant2(DBForStaticSlots):
- def test_case(self):
- for iNo in range(4):
- database = '/Root/users/database'
- value = database + "_" + str(iNo)
-
- logger.debug("create_database")
- # without dynamic stots, allocate node manually as static slot
- self.cluster.create_database(
- database,
- storage_pool_units_count={
- 'hdd': 1
- }
- )
-
- driver_config = ydb.DriverConfig(
- "%s:%s" % (self.cluster.nodes[1].host, self.cluster.nodes[1].port),
- database
- )
-
- with Runtime(self.cluster, database):
- with ydb.Driver(driver_config) as driver:
- with ydb.SessionPool(driver, size=1) as pool:
- def create_table(session, table):
- session.create_table(
- os.path.join(database, table),
- ydb.TableDescription()
- .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
- .with_column(ydb.Column('value', ydb.OptionalType(ydb.DataType.Utf8)))
- .with_primary_key('id')
- )
-
- logger.debug("create table one")
- pool.retry_operation_sync(create_table, self.robust_retries, "table")
- logger.debug("create table two")
- pool.retry_operation_sync(create_table, None, "table_for_rm")
-
- def write_some_data(session, table_one, table_two, value):
- session.transaction().execute(
- "upsert into {table_one} (id, value) "
- "values (1u, \"{val_one}\");"
- "upsert into {table_two} (id, value) "
+ "".format(table_one=table_one, val_one=value,
+ table_two=table_two, val_two=value),
+ commit_tx=True,
+ )
+ pool.retry_operation_sync(write_some_data, self.robust_retries, "table", "table_for_rm", database)
+
+ def read_some_data(session, table_one, table_two):
+ result = session.transaction().execute(
+ "select id, value FROM {table_one};"
+ "select id, value FROM {table_two};"
+ "".format(table_one=table_one, table_two=table_two),
+ commit_tx=True,
+ )
+ return result
+
+ result = pool.retry_operation_sync(read_some_data, self.robust_retries, "table", "table_for_rm")
+
+ assert len(result) == 2
+
+ for lineNo in range(2):
+ assert_that(
+ (1 + lineNo, database),
+ equal_to(
+ (result[lineNo].rows[0].id, result[lineNo].rows[0].value)
+ )
+ )
+
+ def drop_table(session, table):
+ session.drop_table(
+ os.path.join(database, table)
+ )
+ pool.retry_operation_sync(drop_table, self.robust_retries, "table_for_rm")
+
+ self.cluster.remove_database(database)
+
+
+class TestCreateAndDropTheSameTenant2(DBForStaticSlots):
+ def test_case(self):
+ for iNo in range(4):
+ database = '/Root/users/database'
+ value = database + "_" + str(iNo)
+
+ logger.debug("create_database")
+ # without dynamic stots, allocate node manually as static slot
+ self.cluster.create_database(
+ database,
+ storage_pool_units_count={
+ 'hdd': 1
+ }
+ )
+
+ driver_config = ydb.DriverConfig(
+ "%s:%s" % (self.cluster.nodes[1].host, self.cluster.nodes[1].port),
+ database
+ )
+
+ with Runtime(self.cluster, database):
+ with ydb.Driver(driver_config) as driver:
+ with ydb.SessionPool(driver, size=1) as pool:
+ def create_table(session, table):
+ session.create_table(
+ os.path.join(database, table),
+ ydb.TableDescription()
+ .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
+ .with_column(ydb.Column('value', ydb.OptionalType(ydb.DataType.Utf8)))
+ .with_primary_key('id')
+ )
+
+ logger.debug("create table one")
+ pool.retry_operation_sync(create_table, self.robust_retries, "table")
+ logger.debug("create table two")
+ pool.retry_operation_sync(create_table, None, "table_for_rm")
+
+ def write_some_data(session, table_one, table_two, value):
+ session.transaction().execute(
+ "upsert into {table_one} (id, value) "
+ "values (1u, \"{val_one}\");"
+ "upsert into {table_two} (id, value) "
"values (2u, \"{val_two}\");"
- "".format(table_one=table_one, val_one=value,
- table_two=table_two, val_two=value),
- commit_tx=True,
- )
- logger.debug("write_some_data")
- pool.retry_operation_sync(write_some_data, None, "table", "table_for_rm", value)
-
- def read_some_data(session, table_one, table_two):
- result = session.transaction().execute(
- "select id, value FROM {table_one};"
- "select id, value FROM {table_two};"
- "".format(table_one=table_one, table_two=table_two),
- commit_tx=True,
- )
- return result
-
- logger.debug("read_some_data")
- result = pool.retry_operation_sync(read_some_data, None, "table", "table_for_rm")
-
- assert len(result) == 2
-
- for lineNo in range(2):
- assert_that(
- (1 + lineNo, value),
- equal_to(
- (result[lineNo].rows[0].id, result[lineNo].rows[0].value)
- )
- )
-
- def drop_table(session, table):
- session.drop_table(
- os.path.join(database, table)
- )
-
- logger.debug("drop table two")
- pool.retry_operation_sync(drop_table, None, "table_for_rm")
-
- logger.debug("remove_database")
- self.cluster.remove_database(database)
-
- logger.debug("done %d", iNo)
+ "".format(table_one=table_one, val_one=value,
+ table_two=table_two, val_two=value),
+ commit_tx=True,
+ )
+ logger.debug("write_some_data")
+ pool.retry_operation_sync(write_some_data, None, "table", "table_for_rm", value)
+
+ def read_some_data(session, table_one, table_two):
+ result = session.transaction().execute(
+ "select id, value FROM {table_one};"
+ "select id, value FROM {table_two};"
+ "".format(table_one=table_one, table_two=table_two),
+ commit_tx=True,
+ )
+ return result
+
+ logger.debug("read_some_data")
+ result = pool.retry_operation_sync(read_some_data, None, "table", "table_for_rm")
+
+ assert len(result) == 2
+
+ for lineNo in range(2):
+ assert_that(
+ (1 + lineNo, value),
+ equal_to(
+ (result[lineNo].rows[0].id, result[lineNo].rows[0].value)
+ )
+ )
+
+ def drop_table(session, table):
+ session.drop_table(
+ os.path.join(database, table)
+ )
+
+ logger.debug("drop table two")
+ pool.retry_operation_sync(drop_table, None, "table_for_rm")
+
+ logger.debug("remove_database")
+ self.cluster.remove_database(database)
+
+ logger.debug("done %d", iNo)
class TestCheckAccess(DBWithDynamicSlot):
diff --git a/ydb/tests/functional/tenants/test_publish_into_schemeboard_with_common_ssring.py b/ydb/tests/functional/tenants/test_publish_into_schemeboard_with_common_ssring.py
index 2dc016fc45c..59a4607df0c 100644
--- a/ydb/tests/functional/tenants/test_publish_into_schemeboard_with_common_ssring.py
+++ b/ydb/tests/functional/tenants/test_publish_into_schemeboard_with_common_ssring.py
@@ -1,68 +1,68 @@
-# -*- coding: utf-8 -*-
-import os
-import logging
-
+# -*- coding: utf-8 -*-
+import os
+import logging
+
import ydb
-
+
from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
from ydb.tests.library.harness.kikimr_config import KikimrConfigGenerator
from ydb.tests.library.harness.util import LogLevels
from ydb.tests.library.common.types import Erasure
-
-
-logger = logging.getLogger(__name__)
-
-
-class TestOn3DC(object):
- @classmethod
- def setup_class(cls):
- config_generator = KikimrConfigGenerator(
- erasure=Erasure.NONE,
- nodes=2,
- n_to_select=1,
- additional_log_configs={
- 'FLAT_TX_SCHEMESHARD': LogLevels.DEBUG,
- 'SCHEMESHARD_DESCRIBE': LogLevels.DEBUG,
-
- 'SCHEME_BOARD_POPULATOR': LogLevels.DEBUG,
- 'SCHEME_BOARD_REPLICA': LogLevels.DEBUG,
- }
- )
- cls.cluster = kikimr_cluster_factory(
- config_generator
- )
- cls.cluster.start()
-
- @classmethod
- def teardown_class(cls):
- if hasattr(cls, 'cluster'):
- cls.cluster.stop()
-
- def test_create_dirs(self):
+
+
+logger = logging.getLogger(__name__)
+
+
+class TestOn3DC(object):
+ @classmethod
+ def setup_class(cls):
+ config_generator = KikimrConfigGenerator(
+ erasure=Erasure.NONE,
+ nodes=2,
+ n_to_select=1,
+ additional_log_configs={
+ 'FLAT_TX_SCHEMESHARD': LogLevels.DEBUG,
+ 'SCHEMESHARD_DESCRIBE': LogLevels.DEBUG,
+
+ 'SCHEME_BOARD_POPULATOR': LogLevels.DEBUG,
+ 'SCHEME_BOARD_REPLICA': LogLevels.DEBUG,
+ }
+ )
+ cls.cluster = kikimr_cluster_factory(
+ config_generator
+ )
+ cls.cluster.start()
+
+ @classmethod
+ def teardown_class(cls):
+ if hasattr(cls, 'cluster'):
+ cls.cluster.stop()
+
+ def test_create_dirs(self):
return
- driver_config = ydb.DriverConfig(
- "%s:%s" % (self.cluster.nodes[1].host, self.cluster.nodes[1].port),
- database="/Root")
-
- rounds = 2
- for restart_no in range(rounds):
- if restart_no != 0:
- for node in self.cluster.nodes.values():
- node.start()
-
- client = ydb.Driver(driver_config)
- client.wait(120)
-
- for iNo in range(100):
- dir_name = "{}_{}".format(restart_no, iNo)
- logger.debug("create directory %s", dir_name)
- result = client.scheme_client.make_directory(
- os.path.join(
- '/', 'Root', dir_name
- )
- )
- logger.debug("result %s", str(result))
-
- if restart_no != rounds-1:
- for node in self.cluster.nodes.values():
- node.stop()
+ driver_config = ydb.DriverConfig(
+ "%s:%s" % (self.cluster.nodes[1].host, self.cluster.nodes[1].port),
+ database="/Root")
+
+ rounds = 2
+ for restart_no in range(rounds):
+ if restart_no != 0:
+ for node in self.cluster.nodes.values():
+ node.start()
+
+ client = ydb.Driver(driver_config)
+ client.wait(120)
+
+ for iNo in range(100):
+ dir_name = "{}_{}".format(restart_no, iNo)
+ logger.debug("create directory %s", dir_name)
+ result = client.scheme_client.make_directory(
+ os.path.join(
+ '/', 'Root', dir_name
+ )
+ )
+ logger.debug("result %s", str(result))
+
+ if restart_no != rounds-1:
+ for node in self.cluster.nodes.values():
+ node.stop()
diff --git a/ydb/tests/functional/tenants/test_storage_config.py b/ydb/tests/functional/tenants/test_storage_config.py
index 64864e8ee9b..94f1789ed58 100644
--- a/ydb/tests/functional/tenants/test_storage_config.py
+++ b/ydb/tests/functional/tenants/test_storage_config.py
@@ -1,40 +1,40 @@
-# -*- coding: utf-8 -*-
-import logging
-import random
-import string
-import pytest
-from hamcrest import assert_that, equal_to, has_item, has_properties
-
+# -*- coding: utf-8 -*-
+import logging
+import random
+import string
+import pytest
+from hamcrest import assert_that, equal_to, has_item, has_properties
+
from ydb.tests.library.common.local_db_scheme import get_scheme
from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory
from ydb.tests.library.harness.kikimr_config import KikimrConfigGenerator
from ydb.tests.library.harness.util import LogLevels
from ydb.tests.library.predicates.executor import external_blobs_is_present
from ydb.tests.library.common.protobuf_ss import CreateTableRequest
-
+
import ydb.tests.library.matchers.scheme_ops as scheme_operations
from ydb.tests.library.common.types import PType
import ydb
-
-logger = logging.getLogger(__name__)
-
-
-class TBaseTenant(object):
- LOG_SETTINGS = {
- 'CMS_TENANTS': LogLevels.TRACE,
- 'TENANT_SLOT_BROKER': LogLevels.DEBUG,
- 'TENANT_POOL': LogLevels.DEBUG,
- 'LOCAL': LogLevels.DEBUG,
- 'NODE_BROKER': LogLevels.DEBUG,
- 'TX_DATASHARD': LogLevels.DEBUG,
- 'TX_PROXY': LogLevels.DEBUG,
- }
-
- @classmethod
- def setup_class(cls):
+
+logger = logging.getLogger(__name__)
+
+
+class TBaseTenant(object):
+ LOG_SETTINGS = {
+ 'CMS_TENANTS': LogLevels.TRACE,
+ 'TENANT_SLOT_BROKER': LogLevels.DEBUG,
+ 'TENANT_POOL': LogLevels.DEBUG,
+ 'LOCAL': LogLevels.DEBUG,
+ 'NODE_BROKER': LogLevels.DEBUG,
+ 'TX_DATASHARD': LogLevels.DEBUG,
+ 'TX_PROXY': LogLevels.DEBUG,
+ }
+
+ @classmethod
+ def setup_class(cls):
configurator = KikimrConfigGenerator(additional_log_configs=cls.LOG_SETTINGS)
- cls.kikimr = kikimr_cluster_factory(configurator)
- cls.kikimr.start()
+ cls.kikimr = kikimr_cluster_factory(configurator)
+ cls.kikimr.start()
cls.tenant_path = cls.__create_tenant('common_tenant', ('hdd', 'hdd1', 'hdd2'))
cls.driver = ydb.Driver(
ydb.DriverConfig(
@@ -44,32 +44,32 @@ class TBaseTenant(object):
)
cls.driver.wait()
cls.pool = ydb.SessionPool(cls.driver, size=5)
-
- @classmethod
- def teardown_class(cls):
+
+ @classmethod
+ def teardown_class(cls):
if hasattr(cls, 'pool'):
cls.pool.stop()
if hasattr(cls, 'driver'):
cls.driver.stop()
- if hasattr(cls, 'kikimr'):
- cls.kikimr.stop()
-
- @classmethod
+ if hasattr(cls, 'kikimr'):
+ cls.kikimr.stop()
+
+ @classmethod
def __create_tenant(cls, name, storage_pools=('hdd', )):
- tenant_path = '/Root/users/%s' % name
+ tenant_path = '/Root/users/%s' % name
result = cls.kikimr.create_database(
- tenant_path,
- storage_pool_units_count={
- x: 1 for x in storage_pools
- }
- )
-
+ tenant_path,
+ storage_pool_units_count={
+ x: 1 for x in storage_pools
+ }
+ )
+
cls.kikimr.register_and_start_slots(tenant_path, count=1)
cls.kikimr.wait_tenant_up(tenant_path)
return result
-
+
def write_huge_blobs(pool, table_path, count=1, size=2*1024*1024):
with pool.checkout() as session:
@@ -78,535 +78,535 @@ def write_huge_blobs(pool, table_path, count=1, size=2*1024*1024):
declare $value as Utf8;
upsert into `%s` (key, value) VALUES ($key, $value);
""" % table_path)
-
+
for _ in range(count):
key = random.randint(1, 2 ** 48)
value = ''.join(random.choice(string.ascii_lowercase) for _ in range(size))
session.transaction().execute(
prepared, {'$key': key, '$value': value},
commit_tx=True,
- )
-
-
-def list_tablets_in_table(client, table_path):
- table_operations = scheme_operations.TableOperations(client)
- table_operations.describe_options.with_partition_info()
- table_operations.describe_options.with_partition_config()
- response = table_operations.describe(table_path)
-
- return [
- part.DatashardId
- for part in response.PathDescription.TablePartitions
- ]
-
-
-def case_0():
- creation_options = CreateTableRequest.Options()
- creation_options.add_column('key', PType.Uint64, is_key=True)
- creation_options.add_column('value', PType.Utf8, column_family=0)
- creation_options.add_column_family(
- 0,
- creation_options.ColumnStorage1Ext1,
- creation_options.ColumnCacheNone
- )
+ )
+
+
+def list_tablets_in_table(client, table_path):
+ table_operations = scheme_operations.TableOperations(client)
+ table_operations.describe_options.with_partition_info()
+ table_operations.describe_options.with_partition_config()
+ response = table_operations.describe(table_path)
+
+ return [
+ part.DatashardId
+ for part in response.PathDescription.TablePartitions
+ ]
+
+
+def case_0():
+ creation_options = CreateTableRequest.Options()
+ creation_options.add_column('key', PType.Uint64, is_key=True)
+ creation_options.add_column('value', PType.Utf8, column_family=0)
+ creation_options.add_column_family(
+ 0,
+ creation_options.ColumnStorage1Ext1,
+ creation_options.ColumnCacheNone
+ )
creation_options.partition_config.with_partitioning_policy(0) # for now external blobs and autosplit not compatible
- has_external = True
- scheme = lambda table_name: has_item(
- has_properties(
- TableName='__user__{}'.format(table_name),
- ColumnFamilies={
- 0: {'Large': 524288,
- 'Cache': 0,
- 'InMemory': False,
- 'Codec': 0,
- 'Small': 4294967295,
- 'RoomID': 0,
- 'Columns': [1, 2]}
- },
- Rooms={
- 0: {'Main': 1,
- 'Outer': 1,
- 'Blobs': 1}
- }
- )
- )
- return (creation_options, has_external, scheme)
-
-
-def case_11():
- creation_options = CreateTableRequest.Options()
- creation_options.add_column('key', PType.Uint64, is_key=True)
- creation_options.add_column('value', PType.Utf8, column_family=0)
- creation_options.add_column_family(
- 0,
- creation_options.ColumnStorageTest_1_2_1k,
- creation_options.ColumnCacheNone
- )
+ has_external = True
+ scheme = lambda table_name: has_item(
+ has_properties(
+ TableName='__user__{}'.format(table_name),
+ ColumnFamilies={
+ 0: {'Large': 524288,
+ 'Cache': 0,
+ 'InMemory': False,
+ 'Codec': 0,
+ 'Small': 4294967295,
+ 'RoomID': 0,
+ 'Columns': [1, 2]}
+ },
+ Rooms={
+ 0: {'Main': 1,
+ 'Outer': 1,
+ 'Blobs': 1}
+ }
+ )
+ )
+ return (creation_options, has_external, scheme)
+
+
+def case_11():
+ creation_options = CreateTableRequest.Options()
+ creation_options.add_column('key', PType.Uint64, is_key=True)
+ creation_options.add_column('value', PType.Utf8, column_family=0)
+ creation_options.add_column_family(
+ 0,
+ creation_options.ColumnStorageTest_1_2_1k,
+ creation_options.ColumnCacheNone
+ )
creation_options.partition_config.with_partitioning_policy(0) # for now external blobs and autosplit not compatible
- has_external = True
- scheme = lambda table_name: has_item(
- has_properties(
- TableName='__user__{}'.format(table_name),
- ColumnFamilies={
- 0: {'Large': 1024,
- 'Cache': 0,
- 'InMemory': False,
- 'Codec': 0,
- 'Small': 512,
- 'RoomID': 0,
- 'Columns': [1, 2]}
- },
- Rooms={
- 0: {'Main': 1,
- 'Outer': 1,
- 'Blobs': 2}
- }
- )
- )
- return (creation_options, has_external, scheme)
-
-
-def case_1():
- creation_options = CreateTableRequest.Options()
- creation_options.add_column('key', PType.Uint64, is_key=True)
- creation_options.add_column('value', PType.Utf8, column_family=0)
- creation_options.add_column_family(
- 0,
- creation_options.ColumnStorage1,
- creation_options.ColumnCacheNone
- )
- has_external = False
- scheme = lambda table_name: has_item(
- has_properties(
- TableName='__user__{}'.format(table_name),
- ColumnFamilies={
- 0: {'Large': 4294967295,
- 'Cache': 0,
- 'InMemory': False,
- 'Codec': 0,
- 'Small': 4294967295,
- 'RoomID': 0,
- 'Columns': [1, 2]}
- },
- Rooms={
- 0: {'Main': 1,
- 'Outer': 1,
- 'Blobs': 1}
- }
- )
- )
- return (creation_options, has_external, scheme)
-
-
-def case_12():
- creation_options = CreateTableRequest.Options()
- creation_options.add_column('key', PType.Uint64, is_key=True)
- creation_options.add_column('value', PType.Utf8, column_family=0)
- creation_options.add_column_family(
- 0,
- creation_options.ColumnStorage2,
- creation_options.ColumnCacheNone
- )
+ has_external = True
+ scheme = lambda table_name: has_item(
+ has_properties(
+ TableName='__user__{}'.format(table_name),
+ ColumnFamilies={
+ 0: {'Large': 1024,
+ 'Cache': 0,
+ 'InMemory': False,
+ 'Codec': 0,
+ 'Small': 512,
+ 'RoomID': 0,
+ 'Columns': [1, 2]}
+ },
+ Rooms={
+ 0: {'Main': 1,
+ 'Outer': 1,
+ 'Blobs': 2}
+ }
+ )
+ )
+ return (creation_options, has_external, scheme)
+
+
+def case_1():
+ creation_options = CreateTableRequest.Options()
+ creation_options.add_column('key', PType.Uint64, is_key=True)
+ creation_options.add_column('value', PType.Utf8, column_family=0)
+ creation_options.add_column_family(
+ 0,
+ creation_options.ColumnStorage1,
+ creation_options.ColumnCacheNone
+ )
+ has_external = False
+ scheme = lambda table_name: has_item(
+ has_properties(
+ TableName='__user__{}'.format(table_name),
+ ColumnFamilies={
+ 0: {'Large': 4294967295,
+ 'Cache': 0,
+ 'InMemory': False,
+ 'Codec': 0,
+ 'Small': 4294967295,
+ 'RoomID': 0,
+ 'Columns': [1, 2]}
+ },
+ Rooms={
+ 0: {'Main': 1,
+ 'Outer': 1,
+ 'Blobs': 1}
+ }
+ )
+ )
+ return (creation_options, has_external, scheme)
+
+
+def case_12():
+ creation_options = CreateTableRequest.Options()
+ creation_options.add_column('key', PType.Uint64, is_key=True)
+ creation_options.add_column('value', PType.Utf8, column_family=0)
+ creation_options.add_column_family(
+ 0,
+ creation_options.ColumnStorage2,
+ creation_options.ColumnCacheNone
+ )
creation_options.partition_config.with_partitioning_policy(0) # for now external blobs and autosplit not compatible
- has_external = True
- scheme = lambda table_name: has_item(
- has_properties(
- TableName='__user__{}'.format(table_name),
- ColumnFamilies={
- 0: {'Large': 524288,
- 'Cache': 0,
- 'InMemory': False,
- 'Codec': 0,
- 'Small': 4294967295,
- 'RoomID': 0,
- 'Columns': [1, 2]}
- },
- Rooms={
+ has_external = True
+ scheme = lambda table_name: has_item(
+ has_properties(
+ TableName='__user__{}'.format(table_name),
+ ColumnFamilies={
+ 0: {'Large': 524288,
+ 'Cache': 0,
+ 'InMemory': False,
+ 'Codec': 0,
+ 'Small': 4294967295,
+ 'RoomID': 0,
+ 'Columns': [1, 2]}
+ },
+ Rooms={
0: {
'Main': 2,
- 'Outer': 2,
+ 'Outer': 2,
'Blobs': 2
}
- }
- )
- )
- return (creation_options, has_external, scheme)
-
-
-def case_2():
- creation_options = CreateTableRequest.Options()
- creation_options.add_column('key', PType.Uint64, is_key=True)
- creation_options.add_column('value', PType.Utf8, column_family=0)
- storage_config = creation_options.declare_column_family(family_id=0)
- storage_config.appoint_syslog('hdd')
- storage_config.appoint_log('hdd')
- has_external = False
- scheme = lambda table_name: has_item(
- has_properties(
- TableName='__user__{}'.format(table_name),
- ColumnFamilies={
- 0: {'Large': 4294967295,
- 'Cache': 0,
- 'InMemory': False,
- 'Codec': 0,
- 'Small': 4294967295,
- 'RoomID': 0,
- 'Columns': [1, 2]}
- },
- Rooms={
- 0: {'Main': 1,
- 'Outer': 1,
- 'Blobs': 1}
- }
- )
- )
- return (creation_options, has_external, scheme)
-
-
-def case_3():
- creation_options = CreateTableRequest.Options()
- creation_options.add_column('key', PType.Uint64, is_key=True)
- creation_options.add_column('value', PType.Utf8, column_family=0)
- storage_config = creation_options.declare_column_family(family_id=0)
- storage_config.appoint_syslog('NotExist', True)
- storage_config.appoint_log('NotExist', True)
- has_external = False
- scheme = lambda table_name: has_item(
- has_properties(
- TableName='__user__{}'.format(table_name),
- ColumnFamilies={
- 0: {'Large': 4294967295,
- 'Cache': 0,
- 'InMemory': False,
- 'Codec': 0,
- 'Small': 4294967295,
- 'RoomID': 0,
- 'Columns': [1, 2]}
- },
- Rooms={
- 0: {'Main': 1,
- 'Outer': 1,
- 'Blobs': 1}
- }
- )
- )
- return (creation_options, has_external, scheme)
-
-
-def case_4():
- creation_options = CreateTableRequest.Options()
- creation_options.add_column('key', PType.Uint64, is_key=True)
- creation_options.add_column('value', PType.Utf8, column_family=0)
- storage_config = creation_options.declare_column_family(family_id=0)
- storage_config.appoint_syslog('NotExist', True)
- storage_config.appoint_log('NotExist', True)
- storage_config.appoint_data('NotExist', True)
- storage_config.appoint_external('NotExist', True)
+ }
+ )
+ )
+ return (creation_options, has_external, scheme)
+
+
+def case_2():
+ creation_options = CreateTableRequest.Options()
+ creation_options.add_column('key', PType.Uint64, is_key=True)
+ creation_options.add_column('value', PType.Utf8, column_family=0)
+ storage_config = creation_options.declare_column_family(family_id=0)
+ storage_config.appoint_syslog('hdd')
+ storage_config.appoint_log('hdd')
+ has_external = False
+ scheme = lambda table_name: has_item(
+ has_properties(
+ TableName='__user__{}'.format(table_name),
+ ColumnFamilies={
+ 0: {'Large': 4294967295,
+ 'Cache': 0,
+ 'InMemory': False,
+ 'Codec': 0,
+ 'Small': 4294967295,
+ 'RoomID': 0,
+ 'Columns': [1, 2]}
+ },
+ Rooms={
+ 0: {'Main': 1,
+ 'Outer': 1,
+ 'Blobs': 1}
+ }
+ )
+ )
+ return (creation_options, has_external, scheme)
+
+
+def case_3():
+ creation_options = CreateTableRequest.Options()
+ creation_options.add_column('key', PType.Uint64, is_key=True)
+ creation_options.add_column('value', PType.Utf8, column_family=0)
+ storage_config = creation_options.declare_column_family(family_id=0)
+ storage_config.appoint_syslog('NotExist', True)
+ storage_config.appoint_log('NotExist', True)
+ has_external = False
+ scheme = lambda table_name: has_item(
+ has_properties(
+ TableName='__user__{}'.format(table_name),
+ ColumnFamilies={
+ 0: {'Large': 4294967295,
+ 'Cache': 0,
+ 'InMemory': False,
+ 'Codec': 0,
+ 'Small': 4294967295,
+ 'RoomID': 0,
+ 'Columns': [1, 2]}
+ },
+ Rooms={
+ 0: {'Main': 1,
+ 'Outer': 1,
+ 'Blobs': 1}
+ }
+ )
+ )
+ return (creation_options, has_external, scheme)
+
+
+def case_4():
+ creation_options = CreateTableRequest.Options()
+ creation_options.add_column('key', PType.Uint64, is_key=True)
+ creation_options.add_column('value', PType.Utf8, column_family=0)
+ storage_config = creation_options.declare_column_family(family_id=0)
+ storage_config.appoint_syslog('NotExist', True)
+ storage_config.appoint_log('NotExist', True)
+ storage_config.appoint_data('NotExist', True)
+ storage_config.appoint_external('NotExist', True)
creation_options.partition_config.with_partitioning_policy(0) # for now external blobs and autosplit not compatible
- has_external = True
- scheme = lambda table_name: has_item(
- has_properties(
- TableName='__user__{}'.format(table_name),
- ColumnFamilies={
- 0: {'Large': 524288,
- 'Cache': 0,
- 'InMemory': False,
- 'Codec': 0,
- 'Small': 12288,
- 'RoomID': 0,
- 'Columns': [1, 2]}
- },
- Rooms={
- 0: {'Main': 1,
- 'Outer': 1,
- 'Blobs': 1}
- }
- )
- )
- return (creation_options, has_external, scheme)
-
-
-def case_5():
- creation_options = CreateTableRequest.Options()
- creation_options.add_column('key', PType.Uint64, is_key=True)
- creation_options.add_column('value', PType.Utf8, column_family=0)
- storage_config = creation_options.declare_column_family(family_id=0)
- storage_config.appoint_syslog('hdd2')
- storage_config.appoint_log('hdd1')
- storage_config.appoint_data('hdd')
- storage_config.appoint_external('hdd2')
+ has_external = True
+ scheme = lambda table_name: has_item(
+ has_properties(
+ TableName='__user__{}'.format(table_name),
+ ColumnFamilies={
+ 0: {'Large': 524288,
+ 'Cache': 0,
+ 'InMemory': False,
+ 'Codec': 0,
+ 'Small': 12288,
+ 'RoomID': 0,
+ 'Columns': [1, 2]}
+ },
+ Rooms={
+ 0: {'Main': 1,
+ 'Outer': 1,
+ 'Blobs': 1}
+ }
+ )
+ )
+ return (creation_options, has_external, scheme)
+
+
+def case_5():
+ creation_options = CreateTableRequest.Options()
+ creation_options.add_column('key', PType.Uint64, is_key=True)
+ creation_options.add_column('value', PType.Utf8, column_family=0)
+ storage_config = creation_options.declare_column_family(family_id=0)
+ storage_config.appoint_syslog('hdd2')
+ storage_config.appoint_log('hdd1')
+ storage_config.appoint_data('hdd')
+ storage_config.appoint_external('hdd2')
creation_options.partition_config.with_partitioning_policy(0) # for now external blobs and autosplit not compatible
- has_external = True
- scheme = lambda table_name: has_item(
- has_properties(
- TableName='__user__{}'.format(table_name),
- ColumnFamilies={
- 0: {'Large': 524288,
- 'Cache': 0,
- 'InMemory': False,
- 'Codec': 0,
- 'Small': 12288,
- 'RoomID': 0,
- 'Columns': [1, 2]}
- },
- Rooms={
- 0: {'Main': 2,
- 'Outer': 2,
- 'Blobs': 3}
- }
- )
- )
- return (creation_options, has_external, scheme)
-
-
-def case_6():
- creation_options = CreateTableRequest.Options()
- creation_options.add_column('key', PType.Uint64, is_key=True)
- creation_options.add_column('value', PType.Utf8, column_family=0)
- storage_config = creation_options.declare_column_family(family_id=0)
- storage_config.appoint_syslog('hdd')
- storage_config.appoint_log('hdd1')
- storage_config.appoint_data('hdd2')
- storage_config.appoint_external('hdd2')
+ has_external = True
+ scheme = lambda table_name: has_item(
+ has_properties(
+ TableName='__user__{}'.format(table_name),
+ ColumnFamilies={
+ 0: {'Large': 524288,
+ 'Cache': 0,
+ 'InMemory': False,
+ 'Codec': 0,
+ 'Small': 12288,
+ 'RoomID': 0,
+ 'Columns': [1, 2]}
+ },
+ Rooms={
+ 0: {'Main': 2,
+ 'Outer': 2,
+ 'Blobs': 3}
+ }
+ )
+ )
+ return (creation_options, has_external, scheme)
+
+
+def case_6():
+ creation_options = CreateTableRequest.Options()
+ creation_options.add_column('key', PType.Uint64, is_key=True)
+ creation_options.add_column('value', PType.Utf8, column_family=0)
+ storage_config = creation_options.declare_column_family(family_id=0)
+ storage_config.appoint_syslog('hdd')
+ storage_config.appoint_log('hdd1')
+ storage_config.appoint_data('hdd2')
+ storage_config.appoint_external('hdd2')
creation_options.partition_config.with_partitioning_policy(0) # for now external blobs and autosplit not compatible
-
- has_external = True
- scheme = lambda table_name: has_item(
- has_properties(
- TableName='__user__{}'.format(table_name),
- ColumnFamilies={
- 0: {'Large': 524288,
- 'Cache': 0,
- 'InMemory': False,
- 'Codec': 0,
- 'Small': 12288,
- 'RoomID': 0,
- 'Columns': [1, 2]}
- },
- Rooms={
- 0: {'Main': 2,
- 'Outer': 2,
- 'Blobs': 2}
- }
- )
- )
- return (creation_options, has_external, scheme)
-
-
-def case_7():
- creation_options = CreateTableRequest.Options()
- creation_options.add_column('key', PType.Uint64, is_key=True)
- creation_options.add_column('value', PType.Utf8, column_family=0)
- storage_config = creation_options.declare_column_family(family_id=0)
- storage_config.appoint_syslog('hdd')
- storage_config.appoint_log('hdd1')
- storage_config.appoint_data('hdd2', threshold=12200)
- storage_config.appoint_external('hdd2', threshold=524200)
+
+ has_external = True
+ scheme = lambda table_name: has_item(
+ has_properties(
+ TableName='__user__{}'.format(table_name),
+ ColumnFamilies={
+ 0: {'Large': 524288,
+ 'Cache': 0,
+ 'InMemory': False,
+ 'Codec': 0,
+ 'Small': 12288,
+ 'RoomID': 0,
+ 'Columns': [1, 2]}
+ },
+ Rooms={
+ 0: {'Main': 2,
+ 'Outer': 2,
+ 'Blobs': 2}
+ }
+ )
+ )
+ return (creation_options, has_external, scheme)
+
+
+def case_7():
+ creation_options = CreateTableRequest.Options()
+ creation_options.add_column('key', PType.Uint64, is_key=True)
+ creation_options.add_column('value', PType.Utf8, column_family=0)
+ storage_config = creation_options.declare_column_family(family_id=0)
+ storage_config.appoint_syslog('hdd')
+ storage_config.appoint_log('hdd1')
+ storage_config.appoint_data('hdd2', threshold=12200)
+ storage_config.appoint_external('hdd2', threshold=524200)
creation_options.partition_config.with_partitioning_policy(0) # for now external blobs and autosplit not compatible
-
- has_external = True
- scheme = lambda table_name: has_item(
- has_properties(
- TableName='__user__{}'.format(table_name),
- ColumnFamilies={
- 0: {'Large': 524200,
- 'Cache': 0,
- 'InMemory': False,
- 'Codec': 0,
- 'Small': 12200,
- 'RoomID': 0,
- 'Columns': [1, 2]}
- },
- Rooms={
- 0: {'Main': 2,
- 'Outer': 2,
- 'Blobs': 2}
- }
- )
- )
- return (creation_options, has_external, scheme)
-
-
-def case_8():
- creation_options = CreateTableRequest.Options()
- creation_options.add_column('key', PType.Uint64, is_key=True)
- creation_options.add_column('value', PType.Utf8, column_family=0)
- storage_config = creation_options.declare_column_family(family_id=0)
- storage_config.appoint_syslog('hdd')
- storage_config.appoint_log('hdd1')
- storage_config.appoint_data('hdd2', threshold=0)
- storage_config.appoint_external('hdd2', threshold=0)
-
- has_external = False
- scheme = lambda table_name: has_item(
- has_properties(
- TableName='__user__{}'.format(table_name),
- ColumnFamilies={
- 0: {'Large': 4294967295,
- 'Cache': 0,
- 'InMemory': False,
- 'Codec': 0,
- 'Small': 4294967295,
- 'RoomID': 0,
- 'Columns': [1, 2]}
- },
- Rooms={
- 0: {'Main': 2,
- 'Outer': 2,
- 'Blobs': 2}
- }
- )
- )
- return (creation_options, has_external, scheme)
-
-
-def case_9():
- creation_options = CreateTableRequest.Options()
- creation_options.add_column('key', PType.Uint64, is_key=True)
- creation_options.add_column('value', PType.Utf8, column_family=0)
- storage_config = creation_options.declare_column_family(family_id=0)
- storage_config.appoint_syslog('hdd')
- storage_config.appoint_log('hdd')
- storage_config.appoint_data('hdd', threshold=12288)
- storage_config.appoint_external('hdd', threshold=524288)
+
+ has_external = True
+ scheme = lambda table_name: has_item(
+ has_properties(
+ TableName='__user__{}'.format(table_name),
+ ColumnFamilies={
+ 0: {'Large': 524200,
+ 'Cache': 0,
+ 'InMemory': False,
+ 'Codec': 0,
+ 'Small': 12200,
+ 'RoomID': 0,
+ 'Columns': [1, 2]}
+ },
+ Rooms={
+ 0: {'Main': 2,
+ 'Outer': 2,
+ 'Blobs': 2}
+ }
+ )
+ )
+ return (creation_options, has_external, scheme)
+
+
+def case_8():
+ creation_options = CreateTableRequest.Options()
+ creation_options.add_column('key', PType.Uint64, is_key=True)
+ creation_options.add_column('value', PType.Utf8, column_family=0)
+ storage_config = creation_options.declare_column_family(family_id=0)
+ storage_config.appoint_syslog('hdd')
+ storage_config.appoint_log('hdd1')
+ storage_config.appoint_data('hdd2', threshold=0)
+ storage_config.appoint_external('hdd2', threshold=0)
+
+ has_external = False
+ scheme = lambda table_name: has_item(
+ has_properties(
+ TableName='__user__{}'.format(table_name),
+ ColumnFamilies={
+ 0: {'Large': 4294967295,
+ 'Cache': 0,
+ 'InMemory': False,
+ 'Codec': 0,
+ 'Small': 4294967295,
+ 'RoomID': 0,
+ 'Columns': [1, 2]}
+ },
+ Rooms={
+ 0: {'Main': 2,
+ 'Outer': 2,
+ 'Blobs': 2}
+ }
+ )
+ )
+ return (creation_options, has_external, scheme)
+
+
+def case_9():
+ creation_options = CreateTableRequest.Options()
+ creation_options.add_column('key', PType.Uint64, is_key=True)
+ creation_options.add_column('value', PType.Utf8, column_family=0)
+ storage_config = creation_options.declare_column_family(family_id=0)
+ storage_config.appoint_syslog('hdd')
+ storage_config.appoint_log('hdd')
+ storage_config.appoint_data('hdd', threshold=12288)
+ storage_config.appoint_external('hdd', threshold=524288)
creation_options.partition_config.with_partitioning_policy(0) # for now external blobs and autosplit not compatible
- has_external = True
- scheme = lambda table_name: has_item(
- has_properties(
- TableName='__user__{}'.format(table_name),
- ColumnFamilies={
- 0: {'Large': 524288,
- 'Cache': 0,
- 'InMemory': False,
- 'Codec': 0,
- 'Small': 12288,
- 'RoomID': 0,
- 'Columns': [1, 2]}
- },
- Rooms={
- 0: {'Main': 1,
- 'Outer': 1,
- 'Blobs': 1}
- }
- )
- )
- return (creation_options, has_external, scheme)
-
-
-def case_10():
- creation_options = CreateTableRequest.Options()
- creation_options.add_column('key', PType.Uint64, is_key=True)
- creation_options.add_column('value', PType.Utf8, column_family=0)
- storage_config = creation_options.declare_column_family(family_id=0)
- storage_config.appoint_syslog('hdd')
- storage_config.appoint_log('hdd')
- storage_config.appoint_data('hdd', threshold=12288)
- storage_config.appoint_external('hdd', threshold=2*1024*1024+1)
+ has_external = True
+ scheme = lambda table_name: has_item(
+ has_properties(
+ TableName='__user__{}'.format(table_name),
+ ColumnFamilies={
+ 0: {'Large': 524288,
+ 'Cache': 0,
+ 'InMemory': False,
+ 'Codec': 0,
+ 'Small': 12288,
+ 'RoomID': 0,
+ 'Columns': [1, 2]}
+ },
+ Rooms={
+ 0: {'Main': 1,
+ 'Outer': 1,
+ 'Blobs': 1}
+ }
+ )
+ )
+ return (creation_options, has_external, scheme)
+
+
+def case_10():
+ creation_options = CreateTableRequest.Options()
+ creation_options.add_column('key', PType.Uint64, is_key=True)
+ creation_options.add_column('value', PType.Utf8, column_family=0)
+ storage_config = creation_options.declare_column_family(family_id=0)
+ storage_config.appoint_syslog('hdd')
+ storage_config.appoint_log('hdd')
+ storage_config.appoint_data('hdd', threshold=12288)
+ storage_config.appoint_external('hdd', threshold=2*1024*1024+1)
creation_options.partition_config.with_partitioning_policy(0) # for now external blobs and autosplit not compatible
-
- has_external = False
- scheme = lambda table_name: has_item(
- has_properties(
- TableName='__user__{}'.format(table_name),
- ColumnFamilies={
- 0: {'Large': 2*1024*1024+1,
- 'Cache': 0,
- 'InMemory': False,
- 'Codec': 0,
- 'Small': 12288,
- 'RoomID': 0,
- 'Columns': [1, 2]}
- },
- Rooms={
- 0: {'Main': 1,
- 'Outer': 1,
- 'Blobs': 1}
- }
- )
- )
- return (creation_options, has_external, scheme)
-
-TESTS = [
- case_0,
- case_1,
- case_2,
- case_3,
- case_4,
- case_5,
- case_6,
- case_7,
- case_8,
- case_9,
- case_10,
- case_11,
- case_12,
-]
-
-
-class TestStorageConfig(TBaseTenant):
- LOG_SETTINGS = {
- 'LOCAL': LogLevels.DEBUG,
- 'TX_DATASHARD': LogLevels.DEBUG,
- 'FLAT_TX_SCHEMESHARD': LogLevels.DEBUG,
- 'TX_PROXY': LogLevels.DEBUG,
- 'OPS_COMPACT': LogLevels.INFO,
- }
-
- def test_create_tablet(self):
- table_path = '%s/table-1' % (self.tenant_path)
-
+
+ has_external = False
+ scheme = lambda table_name: has_item(
+ has_properties(
+ TableName='__user__{}'.format(table_name),
+ ColumnFamilies={
+ 0: {'Large': 2*1024*1024+1,
+ 'Cache': 0,
+ 'InMemory': False,
+ 'Codec': 0,
+ 'Small': 12288,
+ 'RoomID': 0,
+ 'Columns': [1, 2]}
+ },
+ Rooms={
+ 0: {'Main': 1,
+ 'Outer': 1,
+ 'Blobs': 1}
+ }
+ )
+ )
+ return (creation_options, has_external, scheme)
+
+TESTS = [
+ case_0,
+ case_1,
+ case_2,
+ case_3,
+ case_4,
+ case_5,
+ case_6,
+ case_7,
+ case_8,
+ case_9,
+ case_10,
+ case_11,
+ case_12,
+]
+
+
+class TestStorageConfig(TBaseTenant):
+ LOG_SETTINGS = {
+ 'LOCAL': LogLevels.DEBUG,
+ 'TX_DATASHARD': LogLevels.DEBUG,
+ 'FLAT_TX_SCHEMESHARD': LogLevels.DEBUG,
+ 'TX_PROXY': LogLevels.DEBUG,
+ 'OPS_COMPACT': LogLevels.INFO,
+ }
+
+ def test_create_tablet(self):
+ table_path = '%s/table-1' % (self.tenant_path)
+
with self.pool.checkout() as session:
session.execute_scheme(
"create table `{}` (key Int32, value String, primary key(key));".format(
table_path
)
)
-
+
session.transaction().execute(
"upsert into `{}` (key) values (101);".format(table_path),
commit_tx=True,
)
-
+
session.transaction().execute(
"select key from `{}`;".format(table_path),
)
-
+
session.execute_scheme(
"drop table `{}`;".format(table_path),
)
-
- @pytest.mark.parametrize(
- "creation_options, has_external, matcher", [x() for x in TESTS],
- ids=[x.__name__ for x in TESTS]
- )
- def test_cases(self, creation_options, has_external, matcher):
+
+ @pytest.mark.parametrize(
+ "creation_options, has_external, matcher", [x() for x in TESTS],
+ ids=[x.__name__ for x in TESTS]
+ )
+ def test_cases(self, creation_options, has_external, matcher):
table_name = 'user_table_%d' % random.randint(1, 10000)
- table_path = '%s/%s' % (self.tenant_path, table_name)
- table_operations = scheme_operations.TableOperations(self.kikimr.client)
- table_operations.create_and_wait_and_assert(table_path, options=creation_options)
-
+ table_path = '%s/%s' % (self.tenant_path, table_name)
+ table_operations = scheme_operations.TableOperations(self.kikimr.client)
+ table_operations.create_and_wait_and_assert(table_path, options=creation_options)
+
write_huge_blobs(self.pool, table_path)
-
- assert_that(
- external_blobs_is_present(
- self.kikimr.nodes[1].monitor,
- list_tablets_in_table(self.kikimr.client, table_path)
- ),
- equal_to(has_external)
- )
-
- for tablet in list_tablets_in_table(self.kikimr.client, table_path):
- schema = get_scheme(self.kikimr.client, tablet)
- logger.debug("%s", schema)
- assert_that(
- schema,
- matcher(table_name)
- )
-
- table_operations.remove_and_wait_and_assert(table_path)
+
+ assert_that(
+ external_blobs_is_present(
+ self.kikimr.nodes[1].monitor,
+ list_tablets_in_table(self.kikimr.client, table_path)
+ ),
+ equal_to(has_external)
+ )
+
+ for tablet in list_tablets_in_table(self.kikimr.client, table_path):
+ schema = get_scheme(self.kikimr.client, tablet)
+ logger.debug("%s", schema)
+ assert_that(
+ schema,
+ matcher(table_name)
+ )
+
+ table_operations.remove_and_wait_and_assert(table_path)
diff --git a/ydb/tests/functional/tenants/test_tenants.py b/ydb/tests/functional/tenants/test_tenants.py
index 5836f8ab12b..138297d8ccd 100644
--- a/ydb/tests/functional/tenants/test_tenants.py
+++ b/ydb/tests/functional/tenants/test_tenants.py
@@ -1,20 +1,20 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
import os
import logging
import random
-import pytest
-
-from hamcrest import assert_that, greater_than, is_, not_, none
+import pytest
+
+from hamcrest import assert_that, greater_than, is_, not_, none
import ydb
-
-from common import Runtime, DBForStaticSlots
-
-
+
+from common import Runtime, DBForStaticSlots
+
+
logger = logging.getLogger(__name__)
-
-
-class TestTenants(DBForStaticSlots):
+
+
+class TestTenants(DBForStaticSlots):
def test_when_deactivate_fat_tenant_creation_another_tenant_is_ok(self):
logger.info("create fat tenant")
databases = [os.path.join(self.root_dir, "database_%d") % idx for idx in range(3)]
@@ -26,390 +26,390 @@ class TestTenants(DBForStaticSlots):
}
)
- driver_config = ydb.DriverConfig(
- "%s:%s" % (self.cluster.nodes[1].host, self.cluster.nodes[1].port),
- database
- )
-
- with Runtime(self.cluster, database):
- with ydb.Driver(driver_config) as driver:
- with ydb.SessionPool(driver) as pool:
- def create_table(session):
- session.create_table(
- os.path.join(database, 'table_0'),
- ydb.TableDescription()
- .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
- .with_primary_key('id')
- .with_profile(
- ydb.TableProfile()
- .with_partitioning_policy(
- ydb.PartitioningPolicy().with_uniform_partitions(self.boot_batch_size * 2)
- )
- )
- )
- pool.retry_operation_sync(create_table, self.robust_retries)
-
- def describe_table(session):
- result = session.describe_table(os.path.join(database, 'table_0'))
- logger.debug("> describe table: series, %s", str(result))
- return result
- pool.retry_operation_sync(describe_table)
+ driver_config = ydb.DriverConfig(
+ "%s:%s" % (self.cluster.nodes[1].host, self.cluster.nodes[1].port),
+ database
+ )
+
+ with Runtime(self.cluster, database):
+ with ydb.Driver(driver_config) as driver:
+ with ydb.SessionPool(driver) as pool:
+ def create_table(session):
+ session.create_table(
+ os.path.join(database, 'table_0'),
+ ydb.TableDescription()
+ .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
+ .with_primary_key('id')
+ .with_profile(
+ ydb.TableProfile()
+ .with_partitioning_policy(
+ ydb.PartitioningPolicy().with_uniform_partitions(self.boot_batch_size * 2)
+ )
+ )
+ )
+ pool.retry_operation_sync(create_table, self.robust_retries)
+
+ def describe_table(session):
+ result = session.describe_table(os.path.join(database, 'table_0'))
+ logger.debug("> describe table: series, %s", str(result))
+ return result
+ pool.retry_operation_sync(describe_table)
logger.info("remove tenants")
for database in databases:
- self.cluster.remove_database(database)
+ self.cluster.remove_database(database)
def test_register_tenant_and_force_drop_with_table(self):
- with Runtime(self.cluster, self.database_name, 1):
- with ydb.Driver(self.driver_config) as driver:
- with ydb.SessionPool(driver) as pool:
- def create_table(session):
- session.create_table(
- os.path.join(self.database_name, 'table_0'),
- ydb.TableDescription()
- .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
- .with_primary_key('id')
- )
-
- pool.retry_operation_sync(create_table, self.robust_retries)
-
- def test_force_delete_tenant_when_table_has_been_deleted(self):
- with Runtime(self.cluster, self.database_name):
- with ydb.Driver(self.driver_config) as driver:
- with ydb.SessionPool(driver) as pool:
- def create_table(session_):
- session_.create_table(
- os.path.join(self.database_name, 'table_0'),
- ydb.TableDescription()
- .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
- .with_primary_key('id')
- )
- pool.retry_operation_sync(create_table, self.robust_retries)
-
- def describe_table(session_):
- result = session_.describe_table(os.path.join(self.database_name, 'table_0'))
- logger.debug("> describe table: series, %s", str(result))
- return result
- pool.retry_operation_sync(describe_table)
-
- with pool.checkout() as session:
- session.drop_table(os.path.join(self.database_name, 'table_0'))
-
- def test_progress_when_tenant_tablets_run_on_dynamic_nodes(self):
- with Runtime(self.cluster, self.database_name):
- with ydb.Driver(self.driver_config) as driver:
- with ydb.SessionPool(driver) as pool:
- def create_table(session):
- session.create_table(
- os.path.join(self.database_name, 'table_0'),
- ydb.TableDescription()
- .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
- .with_primary_key('id')
- )
- pool.retry_operation_sync(create_table, self.robust_retries)
-
- def describe_table(session):
- result = session.describe_table(os.path.join(self.database_name, 'table_0'))
- logger.debug("> describe table: series, %s", str(result))
- return result
- pool.retry_operation_sync(describe_table)
-
- def drop_table(session):
- result = session.drop_table(os.path.join(self.database_name, 'table_0'))
- logger.debug("> drop table: series, %s", str(result))
- return result
- pool.retry_operation_sync(drop_table)
-
- def test_yql_operations_over_dynamic_nodes(self):
- with Runtime(self.cluster, self.database_name):
- table_path_1 = os.path.join(self.database_name, 'table_1')
- table_path_2 = os.path.join(self.database_name, 'table_2')
-
- with ydb.Driver(self.driver_config) as driver:
- with ydb.SessionPool(driver) as pool:
- def create_table(session):
- session.execute_scheme(
+ with Runtime(self.cluster, self.database_name, 1):
+ with ydb.Driver(self.driver_config) as driver:
+ with ydb.SessionPool(driver) as pool:
+ def create_table(session):
+ session.create_table(
+ os.path.join(self.database_name, 'table_0'),
+ ydb.TableDescription()
+ .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
+ .with_primary_key('id')
+ )
+
+ pool.retry_operation_sync(create_table, self.robust_retries)
+
+ def test_force_delete_tenant_when_table_has_been_deleted(self):
+ with Runtime(self.cluster, self.database_name):
+ with ydb.Driver(self.driver_config) as driver:
+ with ydb.SessionPool(driver) as pool:
+ def create_table(session_):
+ session_.create_table(
+ os.path.join(self.database_name, 'table_0'),
+ ydb.TableDescription()
+ .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
+ .with_primary_key('id')
+ )
+ pool.retry_operation_sync(create_table, self.robust_retries)
+
+ def describe_table(session_):
+ result = session_.describe_table(os.path.join(self.database_name, 'table_0'))
+ logger.debug("> describe table: series, %s", str(result))
+ return result
+ pool.retry_operation_sync(describe_table)
+
+ with pool.checkout() as session:
+ session.drop_table(os.path.join(self.database_name, 'table_0'))
+
+ def test_progress_when_tenant_tablets_run_on_dynamic_nodes(self):
+ with Runtime(self.cluster, self.database_name):
+ with ydb.Driver(self.driver_config) as driver:
+ with ydb.SessionPool(driver) as pool:
+ def create_table(session):
+ session.create_table(
+ os.path.join(self.database_name, 'table_0'),
+ ydb.TableDescription()
+ .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
+ .with_primary_key('id')
+ )
+ pool.retry_operation_sync(create_table, self.robust_retries)
+
+ def describe_table(session):
+ result = session.describe_table(os.path.join(self.database_name, 'table_0'))
+ logger.debug("> describe table: series, %s", str(result))
+ return result
+ pool.retry_operation_sync(describe_table)
+
+ def drop_table(session):
+ result = session.drop_table(os.path.join(self.database_name, 'table_0'))
+ logger.debug("> drop table: series, %s", str(result))
+ return result
+ pool.retry_operation_sync(drop_table)
+
+ def test_yql_operations_over_dynamic_nodes(self):
+ with Runtime(self.cluster, self.database_name):
+ table_path_1 = os.path.join(self.database_name, 'table_1')
+ table_path_2 = os.path.join(self.database_name, 'table_2')
+
+ with ydb.Driver(self.driver_config) as driver:
+ with ydb.SessionPool(driver) as pool:
+ def create_table(session):
+ session.execute_scheme(
"create table `{first}` (key Int32, value String, primary key(key));"
"create table `{second}` (key Int32, value String, primary key(key));"
- "".format(
- first=table_path_1,
- second=table_path_2
- )
- )
- pool.retry_operation_sync(create_table, self.robust_retries)
-
- def upsert(session):
- session.transaction().execute(
+ "".format(
+ first=table_path_1,
+ second=table_path_2
+ )
+ )
+ pool.retry_operation_sync(create_table, self.robust_retries)
+
+ def upsert(session):
+ session.transaction().execute(
"upsert into `{first}` (key) values (101);"
"upsert into `{second}` (key) values (102);"
- "".format(
- first=table_path_1,
- second=table_path_2
- ),
- commit_tx=True
- )
- pool.retry_operation_sync(upsert)
-
- def select(session):
- session.transaction().execute(
+ "".format(
+ first=table_path_1,
+ second=table_path_2
+ ),
+ commit_tx=True
+ )
+ pool.retry_operation_sync(upsert)
+
+ def select(session):
+ session.transaction().execute(
"select key from `{first}`;"
"select key from `{second}`;"
- "".format(
- first=table_path_1,
- second=table_path_2
- ),
- commit_tx=True
- )
- pool.retry_operation_sync(select)
-
- def test_resolve_nodes(self):
- driver = ydb.Driver(self.driver_config)
-
- try:
- driver.wait(self.robust_retries.get_session_client_timeout)
- except Exception as e:
- logger.info("failed to find endpoints as expected: " + str(e))
- errors = driver.discovery_debug_details()
- logger.info("discovery details: " + str(errors))
- else:
- logger.exception("endpoints have found, not expected")
- assert False
-
- with Runtime(self.cluster, self.database_name):
- with ydb.Driver(self.driver_config) as driver:
- with ydb.SessionPool(driver, size=1) as pool:
- def callee(session):
- session.execute_scheme(
+ "".format(
+ first=table_path_1,
+ second=table_path_2
+ ),
+ commit_tx=True
+ )
+ pool.retry_operation_sync(select)
+
+ def test_resolve_nodes(self):
+ driver = ydb.Driver(self.driver_config)
+
+ try:
+ driver.wait(self.robust_retries.get_session_client_timeout)
+ except Exception as e:
+ logger.info("failed to find endpoints as expected: " + str(e))
+ errors = driver.discovery_debug_details()
+ logger.info("discovery details: " + str(errors))
+ else:
+ logger.exception("endpoints have found, not expected")
+ assert False
+
+ with Runtime(self.cluster, self.database_name):
+ with ydb.Driver(self.driver_config) as driver:
+ with ydb.SessionPool(driver, size=1) as pool:
+ def callee(session):
+ session.execute_scheme(
"CREATE TABLE wormUp (id utf8, PRIMARY KEY (id));"
- )
- pool.retry_operation_sync(callee, self.robust_retries)
-
- def test_create_tables(self):
- with Runtime(self.cluster, self.database_name):
- with ydb.Driver(self.driver_config) as driver:
- with ydb.SessionPool(driver) as pool:
-
- def wormUp(session):
- session.execute_scheme(
+ )
+ pool.retry_operation_sync(callee, self.robust_retries)
+
+ def test_create_tables(self):
+ with Runtime(self.cluster, self.database_name):
+ with ydb.Driver(self.driver_config) as driver:
+ with ydb.SessionPool(driver) as pool:
+
+ def wormUp(session):
+ session.execute_scheme(
"CREATE TABLE wormUp (id utf8, PRIMARY KEY (id));"
- )
+ )
+
+ pool.retry_operation_sync(wormUp, self.robust_retries)
- pool.retry_operation_sync(wormUp, self.robust_retries)
-
- create_futures = []
- table = os.path.join(self.database_name, "temp/hardware/default/compute_az", "allocations")
- sessions = [pool.acquire() for _ in range(10)]
+ create_futures = []
+ table = os.path.join(self.database_name, "temp/hardware/default/compute_az", "allocations")
+ sessions = [pool.acquire() for _ in range(10)]
- for session in sessions:
- create_futures.append(
- session.async_execute_scheme(
+ for session in sessions:
+ create_futures.append(
+ session.async_execute_scheme(
"CREATE TABLE `{table}` (id utf8, PRIMARY KEY (id));".format(
- table=table
- )
+ table=table
+ )
)
)
-
- for session in sessions:
- pool.release(session)
-
- success_responses_count = 0
- for create_future in create_futures:
- try:
- create_future.result()
- success_responses_count += 1
- except ydb.Overloaded:
- pass
- except ydb.Unavailable as e:
- logger.info("ydb.Unavailable: " + str(e))
-
- with pool.checkout() as session:
- assert_that(
- session.describe_table(table),
- is_(
- not_(
- none()
- )
+
+ for session in sessions:
+ pool.release(session)
+
+ success_responses_count = 0
+ for create_future in create_futures:
+ try:
+ create_future.result()
+ success_responses_count += 1
+ except ydb.Overloaded:
+ pass
+ except ydb.Unavailable as e:
+ logger.info("ydb.Unavailable: " + str(e))
+
+ with pool.checkout() as session:
+ assert_that(
+ session.describe_table(table),
+ is_(
+ not_(
+ none()
+ )
)
)
-
- assert_that(
- success_responses_count,
- greater_than(0)
- )
-
- def test_stop_start(self):
- def create_table(session, table):
- session.execute_scheme(
+
+ assert_that(
+ success_responses_count,
+ greater_than(0)
+ )
+
+ def test_stop_start(self):
+ def create_table(session, table):
+ session.execute_scheme(
"CREATE TABLE `{table}` (id utf8, PRIMARY KEY (id));".format(table=table)
)
-
- for iNo in range(5):
- with Runtime(self.cluster, self.database_name):
- with ydb.Driver(self.driver_config) as driver:
- with ydb.SessionPool(driver) as pool:
- pool.retry_operation_sync(
- create_table,
- self.robust_retries,
- "table_%d" % iNo)
-
- def test_create_drop_create_table(self):
- with Runtime(self.cluster, self.database_name, 1):
- with ydb.Driver(self.driver_config) as driver:
- with ydb.SessionPool(driver) as pool:
- def create_table(session):
- session.create_table(
- os.path.join(self.database_name, 'table_0'),
- ydb.TableDescription()
- .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
- .with_primary_key('id')
- )
-
- def drop_table(session):
- session.drop_table(
- os.path.join(self.database_name, 'table_0'),
- )
-
- pool.retry_operation_sync(create_table, self.robust_retries)
- pool.retry_operation_sync(drop_table, self.robust_retries)
- pool.retry_operation_sync(create_table, self.robust_retries)
-
- def test_create_drop_create_table2(self):
- with Runtime(self.cluster, self.database_name, 1):
- with ydb.Driver(self.driver_config) as driver:
- with ydb.SessionPool(driver) as pool:
- def create_drop_create_table(session):
- session.create_table(
- os.path.join(self.database_name, 'table_0'),
- ydb.TableDescription()
- .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
- .with_primary_key('id')
- )
- session.drop_table(
- os.path.join(self.database_name, 'table_0'),
- )
- session.create_table(
- os.path.join(self.database_name, 'table_0'),
- ydb.TableDescription()
- .with_column(ydb.Column('id_1', ydb.OptionalType(ydb.DataType.Uint64)))
- .with_primary_key('id_1')
- )
-
- pool.retry_operation_sync(create_drop_create_table, self.robust_retries)
-
- @pytest.mark.xfail
- def test_create_drop_create_table3(self):
- with Runtime(self.cluster, self.database_name, 1):
- with ydb.Driver(self.driver_config) as driver:
- with ydb.SessionPool(driver) as pool:
- def create_table(session):
- session.execute_scheme('''
+
+ for iNo in range(5):
+ with Runtime(self.cluster, self.database_name):
+ with ydb.Driver(self.driver_config) as driver:
+ with ydb.SessionPool(driver) as pool:
+ pool.retry_operation_sync(
+ create_table,
+ self.robust_retries,
+ "table_%d" % iNo)
+
+ def test_create_drop_create_table(self):
+ with Runtime(self.cluster, self.database_name, 1):
+ with ydb.Driver(self.driver_config) as driver:
+ with ydb.SessionPool(driver) as pool:
+ def create_table(session):
+ session.create_table(
+ os.path.join(self.database_name, 'table_0'),
+ ydb.TableDescription()
+ .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
+ .with_primary_key('id')
+ )
+
+ def drop_table(session):
+ session.drop_table(
+ os.path.join(self.database_name, 'table_0'),
+ )
+
+ pool.retry_operation_sync(create_table, self.robust_retries)
+ pool.retry_operation_sync(drop_table, self.robust_retries)
+ pool.retry_operation_sync(create_table, self.robust_retries)
+
+ def test_create_drop_create_table2(self):
+ with Runtime(self.cluster, self.database_name, 1):
+ with ydb.Driver(self.driver_config) as driver:
+ with ydb.SessionPool(driver) as pool:
+ def create_drop_create_table(session):
+ session.create_table(
+ os.path.join(self.database_name, 'table_0'),
+ ydb.TableDescription()
+ .with_column(ydb.Column('id', ydb.OptionalType(ydb.DataType.Uint64)))
+ .with_primary_key('id')
+ )
+ session.drop_table(
+ os.path.join(self.database_name, 'table_0'),
+ )
+ session.create_table(
+ os.path.join(self.database_name, 'table_0'),
+ ydb.TableDescription()
+ .with_column(ydb.Column('id_1', ydb.OptionalType(ydb.DataType.Uint64)))
+ .with_primary_key('id_1')
+ )
+
+ pool.retry_operation_sync(create_drop_create_table, self.robust_retries)
+
+ @pytest.mark.xfail
+ def test_create_drop_create_table3(self):
+ with Runtime(self.cluster, self.database_name, 1):
+ with ydb.Driver(self.driver_config) as driver:
+ with ydb.SessionPool(driver) as pool:
+ def create_table(session):
+ session.execute_scheme('''
CREATE TABLE `{table}`
- (
- id Int64,
- primary key (id)
- );
- '''.format(table=os.path.join(self.database_name, 'table_0')))
- pool.retry_operation_sync(create_table, self.robust_retries)
-
- def drop_create_table(session):
- session.execute_scheme('''
+ (
+ id Int64,
+ primary key (id)
+ );
+ '''.format(table=os.path.join(self.database_name, 'table_0')))
+ pool.retry_operation_sync(create_table, self.robust_retries)
+
+ def drop_create_table(session):
+ session.execute_scheme('''
DROP TABLE `{table}`;
CREATE TABLE `{table}`
- (
- id_1 Int64,
- primary key (id_1)
- );
- '''.format(table=os.path.join(self.database_name, 'table_0')))
-
- pool.retry_operation_sync(drop_create_table, self.robust_retries)
-
- def test_create_create_table(self):
- with Runtime(self.cluster, self.database_name, 1):
- with ydb.Driver(self.driver_config) as driver:
- with ydb.SessionPool(driver) as pool:
- def create_tables(session, table_base):
- session.execute_scheme('''
+ (
+ id_1 Int64,
+ primary key (id_1)
+ );
+ '''.format(table=os.path.join(self.database_name, 'table_0')))
+
+ pool.retry_operation_sync(drop_create_table, self.robust_retries)
+
+ def test_create_create_table(self):
+ with Runtime(self.cluster, self.database_name, 1):
+ with ydb.Driver(self.driver_config) as driver:
+ with ydb.SessionPool(driver) as pool:
+ def create_tables(session, table_base):
+ session.execute_scheme('''
CREATE TABLE `{table}_0`
- (
- id Int64,
- primary key (id)
- );
+ (
+ id Int64,
+ primary key (id)
+ );
CREATE TABLE `{table}_1`
- (
- id Int64,
- primary key (id)
- );
- '''.format(table=os.path.join(self.database_name, table_base)))
-
- pool.retry_operation_sync(create_tables, self.robust_retries, "first_two")
- pool.retry_operation_sync(create_tables, self.robust_retries, "second_two")
-
- def test_list_database_above(self):
- database_path = self.database_name
- above_database, basename = os.path.split(database_path)
-
- def convert(item):
- def _get_entry_schema(entry):
- return ("name", os.path.basename(entry.name)), \
- ("type", str(entry.type)), \
- ("owner", entry.owner), \
- ("effective_permissions", [x.to_pb() for x in entry.effective_permissions]), \
- ("permissions", [x.to_pb() for x in entry.permissions])
-
- if type(item) == ydb.scheme.Directory:
- return ("Directory",) + _get_entry_schema(item) + (("children", [convert(x) for x in item.children]),)
-
- if type(item) == ydb.scheme.SchemeEntry:
- return ("SchemeEntry",) + _get_entry_schema(item)
-
- return ("UnknownEntry", type(item)) + _get_entry_schema(item)
-
- with Runtime(self.cluster, database_path, 1):
- with ydb.Driver(self.driver_config) as driver:
- driver.wait()
-
- result = driver.scheme_client.list_directory(database_path)
- logger.debug("From database: list database <%s> is %s", database_path, convert(result))
- assert len(result.children) > 0
- assert result.children[0].name == ".sys"
-
- result = driver.scheme_client.list_directory(above_database)
- logger.debug("From database: list above database <%s> is %s", above_database, convert(result))
- assert len(result.children) > 0
- assert result.children[0].name == basename
- assert result.children[0].type == ydb.scheme.SchemeEntryType.DATABASE
-
- driver_config_for_root = ydb.DriverConfig(
- "%s:%s" % (self.cluster.nodes[1].host, self.cluster.nodes[1].port),
- self.root_dir
- )
-
- with ydb.Driver(driver_config_for_root) as driver:
- driver.wait()
-
- result = driver.scheme_client.list_directory(database_path)
- logger.debug("From root: list database <%s> is %s", database_path, convert(result))
- assert len(result.children) > 0
- assert result.children[0].name == ".sys"
-
- result = driver.scheme_client.list_directory(above_database)
- logger.debug("From root: list above database <%s> is %s", above_database, convert(result))
- assert len(result.children) > 0
- assert result.children[0].name == basename
- assert result.children[0].type == ydb.scheme.SchemeEntryType.DATABASE
-
-
-class TestYqlLocks(DBForStaticSlots):
- def _create_tables(self, pool):
- def callee(session):
+ (
+ id Int64,
+ primary key (id)
+ );
+ '''.format(table=os.path.join(self.database_name, table_base)))
+
+ pool.retry_operation_sync(create_tables, self.robust_retries, "first_two")
+ pool.retry_operation_sync(create_tables, self.robust_retries, "second_two")
+
+ def test_list_database_above(self):
+ database_path = self.database_name
+ above_database, basename = os.path.split(database_path)
+
+ def convert(item):
+ def _get_entry_schema(entry):
+ return ("name", os.path.basename(entry.name)), \
+ ("type", str(entry.type)), \
+ ("owner", entry.owner), \
+ ("effective_permissions", [x.to_pb() for x in entry.effective_permissions]), \
+ ("permissions", [x.to_pb() for x in entry.permissions])
+
+ if type(item) == ydb.scheme.Directory:
+ return ("Directory",) + _get_entry_schema(item) + (("children", [convert(x) for x in item.children]),)
+
+ if type(item) == ydb.scheme.SchemeEntry:
+ return ("SchemeEntry",) + _get_entry_schema(item)
+
+ return ("UnknownEntry", type(item)) + _get_entry_schema(item)
+
+ with Runtime(self.cluster, database_path, 1):
+ with ydb.Driver(self.driver_config) as driver:
+ driver.wait()
+
+ result = driver.scheme_client.list_directory(database_path)
+ logger.debug("From database: list database <%s> is %s", database_path, convert(result))
+ assert len(result.children) > 0
+ assert result.children[0].name == ".sys"
+
+ result = driver.scheme_client.list_directory(above_database)
+ logger.debug("From database: list above database <%s> is %s", above_database, convert(result))
+ assert len(result.children) > 0
+ assert result.children[0].name == basename
+ assert result.children[0].type == ydb.scheme.SchemeEntryType.DATABASE
+
+ driver_config_for_root = ydb.DriverConfig(
+ "%s:%s" % (self.cluster.nodes[1].host, self.cluster.nodes[1].port),
+ self.root_dir
+ )
+
+ with ydb.Driver(driver_config_for_root) as driver:
+ driver.wait()
+
+ result = driver.scheme_client.list_directory(database_path)
+ logger.debug("From root: list database <%s> is %s", database_path, convert(result))
+ assert len(result.children) > 0
+ assert result.children[0].name == ".sys"
+
+ result = driver.scheme_client.list_directory(above_database)
+ logger.debug("From root: list above database <%s> is %s", above_database, convert(result))
+ assert len(result.children) > 0
+ assert result.children[0].name == basename
+ assert result.children[0].type == ydb.scheme.SchemeEntryType.DATABASE
+
+
+class TestYqlLocks(DBForStaticSlots):
+ def _create_tables(self, pool):
+ def callee(session):
session.execute_scheme(
"create table bills (account Uint64, deposit Int64, primary key(account)); "
"create table transfers "
"(tx Uint64, acc_from Uint64, acc_to Uint64, amount Int64, primary key(tx)); "
)
- pool.retry_operation_sync(callee, self.robust_retries)
-
- @staticmethod
+ pool.retry_operation_sync(callee, self.robust_retries)
+
+ @staticmethod
def _initial_credit(pool):
with pool.checkout() as session:
session.transaction().execute(
@@ -419,16 +419,16 @@ class TestYqlLocks(DBForStaticSlots):
"values (0u, 0u, 1u, 1000), (1u, 0u, 2u, 1000); ",
commit_tx=True,
)
-
- @staticmethod
+
+ @staticmethod
def _plan_transactions(pool):
- operations = []
- for x in range(1, 10):
- operations += [x, -x]
- random.shuffle(operations)
- return zip(range(2, 2 + len(operations)), operations)
-
- @staticmethod
+ operations = []
+ for x in range(1, 10):
+ operations += [x, -x]
+ random.shuffle(operations)
+ return zip(range(2, 2 + len(operations)), operations)
+
+ @staticmethod
def _perform_transaction(pool, tx, operation):
with pool.checkout() as session:
session.transaction().execute(
@@ -447,14 +447,14 @@ class TestYqlLocks(DBForStaticSlots):
"values ($tx, 1u, 2u, $delta); ".format(delta=operation, tx=tx),
commit_tx=True,
)
-
- @staticmethod
+
+ @staticmethod
def _control_read(pool):
account_first = "select account, deposit from bills where account = 1u;"
account_second = "select account, deposit from bills where account = 2u;"
transfers = "select tx, acc_from, acc_to, amount from transfers; "
-
- data = []
+
+ data = []
with pool.checkout() as session:
with session.transaction() as tx:
for query in (account_first, account_second, transfers):
@@ -463,39 +463,39 @@ class TestYqlLocks(DBForStaticSlots):
query
)
)
-
+
tx.commit()
- assert len(data) > 0
- return data
-
- def test_operation_with_locks(self):
- with Runtime(self.cluster, self.database_name):
- with ydb.Driver(self.driver_config) as driver:
- with ydb.SessionPool(driver, size=1) as pool:
-
- self._create_tables(pool)
-
- self._initial_credit(pool)
-
- transactions = self._plan_transactions(pool)
-
- for tx, operation in transactions:
- logger.debug("transaction %s operation %s", tx, operation)
- self._perform_transaction(
- pool,
- tx,
- operation
- )
-
- logger.debug("read with two hops")
- account_1, account_2, transfers = self._control_read(pool)
-
- assert account_1[0].rows[0].account == 1 and account_1[0].rows[0].deposit == 1000
- assert account_2[0].rows[0].account == 2 and account_1[0].rows[0].deposit == 1000
-
- sum = 0
- for tx, row in zip(range(len(transfers[0].rows)), transfers[0].rows):
- assert tx == row.tx and row.amount != 0
- sum += row.amount
-
- assert sum == 2000
+ assert len(data) > 0
+ return data
+
+ def test_operation_with_locks(self):
+ with Runtime(self.cluster, self.database_name):
+ with ydb.Driver(self.driver_config) as driver:
+ with ydb.SessionPool(driver, size=1) as pool:
+
+ self._create_tables(pool)
+
+ self._initial_credit(pool)
+
+ transactions = self._plan_transactions(pool)
+
+ for tx, operation in transactions:
+ logger.debug("transaction %s operation %s", tx, operation)
+ self._perform_transaction(
+ pool,
+ tx,
+ operation
+ )
+
+ logger.debug("read with two hops")
+ account_1, account_2, transfers = self._control_read(pool)
+
+ assert account_1[0].rows[0].account == 1 and account_1[0].rows[0].deposit == 1000
+ assert account_2[0].rows[0].account == 2 and account_1[0].rows[0].deposit == 1000
+
+ sum = 0
+ for tx, row in zip(range(len(transfers[0].rows)), transfers[0].rows):
+ assert tx == row.tx and row.amount != 0
+ sum += row.amount
+
+ assert sum == 2000
diff --git a/ydb/tests/functional/tenants/ya.make b/ydb/tests/functional/tenants/ya.make
index 4c2ef9bd086..dee204013e0 100644
--- a/ydb/tests/functional/tenants/ya.make
+++ b/ydb/tests/functional/tenants/ya.make
@@ -1,29 +1,29 @@
OWNER(g:kikimr)
PY3TEST()
ENV(YDB_DRIVER_BINARY="ydb/apps/ydbd/ydbd")
-TEST_SRCS(
- common.py
+TEST_SRCS(
+ common.py
test_db_counters.py
test_dynamic_tenants.py
- test_tenants.py
- test_storage_config.py
+ test_tenants.py
+ test_storage_config.py
test_system_views.py
- test_publish_into_schemeboard_with_common_ssring.py
-)
-
+ test_publish_into_schemeboard_with_common_ssring.py
+)
+
SPLIT_FACTOR(20)
TIMEOUT(600)
SIZE(MEDIUM)
-
+
DEPENDS(ydb/apps/ydbd)
-
-PEERDIR(
+
+PEERDIR(
ydb/tests/library
ydb/public/sdk/python/ydb
-)
-
-FORK_SUBTESTS()
+)
+
+FORK_SUBTESTS()
REQUIREMENTS(ram:10)
-END()
+END()
diff --git a/ydb/tests/functional/ttl/test_ttl.py b/ydb/tests/functional/ttl/test_ttl.py
index 16e5ab66097..a822a2d61fb 100644
--- a/ydb/tests/functional/ttl/test_ttl.py
+++ b/ydb/tests/functional/ttl/test_ttl.py
@@ -95,7 +95,7 @@ class TestTTL(object):
yield row
-class TestTTLDefaultEnv(TestTTL):
+class TestTTLDefaultEnv(TestTTL):
def test_case(self):
self._run_test()
diff --git a/ydb/tests/library/common/local_db_scheme.py b/ydb/tests/library/common/local_db_scheme.py
index bb27fefef13..2350333f6ca 100644
--- a/ydb/tests/library/common/local_db_scheme.py
+++ b/ydb/tests/library/common/local_db_scheme.py
@@ -1,19 +1,19 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
import ydb.core.protos.msgbus_pb2 as msgbus
from ydb.tests.library.common.types import DeltaTypes, PType
-
-
+
+
def column_to_dict(delta):
return {
"ColumnId": delta.ColumnId,
"ColumnName": delta.ColumnName,
"ColumnType": str(
PType.from_int(delta.ColumnType)
- )
+ )
}
-
-
+
+
class TableScheme(object):
def __init__(self, table_id, table_name):
self.data = {
@@ -25,70 +25,70 @@ class TableScheme(object):
'ColumnFamilies': {},
'Rooms': {}
}
-
- def add_column(self, delta):
+
+ def add_column(self, delta):
self.data['ColumnsAdded'].append(column_to_dict(delta))
- return self
-
- def drop_column(self, delta):
+ return self
+
+ def drop_column(self, delta):
self.data['ColumnsDropped'].append(column_to_dict(delta))
- return self
-
- def add_column_to_family(self, delta):
- cid = delta.ColumnId
- fid = delta.FamilyId
-
+ return self
+
+ def add_column_to_family(self, delta):
+ cid = delta.ColumnId
+ fid = delta.FamilyId
+
if fid not in self.data['ColumnFamilies']:
- raise RuntimeError("Unknown family")
-
+ raise RuntimeError("Unknown family")
+
self.data['ColumnFamilies'][fid]['Columns'].append(cid)
- return self
-
- def add_family(self, delta):
- fid = delta.FamilyId
- rid = delta.RoomId
-
+ return self
+
+ def add_family(self, delta):
+ fid = delta.FamilyId
+ rid = delta.RoomId
+
if rid not in self.data['Rooms']:
- raise RuntimeError("Unknown room")
-
+ raise RuntimeError("Unknown room")
+
if fid in self.data['ColumnFamilies']:
- raise RuntimeError("Rewriting family is unsupported")
-
+ raise RuntimeError("Rewriting family is unsupported")
+
self.data['ColumnFamilies'][fid] = {
- 'Columns': [],
- 'RoomID': rid,
- 'Codec': None,
- 'InMemory': None,
- 'Cache': None,
- 'Small': None,
- 'Large': None
- }
-
- return self
-
- def set_family(self, delta):
- fid = delta.FamilyId
-
+ 'Columns': [],
+ 'RoomID': rid,
+ 'Codec': None,
+ 'InMemory': None,
+ 'Cache': None,
+ 'Small': None,
+ 'Large': None
+ }
+
+ return self
+
+ def set_family(self, delta):
+ fid = delta.FamilyId
+
if fid not in self.data['ColumnFamilies']:
- raise RuntimeError("Unknown family")
-
- if hasattr(delta, 'Codec') and delta.Codec is not None:
+ raise RuntimeError("Unknown family")
+
+ if hasattr(delta, 'Codec') and delta.Codec is not None:
self.data['ColumnFamilies'][fid]['Codec'] = delta.Codec
-
- if hasattr(delta, 'InMemory') and delta.InMemory is not None:
+
+ if hasattr(delta, 'InMemory') and delta.InMemory is not None:
self.data['ColumnFamilies'][fid]['InMemory'] = delta.InMemory
-
- if hasattr(delta, 'Cache') and delta.Cache is not None:
+
+ if hasattr(delta, 'Cache') and delta.Cache is not None:
self.data['ColumnFamilies'][fid]['Cache'] = delta.Cache
-
- if hasattr(delta, 'Small') and delta.Small is not None:
+
+ if hasattr(delta, 'Small') and delta.Small is not None:
self.data['ColumnFamilies'][fid]['Small'] = delta.Small
-
- if hasattr(delta, 'Large') and delta.Large is not None:
+
+ if hasattr(delta, 'Large') and delta.Large is not None:
self.data['ColumnFamilies'][fid]['Large'] = delta.Large
-
- return self
-
+
+ return self
+
@property
def ColumnFamilies(self):
return self.data['ColumnFamilies']
@@ -101,61 +101,61 @@ class TableScheme(object):
def Rooms(self):
return self.data['Rooms']
- def add_column_to_key(self, delta):
- cid = delta.ColumnId
+ def add_column_to_key(self, delta):
+ cid = delta.ColumnId
self.data['TableKey'].append(cid)
- return self
-
- def unknown_delta(self, delta):
- raise RuntimeError("Unknown delta type")
-
- def set_room(self, delta):
+ return self
+
+ def unknown_delta(self, delta):
+ raise RuntimeError("Unknown delta type")
+
+ def set_room(self, delta):
self.data['Rooms'][delta.RoomId] = {"Main": delta.Main, "Outer": delta.Outer, "Blobs": delta.Blobs}
- return self
-
- def set_compaction_policy(self, delta):
- # Not Implemented yet
- return self
-
- def set_table(self, delta):
- # Not Implemented yet
- return self
-
- def add_delta(self, delta):
- mapping = {
- DeltaTypes.AddColumn: self.add_column,
- DeltaTypes.DropColumn: self.drop_column,
- DeltaTypes.AddColumnToKey: self.add_column_to_key,
- DeltaTypes.AddColumnToFamily: self.add_column_to_family,
- DeltaTypes.AddFamily: self.add_family,
- DeltaTypes.SetRoom: self.set_room,
- DeltaTypes.SetCompactionPolicy: self.set_compaction_policy,
- DeltaTypes.SetFamily: self.set_family,
- DeltaTypes.SetTable: self.set_table,
- }
- op = mapping.get(delta.DeltaType, self.unknown_delta)
- return op(delta)
-
-
+ return self
+
+ def set_compaction_policy(self, delta):
+ # Not Implemented yet
+ return self
+
+ def set_table(self, delta):
+ # Not Implemented yet
+ return self
+
+ def add_delta(self, delta):
+ mapping = {
+ DeltaTypes.AddColumn: self.add_column,
+ DeltaTypes.DropColumn: self.drop_column,
+ DeltaTypes.AddColumnToKey: self.add_column_to_key,
+ DeltaTypes.AddColumnToFamily: self.add_column_to_family,
+ DeltaTypes.AddFamily: self.add_family,
+ DeltaTypes.SetRoom: self.set_room,
+ DeltaTypes.SetCompactionPolicy: self.set_compaction_policy,
+ DeltaTypes.SetFamily: self.set_family,
+ DeltaTypes.SetTable: self.set_table,
+ }
+ op = mapping.get(delta.DeltaType, self.unknown_delta)
+ return op(delta)
+
+
def get_deltas(client, tablet_id):
resp = client.send_request(msgbus.TLocalSchemeTx(TabletID=tablet_id, Timeout=60 * 1000), method='LocalSchemeTx')
- return resp.LocalDbScheme.Delta
-
-
-def get_scheme(client, tablet_id):
+ return resp.LocalDbScheme.Delta
+
+
+def get_scheme(client, tablet_id):
deltas = get_deltas(client, tablet_id)
- scheme = []
+ scheme = []
pos = {}
-
- for delta in deltas:
- if not delta.HasField('TableId'):
- continue
-
- if delta.DeltaType == DeltaTypes.AddTable:
+
+ for delta in deltas:
+ if not delta.HasField('TableId'):
+ continue
+
+ if delta.DeltaType == DeltaTypes.AddTable:
table = TableScheme(delta.TableId, delta.TableName)
pos[delta.TableId] = len(scheme)
- scheme.append(table)
- continue
+ scheme.append(table)
+ continue
scheme[pos[delta.TableId]] = scheme[pos[delta.TableId]].add_delta(delta)
diff --git a/ydb/tests/library/common/msgbus_types.py b/ydb/tests/library/common/msgbus_types.py
index c699db60fbf..475837f0cde 100644
--- a/ydb/tests/library/common/msgbus_types.py
+++ b/ydb/tests/library/common/msgbus_types.py
@@ -104,7 +104,7 @@ class SchemeStatus(enum.IntEnum):
StatusNameConflict = 6
StatusInvalidParameter = 7
StatusMultipleModifications = 8
- ProxyShardNotAvailable = 13
+ ProxyShardNotAvailable = 13
@enum.unique
diff --git a/ydb/tests/library/common/path_types.py b/ydb/tests/library/common/path_types.py
index 15141e29167..f4956db1cf9 100644
--- a/ydb/tests/library/common/path_types.py
+++ b/ydb/tests/library/common/path_types.py
@@ -1,19 +1,19 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-from enum import IntEnum, unique
-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from enum import IntEnum, unique
+
from ydb.core.protos.flat_scheme_op_pb2 import EPathType
-
-
-@unique
-class PathType(IntEnum):
- """
+
+
+@unique
+class PathType(IntEnum):
+ """
These are from /arcadia/ydb/core/protos/flat_scheme_op.proto
- Just remap
- """
-
- Dir = EPathType.Value('EPathTypeDir')
- Table = EPathType.Value('EPathTypeTable')
- PersQueue = EPathType.Value('EPathTypePersQueueGroup')
- SubDomain = EPathType.Value('EPathTypeSubDomain')
+ Just remap
+ """
+
+ Dir = EPathType.Value('EPathTypeDir')
+ Table = EPathType.Value('EPathTypeTable')
+ PersQueue = EPathType.Value('EPathTypePersQueueGroup')
+ SubDomain = EPathType.Value('EPathTypeSubDomain')
diff --git a/ydb/tests/library/common/protobuf_console.py b/ydb/tests/library/common/protobuf_console.py
index 2a8a40a4812..2706cfc1b0d 100644
--- a/ydb/tests/library/common/protobuf_console.py
+++ b/ydb/tests/library/common/protobuf_console.py
@@ -27,25 +27,25 @@ class CreateTenantRequest(AbstractProtobufBuilder):
slot.count = count
return self
- def add_shared_storage_pool(self, pool_type, pool_size):
- pool = self.protobuf.CreateTenantRequest.Request.shared_resources.storage_units.add()
- pool.unit_kind = pool_type
- pool.count = pool_size
- return self
-
- def add_shared_slot(self, count, kind='slot', zone='any'):
- slot = self.protobuf.CreateTenantRequest.Request.shared_resources.computational_units.add()
- slot.unit_kind = kind
- slot.availability_zone = zone
- slot.count = count
- return self
-
- def share_resources_with(self, hostel_db):
- self.protobuf.CreateTenantRequest.Request.serverless_resources.shared_database_path = hostel_db
- return self
-
- def disable_external_subdomain(self):
- self.protobuf.CreateTenantRequest.Request.options.disable_external_subdomain = True
+ def add_shared_storage_pool(self, pool_type, pool_size):
+ pool = self.protobuf.CreateTenantRequest.Request.shared_resources.storage_units.add()
+ pool.unit_kind = pool_type
+ pool.count = pool_size
+ return self
+
+ def add_shared_slot(self, count, kind='slot', zone='any'):
+ slot = self.protobuf.CreateTenantRequest.Request.shared_resources.computational_units.add()
+ slot.unit_kind = kind
+ slot.availability_zone = zone
+ slot.count = count
+ return self
+
+ def share_resources_with(self, hostel_db):
+ self.protobuf.CreateTenantRequest.Request.serverless_resources.shared_database_path = hostel_db
+ return self
+
+ def disable_external_subdomain(self):
+ self.protobuf.CreateTenantRequest.Request.options.disable_external_subdomain = True
def set_schema_quotas(self, schema_quotas):
quotas = self.protobuf.CreateTenantRequest.Request.schema_operation_quotas
@@ -54,7 +54,7 @@ class CreateTenantRequest(AbstractProtobufBuilder):
q = quotas.leaky_bucket_quotas.add()
q.bucket_size = bucket_size
q.bucket_seconds = bucket_seconds
-
+
def set_disk_quotas(self, disk_quotas):
quotas = self.protobuf.CreateTenantRequest.Request.database_quotas
quotas.SetInParent()
@@ -107,16 +107,16 @@ class GetTenantStatusRequest(AbstractProtobufBuilder):
self.protobuf.GetTenantStatusRequest.Request.path = path
-class RemoveTenantRequest(AbstractProtobufBuilder):
- """
+class RemoveTenantRequest(AbstractProtobufBuilder):
+ """
See /arcadia/ydb/public/api/protos/ydb_cms.proto
- """
-
- def __init__(self, path):
- super(RemoveTenantRequest, self).__init__(msgbus.TConsoleRequest())
- self.protobuf.RemoveTenantRequest.Request.path = path
-
-
+ """
+
+ def __init__(self, path):
+ super(RemoveTenantRequest, self).__init__(msgbus.TConsoleRequest())
+ self.protobuf.RemoveTenantRequest.Request.path = path
+
+
class SetConfigRequest(AbstractProtobufBuilder):
"""
See /arcadia/ydb/core/protos/console.proto
diff --git a/ydb/tests/library/common/protobuf_ss.py b/ydb/tests/library/common/protobuf_ss.py
index a22138ef381..90b0638eb41 100644
--- a/ydb/tests/library/common/protobuf_ss.py
+++ b/ydb/tests/library/common/protobuf_ss.py
@@ -96,82 +96,82 @@ class CreatePath(AbstractProtobufBuilder):
self.protobuf.Transaction.ModifyScheme.MkDir.Name = name
-class RegisterTenant(AbstractProtobufBuilder):
- class Options(object):
- def __init__(self):
+class RegisterTenant(AbstractProtobufBuilder):
+ class Options(object):
+ def __init__(self):
self.__plan_resolution = 10
- self.__time_cast_buckets = 2
- self.__coordinators = 1
- self.__mediators = 1
-
- @property
- def plan_resolution(self):
- return self.__plan_resolution
-
- def with_plan_resolution(self, value):
- assert value > 0
- self.__plan_resolution = value
- return self
-
- @property
- def time_cast_buckets(self):
- return self.__time_cast_buckets
-
- def with_time_cast_buckets(self, value):
- assert value > 0
- self.__time_cast_buckets = value
- return self
-
- @property
- def coordinators(self):
- return self.__coordinators
-
- def with_coordinators(self, value):
- assert value > 0
- self.__coordinators = value
- return self
-
- @property
- def mediators(self):
- return self.__mediators
-
- def with_mediators(self, value):
- assert value > 0
- self.__mediators = value
- return self
-
- def __init__(self, work_dir, name=None, options=None):
+ self.__time_cast_buckets = 2
+ self.__coordinators = 1
+ self.__mediators = 1
+
+ @property
+ def plan_resolution(self):
+ return self.__plan_resolution
+
+ def with_plan_resolution(self, value):
+ assert value > 0
+ self.__plan_resolution = value
+ return self
+
+ @property
+ def time_cast_buckets(self):
+ return self.__time_cast_buckets
+
+ def with_time_cast_buckets(self, value):
+ assert value > 0
+ self.__time_cast_buckets = value
+ return self
+
+ @property
+ def coordinators(self):
+ return self.__coordinators
+
+ def with_coordinators(self, value):
+ assert value > 0
+ self.__coordinators = value
+ return self
+
+ @property
+ def mediators(self):
+ return self.__mediators
+
+ def with_mediators(self, value):
+ assert value > 0
+ self.__mediators = value
+ return self
+
+ def __init__(self, work_dir, name=None, options=None):
super(RegisterTenant, self).__init__(msgbus_pb2.TSchemeOperation())
-
- if name is None:
- name = basename(work_dir)
- work_dir = dirname(work_dir)
-
+
+ if name is None:
+ name = basename(work_dir)
+ work_dir = dirname(work_dir)
+
self.__modify_scheme.OperationType = flat_scheme_op_pb2.ESchemeOpCreateSubDomain
- self.__modify_scheme.WorkingDir = work_dir
-
- self.__tenant_settings.Name = name
-
- if options:
- self.with_options(options)
-
- def with_options(self, options):
- assert isinstance(options, self.Options)
- self.__tenant_settings.PlanResolution = options.plan_resolution
- self.__tenant_settings.TimeCastBucketsPerMediator = options.time_cast_buckets
- self.__tenant_settings.Coordinators = options.coordinators
- self.__tenant_settings.Mediators = options.mediators
- return self
-
- @property
- def __modify_scheme(self):
- return self.protobuf.Transaction.ModifyScheme
-
- @property
- def __tenant_settings(self):
- return self.protobuf.Transaction.ModifyScheme.SubDomain
-
-
+ self.__modify_scheme.WorkingDir = work_dir
+
+ self.__tenant_settings.Name = name
+
+ if options:
+ self.with_options(options)
+
+ def with_options(self, options):
+ assert isinstance(options, self.Options)
+ self.__tenant_settings.PlanResolution = options.plan_resolution
+ self.__tenant_settings.TimeCastBucketsPerMediator = options.time_cast_buckets
+ self.__tenant_settings.Coordinators = options.coordinators
+ self.__tenant_settings.Mediators = options.mediators
+ return self
+
+ @property
+ def __modify_scheme(self):
+ return self.protobuf.Transaction.ModifyScheme
+
+ @property
+ def __tenant_settings(self):
+ return self.protobuf.Transaction.ModifyScheme.SubDomain
+
+
def list_of_create_path_builders_from_full_path(full_path):
list_of_dirs = [path for path in string.split(full_path, '/') if path]
ret = []
@@ -186,269 +186,269 @@ def list_of_create_path_builders_from_full_path(full_path):
return ret
-class AbstractTSchemeOperationRequest(AbstractProtobufBuilder):
- """
- See
+class AbstractTSchemeOperationRequest(AbstractProtobufBuilder):
+ """
+ See
/arcadia/ydb/core/protos/msgbus_pb2.proto
/arcadia/ydb/core/protos/flat_scheme_op_pb2.proto
- """
- def __init__(self):
+ """
+ def __init__(self):
super(AbstractTSchemeOperationRequest, self).__init__(msgbus_pb2.TSchemeOperation())
-
-class _DropPolicyOptions(object):
- def __init__(self):
- super(_DropPolicyOptions, self).__init__()
+
+class _DropPolicyOptions(object):
+ def __init__(self):
+ super(_DropPolicyOptions, self).__init__()
self.__drop_policy = flat_scheme_op_pb2.EDropFailOnChanges
-
- @property
- def drop_policy(self):
- return self.__drop_policy
-
- def with_drop_policy(self, value):
+
+ @property
+ def drop_policy(self):
+ return self.__drop_policy
+
+ def with_drop_policy(self, value):
assert value in (flat_scheme_op_pb2.EDropAbortChanges,
flat_scheme_op_pb2.EDropFailOnChanges,
flat_scheme_op_pb2.EDropWaitChanges)
- self.__drop_policy = value
- return self
-
- def with_abort_on_changes(self):
+ self.__drop_policy = value
+ return self
+
+ def with_abort_on_changes(self):
self.__drop_policy = flat_scheme_op_pb2.EDropAbortChanges
- return self
-
- def with_fail_on_changes(self):
+ return self
+
+ def with_fail_on_changes(self):
self.__drop_policy = flat_scheme_op_pb2.EDropFailOnChanges
- return self
-
- def with_wait_changes(self):
+ return self
+
+ def with_wait_changes(self):
self.__drop_policy = flat_scheme_op_pb2.EDropWaitChanges
- return self
-
-
-class DropTenantRequest(AbstractTSchemeOperationRequest):
- class Options(_DropPolicyOptions):
- pass
-
+ return self
+
+
+class DropTenantRequest(AbstractTSchemeOperationRequest):
+ class Options(_DropPolicyOptions):
+ pass
+
def __init__(self, path, name=None, drop_policy=flat_scheme_op_pb2.EDropFailOnChanges, options=None):
- super(DropTenantRequest, self).__init__()
+ super(DropTenantRequest, self).__init__()
self.protobuf.Transaction.ModifyScheme.OperationType = flat_scheme_op_pb2.ESchemeOpDropSubDomain
-
- if name is None:
- name = basename(path)
- path = dirname(path)
-
- self.protobuf.Transaction.ModifyScheme.WorkingDir = path
- self.protobuf.Transaction.ModifyScheme.Drop.Name = name
-
- fixed_options = options or self.Options()
- fixed_options.with_drop_policy(drop_policy)
- self.with_options(fixed_options)
-
- def with_options(self, options):
- assert isinstance(options, self.Options)
-
- if options.drop_policy is not None:
- self.protobuf.Transaction.ModifyScheme.Drop.WaitPolicy = options.drop_policy
-
- return self
-
-
-class ForceDropTenantRequest(DropTenantRequest):
+
+ if name is None:
+ name = basename(path)
+ path = dirname(path)
+
+ self.protobuf.Transaction.ModifyScheme.WorkingDir = path
+ self.protobuf.Transaction.ModifyScheme.Drop.Name = name
+
+ fixed_options = options or self.Options()
+ fixed_options.with_drop_policy(drop_policy)
+ self.with_options(fixed_options)
+
+ def with_options(self, options):
+ assert isinstance(options, self.Options)
+
+ if options.drop_policy is not None:
+ self.protobuf.Transaction.ModifyScheme.Drop.WaitPolicy = options.drop_policy
+
+ return self
+
+
+class ForceDropTenantRequest(DropTenantRequest):
def __init__(self, path, name=None, drop_policy=flat_scheme_op_pb2.EDropFailOnChanges, options=None):
- super(ForceDropTenantRequest, self).__init__(path, name, drop_policy, options)
+ super(ForceDropTenantRequest, self).__init__(path, name, drop_policy, options)
self.protobuf.Transaction.ModifyScheme.OperationType = flat_scheme_op_pb2.ESchemeOpForceDropSubDomain
-
-
-class DropPathRequest(AbstractTSchemeOperationRequest):
- class Options(_DropPolicyOptions):
- pass
-
+
+
+class DropPathRequest(AbstractTSchemeOperationRequest):
+ class Options(_DropPolicyOptions):
+ pass
+
def __init__(self, path, name=None, drop_policy=flat_scheme_op_pb2.EDropFailOnChanges, options=None):
- super(DropPathRequest, self).__init__()
+ super(DropPathRequest, self).__init__()
self.protobuf.Transaction.ModifyScheme.OperationType = flat_scheme_op_pb2.ESchemeOpRmDir
-
- if name is None:
- name = basename(path)
- path = dirname(path)
-
- self.protobuf.Transaction.ModifyScheme.WorkingDir = path
- self.protobuf.Transaction.ModifyScheme.Drop.Name = name
-
- fixed_options = options or self.Options()
- fixed_options.with_drop_policy(drop_policy)
- self.with_options(fixed_options)
-
- def with_options(self, options):
- assert isinstance(options, self.Options)
-
- if options.drop_policy is not None:
- self.protobuf.Transaction.ModifyScheme.Drop.WaitPolicy = options.drop_policy
-
- return self
-
-
-class DropTopicRequest(AbstractTSchemeOperationRequest):
- class Options(_DropPolicyOptions):
- pass
-
- def __init__(self, path, topic_name=None, options=None):
- super(DropTopicRequest, self).__init__()
-
- if topic_name is None:
- topic_name = basename(path)
- path = dirname(path)
-
+
+ if name is None:
+ name = basename(path)
+ path = dirname(path)
+
+ self.protobuf.Transaction.ModifyScheme.WorkingDir = path
+ self.protobuf.Transaction.ModifyScheme.Drop.Name = name
+
+ fixed_options = options or self.Options()
+ fixed_options.with_drop_policy(drop_policy)
+ self.with_options(fixed_options)
+
+ def with_options(self, options):
+ assert isinstance(options, self.Options)
+
+ if options.drop_policy is not None:
+ self.protobuf.Transaction.ModifyScheme.Drop.WaitPolicy = options.drop_policy
+
+ return self
+
+
+class DropTopicRequest(AbstractTSchemeOperationRequest):
+ class Options(_DropPolicyOptions):
+ pass
+
+ def __init__(self, path, topic_name=None, options=None):
+ super(DropTopicRequest, self).__init__()
+
+ if topic_name is None:
+ topic_name = basename(path)
+ path = dirname(path)
+
self.__modify_scheme_transaction.OperationType = flat_scheme_op_pb2.ESchemeOpDropPersQueueGroup
- self.__modify_scheme_transaction.WorkingDir = path
- self.__drop.Name = topic_name
- self.with_options(options or self.Options())
-
+ self.__modify_scheme_transaction.WorkingDir = path
+ self.__drop.Name = topic_name
+ self.with_options(options or self.Options())
+
+ @property
+ def __modify_scheme_transaction(self):
+ return self.protobuf.Transaction.ModifyScheme
+
@property
- def __modify_scheme_transaction(self):
- return self.protobuf.Transaction.ModifyScheme
-
- @property
- def __drop(self):
- return self.__modify_scheme_transaction.Drop
-
- def with_options(self, options):
- assert isinstance(options, self.Options)
-
- if options.drop_policy is not None:
- self.__drop.WaitPolicy = options.drop_policy
-
- return self
-
-
-class CreateTopicRequest(AbstractTSchemeOperationRequest):
- class Options(object):
- def __init__(self):
- self.__partition_count = 10
- self.__partition_per_table = None
-
- # PartitionConfig
- self.__important_client_ids = None
- self.__max_count_in_partition = None
- self.__max_size_in_partition = None
- self.__lifetime_seconds = 0
-
- @property
- def partitions_count(self):
- return self.__partition_count
-
- def with_partitions_count(self, value):
- assert value > 0
- self.__partition_count = value
- return self
-
- @property
- def partition_per_table(self):
- return self.__partition_per_table
-
- def with_partition_per_table(self, value):
- assert value > 0
- self.__partition_per_table = value
- return self
-
- @property
- def important_client_ids(self):
- return self.__important_client_ids
-
- def with_important_client_ids(self, value):
- assert value > 0
- self.__important_client_ids = value
- return self
-
- @property
- def max_count_in_partition(self):
- return self.__max_count_in_partition
-
- def with_max_count_in_partition(self, value):
- assert value > 0
- self.__max_count_in_partition = value
- return self
-
- @property
- def max_size_in_partition(self):
- return self.__max_size_in_partition
-
- def with_max_size_in_partition(self, value):
- assert value > 0
- self.__max_size_in_partition = value
- return self
-
- @property
- def lifetime_seconds(self):
- return self.__lifetime_seconds
-
- def with_lifetime_seconds(self, value):
- assert value > 0
- self.__lifetime_seconds = value
- return self
-
- def __init__(self, path, topic_name=None, options=None):
- super(CreateTopicRequest, self).__init__()
-
- if topic_name is None:
- topic_name = basename(path)
- path = dirname(path)
-
- self._modify_scheme_transaction.OperationType = self._operation
- self._modify_scheme_transaction.WorkingDir = path
- self._pers_queue.Name = topic_name
- self.with_options(options or self.Options())
-
- @property
- def _operation(self):
+ def __drop(self):
+ return self.__modify_scheme_transaction.Drop
+
+ def with_options(self, options):
+ assert isinstance(options, self.Options)
+
+ if options.drop_policy is not None:
+ self.__drop.WaitPolicy = options.drop_policy
+
+ return self
+
+
+class CreateTopicRequest(AbstractTSchemeOperationRequest):
+ class Options(object):
+ def __init__(self):
+ self.__partition_count = 10
+ self.__partition_per_table = None
+
+ # PartitionConfig
+ self.__important_client_ids = None
+ self.__max_count_in_partition = None
+ self.__max_size_in_partition = None
+ self.__lifetime_seconds = 0
+
+ @property
+ def partitions_count(self):
+ return self.__partition_count
+
+ def with_partitions_count(self, value):
+ assert value > 0
+ self.__partition_count = value
+ return self
+
+ @property
+ def partition_per_table(self):
+ return self.__partition_per_table
+
+ def with_partition_per_table(self, value):
+ assert value > 0
+ self.__partition_per_table = value
+ return self
+
+ @property
+ def important_client_ids(self):
+ return self.__important_client_ids
+
+ def with_important_client_ids(self, value):
+ assert value > 0
+ self.__important_client_ids = value
+ return self
+
+ @property
+ def max_count_in_partition(self):
+ return self.__max_count_in_partition
+
+ def with_max_count_in_partition(self, value):
+ assert value > 0
+ self.__max_count_in_partition = value
+ return self
+
+ @property
+ def max_size_in_partition(self):
+ return self.__max_size_in_partition
+
+ def with_max_size_in_partition(self, value):
+ assert value > 0
+ self.__max_size_in_partition = value
+ return self
+
+ @property
+ def lifetime_seconds(self):
+ return self.__lifetime_seconds
+
+ def with_lifetime_seconds(self, value):
+ assert value > 0
+ self.__lifetime_seconds = value
+ return self
+
+ def __init__(self, path, topic_name=None, options=None):
+ super(CreateTopicRequest, self).__init__()
+
+ if topic_name is None:
+ topic_name = basename(path)
+ path = dirname(path)
+
+ self._modify_scheme_transaction.OperationType = self._operation
+ self._modify_scheme_transaction.WorkingDir = path
+ self._pers_queue.Name = topic_name
+ self.with_options(options or self.Options())
+
+ @property
+ def _operation(self):
return flat_scheme_op_pb2.ESchemeOpCreatePersQueueGroup
-
- @property
- def _modify_scheme_transaction(self):
- return self.protobuf.Transaction.ModifyScheme
-
- @property
- def _pers_queue(self):
- return self._modify_scheme_transaction.CreatePersQueueGroup
-
- @property
- def _partition_config(self):
- return self._pers_queue.PQTabletConfig.PartitionConfig
-
- def with_options(self, options):
- assert isinstance(options, self.Options)
-
- if options.partitions_count is not None:
+
+ @property
+ def _modify_scheme_transaction(self):
+ return self.protobuf.Transaction.ModifyScheme
+
+ @property
+ def _pers_queue(self):
+ return self._modify_scheme_transaction.CreatePersQueueGroup
+
+ @property
+ def _partition_config(self):
+ return self._pers_queue.PQTabletConfig.PartitionConfig
+
+ def with_options(self, options):
+ assert isinstance(options, self.Options)
+
+ if options.partitions_count is not None:
self._pers_queue.TotalGroupCount = options.partitions_count
-
- if options.partition_per_table is not None:
- self._pers_queue.PartitionPerTablet = options.partition_per_table
-
- if options.max_count_in_partition is not None:
- self._partition_config.MaxCountInPartition = options.max_count_in_partition
- self._partition_config.MaxSizeInPartition = options.max_count_in_partition * 10 ** 6
-
- if options.max_size_in_partition is not None:
- self._partition_config.MaxSizeInPartition = options.max_size_in_partition
-
- if options.lifetime_seconds is not None:
- self._partition_config.LifetimeSeconds = options.lifetime_seconds
-
- return self
-
-
-class AlterTopicRequest(CreateTopicRequest):
- def __init__(self, path, topic_name=None, options=None):
- super(AlterTopicRequest, self).__init__(path, topic_name, options)
-
- @property
- def _operation(self):
+
+ if options.partition_per_table is not None:
+ self._pers_queue.PartitionPerTablet = options.partition_per_table
+
+ if options.max_count_in_partition is not None:
+ self._partition_config.MaxCountInPartition = options.max_count_in_partition
+ self._partition_config.MaxSizeInPartition = options.max_count_in_partition * 10 ** 6
+
+ if options.max_size_in_partition is not None:
+ self._partition_config.MaxSizeInPartition = options.max_size_in_partition
+
+ if options.lifetime_seconds is not None:
+ self._partition_config.LifetimeSeconds = options.lifetime_seconds
+
+ return self
+
+
+class AlterTopicRequest(CreateTopicRequest):
+ def __init__(self, path, topic_name=None, options=None):
+ super(AlterTopicRequest, self).__init__(path, topic_name, options)
+
+ @property
+ def _operation(self):
return flat_scheme_op_pb2.ESchemeOpAlterPersQueueGroup
-
- @property
- def _pers_queue(self):
- return self._modify_scheme_transaction.AlterPersQueueGroup
-
-
+
+ @property
+ def _pers_queue(self):
+ return self._modify_scheme_transaction.AlterPersQueueGroup
+
+
class DropPath(AbstractProtobufBuilder):
def __init__(self, work_dir, name=None, drop_policy=flat_scheme_op_pb2.EDropFailOnChanges):
super(DropPath, self).__init__(msgbus_pb2.TSchemeOperation())
@@ -462,133 +462,133 @@ class DropPath(AbstractProtobufBuilder):
class CreateTableRequest(AbstractTSchemeOperationRequest):
- class Options(object):
+ class Options(object):
ColumnStorage1 = flat_scheme_op_pb2.ColumnStorage1
ColumnStorage2 = flat_scheme_op_pb2.ColumnStorage2
ColumnStorage1Ext1 = flat_scheme_op_pb2.ColumnStorage1Ext1
ColumnStorageTest_1_2_1k = flat_scheme_op_pb2.ColumnStorageTest_1_2_1k
ColumnCacheNone = flat_scheme_op_pb2.ColumnCacheNone
-
- class __StorageConfig(object):
- def __init__(self):
- self.__targets = {}
- allow_subsitude = True
- self.__defaults = {
- 'syslog': ("NotExist", allow_subsitude),
- 'log': ("NotExist", allow_subsitude)
- }
- self.__data_threshold = 0
- self.__external_threshold = 0
-
- def appoint_syslog(self, pool_kind, allow_subsitude=False):
- self.__targets['syslog'] = (pool_kind, allow_subsitude)
- return self
-
- def appoint_log(self, pool_kind, allow_subsitude=False):
- self.__targets['log'] = (pool_kind, allow_subsitude)
- return self
-
- def appoint_data(self, pool_kind, allow_subsitude=False, threshold=12*1024):
- self.__targets['data'] = (pool_kind, allow_subsitude)
- self.__data_threshold = threshold
- return self
-
- def appoint_external(self, pool_kind, allow_subsitude=False, threshold=512*1024):
- self.__targets['external'] = (pool_kind, allow_subsitude)
- self.__external_threshold = threshold
- return self
-
- def __apply_defaults(self):
- for key, value in self.__defaults.items():
- if key not in self.__targets:
- self.__targets[key] = value
-
- def __fill_result(self, setting, target):
- if target in self.__targets:
- setting.PreferredPoolKind, setting.AllowOtherKinds = self.__targets[target]
-
- def __nonzero__(self):
- return bool(self.__targets)
-
- def get_proto(self):
+
+ class __StorageConfig(object):
+ def __init__(self):
+ self.__targets = {}
+ allow_subsitude = True
+ self.__defaults = {
+ 'syslog': ("NotExist", allow_subsitude),
+ 'log': ("NotExist", allow_subsitude)
+ }
+ self.__data_threshold = 0
+ self.__external_threshold = 0
+
+ def appoint_syslog(self, pool_kind, allow_subsitude=False):
+ self.__targets['syslog'] = (pool_kind, allow_subsitude)
+ return self
+
+ def appoint_log(self, pool_kind, allow_subsitude=False):
+ self.__targets['log'] = (pool_kind, allow_subsitude)
+ return self
+
+ def appoint_data(self, pool_kind, allow_subsitude=False, threshold=12*1024):
+ self.__targets['data'] = (pool_kind, allow_subsitude)
+ self.__data_threshold = threshold
+ return self
+
+ def appoint_external(self, pool_kind, allow_subsitude=False, threshold=512*1024):
+ self.__targets['external'] = (pool_kind, allow_subsitude)
+ self.__external_threshold = threshold
+ return self
+
+ def __apply_defaults(self):
+ for key, value in self.__defaults.items():
+ if key not in self.__targets:
+ self.__targets[key] = value
+
+ def __fill_result(self, setting, target):
+ if target in self.__targets:
+ setting.PreferredPoolKind, setting.AllowOtherKinds = self.__targets[target]
+
+ def __nonzero__(self):
+ return bool(self.__targets)
+
+ def get_proto(self):
storage_config = AbstractProtobufBuilder(flat_scheme_op_pb2.TStorageConfig())
-
- self.__apply_defaults()
- self.__fill_result(storage_config.protobuf.SysLog, 'syslog')
- self.__fill_result(storage_config.protobuf.Log, 'log')
- self.__fill_result(storage_config.protobuf.Data, 'data')
- self.__fill_result(storage_config.protobuf.External, 'external')
- storage_config.protobuf.DataThreshold = self.__data_threshold
- storage_config.protobuf.ExternalThreshold = self.__external_threshold
-
- return storage_config.protobuf
-
- def __init__(self):
- self.__columns = list()
- self.__columns_family = list()
-
- self.__partitions_count = 1
- self.__partition_config = TPartitionConfig()
+
+ self.__apply_defaults()
+ self.__fill_result(storage_config.protobuf.SysLog, 'syslog')
+ self.__fill_result(storage_config.protobuf.Log, 'log')
+ self.__fill_result(storage_config.protobuf.Data, 'data')
+ self.__fill_result(storage_config.protobuf.External, 'external')
+ storage_config.protobuf.DataThreshold = self.__data_threshold
+ storage_config.protobuf.ExternalThreshold = self.__external_threshold
+
+ return storage_config.protobuf
+
+ def __init__(self):
+ self.__columns = list()
+ self.__columns_family = list()
+
+ self.__partitions_count = 1
+ self.__partition_config = TPartitionConfig()
self.__partition_config.with_followers(follower_count=1)
- self.__columns_family = list()
- self.__storage_config = {}
-
- def add_column(self, name, ptype, is_key=False, column_family=None):
- self.__columns.append((name, ptype, is_key, column_family))
- return self
-
- @property
- def columns(self):
- return self.__columns
-
- # deprecated: use declare_column_family and storage_config
- def add_column_family(self, family_id, storage, column_cache):
- self.__columns_family.append((family_id, storage, column_cache, 0, None))
- return self
-
- @property
- def columns_family(self):
- return self.__columns_family
-
- def declare_column_family(self, family_id,
- cache=0, codec=0):
- assert family_id not in self.__storage_config
- storage_config = self.__StorageConfig()
- self.__storage_config[family_id] = storage_config
- self.__columns_family.append((family_id, 0, cache, codec, storage_config))
- return storage_config
-
- def get_storage_config(self, family_id):
- if family_id not in self.__storage_config:
- return None
- return self.__storage_config[family_id]
-
- @property
- def partitions_count(self):
- return self.__partitions_count
-
- def with_partitions_count(self, value):
- assert value > 0
- self.__partitions_count = value
- return self
-
- @property
- def partition_config(self):
- return self.__partition_config
-
- def with_partition_config(self, value):
- assert isinstance(value, TPartitionConfig)
- self.__partition_config = value
- return self
-
+ self.__columns_family = list()
+ self.__storage_config = {}
+
+ def add_column(self, name, ptype, is_key=False, column_family=None):
+ self.__columns.append((name, ptype, is_key, column_family))
+ return self
+
+ @property
+ def columns(self):
+ return self.__columns
+
+ # deprecated: use declare_column_family and storage_config
+ def add_column_family(self, family_id, storage, column_cache):
+ self.__columns_family.append((family_id, storage, column_cache, 0, None))
+ return self
+
+ @property
+ def columns_family(self):
+ return self.__columns_family
+
+ def declare_column_family(self, family_id,
+ cache=0, codec=0):
+ assert family_id not in self.__storage_config
+ storage_config = self.__StorageConfig()
+ self.__storage_config[family_id] = storage_config
+ self.__columns_family.append((family_id, 0, cache, codec, storage_config))
+ return storage_config
+
+ def get_storage_config(self, family_id):
+ if family_id not in self.__storage_config:
+ return None
+ return self.__storage_config[family_id]
+
+ @property
+ def partitions_count(self):
+ return self.__partitions_count
+
+ def with_partitions_count(self, value):
+ assert value > 0
+ self.__partitions_count = value
+ return self
+
+ @property
+ def partition_config(self):
+ return self.__partition_config
+
+ def with_partition_config(self, value):
+ assert isinstance(value, TPartitionConfig)
+ self.__partition_config = value
+ return self
+
def __init__(self, path, table_name=None, options=None, use_options=True):
super(CreateTableRequest, self).__init__()
self.__column_ids = itertools.count(start=1)
- if table_name is None:
- table_name = basename(path)
- path = dirname(path)
-
+ if table_name is None:
+ table_name = basename(path)
+ path = dirname(path)
+
self.protobuf.Transaction.ModifyScheme.OperationType = flat_scheme_op_pb2.ESchemeOpCreateTable
self.protobuf.Transaction.ModifyScheme.WorkingDir = path
@@ -598,7 +598,7 @@ class CreateTableRequest(AbstractTSchemeOperationRequest):
self.with_options(
options or self.Options()
)
-
+
@property
def __create_table_protobuf(self):
return self.protobuf.Transaction.ModifyScheme.CreateTable
@@ -616,39 +616,39 @@ class CreateTableRequest(AbstractTSchemeOperationRequest):
self.__create_table_protobuf.UniformPartitionsCount = uniform_partitions_count
return self
- def with_column_family(self, id_, storage, column_cache, codec=0,
- storage_config=None):
+ def with_column_family(self, id_, storage, column_cache, codec=0,
+ storage_config=None):
family = self.__create_table_protobuf.PartitionConfig.ColumnFamilies.add(
- Id=id_, Storage=storage, ColumnCache=column_cache, ColumnCodec=codec
+ Id=id_, Storage=storage, ColumnCache=column_cache, ColumnCodec=codec
)
-
- if storage_config:
- family.StorageConfig.CopyFrom(
- storage_config.get_proto()
- )
-
+
+ if storage_config:
+ family.StorageConfig.CopyFrom(
+ storage_config.get_proto()
+ )
+
return self
def with_partition_config(self, partition_config):
self.__create_table_protobuf.PartitionConfig.CopyFrom(build_protobuf_if_necessary(partition_config))
return self
- def with_options(self, options):
- assert isinstance(options, self.Options)
-
- self.with_partitions(options.partitions_count)
-
- self.with_partition_config(options.partition_config)
-
- for items in options.columns_family:
- self.with_column_family(*items)
-
- for name, ptype, is_key, column_family in options.columns:
- self.add_column(name, ptype, is_key, column_family)
-
- return self
-
-
+ def with_options(self, options):
+ assert isinstance(options, self.Options)
+
+ self.with_partitions(options.partitions_count)
+
+ self.with_partition_config(options.partition_config)
+
+ for items in options.columns_family:
+ self.with_column_family(*items)
+
+ for name, ptype, is_key, column_family in options.columns:
+ self.add_column(name, ptype, is_key, column_family)
+
+ return self
+
+
class AlterTableRequest(AbstractTSchemeOperationRequest):
def __init__(self, path, table_name):
super(AlterTableRequest, self).__init__()
@@ -691,34 +691,34 @@ class AlterTableRequest(AbstractTSchemeOperationRequest):
class DropTableRequest(AbstractTSchemeOperationRequest):
- class Options(_DropPolicyOptions):
- pass
-
+ class Options(_DropPolicyOptions):
+ pass
+
def __init__(self, path, table_name=None, drop_policy=flat_scheme_op_pb2.EDropFailOnChanges, options=None):
super(DropTableRequest, self).__init__()
self.protobuf.Transaction.ModifyScheme.OperationType = flat_scheme_op_pb2.ESchemeOpDropTable
- if table_name is None:
- table_name = basename(path)
- path = dirname(path)
-
- self.protobuf.Transaction.ModifyScheme.WorkingDir = path
- self.protobuf.Transaction.ModifyScheme.Drop.Name = table_name
-
- fixed_options = options or self.Options()
- fixed_options.with_drop_policy(drop_policy)
- self.with_options(fixed_options)
-
- def with_options(self, options):
- assert isinstance(options, self.Options)
-
- if options.drop_policy is not None:
- self.protobuf.Transaction.ModifyScheme.Drop.WaitPolicy = options.drop_policy
-
- return self
-
-
-class SchemeOperationStatus(AbstractProtobufBuilder):
+ if table_name is None:
+ table_name = basename(path)
+ path = dirname(path)
+
+ self.protobuf.Transaction.ModifyScheme.WorkingDir = path
+ self.protobuf.Transaction.ModifyScheme.Drop.Name = table_name
+
+ fixed_options = options or self.Options()
+ fixed_options.with_drop_policy(drop_policy)
+ self.with_options(fixed_options)
+
+ def with_options(self, options):
+ assert isinstance(options, self.Options)
+
+ if options.drop_policy is not None:
+ self.protobuf.Transaction.ModifyScheme.Drop.WaitPolicy = options.drop_policy
+
+ return self
+
+
+class SchemeOperationStatus(AbstractProtobufBuilder):
def __init__(self, tx_id, scheme_shard_id, timeout_seconds=120):
super(SchemeOperationStatus, self).__init__(msgbus_pb2.TSchemeOperationStatus())
self.protobuf.FlatTxId.TxId = tx_id
@@ -726,10 +726,10 @@ class SchemeOperationStatus(AbstractProtobufBuilder):
self.protobuf.PollOptions.Timeout = timeout_seconds * 1000
-# make a synonym for old code
-TSchemeOperationStatus = SchemeOperationStatus
-
-
+# make a synonym for old code
+TSchemeOperationStatus = SchemeOperationStatus
+
+
class CopyTableRequest(AbstractTSchemeOperationRequest):
def __init__(self, source_table_full_name, destination_path, destination_name):
super(CopyTableRequest, self).__init__()
@@ -748,65 +748,65 @@ class CopyTableRequest(AbstractTSchemeOperationRequest):
class SchemeDescribeRequest(AbstractProtobufBuilder):
- class Options(object):
- def __init__(self):
- self.__partition_info = False
- self.__partition_config = False
- self.__backup_info = False
-
- @property
- def partition_info(self):
- return self.__partition_info
-
+ class Options(object):
+ def __init__(self):
+ self.__partition_info = False
+ self.__partition_config = False
+ self.__backup_info = False
+
+ @property
+ def partition_info(self):
+ return self.__partition_info
+
def with_partition_info(self, value=True):
- assert value > 0
- self.__partition_info = value
- return self
-
- @property
- def partition_config(self):
- return self.__partition_config
-
+ assert value > 0
+ self.__partition_info = value
+ return self
+
+ @property
+ def partition_config(self):
+ return self.__partition_config
+
def with_partition_config(self, value=True):
- assert value > 0
- self.__partition_config = value
- return self
-
- @property
- def backup_info(self):
- return self.__backup_info
-
+ assert value > 0
+ self.__partition_config = value
+ return self
+
+ @property
+ def backup_info(self):
+ return self.__backup_info
+
def with_backup_info(self, value=True):
- assert value > 0
- self.__backup_info = value
- return self
-
- def __init__(self, full_path, options=None):
+ assert value > 0
+ self.__backup_info = value
+ return self
+
+ def __init__(self, full_path, options=None):
super(SchemeDescribeRequest, self).__init__(msgbus_pb2.TSchemeDescribe())
self.protobuf.Path = full_path
- options = options or self.Options()
- self.with_options(options)
-
- @property
- def __options(self):
- return self.protobuf.Options
-
- def with_options(self, options):
- assert isinstance(options, self.Options)
- self.with_partition_info(options.partition_info)
- self.with_partition_config(options.partition_config)
- self.with_backup_info(options.backup_info)
- return self
-
- def with_partition_info(self, enable=True):
- self.__options.ReturnPartitioningInfo = enable
- return self
-
- def with_partition_config(self, enable=True):
- self.__options.ReturnPartitionConfig = enable
- return self
-
- def with_backup_info(self, enable=True):
- self.__options.BackupInfo = enable
- return self
+ options = options or self.Options()
+ self.with_options(options)
+
+ @property
+ def __options(self):
+ return self.protobuf.Options
+
+ def with_options(self, options):
+ assert isinstance(options, self.Options)
+ self.with_partition_info(options.partition_info)
+ self.with_partition_config(options.partition_config)
+ self.with_backup_info(options.backup_info)
+ return self
+
+ def with_partition_info(self, enable=True):
+ self.__options.ReturnPartitioningInfo = enable
+ return self
+
+ def with_partition_config(self, enable=True):
+ self.__options.ReturnPartitionConfig = enable
+ return self
+
+ def with_backup_info(self, enable=True):
+ self.__options.BackupInfo = enable
+ return self
diff --git a/ydb/tests/library/common/types.py b/ydb/tests/library/common/types.py
index 66ae1acfd36..5ec564d65fa 100644
--- a/ydb/tests/library/common/types.py
+++ b/ydb/tests/library/common/types.py
@@ -146,27 +146,27 @@ class TabletTypes(Enum):
TX_DUMMY = _tablet_type(8, 999)
RTMR_PARTITION = _tablet_type(10, 999)
KEYVALUEFLAT = _tablet_type(12, 999)
-
+
KESUS = _tablet_type(29, 999)
- PERSQUEUE = _tablet_type(20, 999)
- FLAT_DATASHARD = _tablet_type(18, 999, service_name='DATASHARD')
+ PERSQUEUE = _tablet_type(20, 999)
+ FLAT_DATASHARD = _tablet_type(18, 999, service_name='DATASHARD')
BLOCKSTORE_VOLUME = _tablet_type(25, 999)
BLOCKSTORE_PARTITION = _tablet_type(26, 999)
-
+
FLAT_TX_COORDINATOR = _tablet_type(13, 0x800001, service_name='TX_COORDINATOR')
- TX_MEDIATOR = _tablet_type(5, 0x810001, service_name='TX_MEDIATOR')
- TX_ALLOCATOR = _tablet_type(23, 0x820001, service_name='TX_ALLOCATOR')
+ TX_MEDIATOR = _tablet_type(5, 0x810001, service_name='TX_MEDIATOR')
+ TX_ALLOCATOR = _tablet_type(23, 0x820001, service_name='TX_ALLOCATOR')
FLAT_TX_PROXY = _tablet_type(17, 0x820001, service_name='TX_PROXY')
- FLAT_HIVE = _tablet_type(14, 0xA001, is_unique=True, service_name='HIVE')
- FLAT_SCHEMESHARD = _tablet_type(16, 0x8587a0, is_unique=True, service_name='FLAT_TX_SCHEMESHARD')
-
+ FLAT_HIVE = _tablet_type(14, 0xA001, is_unique=True, service_name='HIVE')
+ FLAT_SCHEMESHARD = _tablet_type(16, 0x8587a0, is_unique=True, service_name='FLAT_TX_SCHEMESHARD')
+
CMS = _tablet_type(21, 0x2000, is_unique=True, service_name='CMS')
- NODE_BROKER = _tablet_type(22, 0x2001, is_unique=True, service_name='NODE_BROKER')
+ NODE_BROKER = _tablet_type(22, 0x2001, is_unique=True, service_name='NODE_BROKER')
TENANT_SLOT_BROKER = _tablet_type(27, 0x2002, is_unique=True, service_name='TENANT_SLOT_BROKER')
CONSOLE = _tablet_type(28, 0x2003, is_unique=True, service_name='CONSOLE')
- FLAT_BS_CONTROLLER = _tablet_type(15, 0x1001, is_unique=True, service_name='BS_CONTROLLER')
-
+ FLAT_BS_CONTROLLER = _tablet_type(15, 0x1001, is_unique=True, service_name='BS_CONTROLLER')
+
USER_TYPE_START = _tablet_type(0xFF, 0)
TYPE_INVALID = _tablet_type(0xFFFFFFFF, 0)
@@ -196,8 +196,8 @@ class TabletTypes(Enum):
def tablet_id_for(self, index, domain_id=1):
if self.__is_unique:
- return domain_id << 56 | self.__magic_preset
-
+ return domain_id << 56 | self.__magic_preset
+
raw_tablet_id = self.__magic_preset + index
return (domain_id << 56) | (domain_id << 44) | (raw_tablet_id & 0x00000FFFFFFFFFFF)
diff --git a/ydb/tests/library/harness/daemon.py b/ydb/tests/library/harness/daemon.py
index 33a0735f0e1..edabe072629 100644
--- a/ydb/tests/library/harness/daemon.py
+++ b/ydb/tests/library/harness/daemon.py
@@ -45,15 +45,15 @@ class DaemonError(RuntimeError):
)
-class SeveralDaemonErrors(RuntimeError):
- def __init__(self, exceptions):
+class SeveralDaemonErrors(RuntimeError):
+ def __init__(self, exceptions):
super(SeveralDaemonErrors, self).__init__(
"\n".join(
str(x) for x in exceptions
)
)
-
-
+
+
class Daemon(object):
def __init__(self, command, cwd, timeout, stdin_file=None, stdout_file=None, stderr_file=None, stderr_on_error_lines=0):
self.__cwd = cwd
@@ -76,18 +76,18 @@ class Daemon(object):
def daemon(self):
return self.__daemon
- @property
+ @property
def stdin_file_name(self):
return os.path.abspath(self.__stdin_file.name)
@property
- def stdout_file_name(self):
+ def stdout_file_name(self):
return os.path.abspath(self.__stdout_file.name)
-
- @property
- def stderr_file_name(self):
+
+ @property
+ def stderr_file_name(self):
return os.path.abspath(self.__stderr_file.name)
-
+
def is_alive(self):
return self.__daemon is not None and self.__daemon.running
@@ -112,8 +112,8 @@ class Daemon(object):
self.__check_before_fail()
raise DaemonError(
"Unexpectedly finished on start",
- exit_code=self.__daemon.exit_code,
- stdout=self.stdout_file_name,
+ exit_code=self.__daemon.exit_code,
+ stdout=self.stdout_file_name,
stderr=self.stderr_file_name,
max_stderr_lines=self.__stderr_on_error_lines,
)
@@ -126,14 +126,14 @@ class Daemon(object):
self.__daemon.verify_no_coredumps()
self.__daemon.verify_sanitize_errors()
- @property
- def _acceptable_exit_codes(self):
+ @property
+ def _acceptable_exit_codes(self):
return 0, -signal.SIGTERM
-
+
def __check_can_launch_stop(self, stop_type):
if self.__daemon is None or self.__killed:
return False
-
+
if self.__daemon is not None and self.__daemon.exit_code == 0:
return False
@@ -142,8 +142,8 @@ class Daemon(object):
raise DaemonError(
"Unexpectedly finished before %s" % stop_type,
exit_code=self.__daemon.exit_code,
- stdout=self.stdout_file_name,
- stderr=self.stderr_file_name,
+ stdout=self.stdout_file_name,
+ stderr=self.stderr_file_name,
max_stderr_lines=self.__stderr_on_error_lines,
)
@@ -153,13 +153,13 @@ class Daemon(object):
if self.is_alive():
msg = "Cannot {stop_type} daemon cmd = {cmd}".format(cmd=' '.join(self.__command), stop_type=stop_type)
self.logger.error(msg)
- raise DaemonError(
- msg,
- exit_code=self.__daemon.exit_code,
- stdout=self.stdout_file_name,
+ raise DaemonError(
+ msg,
+ exit_code=self.__daemon.exit_code,
+ stdout=self.stdout_file_name,
stderr=self.stderr_file_name,
max_stderr_lines=self.__stderr_on_error_lines,
- )
+ )
def stop(self):
if not self.__check_can_launch_stop("stop"):
@@ -179,11 +179,11 @@ class Daemon(object):
exit_code = self.__daemon.exit_code
self.__check_before_fail()
- if exit_code not in self._acceptable_exit_codes:
+ if exit_code not in self._acceptable_exit_codes:
raise DaemonError(
- "Bad exit_code.",
- exit_code=exit_code,
- stdout=self.stdout_file_name,
+ "Bad exit_code.",
+ exit_code=exit_code,
+ stdout=self.stdout_file_name,
stderr=self.stderr_file_name,
max_stderr_lines=self.__stderr_on_error_lines,
)
diff --git a/ydb/tests/library/harness/kikimr_client.py b/ydb/tests/library/harness/kikimr_client.py
index fee88f6f48a..d74383ae231 100644
--- a/ydb/tests/library/harness/kikimr_client.py
+++ b/ydb/tests/library/harness/kikimr_client.py
@@ -67,13 +67,13 @@ class KiKiMRMessageBusClient(object):
self._channel = grpc.insecure_channel("%s:%s" % (self.server, self.port), options=self._options)
self._stub = grpc_server.TGRpcServerStub(self._channel)
- def describe(self, path, token):
- request = msgbus.TSchemeDescribe()
- request.Path = path
- request.SecurityToken = token
- request.Options.ReturnPartitioningInfo = False
- return self.send(request, 'SchemeDescribe')
-
+ def describe(self, path, token):
+ request = msgbus.TSchemeDescribe()
+ request.Path = path
+ request.SecurityToken = token
+ request.Options.ReturnPartitioningInfo = False
+ return self.send(request, 'SchemeDescribe')
+
def _get_invoke_callee(self, method):
return getattr(self._stub, method)
@@ -141,7 +141,7 @@ class KiKiMRMessageBusClient(object):
'SchemeOperationStatus'
)
- def bind_storage_pools(self, domain_name, spools):
+ def bind_storage_pools(self, domain_name, spools):
request = msgbus.TSchemeOperation()
scheme_transaction = request.Transaction
scheme_operation = scheme_transaction.ModifyScheme
@@ -149,8 +149,8 @@ class KiKiMRMessageBusClient(object):
scheme_operation.OperationType = flat_scheme_op.ESchemeOpAlterSubDomain
domain_description = scheme_operation.SubDomain
domain_description.Name = domain_name
- for name, kind in spools.items():
- domain_description.StoragePools.add(Name=name, Kind=kind)
+ for name, kind in spools.items():
+ domain_description.StoragePools.add(Name=name, Kind=kind)
return self.ddl_exec_status(
FlatTxId.from_response(
self.invoke(
@@ -186,35 +186,35 @@ class KiKiMRMessageBusClient(object):
request.SecurityToken = token
return self.send_and_poll_request(request, 'SchemeOperation')
- def upgrade_subdomain(self, working_dir, name, token=None):
- request = msgbus.TSchemeOperation()
- request.Transaction.ModifyScheme.OperationType = flat_scheme_op_pb2.ESchemeOpUpgradeSubDomain
- request.Transaction.ModifyScheme.WorkingDir = working_dir
- request.Transaction.ModifyScheme.UpgradeSubDomain.Name = name
- if token:
- request.SecurityToken = token
- return self.send_and_poll_request(request, 'SchemeOperation')
-
- def commit_upgrade_subdomain(self, working_dir, name, token=None):
- request = msgbus.TSchemeOperation()
- request.Transaction.ModifyScheme.OperationType = flat_scheme_op_pb2.ESchemeOpUpgradeSubDomainDecision
- request.Transaction.ModifyScheme.WorkingDir = working_dir
- request.Transaction.ModifyScheme.UpgradeSubDomain.Name = name
- request.Transaction.ModifyScheme.UpgradeSubDomain.Decision = flat_scheme_op_pb2.TUpgradeSubDomain.Commit
- if token:
- request.SecurityToken = token
- return self.send_and_poll_request(request, 'SchemeOperation')
-
- def undo_upgrade_subdomain(self, working_dir, name, token=None):
- request = msgbus.TSchemeOperation()
- request.Transaction.ModifyScheme.OperationType = flat_scheme_op_pb2.ESchemeOpUpgradeSubDomainDecision
- request.Transaction.ModifyScheme.WorkingDir = working_dir
- request.Transaction.ModifyScheme.UpgradeSubDomain.Name = name
- request.Transaction.ModifyScheme.UpgradeSubDomain.Decision = flat_scheme_op_pb2.TUpgradeSubDomain.Undo
- if token:
- request.SecurityToken = token
- return self.send_and_poll_request(request, 'SchemeOperation')
-
+ def upgrade_subdomain(self, working_dir, name, token=None):
+ request = msgbus.TSchemeOperation()
+ request.Transaction.ModifyScheme.OperationType = flat_scheme_op_pb2.ESchemeOpUpgradeSubDomain
+ request.Transaction.ModifyScheme.WorkingDir = working_dir
+ request.Transaction.ModifyScheme.UpgradeSubDomain.Name = name
+ if token:
+ request.SecurityToken = token
+ return self.send_and_poll_request(request, 'SchemeOperation')
+
+ def commit_upgrade_subdomain(self, working_dir, name, token=None):
+ request = msgbus.TSchemeOperation()
+ request.Transaction.ModifyScheme.OperationType = flat_scheme_op_pb2.ESchemeOpUpgradeSubDomainDecision
+ request.Transaction.ModifyScheme.WorkingDir = working_dir
+ request.Transaction.ModifyScheme.UpgradeSubDomain.Name = name
+ request.Transaction.ModifyScheme.UpgradeSubDomain.Decision = flat_scheme_op_pb2.TUpgradeSubDomain.Commit
+ if token:
+ request.SecurityToken = token
+ return self.send_and_poll_request(request, 'SchemeOperation')
+
+ def undo_upgrade_subdomain(self, working_dir, name, token=None):
+ request = msgbus.TSchemeOperation()
+ request.Transaction.ModifyScheme.OperationType = flat_scheme_op_pb2.ESchemeOpUpgradeSubDomainDecision
+ request.Transaction.ModifyScheme.WorkingDir = working_dir
+ request.Transaction.ModifyScheme.UpgradeSubDomain.Name = name
+ request.Transaction.ModifyScheme.UpgradeSubDomain.Decision = flat_scheme_op_pb2.TUpgradeSubDomain.Undo
+ if token:
+ request.SecurityToken = token
+ return self.send_and_poll_request(request, 'SchemeOperation')
+
def hive_create_tablets(self, list_of_tablets):
request = msgbus.THiveCreateTablet()
for tablet in list_of_tablets:
diff --git a/ydb/tests/library/harness/kikimr_cluster.py b/ydb/tests/library/harness/kikimr_cluster.py
index cc282aa5f26..942e1588ca4 100644
--- a/ydb/tests/library/harness/kikimr_cluster.py
+++ b/ydb/tests/library/harness/kikimr_cluster.py
@@ -16,7 +16,7 @@ from .kikimr_cluster_interface import KiKiMRClusterInterface
from . import blockstore
import yaml
-logger = logging.getLogger(__name__)
+logger = logging.getLogger(__name__)
DEFAULT_INTERCONNECT_PORT = 19001
DEFAULT_MBUS_PORT = 2134
diff --git a/ydb/tests/library/harness/kikimr_cluster_interface.py b/ydb/tests/library/harness/kikimr_cluster_interface.py
index 5264966da5c..96a891da11b 100644
--- a/ydb/tests/library/harness/kikimr_cluster_interface.py
+++ b/ydb/tests/library/harness/kikimr_cluster_interface.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import abc
-import logging
+import logging
import time
from ydb.tests.library.common.wait_for import wait_for
@@ -13,10 +13,10 @@ import ydb.public.api.protos.ydb_cms_pb2 as cms_tenants_pb
from ydb.public.api.protos.ydb_status_codes_pb2 import StatusIds
-logger = logging.getLogger(__name__)
-logger.setLevel(logging.DEBUG)
-
-
+logger = logging.getLogger(__name__)
+logger.setLevel(logging.DEBUG)
+
+
class KiKiMRClusterInterface(object):
__metaclass__ = abc.ABCMeta
@@ -105,29 +105,29 @@ class KiKiMRClusterInterface(object):
expected_computational_units=1
)
- def __wait_tenant_up(
- self,
- database_name,
- expected_computational_units=None,
- timeout_seconds=120
- ):
- def predicate():
+ def __wait_tenant_up(
+ self,
+ database_name,
+ expected_computational_units=None,
+ timeout_seconds=120
+ ):
+ def predicate():
result = self.get_database_status(database_name)
-
- if expected_computational_units is None:
+
+ if expected_computational_units is None:
expected = set([2])
- else:
- expected = set([2]) if expected_computational_units > 0 else set([4])
-
- return result.state in expected
-
- tenant_running = wait_for(
- predicate=predicate,
- timeout_seconds=timeout_seconds,
- step_seconds=1
- )
- assert tenant_running
-
+ else:
+ expected = set([2]) if expected_computational_units > 0 else set([4])
+
+ return result.state in expected
+
+ tenant_running = wait_for(
+ predicate=predicate,
+ timeout_seconds=timeout_seconds,
+ step_seconds=1
+ )
+ assert tenant_running
+
def __get_console_op(self, op_id):
req = GetOperationRequest(op_id)
response = self.client.send_request(req.protobuf, method='ConsoleRequest')
@@ -150,7 +150,7 @@ class KiKiMRClusterInterface(object):
self,
database_name,
storage_pool_units_count,
- disable_external_subdomain=False,
+ disable_external_subdomain=False,
timeout_seconds=120
):
req = CreateTenantRequest(database_name)
@@ -160,9 +160,9 @@ class KiKiMRClusterInterface(object):
units_count,
)
- if disable_external_subdomain:
- req.disable_external_subdomain()
-
+ if disable_external_subdomain:
+ req.disable_external_subdomain()
+
response = self.client.send_request(req.protobuf, method='ConsoleRequest')
operation = response.CreateTenantResponse.Response.operation
if not operation.ready and response.Status.Code != StatusIds.STATUS_CODE_UNSPECIFIED:
@@ -172,26 +172,26 @@ class KiKiMRClusterInterface(object):
if operation.status != StatusIds.SUCCESS:
raise RuntimeError('create_database failed: %s' % (operation.status,))
- self.__wait_tenant_up(
- database_name,
+ self.__wait_tenant_up(
+ database_name,
expected_computational_units=0,
- timeout_seconds=timeout_seconds
- )
- return database_name
-
- def create_hostel_database(
- self,
- database_name,
- storage_pool_units_count,
- timeout_seconds=120
- ):
- req = CreateTenantRequest(database_name)
- for storage_pool_type_name, units_count in storage_pool_units_count.items():
- req = req.add_shared_storage_pool(
- storage_pool_type_name,
- units_count,
- )
-
+ timeout_seconds=timeout_seconds
+ )
+ return database_name
+
+ def create_hostel_database(
+ self,
+ database_name,
+ storage_pool_units_count,
+ timeout_seconds=120
+ ):
+ req = CreateTenantRequest(database_name)
+ for storage_pool_type_name, units_count in storage_pool_units_count.items():
+ req = req.add_shared_storage_pool(
+ storage_pool_type_name,
+ units_count,
+ )
+
response = self.client.send_request(req.protobuf, method='ConsoleRequest')
operation = response.CreateTenantResponse.Response.operation
if not operation.ready and response.Status.Code != StatusIds.STATUS_CODE_UNSPECIFIED:
@@ -200,37 +200,37 @@ class KiKiMRClusterInterface(object):
operation = self.__wait_console_op(operation.id, timeout_seconds=timeout_seconds)
if operation.status != StatusIds.SUCCESS:
raise RuntimeError('create_hostel_database failed: %s' % (operation.status,))
-
- self.__wait_tenant_up(
- database_name,
+
+ self.__wait_tenant_up(
+ database_name,
expected_computational_units=0,
- timeout_seconds=timeout_seconds
+ timeout_seconds=timeout_seconds
)
return database_name
- def create_serverless_database(
- self,
- database_name,
- hostel_db,
+ def create_serverless_database(
+ self,
+ database_name,
+ hostel_db,
timeout_seconds=120,
schema_quotas=None,
disk_quotas=None,
- attributes=None
- ):
- req = CreateTenantRequest(database_name)
-
- req.share_resources_with(hostel_db)
-
+ attributes=None
+ ):
+ req = CreateTenantRequest(database_name)
+
+ req.share_resources_with(hostel_db)
+
if schema_quotas is not None:
req.set_schema_quotas(schema_quotas)
if disk_quotas is not None:
req.set_disk_quotas(disk_quotas)
- if attributes is not None:
- for name, value in attributes.items():
+ if attributes is not None:
+ for name, value in attributes.items():
req.set_attribute(name, value)
-
+
response = self.client.send_request(req.protobuf, method='ConsoleRequest')
operation = response.CreateTenantResponse.Response.operation
if not operation.ready and response.Status.Code != StatusIds.STATUS_CODE_UNSPECIFIED:
@@ -239,13 +239,13 @@ class KiKiMRClusterInterface(object):
operation = self.__wait_console_op(operation.id, timeout_seconds=timeout_seconds)
if operation.status != StatusIds.SUCCESS:
raise RuntimeError('create_serverless_database failed: %s' % (operation.status,))
-
- self.__wait_tenant_up(
- database_name,
- timeout_seconds=timeout_seconds
- )
- return database_name
-
+
+ self.__wait_tenant_up(
+ database_name,
+ timeout_seconds=timeout_seconds
+ )
+ return database_name
+
def alter_serverless_database(
self,
database_name,
@@ -278,13 +278,13 @@ class KiKiMRClusterInterface(object):
)
return database_name
- def remove_database(
- self,
- database_name,
- timeout_seconds=120
- ):
- req = RemoveTenantRequest(database_name)
-
+ def remove_database(
+ self,
+ database_name,
+ timeout_seconds=120
+ ):
+ req = RemoveTenantRequest(database_name)
+
response = self.client.send_request(req.protobuf, method='ConsoleRequest')
operation = response.RemoveTenantResponse.Response.operation
if not operation.ready and response.Status.Code != StatusIds.STATUS_CODE_UNSPECIFIED:
@@ -293,20 +293,20 @@ class KiKiMRClusterInterface(object):
operation = self.__wait_console_op(operation.id, timeout_seconds=timeout_seconds)
if operation.status not in (StatusIds.SUCCESS, StatusIds.NOT_FOUND):
raise RuntimeError('remove_database failed: %s' % (operation.status,))
-
- def predicate():
- response = self.client.send_request(
- GetTenantStatusRequest(database_name).protobuf, method='ConsoleRequest').GetTenantStatusResponse
- return response.Response.operation.status == StatusIds.NOT_FOUND
-
- tenant_not_found = wait_for(
- predicate=predicate,
- timeout_seconds=timeout_seconds,
- step_seconds=1
- )
- assert tenant_not_found
- return database_name
-
+
+ def predicate():
+ response = self.client.send_request(
+ GetTenantStatusRequest(database_name).protobuf, method='ConsoleRequest').GetTenantStatusResponse
+ return response.Response.operation.status == StatusIds.NOT_FOUND
+
+ tenant_not_found = wait_for(
+ predicate=predicate,
+ timeout_seconds=timeout_seconds,
+ step_seconds=1
+ )
+ assert tenant_not_found
+ return database_name
+
def __str__(self):
return "Cluster type: {ntype}: \nCluster nodes: {nodes}".format(
ntype=type(self), nodes=map(
diff --git a/ydb/tests/library/harness/kikimr_config.py b/ydb/tests/library/harness/kikimr_config.py
index ecdd2163fab..57c282b9f41 100644
--- a/ydb/tests/library/harness/kikimr_config.py
+++ b/ydb/tests/library/harness/kikimr_config.py
@@ -98,13 +98,13 @@ class KikimrConfigGenerator(object):
static_pdisk_size=PDISK_SIZE,
dynamic_pdisk_size=PDISK_SIZE,
dynamic_pdisks=[],
- dynamic_storage_pools=[dict(name="dynamic_storage_pool:1", kind="hdd", pdisk_user_kind=0)],
- n_to_select=None,
+ dynamic_storage_pools=[dict(name="dynamic_storage_pool:1", kind="hdd", pdisk_user_kind=0)],
+ n_to_select=None,
use_log_files=True,
grpc_ssl_enable=False,
use_in_memory_pdisks=False,
enable_pqcd=False,
- enable_metering=False,
+ enable_metering=False,
grpc_tls_data_path=None,
yql_config_path=None,
enable_datastreams=False,
@@ -147,9 +147,9 @@ class KikimrConfigGenerator(object):
self.__node_ids = list(range(1, nodes + 1))
self.n_to_select = n_to_select
if self.n_to_select is None:
- if erasure == Erasure.MIRROR_3_DC:
+ if erasure == Erasure.MIRROR_3_DC:
self.n_to_select = 9
- else:
+ else:
self.n_to_select = min(5, nodes)
self.__use_in_memory_pdisks = use_in_memory_pdisks or os.getenv('YDB_USE_IN_MEMORY_PDISKS') == 'true'
self.static_erasure = erasure
@@ -172,8 +172,8 @@ class KikimrConfigGenerator(object):
self.__dynamic_pdisks = dynamic_pdisks
- self.__output_path = output_path or yatest_common.output_path()
-
+ self.__output_path = output_path or yatest_common.output_path()
+
self.yaml_config = load_default_yaml(self.__node_ids, self.domain_name, self.static_erasure, self.n_to_select, self.__node_ids, self.__additional_log_configs)
self.yaml_config["feature_flags"]["enable_public_api_external_blobs"] = enable_public_api_external_blobs
self.yaml_config["feature_flags"]["enable_mvcc"] = "VALUE_FALSE" if disable_mvcc else "VALUE_TRUE"
@@ -185,9 +185,9 @@ class KikimrConfigGenerator(object):
with open(self.yaml_config["net_classifier_config"]["net_data_file_path"], "w") as net_data_file:
net_data_file.write("")
- if enable_metering:
- self.__set_enable_metering()
-
+ if enable_metering:
+ self.__set_enable_metering()
+
self.naming_config = config_pb2.TAppConfig()
dc_it = itertools.cycle(self._dcs)
rack_it = itertools.count(start=1)
@@ -275,29 +275,29 @@ class KikimrConfigGenerator(object):
def names_txt(self):
return self.naming_config.NameserviceConfig
- def __set_enable_metering(self):
- def ensure_path_exists(path):
- if not os.path.isdir(path):
- os.makedirs(path)
- return path
-
- def get_cwd_for_test(output_path):
- test_name = yatest_common.context.test_name or ""
- test_name = test_name.replace(':', '_')
- return os.path.join(output_path, test_name)
-
- cwd = get_cwd_for_test(self.__output_path)
- ensure_path_exists(cwd)
- metering_file_path = os.path.join(cwd, 'metering.txt')
- with open(metering_file_path, "w") as metering_file:
- metering_file.write('')
+ def __set_enable_metering(self):
+ def ensure_path_exists(path):
+ if not os.path.isdir(path):
+ os.makedirs(path)
+ return path
+
+ def get_cwd_for_test(output_path):
+ test_name = yatest_common.context.test_name or ""
+ test_name = test_name.replace(':', '_')
+ return os.path.join(output_path, test_name)
+
+ cwd = get_cwd_for_test(self.__output_path)
+ ensure_path_exists(cwd)
+ metering_file_path = os.path.join(cwd, 'metering.txt')
+ with open(metering_file_path, "w") as metering_file:
+ metering_file.write('')
self.yaml_config['metering_config'] = {'metering_file_path': metering_file_path}
-
+
@property
- def metering_file_path(self):
+ def metering_file_path(self):
return self.yaml_config.get('metering_config', {}).get('metering_file_path')
-
- @property
+
+ @property
def nbs_enable(self):
return self._enable_nbs
@@ -306,10 +306,10 @@ class KikimrConfigGenerator(object):
return self.yaml_config['sqs_config']['enable_sqs']
@property
- def output_path(self):
- return self.__output_path
-
- @property
+ def output_path(self):
+ return self.__output_path
+
+ @property
def binary_path(self):
return self.__binary_path
diff --git a/ydb/tests/library/harness/kikimr_http_client.py b/ydb/tests/library/harness/kikimr_http_client.py
index a28f7c08b04..68bbfe73754 100644
--- a/ydb/tests/library/harness/kikimr_http_client.py
+++ b/ydb/tests/library/harness/kikimr_http_client.py
@@ -106,15 +106,15 @@ class HiveClient(object):
timeout=TIMEOUT
)
- def set_max_boot_batch_size(self, max_boot_batch_size=10):
+ def set_max_boot_batch_size(self, max_boot_batch_size=10):
self.__get(
- self.__url + "&page=Settings&maxBootBatchSize={max_boot_batch_size}".format(
- max_boot_batch_size=max_boot_batch_size
- ),
- timeout=TIMEOUT
- )
+ self.__url + "&page=Settings&maxBootBatchSize={max_boot_batch_size}".format(
+ max_boot_batch_size=max_boot_batch_size
+ ),
+ timeout=TIMEOUT
+ )
+
-
class SwaggerClient(object):
def __init__(self, host, port, hive_id=DEFAULT_HIVE_ID):
super(SwaggerClient, self).__init__()
diff --git a/ydb/tests/library/harness/kikimr_runner.py b/ydb/tests/library/harness/kikimr_runner.py
index ee26fdee0c1..251f485b5db 100644
--- a/ydb/tests/library/harness/kikimr_runner.py
+++ b/ydb/tests/library/harness/kikimr_runner.py
@@ -21,14 +21,14 @@ from ydb.tests.library.predicates.blobstorage import blobstorage_controller_has_
from library.python import resource
-logger = logging.getLogger(__name__)
+logger = logging.getLogger(__name__)
-def get_unique_path_for_current_test(output_path, sub_folder):
- test_name = yatest_common.context.test_name or ""
+def get_unique_path_for_current_test(output_path, sub_folder):
+ test_name = yatest_common.context.test_name or ""
test_name = test_name.replace(':', '_')
- return os.path.join(output_path, test_name, sub_folder)
+ return os.path.join(output_path, test_name, sub_folder)
def ensure_path_exists(path):
@@ -292,7 +292,7 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface):
self.__wait_for_bs_controller_to_start()
self.__add_bs_box()
- pools = {}
+ pools = {}
for p in self.__configurator.dynamic_storage_pools:
self.add_storage_pool(
@@ -300,10 +300,10 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface):
kind=p['kind'],
pdisk_user_kind=p['pdisk_user_kind'],
)
- pools[p['name']] = p['kind']
+ pools[p['name']] = p['kind']
self.client.bind_storage_pools(self.domain_name, pools)
- default_pool_name = list(pools.keys())[0]
+ default_pool_name = list(pools.keys())[0]
self.default_channel_bindings = {idx: default_pool_name for idx in range(3)}
logger.info("Cluster started and initialized")
@@ -380,7 +380,7 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface):
return ret
def stop(self):
- saved_exceptions = []
+ saved_exceptions = []
for slot in self.slots.values():
exception = self.__stop_node(slot)
@@ -394,7 +394,7 @@ class KiKiMR(kikimr_cluster_interface.KiKiMRClusterInterface):
self.__port_allocator.release_ports()
- if saved_exceptions:
+ if saved_exceptions:
raise daemon.SeveralDaemonErrors(saved_exceptions)
@property
diff --git a/ydb/tests/library/matchers/scheme_ops.py b/ydb/tests/library/matchers/scheme_ops.py
index 57a9ed24ab8..2c84649c564 100644
--- a/ydb/tests/library/matchers/scheme_ops.py
+++ b/ydb/tests/library/matchers/scheme_ops.py
@@ -1,11 +1,11 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
import six
-import abc
-import logging
-
+import abc
+import logging
+
from hamcrest import assert_that, has_properties, equal_to, anything, any_of, instance_of, greater_than
-
+
from ydb.tests.library.common.msgbus_types import MessageBusStatus, SchemeStatus
from ydb.tests.library.common.path_types import PathType
from ydb.tests.library.common.protobuf import build_protobuf_if_necessary
@@ -15,387 +15,387 @@ from ydb.tests.library.common.protobuf_ss import CreateTableRequest, DropTableRe
from ydb.tests.library.common.protobuf_ss import RegisterTenant, DropTenantRequest, ForceDropTenantRequest
from ydb.tests.library.common.protobuf_ss import CreateTopicRequest, DropTopicRequest, AlterTopicRequest
from ydb.tests.library.matchers.response_matchers import DynamicFieldsProtobufMatcher
-
+
import ydb.core.protos.flat_scheme_op_pb2 as flat_scheme_op
-
-logger = logging.getLogger(__name__)
-
-
-class Assertions(object):
- def __init__(self, response):
- self.__actual_response = response
- self.status_is_ok()
- self.domain_is_present()
-
- def status_is_ok(self):
- assert_that(
- self.__actual_response,
- DynamicFieldsProtobufMatcher()
- .Status(MessageBusStatus.MSTATUS_OK)
- .SchemeStatus(SchemeStatus.StatusSuccess)
- )
- return self
-
- def domain_is_present(self):
- assert_that(
- self.__actual_response,
- DynamicFieldsProtobufMatcher()
- .PathDescription(
- has_properties(
- DomainDescription=has_properties(
- ProcessingParams=anything(),
- DomainKey=anything()
- )
- )
- )
- )
- return self
-
- def is_finished(self):
- assert_that(
- self.__actual_response,
- DynamicFieldsProtobufMatcher()
- .PathDescription(
- has_properties(
- Self=has_properties(
- CreateFinished=equal_to(True)
- )
- )
- )
- )
- return self
-
- def check_path_type(self, ptype):
- assert_that(
- self.__actual_response,
- DynamicFieldsProtobufMatcher()
- .PathDescription(
- has_properties(
- Self=has_properties(
- PathType=ptype
- )
- )
- )
- )
- return self
-
- def is_pers_queue(self):
- self.check_path_type(PathType.PersQueue)
- return self
-
- def is_dir(self):
- self.check_path_type(PathType.Dir)
- return self
-
- def is_tenant_root(self):
- self.check_path_type(PathType.SubDomain)
- return self
-
- def is_table(self):
- self.check_path_type(PathType.Table)
- return self
-
- def pers_queue_properties(self,
- name=None, total_partition_count=None, partition_per_tablet=None,
- balancer=None, alter_version=None):
- assert_that(
- self.__actual_response,
- DynamicFieldsProtobufMatcher()
- .PathDescription(
- has_properties(
- Self=has_properties(
- Name=name or anything()
- ),
- PersQueueGroup=has_properties(
- Name=name or anything(),
+
+logger = logging.getLogger(__name__)
+
+
+class Assertions(object):
+ def __init__(self, response):
+ self.__actual_response = response
+ self.status_is_ok()
+ self.domain_is_present()
+
+ def status_is_ok(self):
+ assert_that(
+ self.__actual_response,
+ DynamicFieldsProtobufMatcher()
+ .Status(MessageBusStatus.MSTATUS_OK)
+ .SchemeStatus(SchemeStatus.StatusSuccess)
+ )
+ return self
+
+ def domain_is_present(self):
+ assert_that(
+ self.__actual_response,
+ DynamicFieldsProtobufMatcher()
+ .PathDescription(
+ has_properties(
+ DomainDescription=has_properties(
+ ProcessingParams=anything(),
+ DomainKey=anything()
+ )
+ )
+ )
+ )
+ return self
+
+ def is_finished(self):
+ assert_that(
+ self.__actual_response,
+ DynamicFieldsProtobufMatcher()
+ .PathDescription(
+ has_properties(
+ Self=has_properties(
+ CreateFinished=equal_to(True)
+ )
+ )
+ )
+ )
+ return self
+
+ def check_path_type(self, ptype):
+ assert_that(
+ self.__actual_response,
+ DynamicFieldsProtobufMatcher()
+ .PathDescription(
+ has_properties(
+ Self=has_properties(
+ PathType=ptype
+ )
+ )
+ )
+ )
+ return self
+
+ def is_pers_queue(self):
+ self.check_path_type(PathType.PersQueue)
+ return self
+
+ def is_dir(self):
+ self.check_path_type(PathType.Dir)
+ return self
+
+ def is_tenant_root(self):
+ self.check_path_type(PathType.SubDomain)
+ return self
+
+ def is_table(self):
+ self.check_path_type(PathType.Table)
+ return self
+
+ def pers_queue_properties(self,
+ name=None, total_partition_count=None, partition_per_tablet=None,
+ balancer=None, alter_version=None):
+ assert_that(
+ self.__actual_response,
+ DynamicFieldsProtobufMatcher()
+ .PathDescription(
+ has_properties(
+ Self=has_properties(
+ Name=name or anything()
+ ),
+ PersQueueGroup=has_properties(
+ Name=name or anything(),
TotalGroupCount=total_partition_count or greater_than(0),
- PartitionPerTablet=partition_per_tablet or greater_than(0),
- AlterVersion=alter_version or greater_than(0),
- BalancerTabletID=balancer or greater_than(0),
- )
- )
- )
- )
-
-
-class _BaseSchemeOperation(object):
- __metaclass__ = abc.ABCMeta
-
- def __init__(self, client):
- assert hasattr(client, 'send_request')
- assert callable(getattr(client, 'send_request'))
-
- super(_BaseSchemeOperation, self).__init__()
- self._client = client
-
- def _send_request(self, protobuf, method='SchemeOperation'):
- return self._client.send_request(
- build_protobuf_if_necessary(protobuf),
- method
- )
-
- def _and_assert_scheme_status(self, response):
- assert_that(
- response,
+ PartitionPerTablet=partition_per_tablet or greater_than(0),
+ AlterVersion=alter_version or greater_than(0),
+ BalancerTabletID=balancer or greater_than(0),
+ )
+ )
+ )
+ )
+
+
+class _BaseSchemeOperation(object):
+ __metaclass__ = abc.ABCMeta
+
+ def __init__(self, client):
+ assert hasattr(client, 'send_request')
+ assert callable(getattr(client, 'send_request'))
+
+ super(_BaseSchemeOperation, self).__init__()
+ self._client = client
+
+ def _send_request(self, protobuf, method='SchemeOperation'):
+ return self._client.send_request(
+ build_protobuf_if_necessary(protobuf),
+ method
+ )
+
+ def _and_assert_scheme_status(self, response):
+ assert_that(
+ response,
DynamicFieldsProtobufMatcher().Status(MessageBusStatus.MSTATUS_OK).SchemeStatus(SchemeStatus.StatusSuccess)
- )
- return response
-
-
-class _WaitOperation(_BaseSchemeOperation):
- __metaclass__ = abc.ABCMeta
-
- def __init__(self, client):
- super(_WaitOperation, self).__init__(client)
-
- @staticmethod
- def __looks_like_scheme_response(response):
- assert_that(
- response,
- DynamicFieldsProtobufMatcher()
+ )
+ return response
+
+
+class _WaitOperation(_BaseSchemeOperation):
+ __metaclass__ = abc.ABCMeta
+
+ def __init__(self, client):
+ super(_WaitOperation, self).__init__(client)
+
+ @staticmethod
+ def __looks_like_scheme_response(response):
+ assert_that(
+ response,
+ DynamicFieldsProtobufMatcher()
.Status(any_of(*[x.value for x in MessageBusStatus]))
.SchemeStatus(any_of(*[x.value for x in SchemeStatus]))
.FlatTxId(
has_properties(
TxId=instance_of(six.integer_types),
SchemeShardTabletId=instance_of(six.integer_types)
- )
+ )
)
- )
-
- def wait(self, response, timeout_seconds=120):
- self.__looks_like_scheme_response(response)
-
- if response.Status != MessageBusStatus.MSTATUS_INPROGRESS:
- return response
-
- request = SchemeOperationStatus(
- response.FlatTxId.TxId,
- response.FlatTxId.SchemeShardTabletId,
- timeout_seconds
- )
- return self._send_request(
- request,
- method='SchemeOperationStatus'
- )
-
- def wait_and_assert(self, response, timeout_seconds=120):
- response = self.wait(response, timeout_seconds)
- return self._and_assert_scheme_status(response)
-
-
-class _CreateOperation(_WaitOperation):
- __metaclass__ = abc.ABCMeta
-
- def __init__(self, client):
- super(_CreateOperation, self).__init__(client)
- self.__creation_options = None
-
- def create_and_wait(self, *args, **kwargs):
- if "timeout_seconds" in kwargs:
- timeout_seconds = kwargs.pop("timeout_seconds")
- response = self.create(*args, **kwargs)
- return self.wait(response, timeout_seconds)
-
- response = self.create(*args, **kwargs)
- return self.wait(response)
-
- def create_and_wait_and_assert(self, *args, **kwargs):
- response = self.create_and_wait(*args, **kwargs)
- return self._and_assert_scheme_status(response)
-
- @property
- def creation_options(self):
- return self.__creation_options
-
- @abc.abstractmethod
- def create(self, *args, **kwargs):
- pass
-
-
-class _RemoveOperation(_WaitOperation):
- __metaclass__ = abc.ABCMeta
-
- def __init__(self, client):
- super(_RemoveOperation, self).__init__(client)
- self.__removing_options = None
-
- def remove_and_wait_and_assert(self, *args, **kwargs):
- response = self.remove_and_wait(*args, **kwargs)
- return self._and_assert_scheme_status(response)
-
- def remove_and_wait(self, *args, **kwargs):
- if "timeout_seconds" in kwargs:
- timeout_seconds = kwargs.pop("timeout_seconds")
- response = self.remove(*args, **kwargs)
- return self.wait(response, timeout_seconds)
-
- response = self.remove(*args, **kwargs)
- return self.wait(response)
-
- @property
- def removing_options(self):
- return self.__removing_options
-
- @abc.abstractmethod
- def remove(self, *args, **kwargs):
- pass
-
-
-class _AlterOperation(_WaitOperation):
- __metaclass__ = abc.ABCMeta
-
- def __init__(self, client):
- super(_AlterOperation, self).__init__(client)
- self.__altering_options = None
-
- def alter_and_wait_and_assert(self, *args, **kwargs):
- response = self.alter_and_wait(*args, **kwargs)
- return self._and_assert_scheme_status(response)
-
- def alter_and_wait(self, *args, **kwargs):
- response = self.alter(*args, **kwargs)
- return self.wait(response)
-
- @property
- def altering_options(self):
- return self.__altering_options
-
- @abc.abstractmethod
- def alter(self, *args, **kwargs):
- pass
-
-
-class _DescribeOperation(_BaseSchemeOperation):
- __metaclass__ = abc.ABCMeta
-
- def __init__(self, client):
- super(_DescribeOperation, self).__init__(client)
- self.__describe_opts = SchemeDescribeRequest.Options()
-
- @property
- def describe_options(self):
- return self.__describe_opts
-
- def describe(self, path):
- return self._send_request(
- SchemeDescribeRequest(path, self.describe_options),
- method='SchemeDescribe'
- )
-
-
-class TenantOperations(_CreateOperation, _RemoveOperation, _DescribeOperation):
- def __init__(self, client):
- super(TenantOperations, self).__init__(client)
- self.__creation_options = RegisterTenant.Options()
- self.__removing_options = DropTenantRequest.Options()
-
- @property
- def creation_options(self):
- return self.__creation_options
-
- def create(self, path, options=None):
- options = options or self.creation_options
- return self._send_request(
- RegisterTenant(path, options=options)
- )
-
- @property
- def removing_options(self):
- return self.__removing_options
-
- def remove(self, path, options=None):
- options = options or self.removing_options
- # it's a trick
- # because we have the different transaction in SS for that case
- if options.drop_policy == flat_scheme_op.EDropAbortChanges:
- return self._send_request(
- ForceDropTenantRequest(path, options=options)
- )
- else:
- return self._send_request(
- DropTenantRequest(path, options=options)
- )
-
-
-class PathOperations(_CreateOperation, _RemoveOperation, _DescribeOperation):
+ )
+
+ def wait(self, response, timeout_seconds=120):
+ self.__looks_like_scheme_response(response)
+
+ if response.Status != MessageBusStatus.MSTATUS_INPROGRESS:
+ return response
+
+ request = SchemeOperationStatus(
+ response.FlatTxId.TxId,
+ response.FlatTxId.SchemeShardTabletId,
+ timeout_seconds
+ )
+ return self._send_request(
+ request,
+ method='SchemeOperationStatus'
+ )
+
+ def wait_and_assert(self, response, timeout_seconds=120):
+ response = self.wait(response, timeout_seconds)
+ return self._and_assert_scheme_status(response)
+
+
+class _CreateOperation(_WaitOperation):
+ __metaclass__ = abc.ABCMeta
+
+ def __init__(self, client):
+ super(_CreateOperation, self).__init__(client)
+ self.__creation_options = None
+
+ def create_and_wait(self, *args, **kwargs):
+ if "timeout_seconds" in kwargs:
+ timeout_seconds = kwargs.pop("timeout_seconds")
+ response = self.create(*args, **kwargs)
+ return self.wait(response, timeout_seconds)
+
+ response = self.create(*args, **kwargs)
+ return self.wait(response)
+
+ def create_and_wait_and_assert(self, *args, **kwargs):
+ response = self.create_and_wait(*args, **kwargs)
+ return self._and_assert_scheme_status(response)
+
+ @property
+ def creation_options(self):
+ return self.__creation_options
+
+ @abc.abstractmethod
+ def create(self, *args, **kwargs):
+ pass
+
+
+class _RemoveOperation(_WaitOperation):
+ __metaclass__ = abc.ABCMeta
+
+ def __init__(self, client):
+ super(_RemoveOperation, self).__init__(client)
+ self.__removing_options = None
+
+ def remove_and_wait_and_assert(self, *args, **kwargs):
+ response = self.remove_and_wait(*args, **kwargs)
+ return self._and_assert_scheme_status(response)
+
+ def remove_and_wait(self, *args, **kwargs):
+ if "timeout_seconds" in kwargs:
+ timeout_seconds = kwargs.pop("timeout_seconds")
+ response = self.remove(*args, **kwargs)
+ return self.wait(response, timeout_seconds)
+
+ response = self.remove(*args, **kwargs)
+ return self.wait(response)
+
+ @property
+ def removing_options(self):
+ return self.__removing_options
+
+ @abc.abstractmethod
+ def remove(self, *args, **kwargs):
+ pass
+
+
+class _AlterOperation(_WaitOperation):
+ __metaclass__ = abc.ABCMeta
+
+ def __init__(self, client):
+ super(_AlterOperation, self).__init__(client)
+ self.__altering_options = None
+
+ def alter_and_wait_and_assert(self, *args, **kwargs):
+ response = self.alter_and_wait(*args, **kwargs)
+ return self._and_assert_scheme_status(response)
+
+ def alter_and_wait(self, *args, **kwargs):
+ response = self.alter(*args, **kwargs)
+ return self.wait(response)
+
+ @property
+ def altering_options(self):
+ return self.__altering_options
+
+ @abc.abstractmethod
+ def alter(self, *args, **kwargs):
+ pass
+
+
+class _DescribeOperation(_BaseSchemeOperation):
+ __metaclass__ = abc.ABCMeta
+
+ def __init__(self, client):
+ super(_DescribeOperation, self).__init__(client)
+ self.__describe_opts = SchemeDescribeRequest.Options()
+
+ @property
+ def describe_options(self):
+ return self.__describe_opts
+
+ def describe(self, path):
+ return self._send_request(
+ SchemeDescribeRequest(path, self.describe_options),
+ method='SchemeDescribe'
+ )
+
+
+class TenantOperations(_CreateOperation, _RemoveOperation, _DescribeOperation):
+ def __init__(self, client):
+ super(TenantOperations, self).__init__(client)
+ self.__creation_options = RegisterTenant.Options()
+ self.__removing_options = DropTenantRequest.Options()
+
+ @property
+ def creation_options(self):
+ return self.__creation_options
+
+ def create(self, path, options=None):
+ options = options or self.creation_options
+ return self._send_request(
+ RegisterTenant(path, options=options)
+ )
+
+ @property
+ def removing_options(self):
+ return self.__removing_options
+
+ def remove(self, path, options=None):
+ options = options or self.removing_options
+ # it's a trick
+ # because we have the different transaction in SS for that case
+ if options.drop_policy == flat_scheme_op.EDropAbortChanges:
+ return self._send_request(
+ ForceDropTenantRequest(path, options=options)
+ )
+ else:
+ return self._send_request(
+ DropTenantRequest(path, options=options)
+ )
+
+
+class PathOperations(_CreateOperation, _RemoveOperation, _DescribeOperation):
def __init__(self, client):
super(PathOperations, self).__init__(client)
-
+
def create(self, path):
return self._send_request(
CreatePath(path)
)
-
+
def remove(self, path):
return self._send_request(
DropPathRequest(path)
)
-
-
-class TableOperations(_CreateOperation, _RemoveOperation, _DescribeOperation):
- def __init__(self, client):
- super(TableOperations, self).__init__(client)
- self.describe_options.return_partition_info = True
- self.describe_options.return_partition_config = True
- self.__creation_options = CreateTableRequest.Options()
- self.__removing_options = DropTableRequest.Options()
-
- @property
- def creation_options(self):
- return self.__creation_options
-
- def create(self, path, options=None):
- options = options or self.creation_options
- return self._send_request(
- CreateTableRequest(path, options=options)
- )
- pass
-
- @property
- def removing_options(self):
- return self.__removing_options
-
- def remove(self, path, options=None):
- options = options or self.removing_options
- return self._send_request(
- DropTableRequest(path, options=options)
- )
-
-
-class PersQueueOperations(_CreateOperation, _RemoveOperation, _AlterOperation, _DescribeOperation):
- def __init__(self, client):
- super(PersQueueOperations, self).__init__(client)
- self.__creation_options = CreateTopicRequest.Options()
- self.__removing_options = DropTopicRequest.Options()
- self.__altering_options = AlterTopicRequest.Options()
-
- @property
- def creation_options(self):
- return self.__creation_options
-
- def create(self, path, options=None):
- options = options or self.creation_options
- return self._send_request(
- CreateTopicRequest(path, options=options)
- )
-
- @property
- def removing_options(self):
- return self.__removing_options
-
- def remove(self, path, options=None):
- options = options or self.removing_options
- return self._send_request(
- DropTopicRequest(path, options=options)
- )
-
- @property
- def altering_options(self):
- return self.__altering_options
-
- def alter(self, path, options=None):
- options = options or self.__altering_options
- return self._send_request(
- AlterTopicRequest(path, options=options)
- )
+
+
+class TableOperations(_CreateOperation, _RemoveOperation, _DescribeOperation):
+ def __init__(self, client):
+ super(TableOperations, self).__init__(client)
+ self.describe_options.return_partition_info = True
+ self.describe_options.return_partition_config = True
+ self.__creation_options = CreateTableRequest.Options()
+ self.__removing_options = DropTableRequest.Options()
+
+ @property
+ def creation_options(self):
+ return self.__creation_options
+
+ def create(self, path, options=None):
+ options = options or self.creation_options
+ return self._send_request(
+ CreateTableRequest(path, options=options)
+ )
+ pass
+
+ @property
+ def removing_options(self):
+ return self.__removing_options
+
+ def remove(self, path, options=None):
+ options = options or self.removing_options
+ return self._send_request(
+ DropTableRequest(path, options=options)
+ )
+
+
+class PersQueueOperations(_CreateOperation, _RemoveOperation, _AlterOperation, _DescribeOperation):
+ def __init__(self, client):
+ super(PersQueueOperations, self).__init__(client)
+ self.__creation_options = CreateTopicRequest.Options()
+ self.__removing_options = DropTopicRequest.Options()
+ self.__altering_options = AlterTopicRequest.Options()
+
+ @property
+ def creation_options(self):
+ return self.__creation_options
+
+ def create(self, path, options=None):
+ options = options or self.creation_options
+ return self._send_request(
+ CreateTopicRequest(path, options=options)
+ )
+
+ @property
+ def removing_options(self):
+ return self.__removing_options
+
+ def remove(self, path, options=None):
+ options = options or self.removing_options
+ return self._send_request(
+ DropTopicRequest(path, options=options)
+ )
+
+ @property
+ def altering_options(self):
+ return self.__altering_options
+
+ def alter(self, path, options=None):
+ options = options or self.__altering_options
+ return self._send_request(
+ AlterTopicRequest(path, options=options)
+ )
diff --git a/ydb/tests/library/nemesis/nemesis_core.py b/ydb/tests/library/nemesis/nemesis_core.py
index cd98418952b..6886982c23a 100644
--- a/ydb/tests/library/nemesis/nemesis_core.py
+++ b/ydb/tests/library/nemesis/nemesis_core.py
@@ -46,7 +46,7 @@ class NemesisProcess(threading.Thread):
self.__initial_sleep = initial_sleep
self.daemon = True
- self.__logger = logger.getChild(self.__class__.__name__)
+ self.__logger = logger.getChild(self.__class__.__name__)
@property
def __nemesis_list(self):
diff --git a/ydb/tests/library/nemesis/nemesis_network.py b/ydb/tests/library/nemesis/nemesis_network.py
index 518ba0b4e57..6d136964ac8 100644
--- a/ydb/tests/library/nemesis/nemesis_network.py
+++ b/ydb/tests/library/nemesis/nemesis_network.py
@@ -36,36 +36,36 @@ class NetworkNemesis(Nemesis):
for node_client in self.__node_ids_to_clients.values():
node_client.clear_all_drops()
self.__cur_affected_nodes = 0
-
-
-class DnsNemesis(Nemesis):
- def __init__(self, cluster, schedule=60, ssh_username=None, max_number_affected_nodes=1, probability=0.5):
- super(DnsNemesis, self).__init__(schedule)
- self.__cluster = cluster
- self.__ssh_username = ssh_username
- self.__max_number_affected_nodes = max_number_affected_nodes
- self.__probability = probability
- self.__node_ids_to_clients = {
- node_id: NetworkClient(node.host, port=node.ic_port, ssh_username=ssh_username)
- for node_id, node in cluster.nodes.items()
- }
- self.__cur_affected_nodes = 0
-
- def prepare_state(self):
- self.logger.info('Prepare state')
-
- def inject_fault(self):
- self.__cur_affected_nodes += 1
- if self.__cur_affected_nodes > self.__max_number_affected_nodes:
- self.extract_fault()
- return
-
- random_node_client = random.choice(self.__node_ids_to_clients.values())
- self.logger.info('Injecting fault with client = {client}'.format(client=random_node_client))
- random_node_client.isolate_dns()
-
- def extract_fault(self):
- self.logger.info('Extracting all faults')
- for node_client in self.__node_ids_to_clients.values():
- node_client.clear_all_drops()
- self.__cur_affected_nodes = 0
+
+
+class DnsNemesis(Nemesis):
+ def __init__(self, cluster, schedule=60, ssh_username=None, max_number_affected_nodes=1, probability=0.5):
+ super(DnsNemesis, self).__init__(schedule)
+ self.__cluster = cluster
+ self.__ssh_username = ssh_username
+ self.__max_number_affected_nodes = max_number_affected_nodes
+ self.__probability = probability
+ self.__node_ids_to_clients = {
+ node_id: NetworkClient(node.host, port=node.ic_port, ssh_username=ssh_username)
+ for node_id, node in cluster.nodes.items()
+ }
+ self.__cur_affected_nodes = 0
+
+ def prepare_state(self):
+ self.logger.info('Prepare state')
+
+ def inject_fault(self):
+ self.__cur_affected_nodes += 1
+ if self.__cur_affected_nodes > self.__max_number_affected_nodes:
+ self.extract_fault()
+ return
+
+ random_node_client = random.choice(self.__node_ids_to_clients.values())
+ self.logger.info('Injecting fault with client = {client}'.format(client=random_node_client))
+ random_node_client.isolate_dns()
+
+ def extract_fault(self):
+ self.logger.info('Extracting all faults')
+ for node_client in self.__node_ids_to_clients.values():
+ node_client.clear_all_drops()
+ self.__cur_affected_nodes = 0
diff --git a/ydb/tests/library/nemesis/network/client.py b/ydb/tests/library/nemesis/network/client.py
index b5aa1e685e8..784741462c4 100644
--- a/ydb/tests/library/nemesis/network/client.py
+++ b/ydb/tests/library/nemesis/network/client.py
@@ -40,29 +40,29 @@ class NetworkClient(object):
]
return self.__exec_command(drop_outgoing_command)
- def isolate_dns(self, probability=1.0):
- drop_input = [
- 'sudo', self.__iptables_bin, '-A', 'INPUT', '-p', 'udp', '--sport', '53',
- '-m', 'statistic', '--mode', 'random', '--probability', str(probability), '-j', 'DROP'
- ]
-
- drop_outout = [
- 'sudo', self.__iptables_bin, '-A', 'OUTPUT', '-p', 'udp', '--sport', '1024:65535', '--dport', '53',
- '-m', 'statistic', '--mode', 'random', '--probability', str(probability), '-j', 'DROP'
- ]
-
- reset_cache = [
- 'sudo', '/etc/init.d/bind9', 'restart'
- ]
-
- for cmd in [drop_input, drop_outout, reset_cache]:
- retcode = self.__exec_command(cmd)
- if retcode:
- logger.error("retcode %s for command %s", retcode, cmd)
- return retcode
-
- return 0
-
+ def isolate_dns(self, probability=1.0):
+ drop_input = [
+ 'sudo', self.__iptables_bin, '-A', 'INPUT', '-p', 'udp', '--sport', '53',
+ '-m', 'statistic', '--mode', 'random', '--probability', str(probability), '-j', 'DROP'
+ ]
+
+ drop_outout = [
+ 'sudo', self.__iptables_bin, '-A', 'OUTPUT', '-p', 'udp', '--sport', '1024:65535', '--dport', '53',
+ '-m', 'statistic', '--mode', 'random', '--probability', str(probability), '-j', 'DROP'
+ ]
+
+ reset_cache = [
+ 'sudo', '/etc/init.d/bind9', 'restart'
+ ]
+
+ for cmd in [drop_input, drop_outout, reset_cache]:
+ retcode = self.__exec_command(cmd)
+ if retcode:
+ logger.error("retcode %s for command %s", retcode, cmd)
+ return retcode
+
+ return 0
+
def isolate_node(self):
probability = 1.0
self.drop_incoming_packets(probability)
diff --git a/ydb/tests/library/predicates/executor.py b/ydb/tests/library/predicates/executor.py
index e22a020e54d..0573e32bde4 100644
--- a/ydb/tests/library/predicates/executor.py
+++ b/ydb/tests/library/predicates/executor.py
@@ -1,30 +1,30 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-import logging
-
-logger = logging.getLogger(__name__)
-
-
-def externals_blobs_count(monitor, tablet_id):
- tablet_counters = monitor.tabletcounters(tablet_id)['TabletCounters']
- simple_counters = tablet_counters['ExecutorCounters']['CumulativeCounters']
- for counter in simple_counters:
- if counter['Name'] == 'DbAnnexItemsGrow':
- return int(counter['Value'])
- return 0
-
-
-def external_blobs_is_present(monitor, tablets_ids):
- predicates = []
- for tablet_id in tablets_ids:
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+import logging
+
+logger = logging.getLogger(__name__)
+
+
+def externals_blobs_count(monitor, tablet_id):
+ tablet_counters = monitor.tabletcounters(tablet_id)['TabletCounters']
+ simple_counters = tablet_counters['ExecutorCounters']['CumulativeCounters']
+ for counter in simple_counters:
+ if counter['Name'] == 'DbAnnexItemsGrow':
+ return int(counter['Value'])
+ return 0
+
+
+def external_blobs_is_present(monitor, tablets_ids):
+ predicates = []
+ for tablet_id in tablets_ids:
value = externals_blobs_count(monitor, tablet_id)
- case = value > 0
- log_func = logger.debug if case else logger.error
- log_func(
- "tablet_id is %s TabletCounters.ExecutorCounters.CumulativeCounters.DbAnnexItemsGrow is %s",
- tablet_id,
- value
- )
- predicates.append(case)
- return all(predicates)
+ case = value > 0
+ log_func = logger.debug if case else logger.error
+ log_func(
+ "tablet_id is %s TabletCounters.ExecutorCounters.CumulativeCounters.DbAnnexItemsGrow is %s",
+ tablet_id,
+ value
+ )
+ predicates.append(case)
+ return all(predicates)